@picovoice/orca-web
Version:
Orca Text-to-Speech engine for web browsers (via WebAssembly)
1 lines • 6.12 MB
JavaScript
function A(A,I,g,C,B,Q,E){try{var R=A[Q](E),F=R.value}catch(A){return void g(A)}R.done?I(F):Promise.resolve(F).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 R(I){A(E,B,Q,R,F,"next",I)}function F(I){A(E,B,Q,R,F,"throw",I)}R(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)||!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 R(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 F(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var i={exports:{}},G={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}(G);var U=G.exports;!function(A){var I=U.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,R=Object.defineProperty||function(A,I,g){A[I]=g.value},F="function"==typeof Symbol?Symbol:{},i=F.iterator||"@@iterator",G=F.asyncIterator||"@@asyncIterator",U=F.toStringTag||"@@toStringTag";function c(A,I,g){return Object.defineProperty(A,I,{value:g,enumerable:!0,configurable:!0,writable:!0}),A[I]}try{c({},"")}catch(C){c=function(A,I,g){return A[I]=g}}function w(A,I,g,C){var B=I&&I.prototype instanceof s?I:s,Q=Object.create(B.prototype),E=new H(C||[]);return R(Q,"_invoke",{value:V(A,g,E)}),Q}function y(A,I,g){try{return{type:"normal",arg:A.call(I,g)}}catch(A){return{type:"throw",arg:A}}}B.wrap=w;var Z="suspendedStart",o="suspendedYield",d="executing",l="completed",M={};function s(){}function D(){}function Y(){}var h={};c(h,i,(function(){return this}));var b=Object.getPrototypeOf,N=b&&b(b(n([])));N&&N!==Q&&E.call(N,i)&&(h=N);var a=Y.prototype=s.prototype=Object.create(h);function X(A){["next","throw","return"].forEach((function(I){c(A,I,(function(A){return this._invoke(I,A)}))}))}function S(A,g){function C(B,Q,R,F){var i=y(A[B],A,Q);if("throw"!==i.type){var G=i.arg,U=G.value;return U&&"object"==I(U)&&E.call(U,"__await")?g.resolve(U.__await).then((function(A){C("next",A,R,F)}),(function(A){C("throw",A,R,F)})):g.resolve(U).then((function(A){G.value=A,R(G)}),(function(A){return C("throw",A,R,F)}))}F(i.arg)}var B;R(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 V(A,I,g){var B=Z;return function(Q,E){if(B===d)throw new Error("Generator is already running");if(B===l){if("throw"===Q)throw E;return{value:C,done:!0}}for(g.method=Q,g.arg=E;;){var R=g.delegate;if(R){var F=J(R,g);if(F){if(F===M)continue;return F}}if("next"===g.method)g.sent=g._sent=g.arg;else if("throw"===g.method){if(B===Z)throw B=l,g.arg;g.dispatchException(g.arg)}else"return"===g.method&&g.abrupt("return",g.arg);B=d;var i=y(A,I,g);if("normal"===i.type){if(B=g.done?l:o,i.arg===M)continue;return{value:i.arg,done:g.done}}"throw"===i.type&&(B=l,g.method="throw",g.arg=i.arg)}}}function J(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,J(A,I),"throw"===I.method)||"return"!==g&&(I.method="throw",I.arg=new TypeError("The iterator does not provide a '"+g+"' method")),M;var Q=y(B,A.iterator,I.arg);if("throw"===Q.type)return I.method="throw",I.arg=Q.arg,I.delegate=null,M;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,M):E:(I.method="throw",I.arg=new TypeError("iterator result is not an object"),I.delegate=null,M)}function k(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 m(A){var I=A.completion||{};I.type="normal",delete I.arg,A.completion=I}function H(A){this.tryEntries=[{tryLoc:"root"}],A.forEach(k,this),this.reset(!0)}function n(A){if(A||""===A){var g=A[i];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 D.prototype=Y,R(a,"constructor",{value:Y,configurable:!0}),R(Y,"constructor",{value:D,configurable:!0}),D.displayName=c(Y,U,"GeneratorFunction"),B.isGeneratorFunction=function(A){var I="function"==typeof A&&A.constructor;return!!I&&(I===D||"GeneratorFunction"===(I.displayName||I.name))},B.mark=function(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,Y):(A.__proto__=Y,c(A,U,"GeneratorFunction")),A.prototype=Object.create(a),A},B.awrap=function(A){return{__await:A}},X(S.prototype),c(S.prototype,G,(function(){return this})),B.AsyncIterator=S,B.async=function(A,I,g,C,Q){void 0===Q&&(Q=Promise);var E=new S(w(A,I,g,C),Q);return B.isGeneratorFunction(I)?E:E.next().then((function(A){return A.done?A.value:E.next()}))},X(a),c(a,U,"Generator"),c(a,i,(function(){return this})),c(a,"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=n,H.prototype={constructor:H,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(m),!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 R.type="throw",R.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],R=Q.completion;if("root"===Q.tryLoc)return g("end");if(Q.tryLoc<=this.prev){var F=E.call(Q,"catchLoc"),i=E.call(Q,"finallyLoc");if(F&&i){if(this.prev<Q.catchLoc)return g(Q.catchLoc,!0);if(this.prev<Q.finallyLoc)return g(Q.finallyLoc)}else if(F){if(this.prev<Q.catchLoc)return g(Q.catchLoc,!0)}else{if(!i)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,M):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),M},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),m(g),M}},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;m(g)}return B}}throw new Error("illegal catch attempt")},delegateYield:function(A,I,g){return this.delegate={iterator:n(A),resultName:I,nextLoc:g},"next"===this.method&&(this.arg=C),M}},B}A.exports=g,A.exports.__esModule=!0,A.exports.default=A.exports}(i);var c=(0,i.exports)(),w=c;try{regeneratorRuntime=c}catch(A){"object"==typeof globalThis?globalThis.regeneratorRuntime=c:Function("r","regeneratorRuntime = r")(c)}var y=F(w);const Z=new Error("request for lock canceled");var o=function(A,I,g,C){return new(g||(g=Promise))((function(B,Q){function E(A){try{F(C.next(A))}catch(A){Q(A)}}function R(A){try{F(C.throw(A))}catch(A){Q(A)}}function F(A){var I;A.done?B(A.value):(I=A.value,I instanceof g?I:new g((function(A){A(I)}))).then(E,R)}F((C=C.apply(A,I||[])).next())}))};class d{constructor(A,I=Z){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 o(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 l=function(A,I,g,C){return new(g||(g=Promise))((function(B,Q){function E(A){try{F(C.next(A))}catch(A){Q(A)}}function R(A){try{F(C.throw(A))}catch(A){Q(A)}}function F(A){var I;A.done?B(A.value):(I=A.value,I instanceof g?I:new g((function(A){A(I)}))).then(E,R)}F((C=C.apply(A,I||[])).next())}))};class M{constructor(A){this._semaphore=new d(1,A)}acquire(){return l(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 s=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 D(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var Y={exports:{}},h={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}(h);var b=h.exports;!function(A){var I=b.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,R=Object.defineProperty||function(A,I,g){A[I]=g.value},F="function"==typeof Symbol?Symbol:{},i=F.iterator||"@@iterator",G=F.asyncIterator||"@@asyncIterator",U=F.toStringTag||"@@toStringTag";function c(A,I,g){return Object.defineProperty(A,I,{value:g,enumerable:!0,configurable:!0,writable:!0}),A[I]}try{c({},"")}catch(C){c=function(A,I,g){return A[I]=g}}function w(A,I,g,C){var B=I&&I.prototype instanceof s?I:s,Q=Object.create(B.prototype),E=new H(C||[]);return R(Q,"_invoke",{value:V(A,g,E)}),Q}function y(A,I,g){try{return{type:"normal",arg:A.call(I,g)}}catch(A){return{type:"throw",arg:A}}}B.wrap=w;var Z="suspendedStart",o="suspendedYield",d="executing",l="completed",M={};function s(){}function D(){}function Y(){}var h={};c(h,i,(function(){return this}));var b=Object.getPrototypeOf,N=b&&b(b(n([])));N&&N!==Q&&E.call(N,i)&&(h=N);var a=Y.prototype=s.prototype=Object.create(h);function X(A){["next","throw","return"].forEach((function(I){c(A,I,(function(A){return this._invoke(I,A)}))}))}function S(A,g){function C(B,Q,R,F){var i=y(A[B],A,Q);if("throw"!==i.type){var G=i.arg,U=G.value;return U&&"object"==I(U)&&E.call(U,"__await")?g.resolve(U.__await).then((function(A){C("next",A,R,F)}),(function(A){C("throw",A,R,F)})):g.resolve(U).then((function(A){G.value=A,R(G)}),(function(A){return C("throw",A,R,F)}))}F(i.arg)}var B;R(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 V(A,I,g){var B=Z;return function(Q,E){if(B===d)throw new Error("Generator is already running");if(B===l){if("throw"===Q)throw E;return{value:C,done:!0}}for(g.method=Q,g.arg=E;;){var R=g.delegate;if(R){var F=J(R,g);if(F){if(F===M)continue;return F}}if("next"===g.method)g.sent=g._sent=g.arg;else if("throw"===g.method){if(B===Z)throw B=l,g.arg;g.dispatchException(g.arg)}else"return"===g.method&&g.abrupt("return",g.arg);B=d;var i=y(A,I,g);if("normal"===i.type){if(B=g.done?l:o,i.arg===M)continue;return{value:i.arg,done:g.done}}"throw"===i.type&&(B=l,g.method="throw",g.arg=i.arg)}}}function J(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,J(A,I),"throw"===I.method)||"return"!==g&&(I.method="throw",I.arg=new TypeError("The iterator does not provide a '"+g+"' method")),M;var Q=y(B,A.iterator,I.arg);if("throw"===Q.type)return I.method="throw",I.arg=Q.arg,I.delegate=null,M;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,M):E:(I.method="throw",I.arg=new TypeError("iterator result is not an object"),I.delegate=null,M)}function k(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 m(A){var I=A.completion||{};I.type="normal",delete I.arg,A.completion=I}function H(A){this.tryEntries=[{tryLoc:"root"}],A.forEach(k,this),this.reset(!0)}function n(A){if(A||""===A){var g=A[i];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 D.prototype=Y,R(a,"constructor",{value:Y,configurable:!0}),R(Y,"constructor",{value:D,configurable:!0}),D.displayName=c(Y,U,"GeneratorFunction"),B.isGeneratorFunction=function(A){var I="function"==typeof A&&A.constructor;return!!I&&(I===D||"GeneratorFunction"===(I.displayName||I.name))},B.mark=function(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,Y):(A.__proto__=Y,c(A,U,"GeneratorFunction")),A.prototype=Object.create(a),A},B.awrap=function(A){return{__await:A}},X(S.prototype),c(S.prototype,G,(function(){return this})),B.AsyncIterator=S,B.async=function(A,I,g,C,Q){void 0===Q&&(Q=Promise);var E=new S(w(A,I,g,C),Q);return B.isGeneratorFunction(I)?E:E.next().then((function(A){return A.done?A.value:E.next()}))},X(a),c(a,U,"Generator"),c(a,i,(function(){return this})),c(a,"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=n,H.prototype={constructor:H,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(m),!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 R.type="throw",R.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],R=Q.completion;if("root"===Q.tryLoc)return g("end");if(Q.tryLoc<=this.prev){var F=E.call(Q,"catchLoc"),i=E.call(Q,"finallyLoc");if(F&&i){if(this.prev<Q.catchLoc)return g(Q.catchLoc,!0);if(this.prev<Q.finallyLoc)return g(Q.finallyLoc)}else if(F){if(this.prev<Q.catchLoc)return g(Q.catchLoc,!0)}else{if(!i)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,M):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),M},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),m(g),M}},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;m(g)}return B}}throw new Error("illegal catch attempt")},delegateYield:function(A,I,g){return this.delegate={iterator:n(A),resultName:I,nextLoc:g},"next"===this.method&&(this.arg=C),M}},B}A.exports=g,A.exports.__esModule=!0,A.exports.default=A.exports}(Y);var N=(0,Y.exports)(),a=N;try{regeneratorRuntime=N}catch(A){"object"==typeof globalThis?globalThis.regeneratorRuntime=N:Function("r","regeneratorRuntime = r")(N)}var X=D(a);function S(A,I,g,C){return new(g||(g=Promise))((function(B,Q){function E(A){try{F(C.next(A))}catch(A){Q(A)}}function R(A){try{F(C.throw(A))}catch(A){Q(A)}}function F(A){var I;A.done?B(A.value):(I=A.value,I instanceof g?I:new g((function(A){A(I)}))).then(E,R)}F((C=C.apply(A,I||[])).next())}))}function V(A,I){return V=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(A,I){return A.__proto__=I,A},V(A,I)}function J(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&&V(A,I)}function k(A){return k="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},k(A)}function m(A,I){if(I&&("object"===k(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 H(A){return H=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(A){return A.__proto__||Object.getPrototypeOf(A)},H(A)}function n(A,I){if(!(A instanceof I))throw new TypeError("Cannot call a class as a function")}function W(A){var I=function(A,I){if("object"!==k(A)||null===A)return A;var g=A[Symbol.toPrimitive];if(void 0!==g){var C=g.call(A,I||"default");if("object"!==k(C))return C;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===I?String:Number)(A)}(A,"string");return"symbol"===k(I)?I:String(I)}function K(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,W(C.key),C)}}function t(A,I,g){return I&&K(A.prototype,I),g&&K(A,g),Object.defineProperty(A,"prototype",{writable:!1}),A}var j=function(){function A(){n(this,A),this._path=""}return t(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 L(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=H(A);if(I){var B=H(this).constructor;g=Reflect.construct(C,arguments,B)}else g=C.apply(this,arguments);return m(this,g)}}j._filePtrs=new Map;var u="pv_file";var e=function(){function A(){n(this,A),this._pos=0,this._data=new Uint8Array}return t(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}(),p=function(A){J(g,j);var I=L(g);function g(A,C,B,Q){var E;return n(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 e,E}return t(g,[{key:"pageSize",get:function(){return this._pageSize}},{key:"close",value:function(){return S(this,void 0,void 0,X.mark((function A(){return X.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 S(this,void 0,void 0,X.mark((function C(){var B=this;return X.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 R=0,F=Math.min(A*I,B._meta.size),i=F-F%A,G=new Uint8Array(i),U=B._cache.get(i);if(U){if(R+=U.length,B._pageOffset+=U.length,B._pageOffset===B._pageSize&&(B._pagePtr+=1,B._pageOffset=0),i===R)return void C(U);G.set(U)}var c=IDBKeyRange.bound("".concat(B._path,"-").concat(g.createPage(B._pagePtr)),"".concat(B._path,"-").concat(g.createPage(B._pagePtr+Math.floor(i/B._pageSize)+1))),w=B._store,y=w.openCursor(c);y.onsuccess=function(){var A,I,g=y.result;if(g&&!B._isEOF){var C=Math.min(i-R,g.value.length-B._pageOffset);G.set(g.value.slice(B._pageOffset,B._pageOffset+C),R),R+=C,B._pageOffset+=C,B._pageOffset===B._pageSize&&(B._pagePtr+=1,B._pageOffset=0),R<i?g.continue():(0!==B._pageOffset?B._cache.set(B._pageOffset,g.value):B._cache.clear(),(null===(A=w.transaction)||void 0===A?void 0:A.commit)&&(null===(I=w.transaction)||void 0===I||I.commit()))}},w.transaction.onerror=function(){Q(w.transaction.error)},w.transaction.oncomplete=function(){C(G.slice(0,R))}}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 S(this,void 0,void 0,X.mark((function C(){var B=this;return X.wrap((function(C){for(;;)switch(C.prev=C.next){case 0:return C.abrupt("return",new Promise((function(C,Q){return S(B,void 0,void 0,X.mark((function B(){var E,R,F,i,G,U,c,w,y,Z,o,d=this;return X.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 F=this._store,i=function(){return new Promise((function(A){var I=F.get("".concat(d._path,"-").concat(g.createPage(d._pagePtr)));I.onsuccess=function(){void 0!==I.result?A(I.result.slice(0,d._pageOffset)):A(new Uint8Array(0))}}))},B.next=10,i();case 10:for(G=B.sent,(U=new Uint8Array(G.length+A.length)).set(G),U.set(A,G.length),c=this._pagePtr*this._pageSize+U.length,w={size:c,numPages:Math.ceil(c/this._pageSize),version:I,pageSize:this._pageSize},F.put(w,this._path),y=Math.ceil(U.length/this._pageSize),Z=0;Z<y;Z++)F.put(U.slice(Z*this._pageSize,(Z+1)*this._pageSize),"".concat(this._path,"-").concat(g.createPage(this._pagePtr+Z)));this.exists()&&w.numPages<this._meta.numPages&&(o=IDBKeyRange.bound("".concat(this._path,"-").concat(g.createPage(w.numPages)),"".concat(this._path,"-").concat(g.createPage(this._meta.numPages)),!0),F.delete(o)),(null===(E=F.transaction)||void 0===E?void 0:E.commit)&&(null===(R=F.transaction)||void 0===R||R.commit()),F.transaction.onerror=function(){Q(F.transaction.error)},F.transaction.oncomplete=function(){d._meta=w,d.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 S(this,void 0,void 0,X.mark((function A(){var I=this;return X.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.abrupt("return",new Promise((function(A,C){return S(I,void 0,void 0,X.mark((function I(){var B,Q,E,R,F=this;return X.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,(R=E.delete(Q)).onerror=function(){C(R.error)},R.onsuccess=function(){F._meta=void 0,F._pageOffset=0,F._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(u,this._mode).objectStore(u)}}],[{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 S(C,void 0,void 0,X.mark((function C(){var E,R,F;return X.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(u)||g.result.createObjectStore(u)}}));case 3:E=C.sent,(R=E.transaction(u,"readwrite").objectStore(u).get(A)).onerror=function(){Q(R.error)},R.onsuccess=function(){var C=R.result,F=I.includes("r")?"readonly":"readwrite";if(void 0===C&&"readonly"===F){var i=new Error("'".concat(A,"' doesn't exist."));return i.name="FileNotExists",void Q(i)}var G=new g(A,C,E,F);I.includes("a")&&G.seek(0,2),B(G)},C.next=12;break;case 9:C.prev=9,C.t0=C.catch(0),"InvalidStateError"===C.t0.name?((F=new Error("IndexedDB is not supported")).name="IndexedDBNotSupported",Q(F)):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 x(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=H(A);if(I){var B=H(this).constructor;g=Reflect.construct(C,arguments,B)}else g=C.apply(this,arguments);return m(this,g)}}var r=function(A){J(g,j);var I=x(g);function g(A,C,B,Q){var E;return n(this,g),(E=I.call(this))._pos=0,E._path=A,E._meta=C,E._mode=Q,E}return t(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 S(this,void 0,void 0,X.mark((function A(){return X.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 z(A,I){for(var g=I;0!==A[g];)g++;return new TextDecoder("utf-8").decode(A.slice(I,g))}function T(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 f(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 O(A,I){return S(this,void 0,void 0,X.mark((function g(){var C;return X.wrap((function(g){for(;;)switch(g.prev=g.next){case 0:return g.prev=0,g.next=3,p.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",r.open(A,I));case 17:case"end":return g.stop()}}),g,null,[[0,6]])})))}function v(A,I,g,C){return S(this,void 0,void 0,X.mark((function B(){var Q;return X.wrap((function(B){for(;;)switch(B.prev=B.next){case 0:return B.next=2,O(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(T(I),C);case 6:case"end":return B.stop()}}),B)})))}r._memFiles=new Map;var P=5e3,q=2;function _(A,I,g,C,B){return S(this,void 0,void 0,X.mark((function Q(){var E,R,F,i,G,U,c,w;return X.wrap((function(Q){for(;;)switch(Q.prev=Q.next){case 0:return Q.next=2,O(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:R=q,F=function(A){return new Promise((function(I){setTimeout(I,A)}))},i=B+1,G=null;case 10:if(!(i>0)){Q.next=38;break}return G=null,Q.prev=12,Q.next=15,fetch(I,{cache:"no-cache"});case 15:if(!(U=Q.sent).ok){Q.next=23;break}return Q.next=19,U.arrayBuffer();case 19:return c=Q.sent,Q.next=22,E.write(new Uint8Array(c),C);case 22:return Q.abrupt("return");case 23:return Q.next=25,U.text();case 25:w=Q.sent,G=new Error("Error response returned while fetching model from '".concat(I,"': ").concat(w)),Q.next=32;break;case 29:Q.prev=29,Q.t0=Q.catch(12),G=new Error("Failed to fetch model from '".concat(I,"': ").concat(Q.t0.message));case 32:return i--,Q.next=35,F(R);case 35:R=Math.min(P,R*q),Q.next=10;break;case 38:if(null===G){Q.next=42;break}throw G;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 $(A){return S(this,void 0,void 0,X.mark((function I(){var g,C,B,Q,E,R,F,i,G;return X.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,R=A.version,F=void 0===R?1:R,i=A.numFetchRetries,G=void 0===i?0:i,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,v(B,g,E,F);case 8:case 13:I.next=16;break;case 10:if(null==C){I.next=15;break}return I.next=13,_(B,C,E,F,G);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)})))}function AA(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 IA(A,I){if(A){if("string"==typeof A)return AA(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)?AA(A,I):void 0}}function gA(A,I){return function(A){if(Array.isArray(A))return A}(A)||function(A,I){var g=null==A?null:"undefined"!=typeof Symbol&&A[Symbol.iterator]||A["@@iterator"];if(null!=g){var C,B,Q,E,R=[],F=!0,i=!1;try{if(Q=(g=g.call(A)).next,0===I){if(Object(g)!==g)return;F=!1}else for(;!(F=(C=Q.call(g)).done)&&(R.push(C.value),R.length!==I);F=!0);}catch(A){i=!0,B=A}finally{try{if(!F&&null!=g.return&&(E=g.return(),Object(E)!==E))return}finally{if(i)throw B}}return R}}(A,I)||IA(A,I)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function CA(A){return function(A){if(Array.isArray(A))return AA(A)}(A)||function(A){if("undefined"!=typeof Symbol&&null!=A[Symbol.iterator]||null!=A["@@iterator"])return Array.from(A)}(A)||IA(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 BA,QA,EA,RA=(QA="undefined"!=typeof document?null===(BA=document.currentScript)||void 0===BA?void 0:BA.src:void 0,function(){var A,B,Q=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},R=new Promise((function(I,g){A=I,B=g})),F="object"==("undefined"==typeof window?"undefined":C(window)),i="function"==typeof importScripts;function G(A){return G="function"==typeof Symbol&&"symbol"==C(Symbol.iterator)?function(A){return C(A)}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":C(A)},G(A)}function U(A){var I=function(A,I){if("object"!=G(A)||!A)return A;var g=A[Symbol.toPrimitive];if(void 0!==g){var C=g.call(A,I||"default");if("object"!=G(C))return C;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===I?String:Number)(A)}(A,"string");return"symbol"==G(I)?I:I+""}function c(A,I,g){return(I=U(I))in A?Object.defineProperty(A,I,{value:g,enumerable:!0,configurable:!0,writable:!0}):A[I]=g,A}function w(A,I,g,C,B,Q,E){try{var R=A[Q](E),F=R.value}catch(A){return void g(A)}R.done?I(F):Promise.resolve(F).then(C,B)}function Z(A){return function(){var I=this,g=arguments;return new Promise((function(C,B){var Q=A.apply(I,g);function E(A){w(Q,C,B,E,R,"next",A)}function R(A){w(Q,C,B,E,R,"throw",A)}E(void 0)}))}}function o(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}"object"==("undefined"==typeof process?"undefined":C(process))&&"object"==C(process.versions)&&process.versions.node;var d={exports:{}},l={exports:{}};!function(A){function I(g){return A.exports=I="function"==typeof Symbol&&"symbol"==C(Symbol.iterator)?function(A){return C(A)}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":C(A)},A.exports.__esModule=!0,A.exports.default=A.exports,I(g)}A.exports=I,A.exports.__esModule=!0,A.exports.default=A.exports}(l);var M=l.exports;o(M),function(A){var I=M.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,R=Object.defineProperty||function(A,I,g){A[I]=g.value},F="function"==typeof Symbol?Symbol:{},i=F.iterator||"@@iterator",G=F.asyncIterator||"@@asyncIterator",U=F.toStringTag||"@@toStringTag";function c(A,I,g){return Object.defineProperty(A,I,{value:g,enumerable:!0,configurable:!0,writable:!0}),A[I]}try{c({},"")}catch(C){c=function(A,I,g){return A[I]=g}}function w(A,I,g,C){var B=I&&I.prototype instanceof s?I:s,Q=Object.create(B.prototype),E=new H(C||[]);return R(Q,"_invoke",{value:V(A,g,E)}),Q}function y(A,I,g){try{return{type:"normal",arg:A.call(I,g)}}catch(A){return{type:"throw",arg:A}}}B.wrap=w;var Z="suspendedStart",o="suspendedYield",d="executing",l="completed",M={};function s(){}function D(){}function Y(){}var h={};c(h,i,(function(){return this}));var b=Object.getPrototypeOf,N=b&&b(b(n([])));N&&N!==Q&&E.call(N,i)&&(h=N);var a=Y.prototype=s.prototype=Object.create(h);function X(A){["next","throw","return"].forEach((function(I){c(A,I,(function(A){return this._invoke(I,A)}))}))}function S(A,g){function C(B,Q,R,F){var i=y(A[B],A,Q);if("throw"!==i.type){var G=i.arg,U=G.value;return U&&"object"==I(U)&&E.call(U,"__await")?g.resolve(U.__await).then((function(A){C("next",A,R,F)}),(function(A){C("throw",A,R,F)})):g.resolve(U).then((function(A){G.value=A,R(G)}),(function(A){return C("throw",A,R,F)}))}F(i.arg)}var B;R(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 V(A,I,g){var B=Z;return function(Q,E){if(B===d)throw Error("Generator is already running");if(B===l){if("throw"===Q)throw E;return{value:C,done:!0}}for(g.method=Q,g.arg=E;;){var R=g.delegate;if(R){var F=J(R,g);if(F){if(F===M)continue;return F}}if("next"===g.method)g.sent=g._sent=g.arg;else if("throw"===g.method){if(B===Z)throw B=l,g.arg;g.dispatchException(g.arg)}else"return"===g.method&&g.abrupt("return",g.arg);B=d;var i=y(A,I,g);if("normal"===i.type){if(B=g.done?l:o,i.arg===M)continue;return{value:i.arg,done:g.done}}"throw"===i.type&&(B=l,g.method="throw",g.arg=i.arg)}}}function J(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,J(A,I),"throw"===I.method)||"return"!==g&&(I.method="throw",I.arg=new TypeError("The iterator does not provide a '"+g+"' method")),M;var Q=y(B,A.iterator,I.arg);if("throw"===Q.type)return I.method="throw",I.arg=Q.arg,I.delegate=null,M;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,M):E:(I.method="throw",I.arg=new TypeError("iterator result is not an object"),I.delegate=null,M)}function k(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 m(A){var I=A.completion||{};I.type="normal",delete I.arg,A.completion=I}function H(A){this.tryEntries=[{tryLoc:"root"}],A.forEach(k,this),this.reset(!0)}function n(A){if(A||""===A){var g=A[i];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 D.prototype=Y,R(a,"constructor",{value:Y,configurable:!0}),R(Y,"constructor",{value:D,configurable:!0}),D.displayName=c(Y,U,"GeneratorFunction"),B.isGeneratorFunction=function(A){var I="function"==typeof A&&A.constructor;return!!I&&(I===D||"GeneratorFunction"===(I.displayName||I.name))},B.mark=function(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,Y):(A.__proto__=Y,c(A,U,"GeneratorFunction")),A.prototype=Object.create(a),A},B.awrap=function(A){return{__await:A}},X(S.prototype),c(S.prototype,G,(function(){return this})),B.AsyncIterator=S,B.async=function(A,I,g,C,Q){void 0===Q&&(Q=Promise);var E=new S(w(A,I,g,C),Q);return B.isGeneratorFunction(I)?E:E.next().then((function(A){return A.done?A.value:E.next()}))},X(a),c(a,U,"Generator"),c(a,i,(function(){return this})),c(a,"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=n,H.prototype={constructor:H,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(m),!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 R.type="throw",R.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],R=Q.completion;if("root"===Q.tryLoc)return g("end");if(Q.tryLoc<=this.prev){var F=E.call(Q,"catchLoc"),i=E.call(Q,"finallyLoc");if(F&&i){if(this.prev<Q.catchLoc)return g(Q.catchLoc,!0);if(this.prev<Q.finallyLoc)return g(Q.finallyLoc)}else if(F){if(this.prev<Q.catchLoc)return g(Q.catchLoc,!0)}else{if(!i)throw 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,M):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),M},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),m(g),M}},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;m(g)}return B}}throw Error("illegal catch attempt")},delegateYield:function(A,I,g){return this.delegate={iterator:n(A),resultName:I,nextLoc:g},"next"===this.method&&(this.arg=C),M}},B}A.exports=g,A.exports.__esModule=!0,A.exports.default=A.exports}(d);var s=d.exports;o(s);var D=s(),Y=D;try{regeneratorRuntime=D}catch(A){"object"===("undefined"==typeof globalThis?"undefined":C(globalThis))?globalThis.regeneratorRuntime=D:Function("r","regeneratorRuntime = r")(D)}var h=o(Y);function b(A,I){if(!(A instanceof I))throw new TypeError("Cannot call a class as a function")}function N(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,U(C.key),C)}}function a(A,I,g){return I&&N(A.prototype,I),g&&N(A,g),Object.defineProperty(A,"prototype",{writable:!1}),A}function X(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}var S=function(){function A(){b(this,A),this._path=""}return a(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?X(Object(g),!0).forEach((function(I){c(A,I,g[I])})):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(g)):X(Object(g)).forEach((function(I){Object.defineProperty(A,I,Object.getOwnPropertyDescriptor(g,I))}))}return A}({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)}}])}();function V(A,I){if(I&&("object"==G(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 J(A){return J=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(A){return A.__proto__||Object.getPrototypeOf(A)},J(A)}function k(A,I){return k=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(A,I){return A.__proto__=I,A},k(A,I)}function m(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 H(A,I,g){return I=J(I),V(A,n()?Reflect.construct(I,g||[],J(A).constructor):I.apply(A,g))}function n(){try{var A=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(A){}return(n=function(){return!!A})()}S._filePtrs=new Map;var W="pv_file",K=a((function A(){b(this,A),this._pos=0,this._data=new Uint8Array}),[{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}}]),t=function(A){function I(A,g,C,B){var Q;return b(this,I),(Q=H(this,I))._pageSize=524288,Q._pagePtr=0,Q._pageOffset=0,Q._path=A,Q._meta=g,Q._db=C,Q._mode=B,Q._cache=new K,Q}return m(I,A),a(I,[{key:"pageSize",get:function(){return this._pageSize}},{key:"close",value:(Q=Z(h.mark((function A(){return h.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 Q.apply(this,arguments)})},{key:"read",value:(B=Z(h.mark((function A(g,C){var B=this;return h.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.abrupt("return",new Promise((function(A,Q){if(B.exists()){if(B._isEOF){var E=new Error("EOF");return E.name="EndOfFile",void Q(E)}var R=0,F=Math.min(g*C,B._meta.size),i=F-F%g,G=new Uint8Array(i),U=B._cache.get(i);if(U){if(R+=U.length,B._pageOffset+=U.length,B._pageOffset===B._pageSize&&(B._pagePtr+=1,B._pageOffset=0),i===R)return void A(U);G.set(U)}var c=IDBKeyRange.bound("".concat(B._path,"-").concat(I.createPage(B._pagePtr)),"".concat(B._path,"-").concat(I.createPage(B._pagePtr+Math.floor(i/B._pageSize)+1))),w=B._store,y=w.openCursor(c);y.onsuccess=function(){var A=y.result;if(A&&!B._isEOF){var I,g,C=Math.min(i-R,A.value.length-B._pageOffset);G.set(A.value.slice(B._pageOffset,B._pageOffset+C),R),R+=C,B._pageOffset+=C,B._pageOffset===B._pageSize&&(B._pagePtr+=1,B._pageOffset=0),R<i?A.continue():(0!==B._pageOffset?B._cache.set(B._pageOffset,A.value):B._cache.clear(),null!==(I=w.transaction)&&void 0!==I&&I.commit&&(null===(g=w.transaction)||void 0===g||g.commit()))}},w.transaction.onerror=function(){Q(w.transaction.error)},w.transaction.oncomplete=function(){A(G.slice(0,R))}}else Q(new Error("'".concat(B._path,"' doesn't exist.")))})));case 1:case"end":return A.stop()}}),A)}))),function(A,I){return B.apply(this,arguments)})},{key:"write",value:(C=Z(h.mark((function A(g){var C,B=this,Q=arguments;return