UNPKG

@picovoice/cheetah-web

Version:

Cheetah Speech-to-Text engine for web browsers (via WebAssembly)

1 lines 921 kB
function A(A,I,g,C,B,Q,E){try{var i=A[Q](E),w=i.value}catch(A){return void g(A)}i.done?I(w):Promise.resolve(w).then(C,B)}function I(I){return function(){var g=this,C=arguments;return new Promise((function(B,Q){var E=I.apply(g,C);function i(I){A(E,B,Q,i,w,"next",I)}function w(I){A(E,B,Q,i,w,"throw",I)}i(void 0)}))}}function g(A,I){if(!(A instanceof I))throw new TypeError("Cannot call a class as a function")}function C(A){return C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(A){return typeof A}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},C(A)}function B(A){var I=function(A,I){if("object"!==C(A)||null===A)return A;var g=A[Symbol.toPrimitive];if(void 0!==g){var B=g.call(A,I||"default");if("object"!==C(B))return B;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===I?String:Number)(A)}(A,"string");return"symbol"===C(I)?I:String(I)}function Q(A,I){for(var g=0;g<I.length;g++){var C=I[g];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(A,B(C.key),C)}}function E(A,I,g){return I&&Q(A.prototype,I),g&&Q(A,g),Object.defineProperty(A,"prototype",{writable:!1}),A}function i(A,I,g){return(I=B(I))in A?Object.defineProperty(A,I,{value:g,enumerable:!0,configurable:!0,writable:!0}):A[I]=g,A}function w(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var F={exports:{}},D={exports:{}};!function(A){function I(g){return A.exports=I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(A){return typeof A}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},A.exports.__esModule=!0,A.exports.default=A.exports,I(g)}A.exports=I,A.exports.__esModule=!0,A.exports.default=A.exports}(D);var R=D.exports;!function(A){var I=R.default;function g(){A.exports=g=function(){return B},A.exports.__esModule=!0,A.exports.default=A.exports;var C,B={},Q=Object.prototype,E=Q.hasOwnProperty,i=Object.defineProperty||function(A,I,g){A[I]=g.value},w="function"==typeof Symbol?Symbol:{},F=w.iterator||"@@iterator",D=w.asyncIterator||"@@asyncIterator",R=w.toStringTag||"@@toStringTag";function G(A,I,g){return Object.defineProperty(A,I,{value:g,enumerable:!0,configurable:!0,writable:!0}),A[I]}try{G({},"")}catch(C){G=function(A,I,g){return A[I]=g}}function o(A,I,g,C){var B=I&&I.prototype instanceof H?I:H,Q=Object.create(B.prototype),E=new L(C||[]);return i(Q,"_invoke",{value:n(A,g,E)}),Q}function c(A,I,g){try{return{type:"normal",arg:A.call(I,g)}}catch(A){return{type:"throw",arg:A}}}B.wrap=o;var y="suspendedStart",s="suspendedYield",U="executing",h="completed",N={};function H(){}function M(){}function d(){}var Z={};G(Z,F,(function(){return this}));var Y=Object.getPrototypeOf,S=Y&&Y(Y(k([])));S&&S!==Q&&E.call(S,F)&&(Z=S);var l=d.prototype=H.prototype=Object.create(Z);function a(A){["next","throw","return"].forEach((function(I){G(A,I,(function(A){return this._invoke(I,A)}))}))}function b(A,g){function C(B,Q,i,w){var F=c(A[B],A,Q);if("throw"!==F.type){var D=F.arg,R=D.value;return R&&"object"==I(R)&&E.call(R,"__await")?g.resolve(R.__await).then((function(A){C("next",A,i,w)}),(function(A){C("throw",A,i,w)})):g.resolve(R).then((function(A){D.value=A,i(D)}),(function(A){return C("throw",A,i,w)}))}w(F.arg)}var B;i(this,"_invoke",{value:function(A,I){function Q(){return new g((function(g,B){C(A,I,g,B)}))}return B=B?B.then(Q,Q):Q()}})}function n(A,I,g){var B=y;return function(Q,E){if(B===U)throw new Error("Generator is already running");if(B===h){if("throw"===Q)throw E;return{value:C,done:!0}}for(g.method=Q,g.arg=E;;){var i=g.delegate;if(i){var w=f(i,g);if(w){if(w===N)continue;return w}}if("next"===g.method)g.sent=g._sent=g.arg;else if("throw"===g.method){if(B===y)throw B=h,g.arg;g.dispatchException(g.arg)}else"return"===g.method&&g.abrupt("return",g.arg);B=U;var F=c(A,I,g);if("normal"===F.type){if(B=g.done?h:s,F.arg===N)continue;return{value:F.arg,done:g.done}}"throw"===F.type&&(B=h,g.method="throw",g.arg=F.arg)}}}function f(A,I){var g=I.method,B=A.iterator[g];if(B===C)return I.delegate=null,"throw"===g&&A.iterator.return&&(I.method="return",I.arg=C,f(A,I),"throw"===I.method)||"return"!==g&&(I.method="throw",I.arg=new TypeError("The iterator does not provide a '"+g+"' method")),N;var Q=c(B,A.iterator,I.arg);if("throw"===Q.type)return I.method="throw",I.arg=Q.arg,I.delegate=null,N;var E=Q.arg;return E?E.done?(I[A.resultName]=E.value,I.next=A.nextLoc,"return"!==I.method&&(I.method="next",I.arg=C),I.delegate=null,N):E:(I.method="throw",I.arg=new TypeError("iterator result is not an object"),I.delegate=null,N)}function J(A){var I={tryLoc:A[0]};1 in A&&(I.catchLoc=A[1]),2 in A&&(I.finallyLoc=A[2],I.afterLoc=A[3]),this.tryEntries.push(I)}function K(A){var I=A.completion||{};I.type="normal",delete I.arg,A.completion=I}function L(A){this.tryEntries=[{tryLoc:"root"}],A.forEach(J,this),this.reset(!0)}function k(A){if(A||""===A){var g=A[F];if(g)return g.call(A);if("function"==typeof A.next)return A;if(!isNaN(A.length)){var B=-1,Q=function I(){for(;++B<A.length;)if(E.call(A,B))return I.value=A[B],I.done=!1,I;return I.value=C,I.done=!0,I};return Q.next=Q}}throw new TypeError(I(A)+" is not iterable")}return M.prototype=d,i(l,"constructor",{value:d,configurable:!0}),i(d,"constructor",{value:M,configurable:!0}),M.displayName=G(d,R,"GeneratorFunction"),B.isGeneratorFunction=function(A){var I="function"==typeof A&&A.constructor;return!!I&&(I===M||"GeneratorFunction"===(I.displayName||I.name))},B.mark=function(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,d):(A.__proto__=d,G(A,R,"GeneratorFunction")),A.prototype=Object.create(l),A},B.awrap=function(A){return{__await:A}},a(b.prototype),G(b.prototype,D,(function(){return this})),B.AsyncIterator=b,B.async=function(A,I,g,C,Q){void 0===Q&&(Q=Promise);var E=new b(o(A,I,g,C),Q);return B.isGeneratorFunction(I)?E:E.next().then((function(A){return A.done?A.value:E.next()}))},a(l),G(l,R,"Generator"),G(l,F,(function(){return this})),G(l,"toString",(function(){return"[object Generator]"})),B.keys=function(A){var I=Object(A),g=[];for(var C in I)g.push(C);return g.reverse(),function A(){for(;g.length;){var C=g.pop();if(C in I)return A.value=C,A.done=!1,A}return A.done=!0,A}},B.values=k,L.prototype={constructor:L,reset:function(A){if(this.prev=0,this.next=0,this.sent=this._sent=C,this.done=!1,this.delegate=null,this.method="next",this.arg=C,this.tryEntries.forEach(K),!A)for(var I in this)"t"===I.charAt(0)&&E.call(this,I)&&!isNaN(+I.slice(1))&&(this[I]=C)},stop:function(){this.done=!0;var A=this.tryEntries[0].completion;if("throw"===A.type)throw A.arg;return this.rval},dispatchException:function(A){if(this.done)throw A;var I=this;function g(g,B){return i.type="throw",i.arg=A,I.next=g,B&&(I.method="next",I.arg=C),!!B}for(var B=this.tryEntries.length-1;B>=0;--B){var Q=this.tryEntries[B],i=Q.completion;if("root"===Q.tryLoc)return g("end");if(Q.tryLoc<=this.prev){var w=E.call(Q,"catchLoc"),F=E.call(Q,"finallyLoc");if(w&&F){if(this.prev<Q.catchLoc)return g(Q.catchLoc,!0);if(this.prev<Q.finallyLoc)return g(Q.finallyLoc)}else if(w){if(this.prev<Q.catchLoc)return g(Q.catchLoc,!0)}else{if(!F)throw new Error("try statement without catch or finally");if(this.prev<Q.finallyLoc)return g(Q.finallyLoc)}}}},abrupt:function(A,I){for(var g=this.tryEntries.length-1;g>=0;--g){var C=this.tryEntries[g];if(C.tryLoc<=this.prev&&E.call(C,"finallyLoc")&&this.prev<C.finallyLoc){var B=C;break}}B&&("break"===A||"continue"===A)&&B.tryLoc<=I&&I<=B.finallyLoc&&(B=null);var Q=B?B.completion:{};return Q.type=A,Q.arg=I,B?(this.method="next",this.next=B.finallyLoc,N):this.complete(Q)},complete:function(A,I){if("throw"===A.type)throw A.arg;return"break"===A.type||"continue"===A.type?this.next=A.arg:"return"===A.type?(this.rval=this.arg=A.arg,this.method="return",this.next="end"):"normal"===A.type&&I&&(this.next=I),N},finish:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var g=this.tryEntries[I];if(g.finallyLoc===A)return this.complete(g.completion,g.afterLoc),K(g),N}},catch:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var g=this.tryEntries[I];if(g.tryLoc===A){var C=g.completion;if("throw"===C.type){var B=C.arg;K(g)}return B}}throw new Error("illegal catch attempt")},delegateYield:function(A,I,g){return this.delegate={iterator:k(A),resultName:I,nextLoc:g},"next"===this.method&&(this.arg=C),N}},B}A.exports=g,A.exports.__esModule=!0,A.exports.default=A.exports}(F);var G=(0,F.exports)(),o=G;try{regeneratorRuntime=G}catch(A){"object"==typeof globalThis?globalThis.regeneratorRuntime=G:Function("r","regeneratorRuntime = r")(G)}var c=w(o);const y=new Error("request for lock canceled");var s=function(A,I,g,C){return new(g||(g=Promise))((function(B,Q){function E(A){try{w(C.next(A))}catch(A){Q(A)}}function i(A){try{w(C.throw(A))}catch(A){Q(A)}}function w(A){var I;A.done?B(A.value):(I=A.value,I instanceof g?I:new g((function(A){A(I)}))).then(E,i)}w((C=C.apply(A,I||[])).next())}))};class U{constructor(A,I=y){this._value=A,this._cancelError=I,this._weightedQueues=[],this._weightedWaiters=[]}acquire(A=1){if(A<=0)throw new Error(`invalid weight ${A}: must be positive`);return new Promise(((I,g)=>{this._weightedQueues[A-1]||(this._weightedQueues[A-1]=[]),this._weightedQueues[A-1].push({resolve:I,reject:g}),this._dispatch()}))}runExclusive(A,I=1){return s(this,void 0,void 0,(function*(){const[g,C]=yield this.acquire(I);try{return yield A(g)}finally{C()}}))}waitForUnlock(A=1){if(A<=0)throw new Error(`invalid weight ${A}: must be positive`);return new Promise((I=>{this._weightedWaiters[A-1]||(this._weightedWaiters[A-1]=[]),this._weightedWaiters[A-1].push(I),this._dispatch()}))}isLocked(){return this._value<=0}getValue(){return this._value}setValue(A){this._value=A,this._dispatch()}release(A=1){if(A<=0)throw new Error(`invalid weight ${A}: must be positive`);this._value+=A,this._dispatch()}cancel(){this._weightedQueues.forEach((A=>A.forEach((A=>A.reject(this._cancelError))))),this._weightedQueues=[]}_dispatch(){var A;for(let I=this._value;I>0;I--){const g=null===(A=this._weightedQueues[I-1])||void 0===A?void 0:A.shift();if(!g)continue;const C=this._value,B=I;this._value-=I,I=this._value+1,g.resolve([C,this._newReleaser(B)])}this._drainUnlockWaiters()}_newReleaser(A){let I=!1;return()=>{I||(I=!0,this.release(A))}}_drainUnlockWaiters(){for(let A=this._value;A>0;A--)this._weightedWaiters[A-1]&&(this._weightedWaiters[A-1].forEach((A=>A())),this._weightedWaiters[A-1]=[])}}var h=function(A,I,g,C){return new(g||(g=Promise))((function(B,Q){function E(A){try{w(C.next(A))}catch(A){Q(A)}}function i(A){try{w(C.throw(A))}catch(A){Q(A)}}function w(A){var I;A.done?B(A.value):(I=A.value,I instanceof g?I:new g((function(A){A(I)}))).then(E,i)}w((C=C.apply(A,I||[])).next())}))};class N{constructor(A){this._semaphore=new U(1,A)}acquire(){return h(this,void 0,void 0,(function*(){const[,A]=yield this._semaphore.acquire();return A}))}runExclusive(A){return this._semaphore.runExclusive((()=>A()))}isLocked(){return this._semaphore.isLocked()}waitForUnlock(){return this._semaphore.waitForUnlock()}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}function H(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var M={exports:{}},d={exports:{}};!function(A){function I(g){return A.exports=I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(A){return typeof A}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},A.exports.__esModule=!0,A.exports.default=A.exports,I(g)}A.exports=I,A.exports.__esModule=!0,A.exports.default=A.exports}(d);var Z=d.exports;!function(A){var I=Z.default;function g(){A.exports=g=function(){return B},A.exports.__esModule=!0,A.exports.default=A.exports;var C,B={},Q=Object.prototype,E=Q.hasOwnProperty,i=Object.defineProperty||function(A,I,g){A[I]=g.value},w="function"==typeof Symbol?Symbol:{},F=w.iterator||"@@iterator",D=w.asyncIterator||"@@asyncIterator",R=w.toStringTag||"@@toStringTag";function G(A,I,g){return Object.defineProperty(A,I,{value:g,enumerable:!0,configurable:!0,writable:!0}),A[I]}try{G({},"")}catch(C){G=function(A,I,g){return A[I]=g}}function o(A,I,g,C){var B=I&&I.prototype instanceof H?I:H,Q=Object.create(B.prototype),E=new L(C||[]);return i(Q,"_invoke",{value:n(A,g,E)}),Q}function c(A,I,g){try{return{type:"normal",arg:A.call(I,g)}}catch(A){return{type:"throw",arg:A}}}B.wrap=o;var y="suspendedStart",s="suspendedYield",U="executing",h="completed",N={};function H(){}function M(){}function d(){}var Z={};G(Z,F,(function(){return this}));var Y=Object.getPrototypeOf,S=Y&&Y(Y(k([])));S&&S!==Q&&E.call(S,F)&&(Z=S);var l=d.prototype=H.prototype=Object.create(Z);function a(A){["next","throw","return"].forEach((function(I){G(A,I,(function(A){return this._invoke(I,A)}))}))}function b(A,g){function C(B,Q,i,w){var F=c(A[B],A,Q);if("throw"!==F.type){var D=F.arg,R=D.value;return R&&"object"==I(R)&&E.call(R,"__await")?g.resolve(R.__await).then((function(A){C("next",A,i,w)}),(function(A){C("throw",A,i,w)})):g.resolve(R).then((function(A){D.value=A,i(D)}),(function(A){return C("throw",A,i,w)}))}w(F.arg)}var B;i(this,"_invoke",{value:function(A,I){function Q(){return new g((function(g,B){C(A,I,g,B)}))}return B=B?B.then(Q,Q):Q()}})}function n(A,I,g){var B=y;return function(Q,E){if(B===U)throw new Error("Generator is already running");if(B===h){if("throw"===Q)throw E;return{value:C,done:!0}}for(g.method=Q,g.arg=E;;){var i=g.delegate;if(i){var w=f(i,g);if(w){if(w===N)continue;return w}}if("next"===g.method)g.sent=g._sent=g.arg;else if("throw"===g.method){if(B===y)throw B=h,g.arg;g.dispatchException(g.arg)}else"return"===g.method&&g.abrupt("return",g.arg);B=U;var F=c(A,I,g);if("normal"===F.type){if(B=g.done?h:s,F.arg===N)continue;return{value:F.arg,done:g.done}}"throw"===F.type&&(B=h,g.method="throw",g.arg=F.arg)}}}function f(A,I){var g=I.method,B=A.iterator[g];if(B===C)return I.delegate=null,"throw"===g&&A.iterator.return&&(I.method="return",I.arg=C,f(A,I),"throw"===I.method)||"return"!==g&&(I.method="throw",I.arg=new TypeError("The iterator does not provide a '"+g+"' method")),N;var Q=c(B,A.iterator,I.arg);if("throw"===Q.type)return I.method="throw",I.arg=Q.arg,I.delegate=null,N;var E=Q.arg;return E?E.done?(I[A.resultName]=E.value,I.next=A.nextLoc,"return"!==I.method&&(I.method="next",I.arg=C),I.delegate=null,N):E:(I.method="throw",I.arg=new TypeError("iterator result is not an object"),I.delegate=null,N)}function J(A){var I={tryLoc:A[0]};1 in A&&(I.catchLoc=A[1]),2 in A&&(I.finallyLoc=A[2],I.afterLoc=A[3]),this.tryEntries.push(I)}function K(A){var I=A.completion||{};I.type="normal",delete I.arg,A.completion=I}function L(A){this.tryEntries=[{tryLoc:"root"}],A.forEach(J,this),this.reset(!0)}function k(A){if(A||""===A){var g=A[F];if(g)return g.call(A);if("function"==typeof A.next)return A;if(!isNaN(A.length)){var B=-1,Q=function I(){for(;++B<A.length;)if(E.call(A,B))return I.value=A[B],I.done=!1,I;return I.value=C,I.done=!0,I};return Q.next=Q}}throw new TypeError(I(A)+" is not iterable")}return M.prototype=d,i(l,"constructor",{value:d,configurable:!0}),i(d,"constructor",{value:M,configurable:!0}),M.displayName=G(d,R,"GeneratorFunction"),B.isGeneratorFunction=function(A){var I="function"==typeof A&&A.constructor;return!!I&&(I===M||"GeneratorFunction"===(I.displayName||I.name))},B.mark=function(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,d):(A.__proto__=d,G(A,R,"GeneratorFunction")),A.prototype=Object.create(l),A},B.awrap=function(A){return{__await:A}},a(b.prototype),G(b.prototype,D,(function(){return this})),B.AsyncIterator=b,B.async=function(A,I,g,C,Q){void 0===Q&&(Q=Promise);var E=new b(o(A,I,g,C),Q);return B.isGeneratorFunction(I)?E:E.next().then((function(A){return A.done?A.value:E.next()}))},a(l),G(l,R,"Generator"),G(l,F,(function(){return this})),G(l,"toString",(function(){return"[object Generator]"})),B.keys=function(A){var I=Object(A),g=[];for(var C in I)g.push(C);return g.reverse(),function A(){for(;g.length;){var C=g.pop();if(C in I)return A.value=C,A.done=!1,A}return A.done=!0,A}},B.values=k,L.prototype={constructor:L,reset:function(A){if(this.prev=0,this.next=0,this.sent=this._sent=C,this.done=!1,this.delegate=null,this.method="next",this.arg=C,this.tryEntries.forEach(K),!A)for(var I in this)"t"===I.charAt(0)&&E.call(this,I)&&!isNaN(+I.slice(1))&&(this[I]=C)},stop:function(){this.done=!0;var A=this.tryEntries[0].completion;if("throw"===A.type)throw A.arg;return this.rval},dispatchException:function(A){if(this.done)throw A;var I=this;function g(g,B){return i.type="throw",i.arg=A,I.next=g,B&&(I.method="next",I.arg=C),!!B}for(var B=this.tryEntries.length-1;B>=0;--B){var Q=this.tryEntries[B],i=Q.completion;if("root"===Q.tryLoc)return g("end");if(Q.tryLoc<=this.prev){var w=E.call(Q,"catchLoc"),F=E.call(Q,"finallyLoc");if(w&&F){if(this.prev<Q.catchLoc)return g(Q.catchLoc,!0);if(this.prev<Q.finallyLoc)return g(Q.finallyLoc)}else if(w){if(this.prev<Q.catchLoc)return g(Q.catchLoc,!0)}else{if(!F)throw new Error("try statement without catch or finally");if(this.prev<Q.finallyLoc)return g(Q.finallyLoc)}}}},abrupt:function(A,I){for(var g=this.tryEntries.length-1;g>=0;--g){var C=this.tryEntries[g];if(C.tryLoc<=this.prev&&E.call(C,"finallyLoc")&&this.prev<C.finallyLoc){var B=C;break}}B&&("break"===A||"continue"===A)&&B.tryLoc<=I&&I<=B.finallyLoc&&(B=null);var Q=B?B.completion:{};return Q.type=A,Q.arg=I,B?(this.method="next",this.next=B.finallyLoc,N):this.complete(Q)},complete:function(A,I){if("throw"===A.type)throw A.arg;return"break"===A.type||"continue"===A.type?this.next=A.arg:"return"===A.type?(this.rval=this.arg=A.arg,this.method="return",this.next="end"):"normal"===A.type&&I&&(this.next=I),N},finish:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var g=this.tryEntries[I];if(g.finallyLoc===A)return this.complete(g.completion,g.afterLoc),K(g),N}},catch:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var g=this.tryEntries[I];if(g.tryLoc===A){var C=g.completion;if("throw"===C.type){var B=C.arg;K(g)}return B}}throw new Error("illegal catch attempt")},delegateYield:function(A,I,g){return this.delegate={iterator:k(A),resultName:I,nextLoc:g},"next"===this.method&&(this.arg=C),N}},B}A.exports=g,A.exports.__esModule=!0,A.exports.default=A.exports}(M);var Y=(0,M.exports)(),S=Y;try{regeneratorRuntime=Y}catch(A){"object"==typeof globalThis?globalThis.regeneratorRuntime=Y:Function("r","regeneratorRuntime = r")(Y)}var l=H(S);function a(A,I,g,C){return new(g||(g=Promise))((function(B,Q){function E(A){try{w(C.next(A))}catch(A){Q(A)}}function i(A){try{w(C.throw(A))}catch(A){Q(A)}}function w(A){var I;A.done?B(A.value):(I=A.value,I instanceof g?I:new g((function(A){A(I)}))).then(E,i)}w((C=C.apply(A,I||[])).next())}))}const b=new WeakMap;function n(A,I){return new Proxy(A,{get:(A,g)=>I(A[g])})}class f{constructor(){this.value=void 0,this.exports=null}getState(){return this.exports.asyncify_get_state()}assertNoneState(){let A=this.getState();if(0!==A)throw new Error(`Invalid async state ${A}, expected 0.`)}wrapImportFn(A){return(...I)=>{if(2===this.getState())return this.exports.asyncify_stop_rewind(),this.value;this.assertNoneState();let g=A(...I);if(!(C=g)||"object"!=typeof C&&"function"!=typeof C||"function"!=typeof C.then)return g;var C;this.exports.asyncify_start_unwind(16),this.value=g}}wrapModuleImports(A){return n(A,(A=>"function"==typeof A?this.wrapImportFn(A):A))}wrapImports(A){if(void 0!==A)return n(A,((A=Object.create(null))=>this.wrapModuleImports(A)))}wrapExportFn(A){let I=b.get(A);return void 0!==I||(I=async(...I)=>{this.assertNoneState();let g=A(...I);for(;1===this.getState();)this.exports.asyncify_stop_unwind(),this.value=await this.value,this.assertNoneState(),this.exports.asyncify_start_rewind(16),g=A();return this.assertNoneState(),g},b.set(A,I)),I}wrapExports(A){let I=Object.create(null);for(let g in A){let C=A[g];"function"!=typeof C||g.startsWith("asyncify_")||(C=this.wrapExportFn(C)),Object.defineProperty(I,g,{enumerable:!0,value:C})}return b.set(A,I),I}init(A,I){const{exports:g}=A,C=g.memory||I.env&&I.env.memory;new Int32Array(C.buffer,16).set([24,1024]),this.exports=this.wrapExports(g),Object.setPrototypeOf(A,J.prototype)}}class J extends WebAssembly.Instance{constructor(A,I){let g=new f;super(A,g.wrapImports(I)),g.init(this,I)}get exports(){return b.get(super.exports)}}async function K(A,I){let g=new f,C=await WebAssembly.instantiate(A,g.wrapImports(I));return g.init(C instanceof WebAssembly.Instance?C:C.instance,I),C}async function L(A,I){let g=new f,C=await WebAssembly.instantiateStreaming(A,g.wrapImports(I));return g.init(C.instance,I),C}function k(A,I){return k=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(A,I){return A.__proto__=I,A},k(A,I)}function t(A,I){if("function"!=typeof I&&null!==I)throw new TypeError("Super expression must either be null or a function");A.prototype=Object.create(I&&I.prototype,{constructor:{value:A,writable:!0,configurable:!0}}),Object.defineProperty(A,"prototype",{writable:!1}),I&&k(A,I)}function X(A){return X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(A){return typeof A}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},X(A)}function V(A,I){if(I&&("object"===X(I)||"function"==typeof I))return I;if(void 0!==I)throw new TypeError("Derived constructors may only return object or undefined");return function(A){if(void 0===A)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return A}(A)}function e(A){return e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(A){return A.__proto__||Object.getPrototypeOf(A)},e(A)}function u(A,I){if(!(A instanceof I))throw new TypeError("Cannot call a class as a function")}function v(A){var I=function(A,I){if("object"!==X(A)||null===A)return A;var g=A[Symbol.toPrimitive];if(void 0!==g){var C=g.call(A,I||"default");if("object"!==X(C))return C;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===I?String:Number)(A)}(A,"string");return"symbol"===X(I)?I:String(I)}function r(A,I){for(var g=0;g<I.length;g++){var C=I[g];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(A,v(C.key),C)}}function m(A,I,g){return I&&r(A.prototype,I),g&&r(A,g),Object.defineProperty(A,"prototype",{writable:!1}),A}Object.defineProperty(J.prototype,"exports",{enumerable:!0});var P=function(){function A(){u(this,A),this._path=""}return m(A,[{key:"meta",get:function(){if(void 0!==this._meta)return Object.assign({version:0},this._meta)}},{key:"pageSize",get:function(){}}],[{key:"getPtr",value:function(I){if(A._filePtrs.has(I))return A._filePtrs.get(I);throw new Error("File instance not found.")}},{key:"setPtr",value:function(I,g){A._filePtrs.set(I,g)}},{key:"removePtr",value:function(I){A._filePtrs.delete(I)}}]),A}();function W(A){var I=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(A){return!1}}();return function(){var g,C=e(A);if(I){var B=e(this).constructor;g=Reflect.construct(C,arguments,B)}else g=C.apply(this,arguments);return V(this,g)}}P._filePtrs=new Map;var j="pv_file";var z=function(){function A(){u(this,A),this._pos=0,this._data=new Uint8Array}return m(A,[{key:"get",value:function(A){if(!(this._pos>=this._data.length)){var I=this._data.slice(this._pos,this._pos+A);return this._pos+=A,I}}},{key:"set",value:function(A,I){this._pos=A,this._data=I}},{key:"clear",value:function(){this._pos=0,this._data=new Uint8Array}}]),A}(),x=function(A){t(g,P);var I=W(g);function g(A,C,B,Q){var E;return u(this,g),(E=I.call(this))._pageSize=524288,E._pagePtr=0,E._pageOffset=0,E._path=A,E._meta=C,E._db=B,E._mode=Q,E._cache=new z,E}return m(g,[{key:"pageSize",get:function(){return this._pageSize}},{key:"close",value:function(){return a(this,void 0,void 0,l.mark((function A(){return l.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:this._db.close();case 1:case"end":return A.stop()}}),A,this)})))}},{key:"read",value:function(A,I){return a(this,void 0,void 0,l.mark((function C(){var B=this;return l.wrap((function(C){for(;;)switch(C.prev=C.next){case 0:return C.abrupt("return",new Promise((function(C,Q){if(B.exists()){if(B._isEOF){var E=new Error("EOF");return E.name="EndOfFile",void Q(E)}var i=0,w=Math.min(A*I,B._meta.size),F=w-w%A,D=new Uint8Array(F),R=B._cache.get(F);if(R){if(i+=R.length,B._pageOffset+=R.length,B._pageOffset===B._pageSize&&(B._pagePtr+=1,B._pageOffset=0),F===i)return void C(R);D.set(R)}var G=IDBKeyRange.bound("".concat(B._path,"-").concat(g.createPage(B._pagePtr)),"".concat(B._path,"-").concat(g.createPage(B._pagePtr+Math.floor(F/B._pageSize)+1))),o=B._store,c=o.openCursor(G);c.onsuccess=function(){var A,I,g=c.result;if(g&&!B._isEOF){var C=Math.min(F-i,g.value.length-B._pageOffset);D.set(g.value.slice(B._pageOffset,B._pageOffset+C),i),i+=C,B._pageOffset+=C,B._pageOffset===B._pageSize&&(B._pagePtr+=1,B._pageOffset=0),i<F?g.continue():(0!==B._pageOffset?B._cache.set(B._pageOffset,g.value):B._cache.clear(),(null===(A=o.transaction)||void 0===A?void 0:A.commit)&&(null===(I=o.transaction)||void 0===I||I.commit()))}},o.transaction.onerror=function(){Q(o.transaction.error)},o.transaction.oncomplete=function(){C(D.slice(0,i))}}else Q(new Error("'".concat(B._path,"' doesn't exist.")))})));case 1:case"end":return C.stop()}}),C)})))}},{key:"write",value:function(A){var I=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return a(this,void 0,void 0,l.mark((function C(){var B=this;return l.wrap((function(C){for(;;)switch(C.prev=C.next){case 0:return C.abrupt("return",new Promise((function(C,Q){return a(B,void 0,void 0,l.mark((function B(){var E,i,w,F,D,R,G,o,c,y,s,U=this;return l.wrap((function(B){for(;;)switch(B.prev=B.next){case 0:if("readonly"!==this._mode){B.next=3;break}return Q(new Error("Instance is readonly mode only.")),B.abrupt("return");case 3:if(!("number"!=typeof I&&I<=0)){B.next=6;break}return Q(new Error("Version should be a positive number")),B.abrupt("return");case 6:return w=this._store,F=function(){return new Promise((function(A){var I=w.get("".concat(U._path,"-").concat(g.createPage(U._pagePtr)));I.onsuccess=function(){void 0!==I.result?A(I.result.slice(0,U._pageOffset)):A(new Uint8Array(0))}}))},B.next=10,F();case 10:for(D=B.sent,(R=new Uint8Array(D.length+A.length)).set(D),R.set(A,D.length),G=this._pagePtr*this._pageSize+R.length,o={size:G,numPages:Math.ceil(G/this._pageSize),version:I,pageSize:this._pageSize},w.put(o,this._path),c=Math.ceil(R.length/this._pageSize),y=0;y<c;y++)w.put(R.slice(y*this._pageSize,(y+1)*this._pageSize),"".concat(this._path,"-").concat(g.createPage(this._pagePtr+y)));this.exists()&&o.numPages<this._meta.numPages&&(s=IDBKeyRange.bound("".concat(this._path,"-").concat(g.createPage(o.numPages)),"".concat(this._path,"-").concat(g.createPage(this._meta.numPages)),!0),w.delete(s)),(null===(E=w.transaction)||void 0===E?void 0:E.commit)&&(null===(i=w.transaction)||void 0===i||i.commit()),w.transaction.onerror=function(){Q(w.transaction.error)},w.transaction.oncomplete=function(){U._meta=o,U.seek(0,2),C()};case 23:case"end":return B.stop()}}),B,this)})))})));case 1:case"end":return C.stop()}}),C)})))}},{key:"seek",value:function(A,I){if(!this.exists()&&"readonly"===this._mode)throw new Error("'".concat(this._path,"' doesn't exist."));if(!this.exists())throw new Error("'".concat(this._path,"' doesn't exist."));if(A<0){var g=new Error("EOF");throw g.name="EndOfFile",g}var C;if(0===I)C=Math.min(A,this._meta.size);else if(1===I){var B=this._pageSize*this._pagePtr+this._pageOffset;C=Math.min(B+A,this._meta.size)}else{if(2!==I)throw new Error("Invalid operation: ".concat(I,"."));C=Math.min(this._meta.size+A,this._meta.size)}this._pageOffset=C%this._pageSize,this._pagePtr=Math.floor(C/this._pageSize),this._cache.clear()}},{key:"tell",value:function(){return this.exists()?this._pagePtr*this._pageSize+this._pageOffset:-1}},{key:"remove",value:function(){return a(this,void 0,void 0,l.mark((function A(){var I=this;return l.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.abrupt("return",new Promise((function(A,C){return a(I,void 0,void 0,l.mark((function I(){var B,Q,E,i,w=this;return l.wrap((function(I){for(;;)switch(I.prev=I.next){case 0:if(this.exists()){I.next=3;break}return C(new Error("ENOENT")),I.abrupt("return");case 3:B=this._meta.numPages,Q=IDBKeyRange.bound(this._path,"".concat(this._path,"-").concat(g.createPage(B))),E=this._store,(i=E.delete(Q)).onerror=function(){C(i.error)},i.onsuccess=function(){w._meta=void 0,w._pageOffset=0,w._pagePtr=0,A()};case 9:case"end":return I.stop()}}),I,this)})))})));case 1:case"end":return A.stop()}}),A)})))}},{key:"exists",value:function(){return void 0!==this._meta}},{key:"_isEOF",get:function(){return this._pagePtr>=this._meta.numPages-1&&this._pageOffset>=this._meta.size%this._pageSize}},{key:"_store",get:function(){return this._db.transaction(j,this._mode).objectStore(j)}}],[{key:"open",value:function(A,I){var C=this;if(!self.indexedDB){var B=new Error("IndexedDB is not supported");throw B.name="IndexedDBNotSupported",B}return new Promise((function(B,Q){return a(C,void 0,void 0,l.mark((function C(){var E,i,w;return l.wrap((function(C){for(;;)switch(C.prev=C.next){case 0:return C.prev=0,C.next=3,new Promise((function(A,I){var g=self.indexedDB.open("pv_db",3);g.onerror=function(){I(g.error)},g.onsuccess=function(){A(g.result)},g.onupgradeneeded=function(){g.result.objectStoreNames.contains(j)||g.result.createObjectStore(j)}}));case 3:E=C.sent,(i=E.transaction(j,"readwrite").objectStore(j).get(A)).onerror=function(){Q(i.error)},i.onsuccess=function(){var C=i.result,w=I.includes("r")?"readonly":"readwrite";if(void 0===C&&"readonly"===w){var F=new Error("'".concat(A,"' doesn't exist."));return F.name="FileNotExists",void Q(F)}var D=new g(A,C,E,w);I.includes("a")&&D.seek(0,2),B(D)},C.next=12;break;case 9:C.prev=9,C.t0=C.catch(0),"InvalidStateError"===C.t0.name?((w=new Error("IndexedDB is not supported")).name="IndexedDBNotSupported",Q(w)):Q(C.t0);case 12:case"end":return C.stop()}}),C,null,[[0,9]])})))}))}},{key:"createPage",value:function(A){return("00000"+A).slice(-6)}}]),g}();function T(A){var I=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(A){return!1}}();return function(){var g,C=e(A);if(I){var B=e(this).constructor;g=Reflect.construct(C,arguments,B)}else g=C.apply(this,arguments);return V(this,g)}}var p=function(A){t(g,P);var I=T(g);function g(A,C,B,Q){var E;return u(this,g),(E=I.call(this))._pos=0,E._path=A,E._meta=C,E._mode=Q,E}return m(g,[{key:"close",value:function(){}},{key:"read",value:function(A,I){if(!this.exists())throw new Error("'".concat(this._path,"' doesn't exist."));if(this._isEOF){var g=new Error("EOF");throw g.name="EndOfFile",g}var C=Math.min(A*I,this._file.length-this._pos),B=C-C%A,Q=new Uint8Array(B);return Q.set(this._file.slice(this._pos,this._pos+B),0),this._pos+=B,Q}},{key:"write",value:function(A){var I=new Uint8Array(this._pos+A.length);void 0!==this._file?(I.set(this._file.slice(0,this._pos)),I.set(A,this._pos)):I.set(A),this._file=I,this._pos+=A.length}},{key:"seek",value:function(A,I){if(!this.exists()&&"readonly"===this._mode)throw new Error("'".concat(this._path,"' doesn't exist."));if(!this.exists())throw new Error("'".concat(this._path,"' doesn't exist."));if(A<0){var g=new Error("EOF");throw g.name="EndOfFile",g}var C;if(0===I)C=Math.min(A,this._file.length);else if(1===I)C=Math.min(this._pos+A,this._file.length);else{if(2!==I)throw new Error("Invalid operation: ".concat(I,"."));C=Math.min(this._file.length+A,this._file.length)}this._pos=C}},{key:"tell",value:function(){return this.exists()?this._pos:-1}},{key:"remove",value:function(){return a(this,void 0,void 0,l.mark((function A(){return l.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:if(this.exists()){A.next=2;break}throw new Error("ENOENT");case 2:g._memFiles.delete(this._path),this._pos=0;case 4:case"end":return A.stop()}}),A,this)})))}},{key:"exists",value:function(){return void 0!==this._file}},{key:"_isEOF",get:function(){return this._pos>=this._file.length}},{key:"_file",get:function(){return g._memFiles.get(this._path)},set:function(A){g._memFiles.set(this._path,A)}}],[{key:"open",value:function(A,I){var C=g._memFiles.get(A),B=I.includes("r")?"readonly":"readwrite";if(void 0===C&&"readonly"===B){var Q=new Error("'".concat(A,"' doesn't exist."));throw Q.name="FileNotExists",Q}var E=new g(A,void 0,void 0,B);return I.includes("a")&&E.seek(0,2),E}}]),g}();function O(A,I){var g="undefined"!=typeof Symbol&&A[Symbol.iterator]||A["@@iterator"];if(!g){if(Array.isArray(A)||(g=function(A,I){if(!A)return;if("string"==typeof A)return q(A,I);var g=Object.prototype.toString.call(A).slice(8,-1);"Object"===g&&A.constructor&&(g=A.constructor.name);if("Map"===g||"Set"===g)return Array.from(A);if("Arguments"===g||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(g))return q(A,I)}(A))||I&&A&&"number"==typeof A.length){g&&(A=g);var C=0,B=function(){};return{s:B,n:function(){return C>=A.length?{done:!0}:{done:!1,value:A[C++]}},e:function(A){throw A},f:B}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var Q,E=!0,i=!1;return{s:function(){g=g.call(A)},n:function(){var A=g.next();return E=A.done,A},e:function(A){i=!0,Q=A},f:function(){try{E||null==g.return||g.return()}finally{if(i)throw Q}}}}function q(A,I){(null==I||I>A.length)&&(I=A.length);for(var g=0,C=new Array(I);g<I;g++)C[g]=A[g];return C}function _(A){return A<0?A>>>0:A}function $(A,I){for(var g=I;0!==A[g];)g++;return new TextDecoder("utf-8").decode(A.slice(I,g))}function AA(A){for(var I=atob(A),g=new Uint8Array(I.length),C=0;C<I.length;C++)g[C]=I.charCodeAt(C);return g}function IA(A){var I,g={},C=O(A.split("\r\n"));try{for(C.s();!(I=C.n()).done;){var B=I.value.split(": ");""!==B[0]&&(g[B[0]]=B[1])}}catch(A){C.e(A)}finally{C.f()}return g}function gA(A){var I=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},g=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3;return a(this,void 0,void 0,l.mark((function C(){var B,Q,E,i;return l.wrap((function(C){for(;;)switch(C.prev=C.next){case 0:return B=new AbortController,Q=Object.assign(Object.assign({},I),{signal:B.signal}),E=setTimeout((function(){B.abort()}),g),C.next=5,fetch(A,Q);case 5:return i=C.sent,clearTimeout(E),C.abrupt("return",i);case 8:case"end":return C.stop()}}),C)})))}function CA(A){if("string"!=typeof A)return!1;var I=A.trim();if(""===I)return!1;try{return btoa(atob(I))===I}catch(A){return!1}}function BA(A,I){return a(this,void 0,void 0,l.mark((function g(){var C;return l.wrap((function(g){for(;;)switch(g.prev=g.next){case 0:return g.prev=0,g.next=3,x.open(A,I);case 3:return g.abrupt("return",g.sent);case 6:if(g.prev=6,g.t0=g.catch(0),"IndexedDBNotSupported"===g.t0.name?console.warn("IndexedDB is not supported. Fallback to in-memory storage."):"FileNotExists"!==g.t0.name&&console.warn("Unable to access IndexedDB (".concat(g.t0.toString(),"). Fallback to in-memory storage.")),!("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope)){g.next=16;break}if("FileNotExists"!==g.t0.name){g.next=12;break}throw g.t0;case 12:throw console.error("In-memory storage cannot be used inside a worker."),(C=new Error("Failed to start PvFile: ".concat(g.t0.toString()))).name="PvFileNotSupported",C;case 16:return g.abrupt("return",p.open(A,I));case 17:case"end":return g.stop()}}),g,null,[[0,6]])})))}function QA(A,I,g,C){return a(this,void 0,void 0,l.mark((function B(){var Q;return l.wrap((function(B){for(;;)switch(B.prev=B.next){case 0:return B.next=2,BA(A,"w");case 2:if(Q=B.sent,!(g||void 0===Q.meta||C>Q.meta.version||Q.meta.pageSize!==Q.pageSize)){B.next=6;break}return B.next=6,Q.write(AA(I),C);case 6:case"end":return B.stop()}}),B)})))}p._memFiles=new Map;var EA=5e3,iA=2;function wA(A,I,g,C,B){return a(this,void 0,void 0,l.mark((function Q(){var E,i,w,F,D,R,G,o;return l.wrap((function(Q){for(;;)switch(Q.prev=Q.next){case 0:return Q.next=2,BA(A,"w");case 2:if(E=Q.sent,!(g||void 0===E.meta||C>E.meta.version||E.meta.pageSize!==E.pageSize)){Q.next=43;break}if(!(B<0)){Q.next=6;break}throw Error("numFetchRetries must be a positive number");case 6:i=iA,w=function(A){return new Promise((function(I){setTimeout(I,A)}))},F=B+1,D=null;case 10:if(!(F>0)){Q.next=38;break}return D=null,Q.prev=12,Q.next=15,fetch(I,{cache:"no-cache"});case 15:if(!(R=Q.sent).ok){Q.next=23;break}return Q.next=19,R.arrayBuffer();case 19:return G=Q.sent,Q.next=22,E.write(new Uint8Array(G),C);case 22:return Q.abrupt("return");case 23:return Q.next=25,R.text();case 25:o=Q.sent,D=new Error("Error response returned while fetching model from '".concat(I,"': ").concat(o)),Q.next=32;break;case 29:Q.prev=29,Q.t0=Q.catch(12),D=new Error("Failed to fetch model from '".concat(I,"': ").concat(Q.t0.message));case 32:return F--,Q.next=35,w(i);case 35:i=Math.min(EA,i*iA),Q.next=10;break;case 38:if(null===D){Q.next=42;break}throw D;case 42:throw new Error("Unexpected error encountered while fetching model from '".concat(I,"'"));case 43:case"end":return Q.stop()}}),Q,null,[[12,29]])})))}function FA(A){return a(this,void 0,void 0,l.mark((function I(){var g,C,B,Q,E,i,w,F,D;return l.wrap((function(I){for(;;)switch(I.prev=I.next){case 0:if(null!=A){I.next=2;break}throw new Error("The model is undefined / empty");case 2:if(g=A.base64,C=A.publicPath,B=A.customWritePath,Q=A.forceWrite,E=void 0!==Q&&Q,i=A.version,w=void 0===i?1:i,F=A.numFetchRetries,D=void 0===F?0:F,null!=B){I.next=5;break}throw new Error("The customWritePath of the provided model is undefined / empty");case 5:if(null==g){I.next=10;break}return I.next=8,QA(B,g,E,w);case 8:case 13:I.next=16;break;case 10:if(null==C){I.next=15;break}return I.next=13,wA(B,C,E,w,D);case 15:throw new Error("The provided model doesn't contain a valid publicPath or base64 value");case 16:return I.abrupt("return",B);case 17:case"end":return I.stop()}}),I)})))}var DA={args_get:function(A){return 0},args_sizes_get:function(A){return 0},environ_get:function(A){return 0},environ_sizes_get:function(A){return 0},clock_res_get:function(A){return 0},clock_time_get:function(A){return 0},fd_advise:function(A){return 0},fd_allocate:function(A){return 0},fd_close:function(A){return 0},fd_datasync:function(A){return 0},fd_fdstat_get:function(A){return 0},fd_fdstat_set_flags:function(A){return 0},fd_fdstat_set_rights:function(A){return 0},fd_filestat_get:function(A){return 0},fd_filestat_set_size:function(A){return 0},fd_filestat_set_times:function(A){return 0},fd_pread:function(A){return 0},fd_prestat_get:function(A){return 0},fd_prestat_dir_name:function(A){return 0},fd_pwrite:function(A){return 0},fd_read:function(A){return 0},fd_readdir:function(A){return 0},fd_renumber:function(A){return 0},fd_seek:function(A){return 0},fd_sync:function(A){return 0},fd_tell:function(A){return 0},fd_write:function(A){return 0},path_create_directory:function(A){return 0},path_filestat_get:function(A){return 0},path_filestat_set_times:function(A){return 0},path_link:function(A){return 0},path_open:function(A){return 0},path_readlink:function(A){return 0},path_remove_directory:function(A){return 0},path_rename:function(A){return 0},path_symlink:function(A){return 0},path_unlink_file:function(A){return 0},poll_oneoff:function(A){return 0},proc_exit:function(A){return 0},proc_raise:function(A){return 0},sched_yield:function(A){return 0},random_get:function(A){return 0},sock_recv:function(A){return 0},sock_send:function(A){return 0},sock_shutdown:function(A){return 0}};function RA(A,I,g){var C=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},B=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return a(this,void 0,void 0,l.mark((function Q(){var E,i,w,F,D,R,G,o,c,y,s,U,h,N,H,M,d,Z,Y,S,b,n;return l.wrap((function(Q){for(;;)switch(Q.prev=Q.next){case 0:if(E=function(I,g){new Int32Array(A.buffer)[I/Int32Array.BYTES_PER_ELEMENT]=g},i=function(A,I){return a(this,void 0,void 0,l.mark((function g(){var C;return l.wrap((function(g){for(;;)switch(g.prev=g.next){case 0:return g.next=2,n(A,I);case 2:return C=g.sent,g.abrupt("return",_(C));case 4:case"end":return g.stop()}}),g)})))},w=function(I){I=_(I);var g=new Uint8Array(A.buffer);console.log($(g,I))},F=function(I,g,C){C=_(C);var B=new Uint8Array(A.buffer);if(0===I){var Q=$(B,C);throw new Error("assertion failed at line ".concat(g,' in "').concat(Q,'"'))}},D=function(){return Date.now()/1e3},R=function(I,C,B,Q,w,F,D,R,G){return a(this,void 0,void 0,l.mark((function o(){var c,y,s,U,h,N,H,M,d,Z,Y,S,a;return l.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return I=_(I),C=_(C),B=_(B),Q=_(Q),w=_(w),D=_(D),R=_(R),G=_(G),c=new Uint8Array(A.buffer),y=$(c,I),s=$(c,C),U=$(c,B),h=$(c,Q),N=$(c,w),H=IA(h),M={method:y},N.length>0&&(M.body=N),Object.keys(H).length>0&&(M.headers=H),o.prev=18,o.next=21,gA("https://"+s+U,M,F);case 21:d=o.sent,Y=d.status,o.next=29;break;case 25:return o.prev=25,o.t0=o.catch(18),null==g||g.addError("pvHttpsRequestWasm","Failed to fetch: ".concat(o.t0)),o.abrupt("return");case 29:return o.prev=29,o.next=32,d.text();case 32:Z=o.sent,o.next=39;break;case 35:return o.prev=35,o.t1=o.catch(29),null==g||g.addError("pvHttpsRequestWasm","Failed to get response text: ".concat(o.t1)),o.abrupt("return");case 39:return o.next=41,i(Int8Array.BYTES_PER_ELEMENT,(Z.length+1)*Int8Array.BYTES_PER_ELEMENT);case 41:if(0!==(S=o.sent)){o.next=46;break}return null==g||g.addError("pvMallocError","pvHttpsRequestWasm: cannot allocate memory for response"),E(D,0),o.abrupt("return");case 46:for(E(R,Z.length+1),E(D,S),a=0;a<Z.length;a++)c[S+a]=Z.charCodeAt(a);c[S+Z.length]=0,E(G,Y);case 51:case"end":return o.stop()}}),o,null,[[18,25],[29,35]])})))},G=function(I){return a(this,void 0,void 0,l.mark((function C(){var B,Q,w,F;return l.wrap((function(C){for(;;)switch(C.prev=C.next){case 0:return I=_(I),B=new Uint8Array(A.buffer),Q=void 0!==navigator.userAgent?navigator.userAgent:"unknown",C.next=5,i(Uint8Array.BYTES_PER_ELEMENT,(Q.length+1)*Uint8Array.BYTES_PER_ELEMENT);case 5:if(0!==(w=C.sent)){C.next=10;break}return null==g||g.addError("pvMallocError","pvGetBrowserInfo: cannot allocate memory for browser info"),E(I,0),C.abrupt("return");case 10:for(E(I,w),F=0;F<Q.length;F++)B[w+F]=Q.charCodeAt(F);B[w+Q.length]=0;case 13:case"end":return C.stop()}}),C)})))},o=function(I){var C;return a(this,void 0,void 0,l.mark((function B(){var Q,w,F,D,R;return l.wrap((function(B){for(;;)switch(B.prev=B.next){case 0:return I=_(I),Q=new Uint8Array(A.buffer),w=null!==(C=self.origin)&&void 0!==C?C:self.location.origin,F=new URL(w).hostname,B.next=6,i(Uint8Array.BYTES_PER_ELEMENT,(F.length+1)*Uint8Array.BYTES_PER_ELEMENT);case 6:if(0!==(D=B.sent)){B.next=11;break}return null==g||g.addError("pvMallocError","pvGetOriginInfo: cannot allocate memory for origin info"),E(I,0),B.abrupt("return");case 11:for(E(I,D),R=0;R<F.length;R++)Q[D+R]=F.charCodeAt(R);Q[D+F.length]=0;case 14:case"end":return B.stop()}}),B)})))},c=function(I,C,B,Q){return a(this,void 0,void 0,l.mark((function i(){var w,F,D,R;return l.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return I=_(I),C=_(C),B=_(B),Q=_(Q),w=new Uint8Array(A.buffer),F=$(w,C),D=$(w,B),i.prev=7,i.next=10,BA(F,D);case 10:R=i.sent,P.setPtr(I,R),E(Q,0),i.next=19;break;case 15:i.prev=15,i.t0=i.catch(7),"FileNotExists"!==i.t0.name&&(null==g||g.addError("pvFileOpenWasm",i.t0)),E(Q,-1);case 19:case"end":return i.stop()}}),i,null,[[7,15]])})))},y=function(A,I){return a(this,void 0,void 0,l.mark((function C(){var B;return l.wrap((function(C){for(;;)switch(C.prev=C.next){case 0:return A=_(A),I=_(I),C.prev=2,C.next=5,P.getPtr(A);case 5:return B=C.sent,C.next=8,B.close();case 8:E(I,0),C.next=15;break;case 11:C.prev=11,C.t0=C.catch(2),null==g||g.addError("pvFileCloseWasm",C.t0),E(I,-1);case 15:case"end":return C.stop()}}),C,null,[[2,11]])})))},s=function(I,C,B,Q,i){return a(this,void 0,void 0,l.mark((function w(){var F,D,R;return l.wrap((function(w){for(;;)switch(w.prev=w.next){case 0:return I=_(I),C=_(C),i=_(i),F=new Uint8Array(A.buffer),w.prev=4,D=P.getPtr(I),w.next=8,D.read(B,Q);case 8:R=w.sent,F.set(R,_(C)),E(i,R.length/B),w.next=17;break;case 13:w.prev=13,w.t0=w.catch(4),null==g||g.addError("pvFileReadWasm",w.t0),E(i,-1);case 17:case"end":return w.stop()}}),w,null,[[4,13]])})))},U=function(I,C,B,Q,i){return a(this,void 0,void 0,l.mark((function w(){var F,D,R;return l.wrap((function(w){for(;;)switch(w.prev=w.next){case 0:return I=_(I),C=_(C),i=_(i),F=new Uint8Array(A.buffer),w.prev=4,D=P.getPtr(I),(R=new Uint8Array(B*Q)).set(F.slice(_(C),_(C)+B*Q),0),w.next=10,D.write(R);case 10:E(i,R.length/B),w.next=17;break;case 13:w.prev=13,w.t0=w.catch(4),null==g||g.addError("pvFileWriteWasm",w.t0),E(i,-1);case 17:case"end":return w.stop()}}),w,null,[[4,13]])})))},h=function(A,I,C,B){A=_(A),B=_(B);try{P.getPtr(A).seek(I,C),E(B,0)}catch(A){null==g||g.addError("pvFileSeekWasm",A),E(B,-1)}},N=function(A,I){A=_(A),I=_(I);try{var C=P.getPtr(A);E(I,C.tell())}catch(A){null==g||g.addError("pvFileTellWasm",A),E(I,-1)}},H=function(I,C){return a(this,void 0,void 0,l.mark((function B(){var Q,i,w;return l.wrap((function(B){for(;;)switch(B.prev=B.next){case 0:return I=_(I),C=_(C),Q=new Uint8Array(A.buffer),i=$(Q,I),B.prev=4,B.next=7,BA(i,"w");case 7:return w=B.sent,B.next=10,w.remove();case 10:E(C,0),B.next=17;break;case 13:B.prev=13,B.t0=B.catch(4),null==g||g.addError("pvFileRemoveWasm",B.t0),E(C,-1);case 17:case"end":return B.stop()}}),B,null,[[4,13]])})))},M=function(A){return a(this,void 0,void 0,l.mark((function I(){return l.wrap((function(I){for(;;)switch(I.prev=I.next){case 0:return I.abrupt("return",new Promise((function(I){setTimeout((function(){I(null)}),A)})));case 1:case"end":return I.stop()}}),I)})))},d={wasi_snapshot_preview1:DA,env:Object.assign({memory:A,pv_console_log_wasm:w,pv_assert_wasm:F,pv_time_wasm:D,pv_https_request_wasm:R,pv_get_browser_info:G,pv_get_origin_info:o,pv_file_open_wasm:c,pv_file_close_wasm:y,pv_file_read_wasm:s,pv_file_write_wasm:U,pv_file_seek_wasm:h,pv_file_tell_wasm:N,pv_file_remove_wasm:H,pv_sleep_wasm:M},C),wasi:Object.assign({},B)},!(I instanceof Promise)){Q.next=35;break}if(!L){Q.next=24;break}return Q.next=21,L(I,d);case 21:Z=Q.sent.instance,Q.next=33;break;case 24:return Q.next=26,I;case 26:return Y=Q.sent,Q.next=29,Y.arrayBuffer();case 29:return S=Q.sent,Q.next=32,K(new Uint8Array(S),d);case 32:Z=Q.sent.instance;case 33:Q.next=39;break;case 35:return b=AA(I),Q.next=38,K(b,d);case 38:Z=Q.sent.instance;case 39:return n=Z.exports.aligned_alloc,Q.abrupt("return",Object.assign(Object.assign({},Z.exports),{aligned_alloc:i}));case 41:case"end":return Q.stop()}}),Q)})))}function GA(A,I){(null==I||I>A.length)&&(I=A.length);for(var g=0,C=new Array(I);g<I;g++)C[g]=A[g];return C}function oA(A){return function(A){if(Array.isArray(A))return GA(A)}(A)||function(A){if("undefined"!=typeof Symbol&&null!=A[Symbol.iterator]||null!=A["@@iterator"])return Array.from(A)}(A)||function(A,I){if(A){if("string"==typeof A)return GA(A,I);var g=Object.prototype.toString.call(A).slice(8,-1);return"Object"===g&&A.constructor&&(g=A.constructor.name),"Map"===g||"Set"===g?Array.from(A):"Arguments"===g||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(g)?GA(A,I):void 0}}(A)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var cA=function(){function A(){u(this,A),this._maxNumErrors=10,this._errors=[],this._lastError=new Error("null")}return m(A,[{key:"addError",value:function(A,I){this._lastError=I instanceof Error?I:new Error(I),this._errors.length>=this._maxNumErrors&&this._errors.shift(),I instanceof Error?this._errors.push({key:A,message:I.toString()}):this._errors.push({key:A,message:JSON.stringify(I)})}},{key:"getErrors",value:function(){var A=oA(this._errors);return this._errors=[],A}},{key:"getErrorString",value:function(){return this.getErrors().map((function(A){var I=A.key,g=A.message;return"'".concat(I,"' failed with: ").concat(g,".")})).join("\n")}},{key:"getLastError",value:function(){return this._lastError}},{key:"setMaxErrorNum",value:function(A){this._maxNumErrors=A}}]),A}();const yA=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]));var sA;function UA(A){if(void 0===A)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return A}function hA(A,I){return hA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(A,I){return A.__proto__=I,A},hA(A,I)}function NA(A,I){if("function"!=typeof I&&null!==I)throw new TypeError("Super expression must either be null or a function");A.prototype=Object.create(I&&I.prototype,{constructor:{value:A,writable:!0,configurable:!0}}),Object.defineProperty(A,"prototype",{writable:!1}),I&&hA(A,I)}function HA(A){return HA=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(A){return A.__proto__||Object.getPrototypeOf(A)},HA(A)}function MA(A,I,g){return MA=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(A){return!1}}()?Reflect.construct