mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-20 04:09:41 +00:00
6 lines
150 KiB
JavaScript
6 lines
150 KiB
JavaScript
!function e(t,n,i){function r(a,s){if(!n[a]){if(!t[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[a]={exports:{}};t[a][0].call(u.exports,function(e){var n=t[a][1][e];return r(n||e)},u,u.exports,e,t,n,i)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<i.length;a++)r(i[a]);return r}({1:[function(e,t,n){"use strict";function i(){if(!d){d=!0,o.r2Settings.loadAll();var e=new l.WidgetFactory;a.uiContext.init(e,"content","ruler","title"),a.uiContext.navigateTo(u.Widgets.OVERVIEW),r("demo_avatar",function(){return a.uiContext.navigateTo(u.Widgets.OVERVIEW)}),r("menu_overview",function(){return a.uiContext.navigateTo(u.Widgets.OVERVIEW)}),r("menu_disasm",function(){return a.uiContext.navigateTo(u.Widgets.DISASSEMBLY)}),r("menu_hexdump",function(){return a.uiContext.navigateTo(u.Widgets.HEXDUMP)}),r("menu_debug",function(){return a.uiContext.navigateTo(u.Widgets.DEBUGGER)}),r("menu_functions",function(){return a.uiContext.navigateTo(u.Widgets.FUNCTIONS)}),r("menu_flags",function(){return a.uiContext.navigateTo(u.Widgets.FLAGS)}),r("menu_search",function(){return a.uiContext.navigateTo(u.Widgets.SEARCH)}),r("menu_script",function(){return a.uiContext.navigateTo(u.Widgets.SCRIPTS)}),r("menu_comments",function(){return a.uiContext.navigateTo(u.Widgets.COMMENTS)}),r("menu_help",function(){return alert("todo")}),r("menu_seek",function(){return o.r2Wrapper.seek()}),r("menu_settings",function(){return a.uiContext.navigateTo(u.Widgets.SETTINGS)}),r("menu_about",function(){r2.cmd("?V",function(e){alert("radare2 material webui by --pancake @ 2015-2017\n\n"+e.trim())})}),r("menu_mail",function(){window.location="mailto:pancake@nopcode.org"}),r("layout_single",function(){return a.uiContext.merge()}),r("layout_vertical",function(){return a.uiContext.split(c.Layouts.VERTICAL)});new s.Autocompletion("search","search_autocomplete","fs *;fj").setPrepareView(function(){a.uiContext.isSplitted||a.uiContext.split(c.Layouts.VERTICAL),a.uiContext.navigateTo(u.Widgets.DISASSEMBLY)}),document.querySelector(".mdl-layout__drawer").addEventListener("click",function(){document.querySelector(".mdl-layout__obfuscator").classList.remove("is-visible"),this.classList.remove("is-visible")},!1)}}function r(e,t){var n=document.getElementById(e);n?n.addEventListener("click",function(){t()}):console.error("onclick-error",e)}var o=e("./core/R2Wrapper"),a=e("./core/UIContext"),s=e("./helpers/Autocompletion"),c=(e("./layout/ContainerZone"),e("./layout/Layouts")),l=e("./widgets/WidgetFactory"),u=e("./widgets/Widgets"),d=!1;window.onload=i,document.addEventListener("DOMContentLoaded",i,!1),document.body.onkeypress=function(e){if(e.ctrlKey){var t=[];e.charCode==="o".charCodeAt(0)&&o.r2Wrapper.seek();var n=e.charCode-48;if(n>=0&&n<t.length){var i=t[n];i&&i()}}}},{"./core/R2Wrapper":5,"./core/UIContext":7,"./helpers/Autocompletion":8,"./layout/ContainerZone":15,"./layout/Layouts":17,"./widgets/WidgetFactory":51,"./widgets/Widgets":52}],2:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0}),n.BlockNavigator=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=e("./ChunkStatus"),a=e("./NavigatorDirection");n.BlockNavigator=function(){function e(){i(this,e)}return r(e,[{key:"init",value:function(){if(void 0===this.providerWorker)return void console.log("provider worker should be defined");this.configureWorker_()}},{key:"configureWorker_",value:function(){var e=this;this.providerWorker.onmessage=function(t){if(t.data.dir===a.NavigatorDirection.CURRENT){if(void 0!==e.curChunk.data.callback)for(var n=0;n<e.curChunk.data.callback.length;n++)e.curChunk.data.callback[n](t.data);e.curChunk.data=t.data,e.curChunk.data.status=o.ChunkStatus.COMPLETED}else{for(var i=t.data.dir===a.NavigatorDirection.BEFORE?"prev":"next",r=e.curChunk;void 0!==r[i]&&(r=r[i],r.data.offset!==t.data.offset););if(r===e.curChunk)return void console.log("Error, history corrupted");if(void 0!==r.data.callback)for(var n=0;n<r.data.callback.length;n++)r.data.callback[n](t.data);r.data=t.data,r.data.status=o.ChunkStatus.COMPLETED}}}},{key:"reset",value:function(){this.curChunk=void 0}},{key:"go",value:function(e){var t=e===a.NavigatorDirection.AFTER,n=t?"next":"prev";this.gap;if(void 0!==this.curChunk[n])this.curChunk=this.curChunk[n],this.currentOffset=this.curChunk.data.offset;else{this.currentOffset=this.currentOffset+e*this.gap;var i={dir:e,offset:this.currentOffset,status:o.ChunkStatus.LAUNCHED,callback:[]};this.currentOffset<0&&(i.substract=-1*this.currentOffset,i.offset=0,this.currentOffset=0);var r={data:i,prev:t?this.curChunk:void 0,next:t?void 0:this.curChunk};this.curChunk[n]=r,this.curChunk=r,this.providerWorker.postMessage(i)}}},{key:"get",value:function(e,t,n){var i,r=e===a.NavigatorDirection.BEFORE?"prev":"next";i=e===a.NavigatorDirection.CURRENT?this.curChunk:void 0===this.curChunk?void 0:this.curChunk[r];var s;return void 0===i?e===a.NavigatorDirection.CURRENT?(s={dir:a.NavigatorDirection.CURRENT,offset:this.currentOffset,status:o.ChunkStatus.LAUNCHED,callback:[]},this.curChunk={data:s,prev:void 0,next:void 0},i=this.curChunk,this.providerWorker.postMessage(s)):(s={dir:e,offset:this.currentOffset+e*this.gap,status:o.ChunkStatus.LAUNCHED,callback:[]},this.curChunk[r]={data:s,prev:e===a.NavigatorDirection.AFTER?this.curChunk:void 0,next:e===a.NavigatorDirection.BEFORE?this.curChunk:void 0},i=this.curChunk[r],this.providerWorker.postMessage(s)):!0===n&&(i.data.status=o.ChunkStatus.LAUNCHED,this.providerWorker.postMessage(i.data)),i.data.status!==o.ChunkStatus.LAUNCHED?t(i.data):(void 0===i.data.callback&&(i.data.callback=[]),void i.data.callback.push(t))}},{key:"isInside_",value:function(e,t){var n=e.offset,i=n+this.gap;return n<=t&&i>=t}}]),e}()},{"./ChunkStatus":3,"./NavigatorDirection":4}],3:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.ChunkStatus={LAUNCHED:0,COMPLETED:1}},{}],4:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.NavigatorDirection={BEFORE:-1,CURRENT:0,AFTER:1}},{}],5:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0}),n.r2Settings=n.r2Wrapper=n.R2Actions=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=e("./SettingsManager"),a=e("./UIContext"),s=n.R2Actions={SEEK:"seek"},c=function(){function e(){var t=this;i(this,e),this.listeners=[],Object.keys(s).forEach(function(e,n){t.listeners[s[e]]=[]})}return r(e,[{key:"seek",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=e;void 0===e?i=prompt("address"):"number"==typeof e&&(i="0x"+e.toString(16)),i&&""!==i.trim()&&r2.cmd("s "+i,function(){n&&a.uiContext.navigateTo(n),t.notifyAction(s.SEEK)})}},{key:"registerListener",value:function(e,t){this.listeners[e].push(t)}},{key:"notifyAction",value:function(e){this.listeners[e].forEach(function(e){return e()})}}]),e}(),l=(n.r2Wrapper=new c,{PLATFORM:"platform",BITS:"bits",UTF8:"utf8",UCASE:"ucase",DESCRIBE:"describe",BYTES:"bytes",OS:"os",SIZE:"size",DECODING:"decoding",MODE:"mode",ANAL_HAS_NEXT:"analHasNext",ANAL_SKIP_NOPS:"analSkipNops",ANAL_NON_CODE:"analNonCode",COLORS:"colors",USE_TTS:"useTTS",THEME:"theme",ASMEMU:"asmemu",ASMEMUSTR:"asmemustr"}),u={};u[l.PLATFORM]={name:"platform",defVal:"x86",apply:function(e){r2.cmd("e asm.arch="+e)}},u[l.BITS]={name:"bits",defVal:"32",apply:function(e){r2.cmd("e asm.bits="+e)}},u[l.UTF8]={name:"utf8",defVal:"true",apply:function(e){r2.cmd("e scr.utf8="+e)}},u[l.UCASE]={name:"ucase",defVal:"false",apply:function(e){r2.cmd("e asm.ucase="+e)}},u[l.DESCRIBE]={name:"describe",defVal:"false",apply:function(e){r2.cmd("e asm.describe="+e)}},u[l.BYTES]={name:"bytes",defVal:"false",apply:function(e){r2.cmd("e asm.bytes="+e)}},u[l.OS]={name:"os",defVal:"Linux",apply:function(e){console.log("OS is now: "+e)}},u[l.ASMEMU]={name:"asmemu",defVal:"false",apply:function(e){r2.cmd("e asm.emu="+e)}},u[l.ASMEMUSTR]={name:"asmemustr",defVal:"false",apply:function(e){r2.cmd("e asm.emu.str="+e)}},u[l.SIZE]={name:"size",defVal:"S",apply:function(e){switch(e){case"S":r2.cmd("e asm.bytes=false"),r2.cmd("e asm.lines=false"),r2.cmd("e asm.cmt.right=false");break;case"M":r2.cmd("e asm.bytes=false"),r2.cmd("e asm.lines=true"),r2.cmd("e asm.lineswidth=8"),r2.cmd("e asm.cmt.right=false");break;case"L":r2.cmd("e asm.bytes=true"),r2.cmd("e asm.lines=true"),r2.cmd("e asm.lineswidth=12"),r2.cmd("e asm.cmt.right=true")}}},u[l.DECODING]={name:"decoding",defVal:"Pseudo",apply:function(e){switch(e){case"Pseudo":r2.cmd("e asm.pseudo=1"),r2.cmd("e asm.syntax=intel");break;case"Opcodes":r2.cmd("e asm.pseudo=0"),r2.cmd("e asm.syntax=intel");break;case"ATT":r2.cmd("e asm.pseudo=0"),r2.cmd("e asm.syntax=att")}}},u[l.MODE]={name:"mode",defVal:"PA",apply:function(e){switch(e){case"PA":r2.cmd("e io.va=false"),r2.cmd("e io.pava=false");break;case"VA":r2.cmd("e io.va=true"),r2.cmd("e io.pava=false");break;case"PAVA":r2.cmd("e io.pava=true");break;case"Debug":r2.cmd("e io.va=true"),r2.cmd("e io.debug=true"),r2.cmd("e io.pava=false")}}},u[l.ANAL_HAS_NEXT]={name:"analHasNext",defVal:!0,apply:function(e){console.log("analHasNext is "+e)}},u[l.ANAL_SKIP_NOPS]={name:"analSkipNops",defVal:!0,apply:function(e){console.log("analSkipNops is "+e)}},u[l.ANAL_NON_CODE]={name:"analNonCode",defVal:!1,apply:function(e){console.log("analNonCode is "+e)}},u[l.COLORS]={name:"colors",defVal:!0,apply:function(e){inColor=e,r2.cmd("e scr.color="+e)}},u[l.THEME]={name:"theme",defVal:"none",apply:function(e){r2.cmd("eco "+e)}},u[l.USE_TTS]={name:"tts",defVal:!0,apply:function(){}};n.r2Settings=new o.SettingsManager(l,u)},{"./SettingsManager":6,"./UIContext":7}],6:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();n.SettingsManager=function(){function e(t,n){i(this,e),this.itemKeys=t,this.conf=n}return r(e,[{key:"keys",get:function(){return this.itemKeys}}]),r(e,[{key:"loadAll",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];for(var t in this.conf){var n=this.getItem(t),i=this.getItemDefaultValue(t);(!e&&n!==i||e)&&this.conf[t].apply(n)}}},{key:"resetAll",value:function(){for(var e in this.conf)localStorage.removeItem(e);this.loadAll(!0)}},{key:"getItem",value:function(e){if(!this.keyExists(e))throw new Error("ConfKey "+e+" doesn't exist!");var t=localStorage.getItem(e);return null!==t?("false"===t?t=!1:"true"===t&&(t=!0),t):this.getItemDefaultValue(e)}},{key:"setItem",value:function(e,t){if(!this.keyExists(e))throw new Error("ConfKey "+e+" doesn't exist!");localStorage.setItem(e,t),this.conf[e].apply(t)}},{key:"getItemDefaultValue",value:function(e){if(!this.keyExists(e))throw new Error("ConfKey "+e+" doesn't exist!");return this.conf[e].defVal}},{key:"keyExists",value:function(e){return void 0!==this.conf[e]}}]),e}()},{}],7:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0}),n.uiContext=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=e("../layout/Layouts"),a=e("../layout/Ruler"),s=function(){function e(){i(this,e),this.initialized=!1}return r(e,[{key:"isFirstWidgetFocused",get:function(){return this.focusedWidget===this.displayedWidgets[0]}},{key:"isSplitted",get:function(){return this.currentLayout!==o.Layouts.FULL}}]),r(e,[{key:"init",value:function(e,t,n,i){var r=this;this.initialized&&console.error("UIContext shouldn't be initialized more than once."),this.initialized=!0,this.widgetFactory=e,this.contentNode=document.getElementById(t),this.rulerNode=document.getElementById(n),this.titleNode=document.getElementById(i);for(var s=0;s<2;s++)!function(e){var t=document.createElement("div");t.addEventListener("click",function(){return r.setFocusAt(e)}),r.contentNode.appendChild(t)}(s);this.ruler=new a.Ruler(this.contentNode,this.rulerNode),this.ruler.hide(),this.currentLayout=o.Layouts.FULL,this.ruler.addListeners(function(e){r.resizeTo(e)}),this.displayedWidgets=[],this.focusedWidget}},{key:"setFocusAt",value:function(e){if(~this.displayedWidgets.indexOf(e))return void console.error("UIContext: focus offset isn't correct");if(this.displayedWidgets[e]!==this.focusedWidget){var t=this.focusedWidget,n=this.displayedWidgets[e];this.widgetFactory.get(t).lostFocus(),this.widgetFactory.get(n).gotFocus(),this.focusedWidget=this.displayedWidgets[e],this.drawTitle()}}},{key:"navigateTo",value:function(e){for(var t,n=this.getSlot(e),i=arguments.length,r=Array(i>1?i-1:0),o=1;o<i;o++)r[o-1]=arguments[o];(t=this.widgetFactory.get(e)).drawWidget.apply(t,[n].concat(r)),this.applyLayout(n),this.focusedWidget=e,this.drawTitle()}},{key:"getSlot",value:function(e){var t=this.displayedWidgets.indexOf(e);if(~t)return this.contentNode.children[t];var n=void 0;return this.currentLayout===o.Layouts.FULL?(0!==typeof this.displayedWidgets.length&&(n=this.displayedWidgets[0]),this.displayedWidgets=[e],t=0):1===this.displayedWidgets.length?(this.displayedWidgets.push(e),t=1):this.isFirstWidgetFocused?(n=this.displayedWidgets.shift(),this.displayedWidgets.unshift(e),t=0):(n=this.displayedWidgets.pop(),this.displayedWidgets.push(e),t=1),void 0!==n&&this.widgetFactory.get(n).lostDisplay(),this.setFocusAt(t),this.contentNode.children[t]}},{key:"drawTitle",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:" & ";this.titleNode.innerHTML="";for(var n=0;n<this.displayedWidgets.length;n++)!function(n){var i=e.displayedWidgets[n],r=i===e.focusedWidget&&e.displayedWidgets.length>1,o=document.createElement(r?"strong":"span");o.textContent=e.widgetFactory.get(i).name,o.addEventListener("click",function(){return e.setFocusAt(n)}),0!==n&&e.titleNode.appendChild(document.createTextNode(t)),e.titleNode.appendChild(o)}(n)}},{key:"applyLayout",value:function(e){this.currentLayout===o.Layouts.VERTICAL&&e.classList.add("vertical")}},{key:"resizeTo",value:function(e){this.isSplitted&&(this.contentNode.children[0].style.width=100*(e-.001)+"%",this.contentNode.children[1].style.width=100*(1-e-.001)+"%")}},{key:"split",value:function(e){if(!this.isSplitted){e!==o.Layouts.VERTICAL&&console.error("Not supported layout."),this.currentLayout=e,this.ruler.show();var t=!0,n=!1,i=void 0;try{for(var r,a=this.contentNode.children[Symbol.iterator]();!(t=(r=a.next()).done);t=!0){var s=r.value;this.applyLayout(s)}}catch(e){n=!0,i=e}finally{try{!t&&a.return&&a.return()}finally{if(n)throw i}}}}},{key:"merge",value:function(){if(this.isSplitted){this.ruler.reset(),this.ruler.hide(),this.currentLayout=o.Layouts.FULL;var e=this.isFirstWidgetFocused?this.contentNode.children[0]:this.contentNode.children[1],t=this.isFirstWidgetFocused?this.contentNode.children[1]:this.contentNode.children[0];t.className="rwidget",e.classList.remove("vertical"),e.classList.remove("horizontal"),e.classList.add("full"),e!==this.contentNode.children[0]&&e.parentNode.insertBefore(t,e)}}}]),e}();n.uiContext=new s},{"../layout/Layouts":17,"../layout/Ruler":19}],8:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0}),n.Autocompletion=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=e("../core/R2Wrapper"),a=e("../widgets/Widgets"),s={UP:38,DOWN:40,ENTER:13},c={EMPTY:{pos:-1,offset:0,length:0,name:"No match!"}};n.Autocompletion=function(){function e(t,n,r,o,a){i(this,e),this.form_=t,this.dropdown_=n,this.cmd_=r,this.minChar_=o||2,this.maxProp_=a||10,this.init_()}return r(e,[{key:"init_",value:function(){this.form_=document.getElementById(this.form_),this.dropdown_=document.getElementById(this.dropdown_);var e=this.keyHandler.bind(this);this.form_.addEventListener("keyup",e);var t=this;this.form_.addEventListener("focus",function(){t.prevLength_>=t.minChar_&&t.show()}),this.form_.addEventListener("blur",function(){t.hide()}),this.flags_,this.activeChoice_=0,this.prevLength_=0,this.list_,this.completions_,this.populate_()}},{key:"populate_",value:function(){var e=this;r2.cmdj(this.cmd_,function(t){e.flags_=t})}},{key:"process_",value:function(e){for(var t=[],n=0,i=0;i<this.flags_.length;i++){var r=this.flags_[i].name.indexOf(e,0);if(-1!==r&&t.push({pos:n++,offset:r,length:e.length,name:this.flags_[i].name}),n===this.maxProp_)return t}return t}},{key:"addNode_",value:function(e,t){var n=this,i=document.createElement("li");t&&(i.className="active"),i.addEventListener("mouseover",function(){return n.setActiveChoice(e.pos)}),i.addEventListener("mousedown",function(){n.setActiveChoice(e.pos),n.valid()});var r=document.createElement("strong");r.appendChild(document.createTextNode(e.name.substr(e.offset,e.length))),i.appendChild(document.createTextNode(e.name.substr(0,e.offset))),i.appendChild(r),i.appendChild(document.createTextNode(e.name.substr(e.offset+e.length,e.name.length-(e.offset+e.length)))),this.dropdown_.appendChild(i),console.log(i)}},{key:"cleanChoices_",value:function(){for(;this.dropdown_.firstChild;)this.dropdown_.removeChild(this.dropdown_.firstChild)}},{key:"setActiveChoice",value:function(e){var t=0,n=!0,i=!1,r=void 0;try{for(var o,a=this.dropdown_.children[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){o.value.className=t===e?"active":"",t+=1}}catch(e){i=!0,r=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw r}}this.activeChoice_=e}},{key:"keyMovement_",value:function(e){e===s.UP&&this.activeChoice_>0&&(console.log("UP"),this.setActiveChoice(this.activeChoice_-1)),e===s.DOWN&&this.activeChoice_<this.dropdown_.childNodes.length-1&&(console.log("DOWN"),this.setActiveChoice(this.activeChoice_+1))}},{key:"valid",value:function(){if(!(-1===this.activeChoice_||this.dropdown_.childNodes.length<=this.activeChoice_))return this.hide(),this.prepareView(),o.r2Wrapper.seek(this.completions_[this.activeChoice_].name,a.Widgets.DISASSEMBLY)}},{key:"show",value:function(){this.dropdown_.style.display="block"}},{key:"hide",value:function(){this.dropdown_.style.display="none"}},{key:"keyHandler",value:function(e){if(e.keyCode===s.UP||e.keyCode===s.DOWN)return this.keyMovement_(e.keyCode);if(e.keyCode===s.ENTER)return this.hide(),this.valid();var t=e.target.value;if(this.cleanChoices_(),t.length>=2){if(this.show(),this.completions_=this.process_(t),this.prevLength_!==t.length&&(this.activeChoice_=0),0===this.completions_.length)this.addNode_(c.EMPTY,!1);else for(var n in this.completions_)this.addNode_(this.completions_[n],n===this.activeChoice_);this.prevLength_=t.length}else this.hide()}},{key:"setPrepareView",value:function(e){this.preparationCallback=e}},{key:"prepareView",value:function(){void 0!==this.preparationCallback&&this.preparationCallback()}}]),e}()},{"../core/R2Wrapper":5,"../widgets/Widgets":52}],9:[function(e,t,n){"use strict";function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=e.split(s),i=document.createElement("span"),o=!0,a=!1,c=void 0;try{for(var l,u=n[Symbol.iterator]();!(o=(l=u.next()).done);o=!0){var d=l.value;i.appendChild(r(d,t))}}catch(e){a=!0,c=e}finally{try{!o&&u.return&&u.return()}finally{if(a)throw c}}return i}function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=void 0;return s.test(e)?(n=document.createElement("a"),n.innerHTML=e,o(n,e,t)):(n=document.createElement("span"),n.innerHTML=e),n}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;t=t||e.textContent,e.addEventListener("click",function(){return a.r2Wrapper.seek(t,n)}),e.title="Seek "+t,e.href="#"+t}Object.defineProperty(n,"__esModule",{value:!0}),n.formatOffsets=i,n.formatOffset=r,n.applySeek=o;var a=e("../core/R2Wrapper"),s=new RegExp(/(0x[a-zA-Z0-9]+|(?:sym|fcn|str)\.[\.a-zA-Z0-9_]+)/,"g")},{"../core/R2Wrapper":5}],10:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();n.InfiniteScrolling=function(){function e(t,n,r){i(this,e),this.domTarget=t,this.limit=r,this.howManyScreens=n,this.screenProportion=1/this.howManyScreens,this.pauseScrollEvent=!1,this.prevScroll=0;var o=this;this.domTarget.addEventListener("scroll",function(e){o.scrollEvent_(e)})}return r(e,[{key:"setTopEvent",value:function(e){this.ontop=e}},{key:"setBottomEvent",value:function(e){this.onbottom=e}},{key:"scrollEvent_",value:function(e){var t=this;if(!this.pauseScrollEvent){var n=e.target.scrollHeight-e.target.offsetHeight,i=e.target.scrollTop/n;if(!this.isTopMax&&i<this.limit&&this.prevScroll>i){this.pauseScrollEvent=!0;var r=Math.floor((this.limit+(i-this.limit)+this.screenProportion)*n);this.ontop(r,function(e){t.pauseScrollEvent=!1})}if(i>1-this.limit&&this.prevScroll<i){this.pauseScrollEvent=!0;var r=Math.floor((1-this.limit+(i-(1-this.limit))-this.screenProportion)*n);this.onbottom(r,function(e){t.pauseScrollEvent=!1})}this.prevScroll=i}}}]),e}()},{}],11:[function(e,t,n){"use strict";function i(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=document.createElement("a");i.className="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect",i.style.margin=s;var r=document.createElement("i");return r.className="material-icons",r.innerHTML=e,i.appendChild(r),i.appendChild(document.createTextNode(t)),null!==n&&i.addEventListener("click",n),i}function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=document.createElement("a");return n.className="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect",n.style.margin=s,n.textContent=e,null!==t&&n.addEventListener("click",t),n}function o(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=document.createElement("button");i.className="mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect",i.style.margin=s,i.title=t;var r=document.createElement("i");return r.className="material-icons",r.textContent=e,i.appendChild(r),null!==n&&i.addEventListener("click",n),i}function a(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=document.createElement("button");i.className="mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-js-ripple-effect",i.style.margin=s,i.title=t;var r=document.createElement("i");return r.className="material-icons md-dark",r.innerHTML=e,i.appendChild(r),null!==n&&i.addEventListener("click",n),i}Object.defineProperty(n,"__esModule",{value:!0});var s="3px";n.Inputs={button:r,imgButton:o,iconButton:a,pictogramInputButton:i}},{}],12:[function(e,t,n){"use strict";function i(e,t){if(r.r2Settings.getItem(r.r2Settings.keys.USE_TTS)&&"undefined"!=typeof SpeechSynthesisUtterance){var n=new SpeechSynthesisUtterance;n.text=e,n.lang="en-US",n.onend=function(){t&&t()},n.onerror=function(e){t&&t(e)},speechSynthesis.speak(n)}}Object.defineProperty(n,"__esModule",{value:!0}),n.speak=i;var r=e("../core/R2Wrapper")},{"../core/R2Wrapper":5}],13:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0}),n.Table=void 0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=e("../helpers/Format");n.Table=function(){function e(t,n,r,o){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;i(this,e),this.cols=t,this.nonum=n,this.clickableOffset=new Array(t.length),this.clickableOffset.fill(!1),this.contentEditable=new Array(t.length),this.contentEditable.fill(!1),this.onChange=o,this.seekNavigation=a,this.id=r||!1,this.init()}return o(e,[{key:"init",value:function(){this.root=document.createElement("table"),this.root.className="mdl-data-table mdl-data-table--selectable mdl-shadow--2dp",!1!==this.root.id&&(this.root.id=this.id),this.thead=document.createElement("thead"),this.root.appendChild(this.thead),this.tbody=document.createElement("tbody"),this.root.appendChild(this.tbody);var e=document.createElement("tr");this.thead.appendChild(e);for(var t in this.cols){"+"==this.cols[t][0]?(this.clickableOffset[t]=!0,this.cols[t]=this.cols[t].substr(1)):"~"==this.cols[t][0]&&(this.contentEditable[t]=!0);var n=document.createElement("th");n.appendChild(document.createTextNode(this.cols[t])),this.nonum[t]&&(n.className="mdl-data-table__cell--non-numeric"),e.appendChild(n)}}},{key:"getRows",value:function(){return Array.prototype.slice.call(this.tbody.children)}},{key:"addRow",value:function(e){var t=document.createElement("tr");this.tbody.appendChild(t);for(var n=0;n<e.length;n++){var i=document.createElement("td");if(this.clickableOffset[n]){var o=document.createElement("a");o.innerHTML=e[n],i.appendChild(o),(0,a.applySeek)(o,e[n],this.seekNavigation)}else"object"===r(e[n])?i.appendChild(e[n]):i.innerHTML=e[n];if(this.contentEditable[n]){var s=this;i.initVal=i.innerHTML,i.contentEditable=!0,i.busy=!1,i.addEventListener("blur",function(t){t.target.busy||t.target.initVal!==t.target.innerHTML&&(t.target.busy=!0,s.onChange(e,t.target.innerHTML),t.target.initVal=t.target.innerHTML,t.target.busy=!1)}),i.addEventListener("keydown",function(t){13!==t.keyCode||t.target.busy||t.target.initVal!==t.target.innerHTML&&(t.preventDefault(),t.target.busy=!0,s.onChange(e,t.target.innerHTML),t.target.initVal=t.target.innerHTML,t.target.busy=!1,t.target.blur())})}t.appendChild(i)}return t}},{key:"insertInto",value:function(e){e.appendChild(this.root),!1!==this.id&&$("#"+this.id).DataTable()}}]),e}()},{"../helpers/Format":9}],14:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();n.UpdateManager=function(){function e(){i(this,e),this.updateMethods=[{},{}],this.currentFocus}return r(e,[{key:"registerMethod",value:function(e,t){this.updateMethods[e]=t}},{key:"focusHasChanged",value:function(e){this.currentFocus=e}},{key:"apply",value:function(){void 0!==this.currentFocus&&this.updateMethods[this.currentFocus]()}}]),e}()},{}],15:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0}),n.ContainerZone=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=e("../helpers/UpdateManager"),a=e("./Layouts");n.ContainerZone=function(){function e(t,n,r){i(this,e),this.container=document.getElementById(t),this.ruler=document.getElementById(n),this.title=document.getElementById(r),this.currentLayout=a.Layouts.FULL,this.widgets=[],this.populatedWidgets=[],this.initRuler(),this.focus_=0,this.focusListeners=[];var s=this;this.fallback=function(){var e=s.getWidget("New Widget",!1);e.setHTMLContent('<p class="mdl-typography--text-center">Ready !</p>'),s.add(e)},this.updateManagers={},this.updateManagers.updates=new o.UpdateManager,this.updateManagers.lastViews=new o.UpdateManager,this.addFocusListener(this.updateManagers.updates),this.addFocusListener(this.updateManagers.lastViews)}return r(e,[{key:"fallbackWidget",value:function(e){this.fallback=e}},{key:"initRuler",value:function(){var e={},t=this;this.rulerProp={gap:.005,pos:.5};var n=function(n){e={startX:n.clientX,startWidth:parseInt(document.defaultView.getComputedStyle(t.ruler).width,10),interval:n.clientX-t.ruler.offsetLeft},document.documentElement.addEventListener("mousemove",i,!1),document.documentElement.addEventListener("mouseup",r,!1),n.preventDefault()},i=function(n){var i=(n.clientX-e.interval)/t.container.offsetWidth;t.rulerProp.pos=i,t.container.children[0].style.width=100*(i-t.rulerProp.gap)+"%",t.container.children[1].style.width=100*(1-i-t.rulerProp.gap)+"%",t.ruler.style.marginLeft=100*i+"%"},r=function e(){document.documentElement.removeEventListener("mousemove",i,!1),document.documentElement.removeEventListener("mouseup",e,!1)};this.ruler.addEventListener("mousedown",n)}},{key:"setFocus",value:function(e){this.focus_=e;for(var t=0;t<this.focusListeners.length;t++)this.focusListeners[t].focusHasChanged(e)}},{key:"getFocus",value:function(){return this.focus_}},{key:"getWidget",value:function(e,t){for(var t=void 0===t,n=0;n<this.widgets.length;n++)if(this.widgets[n].getName()===e)return t&&this.add(this.widgets[n]),this.widgets[n];var i=new Widget(e);return this.widgets.push(i),t&&this.add(i),i}},{key:"getWidgetDOMWrapper",value:function(e){var t=this.populatedWidgets.indexOf(e);return-1===t?void console.log("Can't get DOM wrapper of a non-populated widget"):this.container.children[t]}},{key:"isSplitted",value:function(){return this.currentLayout!==a.Layouts.FULL}},{key:"merge",value:function(){if(this.isSplitted()){this.ruler.style.marginLeft="50%",this.ruler.style.display="none",this.rulerProp.pos=.5;var e=this.getWidgetDOMWrapper(this.populatedWidgets[this.getFocus()]);e.className="rwidget full focus",e.style.width="auto";for(var t=0;t<this.container.children.length;t++)t!==this.getFocus()&&(this.container.removeChild(this.container.children[t]),this.populatedWidgets.splice(t,1));this.setFocus(0),this.currentLayout=a.Layouts.FULL,this.drawTitle()}}},{key:"split",value:function(e){if(!this.isSplitted()){this.ruler.style.display="block",this.container.children[0].style.width=100*(this.rulerProp.pos-this.rulerProp.gap)+"%";for(var t=0;t<this.populatedWidgets.length;t++)this.getWidgetDOMWrapper(this.populatedWidgets[t]).classList.remove("full"),this.getWidgetDOMWrapper(this.populatedWidgets[t]).classList.add(e);this.currentLayout=e,
|
|
this.populatedWidgets.length<=1&&this.fallback(),this.setFocus(1),this.drawTitle()}}},{key:"getCurrentlyDrawn",value:function(){for(var e=[],t=0;t<this.populatedWidgets.length;t++)e.push(this.populatedWidgets[t].name);return e}},{key:"add",value:function(e){if(-1===this.populatedWidgets.indexOf(e)){if(e.isAlreadyThere())return this.populatedWidgets.push(e),void this.applyFocusEvent_(e);var t=document.createElement("div");if(t.classList.add("rwidget"),t.classList.add(this.currentLayout),e.binding(t),this.isSplitted()){var n=this.populatedWidgets.length>=2;n&&(this.container.removeChild(this.container.children[this.getFocus()]),this.populatedWidgets.splice(this.getFocus(),1)),0===this.getFocus()&&n?(this.populatedWidgets.unshift(e),e.isAlreadyThere()||(this.container.insertBefore(t,this.container.children[0]),this.container.children[0].style.width=100*(this.rulerProp.pos-this.rulerProp.gap)+"%")):(this.populatedWidgets.push(e),e.isAlreadyThere()||(this.container.appendChild(t),this.container.children[1].style.width=100*(1-this.rulerProp.pos-this.rulerProp.gap)+"%"))}else this.populatedWidgets.length>=1&&this.container.removeChild(this.container.children[this.getFocus()]),this.populatedWidgets=[e],e.isAlreadyThere()||(this.container.appendChild(t),this.container.children[0].style.width="auto");this.moveFocusOnWidget(e),this.applyFocusEvent_(e),e.setOffset(this.getFocus()),this.drawTitle()}}},{key:"moveFocusOnWidget",value:function(e){this.setFocus(this.populatedWidgets.indexOf(e)),this.container.children[this.getFocus()].classList.add("focus"),this.isSplitted()&&this.container.children[(this.getFocus()+1)%2].classList.remove("focus"),this.drawTitle()}},{key:"drawTitle",value:function(){if(this.currentLayout===a.Layouts.FULL||1===this.populatedWidgets.length)this.title.innerHTML=this.populatedWidgets[0].getName();else{for(var e=[],t=0;t<this.populatedWidgets.length;t++)this.getFocus()===t?e.push("<strong>"+this.populatedWidgets[t].getName()+"</strong>"):e.push(this.populatedWidgets[t].getName());this.title.innerHTML=e.join(" & ")}}},{key:"applyFocusEvent_",value:function(e){var t=this;this.getWidgetDOMWrapper(e).addEventListener("mousedown",function(){t.moveFocusOnWidget(e)})}},{key:"addFocusListener",value:function(e){this.focusListeners.push(e)}}]),e}()},{"../helpers/UpdateManager":14,"./Layouts":17}],16:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();n.FlexContainer=function(){function e(t,n){i(this,e),this.classes=void 0===n?"":n,this.init(t)}return r(e,[{key:"init",value:function(e){this.container=e,this.container.innerHTML="",this.controls=document.createElement("div"),this.body=document.createElement("div"),this.controls.className="flex flex-controls "+this.classes,this.body.className="flex flex-body "+this.classes,this.container.appendChild(this.controls),this.container.appendChild(this.body)}},{key:"replug",value:function(e){this.container=e,this.container.innerHTML="",this.container.appendChild(this.controls),this.container.appendChild(this.body)}},{key:"reset",value:function(){this.init(this.container)}},{key:"getControls",value:function(){return this.controls}},{key:"drawControls",value:function(e){this.controls.innerHTML="",e(this.controls)}},{key:"getBody",value:function(){return this.body}},{key:"drawBody",value:function(e){this.body.innerHTML="",e(this.body)}},{key:"pause",value:function(e){this.dialogHasBeenDrawn||this.drawEmptyDialog(),this.textDialog.innerHTML=e,this.dialog.showModal()}},{key:"drawEmptyDialog",value:function(){var e=this;this.dialog=document.createElement("dialog"),this.dialog.className="mdl-dialog",this.dialog.showModal||dialogPolyfill.registerDialog(this.dialog);var t=document.createElement("div");t.className="mdl-dialog__content",this.dialog.appendChild(t);var n=document.createElement("p");n.className="mdl-typography--text-center",t.appendChild(n);var i=document.createElement("i");i.className="material-icons",i.style.fontSize="54px",i.innerHTML="error_outline",n.appendChild(i),this.textDialog=document.createElement("p"),t.appendChild(this.textDialog);var r=document.createElement("div");r.className="mdl-dialog__actions",this.dialog.appendChild(r);var o=document.createElement("button");o.className="mdl-button",o.innerHTML="Cancel",o.addEventListener("click",function(){e.dialog.close()}),r.appendChild(o),document.body.appendChild(this.dialog),componentHandler.upgradeDom()}},{key:"resume",value:function(){this.dialog.close()}}]),e}()},{}],17:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.Layouts={FULL:"full",HORIZONTAL:"horizontal",VERTICAL:"vertical"}},{}],18:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0}),n.RadareInfiniteBlock=n.defaultHeightProvisioning=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=e("../core/NavigatorDirection"),a=e("../helpers/InfiniteScrolling"),s=n.defaultHeightProvisioning=3;n.RadareInfiniteBlock=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s;i(this,e),this.heightProvisioning=t}return r(e,[{key:"getCurChunk",value:function(){return this.curChunk}},{key:"getFirstElement",value:function(){return this.firstElement}},{key:"refreshInitialOffset",value:function(){var e=this;r2.cmd("s",function(t){e.initialOffset=parseInt(t,16)})}},{key:"defineInfiniteParams",value:function(e){var t=this,n=0===this.container.getBody().offsetHeight?800:this.container.getBody().offsetHeight;this.howManyLines=Math.floor(n/this.lineHeight*this.heightProvisioning);var i=new a.InfiniteScrolling(this.container.getBody(),3,void 0!==e?e:.2);i.setTopEvent(function(e,n){t.nav.go(o.NavigatorDirection.BEFORE),t.infiniteDrawingContent(o.NavigatorDirection.BEFORE,e,n)}),i.setBottomEvent(function(e,n){t.nav.go(o.NavigatorDirection.AFTER),t.infiniteDrawingContent(o.NavigatorDirection.AFTER,e,n)})}}]),e}()},{"../core/NavigatorDirection":4,"../helpers/InfiniteScrolling":10}],19:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();n.Ruler=function(){function e(t,n){var r=this;i(this,e),this.containerNode=t,this.rulerNode=n,this.listeners=[],this.moving=!1,this.position=.5,this.init(),this.reset(),this.addListeners(function(e){return r.move(e)})}return r(e,[{key:"position",get:function(){return this._position},set:function(e){this._position=e,this.triggerListeners()}}]),r(e,[{key:"init",value:function(){var e=this,t=function(t){t.preventDefault();var n=e.containerNode.getBoundingClientRect();e.position=(t.clientX-n.left)/n.width},n=function e(){document.documentElement.removeEventListener("mousemove",t,!1),document.documentElement.removeEventListener("mouseup",e,!1)};this.rulerNode.addEventListener("mousedown",function(e){document.documentElement.addEventListener("mousemove",t,!1),document.documentElement.addEventListener("mouseup",n,!1)})}},{key:"triggerListeners",value:function(){var e=this;this.listeners.forEach(function(t){return t(e.position)})}},{key:"addListeners",value:function(e){this.listeners.push(e)}},{key:"move",value:function(e){this.rulerNode.style.marginLeft=100*e+"%"}},{key:"reset",value:function(){this.position=.5,this.move(.5)}},{key:"show",value:function(){this.rulerNode.style.display="block"}},{key:"hide",value:function(){this.rulerNode.style.display="none"}}]),e}()},{}],20:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0}),n.Disassembly=void 0;var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;if(void 0!==a)return a.call(i)},c=e("./DisassemblyNavigator"),l=e("../../layout/RadareInfiniteBlock"),u=e("../../layout/FlexContainer"),d=e("../../core/UIContext"),f=e("../../widgets/Widgets"),h=e("../../helpers/Inputs"),p=e("../../helpers/Format"),m=e("../../core/R2Wrapper");n.Disassembly=function(e){function t(e,n){i(this,t);var o=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return o.container=new u.FlexContainer(e,"disasm"),o.lineHeight=n,o.init(),o}return o(t,e),a(t,[{key:"init",value:function(){var e=this;this.refreshInitialOffset(),this.drawContextualMenu(),this.drawAnalysisDialog(),this.defineInfiniteParams(.05),this.container.pause("Crunching some data..."),this.nav.crunchingData(function(){e.container.resume()}),this.indexOffsetHistory=0,this.offsetHistory=[],this.onSeek()}},{key:"onSeek",value:function(){var e="number"==typeof this.initialOffset?int2fixedHex(this.initialOffset,8):this.initialOffset;if(e===this.offsetHistory[this.offsetHistory.length-1])return this.indexOffsetHistory=this.offsetHistory.length-1,void this.drawControls(this.container.getControls());var t=this.offsetHistory.indexOf(e);if(~t)return this.indexOffsetHistory=t,void this.drawControls(this.container.getControls());this.offsetHistory[this.offsetHistory.length-1];this.indexOffsetHistory<this.offsetHistory.length-1&&(this.offsetHistory=this.offsetHistory.slice(0,this.indexOffsetHistory+1)),this.offsetHistory.push(e),this.indexOffsetHistory=this.offsetHistory.length-1,this.drawControls(this.container.getControls())}},{key:"resetContainer",value:function(e){this.container.replug(e),this.container.reset(),this.refreshInitialOffset(),this.defineInfiniteParams(.05)}},{key:"defineInfiniteParams",value:function(e){s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"defineInfiniteParams",this).call(this,e),this.nav=new c.DisassemblyNavigator(this.howManyLines,this.initialOffset)}},{key:"draw",value:function(e){var t=this;this.drawControls(this.container.getControls()),this.container.drawBody(function(n){t.drawContent(n,function(){t.replaceScrollPosition(t.nav.currentOffset),void 0!==e&&e()})})}},{key:"processChosenAnalysis",value:function(e){for(var t=0;t<this.analysisMethods.length;t++)this.analysisMethods[t].action(this.analysisMethods[t].active);var n=this;this.nav.crunchingData(function(){n.draw(e)})}},{key:"drawAnalysisDialog",value:function(){this.analysisMethods=[{name:"Analyse current offset",ugly:"curoffset",active:!0,action:function(e){e&&r2.cmd("af")}},{name:"Analyze symbols",ugly:"symbols",active:!1,action:function(e){e&&r2.cmd("aa")}},{name:"Analyse calls",ugly:"calls",active:!1,action:function(e){e?r2.cmd("e anal.calls=true;aac"):r2.cmd("e anal.calls=false")}},{name:"Analyse reference",ugly:"ref",active:!1,action:function(e){e&&r2.cmd("aar")}},{name:"Emulate code",ugly:"code",active:!1,action:function(e){e?r2.cmd("e asm.emu=1;aae;e asm.emu=0"):r2.cmd("e asm.emu=false")}},{name:"Find preludes",ugly:"preludes",active:!1,action:function(e){r2.cmd("aap")}},{name:"Autoname functions",ugly:"fcts",active:!1,action:function(e){e&&r2.cmd("aan")}}];var e=this;this.analysisDialog=document.createElement("dialog"),this.analysisDialog.className="mdl-dialog",this.analysisDialog.showModal||dialogPolyfill.registerDialog(this.analysisDialog);var t=document.createElement("div");t.className="mdl-dialog__content",this.analysisDialog.appendChild(t);var n=document.createElement("h6");n.appendChild(document.createTextNode("Analysis...")),n.className="mdl-dialog__title",t.appendChild(n);var i=document.createElement("ul");i.className="mdl-card__supporting-text",this.analysisDialog.appendChild(i);for(var r=0;r<this.analysisMethods.length;r++){var o=document.createElement("li");i.appendChild(o);var a=document.createElement("label");a.for=this.analysisMethods[r].ugly,a.className="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect",o.appendChild(a);var s=document.createElement("input");s.type="checkbox",s.offset=r,s.id=this.analysisMethods[r].ugly,s.checked=this.analysisMethods[r].active,s.className="mdl-checkbox__input",a.appendChild(s),s.addEventListener("change",function(t){e.analysisMethods[t.target.offset].active=t.target.checked});var c=document.createElement("span");c.className="mdl-checkbox__label",c.appendChild(document.createTextNode(this.analysisMethods[r].name)),a.appendChild(c)}var l=document.createElement("div");l.className="mdl-dialog__actions",this.analysisDialog.appendChild(l);var u=document.createElement("button");u.className="mdl-button",u.innerHTML="Proceed",u.addEventListener("click",function(){e.processChosenAnalysis(function(){e.analysisDialog.close()})}),l.appendChild(u);var d=document.createElement("button");d.className="mdl-button",d.innerHTML="Close",d.addEventListener("click",function(){e.analysisDialog.close()}),l.appendChild(d),document.body.appendChild(this.analysisDialog),componentHandler.upgradeDom()}},{key:"extractOffset_",value:function(e){return parseInt(e.slice(5))}},{key:"getCurrentOffset",value:function(){return this.currentOffset}},{key:"oncontextmenu",value:function(e,t){this.refreshContextMenu(t);var n=document.getElementById("contextmenuDisasm");e.preventDefault(),this.contextMenuOpen?n.classList.remove("active"):(this.currentOffset=t,n.classList.add("active"),n.style.left=e.clientX+"px",n.style.top=e.clientY+"px"),this.contextMenuOpen=!this.contextMenuOpen}},{key:"onfctmenu",value:function(e,t){e.preventDefault();var n;r2.cmd("?v "+t,function(e){n=e});var i=prompt("Rename?",t);null!==i&&""!==i&&r2.cmd("fr "+i+"@ "+n)}},{key:"onvarmenu",value:function(e,t){e.preventDefault();var n=prompt("Rename?",t);null!==n&&""!==n&&r2.cmd("afvn "+t+" "+n)}},{key:"refreshContextMenu",value:function(e){var t;r2.cmdj("aoj @"+e,function(e){t=void 0===e[0].val}),this.drawContextualMenu(!t)}},{key:"getPresentBlock",value:function(){for(var e=[],t=this.container.getBody(),n=0;n<t.length;n++)e.push(this.extractOffset_(t[n].className));return e}},{key:"drawContent",value:function(e,t){var n=this,i=this.nav.getShownOffset(),r=0===i[0];if(!this.isTopMax||!r){this.isTopMax=r,this.container.getBody().innerHTML="";for(var o=0;o<i.length;o++){var a=document.createElement("span");this.container.getBody().appendChild(a),this.nav.get(i[o].offset,i[o].size,function(e,i){return function(r){n.drawChunk(r,e),i&&void 0!==t&&t()}}(a,o===i.length-1))}}}},{key:"drawChunk",value:function(e,t){t.innerHTML=e.data;var n=t.getElementsByClassName("r2seek"),i=!0,r=!1,o=void 0;try{for(var a,s=n[Symbol.iterator]();!(i=(a=s.next()).done);i=!0){var c=a.value;(0,p.applySeek)(c)}}catch(e){r=!0,o=e}finally{try{!i&&s.return&&s.return()}finally{if(r)throw o}}for(var l=t.children[0],u=l.children,d=this,f=0;f<u.length;f++)"SPAN"===u[f].tagName&&(-1!==u[f].className.indexOf("offset")?u[f].addEventListener("contextmenu",function(e){return function(t){return d.oncontextmenu(t,e)}}(u[f].id)):-1!==u[f].className.indexOf("fcn")?u[f].addEventListener("contextmenu",function(e){return function(t){return d.onfctmenu(t,e)}}(u[f].id)):-1!==u[f].className.indexOf("var")&&u[f].addEventListener("contextmenu",function(e){return function(t){return d.onvarmenu(t,e)}}(u[f].id)));var h=document.getElementById(this.nav.getSeekOffset());return null!==h&&h.classList.add("currentOffset"),document.getElementById(t)}},{key:"infiniteDrawingContent",value:function(e,t,n){var i=this,r=this.firstVisibleOffset();this.drawContent(this.container.getBody(),function(){i.replaceScrollPosition(r),n()})}},{key:"drawControls",value:function(e){var t=this;e.innerHTML="";var n=h.Inputs.iconButton("list","Others representations");n.id="disasm_more";var i=document.createElement("ul");i.className="mdl-menu mdl-menu--bottom-left mdl-js-menu mdl-js-ripple-effect",i.setAttribute("for","disasm_more");var r={Graph:function(){return d.uiContext.navigateTo(f.Widgets.DISASSEMBLY_GRAPH)},Infos:function(){return d.uiContext.navigateTo(f.Widgets.DISASSEMBLY_INFOS)},Functions:function(){return d.uiContext.navigateTo(f.Widgets.DISASSEMBLY_FUNCTIONS)},"Functions (full)":function(){return d.uiContext.navigateTo(f.Widgets.DISASSEMBLY_FUNCTIONS_FULL)},Blocks:function(){return d.uiContext.navigateTo(f.Widgets.DISASSEMBLY_BLOCKS)},Decompile:function(){return d.uiContext.navigateTo(f.Widgets.DISASSEMBLY_DECOMPILE)}};for(var o in r){var a=document.createElement("li");a.className="mdl-menu__item",a.textContent=o,a.addEventListener("click",r[o]),i.appendChild(a)}var s=document.createElement("div");s.className="button-controls-disasm",s.appendChild(n),s.appendChild(i),s.appendChild(h.Inputs.iconButton("mode_edit","Write",function(){return write()})),s.appendChild(h.Inputs.iconButton("find_replace","Open Analyze window",function(){return t.openAnalysisDialog()})),e.appendChild(s),componentHandler.upgradeDom(),this.history=document.createElement("ul"),this.history.id="disasm-history",e.appendChild(this.history),this.drawHistory(this.history)}},{key:"drawHistory",value:function(e){this.indexOffsetHistory,this.indexOffsetHistory,this.offsetHistory.length;e.innerHTML="";for(var t=0;t<this.offsetHistory.length;t++){var n=t===this.indexOffsetHistory,i=document.createElement("li");i.className=n?"active":"",i.i=t,i.x=this.offsetHistory[t],i.appendChild(document.createTextNode(this.offsetHistory[t])),i.addEventListener("click",function(e){m.r2Wrapper.seek(e.target.x)}),e.appendChild(i)}var i=document.createElement("li");i.title="Seek",i.appendChild(document.createTextNode("?")),i.addEventListener("click",function(){m.r2Wrapper.seek()}),e.appendChild(i)}},{key:"openAnalysisDialog",value:function(){this.analysisDialog.showModal()}},{key:"firstVisibleOffset",value:function(){var e=this.container.getBody().scrollTop;if(0!==e){for(var t=0,n=this.container.getBody().children,i=n[0],r=1;r<n.length;r++){var o=n[r].getBoundingClientRect().height;if((t+=o)>e){t-=o;break}i=n[r]}var a=t-e,s=i.getBoundingClientRect().height-a;return this.extractOffset_(i.children[0].id)+Math.ceil(s/this.lineHeight)}}},{key:"replaceScrollPosition",value:function(e){if(void 0!==e){var t=this.nav.getChunkPositionFor(e);if(-1===t)return void console.log("Chunk position from offset not found");for(var n=this.container.getBody().children[t],i=0;void 0===n.children[i].id;)i++;var r=this.extractOffset_(n.children[i].id),o=n.offsetTop,a=n.getBoundingClientRect().height,s=(e-r)/this.nav.getSize(r),c=Math.floor(s*a),l=o+c;this.container.getBody().scrollTop=l}}},{key:"drawContextualMenu",value:function(e){var t=this,n=function(e,n){var i,r=n+" @"+e;if(r2.cmdj(r,function(e){i=e}),null===i||i.constructor!==Array)return void alert("No available ouput!");t.addLongListDialog(i)},i=function(e,n,i){var r="";void 0!==i&&""===(r=prompt(i+"?"))||(""!==r&&(n+=" "+r),r2.cmd(n+" @"+e),t.nav.cleanOldData(),t.draw())},r=[{aoj:!1,name:"view graph",shortcut:"G",fct:function(){return d.uiContext.navigateTo(f.Widgets.DISASSEMBLY_GRAPH)}},{aoj:!1,name:"analyze function",shortcut:"F",fct:function(e,t){return i(t,"af")}},{aoj:!0,name:"immediate base...",shortcut:"i",expand:[{name:"binary",fct:function(e,t){return i(t,"ahi b")}},{name:"octal",fct:function(e,t){return i(t,"ahi o")}},{name:"decimal",fct:function(e,t){return i(t,"ahi d")}},{name:"hexadecimal",fct:function(e,t){return i(t,"ahi h")}},{name:"string",fct:function(e,t){return i(t,"ahi s")}}]},{aoj:!1,name:"add comment",shortcut:";",fct:function(e,t){return i(t,"CC","Name")}},{aoj:!1,name:"set flag",shortcut:"f",fct:function(e,t){return i(t,"f","Name")}},{aoj:!0,name:"rename flag",shortcut:"n",fct:function(e,t){return i(t,"fr","Name")}},{aoj:!0,name:"set string",shortcut:"s",fct:function(e,t){return i(t,"Cs")}},{aoj:!1,name:"find xrefs",shortcut:"x",fct:function(e,t){return n(t,"axtj")}},{aoj:!1,name:"as data",shortcut:"D",fct:function(e,t){return i(t,"Cd ","Size")}},{aoj:!1,name:"as code",shortcut:"F",fct:function(e,t){return i(t,"C-")}},{aoj:!1,name:"as string",shortcut:"S",fct:function(e,t){return i(t,"Cs")}}],o=document.getElementById("contextmenuDisasm");if(null===o){var o=document.createElement("nav");o.id="contextmenuDisasm",o.classList.add("context-menu")}else o.innerHTML="";var a=document.createElement("ul");o.appendChild(a);for(var t=this,s=function(e,n){e.addEventListener("mousedown",function(e){return function(n){e(n,t.getCurrentOffset())}}(n))},c=0;c<r.length;c++){var l=document.createElement("li");if(a.appendChild(l),l.appendChild(document.createTextNode(r[c].name)),l.isSubOpen=!1,l.addEventListener("mouseenter",function(e){for(var t=Array.prototype.slice.call(e.target.parentNode.getElementsByClassName("subactive")),n=0;n<t.length;n++)t[n].classList.remove("subactive"),t[n].isSubOpen=!1}),void 0!==r[c].expand&&(e&&r[c].aoj||!r[c].aoj)){l.addEventListener("mouseenter",function(e){if(!e.target.isSubOpen){e.target.isSubOpen=!0;var t=e.target.children[0];if(void 0!==t){var n=e.target.getBoundingClientRect(),i=Array.prototype.slice.call(e.target.parentNode.children).indexOf(e.target);e.target.classList.add("subactive"),t.style.left=n.width+"px",t.style.top=i*n.height+"px"}}});var u=document.createElement("ul");l.appendChild(u);for(var h=0;h<r[c].expand.length;h++){var p=document.createElement("li");u.appendChild(p),p.appendChild(document.createTextNode(r[c].expand[h].name)),s(p,r[c].expand[h].fct)}}else e&&r[c].aoj||!r[c].aoj?s(l,r[c].fct):l.classList.add("disabled")}document.body.appendChild(o),componentHandler.upgradeDom();var t=this;this.contextMenuOpen=!1;var m=function(){t.contextMenuOpen&&(o.classList.remove("active"),t.contextMenuOpen=!1)};window.onkeyup=function(e){27===e.keyCode&&m()},document.addEventListener("click",function(){m()})}},{key:"addLongListDialog",value:function(e){var t=document.createElement("dialog");t.className="mdl-dialog",t.showModal||dialogPolyfill.registerDialog(t);var n=document.createElement("div");n.className="mdl-dialog__content",t.appendChild(n);var i=document.createElement("p");i.appendChild(document.createTextNode("Results")),i.className="mdl-typography--text-center",n.appendChild(i);var r=document.createElement("div");r.className="mdl-card__supporting-text",t.appendChild(r);var o=document.createElement("table");o.className="disasm-table-dialog",o.style.width="100%",o.style.border="1px dashed red",r.appendChild(o);var a=document.createElement("thead");o.appendChild(a);for(var s=Object.keys(e[0]),c=0;c<s.length;c++){var l=document.createElement("th");l.appendChild(document.createTextNode(s[c])),a.appendChild(l)}var u=document.createElement("tbody");o.appendChild(u);for(var c=0;c<e.length;c++){var d=document.createElement("tr");u.appendChild(d);for(var f=0;f<s.length;f++){var h=document.createElement("td");if(d.appendChild(h),"opcode"===s[f])h.appendChild((0,p.formatOffset)(e[c][s[f]]));else if("from"===s[f]){var m="0x"+e[c][s[f]].toString(16);h.appendChild((0,p.formatOffset)(m))}else h.innerHTML=e[c][s[f]]}}var g=document.createElement("div");g.className="mdl-dialog__actions",t.appendChild(g);var v=document.createElement("button");v.className="mdl-button",v.innerHTML="Close",v.addEventListener("click",function(){t.close(),document.body.removeChild(t)}),g.appendChild(v),document.body.appendChild(t),componentHandler.upgradeDom(),t.showModal()}}]),t}(l.RadareInfiniteBlock)},{"../../core/R2Wrapper":5,"../../core/UIContext":7,"../../helpers/Format":9,"../../helpers/Inputs":11,"../../layout/FlexContainer":16,"../../layout/RadareInfiniteBlock":18,"../../widgets/Widgets":52,"./DisassemblyNavigator":21}],21:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){return 2*e}Object.defineProperty(n,"__esModule",{value:!0}),n.DisassemblyNavigator=void 0;var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),c=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var a=r.get;if(void 0!==a)return a.call(i)},l=e("../../core/BlockNavigator"),u=e("../../core/ChunkStatus");n.DisassemblyNavigator=function(e){function t(e,n){i(this,t);var o=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return o.currentOffset=n,o.howManyLines=e,o.gap=2*o.howManyLines,o.providerWorker=new Worker("disasmProvider.js"),o.optimalLines=3*o.howManyLines,o.MINFILL=.8*o.optimalLines,o.items=[],o.init(),o}return o(t,e),s(t,[{key:"init",value:function(){c(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"init",this).call(this),this.currentlyShown=[],this.populateFirst()}},{key:"configureWorker_",value:function(){var e=this;this.providerWorker.onmessage=function(t){for(var n,i=0;i<e.items.length;i++)e.items[i].offset===t.data.offset&&e.items[i].size===t.data.size&&(n=e.items[i]);if(void 0===n)return void console.log("Unable to find origin item");n.data=t.data.data,n.status=u.ChunkStatus.COMPLETED;for(var i=0;i<n.callback.length;i++)n.callback[i](n);n.callback=[]}}},{key:"cleanOldData",value:function(){for(var e=0;e<this.items.length;e++)delete this.items[e].data,delete this.items[e].status}},{key:"crunchingData",value:function(e){var t=new Worker("disasmNavProvider.js"),n=this;t.onmessage=function(i){n.navigationData=i.data,n.navigationOffsets=Object.keys(i.data),n.navigationOffsets.sort(),t.terminate(),e()},t.postMessage(!0)}},{key:"getOverlappingIntervals",value:function(e,t){var n=[];for(var i in this.navigationData){var r=i,o=i+this.navigationData[i].size;(r<=e&&o>=t||r<=e&&o>=e||r<=t&&o>=t||r>=e&&o<=t)&&n.push(i)}return n}},{key:"populateFirst",value:function(){return this.populateFrom(this.currentOffset)}},{key:"fillGap",value:function(e,t,n){var i=t-e;return[{offset:e,size:i,artifical:n}]}},{key:"populateFrom",value:function(e){for(var t=e-a(this.howManyLines),n=t+3*a(this.howManyLines),i=this.getOverlappingIntervals(t,n),r=[],o=0;o<i.length-1;o++){var s=i[o],c=i[o+1];if(c<s)if(l<=s)r.push({offset:i[o],size:this.navigationData[i[o]].size});else{var l=c+this.navigationData[c].size;r.push({offset:i[o],size:l-i[o]})}}if(r.length>0){r[0].offset!==t&&(r=r.concat(this.fillGap(t,r[0].offset)));var u=r[r.length-1],d=u.offset+u.size;d!==n&&(r=r.concat(this.fillGap(d+1,n)));for(var o=0;o<r.length-1;o++){var s=i[o],c=i[o+1];c-s>1&&(r=r.concat(this.fillGap(s+1,c)))}}else r=this.fillGap(t,n,!0);this.currentlyShown=r}},{key:"getShownOffset",value:function(){return this.currentlyShown}},{key:"getSize",value:function(e){for(var t=0;t<this.currentlyShown.length;t++)if(this.currentlyShown[t].offset===e)return this.currentlyShown[t].size;return-1}},{key:"getChunkPositionFor",value:function(e){for(var t=0;t<this.currentlyShown.length;t++)if(e>=this.currentlyShown[t].offset&&e<this.currentlyShown[t].offset+this.currentlyShown[t].size)return t;return-1}},{key:"get",value:function(e,t,n){for(var i,r=0;r<this.items.length;r++)this.items[r].offset===e&&this.items[r].size===t&&(i=this.items[r]);if(void 0===i&&(i={offset:e,size:t},this.items.push(i)),void 0!==i.data)return n(i);void 0===i.callback&&(i.callback=[]),i.callback.push(n),i.status!==u.ChunkStatus.LAUNCHED&&(i.status=u.ChunkStatus.LAUNCHED,this.providerWorker.postMessage({offset:i.offset,size:i.size}))}},{key:"go",value:function(e){this.currentOffset+=e*(2*this.howManyLines),this.populateFrom(this.currentOffset)}},{key:"refreshCurrentOffset",value:function(){var e=this;r2.cmd("s",function(t){e.currentOffset=parseInt(t,16)})}},{key:"getSeekOffset",value:function(){return this.currentOffset}}]),t}(l.BlockNavigator)},{"../../core/BlockNavigator":2,"../../core/ChunkStatus":3}],22:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0}),n.HexPairNavigator=void 0;var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=e("../../core/BlockNavigator"),c=e("../../core/NavigatorDirection");n.HexPairNavigator=function(e){function t(e,n,o){i(this,t);var a=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.howManyBytes=16*e,a.gap=a.howManyBytes,a.currentOffset=o,a.curChunk,a.providerWorker=new Worker("hexchunkProvider.js"),a.providerWorker.postMessage({howManyBytes:a.howManyBytes,nbCols:n}),a.init(),a}return o(t,e),a(t,[{key:"changeNbCols",value:function(e){this.providerWorker.postMessage({howManyBytes:this.howManyBytes,nbCols:e,reset:!0}),this.reset()}},{key:"reportChange",value:function(e,t){this.smallModifications.push({offset:e,value:t}),r2.cmd("wx "+t+" @"+e,function(){})}},{key:"hasNewValue",value:function(e){for(var t=0;t<this.smallModifications.length;t++)if(this.smallModifications[t].offset===e)return this.smallModifications[t].value;return null}},{key:"updateModifications",value:function(){var e=this;this.smallModifications=[],this.modifiedBytes=[],r2.cmd("wcj",function(t){for(var t=JSON.parse(t),n=0;n<t.length;n++)for(var i=t[n].addr,r=0;r<t[n].size;r++)e.modifiedBytes.push(i+r)})}},{key:"isModifiedByte",value:function(e){return this.modifiedBytes.indexOf(e)>-1}},{key:"getFlags",value:function(e,t){var n=function(t){for(var n=[],i=0;i<t.length;i++)t[i].size>=e&&n.push({name:t[i].name,start:t[i].offset,end:t[i].offset+t[i].size});return n.sort(function(e,t){return e.size>t.size?-1:1}),n},i=[],r=0,o=function(){
|
|
++r<3||t(n(i))};this.get(c.NavigatorDirection.CURRENT,function(e){i=i.concat(e.flags),o()}),this.get(c.NavigatorDirection.BEFORE,function(e){i=i.concat(e.flags),o()}),this.get(c.NavigatorDirection.AFTER,function(e){i=i.concat(e.flags),o()})}},{key:"getBytes",value:function(e){var t;return r2.cmdj("p8j "+(e.to-e.from+1)+" @"+e.from,function(e){t=e}),t}},{key:"refreshChunk",value:function(e,t){var n=[],i=this;this.get(e,function(r){r.callback=[],n=r.modified,i.get(e,function(e){e.modified.concat(n),t(e)},!0)})}},{key:"refreshCurrent",value:function(e){var t=0,n=function(){++t<3||e()};this.refreshChunk(c.NavigatorDirection.CURRENT,function(){n()}),this.refreshChunk(c.NavigatorDirection.BEFORE,function(){n()}),this.refreshChunk(c.NavigatorDirection.AFTER,function(){n()})}}]),t}(s.BlockNavigator)},{"../../core/BlockNavigator":2,"../../core/NavigatorDirection":4}],23:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0}),n.Hexdump=void 0;var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=e("./HexPairNavigator"),c=e("../../core/NavigatorDirection"),l=e("../../layout/RadareInfiniteBlock"),u=e("../../layout/FlexContainer"),d=e("./WordSizes"),f=(e("../../core/UIContext"),e("../../widgets/Widgets")),h=(e("../../helpers/Inputs"),e("../../helpers/Format")),p=e("../../core/R2Wrapper");n.Hexdump=function(e){function t(e,n,o){i(this,t);var a=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.container=new u.FlexContainer(e,"hex"),a.lineHeight=n,a.bigEndian=o,a.nbColumns=16,a.hexLength=d.WordSizes.PAIRS,a.init(),a.resetContainer(e),a.showFlags=!0,a.beingSelected=!1,a.selectionFirst,a.selectionEnd,a.lastColorUsed=-1,a.bgColors=["rgba(255,0,0,0.4)","rgba(0,255,0,0.4)","rgba(0,92,192,0.4)","rgba(255,255,0,0.4)","rgba(255,0,255,0.4)","rgba(0,255,255,0.4)"],a.flagColorAssociation=[],a}return o(t,e),a(t,[{key:"setOnChangeCallback",value:function(e){this.onChangeCallback=e}},{key:"init",value:function(){var e=this;this.refreshInitialOffset(),r2.cmdj("ecj|",function(t){e.colors=t}),r2.cmdj("ij|",function(t){e.writable=t.core.iorw}),this.selectionMode=!this.writable;for(var t in this.colors)this.colors[t]="rgb("+this.colors[t][0]+","+this.colors[t][1]+","+this.colors[t][2]+")";window.addEventListener("mousedown",function(t){0!==t.button||e.contextMenuOpen||e.cleanSelection()}),this.drawContextualMenu(),this.changeWritable()}},{key:"isWritable",value:function(){return this.writable&&!this.selectionMode}},{key:"changeWritable",value:function(){for(var e=Array.prototype.slice.call(document.getElementsByClassName("writableMenu")),t=this.writable?1:.5,n=0;n<e.length;n++)e[n].style.opacity=t}},{key:"resetContainer",value:function(e){this.refreshInitialOffset(),void 0!==this.nav&&this.nav.reset(),this.container.replug(e),this.container.reset(),this.container.drawBody(function(e){e.appendChild(document.createElement("div")),e.appendChild(document.createElement("div")),e.appendChild(document.createElement("div"))}),this.content=this.container.getBody(),this.defineInfiniteParams()}},{key:"getCurrentSelection",value:function(){return this.currentSelection}},{key:"defineInfiniteParams",value:function(){l.RadareInfiniteBlock.prototype.defineInfiniteParams.call(this),this.nav=new s.HexPairNavigator(this.howManyLines,this.nbColumns,this.initialOffset),this.nav.updateModifications()}},{key:"draw",value:function(){var e=this;this.drawControls(this.container.getControls()),this.drawContent(this.container.getBody(),function(){e.colorizeFlag()})}},{key:"colorizeByte",value:function(e,t){"00"===t||"ff"===t||"7f"===t?e.style.color=this.colors["b0x"+t]:isAsciiVisible(parseInt(t,16))?e.style.color="rgb(192,192,192)":e.style.color="inherit"}},{key:"pickColor",value:function(){return this.lastColorUsed=(this.lastColorUsed+1)%this.bgColors.length,this.bgColors[this.lastColorUsed]}},{key:"honoringEndian",value:function(e,t){return this.bigEndian?e+t:t+e}},{key:"pairs2words",value:function(e,t){if(1===t)return e;for(var n=[],i=0;i<e.length/2;i++)n.push(this.honoringEndian(e[2*i],e[2*i+1]));return this.pairs2words(n,t/2)}},{key:"cleanSelection",value:function(e){void 0===e&&(e=!1),e||(this.currentSelection={});var t;do{t=this.listContent.getElementsByClassName("selected");for(var n=0;n<t.length;n++)t[n].classList.remove("selected")}while(t.length>0)}},{key:"processSelection",value:function(e){e&&this.cleanSelection(!0),this.selectionFirst===this.selectionEnd&&(this.selectionFirst.classList.add("selected"),this.currentSelection={from:this.selectionFirst.offset,to:this.selectionFirst.offset});var t=this.selectionFirst.offset<this.selectionEnd.offset?this.selectionFirst:this.selectionEnd,n=this.selectionFirst.offset<this.selectionEnd.offset?this.selectionEnd:this.selectionFirst;this.currentSelection={from:t.offset,to:n.offset};for(var i=t,r=!1;!r;){var o=i;for(i.classList.add("selected");null!==o;){if(o.offset===n.offset)return o.classList.add("selected"),i=o,void(r=!0);do{i=o,o=o.nextSibling}while(void 0===i.offset);i.classList.add("selected")}var a=i.parentNode.parentNode.nextSibling;if(null===a)return;for(;a.children.length<=1;){if(null===a)return;a=a.nextSibling}i=a.children[1].children[0]}}},{key:"drawContent",value:function(e,t){var n=this;e.innerHTML="",this.listContent=document.createElement("ul"),this.listContent.className="listContent",e.appendChild(this.listContent),this.listContent.addEventListener("contextmenu",function(e){void 0!==n.currentSelection&&void 0!==n.currentSelection.from&&void 0!==n.currentSelection.to||(n.currentSelection={from:e.target.offset,to:e.target.offset}),e.preventDefault();var t=document.getElementById("contextmenuHex");n.contextMenuOpen?t.classList.remove("active"):(t.classList.add("active"),t.style.left=e.clientX+"px",t.style.top=e.clientY+"px"),n.contextMenuOpen=!n.contextMenuOpen}),this.nav.get(c.NavigatorDirection.CURRENT,function(e){n.curChunk=e}),this.nav.get(c.NavigatorDirection.BEFORE,function(e){n.isTopMax=0===e.offset,n.drawChunk(e),n.firstElement=n.drawChunk(n.getCurChunk())}),this.nav.get(c.NavigatorDirection.AFTER,function(e){n.drawChunk(e),n.content.scrollTop=0,n.content.scrollTop=n.getFirstElement().getBoundingClientRect().top,void 0!==t&&t()})}},{key:"drawChunk",value:function(e,t){var n=this;if(0===e.offset&&0===e.hex.length)return this.firstElement;var i,r;-1===this.hexLength?i=this.drawPairs_:(i=this.drawWords_,r=this.hexLength),void 0===t&&(t=c.NavigatorDirection.AFTER);for(var o,a,s=[],l=0;l<e.hex.length;l++){var u,d,f,p;!function(){var m=document.createElement("li");m.className="block"+e.offset,t===c.NavigatorDirection.AFTER?(n.listContent.appendChild(m),s.push(m),a=l):(n.listContent.insertBefore(m,n.listContent.firstChild),s.unshift(m),a=e.hex.length-1-l),m.addEventListener("mousedown",function(e){n.currentLine=m}),m.offset={},m.offset.start=e.offset+n.nbColumns*a,m.offset.end=m.offset.start+(n.nbColumns-1),u=document.createElement("ul"),d=document.createElement("ul"),f=document.createElement("ul"),u.classList.add("offset"),p=document.createElement("li"),u.appendChild(p);var g=int2fixedHex(e.offset+a*n.nbColumns,8),v=document.createElement("a");v.innerHTML=g,(0,h.applySeek)(v),p.appendChild(v),p.assoc=d,d.style.lineHeight=n.lineHeight+"px",d.classList.add("hexpairs"),f.classList.add("ascii"),m.appendChild(u),m.appendChild(d),m.appendChild(f),i.apply(n,[d,f,e.hex[a],e.ascii[a],e.modified,e.offset+n.nbColumns*a,r]),void 0===o&&(o=m)}()}return this.applyFlags(s,e.offset,e.flags),o}},{key:"infiniteDrawingContent",value:function(e,t,n){var i=this;this.nav.get(e,function(r){if(e===c.NavigatorDirection.BEFORE?i.isTopMax=0===r.offset:i.isTopMax&&i.nav.get(c.NavigatorDirection.BEFORE,function(e){e.offset>0&&(i.isTopMax=!1)}),0!==r.offset||0!==r.hex.length){var o;o=e===c.NavigatorDirection.BEFORE?i.listContent.lastChild.className:i.listContent.firstChild.className;for(var a=Array.prototype.slice.call(document.getElementsByClassName(o)),s=0;s<a.length;s++)a[s].parentNode.removeChild(a[s]);i.drawChunk(r,e),i.content.scrollTop=t,i.colorizeFlag(!0),n(i.isTopMax)}})}},{key:"showPairs_",value:function(e,t,n){n?(e.classList.add("active"),t.classList.add("active")):(e.classList.remove("active"),t.classList.remove("active"))}},{key:"drawWords_",value:function(e,t,n,i,r,o,a){var s=this.pairs2words(n,a);e.classList.add("words");for(var c=0;c<n.length;c++){var l=document.createElement("li");l.appendChild(document.createTextNode(i[c])),t.appendChild(l),this.colorizeByte(l,n[c])}for(var c=0;c<s.length;c++){var u,d=document.createElement("li");if(2===a){var f=""+new Int16Array([+s[c]])[0];f.length<5&&(f=Array(5-f.length).join("_")+f),u=document.createTextNode(f)}else u=document.createElement("a"),u.innerHTML="0x"+s[c],(0,h.applySeek)(u);d.appendChild(u),e.appendChild(d)}}},{key:"drawPairs_",value:function(e,t,n,i,r,o){var a=this;e.classList.add("pairs");for(var s={keydown:function(e){return 13===e.keyCode&&l(e.target)},blur:function(e){return l(e.target)}},c={keydown:function(e){return 13===e.keyCode&&u(e.target)},blur:function(e){return u(e.target)}},l=function(e){if(!e.busy){e.busy=!0;var t=e.value.match(/$([a-fA-F0-9]{2})^/);if(null===t){if(void 0===e.parentNode)return;return alert("Wrong format, expected: [a-fA-F0-9]{2}"),void(e.parentNode.innerHTML=e.initValue)}var n=t[0];e=e.parentNode;var i=a.nav.reportChange(e.offset,n);e.innerHTML=n,e.assoc.innerHTML=hexPairToASCII(n),null!==i&&(e.classList.add("modified"),e.assoc.classList.add("modified"),a.colorizeByte(e,n),a.colorizeByte(e.assoc,n),a.onChangeCallback(e.offset,i,n)),e.removeEventListener("keydown",s.keydown),e.removeEventListener("blur",s.blur)}},u=function(e){var t=e.value[0],n=ASCIIToHexpair(t);e=e.parentNode;var i=a.nav.reportChange(e.assoc.offset,n);e.innerHTML=t,e.assoc.innerHTML=n,null!==i&&(e.classList.add("modified"),e.assoc.classList.add("modified"),a.colorizeByte(e,t),a.colorizeByte(e.assoc,t),a.onChangeCallback(e.assoc.offset,e.assoc.innerHTML,n)),e.removeEventListener("keydown",c.keydown),e.removeEventListener("blur",c.blur)},d=0;d<n.length;d++){var f=o+d,h=this.nav.hasNewValue(f),p=this.nav.isModifiedByte(f);null!==h&&(n[d]=h,i[d]=hexPairToASCII(h),p=!0);var m=document.createElement("li");m.appendChild(document.createTextNode(n[d])),m.offset=f,p&&m.classList.add("modified");var g=document.createElement("li");g.appendChild(document.createTextNode(i[d])),p&&g.classList.add("modified"),g.assoc=m,m.assoc=g,e.appendChild(m),t.appendChild(g),this.colorizeByte(m,n[d]),this.colorizeByte(g,n[d]),m.addEventListener("mouseenter",function(e){return a.showPairs_(e.target,e.target.assoc,!0)}),m.addEventListener("mouseleave",function(e){return a.showPairs_(e.target,e.target.assoc,!1)}),g.addEventListener("mouseenter",function(e){return a.showPairs_(e.target,e.target.assoc,!0)}),g.addEventListener("mouseleave",function(e){return a.showPairs_(e.target,e.target.assoc,!1)}),this.isWritable()?(m.addEventListener("click",function(e){if(0===e.button){e.preventDefault();var t=document.createElement("input");t.maxLength=2,t.initValue=e.target.innerHTML,t.value=e.target.innerHTML,t.pattern="[a-fA-F0-9]{2}",e.target.innerHTML="",e.target.appendChild(t),t.busy=!1,t.addEventListener("keydown",s.keydown),t.addEventListener("blur",s.blur),t.focus()}}),g.addEventListener("click",function(e){if(0===e.button){e.preventDefault();var t=document.createElement("input");t.maxLength=1,t.value=e.target.innerHTML,t.pattern="(.){1}",e.target.innerHTML="",e.target.appendChild(t),t.addEventListener("keydown",c.keydown),t.addEventListener("blur",c.blur),t.focus()}})):function(){m.addEventListener("click",function(){a.beingSelected=!1,a.cleanSelection()});var e=function e(){a.beingSelected=!1,window.removeEventListener("mouseup",e)};m.addEventListener("mousedown",function(t){0===t.button&&(t.preventDefault(),a.beingSelected=!0,a.selectionFirst=t.target,window.addEventListener("mouseup",e))}),m.addEventListener("mouseover",function(e){a.beingSelected&&(a.selectionEnd=e.target,a.processSelection(!0))}),m.addEventListener("mouseup",function(e){a.beingSelected&&(a.selectionEnd=e.target,a.processSelection(!1))})}()}}},{key:"drawContextualMenu",value:function(){var e,t=this,n=function(e,n,i,r){var o;r2.cmd(i+" "+(n.to-n.from)+" @"+n.from,function(e){o=e});var a=t.createExportDialog("Export as "+e+":",o,function(){var e,t=new Blob([o],{type:"text/plain"});r2.cmdj("ij",function(t){e=basename(t.core.file)}),e+="_0x"+n.from.toString(16)+"-0x"+n.to.toString(16)+"."+r,saveAs(t,e)});document.body.appendChild(a),componentHandler.upgradeDom(),a.showModal()},i=[{name:"Assembly",fct:function(e,t){return n("ASM",t,"pca","asm")}},{name:"Disassembly",fct:function(e,t){return n("DISASM",t,"pD","disasm")}},{name:"Hexpairs",fct:function(e,t){return n("HEXPAIRS",t,"p8","disasm")}},{name:"Base64 Encode",fct:function(e,t){return n("b64e",t,"p6e","disasm")}},{name:"Base64 Decode",fct:function(e,t){return n("b64d",t,"p6d","disasm")}},{name:"Binary",fct:function(n,i){e=new Uint8Array(t.nav.getBytes(i));var r,o=new Blob([e],{type:"application/octet-stream"});r2.cmdj("ij",function(e){r=basename(e.core.file)}),r+="_0x"+i.from.toString(16)+"-0x"+i.to.toString(16)+".bin",saveAs(o,r)}},{name:"C",fct:function(e,t){return n("C",t,"pc","c")}},{name:"C half-words (2 bytes)",fct:function(e,t){return n("C",t,"pch","c")}},{name:"C words (4 bytes)",fct:function(e,t){return n("C",t,"pcw","c")}},{name:"C dwords (8 bytes)",fct:function(e,t){return n("C",t,"pcd","c")}},{name:"JavaScript",fct:function(e,t){return n("JS",t,"pcJ","js")}},{name:"JSON",fct:function(e,t){return n("JSON",t,"pcj","json")}},{name:"Python",fct:function(e,t){return n("Python",t,"pcp","py")}},{name:"R2 commands",fct:function(e,t){return n("R2 cmd",t,"pc*","r2")}},{name:"Shell script",fct:function(e,t){return n("Shell script",t,"pcS","txt")}},{name:"String",fct:function(e,t){return n("string",t,"pcs","txt")}}],r=function(e,n){var i=prompt("Value (valid hexpair):"),r=n+" "+i+" "+(e.to-e.from)+" @"+e.from;r2.cmd(r,function(){return console.log("Call: "+r)}),t.nav.updateModifications(),t.nav.refreshCurrent(function(){return t.draw()})},o=[{name:"addition",fct:function(e,t){return r(t,"woa")}},{name:"and",fct:function(e,t){return r(t,"woA")}},{name:"divide",fct:function(e,t){return r(t,"wod")}},{name:"shift left",fct:function(e,t){return r(t,"wol")}},{name:"multiply",fct:function(e,t){return r(t,"wom")}},{name:"or",fct:function(e,t){return r(t,"woo")}},{name:"shift right",fct:function(e,t){return r(t,"wor")}},{name:"substraction",fct:function(e,t){return r(t,"wos")}},{name:"write looped",fct:function(e,t){return r(t,"wow")}},{name:"xor",fct:function(e,t){return r(t,"wox")}},{name:"2 byte endian swap",fct:function(e,t){return r(t,"wo2")}},{name:"4 byte endian swap",fct:function(e,t){return r(t,"wo4")}}],a=[{name:"Select line",fct:function(e,n){t.selectionFirst=t.currentLine.children[1].children[0],t.selectionEnd=t.currentLine.children[1].children[t.currentLine.children[1].children.length-1],t.processSelection(!0)}},{name:"Set flag",fct:function(e,n){var i=prompt("Flag's name:");r2.cmd("f "+i+" "+(n.to-n.from+1)+" @"+n.from,function(){t.nav.refreshCurrent(function(){return t.draw()})})}},{name:"Export as...",expand:i,requireWritable:!1},{name:"Operations...",expand:o,requireWritable:!0}],s=document.createElement("nav");s.id="contextmenuHex",s.classList.add("context-menu");var c=document.createElement("ul");s.appendChild(c);for(var l=function(e,n){e.addEventListener("mousedown",function(e){n(e,t.getCurrentSelection())})},u=0;u<a.length;u++){var d=document.createElement("li");if(c.appendChild(d),d.appendChild(document.createTextNode(a[u].name)),d.isSubOpen=!1,d.requireWritable=a[u].requireWritable,a[u].requireWritable&&d.classList.add("writableMenu"),d.addEventListener("mouseenter",function(e){for(var t=Array.prototype.slice.call(e.target.parentNode.getElementsByClassName("subactive")),n=0;n<t.length;n++)t[n].classList.remove("subactive"),t[n].isSubOpen=!1}),void 0!==a[u].expand){d.addEventListener("mouseenter",function(e){if((!e.target.requireWritable||t.writable)&&!e.target.isSubOpen){e.target.isSubOpen=!0;var n=e.target.children[0];if(void 0!==n){var i=e.target.getBoundingClientRect(),r=Array.prototype.slice.call(e.target.parentNode.children).indexOf(e.target);e.target.classList.add("subactive"),n.style.left=i.width+"px",n.style.top=r*i.height+"px"}}});var f=document.createElement("ul");d.appendChild(f);for(var h=0;h<a[u].expand.length;h++){var p=document.createElement("li");f.appendChild(p),p.appendChild(document.createTextNode(a[u].expand[h].name)),l(p,a[u].expand[h].fct)}}else l(d,a[u].fct)}document.body.appendChild(s),componentHandler.upgradeDom(),this.contextMenuOpen=!1;var m=function(){t.contextMenuOpen&&(s.classList.remove("active"),t.contextMenuOpen=!1)};window.onkeyup=function(e){return 27===e.keyCode&&m()},document.addEventListener("click",function(){return m()})}},{key:"createExportDialog",value:function(e,t,n){var i=document.createElement("dialog");i.className="mdl-dialog",i.showModal||dialogPolyfill.registerDialog(i);var r=document.createElement("div");r.className="mdl-dialog__content",i.appendChild(r);var o=document.createTextNode(e);r.appendChild(o);var a=document.createElement("textarea");a.style.width="100%",a.style.height="220px",r.appendChild(a),a.value=t;var s=document.createElement("div");s.className="mdl-dialog__actions",i.appendChild(s);var c=document.createElement("button");c.className="mdl-button",c.innerHTML="Save",c.addEventListener("click",function(){i.close(),i.parentNode.removeChild(i),n()}),s.appendChild(c);var l=document.createElement("button");return l.className="mdl-button",l.innerHTML="Close",l.addEventListener("click",function(){i.close(),i.parentNode.removeChild(i)}),s.appendChild(l),i}},{key:"drawControls",value:function(e){var t=this;e.innerHTML="";var n=document.createElement("ul");n.classList.add("controlList"),e.appendChild(n);var i=document.createElement("li");n.appendChild(i);var r=document.createElement("li");n.appendChild(r);var o=document.createElement("li");n.appendChild(o);var a=document.createElement("li");n.appendChild(a);var s=document.createElement("li");n.appendChild(s);var c=document.createElement("span"),l=document.createElement("select");c.appendChild(l);for(var u in d.WordSizes){var f=document.createElement("option");f.value=d.WordSizes[u],f.text=d.WordSizes[u]>0?8*d.WordSizes[u]+" bits":"pairs",d.WordSizes[u]===this.hexLength&&(f.selected=!0),l.appendChild(f)}l.addEventListener("change",function(e){t.hexLength=parseInt(e.target.value),t.draw()},!1);var h=document.createElement("input");h.className="mdl-textfield__input",h.style.width="26px",h.style.display="inline",h.pattern="[0-9]+",h.value=this.nbColumns;var p=function(e){t.nbColumns=h,t.nav.changeNbCols(h),t.draw(),e.value=h},m=document.createElement("span");m.title="Number of columns per line";var g=document.createElement("button");g.className="mdl-button mdl-js-button mdl-button--icon",g.appendChild(document.createTextNode("-")),g.addEventListener("click",function(){return p(t.nbColumns-1)});var v=document.createElement("button");v.className="mdl-button mdl-js-button mdl-button--icon",v.appendChild(document.createTextNode("+")),v.addEventListener("click",function(){return p(t.nbColumns+1)}),h.addEventListener("change",function(e){var t=parseInt(e.target.value);p(t)}),m.appendChild(g),m.appendChild(document.createTextNode(" ")),m.appendChild(h),m.appendChild(document.createTextNode(" ")),m.appendChild(v);var y=document.createElement("input");y.classList.add("mdl-checkbox__input"),y.type="checkbox",y.checked=this.bigEndian;var b=document.createElement("span");b.classList.add("mdl-checkbox__label"),b.appendChild(document.createTextNode("bigEndian"));var C=document.createElement("label");C.classList.add("mdl-checkbox"),C.classList.add("mdl-js-checkbox"),C.classList.add("mdl-js-ripple-effect"),C.appendChild(y),C.appendChild(b),y.addEventListener("change",function(){t.bigEndian=!t.bigEndian,t.draw()});var w=document.createElement("input");w.classList.add("mdl-checkbox__input"),w.type="checkbox",w.checked=this.isWritable();var E=document.createElement("span");E.classList.add("mdl-checkbox__label"),E.appendChild(document.createTextNode("isEditable"));var k=document.createElement("label");k.classList.add("mdl-checkbox"),k.classList.add("mdl-js-checkbox"),k.classList.add("mdl-js-ripple-effect"),k.appendChild(w),k.appendChild(E),this.writable||(w.disabled=!0),w.addEventListener("change",function(){t.selectionMode=!t.selectionMode,t.draw()});var S=document.createElement("input");S.classList.add("mdl-checkbox__input"),S.type="checkbox",S.checked=this.showFlags;var _=document.createElement("span");_.classList.add("mdl-checkbox__label"),_.appendChild(document.createTextNode("showFlags"));var O=document.createElement("label");O.classList.add("mdl-checkbox"),O.classList.add("mdl-js-checkbox"),O.classList.add("mdl-js-ripple-effect"),O.appendChild(S),O.appendChild(_),S.addEventListener("change",function(){t.showFlags=!t.showFlags,t.draw()}),i.appendChild(c),r.appendChild(m),o.appendChild(C),a.appendChild(k),s.appendChild(O),componentHandler.upgradeDom()}},{key:"getFlagColor",value:function(e){for(var t=0;t<this.flagColorAssociation.length;t++)if(this.flagColorAssociation[t].name===e)return this.flagColorAssociation[t].color;var n=this.pickColor();return this.flagColorAssociation.push({name:e,color:n}),n}},{key:"applyFlags",value:function(e,t,n){var i=this;if(this.showFlags){for(var r in n){var o,a,s;(function(){for(a=n[r],s=0;s<e.length;s++)if(e[s].offset.start<=a.offset&&e[s].offset.end>=a.offset){o=e[s];break}if(void 0===o)return"continue";var c=document.createElement("li"),l=int2fixedHex(a.offset,8);c.classList.add("block"+t),c.classList.add("flag"),c.offset=l,c.appendChild(document.createTextNode("["+l+"] "+a.name)),c.title="Go to Disassembly",c.style.cursor="pointer",c.addEventListener("click",function(){return p.r2Wrapper.seek(l,f.Widgets.DISASSEMBLY)}),c.title="("+a.size+" bytes) Seek "+l+" on disassembly widget",c.style.color=i.getFlagColor(a.name),i.listContent.insertBefore(c,o)})()}}}},{key:"indexOfLine_",value:function(e){for(var t=[].slice.call(this.listContent.children),n=0;n<t.length;n++)if(void 0!==t[n].offset&&t[n].offset.start<=e&&t[n].offset.end>=e)return n;return-1}},{key:"colorizeFlag",value:function(e){var t=this;if(this.showFlags){void 0===e&&(e=!1);var n=[].slice.call(this.listContent.children);if(e)for(var i=0;i<n.length;i++)n[i].backgroundColor="none";this.nav.getFlags(2,function(e){for(var i=0;i<e.length;i++){var r=!1,o=t.indexOfLine_(e[i].start);if(-1===o)return void console.log("Undefined flag offset");for(var a=e[i].start-n[o].offset.start,s=o;s<n.length&&!r;s++)if(void 0!==n[s].offset&&!n[s].classList.contains("flag")){for(var c=n[s].children[1].children,l=a;l<c.length;l++){if(c[l].offset===e[i].end){r=!0;break}c[l].style.backgroundColor=t.getFlagColor(e[i].name)}a=0}}})}}}]),t}(l.RadareInfiniteBlock)},{"../../core/NavigatorDirection":4,"../../core/R2Wrapper":5,"../../core/UIContext":7,"../../helpers/Format":9,"../../helpers/Inputs":11,"../../layout/FlexContainer":16,"../../layout/RadareInfiniteBlock":18,"../../widgets/Widgets":52,"./HexPairNavigator":22,"./WordSizes":24}],24:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.WordSizes={PAIRS:-1,HALF:2,WORD:4,QUADWORD:8}},{}],25:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();n.AnalysisCard=function(){function e(){i(this,e),this.analysisMethods=[{id:"symbols",name:"Analyse symbols",cmd:"aa"},{id:"ref",name:"Analyse References",cmd:"aar"},{id:"calls",name:"Analyse calls",cmd:"e anal.calls=true;aac",disabledCmd:"e anal.calls=false"},{id:"emu",name:"Emulate code",cmd:"e asm.emu=1;aae;e asm.emu=0",disabledCmd:"e asm.emu=false"},{id:"prelude",name:"Find preludes",cmd:"aap"},{id:"autoname",name:"Autoname fcns",cmd:"aan"}],this.build()}return r(e,[{key:"DOM",get:function(){return this.card}},{key:"onAnalysis",set:function(e){this.analysisCallback=e}}]),r(e,[{key:"build",value:function(){var e=this;this.card=document.createElement("div"),this.card.className="demo-options mdl-card mdl-color--teal-300 mdl-shadow--2dp mdl-cell mdl-cell--4-col mdl-cell--3-col-tablet mdl-cell--12-col-desktop";var t=document.createElement("div");t.className="mdl-card__title mdl-card--expand mdl-color--teal-300",t.innerHTML='<h2 class="mdl-card__title-text">Analysis Options</h2>',this.card.appendChild(t);var n=document.createElement("div");n.className="mdl-card__supporting-text mdl-color-grey-600",this.card.appendChild(n);var i=document.createElement("ul");n.appendChild(i);var r=document.createElement("div");r.className="mdl-card__actions mdl-card--border",this.card.appendChild(r);var o=document.createElement("a");o.className="mdl-button mdl-js-button mdl-js-ripple-effect mdl-color--blue-grey-50 mdl-color-text--blue-greu-50",o.textContent="Analyse",o.addEventListener("click",function(){return e.analyse()}),r.appendChild(o);var a=document.createElement("div");a.className="mdl-layout-spacer",r.appendChild(a);var s=document.createElement("i");s.className="material-icons",s.textContent="room",r.appendChild(s),this.addAnalysisOptions(i)}},{key:"addAnalysisOptions",value:function(e){for(var t in this.analysisMethods){var n=this.analysisMethods[t],i="anal_"+n.id,r=document.createElement("li");e.appendChild(r);var o=document.createElement("label");o.className="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect",o.for=i,r.appendChild(o);var a=document.createElement("input");a.className="mdl-checkbox__input",a.id=i,a.type="checkbox",o.appendChild(a);var s=document.createElement("span");s.className="mdl-checkbox__label",s.innerHTML=n.name,o.appendChild(s)}}},{key:"refresh",value:function(){[].slice.call(this.card.getElementsByTagName("input")).forEach(function(e){return e.checked=!1})}},{key:"analyse",value:function(){var e=!1;for(var t in this.analysisMethods){var n=this.analysisMethods[t],i="anal_"+n.id;document.getElementById(i).checked?(r2.cmd(n.cmd),e=!0):void 0!==n.disabledCmd&&r2.cmd(n.cmd)}e&&void 0!==this.analysisCallback&&this.analysisCallback()}}]),e}()},{}],26:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0}),n.EntropyCard=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=e("../../core/R2Wrapper"),a=e("../../widgets/Widgets"),s="http://www.w3.org/2000/svg";n.EntropyCard=function(){function e(t,n){i(this,e),this.width=t,this.height=n,this.entropy=[],this.build(),this.refreshEntropy(),this.draw()}return r(e,[{key:"DOM",get:function(){return this.card}}]),r(e,[{key:"build",value:function(){this.card=document.createElement("div"),this.card.className="demo-charts mdl-color--white mdl-shadow--2dp mdl-cell mdl-cell--12-col mdl-grid",this.card.style.textAlign="center",this.svg=document.createElementNS(s,"svg"),this.card.appendChild(this.svg),this.svg.style.display="block",this.svg.style.margin="auto",this.svg.setAttribute("fill","currentColor"),this.svg.setAttribute("viewBox","0 0 "+this.width+" "+this.height),this.svg.setAttribute("width",this.width+"px"),this.svg.setAttribute("height",this.height+"px"),this.svg.setAttribute("title","Entropy graph")}},{key:"refreshEntropy",value:function(){var e=this;r2.cmdj("p=ej 50 $s @ $M|",function(t){t&&t.entropy&&(e.entropy=t.entropy)})}},{key:"draw",value:function(){var e=this,t=this.entropy.length;if(!(t<1)){var n=this.entropy.reduce(function(e,t){return e.value<t.value?e:t}).value,i=this.entropy.reduce(function(e,t){return e.value>t.value?e:t}).value,r=this.width/t,c=this.height;this.svg.innerHTML="";for(var l in this.entropy)!function(t){var l=e.entropy[t],u=.1+(l.value-n)/(i-n)*.9,d=document.createElementNS(s,"g");d.addEventListener("click",function(){o.r2Wrapper.seek(l.addr,a.Widgets.DISASSEMBLY)}),e.svg.appendChild(d);var f=document.createElementNS(s,"title");f.textContent="0x"+l.addr.toString(16),d.appendChild(f);var h=document.createElementNS(s,"rect");h.setAttribute("x",r*t),h.setAttribute("y",0),h.setAttribute("width",r),h.setAttribute("height",c),h.setAttribute("fill","#000"),h.setAttribute("fill-opacity",u);var p=document.createElementNS(s,"text"),m=u>.4?"#EEEEEE":"black";p.setAttribute("x",r*t+2),p.setAttribute("y",c+10),p.setAttribute("fill",m),p.setAttribute("font-family","Roboto"),p.setAttribute("font-size",12),p.setAttribute("transform","rotate(-90, "+r*t+", "+c+")"),p.textContent="0x"+l.addr.toString(16),d.appendChild(h),d.appendChild(p)}(l)}}},{key:"refresh",value:function(){this.refreshEntropy(),this.draw()}}]),e}()},{"../../core/R2Wrapper":5,"../../widgets/Widgets":52}],27:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0}),n.FortunesCard=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=e("../../helpers/Speak.js");n.FortunesCard=function(){function e(){i(this,e),this.currentFortune=this.getNewFortune(),(0,o.speak)(this.currentFortune),this.build()}return r(e,[{key:"DOM",get:function(){return this.card}}]),r(e,[{key:"build",value:function(){var e=this;this.card=document.createElement("div"),this.card.className="demo-updates mdl-card mdl-shadow--2dp mdl-cell mdl-cell--4-col mdl-cell--4-col-tablet mdl-cell--12-col-desktop";var t=document.createElement("div");t.className="mdl-card__title mdl-card--expand mdl-color--teal-300",t.innerHTML='<h2 class="mdl-card__title-text">Fortunes</h2>',this.fortuneBlock=document.createElement("div"),this.fortuneBlock.className="mdl-card__supporting-text mdl-color-text--grey-600",this.fortuneBlock.innerHTML=this.currentFortune;var n=document.createElement("div");n.className="mdl-card__actions mdl-card--border";var i=document.createElement("a");i.className="mdl-button mdl-js-button mdl-js-ripple-effect",i.innerHTML="Next",i.addEventListener("click",function(){return e.refresh()}),n.appendChild(i),this.card.appendChild(t),this.card.appendChild(this.fortuneBlock),this.card.appendChild(n)}},{key:"refresh",value:function(){this.currentFortune=this.getNewFortune(),this.fortuneBlock.innerHTML=this.currentFortune,(0,o.speak)(this.currentFortune)}},{key:"getNewFortune",value:function(){var e=void 0;return r2.cmd("fo",function(t){e=t}),e}}]),e}()},{"../../helpers/Speak.js":12}],28:[function(e,t,n){"use strict";function i(e,t){
|
|
if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0}),n.GraphCard=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=e("../../core/UIContext"),a=e("../../core/R2Wrapper"),s=e("../../widgets/Widgets");n.GraphCard=function(){function e(){i(this,e),this.build()}return r(e,[{key:"DOM",get:function(){return this.card}}]),r(e,[{key:"build",value:function(){this.card=document.createElement("div"),this.card.className="demo-charts mdl-color--white mdl-shadow--2dp mdl-cell mdl-cell--12-col mdl-grid";var e=this.createChart("code","Go to assembly",void 0,82,function(){a.r2Wrapper.seek("entry0",s.Widgets.DISASSEMBLY)}),t=this.createChart("data","Go to hexdump",void 0,22,function(){a.r2Wrapper.seek("0x00",s.Widgets.HEXDUMP)}),n=this.createChart("strings","Go to strings",void 0,4,function(){o.uiContext.navigateTo(s.Widgets.STRINGS)}),i=this.createChart("functions","Go to functions",void 0,82,function(){o.uiContext.navigateTo(s.Widgets.FUNCTIONS)});this.card.appendChild(e),this.card.appendChild(t),this.card.appendChild(n),this.card.appendChild(i)}},{key:"createChart",value:function(e,t,n,i,r){var o="http://www.w3.org/2000/svg",a=document.createElementNS(o,"svg");a.setAttribute("class","demo-chart mdl-cell mdl-cell--4-col mdl-cell--3-col-desktop"),a.setAttribute("fill","currentColor"),a.setAttribute("viewBox","0 0 1 1"),a.setAttribute("width","200px"),a.setAttribute("height","200px"),a.setAttribute("title",t),a.addEventListener("click",r);var s=document.createElementNS(o,"use");s.setAttributeNS("http://www.w3.org/1999/xlink","href","#piechart"),s.setAttribute("mask","url(#piemask)"),a.appendChild(s);var c=document.createElementNS(o,"text");c.setAttribute("x","0.3"),c.setAttribute("y","0.2"),c.setAttribute("font-family","Roboto"),c.setAttribute("font-size","0.1"),c.setAttribute("fill","#888"),c.setAttribute("text-anchor","top"),c.setAttribute("dy","0.1"),c.textContent=e,a.appendChild(c);var l=document.createElementNS(o,"text");l.setAttribute("x","0.5"),l.setAttribute("y","0.5"),l.setAttribute("font-family","Roboto"),l.setAttribute("font-size","0.3"),l.setAttribute("fill","#888"),l.setAttribute("text-anchor","middle"),l.setAttribute("dy","0.1"),l.textContent=i,a.appendChild(l);var u=document.createElementNS(o,"tspan");return u.setAttribute("dy","-0.07"),u.setAttribute("font-size","0.2"),u.textContent="%",l.appendChild(u),a}},{key:"refresh",value:function(){}}]),e}()},{"../../core/R2Wrapper":5,"../../core/UIContext":7,"../../widgets/Widgets":52}],29:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0}),n.InfoCard=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=e("../../helpers/Format"),a=e("../../widgets/Widgets");n.InfoCard=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;i(this,e),this.headersCmd=[{name:"HDR",title:"Headers",format:this.formatAsKeyValue,cmd:"i|",grep:null,ready:!1},{name:"SYM",title:"Symbols",format:this.fromatAsCode,cmd:"isq",grep:"!imp",ready:!1},{name:"IMP",title:"Imports",format:this.fromatAsCode,cmd:"isq",grep:"imp.",ready:!1},{name:"REL",title:"Relocations",format:this.fromatAsCode,cmd:"ir",grep:null,ready:!1},{name:"SEC",title:"Sections",format:this.fromatAsCode,cmd:"iSq",grep:null,ready:!1},{name:"STR",title:"Strings",format:this.fromatAsCode,cmd:"izq",grep:null,ready:!1},{name:"SDB",title:"Sdb",format:this.fromatAsCode,cmd:"k bin/cur/***",grep:null,ready:!1}],this.build(),this.preloadTabs(t)}return r(e,[{key:"DOM",get:function(){return this.card}},{key:"nbTabs",get:function(){return this.headersCmd.length}}]),r(e,[{key:"build",value:function(){this.card=document.createElement("div"),this.card.className="demo-graphs mdl-shadow--2dp mdl-color--white mdl-cell mdl-cell--8-col";var e=document.createElement("div");e.className="mdl-tabs mdl-js-tabs",this.card.appendChild(e),this.tabs=document.createElement("div"),this.tabs.className="mdl-tabs__tab-bar overview-tabs",this.content=document.createElement("div"),e.appendChild(this.tabs),e.appendChild(this.content),this.createTabs(this.headersCmd,this.tabs,this.content)}},{key:"createTabs",value:function(e,t,n){var i=this,r=!0;for(var o in e)!function(o){var a=e[o],s="tab-"+a.name,c=document.createElement("a");c.classList.add("mdl-tabs__tab"),c.href="#"+s,c.title=a.title,c.innerHTML=a.name;var l=document.createElement("div");l.classList.add("mdl-tabs__panel"),l.id=s,r&&(l.classList.add("is-active"),c.classList.add("is-active"),r=!1),c.addEventListener("click",function(){return i.loadTab(l,a)}),t.appendChild(c),n.appendChild(l)}(o)}},{key:"fixHeight",value:function(e){this.content.style.height="0px";var t=this.card.getBoundingClientRect().height,n=this.tabs.getBoundingClientRect().height,i=t-n-32;this.content.style.height=(i<e?e:i)+"px",this.content.style.overflow="auto"}},{key:"preloadTabs",value:function(e){e=e>this.nbTabs?this.nbTabs:e;for(var t=0;t<e;t++)this.loadTab(this.content.children[t],this.headersCmd[t])}},{key:"loadTab",value:function(e,t){if(!t.ready){var n=t.cmd;t.grep&&(n+="~"+t.grep),r2.cmd(n,function(n){e.innerHTML="",e.appendChild(t.format(n))}),t.cols>1&&(e.style["-webkit-column-count"]=t.cols,e.style["-moz-column-count"]=t.cols,e.style["column-count"]=t.cols),t.ready=!0}}},{key:"refresh",value:function(){for(var e in this.headersCmd)this.headersCmd[e].ready=!1;var t=[].slice.call(this.content.children);for(var n in t)if(t[n].className.indexOf("is-active")>-1){this.loadTab(t[n],this.headersCmd[n]);break}}},{key:"fromatAsCode",value:function(e){var t=document.createElement("pre");return t.style.marge="1.2em",t.appendChild((0,o.formatOffsets)(e,a.Widgets.DISASSEMBLY)),t}},{key:"formatAsKeyValue",value:function(e){var t=document.createElement("dl");t.classList.add("infocard");var n=e.split(/\n/g);for(var i in n){var r=n[i].split(/ (.+)?/);if(r.length>=2){var o=document.createElement("dt");o.textContent=r[0],t.appendChild(o);var a=document.createElement("dd");a.textContent=r[1],t.appendChild(a)}}return t}}]),e}()},{"../../helpers/Format":9,"../../widgets/Widgets":52}],30:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0}),n.Overview=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=e("./AnalysisCard"),a=e("./EntropyCard"),s=e("./FortunesCard"),c=e("./GraphCard"),l=e("./InfoCard");n.Overview=function(){function e(){var t=this;i(this,e),this.analysisCard=new o.AnalysisCard,this.entropyCard=new a.EntropyCard(600,120),this.fortuneCard=new s.FortunesCard,this.graphCard=new c.GraphCard,this.infoCard=new l.InfoCard,this.build(),this.analysisCard.onAnalysis=function(){t.entropyCard.refresh(),t.graphCard.refresh(),t.infoCard.refresh()}}return r(e,[{key:"DOM",get:function(){return this.dom}}]),r(e,[{key:"build",value:function(){this.dom=document.createElement("div"),this.dom.className="mdl-grid demo-content";var e=document.createElement("div");e.className="demo-cards mdl-cell mdl-cell--4-col mdl-cell--8-col-tablet mdl-grid mdl-grid--no-spacing";var t=document.createElement("div");t.className="demo-separator mdl-cell--1-col",e.appendChild(this.fortuneCard.DOM),e.appendChild(t),e.appendChild(this.analysisCard.DOM),this.dom.appendChild(this.infoCard.DOM),this.dom.appendChild(e),this.dom.appendChild(this.entropyCard.DOM),this.dom.appendChild(this.graphCard.DOM)}},{key:"refresh",value:function(){this.analysisCard.refresh(),this.entropyCard.refresh(),this.fortuneCard.refresh(),this.graphCard.refresh(),this.infoCard.refresh()}},{key:"adjustLayout",value:function(){var e=this;window.addEventListener("resize",function(){return e.infoCard.fixHeight(300)},!0),this.infoCard.fixHeight(300)}}]),e}()},{"./AnalysisCard":25,"./EntropyCard":26,"./FortunesCard":27,"./GraphCard":28,"./InfoCard":29}],31:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0}),n.BasePreWidget=void 0;var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=e("./BaseWidget"),c=(e("../helpers/Inputs"),e("../core/R2Wrapper"));n.BasePreWidget=function(e){function t(e,n,o){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;i(this,t);var s=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"dark"));return s.formatFunc=n,s.r2cmd=o,null!==a&&(s.backButton=a),s}return o(t,e),a(t,[{key:"init",value:function(){var e=this;void 0!==this.backButton&&(this.backButton.style.position="absolute",this.backButton.style.top="1em",this.backButton.style.left="1em",c.r2Wrapper.registerListener(c.R2Actions.SEEK,function(){e.displayed&&e.draw()}))}},{key:"draw",value:function(){void 0!==this.backButton&&this.node.appendChild(this.backButton),this.node.appendChild(this.getPre())}},{key:"getPre",value:function(){var e=this,t=document.createElement("pre");return r2.cmd(this.r2cmd,function(n){t.appendChild(e.formatFunc(n))}),t}}]),t}(s.BaseWidget)},{"../core/R2Wrapper":5,"../helpers/Inputs":11,"./BaseWidget":32}],32:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();n.BaseWidget=function(){function e(t){i(this,e),this.name=t;for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];this.classNames=r,this.classNames.push("rwidget"),this.init(),this.focused=!1,this.displayed=!1}return r(e,[{key:"rootNode",get:function(){return this._rootNode}},{key:"node",get:function(){return this._node}}]),r(e,[{key:"init",value:function(){}},{key:"drawWidget",value:function(e){var t=this;this._node=e,this._rootNode=e,this._rootNode.focus(),this.displayed=!0,this.focused=!0,this._node.innerHTML="",this._node.className="",this.classNames.forEach(function(e){return t._rootNode.classList.add(e)});for(var n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];this.draw.apply(this,i)}},{key:"draw",value:function(){}},{key:"gotFocus",value:function(){this.gotDisplay(),this.focused=!0}},{key:"lostFocus",value:function(){this.focused=!1}},{key:"gotDisplay",value:function(){this.displayed=!0}},{key:"lostDisplay",value:function(){this.lostFocus(),this.displayed=!1}}]),e}()},{}],33:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0}),n.CommentsWidget=void 0;var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=e("./BaseWidget"),c=e("../core/UIContext"),l=e("./Widgets"),u=e("../helpers/Inputs"),d=e("../helpers/Table"),f=e("../core/R2Wrapper");n.CommentsWidget=function(e){function t(){return i(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Comments"))}return o(t,e),a(t,[{key:"init",value:function(){var e=this;f.r2Wrapper.registerListener(f.R2Actions.SEEK,function(){e.displayed&&e.draw()})}},{key:"draw",value:function(){this.node.innerHTML="",this.node.appendChild(this.getPanel())}},{key:"getPanel",value:function(){var e=this,t=document.createElement("div"),n=document.createElement("div");n.style.position="fixed",n.style.margin="0.5em",t.appendChild(n),n.appendChild(u.Inputs.button("Notes",function(){return c.uiContext.navigateTo(l.Widgets.NOTES)}));var i=document.createElement("div");return i.style.paddingTop="70px",t.appendChild(i),r2.cmd("CC",function(t){var n=new d.Table(["+Offset","~Comment"],[!0,!1],"commentsTable",function(t,n){var i=t[0];r2.cmd("CC- @ "+i),r2.cmd("CCu base64:"+window.btoa(n)+" @ "+i),e.draw()},l.Widgets.HEXDUMP),r=t.split(/\n/);for(var o in r){var a=r[o].split(/ (.+)?/);a.length>=2&&n.addRow([a[0],a[1]])}n.insertInto(i)}),t}}]),t}(s.BaseWidget)},{"../core/R2Wrapper":5,"../core/UIContext":7,"../helpers/Inputs":11,"../helpers/Table":13,"./BaseWidget":32,"./Widgets":52}],34:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0}),n.DebuggerWidget=void 0;var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=e("./BaseWidget"),c=e("../helpers/Inputs"),l=e("../helpers/Format"),u=e("../core/R2Wrapper");n.DebuggerWidget=function(e){function t(){return i(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Debugger","dark"))}return o(t,e),a(t,[{key:"init",value:function(){var e=this;this.inColor=!0,this.nativeDebugger=!1,r2.cmd("e cfg.debug",function(t){e.nativeDebugger="true"===t.trim()}),u.r2Wrapper.registerListener(u.R2Actions.SEEK,function(){e.displayed&&e.draw()})}},{key:"draw",value:function(){this.node.innerHTML="",this.node.scrollTop=0,this.node.appendChild(this.getPanel())}},{key:"getPanel",value:function(){var e=this,t=document.createElement("div");this.inColor&&(t.style.backgroundColor="#202020");var n=document.createElement("div");n.style.position="fixed",n.style.margin="0.5em",t.appendChild(n),n.appendChild(c.Inputs.iconButton("keyboard_arrow_up","UP",function(){return r2.cmd("s--",function(){return e.draw()})})),n.appendChild(c.Inputs.iconButton("keyboard_arrow_down","DOWN",function(){return r2.cmd("s++",function(){return e.draw()})})),n.appendChild(c.Inputs.button("PC",function(){return r2.cmd("sr pc",function(){return e.draw()})})),n.appendChild(c.Inputs.button("Step",function(){return r2.cmd(e.nativeDebugger?"ds":"aes",function(){return e.draw()})})),n.appendChild(c.Inputs.button("Cont",function(){return r2.cmd(e.nativeDebugger?"dc":"aec",function(){return e.draw()})})),n.appendChild(c.Inputs.button("BP",function(){return r2.cmd("db $$",function(){return e.draw()})})),n.appendChild(c.Inputs.button("REG",function(){var t=prompt("register=value");e.nativeDebugger?r2.cmd("dr "+t+";.dr*",function(){return e.draw()}):r2.cmd("aer "+t+";.ar*",function(){return e.draw()})}));var i=document.createElement("div");i.style.paddingTop="50px",t.appendChild(i);var r=this.nativeDebugger?"dr":"ar";return r2.cmd("f cur;."+r+"*;sr sp;px 64",function(e){var t=document.createElement("pre");t.style.margin="10px",t.style.color="grey",t.appendChild((0,l.formatOffsets)(e)),i.appendChild(t)}),r2.cmd(r+"=;s cur;f-cur;pd 128"+(this.inColor?"|H":""),function(e){var t=document.createElement("pre");t.style.color="grey",t.appendChild((0,l.formatOffsets)(e)),i.appendChild(t)}),t}}]),t}(s.BaseWidget)},{"../core/R2Wrapper":5,"../helpers/Format":9,"../helpers/Inputs":11,"./BaseWidget":32}],35:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0}),n.DisassemblyBlocksWidget=void 0;var a=e("./BasePreWidget"),s=e("../helpers/Inputs"),c=e("../core/UIContext"),l=e("./Widgets"),u=e("../helpers/Format");n.DisassemblyBlocksWidget=function(e){function t(){return i(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Blocks",function(e){return(0,u.formatOffsets)(e)},"pdr|H",s.Inputs.iconButton("undo","Back to Disassembly",function(){return c.uiContext.navigateTo(l.Widgets.DISASSEMBLY)})))}return o(t,e),t}(a.BasePreWidget)},{"../core/UIContext":7,"../helpers/Format":9,"../helpers/Inputs":11,"./BasePreWidget":31,"./Widgets":52}],36:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0}),n.DisassemblyDecompileWidget=void 0;var a=e("./BasePreWidget"),s=e("../helpers/Inputs"),c=e("../core/UIContext"),l=e("./Widgets"),u=e("../helpers/Format");n.DisassemblyDecompileWidget=function(e){function t(){return i(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Decompile",function(e){return(0,u.formatOffsets)(e)},"pdc|H",s.Inputs.iconButton("undo","Back to Disassembly",function(){return c.uiContext.navigateTo(l.Widgets.DISASSEMBLY)})))}return o(t,e),t}(a.BasePreWidget)},{"../core/UIContext":7,"../helpers/Format":9,"../helpers/Inputs":11,"./BasePreWidget":31,"./Widgets":52}],37:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0}),n.DisassemblyFunctionsFullWidget=void 0;var a=e("./BasePreWidget"),s=e("../helpers/Inputs"),c=e("../core/UIContext"),l=e("./Widgets"),u=e("../helpers/Format");n.DisassemblyFunctionsFullWidget=function(e){function t(){return i(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Functions (full)",function(e){return(0,u.formatOffsets)(e)},"e scr.color=1;s entry0;s $S;pD $SS;e scr.color=0",s.Inputs.iconButton("undo","Back to Disassembly",function(){return c.uiContext.navigateTo(l.Widgets.DISASSEMBLY)})))}return o(t,e),t}(a.BasePreWidget)},{"../core/UIContext":7,"../helpers/Format":9,"../helpers/Inputs":11,"./BasePreWidget":31,"./Widgets":52}],38:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0}),n.DisassemblyFunctionsWidget=void 0;var a=e("./BasePreWidget"),s=e("../helpers/Inputs"),c=e("../core/UIContext"),l=e("./Widgets");n.DisassemblyFunctionsWidget=function(e){function t(){return i(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Functions",function(e){var t=document.createElement("span");return t.innerHTML=e,t},"pdf @e:asm.lineswidth=0|H",s.Inputs.iconButton("undo","Back to Disassembly",function(){return c.uiContext.navigateTo(l.Widgets.DISASSEMBLY)})))}return o(t,e),t}(a.BasePreWidget)},{"../core/UIContext":7,"../helpers/Inputs":11,"./BasePreWidget":31,"./Widgets":52}],39:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0}),n.DisassemblyGraphWidget=void 0;var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=e("./BaseWidget"),c=e("../helpers/Inputs"),l=e("../core/UIContext"),u=e("./Widgets"),d=e("../helpers/Format"),f=e("../core/R2Wrapper");n.DisassemblyGraphWidget=function(e){function t(){return i(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Graph","dark"))}return o(t,e),a(t,[{key:"init",value:function(){var e=this;this.backButton=c.Inputs.iconButton("undo","Back to Disassembly",function(){return l.uiContext.navigateTo(u.Widgets.DISASSEMBLY)}),this.backButton.style.position="absolute",this.backButton.style.top="1em",this.backButton.style.left="1em",f.r2Wrapper.registerListener(f.R2Actions.SEEK,function(){e.displayed&&e.draw()})}},{key:"draw",value:function(){this.node.appendChild(this.backButton),this.node.appendChild(this.getGraph())}},{key:"getGraph",value:function(){var e=document.createElement("div");e.style.overflow="auto",e.setAttribute("content","user-scalable=yes, width=device-width, minimum-scale=1, maximum-scale=1");return r2.cmd("agf|H",function(t){var n=document.createElement("pre");n.style.color="white",n.appendChild((0,d.formatOffsets)(t)),e.appendChild(n)}),e}}]),t}(s.BaseWidget)},{"../core/R2Wrapper":5,"../core/UIContext":7,"../helpers/Format":9,"../helpers/Inputs":11,"./BaseWidget":32,"./Widgets":52}],40:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0}),n.DisassemblyInfosWidget=void 0;var a=e("./BasePreWidget"),s=e("../helpers/Inputs"),c=e("../core/UIContext"),l=e("./Widgets");n.DisassemblyInfosWidget=function(e){function t(){return i(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Infos",function(e){var t=document.createElement("span");return t.innerHTML=e,t},"afi",s.Inputs.iconButton("undo","Back to Disassembly",function(){return c.uiContext.navigateTo(l.Widgets.DISASSEMBLY)})))}return o(t,e),t}(a.BasePreWidget)},{"../core/UIContext":7,"../helpers/Inputs":11,"./BasePreWidget":31,"./Widgets":52}],41:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0}),n.DisassemblyWidget=void 0;var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=e("./BaseWidget"),c=e("../modules/disasm/Disassembly"),l=e("../core/R2Wrapper");n.DisassemblyWidget=function(e){function t(){return i(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Disassembly","disasmPanel","dark"))}return o(t,e),a(t,[{key:"init",value:function(){this.firstTime=!0}},{key:"draw",value:function(){var e=this;this.firstTime?(this.disasm=new c.Disassembly(this.node,24),l.r2Wrapper.registerListener(l.R2Actions.SEEK,function(){e.displayed&&(e.disasm.refreshInitialOffset(),e.disasm.resetContainer(e.node),e.disasm.draw(),e.disasm.onSeek())}),this.firstTime=!1):this.disasm.resetContainer(this.node),this.disasm.draw()}}]),t}(s.BaseWidget)},{"../core/R2Wrapper":5,"../modules/disasm/Disassembly":20,"./BaseWidget":32}],42:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0}),n.FlagsSpacesWidget=void 0;var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=e("./BaseWidget"),c=e("../core/UIContext"),l=e("../core/R2Wrapper"),u=e("./Widgets"),d=e("../helpers/Table"),f=e("../helpers/Inputs");n.FlagsSpacesWidget=function(e){function t(){return i(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Flag Spaces"))}return o(t,e),a(t,[{key:"init",value:function(){var e=this;l.r2Wrapper.registerListener(l.R2Actions.SEEK,function(){e.displayed&&e.draw()})}},{key:"draw",value:function(){this.node.innerHTML="",this.node.scrollTop=0,this.current=null,this.node.appendChild(this.getPanel())}},{key:"getPanel",value:function(){var e=this,t=document.createElement("div");this.inColor&&(t.style.backgroundColor="#202020");var n=document.createElement("div");n.style.position="fixed",n.style.margin="0.5em",t.appendChild(n),n.appendChild(f.Inputs.iconButton("undo","Back to flags",function(){return c.uiContext.navigateTo(u.Widgets.FLAGS)})),n.appendChild(f.Inputs.button("Deselect",function(){e.current=null,r2.cmd("fs *",function(){return e.draw()})})),n.appendChild(f.Inputs.button("Add",function(){return e.setFlagspace()})),n.appendChild(f.Inputs.button("Delete",function(){return e.delFlagspace()})),n.appendChild(f.Inputs.button("Rename",function(){return e.renameFlagspace()}));var i=document.createElement("div");return i.appendChild(document.createTextNode("Click on a row to select it.")),i.style.paddingTop="70px",t.appendChild(i),r2.cmd("fs",function(t){var n=new d.Table(["+Flags","Flagspace"],[!0,!1],"flagspaceTable"),r=t.split(/\n/);for(var o in r){var a=r[o].split(/ +/);a.length>=4&&function(){var t=a[3],i=-1===a[2].indexOf("."),r=document.createElement("a");r.innerHTML=t,i&&(r.style.color="red"),r.addEventListener("click",function(){r2.cmd("fs "+t),e.draw()});var o=n.addRow([a[1],r]);o.addEventListener("click",function(){n.getRows().forEach(function(e){e.classList.remove("active")}),o.classList.add("active"),e.current=t})}()}n.insertInto(i)}),t}},{key:"setFlagspace",value:function(){var e=this,t=this.current;t||(t=prompt("name")),t&&r2.cmd("fs "+t,function(){e.draw()})}},{key:"renameFlagspace",value:function(){var e=this,t=this.current;t||(t=prompt("name")),t&&r2.cmd("fsr "+t,function(){e.draw()})}},{key:"delFlagspace",value:function(){var e=this,t=this.current;t||(t="."),t&&r2.cmd("fs-"+t,function(){e.draw()})}}]),t}(s.BaseWidget)},{"../core/R2Wrapper":5,"../core/UIContext":7,"../helpers/Inputs":11,"../helpers/Table":13,"./BaseWidget":32,"./Widgets":52}],43:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0}),n.FlagsWidget=void 0;var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}
|
|
}(),s=e("./BaseWidget"),c=e("../core/UIContext"),l=e("../core/R2Wrapper"),u=e("./Widgets"),d=e("../helpers/Table"),f=e("../helpers/Inputs");n.FlagsWidget=function(e){function t(){return i(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Flags"))}return o(t,e),a(t,[{key:"init",value:function(){var e=this;l.r2Wrapper.registerListener(l.R2Actions.SEEK,function(){e.displayed&&e.draw()})}},{key:"draw",value:function(){this.node.innerHTML="",this.node.scrollTop=0,this.node.appendChild(this.getPanel())}},{key:"getPanel",value:function(){var e=this,t=document.createElement("div");this.inColor&&(t.style.backgroundColor="#202020");var n=document.createElement("div");n.style.position="fixed",n.style.margin="0.5em",t.appendChild(n),n.appendChild(f.Inputs.button("Spaces",function(){return c.uiContext.navigateTo(u.Widgets.FLAGS_SPACE)})),n.appendChild(f.Inputs.button("Delete All",function(){return r2.cmd("f-*",function(){return e.draw()})}));var i=document.createElement("div");return i.style.paddingTop="50px",t.appendChild(i),r2.cmd("f",function(e){var t=new d.Table(["+Offset","Size","Name"],[!0,!0,!1],"flagsTable",null,u.Widgets.HEXDUMP),n=e.split(/\n/);for(var r in n){var o=n[r].split(/ /);o.length>=3&&t.addRow([o[0],o[1],o[2]])}t.insertInto(i)}),t}}]),t}(s.BaseWidget)},{"../core/R2Wrapper":5,"../core/UIContext":7,"../helpers/Inputs":11,"../helpers/Table":13,"./BaseWidget":32,"./Widgets":52}],44:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0}),n.FunctionsWidget=void 0;var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=e("./BaseWidget"),c=e("../helpers/Inputs"),l=e("../helpers/Table"),u=e("../core/R2Wrapper"),d=e("../widgets/Widgets");n.FunctionsWidget=function(e){function t(){return i(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Functions"))}return o(t,e),a(t,[{key:"init",value:function(){var e=this;this.inColor=!0,r2.cmd("e scr.utf8=false"),u.r2Wrapper.registerListener(u.R2Actions.SEEK,function(){e.displayed&&e.draw()})}},{key:"draw",value:function(){this.node.innerHTML="",this.node.scrollTop=0,this.node.appendChild(this.getPanel())}},{key:"getPanel",value:function(){var e=this,t=document.createElement("div"),n=document.createElement("div");n.style.position="fixed",n.style.margin="0.5em",t.appendChild(n),n.appendChild(c.Inputs.button("Symbols",function(){statusMessage("Analyzing symbols..."),r2.cmd("aa",function(){statusMessage("done"),e.draw()})})),n.appendChild(c.Inputs.button("Calls",function(){statusMessage("Analyzing calls..."),r2.cmd("aac",function(){statusMessage("done"),e.draw()})})),n.appendChild(c.Inputs.button("Function",function(){statusMessage("Analyzing function..."),r2.cmd("af",function(){statusMessage("done"),e.draw()})})),n.appendChild(c.Inputs.button("Refs",function(){statusMessage("Analyzing references..."),r2.cmd("aar",function(){statusMessage("done"),e.draw()})})),n.appendChild(c.Inputs.button("AutoName",function(){statusMessage("Analyzing names..."),r2.cmd(".afna @@ fcn.*",function(){statusMessage("done"),e.draw()})}));var i=document.createElement("div");return i.style.paddingTop="70px",t.appendChild(i),r2.cmd("afl",function(e){var t=new l.Table(["+Address","Name","Size","CC"],[!1,!0,!1,!1],"functionTable",null,d.Widgets.DISASSEMBLY),n=e.split(/\n/);for(var r in n){var o=n[r].match(/^(0x[0-9a-f]+)\s+([0-9]+)\s+([0-9]+(\s+\->\s+[0-9]+)?)\s+(.+)$/);null!==o&&t.addRow([o[1],o[5],o[2],o[3]])}t.insertInto(i)}),t}}]),t}(s.BaseWidget)},{"../core/R2Wrapper":5,"../helpers/Inputs":11,"../helpers/Table":13,"../widgets/Widgets":52,"./BaseWidget":32}],45:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0}),n.HexdumpWidget=void 0;var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=e("./BaseWidget"),c=e("../modules/hexdump/Hexdump"),l=e("../core/R2Wrapper");n.HexdumpWidget=function(e){function t(){return i(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Hexdump","dark"))}return o(t,e),a(t,[{key:"init",value:function(){var e=this;r2.cmd("e cfg.bigendian",function(t){e.isBigEndian="true"===t}),this.firstTime=!0}},{key:"draw",value:function(){var e=this;this.firstTime?(this.firstTime=!1,this.hexdump=new c.Hexdump(this.node,24,this.isBigEndian),this.hexdump.setOnChangeCallback(function(e,t,n){console.log("changed")}),l.r2Wrapper.registerListener(l.R2Actions.SEEK,function(){e.displayed&&(e.hexdump.refreshInitialOffset(),e.hexdump.resetContainer(e.node),e.hexdump.draw())})):this.hexdump.resetContainer(this.node),this.hexdump.draw()}}]),t}(s.BaseWidget)},{"../core/R2Wrapper":5,"../modules/hexdump/Hexdump":23,"./BaseWidget":32}],46:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0}),n.NotesWidget=void 0;var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=e("./BaseWidget"),c=e("../core/UIContext"),l=e("./Widgets"),u=e("../helpers/Inputs"),d=e("../core/R2Wrapper");n.NotesWidget=function(e){function t(){return i(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Notes"))}return o(t,e),a(t,[{key:"init",value:function(){var e=this;d.r2Wrapper.registerListener(d.R2Actions.SEEK,function(){e.displayed&&e.draw()})}},{key:"draw",value:function(){this.node.appendChild(this.getPanel())}},{key:"getPanel",value:function(){var e=document.createElement("div"),t=document.createElement("div");t.style.position="fixed",t.style.margin="0.5em",e.appendChild(t),t.appendChild(u.Inputs.iconButton("undo","Back to Comments",function(){return c.uiContext.navigateTo(l.Widgets.COMMENTS)}));var n=document.createElement("div");return n.style.paddingTop="70px",n.innerHTML='<textarea rows=32 style="width:100%;height:100%"></textarea>',e.appendChild(n),e}}]),t}(s.BaseWidget)},{"../core/R2Wrapper":5,"../core/UIContext":7,"../helpers/Inputs":11,"./BaseWidget":32,"./Widgets":52}],47:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0}),n.OverviewWidget=void 0;var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=e("./BaseWidget"),c=e("../modules/overview/Overview"),l=e("../core/R2Wrapper");n.OverviewWidget=function(e){function t(){return i(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Overview"))}return o(t,e),a(t,[{key:"init",value:function(){var e=this;this.overview=new c.Overview,l.r2Wrapper.registerListener(l.R2Actions.SEEK,function(){e.displayed&&e.draw()})}},{key:"draw",value:function(){this.node.appendChild(this.overview.DOM),this.overview.adjustLayout(),componentHandler.upgradeDom()}}]),t}(s.BaseWidget)},{"../core/R2Wrapper":5,"../modules/overview/Overview":30,"./BaseWidget":32}],48:[function(require,module,exports){"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.ScriptWidget=void 0;var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),_BaseWidget2=require("./BaseWidget"),_UIContext=require("../core/UIContext"),_Widgets=require("./Widgets"),_Inputs=require("../helpers/Inputs"),_R2Wrapper=require("../core/R2Wrapper"),ScriptWidget=exports.ScriptWidget=function(_BaseWidget){function ScriptWidget(){return _classCallCheck(this,ScriptWidget),_possibleConstructorReturn(this,(ScriptWidget.__proto__||Object.getPrototypeOf(ScriptWidget)).call(this,"Script"))}return _inherits(ScriptWidget,_BaseWidget),_createClass(ScriptWidget,[{key:"init",value:function(){var e=this;_R2Wrapper.r2Wrapper.registerListener(_R2Wrapper.R2Actions.SEEK,function(){e.displayed&&e.draw()})}},{key:"draw",value:function(){this.toggleFoo="",this.node.appendChild(this.getPanel())}},{key:"getPanel",value:function(){var e=this,t=document.createElement("div");t.appendChild(_Inputs.Inputs.button("Run",function(){return e.runScript()})),t.appendChild(_Inputs.Inputs.button("Indent",function(){return e.indentScript()})),t.appendChild(_Inputs.Inputs.button("Output",function(){return e.toggleScriptOutput()})),t.appendChild(document.createElement("br"));var n=document.createElement("textarea");n.id="script",n.className="pre",n.style.width="100%",t.appendChild(n),t.appendChild(document.createElement("br"));var i=document.createElement("div");i.id="scriptOutput",i.className="output",t.appendChild(i);var r=localStorage.getItem("script");return r||(r='r2.cmd("?V", log);'),n.value=r,t}},{key:"toggleScriptOutput",value:function(){var e=document.getElementById("scriptOutput");e&&(""===this.toggleFoo?(this.toggleFoo=e.innerHTML,e.innerHTML=""):(e.innerHTML=this.toggleFoo,this.toggleFoo=""))}},{key:"indentScript",value:function(){var e=document.getElementById("script").value,t=e;document.getElementById("script").value=t,localStorage.script=t}},{key:"runScript",value:function runScript(){var str=document.getElementById("script").value;localStorage.script=str,document.getElementById("scriptOutput").innerHTML="";try{var msg="\"use strict\";function log(x) { var a = document.getElementById('scriptOutput'); if (a) a.innerHTML += x + '\\n'; }\n";eval(msg+str)}catch(e){alert(e)}}}]),ScriptWidget}(_BaseWidget2.BaseWidget)},{"../core/R2Wrapper":5,"../core/UIContext":7,"../helpers/Inputs":11,"./BaseWidget":32,"./Widgets":52}],49:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0}),n.SearchWidget=void 0;var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=e("./BaseWidget"),c=e("../helpers/Inputs"),l=e("../helpers/Format"),u=e("../core/R2Wrapper");n.SearchWidget=function(e){function t(){return i(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Search"))}return o(t,e),a(t,[{key:"init",value:function(){var e=this;u.r2Wrapper.registerListener(u.R2Actions.SEEK,function(){e.displayed&&e.draw()})}},{key:"draw",value:function(){this.node.appendChild(this.getPanel())}},{key:"getPanel",value:function(){var e=this,t=document.createElement("div"),n=document.createElement("div");n.style.margin="0.5em",t.appendChild(n);var i=document.createElement("input");i.id="search_input",i.className="mdl-card--expand mdl-textfield__input",i.style.backgroundColor="white",i.style.paddingLeft="10px",i.style.top="3.5em",i.style.height="1.8em",i.style.color="white",i.addEventListener("keypress",function(t){return e.searchKey(t.keyCode)}),n.appendChild(i),n.appendChild(document.createElement("br")),n.appendChild(c.Inputs.button("Hex",function(){return e.runSearch()})),n.appendChild(c.Inputs.button("String",function(){return e.runSearchString()})),n.appendChild(c.Inputs.button("Code",function(){return e.runSearchCode()})),n.appendChild(c.Inputs.button("ROP",function(){return e.runSearchROP()})),n.appendChild(c.Inputs.button("Magic",function(){return e.runSearchMagic()}));var r=document.createElement("div");return r.id="search_output",r.style.paddingTop="50px",r.style.color="black",r.className="pre",t.appendChild(r),t}},{key:"searchKey",value:function(e){var t=document.getElementById("search_input");13===e&&(this.runSearch(t.value),t.value="")}},{key:"runSearchMagic",value:function(){r2.cmd("/m",function(e){document.getElementById("search_output").appendChild((0,l.formatOffsets)(e))})}},{key:"runSearchCode",value:function(e){e||(e=document.getElementById("search_input").value),r2.cmd('"/c '+e+'"',function(e){document.getElementById("search_output").appendChild((0,l.formatOffsets)(e))})}},{key:"runSearchString",value:function(e){e||(e=document.getElementById("search_input").value),r2.cmd("/ "+e,function(e){document.getElementById("search_output").appendChild((0,l.formatOffsets)(e))})}},{key:"runSearchROP",value:function(e){e||(e=document.getElementById("search_input").value),r2.cmd('"/R '+e+'"',function(e){document.getElementById("search_output").appendChild((0,l.formatOffsets)(e))})}},{key:"runSearch",value:function(e){e||(e=document.getElementById("search_input").value),'"'===e[0]?r2.cmd('"/ '+e+'"',function(e){document.getElementById("search_output").appendChild((0,l.formatOffsets)(e))}):r2.cmd('"/x '+e+'"',function(e){document.getElementById("search_output").appendChild((0,l.formatOffsets)(e))})}}]),t}(s.BaseWidget)},{"../core/R2Wrapper":5,"../helpers/Format":9,"../helpers/Inputs":11,"./BaseWidget":32}],50:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0}),n.SettingsWidget=void 0;var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=e("../core/R2Wrapper"),c=e("./BaseWidget");n.SettingsWidget=function(e){function t(){return i(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Settings"))}return o(t,e),a(t,[{key:"init",value:function(){var e=this;s.r2Wrapper.registerListener(s.R2Actions.SEEK,function(){e.displayed&&e.draw()})}},{key:"draw",value:function(){var e=this;this.grid=document.createElement("div"),this.grid.className="mdl-grid",this.node.appendChild(this.grid),this.addGrid("Platform",function(t){return e.drawPlatform(t)}),this.addGrid("Disassembly",function(t){return e.drawDisassembly(t)}),this.addGrid("Core/IO",function(t){return e.drawCoreIO(t)}),this.addGrid("Analysis",function(t){return e.drawAnalysis(t)}),this.addGrid("Colors",function(t){return e.drawColors(t)}),this.addGrid("TTS",function(t){return e.drawTTS(t)}),this.addGrid("Reset configuration",function(t){return e.drawReset(t)}),this.addGrid("Emulator",function(t){return e.drawEmulator(t)}),componentHandler.upgradeDom()}},{key:"drawPlatform",value:function(e){var t=["x86","arm","mips","java","dalvik","6502","8051","h8300","hppa","i4004","i8008","lh5801","lm32","m68k","malbolge","mcs96","msp430","nios2","ppc","rar","sh","snes","sparc","spc700","sysz","tms320","v810","v850","ws","xcore","prospeller","gb","z80","arc","avr","bf","cr16","cris","csr","dcpu16","ebc"];uiSelect(e,"Platform",t,t.indexOf(s.r2Settings.getItem(s.r2Settings.keys.PLATFORM)),function(e){s.r2Settings.setItem(s.r2Settings.keys.PLATFORM,e)});var n=["64","32","16","8"];uiSelect(e,"Bits",n,n.indexOf(s.r2Settings.getItem(s.r2Settings.keys.BITS)),function(e){s.r2Settings.setItem(s.r2Settings.keys.BITS,e)});var i=["Linux","Windows","OSX"];uiSelect(e,"OS",i,i.indexOf(s.r2Settings.getItem(s.r2Settings.keys.OS)),function(e){s.r2Settings.setItem(s.r2Settings.keys.OS,e)})}},{key:"drawDisassembly",value:function(e){var t=["S","M","L"];uiSelect(e,"Size",t,t.indexOf(s.r2Settings.getItem(s.r2Settings.keys.SIZE)),function(e){s.r2Settings.setItem(s.r2Settings.keys.SIZE,e)});var n=["Pseudo","Opcodes","ATT"];uiSelect(e,"Decoding",n,n.indexOf(s.r2Settings.getItem(s.r2Settings.keys.DECODING)),function(e){s.r2Settings.setItem(s.r2Settings.keys.DECODING,e)}),uiSwitch(e,"Utf8",s.r2Settings.getItem(s.r2Settings.keys.UTF8),function(e,t){s.r2Settings.setItem(s.r2Settings.keys.UTF8,t)}),uiSwitch(e,"UpperCase",s.r2Settings.getItem(s.r2Settings.keys.UCASE),function(e,t){s.r2Settings.setItem(s.r2Settings.keys.UCASE,t)}),uiSwitch(e,"Show Bytes",s.r2Settings.getItem(s.r2Settings.keys.BYTES),function(e,t){s.r2Settings.setItem(s.r2Settings.keys.BYTES,t)}),uiSwitch(e,"DescribeOps",s.r2Settings.getItem(s.r2Settings.keys.DESCRIBE),function(e,t){s.r2Settings.setItem(s.r2Settings.keys.DESCRIBE,t)})}},{key:"drawEmulator",value:function(e){uiSwitch(e,"Enable ESIL",s.r2Settings.getItem(s.r2Settings.keys.ASMEMU),function(e,t){s.r2Settings.setItem(s.r2Settings.keys.ASMEMU,t)}),uiSwitch(e,"Enable ESIL (Lesser Verbose)",s.r2Settings.getItem(s.r2Settings.keys.ASMEMUSTR),function(e,t){s.r2Settings.setItem(s.r2Settings.keys.ASMEMUSTR,t)})}},{key:"drawCoreIO",value:function(e){var t=["PA","VA","PAVA","Debug"];uiSelect(e,"Mode",t,t.indexOf(s.r2Settings.getItem(s.r2Settings.keys.MODE)),function(e){s.r2Settings.setItem(s.r2Settings.keys.MODE,e)})}},{key:"drawAnalysis",value:function(e){var t=function(e,t,n){s.r2Settings.setItem(n,t)};uiSwitch(e,"HasNext",s.r2Settings.getItem(s.r2Settings.keys.ANAL_HAS_NEXT),function(e,n){return t(0,n,s.r2Settings.keys.ANAL_HAS_NEXT)}),uiSwitch(e,"Skip Nops",s.r2Settings.getItem(s.r2Settings.keys.ANAL_SKIP_NOPS),function(e,n){return t(0,n,s.r2Settings.keys.ANAL_SKIP_NOPS)}),uiSwitch(e,"NonCode",s.r2Settings.getItem(s.r2Settings.keys.ANAL_NON_CODE),function(e,n){return t(0,n,s.r2Settings.keys.ANAL_NON_CODE)})}},{key:"drawColors",value:function(e){var t;r2.cmdj("ecoj",function(e){t=e}),uiSwitch(e,"Colors",s.r2Settings.getItem(s.r2Settings.keys.COLORS),function(e,t){s.r2Settings.setItem(s.r2Settings.keys.COLORS,t)}),uiActionButton(e,function(){r2.cmd("ecr",function(){uiContext.widgetContainer.updateManagers.updates.apply()})},"Randomize"),uiActionButton(e,function(){r2.cmd("ecd",function(){uiContext.widgetContainer.updateManagers.updates.apply()})},"Reset colors"),uiSelect(e,"Theme",t,t.indexOf(s.r2Settings.getItem(s.r2Settings.keys.THEME)),function(e){s.r2Settings.setItem(s.r2Settings.keys.THEME,e)})}},{key:"drawTTS",value:function(e){uiSwitch(e,"Use TTS",s.r2Settings.getItem(s.r2Settings.keys.USE_TTS),function(e,t){s.r2Settings.setItem(s.r2Settings.keys.USE_TTS,t)})}},{key:"drawReset",value:function(e){uiActionButton(e,function(){s.r2Settings.resetAll(),uiContext.widgetContainer.updateManagers.updates.apply()},"RESET")}},{key:"addGrid",value:function(e,t){var n=document.createElement("div");n.className="mdl-cell mdl-color--white mdl-shadow--2dp mdl-cell--4-col",n.style.padding="10px",this.grid.appendChild(n);var i=document.createElement("span");i.className="mdl-layout-title",i.innerHTML=e,n.appendChild(i);var r=document.createElement("div");n.appendChild(r),t(r)}}]),t}(c.BaseWidget)},{"../core/R2Wrapper":5,"./BaseWidget":32}],51:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0}),n.WidgetFactory=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=e("./Widgets"),a=e("./OverviewWidget"),s=e("./HexdumpWidget"),c=e("./DebuggerWidget"),l=e("./FunctionsWidget"),u=e("./FlagsWidget"),d=e("./FlagsSpacesWidget"),f=e("./SearchWidget"),h=e("./ScriptWidget"),p=e("./CommentsWidget"),m=e("./NotesWidget"),g=e("./SettingsWidget"),v=e("./DisassemblyWidget"),y=e("./DisassemblyGraphWidget"),b=e("./DisassemblyInfosWidget"),C=e("./DisassemblyFunctionsWidget"),w=e("./DisassemblyFunctionsFullWidget"),E=e("./DisassemblyBlocksWidget"),k=e("./DisassemblyDecompileWidget");n.WidgetFactory=function(){function e(){i(this,e),this.widgets={}}return r(e,[{key:"get",value:function(e){return this.contains(e)||this.instanciate_(e),this.widgets[e]}},{key:"contains",value:function(e){return void 0!==this.widgets[e]}},{key:"instanciate_",value:function(e){switch(e){case o.Widgets.OVERVIEW:this.widgets[e]=new a.OverviewWidget;break;case o.Widgets.DISASSEMBLY:this.widgets[e]=new v.DisassemblyWidget;break;case o.Widgets.DISASSEMBLY_GRAPH:this.widgets[e]=new y.DisassemblyGraphWidget;break;case o.Widgets.DISASSEMBLY_INFOS:this.widgets[e]=new b.DisassemblyInfosWidget;break;case o.Widgets.DISASSEMBLY_FUNCTIONS:this.widgets[e]=new C.DisassemblyFunctionsWidget;break;case o.Widgets.DISASSEMBLY_FUNCTIONS_FULL:this.widgets[e]=new w.DisassemblyFunctionsFullWidget;break;case o.Widgets.DISASSEMBLY_BLOCKS:this.widgets[e]=new E.DisassemblyBlocksWidget;break;case o.Widgets.DISASSEMBLY_DECOMPILE:this.widgets[e]=new k.DisassemblyDecompileWidget;break;case o.Widgets.HEXDUMP:this.widgets[e]=new s.HexdumpWidget;break;case o.Widgets.DEBUGGER:this.widgets[e]=new c.DebuggerWidget;break;case o.Widgets.FUNCTIONS:this.widgets[e]=new l.FunctionsWidget;break;case o.Widgets.FLAGS:this.widgets[e]=new u.FlagsWidget;break;case o.Widgets.FLAGS_SPACE:this.widgets[e]=new d.FlagsSpacesWidget;break;case o.Widgets.SEARCH:this.widgets[e]=new f.SearchWidget;break;case o.Widgets.SCRIPTS:this.widgets[e]=new h.ScriptWidget;break;case o.Widgets.COMMENTS:this.widgets[e]=new p.CommentsWidget;break;case o.Widgets.NOTES:this.widgets[e]=new m.NotesWidget;break;case o.Widgets.SETTINGS:this.widgets[e]=new g.SettingsWidget;break;default:console.error("Not instanciable widget: "+e)}}}]),e}()},{"./CommentsWidget":33,"./DebuggerWidget":34,"./DisassemblyBlocksWidget":35,"./DisassemblyDecompileWidget":36,"./DisassemblyFunctionsFullWidget":37,"./DisassemblyFunctionsWidget":38,"./DisassemblyGraphWidget":39,"./DisassemblyInfosWidget":40,"./DisassemblyWidget":41,"./FlagsSpacesWidget":42,"./FlagsWidget":43,"./FunctionsWidget":44,"./HexdumpWidget":45,"./NotesWidget":46,"./OverviewWidget":47,"./ScriptWidget":48,"./SearchWidget":49,"./SettingsWidget":50,"./Widgets":52}],52:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.Widgets={OVERVIEW:"overview",DISASSEMBLY:"disassembly",DISASSEMBLY_GRAPH:"disasm_graph",DISASSEMBLY_INFOS:"disasm_infos",DISASSEMBLY_INFOS_FULL:"disasm_infos_full",DISASSEMBLY_FUNCTIONS:"disasm_functions",DISASSEMBLY_BLOCKS:"disasm_blocks",DISASSEMBLY_DECOMPILE:"disasm_decompile",HEXDUMP:"hexdump",DEBUGGER:"debugger",FUNCTIONS:"functions",FLAGS:"flags",FLAGS_SPACE:"flags_space",SEARCH:"search",SCRIPTS:"scripts",COMMENTS:"comments",NOTES:"notes",SETTINGS:"settings"}},{}]},{},[1]);
|