Comparing version 0.10.2 to 0.10.3
@@ -1,1 +0,1 @@ | ||
!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";const{assign:t,create:e,defineProperties:r,entries:o,freeze:n,getOwnPropertyDescriptor:a,getOwnPropertyDescriptors:i,getOwnPropertyNames:c,getPrototypeOf:s,keys:p,prototype:u,setPrototypeOf:l,values:y}=Object,f=(t,e,o)=>r(t,{[e]:o}),{apply:g,construct:d,get:m,set:P}=Reflect,{isArray:h,prototype:b}=Array,{revocable:S}=Proxy,{prototype:w}=RegExp,{prototype:E}=String,{prototype:I}=WeakMap,T=t=>(e,...r)=>g(t,e,r),A=T(u.hasOwnProperty),v=(T(b.filter),T(b.join)),F=(T(b.push),T(b.pop)),U=T(b.includes),k=T(w.test),$=(T(E.match),T(E.search)),x=T(E.slice),R=T(E.split),_=(T(I.get),T(I.set),T(I.has),n({__proto__:null})),{freeze:O,getOwnPropertyDescriptors:C,getPrototypeOf:M}=Object,{ownKeys:N}=Reflect;function G(t,e){if(!t)throw new TypeError(e)}const B={Infinity:1/0,NaN:NaN,undefined:void 0},j={isFinite:"isFinite",isNaN:"isNaN",parseFloat:"parseFloat",parseInt:"parseInt",decodeURI:"decodeURI",decodeURIComponent:"decodeURIComponent",encodeURI:"encodeURI",encodeURIComponent:"encodeURIComponent",Array:"Array",ArrayBuffer:"ArrayBuffer",BigInt:"BigInt",BigInt64Array:"BigInt64Array",BigUint64Array:"BigUint64Array",Boolean:"Boolean",DataView:"DataView",EvalError:"EvalError",Float32Array:"Float32Array",Float64Array:"Float64Array",Int8Array:"Int8Array",Int16Array:"Int16Array",Int32Array:"Int32Array",Map:"Map",Number:"Number",Object:"Object",Promise:"Promise",Proxy:"Proxy",RangeError:"RangeError",ReferenceError:"ReferenceError",Set:"Set",String:"String",Symbol:"Symbol",SyntaxError:"SyntaxError",TypeError:"TypeError",Uint8Array:"Uint8Array",Uint8ClampedArray:"Uint8ClampedArray",Uint16Array:"Uint16Array",Uint32Array:"Uint32Array",URIError:"URIError",WeakMap:"WeakMap",WeakSet:"WeakSet",JSON:"JSON",Reflect:"Reflect",escape:"escape",unescape:"unescape",lockdown:"lockdown",harden:"harden",HandledPromise:"HandledPromise",StaticModuleRecord:"StaticModuleRecord"},D={Date:"%InitialDate%",Error:"%InitialError%",RegExp:"%InitialRegExp%",Math:"%InitialMath%",getStackString:"%InitialGetStackString%"},L={"[[Proto]]":"%FunctionPrototype%",length:"number",name:"string"},W=L,z={"[[Proto]]":"%AsyncFunctionPrototype%"},V={get:W,set:"undefined"},Y={get:W,set:W};function H(t){return t===V||t===Y}function K(t){return{"[[Proto]]":"%SharedError%",prototype:t}}function q(t){return{"[[Proto]]":"%ErrorPrototype%",constructor:t,message:"string",name:"string",toString:!1}}function J(t){return{"[[Proto]]":"%TypedArray%",BYTES_PER_ELEMENT:"number",prototype:t}}function Q(t){return{"[[Proto]]":"%TypedArrayPrototype%",BYTES_PER_ELEMENT:"number",constructor:t}}const X={E:"number",LN10:"number",LN2:"number",LOG10E:"number",LOG2E:"number",PI:"number",SQRT1_2:"number",SQRT2:"number","@@toStringTag":"string",abs:W,acos:W,acosh:W,asin:W,asinh:W,atan:W,atanh:W,atan2:W,cbrt:W,ceil:W,clz32:W,cos:W,cosh:W,exp:W,expm1:W,floor:W,fround:W,hypot:W,imul:W,log:W,log1p:W,log10:W,log2:W,max:W,min:W,pow:W,round:W,sign:W,sin:W,sinh:W,sqrt:W,tan:W,tanh:W,trunc:W},Z={"[[Proto]]":null,"%ThrowTypeError%":W,Infinity:"number",NaN:"number",undefined:"undefined","%UniqueEval%":W,isFinite:W,isNaN:W,parseFloat:W,parseInt:W,decodeURI:W,decodeURIComponent:W,encodeURI:W,encodeURIComponent:W,Object:{"[[Proto]]":"%FunctionPrototype%",assign:W,create:W,defineProperties:W,defineProperty:W,entries:W,freeze:W,fromEntries:W,getOwnPropertyDescriptor:W,getOwnPropertyDescriptors:W,getOwnPropertyNames:W,getOwnPropertySymbols:W,getPrototypeOf:W,is:W,isExtensible:W,isFrozen:W,isSealed:W,keys:W,preventExtensions:W,prototype:"%ObjectPrototype%",seal:W,setPrototypeOf:W,values:W},"%ObjectPrototype%":{"[[Proto]]":null,constructor:"Object",hasOwnProperty:W,isPrototypeOf:W,propertyIsEnumerable:W,toLocaleString:W,toString:W,valueOf:W,"--proto--":Y,__defineGetter__:W,__defineSetter__:W,__lookupGetter__:W,__lookupSetter__:W},"%UniqueFunction%":{"[[Proto]]":"%FunctionPrototype%",prototype:"%FunctionPrototype%"},"%InertFunction%":{"[[Proto]]":"%FunctionPrototype%",prototype:"%FunctionPrototype%"},"%FunctionPrototype%":{apply:W,bind:W,call:W,constructor:"%InertFunction%",toString:W,"@@hasInstance":W,caller:!1,arguments:!1},Boolean:{"[[Proto]]":"%FunctionPrototype%",prototype:"%BooleanPrototype%"},"%BooleanPrototype%":{constructor:"Boolean",toString:W,valueOf:W},Symbol:{"[[Proto]]":"%FunctionPrototype%",asyncIterator:"symbol",for:W,hasInstance:"symbol",isConcatSpreadable:"symbol",iterator:"symbol",keyFor:W,match:"symbol",matchAll:"symbol",prototype:"%SymbolPrototype%",replace:"symbol",search:"symbol",species:"symbol",split:"symbol",toPrimitive:"symbol",toStringTag:"symbol",unscopables:"symbol"},"%SymbolPrototype%":{constructor:"Symbol",description:V,toString:W,valueOf:W,"@@toPrimitive":W,"@@toStringTag":"string"},"%InitialError%":{"[[Proto]]":"%FunctionPrototype%",prototype:"%ErrorPrototype%",captureStackTrace:W,stackTraceLimit:Y,prepareStackTrace:Y},"%SharedError%":{"[[Proto]]":"%FunctionPrototype%",prototype:"%ErrorPrototype%",captureStackTrace:W,stackTraceLimit:Y,prepareStackTrace:Y},"%ErrorPrototype%":{constructor:"%SharedError%",message:"string",name:"string",toString:W},EvalError:K("%EvalErrorPrototype%"),RangeError:K("%RangeErrorPrototype%"),ReferenceError:K("%ReferenceErrorPrototype%"),SyntaxError:K("%SyntaxErrorPrototype%"),TypeError:K("%TypeErrorPrototype%"),URIError:K("%URIErrorPrototype%"),"%EvalErrorPrototype%":q("EvalError"),"%RangeErrorPrototype%":q("RangeError"),"%ReferenceErrorPrototype%":q("ReferenceError"),"%SyntaxErrorPrototype%":q("SyntaxError"),"%TypeErrorPrototype%":q("TypeError"),"%URIErrorPrototype%":q("URIError"),Number:{"[[Proto]]":"%FunctionPrototype%",EPSILON:"number",isFinite:W,isInteger:W,isNaN:W,isSafeInteger:W,MAX_SAFE_INTEGER:"number",MAX_VALUE:"number",MIN_SAFE_INTEGER:"number",MIN_VALUE:"number",NaN:"number",NEGATIVE_INFINITY:"number",parseFloat:W,parseInt:W,POSITIVE_INFINITY:"number",prototype:"%NumberPrototype%"},"%NumberPrototype%":{constructor:"Number",toExponential:W,toFixed:W,toLocaleString:W,toPrecision:W,toString:W,valueOf:W},BigInt:{"[[Proto]]":"%FunctionPrototype%",asIntN:W,asUintN:W,prototype:"%BigIntPrototype%"},"%BigIntPrototype%":{constructor:"BigInt",toLocaleString:W,toString:W,valueOf:W,"@@toStringTag":"string"},"%InitialMath%":{...X,random:W},"%SharedMath%":X,"%InitialDate%":{"[[Proto]]":"%FunctionPrototype%",now:W,parse:W,prototype:"%DatePrototype%",UTC:W},"%SharedDate%":{"[[Proto]]":"%FunctionPrototype%",now:W,parse:W,prototype:"%DatePrototype%",UTC:W},"%DatePrototype%":{constructor:"%SharedDate%",getDate:W,getDay:W,getFullYear:W,getHours:W,getMilliseconds:W,getMinutes:W,getMonth:W,getSeconds:W,getTime:W,getTimezoneOffset:W,getUTCDate:W,getUTCDay:W,getUTCFullYear:W,getUTCHours:W,getUTCMilliseconds:W,getUTCMinutes:W,getUTCMonth:W,getUTCSeconds:W,setDate:W,setFullYear:W,setHours:W,setMilliseconds:W,setMinutes:W,setMonth:W,setSeconds:W,setTime:W,setUTCDate:W,setUTCFullYear:W,setUTCHours:W,setUTCMilliseconds:W,setUTCMinutes:W,setUTCMonth:W,setUTCSeconds:W,toDateString:W,toISOString:W,toJSON:W,toLocaleDateString:W,toLocaleString:W,toLocaleTimeString:W,toString:W,toTimeString:W,toUTCString:W,valueOf:W,"@@toPrimitive":W,getYear:W,setYear:W,toGMTString:W},String:{"[[Proto]]":"%FunctionPrototype%",fromCharCode:W,fromCodePoint:W,prototype:"%StringPrototype%",raw:W},"%StringPrototype%":{length:"number",charAt:W,charCodeAt:W,codePointAt:W,concat:W,constructor:"String",endsWith:W,includes:W,indexOf:W,lastIndexOf:W,localeCompare:W,match:W,matchAll:W,normalize:W,padEnd:W,padStart:W,repeat:W,replace:W,search:W,slice:W,split:W,startsWith:W,substring:W,toLocaleLowerCase:W,toLocaleUpperCase:W,toLowerCase:W,toString:W,toUpperCase:W,trim:W,trimEnd:W,trimStart:W,valueOf:W,"@@iterator":W,substr:W,anchor:W,big:W,blink:W,bold:W,fixed:W,fontcolor:W,fontsize:W,italics:W,link:W,small:W,strike:W,sub:W,sup:W,trimLeft:W,trimRight:W},"%StringIteratorPrototype%":{"[[Proto]]":"%IteratorPrototype%",next:W,"@@toStringTag":"string"},"%InitialRegExp%":{"[[Proto]]":"%FunctionPrototype%",prototype:"%RegExpPrototype%","@@species":V,input:!1,$_:!1,lastMatch:!1,"$&":!1,lastParen:!1,"$+":!1,leftContext:!1,"$`":!1,rightContext:!1,"$'":!1,$1:!1,$2:!1,$3:!1,$4:!1,$5:!1,$6:!1,$7:!1,$8:!1,$9:!1},"%SharedRegExp%":{"[[Proto]]":"%FunctionPrototype%",prototype:"%RegExpPrototype%","@@species":V},"%RegExpPrototype%":{constructor:"%SharedRegExp%",exec:W,dotAll:V,flags:V,global:V,ignoreCase:V,"@@match":W,"@@matchAll":W,multiline:V,"@@replace":W,"@@search":W,source:V,"@@split":W,sticky:V,test:W,toString:W,unicode:V,compile:!1},"%RegExpStringIteratorPrototype%":{"[[Proto]]":"%IteratorPrototype%",next:W,"@@toStringTag":"string"},Array:{"[[Proto]]":"%FunctionPrototype%",from:W,isArray:W,of:W,prototype:"%ArrayPrototype%","@@species":V},"%ArrayPrototype%":{length:"number",concat:W,constructor:"Array",copyWithin:W,entries:W,every:W,fill:W,filter:W,find:W,findIndex:W,flat:W,flatMap:W,forEach:W,includes:W,indexOf:W,join:W,keys:W,lastIndexOf:W,map:W,pop:W,push:W,reduce:W,reduceRight:W,reverse:W,shift:W,slice:W,some:W,sort:W,splice:W,toLocaleString:W,toString:W,unshift:W,values:W,"@@iterator":W,"@@unscopables":{"[[Proto]]":null,copyWithin:"boolean",entries:"boolean",fill:"boolean",find:"boolean",findIndex:"boolean",flat:"boolean",flatMap:"boolean",includes:"boolean",keys:"boolean",values:"boolean"}},"%ArrayIteratorPrototype%":{"[[Proto]]":"%IteratorPrototype%",next:W,"@@toStringTag":"string"},"%TypedArray%":{"[[Proto]]":"%FunctionPrototype%",from:W,of:W,prototype:"%TypedArrayPrototype%","@@species":V},"%TypedArrayPrototype%":{buffer:V,byteLength:V,byteOffset:V,constructor:"%TypedArray%",copyWithin:W,entries:W,every:W,fill:W,filter:W,find:W,findIndex:W,forEach:W,includes:W,indexOf:W,join:W,keys:W,lastIndexOf:W,length:V,map:W,reduce:W,reduceRight:W,reverse:W,set:W,slice:W,some:W,sort:W,subarray:W,toLocaleString:W,toString:W,values:W,"@@iterator":W,"@@toStringTag":V},BigInt64Array:J("%BigInt64ArrayPrototype%"),BigUint64Array:J("%BigUint64ArrayPrototype%"),Float32Array:J("%Float32ArrayPrototype%"),Float64Array:J("%Float64ArrayPrototype%"),Int16Array:J("%Int16ArrayPrototype%"),Int32Array:J("%Int32ArrayPrototype%"),Int8Array:J("%Int8ArrayPrototype%"),Uint16Array:J("%Uint16ArrayPrototype%"),Uint32Array:J("%Uint32ArrayPrototype%"),Uint8Array:J("%Uint8ArrayPrototype%"),Uint8ClampedArray:J("%Uint8ClampedArrayPrototype%"),"%BigInt64ArrayPrototype%":Q("BigInt64Array"),"%BigUint64ArrayPrototype%":Q("BigUint64Array"),"%Float32ArrayPrototype%":Q("Float32Array"),"%Float64ArrayPrototype%":Q("Float64Array"),"%Int16ArrayPrototype%":Q("Int16Array"),"%Int32ArrayPrototype%":Q("Int32Array"),"%Int8ArrayPrototype%":Q("Int8Array"),"%Uint16ArrayPrototype%":Q("Uint16Array"),"%Uint32ArrayPrototype%":Q("Uint32Array"),"%Uint8ArrayPrototype%":Q("Uint8Array"),"%Uint8ClampedArrayPrototype%":Q("Uint8ClampedArray"),Map:{"[[Proto]]":"%FunctionPrototype%","@@species":V,prototype:"%MapPrototype%"},"%MapPrototype%":{clear:W,constructor:"Map",delete:W,entries:W,forEach:W,get:W,has:W,keys:W,set:W,size:V,values:W,"@@iterator":W,"@@toStringTag":"string"},"%MapIteratorPrototype%":{"[[Proto]]":"%IteratorPrototype%",next:W,"@@toStringTag":"string"},Set:{"[[Proto]]":"%FunctionPrototype%",prototype:"%SetPrototype%","@@species":V},"%SetPrototype%":{add:W,clear:W,constructor:"Set",delete:W,entries:W,forEach:W,has:W,keys:W,size:V,values:W,"@@iterator":W,"@@toStringTag":"string"},"%SetIteratorPrototype%":{"[[Proto]]":"%IteratorPrototype%",next:W,"@@toStringTag":"string"},WeakMap:{"[[Proto]]":"%FunctionPrototype%",prototype:"%WeakMapPrototype%"},"%WeakMapPrototype%":{constructor:"WeakMap",delete:W,get:W,has:W,set:W,"@@toStringTag":"string"},WeakSet:{"[[Proto]]":"%FunctionPrototype%",prototype:"%WeakSetPrototype%"},"%WeakSetPrototype%":{add:W,constructor:"WeakSet",delete:W,has:W,"@@toStringTag":"string"},ArrayBuffer:{"[[Proto]]":"%FunctionPrototype%",isView:W,prototype:"%ArrayBufferPrototype%","@@species":V},"%ArrayBufferPrototype%":{byteLength:V,constructor:"ArrayBuffer",slice:W,"@@toStringTag":"string"},SharedArrayBuffer:!1,"%SharedArrayBufferPrototype%":!1,DataView:{"[[Proto]]":"%FunctionPrototype%",prototype:"%DataViewPrototype%"},"%DataViewPrototype%":{buffer:V,byteLength:V,byteOffset:V,constructor:"DataView",getBigInt64:W,getBigUint64:W,getFloat32:W,getFloat64:W,getInt8:W,getInt16:W,getInt32:W,getUint8:W,getUint16:W,getUint32:W,setBigInt64:W,setBigUint64:W,setFloat32:W,setFloat64:W,setInt8:W,setInt16:W,setInt32:W,setUint8:W,setUint16:W,setUint32:W,"@@toStringTag":"string"},Atomics:!1,JSON:{parse:W,stringify:W,"@@toStringTag":"string"},"%IteratorPrototype%":{"@@iterator":W},"%AsyncIteratorPrototype%":{"@@asyncIterator":W},"%InertGeneratorFunction%":{"[[Proto]]":"%InertFunction%",prototype:"%Generator%"},"%Generator%":{"[[Proto]]":"%FunctionPrototype%",constructor:"%InertGeneratorFunction%",prototype:"%GeneratorPrototype%","@@toStringTag":"string"},"%InertAsyncGeneratorFunction%":{"[[Proto]]":"%InertFunction%",prototype:"%AsyncGenerator%"},"%AsyncGenerator%":{"[[Proto]]":"%FunctionPrototype%",constructor:"%InertAsyncGeneratorFunction%",prototype:"%AsyncGeneratorPrototype%","@@toStringTag":"string"},"%GeneratorPrototype%":{"[[Proto]]":"%IteratorPrototype%",constructor:"%Generator%",next:W,return:W,throw:W,"@@toStringTag":"string"},"%AsyncGeneratorPrototype%":{"[[Proto]]":"%AsyncIteratorPrototype%",constructor:"%AsyncGenerator%",next:W,return:W,throw:W,"@@toStringTag":"string"},HandledPromise:{"[[Proto]]":"Promise",applyFunction:W,applyFunctionSendOnly:W,applyMethod:W,applyMethodSendOnly:W,get:W,getSendOnly:W,prototype:"%PromisePrototype%",resolve:W},Promise:{"[[Proto]]":"%FunctionPrototype%",all:W,allSettled:W,prototype:"%PromisePrototype%",race:W,reject:W,resolve:W,"@@species":V},"%PromisePrototype%":{catch:W,constructor:"Promise",finally:W,then:W,"@@toStringTag":"string"},"%InertAsyncFunction%":{"[[Proto]]":"%InertFunction%",prototype:"%AsyncFunctionPrototype%"},"%AsyncFunctionPrototype%":{"[[Proto]]":"%FunctionPrototype%",constructor:"%InertAsyncFunction%","@@toStringTag":"string"},Reflect:{apply:W,construct:W,defineProperty:W,deleteProperty:W,get:W,getOwnPropertyDescriptor:W,getPrototypeOf:W,has:W,isExtensible:W,ownKeys:W,preventExtensions:W,set:W,setPrototypeOf:W},Proxy:{"[[Proto]]":"%FunctionPrototype%",revocable:W},escape:W,unescape:W,"%UniqueCompartment%":{"[[Proto]]":"%FunctionPrototype%",prototype:"%CompartmentPrototype%",toString:W},"%InertCompartment%":{"[[Proto]]":"%FunctionPrototype%",prototype:"%CompartmentPrototype%",toString:W},"%CompartmentPrototype%":{constructor:"%InertCompartment%",evaluate:W,globalThis:V,import:z,load:z,importNow:W,module:W,toString:W},lockdown:W,harden:W,StaticModuleRecord:{"[[Proto]]":"%FunctionPrototype%",prototype:"%StaticModuleRecordPrototype%",toString:W},"%InertStaticModuleRecord%":{"[[Proto]]":"%FunctionPrototype%",prototype:"%StaticModuleRecordPrototype%",toString:W},"%StaticModuleRecordPrototype%":{constructor:"%InertStaticModuleRecord%",toString:W},"%InitialGetStackString%":W};function tt(t,e,r){if(A(t,e)){const o=a(t,e);if(!Object.is(o.value,r.value)||o.get!==r.get||o.set!==r.set||o.writable!==r.writable||o.enumerable!==r.enumerable||o.configurable!==r.configurable)throw new Error(`Conflicting definitions of ${e}`)}f(t,e,r)}function et(){const t={__proto__:null};let e;const r={addIntrinsics(e){!function(t,e){for(const[r,n]of o(e))tt(t,r,n)}(t,i(e))},completePrototypes(){for(const[e,r]of o(t)){if(r!==Object(r))continue;if(!A(r,"prototype"))continue;const o=Z[e];if("object"!=typeof o)throw new Error(`Expected permit object at whitelist.${e}`);const n=o.prototype;if(!n)throw new Error(`${e}.prototype property not whitelisted`);if("string"!=typeof n||!A(Z,n))throw new Error(`Unrecognized ${e}.prototype whitelist entry`);const a=r.prototype;if(A(t,n)){if(t[n]!==a)throw new Error(`Conflicting bindings of ${n}`)}else t[n]=a}},finalIntrinsics:()=>(n(t),e=new WeakSet(y(t).filter(t=>"function"==typeof t)),t),isPseudoNative(t){if(!e)throw new Error("isPseudoNative can only be called after finalIntrinsics");return e.has(t)}};return r.addIntrinsics(B),r.addIntrinsics(function(t,e){const r={__proto__:null};for(const[n,a]of o(e))A(t,n)&&(r[a]=t[n]);return r}(globalThis,j)),r}const{apply:rt,ownKeys:ot}=Reflect,nt=(t=>(e,...r)=>rt(t,e,r))(Object.prototype.hasOwnProperty);function at(t,e){if("string"==typeof e)return e;if("symbol"==typeof e)return`@@${e.toString().slice(14,-1)}`;throw new TypeError(`Unexpected property name type ${t} ${e}`)}function it(t,e){const r=["undefined","boolean","number","string","symbol"];function o(e,o,n,a){if("object"==typeof a)return c(e,o,a),!0;if(!1===a)return!1;if("string"==typeof a)if("prototype"===n||"constructor"===n){if(nt(t,a)){if(o!==t[a])throw new TypeError(`Does not match whitelist ${e}`);return!0}}else if(r.includes(a)){if(typeof o!==a)throw new TypeError(`At ${e} expected ${a} not ${typeof o}`);return!0}throw new TypeError(`Unexpected whitelist permit ${a} at ${e}`)}function n(t,e,r,n){const i=a(e,r);if(nt(i,"value")){if(H(n))throw new TypeError(`Accessor expected at ${t}`);return o(t,i.value,r,n)}if(!H(n))throw new TypeError(`Accessor not expected at ${t}`);return o(`${t}<get>`,i.get,r,n.get)&&o(`${t}<set>`,i.set,r,n.set)}function i(t,r,o){const n="__proto__"===o?"--proto--":o;return nt(r,n)?r[n]:"function"==typeof t&&(e(t),nt(L,n))?L[n]:void 0}function c(e,r,o){if(void 0===r)return;!function(e,r,o){if(r!==Object(r))throw new TypeError(`Object expected: ${e}, ${r}, ${o}`);const n=s(r);if(null!==n||null!==o){if(void 0!==o&&"string"!=typeof o)throw new TypeError(`Malformed whitelist permit ${e}.__proto__`);if(n!==t[o||"%ObjectPrototype%"])throw new Error(`Unexpected intrinsic ${e}.__proto__ at ${o}`)}}(e,r,o["[[Proto]]"]);for(const t of ot(r)){const a=at(e,t),c=`${e}.${a}`,s=i(r,o,a);s&&n(c,r,t,s)||(!1!==s&&console.log(`Removing ${c}`),delete r[t])}}c("intrinsics",t,Z)}const ct=["getTypeName","getFunctionName","getMethodName","getFileName","getLineNumber","getColumnNumber","getEvalOrigin","isToplevel","isEval","isNative","isConstructor","isAsync","getPosition","getScriptNameOrSourceURL","toString"],st=t=>{const e=Object.fromEntries(ct.map(e=>[e,()=>t[e]()]));return Object.create(e,{})},pt=(t,e)=>[`${t}`,...e.map(t=>`\n at ${t}`)].join("");function ut(t,e,o){const n=new WeakMap,a={captureStackTrace(e,r=a.captureStackTrace){"function"!=typeof t.captureStackTrace?Reflect.set(e,"stack",""):t.captureStackTrace(e,r)},getStackString(t){n.has(t)||t.stack;const e=n.get(t);return e?pt(t,e):""},prepareStackTrace:(t,e)=>(n.set(t,e),"unsafe"===o?pt(t,e):"")},i=a.prepareStackTrace;t.prepareStackTrace=i;const c=new WeakSet([i]),s=t=>{if(c.has(t))return t;const e={prepareStackTrace:(e,r)=>(n.set(e,r),t(e,(t=>t.map(st))(r)))};return c.add(e.prepareStackTrace),e.prepareStackTrace};return r(e,{captureStackTrace:{value:a.captureStackTrace,writable:!0,enumerable:!1,configurable:!0},stackTraceLimit:{get(){if("number"==typeof t.stackTraceLimit)return t.stackTraceLimit},set(e){"number"!=typeof t.stackTraceLimit||(t.stackTraceLimit=e)},enumerable:!1,configurable:!0},prepareStackTrace:{get:()=>t.prepareStackTrace,set(e){if("function"==typeof e){const r=s(e);t.prepareStackTrace=r}else t.prepareStackTrace=i},enumerable:!1,configurable:!0}}),a.getStackString}const lt=[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError],yt={getStackString:t=>""};var ft={"%ObjectPrototype%":"*","%ArrayPrototype%":"*","%FunctionPrototype%":{constructor:!0,bind:!0,apply:!0,name:!0,toString:!0},"%ErrorPrototype%":{constructor:!0,message:!0,name:!0,toString:!0},"%TypeErrorPrototype%":{constructor:!0,message:!0,name:!0},"%SyntaxErrorPrototype%":{message:!0},"%RangeErrorPrototype%":{message:!0},"%URIErrorPrototype%":{message:!0},"%EvalErrorPrototype%":{message:!0},"%ReferenceErrorPrototype%":{message:!0},"%PromisePrototype%":{constructor:!0},"%TypedArrayPrototype%":"*","%Generator%":{constructor:!0,name:!0,toString:!0},"%IteratorPrototype%":"*"};const{ownKeys:gt}=Reflect;function dt(t){return null!==t&&"object"==typeof t}const mt=/^(\w*[a-z])Locale([A-Z]\w*)$/,Pt={localeCompare(t){if(null==this)throw new TypeError('Cannot localeCompare with null or undefined "this" value');const e=`${this}`;return e<(t=`${t}`)?-1:e>t?1:(G(e===t,`expected ${e} and ${t} to compare`),0)}}.localeCompare;const ht=function(t={},e={},r={}){throw new TypeError("Not available")},bt=function(t,e){throw new TypeError("Not available")};function St(t){return s(t).constructor}function wt(t,e){const r=`please report internal shim error: ${t}`;throw console.error(r),e&&(console.error(`${e}`),console.error(`${e.stack}`)),TypeError(r)}function Et(t,e){t||wt(e)}const It=["await","break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","let","static","enum","implements","package","protected","interface","private","public","await","null","true","false","this","arguments"],Tt=new RegExp("^[a-zA-Z_$][\\w$]*$");function At(t){return"eval"!==t&&!U(It,t)&&k(Tt,t)}function vt(t,e){const r=a(t,e);return(!1===r.configurable&&!1===r.writable&&A(r,"value"))}const Ft=eval,Ut=new Proxy(_,{get(t,e){wt(`unexpected scope handler trap called: ${String(e)}`)}});function kt(t,e){const r=$(t,e);return r<0?-1:R(x(t,0,r),"\n").length}const $t=new RegExp("(?:\x3c!--|--\x3e)");const xt=new RegExp("\\bimport\\s*(?:\\(|/[/*])");const Rt=new RegExp("\\beval\\s*(?:\\(|/[/*])");function _t(t){return t=function(t){const e=kt(t,Rt);if(e<0)return t;throw new SyntaxError(`possible direct eval expression rejected around line ${e}`)}(t=function(t){const e=kt(t,xt);if(e<0)return t;throw new SyntaxError(`possible import expression rejected around line ${e}`)}(t=function(t){const e=kt(t,$t);if(e<0)return t;throw new SyntaxError(`possible html comment syntax rejected around line ${e}`)}(t)))}const Ot=Function;function Ct(t=[]){const e=function(t){return 0===t.length?"":`const {${v(t,",")}} = this;`}(t);return Ot(`\n with (this) {\n ${e}\n return function() {\n 'use strict';\n return eval(arguments[0]);\n };\n }\n `)}function Mt(t,e,r={},{localTransforms:o=[],globalTransforms:n=[],sloppyGlobalsMode:i=!1}={}){t=function(t,e){for(const r of e)t=r(t);return t}(t,[...o,...n,_t]);const s=function(t,e={},{sloppyGlobalsMode:r=!1}={}){return{__proto__:Ut,useUnsafeEvaluator:!1,get(r,o){if("symbol"!=typeof o)return"eval"===o&&!0===this.useUnsafeEvaluator?(this.useUnsafeEvaluator=!1,Ft):o in e?m(e,o,t):m(t,o)},set(r,o,n){if(o in e){return"value"in a(e,o)?P(e,o,n):P(e,o,n,t)}return P(t,o,n)},has:(o,n)=>!!(r||"eval"===n||n in e||n in t||n in globalThis),getPrototypeOf:()=>null}}(e,r,{sloppyGlobalsMode:i}),p=S(_,s),u=Ct(function(t,e={}){const r=c(t),o=c(e),n=o.filter(t=>At(t)&&vt(e,t));return[...r.filter(e=>!o.includes(e)&&At(e)&&vt(t,e)),...n]}(e,r)),l=g(u,p.proxy,[]);let y;s.useUnsafeEvaluator=!0;try{return g(l,e,[t])}catch(t){throw y=t,t}finally{!0===s.useUnsafeEvaluator&&(wt("handler did not revoke useUnsafeEvaluator",y),p.revoke())}}const Nt=(t,e={})=>r=>"string"!=typeof r?r:Mt(r,t,{},e),Gt=Function;function Bt(t,e={}){const o=function(r){const o=`${F(arguments)||""}`,n=`${v(arguments,",")}`;new Gt(n,o);const a=`(function anonymous(${n}\n) {\n${o}\n})`;return Mt(a,t,{},e)};return r(o,{prototype:{value:Function.prototype,writable:!1,enumerable:!1,configurable:!1}}),Et(s(Function)===Function.prototype,"Function prototype is the same accross compartments"),Et(s(o)===Function.prototype,"Function constructor prototype is the same accross compartments"),o}let jt,Dt=!1;const Lt=function(){if(arguments.length>=1)throw new TypeError("makeHardener no longer takes any options");const t=new WeakSet,{harden:e}={harden(e){const r=new Set,o=new Map,n=new WeakMap;function a(e,o){if(Object(e)!==e)return;const a=typeof e;if("object"!==a&&"function"!==a)throw new TypeError(`Unexpected typeof: ${a}`);t.has(e)||r.has(e)||(r.add(e),n.set(e,o))}function i(t){O(t);const e=M(t),r=C(t),i=n.get(t)||"unknown";null===e||o.has(e)||(o.set(e,i),n.set(e,`${i}.__proto__`)),N(r).forEach(t=>{const e=`${i}.${String(t)}`,o=r[t];"value"in o?a(o.value,`${e}`):(a(o.get,`${e}(get)`),a(o.set,`${e}(set)`))})}return a(e),r.forEach(i),o.forEach((e,o)=>{if(!r.has(o)&&!t.has(o)){let t;try{t=`prototype ${o} of ${e} is not already in the fringeSet`}catch(r){t="a prototype of something is not already in the fringeset (and .toString failed)";try{console.log(t),console.log("the prototype:",o),console.log("of something:",e)}catch(t){}}throw new TypeError(t)}}),r.forEach(t.add,t),e}};return e}(),Wt=()=>!1;function zt(t,n={}){n={...jt,...n};const{dateTaming:y="safe",errorTaming:m="safe",mathTaming:P="safe",regExpTaming:h="safe",localeTaming:b="safe",...S}=n,w=Reflect.ownKeys(S);if(G(0===w.length,`lockdown(): non supported option ${w.join(", ")}`),jt){for(const t of p(jt))G(n[t]===jt[t],`lockdown(): cannot re-invoke with different option ${t}`);return Wt}jt={dateTaming:y,errorTaming:m,mathTaming:P,regExpTaming:h,localeTaming:b};const E=et();E.addIntrinsics(function(){try{(0,Function.prototype.constructor)("return 1")}catch(t){return{}}const t={};function e(e,o,n){let a;try{a=(0,eval)(n)}catch(t){if(t instanceof SyntaxError)return;throw t}const i=s(a),c=function(){throw new TypeError("Not available")};r(c,{prototype:{value:i},name:{value:e,writable:!1,enumerable:!1,configurable:!0}}),r(i,{constructor:{value:c}}),c!==Function.prototype.constructor&&l(c,Function.prototype.constructor),t[o]=c}return e("Function","%InertFunction%","(function(){})"),e("GeneratorFunction","%InertGeneratorFunction%","(function*(){})"),e("AsyncFunction","%InertAsyncFunction%","(async function(){})"),e("AsyncGeneratorFunction","%InertAsyncGeneratorFunction%","(async function*(){})"),t}()),E.addIntrinsics(function(t="safe"){if("safe"!==t&&"unsafe"!==t)throw new Error(`unrecognized dateTaming ${t}`);const e=Date,o=e.prototype,n={now:()=>NaN},a=({powers:t="none"}={})=>{let n;return n="original"===t?function(...t){return void 0===new.target?Reflect.apply(e,void 0,t):Reflect.construct(e,t,new.target)}:function(...t){return void 0===new.target?"Invalid Date":(0===t.length&&(t=[NaN]),Reflect.construct(e,t,new.target))},r(n,{length:{value:7},prototype:{value:o,writable:!1,enumerable:!1,configurable:!1},parse:{value:Date.parse,writable:!0,enumerable:!1,configurable:!0},UTC:{value:Date.UTC,writable:!0,enumerable:!1,configurable:!0}}),n},i=a({powers:"original"}),c=a({power:"none"});return r(i,{now:{value:Date.now,writable:!0,enumerable:!1,configurable:!0}}),r(c,{now:{value:n.now,writable:!0,enumerable:!1,configurable:!0}}),r(o,{constructor:{value:c}}),{"%InitialDate%":i,"%SharedDate%":c}}(y)),E.addIntrinsics(function(t="safe"){if("safe"!==t&&"unsafe"!==t)throw new Error(`unrecognized errorTaming ${t}`);const e=Error,o=e.prototype,n="function"==typeof e.captureStackTrace?"v8":"unknown",a=(t={})=>{const a=function(...t){let r;return r=void 0===new.target?g(e,this,t):d(e,t,new.target),"v8"===n&&e.captureStackTrace(r,a),r};return r(a,{length:{value:1},prototype:{value:o,writable:!1,enumerable:!1,configurable:!1}}),a},i=a({powers:"original"}),c=a({powers:"none"});r(o,{constructor:{value:c}});for(const t of lt)l(t,c);let s=yt.getStackString;return"v8"===n&&(s=ut(e,i,t)),{"%InitialGetStackString%":s,"%InitialError%":i,"%SharedError%":c}}(m)),E.addIntrinsics(function(t="safe"){if("safe"!==t&&"unsafe"!==t)throw new Error(`unrecognized mathTaming ${t}`);const r=Math,o=r,{random:n,...a}=i(r);return{"%InitialMath%":o,"%SharedMath%":e(Object.prototype,a)}}(P)),E.addIntrinsics(function(t="safe"){if("safe"!==t&&"unsafe"!==t)throw new Error(`unrecognized regExpTaming ${t}`);const e=RegExp,o=e.prototype,n=(t={})=>{const n=function(...t){return void 0===new.target?e(...t):Reflect.construct(e,t,new.target)};return r(n,{length:{value:2},prototype:{value:o,writable:!1,enumerable:!1,configurable:!1},[Symbol.species]:a(e,Symbol.species)}),n},i=n(),c=n();return"unsafe"!==t&&delete o.compile,r(o,{constructor:{value:c}}),{"%InitialRegExp%":i,"%SharedRegExp%":c}}(h)),E.addIntrinsics(function(){const t=Function.prototype.constructor,e=typeof Symbol&&Symbol.iterator||"@@iterator",r=typeof Symbol&&Symbol.matchAll||"@@matchAll",o=a(arguments,"callee").get,n=(new String)[e](),i=s(n),c=(new RegExp)[r](),p=s(c),u=(new Array)[e](),l=s(u),y=s(Float32Array),f=(new Map)[e](),g=s(f),d=(new Set)[e](),m=s(d),P=s(l);function*h(){}const b=St(h),S=b.prototype;async function*w(){}const E=St(w),I=E.prototype,T=I.prototype,A=s(T);async function v(){}const F=St(v),U={"%InertFunction%":t,"%ArrayIteratorPrototype%":l,"%InertAsyncFunction%":F,"%AsyncGenerator%":I,"%InertAsyncGeneratorFunction%":E,"%AsyncGeneratorPrototype%":T,"%AsyncIteratorPrototype%":A,"%Generator%":S,"%InertGeneratorFunction%":b,"%IteratorPrototype%":P,"%MapIteratorPrototype%":g,"%RegExpStringIteratorPrototype%":p,"%SetIteratorPrototype%":m,"%StringIteratorPrototype%":i,"%ThrowTypeError%":o,"%TypedArray%":y,"%InertCompartment%":ht,"%InertStaticModuleRecord%":bt};return U}()),E.completePrototypes();const I=E.finalIntrinsics();!function(t,e="safe"){if("safe"!==e&&"unsafe"!==e)throw new Error(`unrecognized dateTaming ${e}`);if("unsafe"!==e){f(String.prototype,"localeCompare",{value:Pt});for(const e of c(t)){const r=t[e];if(r===Object(r))for(const t of c(r)){const e=mt.exec(t);if(e){G("function"==typeof r[t],`expected ${t} to be a function`);const o=`${e[1]}${e[2]}`,n=r[o];G("function"==typeof n,`function ${o} not found`),f(r,t,{value:n})}}}}}(I,b);const T=function(){const t=new WeakSet,e=Function.prototype.toString,r={toString(){const r=g(e,this,[]);return r.endsWith(") { [native code] }")||!t.has(this)?r:`function ${this.name}() { [native code] }`}};return f(Function.prototype,"toString",{value:r.toString}),e=>t.add(e)}();return it(I,T),function(){try{(0,Object.prototype.__lookupGetter__)("x")}catch(t){return}function t(t){if(null==t)throw new TypeError("can't convert undefined or null to object");return Object(t)}function e(t){return"symbol"==typeof t?t:`${t}`}function o(t,e){if("function"!=typeof t)throw TypeError(`invalid ${e} usage`);return t}r(u,{__defineGetter__:{value:function(e,r){const n=t(this);f(n,e,{get:o(r,"getter"),enumerable:!0,configurable:!0})}},__defineSetter__:{value:function(e,r){const n=t(this);f(n,e,{set:o(r,"setter"),enumerable:!0,configurable:!0})}},__lookupGetter__:{value:function(r){let o,n=t(this);for(r=e(r);n&&!(o=a(n,r));)n=s(n);return o&&o.get}},__lookupSetter__:{value:function(r){let o,n=t(this);for(r=e(r);n&&!(o=a(n,r));)n=s(n);return o&&o.set}}})}(),function(t,e,r,{globalTransforms:n,nativeBrander:a,makeCompartmentConstructor:i}){for(const[e,r]of o(B))f(t,e,{value:r,writable:!1,enumerable:!1,configurable:!1});for(const[r,n]of o(j))A(e,n)&&f(t,r,{value:e[n],writable:!0,enumerable:!1,configurable:!0});for(const[n,a]of o(r))A(e,a)&&f(t,n,{value:e[a],writable:!0,enumerable:!1,configurable:!0});const c={globalThis:t,eval:Nt(t,{globalTransforms:n}),Function:Bt(t,{globalTransforms:n})};i&&(c.Compartment=i(e,a));for(const[e,r]of o(c))f(t,e,{value:r,writable:!0,enumerable:!1,configurable:!0}),"function"==typeof r&&a(r)}(globalThis,I,D,{nativeBrander:T,makeCompartmentConstructor:t}),function(){const t=function(t){const e={};function r(t,r,o,n){if("value"in n&&n.configurable){const{value:a}=n;e[t]=a,f(r,o,{get:function(){return a},set:function(e){if(r===this)throw new TypeError(`Cannot assign to read only property '${o}' of '${t}'`);hasOwnProperty.call(this,o)?this[o]=e:f(this,o,{value:e,writable:!0,enumerable:!0,configurable:!0})},enumerable:n.enumerable,configurable:n.configurable})}}function o(t,e,o){const n=a(e,o);n&&r(t,e,o,n)}function n(t,e){const o=i(e);o&>(o).forEach(n=>r(t,e,n,o[n]))}return function t(e,r,i){for(const s of c(i)){const c=a(r,s);if(!c||c.get||c.set)continue;const p=`${e}.${s}`,u=i[s];if(!0===u)o(p,r,s);else if("*"===u)n(p,c.value);else{if(!dt(u))throw new TypeError(`Unexpected override enablement plan ${p}`);t(p,c.value,u)}}}("root",t,ft),e}(I);return Lt(I),Lt(t),Dt=!0,!0}}var Vt;t(globalThis,{harden:t=>(G(Dt,"Cannot harden before lockdown"),Lt(t)),lockdown:(t={})=>zt(Vt,t)()})})); | ||
!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";const{assign:t,create:e,defineProperties:r,entries:o,freeze:n,getOwnPropertyDescriptor:a,getOwnPropertyDescriptors:i,getOwnPropertyNames:c,getPrototypeOf:s,keys:p,prototype:l,setPrototypeOf:u,values:y}=Object,f=(t,e,o)=>r(t,{[e]:o}),{apply:g,construct:m,get:d,set:P}=Reflect,{isArray:b,prototype:h}=Array,{revocable:S}=Proxy,{prototype:w}=RegExp,{prototype:E}=String,{prototype:I}=WeakMap,T=t=>(e,...r)=>g(t,e,r),A=T(l.hasOwnProperty),v=(T(h.filter),T(h.join)),F=(T(h.push),T(h.pop)),x=T(h.includes),U=T(w.test),k=(T(E.match),T(E.search)),_=T(E.slice),R=T(E.split),O=(T(I.get),T(I.set),T(I.has),n({__proto__:null}));function C(){const t=new WeakSet,e=Function.prototype.toString,r={toString(){const r=g(e,this,[]);return r.endsWith(") { [native code] }")||!t.has(this)?r:`function ${this.name}() { [native code] }`}};return f(Function.prototype,"toString",{value:r.toString}),e=>t.add(e)}const M={Infinity:1/0,NaN:NaN,undefined:void 0},N={isFinite:"isFinite",isNaN:"isNaN",parseFloat:"parseFloat",parseInt:"parseInt",decodeURI:"decodeURI",decodeURIComponent:"decodeURIComponent",encodeURI:"encodeURI",encodeURIComponent:"encodeURIComponent",Array:"Array",ArrayBuffer:"ArrayBuffer",BigInt:"BigInt",BigInt64Array:"BigInt64Array",BigUint64Array:"BigUint64Array",Boolean:"Boolean",DataView:"DataView",EvalError:"EvalError",Float32Array:"Float32Array",Float64Array:"Float64Array",Int8Array:"Int8Array",Int16Array:"Int16Array",Int32Array:"Int32Array",Map:"Map",Number:"Number",Object:"Object",Promise:"Promise",Proxy:"Proxy",RangeError:"RangeError",ReferenceError:"ReferenceError",Set:"Set",String:"String",Symbol:"Symbol",SyntaxError:"SyntaxError",TypeError:"TypeError",Uint8Array:"Uint8Array",Uint8ClampedArray:"Uint8ClampedArray",Uint16Array:"Uint16Array",Uint32Array:"Uint32Array",URIError:"URIError",WeakMap:"WeakMap",WeakSet:"WeakSet",JSON:"JSON",Reflect:"Reflect",escape:"escape",unescape:"unescape",lockdown:"lockdown",harden:"harden",HandledPromise:"HandledPromise",StaticModuleRecord:"StaticModuleRecord"},$={Date:"%InitialDate%",Error:"%InitialError%",RegExp:"%InitialRegExp%",Math:"%InitialMath%",getStackString:"%InitialGetStackString%"},G={Date:"%SharedDate%",Error:"%SharedError%",RegExp:"%SharedRegExp%",Math:"%SharedMath%"},j=[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError],B={"[[Proto]]":"%FunctionPrototype%",length:"number",name:"string"},D=B,L={get:D,set:"undefined"},W={get:D,set:D};function z(t){return t===L||t===W}function V(t){return{"[[Proto]]":"%SharedError%",prototype:t}}function Y(t){return{"[[Proto]]":"%ErrorPrototype%",constructor:t,message:"string",name:"string",toString:!1}}function H(t){return{"[[Proto]]":"%TypedArray%",BYTES_PER_ELEMENT:"number",prototype:t}}function J(t){return{"[[Proto]]":"%TypedArrayPrototype%",BYTES_PER_ELEMENT:"number",constructor:t}}const K={E:"number",LN10:"number",LN2:"number",LOG10E:"number",LOG2E:"number",PI:"number",SQRT1_2:"number",SQRT2:"number","@@toStringTag":"string",abs:D,acos:D,acosh:D,asin:D,asinh:D,atan:D,atanh:D,atan2:D,cbrt:D,ceil:D,clz32:D,cos:D,cosh:D,exp:D,expm1:D,floor:D,fround:D,hypot:D,imul:D,log:D,log1p:D,log10:D,log2:D,max:D,min:D,pow:D,round:D,sign:D,sin:D,sinh:D,sqrt:D,tan:D,tanh:D,trunc:D},q={"[[Proto]]":null,"%ThrowTypeError%":D,Infinity:"number",NaN:"number",undefined:"undefined","%UniqueEval%":D,isFinite:D,isNaN:D,parseFloat:D,parseInt:D,decodeURI:D,decodeURIComponent:D,encodeURI:D,encodeURIComponent:D,Object:{"[[Proto]]":"%FunctionPrototype%",assign:D,create:D,defineProperties:D,defineProperty:D,entries:D,freeze:D,fromEntries:D,getOwnPropertyDescriptor:D,getOwnPropertyDescriptors:D,getOwnPropertyNames:D,getOwnPropertySymbols:D,getPrototypeOf:D,is:D,isExtensible:D,isFrozen:D,isSealed:D,keys:D,preventExtensions:D,prototype:"%ObjectPrototype%",seal:D,setPrototypeOf:D,values:D},"%ObjectPrototype%":{"[[Proto]]":null,constructor:"Object",hasOwnProperty:D,isPrototypeOf:D,propertyIsEnumerable:D,toLocaleString:D,toString:D,valueOf:D,"--proto--":W,__defineGetter__:D,__defineSetter__:D,__lookupGetter__:D,__lookupSetter__:D},"%UniqueFunction%":{"[[Proto]]":"%FunctionPrototype%",prototype:"%FunctionPrototype%"},"%InertFunction%":{"[[Proto]]":"%FunctionPrototype%",prototype:"%FunctionPrototype%"},"%FunctionPrototype%":{apply:D,bind:D,call:D,constructor:"%InertFunction%",toString:D,"@@hasInstance":D,caller:!1,arguments:!1},Boolean:{"[[Proto]]":"%FunctionPrototype%",prototype:"%BooleanPrototype%"},"%BooleanPrototype%":{constructor:"Boolean",toString:D,valueOf:D},Symbol:{"[[Proto]]":"%FunctionPrototype%",asyncIterator:"symbol",for:D,hasInstance:"symbol",isConcatSpreadable:"symbol",iterator:"symbol",keyFor:D,match:"symbol",matchAll:"symbol",prototype:"%SymbolPrototype%",replace:"symbol",search:"symbol",species:"symbol",split:"symbol",toPrimitive:"symbol",toStringTag:"symbol",unscopables:"symbol"},"%SymbolPrototype%":{constructor:"Symbol",description:L,toString:D,valueOf:D,"@@toPrimitive":D,"@@toStringTag":"string"},"%InitialError%":{"[[Proto]]":"%FunctionPrototype%",prototype:"%ErrorPrototype%",captureStackTrace:D,stackTraceLimit:W,prepareStackTrace:W},"%SharedError%":{"[[Proto]]":"%FunctionPrototype%",prototype:"%ErrorPrototype%",captureStackTrace:D,stackTraceLimit:W,prepareStackTrace:W},"%ErrorPrototype%":{constructor:"%SharedError%",message:"string",name:"string",toString:D},EvalError:V("%EvalErrorPrototype%"),RangeError:V("%RangeErrorPrototype%"),ReferenceError:V("%ReferenceErrorPrototype%"),SyntaxError:V("%SyntaxErrorPrototype%"),TypeError:V("%TypeErrorPrototype%"),URIError:V("%URIErrorPrototype%"),"%EvalErrorPrototype%":Y("EvalError"),"%RangeErrorPrototype%":Y("RangeError"),"%ReferenceErrorPrototype%":Y("ReferenceError"),"%SyntaxErrorPrototype%":Y("SyntaxError"),"%TypeErrorPrototype%":Y("TypeError"),"%URIErrorPrototype%":Y("URIError"),Number:{"[[Proto]]":"%FunctionPrototype%",EPSILON:"number",isFinite:D,isInteger:D,isNaN:D,isSafeInteger:D,MAX_SAFE_INTEGER:"number",MAX_VALUE:"number",MIN_SAFE_INTEGER:"number",MIN_VALUE:"number",NaN:"number",NEGATIVE_INFINITY:"number",parseFloat:D,parseInt:D,POSITIVE_INFINITY:"number",prototype:"%NumberPrototype%"},"%NumberPrototype%":{constructor:"Number",toExponential:D,toFixed:D,toLocaleString:D,toPrecision:D,toString:D,valueOf:D},BigInt:{"[[Proto]]":"%FunctionPrototype%",asIntN:D,asUintN:D,prototype:"%BigIntPrototype%"},"%BigIntPrototype%":{constructor:"BigInt",toLocaleString:D,toString:D,valueOf:D,"@@toStringTag":"string"},"%InitialMath%":{...K,random:D},"%SharedMath%":K,"%InitialDate%":{"[[Proto]]":"%FunctionPrototype%",now:D,parse:D,prototype:"%DatePrototype%",UTC:D},"%SharedDate%":{"[[Proto]]":"%FunctionPrototype%",now:D,parse:D,prototype:"%DatePrototype%",UTC:D},"%DatePrototype%":{constructor:"%SharedDate%",getDate:D,getDay:D,getFullYear:D,getHours:D,getMilliseconds:D,getMinutes:D,getMonth:D,getSeconds:D,getTime:D,getTimezoneOffset:D,getUTCDate:D,getUTCDay:D,getUTCFullYear:D,getUTCHours:D,getUTCMilliseconds:D,getUTCMinutes:D,getUTCMonth:D,getUTCSeconds:D,setDate:D,setFullYear:D,setHours:D,setMilliseconds:D,setMinutes:D,setMonth:D,setSeconds:D,setTime:D,setUTCDate:D,setUTCFullYear:D,setUTCHours:D,setUTCMilliseconds:D,setUTCMinutes:D,setUTCMonth:D,setUTCSeconds:D,toDateString:D,toISOString:D,toJSON:D,toLocaleDateString:D,toLocaleString:D,toLocaleTimeString:D,toString:D,toTimeString:D,toUTCString:D,valueOf:D,"@@toPrimitive":D,getYear:D,setYear:D,toGMTString:D},String:{"[[Proto]]":"%FunctionPrototype%",fromCharCode:D,fromCodePoint:D,prototype:"%StringPrototype%",raw:D},"%StringPrototype%":{length:"number",charAt:D,charCodeAt:D,codePointAt:D,concat:D,constructor:"String",endsWith:D,includes:D,indexOf:D,lastIndexOf:D,localeCompare:D,match:D,matchAll:D,normalize:D,padEnd:D,padStart:D,repeat:D,replace:D,search:D,slice:D,split:D,startsWith:D,substring:D,toLocaleLowerCase:D,toLocaleUpperCase:D,toLowerCase:D,toString:D,toUpperCase:D,trim:D,trimEnd:D,trimStart:D,valueOf:D,"@@iterator":D,substr:D,anchor:D,big:D,blink:D,bold:D,fixed:D,fontcolor:D,fontsize:D,italics:D,link:D,small:D,strike:D,sub:D,sup:D,trimLeft:D,trimRight:D},"%StringIteratorPrototype%":{"[[Proto]]":"%IteratorPrototype%",next:D,"@@toStringTag":"string"},"%InitialRegExp%":{"[[Proto]]":"%FunctionPrototype%",prototype:"%RegExpPrototype%","@@species":L,input:!1,$_:!1,lastMatch:!1,"$&":!1,lastParen:!1,"$+":!1,leftContext:!1,"$`":!1,rightContext:!1,"$'":!1,$1:!1,$2:!1,$3:!1,$4:!1,$5:!1,$6:!1,$7:!1,$8:!1,$9:!1},"%SharedRegExp%":{"[[Proto]]":"%FunctionPrototype%",prototype:"%RegExpPrototype%","@@species":L},"%RegExpPrototype%":{constructor:"%SharedRegExp%",exec:D,dotAll:L,flags:L,global:L,ignoreCase:L,"@@match":D,"@@matchAll":D,multiline:L,"@@replace":D,"@@search":D,source:L,"@@split":D,sticky:L,test:D,toString:D,unicode:L,compile:!1},"%RegExpStringIteratorPrototype%":{"[[Proto]]":"%IteratorPrototype%",next:D,"@@toStringTag":"string"},Array:{"[[Proto]]":"%FunctionPrototype%",from:D,isArray:D,of:D,prototype:"%ArrayPrototype%","@@species":L},"%ArrayPrototype%":{length:"number",concat:D,constructor:"Array",copyWithin:D,entries:D,every:D,fill:D,filter:D,find:D,findIndex:D,flat:D,flatMap:D,forEach:D,includes:D,indexOf:D,join:D,keys:D,lastIndexOf:D,map:D,pop:D,push:D,reduce:D,reduceRight:D,reverse:D,shift:D,slice:D,some:D,sort:D,splice:D,toLocaleString:D,toString:D,unshift:D,values:D,"@@iterator":D,"@@unscopables":{"[[Proto]]":null,copyWithin:"boolean",entries:"boolean",fill:"boolean",find:"boolean",findIndex:"boolean",flat:"boolean",flatMap:"boolean",includes:"boolean",keys:"boolean",values:"boolean"}},"%ArrayIteratorPrototype%":{"[[Proto]]":"%IteratorPrototype%",next:D,"@@toStringTag":"string"},"%TypedArray%":{"[[Proto]]":"%FunctionPrototype%",from:D,of:D,prototype:"%TypedArrayPrototype%","@@species":L},"%TypedArrayPrototype%":{buffer:L,byteLength:L,byteOffset:L,constructor:"%TypedArray%",copyWithin:D,entries:D,every:D,fill:D,filter:D,find:D,findIndex:D,forEach:D,includes:D,indexOf:D,join:D,keys:D,lastIndexOf:D,length:L,map:D,reduce:D,reduceRight:D,reverse:D,set:D,slice:D,some:D,sort:D,subarray:D,toLocaleString:D,toString:D,values:D,"@@iterator":D,"@@toStringTag":L},BigInt64Array:H("%BigInt64ArrayPrototype%"),BigUint64Array:H("%BigUint64ArrayPrototype%"),Float32Array:H("%Float32ArrayPrototype%"),Float64Array:H("%Float64ArrayPrototype%"),Int16Array:H("%Int16ArrayPrototype%"),Int32Array:H("%Int32ArrayPrototype%"),Int8Array:H("%Int8ArrayPrototype%"),Uint16Array:H("%Uint16ArrayPrototype%"),Uint32Array:H("%Uint32ArrayPrototype%"),Uint8Array:H("%Uint8ArrayPrototype%"),Uint8ClampedArray:H("%Uint8ClampedArrayPrototype%"),"%BigInt64ArrayPrototype%":J("BigInt64Array"),"%BigUint64ArrayPrototype%":J("BigUint64Array"),"%Float32ArrayPrototype%":J("Float32Array"),"%Float64ArrayPrototype%":J("Float64Array"),"%Int16ArrayPrototype%":J("Int16Array"),"%Int32ArrayPrototype%":J("Int32Array"),"%Int8ArrayPrototype%":J("Int8Array"),"%Uint16ArrayPrototype%":J("Uint16Array"),"%Uint32ArrayPrototype%":J("Uint32Array"),"%Uint8ArrayPrototype%":J("Uint8Array"),"%Uint8ClampedArrayPrototype%":J("Uint8ClampedArray"),Map:{"[[Proto]]":"%FunctionPrototype%","@@species":L,prototype:"%MapPrototype%"},"%MapPrototype%":{clear:D,constructor:"Map",delete:D,entries:D,forEach:D,get:D,has:D,keys:D,set:D,size:L,values:D,"@@iterator":D,"@@toStringTag":"string"},"%MapIteratorPrototype%":{"[[Proto]]":"%IteratorPrototype%",next:D,"@@toStringTag":"string"},Set:{"[[Proto]]":"%FunctionPrototype%",prototype:"%SetPrototype%","@@species":L},"%SetPrototype%":{add:D,clear:D,constructor:"Set",delete:D,entries:D,forEach:D,has:D,keys:D,size:L,values:D,"@@iterator":D,"@@toStringTag":"string"},"%SetIteratorPrototype%":{"[[Proto]]":"%IteratorPrototype%",next:D,"@@toStringTag":"string"},WeakMap:{"[[Proto]]":"%FunctionPrototype%",prototype:"%WeakMapPrototype%"},"%WeakMapPrototype%":{constructor:"WeakMap",delete:D,get:D,has:D,set:D,"@@toStringTag":"string"},WeakSet:{"[[Proto]]":"%FunctionPrototype%",prototype:"%WeakSetPrototype%"},"%WeakSetPrototype%":{add:D,constructor:"WeakSet",delete:D,has:D,"@@toStringTag":"string"},ArrayBuffer:{"[[Proto]]":"%FunctionPrototype%",isView:D,prototype:"%ArrayBufferPrototype%","@@species":L},"%ArrayBufferPrototype%":{byteLength:L,constructor:"ArrayBuffer",slice:D,"@@toStringTag":"string"},SharedArrayBuffer:!1,"%SharedArrayBufferPrototype%":!1,DataView:{"[[Proto]]":"%FunctionPrototype%",prototype:"%DataViewPrototype%"},"%DataViewPrototype%":{buffer:L,byteLength:L,byteOffset:L,constructor:"DataView",getBigInt64:D,getBigUint64:D,getFloat32:D,getFloat64:D,getInt8:D,getInt16:D,getInt32:D,getUint8:D,getUint16:D,getUint32:D,setBigInt64:D,setBigUint64:D,setFloat32:D,setFloat64:D,setInt8:D,setInt16:D,setInt32:D,setUint8:D,setUint16:D,setUint32:D,"@@toStringTag":"string"},Atomics:!1,JSON:{parse:D,stringify:D,"@@toStringTag":"string"},"%IteratorPrototype%":{"@@iterator":D},"%AsyncIteratorPrototype%":{"@@asyncIterator":D},"%InertGeneratorFunction%":{"[[Proto]]":"%InertFunction%",prototype:"%Generator%"},"%Generator%":{"[[Proto]]":"%FunctionPrototype%",constructor:"%InertGeneratorFunction%",prototype:"%GeneratorPrototype%","@@toStringTag":"string"},"%InertAsyncGeneratorFunction%":{"[[Proto]]":"%InertFunction%",prototype:"%AsyncGenerator%"},"%AsyncGenerator%":{"[[Proto]]":"%FunctionPrototype%",constructor:"%InertAsyncGeneratorFunction%",prototype:"%AsyncGeneratorPrototype%","@@toStringTag":"string"},"%GeneratorPrototype%":{"[[Proto]]":"%IteratorPrototype%",constructor:"%Generator%",next:D,return:D,throw:D,"@@toStringTag":"string"},"%AsyncGeneratorPrototype%":{"[[Proto]]":"%AsyncIteratorPrototype%",constructor:"%AsyncGenerator%",next:D,return:D,throw:D,"@@toStringTag":"string"},HandledPromise:{"[[Proto]]":"Promise",applyFunction:D,applyFunctionSendOnly:D,applyMethod:D,applyMethodSendOnly:D,get:D,getSendOnly:D,prototype:"%PromisePrototype%",resolve:D},Promise:{"[[Proto]]":"%FunctionPrototype%",all:D,allSettled:D,prototype:"%PromisePrototype%",race:D,reject:D,resolve:D,"@@species":L},"%PromisePrototype%":{catch:D,constructor:"Promise",finally:D,then:D,"@@toStringTag":"string"},"%InertAsyncFunction%":{"[[Proto]]":"%InertFunction%",prototype:"%AsyncFunctionPrototype%"},"%AsyncFunctionPrototype%":{"[[Proto]]":"%FunctionPrototype%",constructor:"%InertAsyncFunction%","@@toStringTag":"string"},Reflect:{apply:D,construct:D,defineProperty:D,deleteProperty:D,get:D,getOwnPropertyDescriptor:D,getPrototypeOf:D,has:D,isExtensible:D,ownKeys:D,preventExtensions:D,set:D,setPrototypeOf:D},Proxy:{"[[Proto]]":"%FunctionPrototype%",revocable:D},escape:D,unescape:D,"%UniqueCompartment%":{"[[Proto]]":"%FunctionPrototype%",prototype:"%CompartmentPrototype%",toString:D},"%InertCompartment%":{"[[Proto]]":"%FunctionPrototype%",prototype:"%CompartmentPrototype%",toString:D},"%CompartmentPrototype%":{constructor:"%InertCompartment%",evaluate:D,globalThis:L,name:L,toString:D},lockdown:D,harden:D,"%InitialGetStackString%":D};function Q(t,e,r){if(A(t,e)){const o=a(t,e);if(!Object.is(o.value,r.value)||o.get!==r.get||o.set!==r.set||o.writable!==r.writable||o.enumerable!==r.enumerable||o.configurable!==r.configurable)throw new Error("Conflicting definitions of "+e)}f(t,e,r)}function X(t,e){const r={__proto__:null};for(const[n,a]of o(e))A(t,n)&&(r[a]=t[n]);return r}function Z(){const t={__proto__:null};let e;const r={addIntrinsics(e){!function(t,e){for(const[r,n]of o(e))Q(t,r,n)}(t,i(e))},completePrototypes(){for(const[e,r]of o(t)){if(r!==Object(r))continue;if(!A(r,"prototype"))continue;const o=q[e];if("object"!=typeof o)throw new Error("Expected permit object at whitelist."+e);const n=o.prototype;if(!n)throw new Error(e+".prototype property not whitelisted");if("string"!=typeof n||!A(q,n))throw new Error(`Unrecognized ${e}.prototype whitelist entry`);const a=r.prototype;if(A(t,n)){if(t[n]!==a)throw new Error("Conflicting bindings of "+n)}else t[n]=a}},finalIntrinsics:()=>(n(t),e=new WeakSet(y(t).filter(t=>"function"==typeof t)),t),isPseudoNative(t){if(!e)throw new Error("isPseudoNative can only be called after finalIntrinsics");return e.has(t)}};return r.addIntrinsics(M),r.addIntrinsics(X(globalThis,N)),r}const{freeze:tt,getOwnPropertyDescriptors:et,getPrototypeOf:rt}=Object,{ownKeys:ot}=Reflect;function nt(t,e){if(!t)throw new TypeError(e)}const{apply:at,ownKeys:it}=Reflect,ct=(t=>(e,...r)=>at(t,e,r))(Object.prototype.hasOwnProperty);function st(t,e){if("string"==typeof e)return e;if("symbol"==typeof e)return"@@"+e.toString().slice(14,-1);throw new TypeError(`Unexpected property name type ${t} ${e}`)}function pt(t,e){const r=["undefined","boolean","number","string","symbol"];function o(e,o,n,a){if("object"==typeof a)return c(e,o,a),!0;if(!1===a)return!1;if("string"==typeof a)if("prototype"===n||"constructor"===n){if(ct(t,a)){if(o!==t[a])throw new TypeError("Does not match whitelist "+e);return!0}}else if(r.includes(a)){if(typeof o!==a)throw new TypeError(`At ${e} expected ${a} not ${typeof o}`);return!0}throw new TypeError(`Unexpected whitelist permit ${a} at ${e}`)}function n(t,e,r,n){const i=a(e,r);if(ct(i,"value")){if(z(n))throw new TypeError("Accessor expected at "+t);return o(t,i.value,r,n)}if(!z(n))throw new TypeError("Accessor not expected at "+t);return o(t+"<get>",i.get,r,n.get)&&o(t+"<set>",i.set,r,n.set)}function i(t,r,o){const n="__proto__"===o?"--proto--":o;return ct(r,n)?r[n]:"function"==typeof t&&(e(t),ct(B,n))?B[n]:void 0}function c(e,r,o){if(void 0===r)return;!function(e,r,o){if(r!==Object(r))throw new TypeError(`Object expected: ${e}, ${r}, ${o}`);const n=s(r);if(null!==n||null!==o){if(void 0!==o&&"string"!=typeof o)throw new TypeError(`Malformed whitelist permit ${e}.__proto__`);if(n!==t[o||"%ObjectPrototype%"])throw new Error(`Unexpected intrinsic ${e}.__proto__ at ${o}`)}}(e,r,o["[[Proto]]"]);for(const t of it(r)){const a=st(e,t),c=`${e}.${a}`,s=i(r,o,a);s&&n(c,r,t,s)||(!1!==s&&console.log("Removing "+c),delete r[t])}}c("intrinsics",t,q)}const lt=["getTypeName","getFunctionName","getMethodName","getFileName","getLineNumber","getColumnNumber","getEvalOrigin","isToplevel","isEval","isNative","isConstructor","isAsync","getPosition","getScriptNameOrSourceURL","toString"],ut=t=>{const e=Object.fromEntries(lt.map(e=>[e,()=>t[e]()]));return Object.create(e,{})},yt=(t,e)=>[""+t,...e.map(t=>"\n at "+t)].join("");function ft(t,e,o){const n=new WeakMap,a={captureStackTrace(e,r=a.captureStackTrace){"function"!=typeof t.captureStackTrace?Reflect.set(e,"stack",""):t.captureStackTrace(e,r)},getStackString(t){n.has(t)||t.stack;const e=n.get(t);return e?yt(t,e):""},prepareStackTrace:(t,e)=>(n.set(t,e),"unsafe"===o?yt(t,e):"")},i=a.prepareStackTrace;t.prepareStackTrace=i;const c=new WeakSet([i]),s=t=>{if(c.has(t))return t;const e={prepareStackTrace:(e,r)=>(n.set(e,r),t(e,(t=>t.map(ut))(r)))};return c.add(e.prepareStackTrace),e.prepareStackTrace};return r(e,{captureStackTrace:{value:a.captureStackTrace,writable:!0,enumerable:!1,configurable:!0},stackTraceLimit:{get(){if("number"==typeof t.stackTraceLimit)return t.stackTraceLimit},set(e){"number"!=typeof t.stackTraceLimit||(t.stackTraceLimit=e)},enumerable:!1,configurable:!0},prepareStackTrace:{get:()=>t.prepareStackTrace,set(e){if("function"==typeof e){const r=s(e);t.prepareStackTrace=r}else t.prepareStackTrace=i},enumerable:!1,configurable:!0}}),a.getStackString}const gt={getStackString:t=>""};var mt={"%ObjectPrototype%":"*","%ArrayPrototype%":"*","%FunctionPrototype%":{constructor:!0,bind:!0,apply:!0,name:!0,toString:!0},"%ErrorPrototype%":{constructor:!0,message:!0,name:!0,toString:!0},"%TypeErrorPrototype%":{constructor:!0,message:!0,name:!0},"%SyntaxErrorPrototype%":{message:!0},"%RangeErrorPrototype%":{message:!0},"%URIErrorPrototype%":{message:!0},"%EvalErrorPrototype%":{message:!0},"%ReferenceErrorPrototype%":{message:!0},"%PromisePrototype%":{constructor:!0},"%TypedArrayPrototype%":"*","%Generator%":{constructor:!0,name:!0,toString:!0},"%IteratorPrototype%":"*"};const{ownKeys:dt}=Reflect;function Pt(t){return null!==t&&"object"==typeof t}const bt=/^(\w*[a-z])Locale([A-Z]\w*)$/,ht={localeCompare(t){if(null==this)throw new TypeError('Cannot localeCompare with null or undefined "this" value');const e=""+this;return e<(t=""+t)?-1:e>t?1:(nt(e===t,`expected ${e} and ${t} to compare`),0)}}.localeCompare;const St=function(t={},e={},r={}){throw new TypeError("Not available")},wt=function(t,e){throw new TypeError("Not available")};function Et(t){return s(t).constructor}function It(t,e){const r="please report internal shim error: "+t;throw console.error(r),e&&(console.error(""+e),console.error(""+e.stack)),TypeError(r)}function Tt(t,e){t||It(e)}const At=["await","break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","let","static","enum","implements","package","protected","interface","private","public","await","null","true","false","this","arguments"],vt=new RegExp("^[a-zA-Z_$][\\w$]*$");function Ft(t){return"eval"!==t&&!x(At,t)&&U(vt,t)}function xt(t,e){const r=a(t,e);return!1===r.configurable&&!1===r.writable&&A(r,"value")}const Ut=eval,kt=new Proxy(O,{get(t,e){It("unexpected scope handler trap called: "+String(e))}});function _t(t,e){const r=k(t,e);return r<0?-1:R(_(t,0,r),"\n").length}const Rt=new RegExp("(?:\x3c!--|--\x3e)");const Ot=new RegExp("\\bimport\\s*(?:\\(|/[/*])");const Ct=new RegExp("\\beval\\s*(?:\\(|/[/*])");function Mt(t){return t=function(t){const e=_t(t,Ct);if(e<0)return t;throw new SyntaxError("possible direct eval expression rejected around line "+e)}(t=function(t){const e=_t(t,Ot);if(e<0)return t;throw new SyntaxError("possible import expression rejected around line "+e)}(t=function(t){const e=_t(t,Rt);if(e<0)return t;throw new SyntaxError("possible html comment syntax rejected around line "+e)}(t)))}const Nt=Function;function $t(t=[]){const e=function(t){return 0===t.length?"":`const {${v(t,",")}} = this;`}(t);return Nt(`\n with (this) {\n ${e}\n return function() {\n 'use strict';\n return eval(arguments[0]);\n };\n }\n `)}function Gt(t,e,r={},{localTransforms:o=[],globalTransforms:n=[],sloppyGlobalsMode:i=!1}={}){t=function(t,e){for(const r of e)t=r(t);return t}(t,[...o,...n,Mt]);const s=function(t,e={},{sloppyGlobalsMode:r=!1}={}){return{__proto__:kt,useUnsafeEvaluator:!1,get(r,o){if("symbol"!=typeof o)return"eval"===o&&!0===this.useUnsafeEvaluator?(this.useUnsafeEvaluator=!1,Ut):o in e?d(e,o,t):d(t,o)},set(r,o,n){if(o in e){return"value"in a(e,o)?P(e,o,n):P(e,o,n,t)}return P(t,o,n)},has:(o,n)=>!!(r||"eval"===n||n in e||n in t||n in globalThis),getPrototypeOf:()=>null,getOwnPropertyDescriptor(t,e){const r=JSON.stringify(String(e));console.warn("getOwnPropertyDescriptor trap on scopeHandler for "+r,(new Error).stack)}}}(e,r,{sloppyGlobalsMode:i}),p=S(O,s),l=$t(function(t,e={}){const r=c(t),o=c(e),n=o.filter(t=>Ft(t)&&xt(e,t));return[...r.filter(e=>!o.includes(e)&&Ft(e)&&xt(t,e)),...n]}(e,r)),u=g(l,p.proxy,[]);let y;s.useUnsafeEvaluator=!0;try{return g(u,e,[t])}catch(t){throw y=t,t}finally{!0===s.useUnsafeEvaluator&&(It("handler did not revoke useUnsafeEvaluator",y),p.revoke())}}const jt=(t,e={})=>r=>"string"!=typeof r?r:Gt(r,t,{},e),Bt=Function;function Dt(t,e={}){const o=function(r){const o=""+(F(arguments)||""),n=""+v(arguments,",");new Bt(n,o);const a=`(function anonymous(${n}\n) {\n${o}\n})`;return Gt(a,t,{},e)};return r(o,{prototype:{value:Function.prototype,writable:!1,enumerable:!1,configurable:!1}}),Tt(s(Function)===Function.prototype,"Function prototype is the same accross compartments"),Tt(s(o)===Function.prototype,"Function constructor prototype is the same accross compartments"),o}function Lt(t,e,r,n,a,{globalTransforms:i,nativeBrander:c}){for(const[e,r]of o(M))f(t,e,{value:r,writable:!1,enumerable:!1,configurable:!1});for(const[r,n]of o(N))A(e,n)&&f(t,r,{value:e[n],writable:!0,enumerable:!1,configurable:!0});for(const[n,a]of o(r))A(e,a)&&f(t,n,{value:e[a],writable:!0,enumerable:!1,configurable:!0});const s={globalThis:t,eval:jt(t,{globalTransforms:i}),Function:Dt(t,{globalTransforms:i})};s.Compartment=n(n,e,c);for(const[e,r]of o(s))f(t,e,{value:r,writable:!0,enumerable:!1,configurable:!0}),"function"==typeof r&&c(r)}let Wt,zt=!1;const Vt=function(){if(arguments.length>=1)throw new TypeError("makeHardener no longer takes any options");const t=new WeakSet,{harden:e}={harden(e){const r=new Set,o=new Map,n=new WeakMap;function a(e,o){if(Object(e)!==e)return;const a=typeof e;if("object"!==a&&"function"!==a)throw new TypeError("Unexpected typeof: "+a);t.has(e)||r.has(e)||(r.add(e),n.set(e,o))}function i(t){tt(t);const e=rt(t),r=et(t),i=n.get(t)||"unknown";null===e||o.has(e)||(o.set(e,i),n.set(e,i+".__proto__")),ot(r).forEach(t=>{const e=`${i}.${String(t)}`,o=r[t];"value"in o?a(o.value,""+e):(a(o.get,e+"(get)"),a(o.set,e+"(set)"))})}return a(e),r.forEach(i),o.forEach((e,o)=>{if(!r.has(o)&&!t.has(o)){let t;try{t=`prototype ${o} of ${e} is not already in the fringeSet`}catch(r){t="a prototype of something is not already in the fringeset (and .toString failed)";try{console.log(t),console.log("the prototype:",o),console.log("of something:",e)}catch(t){}}throw new TypeError(t)}}),r.forEach(t.add,t),e}};return e}(),Yt=()=>!1;function Ht(t,o,n={}){n={...Wt,...n};const{dateTaming:y="safe",errorTaming:d="safe",mathTaming:P="safe",regExpTaming:b="safe",localeTaming:h="safe",...S}=n,w=Reflect.ownKeys(S);if(nt(0===w.length,"lockdown(): non supported option "+w.join(", ")),Wt){for(const t of p(Wt))nt(n[t]===Wt[t],"lockdown(): cannot re-invoke with different option "+t);return Yt}Wt={dateTaming:y,errorTaming:d,mathTaming:P,regExpTaming:b,localeTaming:h};const E=Z();E.addIntrinsics(function(){try{(0,Function.prototype.constructor)("return 1")}catch(t){return{}}const t={};function e(e,o,n){let a;try{a=(0,eval)(n)}catch(t){if(t instanceof SyntaxError)return;throw t}const i=s(a),c=function(){throw new TypeError("Not available")};r(c,{prototype:{value:i},name:{value:e,writable:!1,enumerable:!1,configurable:!0}}),r(i,{constructor:{value:c}}),c!==Function.prototype.constructor&&u(c,Function.prototype.constructor),t[o]=c}return e("Function","%InertFunction%","(function(){})"),e("GeneratorFunction","%InertGeneratorFunction%","(function*(){})"),e("AsyncFunction","%InertAsyncFunction%","(async function(){})"),e("AsyncGeneratorFunction","%InertAsyncGeneratorFunction%","(async function*(){})"),t}()),E.addIntrinsics(function(t="safe"){if("safe"!==t&&"unsafe"!==t)throw new Error("unrecognized dateTaming "+t);const e=Date,o=e.prototype,n={now:()=>NaN},a=({powers:t="none"}={})=>{let n;return n="original"===t?function(...t){return void 0===new.target?Reflect.apply(e,void 0,t):Reflect.construct(e,t,new.target)}:function(...t){return void 0===new.target?"Invalid Date":(0===t.length&&(t=[NaN]),Reflect.construct(e,t,new.target))},r(n,{length:{value:7},prototype:{value:o,writable:!1,enumerable:!1,configurable:!1},parse:{value:Date.parse,writable:!0,enumerable:!1,configurable:!0},UTC:{value:Date.UTC,writable:!0,enumerable:!1,configurable:!0}}),n},i=a({powers:"original"}),c=a({power:"none"});return r(i,{now:{value:Date.now,writable:!0,enumerable:!1,configurable:!0}}),r(c,{now:{value:n.now,writable:!0,enumerable:!1,configurable:!0}}),r(o,{constructor:{value:c}}),{"%InitialDate%":i,"%SharedDate%":c}}(y)),E.addIntrinsics(function(t="safe"){if("safe"!==t&&"unsafe"!==t)throw new Error("unrecognized errorTaming "+t);const e=Error,o=e.prototype,n="function"==typeof e.captureStackTrace?"v8":"unknown",a=(t={})=>{const a=function(...t){let r;return r=void 0===new.target?g(e,this,t):m(e,t,new.target),"v8"===n&&e.captureStackTrace(r,a),r};return r(a,{length:{value:1},prototype:{value:o,writable:!1,enumerable:!1,configurable:!1}}),a},i=a({powers:"original"}),c=a({powers:"none"});r(o,{constructor:{value:c}});for(const t of j)u(t,c);let s=gt.getStackString;return"v8"===n&&(s=ft(e,i,t)),{"%InitialGetStackString%":s,"%InitialError%":i,"%SharedError%":c}}(d)),E.addIntrinsics(function(t="safe"){if("safe"!==t&&"unsafe"!==t)throw new Error("unrecognized mathTaming "+t);const r=Math,o=r,{random:n,...a}=i(r);return{"%InitialMath%":o,"%SharedMath%":e(Object.prototype,a)}}(P)),E.addIntrinsics(function(t="safe"){if("safe"!==t&&"unsafe"!==t)throw new Error("unrecognized regExpTaming "+t);const e=RegExp,o=e.prototype,n=(t={})=>{const n=function(...t){return void 0===new.target?e(...t):Reflect.construct(e,t,new.target)};return r(n,{length:{value:2},prototype:{value:o,writable:!1,enumerable:!1,configurable:!1},[Symbol.species]:a(e,Symbol.species)}),n},i=n(),c=n();return"unsafe"!==t&&delete o.compile,r(o,{constructor:{value:c}}),{"%InitialRegExp%":i,"%SharedRegExp%":c}}(b)),E.addIntrinsics(function(){const t=Function.prototype.constructor,e=typeof Symbol&&Symbol.iterator||"@@iterator",r=typeof Symbol&&Symbol.matchAll||"@@matchAll",o=a(arguments,"callee").get,n=(new String)[e](),i=s(n),c=(new RegExp)[r](),p=s(c),l=(new Array)[e](),u=s(l),y=s(Float32Array),f=(new Map)[e](),g=s(f),m=(new Set)[e](),d=s(m),P=s(u);function*b(){}const h=Et(b),S=h.prototype;async function*w(){}const E=Et(w),I=E.prototype,T=I.prototype,A=s(T);async function v(){}const F=Et(v),x={"%InertFunction%":t,"%ArrayIteratorPrototype%":u,"%InertAsyncFunction%":F,"%AsyncGenerator%":I,"%InertAsyncGeneratorFunction%":E,"%AsyncGeneratorPrototype%":T,"%AsyncIteratorPrototype%":A,"%Generator%":S,"%InertGeneratorFunction%":h,"%IteratorPrototype%":P,"%MapIteratorPrototype%":g,"%RegExpStringIteratorPrototype%":p,"%SetIteratorPrototype%":d,"%StringIteratorPrototype%":i,"%ThrowTypeError%":o,"%TypedArray%":y,"%InertCompartment%":St,"%InertStaticModuleRecord%":wt};return x}()),E.completePrototypes();const I=E.finalIntrinsics();!function(t,e="safe"){if("safe"!==e&&"unsafe"!==e)throw new Error("unrecognized dateTaming "+e);if("unsafe"!==e){f(String.prototype,"localeCompare",{value:ht});for(const e of c(t)){const r=t[e];if(r===Object(r))for(const t of c(r)){const e=bt.exec(t);if(e){nt("function"==typeof r[t],`expected ${t} to be a function`);const o=`${e[1]}${e[2]}`,n=r[o];nt("function"==typeof n,`function ${o} not found`),f(r,t,{value:n})}}}}}(I,h);const T=C();return pt(I,T),function(){try{(0,Object.prototype.__lookupGetter__)("x")}catch(t){return}function t(t){if(null==t)throw new TypeError("can't convert undefined or null to object");return Object(t)}function e(t){return"symbol"==typeof t?t:""+t}function o(t,e){if("function"!=typeof t)throw TypeError(`invalid ${e} usage`);return t}r(l,{__defineGetter__:{value:function(e,r){const n=t(this);f(n,e,{get:o(r,"getter"),enumerable:!0,configurable:!0})}},__defineSetter__:{value:function(e,r){const n=t(this);f(n,e,{set:o(r,"setter"),enumerable:!0,configurable:!0})}},__lookupGetter__:{value:function(r){let o,n=t(this);for(r=e(r);n&&!(o=a(n,r));)n=s(n);return o&&o.get}},__lookupSetter__:{value:function(r){let o,n=t(this);for(r=e(r);n&&!(o=a(n,r));)n=s(n);return o&&o.set}}})}(),Lt(globalThis,I,$,t,0,{nativeBrander:T}),function(){const t=function(t){const e={};function r(t,r,o,n){if("value"in n&&n.configurable){const{value:a}=n;e[t]=a,f(r,o,{get:function(){return a},set:function(e){if(r===this)throw new TypeError(`Cannot assign to read only property '${o}' of '${t}'`);hasOwnProperty.call(this,o)?this[o]=e:f(this,o,{value:e,writable:!0,enumerable:!0,configurable:!0})},enumerable:n.enumerable,configurable:n.configurable})}}function o(t,e,o){const n=a(e,o);n&&r(t,e,o,n)}function n(t,e){const o=i(e);o&&dt(o).forEach(n=>r(t,e,n,o[n]))}return function t(e,r,i){for(const s of c(i)){const c=a(r,s);if(!c||c.get||c.set)continue;const p=`${e}.${s}`,l=i[s];if(!0===l)o(p,r,s);else if("*"===l)n(p,c.value);else{if(!Pt(l))throw new TypeError("Unexpected override enablement plan "+p);t(p,c.value,l)}}}("root",t,mt),e}(I);return Vt(I),Vt(t),zt=!0,!0}}const Jt=new WeakMap,Kt={constructor:St,get globalThis(){return Jt.get(this).globalObject},get name(){return Jt.get(this).name},evaluate(t,o={}){if("string"!=typeof t)throw new TypeError("first argument of evaluate() must be a string");const{transforms:n=[],sloppyGlobalsMode:a=!1,__moduleShimLexicals__:c}=o,s=[...n],{globalTransforms:p,globalObject:l,globalLexicals:u}=Jt.get(this);let y=u;return void 0!==c&&(y=e(null,i(u)),r(y,i(c))),Gt(t,l,y,{globalTransforms:p,localTransforms:s,sloppyGlobalsMode:a})},toString:()=>"[object Compartment]"};r(St,{prototype:{value:Kt}});const qt=(e,r,o)=>{function a(a={},i={},s={}){if(void 0===new.target)throw new TypeError("Class constructor Compartment cannot be invoked without 'new'");const{name:p="<unknown>",transforms:l=[],globalLexicals:u={}}=s,y=[...l],f={};Lt(f,r,G,e,this.constructor.prototype,{globalTransforms:y,nativeBrander:o}),t(f,a);const g=c(u).filter(t=>!Ft(t));if(g.length)throw new Error(`Cannot create compartment with invalid names for global lexicals: ${g.join(", ")}; these names would not be lexically mentionable`);Jt.set(this,{name:p,globalTransforms:y,globalObject:f,globalLexicals:n({...u})})}return a.prototype=Kt,a},Qt=C(),Xt=qt(qt,function(t){const e=Z();return e.addIntrinsics(X(t,G)),e.finalIntrinsics()}(globalThis),Qt);t(globalThis,{harden:t=>(nt(zt,"Cannot harden before lockdown"),Vt(t)),lockdown:((t,e)=>(e={})=>Ht(t,0,e)())(qt),Compartment:Xt})})); |
@@ -0,7 +1,40 @@ | ||
// Copyright (C) 2018 Agoric | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// Importing the lower-layer "./lockdown.js" ensures that we run later and | ||
// replace its global lockdown if an application elects to import both. | ||
import { assign } from './src/commons.js'; | ||
import { tameFunctionToString } from './src/tame-function-tostring.js'; | ||
import { getGlobalIntrinsics } from './src/intrinsics.js'; | ||
import { makeLockdown, harden } from './src/lockdown-shim.js'; | ||
import { | ||
makeCompartmentConstructor, | ||
CompartmentPrototype, | ||
} from './src/compartment-shim.js'; | ||
// TODO wasteful to do it twice, once before lockdown and again during | ||
// lockdown. The second is doubly indirect. We should at least flatten that. | ||
const nativeBrander = tameFunctionToString(); | ||
const Compartment = makeCompartmentConstructor( | ||
makeCompartmentConstructor, | ||
getGlobalIntrinsics(globalThis), | ||
nativeBrander, | ||
); | ||
assign(globalThis, { | ||
harden, | ||
lockdown: makeLockdown(), | ||
lockdown: makeLockdown(makeCompartmentConstructor, CompartmentPrototype), | ||
Compartment, | ||
}); |
{ | ||
"name": "ses", | ||
"version": "0.10.2", | ||
"version": "0.10.3", | ||
"description": "Secure ECMAScript", | ||
@@ -32,3 +32,4 @@ "author": "Agoric", | ||
"lint-fix": "eslint --fix '**/*.js'", | ||
"test": "yarn build && tap --no-esm --no-coverage --reporter spec 'test/**/*.test.js'", | ||
"qt": "tap --no-esm --no-coverage --reporter spec 'test/**/*.test.js'", | ||
"test": "yarn build && yarn qt", | ||
"test262": "tap --no-esm --no-coverage --reporter spec test262/*.js", | ||
@@ -41,3 +42,3 @@ "build": "rollup --config rollup.config.js", | ||
"@agoric/make-hardener": "^0.1.0", | ||
"@agoric/transform-module": "^0.4.0" | ||
"@agoric/transform-module": "^0.4.1" | ||
}, | ||
@@ -44,0 +45,0 @@ "devDependencies": { |
@@ -152,2 +152,3 @@ # Secure EcmaScript (SES) | ||
const c1 = new Compartment({}, {}, { | ||
name: "first compartment", | ||
resolveHook: (moduleSpecifier, moduleReferrer) => { | ||
@@ -175,2 +176,3 @@ return resolve(moduleSpecifier, moduleReferrer); | ||
}, { | ||
name: "second compartment", | ||
resolveHook, | ||
@@ -181,2 +183,78 @@ importHook, | ||
### importHook aliases | ||
If a compartment imports a module specified as `"./utility"` but actually | ||
implemented by an alias like `"./utility/index.js"`, the `importHook` may | ||
follow redirects, symbolic links, or search for candidates using its own logic | ||
and return a module that has a different "response specifier" than the original | ||
"request specifier". | ||
The `importHook` may return an "alias" objeect with `record`, `compartment`, | ||
and `module` properties. | ||
- `record` must be a `StaticModuleRecord`, | ||
- `compartment` is optional, to be specified if the alias transits to a | ||
different compartment, and | ||
- `specifier` is the full module specifier of the module in its compartment. | ||
This defaults to the request specifier, which is only useful if the | ||
compartment is different. | ||
In the following example, the importHook searches for a file and returns an | ||
alias. | ||
```js | ||
const importHook = async specifier => { | ||
const candidates = [specifier, `${specifier}.js`, `${specifier}/index.js`]; | ||
for (const candidate of candidates) { | ||
const record = await wrappedImportHook(candidate).catch(_ => undefined); | ||
if (record !== undefined) { | ||
return { record, specifier }; | ||
} | ||
} | ||
throw new Error(`Cannot find module ${specifier}`); | ||
}; | ||
const compartment = new Compartment({}, {}, { | ||
resolveHook, | ||
importHook, | ||
}); | ||
``` | ||
### moduleMapHook | ||
The module map above allows modules to be introduced to a compartment up-front. | ||
Some modules cannot be known that early. | ||
For example, in Node.js, a package might have a dependency that brings in an | ||
entire subtree of modules. | ||
Also, a pair of compartments with cyclic dependencies between modules they each | ||
contain cannot use `compartment.module` to link the second compartment | ||
constructed to the first. | ||
For these cases, the `Compartment` constructor accepts a `moduleMapHook` option | ||
that is like the dynamic version of the static `moduleMap` argument. | ||
This is a function that accepts a module specifier and returns the module | ||
namespace for that module specifier, or `undefined`. | ||
If the `moduleMapHook` returns `undefined`, the compartment proceeds to the | ||
`importHook` to attempt to asynchronously obtain the module's source. | ||
```js | ||
const moduleMapHook = moduleSpecifier => { | ||
if (moduleSpecifier === 'even') { | ||
return even.module('./index.js'); | ||
} else if (moduleSpecifier === 'odd') { | ||
return odd.module('./index.js'); | ||
} | ||
}; | ||
const even = new Compartment({}, {}, { | ||
resolveHook: nodeResolveHook, | ||
importHook: makeImportHook('https://example.com/even'), | ||
moduleMapHook, | ||
}); | ||
const odd = new Compartment({}, {}, { | ||
resolveHook: nodeResolveHook, | ||
importHook: makeImportHook('https://example.com/odd'), | ||
moduleMapHook, | ||
}); | ||
``` | ||
### Third-party modules | ||
@@ -183,0 +261,0 @@ |
34
ses.js
@@ -15,17 +15,33 @@ // Copyright (C) 2018 Agoric | ||
// Importing the lower-layer "./lockdown.js" ensures that we run later and | ||
// replace its global lockdown if an application elects to import both. | ||
import './lockdown.js'; | ||
import { assign } from './src/commons.js'; | ||
import { makeLockdown } from './src/lockdown-shim.js'; | ||
import { tameFunctionToString } from './src/tame-function-tostring.js'; | ||
import { getGlobalIntrinsics } from './src/intrinsics.js'; | ||
import { makeLockdown, harden } from './src/lockdown-shim.js'; | ||
import { whitelist, modulesWhitelist } from './src/whitelist.js'; | ||
import { | ||
makeCompartmentConstructor, | ||
Compartment, | ||
CompartmentPrototype, | ||
StaticModuleRecord, | ||
} from './src/compartment-shim.js'; | ||
makeModularCompartmentConstructor, | ||
} from './src/module-shim.js'; | ||
assign(whitelist, modulesWhitelist); | ||
// TODO wasteful to do it twice, once before lockdown and again during | ||
// lockdown. The second is doubly indirect. We should at least flatten that. | ||
const nativeBrander = tameFunctionToString(); | ||
const ModularCompartment = makeModularCompartmentConstructor( | ||
makeModularCompartmentConstructor, | ||
getGlobalIntrinsics(globalThis), | ||
nativeBrander, | ||
); | ||
assign(globalThis, { | ||
lockdown: makeLockdown(makeCompartmentConstructor), | ||
Compartment, | ||
harden, | ||
lockdown: makeLockdown( | ||
makeModularCompartmentConstructor, | ||
CompartmentPrototype, | ||
), | ||
Compartment: ModularCompartment, | ||
StaticModuleRecord, | ||
}); |
// This module exports both Compartment and StaticModuleRecord because they | ||
// communicate through the moduleAnalyses private side-table. | ||
/* eslint max-classes-per-file: ["error", 2] */ | ||
import babel from '@agoric/babel-standalone'; | ||
import { makeModuleAnalyzer } from '@agoric/transform-module'; | ||
import { | ||
assign, | ||
create, | ||
defineProperties, | ||
entries, | ||
freeze, | ||
getOwnPropertyNames, | ||
keys, | ||
getOwnPropertyDescriptors, | ||
} from './commons.js'; | ||
import { initGlobalObject } from './global-object.js'; | ||
import { performEval } from './evaluate.js'; | ||
import { load } from './module-load.js'; | ||
import { link } from './module-link.js'; | ||
import { getDeferredExports } from './module-proxy.js'; | ||
import { isValidIdentifierName } from './scope-constants.js'; | ||
import { sharedGlobalPropertyNames } from './whitelist.js'; | ||
import { getGlobalIntrinsics } from './intrinsics.js'; | ||
import { tameFunctionToString } from './tame-function-tostring.js'; | ||
import { InertCompartment, InertStaticModuleRecord } from './inert.js'; | ||
import { InertCompartment } from './inert.js'; | ||
// q, for quoting strings. | ||
const q = JSON.stringify; | ||
const analyzeModule = makeModuleAnalyzer(babel); | ||
// moduleAnalyses are the private data of a StaticModuleRecord. | ||
// We use moduleAnalyses in the loader/linker to look up | ||
// the analysis corresponding to any StaticModuleRecord constructed by an | ||
// importHook. | ||
const moduleAnalyses = new WeakMap(); | ||
/** | ||
* StaticModuleRecord captures the effort of parsing and analyzing module text | ||
* so a cache of StaticModuleRecords may be shared by multiple Compartments. | ||
*/ | ||
export function StaticModuleRecord(string, url) { | ||
if (new.target === undefined) { | ||
return new StaticModuleRecord(string, url); | ||
} | ||
const analysis = analyzeModule({ string, url }); | ||
this.imports = keys(analysis.imports).sort(); | ||
freeze(this); | ||
freeze(this.imports); | ||
moduleAnalyses.set(this, analysis); | ||
} | ||
const StaticModuleRecordPrototype = { | ||
constructor: InertStaticModuleRecord, | ||
toString() { | ||
return '[object StaticModuleRecord]'; | ||
}, | ||
}; | ||
defineProperties(StaticModuleRecord, { | ||
prototype: { value: StaticModuleRecordPrototype }, | ||
}); | ||
defineProperties(InertStaticModuleRecord, { | ||
prototype: { value: StaticModuleRecordPrototype }, | ||
}); | ||
// privateFields captures the private state for each compartment. | ||
const privateFields = new WeakMap(); | ||
// moduleAliases associates every public module exports namespace with its | ||
// corresponding compartment and specifier so they can be used to link modules | ||
// across compartments. | ||
// The mechanism to thread an alias is to use the compartment.module function | ||
// to obtain the exports namespace of a foreign module and pass it into another | ||
// compartment's moduleMap constructor option. | ||
const moduleAliases = new WeakMap(); | ||
export const CompartmentPrototype = { | ||
constructor: InertCompartment, | ||
// Compartments do not need an importHook or resolveHook to be useful | ||
// as a vessel for evaluating programs. | ||
// However, any method that operates the module system will throw an exception | ||
// if these hooks are not available. | ||
const assertModuleHooks = compartment => { | ||
const { importHook, resolveHook } = privateFields.get(compartment); | ||
if (typeof importHook !== 'function' || typeof resolveHook !== 'function') { | ||
throw new TypeError( | ||
`Compartment must be constructed with an importHook and a resolveHook for it to be able to load modules`, | ||
); | ||
} | ||
}; | ||
const CompartmentPrototype = { | ||
constructor: InertCompartment, | ||
get globalThis() { | ||
@@ -101,2 +27,6 @@ return privateFields.get(this).globalObject; | ||
get name() { | ||
return privateFields.get(this).name; | ||
}, | ||
/** | ||
@@ -111,2 +41,4 @@ * @param {string} source is a JavaScript program grammar construction. | ||
// Perform this check first to avoid unecessary sanitizing. | ||
// TODO Maybe relax string check and coerce instead: | ||
// https://github.com/tc39/proposal-dynamic-code-brand-checks | ||
if (typeof source !== 'string') { | ||
@@ -117,3 +49,7 @@ throw new TypeError('first argument of evaluate() must be a string'); | ||
// Extract options, and shallow-clone transforms. | ||
const { transforms = [], sloppyGlobalsMode = false } = options; | ||
const { | ||
transforms = [], | ||
sloppyGlobalsMode = false, | ||
__moduleShimLexicals__ = undefined, | ||
} = options; | ||
const localTransforms = [...transforms]; | ||
@@ -127,3 +63,12 @@ | ||
return performEval(source, globalObject, globalLexicals, { | ||
let localObject = globalLexicals; | ||
if (__moduleShimLexicals__ !== undefined) { | ||
localObject = create(null, getOwnPropertyDescriptors(globalLexicals)); | ||
defineProperties( | ||
localObject, | ||
getOwnPropertyDescriptors(__moduleShimLexicals__), | ||
); | ||
} | ||
return performEval(source, globalObject, localObject, { | ||
globalTransforms, | ||
@@ -135,60 +80,2 @@ localTransforms, | ||
module(specifier) { | ||
if (typeof specifier !== 'string') { | ||
throw new TypeError('first argument of module() must be a string'); | ||
} | ||
assertModuleHooks(this); | ||
const { exportsProxy } = getDeferredExports( | ||
this, | ||
privateFields.get(this), | ||
moduleAliases, | ||
specifier, | ||
); | ||
return exportsProxy; | ||
}, | ||
async import(specifier) { | ||
if (typeof specifier !== 'string') { | ||
throw new TypeError('first argument of import() must be a string'); | ||
} | ||
assertModuleHooks(this); | ||
return load(privateFields, moduleAliases, this, specifier).then(() => { | ||
const namespace = this.importNow(specifier); | ||
return { namespace }; | ||
}); | ||
}, | ||
async load(specifier) { | ||
if (typeof specifier !== 'string') { | ||
throw new TypeError('first argument of load() must be a string'); | ||
} | ||
assertModuleHooks(this); | ||
return load(privateFields, moduleAliases, this, specifier); | ||
}, | ||
importNow(specifier) { | ||
if (typeof specifier !== 'string') { | ||
throw new TypeError('first argument of importNow() must be a string'); | ||
} | ||
assertModuleHooks(this); | ||
const moduleInstance = link( | ||
privateFields, | ||
moduleAnalyses, | ||
moduleAliases, | ||
this, | ||
specifier, | ||
); | ||
moduleInstance.execute(); | ||
return moduleInstance.exportsProxy; | ||
}, | ||
toString() { | ||
@@ -203,3 +90,7 @@ return '[object Compartment]'; | ||
export const makeCompartmentConstructor = (intrinsics, nativeBrander) => { | ||
export const makeCompartmentConstructor = ( | ||
targetMakeCompartmentConstructor, | ||
intrinsics, | ||
nativeBrander, | ||
) => { | ||
/** | ||
@@ -210,10 +101,14 @@ * Compartment() | ||
*/ | ||
function Compartment(endowments = {}, moduleMap = {}, options = {}) { | ||
function Compartment(endowments = {}, _moduleMap = {}, options = {}) { | ||
if (new.target === undefined) { | ||
throw new TypeError( | ||
`Class constructor Compartment cannot be invoked without 'new'`, | ||
); | ||
} | ||
// Extract options, and shallow-clone transforms. | ||
const { | ||
name = '<unknown>', | ||
transforms = [], | ||
globalLexicals = {}, | ||
resolveHook, | ||
importHook, | ||
moduleMapHook, | ||
} = options; | ||
@@ -223,43 +118,18 @@ const globalTransforms = [...transforms]; | ||
const globalObject = {}; | ||
initGlobalObject(globalObject, intrinsics, sharedGlobalPropertyNames, { | ||
globalTransforms, | ||
nativeBrander, | ||
makeCompartmentConstructor, | ||
}); | ||
initGlobalObject( | ||
globalObject, | ||
intrinsics, | ||
sharedGlobalPropertyNames, | ||
targetMakeCompartmentConstructor, | ||
this.constructor.prototype, | ||
{ | ||
globalTransforms, | ||
nativeBrander, | ||
}, | ||
); | ||
assign(globalObject, endowments); | ||
// Map<FullSpecifier, ModuleCompartmentRecord> | ||
const moduleRecords = new Map(); | ||
// Map<FullSpecifier, ModuleInstance> | ||
const instances = new Map(); | ||
// Map<FullSpecifier, {ExportsProxy, ProxiedExports, activate()}> | ||
const deferredExports = new Map(); | ||
// Validate given moduleMap. | ||
// The module map gets translated on-demand in module-load.js and the | ||
// moduleMap can be invalid in ways that cannot be detected in the | ||
// constructor, but these checks allow us to throw early for a better | ||
// developer experience. | ||
for (const [specifier, aliasNamespace] of entries(moduleMap)) { | ||
if (typeof aliasNamespace === 'string') { | ||
// TODO implement parent module record retrieval. | ||
throw new TypeError( | ||
`Cannot map module ${q(specifier)} to ${q( | ||
aliasNamespace, | ||
)} in parent compartment`, | ||
); | ||
} else if (moduleAliases.get(aliasNamespace) === undefined) { | ||
// TODO create and link a synthetic module instance from the given | ||
// namespace object. | ||
throw ReferenceError( | ||
`Cannot map module ${q( | ||
specifier, | ||
)} because it has no known compartment in this realm`, | ||
); | ||
} | ||
} | ||
const invalidNames = getOwnPropertyNames(globalLexicals).filter( | ||
name => !isValidIdentifierName(name), | ||
identifier => !isValidIdentifierName(identifier), | ||
); | ||
@@ -275,9 +145,3 @@ if (invalidNames.length) { | ||
privateFields.set(this, { | ||
resolveHook, | ||
importHook, | ||
moduleMap, | ||
moduleMapHook, | ||
moduleRecords, | ||
deferredExports, | ||
instances, | ||
name, | ||
globalTransforms, | ||
@@ -297,16 +161,5 @@ globalObject, | ||
defineProperties(Compartment, { | ||
prototype: { value: CompartmentPrototype }, | ||
}); | ||
Compartment.prototype = CompartmentPrototype; | ||
return Compartment; | ||
}; | ||
// TODO wasteful to do it twice, once before lockdown and again during | ||
// lockdown. The second is doubly indirect. We should at least flatten that. | ||
const nativeBrander = tameFunctionToString(); | ||
export const Compartment = makeCompartmentConstructor( | ||
getGlobalIntrinsics(globalThis), | ||
nativeBrander, | ||
); |
@@ -46,3 +46,2 @@ // Adapted from SES/Caja | ||
// eslint-disable-next-line no-inner-declarations | ||
function getter() { | ||
@@ -52,3 +51,2 @@ return value; | ||
// eslint-disable-next-line no-inner-declarations | ||
function setter(newValue) { | ||
@@ -55,0 +53,0 @@ if (obj === this) { |
@@ -17,3 +17,5 @@ import { defineProperty, objectHasOwnProperty, entries } from './commons.js'; | ||
newGlobalPropertyNames, | ||
{ globalTransforms, nativeBrander, makeCompartmentConstructor }, | ||
makeCompartmentConstructor, | ||
compartmentPrototype, | ||
{ globalTransforms, nativeBrander }, | ||
) { | ||
@@ -61,8 +63,7 @@ for (const [name, constant] of entries(constantProperties)) { | ||
if (makeCompartmentConstructor) { | ||
perCompartmentGlobals.Compartment = makeCompartmentConstructor( | ||
intrinsics, | ||
nativeBrander, | ||
); | ||
} | ||
perCompartmentGlobals.Compartment = makeCompartmentConstructor( | ||
makeCompartmentConstructor, | ||
intrinsics, | ||
nativeBrander, | ||
); | ||
@@ -69,0 +70,0 @@ // TODO These should still be tamed according to the whitelist before |
@@ -52,3 +52,7 @@ // Copyright (C) 2018 Agoric | ||
export function repairIntrinsics(makeCompartmentConstructor, options = {}) { | ||
export function repairIntrinsics( | ||
makeCompartmentConstructor, | ||
compartmentPrototype, | ||
options = {}, | ||
) { | ||
// First time, absent options default to 'safe'. | ||
@@ -136,6 +140,12 @@ // Subsequent times, absent options default to first options. | ||
// start compartment, from the intrinsics. | ||
initGlobalObject(globalThis, intrinsics, initialGlobalPropertyNames, { | ||
nativeBrander, | ||
initGlobalObject( | ||
globalThis, | ||
intrinsics, | ||
initialGlobalPropertyNames, | ||
makeCompartmentConstructor, | ||
}); | ||
compartmentPrototype, | ||
{ | ||
nativeBrander, | ||
}, | ||
); | ||
@@ -168,6 +178,10 @@ /** | ||
export const makeLockdown = (makeCompartmentConstructor = undefined) => { | ||
export const makeLockdown = ( | ||
makeCompartmentConstructor, | ||
compartmentPrototype, | ||
) => { | ||
const lockdown = (options = {}) => { | ||
const maybeHardenIntrinsics = repairIntrinsics( | ||
makeCompartmentConstructor, | ||
compartmentPrototype, | ||
options, | ||
@@ -174,0 +188,0 @@ ); |
@@ -1,11 +0,3 @@ | ||
import { performEval } from './evaluate.js'; | ||
import { getDeferredExports } from './module-proxy.js'; | ||
import { | ||
create, | ||
getOwnPropertyDescriptors, | ||
entries, | ||
keys, | ||
freeze, | ||
defineProperty, | ||
} from './commons.js'; | ||
import { create, entries, keys, freeze, defineProperty } from './commons.js'; | ||
@@ -40,4 +32,2 @@ // q, for enquoting strings in error messages. | ||
const { globalLexicals } = compartmentFields; | ||
const { exportsProxy, proxiedExports, activate } = getDeferredExports( | ||
@@ -56,4 +46,4 @@ compartment, | ||
// The globalLexicals object is frozen and the corresponding properties of | ||
// localObject must be immutable, so we copy the descriptors. | ||
const localObject = create(null, getOwnPropertyDescriptors(globalLexicals)); | ||
// localLexicals must be immutable, so we copy the descriptors. | ||
const localLexicals = create(null); | ||
@@ -215,3 +205,3 @@ // {_localName_: init(initValue) -> initValue} used by the | ||
if (setProxyTrap) { | ||
defineProperty(localObject, localName, { | ||
defineProperty(localLexicals, localName, { | ||
get, | ||
@@ -332,12 +322,6 @@ set, | ||
let optFunctor = performEval( | ||
functorSource, | ||
let optFunctor = compartment.evaluate(functorSource, { | ||
globalObject, | ||
localObject, // live bindings over global lexicals | ||
{ | ||
localTransforms: [], | ||
globalTransforms: [], | ||
sloppyGlobalsMode: false, | ||
}, | ||
); | ||
__moduleShimLexicals__: localLexicals, | ||
}); | ||
let didThrow = false; | ||
@@ -344,0 +328,0 @@ let thrownError; |
@@ -37,8 +37,3 @@ // For brevity, in this file, as in module-link.js, the term "moduleRecord" | ||
// `load` asynchronously loads `StaticModuleRecords` and creates a complete | ||
// graph of `ModuleCompartmentRecords`. | ||
// The module records refer to each other by a reference to the dependency's | ||
// compartment and the specifier of the module within its own compartment. | ||
// This graph is then ready to be synchronously linked and executed. | ||
export const load = async ( | ||
const loadRecord = async ( | ||
compartmentPrivateFields, | ||
@@ -48,5 +43,43 @@ moduleAliases, | ||
moduleSpecifier, | ||
staticModuleRecord, | ||
) => { | ||
const { resolveHook, moduleRecords } = compartmentPrivateFields.get( | ||
compartment, | ||
); | ||
// resolve all imports relative to this referrer module. | ||
const resolvedImports = resolveAll( | ||
staticModuleRecord.imports, | ||
resolveHook, | ||
moduleSpecifier, | ||
); | ||
const moduleRecord = freeze({ | ||
compartment, | ||
staticModuleRecord, | ||
moduleSpecifier, | ||
resolvedImports, | ||
}); | ||
// Memoize. | ||
moduleRecords.set(moduleSpecifier, moduleRecord); | ||
// Await all dependencies to load, recursively. | ||
await Promise.all( | ||
values(resolvedImports).map(fullSpecifier => | ||
// Behold: recursion. | ||
// eslint-disable-next-line no-use-before-define | ||
load(compartmentPrivateFields, moduleAliases, compartment, fullSpecifier), | ||
), | ||
); | ||
return moduleRecord; | ||
}; | ||
const loadWithoutErrorAnnotation = async ( | ||
compartmentPrivateFields, | ||
moduleAliases, | ||
compartment, | ||
moduleSpecifier, | ||
) => { | ||
const { | ||
resolveHook, | ||
importHook, | ||
@@ -78,3 +111,5 @@ moduleMap, | ||
} | ||
const moduleRecord = await load( | ||
// Behold: recursion. | ||
// eslint-disable-next-line no-use-before-define | ||
const aliasRecord = await load( | ||
compartmentPrivateFields, | ||
@@ -85,4 +120,5 @@ moduleAliases, | ||
); | ||
moduleRecords.set(moduleSpecifier, moduleRecord); | ||
return moduleRecord; | ||
// Memoize. | ||
moduleRecords.set(moduleSpecifier, aliasRecord); | ||
return aliasRecord; | ||
} | ||
@@ -97,26 +133,57 @@ | ||
// resolve all imports relative to this referrer module. | ||
const resolvedImports = resolveAll( | ||
staticModuleRecord.imports, | ||
resolveHook, | ||
if (staticModuleRecord.record !== undefined) { | ||
const { | ||
compartment: aliasCompartment = compartment, | ||
specifier: aliasSpecifier = moduleSpecifier, | ||
record: aliasModuleRecord, | ||
} = staticModuleRecord; | ||
const aliasRecord = await loadRecord( | ||
compartmentPrivateFields, | ||
moduleAliases, | ||
aliasCompartment, | ||
aliasSpecifier, | ||
aliasModuleRecord, | ||
); | ||
// Memoize by aliased specifier. | ||
moduleRecords.set(moduleSpecifier, aliasRecord); | ||
return aliasRecord; | ||
} | ||
return loadRecord( | ||
compartmentPrivateFields, | ||
moduleAliases, | ||
compartment, | ||
moduleSpecifier, | ||
staticModuleRecord, | ||
); | ||
const moduleRecord = freeze({ | ||
}; | ||
// `load` asynchronously loads `StaticModuleRecords` and creates a complete | ||
// graph of `ModuleCompartmentRecords`. | ||
// The module records refer to each other by a reference to the dependency's | ||
// compartment and the specifier of the module within its own compartment. | ||
// This graph is then ready to be synchronously linked and executed. | ||
export const load = async ( | ||
compartmentPrivateFields, | ||
moduleAliases, | ||
compartment, | ||
moduleSpecifier, | ||
) => { | ||
return loadWithoutErrorAnnotation( | ||
compartmentPrivateFields, | ||
moduleAliases, | ||
compartment, | ||
staticModuleRecord, | ||
moduleSpecifier, | ||
resolvedImports, | ||
).catch(error => { | ||
const { name } = compartmentPrivateFields.get(compartment); | ||
// TODO The following drops the causes' stacks. | ||
// In the future, we should capture the causal chain. | ||
// https://github.com/Agoric/SES-shim/issues/440 | ||
throw new error.constructor( | ||
`${error.message}, loading ${q(moduleSpecifier)} in compartment ${q( | ||
name, | ||
)}`, | ||
); | ||
}); | ||
// Memoize. | ||
moduleRecords.set(moduleSpecifier, moduleRecord); | ||
// Await all dependencies to load, recursively. | ||
await Promise.all( | ||
values(resolvedImports).map(fullSpecifier => | ||
load(compartmentPrivateFields, moduleAliases, compartment, fullSpecifier), | ||
), | ||
); | ||
return moduleRecord; | ||
}; |
@@ -156,3 +156,17 @@ import { throwTantrum } from './assertions.js'; | ||
}, | ||
// Chip has seen this happen single stepping under the Chrome/v8 debugger. | ||
// TODO record how to reliably reproduce, and to test if this fix helps. | ||
// TODO report as bug to v8 or Chrome, and record issue link here. | ||
getOwnPropertyDescriptor(_target, prop) { | ||
// Coerce with `String` in case prop is a symbol. | ||
const quotedProp = JSON.stringify(String(prop)); | ||
console.warn( | ||
`getOwnPropertyDescriptor trap on scopeHandler for ${quotedProp}`, | ||
new Error().stack, | ||
); | ||
return undefined; | ||
}, | ||
}; | ||
} |
@@ -8,13 +8,4 @@ import { | ||
import { tameV8ErrorConstructor } from './tame-v8-error-constructor.js'; | ||
import { NativeErrors } from './whitelist.js'; | ||
// TODO where should this go? | ||
export const NativeErrors = [ | ||
EvalError, | ||
RangeError, | ||
ReferenceError, | ||
SyntaxError, | ||
TypeError, | ||
URIError, | ||
]; | ||
// Use concise methods to obtain named functions without constructors. | ||
@@ -21,0 +12,0 @@ const tamedMethods = { |
@@ -10,5 +10,2 @@ import { create, getOwnPropertyDescriptors } from './commons.js'; | ||
// TODO I shouldn't need this eslint-disable for an ignored _ or variable | ||
// name beginning with underbar. | ||
// eslint-disable-next-line no-unused-vars | ||
const { random: _, ...otherDescriptors } = getOwnPropertyDescriptors( | ||
@@ -15,0 +12,0 @@ originalMath, |
@@ -170,2 +170,13 @@ /** | ||
// All the "subclasses" of Error. These are collectively represented in the | ||
// EcmaScript spec by the meta variable NativeError. | ||
export const NativeErrors = [ | ||
EvalError, | ||
RangeError, | ||
ReferenceError, | ||
SyntaxError, | ||
TypeError, | ||
URIError, | ||
]; | ||
/** | ||
@@ -1786,6 +1797,3 @@ * <p>Each JSON record enumerates the disposition of the properties on | ||
globalThis: getter, | ||
import: asyncFn, | ||
load: asyncFn, | ||
importNow: fn, | ||
module: fn, | ||
name: getter, | ||
// Should this be proposed? | ||
@@ -1798,2 +1806,14 @@ toString: fn, | ||
'%InitialGetStackString%': fn, | ||
}; | ||
export const modulesWhitelist = { | ||
'%CompartmentPrototype%': { | ||
...whitelist['%CompartmentPrototype%'], | ||
import: asyncFn, | ||
load: asyncFn, | ||
importNow: fn, | ||
module: fn, | ||
}, | ||
StaticModuleRecord: { | ||
@@ -1816,4 +1836,2 @@ '[[Proto]]': '%FunctionPrototype%', | ||
}, | ||
'%InitialGetStackString%': fn, | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12060703
51
300521
285