@picovoice/cheetah-react
Version:
React hook for Cheetah Web SDK
1 lines • 4.7 MB
JavaScript
var CheetahReact=function(A,I,C){"use strict";function g(A){return g="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},g(A)}function B(A){var I=function(A,I){if("object"!==g(A)||null===A)return A;var C=A[Symbol.toPrimitive];if(void 0!==C){var B=C.call(A,I||"default");if("object"!==g(B))return B;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===I?String:Number)(A)}(A,"string");return"symbol"===g(I)?I:String(I)}function Q(A,I,C,g,B,Q,E){try{var R=A[Q](E),U=R.value}catch(A){return void C(A)}R.done?I(U):Promise.resolve(U).then(g,B)}function E(A){return function(){var I=this,C=arguments;return new Promise((function(g,B){var E=A.apply(I,C);function R(A){Q(E,g,B,R,U,"next",A)}function U(A){Q(E,g,B,R,U,"throw",A)}R(void 0)}))}}function R(A,I){(null==I||I>A.length)&&(I=A.length);for(var C=0,g=new Array(I);C<I;C++)g[C]=A[C];return g}function U(A,I){return function(A){if(Array.isArray(A))return A}(A)||function(A,I){var C=null==A?null:"undefined"!=typeof Symbol&&A[Symbol.iterator]||A["@@iterator"];if(null!=C){var g,B,Q,E,R=[],U=!0,w=!1;try{if(Q=(C=C.call(A)).next,0===I){if(Object(C)!==C)return;U=!1}else for(;!(U=(g=Q.call(C)).done)&&(R.push(g.value),R.length!==I);U=!0);}catch(A){w=!0,B=A}finally{try{if(!U&&null!=C.return&&(E=C.return(),Object(E)!==E))return}finally{if(w)throw B}}return R}}(A,I)||function(A,I){if(A){if("string"==typeof A)return R(A,I);var C=Object.prototype.toString.call(A).slice(8,-1);return"Object"===C&&A.constructor&&(C=A.constructor.name),"Map"===C||"Set"===C?Array.from(A):"Arguments"===C||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(C)?R(A,I):void 0}}(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 w(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var F={exports:{}},i={exports:{}};!function(A){function I(C){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(C)}A.exports=I,A.exports.__esModule=!0,A.exports.default=A.exports}(i);var D=i.exports;!function(A){var I=D.default;function C(){A.exports=C=function(){return B},A.exports.__esModule=!0,A.exports.default=A.exports;var g,B={},Q=Object.prototype,E=Q.hasOwnProperty,R=Object.defineProperty||function(A,I,C){A[I]=C.value},U="function"==typeof Symbol?Symbol:{},w=U.iterator||"@@iterator",F=U.asyncIterator||"@@asyncIterator",i=U.toStringTag||"@@toStringTag";function D(A,I,C){return Object.defineProperty(A,I,{value:C,enumerable:!0,configurable:!0,writable:!0}),A[I]}try{D({},"")}catch(g){D=function(A,I,C){return A[I]=C}}function G(A,I,C,g){var B=I&&I.prototype instanceof l?I:l,Q=Object.create(B.prototype),E=new V(g||[]);return R(Q,"_invoke",{value:j(A,C,E)}),Q}function M(A,I,C){try{return{type:"normal",arg:A.call(I,C)}}catch(A){return{type:"throw",arg:A}}}B.wrap=G;var o="suspendedStart",y="suspendedYield",J="executing",c="completed",h={};function l(){}function s(){}function N(){}var Y={};D(Y,w,(function(){return this}));var S=Object.getPrototypeOf,Z=S&&S(S(b([])));Z&&Z!==Q&&E.call(Z,w)&&(Y=Z);var k=N.prototype=l.prototype=Object.create(Y);function K(A){["next","throw","return"].forEach((function(I){D(A,I,(function(A){return this._invoke(I,A)}))}))}function H(A,C){function g(B,Q,R,U){var w=M(A[B],A,Q);if("throw"!==w.type){var F=w.arg,i=F.value;return i&&"object"==I(i)&&E.call(i,"__await")?C.resolve(i.__await).then((function(A){g("next",A,R,U)}),(function(A){g("throw",A,R,U)})):C.resolve(i).then((function(A){F.value=A,R(F)}),(function(A){return g("throw",A,R,U)}))}U(w.arg)}var B;R(this,"_invoke",{value:function(A,I){function Q(){return new C((function(C,B){g(A,I,C,B)}))}return B=B?B.then(Q,Q):Q()}})}function j(A,I,C){var B=o;return function(Q,E){if(B===J)throw new Error("Generator is already running");if(B===c){if("throw"===Q)throw E;return{value:g,done:!0}}for(C.method=Q,C.arg=E;;){var R=C.delegate;if(R){var U=L(R,C);if(U){if(U===h)continue;return U}}if("next"===C.method)C.sent=C._sent=C.arg;else if("throw"===C.method){if(B===o)throw B=c,C.arg;C.dispatchException(C.arg)}else"return"===C.method&&C.abrupt("return",C.arg);B=J;var w=M(A,I,C);if("normal"===w.type){if(B=C.done?c:y,w.arg===h)continue;return{value:w.arg,done:C.done}}"throw"===w.type&&(B=c,C.method="throw",C.arg=w.arg)}}}function L(A,I){var C=I.method,B=A.iterator[C];if(B===g)return I.delegate=null,"throw"===C&&A.iterator.return&&(I.method="return",I.arg=g,L(A,I),"throw"===I.method)||"return"!==C&&(I.method="throw",I.arg=new TypeError("The iterator does not provide a '"+C+"' method")),h;var Q=M(B,A.iterator,I.arg);if("throw"===Q.type)return I.method="throw",I.arg=Q.arg,I.delegate=null,h;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=g),I.delegate=null,h):E:(I.method="throw",I.arg=new TypeError("iterator result is not an object"),I.delegate=null,h)}function d(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 a(A){var I=A.completion||{};I.type="normal",delete I.arg,A.completion=I}function V(A){this.tryEntries=[{tryLoc:"root"}],A.forEach(d,this),this.reset(!0)}function b(A){if(A||""===A){var C=A[w];if(C)return C.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=g,I.done=!0,I};return Q.next=Q}}throw new TypeError(I(A)+" is not iterable")}return s.prototype=N,R(k,"constructor",{value:N,configurable:!0}),R(N,"constructor",{value:s,configurable:!0}),s.displayName=D(N,i,"GeneratorFunction"),B.isGeneratorFunction=function(A){var I="function"==typeof A&&A.constructor;return!!I&&(I===s||"GeneratorFunction"===(I.displayName||I.name))},B.mark=function(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,N):(A.__proto__=N,D(A,i,"GeneratorFunction")),A.prototype=Object.create(k),A},B.awrap=function(A){return{__await:A}},K(H.prototype),D(H.prototype,F,(function(){return this})),B.AsyncIterator=H,B.async=function(A,I,C,g,Q){void 0===Q&&(Q=Promise);var E=new H(G(A,I,C,g),Q);return B.isGeneratorFunction(I)?E:E.next().then((function(A){return A.done?A.value:E.next()}))},K(k),D(k,i,"Generator"),D(k,w,(function(){return this})),D(k,"toString",(function(){return"[object Generator]"})),B.keys=function(A){var I=Object(A),C=[];for(var g in I)C.push(g);return C.reverse(),function A(){for(;C.length;){var g=C.pop();if(g in I)return A.value=g,A.done=!1,A}return A.done=!0,A}},B.values=b,V.prototype={constructor:V,reset:function(A){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(a),!A)for(var I in this)"t"===I.charAt(0)&&E.call(this,I)&&!isNaN(+I.slice(1))&&(this[I]=g)},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 C(C,B){return R.type="throw",R.arg=A,I.next=C,B&&(I.method="next",I.arg=g),!!B}for(var B=this.tryEntries.length-1;B>=0;--B){var Q=this.tryEntries[B],R=Q.completion;if("root"===Q.tryLoc)return C("end");if(Q.tryLoc<=this.prev){var U=E.call(Q,"catchLoc"),w=E.call(Q,"finallyLoc");if(U&&w){if(this.prev<Q.catchLoc)return C(Q.catchLoc,!0);if(this.prev<Q.finallyLoc)return C(Q.finallyLoc)}else if(U){if(this.prev<Q.catchLoc)return C(Q.catchLoc,!0)}else{if(!w)throw new Error("try statement without catch or finally");if(this.prev<Q.finallyLoc)return C(Q.finallyLoc)}}}},abrupt:function(A,I){for(var C=this.tryEntries.length-1;C>=0;--C){var g=this.tryEntries[C];if(g.tryLoc<=this.prev&&E.call(g,"finallyLoc")&&this.prev<g.finallyLoc){var B=g;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,h):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),h},finish:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var C=this.tryEntries[I];if(C.finallyLoc===A)return this.complete(C.completion,C.afterLoc),a(C),h}},catch:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var C=this.tryEntries[I];if(C.tryLoc===A){var g=C.completion;if("throw"===g.type){var B=g.arg;a(C)}return B}}throw new Error("illegal catch attempt")},delegateYield:function(A,I,C){return this.delegate={iterator:b(A),resultName:I,nextLoc:C},"next"===this.method&&(this.arg=g),h}},B}A.exports=C,A.exports.__esModule=!0,A.exports.default=A.exports}(F);var G=(0,F.exports)(),M=G;try{regeneratorRuntime=G}catch(A){"object"==typeof globalThis?globalThis.regeneratorRuntime=G:Function("r","regeneratorRuntime = r")(G)}var o=w(M);function y(A,I,C,g,B,Q,E){try{var R=A[Q](E),U=R.value}catch(A){return void C(A)}R.done?I(U):Promise.resolve(U).then(g,B)}function J(A){return function(){var I=this,C=arguments;return new Promise((function(g,B){var Q=A.apply(I,C);function E(A){y(Q,g,B,E,R,"next",A)}function R(A){y(Q,g,B,E,R,"throw",A)}E(void 0)}))}}function c(A,I){if(!(A instanceof I))throw new TypeError("Cannot call a class as a function")}function h(A){return h="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},h(A)}function l(A){var I=function(A,I){if("object"!==h(A)||null===A)return A;var C=A[Symbol.toPrimitive];if(void 0!==C){var g=C.call(A,I||"default");if("object"!==h(g))return g;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===I?String:Number)(A)}(A,"string");return"symbol"===h(I)?I:String(I)}function s(A,I){for(var C=0;C<I.length;C++){var g=I[C];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(A,l(g.key),g)}}function N(A,I,C){return I&&s(A.prototype,I),C&&s(A,C),Object.defineProperty(A,"prototype",{writable:!1}),A}function Y(A,I,C){return(I=l(I))in A?Object.defineProperty(A,I,{value:C,enumerable:!0,configurable:!0,writable:!0}):A[I]=C,A}function S(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var Z={exports:{}},k={exports:{}};!function(A){function I(C){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(C)}A.exports=I,A.exports.__esModule=!0,A.exports.default=A.exports}(k);var K=k.exports;!function(A){var I=K.default;function C(){A.exports=C=function(){return B},A.exports.__esModule=!0,A.exports.default=A.exports;var g,B={},Q=Object.prototype,E=Q.hasOwnProperty,R=Object.defineProperty||function(A,I,C){A[I]=C.value},U="function"==typeof Symbol?Symbol:{},w=U.iterator||"@@iterator",F=U.asyncIterator||"@@asyncIterator",i=U.toStringTag||"@@toStringTag";function D(A,I,C){return Object.defineProperty(A,I,{value:C,enumerable:!0,configurable:!0,writable:!0}),A[I]}try{D({},"")}catch(g){D=function(A,I,C){return A[I]=C}}function G(A,I,C,g){var B=I&&I.prototype instanceof l?I:l,Q=Object.create(B.prototype),E=new V(g||[]);return R(Q,"_invoke",{value:j(A,C,E)}),Q}function M(A,I,C){try{return{type:"normal",arg:A.call(I,C)}}catch(A){return{type:"throw",arg:A}}}B.wrap=G;var o="suspendedStart",y="suspendedYield",J="executing",c="completed",h={};function l(){}function s(){}function N(){}var Y={};D(Y,w,(function(){return this}));var S=Object.getPrototypeOf,Z=S&&S(S(b([])));Z&&Z!==Q&&E.call(Z,w)&&(Y=Z);var k=N.prototype=l.prototype=Object.create(Y);function K(A){["next","throw","return"].forEach((function(I){D(A,I,(function(A){return this._invoke(I,A)}))}))}function H(A,C){function g(B,Q,R,U){var w=M(A[B],A,Q);if("throw"!==w.type){var F=w.arg,i=F.value;return i&&"object"==I(i)&&E.call(i,"__await")?C.resolve(i.__await).then((function(A){g("next",A,R,U)}),(function(A){g("throw",A,R,U)})):C.resolve(i).then((function(A){F.value=A,R(F)}),(function(A){return g("throw",A,R,U)}))}U(w.arg)}var B;R(this,"_invoke",{value:function(A,I){function Q(){return new C((function(C,B){g(A,I,C,B)}))}return B=B?B.then(Q,Q):Q()}})}function j(A,I,C){var B=o;return function(Q,E){if(B===J)throw new Error("Generator is already running");if(B===c){if("throw"===Q)throw E;return{value:g,done:!0}}for(C.method=Q,C.arg=E;;){var R=C.delegate;if(R){var U=L(R,C);if(U){if(U===h)continue;return U}}if("next"===C.method)C.sent=C._sent=C.arg;else if("throw"===C.method){if(B===o)throw B=c,C.arg;C.dispatchException(C.arg)}else"return"===C.method&&C.abrupt("return",C.arg);B=J;var w=M(A,I,C);if("normal"===w.type){if(B=C.done?c:y,w.arg===h)continue;return{value:w.arg,done:C.done}}"throw"===w.type&&(B=c,C.method="throw",C.arg=w.arg)}}}function L(A,I){var C=I.method,B=A.iterator[C];if(B===g)return I.delegate=null,"throw"===C&&A.iterator.return&&(I.method="return",I.arg=g,L(A,I),"throw"===I.method)||"return"!==C&&(I.method="throw",I.arg=new TypeError("The iterator does not provide a '"+C+"' method")),h;var Q=M(B,A.iterator,I.arg);if("throw"===Q.type)return I.method="throw",I.arg=Q.arg,I.delegate=null,h;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=g),I.delegate=null,h):E:(I.method="throw",I.arg=new TypeError("iterator result is not an object"),I.delegate=null,h)}function d(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 a(A){var I=A.completion||{};I.type="normal",delete I.arg,A.completion=I}function V(A){this.tryEntries=[{tryLoc:"root"}],A.forEach(d,this),this.reset(!0)}function b(A){if(A||""===A){var C=A[w];if(C)return C.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=g,I.done=!0,I};return Q.next=Q}}throw new TypeError(I(A)+" is not iterable")}return s.prototype=N,R(k,"constructor",{value:N,configurable:!0}),R(N,"constructor",{value:s,configurable:!0}),s.displayName=D(N,i,"GeneratorFunction"),B.isGeneratorFunction=function(A){var I="function"==typeof A&&A.constructor;return!!I&&(I===s||"GeneratorFunction"===(I.displayName||I.name))},B.mark=function(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,N):(A.__proto__=N,D(A,i,"GeneratorFunction")),A.prototype=Object.create(k),A},B.awrap=function(A){return{__await:A}},K(H.prototype),D(H.prototype,F,(function(){return this})),B.AsyncIterator=H,B.async=function(A,I,C,g,Q){void 0===Q&&(Q=Promise);var E=new H(G(A,I,C,g),Q);return B.isGeneratorFunction(I)?E:E.next().then((function(A){return A.done?A.value:E.next()}))},K(k),D(k,i,"Generator"),D(k,w,(function(){return this})),D(k,"toString",(function(){return"[object Generator]"})),B.keys=function(A){var I=Object(A),C=[];for(var g in I)C.push(g);return C.reverse(),function A(){for(;C.length;){var g=C.pop();if(g in I)return A.value=g,A.done=!1,A}return A.done=!0,A}},B.values=b,V.prototype={constructor:V,reset:function(A){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(a),!A)for(var I in this)"t"===I.charAt(0)&&E.call(this,I)&&!isNaN(+I.slice(1))&&(this[I]=g)},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 C(C,B){return R.type="throw",R.arg=A,I.next=C,B&&(I.method="next",I.arg=g),!!B}for(var B=this.tryEntries.length-1;B>=0;--B){var Q=this.tryEntries[B],R=Q.completion;if("root"===Q.tryLoc)return C("end");if(Q.tryLoc<=this.prev){var U=E.call(Q,"catchLoc"),w=E.call(Q,"finallyLoc");if(U&&w){if(this.prev<Q.catchLoc)return C(Q.catchLoc,!0);if(this.prev<Q.finallyLoc)return C(Q.finallyLoc)}else if(U){if(this.prev<Q.catchLoc)return C(Q.catchLoc,!0)}else{if(!w)throw new Error("try statement without catch or finally");if(this.prev<Q.finallyLoc)return C(Q.finallyLoc)}}}},abrupt:function(A,I){for(var C=this.tryEntries.length-1;C>=0;--C){var g=this.tryEntries[C];if(g.tryLoc<=this.prev&&E.call(g,"finallyLoc")&&this.prev<g.finallyLoc){var B=g;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,h):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),h},finish:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var C=this.tryEntries[I];if(C.finallyLoc===A)return this.complete(C.completion,C.afterLoc),a(C),h}},catch:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var C=this.tryEntries[I];if(C.tryLoc===A){var g=C.completion;if("throw"===g.type){var B=g.arg;a(C)}return B}}throw new Error("illegal catch attempt")},delegateYield:function(A,I,C){return this.delegate={iterator:b(A),resultName:I,nextLoc:C},"next"===this.method&&(this.arg=g),h}},B}A.exports=C,A.exports.__esModule=!0,A.exports.default=A.exports}(Z);var H=(0,Z.exports)(),j=H;try{regeneratorRuntime=H}catch(A){"object"==typeof globalThis?globalThis.regeneratorRuntime=H:Function("r","regeneratorRuntime = r")(H)}var L=S(j);const d=new Error("request for lock canceled");var a=function(A,I,C,g){return new(C||(C=Promise))((function(B,Q){function E(A){try{U(g.next(A))}catch(A){Q(A)}}function R(A){try{U(g.throw(A))}catch(A){Q(A)}}function U(A){var I;A.done?B(A.value):(I=A.value,I instanceof C?I:new C((function(A){A(I)}))).then(E,R)}U((g=g.apply(A,I||[])).next())}))};class V{constructor(A,I=d){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,C)=>{this._weightedQueues[A-1]||(this._weightedQueues[A-1]=[]),this._weightedQueues[A-1].push({resolve:I,reject:C}),this._dispatch()}))}runExclusive(A,I=1){return a(this,void 0,void 0,(function*(){const[C,g]=yield this.acquire(I);try{return yield A(C)}finally{g()}}))}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 C=null===(A=this._weightedQueues[I-1])||void 0===A?void 0:A.shift();if(!C)continue;const g=this._value,B=I;this._value-=I,I=this._value+1,C.resolve([g,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 b=function(A,I,C,g){return new(C||(C=Promise))((function(B,Q){function E(A){try{U(g.next(A))}catch(A){Q(A)}}function R(A){try{U(g.throw(A))}catch(A){Q(A)}}function U(A){var I;A.done?B(A.value):(I=A.value,I instanceof C?I:new C((function(A){A(I)}))).then(E,R)}U((g=g.apply(A,I||[])).next())}))};class X{constructor(A){this._semaphore=new V(1,A)}acquire(){return b(this,void 0,void 0,(function*(){const[,A]=yield this._semaphore.acquire();return A}))}runExclusive(A){return this._semaphore.runExclusive((()=>A()))}isLocked(){return this._semaphore.isLocked()}waitForUnlock(){return this._semaphore.waitForUnlock()}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}function n(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}var W={exports:{}},m={exports:{}};!function(A){function I(C){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(C)}A.exports=I,A.exports.__esModule=!0,A.exports.default=A.exports}(m);var t=m.exports;!function(A){var I=t.default;function C(){A.exports=C=function(){return B},A.exports.__esModule=!0,A.exports.default=A.exports;var g,B={},Q=Object.prototype,E=Q.hasOwnProperty,R=Object.defineProperty||function(A,I,C){A[I]=C.value},U="function"==typeof Symbol?Symbol:{},w=U.iterator||"@@iterator",F=U.asyncIterator||"@@asyncIterator",i=U.toStringTag||"@@toStringTag";function D(A,I,C){return Object.defineProperty(A,I,{value:C,enumerable:!0,configurable:!0,writable:!0}),A[I]}try{D({},"")}catch(g){D=function(A,I,C){return A[I]=C}}function G(A,I,C,g){var B=I&&I.prototype instanceof l?I:l,Q=Object.create(B.prototype),E=new V(g||[]);return R(Q,"_invoke",{value:j(A,C,E)}),Q}function M(A,I,C){try{return{type:"normal",arg:A.call(I,C)}}catch(A){return{type:"throw",arg:A}}}B.wrap=G;var o="suspendedStart",y="suspendedYield",J="executing",c="completed",h={};function l(){}function s(){}function N(){}var Y={};D(Y,w,(function(){return this}));var S=Object.getPrototypeOf,Z=S&&S(S(b([])));Z&&Z!==Q&&E.call(Z,w)&&(Y=Z);var k=N.prototype=l.prototype=Object.create(Y);function K(A){["next","throw","return"].forEach((function(I){D(A,I,(function(A){return this._invoke(I,A)}))}))}function H(A,C){function g(B,Q,R,U){var w=M(A[B],A,Q);if("throw"!==w.type){var F=w.arg,i=F.value;return i&&"object"==I(i)&&E.call(i,"__await")?C.resolve(i.__await).then((function(A){g("next",A,R,U)}),(function(A){g("throw",A,R,U)})):C.resolve(i).then((function(A){F.value=A,R(F)}),(function(A){return g("throw",A,R,U)}))}U(w.arg)}var B;R(this,"_invoke",{value:function(A,I){function Q(){return new C((function(C,B){g(A,I,C,B)}))}return B=B?B.then(Q,Q):Q()}})}function j(A,I,C){var B=o;return function(Q,E){if(B===J)throw new Error("Generator is already running");if(B===c){if("throw"===Q)throw E;return{value:g,done:!0}}for(C.method=Q,C.arg=E;;){var R=C.delegate;if(R){var U=L(R,C);if(U){if(U===h)continue;return U}}if("next"===C.method)C.sent=C._sent=C.arg;else if("throw"===C.method){if(B===o)throw B=c,C.arg;C.dispatchException(C.arg)}else"return"===C.method&&C.abrupt("return",C.arg);B=J;var w=M(A,I,C);if("normal"===w.type){if(B=C.done?c:y,w.arg===h)continue;return{value:w.arg,done:C.done}}"throw"===w.type&&(B=c,C.method="throw",C.arg=w.arg)}}}function L(A,I){var C=I.method,B=A.iterator[C];if(B===g)return I.delegate=null,"throw"===C&&A.iterator.return&&(I.method="return",I.arg=g,L(A,I),"throw"===I.method)||"return"!==C&&(I.method="throw",I.arg=new TypeError("The iterator does not provide a '"+C+"' method")),h;var Q=M(B,A.iterator,I.arg);if("throw"===Q.type)return I.method="throw",I.arg=Q.arg,I.delegate=null,h;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=g),I.delegate=null,h):E:(I.method="throw",I.arg=new TypeError("iterator result is not an object"),I.delegate=null,h)}function d(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 a(A){var I=A.completion||{};I.type="normal",delete I.arg,A.completion=I}function V(A){this.tryEntries=[{tryLoc:"root"}],A.forEach(d,this),this.reset(!0)}function b(A){if(A||""===A){var C=A[w];if(C)return C.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=g,I.done=!0,I};return Q.next=Q}}throw new TypeError(I(A)+" is not iterable")}return s.prototype=N,R(k,"constructor",{value:N,configurable:!0}),R(N,"constructor",{value:s,configurable:!0}),s.displayName=D(N,i,"GeneratorFunction"),B.isGeneratorFunction=function(A){var I="function"==typeof A&&A.constructor;return!!I&&(I===s||"GeneratorFunction"===(I.displayName||I.name))},B.mark=function(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,N):(A.__proto__=N,D(A,i,"GeneratorFunction")),A.prototype=Object.create(k),A},B.awrap=function(A){return{__await:A}},K(H.prototype),D(H.prototype,F,(function(){return this})),B.AsyncIterator=H,B.async=function(A,I,C,g,Q){void 0===Q&&(Q=Promise);var E=new H(G(A,I,C,g),Q);return B.isGeneratorFunction(I)?E:E.next().then((function(A){return A.done?A.value:E.next()}))},K(k),D(k,i,"Generator"),D(k,w,(function(){return this})),D(k,"toString",(function(){return"[object Generator]"})),B.keys=function(A){var I=Object(A),C=[];for(var g in I)C.push(g);return C.reverse(),function A(){for(;C.length;){var g=C.pop();if(g in I)return A.value=g,A.done=!1,A}return A.done=!0,A}},B.values=b,V.prototype={constructor:V,reset:function(A){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(a),!A)for(var I in this)"t"===I.charAt(0)&&E.call(this,I)&&!isNaN(+I.slice(1))&&(this[I]=g)},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 C(C,B){return R.type="throw",R.arg=A,I.next=C,B&&(I.method="next",I.arg=g),!!B}for(var B=this.tryEntries.length-1;B>=0;--B){var Q=this.tryEntries[B],R=Q.completion;if("root"===Q.tryLoc)return C("end");if(Q.tryLoc<=this.prev){var U=E.call(Q,"catchLoc"),w=E.call(Q,"finallyLoc");if(U&&w){if(this.prev<Q.catchLoc)return C(Q.catchLoc,!0);if(this.prev<Q.finallyLoc)return C(Q.finallyLoc)}else if(U){if(this.prev<Q.catchLoc)return C(Q.catchLoc,!0)}else{if(!w)throw new Error("try statement without catch or finally");if(this.prev<Q.finallyLoc)return C(Q.finallyLoc)}}}},abrupt:function(A,I){for(var C=this.tryEntries.length-1;C>=0;--C){var g=this.tryEntries[C];if(g.tryLoc<=this.prev&&E.call(g,"finallyLoc")&&this.prev<g.finallyLoc){var B=g;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,h):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),h},finish:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var C=this.tryEntries[I];if(C.finallyLoc===A)return this.complete(C.completion,C.afterLoc),a(C),h}},catch:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var C=this.tryEntries[I];if(C.tryLoc===A){var g=C.completion;if("throw"===g.type){var B=g.arg;a(C)}return B}}throw new Error("illegal catch attempt")},delegateYield:function(A,I,C){return this.delegate={iterator:b(A),resultName:I,nextLoc:C},"next"===this.method&&(this.arg=g),h}},B}A.exports=C,A.exports.__esModule=!0,A.exports.default=A.exports}(W);var f=(0,W.exports)(),T=f;try{regeneratorRuntime=f}catch(A){"object"==typeof globalThis?globalThis.regeneratorRuntime=f:Function("r","regeneratorRuntime = r")(f)}var e=n(T);function p(A,I,C,g){return new(C||(C=Promise))((function(B,Q){function E(A){try{U(g.next(A))}catch(A){Q(A)}}function R(A){try{U(g.throw(A))}catch(A){Q(A)}}function U(A){var I;A.done?B(A.value):(I=A.value,I instanceof C?I:new C((function(A){A(I)}))).then(E,R)}U((g=g.apply(A,I||[])).next())}))}function u(A,I){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(A,I){return A.__proto__=I,A},u(A,I)}function P(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&&u(A,I)}function O(A){return O="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},O(A)}function x(A,I){if(I&&("object"===O(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 z(A){return z=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(A){return A.__proto__||Object.getPrototypeOf(A)},z(A)}function r(A,I){if(!(A instanceof I))throw new TypeError("Cannot call a class as a function")}function v(A){var I=function(A,I){if("object"!==O(A)||null===A)return A;var C=A[Symbol.toPrimitive];if(void 0!==C){var g=C.call(A,I||"default");if("object"!==O(g))return g;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===I?String:Number)(A)}(A,"string");return"symbol"===O(I)?I:String(I)}function q(A,I){for(var C=0;C<I.length;C++){var g=I[C];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(A,v(g.key),g)}}function _(A,I,C){return I&&q(A.prototype,I),C&&q(A,C),Object.defineProperty(A,"prototype",{writable:!1}),A}var $=function(){function A(){r(this,A),this._path=""}return _(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,C){A._filePtrs.set(I,C)}},{key:"removePtr",value:function(I){A._filePtrs.delete(I)}}]),A}();function AA(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 C,g=z(A);if(I){var B=z(this).constructor;C=Reflect.construct(g,arguments,B)}else C=g.apply(this,arguments);return x(this,C)}}$._filePtrs=new Map;var IA="pv_file";var CA=function(){function A(){r(this,A),this._pos=0,this._data=new Uint8Array}return _(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}(),gA=function(A){P(C,A);var I=AA(C);function C(A,g,B,Q){var E;return r(this,C),(E=I.call(this))._pageSize=524288,E._pagePtr=0,E._pageOffset=0,E._path=A,E._meta=g,E._db=B,E._mode=Q,E._cache=new CA,E}return _(C,[{key:"pageSize",get:function(){return this._pageSize}},{key:"close",value:function(){return p(this,void 0,void 0,e.mark((function A(){return e.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 p(this,void 0,void 0,e.mark((function g(){var B=this;return e.wrap((function(g){for(;;)switch(g.prev=g.next){case 0:return g.abrupt("return",new Promise((function(g,Q){if(B.exists()){if(B._isEOF){var E=new Error("EOF");return E.name="EndOfFile",void Q(E)}var R=0,U=Math.min(A*I,B._meta.size),w=U-U%A,F=new Uint8Array(w),i=B._cache.get(w);if(i){if(R+=i.length,B._pageOffset+=i.length,B._pageOffset===B._pageSize&&(B._pagePtr+=1,B._pageOffset=0),w===R)return void g(i);F.set(i)}var D=IDBKeyRange.bound("".concat(B._path,"-").concat(C.createPage(B._pagePtr)),"".concat(B._path,"-").concat(C.createPage(B._pagePtr+Math.floor(w/B._pageSize)+1))),G=B._store,M=G.openCursor(D);M.onsuccess=function(){var A,I,C=M.result;if(C&&!B._isEOF){var g=Math.min(w-R,C.value.length-B._pageOffset);F.set(C.value.slice(B._pageOffset,B._pageOffset+g),R),R+=g,B._pageOffset+=g,B._pageOffset===B._pageSize&&(B._pagePtr+=1,B._pageOffset=0),R<w?C.continue():(0!==B._pageOffset?B._cache.set(B._pageOffset,C.value):B._cache.clear(),(null===(A=G.transaction)||void 0===A?void 0:A.commit)&&(null===(I=G.transaction)||void 0===I||I.commit()))}},G.transaction.onerror=function(){Q(G.transaction.error)},G.transaction.oncomplete=function(){g(F.slice(0,R))}}else Q(new Error("'".concat(B._path,"' doesn't exist.")))})));case 1:case"end":return g.stop()}}),g)})))}},{key:"write",value:function(A){var I=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return p(this,void 0,void 0,e.mark((function g(){var B=this;return e.wrap((function(g){for(;;)switch(g.prev=g.next){case 0:return g.abrupt("return",new Promise((function(g,Q){return p(B,void 0,void 0,e.mark((function B(){var E,R,U,w,F,i,D,G,M,o,y,J=this;return e.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 U=this._store,w=function(){return new Promise((function(A){var I=U.get("".concat(J._path,"-").concat(C.createPage(J._pagePtr)));I.onsuccess=function(){void 0!==I.result?A(I.result.slice(0,J._pageOffset)):A(new Uint8Array(0))}}))},B.next=10,w();case 10:for(F=B.sent,(i=new Uint8Array(F.length+A.length)).set(F),i.set(A,F.length),D=this._pagePtr*this._pageSize+i.length,G={size:D,numPages:Math.ceil(D/this._pageSize),version:I,pageSize:this._pageSize},U.put(G,this._path),M=Math.ceil(i.length/this._pageSize),o=0;o<M;o++)U.put(i.slice(o*this._pageSize,(o+1)*this._pageSize),"".concat(this._path,"-").concat(C.createPage(this._pagePtr+o)));this.exists()&&G.numPages<this._meta.numPages&&(y=IDBKeyRange.bound("".concat(this._path,"-").concat(C.createPage(G.numPages)),"".concat(this._path,"-").concat(C.createPage(this._meta.numPages)),!0),U.delete(y)),(null===(E=U.transaction)||void 0===E?void 0:E.commit)&&(null===(R=U.transaction)||void 0===R||R.commit()),U.transaction.onerror=function(){Q(U.transaction.error)},U.transaction.oncomplete=function(){J._meta=G,J.seek(0,2),g()};case 23:case"end":return B.stop()}}),B,this)})))})));case 1:case"end":return g.stop()}}),g)})))}},{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 C=new Error("EOF");throw C.name="EndOfFile",C}var g;if(0===I)g=Math.min(A,this._meta.size);else if(1===I){var B=this._pageSize*this._pagePtr+this._pageOffset;g=Math.min(B+A,this._meta.size)}else{if(2!==I)throw new Error("Invalid operation: ".concat(I,"."));g=Math.min(this._meta.size+A,this._meta.size)}this._pageOffset=g%this._pageSize,this._pagePtr=Math.floor(g/this._pageSize),this._cache.clear()}},{key:"tell",value:function(){return this.exists()?this._pagePtr*this._pageSize+this._pageOffset:-1}},{key:"remove",value:function(){return p(this,void 0,void 0,e.mark((function A(){var I=this;return e.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.abrupt("return",new Promise((function(A,g){return p(I,void 0,void 0,e.mark((function I(){var B,Q,E,R,U=this;return e.wrap((function(I){for(;;)switch(I.prev=I.next){case 0:if(this.exists()){I.next=3;break}return g(new Error("ENOENT")),I.abrupt("return");case 3:B=this._meta.numPages,Q=IDBKeyRange.bound(this._path,"".concat(this._path,"-").concat(C.createPage(B))),E=this._store,(R=E.delete(Q)).onerror=function(){g(R.error)},R.onsuccess=function(){U._meta=void 0,U._pageOffset=0,U._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(IA,this._mode).objectStore(IA)}}],[{key:"open",value:function(A,I){var g=this;if(!self.indexedDB){var B=new Error("IndexedDB is not supported");throw B.name="IndexedDBNotSupported",B}return new Promise((function(B,Q){return p(g,void 0,void 0,e.mark((function g(){var E,R,U;return e.wrap((function(g){for(;;)switch(g.prev=g.next){case 0:return g.prev=0,g.next=3,new Promise((function(A,I){var C=self.indexedDB.open("pv_db",3);C.onerror=function(){I(C.error)},C.onsuccess=function(){A(C.result)},C.onupgradeneeded=function(){C.result.objectStoreNames.contains(IA)||C.result.createObjectStore(IA)}}));case 3:E=g.sent,(R=E.transaction(IA,"readwrite").objectStore(IA).get(A)).onerror=function(){Q(R.error)},R.onsuccess=function(){var g=R.result,U=I.includes("r")?"readonly":"readwrite";if(void 0===g&&"readonly"===U){var w=new Error("'".concat(A,"' doesn't exist."));return w.name="FileNotExists",void Q(w)}var F=new C(A,g,E,U);I.includes("a")&&F.seek(0,2),B(F)},g.next=12;break;case 9:g.prev=9,g.t0=g.catch(0),"InvalidStateError"===g.t0.name?((U=new Error("IndexedDB is not supported")).name="IndexedDBNotSupported",Q(U)):Q(g.t0);case 12:case"end":return g.stop()}}),g,null,[[0,9]])})))}))}},{key:"createPage",value:function(A){return("00000"+A).slice(-6)}}]),C}($);function BA(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 C,g=z(A);if(I){var B=z(this).constructor;C=Reflect.construct(g,arguments,B)}else C=g.apply(this,arguments);return x(this,C)}}var QA=function(A){P(C,A);var I=BA(C);function C(A,g,B,Q){var E;return r(this,C),(E=I.call(this))._pos=0,E._path=A,E._meta=g,E._mode=Q,E}return _(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 C=new Error("EOF");throw C.name="EndOfFile",C}var g=Math.min(A*I,this._file.length-this._pos),B=g-g%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 C=new Error("EOF");throw C.name="EndOfFile",C}var g;if(0===I)g=Math.min(A,this._file.length);else if(1===I)g=Math.min(this._pos+A,this._file.length);else{if(2!==I)throw new Error("Invalid operation: ".concat(I,"."));g=Math.min(this._file.length+A,this._file.length)}this._pos=g}},{key:"tell",value:function(){return this.exists()?this._pos:-1}},{key:"remove",value:function(){return p(this,void 0,void 0,e.mark((function A(){return e.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:if(this.exists()){A.next=2;break}throw new Error("ENOENT");case 2:C._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 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 EA(A,I){for(var C=I;0!==A[C];)C++;return new TextDecoder("utf-8").decode(A.slice(I,C))}function RA(A){for(var I=atob(A),C=new Uint8Array(I.length),g=0;g<I.length;g++)C[g]=I.charCodeAt(g);return C}function UA(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 wA(A,I){return p(this,void 0,void 0,e.mark((function C(){var g;return e.wrap((function(C){for(;;)switch(C.prev=C.next){case 0:return C.prev=0,C.next=3,gA.open(A,I);case 3:return C.abrupt("return",C.sent);case 6:if(C.prev=6,C.t0=C.catch(0),"IndexedDBNotSupported"===C.t0.name?console.warn("IndexedDB is not supported. Fallback to in-memory storage."):"FileNotExists"!==C.t0.name&&console.warn("Unable to access IndexedDB (".concat(C.t0.toString(),"). Fallback to in-memory storage.")),!("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope)){C.next=16;break}if("FileNotExists"!==C.t0.name){C.next=12;break}throw C.t0;case 12:throw console.error("In-memory storage cannot be used inside a worker."),(g=new Error("Failed to start PvFile: ".concat(C.t0.toString()))).name="PvFileNotSupported",g;case 16:return C.abrupt("return",QA.open(A,I));case 17:case"end":return C.stop()}}),C,null,[[0,6]])})))}function FA(A,I,C,g){return p(this,void 0,void 0,e.mark((function B(){var Q;return e.wrap((function(B){for(;;)switch(B.prev=B.next){case 0:return B.next=2,wA(A,"w");case 2:if(Q=B.sent,!(C||void 0===Q.meta||g>Q.meta.version||Q.meta.pageSize!==Q.pageSize)){B.next=6;break}return B.next=6,Q.write(RA(I),g);case 6:case"end":return B.stop()}}),B)})))}QA._memFiles=new Map;var iA=5e3,DA=2;function GA(A,I,C,g,B){return p(this,void 0,void 0,e.mark((function Q(){var E,R,U,w,F,i,D,G;return e.wrap((function(Q){for(;;)switch(Q.prev=Q.next){case 0:return Q.next=2,wA(A,"w");case 2:if(E=Q.sent,!(C||void 0===E.meta||g>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=DA,U=function(A){return new Promise((function(I){setTimeout(I,A)}))},w=B+1,F=null;case 10:if(!(w>0)){Q.next=38;break}return F=null,Q.prev=12,Q.next=15,fetch(I,{cache:"no-cache"});case 15:if(!(i=Q.sent).ok){Q.next=23;break}return Q.next=19,i.arrayBuffer();case 19:return D=Q.sent,Q.next=22,E.write(new Uint8Array(D),g);case 22:return Q.abrupt("return");case 23:return Q.next=25,i.text();case 25:G=Q.sent,F=new Error("Error response returned while fetching model from '".concat(I,"': ").concat(G)),Q.next=32;break;case 29:Q.prev=29,Q.t0=Q.catch(12),F=new Error("Failed to fetch model from '".concat(I,"': ").concat(Q.t0.message));case 32:return w--,Q.next=35,U(R);case 35:R=Math.min(iA,R*DA),Q.next=10;break;case 38:if(null===F){Q.next=42;break}throw F;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 MA(A){return p(this,void 0,void 0,e.mark((function I(){var C,g,B,Q,E,R,U,w,F;return e.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(C=A.base64,g=A.publicPath,B=A.customWritePath,Q=A.forceWrite,E=void 0!==Q&&Q,R=A.version,U=void 0===R?1:R,w=A.numFetchRetries,F=void 0===w?0:w,null!=B){I.next=5;break}throw new Error("The customWritePath of the provided model is undefined / empty");case 5:if(null==C){I.next=10;break}return I.next=8,FA(B,C,E,U);case 8:case 13:I.next=16;break;case 10:if(null==g){I.next=15;break}return I.next=13,GA(B,g,E,U,F);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 oA(A,I){(null==I||I>A.length)&&(I=A.length);for(var C=0,g=new Array(I);C<I;C++)g[C]=A[C];return g}function yA(A,I){if(A){if("string"==typeof A)return oA(A,I);var C=Object.prototype.toString.call(A).slice(8,-1);return"Object"===C&&A.constructor&&(C=A.constructor.name),"Map"===C||"Set"===C?Array.from(A):"Arguments"===C||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(C)?oA(A,I):void 0}}function JA(A,I){return function(A){if(Array.isArray(A))return A}(A)||function(A,I){var C=null==A?null:"undefined"!=typeof Symbol&&A[Symbol.iterator]||A["@@iterator"];if(null!=C){var g,B,Q,E,R=[],U=!0,w=!1;try{if(Q=(C=C.call(A)).next,0===I){if(Object(C)!==C)return;U=!1}else for(;!(U=(g=Q.call(C)).done)&&(R.push(g.value),R.length!==I);U=!0);}catch(A){w=!0,B=A}finally{try{if(!U&&null!=C.return&&(E=C.return(),Object(E)!==E))return}finally{if(w)throw B}}return R}}(A,I)||yA(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.")}()}var cA,hA,lA,sA=(hA="undefined"!=typeof document?null===(cA=document.currentScript)||void 0===cA?void 0:cA.src:void 0,function(){var A,I,C=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},g=new Promise((function(C,g){A=C,I=g})),B="object"==("undefined"==typeof window?"undefined":h(window)),Q="function"==typeof importScripts;function E(A){return E="function"==typeof Symbol&&"symbol"==h(Symbol.iterator)?function(A){return h(A)}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":h(A)},E(A)}function R(A){var I=function(A,I){if("object"!=E(A)||!A)return A;var C=A[Symbol.toPrimitive];if(void 0!==C){var g=C.call(A,I||"default");if("object"!=E(g))return g;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===I?String:Number)(A)}(A,"string");return"symbol"==E(I)?I:I+""}function U(A,I,C){return(I=R(I))in A?Object.defineProperty(A,I,{value:C,enumerable:!0,configurable:!0,writable:!0}):A[I]=C,A}function w(A,I,C,g,B,Q,E){try{var R=A[Q](E),U=R.value}catch(A){return void C(A)}R.done?I(U):Promise.resolve(U).then(g,B)}function F(A){return function(){var I=this,C=arguments;return new Promise((function(g,B){var Q=A.apply(I,C);function E(A){w(Q,g,B,E,R,"next",A)}function R(A){w(Q,g,B,E,R,"throw",A)}E(void 0)}))}}function i(A){return A&&A.__esModule&&Object.prototype.hasOwnProperty.call(A,"default")?A.default:A}"object"==("undefined"==typeof process?"undefined":h(process))&&"object"==h(process.versions)&&process.versions.node;var D={exports:{}},G={exports:{}};!function(A){function I(C){return A.exports=I="function"==typeof Symbol&&"symbol"==h(Symbol.iterator)?function(A){return h(A)}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":h(A)},A.exports.__esModule=!0,A.exports.default=A.exports,I(C)}A.exports=I,A.exports.__esModule=!0,A.exports.default=A.exports}(G);var M=G.exports;i(M),function(A){var I=M.default;function C(){A.exports=C=function(){return B},A.exports.__esModule=!0,A.exports.default=A.exports;var g,B={},Q=Object.prototype,E=Q.hasOwnProperty,R=Object.defineProperty||function(A,I,C){A[I]=C.value},U="function"==typeof Symbol?Symbol:{},w=U.iterator||"@@iterator",F=U.asyncIterator||"@@asyncIterator",i=U.toStringTag||"@@toStringTag";function D(A,I,C){return Object.defineProperty(A,I,{value:C,enumerable:!0,configurable:!0,writable:!0}),A[I]}try{D({},"")}catch(g){D=function(A,I,C){return A[I]=C}}function G(A,I,C,g){var B=I&&I.prototype instanceof l?I:l,Q=Object.create(B.prototype),E=new V(g||[]);return R(Q,"_invoke",{value:j(A,C,E)}),Q}function M(A,I,C){try{return{type:"normal",arg:A.call(I,C)}}catch(A){return{type:"throw",arg:A}}}B.wrap=G;var o="suspendedStart",y="suspendedYield",J="executing",c="completed",h={};function l(){}function s(){}function N(){}var Y={};D(Y,w,(function(){return this}));var S=Object.getPrototypeOf,Z=S&&S(S(b([])));Z&&Z!==Q&&E.call(Z,w)&&(Y=Z);var k=N.prototype=l.prototype=Object.create(Y);function K(A){["next","throw","return"].forEach((function(I){D(A,I,(function(A){return this._invoke(I,A)}))}))}function H(A,C){function g(B,Q,R,U){var w=M(A[B],A,Q);if("throw"!==w.type){var F=w.arg,i=F.value;return i&&"object"==I(i)&&E.call(i,"__await")?C.resolve(i.__await).then((function(A){g("next",A,R,U)}),(function(A){g("throw",A,R,U)})):C.resolve(i).then((function(A){F.value=A,R(F)}),(function(A){return g("throw",A,R,U)}))}U(w.arg)}var B;R(this,"_invoke",{value:function(A,I){function Q(){return new C((function(C,B){g(A,I,C,B)}))}return B=B?B.then(Q,Q):Q()}})}function j(A,I,C){var B=o;return function(Q,E){if(B===J)throw Error("Generator is already running");if(B===c){if("throw"===Q)throw E;return{value:g,done:!0}}for(C.method=Q,C.arg=E;;){var R=C.delegate;if(R){var U=L(R,C);if(U){if(U===h)continue;return U}}if("next"===C.method)C.sent=C._sent=C.arg;else if("throw"===C.method){if(B===o)throw B=c,C.arg;C.dispatchException(C.arg)}else"return"===C.method&&C.abrupt("return",C.arg);B=J;var w=M(A,I,C);if("normal"===w.type){if(B=C.done?c:y,w.arg===h)continue;return{value:w.arg,done:C.done}}"throw"===w.type&&(B=c,C.method="throw",C.arg=w.arg)}}}function L(A,I){var C=I.method,B=A.iterator[C];if(B===g)return I.delegate=null,"throw"===C&&A.iterator.return&&(I.method="return",I.arg=g,L(A,I),"throw"===I.method)||"return"!==C&&(I.method="throw",I.arg=new TypeError("The iterator does not provide a '"+C+"' method")),h;var Q=M(B,A.iterator,I.arg);if("throw"===Q.type)return I.method="throw",I.arg=Q.arg,I.delegate=null,h;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=g),I.delegate=null,h):E:(I.method="throw",I.arg=ne