glassjar 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{worker-uI0K1NG6.js → worker-DKKpKTP_.js} +383 -404
- package/dist/engine_bg.wasm +0 -0
- package/dist/glassjar.js +1550 -904
- package/dist/glassjar.umd.cjs +5 -2
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/python-packages.d.ts +65 -0
- package/dist/python-packages.d.ts.map +1 -0
- package/dist/python-stdlib-modules.json.d.ts +4 -0
- package/package.json +1 -1
package/dist/glassjar.umd.cjs
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
(function(H,x){typeof exports=="object"&&typeof module<"u"?x(exports):typeof define=="function"&&define.amd?define(["exports"],x):(H=typeof globalThis<"u"?globalThis:H||self,x(H.engine={}))})(this,(function(H){"use strict";var x=typeof document<"u"?document.currentScript:null;function SA(Q){return Q&&Q.__esModule&&Object.prototype.hasOwnProperty.call(Q,"default")?Q.default:Q}var m={exports:{}},DA;function hA(){if(DA)return m.exports;DA=1;var Q=typeof Reflect=="object"?Reflect:null,A=Q&&typeof Q.apply=="function"?Q.apply:function(E,o,k){return Function.prototype.apply.call(E,o,k)},g;Q&&typeof Q.ownKeys=="function"?g=Q.ownKeys:Object.getOwnPropertySymbols?g=function(E){return Object.getOwnPropertyNames(E).concat(Object.getOwnPropertySymbols(E))}:g=function(E){return Object.getOwnPropertyNames(E)};function I(w){console&&console.warn&&console.warn(w)}var C=Number.isNaN||function(E){return E!==E};function B(){B.init.call(this)}m.exports=B,m.exports.once=V,B.EventEmitter=B,B.prototype._events=void 0,B.prototype._eventsCount=0,B.prototype._maxListeners=void 0;var i=10;function D(w){if(typeof w!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof w)}Object.defineProperty(B,"defaultMaxListeners",{enumerable:!0,get:function(){return i},set:function(w){if(typeof w!="number"||w<0||C(w))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+w+".");i=w}}),B.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},B.prototype.setMaxListeners=function(E){if(typeof E!="number"||E<0||C(E))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+E+".");return this._maxListeners=E,this};function N(w){return w._maxListeners===void 0?B.defaultMaxListeners:w._maxListeners}B.prototype.getMaxListeners=function(){return N(this)},B.prototype.emit=function(E){for(var o=[],k=1;k<arguments.length;k++)o.push(arguments[k]);var M=E==="error",R=this._events;if(R!==void 0)M=M&&R.error===void 0;else if(!M)return!1;if(M){var G;if(o.length>0&&(G=o[0]),G instanceof Error)throw G;var j=new Error("Unhandled error."+(G?" ("+G.message+")":""));throw j.context=G,j}var X=R[E];if(X===void 0)return!1;if(typeof X=="function")A(X,this,o);else for(var JA=X.length,vA=q(X,JA),k=0;k<JA;++k)A(vA[k],this,o);return!0};function y(w,E,o,k){var M,R,G;if(D(o),R=w._events,R===void 0?(R=w._events=Object.create(null),w._eventsCount=0):(R.newListener!==void 0&&(w.emit("newListener",E,o.listener?o.listener:o),R=w._events),G=R[E]),G===void 0)G=R[E]=o,++w._eventsCount;else if(typeof G=="function"?G=R[E]=k?[o,G]:[G,o]:k?G.unshift(o):G.push(o),M=N(w),M>0&&G.length>M&&!G.warned){G.warned=!0;var j=new Error("Possible EventEmitter memory leak detected. "+G.length+" "+String(E)+" listeners added. Use emitter.setMaxListeners() to increase limit");j.name="MaxListenersExceededWarning",j.emitter=w,j.type=E,j.count=G.length,I(j)}return w}B.prototype.addListener=function(E,o){return y(this,E,o,!1)},B.prototype.on=B.prototype.addListener,B.prototype.prependListener=function(E,o){return y(this,E,o,!0)};function J(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function L(w,E,o){var k={fired:!1,wrapFn:void 0,target:w,type:E,listener:o},M=J.bind(k);return M.listener=o,k.wrapFn=M,M}B.prototype.once=function(E,o){return D(o),this.on(E,L(this,E,o)),this},B.prototype.prependOnceListener=function(E,o){return D(o),this.prependListener(E,L(this,E,o)),this},B.prototype.removeListener=function(E,o){var k,M,R,G,j;if(D(o),M=this._events,M===void 0)return this;if(k=M[E],k===void 0)return this;if(k===o||k.listener===o)--this._eventsCount===0?this._events=Object.create(null):(delete M[E],M.removeListener&&this.emit("removeListener",E,k.listener||o));else if(typeof k!="function"){for(R=-1,G=k.length-1;G>=0;G--)if(k[G]===o||k[G].listener===o){j=k[G].listener,R=G;break}if(R<0)return this;R===0?k.shift():b(k,R),k.length===1&&(M[E]=k[0]),M.removeListener!==void 0&&this.emit("removeListener",E,j||o)}return this},B.prototype.off=B.prototype.removeListener,B.prototype.removeAllListeners=function(E){var o,k,M;if(k=this._events,k===void 0)return this;if(k.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):k[E]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete k[E]),this;if(arguments.length===0){var R=Object.keys(k),G;for(M=0;M<R.length;++M)G=R[M],G!=="removeListener"&&this.removeAllListeners(G);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(o=k[E],typeof o=="function")this.removeListener(E,o);else if(o!==void 0)for(M=o.length-1;M>=0;M--)this.removeListener(E,o[M]);return this};function Y(w,E,o){var k=w._events;if(k===void 0)return[];var M=k[E];return M===void 0?[]:typeof M=="function"?o?[M.listener||M]:[M]:o?EA(M):q(M,M.length)}B.prototype.listeners=function(E){return Y(this,E,!0)},B.prototype.rawListeners=function(E){return Y(this,E,!1)},B.listenerCount=function(w,E){return typeof w.listenerCount=="function"?w.listenerCount(E):c.call(w,E)},B.prototype.listenerCount=c;function c(w){var E=this._events;if(E!==void 0){var o=E[w];if(typeof o=="function")return 1;if(o!==void 0)return o.length}return 0}B.prototype.eventNames=function(){return this._eventsCount>0?g(this._events):[]};function q(w,E){for(var o=new Array(E),k=0;k<E;++k)o[k]=w[k];return o}function b(w,E){for(;E+1<w.length;E++)w[E]=w[E+1];w.pop()}function EA(w){for(var E=new Array(w.length),o=0;o<E.length;++o)E[o]=w[o].listener||w[o];return E}function V(w,E){return new Promise(function(o,k){function M(G){w.removeListener(E,R),k(G)}function R(){typeof w.removeListener=="function"&&w.removeListener("error",M),o([].slice.call(arguments))}UA(w,E,R,{once:!0}),E!=="error"&&uA(w,M,{once:!0})})}function uA(w,E,o){typeof w.on=="function"&&UA(w,"error",E,o)}function UA(w,E,o,k){if(typeof w.on=="function")k.once?w.once(E,o):w.on(E,o);else if(typeof w.addEventListener=="function")w.addEventListener(E,function M(R){k.once&&w.removeEventListener(E,M),o(R)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof w)}return m.exports}var LA=hA();const wA=SA(LA);class _{__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,NA.unregister(this),A}free(){const A=this.__destroy_into_raw();F.__wbg_dapadapter_free(A,0)}attach(A){F.dapadapter_attach(this.__wbg_ptr,A)}detach(){F.dapadapter_detach(this.__wbg_ptr)}constructor(){const A=F.dapadapter_new();return this.__wbg_ptr=A>>>0,NA.register(this,this.__wbg_ptr,this),this}on(A){F.dapadapter_on(this.__wbg_ptr,A)}resetRun(){F.dapadapter_resetRun(this.__wbg_ptr)}sendMessage(A){return F.dapadapter_sendMessage(this.__wbg_ptr,A)}setFilterInternals(A){F.dapadapter_setFilterInternals(this.__wbg_ptr,A)}}Symbol.dispose&&(_.prototype[Symbol.dispose]=_.prototype.free);class T{static __wrap(A){A=A>>>0;const g=Object.create(T.prototype);return g.__wbg_ptr=A,FA.register(g,g.__wbg_ptr,g),g}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,FA.unregister(this),A}free(){const A=this.__destroy_into_raw();F.__wbg_trap_free(A,0)}static __wbg_wasmer_trap(){F.trap___wbg_wasmer_trap()}}Symbol.dispose&&(T.prototype[Symbol.dispose]=T.prototype.free);function cA(){let Q,A;try{const g=F.cpp_exception_hash();return Q=g[0],A=g[1],s(g[0],g[1])}finally{F.__wbindgen_free(Q,A,1)}}function iA(Q){const A=W(Q,F.__wbindgen_malloc,F.__wbindgen_realloc),g=O,I=F.prefetch_urls(A,g);var C=kA(I[0],I[1]).slice();return F.__wbindgen_free(I[0],I[1]*4,4),C}function sA(){return{__proto__:null,"./engine_bg.js":{__proto__:null,__wbg_BigInt_b7bbccdff258c9f2:function(A){return BigInt(A)},__wbg_Error_8c4e43fe74559d73:function(A,g){return Error(s(A,g))},__wbg_Number_04624de7d0e8332d:function(A){return Number(A)},__wbg_String_8f0eb39a4a4c2f66:function(A,g){const I=String(g),C=W(I,F.__wbindgen_malloc,F.__wbindgen_realloc),B=O;S().setInt32(A+4,B,!0),S().setInt32(A+0,C,!0)},__wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2:function(A,g){const I=g,C=typeof I=="bigint"?I:void 0;S().setBigInt64(A+8,p(C)?BigInt(0):C,!0),S().setInt32(A+0,!p(C),!0)},__wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25:function(A){const g=A,I=typeof g=="boolean"?g:void 0;return p(I)?16777215:I?1:0},__wbg___wbindgen_debug_string_0bc8482c6e3508ae:function(A,g){const I=$(g),C=W(I,F.__wbindgen_malloc,F.__wbindgen_realloc),B=O;S().setInt32(A+4,B,!0),S().setInt32(A+0,C,!0)},__wbg___wbindgen_function_table_5ae7216dfcbcc506:function(){return F.__wbindgen_export},__wbg___wbindgen_in_47fa6863be6f2f25:function(A,g){return A in g},__wbg___wbindgen_is_bigint_31b12575b56f32fc:function(A){return typeof A=="bigint"},__wbg___wbindgen_is_function_0095a73b8b156f76:function(A){return typeof A=="function"},__wbg___wbindgen_is_object_5ae8e5880f2c1fbd:function(A){const g=A;return typeof g=="object"&&g!==null},__wbg___wbindgen_is_string_cd444516edc5b180:function(A){return typeof A=="string"},__wbg___wbindgen_is_undefined_9e4d92534c42d778:function(A){return A===void 0},__wbg___wbindgen_jsval_eq_11888390b0186270:function(A,g){return A===g},__wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811:function(A,g){return A==g},__wbg___wbindgen_lt_bb59cc3d23526e0d:function(A,g){return A<g},__wbg___wbindgen_neg_6b4d356dff49dcc6:function(A){return-A},__wbg___wbindgen_number_get_8ff4255516ccad3e:function(A,g){const I=g,C=typeof I=="number"?I:void 0;S().setFloat64(A+8,p(C)?0:C,!0),S().setInt32(A+0,!p(C),!0)},__wbg___wbindgen_rethrow_05525c567f154472:function(A){throw A},__wbg___wbindgen_shr_ef8e07cce709eb54:function(A,g){return A>>g},__wbg___wbindgen_string_get_72fb696202c56729:function(A,g){const I=g,C=typeof I=="string"?I:void 0;var B=p(C)?0:W(C,F.__wbindgen_malloc,F.__wbindgen_realloc),i=O;S().setInt32(A+4,i,!0),S().setInt32(A+0,B,!0)},__wbg___wbindgen_throw_be289d5034ed271b:function(A,g){throw new Error(s(A,g))},__wbg__wbg_cb_unref_d9b87ff7982e3b21:function(A){A._wbg_cb_unref()},__wbg_addEventListener_3acb0aad4483804c:function(){return K(function(A,g,I,C){A.addEventListener(s(g,I),C)},arguments)},__wbg_apply_2e22c45cb4f12415:function(){return K(function(A,g,I){return Reflect.apply(A,g,I)},arguments)},__wbg_apply_ada2ee1a60ac7b3c:function(){return K(function(A,g,I){return A.apply(g,I)},arguments)},__wbg_arrayBuffer_bb54076166006c39:function(){return K(function(A){return A.arrayBuffer()},arguments)},__wbg_bind_1dc37de2b9939128:function(A,g,I,C){return A.bind(g,I,C)},__wbg_bind_29ba380591735d8c:function(A,g,I){return A.bind(g,I)},__wbg_buffer_7b5f53e46557d8f1:function(A){return A.buffer},__wbg_byteLength_7b03c17ff1e4037f:function(A){return A.byteLength},__wbg_byteLength_b5d783d06792ed2c:function(A){return A.byteLength},__wbg_call_389efe28435a9388:function(){return K(function(A,g){return A.call(g)},arguments)},__wbg_call_4708e0c13bdc8e95:function(){return K(function(A,g,I){return A.call(g,I)},arguments)},__wbg_compareExchange_b578410c358e695e:function(){return K(function(A,g,I,C){return Atomics.compareExchange(A,g>>>0,I,C)},arguments)},__wbg_constructor_ad6c0ed428f55d34:function(A){return A.constructor},__wbg_crypto_86f2631e91b51511:function(A){return A.crypto},__wbg_customSections_193491b069139fb1:function(A,g,I){return WebAssembly.Module.customSections(A,s(g,I))},__wbg_data_5330da50312d0bc1:function(A){return A.data},__wbg_done_57b39ecd9addfe81:function(A){return A.done},__wbg_entries_58c7934c745daac7:function(A){return Object.entries(A)},__wbg_error_7534b8e9a36f1ab4:function(A,g){let I,C;try{I=A,C=g,console.error(s(A,g))}finally{F.__wbindgen_free(I,C,1)}},__wbg_exports_794a42000dacd046:function(A){return WebAssembly.Module.exports(A)},__wbg_exports_86b4926134c40288:function(A){return A.exports},__wbg_fetch_d1488f40cef1e210:function(A,g,I){return A.fetch(s(g,I))},__wbg_from_bddd64e7d5ff6941:function(A){return Array.from(A)},__wbg_getPrototypeOf_2653517f1dc884d5:function(){return K(function(A){return Reflect.getPrototypeOf(A)},arguments)},__wbg_getRandomValues_b3f15fcbfabb0f8b:function(){return K(function(A,g){A.getRandomValues(g)},arguments)},__wbg_getTime_1e3cd1391c5c3995:function(A){return A.getTime()},__wbg_getTimezoneOffset_81776d10a4ec18a8:function(A){return A.getTimezoneOffset()},__wbg_getUint32_bb6f5a401408e7fa:function(A,g,I){return A.getUint32(g>>>0,I!==0)},__wbg_get_7efbcc3819719b0f:function(){return K(function(A,g){return A.get(g>>>0)},arguments)},__wbg_get_9b94d73e6221f75c:function(A,g){return A[g>>>0]},__wbg_get_b3ed3ad4be2bc8ac:function(){return K(function(A,g){return Reflect.get(A,g)},arguments)},__wbg_get_index_253dd2a9e007656d:function(A,g){return A[g>>>0]},__wbg_get_index_9a5bfdd2ca49c65f:function(A,g){return A[g>>>0]},__wbg_get_with_ref_key_1dc361bd10053bfe:function(A,g){return A[g]},__wbg_grow_5d42bf28c2da22cb:function(){return K(function(A,g){return A.grow(g>>>0)},arguments)},__wbg_grow_d034989fce14cc8e:function(){return K(function(A,g){return A.grow(g>>>0)},arguments)},__wbg_imports_8333d40ab24779ad:function(A){return WebAssembly.Module.imports(A)},__wbg_instanceof_ArrayBuffer_c367199e2fa2aa04:function(A){let g;try{g=A instanceof ArrayBuffer}catch{g=!1}return g},__wbg_instanceof_Error_8573fe0b0b480f46:function(A){let g;try{g=A instanceof Error}catch{g=!1}return g},__wbg_instanceof_Function_2a29eec978bb3b11:function(A){let g;try{g=A instanceof Function}catch{g=!1}return g},__wbg_instanceof_Global_2db767b6b2347f01:function(A){let g;try{g=A instanceof WebAssembly.Global}catch{g=!1}return g},__wbg_instanceof_Map_53af74335dec57f4:function(A){let g;try{g=A instanceof Map}catch{g=!1}return g},__wbg_instanceof_Memory_dc8c61e3f831ee37:function(A){let g;try{g=A instanceof WebAssembly.Memory}catch{g=!1}return g},__wbg_instanceof_Module_d0d412b14363ba9a:function(A){let g;try{g=A instanceof WebAssembly.Module}catch{g=!1}return g},__wbg_instanceof_Object_1c6af87502b733ed:function(A){let g;try{g=A instanceof Object}catch{g=!1}return g},__wbg_instanceof_RangeError_0b0dd056bc557b89:function(A){let g;try{g=A instanceof RangeError}catch{g=!1}return g},__wbg_instanceof_Response_ee1d54d79ae41977:function(A){let g;try{g=A instanceof Response}catch{g=!1}return g},__wbg_instanceof_SharedArrayBuffer_91d8a2fa16a2cc26:function(A){let g;try{g=A instanceof SharedArrayBuffer}catch{g=!1}return g},__wbg_instanceof_Table_127f216e592f4159:function(A){let g;try{g=A instanceof WebAssembly.Table}catch{g=!1}return g},__wbg_instanceof_Tag_f1d6b24a98b95210:function(A){let g;try{g=A instanceof WebAssembly.Tag}catch{g=!1}return g},__wbg_instanceof_Uint8Array_9b9075935c74707c:function(A){let g;try{g=A instanceof Uint8Array}catch{g=!1}return g},__wbg_isArray_d314bb98fcf08331:function(A){return Array.isArray(A)},__wbg_isSafeInteger_bfbc7332a9768d2a:function(A){return Number.isSafeInteger(A)},__wbg_is_f29129f676e5410c:function(A,g){return Object.is(A,g)},__wbg_iterator_6ff6560ca1568e55:function(){return Symbol.iterator},__wbg_length_32ed9a279acd054c:function(A){return A.length},__wbg_length_35a7bace40f36eac:function(A){return A.length},__wbg_length_aeb94ff17a8a8556:function(A){return A.length},__wbg_load_eff64ff5e429a422:function(){return K(function(A,g){return Atomics.load(A,g>>>0)},arguments)},__wbg_message_9ddc4b9a62a7c379:function(A){return A.message},__wbg_msCrypto_d562bbe83e0d4b91:function(A){return A.msCrypto},__wbg_new_0728bd2d4c5d41dd:function(){return K(function(A){return new WebAssembly.Tag(A)},arguments)},__wbg_new_0_73afc35eb544e539:function(){return new Date},__wbg_new_245cd5c49157e602:function(A){return new Date(A)},__wbg_new_2ac7fa8be584d280:function(A,g,I){return new DataView(A,g>>>0,I>>>0)},__wbg_new_361308b2356cecd0:function(){return new Object},__wbg_new_3eb36ae241fe6f44:function(){return new Array},__wbg_new_4a996a46a82782b6:function(){return K(function(A,g){return new WebAssembly.Global(A,g)},arguments)},__wbg_new_57c27ff3ddf5b62c:function(){return K(function(A){return new WebAssembly.Module(A)},arguments)},__wbg_new_67274f72d5abea37:function(){return K(function(A){return new WebAssembly.Table(A)},arguments)},__wbg_new_8a6f238a6ece86ea:function(){return new Error},__wbg_new_a4e3cab1cdd635ba:function(){return K(function(A,g){return new WebAssembly.Instance(A,g)},arguments)},__wbg_new_b061c0550d9f3281:function(){return K(function(A){return new WebAssembly.Memory(A)},arguments)},__wbg_new_b5d9e2fb389fef91:function(A,g){try{var I={a:A,b:g},C=(i,D)=>{const N=I.a;I.a=0;try{return pA(N,I.b,i,D)}finally{I.a=N}};return new Promise(C)}finally{I.a=I.b=0}},__wbg_new_ca409f861989e0c5:function(A){return new SharedArrayBuffer(A>>>0)},__wbg_new_dca287b076112a51:function(){return new Map},__wbg_new_dd2b680c8bf6ae29:function(A){return new Uint8Array(A)},__wbg_new_from_slice_a3d2629dc1826784:function(A,g){return new Uint8Array(n(A,g))},__wbg_new_no_args_1c7c842f08d00ebb:function(A,g){return new Function(s(A,g))},__wbg_new_with_args_7bba34e94b1cfa40:function(A,g,I,C){return new Function(s(A,g),s(I,C))},__wbg_new_with_byte_offset_9120ba79e057895b:function(A,g){return new Uint8Array(A,g>>>0)},__wbg_new_with_byte_offset_and_length_aa261d9c9da49eb1:function(A,g,I){return new Uint8Array(A,g>>>0,I>>>0)},__wbg_new_with_byte_offset_and_length_bc2e7b72cc96d1c1:function(A,g,I){return new Int32Array(A,g>>>0,I>>>0)},__wbg_new_with_length_1763c527b2923202:function(A){return new Array(A>>>0)},__wbg_new_with_length_a2c39cbe88fd8ff1:function(A){return new Uint8Array(A>>>0)},__wbg_next_3482f54c49e8af19:function(){return K(function(A){return A.next()},arguments)},__wbg_next_418f80d8f5303233:function(A){return A.next},__wbg_node_e1f24f89a7336c2e:function(A){return A.node},__wbg_notify_78a90977fab74963:function(){return K(function(A,g){return Atomics.notify(A,g>>>0)},arguments)},__wbg_now_a3af9a2f4bbaa4d1:function(){return Date.now()},__wbg_now_ebffdf7e580f210d:function(A){return A.now()},__wbg_ok_87f537440a0acf85:function(A){return A.ok},__wbg_postMessage_2041f4e90af61318:function(){return K(function(A,g){A.postMessage(g)},arguments)},__wbg_process_3975fd6c72f520aa:function(A){return A.process},__wbg_prototypesetcall_bdcdcc5842e4d77d:function(A,g,I){Uint8Array.prototype.set.call(n(A,g),I)},__wbg_push_8ffdcb2063340ba5:function(A,g){return A.push(g)},__wbg_queueMicrotask_0aa0a927f78f5d98:function(A){return A.queueMicrotask},__wbg_queueMicrotask_5bb536982f78a56f:function(A){queueMicrotask(A)},__wbg_randomFillSync_f8c153b79f285817:function(){return K(function(A,g){A.randomFillSync(g)},arguments)},__wbg_removeEventListener_e63328781a5b9af9:function(){return K(function(A,g,I,C){A.removeEventListener(s(g,I),C)},arguments)},__wbg_require_b74f47fc2d022fd6:function(){return K(function(){return module.require},arguments)},__wbg_resolve_002c4b7d9d8f6b64:function(A){return Promise.resolve(A)},__wbg_setTimeout_e0aacd5a637418a6:function(){return K(function(A,g,I){return A.setTimeout(g,I)},arguments)},__wbg_setUint32_d168af7751a8557e:function(A,g,I,C){A.setUint32(g>>>0,I>>>0,C!==0)},__wbg_set_0af2522656c2a71b:function(){return K(function(A,g,I){A.set(g>>>0,I)},arguments)},__wbg_set_1eb0999cf5d27fc8:function(A,g,I){return A.set(g,I)},__wbg_set_25cf9deff6bf0ea8:function(A,g,I){A.set(g,I>>>0)},__wbg_set_3f1d0b984ed272ed:function(A,g,I){A[g]=I},__wbg_set_6cb8631f80447a67:function(){return K(function(A,g,I){return Reflect.set(A,g,I)},arguments)},__wbg_set_cc56eefd2dd91957:function(A,g,I){A.set(n(g,I))},__wbg_set_f43e577aea94465b:function(A,g,I){A[g>>>0]=I},__wbg_set_index_b3244a6c458021e4:function(A,g,I){A[g>>>0]=I},__wbg_set_index_f259b54e97f7b177:function(A,g,I){A[g>>>0]=I},__wbg_set_onmessage_ea7cc2ba099021cd:function(A,g){A.onmessage=g},__wbg_set_value_fc06e541de098215:function(A,g){A.value=g},__wbg_slice_8bbd46adb2100583:function(A,g,I){return A.slice(g>>>0,I>>>0)},__wbg_stack_0ed75d68575b0f3c:function(A,g){const I=g.stack,C=W(I,F.__wbindgen_malloc,F.__wbindgen_realloc),B=O;S().setInt32(A+4,B,!0),S().setInt32(A+0,C,!0)},__wbg_static_accessor_GLOBAL_12837167ad935116:function(){const A=typeof global>"u"?null:global;return p(A)?0:Z(A)},__wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f:function(){const A=typeof globalThis>"u"?null:globalThis;return p(A)?0:Z(A)},__wbg_static_accessor_SELF_a621d3dfbb60d0ce:function(){const A=typeof self>"u"?null:self;return p(A)?0:Z(A)},__wbg_static_accessor_WINDOW_f8727f0cf888e0bd:function(){const A=typeof window>"u"?null:window;return p(A)?0:Z(A)},__wbg_store_d1d951c98d9bed41:function(){return K(function(A,g,I){return Atomics.store(A,g>>>0,I)},arguments)},__wbg_subarray_a96e1fef17ed23cb:function(A,g,I){return A.subarray(g>>>0,I>>>0)},__wbg_then_0d9fe2c7b1857d32:function(A,g,I){return A.then(g,I)},__wbg_then_b9e7b3b5f1a9e1b5:function(A,g){return A.then(g)},__wbg_toString_56d946daff83867b:function(A,g,I){const C=g.toString(I),B=W(C,F.__wbindgen_malloc,F.__wbindgen_realloc),i=O;S().setInt32(A+4,i,!0),S().setInt32(A+0,B,!0)},__wbg_toString_964ff7fe6eca8362:function(A){return A.toString()},__wbg_trap_new:function(A){return T.__wrap(A)},__wbg_validate_71c2d02a71bda62f:function(){return K(function(A){return WebAssembly.validate(A)},arguments)},__wbg_value_0546255b415e96c1:function(A){return A.value},__wbg_value_ce37a60e576310ff:function(A){return A.value},__wbg_versions_4e31226f5e8dc909:function(A){return A.versions},__wbg_wait_be5dae1e53f590f1:function(){return K(function(A,g,I){return Atomics.wait(A,g>>>0,I)},arguments)},__wbg_warn_81ab00e6e16e886d:function(A,g,I){console.warn(A,g,I)},__wbindgen_cast_0000000000000001:function(A,g){return f(A,g,F.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_9eaf8169b8189500___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_9eaf8169b8189500___Array__wasm_bindgen_36932265c58943ab___JsValue___,oA)},__wbindgen_cast_0000000000000002:function(A,g){return f(A,g,F.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_9eaf8169b8189500___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_9eaf8169b8189500___Array__wasm_bindgen_36932265c58943ab___JsValue___,oA)},__wbindgen_cast_0000000000000003:function(A,g){return f(A,g,F.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_9eaf8169b8189500___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_9eaf8169b8189500___Array__wasm_bindgen_36932265c58943ab___JsValue___,jA)},__wbindgen_cast_0000000000000004:function(A,g){return f(A,g,F.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__FnMut__wasm_bindgen_36932265c58943ab___JsValue____Output_______,aA)},__wbindgen_cast_0000000000000005:function(A,g){return VA(A,g,F.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__Fn__web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent____Output_______,HA)},__wbindgen_cast_0000000000000006:function(A,g){return f(A,g,F.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__Fn__web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent____Output_______,qA)},__wbindgen_cast_0000000000000007:function(A){return A},__wbindgen_cast_0000000000000008:function(A){return A},__wbindgen_cast_0000000000000009:function(A,g){return n(A,g)},__wbindgen_cast_000000000000000a:function(A,g){return s(A,g)},__wbindgen_cast_000000000000000b:function(A,g){return BigInt.asUintN(64,A)|BigInt.asUintN(64,g)<<BigInt(64)},__wbindgen_cast_000000000000000c:function(A){return BigInt.asUintN(64,A)},__wbindgen_cast_000000000000000d:function(A,g){var I=kA(A,g).slice();return F.__wbindgen_free(A,g*4,4),I},__wbindgen_init_externref_table:function(){const A=F.__wbindgen_externrefs,g=A.grow(4);A.set(0,void 0),A.set(g+0,void 0),A.set(g+1,null),A.set(g+2,!0),A.set(g+3,!1)}}}}function aA(Q,A,g){F.wasm_bindgen_36932265c58943ab___convert__closures_____invoke___wasm_bindgen_36932265c58943ab___JsValue_____(Q,A,g)}function HA(Q,A,g){F.wasm_bindgen_36932265c58943ab___convert__closures_____invoke___web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent_____(Q,A,g)}function qA(Q,A,g){F.wasm_bindgen_36932265c58943ab___convert__closures_____invoke___web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent______1_(Q,A,g)}function jA(Q,A,g){const I=F.wasm_bindgen_36932265c58943ab___convert__closures________invoke___js_sys_9eaf8169b8189500___Array__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_36932265c58943ab___JsValue__(Q,A,g);if(I[1])throw AA(I[0])}function oA(Q,A,g){const I=F.wasm_bindgen_36932265c58943ab___convert__closures________invoke___js_sys_9eaf8169b8189500___Array__core_37ee0ce0c4cd57d5___result__Result_js_sys_9eaf8169b8189500___Array__wasm_bindgen_36932265c58943ab___JsValue__(Q,A,g);if(I[2])throw AA(I[1]);return AA(I[0])}function pA(Q,A,g,I){F.wasm_bindgen_36932265c58943ab___convert__closures_____invoke___wasm_bindgen_36932265c58943ab___JsValue__wasm_bindgen_36932265c58943ab___JsValue_____(Q,A,g,I)}const NA=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(Q=>F.__wbg_dapadapter_free(Q>>>0,1)),FA=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(Q=>F.__wbg_trap_free(Q>>>0,1));function Z(Q){const A=F.__externref_table_alloc();return F.__wbindgen_externrefs.set(A,Q),A}const r=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(Q=>Q.dtor(Q.a,Q.b));function $(Q){const A=typeof Q;if(A=="number"||A=="boolean"||Q==null)return`${Q}`;if(A=="string")return`"${Q}"`;if(A=="symbol"){const C=Q.description;return C==null?"Symbol":`Symbol(${C})`}if(A=="function"){const C=Q.name;return typeof C=="string"&&C.length>0?`Function(${C})`:"Function"}if(Array.isArray(Q)){const C=Q.length;let B="[";C>0&&(B+=$(Q[0]));for(let i=1;i<C;i++)B+=", "+$(Q[i]);return B+="]",B}const g=/\[object ([^\]]+)\]/.exec(toString.call(Q));let I;if(g&&g.length>1)I=g[1];else return toString.call(Q);if(I=="Object")try{return"Object("+JSON.stringify(Q)+")"}catch{return"Object"}return Q instanceof Error?`${Q.name}: ${Q.message}
|
|
2
|
-
${Q.stack}`:I}function kA(Q,A){Q=Q>>>0;const g=S(),I=[];for(let C=Q;C<Q+4*A;C+=4)I.push(F.__wbindgen_externrefs.get(g.getUint32(C,!0)));return F.__externref_drop_slice(Q,A),I}function n(Q,A){return Q=Q>>>0,z().subarray(Q/1,Q/1+A)}let d=null;function S(){return(d===null||d.buffer.detached===!0||d.buffer.detached===void 0&&d.buffer!==F.memory.buffer)&&(d=new DataView(F.memory.buffer)),d}function s(Q,A){return Q=Q>>>0,xA(Q,A)}let t=null;function z(){return(t===null||t.byteLength===0)&&(t=new Uint8Array(F.memory.buffer)),t}function K(Q,A){try{return Q.apply(this,A)}catch(g){const I=Z(g);F.__wbindgen_exn_store(I)}}function p(Q){return Q==null}function VA(Q,A,g,I){const C={a:Q,b:A,cnt:1,dtor:g},B=(...i)=>{C.cnt++;try{return I(C.a,C.b,...i)}finally{B._wbg_cb_unref()}};return B._wbg_cb_unref=()=>{--C.cnt===0&&(C.dtor(C.a,C.b),C.a=0,r.unregister(C))},r.register(B,C,C),B}function f(Q,A,g,I){const C={a:Q,b:A,cnt:1,dtor:g},B=(...i)=>{C.cnt++;const D=C.a;C.a=0;try{return I(D,C.b,...i)}finally{C.a=D,B._wbg_cb_unref()}};return B._wbg_cb_unref=()=>{--C.cnt===0&&(C.dtor(C.a,C.b),C.a=0,r.unregister(C))},r.register(B,C,C),B}function W(Q,A,g){if(g===void 0){const D=l.encode(Q),N=A(D.length,1)>>>0;return z().subarray(N,N+D.length).set(D),O=D.length,N}let I=Q.length,C=A(I,1)>>>0;const B=z();let i=0;for(;i<I;i++){const D=Q.charCodeAt(i);if(D>127)break;B[C+i]=D}if(i!==I){i!==0&&(Q=Q.slice(i)),C=g(C,I,I=i+Q.length*3,1)>>>0;const D=z().subarray(C+i,C+I),N=l.encodeInto(Q,D);i+=N.written,C=g(C,I,i,1)>>>0}return O=i,C}function AA(Q){const A=F.__wbindgen_externrefs.get(Q);return F.__externref_table_dealloc(Q),A}let u=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});u.decode();const OA=2146435072;let gA=0;function xA(Q,A){return gA+=A,gA>=OA&&(u=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),u.decode(),gA=A),u.decode(z().subarray(Q,Q+A))}const l=new TextEncoder;"encodeInto"in l||(l.encodeInto=function(Q,A){const g=l.encode(Q);return A.set(g),{read:Q.length,written:g.length}});let O=0,F;function dA(Q,A){return F=Q.exports,d=null,t=null,F.__wbindgen_start(),F}async function WA(Q,A){if(typeof Response=="function"&&Q instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(Q,A)}catch(C){if(Q.ok&&g(Q.type)&&Q.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",C);else throw C}const I=await Q.arrayBuffer();return await WebAssembly.instantiate(I,A)}else{const I=await WebAssembly.instantiate(Q,A);return I instanceof WebAssembly.Instance?{instance:I,module:Q}:I}function g(I){switch(I){case"basic":case"cors":case"default":return!0}return!1}}async function TA(Q){if(F!==void 0)return F;Q!==void 0&&(Object.getPrototypeOf(Q)===Object.prototype?{module_or_path:Q}=Q:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),Q===void 0&&(Q=new URL("",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:x&&x.tagName.toUpperCase()==="SCRIPT"&&x.src||new URL("glassjar.umd.cjs",document.baseURI).href));const A=sA();(typeof Q=="string"||typeof Request=="function"&&Q instanceof Request||typeof URL=="function"&&Q instanceof URL)&&(Q=fetch(Q));const{instance:g,module:I}=await WA(await Q,A);return dA(g)}const ZA=new URL("https://cdn.jsdelivr.net/npm/glassjar@0.7.0/dist/engine_bg.wasm"),tA=Object.freeze({maxObjectBytes:128*1024*1024,maxEntries:256,maxMetadataBytes:8*1024*1024,maxEntryMetadataBytes:1024*1024});class zA{records=new Map;staged=new Map;stagingFailed=!1;objectBytes=0;metadataBytes=0;evictions=0;oversized=0;limits;constructor(A={}){this.limits=Object.freeze({...tA,...A});for(const g of Object.values(this.limits))if(!Number.isSafeInteger(g)||g<0)throw new RangeError("C++ cache limits must be nonnegative safe integers")}beginBatch(){this.discardBatch(),this.stagingFailed=!1}stage(A){if(this.stagingFailed)return;const g=this.recordSize(A);if(g===void 0||this.staged.has(A.source)){this.failBatch();return}const I=this.limits;for(;this.records.size&&(this.records.size+this.staged.size>=I.maxEntries||this.objectBytes+A.object.byteLength>I.maxObjectBytes||this.metadataBytes+g>I.maxMetadataBytes);)this.remove(this.records.keys().next().value),this.evictions++;if(this.records.size+this.staged.size>=I.maxEntries||this.objectBytes+A.object.byteLength>I.maxObjectBytes||this.metadataBytes+g>I.maxMetadataBytes||g>I.maxEntryMetadataBytes){this.oversized++,this.failBatch();return}this.staged.set(A.source,{...A,object:new Uint8Array(A.object),metadataBytes:g}),this.objectBytes+=A.object.byteLength,this.metadataBytes+=g}abandonBatch(){this.failBatch()}failBatch(){this.discardBatch(),this.stagingFailed=!0}recordSize(A){if(!(typeof A.source!="string"||!A.source.startsWith("/")||A.source.split("/").slice(1).some(g=>!g||g==="."||g==="..")||typeof A.key!="string"||typeof A.object_hash!="string"||!/^[a-f0-9]{64}$/.test(A.key)||!/^[a-f0-9]{64}$/.test(A.object_hash)||A.receipt!=null&&typeof A.receipt!="string"||!(A.object instanceof Uint8Array)))return new TextEncoder().encode(JSON.stringify({source:A.source,key:A.key,object_hash:A.object_hash,...A.receipt==null?{}:{receipt:A.receipt}})).byteLength}async validateBatch(){if(this.stagingFailed)return!1;const A=[...this.staged.values()];for(const g of A){if(!fA(g.object))return!1;const I=await crypto.subtle.digest("SHA-256",g.object);if(Array.from(new Uint8Array(I),B=>B.toString(16).padStart(2,"0")).join("")!==g.object_hash)return!1}return!0}commitBatch(){for(const[A,g]of this.staged)this.remove(A),this.records.set(A,g);this.staged.clear(),this.stagingFailed=!1}discardBatch(){for(const A of this.staged.values())this.objectBytes-=A.object.byteLength,this.metadataBytes-=A.metadataBytes;this.staged.clear()}snapshot(){return[...this.records.values()].map(({source:A,key:g,object_hash:I,object:C,receipt:B})=>({source:A,key:g,object_hash:I,...B==null?{}:{receipt:B},object:C.slice()}))}touch(A){const g=this.records.get(A);g&&(this.records.delete(A),this.records.set(A,g))}put(A){if(typeof A.source!="string"||!A.source.startsWith("/")||A.source.split("/").slice(1).some(B=>!B||B==="."||B==="..")||typeof A.key!="string"||typeof A.object_hash!="string"||!/^[a-f0-9]{64}$/.test(A.object_hash)||!/^[a-f0-9]{64}$/.test(A.key)||!(A.object instanceof Uint8Array))return;const g=this.recordSize(A);if(g===void 0)return;const I=this.limits;if(this.remove(A.source),I.maxEntries===0||A.object.byteLength>I.maxObjectBytes||g>I.maxMetadataBytes||g>I.maxEntryMetadataBytes){this.oversized++;return}for(;this.records.size>=I.maxEntries||this.objectBytes+A.object.byteLength>I.maxObjectBytes||this.metadataBytes+g>I.maxMetadataBytes;)this.remove(this.records.keys().next().value),this.evictions++;const C={...A,object:new Uint8Array(A.object),metadataBytes:g};this.records.set(A.source,C),this.objectBytes+=C.object.byteLength,this.metadataBytes+=g}delete(A){this.remove(A)}remove(A){const g=this.records.get(A);g&&(this.objectBytes-=g.object.byteLength,this.metadataBytes-=g.metadataBytes,this.records.delete(A))}clear(){this.records.clear(),this.staged.clear(),this.stagingFailed=!1,this.objectBytes=this.metadataBytes=0}stats(){return{objectBytes:this.objectBytes,metadataBytes:this.metadataBytes,entries:this.records.size,stagingEntries:this.staged.size,stagingObjectBytes:[...this.staged.values()].reduce((A,g)=>A+g.object.byteLength,0),stagingMetadataBytes:[...this.staged.values()].reduce((A,g)=>A+g.metadataBytes,0),evictions:this.evictions,oversized:this.oversized}}}function fA(Q){if(!WebAssembly.validate(Q)||Q.length<8)return!1;let A=8,g=!1;const I=()=>{let C=0,B=0;for(let i=0;i<5&&A<Q.length;i++,B+=7){const D=Q[A++];if(C+=(D&127)*2**B,!(D&128))return C}throw new Error("Malformed object section")};try{for(;A<Q.length;){const C=Q[A++],B=I(),i=A+B;if(i>Q.length||C===8)return!1;if(C===0){const D=I();if(A+D>i)return!1;const N=new TextDecoder().decode(Q.subarray(A,A+D));if(A+=D,N==="linking"){if(g||I()!==2)return!1;g=!0}}A=i}return g}catch{return!1}}const U=Symbol();function h(Q){return Q instanceof Error?{type:"error",error:{type:Q.constructor.name,message:Q.message}}:{type:"error",error:{type:typeof Q,message:String(Q)}}}class MA{name;data;constructor(A,g){this.name=A,this.data=g}download(){const A=new Uint8Array(this.data),g=new Blob([A]),I=URL.createObjectURL(g),C=document.createElement("a");C.href=I,C.download=this.name,document.body.appendChild(C),C.click(),document.body.removeChild(C),URL.revokeObjectURL(I)}}class GA extends wA{[U];dap;enabled=!0;set filterInternals(A){this.dap.setFilterInternals(A)}constructor(){super(),this[U]={attach:this.attach.bind(this),detach:this.detach.bind(this),beginRun:()=>this.dap.resetRun()},this.onMessage=this.onMessage.bind(this),this.dap=new _,this.dap.on(this.onMessage)}send(A){return this.dap.sendMessage(A)}artifactListener=A=>{if(A.data.type!=="artifact")return;const g=new MA(A.data.name,new Uint8Array(A.data.data));this.emit("artifact",g)};attach(A){A.addEventListener("message",this.artifactListener),this.dap.attach(A)}detach(A){A.removeEventListener("message",this.artifactListener),this.dap.detach()}onMessage(A){this.emit("event",A)}}const lA="glassjar-wasm:";function PA(Q,A){const g=new URL(String(Q),A);if(g.protocol!=="https:"&&g.protocol!=="http:")throw new TypeError(`Engine Wasm must be served over http(s), not ${g.protocol}`);return g.href}function bA(Q){return new Worker(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/worker-uI0K1NG6.js").href:new URL("assets/worker-uI0K1NG6.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||document.baseURI).href),{type:"module",name:Q?.name})}function XA(Q){return new bA(Q?{name:lA+Q}:void 0)}const mA="/dev/debugger-sh-host";class KA{buffer=new SharedArrayBuffer(4+64*1024);length=new Int32Array(this.buffer,0,1);bytes=new Uint8Array(this.buffer,4);publish(A){Atomics.store(this.length,0,A),Atomics.notify(this.length,0)}}function IA(Q){try{return new Error(`Host device callback failed: ${Q instanceof Error?Q.message:String(Q)}`)}catch{return new Error("Host device callback failed")}}function yA(Q){try{const A=Q?.();if(A&&typeof A.then=="function")return Promise.resolve(A).catch(()=>{}),new TypeError("Host device cleanup must be synchronous")}catch(A){return IA(A)}}class rA{constructor(A){this.onFailure=A}incoming=new KA;outgoing=new KA;workerStart={guest_to_host:this.incoming.buffer,host_to_guest:this.outgoing.buffer};abort=new AbortController;listeners=new Set;cleanup;worker;writing=!1;open(A){let g;try{g=A({signal:this.abort.signal,onData:I=>{if(this.assertOpen(),typeof I!="function")throw new TypeError("Host device listener must be a function");return this.listeners.add(I),()=>{this.listeners.delete(I)}},write:I=>this.write(I)})}catch(I){throw IA(I)}if(g!==void 0&&typeof g!="function")throw Promise.resolve(g).catch(()=>{}),new TypeError("Host device opener must return a cleanup function or undefined");if(typeof g=="function")if(this.abort.signal.aborted){const I=yA(g);if(I)throw I}else this.cleanup=g}attach(A){this.assertOpen(),this.worker=A,A.addEventListener("message",this.onMessage)}assertOpen(){if(this.abort.signal.aborted)throw new Error("Host device is closed")}async write(A){if(this.assertOpen(),!(A instanceof Uint8Array))throw new TypeError("Host device writes require Uint8Array");if(this.writing)throw new Error("Await the previous host device write before writing again");this.writing=!0;try{const g=new Uint8Array(A),I=this.outgoing;let C=0;for(;C<g.length;){this.assertOpen();const B=Atomics.load(I.length,0);if(B!==0){await Atomics.waitAsync(I.length,0,B).value;continue}const i=g.subarray(C,C+I.bytes.length);I.bytes.set(i),I.publish(i.length),C+=i.length}}finally{this.writing=!1}}onMessage=A=>{if(!(this.abort.signal.aborted||A.data?.type!=="host_wake"))try{const g=Atomics.load(this.incoming.length,0);if(g<=0)return;const I=this.incoming.bytes.slice(0,g);this.incoming.publish(0);for(const C of this.listeners){if(this.abort.signal.aborted)break;Promise.resolve(C(I)).catch(B=>this.fail(B))}}catch(g){this.fail(g)}};fail(A){this.abort.signal.aborted||(this.close(),this.onFailure(IA(A)))}close(){if(this.abort.signal.aborted)return;this.worker?.removeEventListener("message",this.onMessage),this.worker=void 0,this.incoming.publish(-1),this.outgoing.publish(-1),this.abort.abort(),this.listeners.clear();const A=this.cleanup;return this.cleanup=void 0,yA(A)}}const nA=["4847c7cda81eb51b1cec18fe40b396605579fe84e17eca2760702b8a9666e4e1"],v=Object.freeze({compiler:"d6b8d6e4596136fc6ae451fe3b81b1be5a1829505cbc993179247c75a764ce87",sysroot:"8745c6af23fd841fa507d0c73f6b6b8e8da1b4ec216a6339739a28b38ff7227b",exceptions:"20986166552953de0e3ca5c1e9f341e7aec8b9ba54dcb244d0d2b2f9ca843ab4"});function RA(Q="legacy"){if(Q==="legacy")return{profile:Q,digests:v};if(Q==="stock-certified-v1"&&nA.length>0)return{profile:Q,digests:v};throw new Error(`The ${Q} toolchain is not available in this build`)}class P{#A;hashCount=3;hashMs;constructor(A,g){this.#A=A,this.hashMs=g}static async load(A,g,I,C=v.exceptions,B="legacy"){const i=RA(B);if(A.length!==2)throw new Error("Missing C++ toolchain assets");let D,N;const y=await Promise.allSettled(A.map(async(b,EA)=>{try{const V=await fetch(b,{cache:"force-cache",signal:I});if(!V.ok)throw new Error(`Cannot load C++ toolchain (${V.status})`);return EA===0&&g&&typeof WebAssembly.compileStreaming=="function"&&typeof V.clone=="function"&&(N=WebAssembly.compileStreaming(V.clone()).catch(()=>{})),new Uint8Array(await V.arrayBuffer())}catch(V){throw D??={error:V},V}}));if(y[0].status==="rejected"||y[1].status==="rejected")throw D?.error;const[J,L]=[y[0].value,y[1].value],[Y,c]=await Promise.allSettled([P.ingestOwned(J,L,!1,C),g?(N??Promise.resolve(void 0)).then(b=>b??WebAssembly.compile(J)):Promise.resolve(void 0)]);if(Y.status==="rejected")throw Y.reason;const q=Y.value;if(q.#A.compilerHash!==i.digests.compiler||q.#A.sysrootHash!==i.digests.sysroot||q.#A.exceptionsHash!==i.digests.exceptions)throw new Error("C++ toolchain integrity mismatch");if(I?.aborted)throw new DOMException("Toolchain loading aborted","AbortError");if(c.status==="rejected")throw c.reason;return q.#A.stockProfile=i.profile==="stock-certified-v1",q.#A.module=c.value,q}static async fromBytes(A,g,I){const C=new Uint8Array(A),B=new Uint8Array(g);return P.ingestOwned(C,B,I,v.exceptions)}static async ingestOwned(A,g,I,C){const B=performance.now(),i=await Promise.allSettled([YA(A),YA(g)]);if(i[0].status==="rejected")throw i[0].reason;if(i[1].status==="rejected")throw i[1].reason;const[D,N]=[i[0].value,i[1].value],y=I?await WebAssembly.compile(A):void 0;return new P({compiler:A,sysroot:g,compilerHash:D,sysrootHash:N,exceptionsHash:C,module:y},performance.now()-B)}matchesExpectation(A){return A.compilerSha256===this.#A.compilerHash&&A.sysrootSha256===this.#A.sysrootHash&&A.exceptionsSha256===this.#A.exceptionsHash}get identity(){return`${this.#A.compilerHash}:${this.#A.sysrootHash}:${this.#A.exceptionsHash}`}get identityBytes(){return this.#A.compiler.byteLength+this.#A.sysroot.byteLength}get compilerBytes(){return this.#A.compiler.byteLength}configure(A,g){try{return A.postMessage({...g,toolchain:this.#A}),!!this.#A.module}catch(I){if(!(I instanceof DOMException)||I.name!=="DataCloneError"||!this.#A.module)throw I;return A.postMessage({...g,toolchain:{...this.#A,module:void 0}}),!1}}}async function YA(Q){const A=await crypto.subtle.digest("SHA-256",Q);return Array.from(new Uint8Array(A),g=>g.toString(16).padStart(2,"0")).join("")}let CA,e;class QA{stdout=new BA(1);stderr=new BA(2);stdin=new a;debugger;lang;scope;fs={};binaryFiles={};cppArtifacts;hostDevice;options;retain;idleTimeoutMs;wasmUrl;objects;generation=0;scopeEpoch=0;operationId=0;disposed=!1;active;promise;slot;idleTimer;toolchain;toolchainLoading;toolchainController;initializing=new Set;toolchainIdentity;toolchainIngestions=0;toolchainHashCount=0;toolchainHashMs=0;compilerModuleCloned=!1;disposal;cancellationDraining;releaseDrain;releases=new Set;retirements=0;latest;cacheValidation;static async create(A,g={}){const{wasmUrl:I,...C}=g,B=I===void 0?void 0:PA(I,globalThis.location?.href),i=structuredClone(C),D=B??null;if(e!==void 0&&e!==D)throw new Error("The engine Wasm is already loaded from a different wasmUrl");e=D,CA??=TA({module_or_path:B??ZA}).catch(y=>{throw CA=void 0,e=void 0,y}),await CA;const N=new QA(A,i);if(N.wasmUrl=B,A!=="c"&&typeof window<"u"&&typeof fetch<"u")for(const y of iA(A))fetch(y,{cache:"force-cache"}).then(J=>J.arrayBuffer()).catch(()=>{});return N}constructor(A,g){const I=g.cpp;this.retain=g.retainWorker??I?.retainWorker??!0;const C=g.idleTimeoutMs??I?.idleTimeoutMs??3e4;if(!Number.isSafeInteger(C)||C<1||C>3e5)throw new RangeError("Worker idle timeout must be between 1 and 300000 milliseconds");if(this.idleTimeoutMs=C,I){if(A!=="c")throw new TypeError("C++ performance options require C/C++");if(!I.scope?.projectId||!I.scope.accountId)throw new TypeError("C++ performance options require project and account identity");if(I.compilerLifetime!==void 0&&!["idle","project"].includes(I.compilerLifetime))throw new TypeError("Invalid compiler lifetime");RA(I.toolchainProfile),this.scope=Object.freeze({...I.scope}),this.options=Object.freeze({...I,scope:this.scope,idleTimeoutMs:C})}this.objects=new zA(typeof I?.objectCache=="object"?I.objectCache:{}),this.debugger=new GA,this.lang=A}get cacheCompilerModule(){return this.options?.cacheCompilerModule??this.retain}get cacheStats(){return structuredClone({...this.objects.stats(),generation:this.generation,scopeEpoch:this.scopeEpoch,operationId:this.operationId,cacheEpoch:this.generation,toolchainProfile:this.options?.toolchainProfile??"legacy",cacheEligible:this.cacheValidation?.eligible??!1,stockCertificateSha256:this.cacheValidation?.certificate,cacheEligibilitySnapshot:this.cacheValidation?.snapshot,cacheEligibilityOperationId:this.cacheValidation?.operationId,cacheEligibilityReason:this.cacheValidation?.reason,toolchainIdentityBytes:this.toolchain?.identityBytes??0,toolchainIngestions:this.toolchainIngestions,toolchainHashCount:this.toolchainHashCount,toolchainHashMs:this.toolchainHashMs,compilerModuleCloned:this.compilerModuleCloned,workerRetained:!!this.slot&&!this.active,workerRetirements:this.retirements,compilerModuleIdentityBytes:this.cacheCompilerModule?this.toolchain?.compilerBytes??0:0,latest:this.active?.stats??this.latest})}clearCaches(){this.cacheValidation=void 0,this.generation++,this.objects.clear(),this.toolchain=void 0,this.active||(this.toolchainController?.abort(),this.toolchainLoading=void 0),this.active||this.retireWorker()}stop(){return this.clearCaches(),this.cancelCurrentOperation()}cancelCurrentOperation(){if(this.cancellationDraining)return this.cancellationDraining;this.operationId++;const A=this.promise,g=this.active?.publication;this.retireWorker(),this.objects.discardBatch(),this.active&&this.finish(this.active,{type:"stopped"});const I=Promise.allSettled([A,g]).then(()=>{this.cancellationDraining===I&&(this.cancellationDraining=void 0)});return this.cancellationDraining=I,I}releaseCompilerResources(A={}){const g=A.signal;return g?.aborted?Promise.resolve("cancelled"):this.disposed?Promise.resolve("released"):new Promise(I=>{const C={resolve:I,signal:g,abort:()=>this.settleRelease(C,"cancelled")};this.releases.add(C),g?.addEventListener("abort",C.abort,{once:!0}),this.flushReleases()})}settleRelease(A,g){this.releases.delete(A)&&(A.signal?.removeEventListener("abort",A.abort),A.resolve(g))}flushReleases(){if(!(this.active||!this.releases.size||this.releaseDrain)){if(this.initializing.size){this.toolchainController?.abort();const A=[...this.initializing];this.toolchainLoading=void 0,this.releaseDrain=Promise.allSettled(A).then(()=>{this.releaseDrain=void 0,this.flushReleases()});return}this.retireWorker(),this.toolchainController?.abort(),this.toolchain=void 0,this.toolchainLoading=void 0;for(const A of this.releases)this.settleRelease(A,"released")}}dispose(){if(this.disposal)return this.disposal;this.disposed=!0,this.scopeEpoch++,this.fs={},this.binaryFiles={},this.cppArtifacts=void 0,this.hostDevice=void 0,this.stdout.removeAllListeners(),this.stderr.removeAllListeners(),this.debugger.removeAllListeners();const A=[...this.initializing];return this.toolchainController?.abort(),this.disposal=Promise.allSettled([this.stop(),...A]).then(()=>{this.latest=void 0,this.flushReleases()}),this.disposal}prepareCompiler(A){if(A?.validateCacheInputs!==void 0&&typeof A.validateCacheInputs!="boolean")return Promise.resolve(h(new TypeError("Invalid compiler preparation options")));const g=A?.validateCacheInputs===!0&&this.options?.toolchainProfile==="stock-certified-v1"&&!!this.options?.objectCache&&this.objects.limits.maxEntries>0&&this.objects.limits.maxObjectBytes>0&&this.objects.limits.maxMetadataBytes>0&&this.objects.limits.maxEntryMetadataBytes>0;return this.submit(!0,!0,g)}run(){return this.submit(!1)}compile(){return this.submit(!0)}submit(A,g=!1,I=!1){if(this.disposed)return Promise.resolve(h(new Error("Engine is disposed")));if(this.active||this.cancellationDraining)return Promise.resolve(h(new Error("An engine job is already active")));if(A&&this.lang!=="c")return Promise.resolve(h(new Error("Compile-only is supported for C/C++")));this.cacheValidation=void 0;const C=g&&!I;let B;try{const Y=C||!this.cppArtifacts?null:{...this.cppArtifacts};if(Y?.cacheCertificate!==void 0){const c=Y.cacheCertificate;(typeof c!="string"||c.length>1024*1024||new TextEncoder().encode(c).byteLength>1024*1024)&&delete Y.cacheCertificate}B={fs:C?{}:structuredClone(this.fs),binary_files:Object.fromEntries(Object.entries(C?{}:this.binaryFiles).map(([c,q])=>[c,new Uint8Array(q)])),cpp_artifacts:structuredClone(Y)}}catch(Y){return Promise.resolve(h(Y))}const i=!A&&this.debugger.enabled,D=A?void 0:this.hostDevice;if(D!==void 0&&(typeof D!="function"||!["c","python"].includes(this.lang)))return Promise.resolve(h(new TypeError("Invalid host device configuration")));clearTimeout(this.idleTimer),this.stdin[U].clear();const N=!!this.slot;let y;const J=new Promise(Y=>{y=Y});this.promise=J;const L={generation:this.generation,scopeEpoch:this.scopeEpoch,operationId:++this.operationId,cacheEpoch:this.generation,prepareOnly:g,validateCacheInputs:I,settled:!1,buildOnly:A,debug:i,opener:D,startedAt:performance.now(),resolve:y,stats:{operation:g?"prepare_compiler":A?"compile":"run",workerReadyMs:0,workerReused:N},start:{...B,lang:this.lang,prepare_compiler:g,validate_cache_inputs:I,scope_epoch:this.scopeEpoch,operation_id:this.operationId,cache_epoch:this.generation,is_debug:i,build_only:A,stdin_buffer:this.stdin[U].buffer,cpp_cache:this.options?.objectCache&&!i&&!g?{generation:this.generation,entries:this.objects.snapshot(),max_entry_metadata_bytes:Math.min(this.objects.limits.maxEntryMetadataBytes,this.objects.limits.maxMetadataBytes,1024*1024)}:null}};this.objects.beginBatch(),this.active=L;try{if(this.slot||this.makeWorker(),!this.current(L))return J;const Y=this.slot;this.lang==="c"&&!this.toolchain&&this.ensureToolchain().catch(c=>{this.current(L)&&this.slot===Y&&this.finish(L,h(c))}),this.slot.ready&&this.dispatch(L)}catch(Y){this.finish(L,h(Y))}return J}current(A){return this.active===A&&!A.settled}makeWorker(){const A=XA(this.wasmUrl),g={worker:A,ready:!1,remove:()=>{}};this.slot=g;const I=i=>{if(this.slot!==g)return;const D=i.data,N=this.active;if(D.type==="ready"){if(g.ready)return;g.ready=!0,N&&this.current(N)&&this.dispatch(N);return}if(!(!N||!this.current(N))){if(!g.ready&&D.type==="error"){this.finish(N,h(new Error(D.message)));return}if(!(D.operationId!==N.operationId||D.scopeEpoch!==N.scopeEpoch))try{if(D.type==="cpp_cache_eligibility"){if(this.options?.toolchainProfile!=="stock-certified-v1"||N.prepareOnly&&!N.validateCacheInputs)return;const y=L=>typeof L=="string"&&/^[0-9a-f]{64}$/.test(L),J=D.eligible===!0&&y(D.certificate_sha256)&&y(D.snapshot);this.cacheValidation={eligible:J,certificate:y(D.certificate_sha256)?D.certificate_sha256:void 0,snapshot:J?D.snapshot:void 0,operationId:N.operationId,reason:J?void 0:typeof D.reason=="string"?D.reason.slice(0,128):"stock-input-validation"}}else if(D.type==="stop")this.finish(N,{type:"completed",exitCode:D.exit_code,timing:{totalMs:performance.now()-N.startedAt,buildMs:D.build_ms,runMs:D.run_ms}});else if(D.type==="error")this.finish(N,h(new Error(D.message)));else if(D.type==="cpp_cache_object"&&D.generation===this.generation&&N.generation===this.generation)try{this.objects.stage(D)}catch{this.objects.abandonBatch()}else D.type==="cpp_cache_stats"&&D.generation===N.generation?N.stats.cache=D.stats:D.type==="cpp_cache_abandon"?this.objects.abandonBatch():D.type==="object_build_complete"?N.publication??=this.publishObjects(N,g):D.type==="compiler_module_stats"&&(N.stats.compilerModule=D)}catch(y){this.finish(N,h(y))}}},C=i=>{this.slot===g&&(this.clearCaches(),this.active?this.finish(this.active,h(i.error??new Error(i.message))):this.retireWorker())},B=()=>C({message:"Unreadable execution worker message"});this.debugger[U].attach(A),A.addEventListener("message",I),A.addEventListener("error",C),A.addEventListener("messageerror",B),g.remove=()=>{A.removeEventListener("message",I),A.removeEventListener("error",C),A.removeEventListener("messageerror",B),this.debugger[U].detach(A)}}async publishObjects(A,g){let I=!1;try{I=await this.objects.validateBatch()}catch{}if(!(!this.current(A)||this.slot!==g)){try{I&&A.cacheEpoch===this.generation?this.objects.commitBatch():(this.objects.abandonBatch(),this.cacheValidation?.operationId===A.operationId&&(this.cacheValidation={...this.cacheValidation,eligible:!1,snapshot:void 0,reason:"stock-publication-budget-or-validation"}))}catch{this.objects.clear(),this.cacheValidation?.operationId===A.operationId&&(this.cacheValidation={...this.cacheValidation,eligible:!1,snapshot:void 0,reason:"stock-publication-failure"})}this.current(A)&&g.worker.postMessage({type:"object_build_ack",scopeEpoch:A.scopeEpoch,operationId:A.operationId,cacheEpoch:A.cacheEpoch})}}ensureToolchain(){if(this.toolchain)return Promise.resolve(this.toolchain);if(this.toolchainLoading)return this.toolchainLoading;this.toolchainController=new AbortController;const A=P.load(iA("c"),this.cacheCompilerModule,this.toolchainController.signal,cA(),this.options?.toolchainProfile);return this.toolchainLoading=A,this.initializing.add(A),A.then(()=>this.initializing.delete(A),()=>{this.initializing.delete(A),this.toolchainLoading===A&&(this.toolchainLoading=void 0)}),A}async dispatch(A){const g=this.slot;if(!(!this.current(A)||!g))try{if(this.lang==="c"){const B=this.scopeEpoch,i=this.generation,D=this.ensureToolchain(),N=this.toolchain??await D;if(!this.current(A)||this.slot!==g||B!==this.scopeEpoch)return;const y=A.start.cpp_artifacts?.requiredToolchain;if(y&&!N.matchesExpectation(y)){this.finish(A,{type:"error",error:{type:"artifact-toolchain-integrity",message:"C++ artifacts require a different compiler, sysroot, or exception runtime"}});return}i===this.generation&&(this.toolchainIdentity&&this.toolchainIdentity!==N.identity&&(this.objects.clear(),A.start.cpp_cache=null),this.toolchain!==N&&(this.toolchainIngestions++,this.toolchainHashCount+=N.hashCount,this.toolchainHashMs+=N.hashMs),this.toolchainIdentity=N.identity,this.toolchain=N,this.toolchainLoading===D&&(this.toolchainLoading=void 0)),g.toolchain!==N&&(this.compilerModuleCloned=N.configure(g.worker,{type:"configure_cpp",cacheCompilerModule:this.cacheCompilerModule}),g.toolchain=N)}if(!this.current(A)||this.slot!==g)return;const I=g.worker;A.stats.workerReadyMs=performance.now()-A.startedAt;const C=B=>this.current(A)&&B.scopeEpoch===A.scopeEpoch&&B.operationId===A.operationId;if(this.stdout[U].attach(I,C),this.stderr[U].attach(I,C),A.prepareOnly||this.debugger[U].beginRun(),A.opener){if(A.device=new rA(B=>this.finish(A,h(B))),A.device.attach(I),A.device.open(A.opener),!this.current(A))return;A.start.host_device=A.device.workerStart}this.current(A)&&(I.postMessage(A.start),A.start.fs={},A.start.binary_files={},A.start.cpp_artifacts=null,A.start.cpp_cache=null)}catch(I){this.current(A)&&(this.toolchainLoading=void 0,this.finish(A,h(I)))}}finish(A,g){if(!this.current(A))return;(g.type!=="completed"||g.exitCode!==0)&&(this.cacheValidation=void 0),A.settled=!0;const I=this.slot?.worker;I&&(this.stdout[U].detach(I),this.stderr[U].detach(I));const C=A.device?.close();C&&(g=h(C));const B=g.type==="completed"&&A.generation===this.generation&&!this.disposed,i=B&&g.type==="completed"&&g.exitCode===0;if(A.generation===this.generation)for(const D of A.stats.cache?.invalid_sources??[])this.objects.delete(D);if(i)for(const D of A.stats.cache?.hit_sources??[])this.objects.touch(D);this.objects.discardBatch(),this.latest=A.stats,this.stdin[U].clear(),(!B||!this.retain)&&this.retireWorker(),!this.disposed&&A.cacheEpoch===this.generation&&(this.slot||this.toolchain&&this.cacheCompilerModule)&&this.options?.compilerLifetime!=="project"&&(this.idleTimer=setTimeout(()=>{this.retireWorker(),this.toolchain=void 0,this.toolchainLoading=void 0},this.idleTimeoutMs)),!this.retain&&!this.cacheCompilerModule&&(this.toolchain=void 0),A.cacheEpoch!==this.generation&&(this.toolchainController?.abort(),this.toolchainLoading=void 0),this.active=void 0,this.promise=void 0,this.flushReleases(),A.resolve(g)}retireWorker(){clearTimeout(this.idleTimer);const A=this.slot;A&&(this.slot=void 0,A.remove(),this.stdout[U].detach(A.worker),this.stderr[U].detach(A.worker),A.worker.onerror=g=>g.preventDefault(),A.worker.terminate(),this.retirements++)}}class BA extends wA{constructor(A){super(),this.mode=A,this.callback=(g=>{const I=g.data;if(this.accepts&&!this.accepts(I)||I.type!=="stdout"||I.mode!==this.mode)return;const C=I.data;this.emit("data",C)}).bind(this),this[U]={attach:this.attach.bind(this),detach:this.detach.bind(this)}}callback;accepts;[U];attach(A,g){this.accepts=g,A.addEventListener("message",this.callback)}detach(A){A.removeEventListener("message",this.callback)}}class a{static BUFFER_SIZE=2048;static HEADER_SIZE=8;static DATA_SIZE=a.BUFFER_SIZE-a.HEADER_SIZE;static READ_IDX=0;static WRITE_IDX=1;static encoder=new TextEncoder;buffer=new SharedArrayBuffer(a.BUFFER_SIZE);generation=0;indices;data;[U];constructor(){this.indices=new Int32Array(this.buffer,0,2),this.data=new Int8Array(this.buffer,a.HEADER_SIZE);const A=()=>this.buffer;this[U]={clear:this.clear.bind(this),get buffer(){return A()}}}clear(){this.generation++,Atomics.notify(this.indices,a.READ_IDX),this.buffer=new SharedArrayBuffer(a.BUFFER_SIZE),this.indices=new Int32Array(this.buffer,0,2),this.data=new Int8Array(this.buffer,a.HEADER_SIZE)}async write(A){const g=typeof A=="string"?a.encoder.encode(A):A;return this.writeBytes(g)}async writeBytes(A){const{DATA_SIZE:g,READ_IDX:I,WRITE_IDX:C}=a;let B=0;const i=this.generation;for(;B<A.length&&i===this.generation;){const D=Atomics.load(this.indices,I);let N=Atomics.load(this.indices,C);N===g-1&&D>0&&(N=0);const y=D<=N?g-N-1:D-N-1;if(y===0){await Atomics.waitAsync(this.indices,I,D).value;continue}const J=Math.min(A.length-B,y);this.data.set(A.subarray(B,B+J),N),Atomics.store(this.indices,C,(N+J)%g),Atomics.notify(this.indices,C),B+=J}}}H.Artifact=MA,H.Debugger=GA,H.Engine=QA,H.HOST_DEVICE_PATH=mA,H.Stdin=a,H.Stdout=BA,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(O,T){typeof exports=="object"&&typeof module<"u"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(O=typeof globalThis<"u"?globalThis:O||self,T(O.engine={}))})(this,(function(O){"use strict";var T=typeof document<"u"?document.currentScript:null;function jA(Q){return Q&&Q.__esModule&&Object.prototype.hasOwnProperty.call(Q,"default")?Q.default:Q}var e={exports:{}},MA;function dA(){if(MA)return e.exports;MA=1;var Q=typeof Reflect=="object"?Reflect:null,A=Q&&typeof Q.apply=="function"?Q.apply:function(i,F,M){return Function.prototype.apply.call(i,F,M)},I;Q&&typeof Q.ownKeys=="function"?I=Q.ownKeys:Object.getOwnPropertySymbols?I=function(i){return Object.getOwnPropertyNames(i).concat(Object.getOwnPropertySymbols(i))}:I=function(i){return Object.getOwnPropertyNames(i)};function g(o){console&&console.warn&&console.warn(o)}var C=Number.isNaN||function(i){return i!==i};function B(){B.init.call(this)}e.exports=B,e.exports.once=s,B.EventEmitter=B,B.prototype._events=void 0,B.prototype._eventsCount=0,B.prototype._maxListeners=void 0;var E=10;function D(o){if(typeof o!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof o)}Object.defineProperty(B,"defaultMaxListeners",{enumerable:!0,get:function(){return E},set:function(o){if(typeof o!="number"||o<0||C(o))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+o+".");E=o}}),B.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},B.prototype.setMaxListeners=function(i){if(typeof i!="number"||i<0||C(i))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+i+".");return this._maxListeners=i,this};function w(o){return o._maxListeners===void 0?B.defaultMaxListeners:o._maxListeners}B.prototype.getMaxListeners=function(){return w(this)},B.prototype.emit=function(i){for(var F=[],M=1;M<arguments.length;M++)F.push(arguments[M]);var y=i==="error",S=this._events;if(S!==void 0)y=y&&S.error===void 0;else if(!y)return!1;if(y){var Y;if(F.length>0&&(Y=F[0]),Y instanceof Error)throw Y;var x=new Error("Unhandled error."+(Y?" ("+Y.message+")":""));throw x.context=Y,x}var u=S[i];if(u===void 0)return!1;if(typeof u=="function")A(u,this,F);else for(var xA=u.length,JI=R(u,xA),M=0;M<xA;++M)A(JI[M],this,F);return!0};function N(o,i,F,M){var y,S,Y;if(D(F),S=o._events,S===void 0?(S=o._events=Object.create(null),o._eventsCount=0):(S.newListener!==void 0&&(o.emit("newListener",i,F.listener?F.listener:F),S=o._events),Y=S[i]),Y===void 0)Y=S[i]=F,++o._eventsCount;else if(typeof Y=="function"?Y=S[i]=M?[F,Y]:[Y,F]:M?Y.unshift(F):Y.push(F),y=w(o),y>0&&Y.length>y&&!Y.warned){Y.warned=!0;var x=new Error("Possible EventEmitter memory leak detected. "+Y.length+" "+String(i)+" listeners added. Use emitter.setMaxListeners() to increase limit");x.name="MaxListenersExceededWarning",x.emitter=o,x.type=i,x.count=Y.length,g(x)}return o}B.prototype.addListener=function(i,F){return N(this,i,F,!1)},B.prototype.on=B.prototype.addListener,B.prototype.prependListener=function(i,F){return N(this,i,F,!0)};function k(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function U(o,i,F){var M={fired:!1,wrapFn:void 0,target:o,type:i,listener:F},y=k.bind(M);return y.listener=F,M.wrapFn=y,y}B.prototype.once=function(i,F){return D(F),this.on(i,U(this,i,F)),this},B.prototype.prependOnceListener=function(i,F){return D(F),this.prependListener(i,U(this,i,F)),this},B.prototype.removeListener=function(i,F){var M,y,S,Y,x;if(D(F),y=this._events,y===void 0)return this;if(M=y[i],M===void 0)return this;if(M===F||M.listener===F)--this._eventsCount===0?this._events=Object.create(null):(delete y[i],y.removeListener&&this.emit("removeListener",i,M.listener||F));else if(typeof M!="function"){for(S=-1,Y=M.length-1;Y>=0;Y--)if(M[Y]===F||M[Y].listener===F){x=M[Y].listener,S=Y;break}if(S<0)return this;S===0?M.shift():H(M,S),M.length===1&&(y[i]=M[0]),y.removeListener!==void 0&&this.emit("removeListener",i,x||F)}return this},B.prototype.off=B.prototype.removeListener,B.prototype.removeAllListeners=function(i){var F,M,y;if(M=this._events,M===void 0)return this;if(M.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):M[i]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete M[i]),this;if(arguments.length===0){var S=Object.keys(M),Y;for(y=0;y<S.length;++y)Y=S[y],Y!=="removeListener"&&this.removeAllListeners(Y);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(F=M[i],typeof F=="function")this.removeListener(i,F);else if(F!==void 0)for(y=F.length-1;y>=0;y--)this.removeListener(i,F[y]);return this};function h(o,i,F){var M=o._events;if(M===void 0)return[];var y=M[i];return y===void 0?[]:typeof y=="function"?F?[y.listener||y]:[y]:F?d(y):R(y,y.length)}B.prototype.listeners=function(i){return h(this,i,!0)},B.prototype.rawListeners=function(i){return h(this,i,!1)},B.listenerCount=function(o,i){return typeof o.listenerCount=="function"?o.listenerCount(i):K.call(o,i)},B.prototype.listenerCount=K;function K(o){var i=this._events;if(i!==void 0){var F=i[o];if(typeof F=="function")return 1;if(F!==void 0)return F.length}return 0}B.prototype.eventNames=function(){return this._eventsCount>0?I(this._events):[]};function R(o,i){for(var F=new Array(i),M=0;M<i;++M)F[M]=o[M];return F}function H(o,i){for(;i+1<o.length;i++)o[i]=o[i+1];o.pop()}function d(o){for(var i=new Array(o.length),F=0;F<i.length;++F)i[F]=o[F].listener||o[F];return i}function s(o,i){return new Promise(function(F,M){function y(Y){o.removeListener(i,S),M(Y)}function S(){typeof o.removeListener=="function"&&o.removeListener("error",y),F([].slice.call(arguments))}v(o,i,S,{once:!0}),i!=="error"&&QA(o,y,{once:!0})})}function QA(o,i,F){typeof o.on=="function"&&v(o,"error",i,F)}function v(o,i,F,M){if(typeof o.on=="function")M.once?o.once(i,F):o.on(i,F);else if(typeof o.addEventListener=="function")o.addEventListener(i,function y(S){M.once&&o.removeEventListener(i,y),F(S)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof o)}return e.exports}var WA=dA();const kA=jA(WA);class BA{__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,UA.unregister(this),A}free(){const A=this.__destroy_into_raw();G.__wbg_dapadapter_free(A,0)}attach(A){G.dapadapter_attach(this.__wbg_ptr,A)}detach(){G.dapadapter_detach(this.__wbg_ptr)}constructor(){const A=G.dapadapter_new();return this.__wbg_ptr=A>>>0,UA.register(this,this.__wbg_ptr,this),this}on(A){G.dapadapter_on(this.__wbg_ptr,A)}resetRun(){G.dapadapter_resetRun(this.__wbg_ptr)}sendMessage(A){return G.dapadapter_sendMessage(this.__wbg_ptr,A)}setFilterInternals(A){G.dapadapter_setFilterInternals(this.__wbg_ptr,A)}}Symbol.dispose&&(BA.prototype[Symbol.dispose]=BA.prototype.free);class z{static __wrap(A){A=A>>>0;const I=Object.create(z.prototype);return I.__wbg_ptr=A,RA.register(I,I.__wbg_ptr,I),I}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,RA.unregister(this),A}free(){const A=this.__destroy_into_raw();G.__wbg_trap_free(A,0)}static __wbg_wasmer_trap(){G.trap___wbg_wasmer_trap()}}Symbol.dispose&&(z.prototype[Symbol.dispose]=z.prototype.free);function ZA(){let Q,A;try{const I=G.cpp_exception_hash();return Q=I[0],A=I[1],q(I[0],I[1])}finally{G.__wbindgen_free(Q,A,1)}}function KA(Q){const A=t(Q,G.__wbindgen_malloc,G.__wbindgen_realloc),I=W,g=G.prefetch_urls(A,I);var C=fA(g[0],g[1]).slice();return G.__wbindgen_free(g[0],g[1]*4,4),C}function TA(){return{__proto__:null,"./engine_bg.js":{__proto__:null,__wbg_BigInt_b7bbccdff258c9f2:function(A){return BigInt(A)},__wbg_Error_8c4e43fe74559d73:function(A,I){return Error(q(A,I))},__wbg_Number_04624de7d0e8332d:function(A){return Number(A)},__wbg_String_8f0eb39a4a4c2f66:function(A,I){const g=String(I),C=t(g,G.__wbindgen_malloc,G.__wbindgen_realloc),B=W;c().setInt32(A+4,B,!0),c().setInt32(A+0,C,!0)},__wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2:function(A,I){const g=I,C=typeof g=="bigint"?g:void 0;c().setBigInt64(A+8,j(C)?BigInt(0):C,!0),c().setInt32(A+0,!j(C),!0)},__wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25:function(A){const I=A,g=typeof I=="boolean"?I:void 0;return j(g)?16777215:g?1:0},__wbg___wbindgen_debug_string_0bc8482c6e3508ae:function(A,I){const g=EA(I),C=t(g,G.__wbindgen_malloc,G.__wbindgen_realloc),B=W;c().setInt32(A+4,B,!0),c().setInt32(A+0,C,!0)},__wbg___wbindgen_function_table_5ae7216dfcbcc506:function(){return G.__wbindgen_export},__wbg___wbindgen_in_47fa6863be6f2f25:function(A,I){return A in I},__wbg___wbindgen_is_bigint_31b12575b56f32fc:function(A){return typeof A=="bigint"},__wbg___wbindgen_is_function_0095a73b8b156f76:function(A){return typeof A=="function"},__wbg___wbindgen_is_object_5ae8e5880f2c1fbd:function(A){const I=A;return typeof I=="object"&&I!==null},__wbg___wbindgen_is_string_cd444516edc5b180:function(A){return typeof A=="string"},__wbg___wbindgen_is_undefined_9e4d92534c42d778:function(A){return A===void 0},__wbg___wbindgen_jsval_eq_11888390b0186270:function(A,I){return A===I},__wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811:function(A,I){return A==I},__wbg___wbindgen_lt_bb59cc3d23526e0d:function(A,I){return A<I},__wbg___wbindgen_neg_6b4d356dff49dcc6:function(A){return-A},__wbg___wbindgen_number_get_8ff4255516ccad3e:function(A,I){const g=I,C=typeof g=="number"?g:void 0;c().setFloat64(A+8,j(C)?0:C,!0),c().setInt32(A+0,!j(C),!0)},__wbg___wbindgen_rethrow_05525c567f154472:function(A){throw A},__wbg___wbindgen_shr_ef8e07cce709eb54:function(A,I){return A>>I},__wbg___wbindgen_string_get_72fb696202c56729:function(A,I){const g=I,C=typeof g=="string"?g:void 0;var B=j(C)?0:t(C,G.__wbindgen_malloc,G.__wbindgen_realloc),E=W;c().setInt32(A+4,E,!0),c().setInt32(A+0,B,!0)},__wbg___wbindgen_throw_be289d5034ed271b:function(A,I){throw new Error(q(A,I))},__wbg__wbg_cb_unref_d9b87ff7982e3b21:function(A){A._wbg_cb_unref()},__wbg_addEventListener_3acb0aad4483804c:function(){return J(function(A,I,g,C){A.addEventListener(q(I,g),C)},arguments)},__wbg_apply_2e22c45cb4f12415:function(){return J(function(A,I,g){return Reflect.apply(A,I,g)},arguments)},__wbg_apply_ada2ee1a60ac7b3c:function(){return J(function(A,I,g){return A.apply(I,g)},arguments)},__wbg_arrayBuffer_bb54076166006c39:function(){return J(function(A){return A.arrayBuffer()},arguments)},__wbg_bind_1dc37de2b9939128:function(A,I,g,C){return A.bind(I,g,C)},__wbg_bind_29ba380591735d8c:function(A,I,g){return A.bind(I,g)},__wbg_buffer_7b5f53e46557d8f1:function(A){return A.buffer},__wbg_byteLength_7b03c17ff1e4037f:function(A){return A.byteLength},__wbg_byteLength_b5d783d06792ed2c:function(A){return A.byteLength},__wbg_call_389efe28435a9388:function(){return J(function(A,I){return A.call(I)},arguments)},__wbg_call_4708e0c13bdc8e95:function(){return J(function(A,I,g){return A.call(I,g)},arguments)},__wbg_compareExchange_b578410c358e695e:function(){return J(function(A,I,g,C){return Atomics.compareExchange(A,I>>>0,g,C)},arguments)},__wbg_constructor_ad6c0ed428f55d34:function(A){return A.constructor},__wbg_crypto_86f2631e91b51511:function(A){return A.crypto},__wbg_customSections_193491b069139fb1:function(A,I,g){return WebAssembly.Module.customSections(A,q(I,g))},__wbg_data_5330da50312d0bc1:function(A){return A.data},__wbg_done_57b39ecd9addfe81:function(A){return A.done},__wbg_entries_58c7934c745daac7:function(A){return Object.entries(A)},__wbg_error_7534b8e9a36f1ab4:function(A,I){let g,C;try{g=A,C=I,console.error(q(A,I))}finally{G.__wbindgen_free(g,C,1)}},__wbg_exports_794a42000dacd046:function(A){return WebAssembly.Module.exports(A)},__wbg_exports_86b4926134c40288:function(A){return A.exports},__wbg_fetch_d1488f40cef1e210:function(A,I,g){return A.fetch(q(I,g))},__wbg_from_bddd64e7d5ff6941:function(A){return Array.from(A)},__wbg_getPrototypeOf_2653517f1dc884d5:function(){return J(function(A){return Reflect.getPrototypeOf(A)},arguments)},__wbg_getRandomValues_b3f15fcbfabb0f8b:function(){return J(function(A,I){A.getRandomValues(I)},arguments)},__wbg_getTime_1e3cd1391c5c3995:function(A){return A.getTime()},__wbg_getTimezoneOffset_81776d10a4ec18a8:function(A){return A.getTimezoneOffset()},__wbg_getUint32_bb6f5a401408e7fa:function(A,I,g){return A.getUint32(I>>>0,g!==0)},__wbg_get_7efbcc3819719b0f:function(){return J(function(A,I){return A.get(I>>>0)},arguments)},__wbg_get_9b94d73e6221f75c:function(A,I){return A[I>>>0]},__wbg_get_b3ed3ad4be2bc8ac:function(){return J(function(A,I){return Reflect.get(A,I)},arguments)},__wbg_get_index_253dd2a9e007656d:function(A,I){return A[I>>>0]},__wbg_get_index_9a5bfdd2ca49c65f:function(A,I){return A[I>>>0]},__wbg_get_with_ref_key_1dc361bd10053bfe:function(A,I){return A[I]},__wbg_grow_5d42bf28c2da22cb:function(){return J(function(A,I){return A.grow(I>>>0)},arguments)},__wbg_grow_d034989fce14cc8e:function(){return J(function(A,I){return A.grow(I>>>0)},arguments)},__wbg_imports_8333d40ab24779ad:function(A){return WebAssembly.Module.imports(A)},__wbg_instanceof_ArrayBuffer_c367199e2fa2aa04:function(A){let I;try{I=A instanceof ArrayBuffer}catch{I=!1}return I},__wbg_instanceof_Error_8573fe0b0b480f46:function(A){let I;try{I=A instanceof Error}catch{I=!1}return I},__wbg_instanceof_Function_2a29eec978bb3b11:function(A){let I;try{I=A instanceof Function}catch{I=!1}return I},__wbg_instanceof_Global_2db767b6b2347f01:function(A){let I;try{I=A instanceof WebAssembly.Global}catch{I=!1}return I},__wbg_instanceof_Map_53af74335dec57f4:function(A){let I;try{I=A instanceof Map}catch{I=!1}return I},__wbg_instanceof_Memory_dc8c61e3f831ee37:function(A){let I;try{I=A instanceof WebAssembly.Memory}catch{I=!1}return I},__wbg_instanceof_Module_d0d412b14363ba9a:function(A){let I;try{I=A instanceof WebAssembly.Module}catch{I=!1}return I},__wbg_instanceof_Object_1c6af87502b733ed:function(A){let I;try{I=A instanceof Object}catch{I=!1}return I},__wbg_instanceof_RangeError_0b0dd056bc557b89:function(A){let I;try{I=A instanceof RangeError}catch{I=!1}return I},__wbg_instanceof_Response_ee1d54d79ae41977:function(A){let I;try{I=A instanceof Response}catch{I=!1}return I},__wbg_instanceof_SharedArrayBuffer_91d8a2fa16a2cc26:function(A){let I;try{I=A instanceof SharedArrayBuffer}catch{I=!1}return I},__wbg_instanceof_Table_127f216e592f4159:function(A){let I;try{I=A instanceof WebAssembly.Table}catch{I=!1}return I},__wbg_instanceof_Tag_f1d6b24a98b95210:function(A){let I;try{I=A instanceof WebAssembly.Tag}catch{I=!1}return I},__wbg_instanceof_Uint8Array_9b9075935c74707c:function(A){let I;try{I=A instanceof Uint8Array}catch{I=!1}return I},__wbg_isArray_d314bb98fcf08331:function(A){return Array.isArray(A)},__wbg_isSafeInteger_bfbc7332a9768d2a:function(A){return Number.isSafeInteger(A)},__wbg_is_f29129f676e5410c:function(A,I){return Object.is(A,I)},__wbg_iterator_6ff6560ca1568e55:function(){return Symbol.iterator},__wbg_length_32ed9a279acd054c:function(A){return A.length},__wbg_length_35a7bace40f36eac:function(A){return A.length},__wbg_length_aeb94ff17a8a8556:function(A){return A.length},__wbg_load_eff64ff5e429a422:function(){return J(function(A,I){return Atomics.load(A,I>>>0)},arguments)},__wbg_message_9ddc4b9a62a7c379:function(A){return A.message},__wbg_msCrypto_d562bbe83e0d4b91:function(A){return A.msCrypto},__wbg_new_0_73afc35eb544e539:function(){return new Date},__wbg_new_245cd5c49157e602:function(A){return new Date(A)},__wbg_new_2ac7fa8be584d280:function(A,I,g){return new DataView(A,I>>>0,g>>>0)},__wbg_new_361308b2356cecd0:function(){return new Object},__wbg_new_3eb36ae241fe6f44:function(){return new Array},__wbg_new_4a996a46a82782b6:function(){return J(function(A,I){return new WebAssembly.Global(A,I)},arguments)},__wbg_new_57c27ff3ddf5b62c:function(){return J(function(A){return new WebAssembly.Module(A)},arguments)},__wbg_new_8a6f238a6ece86ea:function(){return new Error},__wbg_new_a4e3cab1cdd635ba:function(){return J(function(A,I){return new WebAssembly.Instance(A,I)},arguments)},__wbg_new_b061c0550d9f3281:function(){return J(function(A){return new WebAssembly.Memory(A)},arguments)},__wbg_new_b5d9e2fb389fef91:function(A,I){try{var g={a:A,b:I},C=(E,D)=>{const w=g.a;g.a=0;try{return PA(w,g.b,E,D)}finally{g.a=w}};return new Promise(C)}finally{g.a=g.b=0}},__wbg_new_ca409f861989e0c5:function(A){return new SharedArrayBuffer(A>>>0)},__wbg_new_dca287b076112a51:function(){return new Map},__wbg_new_dd2b680c8bf6ae29:function(A){return new Uint8Array(A)},__wbg_new_from_slice_a3d2629dc1826784:function(A,I){return new Uint8Array($(A,I))},__wbg_new_no_args_1c7c842f08d00ebb:function(A,I){return new Function(q(A,I))},__wbg_new_with_args_7bba34e94b1cfa40:function(A,I,g,C){return new Function(q(A,I),q(g,C))},__wbg_new_with_byte_offset_9120ba79e057895b:function(A,I){return new Uint8Array(A,I>>>0)},__wbg_new_with_byte_offset_and_length_aa261d9c9da49eb1:function(A,I,g){return new Uint8Array(A,I>>>0,g>>>0)},__wbg_new_with_byte_offset_and_length_bc2e7b72cc96d1c1:function(A,I,g){return new Int32Array(A,I>>>0,g>>>0)},__wbg_new_with_length_1763c527b2923202:function(A){return new Array(A>>>0)},__wbg_new_with_length_a2c39cbe88fd8ff1:function(A){return new Uint8Array(A>>>0)},__wbg_next_3482f54c49e8af19:function(){return J(function(A){return A.next()},arguments)},__wbg_next_418f80d8f5303233:function(A){return A.next},__wbg_node_e1f24f89a7336c2e:function(A){return A.node},__wbg_notify_78a90977fab74963:function(){return J(function(A,I){return Atomics.notify(A,I>>>0)},arguments)},__wbg_now_a3af9a2f4bbaa4d1:function(){return Date.now()},__wbg_now_ebffdf7e580f210d:function(A){return A.now()},__wbg_ok_87f537440a0acf85:function(A){return A.ok},__wbg_postMessage_2041f4e90af61318:function(){return J(function(A,I){A.postMessage(I)},arguments)},__wbg_process_3975fd6c72f520aa:function(A){return A.process},__wbg_prototypesetcall_bdcdcc5842e4d77d:function(A,I,g){Uint8Array.prototype.set.call($(A,I),g)},__wbg_push_8ffdcb2063340ba5:function(A,I){return A.push(I)},__wbg_queueMicrotask_0aa0a927f78f5d98:function(A){return A.queueMicrotask},__wbg_queueMicrotask_5bb536982f78a56f:function(A){queueMicrotask(A)},__wbg_randomFillSync_f8c153b79f285817:function(){return J(function(A,I){A.randomFillSync(I)},arguments)},__wbg_removeEventListener_e63328781a5b9af9:function(){return J(function(A,I,g,C){A.removeEventListener(q(I,g),C)},arguments)},__wbg_require_b74f47fc2d022fd6:function(){return J(function(){return module.require},arguments)},__wbg_resolve_002c4b7d9d8f6b64:function(A){return Promise.resolve(A)},__wbg_setTimeout_e0aacd5a637418a6:function(){return J(function(A,I,g){return A.setTimeout(I,g)},arguments)},__wbg_setUint32_d168af7751a8557e:function(A,I,g,C){A.setUint32(I>>>0,g>>>0,C!==0)},__wbg_set_0af2522656c2a71b:function(){return J(function(A,I,g){A.set(I>>>0,g)},arguments)},__wbg_set_1eb0999cf5d27fc8:function(A,I,g){return A.set(I,g)},__wbg_set_25cf9deff6bf0ea8:function(A,I,g){A.set(I,g>>>0)},__wbg_set_3f1d0b984ed272ed:function(A,I,g){A[I]=g},__wbg_set_6cb8631f80447a67:function(){return J(function(A,I,g){return Reflect.set(A,I,g)},arguments)},__wbg_set_cc56eefd2dd91957:function(A,I,g){A.set($(I,g))},__wbg_set_f43e577aea94465b:function(A,I,g){A[I>>>0]=g},__wbg_set_index_b3244a6c458021e4:function(A,I,g){A[I>>>0]=g},__wbg_set_index_f259b54e97f7b177:function(A,I,g){A[I>>>0]=g},__wbg_set_onmessage_ea7cc2ba099021cd:function(A,I){A.onmessage=I},__wbg_set_value_fc06e541de098215:function(A,I){A.value=I},__wbg_slice_8bbd46adb2100583:function(A,I,g){return A.slice(I>>>0,g>>>0)},__wbg_stack_0ed75d68575b0f3c:function(A,I){const g=I.stack,C=t(g,G.__wbindgen_malloc,G.__wbindgen_realloc),B=W;c().setInt32(A+4,B,!0),c().setInt32(A+0,C,!0)},__wbg_static_accessor_GLOBAL_12837167ad935116:function(){const A=typeof global>"u"?null:global;return j(A)?0:l(A)},__wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f:function(){const A=typeof globalThis>"u"?null:globalThis;return j(A)?0:l(A)},__wbg_static_accessor_SELF_a621d3dfbb60d0ce:function(){const A=typeof self>"u"?null:self;return j(A)?0:l(A)},__wbg_static_accessor_WINDOW_f8727f0cf888e0bd:function(){const A=typeof window>"u"?null:window;return j(A)?0:l(A)},__wbg_store_d1d951c98d9bed41:function(){return J(function(A,I,g){return Atomics.store(A,I>>>0,g)},arguments)},__wbg_subarray_a96e1fef17ed23cb:function(A,I,g){return A.subarray(I>>>0,g>>>0)},__wbg_then_0d9fe2c7b1857d32:function(A,I,g){return A.then(I,g)},__wbg_then_b9e7b3b5f1a9e1b5:function(A,I){return A.then(I)},__wbg_toString_56d946daff83867b:function(A,I,g){const C=I.toString(g),B=t(C,G.__wbindgen_malloc,G.__wbindgen_realloc),E=W;c().setInt32(A+4,E,!0),c().setInt32(A+0,B,!0)},__wbg_toString_964ff7fe6eca8362:function(A){return A.toString()},__wbg_trap_new:function(A){return z.__wrap(A)},__wbg_validate_71c2d02a71bda62f:function(){return J(function(A){return WebAssembly.validate(A)},arguments)},__wbg_value_0546255b415e96c1:function(A){return A.value},__wbg_value_ce37a60e576310ff:function(A){return A.value},__wbg_versions_4e31226f5e8dc909:function(A){return A.versions},__wbg_wait_be5dae1e53f590f1:function(){return J(function(A,I,g){return Atomics.wait(A,I>>>0,g)},arguments)},__wbg_warn_81ab00e6e16e886d:function(A,I,g){console.warn(A,I,g)},__wbindgen_cast_0000000000000001:function(A,I){return bA(A,I,G.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__Fn__web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent____Output_______,VA)},__wbindgen_cast_0000000000000002:function(A,I){return b(A,I,G.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__Fn__web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent____Output_______,tA)},__wbindgen_cast_0000000000000003:function(A,I){return b(A,I,G.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_9eaf8169b8189500___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_9eaf8169b8189500___Array__wasm_bindgen_36932265c58943ab___JsValue___,yA)},__wbindgen_cast_0000000000000004:function(A,I){return b(A,I,G.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_9eaf8169b8189500___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_9eaf8169b8189500___Array__wasm_bindgen_36932265c58943ab___JsValue___,yA)},__wbindgen_cast_0000000000000005:function(A,I){return b(A,I,G.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_9eaf8169b8189500___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_9eaf8169b8189500___Array__wasm_bindgen_36932265c58943ab___JsValue___,lA)},__wbindgen_cast_0000000000000006:function(A,I){return b(A,I,G.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__FnMut__wasm_bindgen_36932265c58943ab___JsValue____Output_______,zA)},__wbindgen_cast_0000000000000007:function(A){return A},__wbindgen_cast_0000000000000008:function(A){return A},__wbindgen_cast_0000000000000009:function(A,I){return $(A,I)},__wbindgen_cast_000000000000000a:function(A,I){return q(A,I)},__wbindgen_cast_000000000000000b:function(A,I){return BigInt.asUintN(64,A)|BigInt.asUintN(64,I)<<BigInt(64)},__wbindgen_cast_000000000000000c:function(A){return BigInt.asUintN(64,A)},__wbindgen_init_externref_table:function(){const A=G.__wbindgen_externrefs,I=A.grow(4);A.set(0,void 0),A.set(I+0,void 0),A.set(I+1,null),A.set(I+2,!0),A.set(I+3,!1)}}}}function VA(Q,A,I){G.wasm_bindgen_36932265c58943ab___convert__closures_____invoke___web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent_____(Q,A,I)}function tA(Q,A,I){G.wasm_bindgen_36932265c58943ab___convert__closures_____invoke___web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent______1_(Q,A,I)}function zA(Q,A,I){G.wasm_bindgen_36932265c58943ab___convert__closures_____invoke___wasm_bindgen_36932265c58943ab___JsValue_____(Q,A,I)}function lA(Q,A,I){const g=G.wasm_bindgen_36932265c58943ab___convert__closures________invoke___js_sys_9eaf8169b8189500___Array__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_36932265c58943ab___JsValue__(Q,A,I);if(g[1])throw DA(g[0])}function yA(Q,A,I){const g=G.wasm_bindgen_36932265c58943ab___convert__closures________invoke___js_sys_9eaf8169b8189500___Array__core_37ee0ce0c4cd57d5___result__Result_js_sys_9eaf8169b8189500___Array__wasm_bindgen_36932265c58943ab___JsValue__(Q,A,I);if(g[2])throw DA(g[1]);return DA(g[0])}function PA(Q,A,I,g){G.wasm_bindgen_36932265c58943ab___convert__closures_____invoke___wasm_bindgen_36932265c58943ab___JsValue__wasm_bindgen_36932265c58943ab___JsValue_____(Q,A,I,g)}const UA=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(Q=>G.__wbg_dapadapter_free(Q>>>0,1)),RA=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(Q=>G.__wbg_trap_free(Q>>>0,1));function l(Q){const A=G.__externref_table_alloc();return G.__wbindgen_externrefs.set(A,Q),A}const _=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(Q=>Q.dtor(Q.a,Q.b));function EA(Q){const A=typeof Q;if(A=="number"||A=="boolean"||Q==null)return`${Q}`;if(A=="string")return`"${Q}"`;if(A=="symbol"){const C=Q.description;return C==null?"Symbol":`Symbol(${C})`}if(A=="function"){const C=Q.name;return typeof C=="string"&&C.length>0?`Function(${C})`:"Function"}if(Array.isArray(Q)){const C=Q.length;let B="[";C>0&&(B+=EA(Q[0]));for(let E=1;E<C;E++)B+=", "+EA(Q[E]);return B+="]",B}const I=/\[object ([^\]]+)\]/.exec(toString.call(Q));let g;if(I&&I.length>1)g=I[1];else return toString.call(Q);if(g=="Object")try{return"Object("+JSON.stringify(Q)+")"}catch{return"Object"}return Q instanceof Error?`${Q.name}: ${Q.message}
|
|
2
|
+
${Q.stack}`:g}function fA(Q,A){Q=Q>>>0;const I=c(),g=[];for(let C=Q;C<Q+4*A;C+=4)g.push(G.__wbindgen_externrefs.get(I.getUint32(C,!0)));return G.__externref_drop_slice(Q,A),g}function $(Q,A){return Q=Q>>>0,f().subarray(Q/1,Q/1+A)}let V=null;function c(){return(V===null||V.buffer.detached===!0||V.buffer.detached===void 0&&V.buffer!==G.memory.buffer)&&(V=new DataView(G.memory.buffer)),V}function q(Q,A){return Q=Q>>>0,XA(Q,A)}let P=null;function f(){return(P===null||P.byteLength===0)&&(P=new Uint8Array(G.memory.buffer)),P}function J(Q,A){try{return Q.apply(this,A)}catch(I){const g=l(I);G.__wbindgen_exn_store(g)}}function j(Q){return Q==null}function bA(Q,A,I,g){const C={a:Q,b:A,cnt:1,dtor:I},B=(...E)=>{C.cnt++;try{return g(C.a,C.b,...E)}finally{B._wbg_cb_unref()}};return B._wbg_cb_unref=()=>{--C.cnt===0&&(C.dtor(C.a,C.b),C.a=0,_.unregister(C))},_.register(B,C,C),B}function b(Q,A,I,g){const C={a:Q,b:A,cnt:1,dtor:I},B=(...E)=>{C.cnt++;const D=C.a;C.a=0;try{return g(D,C.b,...E)}finally{C.a=D,B._wbg_cb_unref()}};return B._wbg_cb_unref=()=>{--C.cnt===0&&(C.dtor(C.a,C.b),C.a=0,_.unregister(C))},_.register(B,C,C),B}function t(Q,A,I){if(I===void 0){const D=m.encode(Q),w=A(D.length,1)>>>0;return f().subarray(w,w+D.length).set(D),W=D.length,w}let g=Q.length,C=A(g,1)>>>0;const B=f();let E=0;for(;E<g;E++){const D=Q.charCodeAt(E);if(D>127)break;B[C+E]=D}if(E!==g){E!==0&&(Q=Q.slice(E)),C=I(C,g,g=E+Q.length*3,1)>>>0;const D=f().subarray(C+E,C+g),w=m.encodeInto(Q,D);E+=w.written,C=I(C,g,E,1)>>>0}return W=E,C}function DA(Q){const A=G.__wbindgen_externrefs.get(Q);return G.__externref_table_dealloc(Q),A}let AA=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});AA.decode();const mA=2146435072;let wA=0;function XA(Q,A){return wA+=A,wA>=mA&&(AA=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),AA.decode(),wA=A),AA.decode(f().subarray(Q,Q+A))}const m=new TextEncoder;"encodeInto"in m||(m.encodeInto=function(Q,A){const I=m.encode(Q);return A.set(I),{read:Q.length,written:I.length}});let W=0,G;function rA(Q,A){return G=Q.exports,V=null,P=null,G.__wbindgen_start(),G}async function nA(Q,A){if(typeof Response=="function"&&Q instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(Q,A)}catch(C){if(Q.ok&&I(Q.type)&&Q.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",C);else throw C}const g=await Q.arrayBuffer();return await WebAssembly.instantiate(g,A)}else{const g=await WebAssembly.instantiate(Q,A);return g instanceof WebAssembly.Instance?{instance:g,module:Q}:g}function I(g){switch(g){case"basic":case"cors":case"default":return!0}return!1}}async function vA(Q){if(G!==void 0)return G;Q!==void 0&&(Object.getPrototypeOf(Q)===Object.prototype?{module_or_path:Q}=Q:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),Q===void 0&&(Q=new URL("",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:T&&T.tagName.toUpperCase()==="SCRIPT"&&T.src||new URL("glassjar.umd.cjs",document.baseURI).href));const A=TA();(typeof Q=="string"||typeof Request=="function"&&Q instanceof Request||typeof URL=="function"&&Q instanceof URL)&&(Q=fetch(Q));const{instance:I,module:g}=await nA(await Q,A);return rA(I)}const uA=new URL("https://cdn.jsdelivr.net/npm/glassjar@0.8.0/dist/engine_bg.wasm"),eA=Object.freeze({maxObjectBytes:128*1024*1024,maxEntries:256,maxMetadataBytes:8*1024*1024,maxEntryMetadataBytes:1024*1024});class _A{records=new Map;staged=new Map;stagingFailed=!1;objectBytes=0;metadataBytes=0;evictions=0;oversized=0;limits;constructor(A={}){this.limits=Object.freeze({...eA,...A});for(const I of Object.values(this.limits))if(!Number.isSafeInteger(I)||I<0)throw new RangeError("C++ cache limits must be nonnegative safe integers")}beginBatch(){this.discardBatch(),this.stagingFailed=!1}stage(A){if(this.stagingFailed)return;const I=this.recordSize(A);if(I===void 0||this.staged.has(A.source)){this.failBatch();return}const g=this.limits;for(;this.records.size&&(this.records.size+this.staged.size>=g.maxEntries||this.objectBytes+A.object.byteLength>g.maxObjectBytes||this.metadataBytes+I>g.maxMetadataBytes);)this.remove(this.records.keys().next().value),this.evictions++;if(this.records.size+this.staged.size>=g.maxEntries||this.objectBytes+A.object.byteLength>g.maxObjectBytes||this.metadataBytes+I>g.maxMetadataBytes||I>g.maxEntryMetadataBytes){this.oversized++,this.failBatch();return}this.staged.set(A.source,{...A,object:new Uint8Array(A.object),metadataBytes:I}),this.objectBytes+=A.object.byteLength,this.metadataBytes+=I}abandonBatch(){this.failBatch()}failBatch(){this.discardBatch(),this.stagingFailed=!0}recordSize(A){if(!(typeof A.source!="string"||!A.source.startsWith("/")||A.source.split("/").slice(1).some(I=>!I||I==="."||I==="..")||typeof A.key!="string"||typeof A.object_hash!="string"||!/^[a-f0-9]{64}$/.test(A.key)||!/^[a-f0-9]{64}$/.test(A.object_hash)||A.receipt!=null&&typeof A.receipt!="string"||!(A.object instanceof Uint8Array)))return new TextEncoder().encode(JSON.stringify({source:A.source,key:A.key,object_hash:A.object_hash,...A.receipt==null?{}:{receipt:A.receipt}})).byteLength}async validateBatch(){if(this.stagingFailed)return!1;const A=[...this.staged.values()];for(const I of A){if(!$A(I.object))return!1;const g=await crypto.subtle.digest("SHA-256",I.object);if(Array.from(new Uint8Array(g),B=>B.toString(16).padStart(2,"0")).join("")!==I.object_hash)return!1}return!0}commitBatch(){for(const[A,I]of this.staged)this.remove(A),this.records.set(A,I);this.staged.clear(),this.stagingFailed=!1}discardBatch(){for(const A of this.staged.values())this.objectBytes-=A.object.byteLength,this.metadataBytes-=A.metadataBytes;this.staged.clear()}snapshot(){return[...this.records.values()].map(({source:A,key:I,object_hash:g,object:C,receipt:B})=>({source:A,key:I,object_hash:g,...B==null?{}:{receipt:B},object:C.slice()}))}touch(A){const I=this.records.get(A);I&&(this.records.delete(A),this.records.set(A,I))}put(A){if(typeof A.source!="string"||!A.source.startsWith("/")||A.source.split("/").slice(1).some(B=>!B||B==="."||B==="..")||typeof A.key!="string"||typeof A.object_hash!="string"||!/^[a-f0-9]{64}$/.test(A.object_hash)||!/^[a-f0-9]{64}$/.test(A.key)||!(A.object instanceof Uint8Array))return;const I=this.recordSize(A);if(I===void 0)return;const g=this.limits;if(this.remove(A.source),g.maxEntries===0||A.object.byteLength>g.maxObjectBytes||I>g.maxMetadataBytes||I>g.maxEntryMetadataBytes){this.oversized++;return}for(;this.records.size>=g.maxEntries||this.objectBytes+A.object.byteLength>g.maxObjectBytes||this.metadataBytes+I>g.maxMetadataBytes;)this.remove(this.records.keys().next().value),this.evictions++;const C={...A,object:new Uint8Array(A.object),metadataBytes:I};this.records.set(A.source,C),this.objectBytes+=C.object.byteLength,this.metadataBytes+=I}delete(A){this.remove(A)}remove(A){const I=this.records.get(A);I&&(this.objectBytes-=I.object.byteLength,this.metadataBytes-=I.metadataBytes,this.records.delete(A))}clear(){this.records.clear(),this.staged.clear(),this.stagingFailed=!1,this.objectBytes=this.metadataBytes=0}stats(){return{objectBytes:this.objectBytes,metadataBytes:this.metadataBytes,entries:this.records.size,stagingEntries:this.staged.size,stagingObjectBytes:[...this.staged.values()].reduce((A,I)=>A+I.object.byteLength,0),stagingMetadataBytes:[...this.staged.values()].reduce((A,I)=>A+I.metadataBytes,0),evictions:this.evictions,oversized:this.oversized}}}function $A(Q){if(!WebAssembly.validate(Q)||Q.length<8)return!1;let A=8,I=!1;const g=()=>{let C=0,B=0;for(let E=0;E<5&&A<Q.length;E++,B+=7){const D=Q[A++];if(C+=(D&127)*2**B,!(D&128))return C}throw new Error("Malformed object section")};try{for(;A<Q.length;){const C=Q[A++],B=g(),E=A+B;if(E>Q.length||C===8)return!1;if(C===0){const D=g();if(A+D>E)return!1;const w=new TextDecoder().decode(Q.subarray(A,A+D));if(A+=D,w==="linking"){if(I||g()!==2)return!1;I=!0}}A=E}return I}catch{return!1}}const L=Symbol();function a(Q){return Q instanceof Error?{type:"error",error:{type:Q.constructor.name,message:Q.message}}:{type:"error",error:{type:typeof Q,message:String(Q)}}}class YA{name;data;constructor(A,I){this.name=A,this.data=I}download(){const A=new Uint8Array(this.data),I=new Blob([A]),g=URL.createObjectURL(I),C=document.createElement("a");C.href=g,C.download=this.name,document.body.appendChild(C),C.click(),document.body.removeChild(C),URL.revokeObjectURL(g)}}class JA extends kA{[L];dap;enabled=!0;set filterInternals(A){this.dap.setFilterInternals(A)}constructor(){super(),this[L]={attach:this.attach.bind(this),detach:this.detach.bind(this),beginRun:()=>this.dap.resetRun()},this.onMessage=this.onMessage.bind(this),this.dap=new BA,this.dap.on(this.onMessage)}send(A){return this.dap.sendMessage(A)}artifactListener=A=>{if(A.data.type!=="artifact")return;const I=new YA(A.data.name,new Uint8Array(A.data.data));this.emit("artifact",I)};attach(A){A.addEventListener("message",this.artifactListener),this.dap.attach(A)}detach(A){A.removeEventListener("message",this.artifactListener),this.dap.detach()}onMessage(A){this.emit("event",A)}}const AI="glassjar-wasm:";function II(Q,A){const I=new URL(String(Q),A);if(I.protocol!=="https:"&&I.protocol!=="http:")throw new TypeError(`Engine Wasm must be served over http(s), not ${I.protocol}`);return I.href}function gI(Q){return new Worker(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/worker-DKKpKTP_.js").href:new URL("assets/worker-DKKpKTP_.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||document.baseURI).href),{type:"module",name:Q?.name})}function CI(Q){return new gI(Q?{name:AI+Q}:void 0)}const QI="/dev/debugger-sh-host";class hA{buffer=new SharedArrayBuffer(4+64*1024);length=new Int32Array(this.buffer,0,1);bytes=new Uint8Array(this.buffer,4);publish(A){Atomics.store(this.length,0,A),Atomics.notify(this.length,0)}}function iA(Q){try{return new Error(`Host device callback failed: ${Q instanceof Error?Q.message:String(Q)}`)}catch{return new Error("Host device callback failed")}}function SA(Q){try{const A=Q?.();if(A&&typeof A.then=="function")return Promise.resolve(A).catch(()=>{}),new TypeError("Host device cleanup must be synchronous")}catch(A){return iA(A)}}class BI{constructor(A){this.onFailure=A}incoming=new hA;outgoing=new hA;workerStart={guest_to_host:this.incoming.buffer,host_to_guest:this.outgoing.buffer};abort=new AbortController;listeners=new Set;cleanup;worker;writing=!1;open(A){let I;try{I=A({signal:this.abort.signal,onData:g=>{if(this.assertOpen(),typeof g!="function")throw new TypeError("Host device listener must be a function");return this.listeners.add(g),()=>{this.listeners.delete(g)}},write:g=>this.write(g)})}catch(g){throw iA(g)}if(I!==void 0&&typeof I!="function")throw Promise.resolve(I).catch(()=>{}),new TypeError("Host device opener must return a cleanup function or undefined");if(typeof I=="function")if(this.abort.signal.aborted){const g=SA(I);if(g)throw g}else this.cleanup=I}attach(A){this.assertOpen(),this.worker=A,A.addEventListener("message",this.onMessage)}assertOpen(){if(this.abort.signal.aborted)throw new Error("Host device is closed")}async write(A){if(this.assertOpen(),!(A instanceof Uint8Array))throw new TypeError("Host device writes require Uint8Array");if(this.writing)throw new Error("Await the previous host device write before writing again");this.writing=!0;try{const I=new Uint8Array(A),g=this.outgoing;let C=0;for(;C<I.length;){this.assertOpen();const B=Atomics.load(g.length,0);if(B!==0){await Atomics.waitAsync(g.length,0,B).value;continue}const E=I.subarray(C,C+g.bytes.length);g.bytes.set(E),g.publish(E.length),C+=E.length}}finally{this.writing=!1}}onMessage=A=>{if(!(this.abort.signal.aborted||A.data?.type!=="host_wake"))try{const I=Atomics.load(this.incoming.length,0);if(I<=0)return;const g=this.incoming.bytes.slice(0,I);this.incoming.publish(0);for(const C of this.listeners){if(this.abort.signal.aborted)break;Promise.resolve(C(g)).catch(B=>this.fail(B))}}catch(I){this.fail(I)}};fail(A){this.abort.signal.aborted||(this.close(),this.onFailure(iA(A)))}close(){if(this.abort.signal.aborted)return;this.worker?.removeEventListener("message",this.onMessage),this.worker=void 0,this.incoming.publish(-1),this.outgoing.publish(-1),this.abort.abort(),this.listeners.clear();const A=this.cleanup;return this.cleanup=void 0,SA(A)}}const EI=["__future__","_abc","_aix_support","_android_support","_apple_support","_ast","_ast_unparse","_asyncio","_bisect","_blake2","_bz2","_codecs","_codecs_cn","_codecs_hk","_codecs_iso2022","_codecs_jp","_codecs_kr","_codecs_tw","_collections","_collections_abc","_colorize","_compat_pickle","_contextvars","_csv","_ctypes","_curses","_curses_panel","_datetime","_dbm","_decimal","_elementtree","_frozen_importlib","_frozen_importlib_external","_functools","_gdbm","_hashlib","_heapq","_hmac","_imp","_interpchannels","_interpqueues","_interpreters","_io","_ios_support","_json","_locale","_lsprof","_lzma","_markupbase","_math_integer","_md5","_multibytecodec","_multiprocessing","_opcode","_opcode_metadata","_operator","_osx_support","_overlapped","_pickle","_posixshmem","_posixsubprocess","_py_abc","_py_warnings","_pydatetime","_pydecimal","_pyio","_pylong","_pyrepl","_queue","_random","_remote_debugging","_scproxy","_sha1","_sha2","_sha3","_signal","_sitebuiltins","_socket","_sqlite3","_sre","_ssl","_stat","_statistics","_string","_strptime","_struct","_suggestions","_symtable","_sysconfig","_testbuffer","_testcapi","_testclinic","_testclinic_limited","_testinternalcapi","_testlimitedcapi","_thread","_threading_local","_tkinter","_tokenize","_tracemalloc","_types","_typing","_uuid","_warnings","_weakref","_weakrefset","_winapi","_wmi","_xxtestfuzz","_zoneinfo","_zstd","abc","annotationlib","antigravity","argparse","array","ast","asyncio","atexit","base64","bdb","binascii","bisect","builtins","bz2","cProfile","calendar","cmath","cmd","code","codecs","codeop","collections","colorsys","compileall","compression","concurrent","configparser","contextlib","contextvars","copy","copyreg","csv","ctypes","curses","dataclasses","datetime","dbm","decimal","difflib","dis","doctest","email","encodings","ensurepip","enum","errno","faulthandler","fcntl","filecmp","fileinput","fnmatch","fractions","ftplib","functools","gc","genericpath","getopt","getpass","gettext","glob","graphlib","grp","gzip","hashlib","heapq","hmac","html","http","idlelib","imaplib","importlib","inspect","io","ipaddress","itertools","json","keyword","linecache","locale","logging","lzma","mailbox","marshal","math","mimetypes","mmap","modulefinder","msvcrt","multiprocessing","netrc","nt","ntpath","nturl2path","numbers","opcode","operator","optparse","os","pathlib","pdb","pickle","pickletools","pkgutil","platform","plistlib","poplib","posix","posixpath","pprint","profile","profiling","pstats","pty","pwd","py_compile","pyclbr","pydoc","pydoc_data","pyexpat","queue","quopri","random","re","readline","reprlib","resource","rlcompleter","runpy","sched","secrets","select","selectors","shelve","shlex","shutil","signal","site","smtplib","socket","socketserver","sqlite3","ssl","stat","statistics","string","stringprep","struct","subprocess","symtable","sys","sysconfig","syslog","tabnanny","tarfile","tempfile","termios","textwrap","this","threading","time","timeit","tkinter","token","tokenize","tomllib","trace","traceback","tracemalloc","tty","turtle","turtledemo","types","typing","unicodedata","unittest","urllib","uuid","venv","warnings","wave","weakref","webbrowser","winreg","winsound","wsgiref","xml","xmlrpc","xxsubtype","zipapp","zipfile","zipimport","zlib","zoneinfo"],IA="3.15.2",DI="/usr/local/lib/python3.15/site-packages",LA="https://pypi.org/pypi",wI="files.pythonhosted.org",X={packages:50,downloadBytes:60*1024*1024,files:5e3,unpackedBytes:200*1024*1024},iI={python_version:IA.split(".").slice(0,2).join("."),python_full_version:IA,implementation_name:"cpython",implementation_version:IA,platform_python_implementation:"CPython",os_name:"posix",sys_platform:"wasi",platform_system:"",platform_machine:"wasm32",platform_release:"0.0.0",platform_version:"0.0.0"},sA={yaml:"PyYAML",bs4:"beautifulsoup4",dateutil:"python-dateutil",attr:"attrs",dotenv:"python-dotenv",jwt:"PyJWT",serial:"pyserial",docx:"python-docx",pptx:"python-pptx",slugify:"python-slugify",PIL:"pillow",sklearn:"scikit-learn",cv2:"opencv-python",Crypto:"pycryptodome",skimage:"scikit-image",google:"protobuf",_pytest:"pytest"},oI=new Set(EI),cA=/^[A-Za-z0-9]([A-Za-z0-9._-]*[A-Za-z0-9])?$/;function Z(Q){return Q.toLowerCase().replace(/[-_.]+/g,"-")}function NI(Q){const A=new Set;for(const I of Q.split(`
|
|
3
|
+
`)){const g=I.replace(/#.*/,"").trim();let C=/^import\s+(.+)$/.exec(g);if(C){for(const B of C[1].split(",")){const E=B.trim().split(/\s+/)[0]?.split(".")[0];E&&A.add(E)}continue}C=/^from\s+([A-Za-z_][\w.]*)\s+import\b/.exec(g),C&&A.add(C[1].split(".")[0])}return A}function FI(Q){const A=new Set,I=[];let g="";const C=(E,D)=>{for(const[w,N]of Object.entries(E))typeof N=="string"?(w.endsWith(".py")&&(I.push(N),D||A.add(w.slice(0,-3))),!D&&w==="requirements.txt"&&(g=N)):(D||A.add(w),C(N,`${D}/${w}`))};C(Q,"");const B=new Map;for(const E of I)for(const D of NI(E)){if(oI.has(D)||A.has(D)||D.startsWith("_")&&!(D in sA))continue;const w=sA[D]??D;B.set(Z(w),w)}for(const E of g.split(`
|
|
4
|
+
`)){const D=E.replace(/#.*/,"").trim();if(!D||D.startsWith("-"))continue;const w=/^[A-Za-z0-9][A-Za-z0-9._-]*/.exec(D)?.[0];w&&B.set(Z(w),D)}return[...B.values()].sort()}function r(Q){const A=/^v?(?:\d+!)?(\d+(?:\.\d+)*)(?:[-_.]?(a|b|c|rc|alpha|beta|pre|preview)[-_.]?(\d*))?(?:-(\d+)|[-_.]?(?:post|rev|r)[-_.]?(\d*))?(?:[-_.]?dev[-_.]?(\d*))?(?:\+[a-z0-9.]+)?$/i.exec(Q.trim());if(!A)return null;const I=A[2]?.toLowerCase(),g=I?{a:0,alpha:0,b:1,beta:1,c:2,rc:2,pre:2,preview:2}[I]:void 0;return{release:A[1].split(".").map(Number),pre:g===void 0?void 0:[g,Number(A[3]||0)],post:A[4]!==void 0?Number(A[4]):A[5]!==void 0?Number(A[5]||0):void 0,dev:A[6]!==void 0?Number(A[6]||0):void 0,text:Q}}function aA(Q,A){const I=Math.max(Q.release.length,A.release.length);for(let E=0;E<I;E++){const D=(Q.release[E]??0)-(A.release[E]??0);if(D)return Math.sign(D)}const g=E=>[E.pre?0:E.dev!==void 0&&E.post===void 0?-1:1,E.pre?.[0]??0,E.pre?.[1]??0,E.post??-1,E.dev??Number.POSITIVE_INFINITY],C=g(Q),B=g(A);for(let E=0;E<C.length;E++)if(C[E]!==B[E])return Math.sign(C[E]-B[E]);return 0}const HA=Q=>Q.pre!==void 0||Q.dev!==void 0;function oA(Q,A){for(const I of A.split(",")){const g=I.trim();if(!g)continue;const C=/^(~=|===|==|!=|<=|>=|<|>)\s*(.+)$/.exec(g);if(!C)return!1;const[,B,E]=C;if((B==="=="||B==="!=")&&E.endsWith(".*")){if(E.slice(0,-2).split(".").map(Number).every((U,h)=>(Q.release[h]??0)===U)!==(B==="=="))return!1;continue}const D=r(E);if(!D)return!1;const w=aA(Q,D);if(B==="~="){const N=D.release.slice(0,Math.max(1,D.release.length-1));if(w<0||!N.every((k,U)=>(Q.release[U]??0)===k))return!1}else if(!(B==="=="||B==="==="?w===0:B==="!="?w!==0:B==="<="?w<=0:B===">="?w>=0:B==="<"?w<0:w>0))return!1}return!0}function qA(Q){const[A,I]=Q.split(";",2).map(C=>C.trim()),g=/^([A-Za-z0-9][A-Za-z0-9._-]*)\s*(?:\[([^\]]*)\])?\s*\(?\s*([^)]*?)\s*\)?$/.exec(A);return!g||g[3].includes("@")?null:{name:g[1],extras:(g[2]??"").split(",").map(C=>C.trim()).filter(Boolean),specifiers:g[3].replace(/\s+/g,""),marker:I||void 0}}function GI(Q,A=[]){const I=Q.match(/\(|\)|'[^']*'|"[^"]*"|===|==|!=|<=|>=|~=|<|>|\bnot\s+in\b|\bin\b|\band\b|\bor\b|[A-Za-z_][A-Za-z0-9_.]*/g)??[];let g=0;const C=N=>/^['"]/.test(N)?{text:N.slice(1,-1)}:N==="extra"?{text:"",variable:"extra"}:{text:iI[N]??"",variable:N},B=(N,k,U)=>{if(N.variable==="extra"||U.variable==="extra"){const R=Z((N.variable==="extra"?U:N).text),H=A.some(d=>Z(d)===R);return k==="!="?!H:H}if(k==="in")return U.text.includes(N.text);if(/^not\s+in$/.test(k))return!U.text.includes(N.text);if(!N.variable&&U.variable)return B(U,{"<":">",">":"<","<=":">=",">=":"<="}[k]??k,N);const h=r(N.text),K=r(U.text);return h&&K&&/version/.test(N.variable??"")?oA(h,`${k}${U.text}`):k==="=="||k==="==="?N.text===U.text:k==="!="?N.text!==U.text:!1},E=()=>{if(I[g]==="("){g++;const h=w();return g++,h}const N=C(I[g++]),k=I[g++],U=C(I[g++]);return B(N,k,U)},D=()=>{let N=E();for(;I[g]==="and";)g++,N=E()&&N;return N},w=()=>{let N=D();for(;I[g]==="or";)g++,N=D()||N;return N};try{return w()}catch{return!1}}function MI(Q){if(Q.packagetype!=="bdist_wheel"||Q.yanked)return!1;const A=Q.filename.replace(/\.whl$/,"").split("-").slice(-3);return A.length===3&&A[1]==="none"&&A[2]==="any"&&A[0].split(".").some(I=>I==="py3"||I.startsWith("py3"))}function kI(Q){return Q?oA(r(IA),Q.replace(/\s+/g,"")):!0}class KI{constructor(A=(I,g)=>fetch(I,g)){this.fetchImpl=A}projects=new Map;metadata=new Map;wheels=new Map;project(A){const I=Z(A);let g=this.projects.get(I);return g||(g=this.fetchImpl(`${LA}/${encodeURIComponent(I)}/json`).then(async C=>C.ok?await C.json():null,()=>null),this.projects.set(I,g)),g}requiresDist(A,I,g){if(g.info.version===I)return Promise.resolve(g.info.requires_dist??[]);const C=`${Z(A)}@${I}`;let B=this.metadata.get(C);return B||(B=this.fetchImpl(`${LA}/${encodeURIComponent(Z(A))}/${encodeURIComponent(I)}/json`).then(async E=>E.ok?(await E.json()).info.requires_dist??[]:[],()=>[]),this.metadata.set(C,B)),B}async resolve(A,I=()=>{}){const g=new Map,C=[];for(const B of A){const E=qA(B);E&&cA.test(E.name)&&C.push({requirement:E,top:!0})}for(;C.length;){const{requirement:B,top:E}=C.shift(),D=Z(B.name);if(g.has(D))continue;if(g.size>=X.packages)break;const w=await this.project(B.name);if(!w){E&&I({kind:"skipped",message:`${B.name}: not found on PyPI`});continue}const N=Object.entries(w.releases).map(([K,R])=>({version:r(K),files:R})).filter(K=>K.version!==null&&oA(K.version,B.specifiers)).sort((K,R)=>aA(R.version,K.version)),U=[...N.filter(K=>!HA(K.version)),...N.filter(K=>HA(K.version))].map(K=>({version:K.version,wheel:K.files.find(R=>MI(R)&&kI(R.requires_python))})).find(K=>K.wheel);if(!U?.wheel){const K=N.some(R=>R.files.some(H=>H.packagetype==="bdist_wheel"));I({kind:"skipped",message:K?`${w.info.name} has compiled code, which can't run in the browser`:`${w.info.name}: no Python 3.15 wheel on PyPI`});continue}const h=new URL(U.wheel.url);if(!(h.protocol!=="https:"||h.hostname!==wI)){g.set(D,{name:w.info.name,version:U.version.text,url:U.wheel.url,sha256:U.wheel.digests.sha256,size:U.wheel.size});for(const K of await this.requiresDist(B.name,U.version.text,w)){const R=qA(K);!R||!cA.test(R.name)||R.marker&&!GI(R.marker,B.extras)||C.push({requirement:R,top:!1})}}}return[...g.values()]}async install(A,I=()=>{}){const g={};let C=0,B=0;for(const E of A){if(C+=E.size,C>X.downloadBytes){I({kind:"skipped",message:`${E.name}: over the ${X.downloadBytes>>20}MB package limit`});break}const D=`${E.url}#${E.sha256}`;let w=this.wheels.get(D);w||(I({kind:"installing",message:`Installing ${E.name} ${E.version}`}),w=this.download(E),this.wheels.set(D,w),w.catch(()=>this.wheels.delete(D)));let N;try{N=await w}catch(k){I({kind:"skipped",message:`${E.name}: ${k instanceof Error?k.message:String(k)}`});continue}for(const[k,U]of N){if(++B>X.files)break;g[`${DI}/${k}`]=U}}return g}async download(A){const I=await this.fetchImpl(A.url,{cache:"force-cache"});if(!I.ok)throw new Error(`download failed (${I.status})`);const g=new Uint8Array(await I.arrayBuffer());if([...new Uint8Array(await crypto.subtle.digest("SHA-256",g))].map(B=>B.toString(16).padStart(2,"0")).join("")!==A.sha256)throw new Error("download did not match PyPI's checksum");return yI(await RI(g,X.unpackedBytes))}}function yI(Q){const A=new Map;for(const[I,g]of Q){const C=/^[^/]+\.data\/(purelib|platlib)\/(.+)$/.exec(I);C?A.set(C[2],g):/^[^/]+\.data\//.test(I)||A.set(I,g)}return A}function UI(Q){return Q.length>0&&!Q.startsWith("/")&&!Q.includes("\\")&&!Q.includes("\0")&&!Q.split("/").some(A=>A===".."||A===".")}async function RI(Q,A){const I=new DataView(Q.buffer,Q.byteOffset,Q.byteLength);let g=-1;for(let N=Q.length-22;N>=Math.max(0,Q.length-22-65535);N--)if(I.getUint32(N,!0)===101010256){g=N;break}if(g<0)throw new Error("not a zip archive");const C=I.getUint16(g+10,!0);let B=I.getUint32(g+16,!0);const E=new Map;let D=0;const w=new TextDecoder;for(let N=0;N<C;N++){if(I.getUint32(B,!0)!==33639248)throw new Error("corrupt zip directory");const k=I.getUint16(B+10,!0),U=I.getUint32(B+20,!0),h=I.getUint32(B+24,!0),K=I.getUint16(B+28,!0),R=I.getUint16(B+30,!0),H=I.getUint16(B+32,!0),d=I.getUint32(B+42,!0),s=w.decode(Q.subarray(B+46,B+46+K));if(B+=46+K+R+H,s.endsWith("/"))continue;if(!UI(s))throw new Error(`unsafe path in package: ${s}`);if(D+=h,D>A)throw new Error("package too large");const QA=d+30+I.getUint16(d+26,!0)+I.getUint16(d+28,!0),v=Q.subarray(QA,QA+U);let o;if(k===0)o=v.slice();else if(k===8)o=new Uint8Array(await new Response(new Blob([v.slice()]).stream().pipeThrough(new DecompressionStream("deflate-raw"))).arrayBuffer());else throw new Error(`unsupported compression in package: ${s}`);if(o.length!==h)throw new Error(`corrupt entry in package: ${s}`);E.set(s,o)}return E}const YI=["4847c7cda81eb51b1cec18fe40b396605579fe84e17eca2760702b8a9666e4e1"],gA=Object.freeze({compiler:"d6b8d6e4596136fc6ae451fe3b81b1be5a1829505cbc993179247c75a764ce87",sysroot:"8745c6af23fd841fa507d0c73f6b6b8e8da1b4ec216a6339739a28b38ff7227b",exceptions:"20986166552953de0e3ca5c1e9f341e7aec8b9ba54dcb244d0d2b2f9ca843ab4"});function pA(Q="legacy"){if(Q==="legacy")return{profile:Q,digests:gA};if(Q==="stock-certified-v1"&&YI.length>0)return{profile:Q,digests:gA};throw new Error(`The ${Q} toolchain is not available in this build`)}class n{#A;hashCount=3;hashMs;constructor(A,I){this.#A=A,this.hashMs=I}static async load(A,I,g,C=gA.exceptions,B="legacy"){const E=pA(B);if(A.length!==2)throw new Error("Missing C++ toolchain assets");let D,w;const N=await Promise.allSettled(A.map(async(H,d)=>{try{const s=await fetch(H,{cache:"force-cache",signal:g});if(!s.ok)throw new Error(`Cannot load C++ toolchain (${s.status})`);return d===0&&I&&typeof WebAssembly.compileStreaming=="function"&&typeof s.clone=="function"&&(w=WebAssembly.compileStreaming(s.clone()).catch(()=>{})),new Uint8Array(await s.arrayBuffer())}catch(s){throw D??={error:s},s}}));if(N[0].status==="rejected"||N[1].status==="rejected")throw D?.error;const[k,U]=[N[0].value,N[1].value],[h,K]=await Promise.allSettled([n.ingestOwned(k,U,!1,C),I?(w??Promise.resolve(void 0)).then(H=>H??WebAssembly.compile(k)):Promise.resolve(void 0)]);if(h.status==="rejected")throw h.reason;const R=h.value;if(R.#A.compilerHash!==E.digests.compiler||R.#A.sysrootHash!==E.digests.sysroot||R.#A.exceptionsHash!==E.digests.exceptions)throw new Error("C++ toolchain integrity mismatch");if(g?.aborted)throw new DOMException("Toolchain loading aborted","AbortError");if(K.status==="rejected")throw K.reason;return R.#A.stockProfile=E.profile==="stock-certified-v1",R.#A.module=K.value,R}static async fromBytes(A,I,g){const C=new Uint8Array(A),B=new Uint8Array(I);return n.ingestOwned(C,B,g,gA.exceptions)}static async ingestOwned(A,I,g,C){const B=performance.now(),E=await Promise.allSettled([OA(A),OA(I)]);if(E[0].status==="rejected")throw E[0].reason;if(E[1].status==="rejected")throw E[1].reason;const[D,w]=[E[0].value,E[1].value],N=g?await WebAssembly.compile(A):void 0;return new n({compiler:A,sysroot:I,compilerHash:D,sysrootHash:w,exceptionsHash:C,module:N},performance.now()-B)}matchesExpectation(A){return A.compilerSha256===this.#A.compilerHash&&A.sysrootSha256===this.#A.sysrootHash&&A.exceptionsSha256===this.#A.exceptionsHash}get identity(){return`${this.#A.compilerHash}:${this.#A.sysrootHash}:${this.#A.exceptionsHash}`}get identityBytes(){return this.#A.compiler.byteLength+this.#A.sysroot.byteLength}get compilerBytes(){return this.#A.compiler.byteLength}configure(A,I){try{return A.postMessage({...I,toolchain:this.#A}),!!this.#A.module}catch(g){if(!(g instanceof DOMException)||g.name!=="DataCloneError"||!this.#A.module)throw g;return A.postMessage({...I,toolchain:{...this.#A,module:void 0}}),!1}}}async function OA(Q){const A=await crypto.subtle.digest("SHA-256",Q);return Array.from(new Uint8Array(A),I=>I.toString(16).padStart(2,"0")).join("")}let NA,CA;class FA{stdout=new GA(1);stderr=new GA(2);stdin=new p;debugger;lang;scope;fs={};binaryFiles={};cppArtifacts;hostDevice;options;python;installer;installed;retain;idleTimeoutMs;wasmUrl;objects;generation=0;scopeEpoch=0;operationId=0;disposed=!1;active;promise;slot;idleTimer;toolchain;toolchainLoading;toolchainController;initializing=new Set;toolchainIdentity;toolchainIngestions=0;toolchainHashCount=0;toolchainHashMs=0;compilerModuleCloned=!1;disposal;cancellationDraining;releaseDrain;releases=new Set;retirements=0;latest;cacheValidation;static async create(A,I={}){const{wasmUrl:g,python:C,...B}=I,E=g===void 0?void 0:II(g,globalThis.location?.href),D=structuredClone(B);C&&(D.python={packages:!!C.packages,onPackageStatus:typeof C.onPackageStatus=="function"?C.onPackageStatus:void 0});const w=E??null;if(CA!==void 0&&CA!==w)throw new Error("The engine Wasm is already loaded from a different wasmUrl");CA=w,NA??=vA({module_or_path:E??uA}).catch(k=>{throw NA=void 0,CA=void 0,k}),await NA;const N=new FA(A,D);if(N.wasmUrl=E,A!=="c"&&typeof window<"u"&&typeof fetch<"u")for(const k of KA(A))fetch(k,{cache:"force-cache"}).then(U=>U.arrayBuffer()).catch(()=>{});return N}constructor(A,I){const g=I.cpp;this.retain=I.retainWorker??g?.retainWorker??!0;const C=I.idleTimeoutMs??g?.idleTimeoutMs??3e4;if(!Number.isSafeInteger(C)||C<1||C>3e5)throw new RangeError("Worker idle timeout must be between 1 and 300000 milliseconds");if(this.idleTimeoutMs=C,g){if(A!=="c")throw new TypeError("C++ performance options require C/C++");if(!g.scope?.projectId||!g.scope.accountId)throw new TypeError("C++ performance options require project and account identity");if(g.compilerLifetime!==void 0&&!["idle","project"].includes(g.compilerLifetime))throw new TypeError("Invalid compiler lifetime");pA(g.toolchainProfile),this.scope=Object.freeze({...g.scope}),this.options=Object.freeze({...g,scope:this.scope,idleTimeoutMs:C})}if(I.python){if(A!=="python")throw new TypeError("Python options require Python");this.python=Object.freeze({...I.python})}this.objects=new _A(typeof g?.objectCache=="object"?g.objectCache:{}),this.debugger=new JA,this.lang=A}get cacheCompilerModule(){return this.options?.cacheCompilerModule??this.retain}get cacheStats(){return structuredClone({...this.objects.stats(),generation:this.generation,scopeEpoch:this.scopeEpoch,operationId:this.operationId,cacheEpoch:this.generation,toolchainProfile:this.options?.toolchainProfile??"legacy",cacheEligible:this.cacheValidation?.eligible??!1,stockCertificateSha256:this.cacheValidation?.certificate,cacheEligibilitySnapshot:this.cacheValidation?.snapshot,cacheEligibilityOperationId:this.cacheValidation?.operationId,cacheEligibilityReason:this.cacheValidation?.reason,toolchainIdentityBytes:this.toolchain?.identityBytes??0,toolchainIngestions:this.toolchainIngestions,toolchainHashCount:this.toolchainHashCount,toolchainHashMs:this.toolchainHashMs,compilerModuleCloned:this.compilerModuleCloned,workerRetained:!!this.slot&&!this.active,workerRetirements:this.retirements,compilerModuleIdentityBytes:this.cacheCompilerModule?this.toolchain?.compilerBytes??0:0,latest:this.active?.stats??this.latest})}clearCaches(){this.cacheValidation=void 0,this.generation++,this.objects.clear(),this.toolchain=void 0,this.active||(this.toolchainController?.abort(),this.toolchainLoading=void 0),this.active||this.retireWorker()}stop(){return this.clearCaches(),this.cancelCurrentOperation()}cancelCurrentOperation(){if(this.cancellationDraining)return this.cancellationDraining;this.operationId++;const A=this.promise,I=this.active?.publication;this.retireWorker(),this.objects.discardBatch(),this.active&&this.finish(this.active,{type:"stopped"});const g=Promise.allSettled([A,I]).then(()=>{this.cancellationDraining===g&&(this.cancellationDraining=void 0)});return this.cancellationDraining=g,g}releaseCompilerResources(A={}){const I=A.signal;return I?.aborted?Promise.resolve("cancelled"):this.disposed?Promise.resolve("released"):new Promise(g=>{const C={resolve:g,signal:I,abort:()=>this.settleRelease(C,"cancelled")};this.releases.add(C),I?.addEventListener("abort",C.abort,{once:!0}),this.flushReleases()})}settleRelease(A,I){this.releases.delete(A)&&(A.signal?.removeEventListener("abort",A.abort),A.resolve(I))}flushReleases(){if(!(this.active||!this.releases.size||this.releaseDrain)){if(this.initializing.size){this.toolchainController?.abort();const A=[...this.initializing];this.toolchainLoading=void 0,this.releaseDrain=Promise.allSettled(A).then(()=>{this.releaseDrain=void 0,this.flushReleases()});return}this.retireWorker(),this.toolchainController?.abort(),this.toolchain=void 0,this.toolchainLoading=void 0;for(const A of this.releases)this.settleRelease(A,"released")}}dispose(){if(this.disposal)return this.disposal;this.disposed=!0,this.scopeEpoch++,this.fs={},this.binaryFiles={},this.cppArtifacts=void 0,this.hostDevice=void 0,this.stdout.removeAllListeners(),this.stderr.removeAllListeners(),this.debugger.removeAllListeners();const A=[...this.initializing];return this.toolchainController?.abort(),this.disposal=Promise.allSettled([this.stop(),...A]).then(()=>{this.latest=void 0,this.flushReleases()}),this.disposal}prepareCompiler(A){if(A?.validateCacheInputs!==void 0&&typeof A.validateCacheInputs!="boolean")return Promise.resolve(a(new TypeError("Invalid compiler preparation options")));const I=A?.validateCacheInputs===!0&&this.options?.toolchainProfile==="stock-certified-v1"&&!!this.options?.objectCache&&this.objects.limits.maxEntries>0&&this.objects.limits.maxObjectBytes>0&&this.objects.limits.maxMetadataBytes>0&&this.objects.limits.maxEntryMetadataBytes>0;return this.submit(!0,!0,I)}run(){return this.lang==="python"&&this.python?.packages?this.runWithPackages():this.submit(!1)}async runWithPackages(){const A=g=>{try{this.python?.onPackageStatus?.(g)}catch{}};let I={};try{const g=FI(this.fs),C=g.join(`
|
|
5
|
+
`);g.length&&this.installed?.key===C?I=this.installed.files:g.length&&(this.installer??=new KI,I=await this.installer.install(await this.installer.resolve(g,A),A),this.installed={key:C,files:I})}catch(g){A({kind:"skipped",message:`Packages: ${g instanceof Error?g.message:String(g)}`})}return this.submit(!1,!1,!1,I)}compile(){return this.submit(!0)}submit(A,I=!1,g=!1,C={}){if(this.disposed)return Promise.resolve(a(new Error("Engine is disposed")));if(this.active||this.cancellationDraining)return Promise.resolve(a(new Error("An engine job is already active")));if(A&&this.lang!=="c")return Promise.resolve(a(new Error("Compile-only is supported for C/C++")));this.cacheValidation=void 0;const B=I&&!g;let E;try{const K=B||!this.cppArtifacts?null:{...this.cppArtifacts};if(K?.cacheCertificate!==void 0){const R=K.cacheCertificate;(typeof R!="string"||R.length>1024*1024||new TextEncoder().encode(R).byteLength>1024*1024)&&delete K.cacheCertificate}E={fs:B?{}:structuredClone(this.fs),binary_files:Object.fromEntries(Object.entries(B?{}:{...C,...this.binaryFiles}).map(([R,H])=>[R,new Uint8Array(H)])),cpp_artifacts:structuredClone(K)}}catch(K){return Promise.resolve(a(K))}const D=!A&&this.debugger.enabled,w=A?void 0:this.hostDevice;if(w!==void 0&&(typeof w!="function"||!["c","python"].includes(this.lang)))return Promise.resolve(a(new TypeError("Invalid host device configuration")));clearTimeout(this.idleTimer),this.stdin[L].clear();const N=!!this.slot;let k;const U=new Promise(K=>{k=K});this.promise=U;const h={generation:this.generation,scopeEpoch:this.scopeEpoch,operationId:++this.operationId,cacheEpoch:this.generation,prepareOnly:I,validateCacheInputs:g,settled:!1,buildOnly:A,debug:D,opener:w,startedAt:performance.now(),resolve:k,stats:{operation:I?"prepare_compiler":A?"compile":"run",workerReadyMs:0,workerReused:N},start:{...E,lang:this.lang,prepare_compiler:I,validate_cache_inputs:g,scope_epoch:this.scopeEpoch,operation_id:this.operationId,cache_epoch:this.generation,is_debug:D,build_only:A,stdin_buffer:this.stdin[L].buffer,cpp_cache:this.options?.objectCache&&!D&&!I?{generation:this.generation,entries:this.objects.snapshot(),max_entry_metadata_bytes:Math.min(this.objects.limits.maxEntryMetadataBytes,this.objects.limits.maxMetadataBytes,1024*1024)}:null}};this.objects.beginBatch(),this.active=h;try{if(this.slot||this.makeWorker(),!this.current(h))return U;const K=this.slot;this.lang==="c"&&!this.toolchain&&this.ensureToolchain().catch(R=>{this.current(h)&&this.slot===K&&this.finish(h,a(R))}),this.slot.ready&&this.dispatch(h)}catch(K){this.finish(h,a(K))}return U}current(A){return this.active===A&&!A.settled}makeWorker(){const A=CI(this.wasmUrl),I={worker:A,ready:!1,remove:()=>{}};this.slot=I;const g=E=>{if(this.slot!==I)return;const D=E.data,w=this.active;if(D.type==="ready"){if(I.ready)return;I.ready=!0,w&&this.current(w)&&this.dispatch(w);return}if(!(!w||!this.current(w))){if(!I.ready&&D.type==="error"){this.finish(w,a(new Error(D.message)));return}if(!(D.operationId!==w.operationId||D.scopeEpoch!==w.scopeEpoch))try{if(D.type==="cpp_cache_eligibility"){if(this.options?.toolchainProfile!=="stock-certified-v1"||w.prepareOnly&&!w.validateCacheInputs)return;const N=U=>typeof U=="string"&&/^[0-9a-f]{64}$/.test(U),k=D.eligible===!0&&N(D.certificate_sha256)&&N(D.snapshot);this.cacheValidation={eligible:k,certificate:N(D.certificate_sha256)?D.certificate_sha256:void 0,snapshot:k?D.snapshot:void 0,operationId:w.operationId,reason:k?void 0:typeof D.reason=="string"?D.reason.slice(0,128):"stock-input-validation"}}else if(D.type==="stop")this.finish(w,{type:"completed",exitCode:D.exit_code,timing:{totalMs:performance.now()-w.startedAt,buildMs:D.build_ms,runMs:D.run_ms}});else if(D.type==="error")this.finish(w,a(new Error(D.message)));else if(D.type==="cpp_cache_object"&&D.generation===this.generation&&w.generation===this.generation)try{this.objects.stage(D)}catch{this.objects.abandonBatch()}else D.type==="cpp_cache_stats"&&D.generation===w.generation?w.stats.cache=D.stats:D.type==="cpp_cache_abandon"?this.objects.abandonBatch():D.type==="object_build_complete"?w.publication??=this.publishObjects(w,I):D.type==="compiler_module_stats"&&(w.stats.compilerModule=D)}catch(N){this.finish(w,a(N))}}},C=E=>{this.slot===I&&(this.clearCaches(),this.active?this.finish(this.active,a(E.error??new Error(E.message))):this.retireWorker())},B=()=>C({message:"Unreadable execution worker message"});this.debugger[L].attach(A),A.addEventListener("message",g),A.addEventListener("error",C),A.addEventListener("messageerror",B),I.remove=()=>{A.removeEventListener("message",g),A.removeEventListener("error",C),A.removeEventListener("messageerror",B),this.debugger[L].detach(A)}}async publishObjects(A,I){let g=!1;try{g=await this.objects.validateBatch()}catch{}if(!(!this.current(A)||this.slot!==I)){try{g&&A.cacheEpoch===this.generation?this.objects.commitBatch():(this.objects.abandonBatch(),this.cacheValidation?.operationId===A.operationId&&(this.cacheValidation={...this.cacheValidation,eligible:!1,snapshot:void 0,reason:"stock-publication-budget-or-validation"}))}catch{this.objects.clear(),this.cacheValidation?.operationId===A.operationId&&(this.cacheValidation={...this.cacheValidation,eligible:!1,snapshot:void 0,reason:"stock-publication-failure"})}this.current(A)&&I.worker.postMessage({type:"object_build_ack",scopeEpoch:A.scopeEpoch,operationId:A.operationId,cacheEpoch:A.cacheEpoch})}}ensureToolchain(){if(this.toolchain)return Promise.resolve(this.toolchain);if(this.toolchainLoading)return this.toolchainLoading;this.toolchainController=new AbortController;const A=n.load(KA("c"),this.cacheCompilerModule,this.toolchainController.signal,ZA(),this.options?.toolchainProfile);return this.toolchainLoading=A,this.initializing.add(A),A.then(()=>this.initializing.delete(A),()=>{this.initializing.delete(A),this.toolchainLoading===A&&(this.toolchainLoading=void 0)}),A}async dispatch(A){const I=this.slot;if(!(!this.current(A)||!I))try{if(this.lang==="c"){const B=this.scopeEpoch,E=this.generation,D=this.ensureToolchain(),w=this.toolchain??await D;if(!this.current(A)||this.slot!==I||B!==this.scopeEpoch)return;const N=A.start.cpp_artifacts?.requiredToolchain;if(N&&!w.matchesExpectation(N)){this.finish(A,{type:"error",error:{type:"artifact-toolchain-integrity",message:"C++ artifacts require a different compiler, sysroot, or exception runtime"}});return}E===this.generation&&(this.toolchainIdentity&&this.toolchainIdentity!==w.identity&&(this.objects.clear(),A.start.cpp_cache=null),this.toolchain!==w&&(this.toolchainIngestions++,this.toolchainHashCount+=w.hashCount,this.toolchainHashMs+=w.hashMs),this.toolchainIdentity=w.identity,this.toolchain=w,this.toolchainLoading===D&&(this.toolchainLoading=void 0)),I.toolchain!==w&&(this.compilerModuleCloned=w.configure(I.worker,{type:"configure_cpp",cacheCompilerModule:this.cacheCompilerModule}),I.toolchain=w)}if(!this.current(A)||this.slot!==I)return;const g=I.worker;A.stats.workerReadyMs=performance.now()-A.startedAt;const C=B=>this.current(A)&&B.scopeEpoch===A.scopeEpoch&&B.operationId===A.operationId;if(this.stdout[L].attach(g,C),this.stderr[L].attach(g,C),A.prepareOnly||this.debugger[L].beginRun(),A.opener){if(A.device=new BI(B=>this.finish(A,a(B))),A.device.attach(g),A.device.open(A.opener),!this.current(A))return;A.start.host_device=A.device.workerStart}this.current(A)&&(g.postMessage(A.start),A.start.fs={},A.start.binary_files={},A.start.cpp_artifacts=null,A.start.cpp_cache=null)}catch(g){this.current(A)&&(this.toolchainLoading=void 0,this.finish(A,a(g)))}}finish(A,I){if(!this.current(A))return;(I.type!=="completed"||I.exitCode!==0)&&(this.cacheValidation=void 0),A.settled=!0;const g=this.slot?.worker;g&&(this.stdout[L].detach(g),this.stderr[L].detach(g));const C=A.device?.close();C&&(I=a(C));const B=I.type==="completed"&&A.generation===this.generation&&!this.disposed,E=B&&I.type==="completed"&&I.exitCode===0;if(A.generation===this.generation)for(const D of A.stats.cache?.invalid_sources??[])this.objects.delete(D);if(E)for(const D of A.stats.cache?.hit_sources??[])this.objects.touch(D);this.objects.discardBatch(),this.latest=A.stats,this.stdin[L].clear(),(!B||!this.retain)&&this.retireWorker(),!this.disposed&&A.cacheEpoch===this.generation&&(this.slot||this.toolchain&&this.cacheCompilerModule)&&this.options?.compilerLifetime!=="project"&&(this.idleTimer=setTimeout(()=>{this.retireWorker(),this.toolchain=void 0,this.toolchainLoading=void 0},this.idleTimeoutMs)),!this.retain&&!this.cacheCompilerModule&&(this.toolchain=void 0),A.cacheEpoch!==this.generation&&(this.toolchainController?.abort(),this.toolchainLoading=void 0),this.active=void 0,this.promise=void 0,this.flushReleases(),A.resolve(I)}retireWorker(){clearTimeout(this.idleTimer);const A=this.slot;A&&(this.slot=void 0,A.remove(),this.stdout[L].detach(A.worker),this.stderr[L].detach(A.worker),A.worker.onerror=I=>I.preventDefault(),A.worker.terminate(),this.retirements++)}}class GA extends kA{constructor(A){super(),this.mode=A,this.callback=(I=>{const g=I.data;if(this.accepts&&!this.accepts(g)||g.type!=="stdout"||g.mode!==this.mode)return;const C=g.data;this.emit("data",C)}).bind(this),this[L]={attach:this.attach.bind(this),detach:this.detach.bind(this)}}callback;accepts;[L];attach(A,I){this.accepts=I,A.addEventListener("message",this.callback)}detach(A){A.removeEventListener("message",this.callback)}}class p{static BUFFER_SIZE=2048;static HEADER_SIZE=8;static DATA_SIZE=p.BUFFER_SIZE-p.HEADER_SIZE;static READ_IDX=0;static WRITE_IDX=1;static encoder=new TextEncoder;buffer=new SharedArrayBuffer(p.BUFFER_SIZE);generation=0;indices;data;[L];constructor(){this.indices=new Int32Array(this.buffer,0,2),this.data=new Int8Array(this.buffer,p.HEADER_SIZE);const A=()=>this.buffer;this[L]={clear:this.clear.bind(this),get buffer(){return A()}}}clear(){this.generation++,Atomics.notify(this.indices,p.READ_IDX),this.buffer=new SharedArrayBuffer(p.BUFFER_SIZE),this.indices=new Int32Array(this.buffer,0,2),this.data=new Int8Array(this.buffer,p.HEADER_SIZE)}async write(A){const I=typeof A=="string"?p.encoder.encode(A):A;return this.writeBytes(I)}async writeBytes(A){const{DATA_SIZE:I,READ_IDX:g,WRITE_IDX:C}=p;let B=0;const E=this.generation;for(;B<A.length&&E===this.generation;){const D=Atomics.load(this.indices,g);let w=Atomics.load(this.indices,C);w===I-1&&D>0&&(w=0);const N=D<=w?I-w-1:D-w-1;if(N===0){await Atomics.waitAsync(this.indices,g,D).value;continue}const k=Math.min(A.length-B,N);this.data.set(A.subarray(B,B+k),w),Atomics.store(this.indices,C,(w+k)%I),Atomics.notify(this.indices,C),B+=k}}}O.Artifact=YA,O.Debugger=JA,O.Engine=FA,O.HOST_DEVICE_PATH=QI,O.Stdin=p,O.Stdout=GA,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { CompilerModuleStats } from './compiler-module-cache.js';
|
|
|
4
4
|
import { CppCacheLimits, ObjectCacheStats } from './cpp-object-cache.js';
|
|
5
5
|
import { Debugger } from './debugger.js';
|
|
6
6
|
import { HostDeviceOpener } from './host-device.js';
|
|
7
|
+
import { PackageStatus } from './python-packages.js';
|
|
7
8
|
import { Internals } from './util.js';
|
|
8
9
|
export type Lang = 'c' | 'python' | 'rust';
|
|
9
10
|
type StdoutMode = 1 | 2;
|
|
@@ -35,8 +36,19 @@ export interface CppPerformanceOptions {
|
|
|
35
36
|
compilerLifetime?: 'idle' | 'project';
|
|
36
37
|
toolchainProfile?: 'legacy' | 'stock-certified-v1';
|
|
37
38
|
}
|
|
39
|
+
export interface PythonOptions {
|
|
40
|
+
/**
|
|
41
|
+
* Install the pure-Python packages a program imports (and any requirements.txt) from
|
|
42
|
+
* PyPI before each run, like `pip install`. Off by default: it fetches from pypi.org.
|
|
43
|
+
*/
|
|
44
|
+
packages?: boolean;
|
|
45
|
+
/** Progress and notes from package installs, e.g. a package with compiled code. */
|
|
46
|
+
onPackageStatus?: (status: PackageStatus) => void;
|
|
47
|
+
}
|
|
48
|
+
export type { PackageStatus } from './python-packages.js';
|
|
38
49
|
export interface EngineOptions {
|
|
39
50
|
cpp?: CppPerformanceOptions;
|
|
51
|
+
python?: PythonOptions;
|
|
40
52
|
/**
|
|
41
53
|
* Where to load this package's `dist/engine_bg.wasm` from, for hosts that serve it
|
|
42
54
|
* themselves. Relative URLs resolve against the page. It must be the file from this
|
|
@@ -152,6 +164,9 @@ export declare class Engine {
|
|
|
152
164
|
cppArtifacts?: CppArtifacts;
|
|
153
165
|
hostDevice?: HostDeviceOpener;
|
|
154
166
|
private readonly options?;
|
|
167
|
+
private readonly python?;
|
|
168
|
+
private installer?;
|
|
169
|
+
private installed?;
|
|
155
170
|
private readonly retain;
|
|
156
171
|
private readonly idleTimeoutMs;
|
|
157
172
|
/** Absolute `EngineOptions.wasmUrl`, handed to each worker; unset uses the default. */
|
|
@@ -204,6 +219,8 @@ export declare class Engine {
|
|
|
204
219
|
prepareCompiler(options?: CompilerPreparationOptions): Promise<RunResult>;
|
|
205
220
|
/** Every Run links current objects and starts a fresh student runtime. */
|
|
206
221
|
run(): Promise<RunResult>;
|
|
222
|
+
/** Installs what the program imports from PyPI, then runs it with those files mounted. */
|
|
223
|
+
private runWithPackages;
|
|
207
224
|
/** Compiles Run-profile C++ translation units only; never links, runs, or opens devices. */
|
|
208
225
|
compile(): Promise<RunResult>;
|
|
209
226
|
private submit;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/ts/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAKlC,OAAO,KAAK,EAAyB,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAC7F,OAAO,EAAE,cAAc,EAAkB,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAqB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/ts/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export declare const PYTHON_VERSION = "3.15.2";
|
|
2
|
+
export declare const SITE_PACKAGES = "/usr/local/lib/python3.15/site-packages";
|
|
3
|
+
export type PackageStatus = {
|
|
4
|
+
kind: 'installing' | 'installed' | 'skipped';
|
|
5
|
+
message: string;
|
|
6
|
+
};
|
|
7
|
+
export type Fetch = (url: string, init?: RequestInit) => Promise<Response>;
|
|
8
|
+
/** PEP 503 normalized project name. */
|
|
9
|
+
export declare function normalize(name: string): string;
|
|
10
|
+
type DirNode = {
|
|
11
|
+
[name: string]: string | DirNode;
|
|
12
|
+
};
|
|
13
|
+
/** Top-level import names in Python source (best effort, line based). */
|
|
14
|
+
export declare function importsIn(source: string): Set<string>;
|
|
15
|
+
/** Project names a workspace needs from PyPI: third-party imports plus requirements.txt. */
|
|
16
|
+
export declare function requirementsFor(fs: DirNode): string[];
|
|
17
|
+
type Version = {
|
|
18
|
+
release: number[];
|
|
19
|
+
pre?: [number, number];
|
|
20
|
+
post?: number;
|
|
21
|
+
dev?: number;
|
|
22
|
+
text: string;
|
|
23
|
+
};
|
|
24
|
+
export declare function parseVersion(text: string): Version | null;
|
|
25
|
+
export declare function compareVersions(a: Version, b: Version): number;
|
|
26
|
+
/** Whether a version satisfies a specifier set like ">=1.6,<2" (empty = anything). */
|
|
27
|
+
export declare function satisfies(version: Version, specifiers: string): boolean;
|
|
28
|
+
export type Requirement = {
|
|
29
|
+
name: string;
|
|
30
|
+
extras: string[];
|
|
31
|
+
specifiers: string;
|
|
32
|
+
marker?: string;
|
|
33
|
+
};
|
|
34
|
+
export declare function parseRequirement(text: string): Requirement | null;
|
|
35
|
+
/** Evaluates a PEP 508 marker for this runtime, with the given extras requested. */
|
|
36
|
+
export declare function markerMatches(marker: string, extras?: string[]): boolean;
|
|
37
|
+
export type ResolvedPackage = {
|
|
38
|
+
name: string;
|
|
39
|
+
version: string;
|
|
40
|
+
url: string;
|
|
41
|
+
sha256: string;
|
|
42
|
+
size: number;
|
|
43
|
+
};
|
|
44
|
+
export declare class PackageInstaller {
|
|
45
|
+
private readonly fetchImpl;
|
|
46
|
+
private readonly projects;
|
|
47
|
+
private readonly metadata;
|
|
48
|
+
private readonly wheels;
|
|
49
|
+
constructor(fetchImpl?: Fetch);
|
|
50
|
+
private project;
|
|
51
|
+
/** requires_dist of one release (the project JSON only carries the latest's). */
|
|
52
|
+
private requiresDist;
|
|
53
|
+
/**
|
|
54
|
+
* Resolves requirements and their dependencies to pure-Python wheels. Greedy: the newest
|
|
55
|
+
* release that fits every constraint seen so far for that project.
|
|
56
|
+
*/
|
|
57
|
+
resolve(requirements: string[], report?: (status: PackageStatus) => void): Promise<ResolvedPackage[]>;
|
|
58
|
+
/** Files to mount, by absolute path in the run, for these resolved packages. */
|
|
59
|
+
install(packages: ResolvedPackage[], report?: (status: PackageStatus) => void): Promise<Record<string, Uint8Array>>;
|
|
60
|
+
private download;
|
|
61
|
+
}
|
|
62
|
+
/** Files in a zip archive (stored or deflated), with traversal and size guards. */
|
|
63
|
+
export declare function unzip(bytes: Uint8Array, maxUnpacked: number): Promise<Map<string, Uint8Array>>;
|
|
64
|
+
export {};
|
|
65
|
+
//# sourceMappingURL=python-packages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python-packages.d.ts","sourceRoot":"","sources":["../src/ts/python-packages.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
declare const _default: ["__future__", "_abc", "_aix_support", "_android_support", "_apple_support", "_ast", "_ast_unparse", "_asyncio", "_bisect", "_blake2", "_bz2", "_codecs", "_codecs_cn", "_codecs_hk", "_codecs_iso2022", "_codecs_jp", "_codecs_kr", "_codecs_tw", "_collections", "_collections_abc", "_colorize", "_compat_pickle", "_contextvars", "_csv", "_ctypes", "_curses", "_curses_panel", "_datetime", "_dbm", "_decimal", "_elementtree", "_frozen_importlib", "_frozen_importlib_external", "_functools", "_gdbm", "_hashlib", "_heapq", "_hmac", "_imp", "_interpchannels", "_interpqueues", "_interpreters", "_io", "_ios_support", "_json", "_locale", "_lsprof", "_lzma", "_markupbase", "_math_integer", "_md5", "_multibytecodec", "_multiprocessing", "_opcode", "_opcode_metadata", "_operator", "_osx_support", "_overlapped", "_pickle", "_posixshmem", "_posixsubprocess", "_py_abc", "_py_warnings", "_pydatetime", "_pydecimal", "_pyio", "_pylong", "_pyrepl", "_queue", "_random", "_remote_debugging", "_scproxy", "_sha1", "_sha2", "_sha3", "_signal", "_sitebuiltins", "_socket", "_sqlite3", "_sre", "_ssl", "_stat", "_statistics", "_string", "_strptime", "_struct", "_suggestions", "_symtable", "_sysconfig", "_testbuffer", "_testcapi", "_testclinic", "_testclinic_limited", "_testinternalcapi", "_testlimitedcapi", "_thread", "_threading_local", "_tkinter", "_tokenize", "_tracemalloc", "_types", "_typing", "_uuid", "_warnings", "_weakref", "_weakrefset", "_winapi", "_wmi", "_xxtestfuzz", "_zoneinfo", "_zstd", "abc", "annotationlib", "antigravity", "argparse", "array", "ast", "asyncio", "atexit", "base64", "bdb", "binascii", "bisect", "builtins", "bz2", "cProfile", "calendar", "cmath", "cmd", "code", "codecs", "codeop", "collections", "colorsys", "compileall", "compression", "concurrent", "configparser", "contextlib", "contextvars", "copy", "copyreg", "csv", "ctypes", "curses", "dataclasses", "datetime", "dbm", "decimal", "difflib", "dis", "doctest", "email", "encodings", "ensurepip", "enum", "errno", "faulthandler", "fcntl", "filecmp", "fileinput", "fnmatch", "fractions", "ftplib", "functools", "gc", "genericpath", "getopt", "getpass", "gettext", "glob", "graphlib", "grp", "gzip", "hashlib", "heapq", "hmac", "html", "http", "idlelib", "imaplib", "importlib", "inspect", "io", "ipaddress", "itertools", "json", "keyword", "linecache", "locale", "logging", "lzma", "mailbox", "marshal", "math", "mimetypes", "mmap", "modulefinder", "msvcrt", "multiprocessing", "netrc", "nt", "ntpath", "nturl2path", "numbers", "opcode", "operator", "optparse", "os", "pathlib", "pdb", "pickle", "pickletools", "pkgutil", "platform", "plistlib", "poplib", "posix", "posixpath", "pprint", "profile", "profiling", "pstats", "pty", "pwd", "py_compile", "pyclbr", "pydoc", "pydoc_data", "pyexpat", "queue", "quopri", "random", "re", "readline", "reprlib", "resource", "rlcompleter", "runpy", "sched", "secrets", "select", "selectors", "shelve", "shlex", "shutil", "signal", "site", "smtplib", "socket", "socketserver", "sqlite3", "ssl", "stat", "statistics", "string", "stringprep", "struct", "subprocess", "symtable", "sys", "sysconfig", "syslog", "tabnanny", "tarfile", "tempfile", "termios", "textwrap", "this", "threading", "time", "timeit", "tkinter", "token", "tokenize", "tomllib", "trace", "traceback", "tracemalloc", "tty", "turtle", "turtledemo", "types", "typing", "unicodedata", "unittest", "urllib", "uuid", "venv", "warnings", "wave", "weakref", "webbrowser", "winreg", "winsound", "wsgiref", "xml", "xmlrpc", "xxsubtype", "zipapp", "zipfile", "zipimport", "zlib", "zoneinfo"]
|
|
2
|
+
;
|
|
3
|
+
|
|
4
|
+
export default _default;
|