jscrewit 2.36.0 → 2.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/readme.md CHANGED
@@ -56,8 +56,8 @@ The following source will do an `alert(1)` in any browser, including Internet Ex
56
56
  To use JScrewIt in your project, download
57
57
  [jscrewit.js](https://cdn.jsdelivr.net/npm/jscrewit/lib/jscrewit.js) (uncompressed, development
58
58
  version) or
59
- [jscrewit.min.js](https://cdn.jsdelivr.net/npm/jscrewit/lib/jscrewit.min.js) (compressed,
60
- productive version) from npm and include it in your HTML file.
59
+ [jscrewit.min.js](https://cdn.jsdelivr.net/npm/jscrewit/lib/jscrewit.min.js) (compressed, productive
60
+ version) from npm and include it in your HTML file.
61
61
 
62
62
  ```html
63
63
  <script src="jscrewit.js"></script>
@@ -139,17 +139,16 @@ to support.
139
139
  In order to understand how this works, let's consider the JavaScript functions `atob` and `btoa`.
140
140
  Not all browsers support these functions: without any further information, JScrewIt will assume that
141
141
  they are unavailable and will not use them to encode the input.
142
- Anyway, if we know in advance that the browsers we plan to target do support `atob` and `btoa`
143
- indeed, we can let JScrewIt create code that uses those functions whenever that makes the output
144
- shorter.
142
+ However, if we know in advance that the browsers we plan to target do support `atob` and `btoa`, we
143
+ can let JScrewIt create code that uses those functions whenever that makes the output shorter.
145
144
 
146
145
  The way to tell JScrewIt to use a particular set of features is by specifying a value for the
147
146
  `features` option in the second parameter passed to `encode`.
148
147
 
149
- For instance, a generic `alert(1)` example for an unspecified environment is 1905 chracters long.
148
+ For instance, a generic `alert(1)` example for an unspecified environment is 1903 chracters long.
150
149
 
151
150
  ```js
152
- const output = JScrewIt.encode("alert(1)"); // output is 1905 characters
151
+ const output = JScrewIt.encode("alert(1)"); // output is 1903 characters
153
152
  ```
154
153
 
155
154
  We can save a few characters by indicating that our code is only supposed to run in a browser.
@@ -189,29 +188,27 @@ Most typically, it will throw some kind of error at runtime.
189
188
 
190
189
  It's important to keep in mind that each of the target engines needs to support every feature we
191
190
  specify.
192
- So if we want our JSFuck code to run in Android Browser 4.4, Safari 7.0 and Node.js 13+, we can only
191
+ So if we want our JSFuck code to run in Android Browser 4.0, Safari 7.0 and Node.js 13+, we can only
193
192
  specify features supported by all of these engines.
194
193
  These features can be retrieved with
195
194
  [`JScrewIt.Feature.commonOf`](api-doc/interfaces/FeatureConstructor.md#commonof).
196
195
 
197
196
  ```js
198
- { features: JScrewIt.Feature.commonOf("ANDRO_4_4", "NODE_13", "SAFARI_7_0") }
197
+ { features: JScrewIt.Feature.commonOf("ANDRO_4_0", "NODE_13", "SAFARI_7_0") }
199
198
  ```
200
199
 
201
200
  The features turn out to be
202
201
  [`ESC_HTML_QUOT`](api-doc/interfaces/FeatureAll.md#ESC_HTML_QUOT),
203
- [`GENERIC_ARRAY_TO_STRING`](api-doc/interfaces/FeatureAll.md#GENERIC_ARRAY_TO_STRING),
204
202
  [`GMT`](api-doc/interfaces/FeatureAll.md#GMT),
205
203
  [`INCR_CHAR`](api-doc/interfaces/FeatureAll.md#INCR_CHAR),
206
- [`NAME`](api-doc/interfaces/FeatureAll.md#NAME),
207
- [`NO_IE_SRC`](api-doc/interfaces/FeatureAll.md#NO_IE_SRC) and
208
- [`OBJECT_UNDEFINED`](api-doc/interfaces/FeatureAll.md#OBJECT_UNDEFINED) (a quick way to see this is
209
- entering `JScrewIt.Feature.commonOf("ANDRO_4_4", "NODE_13", "SAFARI_7_0").toString()` in the
210
- browser's console).
204
+ [`NAME`](api-doc/interfaces/FeatureAll.md#NAME) and
205
+ [`NO_IE_SRC`](api-doc/interfaces/FeatureAll.md#NO_IE_SRC) (a quick way to see this is entering
206
+ `JScrewIt.Feature.commonOf("ANDRO_4_0", "NODE_13", "SAFARI_7_0").toString()` in the browser's
207
+ console).
211
208
  With this knowledge, we could also rewrite the expression above as follows.
212
209
 
213
210
  ```js
214
- { features: ["ESC_HTML_QUOT", "GMT", "INCR_CHAR", "NAME", "NO_IE_SRC", "OBJECT_UNDEFINED"] }
211
+ { features: ["ESC_HTML_QUOT", "GMT", "INCR_CHAR", "NAME", "NO_IE_SRC"] }
215
212
  ```
216
213
 
217
214
  Finally, note that simply specifying an array of engine features will not achieve the desired
@@ -219,7 +216,7 @@ effect, as it will result in the union of the features available in every engine
219
216
  their intersection.
220
217
 
221
218
  ```diff
222
- - { features: ["ANDRO_4_4", "NODE_13", "SAFARI_7_0"] }
219
+ - { features: ["ANDRO_4_0", "NODE_13", "SAFARI_7_0"] }
223
220
  ```
224
221
 
225
222
  ### Further Reading
package/ui/ui.js CHANGED
@@ -1 +1 @@
1
- !function(){"use strict";function a(e){var t=typeof e;return"object"==t&&null!==e||"undefined"==t&&void 0!==e}function o(n,o,i,r){return function(t){function e(e){t[r](e,o,i)}Array.isArray(n)?n.forEach(e):e(n)}}function u(e){e.removeAttribute("tabindex")}function T(e){e.setAttribute("tabindex",0)}function E(e){function t(){c.className="button focusable",a("off")}function n(e){e.target!==c&&i()&&t()}function o(e){!e.relatedTarget&&i()&&t()}function i(){return/\bactive\b/.test(c.className)}function r(){return!c.hasAttribute("tabindex")}function a(e){e=B[e];B(document,e("mousemove",n),e("mouseout",o))}var c=B("SPAN",{className:"button focusable",get disabled(){return r()},set disabled(e){(e=!!e)!==r()&&(e?(B(c,u),i()&&(document.releaseCapture(),a("off")),c.blur()):B(c,T),c.className="",c.className="button focusable")}},T,B.on("click",function(e){r()&&e.stopImmediatePropagation(),e.preventDefault()}),B.on("keydown",function(e){13===e.keyCode&&(c.click(),e.preventDefault())}),B.on("keyup",function(e){32===e.keyCode&&(c.click(),e.preventDefault())}),B.on("mouseup",function(e){0===e.button&&i()&&(document.releaseCapture(),t())}),B("SPAN",e),B("SPAN"));return c.setCapture&&(c.firstChild.setAttribute("unselectable","on"),B(c,B.on("mousedown",function(e){0!==e.button||r()||i()||(c.setCapture(),c.className="active button focusable",a("on"))}))),c}function N(e,t){function n(){var e=document.body;e.removeChild(c),B(e,B.off("keydown",r),B.off("focus",i,!0)),void 0!==t&&t()}function o(){a.focus()}function i(e){a.contains(e.target)||o()}function r(e){var t=e.keyCode;13!==t&&27!==t||!(t=document.activeElement).contains(a)&&t.contains(e.target)||(n(),e.preventDefault())}var a=B("DIV",{style:{borderRadius:"25px",display:"inline-block",maxWidth:"500px",width:"100%"}},T,B("DIV",{className:"focusable",id:"modalBox",style:{background:"whitesmoke",border:"10px solid blue",borderRadius:"23px",margin:"2px"}},B("DIV",{style:{margin:"1.5em 1.5em .25em",overflow:"hidden"}},e,B("DIV",{style:{margin:"1.25em 0"}},B(E("OK"),{style:{maxWidth:"5em",width:"100%"}},B.on("click",n)))))),c=B("DIV",{style:{background:"rgba(0, 0, 0, .25)",overflow:"auto",position:"fixed",textAlign:"center",left:"0",top:"0",bottom:"0",width:"100%"}},B("DIV",{style:{display:"table",tableLayout:"fixed",width:"100%",height:"100%"}},B("DIV",{style:{display:"table-cell",verticalAlign:"middle"}},a)));B(document.body,c,B.on("focus",i,!0),B.on("keydown",r)),setTimeout(o)}function i(e){var t,n=typeof e;try{t="string"==n?'"'.concat(e,'"'):0===e&&1/e<0?"-0":Array.isArray(e)?e.length?"[…]":"[]":"bigint"==n?"".concat(e,"n"):"symbol"!=n?String(e):e.toString()}catch(e){}return t}function t(){(O=new Worker(y)).onmessage=S}function n(){URL.revokeObjectURL(y),y=void 0}function D(){var e,t=r();try{e=JScrewIt.encode(inputArea.value,t)}catch(e){return s(),void d(String(e))}p(e)}function M(){var e=r(),e={input:inputArea.value,options:e};v&&(O.terminate(),t(),e.url=m),O.postMessage(e),s(),l(!0),inputArea.onkeyup=null}function r(){return{features:C.canonicalNames}}function k(e){9!==e.keyCode&&M()}function J(e){var t;L(e)&&(e=outputArea.value.length,0===outputArea.selectionStart&&outputArea.selectionEnd===e||(outputArea.selectionStart=0,outputArea.selectionEnd=e,"scrollTopMax"in outputArea&&(t=outputArea.scrollTop,B(outputArea,B.on("scroll",function(){outputArea.scrollTop=t},{once:!0})))))}function w(){V.disabled=!1;var e=this.result;null!=e&&(inputArea.value=e),inputArea.oninput(),inputArea.disabled=!1}function q(){var e,t,n,o;try{t=(0,eval)(outputArea.value)}catch(e){n=B("P",String(e))}void 0!==t&&(e=function(e){var t;if(Array.isArray(e))try{t="[".concat(e.map(i).join(", "),"]")}catch(e){}else t=i(e);return t}(t),t=function(e){var t;if(null!==e){var n=typeof e;if("function"==n||"object"==n||"undefined"==n){var o=Object.getPrototypeOf(e);if(o===Array.prototype)switch(e.length){case 0:t="an empty array";break;case 1:t="a one element array";break;default:t="an array"}else t=o===Date.prototype?"a date":o===RegExp.prototype?"a regular expression":"function"==n?"a function":"an object"}}return t}(t),n=e?B("DIV",B("P",t?"Evaluation result is "+t+":":"Evaluation result is"),B("P",{style:{overflowX:"auto"}},B("DIV",{style:{display:"inline-block",textAlign:"left",whiteSpace:"pre"}},e))):B("DIV",B("P","Evaluation result is "+t+"."))),null!=n&&(o=this,N(n,function(){o.focus()}))}function S(e){var e=e.data,t=e.error;t?d(t):p(e.output),l(!1)}function L(e){var t,n,o=e.target;return(o="runtimeStyle"in o?(t=o.lastMainMouseButtonEventTimeStamp,n=0===e.button?e.timeStamp:void 0,(o.lastMainMouseButtonEventTimeStamp=n)-t<=500):2<=e.detail&&0===e.button)&&e.preventDefault(),o}function e(){function n(){var e=+new Date;0<=((d=u+(e-s)*l/250)-a)*l&&(d=a,o()),i.height=1===d?"":t.scrollHeight*d+"px",r.display=0===d?"none":""}function o(){clearInterval(c),c=null,l=0}document.querySelector("main>div").style.display="block",inputArea.value=inputArea.defaultValue,B(outputArea,B.on("mousedown",J),B.on("mouseup",L),B.on("input",P)),B(stats.parentNode,B(E("Run this"),{style:{bottom:"0",fontSize:"10pt",position:"absolute",right:"0"}},B.on("click",q))),e=F.COMPACT,C=F.AUTO.includes(e)?e:F.BROWSER,compMenu.value=C.name,compMenu.previousIndex=compMenu.selectedIndex,O?(h=M)():(e=B(E("Encode"),B.on("click",D)),B(controls,e),h=W,outputArea.value=""),"undefined"!=typeof File&&(e=B("INPUT",{accept:".js",style:{display:"none"},type:"file"},B.on("change",H)),k=HTMLInputElement.prototype.click.bind(e),V=B(E("Load file…"),B.on("click",k)),B(controls,V,e)),inputArea.oninput=h;var t,i,r,a,c,u,s,l,d,p,f,m,b,v,e,y,h,g,A,k=function(){var e=compMenu.selectedIndex,t=compMenu.options[e].value,n=t?F[t]:R.feature;!j&&F.areEqual(n,C)||(C=n,this()),e!==compMenu.previousIndex&&(compMenu.previousIndex=e,U.rollTo(+!t))}.bind(h);function w(e,t){return B("LABEL",{style:{display:"inline-table"}},B("SPAN",{style:{display:"table-cell",verticalAlign:"middle"}},B("INPUT",{style:{margin:"0 .25em 0 0"},type:"checkbox"},t)),B("SPAN",{style:{display:"table-cell"}},e))}function S(e){var t=B("DIV",{className:"help-text"});return t.innerHTML=e,B("SPAN",{className:"focusable",style:{background:"black",borderRadius:"1em",color:"white",cursor:"pointer",display:"inline-table",fontSize:"8pt",fontWeight:"bold",lineHeight:"10.5pt",position:"relative",textAlign:"center",top:"-1.5pt",width:"10.5pt"},title:"Learn more…"},"?",T,B.on("click",function(){N(t)}))}function x(){var t=p.checked;Array.prototype.forEach.call(m,function(e){e.checked=t})}function I(){var t=JScrewIt.Feature,e=Array.prototype.filter.call(m,function(e){return e.checked}).map(function(e){return++n,t[e.featureName]}),n=e.length;p.checked=n,p.indeterminate=n&&n<m.length,f=t.commonOf.apply(null,e)||t.DEFAULT,v.checked&&(f=f.restrict("web-worker",e)),b.checked&&(f=f.restrict("forced-strict-mode",e))}B(compMenu,B.on("change",k)),R=B((e=B(w("Select/deselect all"),{style:{margin:"0 0 .5em"}},B.on("change",x),B.on(["keyup","mouseup"],function(){setTimeout(function(){p.indeterminate||x()})})),y=B("TABLE",{style:{borderSpacing:"0",width:"100%"}}),h=w("Generate strict mode code"),g=w("Support web workers"),A=B("FIELDSET",{className:"engine-selection-box",get feature(){return f}},B("DIV",B("P",{style:{margin:".25em 0 .75em"}},"Select the engines you want your code to support."),e,y,B("HR"),B("DIV",g," ",S("<p>Web workers are part of a standard HTML technology used to perform background tasks in JavaScript.<p>Check the option <dfn>Support web workers</dfn> only if your code needs to run inside a web worker. To create or use a web worker in your code, this option is not required.")),B("DIV",h," ",S('<p>The option <dfn>Generate strict mode code</dfn> instructs JScrewIt to avoid optimizations that don\'t work in strict mode JavaScript code. Check this option only if your environment disallows non-strict code. You may want to do this for example in one of the following circumstances.<ul><li>To encode a string or a number and embed it in a JavaScript file in a place where strict mode code is expected, like in a scope containing a <code>"use strict"</code> statement or in a class body.<li>To encode a script and run it in Node.js with the option <code>--use_strict</code>.<li>To encode an ECMAScript module. Note that module support in JSFuck is <em>very</em> limited, as <code>import</code> and <code>export</code> statements don\'t work at all. If your module doesn\'t contain these statements, you can encode it using this option.</ul><p>In most other cases, this option is not required, not even to encode a script that contains a top level <code>"use strict"</code> statement.')),B.on("change",function(){var e;I(),(e=document.createEvent("Event")).initEvent("input",!0,!1),A.dispatchEvent(e)}))),["Chrome","Edge","Firefox","Internet Explorer","Safari","Opera","Android Browser","Node.js"].forEach(function(e,t){for(var n,o=JScrewIt.Feature.FAMILIES[e],i=1&t?{className:"even-field"}:null,r=(o.length+2)/3^0,a=3*r,c=0;c<a;++c){var u,s,l,d=o[c],p=(c%3||(n=B("TR",i),c||B(n,B("TD",{rowSpan:r,style:{padding:"0 .5em 0 0"}},e)),B(y,n)),null);d&&("string"!=typeof(s=d.version)&&(l=s.from,s=null==(u=s.to)?l+"+":l+"–"+u),null!=(l=d.shortTag)&&(s+=" ("+l+")"),p=w(s,{checked:!0,featureName:d.featureName})),B(n,B("TD",{style:{padding:"0 0 0 .5em",width:"6em"}},p))}}),p=e.querySelector("INPUT"),m=y.querySelectorAll("INPUT"),b=h.querySelector("INPUT"),v=g.querySelector("INPUT"),I(),A),B.on("input",k)),d=l=0,e=B("DIV"),(r=e.style).display="none",t=B("DIV",e,{container:e,rollTo:function(e){var t;e===d?o():((t=d<e?1:-1)!==l&&(u=d,s=+new Date,l=t),a=e,c=c||setInterval(n,0))}}),(i=t.style).height="0",i.overflowY="hidden",U=t,g="Custom Compatibility Selection","open"in(k=document.createElement("DETAILS"))?(B(k,{open:!0},B("SUMMARY",{dir:"rtl"},B("SPAN",{style:{float:"left"}},g))),B.css("details.frame:not([open])>:first-child",{"margin-bottom":"initial"})):k=B("DIV",B("SPAN",g)),B(U.container,B(k,{className:"frame"},R)),B(controls.parentNode,U),inputArea.selectionStart=2147483647,inputArea.focus()}function c(){document.addEventListener("DOMContentLoaded",e)}function H(){var e,t=this.files[0];t&&(inputArea.disabled=!0,inputArea.value="",V.disabled=!0,(e=new FileReader).addEventListener("loadend",w),e.readAsText(t))}function W(){b&&P(!0)}function s(){b=!1,outputArea.value="",stats.textContent="…"}function l(e){v=e,outputArea.disabled=e}function d(e){N(B("P",e))}function p(e){outputArea.value=e,P()}function P(e){var t=outputArea.value.length,t=1===t?"1 char":t+" chars";j=!!e,e&&(O&&(inputArea.onkeyup=k),t+=" – <i>out of sync</i>"),b=!0,stats.innerHTML=t}var f,C,R,m,V,j,b,U,v,O,y,h,g=Object,B=function(e){for(var t=e instanceof Node?e:"function"==typeof e?e.call(B):document.createElement(e),n=arguments.length,o=0;++o<n;){var i=arguments[o];i instanceof Node?t.appendChild(i):a(i)?function o(i,r){g.keys(r).forEach(function(e){var t,n=g.getOwnPropertyDescriptor(r,e);"value"in n?(t=n.value,e in i&&a(t)?o(i[e],t):i[e]=t):g.defineProperty(i,e,n)})}(t,i):"function"==typeof i?i.call(B,t):null!=i&&(i=document.createTextNode(i),t.appendChild(i))}return t},A=(B.off=function(e,t,n){return o(e,t,n,"removeEventListener")},B.on=function(e,t,n){return o(e,t,n,"addEventListener")},B.css=function(e,t){var n=t,t=e+"{"+g.keys(n).map(function(e){return e+":"+n[e]}).join(";")+"}";f||(e=B("STYLE"),B(document.head,e),f=e.sheet),f.insertRule(t,f.cssRules.length)},B.css(".button",{background:"#e0e0e0",color:"#212121",cursor:"default",display:"inline-block",position:"relative"}),B.css(".button, .button>:last-child",{"border-radius":".1em"}),B.css(".button.active, .button[tabindex]:active",{background:"#29b3e5"}),B.css(".button.active>:first-child, .button[tabindex]:active>:first-child",{left:".1em",top:".1em"}),B.css(".button.active>:last-child, .button[tabindex]:active>:last-child",{"border-color":"#0088b6"}),B.css(".button:not([tabindex])",{background:"#e9e9e9",color:"#707070"}),B.css(".button:not([tabindex])>:last-child",{"border-color":"#bababa"}),B.css(".button>:first-child",{display:"inline-block",margin:".15em .5em",position:"relative","user-select":"none","-moz-user-select":"none","-ms-user-select":"none","-webkit-user-select":"none"}),B.css(".button>:last-child",{"border-color":"#707070","border-style":"solid","border-width":"1px",display:"inline-block",position:"absolute",left:"0",right:"0",top:"0",bottom:"0"}),B.css(".button[tabindex]:hover:not(.active):not(:active)",{background:"#a3f4ff"}),B.css(".button[tabindex]:hover:not(.active):not(:active)>:last-child",{"border-color":"#189fdd"}),B.css("#modalBox p:first-child",{"margin-top":"0"}),B.css("#modalBox p:last-child",{"margin-bottom":"0"}),B.css(".engine-selection-box",{background:"#f0f0f0"}),B.css(".engine-selection-box .even-field",{background:"#fff"}),B.css(".help-text",{"font-size":"11pt","text-align":"justify"}),B.css(".help-text code",{"white-space":"pre"}),B.css(".help-text dfn",{"font-style":"normal","font-weight":"bold"}),B.css(".help-text li",{margin:".5em 0"}),"application/javascript"),F=JScrewIt.Feature;try{(h=new XMLHttpRequest).open("GET","lib/jscrewit.min.js",!0)}catch(e){h=void 0}if(h&&"undefined"!=typeof Worker){y=URL.createObjectURL(new Blob(['"use strict";self.onmessage=function(t){var t=t.data,r=t.url,r=(null!=r&&importScripts(r),t.input);if(null!=r){try{e={output:JScrewIt.encode(r,t.options)}}catch(t){var e={error:String(t)}}postMessage(e)}};'],{type:A}));try{t()}catch(e){n()}}O?(h.onerror=function(){O.terminate(),O=void 0,n()},h.onload=function(){h.status<400?(m=URL.createObjectURL(h.response),O.postMessage({url:m})):this.onerror()},h.onloadend=function(){("loading"===document.readyState?c:e)()},h.overrideMimeType(A),h.responseType="blob",h.send()):c()}();
1
+ (()=>{function a(e){var t=typeof e;return"object"==t&&null!==e||"undefined"==t&&void 0!==e}function o(n,o,i,r){return function(t){function e(e){t[r](e,o,i)}Array.isArray(n)?n.forEach(e):e(n)}}function u(e){e.removeAttribute("tabindex")}function T(e){e.setAttribute("tabindex",0)}function E(e){function t(){c.className="button focusable",a("off")}function n(e){e.target!==c&&i()&&t()}function o(e){!e.relatedTarget&&i()&&t()}function i(){return/\bactive\b/.test(c.className)}function r(){return!c.hasAttribute("tabindex")}function a(e){e=B[e];B(document,e("mousemove",n),e("mouseout",o))}var c=B("SPAN",{className:"button focusable",get disabled(){return r()},set disabled(e){(e=!!e)!==r()&&(e?(B(c,u),i()&&(document.releaseCapture(),a("off")),c.blur()):B(c,T),c.className="",c.className="button focusable")}},T,B.on("click",function(e){r()&&e.stopImmediatePropagation(),e.preventDefault()}),B.on("keydown",function(e){13===e.keyCode&&(c.click(),e.preventDefault())}),B.on("keyup",function(e){32===e.keyCode&&(c.click(),e.preventDefault())}),B.on("mouseup",function(e){0===e.button&&i()&&(document.releaseCapture(),t())}),B("SPAN",e),B("SPAN"));return c.setCapture&&(c.firstChild.setAttribute("unselectable","on"),B(c,B.on("mousedown",function(e){0!==e.button||r()||i()||(c.setCapture(),c.className="active button focusable",a("on"))}))),c}function N(e,t){function n(){var e=document.body;e.removeChild(c),B(e,B.off("keydown",r),B.off("focus",i,!0)),void 0!==t&&t()}function o(){a.focus()}function i(e){a.contains(e.target)||o()}function r(e){var t=e.keyCode;13!==t&&27!==t||!(t=document.activeElement).contains(a)&&t.contains(e.target)||(n(),e.preventDefault())}var a=B("DIV",{style:{borderRadius:"25px",display:"inline-block",maxWidth:"500px",width:"100%"}},T,B("DIV",{className:"focusable",id:"modalBox",style:{background:"whitesmoke",border:"10px solid blue",borderRadius:"23px",margin:"2px"}},B("DIV",{style:{margin:"1.5em 1.5em .25em",overflow:"hidden"}},e,B("DIV",{style:{margin:"1.25em 0"}},B(E("OK"),{style:{maxWidth:"5em",width:"100%"}},B.on("click",n)))))),c=B("DIV",{style:{background:"rgba(0, 0, 0, .25)",overflow:"auto",position:"fixed",textAlign:"center",left:"0",top:"0",bottom:"0",width:"100%"}},B("DIV",{style:{display:"table",tableLayout:"fixed",width:"100%",height:"100%"}},B("DIV",{style:{display:"table-cell",verticalAlign:"middle"}},a)));B(document.body,c,B.on("focus",i,!0),B.on("keydown",r)),setTimeout(o)}function i(e){var t,n=typeof e;try{t="string"==n?'"'.concat(e,'"'):0===e&&1/e<0?"-0":Array.isArray(e)?e.length?"[…]":"[]":"bigint"==n?"".concat(e,"n"):"symbol"!=n?String(e):e.toString()}catch(e){}return t}function t(){(O=new Worker(y)).onmessage=S}function n(){URL.revokeObjectURL(y),y=void 0}function D(){var e,t=r();try{e=JScrewIt.encode(inputArea.value,t)}catch(e){return l(),void d(String(e))}p(e)}function M(){var e=r(),e={input:inputArea.value,options:e};v&&(O.terminate(),t(),e.url=m),O.postMessage(e),l(),s(!0),inputArea.onkeyup=null}function r(){return{features:C.canonicalNames}}function k(e){9!==e.keyCode&&M()}function J(e){var t;L(e)&&(e=outputArea.value.length,0===outputArea.selectionStart&&outputArea.selectionEnd===e||(outputArea.selectionStart=0,outputArea.selectionEnd=e,"scrollTopMax"in outputArea&&(t=outputArea.scrollTop,B(outputArea,B.on("scroll",function(){outputArea.scrollTop=t},{once:!0})))))}function w(){V.disabled=!1;var e=this.result;null!=e&&(inputArea.value=e),inputArea.oninput(),inputArea.disabled=!1}function q(){var e,t,n,o;try{t=(0,eval)(outputArea.value)}catch(e){n=B("P",String(e))}void 0!==t&&(e=(e=>{var t;if(Array.isArray(e))try{t="[".concat(e.map(i).join(", "),"]")}catch(e){}else t=i(e);return t})(t),t=(e=>{var t;if(null!==e){var n=typeof e;if("function"==n||"object"==n||"undefined"==n){var o=Object.getPrototypeOf(e);if(o===Array.prototype)switch(e.length){case 0:t="an empty array";break;case 1:t="a one element array";break;default:t="an array"}else t=o===Date.prototype?"a date":o===RegExp.prototype?"a regular expression":"function"==n?"a function":"an object"}}return t})(t),n=e?B("DIV",B("P",t?"Evaluation result is "+t+":":"Evaluation result is"),B("P",{style:{overflowX:"auto"}},B("DIV",{style:{display:"inline-block",textAlign:"left",whiteSpace:"pre"}},e))):B("DIV",B("P","Evaluation result is "+t+"."))),null!=n&&(o=this,N(n,function(){o.focus()}))}function S(e){var e=e.data,t=e.error;t?d(t):p(e.output),s(!1)}function L(e){var t,n,o=e.target;return(o="runtimeStyle"in o?(t=o.lastMainMouseButtonEventTimeStamp,n=0===e.button?e.timeStamp:void 0,(o.lastMainMouseButtonEventTimeStamp=n)-t<=500):2<=e.detail&&0===e.button)&&e.preventDefault(),o}function e(){function n(){var e=+new Date;0<=((d=u+(e-l)*s/250)-a)*s&&(d=a,o()),i.height=1===d?"":t.scrollHeight*d+"px",r.display=0===d?"none":""}function o(){clearInterval(c),c=null,s=0}document.querySelector("main>div").style.display="block",inputArea.value=inputArea.defaultValue,B(outputArea,B.on("mousedown",J),B.on("mouseup",L),B.on("input",P)),B(stats.parentNode,B(E("Run this"),{style:{bottom:"0",fontSize:"10pt",position:"absolute",right:"0"}},B.on("click",q))),e=F.COMPACT,C=F.AUTO.includes(e)?e:F.BROWSER,compMenu.value=C.name,compMenu.previousIndex=compMenu.selectedIndex,O?(h=M)():(e=B(E("Encode"),B.on("click",D)),B(controls,e),h=W,outputArea.value=""),"undefined"!=typeof File&&(e=B("INPUT",{accept:".js",style:{display:"none"},type:"file"},B.on("change",H)),k=HTMLInputElement.prototype.click.bind(e),V=B(E("Load file…"),B.on("click",k)),B(controls,V,e)),inputArea.oninput=h;var t,i,r,a,c,u,l,s,d,p,f,m,b,v,e,y,h,g,A,k=function(){var e=compMenu.selectedIndex,t=compMenu.options[e].value,n=t?F[t]:R.feature;!j&&F.areEqual(n,C)||(C=n,this()),e!==compMenu.previousIndex&&(compMenu.previousIndex=e,U.rollTo(+!t))}.bind(h);function w(e,t){return B("LABEL",{style:{display:"inline-table"}},B("SPAN",{style:{display:"table-cell",verticalAlign:"middle"}},B("INPUT",{style:{margin:"0 .25em 0 0"},type:"checkbox"},t)),B("SPAN",{style:{display:"table-cell"}},e))}function S(e){var t=B("DIV",{className:"help-text"});return t.innerHTML=e,B("SPAN",{className:"focusable",style:{background:"black",borderRadius:"1em",color:"white",cursor:"pointer",display:"inline-table",fontSize:"8pt",fontWeight:"bold",lineHeight:"10.5pt",position:"relative",textAlign:"center",top:"-1.5pt",width:"10.5pt"},title:"Learn more…"},"?",T,B.on("click",function(){N(t)}))}function x(){var t=p.checked;Array.prototype.forEach.call(m,function(e){e.checked=t})}function I(){var t=JScrewIt.Feature,e=Array.prototype.filter.call(m,function(e){return e.checked}).map(function(e){return++n,t[e.featureName]}),n=e.length;p.checked=n,p.indeterminate=n&&n<m.length,f=t.commonOf.apply(null,e)||t.DEFAULT,v.checked&&(f=f.restrict("web-worker",e)),b.checked&&(f=f.restrict("forced-strict-mode",e))}B(compMenu,B.on("change",k)),R=B((e=B(w("Select/deselect all"),{style:{margin:"0 0 .5em"}},B.on("change",x),B.on(["keyup","mouseup"],function(){setTimeout(function(){p.indeterminate||x()})})),y=B("TABLE",{style:{borderSpacing:"0",width:"100%"}}),h=w("Generate strict mode code"),g=w("Support web workers"),A=B("FIELDSET",{className:"engine-selection-box",get feature(){return f}},B("DIV",B("P",{style:{margin:".25em 0 .75em"}},"Select the engines you want your code to support."),e,y,B("HR"),B("DIV",g," ",S("<p>Web workers are part of a standard HTML technology used to perform background tasks in JavaScript.<p>Check the option <dfn>Support web workers</dfn> only if your code needs to run inside a web worker. To create or use a web worker in your code, this option is not required.")),B("DIV",h," ",S('<p>The option <dfn>Generate strict mode code</dfn> instructs JScrewIt to avoid optimizations that don\'t work in strict mode JavaScript code. Check this option only if your environment disallows non-strict code. You may want to do this for example in one of the following circumstances.<ul><li>To encode a string or a number and embed it in a JavaScript file in a place where strict mode code is expected, like in a scope containing a <code>"use strict"</code> statement or in a class body.<li>To encode a script and run it in Node.js with the option <code>--use_strict</code>.<li>To encode an ECMAScript module. Note that module support in JSFuck is <em>very</em> limited, as <code>import</code> and <code>export</code> statements don\'t work at all. If your module doesn\'t contain these statements, you can encode it using this option.</ul><p>In most other cases, this option is not required, not even to encode a script that contains a top level <code>"use strict"</code> statement.')),B.on("change",function(){var e;I(),(e=document.createEvent("Event")).initEvent("input",!0,!1),A.dispatchEvent(e)}))),["Chrome","Edge","Firefox","Internet Explorer","Safari","Opera","Android Browser","Node.js"].forEach(function(e,t){for(var n,o=JScrewIt.Feature.FAMILIES[e],i=1&t?{className:"even-field"}:null,r=(o.length+2)/3^0,a=3*r,c=0;c<a;++c){var u,l,s,d=o[c],p=(c%3||(n=B("TR",i),c||B(n,B("TD",{rowSpan:r,style:{padding:"0 .5em 0 0"}},e)),B(y,n)),null);d&&("string"!=typeof(l=d.version)&&(s=l.from,l=null==(u=l.to)?s+"+":s+"–"+u),null!=(s=d.shortTag)&&(l+=" ("+s+")"),p=w(l,{checked:!0,featureName:d.featureName})),B(n,B("TD",{style:{padding:"0 0 0 .5em",width:"6em"}},p))}}),p=e.querySelector("INPUT"),m=y.querySelectorAll("INPUT"),b=h.querySelector("INPUT"),v=g.querySelector("INPUT"),I(),A),B.on("input",k)),d=s=0,e=B("DIV"),(r=e.style).display="none",t=B("DIV",e,{container:e,rollTo:function(e){var t;e===d?o():((t=d<e?1:-1)!==s&&(u=d,l=+new Date,s=t),a=e,c=c||setInterval(n,0))}}),(i=t.style).height="0",i.overflowY="hidden",U=t,g="Custom Compatibility Selection","open"in(k=document.createElement("DETAILS"))?(B(k,{open:!0},B("SUMMARY",{dir:"rtl"},B("SPAN",{style:{float:"left"}},g))),B.css("details.frame:not([open])>:first-child",{"margin-bottom":"initial"})):k=B("DIV",B("SPAN",g)),B(U.container,B(k,{className:"frame"},R)),B(controls.parentNode,U),inputArea.selectionStart=2147483647,inputArea.focus()}function c(){document.addEventListener("DOMContentLoaded",e)}function H(){var e,t=this.files[0];t&&(inputArea.disabled=!0,inputArea.value="",V.disabled=!0,(e=new FileReader).addEventListener("loadend",w),e.readAsText(t))}function W(){b&&P(!0)}function l(){b=!1,outputArea.value="",stats.textContent="…"}function s(e){v=e,outputArea.disabled=e}function d(e){N(B("P",e))}function p(e){outputArea.value=e,P()}function P(e){var t=outputArea.value.length,t=1===t?"1 char":t+" chars";j=!!e,e&&(O&&(inputArea.onkeyup=k),t+=" – <i>out of sync</i>"),b=!0,stats.innerHTML=t}var f,C,R,m,V,j,b,U,v,O,y,h,g=Object,B=function(e){for(var t=e instanceof Node?e:"function"==typeof e?e.call(B):document.createElement(e),n=arguments.length,o=0;++o<n;){var i=arguments[o];i instanceof Node?t.appendChild(i):a(i)?function o(i,r){g.keys(r).forEach(function(e){var t,n=g.getOwnPropertyDescriptor(r,e);"value"in n?(t=n.value,e in i&&a(t)?o(i[e],t):i[e]=t):g.defineProperty(i,e,n)})}(t,i):"function"==typeof i?i.call(B,t):null!=i&&(i=document.createTextNode(i),t.appendChild(i))}return t},A=(B.off=function(e,t,n){return o(e,t,n,"removeEventListener")},B.on=function(e,t,n){return o(e,t,n,"addEventListener")},B.css=function(e,t){var n=t,t=e+"{"+g.keys(n).map(function(e){return e+":"+n[e]}).join(";")+"}";f||(e=B("STYLE"),B(document.head,e),f=e.sheet),f.insertRule(t,f.cssRules.length)},B.css(".button",{background:"#e0e0e0",color:"#212121",cursor:"default",display:"inline-block",position:"relative"}),B.css(".button, .button>:last-child",{"border-radius":".1em"}),B.css(".button.active, .button[tabindex]:active",{background:"#29b3e5"}),B.css(".button.active>:first-child, .button[tabindex]:active>:first-child",{left:".1em",top:".1em"}),B.css(".button.active>:last-child, .button[tabindex]:active>:last-child",{"border-color":"#0088b6"}),B.css(".button:not([tabindex])",{background:"#e9e9e9",color:"#707070"}),B.css(".button:not([tabindex])>:last-child",{"border-color":"#bababa"}),B.css(".button>:first-child",{display:"inline-block",margin:".15em .5em",position:"relative","user-select":"none","-moz-user-select":"none","-ms-user-select":"none","-webkit-user-select":"none"}),B.css(".button>:last-child",{"border-color":"#707070","border-style":"solid","border-width":"1px",display:"inline-block",position:"absolute",left:"0",right:"0",top:"0",bottom:"0"}),B.css(".button[tabindex]:hover:not(.active):not(:active)",{background:"#a3f4ff"}),B.css(".button[tabindex]:hover:not(.active):not(:active)>:last-child",{"border-color":"#189fdd"}),B.css("#modalBox p:first-child",{"margin-top":"0"}),B.css("#modalBox p:last-child",{"margin-bottom":"0"}),B.css(".engine-selection-box",{background:"#f0f0f0"}),B.css(".engine-selection-box .even-field",{background:"#fff"}),B.css(".help-text",{"font-size":"11pt","text-align":"justify"}),B.css(".help-text code",{"white-space":"pre"}),B.css(".help-text dfn",{"font-style":"normal","font-weight":"bold"}),B.css(".help-text li",{margin:".5em 0"}),"application/javascript"),F=JScrewIt.Feature;try{(h=new XMLHttpRequest).open("GET","lib/jscrewit.min.js",!0)}catch(e){h=void 0}if(h&&"undefined"!=typeof Worker){y=URL.createObjectURL(new Blob(["self.onmessage=function(t){var t=t.data,r=t.url,r=(null!=r&&importScripts(r),t.input);if(null!=r){try{e={output:JScrewIt.encode(r,t.options)}}catch(t){var e={error:String(t)}}postMessage(e)}};"],{type:A}));try{t()}catch(e){n()}}O?(h.onerror=function(){O.terminate(),O=void 0,n()},h.onload=function(){h.status<400?(m=URL.createObjectURL(h.response),O.postMessage({url:m})):this.onerror()},h.onloadend=function(){("loading"===document.readyState?c:e)()},h.overrideMimeType(A),h.responseType="blob",h.send()):c()})();