factory_web/public/jsmap/ThirdParty/Workers/basis_transcoder.js

1 line
33 KiB
JavaScript

var BASIS=function(){var r="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0;return"undefined"!=typeof __filename&&(r=r||__filename),function(e){var t,n,o=void 0!==(e=e||{})?e:{};o.ready=new Promise((function(r,e){t=r,readyPromiseRejectza=e}));var i,a={};for(i in o)o.hasOwnProperty(i)&&(a[i]=o[i]);var u=[],s=!1,c=!1,f=!1,l=!1;s="object"==typeof window,c="function"==typeof importScripts,f="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,l=!s&&!f&&!c;var p,d,h,v,y,m="";function g(r){return o.locateFile?o.locateFile(r,m):m+r}f?(m=c?require("path").dirname(m)+"/":__dirname+"/",p=function(r,e){return v||(v=require("fs")),y||(y=require("path")),r=y.normalize(r),v.readFileSync(r,e?null:"utf8")},h=function(r){var e=p(r,!0);return e.buffer||(e=new Uint8Array(e)),A(e.buffer),e},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),u=process.argv.slice(2),process.on("uncaughtException",(function(r){if(!(r instanceof Qt))throw r})),process.on("unhandledRejection",dr),o.inspect=function(){return"[Emscripten Module object]"}):l?("undefined"!=typeof read&&(p=function(r){return read(r)}),h=function(r){var e;return"function"==typeof readbuffer?new Uint8Array(readbuffer(r)):(A("object"==typeof(e=read(r,"binary"))),e)},"undefined"!=typeof scriptArgs?u=scriptArgs:void 0!==arguments&&(u=arguments),"undefined"!=typeof print&&("undefined"==typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!=typeof printErr?printErr:print)):(s||c)&&(c?m=self.location.href:"undefined"!=typeof document&&document.currentScript&&(m=document.currentScript.src),r&&(m=r),m=0!==m.indexOf("blob:")?m.substr(0,m.lastIndexOf("/")+1):"",p=function(r){var e=new XMLHttpRequest;return e.open("GET",r,!1),e.send(null),e.responseText},c&&(h=function(r){var e=new XMLHttpRequest;return e.open("GET",r,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),d=function(r,e,t){var n=new XMLHttpRequest;n.open("GET",r,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?e(n.response):t()},n.onerror=t,n.send(null)});var w=o.print||console.log.bind(console),T=o.printErr||console.warn.bind(console);for(i in a)a.hasOwnProperty(i)&&(o[i]=a[i]);a=null,o.arguments&&(u=o.arguments),o.thisProgram&&o.thisProgram,o.quit&&o.quit;var b,C,$=function(r){};o.wasmBinary&&(b=o.wasmBinary),o.noExitRuntime,"object"!=typeof WebAssembly&&dr("no native wasm support detected");var P=!1;function A(r,e){r||dr("Assertion failed: "+e)}var _="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function S(r,e,t){for(var n=e+t,o=e;r[o]&&!(o>=n);)++o;if(o-e>16&&r.subarray&&_)return _.decode(r.subarray(e,o));for(var i="";e<o;){var a=r[e++];if(128&a){var u=63&r[e++];if(192!=(224&a)){var s=63&r[e++];if((a=224==(240&a)?(15&a)<<12|u<<6|s:(7&a)<<18|u<<12|s<<6|63&r[e++])<65536)i+=String.fromCharCode(a);else{var c=a-65536;i+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else i+=String.fromCharCode((31&a)<<6|u)}else i+=String.fromCharCode(a)}return i}function W(r,e){return r?S(R,r,e):""}function E(r,e,t,n){if(!(n>0))return 0;for(var o=t,i=t+n-1,a=0;a<r.length;++a){var u=r.charCodeAt(a);if(u>=55296&&u<=57343&&(u=65536+((1023&u)<<10)|1023&r.charCodeAt(++a)),u<=127){if(t>=i)break;e[t++]=u}else if(u<=2047){if(t+1>=i)break;e[t++]=192|u>>6,e[t++]=128|63&u}else if(u<=65535){if(t+2>=i)break;e[t++]=224|u>>12,e[t++]=128|u>>6&63,e[t++]=128|63&u}else{if(t+3>=i)break;e[t++]=240|u>>18,e[t++]=128|u>>12&63,e[t++]=128|u>>6&63,e[t++]=128|63&u}}return e[t]=0,t-o}function F(r,e,t){return E(r,R,e,t)}function k(r){for(var e=0,t=0;t<r.length;++t){var n=r.charCodeAt(t);n>=55296&&n<=57343&&(n=65536+((1023&n)<<10)|1023&r.charCodeAt(++t)),n<=127?++e:e+=n<=2047?2:n<=65535?3:4}return e}var O,j,R,I,x,D,U,B,M,V="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function H(r,e){for(var t=r,n=t>>1,o=n+e/2;!(n>=o)&&x[n];)++n;if((t=n<<1)-r>32&&V)return V.decode(R.subarray(r,t));for(var i="",a=0;!(a>=e/2);++a){var u=I[r+2*a>>1];if(0==u)break;i+=String.fromCharCode(u)}return i}function q(r,e,t){if(void 0===t&&(t=2147483647),t<2)return 0;for(var n=e,o=(t-=2)<2*r.length?t/2:r.length,i=0;i<o;++i){var a=r.charCodeAt(i);I[e>>1]=a,e+=2}return I[e>>1]=0,e-n}function z(r){return 2*r.length}function N(r,e){for(var t=0,n="";!(t>=e/4);){var o=D[r+4*t>>2];if(0==o)break;if(++t,o>=65536){var i=o-65536;n+=String.fromCharCode(55296|i>>10,56320|1023&i)}else n+=String.fromCharCode(o)}return n}function G(r,e,t){if(void 0===t&&(t=2147483647),t<4)return 0;for(var n=e,o=n+t-4,i=0;i<r.length;++i){var a=r.charCodeAt(i);if(a>=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&r.charCodeAt(++i)),D[e>>2]=a,(e+=4)+4>o)break}return D[e>>2]=0,e-n}function L(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}function X(r,e){return r%e>0&&(r+=e-r%e),r}function J(r){O=r,o.HEAP8=j=new Int8Array(r),o.HEAP16=I=new Int16Array(r),o.HEAP32=D=new Int32Array(r),o.HEAPU8=R=new Uint8Array(r),o.HEAPU16=x=new Uint16Array(r),o.HEAPU32=U=new Uint32Array(r),o.HEAPF32=B=new Float32Array(r),o.HEAPF64=M=new Float64Array(r)}o.INITIAL_MEMORY;var K,Q=[],Y=[],Z=[],rr=[];function er(){if(o.preRun)for("function"==typeof o.preRun&&(o.preRun=[o.preRun]);o.preRun.length;)ir(o.preRun.shift());$r(Q)}function tr(){$r(Y)}function nr(){$r(Z)}function or(){if(o.postRun)for("function"==typeof o.postRun&&(o.postRun=[o.postRun]);o.postRun.length;)ur(o.postRun.shift());$r(rr)}function ir(r){Q.unshift(r)}function ar(r){Y.unshift(r)}function ur(r){rr.unshift(r)}var sr=0,cr=null,fr=null;function lr(r){sr++,o.monitorRunDependencies&&o.monitorRunDependencies(sr)}function pr(r){if(sr--,o.monitorRunDependencies&&o.monitorRunDependencies(sr),0==sr&&(null!==cr&&(clearInterval(cr),cr=null),fr)){var e=fr;fr=null,e()}}function dr(r){o.onAbort&&o.onAbort(r),T(r+=""),P=!0,r="abort("+r+"). Build with -s ASSERTIONS=1 for more info.";var e=new WebAssembly.RuntimeError(r);throw n(e),e}function hr(r,e){return String.prototype.startsWith?r.startsWith(e):0===r.indexOf(e)}o.preloadedImages={},o.preloadedAudios={};var vr="data:application/octet-stream;base64,";function yr(r){return hr(r,vr)}var mr="file://";function gr(r){return hr(r,mr)}var wr="basis_transcoder.wasm";function Tr(r){try{if(r==wr&&b)return new Uint8Array(b);if(h)return h(r);throw"both async and sync fetching of the wasm failed"}catch(r){dr(r)}}function br(){if(!b&&(s||c)){if("function"==typeof fetch&&!gr(wr))return fetch(wr,{credentials:"same-origin"}).then((function(r){if(!r.ok)throw"failed to load wasm binary file at '"+wr+"'";return r.arrayBuffer()})).catch((function(){return Tr(wr)}));if(d)return new Promise((function(r,e){d(wr,(function(e){r(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return Tr(wr)}))}function Cr(){var r={a:Lt};function e(r,e){var t=r.exports;o.asm=t,J((C=o.asm.K).buffer),K=o.asm.O,ar(o.asm.L),pr()}function t(r){e(r.instance)}function i(e){return br().then((function(e){return WebAssembly.instantiate(e,r)})).then(e,(function(r){T("failed to asynchronously prepare wasm: "+r),dr(r)}))}if(lr(),o.instantiateWasm)try{return o.instantiateWasm(r,e)}catch(r){return T("Module.instantiateWasm callback failed with error: "+r),!1}return(b||"function"!=typeof WebAssembly.instantiateStreaming||yr(wr)||gr(wr)||"function"!=typeof fetch?i(t):fetch(wr,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,r).then(t,(function(r){return T("wasm streaming compile failed: "+r),T("falling back to ArrayBuffer instantiation"),i(t)}))}))).catch(n),{}}function $r(r){for(;r.length>0;){var e=r.shift();if("function"!=typeof e){var t=e.func;"number"==typeof t?void 0===e.arg?K.get(t)():K.get(t)(e.arg):t(void 0===e.arg?null:e.arg)}else e(o)}}yr(wr)||(wr=g(wr));var Pr={};function Ar(r){for(;r.length;){var e=r.pop();r.pop()(e)}}function _r(r){return this.fromWireType(U[r>>2])}var Sr={},Wr={},Er={},Fr=48,kr=57;function Or(r){if(void 0===r)return"_unknown";var e=(r=r.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return e>=Fr&&e<=kr?"_"+r:r}function jr(r,e){return r=Or(r),new Function("body","return function "+r+'() {\n "use strict"; return body.apply(this, arguments);\n};\n')(e)}function Rr(r,e){var t=jr(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}var Ir=void 0;function xr(r){throw new Ir(r)}function Dr(r,e,t){function n(e){var n=t(e);n.length!==r.length&&xr("Mismatched type converter count");for(var o=0;o<r.length;++o)Nr(r[o],n[o])}r.forEach((function(r){Er[r]=e}));var o=new Array(e.length),i=[],a=0;e.forEach((function(r,e){Wr.hasOwnProperty(r)?o[e]=Wr[r]:(i.push(r),Sr.hasOwnProperty(r)||(Sr[r]=[]),Sr[r].push((function(){o[e]=Wr[r],++a===i.length&&n(o)})))})),0===i.length&&n(o)}function Ur(r){var e=Pr[r];delete Pr[r];var t=e.rawConstructor,n=e.rawDestructor,o=e.fields;Dr([r],o.map((function(r){return r.getterReturnType})).concat(o.map((function(r){return r.setterArgumentType}))),(function(r){var i={};return o.forEach((function(e,t){var n=e.fieldName,a=r[t],u=e.getter,s=e.getterContext,c=r[t+o.length],f=e.setter,l=e.setterContext;i[n]={read:function(r){return a.fromWireType(u(s,r))},write:function(r,e){var t=[];f(l,r,c.toWireType(t,e)),Ar(t)}}})),[{name:e.name,fromWireType:function(r){var e={};for(var t in i)e[t]=i[t].read(r);return n(r),e},toWireType:function(r,e){for(var o in i)if(!(o in e))throw new TypeError('Missing field: "'+o+'"');var a=t();for(o in i)i[o].write(a,e[o]);return null!==r&&r.push(n,a),a},argPackAdvance:8,readValueFromPointer:_r,destructorFunction:n}]}))}function Br(r){switch(r){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+r)}}function Mr(){for(var r=new Array(256),e=0;e<256;++e)r[e]=String.fromCharCode(e);Vr=r}var Vr=void 0;function Hr(r){for(var e="",t=r;R[t];)e+=Vr[R[t++]];return e}var qr=void 0;function zr(r){throw new qr(r)}function Nr(r,e,t){if(t=t||{},!("argPackAdvance"in e))throw new TypeError("registerType registeredInstance requires argPackAdvance");var n=e.name;if(r||zr('type "'+n+'" must have a positive integer typeid pointer'),Wr.hasOwnProperty(r)){if(t.ignoreDuplicateRegistrations)return;zr("Cannot register type '"+n+"' twice")}if(Wr[r]=e,delete Er[r],Sr.hasOwnProperty(r)){var o=Sr[r];delete Sr[r],o.forEach((function(r){r()}))}}function Gr(r,e,t,n,o){var i=Br(t);Nr(r,{name:e=Hr(e),fromWireType:function(r){return!!r},toWireType:function(r,e){return e?n:o},argPackAdvance:8,readValueFromPointer:function(r){var n;if(1===t)n=j;else if(2===t)n=I;else{if(4!==t)throw new TypeError("Unknown boolean type size: "+e);n=D}return this.fromWireType(n[r>>i])},destructorFunction:null})}function Lr(r){if(!(this instanceof ce))return!1;if(!(r instanceof ce))return!1;for(var e=this.$$.ptrType.registeredClass,t=this.$$.ptr,n=r.$$.ptrType.registeredClass,o=r.$$.ptr;e.baseClass;)t=e.upcast(t),e=e.baseClass;for(;n.baseClass;)o=n.upcast(o),n=n.baseClass;return e===n&&t===o}function Xr(r){return{count:r.count,deleteScheduled:r.deleteScheduled,preservePointerOnDelete:r.preservePointerOnDelete,ptr:r.ptr,ptrType:r.ptrType,smartPtr:r.smartPtr,smartPtrType:r.smartPtrType}}function Jr(r){zr(r.$$.ptrType.registeredClass.name+" instance already deleted")}var Kr=!1;function Qr(r){}function Yr(r){r.smartPtr?r.smartPtrType.rawDestructor(r.smartPtr):r.ptrType.registeredClass.rawDestructor(r.ptr)}function Zr(r){r.count.value-=1,0===r.count.value&&Yr(r)}function re(r){return"undefined"==typeof FinalizationGroup?(re=function(r){return r},r):(Kr=new FinalizationGroup((function(r){for(var e=r.next();!e.done;e=r.next()){var t=e.value;t.ptr?Zr(t):console.warn("object already deleted: "+t.ptr)}})),re=function(r){return Kr.register(r,r.$$,r.$$),r},Qr=function(r){Kr.unregister(r.$$)},re(r))}function ee(){if(this.$$.ptr||Jr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var r=re(Object.create(Object.getPrototypeOf(this),{$$:{value:Xr(this.$$)}}));return r.$$.count.value+=1,r.$$.deleteScheduled=!1,r}function te(){this.$$.ptr||Jr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&zr("Object already scheduled for deletion"),Qr(this),Zr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function ne(){return!this.$$.ptr}var oe=void 0,ie=[];function ae(){for(;ie.length;){var r=ie.pop();r.$$.deleteScheduled=!1,r.delete()}}function ue(){return this.$$.ptr||Jr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&zr("Object already scheduled for deletion"),ie.push(this),1===ie.length&&oe&&oe(ae),this.$$.deleteScheduled=!0,this}function se(){ce.prototype.isAliasOf=Lr,ce.prototype.clone=ee,ce.prototype.delete=te,ce.prototype.isDeleted=ne,ce.prototype.deleteLater=ue}function ce(){}var fe={};function le(r,e,t){if(void 0===r[e].overloadTable){var n=r[e];r[e]=function(){return r[e].overloadTable.hasOwnProperty(arguments.length)||zr("Function '"+t+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+r[e].overloadTable+")!"),r[e].overloadTable[arguments.length].apply(this,arguments)},r[e].overloadTable=[],r[e].overloadTable[n.argCount]=n}}function pe(r,e,t){o.hasOwnProperty(r)?((void 0===t||void 0!==o[r].overloadTable&&void 0!==o[r].overloadTable[t])&&zr("Cannot register public name '"+r+"' twice"),le(o,r,r),o.hasOwnProperty(t)&&zr("Cannot register multiple overloads of a function with the same number of arguments ("+t+")!"),o[r].overloadTable[t]=e):(o[r]=e,void 0!==t&&(o[r].numArguments=t))}function de(r,e,t,n,o,i,a,u){this.name=r,this.constructor=e,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=o,this.getActualType=i,this.upcast=a,this.downcast=u,this.pureVirtualFunctions=[]}function he(r,e,t){for(;e!==t;)e.upcast||zr("Expected null or instance of "+t.name+", got an instance of "+e.name),r=e.upcast(r),e=e.baseClass;return r}function ve(r,e){if(null===e)return this.isReference&&zr("null is not a valid "+this.name),0;e.$$||zr('Cannot pass "'+at(e)+'" as a '+this.name),e.$$.ptr||zr("Cannot pass deleted object as a pointer of type "+this.name);var t=e.$$.ptrType.registeredClass;return he(e.$$.ptr,t,this.registeredClass)}function ye(r,e){var t;if(null===e)return this.isReference&&zr("null is not a valid "+this.name),this.isSmartPointer?(t=this.rawConstructor(),null!==r&&r.push(this.rawDestructor,t),t):0;e.$$||zr('Cannot pass "'+at(e)+'" as a '+this.name),e.$$.ptr||zr("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&e.$$.ptrType.isConst&&zr("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=he(e.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===e.$$.smartPtr&&zr("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:e.$$.smartPtrType===this?t=e.$$.smartPtr:zr("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 o=e.clone();t=this.rawShare(t,rt((function(){o.delete()}))),null!==r&&r.push(this.rawDestructor,t)}break;default:zr("Unsupporting sharing policy")}return t}function me(r,e){if(null===e)return this.isReference&&zr("null is not a valid "+this.name),0;e.$$||zr('Cannot pass "'+at(e)+'" as a '+this.name),e.$$.ptr||zr("Cannot pass deleted object as a pointer of type "+this.name),e.$$.ptrType.isConst&&zr("Cannot convert argument of type "+e.$$.ptrType.name+" to parameter type "+this.name);var t=e.$$.ptrType.registeredClass;return he(e.$$.ptr,t,this.registeredClass)}function ge(r){return this.rawGetPointee&&(r=this.rawGetPointee(r)),r}function we(r){this.rawDestructor&&this.rawDestructor(r)}function Te(r){null!==r&&r.delete()}function be(r,e,t){if(e===t)return r;if(void 0===t.baseClass)return null;var n=be(r,e,t.baseClass);return null===n?null:t.downcast(n)}function Ce(){return Object.keys(_e).length}function $e(){var r=[];for(var e in _e)_e.hasOwnProperty(e)&&r.push(_e[e]);return r}function Pe(r){oe=r,ie.length&&oe&&oe(ae)}function Ae(){o.getInheritedInstanceCount=Ce,o.getLiveInheritedInstances=$e,o.flushPendingDeletes=ae,o.setDelayFunction=Pe}var _e={};function Se(r,e){for(void 0===e&&zr("ptr should not be undefined");r.baseClass;)e=r.upcast(e),r=r.baseClass;return e}function We(r,e){return e=Se(r,e),_e[e]}function Ee(r,e){return e.ptrType&&e.ptr||xr("makeClassHandle requires ptr and ptrType"),!!e.smartPtrType!=!!e.smartPtr&&xr("Both smartPtrType and smartPtr must be specified"),e.count={value:1},re(Object.create(r,{$$:{value:e}}))}function Fe(r){var e=this.getPointee(r);if(!e)return this.destructor(r),null;var t=We(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 o(){return this.isSmartPointer?Ee(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:e,smartPtrType:this,smartPtr:r}):Ee(this.registeredClass.instancePrototype,{ptrType:this,ptr:r})}var i,a=this.registeredClass.getActualType(e),u=fe[a];if(!u)return o.call(this);i=this.isConst?u.constPointerType:u.pointerType;var s=be(e,this.registeredClass,i.registeredClass);return null===s?o.call(this):this.isSmartPointer?Ee(i.registeredClass.instancePrototype,{ptrType:i,ptr:s,smartPtrType:this,smartPtr:r}):Ee(i.registeredClass.instancePrototype,{ptrType:i,ptr:s})}function ke(){Oe.prototype.getPointee=ge,Oe.prototype.destructor=we,Oe.prototype.argPackAdvance=8,Oe.prototype.readValueFromPointer=_r,Oe.prototype.deleteObject=Te,Oe.prototype.fromWireType=Fe}function Oe(r,e,t,n,o,i,a,u,s,c,f){this.name=r,this.registeredClass=e,this.isReference=t,this.isConst=n,this.isSmartPointer=o,this.pointeeType=i,this.sharingPolicy=a,this.rawGetPointee=u,this.rawConstructor=s,this.rawShare=c,this.rawDestructor=f,o||void 0!==e.baseClass?this.toWireType=ye:n?(this.toWireType=ve,this.destructorFunction=null):(this.toWireType=me,this.destructorFunction=null)}function je(r,e,t){o.hasOwnProperty(r)||xr("Replacing nonexistant public symbol"),void 0!==o[r].overloadTable&&void 0!==t?o[r].overloadTable[t]=e:(o[r]=e,o[r].argCount=t)}function Re(r,e,t){var n=o["dynCall_"+r];return t&&t.length?n.apply(null,[e].concat(t)):n.call(null,e)}function Ie(r,e,t){return-1!=r.indexOf("j")?Re(r,e,t):K.get(e).apply(null,t)}function xe(r,e){var t=[];return function(){t.length=arguments.length;for(var n=0;n<arguments.length;n++)t[n]=arguments[n];return Ie(r,e,t)}}function De(r,e){var t=-1!=(r=Hr(r)).indexOf("j")?xe(r,e):K.get(e);return"function"!=typeof t&&zr("unknown function pointer with signature "+r+": "+e),t}var Ue=void 0;function Be(r){var e=Kt(r),t=Hr(e);return Jt(e),t}function Me(r,e){var t=[],n={};throw e.forEach((function r(e){n[e]||Wr[e]||(Er[e]?Er[e].forEach(r):(t.push(e),n[e]=!0))})),new Ue(r+": "+t.map(Be).join([", "]))}function Ve(r,e,t,n,o,i,a,u,s,c,f,l,p){f=Hr(f),i=De(o,i),u&&(u=De(a,u)),c&&(c=De(s,c)),p=De(l,p);var d=Or(f);pe(d,(function(){Me("Cannot construct "+f+" due to unbound types",[n])})),Dr([r,e,t],n?[n]:[],(function(e){var t,o;e=e[0],o=n?(t=e.registeredClass).instancePrototype:ce.prototype;var a=jr(d,(function(){if(Object.getPrototypeOf(this)!==s)throw new qr("Use 'new' to construct "+f);if(void 0===l.constructor_body)throw new qr(f+" has no accessible constructor");var r=l.constructor_body[arguments.length];if(void 0===r)throw new qr("Tried to invoke ctor of "+f+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(l.constructor_body).toString()+") parameters instead!");return r.apply(this,arguments)})),s=Object.create(o,{constructor:{value:a}});a.prototype=s;var l=new de(f,a,s,p,t,i,u,c),h=new Oe(f,l,!0,!1,!1),v=new Oe(f+"*",l,!1,!1,!1),y=new Oe(f+" const*",l,!1,!0,!1);return fe[r]={pointerType:v,constPointerType:y},je(d,a),[h,v,y]}))}function He(r,e){for(var t=[],n=0;n<r;n++)t.push(D[(e>>2)+n]);return t}function qe(r,e,t,n,o,i){A(e>0);var a=He(e,t);o=De(n,o);var u=[i],s=[];Dr([],[r],(function(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 qr("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]=function(){Me("Cannot construct "+r.name+" due to unbound types",a)},Dr([],a,(function(n){return r.registeredClass.constructor_body[e-1]=function(){arguments.length!==e-1&&zr(t+" called with "+arguments.length+" arguments, expected "+(e-1)),s.length=0,u.length=e;for(var r=1;r<e;++r)u[r]=n[r].toWireType(s,arguments[r-1]);var i=o.apply(null,u);return Ar(s),n[0].fromWireType(i)},[]})),[]}))}function ze(r,e){if(!(r instanceof Function))throw new TypeError("new_ called with constructor type "+typeof r+" which is not a function");var t=jr(r.name||"unknownFunctionName",(function(){}));t.prototype=r.prototype;var n=new t,o=r.apply(n,e);return o instanceof Object?o:n}function Ne(r,e,t,n,o){var i=e.length;i<2&&zr("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=null!==e[1]&&null!==t,u=!1,s=1;s<e.length;++s)if(null!==e[s]&&void 0===e[s].destructorFunction){u=!0;break}var c="void"!==e[0].name,f="",l="";for(s=0;s<i-2;++s)f+=(0!==s?", ":"")+"arg"+s,l+=(0!==s?", ":"")+"arg"+s+"Wired";var p="return function "+Or(r)+"("+f+") {\nif (arguments.length !== "+(i-2)+") {\nthrowBindingError('function "+r+" called with ' + arguments.length + ' arguments, expected "+(i-2)+" args!');\n}\n";u&&(p+="var destructors = [];\n");var d=u?"destructors":"null",h=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],v=[zr,n,o,Ar,e[0],e[1]];for(a&&(p+="var thisWired = classParam.toWireType("+d+", this);\n"),s=0;s<i-2;++s)p+="var arg"+s+"Wired = argType"+s+".toWireType("+d+", arg"+s+"); // "+e[s+2].name+"\n",h.push("argType"+s),v.push(e[s+2]);if(a&&(l="thisWired"+(l.length>0?", ":"")+l),p+=(c?"var rv = ":"")+"invoker(fn"+(l.length>0?", ":"")+l+");\n",u)p+="runDestructors(destructors);\n";else for(s=a?1:2;s<e.length;++s){var y=1===s?"thisWired":"arg"+(s-2)+"Wired";null!==e[s].destructorFunction&&(p+=y+"_dtor("+y+"); // "+e[s].name+"\n",h.push(y+"_dtor"),v.push(e[s].destructorFunction))}return c&&(p+="var ret = retType.fromWireType(rv);\nreturn ret;\n"),p+="}\n",h.push(p),ze(Function,h).apply(null,v)}function Ge(r,e,t,n,o,i,a,u){var s=He(t,n);e=Hr(e),i=De(o,i),Dr([],[r],(function(r){var n=(r=r[0]).name+"."+e;function o(){Me("Cannot call "+n+" due to unbound types",s)}u&&r.registeredClass.pureVirtualFunctions.push(e);var c=r.registeredClass.instancePrototype,f=c[e];return void 0===f||void 0===f.overloadTable&&f.className!==r.name&&f.argCount===t-2?(o.argCount=t-2,o.className=r.name,c[e]=o):(le(c,e,n),c[e].overloadTable[t-2]=o),Dr([],s,(function(o){var u=Ne(n,o,r,i,a);return void 0===c[e].overloadTable?(u.argCount=t-2,c[e]=u):c[e].overloadTable[t-2]=u,[]})),[]}))}function Le(r,e,t){r=Hr(r),Dr([],[e],(function(e){return e=e[0],o[r]=e.fromWireType(t),[]}))}var Xe=[],Je=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Ke(r){r>4&&0==--Je[r].refcount&&(Je[r]=void 0,Xe.push(r))}function Qe(){for(var r=0,e=5;e<Je.length;++e)void 0!==Je[e]&&++r;return r}function Ye(){for(var r=5;r<Je.length;++r)if(void 0!==Je[r])return Je[r];return null}function Ze(){o.count_emval_handles=Qe,o.get_first_emval=Ye}function rt(r){switch(r){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var e=Xe.length?Xe.pop():Je.length;return Je[e]={refcount:1,value:r},e}}function et(r,e){Nr(r,{name:e=Hr(e),fromWireType:function(r){var e=Je[r].value;return Ke(r),e},toWireType:function(r,e){return rt(e)},argPackAdvance:8,readValueFromPointer:_r,destructorFunction:null})}function tt(r,e,t){switch(e){case 0:return function(r){var e=t?j:R;return this.fromWireType(e[r])};case 1:return function(r){var e=t?I:x;return this.fromWireType(e[r>>1])};case 2:return function(r){var e=t?D:U;return this.fromWireType(e[r>>2])};default:throw new TypeError("Unknown integer type: "+r)}}function nt(r,e,t,n){var o=Br(t);function i(){}e=Hr(e),i.values={},Nr(r,{name:e,constructor:i,fromWireType:function(r){return this.constructor.values[r]},toWireType:function(r,e){return e.value},argPackAdvance:8,readValueFromPointer:tt(e,o,n),destructorFunction:null}),pe(e,i)}function ot(r,e){var t=Wr[r];return void 0===t&&zr(e+" has unknown type "+Be(r)),t}function it(r,e,t){var n=ot(r,"enum");e=Hr(e);var o=n.constructor,i=Object.create(n.constructor.prototype,{value:{value:t},constructor:{value:jr(n.name+"_"+e,(function(){}))}});o.values[t]=i,o[e]=i}function at(r){if(null===r)return"null";var e=typeof r;return"object"===e||"array"===e||"function"===e?r.toString():""+r}function ut(r,e){switch(e){case 2:return function(r){return this.fromWireType(B[r>>2])};case 3:return function(r){return this.fromWireType(M[r>>3])};default:throw new TypeError("Unknown float type: "+r)}}function st(r,e,t){var n=Br(t);Nr(r,{name:e=Hr(e),fromWireType:function(r){return r},toWireType:function(r,e){if("number"!=typeof e&&"boolean"!=typeof e)throw new TypeError('Cannot convert "'+at(e)+'" to '+this.name);return e},argPackAdvance:8,readValueFromPointer:ut(e,n),destructorFunction:null})}function ct(r,e,t,n,o,i){var a=He(e,t);r=Hr(r),o=De(n,o),pe(r,(function(){Me("Cannot call "+r+" due to unbound types",a)}),e-1),Dr([],a,(function(t){var n=[t[0],null].concat(t.slice(1));return je(r,Ne(r,n,null,o,i),e-1),[]}))}function ft(r,e,t){switch(e){case 0:return t?function(r){return j[r]}:function(r){return R[r]};case 1:return t?function(r){return I[r>>1]}:function(r){return x[r>>1]};case 2:return t?function(r){return D[r>>2]}:function(r){return U[r>>2]};default:throw new TypeError("Unknown integer type: "+r)}}function lt(r,e,t,n,o){e=Hr(e),-1===o&&(o=4294967295);var i=Br(t),a=function(r){return r};if(0===n){var u=32-8*t;a=function(r){return r<<u>>>u}}var s=-1!=e.indexOf("unsigned");Nr(r,{name:e,fromWireType:a,toWireType:function(r,t){if("number"!=typeof t&&"boolean"!=typeof t)throw new TypeError('Cannot convert "'+at(t)+'" to '+this.name);if(t<n||t>o)throw new TypeError('Passing a number "'+at(t)+'" from JS side to C/C++ side to an argument of type "'+e+'", which is outside the valid range ['+n+", "+o+"]!");return s?t>>>0:0|t},argPackAdvance:8,readValueFromPointer:ft(e,i,0!==n),destructorFunction:null})}function pt(r,e,t){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][e];function o(r){var e=U,t=e[r>>=2],o=e[r+1];return new n(O,o,t)}Nr(r,{name:t=Hr(t),fromWireType:o,argPackAdvance:8,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})}function dt(r,e){var t="std::string"===(e=Hr(e));Nr(r,{name:e,fromWireType:function(r){var e,n=U[r>>2];if(t)for(var o=r+4,i=0;i<=n;++i){var a=r+4+i;if(i==n||0==R[a]){var u=W(o,a-o);void 0===e?e=u:(e+=String.fromCharCode(0),e+=u),o=a+1}}else{var s=new Array(n);for(i=0;i<n;++i)s[i]=String.fromCharCode(R[r+4+i]);e=s.join("")}return Jt(r),e},toWireType:function(r,e){e instanceof ArrayBuffer&&(e=new Uint8Array(e));var n="string"==typeof e;n||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||zr("Cannot pass non-string to std::string");var o=(t&&n?function(){return k(e)}:function(){return e.length})(),i=Xt(4+o+1);if(U[i>>2]=o,t&&n)F(e,i+4,o+1);else if(n)for(var a=0;a<o;++a){var u=e.charCodeAt(a);u>255&&(Jt(i),zr("String has UTF-16 code units that do not fit in 8 bits")),R[i+4+a]=u}else for(a=0;a<o;++a)R[i+4+a]=e[a];return null!==r&&r.push(Jt,i),i},argPackAdvance:8,readValueFromPointer:_r,destructorFunction:function(r){Jt(r)}})}function ht(r,e,t){var n,o,i,a,u;t=Hr(t),2===e?(n=H,o=q,a=z,i=function(){return x},u=1):4===e&&(n=N,o=G,a=L,i=function(){return U},u=2),Nr(r,{name:t,fromWireType:function(r){for(var t,o=U[r>>2],a=i(),s=r+4,c=0;c<=o;++c){var f=r+4+c*e;if(c==o||0==a[f>>u]){var l=n(s,f-s);void 0===t?t=l:(t+=String.fromCharCode(0),t+=l),s=f+e}}return Jt(r),t},toWireType:function(r,n){"string"!=typeof n&&zr("Cannot pass non-string to C++ string type "+t);var i=a(n),s=Xt(4+i+e);return U[s>>2]=i>>u,o(n,s+4,i+e),null!==r&&r.push(Jt,s),s},argPackAdvance:8,readValueFromPointer:_r,destructorFunction:function(r){Jt(r)}})}function vt(r,e,t,n,o,i){Pr[r]={name:Hr(e),rawConstructor:De(t,n),rawDestructor:De(o,i),fields:[]}}function yt(r,e,t,n,o,i,a,u,s,c){Pr[r].fields.push({fieldName:Hr(e),getterReturnType:t,getter:De(n,o),getterContext:i,setterArgumentType:a,setter:De(u,s),setterContext:c})}function mt(r,e){Nr(r,{isVoid:!0,name:e=Hr(e),argPackAdvance:0,fromWireType:function(){},toWireType:function(r,e){}})}function gt(r){return r||zr("Cannot use deleted val. handle = "+r),Je[r].value}function wt(r,e,t){r=gt(r),e=ot(e,"emval::as");var n=[],o=rt(n);return D[t>>2]=o,e.toWireType(n,r)}var Tt={};function bt(r){var e=Tt[r];return void 0===e?Hr(r):e}var Ct=[];function $t(r,e,t,n){(r=Ct[r])(e=gt(e),t=bt(t),null,n)}function Pt(){return"object"==typeof globalThis?globalThis:Function("return this")()}function At(r){return 0===r?rt(Pt()):(r=bt(r),rt(Pt()[r]))}function _t(r){var e=Ct.length;return Ct.push(r),e}function St(r,e){for(var t=new Array(r),n=0;n<r;++n)t[n]=ot(D[(e>>2)+n],"parameter "+n);return t}function Wt(r,e){for(var t=St(r,e),n=t[0],o=n.name+"_$"+t.slice(1).map((function(r){return r.name})).join("_")+"$",i=["retType"],a=[n],u="",s=0;s<r-1;++s)u+=(0!==s?", ":"")+"arg"+s,i.push("argType"+s),a.push(t[1+s]);var c="return function "+Or("methodCaller_"+o)+"(handle, name, destructors, args) {\n",f=0;for(s=0;s<r-1;++s)c+=" var arg"+s+" = argType"+s+".readValueFromPointer(args"+(f?"+"+f:"")+");\n",f+=t[s+1].argPackAdvance;for(c+=" var rv = handle[name]("+u+");\n",s=0;s<r-1;++s)t[s+1].deleteObject&&(c+=" argType"+s+".deleteObject(arg"+s+");\n");return n.isVoid||(c+=" return retType.toWireType(destructors, rv);\n"),c+="};\n",i.push(c),_t(ze(Function,i).apply(null,a))}function Et(r){return r=bt(r),rt(o[r])}function Ft(r,e){return rt((r=gt(r))[e=gt(e)])}function kt(r){r>4&&(Je[r].refcount+=1)}function Ot(r){for(var e="",t=0;t<r;++t)e+=(0!==t?", ":"")+"arg"+t;var n="return function emval_allocator_"+r+"(constructor, argTypes, args) {\n";for(t=0;t<r;++t)n+="var argType"+t+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+t+'], "parameter '+t+'");\nvar arg'+t+" = argType"+t+".readValueFromPointer(args);\nargs += argType"+t+"['argPackAdvance'];\n";return n+="var obj = new constructor("+e+");\nreturn __emval_register(obj);\n}\n",new Function("requireRegisteredType","Module","__emval_register",n)(ot,o,rt)}var jt={};function Rt(r,e,t,n){r=gt(r);var o=jt[e];return o||(o=Ot(e),jt[e]=o),o(r,t,n)}function It(r){return rt(bt(r))}function xt(r){Ar(Je[r].value),Ke(r)}function Dt(){dr()}function Ut(r,e,t){R.copyWithin(r,e,e+t)}function Bt(r){try{return C.grow(r-O.byteLength+65535>>>16),J(C.buffer),1}catch(r){}}function Mt(r){var e=R.length,t=2147483648;if((r>>>=0)>t)return!1;for(var n=1;n<=4;n*=2){var o=e*(1+.2/n);if(o=Math.min(o,r+100663296),Bt(Math.min(t,X(Math.max(r,o),65536))))return!0}return!1}var Vt={mappings:{},buffers:[null,[],[]],printChar:function(r,e){var t=Vt.buffers[r];0===e||10===e?((1===r?w:T)(S(t,0)),t.length=0):t.push(e)},varargs:void 0,get:function(){return Vt.varargs+=4,D[Vt.varargs-4>>2]},getStr:function(r){return W(r)},get64:function(r,e){return r}};function Ht(r){return 0}function qt(r,e,t,n,o){}function zt(r,e,t,n){for(var o=0,i=0;i<t;i++){for(var a=D[e+8*i>>2],u=D[e+(8*i+4)>>2],s=0;s<u;s++)Vt.printChar(r,R[a+s]);o+=u}return D[n>>2]=o,0}function Nt(r){$(0|r)}Ir=o.InternalError=Rr(Error,"InternalError"),Mr(),qr=o.BindingError=Rr(Error,"BindingError"),se(),ke(),Ae(),Ue=o.UnboundTypeError=Rr(Error,"UnboundTypeError"),Ze();var Gt,Lt={t:Ur,I:Gr,x:Ve,w:qe,d:Ge,k:Le,H:et,n:nt,a:it,A:st,i:ct,j:lt,h:pt,B:dt,v:ht,u:vt,c:yt,J:mt,m:wt,s:$t,b:Ke,y:At,p:Wt,r:Et,e:Ft,g:kt,q:Rt,f:It,l:xt,o:Dt,E:Ut,F:Mt,G:Ht,C:qt,z:zt,D:Nt},Xt=(Cr(),o.___wasm_call_ctors=function(){return(o.___wasm_call_ctors=o.asm.L).apply(null,arguments)},o._malloc=function(){return(Xt=o._malloc=o.asm.M).apply(null,arguments)}),Jt=o._free=function(){return(Jt=o._free=o.asm.N).apply(null,arguments)},Kt=o.___getTypeName=function(){return(Kt=o.___getTypeName=o.asm.P).apply(null,arguments)};function Qt(r){this.name="ExitStatus",this.message="Program terminated with exit("+r+")",this.status=r}function Yt(r){function e(){Gt||(Gt=!0,o.calledRun=!0,P||(tr(),nr(),t(o),o.onRuntimeInitialized&&o.onRuntimeInitialized(),or()))}r=r||u,sr>0||(er(),sr>0||(o.setStatus?(o.setStatus("Running..."),setTimeout((function(){setTimeout((function(){o.setStatus("")}),1),e()}),1)):e()))}if(o.___embind_register_native_and_builtin_types=function(){return(o.___embind_register_native_and_builtin_types=o.asm.Q).apply(null,arguments)},o.dynCall_jiji=function(){return(o.dynCall_jiji=o.asm.R).apply(null,arguments)},fr=function r(){Gt||Yt(),Gt||(fr=r)},o.run=Yt,o.preInit)for("function"==typeof o.preInit&&(o.preInit=[o.preInit]);o.preInit.length>0;)o.preInit.pop()();return Yt(),e.ready}}();"object"==typeof exports&&"object"==typeof module?module.exports=BASIS:"function"==typeof define&&define.amd?define([],(function(){return BASIS})):"object"==typeof exports&&(exports.BASIS=BASIS);