(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{20:function(e,t,n){e.exports=n(37)},27:function(e,t,n){},31:function(e,t,n){},32:function(e,t,n){},35:function(e,t,n){},36:function(e,t,n){},37:function(e,t,n){"use strict";n.r(t);var a=n(1),i=n(2),r=function(e){return"object"==typeof e&&!(e instanceof Array)&&e instanceof Object},s=function(e){return"function"==typeof e},l=function(e){return"string"==typeof e},o=n(4),u=n.n(o),c=new(function(){function e(){Object(a.a)(this,e),this.debugMode=void 0,this.handlers=void 0,this.errorHandler=void 0,this.handlers=[],this.debugMode=!1,this.errorHandler=null}return Object(i.a)(e,[{key:"execute",value:function(e){u.a.debug("Executing command: ".concat(e));var t=e.trim().toLowerCase(),n=this.findHandler(t);if(null!=n)if(this.debugMode)this.invokeHandler(t,n);else try{this.invokeHandler(t,n)}catch(a){this.handleError(t,a)}else u.a.debug("Handled is not found for command: ".concat(e)),this.handleError(t,new Error("Unsupported expression: "+t.trim()))}},{key:"onError",value:function(e){this.errorHandler=e}},{key:"command",value:function(e,t){var n=this.createHandler(e,t);null!=n?s(n.canHandle)?s(n.handle)?this.handlers.push(n):console.warn('handler is missing "handle" function. registration denied.'):console.warn('handler is missing "canHandle" function. registration denied.'):console.warn("unexpected set of arguments: ",JSON.stringify(arguments))}},{key:"createHandler",value:function(e,t){return r(e)?e:l(e)?{canHandle:function(t){return t===e},handle:t}:null}},{key:"findHandler",value:function(e){return this.handlers.filter(function(t){return t.canHandle(e)})[0]}},{key:"invokeHandler",value:function(e,t){var n=t.handle({input:e});null!=n&&u.a.debug(n)}},{key:"handleError",value:function(e,t){this.debugMode&&console.error(e,t),null!=this.errorHandler&&this.errorHandler(e,t)}}]),e}()),m=n(6),d=n(5),h=n(7),p=n(0),f=n.n(p),g=function(e){function t(e){var n;return Object(a.a)(this,t),(n=Object(m.a)(this,Object(d.a)(t).call(this,e))).history=void 0,n.historyIndex=void 0,n.nameInput=void 0,n.nameInput=null,n.history=[],n.historyIndex=-1,n}return Object(h.a)(t,e),Object(i.a)(t,[{key:"componentDidMount",value:function(){null!=this.nameInput&&this.nameInput.focus()}},{key:"render",value:function(){var e=this;return f.a.createElement("input",{id:"in",type:"text",ref:function(t){e.nameInput=t},onKeyUp:function(t){return e.onKeyUp(t)},onKeyDown:function(t){return e.onKeyDown(t)},className:"expressionInput mono",placeholder:"type expression like '1>>2' or 'help' "})}},{key:"onKeyUp",value:function(e){var t=e.target;if(13==e.keyCode&&0!=t.value.trim().length){var n=t.value;this.history.unshift(n),this.historyIndex=-1,t.value="",this.props.onCommandEntered(n)}}},{key:"onKeyDown",value:function(e){if(38==e.keyCode){var t=this.historyIndex+1;return this.history.length>t&&(e.target.value=this.history[t],this.historyIndex=t),void e.preventDefault()}40==e.keyCode&&(this.historyIndex>0&&(e.target.value=this.history[--this.historyIndex]),e.preventDefault())}}]),t}(f.a.Component),v=function(e){function t(){return Object(a.a)(this,t),Object(m.a)(this,Object(d.a)(t).apply(this,arguments))}return Object(h.a)(t,e),Object(i.a)(t,[{key:"render",value:function(){return f.a.createElement("div",{className:"result"},f.a.createElement("div",{className:"input mono"},f.a.createElement("span",{className:"cur"},">"),this.props.input,f.a.createElement("a",{className:"hashLink",title:"Link for this expression",href:window.location.pathname+"#"+this.props.inputHash},"#")),f.a.createElement("div",{className:"content"},this.props.children))}}]),t}(f.a.Component);var b=function(e){var t=[],n=e.appState;return"prod"!=e.appState.env&&t.push(n.env),e.appState.debugMode&&t.push("debug"),"false"===localStorage.getItem("TrackAnalytics")&&t.push("notrack"),0==t.length?null:f.a.createElement("div",null,t.map(function(e){return f.a.createElement("span",null,e,"\xa0")}))},E={encodeHash:function(e){return encodeURIComponent(e.trim().replace(/\s/g,","))},decodeHash:function(e){return decodeURIComponent(e.replace(/^\#/,"")).replace(/,/g," ")},getArgs:function(e){var t,n=this.decodeHash(e),a=[];return(t=n,t.split("||").filter(function(e){return e.length>0})).forEach(function(e){a.push(e)}),a}};var y=n(12),x=n(17),B=n(13);n(27);var k=function(){return f.a.createElement("ul",{className:"top-links"},f.a.createElement("li",null,f.a.createElement("a",{href:"https://github.com/BorisLevitskiy/BitwiseCmd"},f.a.createElement(y.a,{className:"icon",icon:B.a,size:"lg"}),"Project on GitHub")),f.a.createElement("li",null,f.a.createElement("a",{href:"https://twitter.com/BitwiseCmd"},f.a.createElement(y.a,{className:"icon",icon:B.b,size:"lg"}),f.a.createElement("span",{className:"link-text"},"Twitter"))),f.a.createElement("li",null,f.a.createElement("a",{href:"mailto:bitwisecmd@gmail.com?subject=Feedback"},f.a.createElement(y.a,{className:"icon",icon:x.a,size:"lg"}),f.a.createElement("span",{className:"link-text"},"Send Feedback"))))},w=function(e){function t(){return Object(a.a)(this,t),Object(m.a)(this,Object(d.a)(t).apply(this,arguments))}return Object(h.a)(t,e),Object(i.a)(t,[{key:"componentWillMount",value:function(){var e=this;this.refresh(),this.props.appState.onChange(function(){return e.refresh()})}},{key:"refresh",value:function(){this.setState(this.props.appState)}},{key:"getIndicator",value:function(e){return e?"on":"off"}},{key:"getResultViews",value:function(){var e=this;return this.state.commandResults.map(function(t,n){return f.a.createElement(v,{key:t.key,input:t.input,inputHash:E.encodeHash(t.input),appState:e.props.appState},t.view)})}},{key:"toggleEmphasizeBytes",value:function(){this.props.appState.toggleEmphasizeBytes()}},{key:"render",value:function(){var e=this;return f.a.createElement("div",{className:"app-root ".concat(this.state.uiTheme)},f.a.createElement(b,{appState:this.props.appState}),f.a.createElement("div",{className:"header"},f.a.createElement("h1",null,"Bitwise",f.a.createElement("span",{className:"header-cmd"},"Cmd")),f.a.createElement(k,null)),f.a.createElement("div",{className:"expressionInput-container"},f.a.createElement(g,{onCommandEntered:function(e){return c.execute(e)}}),f.a.createElement("span",{className:"configPnl"},f.a.createElement("span",{id:"emphasizeBytes","data-cmd":"em",className:"indicator "+this.getIndicator(this.state.emphasizeBytes),title:"Toggle Emphasize Bytes",onClick:function(){return e.toggleEmphasizeBytes()}},"[em]"))),f.a.createElement("div",{id:"output"},this.getResultViews()))}}]),t}(f.a.Component),O=n(18),_=n.n(O);n(31);var N=function(e){return f.a.createElement("div",{className:"result"},f.a.createElement("div",{className:"error"},e.errorMessage))},S={formatString:function(e,t){return e.toString(function(e){switch(e){case"bin":return 2;case"hex":return 16;case"dec":return 10}throw new Error("Unsupported kind: "+e)}(t||"bin"))},padLeft:function(e,t,n){var a=Array.prototype.slice.call(e);n=n||"0";if(null==t)return e;for(;t>a.length;)a.unshift(n);return a.join("")}};var C=function(e){function t(){return Object(a.a)(this,t),Object(m.a)(this,Object(d.a)(t).apply(this,arguments))}return Object(h.a)(t,e),Object(i.a)(t,[{key:"render",value:function(){return f.a.createElement("span",{className:this.props.className},this.getChildren())}},{key:"onBitClick",value:function(e,t){if(this.props.allowFlipBits&&this.props.onFlipBit){this.props.onFlipBit;var n=this.props.binaryString.split("");n[e]="0"==n[e]?"1":"0";var a=n.join("");this.props.onFlipBit({index:e,binaryString:this.props.binaryString,$event:t,newBinaryString:a})}}},{key:"getChildren",value:function(){var e=this.createBits(this.props.binaryString.split(""));return this.props.emphasizeBytes?this.splitIntoBytes(e):e}},{key:"createBits",value:function(e){var t=this,n=this.props.allowFlipBits||!1?" flipable":"";return e.map(function(e,a){var i="0"==e?"zero".concat(n):"one".concat(n);return f.a.createElement("span",{className:i,key:a,onClick:function(e){return t.onBitClick(a,e)}},e)})}},{key:"splitIntoBytes",value:function(e){for(var t=[],n=0;e.length>0;)t.push(f.a.createElement("span",{key:n++,className:"byte"},e.splice(0,8)));return t}}]),t}(f.a.Component);n(32);var I=function(e){function t(){return Object(a.a)(this,t),Object(m.a)(this,Object(d.a)(t).apply(this,arguments))}return Object(h.a)(t,e),Object(i.a)(t,[{key:"render",value:function(){return 1===this.props.ipAddresses.length?this.renderSingleIp(this.props.ipAddresses[0]):this.renderMultipleIps()}},{key:"renderMultipleIps",value:function(){var e=this;return f.a.createElement("table",{className:"expression"},f.a.createElement("tbody",null,this.props.ipAddresses.map(function(t,n){return f.a.createElement("tr",{key:n},f.a.createElement("td",{className:"label"},f.a.createElement("strong",null,t.toString())),f.a.createElement("td",{className:"bin"},e.bin(t.firstByte,1,t),f.a.createElement("span",{className:"soft"},"."),e.bin(t.secondByte,2,t),f.a.createElement("span",{className:"soft"},"."),e.bin(t.thirdByte,3,t),f.a.createElement("span",{className:"soft"},"."),e.bin(t.fourthByte,4,t)))})))}},{key:"renderSingleIp",value:function(e){return f.a.createElement("table",{className:"expression"},f.a.createElement("thead",null,f.a.createElement("tr",null,f.a.createElement("th",{className:"first-decimal"},e.firstByte),f.a.createElement("th",{className:"second-decimal"},e.secondByte),f.a.createElement("th",{className:"third-decimal"},e.thirdByte),f.a.createElement("th",{className:"fourth-decimal"},e.fourthByte))),f.a.createElement("tbody",null,f.a.createElement("tr",null,f.a.createElement("td",{className:"first-bin"},this.bin(e.firstByte,1,e)),f.a.createElement("td",{className:"second-bin"},this.bin(e.secondByte,2,e)),f.a.createElement("td",{className:"third-bin"},this.bin(e.thirdByte,3,e)),f.a.createElement("td",{className:"fourth-bin"},this.bin(e.fourthByte,4,e)))))}},{key:"bin",value:function(e,t,n){var a,i=this;return f.a.createElement(C,{binaryString:(a=e,S.padLeft(S.formatString(a,"bin"),8,"0")),key:t,emphasizeBytes:!1,allowFlipBits:!0,className:"octet-".concat(t),onFlipBit:function(e){return i.onFlippedBit(e.newBinaryString,t,n)}})}},{key:"onFlippedBit",value:function(e,t,n){n.setOctet(t,parseInt(e,2)),this.forceUpdate()}}]),t}(f.a.Component),M={parse:function(e){var t=this,n=this.getMaches(e),a=n.filter(function(e){return null!=e.matches}),i=n.filter(function(e){return null==e.matches});if(0==a.length)return null;if(i.length>0)return new j("Value(s) ".concat(i.map(function(e){return e.input}).join(",")," was not recognized as valid ip address or ip address with a subnet mask"));var r=n.map(function(e){return t.parseSingle(e.matches,e.input)}),s=r.filter(function(e){return e instanceof j});return s.length>0?s[0]:r},getMaches:function(e){return e.replace(/[\t\s]+/g," ").split(" ").filter(function(e){return e.length>0}).map(function(e){var t=/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})(\/\d+)?$/.exec(e);return null==t||0===t.length?{matches:null,input:e}:{matches:t,input:e}})},parseSingle:function(e,t){var n=function(e){return e<0||e>255},a=parseInt(e[1]),i=parseInt(e[2]),r=parseInt(e[3]),s=parseInt(e[4]);if(n(a)||n(i)||n(r)||n(s))return new j("".concat(t," value doesn't fall within the valid range of the IP address space"));var l=new z(a,i,r,s);if(e[5]){var o=e[5].substr(1),u=parseInt(o);return u>32?new j("Subnet mask value in ".concat(t," is out of range")):new R(l,u)}return l}},j=function e(t){Object(a.a)(this,e),this.errorMessage=void 0,this.errorMessage=t},R=function(){function e(t,n){Object(a.a)(this,e),this.maskBits=void 0,this.ipAddress=void 0,this.ipAddress=t,this.maskBits=n}return Object(i.a)(e,[{key:"toString",value:function(){return"".concat(this.ipAddress.toString(),"/").concat(this.maskBits)}},{key:"createSubnetMaskIp",value:function(){var e=function(e){return 255<<8-e&255};return this.maskBits<=8?new z(e(this.maskBits),0,0,0):this.maskBits<=16?new z(255,e(this.maskBits-8),0,0):this.maskBits<=24?new z(255,255,e(this.maskBits-16),0):new z(255,255,255,e(this.maskBits-24))}}]),e}(),z=function(){function e(t,n,i,r){Object(a.a)(this,e),this.firstByte=void 0,this.secondByte=void 0,this.thirdByte=void 0,this.fourthByte=void 0,this.firstByte=t,this.secondByte=n,this.thirdByte=i,this.fourthByte=r}return Object(i.a)(e,[{key:"toString",value:function(){return"".concat(this.firstByte,".").concat(this.secondByte,".").concat(this.thirdByte,".").concat(this.fourthByte)}},{key:"setOctet",value:function(e,t){switch(e){case 1:this.firstByte=t;break;case 2:this.secondByte=t;break;case 3:this.thirdByte=t;break;case 4:this.fourthByte=t}}}]),e}(),L={setup:function(e,t){t.command({canHandle:function(e){return null!=M.parse(e)},handle:function(t){var n=M.parse(t.input);if(null!=n)if(n instanceof j)e.addCommandResult(t.input,f.a.createElement(N,{errorMessage:n.errorMessage}));else{var a=[];n.forEach(function(e){e instanceof R?(a.push(e.ipAddress),a.push(e.createSubnetMaskIp())):e instanceof z&&a.push(e)}),e.addCommandResult(t.input,f.a.createElement(I,{ipAddresses:a}))}}}),u.a.debug()}},D=n(8),F=n(9),H=function(){function e(t,n){Object(a.a)(this,e),this.numbers=void 0,this.expressionString=void 0,this.maxBitsLength=void 0,this.expressionString=t,this.numbers=n,this.maxBitsLength=n.map(function(e){return e.lengthInBits}).reduce(function(e,t){return e>=t?e:t},0)}return Object(i.a)(e,[{key:"toString",value:function(){return this.numbers.map(function(e){return e.value.toString()}).join(" ")}}]),e}(),P=function e(t,n){Object(a.a)(this,e),this.expressionString=void 0,this.expressionItems=void 0,this.expressionString=t,this.expressionItems=n},U=function(){function e(){Object(a.a)(this,e),this.factories=void 0,this.factories=[]}return Object(i.a)(e,[{key:"canParse",value:function(e){for(var t=e.replace(/^\s+|\s+$/,""),n=this.factories.length-1;n>=0;n--)if(!0===this.factories[n].canCreate(t))return!0;return!1}},{key:"parse",value:function(e){for(var t,n=e.replace(/^\s+|\s+$/,""),a=0,i=this.factories.length;a0&&n.push(D.a.parse(e.trim()))}),new H(e,n)}}]),e}(),T=function(){function e(){Object(a.a)(this,e),this.fullRegex=void 0,this.regex=void 0,this.fullRegex=/^((<<|>>|>>>|\||\&|\^)?(~?-?([b,x,a-f,0-9]+)))+$/,this.regex=/(<<|>>|>>>|\||\&|\^)?(~?-?(?:[b,x,a-f,0-9]+))/g}return Object(i.a)(e,[{key:"canCreate",value:function(e){return this.fullRegex.lastIndex=0,this.fullRegex.test(this.normalizeString(e))}},{key:"create",value:function(e){for(var t,n=[],a=this.normalizeString(e);null!=(t=this.regex.exec(a));)n.push(this.parseMatch(t));return new P(a,n)}},{key:"parseMatch",value:function(e){var t=e[0],n=e[1],a=e[2],i=null;return i=0==a.indexOf("~")?new F.a(a,D.a.parse(a.substring(1)),"~"):D.a.parse(a),null==n?i:new F.a(t,i,n)}},{key:"normalizeString",value:function(e){return e.replace(/\s+/g,"")}}]),e}(),K=new U;K.addFactory(new A),K.addFactory(new T);var V=function(){function e(t){var n=t.emphasizeBytes,i=void 0!==n&&n,r=t.allowFlipBits,s=void 0!==r&&r;Object(a.a)(this,e),this.emphasizeBytes=void 0,this.items=void 0,this.maxNumberOfBits=void 0,this.allowFlipBits=void 0,this.emphasizeBytes=i,this.items=[],this.maxNumberOfBits=0,this.allowFlipBits=!0===s}return Object(i.a)(e,[{key:"addOperandRow",value:function(e){this.maxNumberOfBits=Math.max(e.getLengthInBits(),this.maxNumberOfBits),this.items.push({sign:"",css:"",expressionItem:e,allowFlipBits:this.allowFlipBits,label:""})}},{key:"addExpressionOperandRow",value:function(e){var t=e.isNotExpression?e.evaluate():e.getUnderlyingOperand();this.maxNumberOfBits=Math.max(t.getLengthInBits(),this.maxNumberOfBits),this.items.push({sign:e.sign,css:"",label:this.getLabel(t),expressionItem:e.operand,allowFlipBits:this.allowFlipBits})}},{key:"addShiftExpressionResultRow",value:function(e,t){this.maxNumberOfBits=Math.max(t.getLengthInBits(),this.maxNumberOfBits),this.items.push({sign:e.sign+e.operand.toString(),css:"expression-result",expressionItem:t,allowFlipBits:!1,label:""})}},{key:"addExpressionResultRow",value:function(e){this.maxNumberOfBits=Math.max(e.getLengthInBits(),this.maxNumberOfBits),this.items.push({sign:"=",css:"expression-result",expressionItem:e,allowFlipBits:!1,label:""})}},{key:"getLabel",value:function(e){return"bin"==e.base?e.toString("dec"):e.toString()}}],[{key:"buildListOfNumbers",value:function(t,n){var a=new e(n);return t.numbers.forEach(function(e){return a.addOperandRow(e)}),a.maxNumberOfBits=e.getNumberOfBits(a.maxNumberOfBits,a.emphasizeBytes),a}},{key:"buildMultiple",value:function(t,n){t.expressionItems[0];for(var a,i=0,r=t.expressionItems.length,s=new e(n),l=null;i>")," \u2014 sign propagating right shift"),f.a.createElement("li",null,f.a.createElement("code",null,">>>")," \u2014 zero-fill right shift"))),f.a.createElement("div",{className:"section"},f.a.createElement("strong",{className:"section-title soft"},"Tip"),f.a.createElement("p",null,"You can click on bits to flip them in number inputs (e.g. ",f.a.createElement(X,{text:"2 4"}),") or IP addresses (e.g. ",f.a.createElement(X,{text:"192.168.0.0/8"}),")")))))};var Z=function(e){return f.a.createElement("p",null,e.text)};n(36);var ee=function(){return f.a.createElement("div",{className:"changelog"},f.a.createElement("h3",null,"Changelog"),f.a.createElement("div",{className:"item item-new"},f.a.createElement("p",null,f.a.createElement("span",{className:"soft date"},"Jun 14th, 2021")," ",f.a.createElement("br",null),"Added support of ip addresses and subnet masks notatioans. Try them out:"),f.a.createElement("ul",null,f.a.createElement("li",null,"Single IP address ",f.a.createElement(X,{text:"127.0.0.1"})),f.a.createElement("li",null,"Multiple IP addresses and subnet mask notations ",f.a.createElement(X,{text:"127.0.0.1 192.168.0.0/24"})))),f.a.createElement("div",{className:"item"},f.a.createElement("p",null,f.a.createElement("span",{className:"soft date"},"Jun 6th, 2017")," ",f.a.createElement("br",null),"Added ",f.a.createElement("code",null,f.a.createElement(X,{text:"guid"}))," command. Use it for generating v4 GUIDs ")),f.a.createElement("div",{className:"item"},f.a.createElement("p",null,f.a.createElement("span",{className:"soft date"},"May 27th, 2017")," ",f.a.createElement("br",null),"Added support of binary number notation (e.g. ",f.a.createElement("code",null,f.a.createElement(X,{text:"0b10101"})),"). ")),f.a.createElement("div",{className:"item"},f.a.createElement("p",null,f.a.createElement("span",{className:"soft"},"May 20th, 2017")," ",f.a.createElement("br",null),"New ",f.a.createElement(X,{text:"Midnight"})," theme added. ")),f.a.createElement("div",{className:"item"},f.a.createElement("p",null,f.a.createElement("span",{className:"soft"},"May 16th, 2017")," ",f.a.createElement("br",null),"Complete rewrite using React. Old implementation is available at ",f.a.createElement("a",{href:"http://bitwisecmd.com/old"},"http://bitwisecmd.com/old"),". Please let me know if you have problems with this release by ",f.a.createElement("a",{href:"https://github.com/BorysLevytskyi/BitwiseCmd/issues"},"creating issue")," in Github Repo.")))},te={setup:function(e,t){t.debugMode=e.debugMode,e.onChange(function(){return t.debugMode=e.debugMode}),t.command("help",function(t){return e.addCommandResult(t.input,f.a.createElement(Q,null))}),t.command("clear",function(){return e.clearCommandResults()}),t.command("em",function(){return e.toggleEmphasizeBytes()}),t.command("dark",function(){return e.setUiTheme("dark")}),t.command("light",function(){return e.setUiTheme("light")}),t.command("midnight",function(){return e.setUiTheme("midnight")}),t.command("about",function(t){return e.addCommandResult(t.input,f.a.createElement(Y,null))}),t.command("whatsnew",function(t){return e.addCommandResult(t.input,f.a.createElement(ee,null))}),t.command("guid",function(t){return e.addCommandResult(t.input,f.a.createElement(Z,{text:G()()}))}),t.command("-notrack",function(){}),t.command("-debug",function(t){e.toggleDebugMode(),e.addCommandResult(t.input,f.a.createElement(Z,{text:"Debug Mode: ".concat(e.debugMode)}))}),t.onError(function(t,n){return e.addCommandResult(t,f.a.createElement(N,{errorMessage:n.toString()}))})}},ne=5,ae=function(){function e(t,n){Object(a.a)(this,e),this.version=ne,this.emphasizeBytes=void 0,this.debugMode=!1,this.uiTheme=void 0,this.changeHandlers=void 0,this.commandResults=void 0,this.persistedVersion=void 0,this.wasOldVersion=void 0,this.env=void 0,this.commandResults=[],this.changeHandlers=[],this.uiTheme=t.uiTheme||"midnight",this.env=n,this.emphasizeBytes=t.emphasizeBytes||!0,this.persistedVersion=t.version||.1,this.wasOldVersion=null!=t.version&&this.version>this.persistedVersion,this.debugMode="prod"!==n||!0===t.debugMode}return Object(i.a)(e,[{key:"addCommandResult",value:function(e,t){var n=Math.ceil(1e7*Math.random())^Date.now();this.commandResults.unshift({key:n,input:e,view:t}),u.a.debug("command result added: ".concat(e)),this.triggerChanged()}},{key:"clearCommandResults",value:function(){this.commandResults=[],this.triggerChanged()}},{key:"toggleEmphasizeBytes",value:function(){this.emphasizeBytes=!this.emphasizeBytes,this.triggerChanged()}},{key:"onChange",value:function(e){this.changeHandlers.push(e)}},{key:"triggerChanged",value:function(){var e=this;this.changeHandlers.forEach(function(t){return t(e)})}},{key:"setUiTheme",value:function(e){this.uiTheme=e,this.triggerChanged()}},{key:"toggleDebugMode",value:function(){this.debugMode=!this.debugMode,this.triggerChanged()}},{key:"getPersistData",value:function(){return{emphasizeBytes:this.emphasizeBytes,uiTheme:this.uiTheme,version:this.version,debugMode:this.debugMode}}}]),e}();var ie={getPersistedData:function(){var e=window.localStorage.getItem("AppState");if(!e)return{};try{return JSON.parse(e)}catch(t){return console.error("Failed to parse AppState json. Json Value: \n"+e,t),{}}},watch:function(e){var t=this;e.onChange(function(){return t.persistData(e)})},persistData:function(e){localStorage.setItem("AppState",JSON.stringify(e.getPersistData()))}};var re=function(e){return f.a.createElement("div",{className:"result"},f.a.createElement("div",{className:"error"},"\xaf\\_(\u30c4)_/\xaf Sorry, i don\u2032t know what ",f.a.createElement("strong",null,e.input)," is"))},se=function(){var e="bitwisecmd.com"===window.location.host?"prod":"stage";!function(e){"prod"!=e?(u.a.setLevel("debug"),u.a.debug("Log level is set to debug. Env: ".concat(e))):u.a.setLevel("warn")}(e);var t=function(e){var t=ie.getPersistedData(),n=new ae(t,e);return ie.watch(n),u.a.debug("appState initialized",n),n}(e);return{appState:t,startupCommands:function(e){var t=E.getArgs(window.location.hash),n=["help","127.0.0.1 192.168.0.0/8","1|2&6","4 0b1000000 0x80"];return e.wasOldVersion&&(n=["whatsnew"]),t.length>0&&(n=t),u.a.debug("Executing startup commands",n),n}(t)}}();te.setup(se.appState,c),L.setup(se.appState,c),W.setup(se.appState,c),c.command({canHandle:function(){return!0},handle:function(e){return se.appState.addCommandResult(e.input,f.a.createElement(re,{input:e.input}))}});var le=f.a.createElement(w,{appState:se.appState});_.a.render(le,document.getElementById("root")),u.a.debug("Executing startup commands",se.startupCommands),se.startupCommands.forEach(c.execute.bind(c)),u.a.debug("started")},8:function(e,t,n){"use strict";var a=n(1),i=n(2),r=[{regex:/^-?\d+$/,radix:10,base:"dec",prefix:"^$"},{regex:/^-?0x[0-9,a-f]+$/i,radix:16,base:"hex",prefix:/0x/i},{regex:/^-?0b[0-1]+$/i,radix:2,base:"bin",prefix:/0b/i}],s=new(function(){function e(t){Object(a.a)(this,e),this.parsers=void 0,this.parsers=t}return Object(i.a)(e,[{key:"parse",value:function(e){var t=this;return this.parsers.map(function(n){return t.applyParser(n,e)}).reduce(function(e,t){return e||t})}},{key:"parseOperator",value:function(e){var t=e.match(e);return null==t||0==t.length?null:t[0]}},{key:"applyParser",value:function(e,t){return e.regex.test(t)?{value:parseInt(t.replace(e.prefix,""),e.radix),base:e.base,input:t}:null}}]),e}())(r);n.d(t,"a",function(){return o});var l=1,o=function(){function e(t,n){Object(a.a)(this,e),this.id=void 0,this.value=void 0,this.base=void 0,this.lengthInBits=void 0,this.isExpression=void 0,this.id=l++,this.value=t,this.base=n||"dec",this.lengthInBits=e.getBitLength(this.value),this.isExpression=!1}return Object(i.a)(e,[{key:"getLengthInBits",value:function(){return this.value<0?32:Math.floor(Math.log(this.value)/Math.log(2))+1}},{key:"getOtherBase",value:function(e){switch(e||this.base){case"dec":case"bin":return"hex";case"hex":return"dec";default:throw new Error(e+" kind doesn't have opposite kind")}}},{key:"toString",value:function(t){return e.toBaseString(this.value,t||this.base)}},{key:"toOtherKindString",value:function(){return this.toString(this.getOtherBase())}},{key:"toDecimalString",value:function(){return this.toString("dec")}},{key:"toHexString",value:function(){return this.toString("hex")}},{key:"toBinaryString",value:function(){return this.toString("bin")}},{key:"setValue",value:function(t){this.value=t,this.lengthInBits=e.getBitLength(t)}},{key:"evaluate",value:function(){return this}},{key:"getUnderlyingOperand",value:function(){return this}}],[{key:"getBitLength",value:function(e){return Math.floor(Math.log(e)/Math.log(2))+1}},{key:"getBase",value:function(e){switch(e){case"bin":return 2;case"hex":return 16;case"dec":return 10}}},{key:"create",value:function(t,n){return new e(t,n||"dec")}},{key:"parse",value:function(t){var n=s.parse(t);if(!n)throw new Error(t+" is not a valid number");return new e(n.value,n.base)}},{key:"toBaseString",value:function(e,t){switch(t){case"hex":var n=Math.abs(e).toString(16);return e>=0?"0x"+n:"-0x"+n;case"bin":return(e>>>0).toString(2);case"dec":return e.toString(10);default:throw new Error("Unexpected kind: "+t)}}},{key:"toHexString",value:function(e){return 0===e.indexOf("-")?"-0x"+e.substr(1):"0x"+e}}]),e}()},9:function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",function(){return ExpressionOperand});var D_MyStuff_Pet_BitwiseCmd_node_modules_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(1),D_MyStuff_Pet_BitwiseCmd_node_modules_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(2),_NumericOperand__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(8),ExpressionOperand=function(){function ExpressionOperand(e,t,n){Object(D_MyStuff_Pet_BitwiseCmd_node_modules_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__.a)(this,ExpressionOperand),this.expressionString=void 0,this.operand=void 0,this.sign=void 0,this.isExpression=void 0,this.isShiftExpression=void 0,this.isNotExpression=void 0,this.expressionString=e,this.operand=t,this.sign=n,this.isExpression=!0,this.isShiftExpression=this.sign.indexOf("<")>=0||this.sign.indexOf(">")>=0,this.isNotExpression="~"===this.sign}return Object(D_MyStuff_Pet_BitwiseCmd_node_modules_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__.a)(ExpressionOperand,[{key:"evaluate",value:function evaluate(operand){if(operand instanceof ExpressionOperand)throw new Error("value shouldnt be expression");var evaluatedOperand=this.operand.evaluate(),str="";if("~"==this.sign)str="~"+evaluatedOperand.value;else{if(null==operand)throw new Error("Other is required for expression: "+this.expressionString);str=operand.value+this.sign+evaluatedOperand.value}return _NumericOperand__WEBPACK_IMPORTED_MODULE_2__.a.create(eval(str),evaluatedOperand.base)}},{key:"getUnderlyingOperand",value:function(){return this.operand.getUnderlyingOperand()}},{key:"toString",value:function(){return this.sign+this.operand.toString()}}]),ExpressionOperand}()}},[[20,1,2]]]); //# sourceMappingURL=main.b8debf08.chunk.js.map