diff --git a/tools/env_maker.js b/tools/env_maker.js index 218a338..91defe3 100644 --- a/tools/env_maker.js +++ b/tools/env_maker.js @@ -312,6 +312,7 @@ var _slice = Date.call.bind(Date.call, [].slice) var _join = Date.call.bind(Date.call, [].join) var _le = 60 var _rd = (function() { var seed = 11111; return function random() { return seed = (seed * 9301 + 49297) % 233280, (seed / 233280)} })(); +var v_this = this var _m = function(){try{ arguments[2] = arguments[2].toString() var title = _join(_slice(arguments,0,3), ' ') @@ -468,12 +469,6 @@ encodeURIComponent = saf(function encodeURIComponent(){return _fu('encodeURIComp escape = saf(function escape(){return _fu('escape', arguments, v_escape.apply(this, arguments))}) unescape = saf(function unescape(){return _fu('unescape', arguments, v_unescape.apply(this, arguments))}) -if (_isvm){ - delete v_this.Buffer - delete v_this.VMError -}else{ - delete global.Buffer -} @@ -999,16 +994,26 @@ function v_hook_storage(e){ return new Proxy(e,{ set:function(a,b,c){ return a[b]=String(c)}, get:function(a,b){ return a[b]},}) } -window = init_Window('window') -window = new Proxy(window, { - get:function(a,b){return a[b]||global[b]}, - set:function(a,b,c){return (_isvm?v_this:global)[b]=a[b]=c} +var window = init_Window('window') +var window = new Proxy(window, { + get:function(a,b){return a[b]||v_this[b]}, + set:function(a,b,c){return v_this[b]=a[b]=c} +}) + +var win = { + window: window, + frames: window, + parent: window, + self: window, + top: window, +} +_ods(window[_y], { + window: {[_g]:function(){return win.window},[_s]:function(e){return win.window = e}}, + frames: {[_g]:function(){return win.frames},[_s]:function(e){return win.frames = e}}, + parent: {[_g]:function(){return win.parent},[_s]:function(e){return win.parent = e}}, + self: {[_g]:function(){return win.self}, [_s]:function(e){return win.self = e}}, + top: {[_g]:function(){return win.top}, [_s]:function(e){return win.top = e}}, }) -window[_y].window = window -window[_y].frames = window -window[_y].parent = window -window[_y].self = window -window[_y].top = window window[_y].caches = init_CacheStorage('caches') window[_y].clientInformation = init_Navigator('navigator') window[_y].cookieStore = init_CookieStore('cookieStore') @@ -1270,14 +1275,11 @@ window[_y].atob = atob_btoa.atob // styleMedia = init_StyleMedia('styleMedia') // speechSynthesis = init_SpeechSynthesis('speechSynthesis') -// 将构造的各种参数直接传给 global 和环境下的 this 使用 Object.defineProperties(v_this, {[Symbol.toStringTag]:{value:'Window'}}) Object.defineProperties(v_this, Object.getOwnPropertyDescriptors(window)) -if (_isvm){ - v_this.__proto__ = window.__proto__ -}else{ - Object.defineProperties(global, Object.getOwnPropertyDescriptors(window)) -} +delete v_this.Buffer +delete v_this.VMError +v_this.__proto__ = window.__proto__ delete console.Console console.memory = MemoryInfo._new() @@ -2281,43 +2283,69 @@ window[_y].v_blockrandom = function(r){ }) } +window[_y].v_repair_this = function(){ + win = { + window: v_this, + frames: v_this, + parent: v_this, + self: v_this, + top: v_this, + } +} + return window ` var v_tail = ` +function cilame_init(){ + this._y = Symbol.for('cilame') + this.v_t = false + this._bl = console.log + this.window = cilame() -var _y = Symbol.for('cilame') -global.v_t = false -var _bl = console.log -window = cilame(this) + this.v_getlist = window[_y].v_getlist + this.v_getlists = window[_y].v_getlists + this.v_requests = { + 'xmllist': window[_y].XMLHttpRequestList, + 'xmlsend': window[_y].XMLHttpRequestListSend, + 'fetcher': window[_y].fetchList, + } + this.v_listeners = window[_y].listeners + this.v_load = window[_y].v_load + this.v_mouse = window[_y].v_mouse + this.v_blocktime = window[_y].v_blocktime + this.v_blockrandom = window[_y].v_blockrandom + this.v_repair_this = window[_y].v_repair_this // fix Function('this === window')() detect. but the window hook log will fail. + this.v_run_vm2 = function(jscode){ + delete console.Console + var runcode = [cilame, cilame_init, 'cilame_init()', 'debugger', jscode].join('\\n') + return new VM({sandbox: {console}}).run(new VMScript(runcode, 'cilame_test_vm2')) + } + this.v_runfile_vm2 = function(file){ + var fs = require('fs') + var jscode = fs.readFileSync(file, {encoding:'utf8'}) + return v_run_vm2(jscode) + } -// 注入全局,方便后面搞成库直接用 require 就能拿到内容。 -window.v_getlist = window[_y].v_getlist -window.v_getlists = window[_y].v_getlists -window.v_requests = { - 'xmllist': window[_y].XMLHttpRequestList, - 'xmlsend': window[_y].XMLHttpRequestListSend, - 'fetcher': window[_y].fetchList, + location.href = 'http://pls_init_href_first/test1/test2' + // document[_y].referrer = 'http://newhref' + // window[_y].init_cookie('key=value; key2=value2') + + v_t = true // 打开日志开关,建议不要关闭。 } -window.v_listeners = window[_y].listeners -window.v_load = window[_y].v_load -window.v_mouse = window[_y].v_mouse -window.v_blocktime = window[_y].v_blocktime -window.v_blockrandom = window[_y].v_blockrandom -location.href = 'http://pls_init_href_first/test1/test2' -// document[_y].referrer = 'http://newhref' -// window[_y].init_cookie('key=value; key2=value2') -v_t = true // 打开日志开关 +cilame_init() debugger ` +var vm2code = "Object.assign(global,function(){var e={\n\"contextify.js\":'\"use strict\";const global=this,local=host.Object.create(null);local.Object=Object,local.Array=Array,local.Reflect=host.Object.create(null),local.Reflect.ownKeys=Reflect.ownKeys,local.Reflect.enumerate=Reflect.enumerate,local.Reflect.getPrototypeOf=Reflect.getPrototypeOf,local.Reflect.construct=Reflect.construct,local.Reflect.apply=Reflect.apply,local.Reflect.set=Reflect.set,local.Reflect.deleteProperty=Reflect.deleteProperty,local.Reflect.has=Reflect.has,local.Reflect.defineProperty=Reflect.defineProperty,local.Reflect.setPrototypeOf=Reflect.setPrototypeOf,local.Reflect.isExtensible=Reflect.isExtensible,local.Reflect.preventExtensions=Reflect.preventExtensions,local.Reflect.getOwnPropertyDescriptor=Reflect.getOwnPropertyDescriptor,Object.setPrototypeOf(global,Object.prototype);const DEBUG=!1,OPNA=\"Operation not allowed on contextified object.\",captureStackTrace=Error.captureStackTrace,FROZEN_TRAPS=host.Object.create(null);FROZEN_TRAPS.set=((e,t)=>!1),FROZEN_TRAPS.setPrototypeOf=((e,t)=>!1),FROZEN_TRAPS.defineProperty=((e,t)=>!1),FROZEN_TRAPS.deleteProperty=((e,t)=>!1),FROZEN_TRAPS.isExtensible=((e,t)=>!1),FROZEN_TRAPS.preventExtensions=(e=>!1);const Contextified=new host.WeakMap,Decontextified=new host.WeakMap,hasInstance=local.Object[Symbol.hasInstance];function instanceOf(e,t){try{return host.Reflect.apply(hasInstance,t,[e])}catch(e){throw new VMError(\"Unable to perform instanceOf check.\")}}const SHARED_OBJECT={__proto__:null};function createBaseObject(e){let t;if(\"function\"==typeof e)try{new new host.Proxy(e,{__proto__:null,construct(){return this}}),(t=function(){}).prototype=null}catch(e){t=(()=>{})}else{if(!host.Array.isArray(e))return{__proto__:null};t=[]}return local.Reflect.setPrototypeOf(t,null)?t:null}class VMError extends Error{constructor(e,t){super(e),this.name=\"VMError\",this.code=t,captureStackTrace(this,this.constructor)}}function throwCallerCalleeArgumentsAccess(e){return throwCallerCalleeArgumentsAccess[e],new VMError(\"Unreachable\")}function unexpected(){throw new VMError(\"Should not happen\")}function doPreventExtensions(e,t,r){const o=local.Reflect.ownKeys(t);for(let n=0;n{if(!host.Array.isArray(e))return new host.Array;try{const t=new host.Array;for(let r=0,o=e.length;r{if(\"function\"==typeof e)return Decontextify.function(e);const c=host.Object.create(null);return c.get=((c,l,i)=>{try{if(\"isVMProxy\"===l)return!0;if(\"constructor\"===l)return t;if(\"__proto__\"===l)return t.prototype}catch(e){return null}if(\"__defineGetter__\"===l)return host.Object.prototype.__defineGetter__;if(\"__defineSetter__\"===l)return host.Object.prototype.__defineSetter__;if(\"__lookupGetter__\"===l)return host.Object.prototype.__lookupGetter__;if(\"__lookupSetter__\"===l)return host.Object.prototype.__lookupSetter__;if(l===host.Symbol.toStringTag&&n)return n;try{return Decontextify.value(e[l],null,r,o)}catch(e){throw Decontextify.value(e)}}),c.getPrototypeOf=(e=>t&&t.prototype),Decontextify.object(e,c,r,o)}),Decontextify.function=((e,t,r,o,n)=>{const c=host.Object.create(null);let l;return c.apply=((t,r,o)=>{r=Contextify.value(r),o=Contextify.arguments(o);try{return Decontextify.value(e.apply(r,o))}catch(e){throw Decontextify.value(e)}}),c.construct=((t,n,c)=>{n=Contextify.arguments(n);try{return Decontextify.instance(new e(...n),l,r,o)}catch(e){throw Decontextify.value(e)}}),c.get=((t,c,l)=>{try{if(\"isVMProxy\"===c)return!0;if(n&&host.Object.prototype.hasOwnProperty.call(n,c))return n[c];if(\"constructor\"===c)return host.Function;if(\"__proto__\"===c)return host.Function.prototype}catch(e){return null}if(\"__defineGetter__\"===c)return host.Object.prototype.__defineGetter__;if(\"__defineSetter__\"===c)return host.Object.prototype.__defineSetter__;if(\"__lookupGetter__\"===c)return host.Object.prototype.__lookupGetter__;if(\"__lookupSetter__\"===c)return host.Object.prototype.__lookupSetter__;try{return Decontextify.value(e[c],null,r,o)}catch(e){throw Decontextify.value(e)}}),c.getPrototypeOf=(e=>host.Function.prototype),l=Decontextify.object(e,host.Object.assign(c,t),r)}),Decontextify.object=((e,t,r,o,n)=>{const c=host.Object.create(null);let l;if(c.get=((t,c,l)=>{try{if(\"isVMProxy\"===c)return!0;if(n&&host.Object.prototype.hasOwnProperty.call(n,c))return n[c];if(\"constructor\"===c)return host.Object;if(\"__proto__\"===c)return host.Object.prototype}catch(e){return null}if(\"__defineGetter__\"===c)return host.Object.prototype.__defineGetter__;if(\"__defineSetter__\"===c)return host.Object.prototype.__defineSetter__;if(\"__lookupGetter__\"===c)return host.Object.prototype.__lookupGetter__;if(\"__lookupSetter__\"===c)return host.Object.prototype.__lookupSetter__;try{return Decontextify.value(e[c],null,r,o)}catch(e){throw Decontextify.value(e)}}),c.set=((t,r,o,n)=>{o=Contextify.value(o);try{return local.Reflect.set(e,r,o)}catch(e){throw Decontextify.value(e)}}),c.getOwnPropertyDescriptor=((t,r)=>{let o,n;try{o=host.Object.getOwnPropertyDescriptor(e,r)}catch(e){throw Decontextify.value(e)}if(o){if(!(n=o.get||o.set?{__proto__:null,get:Decontextify.value(o.get)||void 0,set:Decontextify.value(o.set)||void 0,enumerable:!0===o.enumerable,configurable:!0===o.configurable}:{__proto__:null,value:Decontextify.value(o.value),writable:!0===o.writable,enumerable:!0===o.enumerable,configurable:!0===o.configurable}).configurable)try{(o=host.Object.getOwnPropertyDescriptor(t,r))&&!o.configurable&&o.writable===n.writable||local.Reflect.defineProperty(t,r,n)}catch(e){}return n}}),c.defineProperty=((t,n,c)=>{let l=!1;try{l=local.Reflect.setPrototypeOf(c,null)}catch(e){}if(!l)return!1;const i=host.Object.create(null);c.get||c.set?(i.get=Contextify.value(c.get,null,r,o)||void 0,i.set=Contextify.value(c.set,null,r,o)||void 0,i.enumerable=!0===c.enumerable,i.configurable=!0===c.configurable):(i.value=Contextify.value(c.value,null,r,o),i.writable=!0===c.writable,i.enumerable=!0===c.enumerable,i.configurable=!0===c.configurable);try{l=local.Reflect.defineProperty(e,n,i)}catch(e){throw Decontextify.value(e)}if(l&&!c.configurable)try{local.Reflect.defineProperty(t,n,c)}catch(e){return!1}return l}),c.deleteProperty=((t,r)=>{try{return Decontextify.value(local.Reflect.deleteProperty(e,r))}catch(e){throw Decontextify.value(e)}}),c.getPrototypeOf=(e=>host.Object.prototype),c.setPrototypeOf=(e=>{throw new host.Error(OPNA)}),c.has=((t,r)=>{try{return Decontextify.value(local.Reflect.has(e,r))}catch(e){throw Decontextify.value(e)}}),c.isExtensible=(t=>{let n;try{n=local.Reflect.isExtensible(e)}catch(e){throw Decontextify.value(e)}if(!n)try{local.Reflect.isExtensible(t)&&doPreventExtensions(t,e,e=>Contextify.value(e,null,r,o))}catch(e){}return n}),c.ownKeys=(t=>{try{return Decontextify.value(local.Reflect.ownKeys(e))}catch(e){throw Decontextify.value(e)}}),c.preventExtensions=(t=>{let n;try{n=local.Reflect.preventExtensions(e)}catch(e){throw Decontextify.value(e)}if(n)try{local.Reflect.isExtensible(t)&&doPreventExtensions(t,e,e=>Contextify.value(e,null,r,o))}catch(e){}return n}),c.enumerate=(t=>{try{return Decontextify.value(local.Reflect.enumerate(e))}catch(e){throw Decontextify.value(e)}}),host.Object.assign(c,t,r),host.Array.isArray(e)){const t=c.get;l={__proto__:null,ownKeys:c.ownKeys,get:t},c.ownKeys=(t=>{try{const t=local.Reflect.ownKeys(e);return Decontextify.value(t.filter(e=>\"string\"!=typeof e||!e.match(/^\\\\d+$/)))}catch(e){throw Decontextify.value(e)}}),c.get=((e,r,o)=>{if(r!==host.Symbol.toStringTag)return t(e,r,o)})}else l=SHARED_OBJECT;const i=new host.Proxy(createBaseObject(e),c);Decontextified.set(i,e);const a=new host.Proxy(i,l);return Decontextify.proxies.set(e,a),Decontextified.set(a,e),a}),Decontextify.value=((e,t,r,o,n)=>{try{if(Contextified.has(e))return Contextified.get(e);if(Decontextify.proxies.has(e))return Decontextify.proxies.get(e);switch(typeof e){case\"object\":return null===e?null:instanceOf(e,Number)?Decontextify.instance(e,host.Number,r,o,\"Number\"):instanceOf(e,String)?Decontextify.instance(e,host.String,r,o,\"String\"):instanceOf(e,Boolean)?Decontextify.instance(e,host.Boolean,r,o,\"Boolean\"):instanceOf(e,Date)?Decontextify.instance(e,host.Date,r,o,\"Date\"):instanceOf(e,RangeError)?Decontextify.instance(e,host.RangeError,r,o,\"Error\"):instanceOf(e,ReferenceError)?Decontextify.instance(e,host.ReferenceError,r,o,\"Error\"):instanceOf(e,SyntaxError)?Decontextify.instance(e,host.SyntaxError,r,o,\"Error\"):instanceOf(e,TypeError)?Decontextify.instance(e,host.TypeError,r,o,\"Error\"):instanceOf(e,VMError)?Decontextify.instance(e,host.VMError,r,o,\"Error\"):instanceOf(e,EvalError)?Decontextify.instance(e,host.EvalError,r,o,\"Error\"):instanceOf(e,URIError)?Decontextify.instance(e,host.URIError,r,o,\"Error\"):instanceOf(e,Error)?Decontextify.instance(e,host.Error,r,o,\"Error\"):instanceOf(e,Array)?Decontextify.instance(e,host.Array,r,o,\"Array\"):instanceOf(e,RegExp)?Decontextify.instance(e,host.RegExp,r,o,\"RegExp\"):instanceOf(e,Map)?Decontextify.instance(e,host.Map,r,o,\"Map\"):instanceOf(e,WeakMap)?Decontextify.instance(e,host.WeakMap,r,o,\"WeakMap\"):instanceOf(e,Set)?Decontextify.instance(e,host.Set,r,o,\"Set\"):instanceOf(e,WeakSet)?Decontextify.instance(e,host.WeakSet,r,o,\"WeakSet\"):\"function\"==typeof Promise&&instanceOf(e,Promise)?Decontextify.instance(e,host.Promise,r,o,\"Promise\"):null===local.Reflect.getPrototypeOf(e)?Decontextify.instance(e,null,r,o):Decontextify.object(e,t,r,o,n);case\"function\":return Decontextify.function(e,t,r,o,n);case\"undefined\":return;default:return e}}catch(e){return null}});const Contextify=host.Object.create(null);Contextify.proxies=new host.WeakMap,Contextify.arguments=(e=>{if(!host.Array.isArray(e))return new local.Array;try{const t=new local.Array;for(let r=0,o=e.length;r{if(\"function\"==typeof e)return Contextify.function(e);const c=host.Object.create(null);return c.get=((c,l,i)=>{try{if(\"isVMProxy\"===l)return!0;if(\"constructor\"===l)return t;if(\"__proto__\"===l)return t.prototype}catch(e){return null}if(\"__defineGetter__\"===l)return local.Object.prototype.__defineGetter__;if(\"__defineSetter__\"===l)return local.Object.prototype.__defineSetter__;if(\"__lookupGetter__\"===l)return local.Object.prototype.__lookupGetter__;if(\"__lookupSetter__\"===l)return local.Object.prototype.__lookupSetter__;if(l===host.Symbol.toStringTag&&n)return n;try{return Contextify.value(host.Reflect.get(e,l),null,r,o)}catch(e){throw Contextify.value(e)}}),c.getPrototypeOf=(e=>t&&t.prototype),Contextify.object(e,c,r,o)}),Contextify.function=((e,t,r,o,n)=>{const c=host.Object.create(null);let l;return c.apply=((t,r,o)=>{r=Decontextify.value(r),o=Decontextify.arguments(o);try{return Contextify.value(e.apply(r,o))}catch(e){throw Contextify.value(e)}}),c.construct=((t,n,c)=>{host.version<8&&e===host.Buffer&&\"number\"==typeof n[0]&&(n[0]=new Array(n[0]).fill(0)),n=Decontextify.arguments(n);try{return Contextify.instance(new e(...n),l,r,o)}catch(e){throw Contextify.value(e)}}),c.get=((t,c,l)=>{try{if(\"isVMProxy\"===c)return!0;if(n&&host.Object.prototype.hasOwnProperty.call(n,c))return n[c];if(\"constructor\"===c)return Function;if(\"__proto__\"===c)return Function.prototype}catch(e){return null}if(\"__defineGetter__\"===c)return local.Object.prototype.__defineGetter__;if(\"__defineSetter__\"===c)return local.Object.prototype.__defineSetter__;if(\"__lookupGetter__\"===c)return local.Object.prototype.__lookupGetter__;if(\"__lookupSetter__\"===c)return local.Object.prototype.__lookupSetter__;if(\"caller\"===c||\"callee\"===c||\"arguments\"===c)throw throwCallerCalleeArgumentsAccess(c);try{return Contextify.value(host.Reflect.get(e,c),null,r,o)}catch(e){throw Contextify.value(e)}}),c.getPrototypeOf=(e=>Function.prototype),l=Contextify.object(e,host.Object.assign(c,t),r)}),Contextify.object=((e,t,r,o,n)=>{const c=host.Object.create(null);c.get=((t,c,l)=>{try{if(\"isVMProxy\"===c)return!0;if(n&&host.Object.prototype.hasOwnProperty.call(n,c))return n[c];if(\"constructor\"===c)return Object;if(\"__proto__\"===c)return Object.prototype}catch(e){return null}if(\"__defineGetter__\"===c)return local.Object.prototype.__defineGetter__;if(\"__defineSetter__\"===c)return local.Object.prototype.__defineSetter__;if(\"__lookupGetter__\"===c)return local.Object.prototype.__lookupGetter__;if(\"__lookupSetter__\"===c)return local.Object.prototype.__lookupSetter__;try{return Contextify.value(host.Reflect.get(e,c),null,r,o)}catch(e){throw Contextify.value(e)}}),c.set=((t,r,n,c)=>{if(\"__proto__\"===r)return!1;if(o&&o.protected&&\"function\"==typeof n)return!1;n=Decontextify.value(n);try{return host.Reflect.set(e,r,n)}catch(e){throw Contextify.value(e)}}),c.getOwnPropertyDescriptor=((t,n)=>{let c,l;try{c=host.Object.getOwnPropertyDescriptor(e,n)}catch(e){throw Contextify.value(e)}if(c){if(!(l=c.get||c.set?{__proto__:null,get:Contextify.value(c.get,null,r,o)||void 0,set:Contextify.value(c.set,null,r,o)||void 0,enumerable:!0===c.enumerable,configurable:!0===c.configurable}:{__proto__:null,value:Contextify.value(c.value,null,r,o),writable:!0===c.writable,enumerable:!0===c.enumerable,configurable:!0===c.configurable}).configurable)try{(c=host.Object.getOwnPropertyDescriptor(t,n))&&!c.configurable&&c.writable===l.writable||local.Reflect.defineProperty(t,n,l)}catch(e){}return l}}),c.defineProperty=((t,n,c)=>{let l=!1;try{l=local.Reflect.setPrototypeOf(c,null)}catch(e){}if(!l)return!1;const i=c.get,a=c.set,f=c.value;if(o&&o.protected&&(i||a||\"function\"==typeof f))return!1;const s=host.Object.create(null);i||a?(s.get=Decontextify.value(i,null,r,o)||void 0,s.set=Decontextify.value(a,null,r,o)||void 0,s.enumerable=!0===c.enumerable,s.configurable=!0===c.configurable):(s.value=Decontextify.value(f,null,r,o),s.writable=!0===c.writable,s.enumerable=!0===c.enumerable,s.configurable=!0===c.configurable);try{l=host.Reflect.defineProperty(e,n,s)}catch(e){throw Contextify.value(e)}if(l&&!c.configurable)try{local.Reflect.defineProperty(t,n,c)}catch(e){return!1}return l}),c.deleteProperty=((t,r)=>{try{return Contextify.value(host.Reflect.deleteProperty(e,r))}catch(e){throw Contextify.value(e)}}),c.getPrototypeOf=(e=>local.Object.prototype),c.setPrototypeOf=(e=>{throw new VMError(OPNA)}),c.has=((t,r)=>{try{return Contextify.value(host.Reflect.has(e,r))}catch(e){throw Contextify.value(e)}}),c.isExtensible=(t=>{let n;try{n=host.Reflect.isExtensible(e)}catch(e){throw Contextify.value(e)}if(!n)try{local.Reflect.isExtensible(t)&&doPreventExtensions(t,e,e=>Decontextify.value(e,null,r,o))}catch(e){}return n}),c.ownKeys=(t=>{try{return Contextify.value(host.Reflect.ownKeys(e))}catch(e){throw Contextify.value(e)}}),c.preventExtensions=(t=>{let n;try{n=local.Reflect.preventExtensions(e)}catch(e){throw Contextify.value(e)}if(n)try{local.Reflect.isExtensible(t)&&doPreventExtensions(t,e,e=>Decontextify.value(e,null,r,o))}catch(e){}return n}),c.enumerate=(t=>{try{return Contextify.value(host.Reflect.enumerate(e))}catch(e){throw Contextify.value(e)}});const l=new host.Proxy(createBaseObject(e),host.Object.assign(c,t,r));return Contextify.proxies.set(e,l),Contextified.set(l,e),l}),Contextify.value=((e,t,r,o,n)=>{try{if(Decontextified.has(e))return Decontextified.get(e);if(Contextify.proxies.has(e))return Contextify.proxies.get(e);switch(typeof e){case\"object\":return null===e?null:instanceOf(e,host.Number)?Contextify.instance(e,Number,r,o,\"Number\"):instanceOf(e,host.String)?Contextify.instance(e,String,r,o,\"String\"):instanceOf(e,host.Boolean)?Contextify.instance(e,Boolean,r,o,\"Boolean\"):instanceOf(e,host.Date)?Contextify.instance(e,Date,r,o,\"Date\"):instanceOf(e,host.RangeError)?Contextify.instance(e,RangeError,r,o,\"Error\"):instanceOf(e,host.ReferenceError)?Contextify.instance(e,ReferenceError,r,o,\"Error\"):instanceOf(e,host.SyntaxError)?Contextify.instance(e,SyntaxError,r,o,\"Error\"):instanceOf(e,host.TypeError)?Contextify.instance(e,TypeError,r,o,\"Error\"):instanceOf(e,host.VMError)?Contextify.instance(e,VMError,r,o,\"Error\"):instanceOf(e,host.EvalError)?Contextify.instance(e,EvalError,r,o,\"Error\"):instanceOf(e,host.URIError)?Contextify.instance(e,URIError,r,o,\"Error\"):instanceOf(e,host.Error)?Contextify.instance(e,Error,r,o,\"Error\"):instanceOf(e,host.Array)?Contextify.instance(e,Array,r,o,\"Array\"):instanceOf(e,host.RegExp)?Contextify.instance(e,RegExp,r,o,\"RegExp\"):instanceOf(e,host.Map)?Contextify.instance(e,Map,r,o,\"Map\"):instanceOf(e,host.WeakMap)?Contextify.instance(e,WeakMap,r,o,\"WeakMap\"):instanceOf(e,host.Set)?Contextify.instance(e,Set,r,o,\"Set\"):instanceOf(e,host.WeakSet)?Contextify.instance(e,WeakSet,r,o,\"WeakSet\"):\"function\"==typeof Promise&&instanceOf(e,host.Promise)?Contextify.instance(e,Promise,r,o,\"Promise\"):instanceOf(e,host.Buffer)?Contextify.instance(e,LocalBuffer,r,o,\"Uint8Array\"):null===host.Reflect.getPrototypeOf(e)?Contextify.instance(e,null,r,o):Contextify.object(e,t,r,o,n);case\"function\":return Contextify.function(e,t,r,o,n);case\"undefined\":return;default:return e}}catch(e){return null}}),Contextify.setGlobal=((e,t)=>{const r=Contextify.value(e);try{global[r]=Contextify.value(t)}catch(e){throw Decontextify.value(e)}}),Contextify.getGlobal=(e=>{const t=Contextify.value(e);try{return Decontextify.value(global[t])}catch(e){throw Decontextify.value(e)}}),Contextify.readonly=((e,t)=>Contextify.value(e,null,FROZEN_TRAPS,null,t)),Contextify.protected=((e,t)=>Contextify.value(e,null,null,{protected:!0},t)),Contextify.connect=((e,t)=>{Decontextified.set(e,t),Contextified.set(t,e)}),Contextify.makeModule=(()=>({exports:{}})),Contextify.isVMProxy=(e=>Decontextified.has(e));const BufferMock=host.Object.create(null);BufferMock.allocUnsafe=function(e){return this.alloc(e)},BufferMock.allocUnsafeSlow=function(e){return this.alloc(e)};const BufferOverride=host.Object.create(null);BufferOverride.inspect=function(e,t){const r=host.INSPECT_MAX_BYTES,o=Math.min(r,this.length),n=this.length-r;let c=this.hexSlice(0,o).replace(/(.{2})/g,\"$1 \").trim();return n>0&&(c+=` ... ${n} more byte${n>1?\"s\":\"\"}`),`<${this.constructor.name} ${c}>`};const LocalBuffer=global.Buffer=Contextify.readonly(host.Buffer,BufferMock);Contextify.connect(host.Buffer.prototype.inspect,BufferOverride.inspect);const exportsMap=host.Object.create(null);return exportsMap.Contextify=Contextify,exportsMap.Decontextify=Decontextify,exportsMap.Buffer=LocalBuffer,exportsMap.sandbox=Decontextify.value(global),exportsMap.Function=Function,exportsMap;',\n\"fixasync.js\":'\"use strict\";const{GeneratorFunction:GeneratorFunction,AsyncFunction:AsyncFunction,AsyncGeneratorFunction:AsyncGeneratorFunction,global:global,internal:internal,host:host,hook:hook}=this,{Contextify:Contextify,Decontextify:Decontextify}=internal,{Function:Function,eval:eval_,Promise:Promise,Object:Object,Reflect:Reflect}=global,{getOwnPropertyDescriptor:getOwnPropertyDescriptor,defineProperty:defineProperty,assign:assign}=Object,{apply:rApply,construct:rConstruct}=Reflect,FunctionHandler={__proto__:null,apply(t,o,n){const e=this.type;n=Decontextify.arguments(n);try{n=Contextify.value(hook(e,n))}catch(t){throw Contextify.value(t)}return rApply(t,o,n)},construct(t,o,n){const e=this.type;o=Decontextify.arguments(o);try{o=Contextify.value(hook(e,o))}catch(t){throw Contextify.value(t)}return rConstruct(t,o,n)}};function makeCheckFunction(t){return assign({__proto__:null,type:t},FunctionHandler)}function override(t,o,n){const e=getOwnPropertyDescriptor(t,o);e.value=n,defineProperty(t,o,e)}const proxiedFunction=new host.Proxy(Function,makeCheckFunction(\"function\"));override(Function.prototype,\"constructor\",proxiedFunction),GeneratorFunction&&(Object.setPrototypeOf(GeneratorFunction,proxiedFunction),override(GeneratorFunction.prototype,\"constructor\",new host.Proxy(GeneratorFunction,makeCheckFunction(\"generator_function\")))),AsyncFunction&&(Object.setPrototypeOf(AsyncFunction,proxiedFunction),override(AsyncFunction.prototype,\"constructor\",new host.Proxy(AsyncFunction,makeCheckFunction(\"async_function\")))),AsyncGeneratorFunction&&(Object.setPrototypeOf(AsyncGeneratorFunction,proxiedFunction),override(AsyncGeneratorFunction.prototype,\"constructor\",new host.Proxy(AsyncGeneratorFunction,makeCheckFunction(\"async_generator_function\")))),global.Function=proxiedFunction,global.eval=new host.Proxy(eval_,makeCheckFunction(\"eval\")),Promise&&(Promise.prototype.then=new host.Proxy(Promise.prototype.then,makeCheckFunction(\"promise_then\")),Contextify.connect(host.Promise.prototype.then,Promise.prototype.then),Promise.prototype.finally&&(Promise.prototype.finally=new host.Proxy(Promise.prototype.finally,makeCheckFunction(\"promise_finally\")),Contextify.connect(host.Promise.prototype.finally,Promise.prototype.finally)),Promise.prototype.catch&&(Promise.prototype.catch=new host.Proxy(Promise.prototype.catch,makeCheckFunction(\"promise_catch\")),Contextify.connect(host.Promise.prototype.catch,Promise.prototype.catch)));',\n\"sandbox.js\":'\"use strict\";const{Script:Script}=host.require(\"vm\"),fs=host.require(\"fs\"),pa=host.require(\"path\"),BUILTIN_MODULES=host.process.binding(\"natives\"),parseJSON=JSON.parse,importModuleDynamically=()=>{throw\"Dynamic imports are not allowed.\"};return((t,e)=>{const r=this,o=new e.WeakMap,n={__proto__:null},i={__proto__:null},s={__proto__:null,\".json\"(t,e){try{const r=fs.readFileSync(e,\"utf8\");t.exports=parseJSON(r)}catch(t){throw Contextify.value(t)}},\".node\"(r,o){if(\"sandbox\"===t.options.require.context)throw new VMError(\"Native modules can be required only with context set to \\'host\\'.\");try{r.exports=Contextify.readonly(e.require(o))}catch(t){throw Contextify.value(t)}}};for(let o=0;o{if(\"sandbox\"!==t.options.require.context)try{o.exports=Contextify.readonly(e.require(n))}catch(t){throw Contextify.value(t)}else{let e;try{let r=fs.readFileSync(n,\"utf8\");r=t._compiler(r,n),e=new Script(`(function (exports, require, module, __filename, __dirname) { \\'use strict\\'; ${r} \\\\n});`,{__proto__:null,filename:n||\"vm.js\",displayErrors:!1,importModuleDynamically:importModuleDynamically})}catch(t){throw Contextify.value(t)}e.runInContext(r,{__proto__:null,filename:n||\"vm.js\",displayErrors:!1,importModuleDynamically:importModuleDynamically})(o.exports,o.require,o,n,i)}})}const c=e=>{if(!e)return null;let r;try{e=pa.resolve(e);const o=fs.existsSync(e),n=!!o&&fs.statSync(e).isDirectory();if(o&&!n)return e;for(let r=0;r{if(\"buffer\"===t)return{Buffer:Buffer};if(n[t])return n[t].exports;if(\"util\"===t)return Contextify.readonly(e.require(t),{__proto__:null,inherits:(t,e)=>{t.super_=e,Object.setPrototypeOf(t.prototype,e.prototype)}});if(\"events\"===t||\"internal/errors\"===t){let o;try{o=new Script(`(function (exports, require, module, process, internalBinding) {\\\\n\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\'use strict\\';\\\\n\\\\t\\\\t\\\\t\\\\t\\\\t\\\\tconst primordials = global;\\\\n\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t${BUILTIN_MODULES[t]}\\\\n\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\n\\\\n\\\\t\\\\t\\\\t\\\\t\\\\t});`,{filename:`${t}.vm.js`})}catch(t){throw Contextify.value(t)}const i=n[t]={exports:{},require:a};try{o.runInContext(r)(i.exports,i.require,i,e.process,e.process.binding)}catch(e){throw new VMError(`Error loading \\'${t}\\'`)}return i.exports}return Contextify.readonly(e.require(t))},l=(r,o=!1)=>{return n=>{let u,f;try{const r=t.options;if(r.nesting&&\"vm2\"===n)return{VM:Contextify.readonly(e.VM),NodeVM:Contextify.readonly(e.NodeVM)};u=r.require}catch(t){throw Contextify.value(t)}if(!u)throw new VMError(`Access denied to require \\'${n}\\'`,\"EDENIED\");if(null==n)throw new VMError(\"Module \\'\\' not found.\",\"ENOTFOUND\");if(\"string\"!=typeof n)throw new VMError(`Invalid module name \\'${n}\\'`,\"EINVALIDNAME\");let y,x=!1;try{const{mock:t}=u;if(t){const e=t[n];if(e)return Contextify.readonly(e)}}catch(t){throw Contextify.value(t)}if(BUILTIN_MODULES[n]){let t;try{const r=u.builtin;t=e.Array.isArray(r)?r.indexOf(\"*\")>=0?-1===r.indexOf(`-${n}`):r.indexOf(n)>=0:!!r&&r[n]}catch(t){throw Contextify.value(t)}if(!t)throw new VMError(`Access denied to require \\'${n}\\'`,\"EDENIED\");return a(n)}try{y=u.external}catch(t){throw Contextify.value(t)}if(!y)throw new VMError(`Access denied to require \\'${n}\\'`,\"EDENIED\");if(/^(\\\\.|\\\\.\\\\/|\\\\.\\\\.\\\\/)/.exec(n)){if(!r)throw new VMError(\"You must specify script path to load relative modules.\",\"ENOPATH\");f=c(`${r}/${n}`)}else if(/^(\\\\/|\\\\\\\\|[a-zA-Z]:\\\\\\\\)/.exec(n))f=c(n);else{if(!r)throw new VMError(\"You must specify script path to load relative modules.\",\"ENOPATH\");if(\"object\"==typeof y){let t;try{const{external:r,transitive:i}=(t=>e.Array.isArray(t)?{__proto__:null,external:t,transitive:!1}:{__proto__:null,external:t.modules,transitive:t.transitive})(y);t=r.some(t=>e.helpers.match(t,n))||i&&o}catch(t){throw Contextify.value(t)}if(!t)throw new VMError(`The module \\'${n}\\' is not whitelisted in VM.`,\"EDENIED\");x=!0}const t=r.split(pa.sep);for(;t.length;){const e=t.join(pa.sep);if(f=c(`${e}${pa.sep}node_modules${pa.sep}${n}`))break;t.pop()}}if(!f){let t;try{t=u.resolve}catch(t){throw Contextify.value(t)}if(t){let t;try{t=u.resolve(n,r)}catch(t){throw Contextify.value(t)}f=c(t)}}if(!f)throw new VMError(`Cannot find module \\'${n}\\'`,\"ENOTFOUND\");if(i[f])return i[f].exports;const h=pa.dirname(f),p=pa.extname(f);let d=!0;try{const t=u.root;t&&(d=(e.Array.isArray(t)?t:e.Array.of(t)).some(t=>e.String.prototype.startsWith.call(h,pa.resolve(t))))}catch(t){throw Contextify.value(t)}if(!d)throw new VMError(`Module \\'${n}\\' is not allowed to be required. The path is outside the border!`,\"EDENIED\");const v=i[f]={filename:f,exports:{},require:l(h,x)};if(s[p])return s[p](v,f,h),v.exports;throw new VMError(`Failed to load \\'${n}\\': Unknown type.`,\"ELOADFAIL\")}};function u(t,r){if(\"beforeExit\"!==t&&\"exit\"!==t)throw new Error(`Access denied to listen for \\'${t}\\' event.`);try{e.process.on(t,Decontextify.value(r))}catch(t){throw Contextify.value(t)}return this}r.setTimeout=function(t,r,...n){if(\"function\"!=typeof t)throw new TypeError(\\'\"callback\" argument must be a function\\');let i;try{i=e.setTimeout(Decontextify.value(()=>{t(...n)}),Decontextify.value(r))}catch(t){throw Contextify.value(t)}const s=Contextify.value(i);return o.set(s,i),s},r.setInterval=function(t,r,...n){if(\"function\"!=typeof t)throw new TypeError(\\'\"callback\" argument must be a function\\');let i;try{i=e.setInterval(Decontextify.value(()=>{t(...n)}),Decontextify.value(r))}catch(t){throw Contextify.value(t)}const s=Contextify.value(i);return o.set(s,i),s},r.setImmediate=function(t,...r){if(\"function\"!=typeof t)throw new TypeError(\\'\"callback\" argument must be a function\\');let n;try{n=e.setImmediate(Decontextify.value(()=>{t(...r)}))}catch(t){throw Contextify.value(t)}const i=Contextify.value(n);return o.set(i,n),i},r.clearTimeout=function(t){try{e.clearTimeout(o.get(t))}catch(t){throw Contextify.value(t)}},r.clearInterval=function(t){try{e.clearInterval(o.get(t))}catch(t){throw Contextify.value(t)}},r.clearImmediate=function(t){try{e.clearImmediate(o.get(t))}catch(t){throw Contextify.value(t)}};const{argv:f,env:y}=options;return r.process={argv:void 0!==f?Contextify.value(f):[],title:e.process.title,version:e.process.version,versions:Contextify.readonly(e.process.versions),arch:e.process.arch,platform:e.process.platform,env:void 0!==y?Contextify.value(y):{},pid:e.process.pid,features:Contextify.readonly(e.process.features),nextTick:function(t,...r){if(\"function\"!=typeof t)throw new Error(\"Callback must be a function.\");try{e.process.nextTick(Decontextify.value(()=>{t(...r)}))}catch(t){throw Contextify.value(t)}},hrtime:function(t){try{return Contextify.value(e.process.hrtime(Decontextify.value(t)))}catch(t){throw Contextify.value(t)}},cwd:function(){try{return Contextify.value(e.process.cwd())}catch(t){throw Contextify.value(t)}},addListener:u,on:u,once:function(t,r){if(\"beforeExit\"!==t&&\"exit\"!==t)throw new Error(`Access denied to listen for \\'${t}\\' event.`);try{e.process.once(t,Decontextify.value(r))}catch(t){throw Contextify.value(t)}return this},listeners:function(t){if(\"beforeExit\"!==t&&\"exit\"!==t)return[];try{return Contextify.value(e.process.listeners(t).filter(t=>Contextify.isVMProxy(t)))}catch(t){throw Contextify.value(t)}},removeListener:function(t,r){if(\"beforeExit\"!==t&&\"exit\"!==t)return this;try{e.process.removeListener(t,Decontextify.value(r))}catch(t){throw Contextify.value(t)}return this},umask:function(){if(arguments.length)throw new Error(\"Access denied to set umask.\");try{return Contextify.value(e.process.umask())}catch(t){throw Contextify.value(t)}}},\"inherit\"===t.options.console?r.console=Contextify.readonly(e.console):\"redirect\"===t.options.console&&(r.console={debug(...e){try{t.emit(\"console.debug\",...Decontextify.arguments(e))}catch(t){throw Contextify.value(t)}},log(...e){try{t.emit(\"console.log\",...Decontextify.arguments(e))}catch(t){throw Contextify.value(t)}},info(...e){try{t.emit(\"console.info\",...Decontextify.arguments(e))}catch(t){throw Contextify.value(t)}},warn(...e){try{t.emit(\"console.warn\",...Decontextify.arguments(e))}catch(t){throw Contextify.value(t)}},error(...e){try{t.emit(\"console.error\",...Decontextify.arguments(e))}catch(t){throw Contextify.value(t)}},dir(...e){try{t.emit(\"console.dir\",...Decontextify.arguments(e))}catch(t){throw Contextify.value(t)}},time(){},timeEnd(){},trace(...e){try{t.emit(\"console.trace\",...Decontextify.arguments(e))}catch(t){throw Contextify.value(t)}}}),l})(vm,host);'\n};const t=require(\"fs\"),r=require(\"vm\"),o=require(\"path\"),{EventEmitter:n}=require(\"events\"),{INSPECT_MAX_BYTES:i}=require(\"buffer\"),c=function(){return{match:function(e,t){const r=function(e){return e.replace(/[.*+\\-?^${}()|[\\]\\\\]/g,\"\\\\require('./helpers.js');\")}(e).replace(/\\\\\\*/g,\"\\\\S*\").replace(/\\\\\\?/g,\".\");return new RegExp(r).test(t)}}}(),l=()=>{throw\"Dynamic imports are not allowed.\"};function s(t,o,n){const i=e[t.split(\"/\").pop()];return new r.Script(o+i+n,{filename:t,displayErrors:!1,importModuleDynamically:l})}const a={coffeeScriptCompiler:null,timeoutContext:null,timeoutScript:null,contextifyScript:s(`${__dirname}/contextify.js`,\"(function(require, host) { \",\"\\n})\"),sandboxScript:null,hookScript:null,getGlobalScript:null,getGeneratorFunctionScript:null,getAsyncFunctionScript:null,getAsyncGeneratorFunctionScript:null},u={displayErrors:!1,importModuleDynamically:l};function f(e,t){return p(e)}function y(e){if(\"function\"==typeof e)return e;switch(e){case\"coffeescript\":case\"coffee-script\":case\"cs\":case\"text/coffeescript\":return function(){if(!a.coffeeScriptCompiler)try{const e=require(\"coffee-script\");a.coffeeScriptCompiler=((t,r)=>e.compile(t,{header:!1,bare:!0}))}catch(e){throw new m(\"Coffee-Script compiler is not installed.\")}return a.coffeeScriptCompiler}();case\"javascript\":case\"java-script\":case\"js\":case\"text/javascript\":return f;default:throw new m(`Unsupported compiler '${e}'.`)}}function p(e){return e.startsWith(\"#!\")?\"//\"+e.substr(2):e}class h{constructor(e,t){const r=`${e}`;let o,n;2===arguments.length?\"object\"==typeof t&&t.toString===Object.prototype.toString?o=(n=t||{}).filename:(n={},o=t):arguments.length>2?(n=arguments[2]||{},o=t||n.filename):n={};const{compiler:i=\"javascript\",lineOffset:c=0,columnOffset:l=0}=n,s=y(i);Object.defineProperties(this,{code:{get(){return this._prefix+this._code+this._suffix},set(e){const t=String(e);t===this._code&&\"\"===this._prefix&&\"\"===this._suffix||(this._code=t,this._prefix=\"\",this._suffix=\"\",this._compiledVM=null,this._compiledNodeVM=null,this._compiledCode=null)},enumerable:!0},filename:{value:o||\"vm.js\",enumerable:!0},lineOffset:{value:c,enumerable:!0},columnOffset:{value:l,enumerable:!0},compiler:{value:i,enumerable:!0},_code:{value:r,writable:!0},_prefix:{value:\"\",writable:!0},_suffix:{value:\"\",writable:!0},_compiledVM:{value:null,writable:!0},_compiledNodeVM:{value:null,writable:!0},_compiledCode:{value:null,writable:!0},_compiler:{value:s}})}wrap(e,t){const r=`${e}`,o=`${t}`;return this._prefix===r&&this._suffix===o?this:(this._prefix=r,this._suffix=o,this._compiledVM=null,this._compiledNodeVM=null,this)}compile(){return this._compileVM(),this}getCompiledCode(){return this._compiledCode||(this._compiledCode=this._compiler(this._prefix+p(this._code)+this._suffix,this.filename)),this._compiledCode}_compile(e,t){return new r.Script(e+this.getCompiledCode()+t,{filename:this.filename,displayErrors:!1,lineOffset:this.lineOffset,columnOffset:this.columnOffset,importModuleDynamically:l})}_compileVM(){let e=this._compiledVM;return e||(this._compiledVM=e=this._compile(\"\",\"\")),e}_compileNodeVM(){let e=this._compiledNodeVM;return e||(this._compiledNodeVM=e=this._compile(\"(function (exports, require, module, __filename, __dirname) { \",\"\\n})\")),e}}class x extends n{constructor(e={}){super();const{timeout:t,sandbox:o,compiler:n=\"javascript\"}=e,i=!1!==e.eval,c=!1!==e.wasm,f=!!e.fixAsync;if(o&&\"object\"!=typeof o)throw new m(\"Sandbox must be object.\");const p=y(n),h=r.createContext(void 0,{codeGeneration:{strings:i,wasm:c}}),x=a.contextifyScript.runInContext(h,u).call(h,require,d),_=f?(v=x,(e,t)=>{if(\"function\"===e||\"generator_function\"===e||\"eval\"===e||\"run\"===e){const r=v.Function;if(\"eval\"===e){const e=t[0];if(t=[e],\"string\"!=typeof e)return t}else t=t.map(e=>`${e}`);if(-1===t.findIndex(e=>/\\basync\\b/.test(e)))return t;const o=t.map(e=>e.replace(/async/g,\"a\\\\u0073ync\"));try{r(...o)}catch(e){try{r(...t)}catch(e){throw v.Decontextify.value(e)}throw new m(\"Async not available\")}return t}throw new m(\"Async not available\")}):null;var v;if(Object.defineProperties(this,{timeout:{value:t,writable:!0,enumerable:!0},compiler:{value:n,enumerable:!0},sandbox:{value:x.sandbox,enumerable:!0},_context:{value:h},_internal:{value:x},_compiler:{value:p},_hook:{value:_}}),_){if(!a.hookScript){a.hookScript=s(`${__dirname}/fixasync.js`,\"(function() { \",\"\\n})\"),a.getGlobalScript=new r.Script(\"this\",{filename:\"get_global.js\",displayErrors:!1,importModuleDynamically:l});try{a.getGeneratorFunctionScript=new r.Script(\"(function*(){}).constructor\",{filename:\"get_generator_function.js\",displayErrors:!1,importModuleDynamically:l})}catch(e){}try{a.getAsyncFunctionScript=new r.Script(\"(async function(){}).constructor\",{filename:\"get_async_function.js\",displayErrors:!1,importModuleDynamically:l})}catch(e){}try{a.getAsyncGeneratorFunctionScript=new r.Script(\"(async function*(){}).constructor\",{filename:\"get_async_generator_function.js\",displayErrors:!1,importModuleDynamically:l})}catch(e){}}\nconst e={__proto__:null,global:a.getGlobalScript.runInContext(h,u),internal:x,host:d,hook:_};if(a.getGeneratorFunctionScript)try{e.GeneratorFunction=a.getGeneratorFunctionScript.runInContext(h,u)}catch(e){}if(a.getAsyncFunctionScript)try{e.AsyncFunction=a.getAsyncFunctionScript.runInContext(h,u)}catch(e){}if(a.getAsyncGeneratorFunctionScript)try{e.AsyncGeneratorFunction=a.getAsyncGeneratorFunctionScript.runInContext(h,u)}catch(e){}a.hookScript.runInContext(h,u).call(e)}o&&this.setGlobals(o)}setGlobals(e){for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&this._internal.Contextify.setGlobal(t,e[t]);return this}setGlobal(e,t){return this._internal.Contextify.setGlobal(e,t),this}getGlobal(e){return this._internal.Contextify.getGlobal(e)}freeze(e,t){return this._internal.Contextify.readonly(e),t&&this._internal.Contextify.setGlobal(t,e),e}protect(e,t){return this._internal.Contextify.protected(e),t&&this._internal.Contextify.setGlobal(t,e),e}run(e,t){let o;if(e instanceof h)if(this._hook){const t=e.getCompiledCode(),n=this._hook(\"run\",[t])[0];o=n===t?e._compileVM():new r.Script(n,{filename:e.filename,displayErrors:!1,importModuleDynamically:l})}else o=e._compileVM();else{const n=t||\"vm.js\";let i=this._compiler(e,n);this._hook&&(i=this._hook(\"run\",[i])[0]),o=new r.Script(i,{filename:n,displayErrors:!1,importModuleDynamically:l})}if(!this.timeout)try{return this._internal.Decontextify.value(o.runInContext(this._context,u))}catch(e){throw this._internal.Decontextify.value(e)}return function(e,t){let o=a.timeoutContext,n=a.timeoutScript;o||(a.timeoutContext=o=r.createContext(),a.timeoutScript=n=new r.Script(\"fn()\",{filename:\"timeout_bridge.js\",displayErrors:!1,importModuleDynamically:l})),o.fn=e;try{return n.runInContext(o,{displayErrors:!1,importModuleDynamically:l,timeout:t})}finally{o.fn=null}}(()=>{try{return this._internal.Decontextify.value(o.runInContext(this._context,u))}catch(e){throw this._internal.Decontextify.value(e)}},this.timeout)}runFile(e){const r=o.resolve(e);if(!t.existsSync(r))throw new m(`Script '${e}' not found.`);if(t.statSync(r).isDirectory())throw new m(\"Script must be file, got directory.\");return this.run(t.readFileSync(r,\"utf8\"),r)}}class _ extends x{constructor(e={}){const t=e.sandbox;if(t&&\"object\"!=typeof t)throw new m(\"Sandbox must be object.\");super({compiler:e.compiler,eval:e.eval,wasm:e.wasm}),Object.defineProperty(this,\"options\",{value:{console:e.console||\"inherit\",require:e.require||!1,nesting:e.nesting||!1,wrapper:e.wrapper||\"commonjs\",sourceExtensions:e.sourceExtensions||[\"js\"]}});let r=a.sandboxScript;r||(a.sandboxScript=r=s(`${__dirname}/sandbox.js`,\"(function (vm, host, Contextify, Decontextify, Buffer, options) { \",\"\\n})\"));const o=r.runInContext(this._context,u);if(Object.defineProperty(this,\"_prepareRequire\",{value:o.call(this._context,this,d,this._internal.Contextify,this._internal.Decontextify,this._internal.Buffer,e)}),t&&this.setGlobals(t),this.options.require&&this.options.require.import)if(Array.isArray(this.options.require.import))for(let e=0,t=this.options.require.import.length;e3)throw new m(\"Invalid number of arguments.\");const i=\"string\"==typeof n?o.resolve(n):void 0;return new _(r).run(e,i)}static file(e,r){const n=o.resolve(e);if(!t.existsSync(n))throw new m(`Script '${e}' not found.`);if(t.statSync(n).isDirectory())throw new m(\"Script must be file, got directory.\");return new _(r).run(t.readFileSync(n,\"utf8\"),n)}}class m extends Error{constructor(e){super(e),this.name=\"VMError\",Error.captureStackTrace(this,this.constructor)}}global._require=require;const d={version:parseInt(process.versions.node.split(\".\")[0]),_require:_require,process:process,console:console,setTimeout:setTimeout,setInterval:setInterval,setImmediate:setImmediate,clearTimeout:clearTimeout,clearInterval:clearInterval,clearImmediate:clearImmediate,String:String,Number:Number,Buffer:Buffer,Boolean:Boolean,\nArray:Array,Date:Date,Error:Error,EvalError:EvalError,RangeError:RangeError,ReferenceError:ReferenceError,SyntaxError:SyntaxError,TypeError:TypeError,URIError:URIError,RegExp:RegExp,Function:Function,Object:Object,VMError:m,Proxy:Proxy,Reflect:Reflect,Map:Map,WeakMap:WeakMap,Set:Set,WeakSet:WeakSet,Promise:Promise,Symbol:Symbol,INSPECT_MAX_BYTES:i,VM:x,NodeVM:_,helpers:c};var v={};return v.VMError=m,v.NodeVM=_,v.VM=x,v.VMScript=h,v}());\n" + v_ret = v_str_saf + v_mk_head_WindowProperties() + '\n' + v_global_init(v_global_s) + '\n' + v_ret -v_ret = ` -function cilame(v_this){ +v_ret = vm2code + ` +function cilame(){ ${v_ret.trim().split('\n').map(function(e){return ' '+e}).join('\n')} } `