New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@picovoice/web-utils

Package Overview
Dependencies
Maintainers
6
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@picovoice/web-utils - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

.eslintrc.js

4

dist/esm/index.min.js

@@ -1,1 +0,3 @@

function t(t,r,e,n,o,a,i){try{var c=t[a](i),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function r(r){return function(){var e=this,n=arguments;return new Promise((function(o,a){var i=r.apply(e,n);function c(r){t(i,o,a,c,u,"next",r)}function u(r){t(i,o,a,c,u,"throw",r)}c(void 0)}))}}var e,n,o=(e=function(t){var r=function(t){var r,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{u({},"")}catch(t){u=function(t,r,e){return t[r]=e}}function s(t,r,e,n){var o=r&&r.prototype instanceof _?r:_,a=Object.create(o.prototype),i=new A(n||[]);return a._invoke=function(t,r,e){var n=l;return function(o,a){if(n===h)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw a;return I()}for(e.method=o,e.arg=a;;){var i=e.delegate;if(i){var c=L(i,e);if(c){if(c===v)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===l)throw n=y,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=h;var u=f(t,r,e);if("normal"===u.type){if(n=e.done?y:p,u.arg===v)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n=y,e.method="throw",e.arg=u.arg)}}}(t,e,i),a}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var l="suspendedStart",p="suspendedYield",h="executing",y="completed",v={};function _(){}function d(){}function E(){}var g={};u(g,a,(function(){return this}));var m=Object.getPrototypeOf,w=m&&m(m(k([])));w&&w!==e&&n.call(w,a)&&(g=w);var b=E.prototype=_.prototype=Object.create(g);function x(t){["next","throw","return"].forEach((function(r){u(t,r,(function(t){return this._invoke(r,t)}))}))}function T(t,r){function e(o,a,i,c){var u=f(t[o],t,a);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?r.resolve(l.__await).then((function(t){e("next",t,i,c)}),(function(t){e("throw",t,i,c)})):r.resolve(l).then((function(t){s.value=t,i(s)}),(function(t){return e("throw",t,i,c)}))}c(u.arg)}var o;this._invoke=function(t,n){function a(){return new r((function(r,o){e(t,n,r,o)}))}return o=o?o.then(a,a):a()}}function L(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,L(t,e),"throw"===e.method))return v;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,v;var a=o.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,v):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function S(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function P(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function k(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function e(){for(;++o<t.length;)if(n.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=r,e.done=!0,e};return i.next=i}}return{next:I}}function I(){return{value:r,done:!0}}return d.prototype=E,u(b,"constructor",E),u(E,"constructor",d),d.displayName=u(E,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===d||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,u(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},x(T.prototype),u(T.prototype,i,(function(){return this})),t.AsyncIterator=T,t.async=function(r,e,n,o,a){void 0===a&&(a=Promise);var i=new T(s(r,e,n,o),a);return t.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},x(b),u(b,c,"Generator"),u(b,a,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=k,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(P),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(n,o){return c.type="throw",c.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var u=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(u&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=r&&r<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=r,a?(this.method="next",this.next=a.finallyLoc,v):this.complete(i)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),v},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),P(e),v}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;P(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),v}},t}(t.exports);try{regeneratorRuntime=r}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},e(n={exports:{}},n.exports),n.exports);const a=new WeakMap;function i(t,r){return new Proxy(t,{get:(t,e)=>r(t[e])})}class c{constructor(){this.value=void 0,this.exports=null}getState(){return this.exports.asyncify_get_state()}assertNoneState(){let t=this.getState();if(0!==t)throw new Error(`Invalid async state ${t}, expected 0.`)}wrapImportFn(t){return(...r)=>{if(2===this.getState())return this.exports.asyncify_stop_rewind(),this.value;this.assertNoneState();let e=t(...r);if(!(n=e)||"object"!=typeof n&&"function"!=typeof n||"function"!=typeof n.then)return e;var n;this.exports.asyncify_start_unwind(16),this.value=e}}wrapModuleImports(t){return i(t,(t=>"function"==typeof t?this.wrapImportFn(t):t))}wrapImports(t){if(void 0!==t)return i(t,((t=Object.create(null))=>this.wrapModuleImports(t)))}wrapExportFn(t){let r=a.get(t);return void 0!==r||(r=async(...r)=>{this.assertNoneState();let e=t(...r);for(;1===this.getState();)this.exports.asyncify_stop_unwind(),this.value=await this.value,this.assertNoneState(),this.exports.asyncify_start_rewind(16),e=t();return this.assertNoneState(),e},a.set(t,r)),r}wrapExports(t){let r=Object.create(null);for(let e in t){let n=t[e];"function"!=typeof n||e.startsWith("asyncify_")||(n=this.wrapExportFn(n)),Object.defineProperty(r,e,{enumerable:!0,value:n})}return a.set(t,r),r}init(t,r){const{exports:e}=t,n=e.memory||r.env&&r.env.memory;new Int32Array(n.buffer,16).set([24,1024]),this.exports=this.wrapExports(e),Object.setPrototypeOf(t,u.prototype)}}class u extends WebAssembly.Instance{constructor(t,r){let e=new c;super(t,e.wrapImports(r)),e.init(this,r)}get exports(){return a.get(super.exports)}}async function s(t,r){let e=new c,n=await WebAssembly.instantiate(t,e.wrapImports(r));return e.init(n instanceof WebAssembly.Instance?n:n.instance,r),n}function f(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function l(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function p(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?l(Object(e),!0).forEach((function(r){f(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):l(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}function h(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=function(t,r){if(!t)return;if("string"==typeof t)return y(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)return Array.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return y(t,r)}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,c=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return i=t.done,t},e:function(t){c=!0,a=t},f:function(){try{i||null==e.return||e.return()}finally{if(c)throw a}}}}function y(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}Object.defineProperty(u.prototype,"exports",{enumerable:!0});function v(){return new Promise((function(t,r){var e=self.indexedDB.open("pv_db",1);e.onerror=function(){r(e.error)},e.onsuccess=function(){t(e.result)},e.onupgradeneeded=function(){e.result.createObjectStore("pv_store")}}))}function _(){if(self.indexedDB){var t=function(t){return new Promise((function(r,e){t.onerror=function(){e(t.error)},t.onsuccess=function(){r(t.result)}}))};return{setItem:(a=r(o.mark((function r(e,n){var a,i;return o.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,v();case 2:return a=r.sent,i=a.transaction("pv_store","readwrite").objectStore("pv_store").put(n,e),r.next=6,t(i);case 6:a.close();case 7:case"end":return r.stop()}}),r)}))),function(t,r){return a.apply(this,arguments)}),getItem:(n=r(o.mark((function r(e){var n,a,i;return o.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,v();case 2:return n=r.sent,a=n.transaction("pv_store","readonly").objectStore("pv_store").get(e),r.next=6,t(a);case 6:return i=r.sent,n.close(),r.abrupt("return",i);case 9:case"end":return r.stop()}}),r)}))),function(t){return n.apply(this,arguments)}),removeItem:(e=r(o.mark((function r(e){var n,a;return o.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,v();case 2:return n=r.sent,a=n.transaction("pv_store","readwrite").objectStore("pv_store").delete(e),r.next=6,t(a);case 6:n.close();case 7:case"end":return r.stop()}}),r)}))),function(t){return e.apply(this,arguments)})}}if(self.localStorage)return self.localStorage;var e,n,a;throw new Error("Cannot get a presistent storage object.")}function d(t,r){for(var e=r;0!==t[e];)e++;return new TextDecoder("utf-8").decode(t.subarray(r,e))}function E(t){for(var r=atob(t),e=new Uint8Array(r.length),n=0;n<r.length;n++)e[n]=r.charCodeAt(n);return e}function g(t,r,e){for(var n="",o=0;o<r;o++)n+=String.fromCharCode(t[e+o]);return btoa(n)}function m(t){var r,e={},n=h(t.split("\r\n"));try{for(n.s();!(r=n.n()).done;){var o=r.value.split(": ");""!==o[0]&&(e[o[0]]=o[1])}}catch(t){n.e(t)}finally{n.f()}return e}function w(t){return b.apply(this,arguments)}function b(){return b=r(o.mark((function t(r){var e,n,a,i,c,u,s=arguments;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=s.length>1&&void 0!==s[1]?s[1]:{},n=s.length>2&&void 0!==s[2]?s[2]:5e3,a=new AbortController,i=p(p({},e),{},{signal:a.signal}),c=setTimeout((function(){a.abort()}),n),t.next=7,fetch(r,i);case 7:return u=t.sent,clearTimeout(c),t.abrupt("return",u);case 10:case"end":return t.stop()}}),t)}))),b.apply(this,arguments)}function x(t){if("string"!=typeof t||null==t)return!1;var r=t.trim();if(""===r)return!1;try{return btoa(atob(r))===r}catch(t){return!1}}var T={args_get:function(t){return 0},args_sizes_get:function(t){return 0},environ_get:function(t){return 0},environ_sizes_get:function(t){return 0},clock_res_get:function(t){return 0},clock_time_get:function(t){return 0},fd_advise:function(t){return 0},fd_allocate:function(t){return 0},fd_close:function(t){return 0},fd_datasync:function(t){return 0},fd_fdstat_get:function(t){return 0},fd_fdstat_set_flags:function(t){return 0},fd_fdstat_set_rights:function(t){return 0},fd_filestat_get:function(t){return 0},fd_filestat_set_size:function(t){return 0},fd_filestat_set_times:function(t){return 0},fd_pread:function(t){return 0},fd_prestat_get:function(t){return 0},fd_prestat_dir_name:function(t){return 0},fd_pwrite:function(t){return 0},fd_read:function(t){return 0},fd_readdir:function(t){return 0},fd_renumber:function(t){return 0},fd_seek:function(t){return 0},fd_sync:function(t){return 0},fd_tell:function(t){return 0},fd_write:function(t){return 0},path_create_directory:function(t){return 0},path_filestat_get:function(t){return 0},path_filestat_set_times:function(t){return 0},path_link:function(t){return 0},path_open:function(t){return 0},path_readlink:function(t){return 0},path_remove_directory:function(t){return 0},path_rename:function(t){return 0},path_symlink:function(t){return 0},path_unlink_file:function(t){return 0},poll_oneoff:function(t){return 0},proc_exit:function(t){return 0},proc_raise:function(t){return 0},sched_yield:function(t){return 0},random_get:function(t){return 0},sock_recv:function(t){return 0},sock_send:function(t){return 0},sock_shutdown:function(t){return 0}};function L(t,r){return S.apply(this,arguments)}function S(){return S=r(o.mark((function t(e,n){var a,i,c,u,f,l,p,h,y,v,b,x,L,S,P,A,k,I;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=new Uint8Array(e.buffer),i=new Int32Array(e.buffer),c=_(),u=function(t){console.log(d(a,t))},f=function(t,r,e){if(0===t){var n=d(a,e);throw new Error("assertion failed at line ".concat(r,' in "').concat(n,'"'))}},l=function(){return Date.now()/1e3},p=function(){var t=r(o.mark((function t(r,e,n,c,u,s,f,l,p){var h,y,v,_,E,g,b,x,T,L,S;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return h=d(a,r),y=d(a,e),v=d(a,n),_=d(a,c),E=d(a,u),g=m(_),t.prev=6,t.next=9,w("https://"+y+v,{method:h,headers:g,body:E},s);case 9:b=t.sent,T=b.status,t.next=16;break;case 13:t.prev=13,t.t0=t.catch(6),T=0;case 16:if(void 0===b){t.next=36;break}return t.prev=17,t.next=20,b.text();case 20:x=t.sent,t.next=27;break;case 23:t.prev=23,t.t1=t.catch(17),x="",T=1;case 27:return t.next=29,I(Int8Array.BYTES_PER_ELEMENT,(x.length+1)*Int8Array.BYTES_PER_ELEMENT);case 29:if(0!==(L=t.sent)){t.next=32;break}throw new Error("malloc failed: Cannot allocate memory");case 32:for(i[l/Int32Array.BYTES_PER_ELEMENT]=x.length+1,i[f/Int32Array.BYTES_PER_ELEMENT]=L,S=0;S<x.length;S++)a[L+S]=x.charCodeAt(S);a[L+x.length]=0;case 36:i[p/Int32Array.BYTES_PER_ELEMENT]=T;case 37:case"end":return t.stop()}}),t,null,[[6,13],[17,23]])})));return function(r,e,n,o,a,i,c,u,s){return t.apply(this,arguments)}}(),h=function(){var t=r(o.mark((function t(r,e,n,u){var s,f,l,p;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=d(a,r),t.prev=1,t.next=4,c.getItem(s);case 4:return f=t.sent,l=E(f),t.next=8,I(Uint8Array.BYTES_PER_ELEMENT,l.length*Uint8Array.BYTES_PER_ELEMENT);case 8:if(0!==(p=t.sent)){t.next=11;break}throw new Error("malloc failed: Cannot allocate memory");case 11:i[e/Int32Array.BYTES_PER_ELEMENT]=l.byteLength,i[n/Int32Array.BYTES_PER_ELEMENT]=p,a.set(l,p),i[u/Int32Array.BYTES_PER_ELEMENT]=1,t.next=20;break;case 17:t.prev=17,t.t0=t.catch(1),i[u/Int32Array.BYTES_PER_ELEMENT]=0;case 20:case"end":return t.stop()}}),t,null,[[1,17]])})));return function(r,e,n,o){return t.apply(this,arguments)}}(),y=function(){var t=r(o.mark((function t(r,e,n,u){var s,f;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=d(a,r),f=g(a,e,n),t.prev=2,t.next=5,c.setItem(s,f);case 5:i[u/Int32Array.BYTES_PER_ELEMENT]=1,t.next=11;break;case 8:t.prev=8,t.t0=t.catch(2),i[u/Int32Array.BYTES_PER_ELEMENT]=0;case 11:case"end":return t.stop()}}),t,null,[[2,8]])})));return function(r,e,n,o){return t.apply(this,arguments)}}(),v=function(){var t=r(o.mark((function t(r,e,n){var u,s;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=d(a,r),t.prev=1,t.next=4,c.getItem(u);case 4:s=t.sent,a[e]=null==s?0:1,i[n/Int32Array.BYTES_PER_ELEMENT]=1,t.next=12;break;case 9:t.prev=9,t.t0=t.catch(1),i[n/Int32Array.BYTES_PER_ELEMENT]=0;case 12:case"end":return t.stop()}}),t,null,[[1,9]])})));return function(r,e,n){return t.apply(this,arguments)}}(),b=function(){var t=r(o.mark((function t(r,e){var n;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=d(a,r),t.prev=1,t.next=4,c.removeItem(n);case 4:i[e/Int32Array.BYTES_PER_ELEMENT]=1,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),i[e/Int32Array.BYTES_PER_ELEMENT]=0;case 10:case"end":return t.stop()}}),t,null,[[1,7]])})));return function(r,e){return t.apply(this,arguments)}}(),x=function(){var t=r(o.mark((function t(r){var e,n,c;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=void 0!==navigator.userAgent?navigator.userAgent:"unknown",t.next=3,I(Uint8Array.BYTES_PER_ELEMENT,(e.length+1)*Uint8Array.BYTES_PER_ELEMENT);case 3:if(0!==(n=t.sent)){t.next=6;break}throw new Error("malloc failed: Cannot allocate memory");case 6:for(i[r/Int32Array.BYTES_PER_ELEMENT]=n,c=0;c<e.length;c++)a[n+c]=e.charCodeAt(c);a[n+e.length]=0;case 9:case"end":return t.stop()}}),t)})));return function(r){return t.apply(this,arguments)}}(),L=function(){var t=r(o.mark((function t(r){var e,n,c,u;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=null!==(e=self.origin)&&void 0!==e?e:self.location.origin,t.next=3,I(Uint8Array.BYTES_PER_ELEMENT,(n.length+1)*Uint8Array.BYTES_PER_ELEMENT);case 3:if(0!==(c=t.sent)){t.next=6;break}throw new Error("malloc failed: Cannot allocate memory");case 6:for(i[r/Int32Array.BYTES_PER_ELEMENT]=c,u=0;u<n.length;u++)a[c+u]=n.charCodeAt(u);a[c+n.length]=0;case 9:case"end":return t.stop()}}),t)})));return function(r){return t.apply(this,arguments)}}(),S={wasi_snapshot_preview1:T,env:{memory:e,pv_console_log_wasm:u,pv_assert_wasm:f,pv_time_wasm:l,pv_https_request_wasm:p,pv_file_load_wasm:h,pv_file_save_wasm:y,pv_file_exists_wasm:v,pv_file_delete_wasm:b,pv_get_browser_info:x,pv_get_origin_info:L}},P=E(n),t.next=17,s(P,S);case 17:return A=t.sent,k=A.instance,I=k.exports.aligned_alloc,t.abrupt("return",k.exports);case 21:case"end":return t.stop()}}),t)}))),S.apply(this,arguments)}export{g as arrayBufferToBase64AtIndex,d as arrayBufferToStringAtIndex,E as base64ToUint8Array,L as buildWasm,w as fetchWithTimeout,_ as getPvStorage,x as isAccessKeyValid,m as stringHeaderToObject};
function t(t,e,r,n,o,a,i){try{var s=t[a](i),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function e(e){return function(){var r=this,n=arguments;return new Promise((function(o,a){var i=e.apply(r,n);function s(e){t(i,o,a,s,c,"next",e)}function c(e){t(i,o,a,s,c,"throw",e)}s(void 0)}))}}function r(t){var e={exports:{}};return t(e,e.exports),e.exports}var n=r((function(t){function e(r){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports})),o=r((function(t){var e=n.default;function r(){
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
t.exports=r=function(){return n},t.exports.__esModule=!0,t.exports.default=t.exports;var n={},o=Object.prototype,a=o.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var o=e&&e.prototype instanceof v?e:v,a=Object.create(o.prototype),i=new k(n||[]);return a._invoke=function(t,e,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return I()}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var s=b(i,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=l(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,i),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}n.wrap=p;var h={};function v(){}function _(){}function d(){}var y={};f(y,s,(function(){return this}));var m=Object.getPrototypeOf,E=m&&m(m(T([])));E&&E!==o&&a.call(E,s)&&(y=E);var w=d.prototype=v.prototype=Object.create(y);function g(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,r){function n(o,i,s,c){var u=l(t[o],t,i);if("throw"!==u.type){var f=u.arg,p=f.value;return p&&"object"==e(p)&&a.call(p,"__await")?r.resolve(p.__await).then((function(t){n("next",t,s,c)}),(function(t){n("throw",t,s,c)})):r.resolve(p).then((function(t){f.value=t,s(f)}),(function(t){return n("throw",t,s,c)}))}c(u.arg)}var o;this._invoke=function(t,e){function a(){return new r((function(r,o){n(t,e,r,o)}))}return o=o?o.then(a,a):a()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=l(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function T(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(a.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:I}}function I(){return{value:void 0,done:!0}}return _.prototype=d,f(w,"constructor",d),f(d,"constructor",_),_.displayName=f(d,u,"GeneratorFunction"),n.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===_||"GeneratorFunction"===(e.displayName||e.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,f(t,u,"GeneratorFunction")),t.prototype=Object.create(w),t},n.awrap=function(t){return{__await:t}},g(x.prototype),f(x.prototype,c,(function(){return this})),n.AsyncIterator=x,n.async=function(t,e,r,o,a){void 0===a&&(a=Promise);var i=new x(p(t,e,r,o),a);return n.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},g(w),f(w,u,"Generator"),f(w,s,(function(){return this})),f(w,"toString",(function(){return"[object Generator]"})),n.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},n.values=T,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!t)for(var e in this)"t"===e.charAt(0)&&a.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return i.type="throw",i.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=a.call(o,"catchLoc"),c=a.call(o,"finallyLoc");if(s&&c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:T(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},n}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}))();const a=new WeakMap;function i(t,e){return new Proxy(t,{get:(t,r)=>e(t[r])})}class s{constructor(){this.value=void 0,this.exports=null}getState(){return this.exports.asyncify_get_state()}assertNoneState(){let t=this.getState();if(0!==t)throw new Error(`Invalid async state ${t}, expected 0.`)}wrapImportFn(t){return(...e)=>{if(2===this.getState())return this.exports.asyncify_stop_rewind(),this.value;this.assertNoneState();let r=t(...e);if(!(n=r)||"object"!=typeof n&&"function"!=typeof n||"function"!=typeof n.then)return r;var n;this.exports.asyncify_start_unwind(16),this.value=r}}wrapModuleImports(t){return i(t,(t=>"function"==typeof t?this.wrapImportFn(t):t))}wrapImports(t){if(void 0!==t)return i(t,((t=Object.create(null))=>this.wrapModuleImports(t)))}wrapExportFn(t){let e=a.get(t);return void 0!==e||(e=async(...e)=>{this.assertNoneState();let r=t(...e);for(;1===this.getState();)this.exports.asyncify_stop_unwind(),this.value=await this.value,this.assertNoneState(),this.exports.asyncify_start_rewind(16),r=t();return this.assertNoneState(),r},a.set(t,e)),e}wrapExports(t){let e=Object.create(null);for(let r in t){let n=t[r];"function"!=typeof n||r.startsWith("asyncify_")||(n=this.wrapExportFn(n)),Object.defineProperty(e,r,{enumerable:!0,value:n})}return a.set(t,e),e}init(t,e){const{exports:r}=t,n=r.memory||e.env&&e.env.memory;new Int32Array(n.buffer,16).set([24,1024]),this.exports=this.wrapExports(r),Object.setPrototypeOf(t,c.prototype)}}class c extends WebAssembly.Instance{constructor(t,e){let r=new s;super(t,r.wrapImports(e)),r.init(this,e)}get exports(){return a.get(super.exports)}}async function u(t,e){let r=new s,n=await WebAssembly.instantiate(t,r.wrapImports(e));return r.init(n instanceof WebAssembly.Instance?n:n.instance,e),n}async function f(t,e){let r=new s,n=await WebAssembly.instantiateStreaming(t,r.wrapImports(e));return r.init(n.instance,e),n}function p(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function l(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function h(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?l(Object(r),!0).forEach((function(e){p(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function v(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return _(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return i=t.done,t},e:function(t){s=!0,a=t},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw a}}}}function _(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}Object.defineProperty(c.prototype,"exports",{enumerable:!0});function d(){return new Promise((function(t,e){var r=self.indexedDB.open("pv_db",2);r.onerror=function(){e(r.error)},r.onsuccess=function(){t(r.result)},r.onupgradeneeded=function(){r.result.objectStoreNames.contains("pv_store")||r.result.createObjectStore("pv_store"),r.result.objectStoreNames.contains("pv_file")||r.result.createObjectStore("pv_file")}}))}var y=function(t){return new Promise((function(e,r){t.onerror=function(){r(t.error)},t.onsuccess=function(){e(t.result)}}))};function m(){var t,r,n,a,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(self.indexedDB)return{setItem:(a=e(o.mark((function t(e,r){var n,a;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,d();case 2:return n=t.sent,a=n.transaction("pv_store","readwrite").objectStore("pv_store").put(r,e),t.next=6,y(a);case 6:n.close();case 7:case"end":return t.stop()}}),t)}))),function(t,e){return a.apply(this,arguments)}),getItem:(n=e(o.mark((function t(e){var r,n,a;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,d();case 2:return r=t.sent,n=r.transaction("pv_store","readonly").objectStore("pv_store").get(e),t.next=6,y(n);case 6:return a=t.sent,r.close(),t.abrupt("return",a);case 9:case"end":return t.stop()}}),t)}))),function(t){return n.apply(this,arguments)}),removeItem:(r=e(o.mark((function t(e){var r,n;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,d();case 2:return r=t.sent,n=r.transaction("pv_store","readwrite").objectStore("pv_store").delete(e),t.next=6,y(n);case 6:r.close();case 7:case"end":return t.stop()}}),t)}))),function(t){return r.apply(this,arguments)}),exists:(t=e(o.mark((function t(e){var r,n,a;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,d();case 2:return r=t.sent,n=r.transaction("pv_store","readonly").objectStore("pv_store").count(e),t.next=6,y(n);case 6:return a=t.sent,r.close(),t.abrupt("return",a>0);case 9:case"end":return t.stop()}}),t)}))),function(e){return t.apply(this,arguments)})};if(i)throw new Error("IndexedDB is required but not available.");if(self.localStorage){var s=self.localStorage,c=s.setItem,u=s.getItem,f=s.removeItem,p=function(t){return null!==u(t)};return{setItem:c,getItem:u,removeItem:f,exists:p}}throw new Error("Cannot get a persistent storage object.")}function E(t,e){for(var r=e;0!==t[r];)r++;return new TextDecoder("utf-8").decode(t.subarray(e,r))}function w(t){for(var e=atob(t),r=new Uint8Array(e.length),n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function g(t,e,r){for(var n="",o=0;o<e;o++)n+=String.fromCharCode(t[r+o]);return btoa(n)}function x(t){var e,r={},n=v(t.split("\r\n"));try{for(n.s();!(e=n.n()).done;){var o=e.value.split(": ");""!==o[0]&&(r[o[0]]=o[1])}}catch(t){n.e(t)}finally{n.f()}return r}function b(t){return P.apply(this,arguments)}function P(){return P=e(o.mark((function t(e){var r,n,a,i,s,c,u=arguments;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=u.length>1&&void 0!==u[1]?u[1]:{},n=u.length>2&&void 0!==u[2]?u[2]:5e3,a=new AbortController,i=h(h({},r),{},{signal:a.signal}),s=setTimeout((function(){a.abort()}),n),t.next=7,fetch(e,i);case 7:return c=t.sent,clearTimeout(s),t.abrupt("return",c);case 10:case"end":return t.stop()}}),t)}))),P.apply(this,arguments)}function S(t){if("string"!=typeof t||null==t)return!1;var e=t.trim();if(""===e)return!1;try{return btoa(atob(e))===e}catch(t){return!1}}function k(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var T=function(){function t(e,r,n,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),p(this,"_pageSize",65536),p(this,"_path",void 0),p(this,"_db",void 0),p(this,"_mode",void 0),p(this,"_meta",void 0),p(this,"_pagePtr",0),p(this,"_pageOffset",0),this._path=e,this._meta=r,this._db=n,this._mode=o}var r,n,a,i,s,c,u,f;return r=t,n=[{key:"close",value:(f=e(o.mark((function t(){return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this._db.close();case 1:case"end":return t.stop()}}),t,this)}))),function(){return f.apply(this,arguments)})},{key:"read",value:(u=e(o.mark((function e(r,n){var a=this;return o.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,o){if(void 0!==a._meta){if(a._isEOF){var i=new Error("EOF");return i.name="EndOfFile",void o(i)}var s=0,c=Math.min(r*n,a._meta.size),u=c-c%r,f=new Uint8Array(u),p=IDBKeyRange.bound("".concat(a._path,"-").concat(t.createPage(a._pagePtr)),"".concat(a._path,"-").concat(t.createPage(a._meta.numPages))),l=a._store,h=l.openCursor(p);h.onsuccess=function(){var t=h.result;if(t&&!a._isEOF){var e=Math.min(u-s,t.value.length-a._pageOffset);f.set(t.value.slice(a._pageOffset,a._pageOffset+e),s),s+=e,a._pageOffset+=e,a._pageOffset===a._pageSize&&(a._pagePtr+=1,a._pageOffset=0),s<u&&t.continue()}},l.transaction.onerror=function(){o(l.transaction.error)},l.transaction.oncomplete=function(){e(f.slice(0,s))}}else o(new Error("'".concat(a._path,"' doesn't exist.")))})));case 1:case"end":return e.stop()}}),e)}))),function(t,e){return u.apply(this,arguments)})},{key:"write",value:(c=e(o.mark((function e(r){var n=this;return o.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,o){if("readonly"!==n._mode){var a=n._store,i=Math.ceil(r.length/n._pageSize),s={size:r.length,numPages:i},c=function(){a.add(s,n._path);for(var e=0;e<i;e++)a.add(r.slice(e*n._pageSize,(e+1)*n._pageSize),"".concat(n._path,"-").concat(t.createPage(e)))};if(n._meta){var u=n._meta.numPages,f=IDBKeyRange.bound(n._path,"".concat(n._path,"-").concat(t.createPage(u)));a.delete(f).onsuccess=function(){return c()}}else c();a.transaction.onerror=function(){o(a.transaction.error)},a.transaction.oncomplete=function(){n._meta=s,e()}}else o(new Error("Instance is readonly mode only."))})));case 1:case"end":return e.stop()}}),e)}))),function(t){return c.apply(this,arguments)})},{key:"seek",value:function(t,e){if(void 0===this._meta)throw new Error("'".concat(this._path,"' doesn't exist."));if(t<0){var r=new Error("EOF");throw r.name="EndOfFile",r}var n;if(0===e)n=Math.min(t,this._meta.size);else if(1===e){var o=this._pageSize*this._pagePtr+this._pageOffset;n=Math.min(o+t,this._meta.size)}else{if(2!==e)throw new Error("Invalid operation: ".concat(e,"."));n=Math.min(this._meta.size+t,this._meta.size)}this._pageOffset=n%this._pageSize,this._pagePtr=Math.floor(n/this._pageSize)}},{key:"tell",value:function(){return this._pagePtr*this._pageSize+this._pageOffset}},{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("pv_file",this._mode).objectStore("pv_file")}}],a=[{key:"open",value:function(r,n){if(!self.indexedDB)throw new Error("IndexedDB is not supported");return new Promise(function(){var a=e(o.mark((function e(a,i){var s,c,u;return o.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d();case 2:s=e.sent,c=n.includes("r")?"readonly":"readwrite",(u=s.transaction("pv_file",c).objectStore("pv_file").get(r)).onerror=function(){i(u.error)},u.onsuccess=function(){void 0===u.result&&"readonly"===c?i("Instance is readonly mode but '".concat(r,"' doesn't exist.")):a(new t(r,u.result,s,c))};case 7:case"end":return e.stop()}}),e)})));return function(t,e){return a.apply(this,arguments)}}())}},{key:"remove",value:(s=e(o.mark((function r(n){var a=this;return o.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(self.indexedDB){r.next=2;break}throw new Error("IndexedDB is not supported");case 2:return r.abrupt("return",new Promise(function(){var r=e(o.mark((function e(r,i){var s,c,u,f,p;return o.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.open(n,"w");case 2:s=e.sent,c=s._meta.numPages,u=IDBKeyRange.bound(s._path,"".concat(s._path,"-").concat(t.createPage(c))),f=s._store,(p=f.delete(u)).onerror=function(){i(p.error)},p.onsuccess=function(){r()};case 9:case"end":return e.stop()}}),e)})));return function(t,e){return r.apply(this,arguments)}}()));case 3:case"end":return r.stop()}}),r)}))),function(t){return s.apply(this,arguments)})},{key:"exists",value:(i=e(o.mark((function t(e){var r;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(self.indexedDB){t.next=2;break}throw new Error("IndexedDB is not supported");case 2:return t.prev=2,t.next=5,this.open(e,"r");case 5:return r=t.sent,t.abrupt("return",void 0!==r._meta);case 9:return t.prev=9,t.t0=t.catch(2),t.abrupt("return",!1);case 12:case"end":return t.stop()}}),t,this,[[2,9]])}))),function(t){return i.apply(this,arguments)})},{key:"getPtr",value:function(e){return t._filePtrs.get(e)}},{key:"setPtr",value:function(e,r){t._filePtrs.set(e,r)}},{key:"removePtr",value:function(e){t._filePtrs.delete(e)}},{key:"createPage",value:function(t){return("000"+t).slice(-4)}}],n&&k(r.prototype,n),a&&k(r,a),Object.defineProperty(r,"prototype",{writable:!1}),t}();p(T,"_filePtrs",new Map);var I={args_get:function(t){return 0},args_sizes_get:function(t){return 0},environ_get:function(t){return 0},environ_sizes_get:function(t){return 0},clock_res_get:function(t){return 0},clock_time_get:function(t){return 0},fd_advise:function(t){return 0},fd_allocate:function(t){return 0},fd_close:function(t){return 0},fd_datasync:function(t){return 0},fd_fdstat_get:function(t){return 0},fd_fdstat_set_flags:function(t){return 0},fd_fdstat_set_rights:function(t){return 0},fd_filestat_get:function(t){return 0},fd_filestat_set_size:function(t){return 0},fd_filestat_set_times:function(t){return 0},fd_pread:function(t){return 0},fd_prestat_get:function(t){return 0},fd_prestat_dir_name:function(t){return 0},fd_pwrite:function(t){return 0},fd_read:function(t){return 0},fd_readdir:function(t){return 0},fd_renumber:function(t){return 0},fd_seek:function(t){return 0},fd_sync:function(t){return 0},fd_tell:function(t){return 0},fd_write:function(t){return 0},path_create_directory:function(t){return 0},path_filestat_get:function(t){return 0},path_filestat_set_times:function(t){return 0},path_link:function(t){return 0},path_open:function(t){return 0},path_readlink:function(t){return 0},path_remove_directory:function(t){return 0},path_rename:function(t){return 0},path_symlink:function(t){return 0},path_unlink_file:function(t){return 0},poll_oneoff:function(t){return 0},proc_exit:function(t){return 0},proc_raise:function(t){return 0},sched_yield:function(t){return 0},random_get:function(t){return 0},sock_recv:function(t){return 0},sock_send:function(t){return 0},sock_shutdown:function(t){return 0}};function L(t,e){return O.apply(this,arguments)}function O(){return O=e(o.mark((function t(r,n){var a,i,s,c,p,l,h,v,_,d,y,P,S,k,L,O,A,M,N,B,j,R,Y;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=new Uint8Array(r.buffer),i=new Int32Array(r.buffer),s=m(),c=function(t){console.log(E(a,t))},p=function(t,e,r){if(0===t){var n=E(a,r);throw new Error("assertion failed at line ".concat(e,' in "').concat(n,'"'))}},l=function(){return Date.now()/1e3},h=function(){var t=e(o.mark((function t(e,r,n,s,c,u,f,p,l){var h,v,_,d,y,m,w,g,P,S,k;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return h=E(a,e),v=E(a,r),_=E(a,n),d=E(a,s),y=E(a,c),m=x(d),t.prev=6,t.next=9,b("https://"+v+_,{method:h,headers:m,body:y},u);case 9:w=t.sent,P=w.status,t.next=16;break;case 13:t.prev=13,t.t0=t.catch(6),P=0;case 16:if(void 0===w){t.next=36;break}return t.prev=17,t.next=20,w.text();case 20:g=t.sent,t.next=27;break;case 23:t.prev=23,t.t1=t.catch(17),g="",P=1;case 27:return t.next=29,Y(Int8Array.BYTES_PER_ELEMENT,(g.length+1)*Int8Array.BYTES_PER_ELEMENT);case 29:if(0!==(S=t.sent)){t.next=32;break}throw new Error("malloc failed: Cannot allocate memory");case 32:for(i[p/Int32Array.BYTES_PER_ELEMENT]=g.length+1,i[f/Int32Array.BYTES_PER_ELEMENT]=S,k=0;k<g.length;k++)a[S+k]=g.charCodeAt(k);a[S+g.length]=0;case 36:i[l/Int32Array.BYTES_PER_ELEMENT]=P;case 37:case"end":return t.stop()}}),t,null,[[6,13],[17,23]])})));return function(e,r,n,o,a,i,s,c,u){return t.apply(this,arguments)}}(),v=function(){var t=e(o.mark((function t(e,r,n,c){var u,f,p,l;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=E(a,e),t.prev=1,t.next=4,s.getItem(u);case 4:return f=t.sent,p=w(f),t.next=8,Y(Uint8Array.BYTES_PER_ELEMENT,p.length*Uint8Array.BYTES_PER_ELEMENT);case 8:if(0!==(l=t.sent)){t.next=11;break}throw new Error("malloc failed: Cannot allocate memory");case 11:i[r/Int32Array.BYTES_PER_ELEMENT]=p.byteLength,i[n/Int32Array.BYTES_PER_ELEMENT]=l,a.set(p,l),i[c/Int32Array.BYTES_PER_ELEMENT]=1,t.next=20;break;case 17:t.prev=17,t.t0=t.catch(1),i[c/Int32Array.BYTES_PER_ELEMENT]=0;case 20:case"end":return t.stop()}}),t,null,[[1,17]])})));return function(e,r,n,o){return t.apply(this,arguments)}}(),_=function(){var t=e(o.mark((function t(e,r,n,c){var u,f;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=E(a,e),f=g(a,r,n),t.prev=2,t.next=5,s.setItem(u,f);case 5:i[c/Int32Array.BYTES_PER_ELEMENT]=1,t.next=11;break;case 8:t.prev=8,t.t0=t.catch(2),i[c/Int32Array.BYTES_PER_ELEMENT]=0;case 11:case"end":return t.stop()}}),t,null,[[2,8]])})));return function(e,r,n,o){return t.apply(this,arguments)}}(),d=function(){var t=e(o.mark((function t(e,r,n){var c,u;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return c=E(a,e),t.prev=1,t.next=4,s.exists(c);case 4:u=t.sent,a[r]=u?1:0,i[n/Int32Array.BYTES_PER_ELEMENT]=1,t.next=12;break;case 9:t.prev=9,t.t0=t.catch(1),i[n/Int32Array.BYTES_PER_ELEMENT]=0;case 12:case"end":return t.stop()}}),t,null,[[1,9]])})));return function(e,r,n){return t.apply(this,arguments)}}(),y=function(){var t=e(o.mark((function t(e,r){var n;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=E(a,e),t.prev=1,t.next=4,s.removeItem(n);case 4:i[r/Int32Array.BYTES_PER_ELEMENT]=1,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),i[r/Int32Array.BYTES_PER_ELEMENT]=0;case 10:case"end":return t.stop()}}),t,null,[[1,7]])})));return function(e,r){return t.apply(this,arguments)}}(),P=function(){var t=e(o.mark((function t(e){var r,n,s;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=void 0!==navigator.userAgent?navigator.userAgent:"unknown",t.next=3,Y(Uint8Array.BYTES_PER_ELEMENT,(r.length+1)*Uint8Array.BYTES_PER_ELEMENT);case 3:if(0!==(n=t.sent)){t.next=6;break}throw new Error("malloc failed: Cannot allocate memory");case 6:for(i[e/Int32Array.BYTES_PER_ELEMENT]=n,s=0;s<r.length;s++)a[n+s]=r.charCodeAt(s);a[n+r.length]=0;case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),S=function(){var t=e(o.mark((function t(e){var r,n,s,c;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=null!==(r=self.origin)&&void 0!==r?r:self.location.origin,t.next=3,Y(Uint8Array.BYTES_PER_ELEMENT,(n.length+1)*Uint8Array.BYTES_PER_ELEMENT);case 3:if(0!==(s=t.sent)){t.next=6;break}throw new Error("malloc failed: Cannot allocate memory");case 6:for(i[e/Int32Array.BYTES_PER_ELEMENT]=s,c=0;c<n.length;c++)a[s+c]=n.charCodeAt(c);a[s+n.length]=0;case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),k=function(){var t=e(o.mark((function t(e,r,n,s){var c,u,f;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return c=E(a,r),u=E(a,n),t.prev=2,t.next=5,T.open(c,u);case 5:f=t.sent,T.setPtr(e,f),i[s/Int32Array.BYTES_PER_ELEMENT]=0,t.next=13;break;case 10:t.prev=10,t.t0=t.catch(2),i[s/Int32Array.BYTES_PER_ELEMENT]=-1;case 13:case"end":return t.stop()}}),t,null,[[2,10]])})));return function(e,r,n,o){return t.apply(this,arguments)}}(),L=function(){var t=e(o.mark((function t(e,r){var n;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,T.getPtr(e);case 3:return n=t.sent,t.next=6,n.close();case 6:i[r/Int32Array.BYTES_PER_ELEMENT]=0,t.next=12;break;case 9:t.prev=9,t.t0=t.catch(0),i[r/Int32Array.BYTES_PER_ELEMENT]=-1;case 12:case"end":return t.stop()}}),t,null,[[0,9]])})));return function(e,r){return t.apply(this,arguments)}}(),O=function(){var t=e(o.mark((function t(e,r,n,s,c){var u,f;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,T.getPtr(e);case 3:return u=t.sent,t.next=6,u.read(n,s);case 6:f=t.sent,a.set(f,r),i[c/Int32Array.BYTES_PER_ELEMENT]=f.length/n,t.next=14;break;case 11:t.prev=11,t.t0=t.catch(0),i[c/Int32Array.BYTES_PER_ELEMENT]=-1;case 14:case"end":return t.stop()}}),t,null,[[0,11]])})));return function(e,r,n,o,a){return t.apply(this,arguments)}}(),A=function(){var t=e(o.mark((function t(e,r,n,a){return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:try{T.getPtr(e).seek(r,n),i[a/Int32Array.BYTES_PER_ELEMENT]=0}catch(t){i[a/Int32Array.BYTES_PER_ELEMENT]=-1}case 1:case"end":return t.stop()}}),t)})));return function(e,r,n,o){return t.apply(this,arguments)}}(),M=function(){var t=e(o.mark((function t(e,r){var n;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:try{n=T.getPtr(e),i[r/Int32Array.BYTES_PER_ELEMENT]=n.tell()}catch(t){i[r/Int32Array.BYTES_PER_ELEMENT]=-1}case 1:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),N=function(){var t=e(o.mark((function t(e,r){var n;return o.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=E(a,e),t.prev=1,t.next=4,T.remove(n);case 4:i[r/Int32Array.BYTES_PER_ELEMENT]=0,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),i[r/Int32Array.BYTES_PER_ELEMENT]=-1;case 10:case"end":return t.stop()}}),t,null,[[1,7]])})));return function(e,r){return t.apply(this,arguments)}}(),B={wasi_snapshot_preview1:I,env:{memory:r,pv_console_log_wasm:c,pv_assert_wasm:p,pv_time_wasm:l,pv_https_request_wasm:h,pv_file_load_wasm:v,pv_file_save_wasm:_,pv_file_exists_wasm:d,pv_file_delete_wasm:y,pv_get_browser_info:P,pv_get_origin_info:S,pv_file_open_wasm:k,pv_file_close_wasm:L,pv_file_read_wasm:O,pv_file_seek_wasm:A,pv_file_tell_wasm:M,pv_file_remove_wasm:N}},!(n instanceof Promise)){t.next=26;break}return t.next=23,f(n,B);case 23:j=t.sent.instance,t.next=30;break;case 26:return R=w(n),t.next=29,u(R,B);case 29:j=t.sent.instance;case 30:return Y=j.exports.aligned_alloc,t.abrupt("return",j.exports);case 32:case"end":return t.stop()}}),t)}))),O.apply(this,arguments)}export{T as PvFile,g as arrayBufferToBase64AtIndex,E as arrayBufferToStringAtIndex,w as base64ToUint8Array,L as buildWasm,b as fetchWithTimeout,m as getPvStorage,S as isAccessKeyValid,x as stringHeaderToObject};

@@ -1,1 +0,3 @@

var WebUtils=function(t){"use strict";function r(t,r,e,n,o,a,i){try{var c=t[a](i),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function e(t){return function(){var e=this,n=arguments;return new Promise((function(o,a){var i=t.apply(e,n);function c(t){r(i,o,a,c,u,"next",t)}function u(t){r(i,o,a,c,u,"throw",t)}c(void 0)}))}}var n,o,a=(n=function(t){var r=function(t){var r,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{u({},"")}catch(t){u=function(t,r,e){return t[r]=e}}function s(t,r,e,n){var o=r&&r.prototype instanceof d?r:d,a=Object.create(o.prototype),i=new P(n||[]);return a._invoke=function(t,r,e){var n=l;return function(o,a){if(n===h)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw a;return I()}for(e.method=o,e.arg=a;;){var i=e.delegate;if(i){var c=S(i,e);if(c){if(c===v)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===l)throw n=y,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=h;var u=f(t,r,e);if("normal"===u.type){if(n=e.done?y:p,u.arg===v)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n=y,e.method="throw",e.arg=u.arg)}}}(t,e,i),a}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var l="suspendedStart",p="suspendedYield",h="executing",y="completed",v={};function d(){}function _(){}function E(){}var g={};u(g,a,(function(){return this}));var m=Object.getPrototypeOf,w=m&&m(m(k([])));w&&w!==e&&n.call(w,a)&&(g=w);var b=E.prototype=d.prototype=Object.create(g);function x(t){["next","throw","return"].forEach((function(r){u(t,r,(function(t){return this._invoke(r,t)}))}))}function T(t,r){function e(o,a,i,c){var u=f(t[o],t,a);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?r.resolve(l.__await).then((function(t){e("next",t,i,c)}),(function(t){e("throw",t,i,c)})):r.resolve(l).then((function(t){s.value=t,i(s)}),(function(t){return e("throw",t,i,c)}))}c(u.arg)}var o;this._invoke=function(t,n){function a(){return new r((function(r,o){e(t,n,r,o)}))}return o=o?o.then(a,a):a()}}function S(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,S(t,e),"throw"===e.method))return v;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,v;var a=o.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,v):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function L(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function A(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function k(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function e(){for(;++o<t.length;)if(n.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=r,e.done=!0,e};return i.next=i}}return{next:I}}function I(){return{value:r,done:!0}}return _.prototype=E,u(b,"constructor",E),u(E,"constructor",_),_.displayName=u(E,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===_||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,u(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},x(T.prototype),u(T.prototype,i,(function(){return this})),t.AsyncIterator=T,t.async=function(r,e,n,o,a){void 0===a&&(a=Promise);var i=new T(s(r,e,n,o),a);return t.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},x(b),u(b,c,"Generator"),u(b,a,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=k,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(A),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(n,o){return c.type="throw",c.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var u=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(u&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=r&&r<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=r,a?(this.method="next",this.next=a.finallyLoc,v):this.complete(i)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),v},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),A(e),v}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;A(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),v}},t}(t.exports);try{regeneratorRuntime=r}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},n(o={exports:{}},o.exports),o.exports),i=a;const c=new WeakMap;function u(t,r){return new Proxy(t,{get:(t,e)=>r(t[e])})}class s{constructor(){this.value=void 0,this.exports=null}getState(){return this.exports.asyncify_get_state()}assertNoneState(){let t=this.getState();if(0!==t)throw new Error(`Invalid async state ${t}, expected 0.`)}wrapImportFn(t){return(...r)=>{if(2===this.getState())return this.exports.asyncify_stop_rewind(),this.value;this.assertNoneState();let e=t(...r);if(!(n=e)||"object"!=typeof n&&"function"!=typeof n||"function"!=typeof n.then)return e;var n;this.exports.asyncify_start_unwind(16),this.value=e}}wrapModuleImports(t){return u(t,(t=>"function"==typeof t?this.wrapImportFn(t):t))}wrapImports(t){if(void 0!==t)return u(t,((t=Object.create(null))=>this.wrapModuleImports(t)))}wrapExportFn(t){let r=c.get(t);return void 0!==r||(r=async(...r)=>{this.assertNoneState();let e=t(...r);for(;1===this.getState();)this.exports.asyncify_stop_unwind(),this.value=await this.value,this.assertNoneState(),this.exports.asyncify_start_rewind(16),e=t();return this.assertNoneState(),e},c.set(t,r)),r}wrapExports(t){let r=Object.create(null);for(let e in t){let n=t[e];"function"!=typeof n||e.startsWith("asyncify_")||(n=this.wrapExportFn(n)),Object.defineProperty(r,e,{enumerable:!0,value:n})}return c.set(t,r),r}init(t,r){const{exports:e}=t,n=e.memory||r.env&&r.env.memory;new Int32Array(n.buffer,16).set([24,1024]),this.exports=this.wrapExports(e),Object.setPrototypeOf(t,f.prototype)}}class f extends WebAssembly.Instance{constructor(t,r){let e=new s;super(t,e.wrapImports(r)),e.init(this,r)}get exports(){return c.get(super.exports)}}async function l(t,r){let e=new s,n=await WebAssembly.instantiate(t,e.wrapImports(r));return e.init(n instanceof WebAssembly.Instance?n:n.instance,r),n}function p(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function h(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function y(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?h(Object(e),!0).forEach((function(r){p(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):h(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}function v(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=function(t,r){if(!t)return;if("string"==typeof t)return d(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)return Array.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return d(t,r)}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,c=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return i=t.done,t},e:function(t){c=!0,a=t},f:function(){try{i||null==e.return||e.return()}finally{if(c)throw a}}}}function d(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}Object.defineProperty(f.prototype,"exports",{enumerable:!0});var _="pv_store";function E(){return new Promise((function(t,r){var e=self.indexedDB.open("pv_db",1);e.onerror=function(){r(e.error)},e.onsuccess=function(){t(e.result)},e.onupgradeneeded=function(){e.result.createObjectStore(_)}}))}function g(){if(self.indexedDB){var t=function(t){return new Promise((function(r,e){t.onerror=function(){e(t.error)},t.onsuccess=function(){r(t.result)}}))};return{setItem:(o=e(i.mark((function r(e,n){var o,a;return i.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,E();case 2:return o=r.sent,a=o.transaction(_,"readwrite").objectStore(_).put(n,e),r.next=6,t(a);case 6:o.close();case 7:case"end":return r.stop()}}),r)}))),function(t,r){return o.apply(this,arguments)}),getItem:(n=e(i.mark((function r(e){var n,o,a;return i.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,E();case 2:return n=r.sent,o=n.transaction(_,"readonly").objectStore(_).get(e),r.next=6,t(o);case 6:return a=r.sent,n.close(),r.abrupt("return",a);case 9:case"end":return r.stop()}}),r)}))),function(t){return n.apply(this,arguments)}),removeItem:(r=e(i.mark((function r(e){var n,o;return i.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,E();case 2:return n=r.sent,o=n.transaction(_,"readwrite").objectStore(_).delete(e),r.next=6,t(o);case 6:n.close();case 7:case"end":return r.stop()}}),r)}))),function(t){return r.apply(this,arguments)})}}if(self.localStorage)return self.localStorage;var r,n,o;throw new Error("Cannot get a presistent storage object.")}function m(t,r){for(var e=r;0!==t[e];)e++;return new TextDecoder("utf-8").decode(t.subarray(r,e))}function w(t){for(var r=atob(t),e=new Uint8Array(r.length),n=0;n<r.length;n++)e[n]=r.charCodeAt(n);return e}function b(t,r,e){for(var n="",o=0;o<r;o++)n+=String.fromCharCode(t[e+o]);return btoa(n)}function x(t){var r,e={},n=v(t.split("\r\n"));try{for(n.s();!(r=n.n()).done;){var o=r.value.split(": ");""!==o[0]&&(e[o[0]]=o[1])}}catch(t){n.e(t)}finally{n.f()}return e}function T(t){return S.apply(this,arguments)}function S(){return S=e(i.mark((function t(r){var e,n,o,a,c,u,s=arguments;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=s.length>1&&void 0!==s[1]?s[1]:{},n=s.length>2&&void 0!==s[2]?s[2]:5e3,o=new AbortController,a=y(y({},e),{},{signal:o.signal}),c=setTimeout((function(){o.abort()}),n),t.next=7,fetch(r,a);case 7:return u=t.sent,clearTimeout(c),t.abrupt("return",u);case 10:case"end":return t.stop()}}),t)}))),S.apply(this,arguments)}var L={args_get:function(t){return 0},args_sizes_get:function(t){return 0},environ_get:function(t){return 0},environ_sizes_get:function(t){return 0},clock_res_get:function(t){return 0},clock_time_get:function(t){return 0},fd_advise:function(t){return 0},fd_allocate:function(t){return 0},fd_close:function(t){return 0},fd_datasync:function(t){return 0},fd_fdstat_get:function(t){return 0},fd_fdstat_set_flags:function(t){return 0},fd_fdstat_set_rights:function(t){return 0},fd_filestat_get:function(t){return 0},fd_filestat_set_size:function(t){return 0},fd_filestat_set_times:function(t){return 0},fd_pread:function(t){return 0},fd_prestat_get:function(t){return 0},fd_prestat_dir_name:function(t){return 0},fd_pwrite:function(t){return 0},fd_read:function(t){return 0},fd_readdir:function(t){return 0},fd_renumber:function(t){return 0},fd_seek:function(t){return 0},fd_sync:function(t){return 0},fd_tell:function(t){return 0},fd_write:function(t){return 0},path_create_directory:function(t){return 0},path_filestat_get:function(t){return 0},path_filestat_set_times:function(t){return 0},path_link:function(t){return 0},path_open:function(t){return 0},path_readlink:function(t){return 0},path_remove_directory:function(t){return 0},path_rename:function(t){return 0},path_symlink:function(t){return 0},path_unlink_file:function(t){return 0},poll_oneoff:function(t){return 0},proc_exit:function(t){return 0},proc_raise:function(t){return 0},sched_yield:function(t){return 0},random_get:function(t){return 0},sock_recv:function(t){return 0},sock_send:function(t){return 0},sock_shutdown:function(t){return 0}};function A(){return A=e(i.mark((function t(r,n){var o,a,c,u,s,f,p,h,y,v,d,_,E,S,A,P,k,I;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=new Uint8Array(r.buffer),a=new Int32Array(r.buffer),c=g(),u=function(t){console.log(m(o,t))},s=function(t,r,e){if(0===t){var n=m(o,e);throw new Error("assertion failed at line ".concat(r,' in "').concat(n,'"'))}},f=function(){return Date.now()/1e3},p=function(){var t=e(i.mark((function t(r,e,n,c,u,s,f,l,p){var h,y,v,d,_,E,g,w,b,S,L;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return h=m(o,r),y=m(o,e),v=m(o,n),d=m(o,c),_=m(o,u),E=x(d),t.prev=6,t.next=9,T("https://"+y+v,{method:h,headers:E,body:_},s);case 9:g=t.sent,b=g.status,t.next=16;break;case 13:t.prev=13,t.t0=t.catch(6),b=0;case 16:if(void 0===g){t.next=36;break}return t.prev=17,t.next=20,g.text();case 20:w=t.sent,t.next=27;break;case 23:t.prev=23,t.t1=t.catch(17),w="",b=1;case 27:return t.next=29,I(Int8Array.BYTES_PER_ELEMENT,(w.length+1)*Int8Array.BYTES_PER_ELEMENT);case 29:if(0!==(S=t.sent)){t.next=32;break}throw new Error("malloc failed: Cannot allocate memory");case 32:for(a[l/Int32Array.BYTES_PER_ELEMENT]=w.length+1,a[f/Int32Array.BYTES_PER_ELEMENT]=S,L=0;L<w.length;L++)o[S+L]=w.charCodeAt(L);o[S+w.length]=0;case 36:a[p/Int32Array.BYTES_PER_ELEMENT]=b;case 37:case"end":return t.stop()}}),t,null,[[6,13],[17,23]])})));return function(r,e,n,o,a,i,c,u,s){return t.apply(this,arguments)}}(),h=function(){var t=e(i.mark((function t(r,e,n,u){var s,f,l,p;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=m(o,r),t.prev=1,t.next=4,c.getItem(s);case 4:return f=t.sent,l=w(f),t.next=8,I(Uint8Array.BYTES_PER_ELEMENT,l.length*Uint8Array.BYTES_PER_ELEMENT);case 8:if(0!==(p=t.sent)){t.next=11;break}throw new Error("malloc failed: Cannot allocate memory");case 11:a[e/Int32Array.BYTES_PER_ELEMENT]=l.byteLength,a[n/Int32Array.BYTES_PER_ELEMENT]=p,o.set(l,p),a[u/Int32Array.BYTES_PER_ELEMENT]=1,t.next=20;break;case 17:t.prev=17,t.t0=t.catch(1),a[u/Int32Array.BYTES_PER_ELEMENT]=0;case 20:case"end":return t.stop()}}),t,null,[[1,17]])})));return function(r,e,n,o){return t.apply(this,arguments)}}(),y=function(){var t=e(i.mark((function t(r,e,n,u){var s,f;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=m(o,r),f=b(o,e,n),t.prev=2,t.next=5,c.setItem(s,f);case 5:a[u/Int32Array.BYTES_PER_ELEMENT]=1,t.next=11;break;case 8:t.prev=8,t.t0=t.catch(2),a[u/Int32Array.BYTES_PER_ELEMENT]=0;case 11:case"end":return t.stop()}}),t,null,[[2,8]])})));return function(r,e,n,o){return t.apply(this,arguments)}}(),v=function(){var t=e(i.mark((function t(r,e,n){var u,s;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=m(o,r),t.prev=1,t.next=4,c.getItem(u);case 4:s=t.sent,o[e]=null==s?0:1,a[n/Int32Array.BYTES_PER_ELEMENT]=1,t.next=12;break;case 9:t.prev=9,t.t0=t.catch(1),a[n/Int32Array.BYTES_PER_ELEMENT]=0;case 12:case"end":return t.stop()}}),t,null,[[1,9]])})));return function(r,e,n){return t.apply(this,arguments)}}(),d=function(){var t=e(i.mark((function t(r,e){var n;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=m(o,r),t.prev=1,t.next=4,c.removeItem(n);case 4:a[e/Int32Array.BYTES_PER_ELEMENT]=1,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),a[e/Int32Array.BYTES_PER_ELEMENT]=0;case 10:case"end":return t.stop()}}),t,null,[[1,7]])})));return function(r,e){return t.apply(this,arguments)}}(),_=function(){var t=e(i.mark((function t(r){var e,n,c;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=void 0!==navigator.userAgent?navigator.userAgent:"unknown",t.next=3,I(Uint8Array.BYTES_PER_ELEMENT,(e.length+1)*Uint8Array.BYTES_PER_ELEMENT);case 3:if(0!==(n=t.sent)){t.next=6;break}throw new Error("malloc failed: Cannot allocate memory");case 6:for(a[r/Int32Array.BYTES_PER_ELEMENT]=n,c=0;c<e.length;c++)o[n+c]=e.charCodeAt(c);o[n+e.length]=0;case 9:case"end":return t.stop()}}),t)})));return function(r){return t.apply(this,arguments)}}(),E=function(){var t=e(i.mark((function t(r){var e,n,c,u;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=null!==(e=self.origin)&&void 0!==e?e:self.location.origin,t.next=3,I(Uint8Array.BYTES_PER_ELEMENT,(n.length+1)*Uint8Array.BYTES_PER_ELEMENT);case 3:if(0!==(c=t.sent)){t.next=6;break}throw new Error("malloc failed: Cannot allocate memory");case 6:for(a[r/Int32Array.BYTES_PER_ELEMENT]=c,u=0;u<n.length;u++)o[c+u]=n.charCodeAt(u);o[c+n.length]=0;case 9:case"end":return t.stop()}}),t)})));return function(r){return t.apply(this,arguments)}}(),S={wasi_snapshot_preview1:L,env:{memory:r,pv_console_log_wasm:u,pv_assert_wasm:s,pv_time_wasm:f,pv_https_request_wasm:p,pv_file_load_wasm:h,pv_file_save_wasm:y,pv_file_exists_wasm:v,pv_file_delete_wasm:d,pv_get_browser_info:_,pv_get_origin_info:E}},A=w(n),t.next=17,l(A,S);case 17:return P=t.sent,k=P.instance,I=k.exports.aligned_alloc,t.abrupt("return",k.exports);case 21:case"end":return t.stop()}}),t)}))),A.apply(this,arguments)}return t.arrayBufferToBase64AtIndex=b,t.arrayBufferToStringAtIndex=m,t.base64ToUint8Array=w,t.buildWasm=function(t,r){return A.apply(this,arguments)},t.fetchWithTimeout=T,t.getPvStorage=g,t.isAccessKeyValid=function(t){if("string"!=typeof t||null==t)return!1;var r=t.trim();if(""===r)return!1;try{return btoa(atob(r))===r}catch(t){return!1}},t.stringHeaderToObject=x,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
var WebUtils=function(t){"use strict";function e(t,e,r,n,o,a,i){try{var s=t[a](i),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function r(t){return function(){var r=this,n=arguments;return new Promise((function(o,a){var i=t.apply(r,n);function s(t){e(i,o,a,s,c,"next",t)}function c(t){e(i,o,a,s,c,"throw",t)}s(void 0)}))}}function n(t){var e={exports:{}};return t(e,e.exports),e.exports}var o=n((function(t){function e(r){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports})),a=n((function(t){var e=o.default;function r(){
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
t.exports=r=function(){return n},t.exports.__esModule=!0,t.exports.default=t.exports;var n={},o=Object.prototype,a=o.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var o=e&&e.prototype instanceof v?e:v,a=Object.create(o.prototype),i=new T(n||[]);return a._invoke=function(t,e,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return I()}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var s=b(i,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=l(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,i),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}n.wrap=p;var h={};function v(){}function _(){}function d(){}var y={};f(y,s,(function(){return this}));var m=Object.getPrototypeOf,E=m&&m(m(k([])));E&&E!==o&&a.call(E,s)&&(y=E);var w=d.prototype=v.prototype=Object.create(y);function g(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,r){function n(o,i,s,c){var u=l(t[o],t,i);if("throw"!==u.type){var f=u.arg,p=f.value;return p&&"object"==e(p)&&a.call(p,"__await")?r.resolve(p.__await).then((function(t){n("next",t,s,c)}),(function(t){n("throw",t,s,c)})):r.resolve(p).then((function(t){f.value=t,s(f)}),(function(t){return n("throw",t,s,c)}))}c(u.arg)}var o;this._invoke=function(t,e){function a(){return new r((function(r,o){n(t,e,r,o)}))}return o=o?o.then(a,a):a()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=l(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function k(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(a.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:I}}function I(){return{value:void 0,done:!0}}return _.prototype=d,f(w,"constructor",d),f(d,"constructor",_),_.displayName=f(d,u,"GeneratorFunction"),n.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===_||"GeneratorFunction"===(e.displayName||e.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,f(t,u,"GeneratorFunction")),t.prototype=Object.create(w),t},n.awrap=function(t){return{__await:t}},g(x.prototype),f(x.prototype,c,(function(){return this})),n.AsyncIterator=x,n.async=function(t,e,r,o,a){void 0===a&&(a=Promise);var i=new x(p(t,e,r,o),a);return n.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},g(w),f(w,u,"Generator"),f(w,s,(function(){return this})),f(w,"toString",(function(){return"[object Generator]"})),n.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},n.values=k,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!t)for(var e in this)"t"===e.charAt(0)&&a.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return i.type="throw",i.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=a.call(o,"catchLoc"),c=a.call(o,"finallyLoc");if(s&&c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},n}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})),i=a();const s=new WeakMap;function c(t,e){return new Proxy(t,{get:(t,r)=>e(t[r])})}class u{constructor(){this.value=void 0,this.exports=null}getState(){return this.exports.asyncify_get_state()}assertNoneState(){let t=this.getState();if(0!==t)throw new Error(`Invalid async state ${t}, expected 0.`)}wrapImportFn(t){return(...e)=>{if(2===this.getState())return this.exports.asyncify_stop_rewind(),this.value;this.assertNoneState();let r=t(...e);if(!(n=r)||"object"!=typeof n&&"function"!=typeof n||"function"!=typeof n.then)return r;var n;this.exports.asyncify_start_unwind(16),this.value=r}}wrapModuleImports(t){return c(t,(t=>"function"==typeof t?this.wrapImportFn(t):t))}wrapImports(t){if(void 0!==t)return c(t,((t=Object.create(null))=>this.wrapModuleImports(t)))}wrapExportFn(t){let e=s.get(t);return void 0!==e||(e=async(...e)=>{this.assertNoneState();let r=t(...e);for(;1===this.getState();)this.exports.asyncify_stop_unwind(),this.value=await this.value,this.assertNoneState(),this.exports.asyncify_start_rewind(16),r=t();return this.assertNoneState(),r},s.set(t,e)),e}wrapExports(t){let e=Object.create(null);for(let r in t){let n=t[r];"function"!=typeof n||r.startsWith("asyncify_")||(n=this.wrapExportFn(n)),Object.defineProperty(e,r,{enumerable:!0,value:n})}return s.set(t,e),e}init(t,e){const{exports:r}=t,n=r.memory||e.env&&e.env.memory;new Int32Array(n.buffer,16).set([24,1024]),this.exports=this.wrapExports(r),Object.setPrototypeOf(t,f.prototype)}}class f extends WebAssembly.Instance{constructor(t,e){let r=new u;super(t,r.wrapImports(e)),r.init(this,e)}get exports(){return s.get(super.exports)}}async function p(t,e){let r=new u,n=await WebAssembly.instantiate(t,r.wrapImports(e));return r.init(n instanceof WebAssembly.Instance?n:n.instance,e),n}async function l(t,e){let r=new u,n=await WebAssembly.instantiateStreaming(t,r.wrapImports(e));return r.init(n.instance,e),n}function h(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function v(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function _(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?v(Object(r),!0).forEach((function(e){h(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function d(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return y(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return y(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return i=t.done,t},e:function(t){s=!0,a=t},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw a}}}}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}Object.defineProperty(f.prototype,"exports",{enumerable:!0});var m="pv_store",E="pv_file";function w(){return new Promise((function(t,e){var r=self.indexedDB.open("pv_db",2);r.onerror=function(){e(r.error)},r.onsuccess=function(){t(r.result)},r.onupgradeneeded=function(){r.result.objectStoreNames.contains(m)||r.result.createObjectStore(m),r.result.objectStoreNames.contains(E)||r.result.createObjectStore(E)}}))}var g=function(t){return new Promise((function(e,r){t.onerror=function(){r(t.error)},t.onsuccess=function(){e(t.result)}}))};function x(){var t,e,n,o,a=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(self.indexedDB)return{setItem:(o=r(i.mark((function t(e,r){var n,o;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,w();case 2:return n=t.sent,o=n.transaction(m,"readwrite").objectStore(m).put(r,e),t.next=6,g(o);case 6:n.close();case 7:case"end":return t.stop()}}),t)}))),function(t,e){return o.apply(this,arguments)}),getItem:(n=r(i.mark((function t(e){var r,n,o;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,w();case 2:return r=t.sent,n=r.transaction(m,"readonly").objectStore(m).get(e),t.next=6,g(n);case 6:return o=t.sent,r.close(),t.abrupt("return",o);case 9:case"end":return t.stop()}}),t)}))),function(t){return n.apply(this,arguments)}),removeItem:(e=r(i.mark((function t(e){var r,n;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,w();case 2:return r=t.sent,n=r.transaction(m,"readwrite").objectStore(m).delete(e),t.next=6,g(n);case 6:r.close();case 7:case"end":return t.stop()}}),t)}))),function(t){return e.apply(this,arguments)}),exists:(t=r(i.mark((function t(e){var r,n,o;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,w();case 2:return r=t.sent,n=r.transaction(m,"readonly").objectStore(m).count(e),t.next=6,g(n);case 6:return o=t.sent,r.close(),t.abrupt("return",o>0);case 9:case"end":return t.stop()}}),t)}))),function(e){return t.apply(this,arguments)})};if(a)throw new Error("IndexedDB is required but not available.");if(self.localStorage){var s=self.localStorage,c=s.setItem,u=s.getItem,f=s.removeItem,p=function(t){return null!==u(t)};return{setItem:c,getItem:u,removeItem:f,exists:p}}throw new Error("Cannot get a persistent storage object.")}function b(t,e){for(var r=e;0!==t[r];)r++;return new TextDecoder("utf-8").decode(t.subarray(e,r))}function P(t){for(var e=atob(t),r=new Uint8Array(e.length),n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function S(t,e,r){for(var n="",o=0;o<e;o++)n+=String.fromCharCode(t[r+o]);return btoa(n)}function T(t){var e,r={},n=d(t.split("\r\n"));try{for(n.s();!(e=n.n()).done;){var o=e.value.split(": ");""!==o[0]&&(r[o[0]]=o[1])}}catch(t){n.e(t)}finally{n.f()}return r}function k(t){return I.apply(this,arguments)}function I(){return I=r(i.mark((function t(e){var r,n,o,a,s,c,u=arguments;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=u.length>1&&void 0!==u[1]?u[1]:{},n=u.length>2&&void 0!==u[2]?u[2]:5e3,o=new AbortController,a=_(_({},r),{},{signal:o.signal}),s=setTimeout((function(){o.abort()}),n),t.next=7,fetch(e,a);case 7:return c=t.sent,clearTimeout(s),t.abrupt("return",c);case 10:case"end":return t.stop()}}),t)}))),I.apply(this,arguments)}function L(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var A=function(){function t(e,r,n,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),h(this,"_pageSize",65536),h(this,"_path",void 0),h(this,"_db",void 0),h(this,"_mode",void 0),h(this,"_meta",void 0),h(this,"_pagePtr",0),h(this,"_pageOffset",0),this._path=e,this._meta=r,this._db=n,this._mode=o}var e,n,o,a,s,c,u,f;return e=t,n=[{key:"close",value:(f=r(i.mark((function t(){return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this._db.close();case 1:case"end":return t.stop()}}),t,this)}))),function(){return f.apply(this,arguments)})},{key:"read",value:(u=r(i.mark((function e(r,n){var o=this;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,a){if(void 0!==o._meta){if(o._isEOF){var i=new Error("EOF");return i.name="EndOfFile",void a(i)}var s=0,c=Math.min(r*n,o._meta.size),u=c-c%r,f=new Uint8Array(u),p=IDBKeyRange.bound("".concat(o._path,"-").concat(t.createPage(o._pagePtr)),"".concat(o._path,"-").concat(t.createPage(o._meta.numPages))),l=o._store,h=l.openCursor(p);h.onsuccess=function(){var t=h.result;if(t&&!o._isEOF){var e=Math.min(u-s,t.value.length-o._pageOffset);f.set(t.value.slice(o._pageOffset,o._pageOffset+e),s),s+=e,o._pageOffset+=e,o._pageOffset===o._pageSize&&(o._pagePtr+=1,o._pageOffset=0),s<u&&t.continue()}},l.transaction.onerror=function(){a(l.transaction.error)},l.transaction.oncomplete=function(){e(f.slice(0,s))}}else a(new Error("'".concat(o._path,"' doesn't exist.")))})));case 1:case"end":return e.stop()}}),e)}))),function(t,e){return u.apply(this,arguments)})},{key:"write",value:(c=r(i.mark((function e(r){var n=this;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,o){if("readonly"!==n._mode){var a=n._store,i=Math.ceil(r.length/n._pageSize),s={size:r.length,numPages:i},c=function(){a.add(s,n._path);for(var e=0;e<i;e++)a.add(r.slice(e*n._pageSize,(e+1)*n._pageSize),"".concat(n._path,"-").concat(t.createPage(e)))};if(n._meta){var u=n._meta.numPages,f=IDBKeyRange.bound(n._path,"".concat(n._path,"-").concat(t.createPage(u)));a.delete(f).onsuccess=function(){return c()}}else c();a.transaction.onerror=function(){o(a.transaction.error)},a.transaction.oncomplete=function(){n._meta=s,e()}}else o(new Error("Instance is readonly mode only."))})));case 1:case"end":return e.stop()}}),e)}))),function(t){return c.apply(this,arguments)})},{key:"seek",value:function(t,e){if(void 0===this._meta)throw new Error("'".concat(this._path,"' doesn't exist."));if(t<0){var r=new Error("EOF");throw r.name="EndOfFile",r}var n;if(0===e)n=Math.min(t,this._meta.size);else if(1===e){var o=this._pageSize*this._pagePtr+this._pageOffset;n=Math.min(o+t,this._meta.size)}else{if(2!==e)throw new Error("Invalid operation: ".concat(e,"."));n=Math.min(this._meta.size+t,this._meta.size)}this._pageOffset=n%this._pageSize,this._pagePtr=Math.floor(n/this._pageSize)}},{key:"tell",value:function(){return this._pagePtr*this._pageSize+this._pageOffset}},{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(E,this._mode).objectStore(E)}}],o=[{key:"open",value:function(e,n){if(!self.indexedDB)throw new Error("IndexedDB is not supported");return new Promise(function(){var o=r(i.mark((function r(o,a){var s,c,u;return i.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,w();case 2:s=r.sent,c=n.includes("r")?"readonly":"readwrite",(u=s.transaction(E,c).objectStore(E).get(e)).onerror=function(){a(u.error)},u.onsuccess=function(){void 0===u.result&&"readonly"===c?a("Instance is readonly mode but '".concat(e,"' doesn't exist.")):o(new t(e,u.result,s,c))};case 7:case"end":return r.stop()}}),r)})));return function(t,e){return o.apply(this,arguments)}}())}},{key:"remove",value:(s=r(i.mark((function e(n){var o=this;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(self.indexedDB){e.next=2;break}throw new Error("IndexedDB is not supported");case 2:return e.abrupt("return",new Promise(function(){var e=r(i.mark((function e(r,a){var s,c,u,f,p;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.open(n,"w");case 2:s=e.sent,c=s._meta.numPages,u=IDBKeyRange.bound(s._path,"".concat(s._path,"-").concat(t.createPage(c))),f=s._store,(p=f.delete(u)).onerror=function(){a(p.error)},p.onsuccess=function(){r()};case 9:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()));case 3:case"end":return e.stop()}}),e)}))),function(t){return s.apply(this,arguments)})},{key:"exists",value:(a=r(i.mark((function t(e){var r;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(self.indexedDB){t.next=2;break}throw new Error("IndexedDB is not supported");case 2:return t.prev=2,t.next=5,this.open(e,"r");case 5:return r=t.sent,t.abrupt("return",void 0!==r._meta);case 9:return t.prev=9,t.t0=t.catch(2),t.abrupt("return",!1);case 12:case"end":return t.stop()}}),t,this,[[2,9]])}))),function(t){return a.apply(this,arguments)})},{key:"getPtr",value:function(e){return t._filePtrs.get(e)}},{key:"setPtr",value:function(e,r){t._filePtrs.set(e,r)}},{key:"removePtr",value:function(e){t._filePtrs.delete(e)}},{key:"createPage",value:function(t){return("000"+t).slice(-4)}}],n&&L(e.prototype,n),o&&L(e,o),Object.defineProperty(e,"prototype",{writable:!1}),t}();h(A,"_filePtrs",new Map);var O={args_get:function(t){return 0},args_sizes_get:function(t){return 0},environ_get:function(t){return 0},environ_sizes_get:function(t){return 0},clock_res_get:function(t){return 0},clock_time_get:function(t){return 0},fd_advise:function(t){return 0},fd_allocate:function(t){return 0},fd_close:function(t){return 0},fd_datasync:function(t){return 0},fd_fdstat_get:function(t){return 0},fd_fdstat_set_flags:function(t){return 0},fd_fdstat_set_rights:function(t){return 0},fd_filestat_get:function(t){return 0},fd_filestat_set_size:function(t){return 0},fd_filestat_set_times:function(t){return 0},fd_pread:function(t){return 0},fd_prestat_get:function(t){return 0},fd_prestat_dir_name:function(t){return 0},fd_pwrite:function(t){return 0},fd_read:function(t){return 0},fd_readdir:function(t){return 0},fd_renumber:function(t){return 0},fd_seek:function(t){return 0},fd_sync:function(t){return 0},fd_tell:function(t){return 0},fd_write:function(t){return 0},path_create_directory:function(t){return 0},path_filestat_get:function(t){return 0},path_filestat_set_times:function(t){return 0},path_link:function(t){return 0},path_open:function(t){return 0},path_readlink:function(t){return 0},path_remove_directory:function(t){return 0},path_rename:function(t){return 0},path_symlink:function(t){return 0},path_unlink_file:function(t){return 0},poll_oneoff:function(t){return 0},proc_exit:function(t){return 0},proc_raise:function(t){return 0},sched_yield:function(t){return 0},random_get:function(t){return 0},sock_recv:function(t){return 0},sock_send:function(t){return 0},sock_shutdown:function(t){return 0}};function M(){return M=r(i.mark((function t(e,n){var o,a,s,c,u,f,h,v,_,d,y,m,E,w,g,I,L,M,B,N,j,R,Y;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=new Uint8Array(e.buffer),a=new Int32Array(e.buffer),s=x(),c=function(t){console.log(b(o,t))},u=function(t,e,r){if(0===t){var n=b(o,r);throw new Error("assertion failed at line ".concat(e,' in "').concat(n,'"'))}},f=function(){return Date.now()/1e3},h=function(){var t=r(i.mark((function t(e,r,n,s,c,u,f,p,l){var h,v,_,d,y,m,E,w,g,x,P;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return h=b(o,e),v=b(o,r),_=b(o,n),d=b(o,s),y=b(o,c),m=T(d),t.prev=6,t.next=9,k("https://"+v+_,{method:h,headers:m,body:y},u);case 9:E=t.sent,g=E.status,t.next=16;break;case 13:t.prev=13,t.t0=t.catch(6),g=0;case 16:if(void 0===E){t.next=36;break}return t.prev=17,t.next=20,E.text();case 20:w=t.sent,t.next=27;break;case 23:t.prev=23,t.t1=t.catch(17),w="",g=1;case 27:return t.next=29,Y(Int8Array.BYTES_PER_ELEMENT,(w.length+1)*Int8Array.BYTES_PER_ELEMENT);case 29:if(0!==(x=t.sent)){t.next=32;break}throw new Error("malloc failed: Cannot allocate memory");case 32:for(a[p/Int32Array.BYTES_PER_ELEMENT]=w.length+1,a[f/Int32Array.BYTES_PER_ELEMENT]=x,P=0;P<w.length;P++)o[x+P]=w.charCodeAt(P);o[x+w.length]=0;case 36:a[l/Int32Array.BYTES_PER_ELEMENT]=g;case 37:case"end":return t.stop()}}),t,null,[[6,13],[17,23]])})));return function(e,r,n,o,a,i,s,c,u){return t.apply(this,arguments)}}(),v=function(){var t=r(i.mark((function t(e,r,n,c){var u,f,p,l;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=b(o,e),t.prev=1,t.next=4,s.getItem(u);case 4:return f=t.sent,p=P(f),t.next=8,Y(Uint8Array.BYTES_PER_ELEMENT,p.length*Uint8Array.BYTES_PER_ELEMENT);case 8:if(0!==(l=t.sent)){t.next=11;break}throw new Error("malloc failed: Cannot allocate memory");case 11:a[r/Int32Array.BYTES_PER_ELEMENT]=p.byteLength,a[n/Int32Array.BYTES_PER_ELEMENT]=l,o.set(p,l),a[c/Int32Array.BYTES_PER_ELEMENT]=1,t.next=20;break;case 17:t.prev=17,t.t0=t.catch(1),a[c/Int32Array.BYTES_PER_ELEMENT]=0;case 20:case"end":return t.stop()}}),t,null,[[1,17]])})));return function(e,r,n,o){return t.apply(this,arguments)}}(),_=function(){var t=r(i.mark((function t(e,r,n,c){var u,f;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=b(o,e),f=S(o,r,n),t.prev=2,t.next=5,s.setItem(u,f);case 5:a[c/Int32Array.BYTES_PER_ELEMENT]=1,t.next=11;break;case 8:t.prev=8,t.t0=t.catch(2),a[c/Int32Array.BYTES_PER_ELEMENT]=0;case 11:case"end":return t.stop()}}),t,null,[[2,8]])})));return function(e,r,n,o){return t.apply(this,arguments)}}(),d=function(){var t=r(i.mark((function t(e,r,n){var c,u;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return c=b(o,e),t.prev=1,t.next=4,s.exists(c);case 4:u=t.sent,o[r]=u?1:0,a[n/Int32Array.BYTES_PER_ELEMENT]=1,t.next=12;break;case 9:t.prev=9,t.t0=t.catch(1),a[n/Int32Array.BYTES_PER_ELEMENT]=0;case 12:case"end":return t.stop()}}),t,null,[[1,9]])})));return function(e,r,n){return t.apply(this,arguments)}}(),y=function(){var t=r(i.mark((function t(e,r){var n;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=b(o,e),t.prev=1,t.next=4,s.removeItem(n);case 4:a[r/Int32Array.BYTES_PER_ELEMENT]=1,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),a[r/Int32Array.BYTES_PER_ELEMENT]=0;case 10:case"end":return t.stop()}}),t,null,[[1,7]])})));return function(e,r){return t.apply(this,arguments)}}(),m=function(){var t=r(i.mark((function t(e){var r,n,s;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=void 0!==navigator.userAgent?navigator.userAgent:"unknown",t.next=3,Y(Uint8Array.BYTES_PER_ELEMENT,(r.length+1)*Uint8Array.BYTES_PER_ELEMENT);case 3:if(0!==(n=t.sent)){t.next=6;break}throw new Error("malloc failed: Cannot allocate memory");case 6:for(a[e/Int32Array.BYTES_PER_ELEMENT]=n,s=0;s<r.length;s++)o[n+s]=r.charCodeAt(s);o[n+r.length]=0;case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),E=function(){var t=r(i.mark((function t(e){var r,n,s,c;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=null!==(r=self.origin)&&void 0!==r?r:self.location.origin,t.next=3,Y(Uint8Array.BYTES_PER_ELEMENT,(n.length+1)*Uint8Array.BYTES_PER_ELEMENT);case 3:if(0!==(s=t.sent)){t.next=6;break}throw new Error("malloc failed: Cannot allocate memory");case 6:for(a[e/Int32Array.BYTES_PER_ELEMENT]=s,c=0;c<n.length;c++)o[s+c]=n.charCodeAt(c);o[s+n.length]=0;case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),w=function(){var t=r(i.mark((function t(e,r,n,s){var c,u,f;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return c=b(o,r),u=b(o,n),t.prev=2,t.next=5,A.open(c,u);case 5:f=t.sent,A.setPtr(e,f),a[s/Int32Array.BYTES_PER_ELEMENT]=0,t.next=13;break;case 10:t.prev=10,t.t0=t.catch(2),a[s/Int32Array.BYTES_PER_ELEMENT]=-1;case 13:case"end":return t.stop()}}),t,null,[[2,10]])})));return function(e,r,n,o){return t.apply(this,arguments)}}(),g=function(){var t=r(i.mark((function t(e,r){var n;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,A.getPtr(e);case 3:return n=t.sent,t.next=6,n.close();case 6:a[r/Int32Array.BYTES_PER_ELEMENT]=0,t.next=12;break;case 9:t.prev=9,t.t0=t.catch(0),a[r/Int32Array.BYTES_PER_ELEMENT]=-1;case 12:case"end":return t.stop()}}),t,null,[[0,9]])})));return function(e,r){return t.apply(this,arguments)}}(),I=function(){var t=r(i.mark((function t(e,r,n,s,c){var u,f;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,A.getPtr(e);case 3:return u=t.sent,t.next=6,u.read(n,s);case 6:f=t.sent,o.set(f,r),a[c/Int32Array.BYTES_PER_ELEMENT]=f.length/n,t.next=14;break;case 11:t.prev=11,t.t0=t.catch(0),a[c/Int32Array.BYTES_PER_ELEMENT]=-1;case 14:case"end":return t.stop()}}),t,null,[[0,11]])})));return function(e,r,n,o,a){return t.apply(this,arguments)}}(),L=function(){var t=r(i.mark((function t(e,r,n,o){return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:try{A.getPtr(e).seek(r,n),a[o/Int32Array.BYTES_PER_ELEMENT]=0}catch(t){a[o/Int32Array.BYTES_PER_ELEMENT]=-1}case 1:case"end":return t.stop()}}),t)})));return function(e,r,n,o){return t.apply(this,arguments)}}(),M=function(){var t=r(i.mark((function t(e,r){var n;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:try{n=A.getPtr(e),a[r/Int32Array.BYTES_PER_ELEMENT]=n.tell()}catch(t){a[r/Int32Array.BYTES_PER_ELEMENT]=-1}case 1:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),B=function(){var t=r(i.mark((function t(e,r){var n;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=b(o,e),t.prev=1,t.next=4,A.remove(n);case 4:a[r/Int32Array.BYTES_PER_ELEMENT]=0,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),a[r/Int32Array.BYTES_PER_ELEMENT]=-1;case 10:case"end":return t.stop()}}),t,null,[[1,7]])})));return function(e,r){return t.apply(this,arguments)}}(),N={wasi_snapshot_preview1:O,env:{memory:e,pv_console_log_wasm:c,pv_assert_wasm:u,pv_time_wasm:f,pv_https_request_wasm:h,pv_file_load_wasm:v,pv_file_save_wasm:_,pv_file_exists_wasm:d,pv_file_delete_wasm:y,pv_get_browser_info:m,pv_get_origin_info:E,pv_file_open_wasm:w,pv_file_close_wasm:g,pv_file_read_wasm:I,pv_file_seek_wasm:L,pv_file_tell_wasm:M,pv_file_remove_wasm:B}},!(n instanceof Promise)){t.next=26;break}return t.next=23,l(n,N);case 23:j=t.sent.instance,t.next=30;break;case 26:return R=P(n),t.next=29,p(R,N);case 29:j=t.sent.instance;case 30:return Y=j.exports.aligned_alloc,t.abrupt("return",j.exports);case 32:case"end":return t.stop()}}),t)}))),M.apply(this,arguments)}return t.PvFile=A,t.arrayBufferToBase64AtIndex=S,t.arrayBufferToStringAtIndex=b,t.base64ToUint8Array=P,t.buildWasm=function(t,e){return M.apply(this,arguments)},t.fetchWithTimeout=k,t.getPvStorage=x,t.isAccessKeyValid=function(t){if("string"!=typeof t||null==t)return!1;var e=t.trim();if(""===e)return!1;try{return btoa(atob(e))===e}catch(t){return!1}},t.stringHeaderToObject=T,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
import { aligned_alloc_type, pv_free_type, buildWasm } from "./wasm";
import { arrayBufferToBase64AtIndex, arrayBufferToStringAtIndex, base64ToUint8Array, fetchWithTimeout, getPvStorage, isAccessKeyValid, stringHeaderToObject } from './utils';
export { aligned_alloc_type, pv_free_type, buildWasm, arrayBufferToBase64AtIndex, arrayBufferToStringAtIndex, base64ToUint8Array, fetchWithTimeout, getPvStorage, isAccessKeyValid, stringHeaderToObject, };
import { PvFile } from "./pv_file";
export { aligned_alloc_type, pv_free_type, buildWasm, arrayBufferToBase64AtIndex, arrayBufferToStringAtIndex, base64ToUint8Array, fetchWithTimeout, getPvStorage, isAccessKeyValid, stringHeaderToObject, PvFile, };
//# sourceMappingURL=index.d.ts.map
/**
* Indexed DB configurations
*/
export declare const DB_NAME = "pv_db";
export declare const STORE_NAME = "pv_store";
export declare const PV_FILE_STORE = "pv_file";
export declare const DB_VERSION = 2;
/**
* Storage Interface.
*/
interface PvStorage {
setItem: (key: string, value: string) => void | Promise<void>;
getItem: (key: string) => string | Promise<string>;
setItem: (key: string, value: any) => void | Promise<void>;
getItem: (key: string) => any | Promise<any>;
removeItem: (key: string) => void | Promise<void>;
exists: (key: string) => boolean | Promise<boolean>;
}
/**
* Opens indexedDB connection, handles version changes and gets the db instance.
*
* @returns The instance of indexedDB connection.
*/
export declare function getDB(): Promise<IDBDatabase>;
export declare const requestHelper: (request: IDBRequest) => Promise<any>;
/**
* Gets the storage to use. Either tries to use IndexedDB or localStorage.
* @param requireDB Flag indication if IndexedDB is required.
*
* @returns PvStorage instance to use as storage.
*/
export declare function getPvStorage(): PvStorage;
export declare function getPvStorage(requireDB?: boolean): PvStorage;
/**

@@ -16,0 +32,0 @@ * Convert a null terminated phrase stored inside an array buffer to a string

@@ -7,6 +7,6 @@ export declare type aligned_alloc_type = (alignment: number, size: number) => Promise<number>;

* @param memory Initialized WebAssembly memory object.
* @param wasm_base64 The wasm file in base64 string to initialize.
* @param wasm The wasm file in base64 string or stream to public path (i.e. fetch("file.wasm")) to initialize.
* @returns An object containing the exported functions from WASM.
*/
export declare function buildWasm(memory: WebAssembly.Memory, wasm_base64: string): Promise<any>;
export declare function buildWasm(memory: WebAssembly.Memory, wasm: string | Promise<Response>): Promise<any>;
//# sourceMappingURL=wasm.d.ts.map
{
"name": "@picovoice/web-utils",
"version": "1.0.1",
"version": "1.1.0",
"description": "Picovoice web utility functions",

@@ -18,24 +18,38 @@ "author": "Picovoice",

"start": "cross-env TARGET='debug' rollup --config --watch",
"test": "cypress run-ct",
"watch": "rollup --config --watch"
},
"devDependencies": {
"@babel/core": "^7.12.13",
"@babel/plugin-transform-runtime": "^7.12.15",
"@babel/preset-env": "^7.12.13",
"@babel/runtime": "^7.12.13",
"@rollup/plugin-babel": "^5.2.3",
"@rollup/plugin-commonjs": "^17.1.0",
"@rollup/plugin-node-resolve": "^11.1.1",
"@typescript-eslint/eslint-plugin": "^4.15.0",
"@typescript-eslint/parser": "^4.15.0",
"@babel/core": "^7.16.12",
"@babel/plugin-transform-runtime": "^7.16.10",
"@babel/preset-env": "^7.16.11",
"@babel/runtime": "^7.16.7",
"@cypress/webpack-dev-server": "^1.8.4",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^18.1.0",
"@rollup/plugin-node-resolve": "^11.2.1",
"@rollup/pluginutils": "^4.2.1",
"@typescript-eslint/eslint-plugin": "^5.19.0",
"@typescript-eslint/parser": "^5.19.0",
"asyncify-wasm": "^1.2.1",
"cross-env": "^7.0.3",
"eslint": "^7.19.0",
"cypress": "^9.6.1",
"eslint": "^8.13.0",
"html-webpack-plugin": "^5.5.0",
"npm-run-all": "^4.1.5",
"rollup": "^2.38.5",
"rollup": "^2.70.1",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.29.0",
"rollup-plugin-web-worker-loader": "^1.6.0",
"typescript": "^4.5.4"
"rollup-plugin-typescript2": "^0.31.2",
"rollup-plugin-web-worker-loader": "^1.6.1",
"ts-loader": "^9.3.0",
"typescript": "^4.6.3",
"webpack": "^5.72.1",
"webpack-dev-server": "^4.9.0"
},
"dependencies": {
"commander": "^9.2.0"
},
"bin": {
"pvbase64": "./scripts/base64.js"
}
}

@@ -24,2 +24,6 @@ /*

import {
PvFile
} from "./pv_file";
export {

@@ -38,2 +42,4 @@ // wasm exports

stringHeaderToObject,
// PvFile
PvFile,
};

@@ -15,193 +15,208 @@ /*

*/
const DB_NAME = 'pv_db';
const STORE_NAME = 'pv_store';
const V = 1;
/**
* Storage Interface.
*/
interface PvStorage {
setItem: (key: string, value: string) => void | Promise<void>;
getItem: (key: string) => string | Promise<string>;
removeItem: (key: string) => void | Promise<void>;
}
/**
* Opens indexedDB connection, handles version changes and gets the db instance.
*
* @returns The instance of indexedDB connection.
*/
function getDB(): Promise<IDBDatabase> {
return new Promise((resolve, reject) => {
const request = self.indexedDB.open(DB_NAME, V);
request.onerror = () => {
reject(request.error);
};
request.onsuccess = () => {
resolve(request.result);
};
request.onupgradeneeded = () => {
request.result.createObjectStore(STORE_NAME);
};
});
}
/**
* Gets the storage to use. Either tries to use IndexedDB or localStorage.
*
* @returns PvStorage instance to use as storage.
*/
export function getPvStorage(): PvStorage {
if (self.indexedDB) {
const requestHelper = (request: IDBRequest): Promise<any> => {
return new Promise((resolve, reject) => {
request.onerror = () => {
reject(request.error);
};
request.onsuccess = () => {
resolve(request.result);
};
});
}
return {
setItem: async (key: string, value: string) => {
const db = await getDB();
const request = db.transaction(STORE_NAME, 'readwrite').objectStore(STORE_NAME).put(value, key);
await requestHelper(request);
db.close();
},
getItem: async (key: string) => {
const db = await getDB();
const request = db.transaction(STORE_NAME, 'readonly').objectStore(STORE_NAME).get(key);
const res = await requestHelper(request);
db.close();
return res;
},
removeItem: async (key: string) => {
const db = await getDB();
const request = db.transaction(STORE_NAME, 'readwrite').objectStore(STORE_NAME).delete(key);
await requestHelper(request);
db.close();
}
}
} else if (self.localStorage) {
return self.localStorage as PvStorage;
}
throw new Error("Cannot get a presistent storage object.");
}
/**
* Convert a null terminated phrase stored inside an array buffer to a string
*
* @param arrayBuffer input array buffer
* @param indexStart the index at which the phrase is stored
* @return retrieved string
*/
export function arrayBufferToStringAtIndex(
arrayBuffer: Uint8Array,
indexStart: number,
): string {
let indexEnd = indexStart;
while (arrayBuffer[indexEnd] !== 0) {
indexEnd++;
}
const utf8decoder = new TextDecoder('utf-8');
return utf8decoder.decode(arrayBuffer.subarray(indexStart, indexEnd));
}
/**
* Decode a base64 string and stored it in a Uint8Array array
*
* @param base64String input base64 string
* @return decoded array
*/
export function base64ToUint8Array(base64String: string): Uint8Array {
const base64StringDecoded = atob(base64String);
const binaryArray = new Uint8Array(base64StringDecoded.length);
for (let i = 0; i < base64StringDecoded.length; i++) {
binaryArray[i] = base64StringDecoded.charCodeAt(i);
}
return binaryArray;
}
/**
* Encode an ArrayBuffer array to base64 string
*
* @param arrayBuffer input array
* @param size size of the phrase to be encoded
* @param index the index at which the phrase is stored
* @return base64 string
*/
export function arrayBufferToBase64AtIndex(arrayBuffer: ArrayBuffer, size: number, index: number): string {
let binary = '';
for (let i = 0; i < size; i++) {
// @ts-ignore
binary += String.fromCharCode(arrayBuffer[index + i]);
}
return btoa(binary);
}
/**
* Convert a string header to JS object
*
* @param stringHeader input string in json format
* @return retrieved object
*/
// eslint-disable-next-line
export const DB_NAME = 'pv_db';
export const STORE_NAME = 'pv_store';
export const PV_FILE_STORE = 'pv_file';
export const DB_VERSION = 2;
/**
* Storage Interface.
*/
interface PvStorage {
setItem: (key: string, value: any) => void | Promise<void>;
getItem: (key: string) => any | Promise<any>;
removeItem: (key: string) => void | Promise<void>;
exists: (key: string) => boolean | Promise<boolean>;
}
/**
* Opens indexedDB connection, handles version changes and gets the db instance.
*
* @returns The instance of indexedDB connection.
*/
export function getDB(): Promise<IDBDatabase> {
return new Promise((resolve, reject) => {
const request = self.indexedDB.open(DB_NAME, DB_VERSION);
request.onerror = () => {
reject(request.error);
};
request.onsuccess = () => {
resolve(request.result);
};
request.onupgradeneeded = () => {
if (!request.result.objectStoreNames.contains(STORE_NAME)) {
request.result.createObjectStore(STORE_NAME);
}
if (!request.result.objectStoreNames.contains(PV_FILE_STORE)) {
request.result.createObjectStore(PV_FILE_STORE);
}
};
});
}
export const requestHelper = (request: IDBRequest): Promise<any> => new Promise((resolve, reject) => {
request.onerror = () => {
reject(request.error);
};
request.onsuccess = () => {
resolve(request.result);
};
});
/**
* Gets the storage to use. Either tries to use IndexedDB or localStorage.
* @param requireDB Flag indication if IndexedDB is required.
*
* @returns PvStorage instance to use as storage.
*/
export function getPvStorage(requireDB = false): PvStorage {
if (self.indexedDB) {
return {
setItem: async (key: string, value: any) => {
const db = await getDB();
const request = db.transaction(STORE_NAME, 'readwrite').objectStore(STORE_NAME).put(value, key);
await requestHelper(request);
db.close();
},
getItem: async (key: string) => {
const db = await getDB();
const request = db.transaction(STORE_NAME, 'readonly').objectStore(STORE_NAME).get(key);
const res = await requestHelper(request);
db.close();
return res;
},
removeItem: async (key: string) => {
const db = await getDB();
const request = db.transaction(STORE_NAME, 'readwrite').objectStore(STORE_NAME).delete(key);
await requestHelper(request);
db.close();
},
exists: async (key: string) => {
const db = await getDB();
const request = db.transaction(STORE_NAME, 'readonly').objectStore(STORE_NAME).count(key);
const res = await requestHelper(request);
db.close();
return res > 0;
}
};
} else if (requireDB) {
throw new Error("IndexedDB is required but not available.");
} else if (self.localStorage) {
const { setItem, getItem, removeItem } = self.localStorage;
const exists = (key: string) => getItem(key) !== null;
return {
setItem,
getItem,
removeItem,
exists
};
}
throw new Error("Cannot get a persistent storage object.");
}
/**
* Convert a null terminated phrase stored inside an array buffer to a string
*
* @param arrayBuffer input array buffer
* @param indexStart the index at which the phrase is stored
* @return retrieved string
*/
export function arrayBufferToStringAtIndex(
arrayBuffer: Uint8Array,
indexStart: number,
): string {
let indexEnd = indexStart;
while (arrayBuffer[indexEnd] !== 0) {
indexEnd++;
}
const utf8decoder = new TextDecoder('utf-8');
return utf8decoder.decode(arrayBuffer.subarray(indexStart, indexEnd));
}
/**
* Decode a base64 string and stored it in a Uint8Array array
*
* @param base64String input base64 string
* @return decoded array
*/
export function base64ToUint8Array(base64String: string): Uint8Array {
const base64StringDecoded = atob(base64String);
const binaryArray = new Uint8Array(base64StringDecoded.length);
for (let i = 0; i < base64StringDecoded.length; i++) {
binaryArray[i] = base64StringDecoded.charCodeAt(i);
}
return binaryArray;
}
/**
* Encode an ArrayBuffer array to base64 string
*
* @param arrayBuffer input array
* @param size size of the phrase to be encoded
* @param index the index at which the phrase is stored
* @return base64 string
*/
export function arrayBufferToBase64AtIndex(arrayBuffer: ArrayBuffer, size: number, index: number): string {
let binary = '';
for (let i = 0; i < size; i++) {
// @ts-ignore
binary += String.fromCharCode(arrayBuffer[index + i]);
}
return btoa(binary);
}
/**
* Convert a string header to JS object
*
* @param stringHeader input string in json format
* @return retrieved object
*/
// eslint-disable-next-line
export function stringHeaderToObject(stringHeader: string): object {
const objectHeader = {};
for (const property of stringHeader.split('\r\n')) {
const keyValuePair = property.split(': ');
if (keyValuePair[0] !== '') {
// @ts-ignore
objectHeader[keyValuePair[0]] = keyValuePair[1];
}
}
return objectHeader;
}
/**
* A wrapper to fetch that also supports timeout
*
* @param uri the URL of the resource
* @param options other options related to fetch
* @param time timeout value
* @return received response
*/
export async function fetchWithTimeout(uri: string, options = {}, time = 5000): Promise<Response> {
const controller = new AbortController();
const config = { ...options, signal: controller.signal };
const timeout = setTimeout(() => {
controller.abort();
}, time);
const response = await fetch(uri, config);
clearTimeout(timeout);
return response;
}
/**
* Checking whether the given AccessKey is valid
*
* @return true if the AccessKey is valid, false if not
*/
export function isAccessKeyValid(accessKey: string): boolean {
if (typeof accessKey !== 'string' || accessKey === undefined || accessKey === null) {
return false;
}
const accessKeyCleaned = accessKey.trim();
if (accessKeyCleaned === '') { return false; }
try {
return btoa(atob(accessKeyCleaned)) === accessKeyCleaned;
} catch (err) {
return false;
}
}
const objectHeader = {};
for (const property of stringHeader.split('\r\n')) {
const keyValuePair = property.split(': ');
if (keyValuePair[0] !== '') {
// @ts-ignore
objectHeader[keyValuePair[0]] = keyValuePair[1];
}
}
return objectHeader;
}
/**
* A wrapper to fetch that also supports timeout
*
* @param uri the URL of the resource
* @param options other options related to fetch
* @param time timeout value
* @return received response
*/
export async function fetchWithTimeout(uri: string, options = {}, time = 5000): Promise<Response> {
const controller = new AbortController();
const config = { ...options, signal: controller.signal };
const timeout = setTimeout(() => {
controller.abort();
}, time);
const response = await fetch(uri, config);
clearTimeout(timeout);
return response;
}
/**
* Checking whether the given AccessKey is valid
*
* @return true if the AccessKey is valid, false if not
*/
export function isAccessKeyValid(accessKey: string): boolean {
if (typeof accessKey !== 'string' || accessKey === undefined || accessKey === null) {
return false;
}
const accessKeyCleaned = accessKey.trim();
if (accessKeyCleaned === '') { return false; }
try {
return btoa(atob(accessKeyCleaned)) === accessKeyCleaned;
} catch (err) {
return false;
}
}

@@ -12,2 +12,4 @@ /*

/* eslint camelcase: 0 */
import * as Asyncify from 'asyncify-wasm';

@@ -24,4 +26,6 @@

import { wasiSnapshotPreview1Emulator } from './wasi_snapshot';
import {PvFile} from "./pv_file";
import {wasiSnapshotPreview1Emulator} from './wasi_snapshot';
export type aligned_alloc_type = (alignment: number, size: number) => Promise<number>;

@@ -34,3 +38,3 @@ export type pv_free_type = (ptr: number) => Promise<void>;

* @param memory Initialized WebAssembly memory object.
* @param wasm_base64 The wasm file in base64 string to initialize.
* @param wasm The wasm file in base64 string or stream to public path (i.e. fetch("file.wasm")) to initialize.
* @returns An object containing the exported functions from WASM.

@@ -40,3 +44,3 @@ */

memory: WebAssembly.Memory,
wasm_base64: string
wasm: string | Promise<Response>
): Promise<any> {

@@ -224,4 +228,4 @@ const memoryBufferUint8 = new Uint8Array(memory.buffer);

try {
const isExists = await storage.getItem(path);
memoryBufferUint8[isExistsAddress] = (isExists === undefined || isExists === null) ? 0 : 1;
const isExists = await storage.exists(path);
memoryBufferUint8[isExistsAddress] = (isExists) ? 1 : 0;
memoryBufferInt32[

@@ -297,2 +301,113 @@ succeededAddress / Int32Array.BYTES_PER_ELEMENT

const pvFileOpenWasm = async function(
fileAddress: number,
pathAddress: number,
modeAddress: number,
statusAddress: number
) {
const path = arrayBufferToStringAtIndex(memoryBufferUint8, pathAddress);
const mode = arrayBufferToStringAtIndex(memoryBufferUint8, modeAddress);
try {
const file = await PvFile.open(path, mode);
PvFile.setPtr(fileAddress, file);
memoryBufferInt32[
statusAddress / Int32Array.BYTES_PER_ELEMENT
] = 0;
} catch (e) {
memoryBufferInt32[
statusAddress / Int32Array.BYTES_PER_ELEMENT
] = -1;
}
};
const pvFileCloseWasm = async function(
fileAddress: number,
statusAddress: number
) {
try {
const file = await PvFile.getPtr(fileAddress);
await file.close();
memoryBufferInt32[
statusAddress / Int32Array.BYTES_PER_ELEMENT
] = 0;
} catch (e) {
memoryBufferInt32[
statusAddress / Int32Array.BYTES_PER_ELEMENT
] = -1;
}
};
const pvFileReadWasm = async function(
fileAddress: number,
contentAddress: number,
size: number,
count: number,
numReadAddress: number
) {
try {
const file = await PvFile.getPtr(fileAddress);
const content = await file.read(size, count);
memoryBufferUint8.set(content, contentAddress);
memoryBufferInt32[
numReadAddress / Int32Array.BYTES_PER_ELEMENT
] = (content.length / size);
} catch (e) {
memoryBufferInt32[
numReadAddress / Int32Array.BYTES_PER_ELEMENT
] = -1;
}
};
const pvFileSeekWasm = async function(
fileAddress: number,
offset: number,
whence: number,
statusAddress: number
) {
try {
const file = PvFile.getPtr(fileAddress);
file.seek(offset, whence);
memoryBufferInt32[
statusAddress / Int32Array.BYTES_PER_ELEMENT
] = 0;
} catch (e) {
memoryBufferInt32[
statusAddress / Int32Array.BYTES_PER_ELEMENT
] = -1;
}
};
const pvFileTellWasm = async function(
fileAddress: number,
offsetAddress: number,
) {
try {
const file = PvFile.getPtr(fileAddress);
memoryBufferInt32[
offsetAddress / Int32Array.BYTES_PER_ELEMENT
] = file.tell();
} catch (e) {
memoryBufferInt32[
offsetAddress / Int32Array.BYTES_PER_ELEMENT
] = -1;
}
};
const pvFileRemoveWasm = async function(
pathAddress: number,
statusAddress: number
) {
const path = arrayBufferToStringAtIndex(memoryBufferUint8, pathAddress);
try {
await PvFile.remove(path);
memoryBufferInt32[
statusAddress / Int32Array.BYTES_PER_ELEMENT
] = 0;
} catch (e) {
memoryBufferInt32[
statusAddress / Int32Array.BYTES_PER_ELEMENT
] = -1;
}
};
const importObject = {

@@ -303,30 +418,28 @@ // eslint-disable-next-line camelcase

memory: memory,
// eslint-disable-next-line camelcase
pv_console_log_wasm: pvConsoleLogWasm,
// eslint-disable-next-line camelcase
pv_assert_wasm: pvAssertWasm,
// eslint-disable-next-line camelcase
pv_time_wasm: pvTimeWasm,
// eslint-disable-next-line camelcase
pv_https_request_wasm: pvHttpsRequestWasm,
// eslint-disable-next-line camelcase
pv_file_load_wasm: pvFileLoadWasm,
// eslint-disable-next-line camelcase
pv_file_save_wasm: pvFileSaveWasm,
// eslint-disable-next-line camelcase
pv_file_exists_wasm: pvFileExistsWasm,
// eslint-disable-next-line camelcase
pv_file_delete_wasm: pvFileDeleteWasm,
// eslint-disable-next-line camelcase
pv_get_browser_info: pvGetBrowserInfo,
// eslint-disable-next-line camelcase
pv_get_origin_info: pvGetOriginInfo,
pv_file_open_wasm: pvFileOpenWasm,
pv_file_close_wasm: pvFileCloseWasm,
pv_file_read_wasm: pvFileReadWasm,
pv_file_seek_wasm: pvFileSeekWasm,
pv_file_tell_wasm: pvFileTellWasm,
pv_file_remove_wasm: pvFileRemoveWasm
},
};
const wasmCodeArray = base64ToUint8Array(wasm_base64);
const { instance } = await Asyncify.instantiate(
wasmCodeArray,
importObject
);
let instance: WebAssembly.Instance;
if (wasm instanceof Promise) {
instance = (await Asyncify.instantiateStreaming(wasm, importObject)).instance;
} else {
const wasmCodeArray = base64ToUint8Array(wasm);
instance = (await Asyncify.instantiate(wasmCodeArray, importObject)).instance;
}

@@ -333,0 +446,0 @@ const aligned_alloc = instance.exports.aligned_alloc as aligned_alloc_type;

@@ -16,6 +16,6 @@ {

"strict": false,
"target": "esnext"
"target": "esnext",
"types": ["cypress"],
},
"exclude": ["node_modules", "dist"]
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc