UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) • 28.5 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ var r,e=(r="undefined"!=typeof document?document.currentScript?.src:void 0,function(e={}){var t,n,a=Object.assign({},e),o=new Promise(((r,e)=>{t=r,n=e})),i=!0,s=Object.assign({},a),u="";function c(r){return a.locateFile?a.locateFile(r,u):u+r}"undefined"!=typeof document&&document.currentScript&&(u=document.currentScript.src),r&&(u=r),u=u.startsWith("blob:")?"":u.substr(0,u.replace(/[?#].*/,"").lastIndexOf("/")+1);var l,p,h=a.print||console.log.bind(console),d=a.printErr||console.error.bind(console);Object.assign(a,s),s=null,a.arguments&&a.arguments,a.thisProgram&&a.thisProgram,a.quit&&a.quit,a.wasmBinary&&(l=a.wasmBinary);var f,v,y,m,g,$,w,T,b=!1;function C(){var r=p.buffer;a.HEAP8=f=new Int8Array(r),a.HEAP16=y=new Int16Array(r),a.HEAPU8=v=new Uint8Array(r),a.HEAPU16=m=new Uint16Array(r),a.HEAP32=g=new Int32Array(r),a.HEAPU32=$=new Uint32Array(r),a.HEAPF32=w=new Float32Array(r),a.HEAPF64=T=new Float64Array(r)}var P=[],A=[],W=[];function _(){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)O(a.preRun.shift());J(P)}function F(){J(A)}function S(){if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;)k(a.postRun.shift());J(W)}function O(r){P.unshift(r)}function j(r){A.unshift(r)}function k(r){W.unshift(r)}var E=0,R=null;function D(r){E++,a.monitorRunDependencies?.(E)}function x(r){if(E--,a.monitorRunDependencies?.(E),0==E&&R){var e=R;R=null,e()}}function I(r){a.onAbort?.(r),d(r="Aborted("+r+")"),b=!0,r+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(r);throw n(e),e}var V,H="data:application/octet-stream;base64,",U=r=>r.startsWith(H);function B(){var r="basis_transcoder.wasm";return U(r)?r:c(r)}function N(r){if(r==V&&l)return new Uint8Array(l);throw"both async and sync fetching of the wasm failed"}function M(r){return!l&&i&&"function"==typeof fetch?fetch(r,{credentials:"same-origin"}).then((e=>{if(!e.ok)throw`failed to load wasm binary file at '${r}'`;return e.arrayBuffer()})).catch((()=>N(r))):Promise.resolve().then((()=>N(r)))}function z(r,e,t){return M(r).then((r=>WebAssembly.instantiate(r,e))).then(t,(r=>{d(`failed to asynchronously prepare wasm: ${r}`),I(r)}))}function q(r,e,t,n){return r||"function"!=typeof WebAssembly.instantiateStreaming||U(e)||"function"!=typeof fetch?z(e,t,n):fetch(e,{credentials:"same-origin"}).then((r=>WebAssembly.instantiateStreaming(r,t).then(n,(function(r){return d(`wasm streaming compile failed: ${r}`),d("falling back to ArrayBuffer instantiation"),z(e,t,n)}))))}function G(){return{a:kt}}function L(){var r=G();function e(r,e){return Et=r.exports,p=Et.L,C(),re=Et.Q,j(Et.M),x(),Et}function t(r){e(r.instance)}if(D(),a.instantiateWasm)try{return a.instantiateWasm(r,e)}catch(o){d(`Module.instantiateWasm callback failed with error: ${o}`),n(o)}return V||(V=B()),q(l,V,r,t).catch(n),{}}var J=r=>{for(;r.length>0;)r.shift()(a)};a.noExitRuntime;class K{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){$[this.ptr+4>>2]=r}get_type(){return $[this.ptr+4>>2]}set_destructor(r){$[this.ptr+8>>2]=r}get_destructor(){return $[this.ptr+8>>2]}set_caught(r){r=r?1:0,f[this.ptr+12]=r}get_caught(){return 0!=f[this.ptr+12]}set_rethrown(r){r=r?1:0,f[this.ptr+13]=r}get_rethrown(){return 0!=f[this.ptr+13]}init(r,e){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(e)}set_adjusted_ptr(r){$[this.ptr+16>>2]=r}get_adjusted_ptr(){return $[this.ptr+16>>2]}get_exception_ptr(){if(It(this.get_type()))return $[this.excPtr>>2];var r=this.get_adjusted_ptr();return 0!==r?r:this.excPtr}}var Q=(r,e,t)=>{throw new K(r).init(e,t),r},Z=()=>{I("")},X={},Y=r=>{for(;r.length;){var e=r.pop();r.pop()(e)}};function rr(r){return this.fromWireType($[r>>2])}var er,tr,nr,ar={},or={},ir={},sr=r=>{throw new er(r)},ur=(r,e,t)=>{function n(e){var n=t(e);n.length!==r.length&&sr("Mismatched type converter count");for(var a=0;a<r.length;++a)vr(r[a],n[a])}r.forEach((function(r){ir[r]=e}));var a=new Array(e.length),o=[],i=0;e.forEach(((r,e)=>{or.hasOwnProperty(r)?a[e]=or[r]:(o.push(r),ar.hasOwnProperty(r)||(ar[r]=[]),ar[r].push((()=>{a[e]=or[r],++i===o.length&&n(a)})))})),0===o.length&&n(a)},cr=r=>{var e=X[r];delete X[r];var t=e.rawConstructor,n=e.rawDestructor,a=e.fields,o=a.map((r=>r.getterReturnType)).concat(a.map((r=>r.setterArgumentType)));ur([r],o,(r=>{var o={};return a.forEach(((e,t)=>{var n=e.fieldName,i=r[t],s=e.getter,u=e.getterContext,c=r[t+a.length],l=e.setter,p=e.setterContext;o[n]={read:r=>i.fromWireType(s(u,r)),write:(r,e)=>{var t=[];l(p,r,c.toWireType(t,e)),Y(t)}}})),[{name:e.name,fromWireType:r=>{var e={};for(var t in o)e[t]=o[t].read(r);return n(r),e},toWireType:(r,e)=>{for(var a in o)if(!(a in e))throw new TypeError(`Missing field: "${a}"`);var i=t();for(a in o)o[a].write(i,e[a]);return null!==r&&r.push(n,i),i},argPackAdvance:mr,readValueFromPointer:rr,destructorFunction:n}]}))},lr=(r,e,t,n,a)=>{},pr=()=>{for(var r=new Array(256),e=0;e<256;++e)r[e]=String.fromCharCode(e);tr=r},hr=r=>{for(var e="",t=r;v[t];)e+=tr[v[t++]];return e},dr=r=>{throw new nr(r)};function fr(r,e,t={}){var n=e.name;if(r||dr(`type "${n}" must have a positive integer typeid pointer`),or.hasOwnProperty(r)){if(t.ignoreDuplicateRegistrations)return;dr(`Cannot register type '${n}' twice`)}if(or[r]=e,delete ir[r],ar.hasOwnProperty(r)){var a=ar[r];delete ar[r],a.forEach((r=>r()))}}function vr(r,e,t={}){if(!("argPackAdvance"in e))throw new TypeError("registerType registeredInstance requires argPackAdvance");return fr(r,e,t)}var yr,mr=8,gr=(r,e,t,n)=>{vr(r,{name:e=hr(e),fromWireType:function(r){return!!r},toWireType:function(r,e){return e?t:n},argPackAdvance:mr,readValueFromPointer:function(r){return this.fromWireType(v[r])},destructorFunction:null})},$r=r=>({count:r.count,deleteScheduled:r.deleteScheduled,preservePointerOnDelete:r.preservePointerOnDelete,ptr:r.ptr,ptrType:r.ptrType,smartPtr:r.smartPtr,smartPtrType:r.smartPtrType}),wr=r=>{function e(r){return r.$$.ptrType.registeredClass.name}dr(e(r)+" instance already deleted")},Tr=!1,br=r=>{},Cr=r=>{r.smartPtr?r.smartPtrType.rawDestructor(r.smartPtr):r.ptrType.registeredClass.rawDestructor(r.ptr)},Pr=r=>{r.count.value-=1,0===r.count.value&&Cr(r)},Ar=(r,e,t)=>{if(e===t)return r;if(void 0===t.baseClass)return null;var n=Ar(r,e,t.baseClass);return null===n?null:t.downcast(n)},Wr={},_r=()=>Object.keys(Er).length,Fr=()=>{var r=[];for(var e in Er)Er.hasOwnProperty(e)&&r.push(Er[e]);return r},Sr=[],Or=()=>{for(;Sr.length;){var r=Sr.pop();r.$$.deleteScheduled=!1,r.delete()}},jr=r=>{yr=r,Sr.length&&yr&&yr(Or)},kr=()=>{a.getInheritedInstanceCount=_r,a.getLiveInheritedInstances=Fr,a.flushPendingDeletes=Or,a.setDelayFunction=jr},Er={},Rr=(r,e)=>{for(void 0===e&&dr("ptr should not be undefined");r.baseClass;)e=r.upcast(e),r=r.baseClass;return e},Dr=(r,e)=>(e=Rr(r,e),Er[e]),xr=(r,e)=>(e.ptrType&&e.ptr||sr("makeClassHandle requires ptr and ptrType"),!!e.smartPtrType!=!!e.smartPtr&&sr("Both smartPtrType and smartPtr must be specified"),e.count={value:1},Vr(Object.create(r,{$$:{value:e,writable:!0}})));function Ir(r){var e=this.getPointee(r);if(!e)return this.destructor(r),null;var t=Dr(this.registeredClass,e);if(void 0!==t){if(0===t.$$.count.value)return t.$$.ptr=e,t.$$.smartPtr=r,t.clone();var n=t.clone();return this.destructor(r),n}function a(){return this.isSmartPointer?xr(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:e,smartPtrType:this,smartPtr:r}):xr(this.registeredClass.instancePrototype,{ptrType:this,ptr:r})}var o,i=this.registeredClass.getActualType(e),s=Wr[i];if(!s)return a.call(this);o=this.isConst?s.constPointerType:s.pointerType;var u=Ar(e,this.registeredClass,o.registeredClass);return null===u?a.call(this):this.isSmartPointer?xr(o.registeredClass.instancePrototype,{ptrType:o,ptr:u,smartPtrType:this,smartPtr:r}):xr(o.registeredClass.instancePrototype,{ptrType:o,ptr:u})}var Vr=r=>"undefined"==typeof FinalizationRegistry?(Vr=r=>r,r):(Tr=new FinalizationRegistry((r=>{Pr(r.$$)})),Vr=r=>{var e=r.$$;if(e.smartPtr){var t={$$:e};Tr.register(r,t,r)}return r},br=r=>Tr.unregister(r),Vr(r)),Hr=()=>{Object.assign(Ur.prototype,{isAliasOf(r){if(!(this instanceof Ur))return!1;if(!(r instanceof Ur))return!1;var e=this.$$.ptrType.registeredClass,t=this.$$.ptr;r.$$=r.$$;for(var n=r.$$.ptrType.registeredClass,a=r.$$.ptr;e.baseClass;)t=e.upcast(t),e=e.baseClass;for(;n.baseClass;)a=n.upcast(a),n=n.baseClass;return e===n&&t===a},clone(){if(this.$$.ptr||wr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var r=Vr(Object.create(Object.getPrototypeOf(this),{$$:{value:$r(this.$$)}}));return r.$$.count.value+=1,r.$$.deleteScheduled=!1,r},delete(){this.$$.ptr||wr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&dr("Object already scheduled for deletion"),br(this),Pr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||wr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&dr("Object already scheduled for deletion"),Sr.push(this),1===Sr.length&&yr&&yr(Or),this.$$.deleteScheduled=!0,this}})};function Ur(){}var Br=(r,e)=>Object.defineProperty(e,"name",{value:r}),Nr=(r,e,t)=>{if(void 0===r[e].overloadTable){var n=r[e];r[e]=function(...n){return r[e].overloadTable.hasOwnProperty(n.length)||dr(`Function '${t}' called with an invalid number of arguments (${n.length}) - expects one of (${r[e].overloadTable})!`),r[e].overloadTable[n.length].apply(this,n)},r[e].overloadTable=[],r[e].overloadTable[n.argCount]=n}},Mr=(r,e,t)=>{a.hasOwnProperty(r)?((void 0===t||void 0!==a[r].overloadTable&&void 0!==a[r].overloadTable[t])&&dr(`Cannot register public name '${r}' twice`),Nr(a,r,r),a.hasOwnProperty(t)&&dr(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),a[r].overloadTable[t]=e):(a[r]=e,void 0!==t&&(a[r].numArguments=t))},zr=48,qr=57,Gr=r=>{if(void 0===r)return"_unknown";var e=(r=r.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return e>=zr&&e<=qr?`_${r}`:r};function Lr(r,e,t,n,a,o,i,s){this.name=r,this.constructor=e,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=a,this.getActualType=o,this.upcast=i,this.downcast=s,this.pureVirtualFunctions=[]}var Jr=(r,e,t)=>{for(;e!==t;)e.upcast||dr(`Expected null or instance of ${t.name}, got an instance of ${e.name}`),r=e.upcast(r),e=e.baseClass;return r};function Kr(r,e){if(null===e)return this.isReference&&dr(`null is not a valid ${this.name}`),0;e.$$||dr(`Cannot pass "${Re(e)}" as a ${this.name}`),e.$$.ptr||dr(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=e.$$.ptrType.registeredClass;return Jr(e.$$.ptr,t,this.registeredClass)}function Qr(r,e){var t;if(null===e)return this.isReference&&dr(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),null!==r&&r.push(this.rawDestructor,t),t):0;e&&e.$$||dr(`Cannot pass "${Re(e)}" as a ${this.name}`),e.$$.ptr||dr(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&e.$$.ptrType.isConst&&dr(`Cannot convert argument of type ${e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name} to parameter type ${this.name}`);var n=e.$$.ptrType.registeredClass;if(t=Jr(e.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===e.$$.smartPtr&&dr("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:e.$$.smartPtrType===this?t=e.$$.smartPtr:dr(`Cannot convert argument of type ${e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=e.$$.smartPtr;break;case 2:if(e.$$.smartPtrType===this)t=e.$$.smartPtr;else{var a=e.clone();t=this.rawShare(t,_e.toHandle((()=>a.delete()))),null!==r&&r.push(this.rawDestructor,t)}break;default:dr("Unsupporting sharing policy")}return t}function Zr(r,e){if(null===e)return this.isReference&&dr(`null is not a valid ${this.name}`),0;e.$$||dr(`Cannot pass "${Re(e)}" as a ${this.name}`),e.$$.ptr||dr(`Cannot pass deleted object as a pointer of type ${this.name}`),e.$$.ptrType.isConst&&dr(`Cannot convert argument of type ${e.$$.ptrType.name} to parameter type ${this.name}`);var t=e.$$.ptrType.registeredClass;return Jr(e.$$.ptr,t,this.registeredClass)}var Xr=()=>{Object.assign(Yr.prototype,{getPointee(r){return this.rawGetPointee&&(r=this.rawGetPointee(r)),r},destructor(r){this.rawDestructor?.(r)},argPackAdvance:mr,readValueFromPointer:rr,fromWireType:Ir})};function Yr(r,e,t,n,a,o,i,s,u,c,l){this.name=r,this.registeredClass=e,this.isReference=t,this.isConst=n,this.isSmartPointer=a,this.pointeeType=o,this.sharingPolicy=i,this.rawGetPointee=s,this.rawConstructor=u,this.rawShare=c,this.rawDestructor=l,a||void 0!==e.baseClass?this.toWireType=Qr:n?(this.toWireType=Kr,this.destructorFunction=null):(this.toWireType=Zr,this.destructorFunction=null)}var re,ee,te=(r,e,t)=>{a.hasOwnProperty(r)||sr("Replacing nonexistent public symbol"),void 0!==a[r].overloadTable&&void 0!==t?a[r].overloadTable[t]=e:(a[r]=e,a[r].argCount=t)},ne=(r,e,t)=>(r=r.replace(/p/g,"i"),(0,a["dynCall_"+r])(e,...t)),ae=[],oe=r=>{var e=ae[r];return e||(r>=ae.length&&(ae.length=r+1),ae[r]=e=re.get(r)),e},ie=(r,e,t=[])=>r.includes("j")?ne(r,e,t):oe(e)(...t),se=(r,e)=>(...t)=>ie(r,e,t),ue=(r,e)=>{function t(){return r.includes("j")?se(r,e):oe(e)}r=hr(r);var n=t();return"function"!=typeof n&&dr(`unknown function pointer with signature ${r}: ${e}`),n},ce=(r,e)=>{var t=Br(e,(function(r){this.name=e,this.message=r;var t=new Error(r).stack;void 0!==t&&(this.stack=this.toString()+"\n"+t.replace(/^Error(:[^\n]*)?\n/,""))}));return t.prototype=Object.create(r.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},t},le=r=>{var e=Rt(r),t=hr(e);return xt(e),t},pe=(r,e)=>{var t=[],n={};function a(r){n[r]||or[r]||(ir[r]?ir[r].forEach(a):(t.push(r),n[r]=!0))}throw e.forEach(a),new ee(`${r}: `+t.map(le).join([", "]))},he=(r,e,t,n,a,o,i,s,u,c,l,p,h)=>{l=hr(l),o=ue(a,o),s&&=ue(i,s),c&&=ue(u,c),h=ue(p,h);var d=Gr(l);Mr(d,(function(){pe(`Cannot construct ${l} due to unbound types`,[n])})),ur([r,e,t],n?[n]:[],(e=>{var t,a;e=e[0],a=n?(t=e.registeredClass).instancePrototype:Ur.prototype;var i=Br(l,(function(...r){if(Object.getPrototypeOf(this)!==u)throw new nr("Use 'new' to construct "+l);if(void 0===p.constructor_body)throw new nr(l+" has no accessible constructor");var e=p.constructor_body[r.length];if(void 0===e)throw new nr(`Tried to invoke ctor of ${l} with invalid number of parameters (${r.length}) - expected (${Object.keys(p.constructor_body).toString()}) parameters instead!`);return e.apply(this,r)})),u=Object.create(a,{constructor:{value:i}});i.prototype=u;var p=new Lr(l,i,u,h,t,o,s,c);p.baseClass&&(p.baseClass.__derivedClasses??=[],p.baseClass.__derivedClasses.push(p));var f=new Yr(l,p,!0,!1,!1),v=new Yr(l+"*",p,!1,!1,!1),y=new Yr(l+" const*",p,!1,!0,!1);return Wr[r]={pointerType:v,constPointerType:y},te(d,i),[f,v,y]}))},de=(r,e)=>{for(var t=[],n=0;n<r;n++)t.push($[e+4*n>>2]);return t};function fe(r){for(var e=1;e<r.length;++e)if(null!==r[e]&&void 0===r[e].destructorFunction)return!0;return!1}function ve(r,e){if(!(r instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof r} which is not a function`);var t=Br(r.name||"unknownFunctionName",(function(){}));t.prototype=r.prototype;var n=new t,a=r.apply(n,e);return a instanceof Object?a:n}function ye(r,e,t,n){for(var a=fe(r),o=r.length,i="",s="",u=0;u<o-2;++u)i+=(0!==u?", ":"")+"arg"+u,s+=(0!==u?", ":"")+"arg"+u+"Wired";var c=`\n return function (${i}) {\n if (arguments.length !== ${o-2}) {\n throwBindingError('function ' + humanName + ' called with ' + arguments.length + ' arguments, expected ${o-2}');\n }`;a&&(c+="var destructors = [];\n");var l=a?"destructors":"null",p=["humanName","throwBindingError","invoker","fn","runDestructors","retType","classParam"];for(e&&(c+="var thisWired = classParam['toWireType']("+l+", this);\n"),u=0;u<o-2;++u)c+="var arg"+u+"Wired = argType"+u+"['toWireType']("+l+", arg"+u+");\n",p.push("argType"+u);if(e&&(s="thisWired"+(s.length>0?", ":"")+s),c+=(t||n?"var rv = ":"")+"invoker(fn"+(s.length>0?", ":"")+s+");\n",a)c+="runDestructors(destructors);\n";else for(u=e?1:2;u<r.length;++u){var h=1===u?"thisWired":"arg"+(u-2)+"Wired";null!==r[u].destructorFunction&&(c+=`${h}_dtor(${h});\n`,p.push(`${h}_dtor`))}return t&&(c+="var ret = retType['fromWireType'](rv);\nreturn ret;\n"),[p,c+="}\n"]}function me(r,e,t,n,a,o){var i=e.length;i<2&&dr("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var s=null!==e[1]&&null!==t,u=fe(e),c="void"!==e[0].name,l=[r,dr,n,a,Y,e[0],e[1]],p=0;p<i-2;++p)l.push(e[p+2]);if(!u)for(p=s?1:2;p<e.length;++p)null!==e[p].destructorFunction&&l.push(e[p].destructorFunction);let[h,d]=ye(e,s,c,o);h.push(d);var f=ve(Function,h)(...l);return Br(r,f)}var ge=(r,e,t,n,a,o)=>{var i=de(e,t);a=ue(n,a),ur([],[r],(r=>{var t=`constructor ${(r=r[0]).name}`;if(void 0===r.registeredClass.constructor_body&&(r.registeredClass.constructor_body=[]),void 0!==r.registeredClass.constructor_body[e-1])throw new nr(`Cannot register multiple constructors with identical number of parameters (${e-1}) for class '${r.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return r.registeredClass.constructor_body[e-1]=()=>{pe(`Cannot construct ${r.name} due to unbound types`,i)},ur([],i,(n=>(n.splice(1,0,null),r.registeredClass.constructor_body[e-1]=me(t,n,null,a,o),[]))),[]}))},$e=r=>{const e=(r=r.trim()).indexOf("(");return-1!==e?r.substr(0,e):r},we=(r,e,t,n,a,o,i,s,u)=>{var c=de(t,n);e=hr(e),e=$e(e),o=ue(a,o),ur([],[r],(r=>{var n=`${(r=r[0]).name}.${e}`;function a(){pe(`Cannot call ${n} due to unbound types`,c)}e.startsWith("@@")&&(e=Symbol[e.substring(2)]),s&&r.registeredClass.pureVirtualFunctions.push(e);var l=r.registeredClass.instancePrototype,p=l[e];return void 0===p||void 0===p.overloadTable&&p.className!==r.name&&p.argCount===t-2?(a.argCount=t-2,a.className=r.name,l[e]=a):(Nr(l,e,n),l[e].overloadTable[t-2]=a),ur([],c,(a=>{var s=me(n,a,r,o,i,u);return void 0===l[e].overloadTable?(s.argCount=t-2,l[e]=s):l[e].overloadTable[t-2]=s,[]})),[]}))},Te=(r,e,t)=>{r=hr(r),ur([],[e],(e=>(e=e[0],a[r]=e.fromWireType(t),[])))},be=[],Ce=[],Pe=r=>{r>9&&0==--Ce[r+1]&&(Ce[r]=void 0,be.push(r))},Ae=()=>Ce.length/2-5-be.length,We=()=>{Ce.push(0,1,void 0,1,null,1,!0,1,!1,1),a.count_emval_handles=Ae},_e={toValue:r=>(r||dr("Cannot use deleted val. handle = "+r),Ce[r]),toHandle:r=>{switch(r){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const e=be.pop()||Ce.length;return Ce[e]=r,Ce[e+1]=1,e}}}},Fe={name:"emscripten::val",fromWireType:r=>{var e=_e.toValue(r);return Pe(r),e},toWireType:(r,e)=>_e.toHandle(e),argPackAdvance:mr,readValueFromPointer:rr,destructorFunction:null},Se=r=>vr(r,Fe),Oe=(r,e,t)=>{switch(e){case 1:return t?function(r){return this.fromWireType(f[r])}:function(r){return this.fromWireType(v[r])};case 2:return t?function(r){return this.fromWireType(y[r>>1])}:function(r){return this.fromWireType(m[r>>1])};case 4:return t?function(r){return this.fromWireType(g[r>>2])}:function(r){return this.fromWireType($[r>>2])};default:throw new TypeError(`invalid integer width (${e}): ${r}`)}},je=(r,e,t,n)=>{function a(){}e=hr(e),a.values={},vr(r,{name:e,constructor:a,fromWireType:function(r){return this.constructor.values[r]},toWireType:(r,e)=>e.value,argPackAdvance:mr,readValueFromPointer:Oe(e,t,n),destructorFunction:null}),Mr(e,a)},ke=(r,e)=>{var t=or[r];return void 0===t&&dr(`${e} has unknown type ${le(r)}`),t},Ee=(r,e,t)=>{var n=ke(r,"enum");e=hr(e);var a=n.constructor,o=Object.create(n.constructor.prototype,{value:{value:t},constructor:{value:Br(`${n.name}_${e}`,(function(){}))}});a.values[t]=o,a[e]=o},Re=r=>{if(null===r)return"null";var e=typeof r;return"object"===e||"array"===e||"function"===e?r.toString():""+r},De=(r,e)=>{switch(e){case 4:return function(r){return this.fromWireType(w[r>>2])};case 8:return function(r){return this.fromWireType(T[r>>3])};default:throw new TypeError(`invalid float width (${e}): ${r}`)}},xe=(r,e,t)=>{vr(r,{name:e=hr(e),fromWireType:r=>r,toWireType:(r,e)=>e,argPackAdvance:mr,readValueFromPointer:De(e,t),destructorFunction:null})},Ie=(r,e,t,n,a,o,i)=>{var s=de(e,t);r=hr(r),r=$e(r),a=ue(n,a),Mr(r,(function(){pe(`Cannot call ${r} due to unbound types`,s)}),e-1),ur([],s,(t=>{var n=[t[0],null].concat(t.slice(1));return te(r,me(r,n,null,a,o,i),e-1),[]}))},Ve=(r,e,t)=>{switch(e){case 1:return t?r=>f[r]:r=>v[r];case 2:return t?r=>y[r>>1]:r=>m[r>>1];case 4:return t?r=>g[r>>2]:r=>$[r>>2];default:throw new TypeError(`invalid integer width (${e}): ${r}`)}},He=(r,e,t,n,a)=>{e=hr(e);var o=r=>r;if(0===n){var i=32-8*t;o=r=>r<<i>>>i}var s=e.includes("unsigned"),u=(r,e)=>{};vr(r,{name:e,fromWireType:o,toWireType:s?function(r,e){return u(e,this.name),e>>>0}:function(r,e){return u(e,this.name),e},argPackAdvance:mr,readValueFromPointer:Ve(e,t,0!==n),destructorFunction:null})},Ue=(r,e,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][e];function a(r){var e=$[r>>2],t=$[r+4>>2];return new n(f.buffer,t,e)}vr(r,{name:t=hr(t),fromWireType:a,argPackAdvance:mr,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})},Be=(r,e,t,n)=>{if(!(n>0))return 0;for(var a=t,o=t+n-1,i=0;i<r.length;++i){var s=r.charCodeAt(i);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&r.charCodeAt(++i)),s<=127){if(t>=o)break;e[t++]=s}else if(s<=2047){if(t+1>=o)break;e[t++]=192|s>>6,e[t++]=128|63&s}else if(s<=65535){if(t+2>=o)break;e[t++]=224|s>>12,e[t++]=128|s>>6&63,e[t++]=128|63&s}else{if(t+3>=o)break;e[t++]=240|s>>18,e[t++]=128|s>>12&63,e[t++]=128|s>>6&63,e[t++]=128|63&s}}return e[t]=0,t-a},Ne=(r,e,t)=>Be(r,v,e,t),Me=r=>{for(var e=0,t=0;t<r.length;++t){var n=r.charCodeAt(t);n<=127?e++:n<=2047?e+=2:n>=55296&&n<=57343?(e+=4,++t):e+=3}return e},ze="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,qe=(r,e,t)=>{for(var n=e+t,a=e;r[a]&&!(a>=n);)++a;if(a-e>16&&r.buffer&&ze)return ze.decode(r.subarray(e,a));for(var o="";e<a;){var i=r[e++];if(128&i){var s=63&r[e++];if(192!=(224&i)){var u=63&r[e++];if((i=224==(240&i)?(15&i)<<12|s<<6|u:(7&i)<<18|s<<12|u<<6|63&r[e++])<65536)o+=String.fromCharCode(i);else{var c=i-65536;o+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else o+=String.fromCharCode((31&i)<<6|s)}else o+=String.fromCharCode(i)}return o},Ge=(r,e)=>r?qe(v,r,e):"",Le=(r,e)=>{var t="std::string"===(e=hr(e));vr(r,{name:e,fromWireType(r){var e,n=$[r>>2],a=r+4;if(t)for(var o=a,i=0;i<=n;++i){var s=a+i;if(i==n||0==v[s]){var u=Ge(o,s-o);void 0===e?e=u:(e+=String.fromCharCode(0),e+=u),o=s+1}}else{var c=new Array(n);for(i=0;i<n;++i)c[i]=String.fromCharCode(v[a+i]);e=c.join("")}return xt(r),e},toWireType(r,e){var n;e instanceof ArrayBuffer&&(e=new Uint8Array(e));var a="string"==typeof e;a||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||dr("Cannot pass non-string to std::string"),n=t&&a?Me(e):e.length;var o=Dt(4+n+1),i=o+4;if($[o>>2]=n,t&&a)Ne(e,i,n+1);else if(a)for(var s=0;s<n;++s){var u=e.charCodeAt(s);u>255&&(xt(i),dr("String has UTF-16 code units that do not fit in 8 bits")),v[i+s]=u}else for(s=0;s<n;++s)v[i+s]=e[s];return null!==r&&r.push(xt,o),o},argPackAdvance:mr,readValueFromPointer:rr,destructorFunction(r){xt(r)}})},Je="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,Ke=(r,e)=>{for(var t=r,n=t>>1,a=n+e/2;!(n>=a)&&m[n];)++n;if((t=n<<1)-r>32&&Je)return Je.decode(v.subarray(r,t));for(var o="",i=0;!(i>=e/2);++i){var s=y[r+2*i>>1];if(0==s)break;o+=String.fromCharCode(s)}return o},Qe=(r,e,t)=>{if(t??=2147483647,t<2)return 0;for(var n=e,a=(t-=2)<2*r.length?t/2:r.length,o=0;o<a;++o){var i=r.charCodeAt(o);y[e>>1]=i,e+=2}return y[e>>1]=0,e-n},Ze=r=>2*r.length,Xe=(r,e)=>{for(var t=0,n="";!(t>=e/4);){var a=g[r+4*t>>2];if(0==a)break;if(++t,a>=65536){var o=a-65536;n+=String.fromCharCode(55296|o>>10,56320|1023&o)}else n+=String.fromCharCode(a)}return n},Ye=(r,e,t)=>{if(t??=2147483647,t<4)return 0;for(var n=e,a=n+t-4,o=0;o<r.length;++o){var i=r.charCodeAt(o);if(i>=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&r.charCodeAt(++o)),g[e>>2]=i,(e+=4)+4>a)break}return g[e>>2]=0,e-n},rt=r=>{for(var e=0,t=0;t<r.length;++t){var n=r.charCodeAt(t);n>=55296&&n<=57343&&++t,e+=4}return e},et=(r,e,t)=>{var n,a,o,i;t=hr(t),2===e?(n=Ke,a=Qe,i=Ze,o=r=>m[r>>1]):4===e&&(n=Xe,a=Ye,i=rt,o=r=>$[r>>2]),vr(r,{name:t,fromWireType:r=>{for(var t,a=$[r>>2],i=r+4,s=0;s<=a;++s){var u=r+4+s*e;if(s==a||0==o(u)){var c=n(i,u-i);void 0===t?t=c:(t+=String.fromCharCode(0),t+=c),i=u+e}}return xt(r),t},toWireType:(r,n)=>{"string"!=typeof n&&dr(`Cannot pass non-string to C++ string type ${t}`);var o=i(n),s=Dt(4+o+e);return $[s>>2]=o/e,a(n,s+4,o+e),null!==r&&r.push(xt,s),s},argPackAdvance:mr,readValueFromPointer:rr,destructorFunction(r){xt(r)}})},tt=(r,e,t,n,a,o)=>{X[r]={name:hr(e),rawConstructor:ue(t,n),rawDestructor:ue(a,o),fields:[]}},nt=(r,e,t,n,a,o,i,s,u,c)=>{X[r].fields.push({fieldName:hr(e),getterReturnType:t,getter:ue(n,a),getterContext:o,setterArgumentType:i,setter:ue(s,u),setterContext:c})},at=(r,e)=>{vr(r,{isVoid:!0,name:e=hr(e),argPackAdvance:0,fromWireType:()=>{},toWireType:(r,e)=>{}})},ot=(r,e,t)=>v.copyWithin(r,e,e+t),it=(r,e,t)=>{var n=[],a=r.toWireType(n,t);return n.length&&($[e>>2]=_e.toHandle(n)),a},st=(r,e,t)=>(r=_e.toValue(r),e=ke(e,"emval::as"),it(e,t,r)),ut=[],ct=(r,e,t,n)=>(r=ut[r])(null,e=_e.toValue(e),t,n),lt={},pt=r=>{var e=lt[r];return void 0===e?hr(r):e},ht=(r,e,t,n,a)=>(r=ut[r])(e=_e.toValue(e),e[t=pt(t)],n,a),dt=()=>"object"==typeof globalThis?globalThis:Function("return this")(),ft=r=>0===r?_e.toHandle(dt()):(r=pt(r),_e.toHandle(dt()[r])),vt=r=>{var e=ut.length;return ut.push(r),e},yt=(r,e)=>{for(var t=new Array(r),n=0;n<r;++n)t[n]=ke($[e+4*n>>2],"parameter "+n);return t},mt=(r,e,t)=>{var n=yt(r,e),a=n.shift();r--;var o="return function (obj, func, destructorsRef, args) {\n",i=0,s=[];0===t&&s.push("obj");for(var u=["retType"],c=[a],l=0;l<r;++l)s.push("arg"+l),u.push("argType"+l),c.push(n[l]),o+=` var arg${l} = argType${l}.readValueFromPointer(args${i?"+"+i:""});\n`,i+=n[l].argPackAdvance;o+=` var rv = ${1===t?"new func":"func.call"}(${s.join(", ")});\n`,a.isVoid||(u.push("emval_returnValue"),c.push(it),o+=" return emval_returnValue(retType, destructorsRef, rv);\n"),o+="};\n",u.push(o);var p=ve(Function,u)(...c),h=`methodCaller<(${n.map((r=>r.name)).join(", ")}) => ${a.name}>`;return vt(Br(h,p))},gt=r=>(r=pt(r),_e.toHandle(a[r])),$t=(r,e)=>(r=_e.toValue(r),e=_e.toValue(e),_e.toHandle(r[e])),wt=r=>{r>9&&(Ce[r+1]+=1)},Tt=r=>_e.toHandle(pt(r)),bt=r=>{var e=_e.toValue(r);Y(e),Pe(r)},Ct=()=>2147483648,Pt=r=>{var e=(r-p.buffer.byteLength+65535)/65536;try{return p.grow(e),C(),1}catch(t){}},At=r=>{var e=v.length;r>>>=0;var t=Ct();if(r>t)return!1;for(var n=(r,e)=>r+(e-r%e)%e,a=1;a<=4;a*=2){var o=e*(1+.2/a);o=Math.min(o,r+100663296);var i=Math.min(t,n(Math.max(r,o),65536));if(Pt(i))return!0}return!1},Wt=r=>52;function _t(r,e,t,n,a){return 70}var Ft=[null,[],[]],St=(r,e)=>{var t=Ft[r];0===e||10===e?((1===r?h:d)(qe(t,0)),t.length=0):t.push(e)},Ot=(r,e,t,n)=>{for(var a=0,o=0;o<t;o++){var i=$[e>>2],s=$[e+4>>2];e+=8;for(var u=0;u<s;u++)St(r,v[i+u]);a+=s}return $[n>>2]=a,0};er=a.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},pr(),nr=a.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},Hr(),kr(),Xr(),ee=a.UnboundTypeError=ce(Error,"UnboundTypeError"),We();var jt,kt={K:Q,G:Z,s:cr,C:lr,I:gr,w:he,v:ge,d:we,m:Te,H:Se,o:je,a:Ee,A:xe,k:Ie,l:He,f:Ue,z:Le,u:et,t:tt,c:nt,J:at,F:ot,n:st,q:ct,p:ht,b:Pe,x:ft,i:mt,r:gt,g:$t,j:wt,h:Tt,e:bt,D:At,E:Wt,B:_t,y:Ot},Et=L(),Rt=r=>(Rt=Et.N)(r),Dt=r=>(Dt=Et.O)(r),xt=r=>(xt=Et.P)(r),It=r=>(It=Et.R)(r);function Vt(){function r(){jt||(jt=!0,a.calledRun=!0,b||(F(),t(a),a.onRuntimeInitialized&&a.onRuntimeInitialized(),S()))}E>0||(_(),E>0||(a.setStatus?(a.setStatus("Running..."),setTimeout((function(){setTimeout((function(){a.setStatus("")}),1),r()}),1)):r()))}if(a.dynCall_jiji=(r,e,t,n,o)=>(a.dynCall_jiji=Et.S)(r,e,t,n,o),R=function r(){jt||Vt(),jt||(R=r)},a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);a.preInit.length>0;)a.preInit.pop()();return Vt(),o});export{e as default};