@picovoice/leopard-web
Version:
Leopard Speech-to-Text engine for web browsers (via WebAssembly)
1 lines • 747 kB
JavaScript
function A(A,I,g,C,B,Q,E){try{var i=A[Q](E),G=i.value}catch(A){return void g(A)}i.done?I(G):Promise.resolve(G).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,G,"next",I)}function G(I){A(E,B,Q,i,G,"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}var G={},R={get exports(){return G},set exports(A){G=A}},o={};!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}({get exports(){return o},set exports(A){o=A}}),function(A){var I=o.default;function g(){A.exports=g=function(){return C},A.exports.__esModule=!0,A.exports.default=A.exports;var C={},B=Object.prototype,Q=B.hasOwnProperty,E=Object.defineProperty||function(A,I,g){A[I]=g.value},i="function"==typeof Symbol?Symbol:{},G=i.iterator||"@@iterator",R=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function F(A,I,g){return Object.defineProperty(A,I,{value:g,enumerable:!0,configurable:!0,writable:!0}),A[I]}try{F({},"")}catch(A){F=function(A,I,g){return A[I]=g}}function w(A,I,g,C){var B=I&&I.prototype instanceof D?I:D,Q=Object.create(B.prototype),i=new M(C||[]);return E(Q,"_invoke",{value:a(A,g,i)}),Q}function c(A,I,g){try{return{type:"normal",arg:A.call(I,g)}}catch(A){return{type:"throw",arg:A}}}C.wrap=w;var y={};function D(){}function h(){}function s(){}var Z={};F(Z,G,(function(){return this}));var U=Object.getPrototypeOf,l=U&&U(U(H([])));l&&l!==B&&Q.call(l,G)&&(Z=l);var d=s.prototype=D.prototype=Object.create(Z);function N(A){["next","throw","return"].forEach((function(I){F(A,I,(function(A){return this._invoke(I,A)}))}))}function Y(A,g){function C(B,E,i,G){var R=c(A[B],A,E);if("throw"!==R.type){var o=R.arg,F=o.value;return F&&"object"==I(F)&&Q.call(F,"__await")?g.resolve(F.__await).then((function(A){C("next",A,i,G)}),(function(A){C("throw",A,i,G)})):g.resolve(F).then((function(A){o.value=A,i(o)}),(function(A){return C("throw",A,i,G)}))}G(R.arg)}var B;E(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 a(A,I,g){var C="suspendedStart";return function(B,Q){if("executing"===C)throw new Error("Generator is already running");if("completed"===C){if("throw"===B)throw Q;return k()}for(g.method=B,g.arg=Q;;){var E=g.delegate;if(E){var i=b(E,g);if(i){if(i===y)continue;return i}}if("next"===g.method)g.sent=g._sent=g.arg;else if("throw"===g.method){if("suspendedStart"===C)throw C="completed",g.arg;g.dispatchException(g.arg)}else"return"===g.method&&g.abrupt("return",g.arg);C="executing";var G=c(A,I,g);if("normal"===G.type){if(C=g.done?"completed":"suspendedYield",G.arg===y)continue;return{value:G.arg,done:g.done}}"throw"===G.type&&(C="completed",g.method="throw",g.arg=G.arg)}}}function b(A,I){var g=I.method,C=A.iterator[g];if(void 0===C)return I.delegate=null,"throw"===g&&A.iterator.return&&(I.method="return",I.arg=void 0,b(A,I),"throw"===I.method)||"return"!==g&&(I.method="throw",I.arg=new TypeError("The iterator does not provide a '"+g+"' method")),y;var B=c(C,A.iterator,I.arg);if("throw"===B.type)return I.method="throw",I.arg=B.arg,I.delegate=null,y;var Q=B.arg;return Q?Q.done?(I[A.resultName]=Q.value,I.next=A.nextLoc,"return"!==I.method&&(I.method="next",I.arg=void 0),I.delegate=null,y):Q:(I.method="throw",I.arg=new TypeError("iterator result is not an object"),I.delegate=null,y)}function S(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 J(A){var I=A.completion||{};I.type="normal",delete I.arg,A.completion=I}function M(A){this.tryEntries=[{tryLoc:"root"}],A.forEach(S,this),this.reset(!0)}function H(A){if(A){var I=A[G];if(I)return I.call(A);if("function"==typeof A.next)return A;if(!isNaN(A.length)){var g=-1,C=function I(){for(;++g<A.length;)if(Q.call(A,g))return I.value=A[g],I.done=!1,I;return I.value=void 0,I.done=!0,I};return C.next=C}}return{next:k}}function k(){return{value:void 0,done:!0}}return h.prototype=s,E(d,"constructor",{value:s,configurable:!0}),E(s,"constructor",{value:h,configurable:!0}),h.displayName=F(s,o,"GeneratorFunction"),C.isGeneratorFunction=function(A){var I="function"==typeof A&&A.constructor;return!!I&&(I===h||"GeneratorFunction"===(I.displayName||I.name))},C.mark=function(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,s):(A.__proto__=s,F(A,o,"GeneratorFunction")),A.prototype=Object.create(d),A},C.awrap=function(A){return{__await:A}},N(Y.prototype),F(Y.prototype,R,(function(){return this})),C.AsyncIterator=Y,C.async=function(A,I,g,B,Q){void 0===Q&&(Q=Promise);var E=new Y(w(A,I,g,B),Q);return C.isGeneratorFunction(I)?E:E.next().then((function(A){return A.done?A.value:E.next()}))},N(d),F(d,o,"Generator"),F(d,G,(function(){return this})),F(d,"toString",(function(){return"[object Generator]"})),C.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}},C.values=H,M.prototype={constructor:M,reset:function(A){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(J),!A)for(var I in this)"t"===I.charAt(0)&&Q.call(this,I)&&!isNaN(+I.slice(1))&&(this[I]=void 0)},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,C){return E.type="throw",E.arg=A,I.next=g,C&&(I.method="next",I.arg=void 0),!!C}for(var C=this.tryEntries.length-1;C>=0;--C){var B=this.tryEntries[C],E=B.completion;if("root"===B.tryLoc)return g("end");if(B.tryLoc<=this.prev){var i=Q.call(B,"catchLoc"),G=Q.call(B,"finallyLoc");if(i&&G){if(this.prev<B.catchLoc)return g(B.catchLoc,!0);if(this.prev<B.finallyLoc)return g(B.finallyLoc)}else if(i){if(this.prev<B.catchLoc)return g(B.catchLoc,!0)}else{if(!G)throw new Error("try statement without catch or finally");if(this.prev<B.finallyLoc)return g(B.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&&Q.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 E=B?B.completion:{};return E.type=A,E.arg=I,B?(this.method="next",this.next=B.finallyLoc,y):this.complete(E)},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),y},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),J(g),y}},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;J(g)}return B}}throw new Error("illegal catch attempt")},delegateYield:function(A,I,g){return this.delegate={iterator:H(A),resultName:I,nextLoc:g},"next"===this.method&&(this.arg=void 0),y}},C}A.exports=g,A.exports.__esModule=!0,A.exports.default=A.exports}(R);var F=G(),w=F;try{regeneratorRuntime=F}catch(A){"object"==typeof globalThis?globalThis.regeneratorRuntime=F:Function("r","regeneratorRuntime = r")(F)}const c=new Error("request for lock canceled");var y=function(A,I,g,C){return new(g||(g=Promise))((function(B,Q){function E(A){try{G(C.next(A))}catch(A){Q(A)}}function i(A){try{G(C.throw(A))}catch(A){Q(A)}}function G(A){var I;A.done?B(A.value):(I=A.value,I instanceof g?I:new g((function(A){A(I)}))).then(E,i)}G((C=C.apply(A,I||[])).next())}))};class D{constructor(A,I=c){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 y(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{G(C.next(A))}catch(A){Q(A)}}function i(A){try{G(C.throw(A))}catch(A){Q(A)}}function G(A){var I;A.done?B(A.value):(I=A.value,I instanceof g?I:new g((function(A){A(I)}))).then(E,i)}G((C=C.apply(A,I||[])).next())}))};class s{constructor(A){this._semaphore=new D(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()}}const Z=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]));function U(A,I,g,C,B,Q,E){try{var i=A[Q](E),G=i.value}catch(A){return void g(A)}i.done?I(G):Promise.resolve(G).then(C,B)}function l(A){return function(){var I=this,g=arguments;return new Promise((function(C,B){var Q=A.apply(I,g);function E(A){U(Q,C,B,E,i,"next",A)}function i(A){U(Q,C,B,E,i,"throw",A)}E(void 0)}))}}function d(A){var I={exports:{}};return A(I,I.exports),I.exports}var N=d((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})),Y=d((function(A){var I=N.default;function g(){A.exports=g=function(){return C},A.exports.__esModule=!0,A.exports.default=A.exports;var C={},B=Object.prototype,Q=B.hasOwnProperty,E=Object.defineProperty||function(A,I,g){A[I]=g.value},i="function"==typeof Symbol?Symbol:{},G=i.iterator||"@@iterator",R=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function F(A,I,g){return Object.defineProperty(A,I,{value:g,enumerable:!0,configurable:!0,writable:!0}),A[I]}try{F({},"")}catch(A){F=function(A,I,g){return A[I]=g}}function w(A,I,g,C){var B=I&&I.prototype instanceof D?I:D,Q=Object.create(B.prototype),i=new M(C||[]);return E(Q,"_invoke",{value:a(A,g,i)}),Q}function c(A,I,g){try{return{type:"normal",arg:A.call(I,g)}}catch(A){return{type:"throw",arg:A}}}C.wrap=w;var y={};function D(){}function h(){}function s(){}var Z={};F(Z,G,(function(){return this}));var U=Object.getPrototypeOf,l=U&&U(U(H([])));l&&l!==B&&Q.call(l,G)&&(Z=l);var d=s.prototype=D.prototype=Object.create(Z);function N(A){["next","throw","return"].forEach((function(I){F(A,I,(function(A){return this._invoke(I,A)}))}))}function Y(A,g){function C(B,E,i,G){var R=c(A[B],A,E);if("throw"!==R.type){var o=R.arg,F=o.value;return F&&"object"==I(F)&&Q.call(F,"__await")?g.resolve(F.__await).then((function(A){C("next",A,i,G)}),(function(A){C("throw",A,i,G)})):g.resolve(F).then((function(A){o.value=A,i(o)}),(function(A){return C("throw",A,i,G)}))}G(R.arg)}var B;E(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 a(A,I,g){var C="suspendedStart";return function(B,Q){if("executing"===C)throw new Error("Generator is already running");if("completed"===C){if("throw"===B)throw Q;return k()}for(g.method=B,g.arg=Q;;){var E=g.delegate;if(E){var i=b(E,g);if(i){if(i===y)continue;return i}}if("next"===g.method)g.sent=g._sent=g.arg;else if("throw"===g.method){if("suspendedStart"===C)throw C="completed",g.arg;g.dispatchException(g.arg)}else"return"===g.method&&g.abrupt("return",g.arg);C="executing";var G=c(A,I,g);if("normal"===G.type){if(C=g.done?"completed":"suspendedYield",G.arg===y)continue;return{value:G.arg,done:g.done}}"throw"===G.type&&(C="completed",g.method="throw",g.arg=G.arg)}}}function b(A,I){var g=I.method,C=A.iterator[g];if(void 0===C)return I.delegate=null,"throw"===g&&A.iterator.return&&(I.method="return",I.arg=void 0,b(A,I),"throw"===I.method)||"return"!==g&&(I.method="throw",I.arg=new TypeError("The iterator does not provide a '"+g+"' method")),y;var B=c(C,A.iterator,I.arg);if("throw"===B.type)return I.method="throw",I.arg=B.arg,I.delegate=null,y;var Q=B.arg;return Q?Q.done?(I[A.resultName]=Q.value,I.next=A.nextLoc,"return"!==I.method&&(I.method="next",I.arg=void 0),I.delegate=null,y):Q:(I.method="throw",I.arg=new TypeError("iterator result is not an object"),I.delegate=null,y)}function S(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 J(A){var I=A.completion||{};I.type="normal",delete I.arg,A.completion=I}function M(A){this.tryEntries=[{tryLoc:"root"}],A.forEach(S,this),this.reset(!0)}function H(A){if(A){var I=A[G];if(I)return I.call(A);if("function"==typeof A.next)return A;if(!isNaN(A.length)){var g=-1,C=function I(){for(;++g<A.length;)if(Q.call(A,g))return I.value=A[g],I.done=!1,I;return I.value=void 0,I.done=!0,I};return C.next=C}}return{next:k}}function k(){return{value:void 0,done:!0}}return h.prototype=s,E(d,"constructor",{value:s,configurable:!0}),E(s,"constructor",{value:h,configurable:!0}),h.displayName=F(s,o,"GeneratorFunction"),C.isGeneratorFunction=function(A){var I="function"==typeof A&&A.constructor;return!!I&&(I===h||"GeneratorFunction"===(I.displayName||I.name))},C.mark=function(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,s):(A.__proto__=s,F(A,o,"GeneratorFunction")),A.prototype=Object.create(d),A},C.awrap=function(A){return{__await:A}},N(Y.prototype),F(Y.prototype,R,(function(){return this})),C.AsyncIterator=Y,C.async=function(A,I,g,B,Q){void 0===Q&&(Q=Promise);var E=new Y(w(A,I,g,B),Q);return C.isGeneratorFunction(I)?E:E.next().then((function(A){return A.done?A.value:E.next()}))},N(d),F(d,o,"Generator"),F(d,G,(function(){return this})),F(d,"toString",(function(){return"[object Generator]"})),C.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}},C.values=H,M.prototype={constructor:M,reset:function(A){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(J),!A)for(var I in this)"t"===I.charAt(0)&&Q.call(this,I)&&!isNaN(+I.slice(1))&&(this[I]=void 0)},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,C){return E.type="throw",E.arg=A,I.next=g,C&&(I.method="next",I.arg=void 0),!!C}for(var C=this.tryEntries.length-1;C>=0;--C){var B=this.tryEntries[C],E=B.completion;if("root"===B.tryLoc)return g("end");if(B.tryLoc<=this.prev){var i=Q.call(B,"catchLoc"),G=Q.call(B,"finallyLoc");if(i&&G){if(this.prev<B.catchLoc)return g(B.catchLoc,!0);if(this.prev<B.finallyLoc)return g(B.finallyLoc)}else if(i){if(this.prev<B.catchLoc)return g(B.catchLoc,!0)}else{if(!G)throw new Error("try statement without catch or finally");if(this.prev<B.finallyLoc)return g(B.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&&Q.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 E=B?B.completion:{};return E.type=A,E.arg=I,B?(this.method="next",this.next=B.finallyLoc,y):this.complete(E)},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),y},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),J(g),y}},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;J(g)}return B}}throw new Error("illegal catch attempt")},delegateYield:function(A,I,g){return this.delegate={iterator:H(A),resultName:I,nextLoc:g},"next"===this.method&&(this.arg=void 0),y}},C}A.exports=g,A.exports.__esModule=!0,A.exports.default=A.exports})),a=Y(),b=a;try{regeneratorRuntime=a}catch(A){"object"==typeof globalThis?globalThis.regeneratorRuntime=a:Function("r","regeneratorRuntime = r")(a)}const S=new WeakMap;function J(A,I){return new Proxy(A,{get:(A,g)=>I(A[g])})}class M{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 J(A,(A=>"function"==typeof A?this.wrapImportFn(A):A))}wrapImports(A){if(void 0!==A)return J(A,((A=Object.create(null))=>this.wrapModuleImports(A)))}wrapExportFn(A){let I=S.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},S.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 S.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,H.prototype)}}class H extends WebAssembly.Instance{constructor(A,I){let g=new M;super(A,g.wrapImports(I)),g.init(this,I)}get exports(){return S.get(super.exports)}}async function k(A,I){let g=new M,C=await WebAssembly.instantiate(A,g.wrapImports(I));return g.init(C instanceof WebAssembly.Instance?C:C.instance,I),C}async function K(A,I){let g=new M,C=await WebAssembly.instantiateStreaming(A,g.wrapImports(I));return g.init(C.instance,I),C}function V(A){return V="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},V(A)}function n(A){var I=function(A,I){if("object"!==V(A)||null===A)return A;var g=A[Symbol.toPrimitive];if(void 0!==g){var C=g.call(A,I||"default");if("object"!==V(C))return C;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===I?String:Number)(A)}(A,"string");return"symbol"===V(I)?I:String(I)}function m(A,I,g){return(I=n(I))in A?Object.defineProperty(A,I,{value:g,enumerable:!0,configurable:!0,writable:!0}):A[I]=g,A}function X(A,I){if(!(A instanceof I))throw new TypeError("Cannot call a class as a function")}function t(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,n(C.key),C)}}function e(A,I,g){return I&&t(A.prototype,I),g&&t(A,g),Object.defineProperty(A,"prototype",{writable:!1}),A}function W(A){if(void 0===A)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return A}function L(A,I){return L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(A,I){return A.__proto__=I,A},L(A,I)}function r(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&&L(A,I)}function u(A,I){if(I&&("object"===V(I)||"function"==typeof I))return I;if(void 0!==I)throw new TypeError("Derived constructors may only return object or undefined");return W(A)}function j(A){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(A){return A.__proto__||Object.getPrototypeOf(A)},j(A)}function p(A,I){var g=Object.keys(A);if(Object.getOwnPropertySymbols){var C=Object.getOwnPropertySymbols(A);I&&(C=C.filter((function(I){return Object.getOwnPropertyDescriptor(A,I).enumerable}))),g.push.apply(g,C)}return g}Object.defineProperty(H.prototype,"exports",{enumerable:!0});var f=function(){function A(){X(this,A),m(this,"_path",void 0),m(this,"_meta",void 0)}return e(A,[{key:"meta",get:function(){if(void 0!==this._meta)return function(A){for(var I=1;I<arguments.length;I++){var g=null!=arguments[I]?arguments[I]:{};I%2?p(Object(g),!0).forEach((function(I){m(A,I,g[I])})):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(g)):p(Object(g)).forEach((function(I){Object.defineProperty(A,I,Object.getOwnPropertyDescriptor(g,I))}))}return A}({version:0},this._meta)}}],[{key:"getPtr",value:function(I){return A._filePtrs.get(I)}},{key:"setPtr",value:function(I,g){A._filePtrs.set(I,g)}},{key:"removePtr",value:function(I){A._filePtrs.delete(I)}}]),A}();function v(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=j(A);if(I){var B=j(this).constructor;g=Reflect.construct(C,arguments,B)}else g=C.apply(this,arguments);return u(this,g)}}m(f,"_filePtrs",new Map);var P="pv_db",z="pv_file",T=3;var x=function(A){r(E,f);var I,g,C,B,Q=v(E);function E(A,I,g,C){var B;return X(this,E),m(W(B=Q.call(this)),"_pageSize",65536),m(W(B),"_db",void 0),m(W(B),"_mode",void 0),m(W(B),"_pagePtr",0),m(W(B),"_pageOffset",0),B._path=A,B._meta=I,B._db=g,B._mode=C,B}return e(E,[{key:"close",value:(B=l(b.mark((function A(){return b.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:this._db.close();case 1:case"end":return A.stop()}}),A,this)}))),function(){return B.apply(this,arguments)})},{key:"read",value:(C=l(b.mark((function A(I,g){var C=this;return b.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.abrupt("return",new Promise((function(A,B){if(C.exists()){if(C._isEOF){var Q=new Error("EOF");return Q.name="EndOfFile",void B(Q)}var i=0,G=Math.min(I*g,C._meta.size),R=G-G%I,o=new Uint8Array(R),F=IDBKeyRange.bound("".concat(C._path,"-").concat(E.createPage(C._pagePtr)),"".concat(C._path,"-").concat(E.createPage(C._meta.numPages))),w=C._store,c=w.openCursor(F);c.onsuccess=function(){var A=c.result;if(A&&!C._isEOF){var I=Math.min(R-i,A.value.length-C._pageOffset);o.set(A.value.slice(C._pageOffset,C._pageOffset+I),i),i+=I,C._pageOffset+=I,C._pageOffset===C._pageSize&&(C._pagePtr+=1,C._pageOffset=0),i<R&&A.continue()}},w.transaction.onerror=function(){B(w.transaction.error)},w.transaction.oncomplete=function(){A(o.slice(0,i))}}else B(new Error("'".concat(C._path,"' doesn't exist.")))})));case 1:case"end":return A.stop()}}),A)}))),function(A,I){return C.apply(this,arguments)})},{key:"write",value:(g=l(b.mark((function A(I){var g,C=this,B=arguments;return b.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return g=B.length>1&&void 0!==B[1]?B[1]:1,A.abrupt("return",new Promise(function(){var A=l(b.mark((function A(B,Q){var i,G,R,o,F,w,c,y,D;return b.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:if("readonly"!==C._mode){A.next=3;break}return Q(new Error("Instance is readonly mode only.")),A.abrupt("return");case 3:if(!("number"!=typeof g&&g<=0)){A.next=6;break}return Q(new Error("Version should be a positive number")),A.abrupt("return");case 6:return i=C._store,G=function(){return new Promise((function(A){var I=i.get("".concat(C._path,"-").concat(E.createPage(C._pagePtr)));I.onsuccess=function(){void 0!==I.result?A(I.result.slice(0,C._pageOffset)):A(new Uint8Array(0))}}))},A.next=10,G();case 10:for(R=A.sent,(o=new Uint8Array(R.length+I.length)).set(R),o.set(I,R.length),F=C._pagePtr*C._pageSize+o.length,w={size:F,numPages:Math.ceil(F/C._pageSize),version:g},i.put(w,C._path),c=Math.ceil(o.length/C._pageSize),y=0;y<c;y++)i.put(o.slice(y*C._pageSize,(y+1)*C._pageSize),"".concat(C._path,"-").concat(E.createPage(C._pagePtr+y)));C.exists()&&w.numPages<C._meta.numPages&&(D=IDBKeyRange.bound("".concat(C._path,"-").concat(E.createPage(w.numPages)),"".concat(C._path,"-").concat(E.createPage(C._meta.numPages)),!0),i.delete(D)),i.transaction.onerror=function(){Q(i.transaction.error)},i.transaction.oncomplete=function(){C._meta=w,C.seek(0,2),B()};case 22:case"end":return A.stop()}}),A)})));return function(I,g){return A.apply(this,arguments)}}()));case 2:case"end":return A.stop()}}),A)}))),function(A){return g.apply(this,arguments)})},{key:"seek",value:function(A,I){if(!this.exists()&&"readonly"===this._mode)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)}},{key:"tell",value:function(){return this.exists()?this._pagePtr*this._pageSize+this._pageOffset:-1}},{key:"remove",value:(I=l(b.mark((function A(){var I=this;return b.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.abrupt("return",new Promise(function(){var A=l(b.mark((function A(g,C){var B,Q,i,G;return b.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:B=I._meta.numPages,Q=IDBKeyRange.bound(I._path,"".concat(I._path,"-").concat(E.createPage(B))),i=I._store,(G=i.delete(Q)).onerror=function(){C(G.error)},G.onsuccess=function(){I._meta=void 0,I._pageOffset=0,I._pagePtr=0,g()};case 6:case"end":return A.stop()}}),A)})));return function(I,g){return A.apply(this,arguments)}}()));case 1:case"end":return A.stop()}}),A)}))),function(){return I.apply(this,arguments)})},{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(z,this._mode).objectStore(z)}}],[{key:"open",value:function(A,I){if(!self.indexedDB){var g=new Error("IndexedDB is not supported");throw g.name="IndexedDBNotSupported",g}return new Promise(function(){var g=l(b.mark((function g(C,B){var Q,i,G;return b.wrap((function(g){for(;;)switch(g.prev=g.next){case 0:return g.prev=0,g.next=3,new Promise((function(A,I){var g=self.indexedDB.open(P,T);g.onerror=function(){I(g.error)},g.onsuccess=function(){A(g.result)},g.onupgradeneeded=function(){g.result.objectStoreNames.contains(z)||g.result.createObjectStore(z)}}));case 3:Q=g.sent,(i=Q.transaction(z,"readwrite").objectStore(z).get(A)).onerror=function(){B(i.error)},i.onsuccess=function(){var g=i.result,G=I.includes("r")?"readonly":"readwrite";if(void 0===g&&"readonly"===G){var R=new Error("'".concat(A,"' doesn't exist."));return R.name="FileNotExists",void B(R)}var o=new E(A,g,Q,G);I.includes("a")&&o.seek(0,2),C(o)},g.next=12;break;case 9:g.prev=9,g.t0=g.catch(0),"InvalidStateError"===g.t0.name?((G=new Error("IndexedDB is not supported")).name="IndexedDBNotSupported",B(G)):B(g.t0);case 12:case"end":return g.stop()}}),g,null,[[0,9]])})));return function(A,I){return g.apply(this,arguments)}}())}},{key:"createPage",value:function(A){return("000"+A).slice(-4)}}]),E}();function q(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=j(A);if(I){var B=j(this).constructor;g=Reflect.construct(C,arguments,B)}else g=C.apply(this,arguments);return u(this,g)}}var O=function(A){r(C,f);var I,g=q(C);function C(A,I,B,Q){var E;return X(this,C),m(W(E=g.call(this)),"_pos",0),m(W(E),"_mode",void 0),E._path=A,E._meta=I,E._mode=Q,E}return e(C,[{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(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:(I=l(b.mark((function A(){return b.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:C._memFiles.delete(this._path),this._file=void 0,this._pos=0;case 3:case"end":return A.stop()}}),A,this)}))),function(){return I.apply(this,arguments)})},{key:"exists",value:function(){return void 0!==this._file}},{key:"_isEOF",get:function(){return this._pos>=this._file.length}},{key:"_file",get:function(){return C._memFiles.get(this._path)},set:function(A){C._memFiles.set(this._path,A)}}],[{key:"open",value:function(A,I){var g=C._memFiles.get(A),B=I.includes("r")?"readonly":"readwrite";if(void 0===g&&"readonly"===B){var Q=new Error("'".concat(A,"' doesn't exist."));throw Q.name="FileNotExists",Q}var E=new C(A,void 0,void 0,B);return I.includes("a")&&E.seek(0,2),E}}]),C}();function _(A,I){var g=Object.keys(A);if(Object.getOwnPropertySymbols){var C=Object.getOwnPropertySymbols(A);I&&(C=C.filter((function(I){return Object.getOwnPropertyDescriptor(A,I).enumerable}))),g.push.apply(g,C)}return g}function $(A){for(var I=1;I<arguments.length;I++){var g=null!=arguments[I]?arguments[I]:{};I%2?_(Object(g),!0).forEach((function(I){m(A,I,g[I])})):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(g)):_(Object(g)).forEach((function(I){Object.defineProperty(A,I,Object.getOwnPropertyDescriptor(g,I))}))}return A}function AA(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 IA(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 IA(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 IA(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 gA(A,I){for(var g=I;0!==A[g];)g++;return new TextDecoder("utf-8").decode(A.subarray(I,g))}function CA(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 BA(A){var I,g={},C=AA(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 QA(A){return EA.apply(this,arguments)}function EA(){return EA=l(b.mark((function A(I){var g,C,B,Q,E,i,G=arguments;return b.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return g=G.length>1&&void 0!==G[1]?G[1]:{},C=G.length>2&&void 0!==G[2]?G[2]:5e3,B=new AbortController,Q=$($({},g),{},{signal:B.signal}),E=setTimeout((function(){B.abort()}),C),A.next=7,fetch(I,Q);case 7:return i=A.sent,clearTimeout(E),A.abrupt("return",i);case 10:case"end":return A.stop()}}),A)}))),EA.apply(this,arguments)}function iA(A,I){return GA.apply(this,arguments)}function GA(){return(GA=l(b.mark((function A(I,g){var C;return b.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.prev=0,A.next=3,x.open(I,g);case 3:return A.abrupt("return",A.sent);case 6:if(A.prev=6,A.t0=A.catch(0),"IndexedDBNotSupported"===A.t0.name?console.warn("IndexedDB is not supported. Fallback to in-memory storage."):"FileNotExists"!==A.t0.name&&console.warn("Unable to access IndexedDB (".concat(A.t0.toString(),"). Fallback to in-memory storage.")),!("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope)){A.next=16;break}if("FileNotExists"!==A.t0.name){A.next=12;break}throw A.t0;case 12:throw console.error("In-memory storage cannot be used inside a worker."),(C=new Error("Failed to start PvFile: ".concat(A.t0.toString()))).name="PvFileNotSupported",C;case 16:return A.abrupt("return",O.open(I,g));case 17:case"end":return A.stop()}}),A,null,[[0,6]])})))).apply(this,arguments)}function RA(A,I,g,C){return oA.apply(this,arguments)}function oA(){return(oA=l(b.mark((function A(I,g,C,B){var Q;return b.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.next=2,iA(I,"w");case 2:if(Q=A.sent,!(C||void 0===Q.meta||B>Q.meta.version)){A.next=6;break}return A.next=6,Q.write(CA(g),B);case 6:case"end":return A.stop()}}),A)})))).apply(this,arguments)}m(O,"_memFiles",new Map);var FA=5e3,wA=2;function cA(A,I,g,C,B){return yA.apply(this,arguments)}function yA(){return(yA=l(b.mark((function A(I,g,C,B,Q){var E,i,G,R,o,F,w,c;return b.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.next=2,iA(I,"w");case 2:if(E=A.sent,!(C||void 0===E.meta||B>E.meta.version)){A.next=43;break}if(!(Q<0)){A.next=6;break}throw Error("numFetchRetries must be a positive number");case 6:i=wA,G=function(A){return new Promise((function(I){setTimeout(I,A)}))},R=Q+1,o=null;case 10:if(!(R>0)){A.next=38;break}return o=null,A.prev=12,A.next=15,fetch(g,{cache:"no-cache"});case 15:if(!(F=A.sent).ok){A.next=23;break}return A.next=19,F.arrayBuffer();case 19:return w=A.sent,A.next=22,E.write(new Uint8Array(w),B);case 22:return A.abrupt("return");case 23:return A.next=25,F.text();case 25:c=A.sent,o=new Error("Error response returned while fetching model from '".concat(g,"': ").concat(c)),A.next=32;break;case 29:A.prev=29,A.t0=A.catch(12),o=new Error("Failed to fetch model from '".concat(g,"': ").concat(A.t0.message));case 32:return R--,A.next=35,G(i);case 35:i=Math.min(FA,i*wA),A.next=10;break;case 38:if(null===o){A.next=42;break}throw o;case 42:throw new Error("Unexpected error encountered while fetching model from '".concat(g,"'"));case 43:case"end":return A.stop()}}),A,null,[[12,29]])})))).apply(this,arguments)}function DA(A){return hA.apply(this,arguments)}function hA(){return(hA=l(b.mark((function A(I){var g,C,B,Q,E,i,G,R,o;return b.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:if(null!=I){A.next=2;break}throw new Error("The model is undefined / empty");case 2:if(g=I.base64,C=I.publicPath,B=I.customWritePath,Q=I.forceWrite,E=void 0!==Q&&Q,i=I.version,G=void 0===i?1:i,R=I.numFetchRetries,o=void 0===R?0:R,null!=B){A.next=5;break}throw new Error("The customWritePath of the provided model is undefined / empty");case 5:if(null==g){A.next=10;break}return A.next=8,RA(B,g,E,G);case 8:case 13:A.next=16;break;case 10:if(null==C){A.next=15;break}return A.next=13,cA(B,C,E,G,o);case 15:throw new Error("The provided model doesn't contain a valid publicPath or base64 value");case 16:return A.abrupt("return",B);case 17:case"end":return A.stop()}}),A)})))).apply(this,arguments)}var sA={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 ZA(A,I,g){return UA.apply(this,arguments)}function UA(){return UA=l(b.mark((function A(I,g,C){var B,Q,E,i,G,R,o,F,w,c,y,D,h,s,Z,U,d,N,Y,a,S;return b.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:if(B=new Uint8Array(I.buffer),Q=new Int32Array(I.buffer),E=function(A){console.log(gA(B,A))},i=function(A,I,g){if(0===A){var C=gA(B,g);throw new Error("assertion failed at line ".concat(I,' in "').concat(C,'"'))}},G=function(){return Date.now()/1e3},R=function(){var A=l(b.mark((function A(I,g,E,i,G,R,o,F,w){var c,y,D,h,s,Z,U,l,d,N,Y;return b.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return c=gA(B,I),y=gA(B,g),D=gA(B,E),h=gA(B,i),s=gA(B,G),Z=BA(h),A.prev=6,A.next=9,QA("https://"+y+D,{method:c,headers:Z,body:s},R);case 9:U=A.sent,d=U.status,A.next=17;break;case 13:return A.prev=13,A.t0=A.catch(6),null==C||C.addError("pvHttpsRequestWasm","Failed to fetch: ".concat(A.t0)),A.abrupt("return");case 17:return A.prev=17,A.next=20,U.text();case 20:l=A.sent,A.next=27;break;case 23:return A.prev=23,A.t1=A.catch(17),null==C||C.addError("pvHttpsRequestWasm","Failed to get response text: ".concat(A.t1)),A.abrupt("return");case 27:return A.next=29,S(Int8Array.BYTES_PER_ELEMENT,(l.length+1)*Int8Array.BYTES_PER_ELEMENT);case 29:if(0!==(N=A.sent)){A.next=34;break}return null==C||C.addError("pvMallocError","pvHttpsRequestWasm: cannot allocate memory for response"),Q[o/Int32Array.BYTES_PER_ELEMENT]=0,A.abrupt("return");case 34:for(Q[F/Int32Array.BYTES_PER_ELEMENT]=l.length+1,Q[o/Int32Array.BYTES_PER_ELEMENT]=N,Y=0;Y<l.length;Y++)B[N+Y]=l.charCodeAt(Y);B[N+l.length]=0,Q[w/Int32Array.BYTES_PER_ELEMENT]=d;case 39:case"end":return A.stop()}}),A,null,[[6,13],[17,23]])})));return function(I,g,C,B,Q,E,i,G,R){return A.apply(this,arguments)}}(),o=function(){var A=l(b.mark((function A(I){var g,E,i;return b.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return g=void 0!==navigator.userAgent?navigator.userAgent:"unknown",A.next=3,S(Uint8Array.BYTES_PER_ELEMENT,(g.length+1)*Uint8Array.BYTES_PER_ELEMENT);case 3:if(0!==(E=A.sent)){A.next=8;break}return null==C||C.addError("pvMallocError","pvGetBrowserInfo: cannot allocate memory for browser info"),Q[I/Int32Array.BYTES_PER_ELEMENT]=0,A.abrupt("return");case 8:for(Q[I/Int32Array.BYTES_PER_ELEMENT]=E,i=0;i<g.length;i++)B[E+i]=g.charCodeAt(i);B[E+g.length]=0;case 11:case"end":return A.stop()}}),A)})));return function(I){return A.apply(this,arguments)}}(),F=function(){var A=l(b.mark((function A(I){var g,E,i,G,R;return b.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return E=null!==(g=self.origin)&&void 0!==g?g:self.location.origin,i=new URL(E).hostname,A.next=4,S(Uint8Array.BYTES_PER_ELEMENT,(i.length+1)*Uint8Array.BYTES_PER_ELEMENT);case 4:if(0!==(G=A.sent)){A.next=9;break}return null==C||C.addError("pvMallocError","pvGetOriginInfo: cannot allocate memory for origin info"),Q[I/Int32Array.BYTES_PER_ELEMENT]=0,A.abrupt("return");case 9:for(Q[I/Int32Array.BYTES_PER_ELEMENT]=G,R=0;R<i.length;R++)B[G+R]=i.charCodeAt(R);B[G+i.length]=0;case 12:case"end":return A.stop()}}),A)})));return function(I){return A.apply(this,arguments)}}(),w=function(){var A=l(b.mark((function A(I,g,E,i){var G,R,o;return b.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return G=gA(B,g),R=gA(B,E),A.prev=2,A.next=5,iA(G,R);case 5:o=A.sent,f.setPtr(I,o),Q[i/Int32Array.BYTES_PER_ELEMENT]=0,A.next=14;break;case 10:A.prev=10,A.t0=A.catch(2),"FileNotExists"!==A.t0.name&&(null==C||C.addError("pvFileOpenWasm",A.t0)),Q[i/Int32Array.BYTES_PER_ELEMENT]=-1;case 14:case"end":return A.stop()}}),A,null,[[2,10]])})));return function(I,g,C,B){return A.apply(this,arguments)}}(),c=function(){var A=l(b.mark((function A(I,g){var B;return b.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.prev=0,A.next=3,f.getPtr(I);case 3:return B=A.sent,A.next=6,B.close();case 6:Q[g/Int32Array.BYTES_PER_ELEMENT]=0,A.next=13;break;case 9:A.prev=9,A.t0=A.catch(0),null==C||C.addError("pvFileCloseWasm",A.t0),Q[g/Int32Array.BYTES_PER_ELEMENT]=-1;case 13:case"end":return A.stop()}}),A,null,[[0,9]])})));return function(I,g){return A.apply(this,arguments)}}(),y=function(){var A=l(b.mark((function A(I,g,E,i,G){var R,o;return b.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.prev=0,A.next=3,f.getPtr(I);case 3:return R=A.sent,A.next=6,R.read(E,i);case 6:o=A.sent,B.set(o,g),Q[G/Int32Array.BYTES_PER_ELEMENT]=o.length/E,A.next=15;break;case 11:A.prev=11,A.t0=A.catch(0),null==C||C.addError("pvFileReadWasm",A.t0),Q[G/Int32Array.BYTES_PER_ELEMENT]=-1;case 15:case"end":return A.stop()}}),A,null,[[0,11]])})));return function(I,g,C,B,Q){return A.apply(this,arguments)}}(),D=function(){var A=l(b.mark((function A(I,g,E,i,G){var R,o;return b.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.prev=0,A.next=3,f.getPtr(I);case 3:return R=A.sent,(o=new Uint8Array(E*i)).set(B.slice(g,g+E*i),0),A.next=8,R.write(o);case 8:Q[G/Int32Array.BYTES_PER_ELEMENT]=o.length/E,A.next=15;break;case 11:A.prev=11,A.t0=A.catch(0),null==C||C.addError("pvFileWriteWasm",A.t0),Q[G/Int32Array.BYTES_PER_ELEMENT]=1;case 15:case"end":return A.stop()}}),A,null,[[0,11]])})));return function(I,g,C,B,Q){return A.apply(this,arguments)}}(),h=function(A,I,g,B){try{f.getPtr(A).seek(I,g),Q[B/Int32Array.BYTES_PER_ELEMENT]=0}catch(A){null==C||C.addError("pvFileSeekWasm",A),Q[B/Int32Array.BYTES_PER_ELEMENT]=-1}},s=function(A,I){try{var g=f.getPtr(A);Q[I/Int32Array.BYTES_PER_ELEMENT]=g.tell()}catch(A){null==C||C.addError("pvFileTellWasm",A),Q[I/Int32Array.BYTES_PER_ELEMENT]=-1}},Z=function(){var A=l(b.mark((function A(I,g){var E,i;return b.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return E=gA(B,I),A.prev=1,A.next=4,iA(E,"w");case 4:return i=A.sent,A.next=7,i.remove();case 7:Q[g/Int32Array.BYTES_PER_ELEMENT]=0,A.next=14;break;case 10:A.prev=10,A.t0=A.catch(1),null==C||C.addError("pvFileRemoveWasm",A.t0),Q[g/Int32Array.BYTES_PER_ELEMENT]=-1;case 14:case"end":return A.stop()}}),A,null,[[1,10]])})));return function(I,g){return A.apply(this,arguments)}}(),U={wasi_snapshot_preview1:sA,env:{memory:I,pv_console_log_wasm:E,pv_assert_wasm:i,pv_time_wasm:G,pv_https_request_wasm:R,pv_get_browser_info:o,pv_get_origin_info:F,pv_file_open_wasm:w,pv_file_close_wasm:c,pv_file_read_wasm:y,pv_file_write_wasm:D,pv_file_seek_wasm:h,pv_file_tell_wasm:s,pv_file_remove_wasm:Z}},!(g instanceof Promise)){A.next=34;break}if(!K){A.next=23;break}return A.next=20,K(g,U);case 20:d=A.sent.instance,A.next=32;break;case 23:return A.next=25,g;case 25:return N=A.sent,A.next=28,N.arrayBuffer();case 28:return Y=A.sent,A.next=31,k(new Uint8Array(Y),U);case 31:d=A.sent.instance;case 32:A.next=38;break;case 34:return a=CA(g),A.next=37,k(a,U);case 37:d=A.sent.instance;case 38:return S=d.exports.aligned_alloc,A.abrupt("return",d.exports);case 40:case"end":return A.stop()}}),A)}))),UA.apply(this,arguments)}function lA(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 dA(A){return function(A){if(Array.isArray(A))return lA(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 lA(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)?lA(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 NA,YA=function(){function A(){X(this,A),m(this,"_maxNumErrors",10),m(this,"_errors",[]),m(this,"_lastError",void 0)}return e(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=dA(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}();function aA(A){if(void 0===A)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return A}function bA(A,I){return bA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(A,I){return A.__proto__=I,A},bA(A,I)}function SA(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&&bA(A,I)}function JA(A){return JA=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(A){return A.__proto__||Object.getPrototypeOf(A)},JA(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.bind():function(A,I,g){var C=[null];C.push.apply(C,I);var B=new(Function.bind.apply(A,C));return g&&bA(B,