@cuxt/sandboxjs 0.1.1 → 0.1.4
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/LICENSE +21 -21
- package/README.md +198 -185
- package/{build → dist/cjs}/Sandbox.d.ts +15 -6
- package/dist/cjs/Sandbox.js +126 -0
- package/dist/{SandboxExec.d.ts → cjs/SandboxExec.d.ts} +8 -17
- package/dist/cjs/SandboxExec.js +227 -0
- package/{build/eval.d.ts → dist/cjs/eval/index.d.ts} +10 -2
- package/dist/cjs/eval/index.js +233 -0
- package/dist/cjs/executor/executorUtils.d.ts +161 -0
- package/dist/cjs/executor/executorUtils.js +930 -0
- package/dist/cjs/executor/index.d.ts +1 -0
- package/dist/cjs/executor/index.js +2 -0
- package/dist/cjs/executor/ops/assignment.d.ts +1 -0
- package/dist/cjs/executor/ops/assignment.js +88 -0
- package/dist/cjs/executor/ops/call.d.ts +1 -0
- package/dist/cjs/executor/ops/call.js +160 -0
- package/dist/cjs/executor/ops/comparison.d.ts +1 -0
- package/dist/cjs/executor/ops/comparison.js +36 -0
- package/dist/cjs/executor/ops/control.d.ts +1 -0
- package/dist/cjs/executor/ops/control.js +203 -0
- package/dist/cjs/executor/ops/functions.d.ts +1 -0
- package/dist/cjs/executor/ops/functions.js +55 -0
- package/dist/cjs/executor/ops/index.d.ts +0 -0
- package/dist/cjs/executor/ops/index.js +11 -0
- package/dist/cjs/executor/ops/literals.d.ts +1 -0
- package/dist/cjs/executor/ops/literals.js +45 -0
- package/dist/cjs/executor/ops/misc.d.ts +1 -0
- package/dist/cjs/executor/ops/misc.js +25 -0
- package/dist/cjs/executor/ops/object.d.ts +1 -0
- package/dist/cjs/executor/ops/object.js +51 -0
- package/dist/cjs/executor/ops/prop.d.ts +1 -0
- package/dist/cjs/executor/ops/prop.js +70 -0
- package/dist/cjs/executor/ops/unary.d.ts +1 -0
- package/dist/cjs/executor/ops/unary.js +48 -0
- package/dist/cjs/executor/ops/variables.d.ts +1 -0
- package/dist/cjs/executor/ops/variables.js +16 -0
- package/dist/cjs/executor/opsRegistry.d.ts +33 -0
- package/dist/cjs/executor/opsRegistry.js +8 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/parser/index.d.ts +3 -0
- package/dist/cjs/parser/index.js +1 -0
- package/dist/{parser.d.ts → cjs/parser/lisp.d.ts} +29 -42
- package/dist/cjs/parser/lispTypes/conditionals.d.ts +2 -0
- package/dist/cjs/parser/lispTypes/conditionals.js +135 -0
- package/dist/cjs/parser/lispTypes/control.d.ts +2 -0
- package/dist/cjs/parser/lispTypes/control.js +204 -0
- package/dist/cjs/parser/lispTypes/declarations.d.ts +2 -0
- package/dist/cjs/parser/lispTypes/declarations.js +99 -0
- package/dist/cjs/parser/lispTypes/index.d.ts +3 -0
- package/dist/cjs/parser/lispTypes/index.js +17 -0
- package/dist/cjs/parser/lispTypes/operators.d.ts +2 -0
- package/dist/cjs/parser/lispTypes/operators.js +252 -0
- package/dist/cjs/parser/lispTypes/shared.d.ts +38 -0
- package/dist/cjs/parser/lispTypes/structures.d.ts +2 -0
- package/dist/cjs/parser/lispTypes/structures.js +188 -0
- package/dist/cjs/parser/lispTypes/values.d.ts +2 -0
- package/dist/cjs/parser/lispTypes/values.js +89 -0
- package/dist/cjs/parser/parserUtils.d.ts +34 -0
- package/dist/cjs/parser/parserUtils.js +968 -0
- package/dist/cjs/utils/CodeString.d.ts +16 -0
- package/dist/cjs/utils/CodeString.js +64 -0
- package/dist/cjs/utils/ExecContext.d.ts +34 -0
- package/dist/cjs/utils/ExecContext.js +171 -0
- package/dist/cjs/utils/Prop.d.ts +16 -0
- package/dist/cjs/utils/Prop.js +81 -0
- package/dist/cjs/utils/Scope.d.ts +47 -0
- package/dist/cjs/utils/Scope.js +127 -0
- package/dist/cjs/utils/errors.d.ts +10 -0
- package/dist/cjs/utils/errors.js +12 -0
- package/dist/cjs/utils/functionReplacements.d.ts +11 -0
- package/dist/cjs/utils/functionReplacements.js +362 -0
- package/dist/cjs/utils/index.d.ts +7 -0
- package/dist/cjs/utils/index.js +7 -0
- package/dist/cjs/utils/types.d.ts +221 -0
- package/dist/cjs/utils/types.js +164 -0
- package/dist/cjs/utils/unraw.js +145 -0
- package/dist/{node → esm}/Sandbox.d.ts +15 -6
- package/dist/esm/Sandbox.js +115 -0
- package/dist/esm/Sandbox.js.map +1 -0
- package/{build → dist/esm}/SandboxExec.d.ts +8 -17
- package/dist/esm/SandboxExec.js +224 -0
- package/dist/esm/SandboxExec.js.map +1 -0
- package/dist/{eval.d.ts → esm/eval/index.d.ts} +10 -2
- package/dist/esm/eval/index.js +235 -0
- package/dist/esm/eval/index.js.map +1 -0
- package/dist/esm/executor/executorUtils.d.ts +161 -0
- package/dist/esm/executor/executorUtils.js +898 -0
- package/dist/esm/executor/executorUtils.js.map +1 -0
- package/dist/esm/executor/index.d.ts +1 -0
- package/dist/esm/executor/index.js +2 -0
- package/dist/esm/executor/ops/assignment.d.ts +1 -0
- package/dist/esm/executor/ops/assignment.js +90 -0
- package/dist/esm/executor/ops/assignment.js.map +1 -0
- package/dist/esm/executor/ops/call.d.ts +1 -0
- package/dist/esm/executor/ops/call.js +162 -0
- package/dist/esm/executor/ops/call.js.map +1 -0
- package/dist/esm/executor/ops/comparison.d.ts +1 -0
- package/dist/esm/executor/ops/comparison.js +38 -0
- package/dist/esm/executor/ops/comparison.js.map +1 -0
- package/dist/esm/executor/ops/control.d.ts +1 -0
- package/dist/esm/executor/ops/control.js +205 -0
- package/dist/esm/executor/ops/control.js.map +1 -0
- package/dist/esm/executor/ops/functions.d.ts +1 -0
- package/dist/esm/executor/ops/functions.js +57 -0
- package/dist/esm/executor/ops/functions.js.map +1 -0
- package/dist/esm/executor/ops/index.d.ts +0 -0
- package/dist/esm/executor/ops/index.js +11 -0
- package/dist/esm/executor/ops/literals.d.ts +1 -0
- package/dist/esm/executor/ops/literals.js +47 -0
- package/dist/esm/executor/ops/literals.js.map +1 -0
- package/dist/esm/executor/ops/misc.d.ts +1 -0
- package/dist/esm/executor/ops/misc.js +27 -0
- package/dist/esm/executor/ops/misc.js.map +1 -0
- package/dist/esm/executor/ops/object.d.ts +1 -0
- package/dist/esm/executor/ops/object.js +53 -0
- package/dist/esm/executor/ops/object.js.map +1 -0
- package/dist/esm/executor/ops/prop.d.ts +1 -0
- package/dist/esm/executor/ops/prop.js +72 -0
- package/dist/esm/executor/ops/prop.js.map +1 -0
- package/dist/esm/executor/ops/unary.d.ts +1 -0
- package/dist/esm/executor/ops/unary.js +50 -0
- package/dist/esm/executor/ops/unary.js.map +1 -0
- package/dist/esm/executor/ops/variables.d.ts +1 -0
- package/dist/esm/executor/ops/variables.js +18 -0
- package/dist/esm/executor/ops/variables.js.map +1 -0
- package/dist/esm/executor/opsRegistry.d.ts +33 -0
- package/dist/esm/executor/opsRegistry.js +9 -0
- package/dist/esm/executor/opsRegistry.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/parser/index.d.ts +3 -0
- package/dist/esm/parser/index.js +1 -0
- package/{build/parser.d.ts → dist/esm/parser/lisp.d.ts} +29 -42
- package/dist/esm/parser/lispTypes/conditionals.d.ts +2 -0
- package/dist/esm/parser/lispTypes/conditionals.js +137 -0
- package/dist/esm/parser/lispTypes/conditionals.js.map +1 -0
- package/dist/esm/parser/lispTypes/control.d.ts +2 -0
- package/dist/esm/parser/lispTypes/control.js +206 -0
- package/dist/esm/parser/lispTypes/control.js.map +1 -0
- package/dist/esm/parser/lispTypes/declarations.d.ts +2 -0
- package/dist/esm/parser/lispTypes/declarations.js +101 -0
- package/dist/esm/parser/lispTypes/declarations.js.map +1 -0
- package/dist/esm/parser/lispTypes/index.d.ts +3 -0
- package/dist/esm/parser/lispTypes/index.js +19 -0
- package/dist/esm/parser/lispTypes/index.js.map +1 -0
- package/dist/esm/parser/lispTypes/operators.d.ts +2 -0
- package/dist/esm/parser/lispTypes/operators.js +254 -0
- package/dist/esm/parser/lispTypes/operators.js.map +1 -0
- package/dist/esm/parser/lispTypes/shared.d.ts +38 -0
- package/dist/esm/parser/lispTypes/structures.d.ts +2 -0
- package/dist/esm/parser/lispTypes/structures.js +190 -0
- package/dist/esm/parser/lispTypes/structures.js.map +1 -0
- package/dist/esm/parser/lispTypes/values.d.ts +2 -0
- package/dist/esm/parser/lispTypes/values.js +91 -0
- package/dist/esm/parser/lispTypes/values.js.map +1 -0
- package/dist/esm/parser/parserUtils.d.ts +34 -0
- package/dist/esm/parser/parserUtils.js +959 -0
- package/dist/esm/parser/parserUtils.js.map +1 -0
- package/dist/esm/utils/CodeString.d.ts +16 -0
- package/dist/esm/utils/CodeString.js +66 -0
- package/dist/esm/utils/CodeString.js.map +1 -0
- package/dist/esm/utils/ExecContext.d.ts +34 -0
- package/dist/esm/utils/ExecContext.js +168 -0
- package/dist/esm/utils/ExecContext.js.map +1 -0
- package/dist/esm/utils/Prop.d.ts +16 -0
- package/dist/esm/utils/Prop.js +80 -0
- package/dist/esm/utils/Prop.js.map +1 -0
- package/dist/esm/utils/Scope.d.ts +47 -0
- package/dist/esm/utils/Scope.js +122 -0
- package/dist/esm/utils/Scope.js.map +1 -0
- package/dist/esm/utils/errors.d.ts +10 -0
- package/dist/esm/utils/errors.js +10 -0
- package/dist/esm/utils/errors.js.map +1 -0
- package/dist/esm/utils/functionReplacements.d.ts +11 -0
- package/dist/esm/utils/functionReplacements.js +361 -0
- package/dist/esm/utils/functionReplacements.js.map +1 -0
- package/dist/esm/utils/index.d.ts +7 -0
- package/dist/esm/utils/index.js +7 -0
- package/dist/esm/utils/types.d.ts +221 -0
- package/dist/esm/utils/types.js +160 -0
- package/dist/esm/utils/types.js.map +1 -0
- package/dist/esm/utils/unraw.js +147 -0
- package/dist/esm/utils/unraw.js.map +1 -0
- package/dist/umd/Sandbox.min.js +2 -0
- package/dist/umd/Sandbox.min.js.map +1 -0
- package/dist/umd/SandboxExec.min.js +2 -0
- package/dist/umd/SandboxExec.min.js.map +1 -0
- package/package.json +17 -16
- package/build/Sandbox.js +0 -62
- package/build/SandboxExec.js +0 -214
- package/build/eval.js +0 -205
- package/build/executor.d.ts +0 -124
- package/build/executor.js +0 -1554
- package/build/parser.js +0 -1527
- package/build/unraw.js +0 -168
- package/build/utils.d.ts +0 -264
- package/build/utils.js +0 -362
- package/dist/Sandbox.d.ts +0 -25
- package/dist/Sandbox.js +0 -270
- package/dist/Sandbox.js.map +0 -1
- package/dist/Sandbox.min.js +0 -2
- package/dist/Sandbox.min.js.map +0 -1
- package/dist/SandboxExec.js +0 -218
- package/dist/SandboxExec.js.map +0 -1
- package/dist/SandboxExec.min.js +0 -2
- package/dist/SandboxExec.min.js.map +0 -1
- package/dist/executor.d.ts +0 -124
- package/dist/executor.js +0 -1558
- package/dist/executor.js.map +0 -1
- package/dist/node/Sandbox.js +0 -277
- package/dist/node/SandboxExec.d.ts +0 -66
- package/dist/node/SandboxExec.js +0 -225
- package/dist/node/eval.d.ts +0 -27
- package/dist/node/executor.d.ts +0 -124
- package/dist/node/executor.js +0 -1575
- package/dist/node/parser.d.ts +0 -154
- package/dist/node/parser.js +0 -1704
- package/dist/node/utils.d.ts +0 -264
- package/dist/node/utils.js +0 -385
- package/dist/parser.js +0 -1690
- package/dist/parser.js.map +0 -1
- package/dist/unraw.d.ts +0 -11
- package/dist/utils.d.ts +0 -264
- package/dist/utils.js +0 -365
- package/dist/utils.js.map +0 -1
- /package/{build → dist/cjs/utils}/unraw.d.ts +0 -0
- /package/dist/{node → esm/utils}/unraw.d.ts +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).SandboxExec={})}(this,function(t){Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e=class extends Error{},n=class extends e{},o=class extends e{},r=class extends e{},i=class extends e{},s=class t{constructor(e){this.ref={str:""},e instanceof t?(this.ref=e.ref,this.start=e.start,this.end=e.end):(this.ref.str=e,this.start=0,this.end=e.length)}substring(e,n){if(!this.length)return this;(e=this.start+e)<0&&(e=0),e>this.end&&(e=this.end),(n=void 0===n?this.end:this.start+n)<0&&(n=0),n>this.end&&(n=this.end);const o=new t(this);return o.start=e,o.end=n,o}get length(){const t=this.end-this.start;return t<0?0:t}char(t){if(this.start!==this.end)return this.ref.str[this.start+t]}toString(){return this.ref.str.substring(this.start,this.end)}trimStart(){const e=/^\s+/.exec(this.toString()),n=new t(this);return e&&(n.start+=e[0].length),n}slice(t,e){return t<0&&(t=this.end-this.start+t),t<0&&(t=0),void 0===e&&(e=this.end-this.start),e<0&&(e=this.end-this.start+e),e<0&&(e=0),this.substring(t,e)}trim(){const t=this.trimStart(),e=/\s+$/.exec(t.toString());return e&&(t.end-=e[0].length),t}valueOf(){return this.toString()}},a=(Object.getPrototypeOf(async function(){}).constructor,Object.getPrototypeOf(function*(){}).constructor),c=Object.getPrototypeOf(async function*(){}).constructor,l=new Set(["await","break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","implements","import","in","instanceof","let","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with"]),d=function(t){return t.let="let",t.const="const",t.var="var",t.internal="internal",t}({}),u=function(t){return t[t.None=0]="None",t[t.Prop=1]="Prop",t[t.StringIndex=2]="StringIndex",t[t.Let=3]="Let",t[t.Const=4]="Const",t[t.Call=5]="Call",t[t.KeyVal=6]="KeyVal",t[t.Number=7]="Number",t[t.Return=8]="Return",t[t.Assign=9]="Assign",t[t.InlineFunction=10]="InlineFunction",t[t.ArrowFunction=11]="ArrowFunction",t[t.CreateArray=12]="CreateArray",t[t.If=13]="If",t[t.IfCase=14]="IfCase",t[t.InlineIf=15]="InlineIf",t[t.InlineIfCase=16]="InlineIfCase",t[t.SpreadObject=17]="SpreadObject",t[t.SpreadArray=18]="SpreadArray",t[t.ArrayProp=19]="ArrayProp",t[t.PropOptional=20]="PropOptional",t[t.CallOptional=21]="CallOptional",t[t.CreateObject=22]="CreateObject",t[t.Group=23]="Group",t[t.Not=24]="Not",t[t.IncrementBefore=25]="IncrementBefore",t[t.IncrementAfter=26]="IncrementAfter",t[t.DecrementBefore=27]="DecrementBefore",t[t.DecrementAfter=28]="DecrementAfter",t[t.And=29]="And",t[t.Or=30]="Or",t[t.StrictNotEqual=31]="StrictNotEqual",t[t.StrictEqual=32]="StrictEqual",t[t.Plus=33]="Plus",t[t.Var=34]="Var",t[t.GlobalSymbol=35]="GlobalSymbol",t[t.Literal=36]="Literal",t[t.Function=37]="Function",t[t.Loop=38]="Loop",t[t.Try=39]="Try",t[t.Switch=40]="Switch",t[t.SwitchCase=41]="SwitchCase",t[t.InternalBlock=42]="InternalBlock",t[t.Expression=43]="Expression",t[t.Await=44]="Await",t[t.New=45]="New",t[t.Throw=46]="Throw",t[t.Minus=47]="Minus",t[t.Divide=48]="Divide",t[t.Power=49]="Power",t[t.Multiply=50]="Multiply",t[t.Modulus=51]="Modulus",t[t.Equal=52]="Equal",t[t.NotEqual=53]="NotEqual",t[t.SmallerEqualThan=54]="SmallerEqualThan",t[t.LargerEqualThan=55]="LargerEqualThan",t[t.SmallerThan=56]="SmallerThan",t[t.LargerThan=57]="LargerThan",t[t.Negative=58]="Negative",t[t.Positive=59]="Positive",t[t.Typeof=60]="Typeof",t[t.Delete=61]="Delete",t[t.Instanceof=62]="Instanceof",t[t.In=63]="In",t[t.Inverse=64]="Inverse",t[t.SubractEquals=65]="SubractEquals",t[t.AddEquals=66]="AddEquals",t[t.DivideEquals=67]="DivideEquals",t[t.PowerEquals=68]="PowerEquals",t[t.MultiplyEquals=69]="MultiplyEquals",t[t.ModulusEquals=70]="ModulusEquals",t[t.BitNegateEquals=71]="BitNegateEquals",t[t.BitAndEquals=72]="BitAndEquals",t[t.BitOrEquals=73]="BitOrEquals",t[t.UnsignedShiftRightEquals=74]="UnsignedShiftRightEquals",t[t.ShiftRightEquals=75]="ShiftRightEquals",t[t.ShiftLeftEquals=76]="ShiftLeftEquals",t[t.BitAnd=77]="BitAnd",t[t.BitOr=78]="BitOr",t[t.BitNegate=79]="BitNegate",t[t.BitShiftLeft=80]="BitShiftLeft",t[t.BitShiftRight=81]="BitShiftRight",t[t.BitUnsignedShiftRight=82]="BitUnsignedShiftRight",t[t.BigInt=83]="BigInt",t[t.LiteralIndex=84]="LiteralIndex",t[t.RegexIndex=85]="RegexIndex",t[t.LoopAction=86]="LoopAction",t[t.Void=87]="Void",t[t.True=88]="True",t[t.NullishCoalescing=89]="NullishCoalescing",t[t.AndEquals=90]="AndEquals",t[t.OrEquals=91]="OrEquals",t[t.NullishCoalescingEquals=92]="NullishCoalescingEquals",t[t.Block=93]="Block",t[t.Labeled=94]="Labeled",t[t.Internal=95]="Internal",t[t.Yield=96]="Yield",t[t.YieldDelegate=97]="YieldDelegate",t[t.Hole=98]="Hole",t[t.LispEnumSize=99]="LispEnumSize",t}({});function p(t,e){const{ticks:o}=t.ctx;if(void 0!==o.tickLimit&&o.tickLimit<=o.ticks+e)throw new n("Execution quota exceeded");o.ticks+=e}var f=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],h=new Set(f.map(t=>Object.getPrototypeOf(t.prototype)));function b(t,e){return n=>function(...o){return p(n,e(this,o)),t.apply(this,o)}}var y=[],g=Array.prototype;function v(t,e){return(n,o)=>{if(!Array.isArray(n))return 0n;const r=BigInt(n.length);switch(t){case"one":return 1n;case"n":return r;case"nlogn":return n.length<=1?1n:r*BigInt(Math.round(Math.log2(n.length)));case"arrs":{let t=0n;const r=e===y.flat&&"number"==typeof o[0]?o[0]:1,i=(e,n=0)=>{if(t+=BigInt(e.length),!(n>=r))for(const t of e)Array.isArray(t)&&i(t,n+1)};return i(n),t}}}}var w=[[y.push,"one"],[y.pop,"one"],[g.at,"one"],[y.fill,"n"],[y.includes,"n"],[y.indexOf,"n"],[y.lastIndexOf,"n"],[y.find,"n"],[y.findIndex,"n"],[g.findLast,"n"],[g.findLastIndex,"n"],[y.forEach,"n"],[y.map,"n"],[y.filter,"n"],[y.reduce,"n"],[y.reduceRight,"n"],[y.every,"n"],[y.some,"n"],[y.join,"n"],[y.reverse,"n"],[y.shift,"n"],[y.unshift,"n"],[y.splice,"n"],[y.slice,"n"],[y.copyWithin,"n"],[y.entries,"n"],[y.keys,"n"],[y.values,"n"],[g.toReversed,"n"],[g.toSpliced,"n"],[g.with,"n"],[y.toString,"n"],[y.toLocaleString,"n"],[y.sort,"nlogn"],[g.toSorted,"nlogn"],[y.flat,"arrs"],[y.flatMap,"arrs"],[y.concat,"arrs"]],x="",S=String.prototype;function m(t){return e=>"string"!=typeof e?0n:"one"===t?1n:BigInt(e.length)}var E=[[x.charAt,"one"],[x.charCodeAt,"one"],[x.codePointAt,"one"],[S.at,"one"],[x.indexOf,"n"],[x.lastIndexOf,"n"],[x.includes,"n"],[x.startsWith,"n"],[x.endsWith,"n"],[x.slice,"n"],[x.substring,"n"],[x.padStart,"n"],[x.padEnd,"n"],[x.repeat,"n"],[x.split,"n"],[x.replace,"n"],[S.replaceAll,"n"],[x.match,"n"],[x.matchAll,"n"],[x.search,"n"],[x.trim,"n"],[x.trimStart,"n"],[x.trimEnd,"n"],[x.toLowerCase,"n"],[x.toUpperCase,"n"],[x.toLocaleLowerCase,"n"],[x.toLocaleUpperCase,"n"],[x.normalize,"n"],[x.concat,"n"],[x.toString,"n"],[x.valueOf,"n"]],I=new Map,O=[[I.get,"one"],[I.set,"one"],[I.has,"one"],[I.delete,"one"],[I.keys,"n"],[I.values,"n"],[I.entries,"n"],[I.forEach,"n"],[I.clear,"n"]];function A(t){return e=>e instanceof Map?"one"===t?1n:BigInt(e.size):0n}var j=new Set,k=[[j.add,"one"],[j.has,"one"],[j.delete,"one"],[j.values,"n"],[j.keys,"n"],[j.entries,"n"],[j.forEach,"n"],[j.clear,"n"]];function B(t){return e=>e instanceof Set?"one"===t?1n:BigInt(e.size):0n}var R=[];for(const _t of h){_t.at&&R.push([_t.at,"one"]),_t.set&&R.push([_t.set,"one"]);for(const t of["fill","find","findIndex","findLast","findLastIndex","includes","indexOf","lastIndexOf","forEach","map","filter","reduce","reduceRight","every","some","join","reverse","slice","subarray","copyWithin","entries","keys","values","toReversed","with","toString","toLocaleString"])_t[t]&&R.push([_t[t],"n"]);_t.sort&&R.push([_t.sort,"nlogn"]),_t.toSorted&&R.push([_t.toSorted,"nlogn"])}function C(t){return e=>{if(n=e,!ArrayBuffer.isView(n)||n instanceof DataView||!h.has(Object.getPrototypeOf(Object.getPrototypeOf(n))))return 0n;var n;const o=BigInt(e.length);switch(t){case"one":return 1n;case"n":return o;case"nlogn":return e.length<=1?1n:o*BigInt(Math.round(Math.log2(e.length)))}}}var F=[[Math.max],[Math.min],[Math.hypot]],P=/x/,L=[P.exec,P.test,P[Symbol.match],P[Symbol.matchAll],P[Symbol.replace],P[Symbol.search],P[Symbol.split]],T=[Promise.all,Promise.allSettled,Promise.race,..."function"==typeof Promise.any?[Promise.any]:[]],q=[[Object.prototype.hasOwnProperty,"one"],[Object.prototype.propertyIsEnumerable,"one"],[Object.prototype.isPrototypeOf,"one"],[Object.create,"one"],[Object.getPrototypeOf,"one"],[Object.setPrototypeOf,"one"],[Object.is,"one"],[Object.defineProperty,"one"],[Object.getOwnPropertyDescriptor,"one"],[Object.isExtensible,"one"],[Object.preventExtensions,"one"],[Object.keys,"n"],[Object.values,"n"],[Object.entries,"n"],[Object.assign,"n"],[Object.fromEntries,"n"],[Object.getOwnPropertyNames,"n"],[Object.getOwnPropertySymbols,"n"],[Object.getOwnPropertyDescriptors,"n"],[Object.freeze,"n"],[Object.seal,"n"],[Object.isFrozen,"n"],[Object.isSealed,"n"]];function W(t,e){return(n,o)=>{if("one"===t)return 1n;const r=e?o[0]:n;return null!==r&&"object"==typeof r?BigInt(Object.keys(r).length):1n}}var N=new Set([Object.keys,Object.values,Object.entries,Object.assign,Object.fromEntries,Object.getOwnPropertyNames,Object.getOwnPropertySymbols,Object.getOwnPropertyDescriptors,Object.freeze,Object.seal,Object.isFrozen,Object.isSealed]),M=new Map,U=new Set;for(const[_t,zt]of w)_t&&(M.set(_t,b(_t,v(zt,_t))),U.add(_t));for(const[_t,zt]of E)_t&&(M.set(_t,b(_t,m(zt))),U.add(_t));for(const[_t,zt]of O)_t&&(M.set(_t,b(_t,A(zt))),U.add(_t));for(const[_t,zt]of k)_t&&(M.set(_t,b(_t,B(zt))),U.add(_t));for(const[_t,zt]of R)_t&&(M.set(_t,b(_t,C(zt))),U.add(_t));for(const[_t]of F)_t&&M.set(_t,b(_t,(t,e)=>BigInt(e.length)));for(const _t of[JSON.parse,JSON.stringify])M.set(_t,b(_t,(t,e)=>{const n=e[0];return"string"==typeof n?BigInt(n.length):null!==n&&"object"==typeof n?BigInt(Object.keys(n).length):1n}));for(const _t of L)_t&&(M.set(_t,b(_t,(t,e)=>{const n=e[0];return"string"==typeof n?BigInt(n.length):1n})),U.add(_t));for(const _t of T)_t&&M.set(_t,b(_t,(t,e)=>{const n=e[0];return Array.isArray(n)?BigInt(n.length):0n}));for(const[_t,zt]of q){if(!_t)continue;const t=N.has(_t);M.set(_t,b(_t,W(zt,t))),t||U.add(_t)}if(Array.from&&M.set(Array.from,b(Array.from,(t,e)=>{const n=e[0];return null!=n&&"number"==typeof n.length?BigInt(n.length):0n})),"function"==typeof Array.fromAsync){const t=Array.fromAsync;M.set(t,b(t,(t,e)=>{const n=e[0];return null!=n&&"number"==typeof n.length?BigInt(n.length):0n}))}var $=new WeakMap,V=new WeakMap,D=class{constructor(t,e,n=!1,o=!1,r=!1,i=!1){this.context=t,this.prop=e,this.isConst=n,this.isGlobal=o,this.isVariable=r,this.isInternal=i}get(t){const e=this.context;if(void 0===e)throw new ReferenceError(`${this.prop.toString()} is not defined`);if(null===e)throw new TypeError(`Cannot read properties of null, (reading '${this.prop.toString()}')`);t.getSubscriptions.forEach(t=>t(e,this.prop.toString()));return z(e[this.prop],t,e)}};function G(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Y(t){return V.get(t)}function _(t,e,n){if(!t)return;t instanceof D&&(n||(n=t),t=t.get(e));const o=n?.prop||"prop";if(t===globalThis)return new D({[o]:e.ctx.sandboxGlobal},o,n?.isConst||!1,!1,n?.isVariable||!1);if(n&&!n.isVariable)return;const r=z(t,e,n?.context);return r!==t?new D({[o]:r},o,n?.isConst||!1,n?.isGlobal||!1,n?.isVariable||!1):void 0}function z(t,e,n){if("function"!=typeof t)return t;const o=e.evals.get(t);return void 0===o?t:function(t,e,n){return U.has(t)&&null!==e&&("object"==typeof e||"function"==typeof e)&&e!==n.ctx.sandboxGlobal&&!n.ctx.globalsWhitelist.has(e)}(t,n,e)?function(t,e,n,o){let r=$.get(t);r||(r=new WeakMap,$.set(t,r));let i=r.get(e);return i||(i=function(...e){return t.apply(this,e)},function(t,e,n={}){for(const o of["name","length"]){const r=Object.getOwnPropertyDescriptor(e,o);r?.configurable&&Object.defineProperty(t,o,{...r,value:n[o]??e[o]})}}(i,n),o.ctx.sandboxedFunctions.add(i),V.set(i,e),r.set(e,i),i)}(o,n,t,e):o}function J(t){const e=Object.assign({},t);for(const n in e)e[n]=!0;return e}var H=class{constructor(t,e={},n){this.const={},this.let={},this.var={},this.internal={},this.internalVars={};const o=void 0!==n||null===t;this.parent=t,this.allVars=e,this.let=o?this.let:J(e),this.var=o?J(e):this.var,this.globals=null===t?J(e):{},this.functionThis=n}get(t,e){const n="this"===t,o=this.getWhereValScope(t,n,e);return o&&n?new D({this:o.functionThis},t,!1,!1,!0):o?e&&o.internalVars[t]?new D(o.internalVars,t,!1,!1,!0,!0):new D(o.allVars,t,G(o.const,t),G(o.globals,t),!0):new D(void 0,t)}set(t,n,o){if("this"===t)throw new SyntaxError('"this" cannot be assigned');if(l.has(t))throw new SyntaxError("Unexepected token '"+t+"'");const r=this.get(t,o);if(void 0===r.context)throw new ReferenceError(`Variable '${t}' was not declared.`);if(null===r.context)throw new TypeError(`Cannot set properties of null, (setting '${t}')`);if(r.isConst)throw new TypeError("Assignment to constant variable");if(r.isGlobal)throw new e(`Cannot override global variable '${t}'`);return r.context[r.prop]=n,r}getWhereValScope(t,e,n){let o=this;if(e){do{if(void 0!==o.functionThis)return o;o=o.parent}while(null!==o);return null}do{if(n&&t in o.internalVars&&(!(t in{})||G(o.internalVars,t)))return o;if(t in o.allVars&&(!(t in{})||G(o.allVars,t)))return o;o=o.parent}while(null!==o);return null}getWhereVarScope(t,e,n){let o=this;do{if(n&&t in o.internalVars&&(!(t in{})||G(o.internalVars,t)))return o;if(t in o.allVars&&(!(t in{})||G(o.allVars,t)))return o;if(null===o.parent||e||void 0!==o.functionThis)return o;o=o.parent}while(null!==o);return o}declare(t,e,n,o,r){if("this"===t)throw new SyntaxError('"this" cannot be declared');if(l.has(t))throw new SyntaxError("Unexepected token '"+t+"'");const i=this.getWhereVarScope(t,e!==d.var,r);if(e===d.var){if(i.var[t])return i.allVars[t]=n,o?i.globals[t]=!0:delete i.globals[t],new D(i.allVars,t,!1,i.globals[t],!0);if(t in i.allVars)throw new SyntaxError(`Identifier '${t}' has already been declared`)}if(t in i.allVars||t in i.internalVars)throw new SyntaxError(`Identifier '${t}' has already been declared`);return o&&(i.globals[t]=!0),i[e][t]=!0,e===d.internal?i.internalVars[t]=n:i.allVars[t]=n,new D(e===d.internal?this.internalVars:this.allVars,t,e===d.const,o,!0,e===d.internal)}},K=class{},Q={},X=class{constructor(t){this.result=t()}};function Z(t,e,n=new WeakSet){return null===t||"object"!=typeof t&&"function"!=typeof t?t:((t=_(t,e)||t)instanceof D&&(t=t.get(e)),t!==Q?t:void 0)}function SandboxGlobal(){}function tt(t,e){const n=(o=e.symbolWhitelist,{registry:new Map,reverseRegistry:new Map,whitelist:{...o}});var o;const r=new(function(t){return e.prototype=SandboxGlobal.prototype,e;function e(){for(const e in t)this[e]=t[e]}}(e.globals)),i={sandbox:t,globalsWhitelist:new Set(Object.values(e.globals)),prototypeWhitelist:new Map([...e.prototypeWhitelist].map(t=>[t[0].prototype,t[1]])),sandboxSymbols:n,options:e,globalScope:new H(null,r,r),sandboxGlobal:r,ticks:{ticks:0n,tickLimit:e.executionQuota,nextYield:e.nonBlocking?50000n:void 0},sandboxedFunctions:new WeakSet};i.prototypeWhitelist.set(Object.getPrototypeOf(r),new Set),i.prototypeWhitelist.set(Object.getPrototypeOf([][Symbol.iterator]()),new Set);const s=Object.getPrototypeOf(function*(){}());i.prototypeWhitelist.set(Object.getPrototypeOf(s),new Set);const a=Object.getPrototypeOf(async function*(){}());return i.prototypeWhitelist.set(Object.getPrototypeOf(a),new Set),"undefined"!=typeof Response&&i.prototypeWhitelist.set(Response.prototype,new Set),"undefined"!=typeof Request&&i.prototypeWhitelist.set(Request.prototype,new Set),"undefined"!=typeof Headers&&i.prototypeWhitelist.set(Headers.prototype,new Set),"undefined"!=typeof FormData&&i.prototypeWhitelist.set(FormData.prototype,new Set),"undefined"!=typeof Blob&&i.prototypeWhitelist.set(Blob.prototype,new Set),"undefined"!=typeof URLSearchParams&&i.prototypeWhitelist.set(URLSearchParams.prototype,new Set),"undefined"!=typeof AbortController&&i.prototypeWhitelist.set(AbortController.prototype,new Set),"undefined"!=typeof ReadableStream&&i.prototypeWhitelist.set(ReadableStream.prototype,new Set),"undefined"!=typeof TransformStream&&i.prototypeWhitelist.set(TransformStream.prototype,new Set),"undefined"!=typeof WritableStream&&i.prototypeWhitelist.set(WritableStream.prototype,new Set),"undefined"!=typeof TextEncoder&&i.prototypeWhitelist.set(TextEncoder.prototype,new Set),"undefined"!=typeof TextDecoder&&i.prototypeWhitelist.set(TextDecoder.prototype,new Set),i}function et(t){return Array.isArray(t)&&"number"==typeof t[0]&&t[0]!==u.None&&t[0]!==u.True}var nt=new Map;function ot(t,e){nt.set(t,e)}ot(u.Prop,({done:t,a:e,b:n,obj:o,context:r,scope:s,internal:a})=>{if(null===e)throw new TypeError(`Cannot read properties of null (reading '${n?.toString()}')`);if(function(t){return Ct.includes(typeof t)}(n)||(n=`${n}`),void 0===e&&void 0===o&&"string"==typeof n){const e=s.get(n,a);if(void 0===e.context)throw new ReferenceError(`${n} is not defined`);e.context===r.ctx.sandboxGlobal&&r.ctx.options.audit&&r.ctx.auditReport?.globalsAccess.add(n);return void t(void 0,_(e.context[e.prop],r,e)||e)}if(void 0===e)throw new TypeError(`Cannot read properties of undefined (reading '${n.toString()}')`);if(!function(t){return null!=t}(e))return void t(void 0,new D(void 0,n));const c="function"==typeof e||!G(e,n);if(r.ctx.options.audit&&c){let t=Object.getPrototypeOf(e);do{G(t,n)&&(r.ctx.auditReport&&!r.ctx.auditReport.prototypeAccess[t.constructor.name]&&(r.ctx.auditReport.prototypeAccess[t.constructor.name]=new Set),r.ctx.auditReport?.prototypeAccess[t.constructor.name].add(n))}while(t=Object.getPrototypeOf(t))}if(c){if("function"==typeof e&&G(e,n)){const t=r.ctx.prototypeWhitelist.get(e.prototype);if((!t||t.size&&!t.has(n))&&!r.ctx.sandboxedFunctions.has(e))throw new i(`Static method or property access not permitted: ${e.name}.${n.toString()}`)}let t=e;for(;t=Object.getPrototypeOf(t);)if(G(t,n)||"__proto__"===n){const e=r.ctx.prototypeWhitelist.get(t);if(e&&(!e.size||e.has(n))||r.ctx.sandboxedFunctions.has(t.constructor))break;if("__proto__"===n)throw new i("Access to prototype of global object is not permitted");throw new i(`Method or property access not permitted: ${t.constructor.name}.${n.toString()}`)}}if("function"==typeof e){if("prototype"===n&&!r.ctx.sandboxedFunctions.has(e))throw new i("Access to prototype of global object is not permitted");if(["caller","callee","arguments"].includes(n))throw new i(`Access to '${n}' property is not permitted`)}const l=e[n];if("__proto__"===n&&!r.ctx.sandboxedFunctions.has(l?.constructor))throw new i("Access to prototype of global object is not permitted");const d=_(l,r,new D(e,n,!1,!1));if(d)return void t(void 0,d);const u=e===r.ctx.sandboxGlobal,p=!u&&o instanceof D&&o.isGlobal||"function"==typeof e&&!r.ctx.sandboxedFunctions.has(e)||r.ctx.globalsWhitelist.has(e)||u&&"string"==typeof n&&G(r.ctx.globalScope.globals,n);t(void 0,new D(e,n,!1,p,!1))}),ot(u.StringIndex,({done:t,b:e,context:n})=>t(void 0,n.constants.strings[parseInt(e)])),ot(u.Call,t=>{const{done:e,a:n,b:o,obj:i,context:s}=t;if(s.ctx.options.forbidFunctionCalls)throw new r("Function invocations are not allowed");if("function"!=typeof n)throw new TypeError(`${"symbol"==typeof i?.prop?"Symbol":i?.prop} is not a function`);const a=new Array(o.length);let c=0;for(let r=0;r<o.length;r++){const e=o[r];if(e instanceof jt){const n=Array.isArray(e.item)?e.item:[...e.item];if(Wt(t,BigInt(n.length)))return;for(let t=0;t<n.length;t++)a[c++]=Z(n[t],s)}else a[c++]=Z(e,s)}if(a.length=c,n===String){const t=String(a[0]);return p(s,BigInt(t.length)),void e(void 0,t)}if("function"==typeof i){const t=s.evals.get(i),n=Y(i);let o=t?t(i,...a):void 0===n?i(...a):i.call(n,...a);return o=Z(o,s),void(null!==o&&"object"==typeof o&&o instanceof X?Promise.resolve(o.result).then(t=>e(void 0,t),t=>e(t)):e(void 0,o))}const l=i.context[i.prop];if(l===JSON.stringify&&s.getSubscriptions.size){const t=new WeakSet;let e=0n;const n=o=>{if(!o||"object"!=typeof o||t.has(o))return;t.add(o);const r=Object.keys(o);e+=BigInt(r.length);for(const t of r)s.getSubscriptions.forEach(e=>e(o,t)),n(o[t])};n(a[0]),p(s,e)}if(i.context instanceof Array&&It.has(l)&&(s.changeSubscriptions.get(i.context)||s.changeSubscriptionsGlobal.get(i.context))){let t,e=!1;if("push"===i.prop)t={type:"push",added:a},e=!!a.length;else if("pop"===i.prop)t={type:"pop",removed:i.context.slice(-1)},e=!!t.removed.length;else if("shift"===i.prop)t={type:"shift",removed:i.context.slice(0,1)},e=!!t.removed.length;else if("unshift"===i.prop)t={type:"unshift",added:a},e=!!a.length;else if("splice"===i.prop)t={type:"splice",startIndex:a[0],deleteCount:void 0===a[1]?i.context.length:a[1],added:a.slice(2),removed:i.context.slice(a[0],void 0===a[1]?void 0:a[0]+a[1])},e=!!t.added.length||!!t.removed.length;else if("reverse"===i.prop||"sort"===i.prop)t={type:i.prop},e=!!i.context.length;else if("copyWithin"===i.prop){const n=void 0===a[2]?i.context.length-a[1]:Math.min(i.context.length,a[2]-a[1]);t={type:"copyWithin",startIndex:a[0],endIndex:a[0]+n,added:i.context.slice(a[1],a[1]+n),removed:i.context.slice(a[0],a[0]+n)},e=!!t.added.length||!!t.removed.length}if(e){const e=s.changeSubscriptions.get(i.context);if(void 0!==e)for(const o of e)o(t);const n=s.changeSubscriptionsGlobal.get(i.context);if(void 0!==n)for(const o of n)o(t)}}i.get(s);const d=s.evals.get(l),u=Y(l),f=i.isVariable&&void 0!==u?u:i.context;let h=d?d.call(f,...a):n.call(f,...a);h=Z(h,s),null!==h&&"object"==typeof h&&h instanceof X?Promise.resolve(h.result).then(t=>e(void 0,t),t=>e(t)):e(void 0,h)}),ot(u.New,t=>{const{done:e,a:n,b:o,context:r}=t;if(!r.ctx.globalsWhitelist.has(n)&&!r.ctx.sandboxedFunctions.has(n))throw new i(`Object construction not allowed: ${n.constructor.name}`);const s=o.map(t=>Z(t,r)),a=r.evals.get(n);if(a)return void e(void 0,new a(...s));const c=function(t,e){if(t===Array){const t=e[0];return"number"==typeof t&&1===e.length?BigInt(t):BigInt(e.length)}if(h.has(Object.getPrototypeOf(t.prototype))){const t=e[0];return"number"==typeof t?BigInt(t):Array.isArray(t)||ArrayBuffer.isView(t)?BigInt(t.length):0n}if(t===Map||t===Set){const t=e[0];return Array.isArray(t)?BigInt(t.length):0n}if(t===String||t===RegExp){const t=e[0];return"string"==typeof t?BigInt(t.length):0n}return 0n}(n,s);c>0n&&Wt(t,c)||e(void 0,new n(...s))}),ot(u.CreateObject,t=>{const{done:e,b:n}=t;let o={};for(const r of n)if(r.key instanceof At){const e=Object.keys(r.key.item);if(Wt(t,BigInt(e.length)))return;o={...o,...r.key.item}}else o[r.key]=r.val;e(void 0,o)}),ot(u.KeyVal,({done:t,a:e,b:n})=>t(void 0,new Ot(e,n))),ot(u.CreateArray,t=>{const{done:e,b:n,context:o}=t,r=[];for(const i of n)if(i instanceof jt){const e=Array.isArray(i.item)?i.item:[...i.item];if(Wt(t,BigInt(e.length)))return;for(const t of e)r.push(Z(t,o))}else i instanceof kt?r.length++:r.push(Z(i,o));e(void 0,r)}),ot(u.Hole,({done:t})=>t(void 0,new kt)),ot(u.Group,({done:t,b:e})=>t(void 0,e)),ot(u.GlobalSymbol,({done:t,b:e})=>{switch(e){case"true":return t(void 0,!0);case"false":return t(void 0,!1);case"null":return t(void 0,null);case"undefined":return t(void 0,void 0);case"NaN":return t(void 0,NaN);case"Infinity":return t(void 0,1/0)}t(new Error("Unknown symbol: "+e))}),ot(u.SpreadArray,({done:t,b:e})=>{t(void 0,new jt(e))}),ot(u.SpreadObject,({done:t,b:e})=>{t(void 0,new At(e))}),ot(u.Number,({done:t,b:e})=>t(void 0,Number(e.replace(/_/g,"")))),ot(u.BigInt,({done:t,b:e})=>t(void 0,BigInt(e.replace(/_/g,"")))),ot(u.RegexIndex,({done:t,b:e,context:n})=>{const o=n.constants.regexes[parseInt(e)];if(!n.ctx.globalsWhitelist.has(RegExp))throw new r("Regex not permitted");t(void 0,new(n.evals.get(RegExp)??RegExp)(o.regex,o.flags))}),ot(u.LiteralIndex,t=>{const{exec:e,done:n,ticks:o,b:r,context:i,scope:s,internal:a,generatorYield:c}=t,[,l,d]=i.constants.literals[parseInt(r)],u=[];let p;const f=[];for(;p=Rt.exec(l);)p[2]||(u.push(d[parseInt(p[3],10)]),f.push(p[3]));e(o,u,s,i,(...e)=>{const o={};if(1===e.length)return void n(e[0]);const r=e[1];for(const t of Object.keys(r)){const e=f[t];o[e]=r[t]}const s=l.replace(/(\\\\)*(\\)?\${(\d+)}/g,(t,e,n,r)=>{if(n)return t;return(e||"")+`${Z(o[r],i)}`});Wt(t,BigInt(s.length))||n(void 0,s)},void 0,a,c)}),ot(u.Not,({done:t,b:e})=>t(void 0,!e)),ot(u.Inverse,({done:t,b:e})=>t(void 0,~e)),ot(u.IncrementBefore,({done:t,obj:e,context:n})=>{Et(e,n),t(void 0,++e.context[e.prop])}),ot(u.IncrementAfter,({done:t,obj:e,context:n})=>{Et(e,n),t(void 0,e.context[e.prop]++)}),ot(u.DecrementBefore,({done:t,obj:e,context:n})=>{Et(e,n),t(void 0,--e.context[e.prop])}),ot(u.DecrementAfter,({done:t,obj:e,context:n})=>{Et(e,n),t(void 0,e.context[e.prop]--)}),ot(u.Positive,({done:t,b:e})=>t(void 0,+e)),ot(u.Negative,({done:t,b:e})=>t(void 0,-e)),ot(u.Typeof,({exec:t,done:e,ticks:n,b:o,context:r,scope:i,internal:s,generatorYield:a})=>{t(n,o,i,r,(t,n)=>{e(void 0,typeof Z(n,r))},void 0,s,a)}),ot(u.Delete,({done:t,context:e,bobj:n})=>{n instanceof D?(Et(n,e,"delete"),n.isVariable?t(void 0,!1):t(void 0,delete n.context?.[n.prop])):t(void 0,!0)}),ot(u.Void,({done:t})=>{t()}),ot(u.Assign,t=>{const{done:e,b:n,obj:o,context:r,scope:i,bobj:s,internal:a}=t;if(Et(o,r),o.isGlobal=s?.isGlobal||!1,o.isVariable){const t=i.getWhereValScope(o.prop,"this"===o.prop,a);if(null===t)throw new ReferenceError(`Cannot assign to undeclared variable '${o.prop.toString()}'`);return t.set(o.prop,n,a),o.isGlobal?t.globals[o.prop.toString()]=!0:delete t.globals[o.prop.toString()],void e(void 0,n)}if("length"===o.prop&&Array.isArray(o.context)&&"number"==typeof n){const e=BigInt(Math.abs(n-o.context.length));if(e>0n&&Wt(t,e))return}e(void 0,o.context[o.prop]=n)}),ot(u.AddEquals,t=>{const{done:e,b:n,obj:o,context:r}=t;Et(o,r);const i=o.context[o.prop]+n;"string"==typeof i&&Wt(t,BigInt(i.length))||e(void 0,o.context[o.prop]=i)}),ot(u.SubractEquals,({done:t,b:e,obj:n,context:o})=>{Et(n,o),t(void 0,n.context[n.prop]-=e)}),ot(u.DivideEquals,({done:t,b:e,obj:n,context:o})=>{Et(n,o),t(void 0,n.context[n.prop]/=e)}),ot(u.MultiplyEquals,({done:t,b:e,obj:n,context:o})=>{Et(n,o),t(void 0,n.context[n.prop]*=e)}),ot(u.PowerEquals,({done:t,b:e,obj:n,context:o})=>{Et(n,o),t(void 0,n.context[n.prop]**=e)}),ot(u.ModulusEquals,({done:t,b:e,obj:n,context:o})=>{Et(n,o),t(void 0,n.context[n.prop]%=e)}),ot(u.BitNegateEquals,({done:t,b:e,obj:n,context:o})=>{Et(n,o),t(void 0,n.context[n.prop]^=e)}),ot(u.BitAndEquals,({done:t,b:e,obj:n,context:o})=>{Et(n,o),t(void 0,n.context[n.prop]&=e)}),ot(u.BitOrEquals,({done:t,b:e,obj:n,context:o})=>{Et(n,o),t(void 0,n.context[n.prop]|=e)}),ot(u.ShiftLeftEquals,({done:t,b:e,obj:n,context:o})=>{Et(n,o),t(void 0,n.context[n.prop]<<=e)}),ot(u.ShiftRightEquals,({done:t,b:e,obj:n,context:o})=>{Et(n,o),t(void 0,n.context[n.prop]>>=e)}),ot(u.UnsignedShiftRightEquals,({done:t,b:e,obj:n,context:o})=>{Et(n,o),t(void 0,n.context[n.prop]>>>=e)}),ot(u.AndEquals,({done:t,b:e,obj:n,context:o})=>{Et(n,o),t(void 0,n.context[n.prop]&&=e)}),ot(u.OrEquals,({done:t,b:e,obj:n,context:o})=>{Et(n,o),t(void 0,n.context[n.prop]||=e)}),ot(u.NullishCoalescingEquals,({done:t,b:e,obj:n,context:o})=>{Et(n,o),t(void 0,n.context[n.prop]??=e)}),ot(u.LargerThan,({done:t,a:e,b:n})=>t(void 0,e>n)),ot(u.SmallerThan,({done:t,a:e,b:n})=>t(void 0,e<n)),ot(u.LargerEqualThan,({done:t,a:e,b:n})=>t(void 0,e>=n)),ot(u.SmallerEqualThan,({done:t,a:e,b:n})=>t(void 0,e<=n)),ot(u.Equal,({done:t,a:e,b:n})=>t(void 0,e==n)),ot(u.StrictEqual,({done:t,a:e,b:n})=>t(void 0,e===n)),ot(u.NotEqual,({done:t,a:e,b:n})=>t(void 0,e!=n)),ot(u.StrictNotEqual,({done:t,a:e,b:n})=>t(void 0,e!==n)),ot(u.And,({done:t,a:e,b:n})=>t(void 0,e&&n)),ot(u.Or,({done:t,a:e,b:n})=>t(void 0,e||n)),ot(u.NullishCoalescing,({done:t,a:e,b:n})=>t(void 0,e??n)),ot(u.BitAnd,({done:t,a:e,b:n})=>t(void 0,e&n)),ot(u.BitOr,({done:t,a:e,b:n})=>t(void 0,e|n)),ot(u.Plus,t=>{const{done:e,a:n,b:o}=t,r=n+o;"string"==typeof r&&Wt(t,BigInt(r.length))||e(void 0,r)}),ot(u.Minus,({done:t,a:e,b:n})=>t(void 0,e-n)),ot(u.Divide,({done:t,a:e,b:n})=>t(void 0,e/n)),ot(u.Power,({done:t,a:e,b:n})=>t(void 0,e**n)),ot(u.BitNegate,({done:t,a:e,b:n})=>t(void 0,e^n)),ot(u.Multiply,({done:t,a:e,b:n})=>t(void 0,e*n)),ot(u.Modulus,({done:t,a:e,b:n})=>t(void 0,e%n)),ot(u.BitShiftLeft,({done:t,a:e,b:n})=>t(void 0,e<<n)),ot(u.BitShiftRight,({done:t,a:e,b:n})=>t(void 0,e>>n)),ot(u.BitUnsignedShiftRight,({done:t,a:e,b:n})=>t(void 0,e>>>n)),ot(u.Instanceof,({done:t,a:e,b:n})=>t(void 0,e instanceof n)),ot(u.In,({done:t,a:e,b:n})=>t(void 0,e in n)),ot(u.Return,({done:t,b:e})=>t(void 0,e)),ot(u.Var,({done:t,a:e,b:n,scope:o,bobj:r,internal:i})=>{t(void 0,o.declare(e,d.var,n,r?.isGlobal||!1,i))}),ot(u.Let,({done:t,a:e,b:n,scope:o,bobj:r,internal:i})=>{t(void 0,o.declare(e,d.let,n,r?.isGlobal||!1,i))}),ot(u.Const,({done:t,a:e,b:n,scope:o,bobj:r,internal:i})=>{t(void 0,o.declare(e,d.const,n,r?.isGlobal||!1,i))}),ot(u.Internal,({done:t,a:e,b:n,scope:o,bobj:i,internal:s})=>{if(!s)throw new r("Internal variables are not accessible");t(void 0,o.declare(e,d.internal,n,i?.isGlobal||!1,s))}),ot(u.LoopAction,({done:t,a:e,b:n,context:o,statementLabels:r})=>{const i=st(n),s=function(t,e,n){if(!t)return;for(let o=t.length-1;o>=0;o--){const r=t[o];if(n){if(r.label!==n)continue;return("continue"===e?r.acceptsContinue:r.acceptsBreak)?r:null}if("continue"===e?r.acceptsUnlabeledContinue:r.acceptsUnlabeledBreak)return r}}(r,e,i);if(null===s)throw new TypeError("Illegal continue statement");if(!s)throw new TypeError(i?`Undefined label '${i}'`:"Illegal "+e+" statement");t(void 0,new rt(o.ctx.auditReport,void 0,!1,{type:e,label:i}))}),ot(u.Throw,({done:t,b:e})=>{t(e)}),ot(u.None,({done:t})=>t()),ot(u.ArrowFunction,({done:t,ticks:e,a:n,b:o,obj:i,context:a,scope:c,internal:l})=>{if("string"==typeof i[2]||i[2]instanceof s){if(!a.allowJit||!a.evalContext)throw new r("Unevaluated code detected, JIT not allowed");i[2]=o=a.evalContext.lispifyFunction(new s(i[2]),a.constants)}const d=n.slice(1);n[0]?t(void 0,bt(d,o,e,a,c,void 0,l)):t(void 0,ht(d,o,e,a,c,void 0,l))}),ot(u.Function,({done:t,ticks:e,a:n,b:o,obj:i,context:a,scope:c,internal:l})=>{if("string"==typeof i[2]||i[2]instanceof s){if(!a.allowJit||!a.evalContext)throw new r("Unevaluated code detected, JIT not allowed");i[2]=o=a.evalContext.lispifyFunction(new s(i[2]),a.constants,!1,{generatorDepth:n[1]===u.True?1:0,asyncDepth:n[0]===u.True?1:0,lispDepth:0})}const p=n[0],f=n[1],h=n[2],b=n.slice(3);let y;y=p===u.True&&f===u.True?mt(b,o,e,a,c,h,l):f===u.True?St(b,o,e,a,c,h,l):p===u.True?bt(b,o,e,a,c,h,l):ht(b,o,e,a,c,h,l),h&&c.declare(h,d.var,y,!1,l),t(void 0,y)}),ot(u.InlineFunction,({done:t,ticks:e,a:n,b:o,obj:i,context:a,scope:c,internal:l})=>{if("string"==typeof i[2]||i[2]instanceof s){if(!a.allowJit||!a.evalContext)throw new r("Unevaluated code detected, JIT not allowed");i[2]=o=a.evalContext.lispifyFunction(new s(i[2]),a.constants,!1,{generatorDepth:n[1]===u.True?1:0,asyncDepth:n[0]===u.True?1:0,lispDepth:0})}const p=n[0],f=n[1],h=n[2],b=n.slice(3);let y;h&&(c=new H(c,{})),y=p===u.True&&f===u.True?mt(b,o,e,a,c,h,l):f===u.True?St(b,o,e,a,c,h,l):p===u.True?bt(b,o,e,a,c,h,l):ht(b,o,e,a,c,h,l),h&&c.declare(h,d.let,y,!1,l),t(void 0,y)}),ot(u.Loop,({exec:t,done:e,ticks:n,a:o,b:r,context:i,scope:s,statementLabels:a,internal:c,generatorYield:l})=>{const[d,p,f,h,b,y,g,v,w]=o,x=[...at(w).map(t=>ct(t,!1)),ct()],S=ut(a,x);if(v===u.True&&t!==Tt)return void e(new SyntaxError("for-await-of loops are only allowed inside async functions"));let m=!0;const E=new H(s,{}),I={$$obj:void 0},O=new H(E,I);if(t===Tt)(async()=>{let o;if(o=Pt(e=>t(n,h,E,i,e,void 0,c,l)),I.$$obj=!0===(o=Pt(e=>t(n,f,E,i,e,void 0,c,l))).isInstant?o.instant:(await o.p).result,v===u.True){const t=I.$$obj;I.$$obj=t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t}for(o=Pt(e=>t(n,p,O,i,e,void 0,c,l)),v===u.True&&(I.$$next=await I.$$next),d&&(m=!0===(o=Pt(e=>t(n,y,O,i,e,void 0,c,l))).isInstant?o.instant:(await o.p).result);m;){const s=new H(O,{});o=Pt(e=>t(n,g,s,i,e,void 0,c,l)),!0===o.isInstant?o.instant:(await o.p).result;const a=await Vt(n,i,r,[s],S,c,l);if(a instanceof rt&&a.returned)return void e(void 0,a);if(a instanceof rt&&a.controlFlow){if(!x.some(t=>pt(a.controlFlow,t)))return void e(void 0,a);if(a.breakLoop)break}o=Pt(e=>t(n,b,O,i,e,void 0,c,l)),v===u.True&&(I.$$next=await I.$$next),m=!0===(o=Pt(e=>t(n,y,O,i,e,void 0,c,l))).isInstant?o.instant:(await o.p).result}e()})().catch(e);else{for(Lt(e=>t(n,h,E,i,e,void 0,c,l)),I.$$obj=Lt(e=>t(n,f,E,i,e,void 0,c,l)).result,Lt(e=>t(n,p,O,i,e,void 0,c,l)),d&&(m=Lt(e=>t(n,y,O,i,e,void 0,c,l)).result);m;){const o=new H(O,{});Lt(e=>t(n,g,o,i,e,void 0,c,l));const s=$t(n,i,r,[o],S,c,l);if(s instanceof rt&&s.returned)return void e(void 0,s);if(s instanceof rt&&s.controlFlow){if(!x.some(t=>pt(s.controlFlow,t)))return void e(void 0,s);if(s.breakLoop)break}Lt(e=>t(n,b,O,i,e,void 0,c,l)),m=Lt(e=>t(n,y,O,i,e,void 0,c,l)).result}e()}}),ot(u.If,({exec:t,done:e,ticks:n,a:o,b:r,context:i,scope:s,statementLabels:a,internal:c,generatorYield:l})=>{t(n,Z(o,i)?r.t:r.f,s,i,e,a,c,l)}),ot(u.InlineIf,({exec:t,done:e,ticks:n,a:o,b:r,context:i,scope:s,internal:a,generatorYield:c})=>{t(n,Z(o,i)?r.t:r.f,s,i,e,void 0,a,c)}),ot(u.InlineIfCase,({done:t,a:e,b:n})=>t(void 0,new Bt(e,n))),ot(u.IfCase,({done:t,a:e,b:n})=>t(void 0,new Bt(e,n))),ot(u.Labeled,({exec:t,done:e,ticks:n,a:o,b:r,context:i,scope:s,statementLabels:a,internal:c,generatorYield:l})=>{const d=lt(st(o));t(n,r,s,i,(...t)=>{if(1===t.length)return void e(t[0]);const n=t[1];n instanceof rt&&n.controlFlow&&d&&pt(n.controlFlow,d)?e():e(void 0,n)},dt(a,d),c,l)}),ot(u.Switch,({exec:t,done:e,ticks:n,a:o,b:r,context:i,scope:s,statementLabels:a,internal:c,generatorYield:l})=>{const d={label:u,acceptsBreak:!0,acceptsContinue:!1,acceptsUnlabeledBreak:!0,acceptsUnlabeledContinue:!1};var u;const p=dt(a,d);t(n,o,s,i,(...o)=>{if(1===o.length)return void e(o[0]);let a=o[1];if(a=Z(a,i),t===qt){let o,u=!1;for(const f of r)if(u||(u=!f[1]||a===Z(Lt(e=>t(n,f[1],s,i,e,void 0,c,l)).result,i))){if(!f[2])continue;if(o=$t(n,i,f[2],[s],p,c,l),o.controlFlow){if(!pt(o.controlFlow,d))return void e(void 0,o);if(o.breakLoop)break}if(o.returned)return void e(void 0,o);if(!f[1])break}e()}else(async()=>{let o,u=!1;for(const f of r){let r;if(u||(u=!f[1]||a===Z(!0===(r=Pt(e=>t(n,f[1],s,i,e,void 0,c,l))).isInstant?r.instant:(await r.p).result,i))){if(!f[2])continue;if(o=await Vt(n,i,f[2],[s],p,c,l),o.controlFlow){if(!pt(o.controlFlow,d))return void e(void 0,o);if(o.breakLoop)break}if(o.returned)return void e(void 0,o);if(!f[1])break}}e()})().catch(e)},void 0,c,l)}),ot(u.Try,({exec:t,done:n,ticks:o,a:r,b:i,context:s,scope:a,statementLabels:c,internal:l,generatorYield:d})=>{const[u,p,f]=i;Dt(t,(...r)=>{const i=1===r.length,h=i?r[0]:void 0,b=!i&&r.length>1?r[1]:void 0,y=(e,r)=>{f&&f.length>0?Dt(t,(...t)=>{const o=1===t.length,i=!o&&t.length>1?t[1]:void 0;o?n(t[0]):i instanceof rt&&(i.returned||i.breakLoop||i.continueLoop)?n(void 0,i):e?n(r):r instanceof rt&&(r.returned||r.breakLoop||r.continueLoop)?n(void 0,r):n()},o,s,f,[new H(a,{})],c,l,d):e?n(r):r instanceof rt&&(r.returned||r.breakLoop||r.continueLoop)?n(void 0,r):n()};if(i&&h instanceof e)n(h);else if(i&&p&&p.length>0){const e={};u&&(e[u]=h),Dt(t,(...t)=>{const e=1===t.length;y(e,e?t[0]:t.length>1?t[1]:void 0)},o,s,p,[new H(a,e)],c,l,d)}else y(i,i?h:b)},o,s,r,[new H(a)],c,l,d)}),ot(u.Expression,({done:t,a:e})=>t(void 0,e.pop()));var rt=class{constructor(t,e,n,o){this.auditReport=t,this.result=e,this.returned=n,this.controlFlow=o}get breakLoop(){return"break"===this.controlFlow?.type}get continueLoop(){return"continue"===this.controlFlow?.type}},it=[];function st(t){return void 0===t||t===u.None?void 0:t}function at(t){return void 0===t||t===u.None?[]:Array.isArray(t)&&!et(t)?t.filter(t=>"string"==typeof t):[t]}function ct(t,e=!0){return{label:t,acceptsBreak:!0,acceptsContinue:!0,acceptsUnlabeledBreak:e,acceptsUnlabeledContinue:e}}function lt(t){if(t)return{label:t,acceptsBreak:!0,acceptsContinue:!1,acceptsUnlabeledBreak:!1,acceptsUnlabeledContinue:!1}}function dt(t,e){return e?[...t||it,e]:t}function ut(t,e){return e.reduce((t,e)=>dt(t,e),t)}function pt(t,e){return"continue"===t.type?!!e.acceptsContinue&&(t.label?e.label===t.label:e.acceptsUnlabeledContinue):!!e.acceptsBreak&&(t.label?e.label===t.label:e.acceptsUnlabeledBreak)}function ft(t,e){const n={};return t.forEach((t,o)=>{t.startsWith("...")?n[t.substring(3)]=e.slice(o):n[t]=e[o]}),n}function ht(t,e,n,o,i,s,a=!1){if(o.ctx.options.forbidFunctionCreation)throw new r("Function creation is forbidden");let c;return c=void 0===s?(...r)=>{const s=ft(t,r);return $t(n,o,e,void 0===i?[]:[new H(i,s)],void 0,a).result}:function(...r){const s=ft(t,r);return $t(n,o,e,void 0===i?[]:[new H(i,s,this)],void 0,a).result},o.registerSandboxFunction(c),o.ctx.sandboxedFunctions.add(c),c}function bt(t,e,n,o,i,s,a=!1){if(o.ctx.options.forbidFunctionCreation)throw new r("Function creation is forbidden");if(!o.ctx.prototypeWhitelist?.has(Promise.prototype))throw new r("Async/await not permitted");let c;return c=void 0===s?async(...r)=>{const s=ft(t,r);return(await Vt(n,o,e,void 0===i?[]:[new H(i,s)],void 0,a)).result}:async function(...r){const s=ft(t,r);return(await Vt(n,o,e,void 0===i?[]:[new H(i,s,this)],void 0,a)).result},o.registerSandboxFunction(c),o.ctx.sandboxedFunctions.add(c),c}var yt=class{constructor(t,e){this.value=t,this.delegate=e}},gt=Symbol("syncYieldPause");function vt(t){const e=t?.[Symbol.iterator]?.()??t;if(!e||"function"!=typeof e.next)throw new TypeError("yield* target is not iterable");return"function"==typeof e[Symbol.iterator]?e:{next:e.next.bind(e),throw:e.throw?.bind(e),return:e.return?.bind(e),[Symbol.iterator](){return this}}}function wt(t){const e=t?.[Symbol.asyncIterator]?.();if(e)return{next:e.next.bind(e),throw:e.throw?.bind(e),return:e.return?.bind(e),[Symbol.asyncIterator](){return this}};const n=vt(t);return{next:async t=>n.next(t),async throw(t){if("function"==typeof n.throw)return n.throw(t);throw t},return:async t=>"function"==typeof n.return?n.return(t):{value:t,done:!0},[Symbol.asyncIterator](){return this}}}function*xt(t,e,n,o,r,i){if(!et(e)&&Array.isArray(e)){const s=e;if(0===s.length||s[0]===u.None)return new rt(o.ctx.auditReport,void 0,!1);for(const e of s){const s=yield*xt(t,e,n,o,r,i);if(s instanceof rt&&(s.returned||s.controlFlow))return s;if(et(e)&&e[0]===u.Return)return new rt(o.ctx.auditReport,s.result,!0)}return new rt(o.ctx.auditReport,void 0,!1)}const[s,a,c]=e;switch(s){case u.Yield:{const e=yield Z((yield*xt(t,a,n,o,r,i)).result,o);return new rt(o.ctx.auditReport,e,!1)}case u.YieldDelegate:{const e=yield*vt(Z((yield*xt(t,a,n,o,r,i)).result,o));return new rt(o.ctx.auditReport,e,!1)}case u.If:{const e=yield*xt(t,a,n,o,r,i),s=Lt(e=>qt(t,c,n,o,e,r,i,void 0)).result,l=Z(e.result,o)?s.t:s.f;return l?yield*xt(t,l,n,o,r,i):new rt(o.ctx.auditReport,void 0,!1)}case u.Loop:{const[e,s,l,d,p,f,h,b,y]=a;if(b===u.True)throw new SyntaxError("for-await-of loops are only allowed inside async functions");const g=[...at(y).map(t=>ct(t,!1)),ct()],v=ut(r,g),w=new H(n,{}),x={$$obj:void 0},S=new H(w,x);Lt(e=>qt(t,d,w,o,e,void 0,i,void 0)),x.$$obj=Lt(e=>qt(t,l,w,o,e,void 0,i,void 0)).result,Lt(e=>qt(t,s,S,o,e,void 0,i,void 0));let m=!0;for(e&&(m=Lt(e=>qt(t,f,S,o,e,void 0,i,void 0)).result);m;){const e=new H(S,{});Lt(n=>qt(t,h,e,o,n,void 0,i,void 0));const n=yield*xt(t,c,e,o,v,i);if(n.returned)return n;if(n.controlFlow){if(!g.some(t=>pt(n.controlFlow,t)))return n;if(n.breakLoop)break}Lt(e=>qt(t,p,S,o,e,void 0,i,void 0)),m=Lt(e=>qt(t,f,S,o,e,void 0,i,void 0)).result}return new rt(o.ctx.auditReport,void 0,!1)}case u.Try:{const[e,s,d]=c;let u,p;try{u=yield*xt(t,a,n,o,r,i)}catch(l){if(!(e&&s?.length>0))throw l;u=yield*xt(t,s,new H(n,{[e]:l}),o,r,i)}finally{if(d?.length>0){const e=yield*xt(t,d,n,o,r,i);(e.returned||e.controlFlow)&&(p=e)}}return p||u}case u.Labeled:{const e=lt(st(a)),s=yield*xt(t,c,n,o,ut(r,e?[e]:[]),i);return s.controlFlow&&e&&pt(s.controlFlow,e)?new rt(o.ctx.auditReport,s.result,!1):s}default:{let s=0;const a=[];for(;;){let c,d=0,u=!1,p=!1;const f=(t,e)=>{if(d<s)return e(void 0,a[d]),void d++;throw c=t.value,u=t.delegate,p=!0,d++,gt};try{const s=Lt(s=>qt(t,e,n,o,s,r,i,f)).result;return s instanceof rt?s:new rt(o.ctx.auditReport,s,!1)}catch(l){if(!p||l!==gt)throw l;const t=u?yield*vt(c):yield c;a.push(t),s++}}}}}function St(t,e,n,o,i,s,c=!1){if(o.ctx.options.forbidFunctionCreation)throw new r("Function creation is forbidden");const l=(r,s)=>{const a=ft(t,s),l=xt(n,e,new H(void 0===i?null:i,a,r),o,void 0,c);let d=!1;function u(t){if(d)return{value:void 0,done:!0};try{const e=t();return e.done?(d=!0,{value:e.value instanceof rt?e.value.result:e.value,done:!0}):{value:e.value,done:!1}}catch(e){throw d=!0,e}}return{next:t=>u(()=>l.next(t)),return:t=>u(()=>l.return(t)),throw:t=>u(()=>l.throw(t)),[Symbol.iterator](){return this}}},d=function(...t){return l(this,t)};return Object.setPrototypeOf(d,a.prototype),o.registerSandboxFunction(d),o.ctx.sandboxedFunctions.add(d),d}function mt(t,e,n,o,i,s,a=!1){if(o.ctx.options.forbidFunctionCreation)throw new r("Function creation is forbidden");if(!o.ctx.prototypeWhitelist?.has(Promise.prototype))throw new r("Async/await not permitted");const l=function(...r){return((r,s)=>{const c=ft(t,s),l=void 0===i?[new H(null,c,r)]:[new H(i,c,r)];return async function*(){const t=[];let r=null;const i=Vt(n,o,e,l,void 0,a,(e,n)=>{t.push({yieldValue:e,continueDone:n}),r&&(r(),r=null)});let s,c,d=!1;for(i.then(t=>{d=!0,s=t,r?.()},t=>{d=!0,c=t,r?.()});;){for(0!==t.length||d||await new Promise(t=>{r=t});t.length>0;){const{yieldValue:e,continueDone:n}=t.shift();try{const t=e.delegate?yield*wt(e.value):yield e.value;n?.(void 0,t)}catch(u){n?.(u)}}if(d)break}if(void 0!==c)throw c;return s?.result}()})(this,r)};return Object.setPrototypeOf(l,c.prototype),o.registerSandboxFunction(l),o.ctx.sandboxedFunctions.add(l),l}function Et(t,e,n="assign"){if(void 0===t.context)throw new ReferenceError(`Cannot ${n} value to undefined.`);if(t.isConst)throw new TypeError("Assignment to constant variable.");if(t.isGlobal)throw new i(`Cannot ${n} property '${t.prop.toString()}' of a global object`);if(null===t.context)throw new TypeError("Cannot set properties of null");if("function"==typeof t.context[t.prop]&&!G(t.context,t.prop))throw new i(`Override prototype property '${t.prop.toString()}' not allowed`);"delete"===n?G(t.context,t.prop)&&(e.changeSubscriptions.get(t.context)?.forEach(e=>e({type:"delete",prop:t.prop.toString()})),e.changeSubscriptionsGlobal.get(t.context)?.forEach(e=>e({type:"delete",prop:t.prop.toString()}))):G(t.context,t.prop)?(e.setSubscriptions.get(t.context)?.get(t.prop.toString())?.forEach(t=>t({type:"replace"})),e.setSubscriptionsGlobal.get(t.context)?.get(t.prop.toString())?.forEach(t=>t({type:"replace"}))):(e.changeSubscriptions.get(t.context)?.forEach(e=>e({type:"create",prop:t.prop.toString()})),e.changeSubscriptionsGlobal.get(t.context)?.forEach(e=>e({type:"create",prop:t.prop.toString()})))}var It=new Set([[].push,[].pop,[].shift,[].unshift,[].splice,[].reverse,[].sort,[].copyWithin]),Ot=class{constructor(t,e){this.key=t,this.val=e}},At=class{constructor(t){this.item=t}},jt=class{constructor(t){this.item=t}},kt=class{},Bt=class{constructor(t,e,n){this.t=t,this.f=e,this.label=n}},Rt=/(\$\$)*(\$)?\${(\d+)}/g,Ct=["string","number","symbol"];function Ft(t,e,n,o,r,i,s,a,c){e===qt?function(t,e,n,o,r,i,s,a){const c=[];for(let l=0;l<e.length;l++){let d=Lt(n=>qt(t,e[l],o,r,n,i,s,a)).result;if(d instanceof rt&&(d.returned||d.breakLoop||d.continueLoop))return void n(void 0,d);if(et(e[l])&&e[l][0]===u.Return)return void n(void 0,new rt(r.ctx.auditReport,d,!0));c.push(d)}n(void 0,c)}(t,n,o,r,i,s,a,c):async function(t,e,n,o,r,i,s,a){const c=[];for(let d=0;d<e.length;d++){let p;try{let n;p=!0===(n=Pt(n=>Tt(t,e[d],o,r,n,i,s,a))).isInstant?n.instant:(await n.p).result}catch(l){return void n(l)}if(p instanceof rt&&(p.returned||p.breakLoop||p.continueLoop))return void n(void 0,p);if(et(e[d])&&e[d][0]===u.Return)return void n(void 0,new rt(r.ctx.auditReport,p,!0));c.push(p)}n(void 0,c)}(t,n,o,r,i,s,a,c).catch(o)}function Pt(t){let e,n=!1;const o=new Promise((o,r)=>{t((...t)=>{1===t.length?r(t[0]):(n=!0,e=t[1],o({result:t[1]}))})});return{isInstant:n,instant:e,p:o}}function Lt(t){let e,n;if(t((...t)=>{n=1===t.length?{error:t[0]}:void 0,e=t[1]}),n)throw n.error;return{result:e}}async function Tt(t,e,n,o,r,i,s,a){let c=r;const l=new Promise(t=>{c=(...e)=>{r(...e),t()}});if(!Ut(t,e,n,o,c,!0,i,s,a)&&et(e)){let r,l=e[0];try{let c;r=!0===(c=Pt(r=>Tt(t,e[1],n,o,r,i,s,a))).isInstant?c.instant:(await c.p).result}catch(d){return void c(d)}let p,f=r;try{f=r instanceof D?r.get(o):r}catch(d){return void c(d)}if(l===u.PropOptional||l===u.CallOptional){if(null==f)return void c(void 0,Q);l=l===u.PropOptional?u.Prop:u.Call}if(f===Q){if(l===u.Prop||l===u.Call)return void c(void 0,f);f=void 0}if(l===u.NullishCoalescing&&null!=f)return void c(void 0,f);try{let r;p=!0===(r=Pt(r=>Tt(t,e[2],n,o,r,i,s,a))).isInstant?r.instant:(await r.p).result}catch(d){return void c(d)}let h=p;try{h=p instanceof D?p.get(o):p}catch(d){return void c(d)}h===Q&&(h=void 0),Nt({op:l,exec:Tt,done:c,ticks:t,a:f,b:h,obj:r,context:o,scope:n,bobj:p,statementLabels:i,internal:s,generatorYield:a,tree:e})}await l}function qt(t,e,n,o,r,i,s,a){if(!Ut(t,e,n,o,r,!1,i,s,a)&&et(e)){let c=e[0],l=Lt(r=>qt(t,e[1],n,o,r,i,s,a)).result,d=l instanceof D?l.get(o):l;if(c===u.PropOptional||c===u.CallOptional){if(null==d)return void r(void 0,Q);c=c===u.PropOptional?u.Prop:u.Call}if(d===Q){if(c===u.Prop||c===u.Call)return void r(void 0,d);d=void 0}if(c===u.NullishCoalescing&&null!=d)return void r(void 0,d);let p=Lt(r=>qt(t,e[2],n,o,r,i,s,a)).result,f=p instanceof D?p.get(o):p;f===Q&&(f=void 0),Nt({op:c,exec:qt,done:r,ticks:t,a:d,b:f,obj:l,context:o,scope:n,bobj:p,statementLabels:i,internal:s,generatorYield:a,tree:e})}}function Wt(t,e=0n){const o=t.context.ctx.sandbox,{ticks:r,scope:i,context:s}=t;if(o.halted){const e=o.subscribeResume(()=>{e.unsubscribe(),Nt(t,!1)});return!0}if(void 0!==r.tickLimit&&r.tickLimit<=r.ticks+e){const e=new n("Execution quota exceeded");if(s.ctx.options.haltOnSandboxError){const n=o.subscribeResume(()=>{n.unsubscribe(),Nt(t)});o.haltExecution({type:"error",error:e,ticks:r,scope:i,context:s})}else t.done(e);return!0}if(r.nextYield&&r.ticks>r.nextYield){const e=o.subscribeResume(()=>{e.unsubscribe(),Nt(t,!1)});return r.nextYield+=50000n,o.haltExecution({type:"yield"}),setTimeout(()=>o.resumeExecution()),!0}return r.ticks+=e,!1}function Nt(t,n=!0){const{done:r,op:i,ticks:s,context:a,scope:c}=t;n&&s.ticks++;const l=a.ctx.sandbox;try{if(Wt(t))return;const e=nt.get(i);if(void 0===e)return void r(new o("Unknown operator: "+i));e(t)}catch(d){if(a.ctx.options.haltOnSandboxError&&d instanceof e){const t=l.subscribeResume(()=>{t.unsubscribe(),r(d)});l.haltExecution({type:"error",error:d,ticks:s,scope:c,context:a})}else r(d)}}var Mt=new Set([u.ArrowFunction,u.Function,u.InlineFunction,u.Loop,u.Try,u.Switch,u.IfCase,u.InlineIfCase,u.Labeled,u.Typeof]);function Ut(t,e,n,o,i,s,a,c,l){const d=s?Tt:qt;if(e instanceof D)i(void 0,e.get(o));else if(e===Q)i();else if(Array.isArray(e)&&!et(e))e[0]===u.None?i():Ft(t,d,e,i,n,o,a,c,l);else if(et(e))if(e[0]===u.Block)Ft(t,d,e[1],i,new H(n),o,a,c,l);else if(e[0]===u.InternalBlock)Ft(t,d,e[1],i,n,o,a,!0,l);else if(e[0]===u.Await)s?o.ctx.prototypeWhitelist?.has(Promise.prototype)?Tt(t,e[1],n,o,async(...t)=>{if(1===t.length)i(t[0]);else try{i(void 0,await Z(t[1],o))}catch(e){i(e)}},a,c,l).catch(i):i(new r("Async/await is not permitted")):i(new SyntaxError("Illegal use of 'await', must be inside async function"));else if(e[0]===u.Yield||e[0]===u.YieldDelegate){const r=l;if(!r)return i(new SyntaxError("Illegal use of 'yield', must be inside a generator function")),!0;const d=e[0]===u.YieldDelegate;if(s)Tt(t,e[1],n,o,async(...t)=>{if(1!==t.length)try{r(new yt(await Z(t[1],o),d),i)}catch(e){i(e)}else i(t[0])},a,c,l).catch(i);else try{const s=Lt(r=>qt(t,e[1],n,o,r,a,c,l)).result;r(new yt(Z(s,o),d),i)}catch(p){if(p===gt)throw p;i(p)}}else{if(!Mt.has(e[0]))return!1;Nt({op:e[0],exec:d,done:i,ticks:t,a:e[1],b:e[2],obj:e,tree:e,context:o,scope:n,bobj:void 0,statementLabels:a,internal:c,generatorYield:l})}else i(void 0,e);return!0}function $t(t,e,n,o=[],r,i,s){return Lt(a=>Dt(qt,a,t,e,n,o,r,i,s)).result}async function Vt(t,e,n,o=[],r,i,s){let a;return!0===(a=Pt(a=>Dt(Tt,a,t,e,n,o,r,i,s))).isInstant?a.instant:(await a.p).result}function Dt(t,e,n,o,r,i=[],s,a,c){if(!r)return void e();if(!(r instanceof Array))throw new SyntaxError("Bad execution tree");let l,d=o.ctx.globalScope;for(;l=i.shift();)"object"==typeof l&&(d=l instanceof H?l:new H(d,l,l instanceof K?void 0:null));o.ctx.options.audit&&!o.ctx.auditReport&&(o.ctx.auditReport={globalsAccess:new Set,prototypeAccess:{}}),t===qt?function(t,e,n,o,r,i,s,a){if(!(o instanceof Array))throw new SyntaxError("Bad execution tree");let c=0;for(c=0;c<o.length;c++){let d,p;const f=o[c];try{qt(e,f,r,n,(...t)=>{1===t.length?p={error:t[0]}:d=t[1]},i,s,a)}catch(l){p={error:l}}if(p)return void t(p.error);if(d instanceof rt)return void t(void 0,d);if(et(f)&&f[0]===u.Return)return void t(void 0,new rt(n.ctx.auditReport,d,!0))}t(void 0,new rt(n.ctx.auditReport,void 0,!1))}(e,n,o,r,d,s,a,c):async function(t,e,n,o,r,i,s,a){if(!(o instanceof Array))throw new SyntaxError("Bad execution tree");let c=0;for(c=0;c<o.length;c++){let d,p;const f=o[c];try{await Tt(e,f,r,n,(...t)=>{1===t.length?p={error:t[0]}:d=t[1]},i,s,a)}catch(l){p={error:l}}if(p)return void t(p.error);if(d instanceof rt)return void t(void 0,d);if(et(f)&&f[0]===u.Return)return void t(void 0,new rt(n.ctx.auditReport,d,!0))}t(void 0,new rt(n.ctx.auditReport,void 0,!1))}(e,n,o,r,d,s,a,c).catch(e)}function Gt(t,e,n,o){const r=o.setSubscriptions.get(t)||new Map;o.setSubscriptions.set(t,r);const i=r.get(e)||new Set;let s;r.set(e,i),i.add(n);const a=t[e];return a instanceof Object&&(s=o.changeSubscriptions.get(a)||new Set,s.add(n),o.changeSubscriptions.set(a,s)),{unsubscribe:()=>{i.delete(n),s?.delete(n)}}}var Yt=class t{constructor(e,n){this.evalContext=n,this.setSubscriptions=new WeakMap,this.changeSubscriptions=new WeakMap,this.sandboxFunctions=new WeakMap,this.haltSubscriptions=new Set,this.resumeSubscriptions=new Set,this.halted=!1,this.timeoutHandleCounter=0,this.setTimeoutHandles=new Map,this.setIntervalHandles=new Map;const o=Object.assign({audit:!1,forbidFunctionCalls:!1,forbidFunctionCreation:!1,globals:t.SAFE_GLOBALS,symbolWhitelist:t.SAFE_SYMBOLS,prototypeWhitelist:t.SAFE_PROTOTYPES,maxParserRecursionDepth:256,nonBlocking:!1,functionReplacements:new Map},e||{});this.context=tt(this,o)}static get SAFE_GLOBALS(){return{globalThis:globalThis,Function:Function,eval:eval,console:{debug:console.debug,error:console.error,info:console.info,log:console.log,table:console.table,warn:console.warn},isFinite:isFinite,isNaN:isNaN,parseFloat:parseFloat,parseInt:parseInt,decodeURI:decodeURI,decodeURIComponent:decodeURIComponent,encodeURI:encodeURI,encodeURIComponent:encodeURIComponent,escape:escape,unescape:unescape,Boolean:Boolean,Number:Number,BigInt:BigInt,String:String,Object:Object,Array:Array,Symbol:Symbol,Error:Error,EvalError:EvalError,RangeError:RangeError,ReferenceError:ReferenceError,SyntaxError:SyntaxError,TypeError:TypeError,URIError:URIError,Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array,Map:Map,Set:Set,WeakMap:WeakMap,WeakSet:WeakSet,Promise:Promise,Intl:Intl,JSON:JSON,Math:Math,Date:Date,RegExp:RegExp}}static get SAFE_SYMBOLS(){const t={};for(const e of["asyncIterator","iterator","match","matchAll","replace","search","split"]){const n=Symbol[e];"symbol"==typeof n&&(t[e]=n)}return t}static get SAFE_PROTOTYPES(){const t=[Function,Boolean,Number,BigInt,String,Date,Error,Array,Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Map,Set,WeakMap,WeakSet,Promise,Symbol,Date,RegExp,Response,Request,Headers,FormData],e=new Map;return t.forEach(t=>{e.set(t,new Set)}),e.set(Object,new Set(["constructor","name","entries","fromEntries","getOwnPropertyNames","is","keys","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf","values"])),e}subscribeGet(t,e){return e.getSubscriptions.add(t),{unsubscribe:()=>e.getSubscriptions.delete(t)}}subscribeSet(t,e,n,o){return Gt(t,e,n,o)}subscribeSetGlobal(t,e,n){return Gt(t,e,n,this)}subscribeHalt(t){return this.haltSubscriptions.add(t),{unsubscribe:()=>{this.haltSubscriptions.delete(t)}}}subscribeResume(t){return this.resumeSubscriptions.add(t),{unsubscribe:()=>{this.resumeSubscriptions.delete(t)}}}haltExecution(t={type:"manual"}){if(!this.halted){this.halted=!0;for(const e of this.haltSubscriptions)e(t)}}resumeExecution(){if(this.halted){if(void 0!==this.context.ticks.tickLimit&&this.context.ticks.ticks>=this.context.ticks.tickLimit)throw new n("Cannot resume execution: tick limit exceeded");this.halted=!1;for(const t of this.resumeSubscriptions)t()}}getContext(t){return this.sandboxFunctions.get(t)}executeTree(t,e=[]){return $t(t.ctx.ticks,t,t.tree,e,void 0,!1)}executeTreeAsync(t,e=[]){return Vt(t.ctx.ticks,t,t.tree,e,void 0,!1)}};t.SandboxExec=Yt,t.default=Yt});
|
|
2
|
+
//# sourceMappingURL=SandboxExec.min.js.map
|