@squoosh-kit/webp 0.0.11 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +17 -0
  2. package/dist/bridge.browser.mjs +2 -2
  3. package/dist/bridge.browser.mjs.map +4 -4
  4. package/dist/bridge.bun.js +2 -2
  5. package/dist/bridge.bun.js.map +4 -4
  6. package/dist/bridge.d.ts +2 -2
  7. package/dist/bridge.d.ts.map +1 -1
  8. package/dist/bridge.node.cjs +2 -2
  9. package/dist/bridge.node.cjs.map +4 -4
  10. package/dist/bridge.node.mjs +2 -2
  11. package/dist/bridge.node.mjs.map +4 -4
  12. package/dist/chunk-124gpwf3.js +3 -0
  13. package/dist/chunk-124gpwf3.js.map +10 -0
  14. package/dist/chunk-3e1dzjy4.js +27 -0
  15. package/dist/chunk-3e1dzjy4.js.map +10 -0
  16. package/dist/chunk-494e4bws.js +4 -0
  17. package/dist/chunk-494e4bws.js.map +9 -0
  18. package/dist/chunk-6k9yrqxa.js +5 -0
  19. package/dist/chunk-6k9yrqxa.js.map +9 -0
  20. package/dist/chunk-8pja0p5b.js +5 -0
  21. package/dist/chunk-8pja0p5b.js.map +10 -0
  22. package/dist/chunk-a31j12b6.js +4 -0
  23. package/dist/chunk-a31j12b6.js.map +10 -0
  24. package/dist/chunk-ks7kcgv0.js +4 -0
  25. package/dist/chunk-ks7kcgv0.js.map +9 -0
  26. package/dist/chunk-sc3b6r8w.js +27 -0
  27. package/dist/chunk-sc3b6r8w.js.map +10 -0
  28. package/dist/chunk-t6tcztdc.js +28 -0
  29. package/dist/chunk-t6tcztdc.js.map +10 -0
  30. package/dist/chunk-zwen5g92.js +27 -0
  31. package/dist/chunk-zwen5g92.js.map +10 -0
  32. package/dist/index.browser.mjs +2 -2
  33. package/dist/index.browser.mjs.map +3 -3
  34. package/dist/index.bun.js +2 -2
  35. package/dist/index.bun.js.map +3 -3
  36. package/dist/index.d.ts +4 -4
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.node.cjs.map +1 -1
  39. package/dist/index.node.mjs +2 -2
  40. package/dist/index.node.mjs.map +3 -3
  41. package/dist/types.d.ts +3 -23
  42. package/dist/types.d.ts.map +1 -1
  43. package/dist/types.node.cjs +2 -2
  44. package/dist/types.node.cjs.map +1 -1
  45. package/dist/wasm/webp/webp_enc_simd.d.ts +1 -0
  46. package/dist/wasm/webp/webp_enc_simd.js +16 -0
  47. package/dist/wasm/webp/webp_enc_simd.wasm +0 -0
  48. package/dist/wasm/webp/webp_node_enc.js +16 -0
  49. package/dist/wasm/webp/webp_node_enc.wasm +0 -0
  50. package/dist/wasm/webp-dec/webp_node_dec.js +16 -0
  51. package/dist/wasm/webp-dec/webp_node_dec.wasm +0 -0
  52. package/dist/webp.worker.browser.mjs +20 -21
  53. package/dist/webp.worker.browser.mjs.map +7 -6
  54. package/dist/webp.worker.bun.js +20 -21
  55. package/dist/webp.worker.bun.js.map +7 -6
  56. package/dist/webp.worker.d.ts +2 -2
  57. package/dist/webp.worker.d.ts.map +1 -1
  58. package/dist/webp.worker.node.cjs +20 -20
  59. package/dist/webp.worker.node.cjs.map +7 -6
  60. package/dist/webp.worker.node.mjs +20 -21
  61. package/dist/webp.worker.node.mjs.map +7 -6
  62. package/package.json +2 -2
@@ -1,29 +1,28 @@
1
1
  // @bun
2
- var D8=Object.create;var{getPrototypeOf:R8,defineProperty:m$,getOwnPropertyNames:N8}=Object;var k8=Object.prototype.hasOwnProperty;var z8=(q,V,K)=>{K=q!=null?D8(R8(q)):{};let H=V||!q||!q.__esModule?m$(K,"default",{value:q,enumerable:!0}):K;for(let U of N8(q))if(!k8.call(H,U))m$(H,U,{get:()=>q[U],enumerable:!0});return H};var _8=import.meta.require;async function l$(q){try{if(typeof process<"u"&&process.versions?.node){let V=await import("fs/promises"),H=new URL(q,import.meta.url).pathname,U=await V.readFile(H);return U.buffer.slice(U.byteOffset,U.byteOffset+U.byteLength)}}catch(V){}try{let V=new URL(q,import.meta.url),K=await fetch(V);if(!K.ok)throw Error(`Failed to fetch WASM binary: ${K.status} ${K.statusText}`);return K.arrayBuffer()}catch(V){throw Error(`Failed to load WASM binary from "${q}": ${V instanceof Error?V.message:String(V)}`)}}function h8(q){if(q instanceof SharedArrayBuffer)throw Error("SharedArrayBuffer is not supported. Use regular ArrayBuffer or Uint8Array instead.");if(!(q instanceof ArrayBuffer))throw TypeError("image.data.buffer must be an ArrayBuffer")}function d$(q){if(!q||typeof q!=="object")throw TypeError("image must be an object");let V=q;if(!("data"in V))throw TypeError("image.data is required");let{data:K}=V;if(!(K instanceof Uint8Array||K instanceof Uint8ClampedArray))throw TypeError("image.data must be Uint8Array or Uint8ClampedArray");if(!("width"in V)||!("height"in V))throw TypeError("image.width and image.height are required");let{width:H,height:U}=V;if(typeof H!=="number"||!Number.isInteger(H)||H<=0)throw RangeError(`image.width must be a positive integer, got ${H}`);if(typeof U!=="number"||!Number.isInteger(U)||U<=0)throw RangeError(`image.height must be a positive integer, got ${U}`);let b=H*U*4;if(K.length<b)throw RangeError(`image.data too small: ${K.length} bytes, expected at least ${b} bytes for ${H}x${U} RGBA image`)}function o$(q){if(q!==void 0&&(typeof q!=="object"||q===null))throw TypeError("options must be an object or undefined");if(q===void 0)return;let V=q;if(V.quality!==void 0){if(typeof V.quality!=="number"||!Number.isInteger(V.quality)||V.quality<0||V.quality>100)throw RangeError(`options.quality must be an integer between 0 and 100, got ${V.quality}`)}if(V.lossless!==void 0&&typeof V.lossless!=="boolean")throw TypeError(`options.lossless must be boolean, got ${typeof V.lossless}`);if(V.nearLossless!==void 0&&typeof V.nearLossless!=="boolean")throw TypeError(`options.nearLossless must be boolean, got ${typeof V.nearLossless}`)}var F8=function(){var q=import.meta.url;return function(K){K=K||{};var K=typeof K<"u"?K:{},H,U;K.ready=new Promise(function($,j){H=$,U=j});var b={},k;for(k in K)if(K.hasOwnProperty(k))b[k]=K[k];var T=[],g="./this.program",s=function($,j){throw j},W$=!1,n=!0,F="";function u$($){if(K.locateFile)return K.locateFile($,F);return F+$}var s$,n$,Q$,a$;if(W$||n){if(n)F=self.location.href;else if(typeof document<"u"&&document.currentScript)F=document.currentScript.src;if(q)F=q;if(F.indexOf("blob:")!==0)F=F.substr(0,F.lastIndexOf("/")+1);else F="";{if(s$=function($){var j=new XMLHttpRequest;return j.open("GET",$,!1),j.send(null),j.responseText},n)Q$=function($){var j=new XMLHttpRequest;return j.open("GET",$,!1),j.responseType="arraybuffer",j.send(null),new Uint8Array(j.response)};n$=function($,j,G){var J=new XMLHttpRequest;J.open("GET",$,!0),J.responseType="arraybuffer",J.onload=function(){if(J.status==200||J.status==0&&J.response){j(J.response);return}G()},J.onerror=G,J.send(null)}}a$=function($){document.title=$}}var B8=K.print||console.log.bind(console),c=K.printErr||console.warn.bind(console);for(k in b)if(b.hasOwnProperty(k))K[k]=b[k];if(b=null,K.arguments)T=K.arguments;if(K.thisProgram)g=K.thisProgram;if(K.quit)s=K.quit;var p;if(K.wasmBinary)p=K.wasmBinary;var f8=K.noExitRuntime||!0;if(typeof WebAssembly!=="object")r("no native wasm support detected");var a,b$=!1,t$,r$=new TextDecoder("utf8");function e$($,j){if(!$)return"";var G=$+j;for(var J=$;!(J>=G)&&D[J];)++J;return r$.decode(D.subarray($,J))}function $0($,j,G,J){if(!(J>0))return 0;var Q=G,Z=G+J-1;for(var O=0;O<$.length;++O){var Y=$.charCodeAt(O);if(Y>=55296&&Y<=57343){var X=$.charCodeAt(++O);Y=65536+((Y&1023)<<10)|X&1023}if(Y<=127){if(G>=Z)break;j[G++]=Y}else if(Y<=2047){if(G+1>=Z)break;j[G++]=192|Y>>6,j[G++]=128|Y&63}else if(Y<=65535){if(G+2>=Z)break;j[G++]=224|Y>>12,j[G++]=128|Y>>6&63,j[G++]=128|Y&63}else{if(G+3>=Z)break;j[G++]=240|Y>>18,j[G++]=128|Y>>12&63,j[G++]=128|Y>>6&63,j[G++]=128|Y&63}}return j[G]=0,G-Q}function j0($,j,G){return $0($,D,j,G)}function G0($){var j=0;for(var G=0;G<$.length;++G){var J=$.charCodeAt(G);if(J>=55296&&J<=57343)J=65536+((J&1023)<<10)|$.charCodeAt(++G)&1023;if(J<=127)++j;else if(J<=2047)j+=2;else if(J<=65535)j+=3;else j+=4}return j}var J0=new TextDecoder("utf-16le");function K0($,j){var G=$,J=G>>1,Q=J+j/2;while(!(J>=Q)&&m[J])++J;return G=J<<1,J0.decode(D.subarray($,G));var Z="";for(var O=0;!(O>=j/2);++O){var Y=M[$+O*2>>1];if(Y==0)break;Z+=String.fromCharCode(Y)}return Z}function Q0($,j,G){if(G===void 0)G=2147483647;if(G<2)return 0;G-=2;var J=j,Q=G<$.length*2?G/2:$.length;for(var Z=0;Z<Q;++Z){var O=$.charCodeAt(Z);M[j>>1]=O,j+=2}return M[j>>1]=0,j-J}function Y0($){return $.length*2}function Z0($,j){var G=0,J="";while(!(G>=j/4)){var Q=S[$+G*4>>2];if(Q==0)break;if(++G,Q>=65536){var Z=Q-65536;J+=String.fromCharCode(55296|Z>>10,56320|Z&1023)}else J+=String.fromCharCode(Q)}return J}function X0($,j,G){if(G===void 0)G=2147483647;if(G<4)return 0;var J=j,Q=J+G-4;for(var Z=0;Z<$.length;++Z){var O=$.charCodeAt(Z);if(O>=55296&&O<=57343){var Y=$.charCodeAt(++Z);O=65536+((O&1023)<<10)|Y&1023}if(S[j>>2]=O,j+=4,j+4>Q)break}return S[j>>2]=0,j-J}function O0($){var j=0;for(var G=0;G<$.length;++G){var J=$.charCodeAt(G);if(J>=55296&&J<=57343)++G;j+=4}return j}function q0($,j){if($%j>0)$+=j-$%j;return $}var Y$,t,D,M,m,S,C,A$,D$;function R$($){Y$=$,K.HEAP8=t=new Int8Array($),K.HEAP16=M=new Int16Array($),K.HEAP32=S=new Int32Array($),K.HEAPU8=D=new Uint8Array($),K.HEAPU16=m=new Uint16Array($),K.HEAPU32=C=new Uint32Array($),K.HEAPF32=A$=new Float32Array($),K.HEAPF64=D$=new Float64Array($)}var S8=K.INITIAL_MEMORY||16777216,l,N$=[],k$=[],z$=[],E0=!1;function V0(){if(K.preRun){if(typeof K.preRun=="function")K.preRun=[K.preRun];while(K.preRun.length)U0(K.preRun.shift())}X$(N$)}function L0(){E0=!0,X$(k$)}function H0(){if(K.postRun){if(typeof K.postRun=="function")K.postRun=[K.postRun];while(K.postRun.length)b0(K.postRun.shift())}X$(z$)}function U0($){N$.unshift($)}function W0($){k$.unshift($)}function b0($){z$.unshift($)}var x=0,Z$=null,d=null;function A0($){if(x++,K.monitorRunDependencies)K.monitorRunDependencies(x)}function D0($){if(x--,K.monitorRunDependencies)K.monitorRunDependencies(x);if(x==0){if(Z$!==null)clearInterval(Z$),Z$=null;if(d){var j=d;d=null,j()}}}K.preloadedImages={},K.preloadedAudios={};function r($){if(K.onAbort)K.onAbort($);$+="",c($),b$=!0,t$=1,$="abort("+$+"). Build with -s ASSERTIONS=1 for more info.";var j=new WebAssembly.RuntimeError($);throw U(j),j}var R0="data:application/octet-stream;base64,";function _$($){return $.startsWith(R0)}if(K.locateFile){var _="webp_enc.wasm";if(!_$(_))_=u$(_)}else var _=new URL("webp_enc.wasm",import.meta.url).toString();function F$($){try{if($==_&&p)return new Uint8Array(p);if(Q$)return Q$($);else throw"both async and sync fetching of the wasm failed"}catch(j){r(j)}}function N0(){if(!p&&(W$||n)){if(typeof fetch==="function")return fetch(_,{credentials:"same-origin"}).then(function($){if(!$.ok)throw"failed to load wasm binary file at '"+_+"'";return $.arrayBuffer()}).catch(function(){return F$(_)})}return Promise.resolve().then(function(){return F$(_)})}function k0(){var $={a:U8};function j(O,Y){var X=O.exports;K.asm=X,a=K.asm.x,R$(a.buffer),l=K.asm.D,W0(K.asm.y),D0("wasm-instantiate")}A0("wasm-instantiate");function G(O){j(O.instance)}function J(O){return N0().then(function(Y){var X=WebAssembly.instantiate(Y,$);return X}).then(O,function(Y){c("failed to asynchronously prepare wasm: "+Y),r(Y)})}function Q(){if(!p&&typeof WebAssembly.instantiateStreaming==="function"&&!_$(_)&&typeof fetch==="function")return fetch(_,{credentials:"same-origin"}).then(function(O){var Y=WebAssembly.instantiateStreaming(O,$);return Y.then(G,function(X){return c("wasm streaming compile failed: "+X),c("falling back to ArrayBuffer instantiation"),J(G)})});else return J(G)}if(K.instantiateWasm)try{var Z=K.instantiateWasm($,j);return Z}catch(O){return c("Module.instantiateWasm callback failed with error: "+O),!1}return Q().catch(U),{}}function X$($){while($.length>0){var j=$.shift();if(typeof j=="function"){j(K);continue}var G=j.func;if(typeof G==="number")if(j.arg===void 0)l.get(G)();else l.get(G)(j.arg);else G(j.arg===void 0?null:j.arg)}}function z0($,j){}function _0($,j){return z0($,j)}var e={};function C$($){while($.length){var j=$.pop(),G=$.pop();G(j)}}function $$($){return this.fromWireType(C[$>>2])}var y={},h={},j$={},F0=48,C0=57;function w$($){if($===void 0)return"_unknown";$=$.replace(/[^a-zA-Z0-9_]/g,"$");var j=$.charCodeAt(0);if(j>=F0&&j<=C0)return"_"+$;else return $}function O$($,j){return $=w$($),Function("body","return function "+$+`() {
2
+ import{c as r1,d as t1}from"./chunk-8pja0p5b.js";import{e as u1,f as s1}from"./chunk-6k9yrqxa.js";async function i1(O){try{if(typeof process<"u"&&process.versions?.node){let b=await import("fs/promises"),L=new URL(O,import.meta.url).pathname,E=await b.readFile(L);return E.buffer.slice(E.byteOffset,E.byteOffset+E.byteLength)}}catch(b){}try{let b=new URL(O,import.meta.url),J=await fetch(b);if(!J.ok)throw Error(`Failed to fetch WASM binary: ${J.status} ${J.statusText}`);return await J.arrayBuffer()}catch(b){throw Error(`Failed to load WASM binary from "${O}": ${b instanceof Error?b.message:String(b)}`)}}var n1=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]));var r=null,$1=null;async function o1(){if(r!==null)return r;if($1)return $1;return $1=(async()=>{try{return r=await n1(),r}catch(O){return r=!1,console.warn("SIMD detection failed, falling back to standard WASM modules:",O),!1}})(),$1}var C5=function(){var O=import.meta.url;return function(J){J=J||{};var J=typeof J<"u"?J:{},L,E;J.ready=new Promise(function(A,Q){L=A,E=Q});var U={},z;for(z in J)if(J.hasOwnProperty(z))U[z]=J[z];var y=[],l="./this.program",g=function(A,Q){throw Q},c=!1,p=!0,k="";function j1(A){if(J.locateFile)return J.locateFile(A,k);return k+A}var e1,A0,O1,Q0;if(c||p){if(p)k=self.location.href;else if(typeof document<"u"&&document.currentScript)k=document.currentScript.src;if(O)k=O;if(k.indexOf("blob:")!==0)k=k.substr(0,k.lastIndexOf("/")+1);else k="";{if(e1=function(A){var Q=new XMLHttpRequest;return Q.open("GET",A,!1),Q.send(null),Q.responseText},p)O1=function(A){var Q=new XMLHttpRequest;return Q.open("GET",A,!1),Q.responseType="arraybuffer",Q.send(null),new Uint8Array(Q.response)};A0=function(A,Q,X){var Z=new XMLHttpRequest;Z.open("GET",A,!0),Z.responseType="arraybuffer",Z.onload=function(){if(Z.status==200||Z.status==0&&Z.response){Q(Z.response);return}X()},Z.onerror=X,Z.send(null)}}Q0=function(A){document.title=A}}var I5=J.print||console.log.bind(console),d=J.printErr||console.warn.bind(console);for(z in U)if(U.hasOwnProperty(z))J[z]=U[z];if(U=null,J.arguments)y=J.arguments;if(J.thisProgram)l=J.thisProgram;if(J.quit)g=J.quit;var u;if(J.wasmBinary)u=J.wasmBinary;var S5=J.noExitRuntime||!0;if(typeof WebAssembly!=="object")Q1("no native wasm support detected");var e,N1=!1,X0,Z0=new TextDecoder("utf8");function J0(A,Q){if(!A)return"";var X=A+Q;for(var Z=A;!(Z>=X)&&D[Z];)++Z;return Z0.decode(D.subarray(A,Z))}function Y0(A,Q,X,Z){if(!(Z>0))return 0;var Y=X,K=X+Z-1;for(var j=0;j<A.length;++j){var G=A.charCodeAt(j);if(G>=55296&&G<=57343){var $=A.charCodeAt(++j);G=65536+((G&1023)<<10)|$&1023}if(G<=127){if(X>=K)break;Q[X++]=G}else if(G<=2047){if(X+1>=K)break;Q[X++]=192|G>>6,Q[X++]=128|G&63}else if(G<=65535){if(X+2>=K)break;Q[X++]=224|G>>12,Q[X++]=128|G>>6&63,Q[X++]=128|G&63}else{if(X+3>=K)break;Q[X++]=240|G>>18,Q[X++]=128|G>>12&63,Q[X++]=128|G>>6&63,Q[X++]=128|G&63}}return Q[X]=0,X-Y}function G0(A,Q,X){return Y0(A,D,Q,X)}function K0(A){var Q=0;for(var X=0;X<A.length;++X){var Z=A.charCodeAt(X);if(Z>=55296&&Z<=57343)Z=65536+((Z&1023)<<10)|A.charCodeAt(++X)&1023;if(Z<=127)++Q;else if(Z<=2047)Q+=2;else if(Z<=65535)Q+=3;else Q+=4}return Q}var $0=new TextDecoder("utf-16le");function j0(A,Q){var X=A,Z=X>>1,Y=Z+Q/2;while(!(Z>=Y)&&s[Z])++Z;return X=Z<<1,$0.decode(D.subarray(A,X));var K="";for(var j=0;!(j>=Q/2);++j){var G=f[A+j*2>>1];if(G==0)break;K+=String.fromCharCode(G)}return K}function O0(A,Q,X){if(X===void 0)X=2147483647;if(X<2)return 0;X-=2;var Z=Q,Y=X<A.length*2?X/2:A.length;for(var K=0;K<Y;++K){var j=A.charCodeAt(K);f[Q>>1]=j,Q+=2}return f[Q>>1]=0,Q-Z}function V0(A){return A.length*2}function q0(A,Q){var X=0,Z="";while(!(X>=Q/4)){var Y=M[A+X*4>>2];if(Y==0)break;if(++X,Y>=65536){var K=Y-65536;Z+=String.fromCharCode(55296|K>>10,56320|K&1023)}else Z+=String.fromCharCode(Y)}return Z}function W0(A,Q,X){if(X===void 0)X=2147483647;if(X<4)return 0;var Z=Q,Y=Z+X-4;for(var K=0;K<A.length;++K){var j=A.charCodeAt(K);if(j>=55296&&j<=57343){var G=A.charCodeAt(++K);j=65536+((j&1023)<<10)|G&1023}if(M[Q>>2]=j,Q+=4,Q+4>Y)break}return M[Q>>2]=0,Q-Z}function E0(A){var Q=0;for(var X=0;X<A.length;++X){var Z=A.charCodeAt(X);if(Z>=55296&&Z<=57343)++X;Q+=4}return Q}function L0(A,Q){if(A%Q>0)A+=Q-A%Q;return A}var V1,A1,D,f,s,M,_,k1,F1;function z1(A){V1=A,J.HEAP8=A1=new Int8Array(A),J.HEAP16=f=new Int16Array(A),J.HEAP32=M=new Int32Array(A),J.HEAPU8=D=new Uint8Array(A),J.HEAPU16=s=new Uint16Array(A),J.HEAPU32=_=new Uint32Array(A),J.HEAPF32=k1=new Float32Array(A),J.HEAPF64=F1=new Float64Array(A)}var P5=J.INITIAL_MEMORY||16777216,i,C1=[],R1=[],_1=[],U0=!1;function H0(){if(J.preRun){if(typeof J.preRun=="function")J.preRun=[J.preRun];while(J.preRun.length)N0(J.preRun.shift())}W1(C1)}function b0(){U0=!0,W1(R1)}function D0(){if(J.postRun){if(typeof J.postRun=="function")J.postRun=[J.postRun];while(J.postRun.length)F0(J.postRun.shift())}W1(_1)}function N0(A){C1.unshift(A)}function k0(A){R1.unshift(A)}function F0(A){_1.unshift(A)}var v=0,q1=null,n=null;function z0(A){if(v++,J.monitorRunDependencies)J.monitorRunDependencies(v)}function C0(A){if(v--,J.monitorRunDependencies)J.monitorRunDependencies(v);if(v==0){if(q1!==null)clearInterval(q1),q1=null;if(n){var Q=n;n=null,Q()}}}J.preloadedImages={},J.preloadedAudios={};function Q1(A){if(J.onAbort)J.onAbort(A);A+="",d(A),N1=!0,X0=1,A="abort("+A+"). Build with -s ASSERTIONS=1 for more info.";var Q=new WebAssembly.RuntimeError(A);throw E(Q),Q}var R0="data:application/octet-stream;base64,";function B1(A){return A.startsWith(R0)}if(J.locateFile){var R="webp_enc.wasm";if(!B1(R))R=j1(R)}else var R=new URL("webp_enc.wasm",import.meta.url).toString();function I1(A){try{if(A==R&&u)return new Uint8Array(u);if(O1)return O1(A);else throw"both async and sync fetching of the wasm failed"}catch(Q){Q1(Q)}}function _0(){if(!u&&(c||p)){if(typeof fetch==="function")return fetch(R,{credentials:"same-origin"}).then(function(A){if(!A.ok)throw"failed to load wasm binary file at '"+R+"'";return A.arrayBuffer()}).catch(function(){return I1(R)})}return Promise.resolve().then(function(){return I1(R)})}function B0(){var A={a:N5};function Q(j,G){var $=j.exports;J.asm=$,e=J.asm.x,z1(e.buffer),i=J.asm.D,k0(J.asm.y),C0("wasm-instantiate")}z0("wasm-instantiate");function X(j){Q(j.instance)}function Z(j){return _0().then(function(G){var $=WebAssembly.instantiate(G,A);return $}).then(j,function(G){d("failed to asynchronously prepare wasm: "+G),Q1(G)})}function Y(){if(!u&&typeof WebAssembly.instantiateStreaming==="function"&&!B1(R)&&typeof fetch==="function")return fetch(R,{credentials:"same-origin"}).then(function(j){var G=WebAssembly.instantiateStreaming(j,A);return G.then(X,function($){return d("wasm streaming compile failed: "+$),d("falling back to ArrayBuffer instantiation"),Z(X)})});else return Z(X)}if(J.instantiateWasm)try{var K=J.instantiateWasm(A,Q);return K}catch(j){return d("Module.instantiateWasm callback failed with error: "+j),!1}return Y().catch(E),{}}function W1(A){while(A.length>0){var Q=A.shift();if(typeof Q=="function"){Q(J);continue}var X=Q.func;if(typeof X==="number")if(Q.arg===void 0)i.get(X)();else i.get(X)(Q.arg);else X(Q.arg===void 0?null:Q.arg)}}function I0(A,Q){}function S0(A,Q){return I0(A,Q)}var X1={};function S1(A){while(A.length){var Q=A.pop(),X=A.pop();X(Q)}}function Z1(A){return this.fromWireType(_[A>>2])}var m={},T={},J1={},P0=48,w0=57;function P1(A){if(A===void 0)return"_unknown";A=A.replace(/[^a-zA-Z0-9_]/g,"$");var Q=A.charCodeAt(0);if(Q>=P0&&Q<=w0)return"_"+A;else return A}function E1(A,Q){return A=P1(A),Function("body","return function "+A+`() {
3
3
  "use strict"; return body.apply(this, arguments);
4
4
  };
5
- `)(j)}function q$($,j){var G=O$(j,function(J){this.name=j,this.message=J;var Q=Error(J).stack;if(Q!==void 0)this.stack=this.toString()+`
6
- `+Q.replace(/^Error(:[^\n]*)?\n/,"")});return G.prototype=Object.create($.prototype),G.prototype.constructor=G,G.prototype.toString=function(){if(this.message===void 0)return this.name;else return this.name+": "+this.message},G}var I$=void 0;function B$($){throw new I$($)}function f$($,j,G){$.forEach(function(Y){j$[Y]=j});function J(Y){var X=G(Y);if(X.length!==$.length)B$("Mismatched type converter count");for(var E=0;E<$.length;++E)w($[E],X[E])}var Q=Array(j.length),Z=[],O=0;if(j.forEach(function(Y,X){if(h.hasOwnProperty(Y))Q[X]=h[Y];else{if(Z.push(Y),!y.hasOwnProperty(Y))y[Y]=[];y[Y].push(function(){if(Q[X]=h[Y],++O,O===Z.length)J(Q)})}}),Z.length===0)J(Q)}function w0($){var j=e[$];delete e[$];var{rawConstructor:G,rawDestructor:J,fields:Q}=j,Z=Q.map(function(O){return O.getterReturnType}).concat(Q.map(function(O){return O.setterArgumentType}));f$([$],Z,function(O){var Y={};return Q.forEach(function(X,E){var L=X.fieldName,W=O[E],R=X.getter,f=X.getterContext,I=O[E+Q.length],v=X.setter,P=X.setterContext;Y[L]={read:function(i){return W.fromWireType(R(f,i))},write:function(i,A8){var p$=[];v(P,i,I.toWireType(p$,A8)),C$(p$)}}}),[{name:j.name,fromWireType:function(X){var E={};for(var L in Y)E[L]=Y[L].read(X);return J(X),E},toWireType:function(X,E){for(var L in Y)if(!(L in E))throw TypeError('Missing field: "'+L+'"');var W=G();for(L in Y)Y[L].write(W,E[L]);if(X!==null)X.push(J,W);return W},argPackAdvance:8,readValueFromPointer:$$,destructorFunction:J}]})}function I0($,j,G,J,Q){}function G$($){switch($){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw TypeError("Unknown type size: "+$)}}function B0(){var $=Array(256);for(var j=0;j<256;++j)$[j]=String.fromCharCode(j);S$=$}var S$=void 0;function A($){var j="",G=$;while(D[G])j+=S$[D[G++]];return j}var P$=void 0;function N($){throw new P$($)}function w($,j,G){if(G=G||{},!("argPackAdvance"in j))throw TypeError("registerType registeredInstance requires argPackAdvance");var J=j.name;if(!$)N('type "'+J+'" must have a positive integer typeid pointer');if(h.hasOwnProperty($))if(G.ignoreDuplicateRegistrations)return;else N("Cannot register type '"+J+"' twice");if(h[$]=j,delete j$[$],y.hasOwnProperty($)){var Q=y[$];delete y[$],Q.forEach(function(Z){Z()})}}function f0($,j,G,J,Q){var Z=G$(G);j=A(j),w($,{name:j,fromWireType:function(O){return!!O},toWireType:function(O,Y){return Y?J:Q},argPackAdvance:8,readValueFromPointer:function(O){var Y;if(G===1)Y=t;else if(G===2)Y=M;else if(G===4)Y=S;else throw TypeError("Unknown boolean type size: "+j);return this.fromWireType(Y[O>>Z])},destructorFunction:null})}var E$=[],z=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function M$($){if($>4&&--z[$].refcount===0)z[$]=void 0,E$.push($)}function S0(){var $=0;for(var j=5;j<z.length;++j)if(z[j]!==void 0)++$;return $}function P0(){for(var $=5;$<z.length;++$)if(z[$]!==void 0)return z[$];return null}function M0(){K.count_emval_handles=S0,K.get_first_emval=P0}function J$($){switch($){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:{var j=E$.length?E$.pop():z.length;return z[j]={refcount:1,value:$},j}}}function x0($,j){j=A(j),w($,{name:j,fromWireType:function(G){var J=z[G].value;return M$(G),J},toWireType:function(G,J){return J$(J)},argPackAdvance:8,readValueFromPointer:$$,destructorFunction:null})}function h0($,j,G){if($[j].overloadTable===void 0){var J=$[j];$[j]=function(){if(!$[j].overloadTable.hasOwnProperty(arguments.length))N("Function '"+G+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+$[j].overloadTable+")!");return $[j].overloadTable[arguments.length].apply(this,arguments)},$[j].overloadTable=[],$[j].overloadTable[J.argCount]=J}}function x$($,j,G){if(K.hasOwnProperty($)){if(G===void 0||K[$].overloadTable!==void 0&&K[$].overloadTable[G]!==void 0)N("Cannot register public name '"+$+"' twice");if(h0(K,$,$),K.hasOwnProperty(G))N("Cannot register multiple overloads of a function with the same number of arguments ("+G+")!");K[$].overloadTable[G]=j}else if(K[$]=j,G!==void 0)K[$].numArguments=G}function v0($,j,G){switch(j){case 0:return function(J){var Q=G?t:D;return this.fromWireType(Q[J])};case 1:return function(J){var Q=G?M:m;return this.fromWireType(Q[J>>1])};case 2:return function(J){var Q=G?S:C;return this.fromWireType(Q[J>>2])};default:throw TypeError("Unknown integer type: "+$)}}function T0($,j,G,J){var Q=G$(G);j=A(j);function Z(){}Z.values={},w($,{name:j,constructor:Z,fromWireType:function(O){return this.constructor.values[O]},toWireType:function(O,Y){return Y.value},argPackAdvance:8,readValueFromPointer:v0(j,Q,J),destructorFunction:null}),x$(j,Z)}function h$($){var j=c$($),G=A(j);return B(j),G}function v$($,j){var G=h[$];if(G===void 0)N(j+" has unknown type "+h$($));return G}function y0($,j,G){var J=v$($,"enum");j=A(j);var Q=J.constructor,Z=Object.create(J.constructor.prototype,{value:{value:G},constructor:{value:O$(J.name+"_"+j,function(){})}});Q.values[G]=Z,Q[j]=Z}function V$($){if($===null)return"null";var j=typeof $;if(j==="object"||j==="array"||j==="function")return $.toString();else return""+$}function g0($,j){switch(j){case 2:return function(G){return this.fromWireType(A$[G>>2])};case 3:return function(G){return this.fromWireType(D$[G>>3])};default:throw TypeError("Unknown float type: "+$)}}function c0($,j,G){var J=G$(G);j=A(j),w($,{name:j,fromWireType:function(Q){return Q},toWireType:function(Q,Z){if(typeof Z!=="number"&&typeof Z!=="boolean")throw TypeError('Cannot convert "'+V$(Z)+'" to '+this.name);return Z},argPackAdvance:8,readValueFromPointer:g0(j,J),destructorFunction:null})}function p0($,j){if(!($ instanceof Function))throw TypeError("new_ called with constructor type "+typeof $+" which is not a function");var G=O$($.name||"unknownFunctionName",function(){});G.prototype=$.prototype;var J=new G,Q=$.apply(J,j);return Q instanceof Object?Q:J}function m0($,j,G,J,Q){var Z=j.length;if(Z<2)N("argTypes array size mismatch! Must at least get return value and 'this' types!");var O=j[1]!==null&&G!==null,Y=!1;for(var X=1;X<j.length;++X)if(j[X]!==null&&j[X].destructorFunction===void 0){Y=!0;break}var E=j[0].name!=="void",L="",W="";for(var X=0;X<Z-2;++X)L+=(X!==0?", ":"")+"arg"+X,W+=(X!==0?", ":"")+"arg"+X+"Wired";var R="return function "+w$($)+"("+L+`) {
7
- if (arguments.length !== `+(Z-2)+`) {
8
- throwBindingError('function `+$+" called with ' + arguments.length + ' arguments, expected "+(Z-2)+` args!');
5
+ `)(Q)}function L1(A,Q){var X=E1(Q,function(Z){this.name=Q,this.message=Z;var Y=Error(Z).stack;if(Y!==void 0)this.stack=this.toString()+`
6
+ `+Y.replace(/^Error(:[^\n]*)?\n/,"")});return X.prototype=Object.create(A.prototype),X.prototype.constructor=X,X.prototype.toString=function(){if(this.message===void 0)return this.name;else return this.name+": "+this.message},X}var w1=void 0;function M1(A){throw new w1(A)}function x1(A,Q,X){A.forEach(function(G){J1[G]=Q});function Z(G){var $=X(G);if($.length!==A.length)M1("Mismatched type converter count");for(var V=0;V<A.length;++V)B(A[V],$[V])}var Y=Array(Q.length),K=[],j=0;if(Q.forEach(function(G,$){if(T.hasOwnProperty(G))Y[$]=T[G];else{if(K.push(G),!m.hasOwnProperty(G))m[G]=[];m[G].push(function(){if(Y[$]=T[G],++j,j===K.length)Z(Y)})}}),K.length===0)Z(Y)}function M0(A){var Q=X1[A];delete X1[A];var{rawConstructor:X,rawDestructor:Z,fields:Y}=Q,K=Y.map(function(j){return j.getterReturnType}).concat(Y.map(function(j){return j.setterArgumentType}));x1([A],K,function(j){var G={};return Y.forEach(function($,V){var q=$.fieldName,W=j[V],N=$.getter,w=$.getterContext,I=j[V+Y.length],h=$.setter,x=$.setterContext;G[q]={read:function(a){return W.fromWireType(N(w,a))},write:function(a,z5){var d1=[];h(x,a,I.toWireType(d1,z5)),S1(d1)}}}),[{name:Q.name,fromWireType:function($){var V={};for(var q in G)V[q]=G[q].read($);return Z($),V},toWireType:function($,V){for(var q in G)if(!(q in V))throw TypeError('Missing field: "'+q+'"');var W=X();for(q in G)G[q].write(W,V[q]);if($!==null)$.push(Z,W);return W},argPackAdvance:8,readValueFromPointer:Z1,destructorFunction:Z}]})}function x0(A,Q,X,Z,Y){}function Y1(A){switch(A){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw TypeError("Unknown type size: "+A)}}function f0(){var A=Array(256);for(var Q=0;Q<256;++Q)A[Q]=String.fromCharCode(Q);f1=A}var f1=void 0;function H(A){var Q="",X=A;while(D[X])Q+=f1[D[X++]];return Q}var v1=void 0;function F(A){throw new v1(A)}function B(A,Q,X){if(X=X||{},!("argPackAdvance"in Q))throw TypeError("registerType registeredInstance requires argPackAdvance");var Z=Q.name;if(!A)F('type "'+Z+'" must have a positive integer typeid pointer');if(T.hasOwnProperty(A))if(X.ignoreDuplicateRegistrations)return;else F("Cannot register type '"+Z+"' twice");if(T[A]=Q,delete J1[A],m.hasOwnProperty(A)){var Y=m[A];delete m[A],Y.forEach(function(K){K()})}}function v0(A,Q,X,Z,Y){var K=Y1(X);Q=H(Q),B(A,{name:Q,fromWireType:function(j){return!!j},toWireType:function(j,G){return G?Z:Y},argPackAdvance:8,readValueFromPointer:function(j){var G;if(X===1)G=A1;else if(X===2)G=f;else if(X===4)G=M;else throw TypeError("Unknown boolean type size: "+Q);return this.fromWireType(G[j>>K])},destructorFunction:null})}var U1=[],C=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function T1(A){if(A>4&&--C[A].refcount===0)C[A]=void 0,U1.push(A)}function T0(){var A=0;for(var Q=5;Q<C.length;++Q)if(C[Q]!==void 0)++A;return A}function h0(){for(var A=5;A<C.length;++A)if(C[A]!==void 0)return C[A];return null}function y0(){J.count_emval_handles=T0,J.get_first_emval=h0}function G1(A){switch(A){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:{var Q=U1.length?U1.pop():C.length;return C[Q]={refcount:1,value:A},Q}}}function g0(A,Q){Q=H(Q),B(A,{name:Q,fromWireType:function(X){var Z=C[X].value;return T1(X),Z},toWireType:function(X,Z){return G1(Z)},argPackAdvance:8,readValueFromPointer:Z1,destructorFunction:null})}function c0(A,Q,X){if(A[Q].overloadTable===void 0){var Z=A[Q];A[Q]=function(){if(!A[Q].overloadTable.hasOwnProperty(arguments.length))F("Function '"+X+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+A[Q].overloadTable+")!");return A[Q].overloadTable[arguments.length].apply(this,arguments)},A[Q].overloadTable=[],A[Q].overloadTable[Z.argCount]=Z}}function h1(A,Q,X){if(J.hasOwnProperty(A)){if(X===void 0||J[A].overloadTable!==void 0&&J[A].overloadTable[X]!==void 0)F("Cannot register public name '"+A+"' twice");if(c0(J,A,A),J.hasOwnProperty(X))F("Cannot register multiple overloads of a function with the same number of arguments ("+X+")!");J[A].overloadTable[X]=Q}else if(J[A]=Q,X!==void 0)J[A].numArguments=X}function p0(A,Q,X){switch(Q){case 0:return function(Z){var Y=X?A1:D;return this.fromWireType(Y[Z])};case 1:return function(Z){var Y=X?f:s;return this.fromWireType(Y[Z>>1])};case 2:return function(Z){var Y=X?M:_;return this.fromWireType(Y[Z>>2])};default:throw TypeError("Unknown integer type: "+A)}}function m0(A,Q,X,Z){var Y=Y1(X);Q=H(Q);function K(){}K.values={},B(A,{name:Q,constructor:K,fromWireType:function(j){return this.constructor.values[j]},toWireType:function(j,G){return G.value},argPackAdvance:8,readValueFromPointer:p0(Q,Y,Z),destructorFunction:null}),h1(Q,K)}function y1(A){var Q=l1(A),X=H(Q);return P(Q),X}function g1(A,Q){var X=T[A];if(X===void 0)F(Q+" has unknown type "+y1(A));return X}function l0(A,Q,X){var Z=g1(A,"enum");Q=H(Q);var Y=Z.constructor,K=Object.create(Z.constructor.prototype,{value:{value:X},constructor:{value:E1(Z.name+"_"+Q,function(){})}});Y.values[X]=K,Y[Q]=K}function H1(A){if(A===null)return"null";var Q=typeof A;if(Q==="object"||Q==="array"||Q==="function")return A.toString();else return""+A}function d0(A,Q){switch(Q){case 2:return function(X){return this.fromWireType(k1[X>>2])};case 3:return function(X){return this.fromWireType(F1[X>>3])};default:throw TypeError("Unknown float type: "+A)}}function u0(A,Q,X){var Z=Y1(X);Q=H(Q),B(A,{name:Q,fromWireType:function(Y){return Y},toWireType:function(Y,K){if(typeof K!=="number"&&typeof K!=="boolean")throw TypeError('Cannot convert "'+H1(K)+'" to '+this.name);return K},argPackAdvance:8,readValueFromPointer:d0(Q,Z),destructorFunction:null})}function s0(A,Q){if(!(A instanceof Function))throw TypeError("new_ called with constructor type "+typeof A+" which is not a function");var X=E1(A.name||"unknownFunctionName",function(){});X.prototype=A.prototype;var Z=new X,Y=A.apply(Z,Q);return Y instanceof Object?Y:Z}function i0(A,Q,X,Z,Y){var K=Q.length;if(K<2)F("argTypes array size mismatch! Must at least get return value and 'this' types!");var j=Q[1]!==null&&X!==null,G=!1;for(var $=1;$<Q.length;++$)if(Q[$]!==null&&Q[$].destructorFunction===void 0){G=!0;break}var V=Q[0].name!=="void",q="",W="";for(var $=0;$<K-2;++$)q+=($!==0?", ":"")+"arg"+$,W+=($!==0?", ":"")+"arg"+$+"Wired";var N="return function "+P1(A)+"("+q+`) {
7
+ if (arguments.length !== `+(K-2)+`) {
8
+ throwBindingError('function `+A+" called with ' + arguments.length + ' arguments, expected "+(K-2)+` args!');
9
9
  }
10
- `;if(Y)R+=`var destructors = [];
11
- `;var f=Y?"destructors":"null",I=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],v=[N,J,Q,C$,j[0],j[1]];if(O)R+="var thisWired = classParam.toWireType("+f+`, this);
12
- `;for(var X=0;X<Z-2;++X)R+="var arg"+X+"Wired = argType"+X+".toWireType("+f+", arg"+X+"); // "+j[X+2].name+`
13
- `,I.push("argType"+X),v.push(j[X+2]);if(O)W="thisWired"+(W.length>0?", ":"")+W;if(R+=(E?"var rv = ":"")+"invoker(fn"+(W.length>0?", ":"")+W+`);
14
- `,Y)R+=`runDestructors(destructors);
15
- `;else for(var X=O?1:2;X<j.length;++X){var P=X===1?"thisWired":"arg"+(X-2)+"Wired";if(j[X].destructorFunction!==null)R+=P+"_dtor("+P+"); // "+j[X].name+`
16
- `,I.push(P+"_dtor"),v.push(j[X].destructorFunction)}if(E)R+=`var ret = retType.fromWireType(rv);
10
+ `;if(G)N+=`var destructors = [];
11
+ `;var w=G?"destructors":"null",I=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],h=[F,Z,Y,S1,Q[0],Q[1]];if(j)N+="var thisWired = classParam.toWireType("+w+`, this);
12
+ `;for(var $=0;$<K-2;++$)N+="var arg"+$+"Wired = argType"+$+".toWireType("+w+", arg"+$+"); // "+Q[$+2].name+`
13
+ `,I.push("argType"+$),h.push(Q[$+2]);if(j)W="thisWired"+(W.length>0?", ":"")+W;if(N+=(V?"var rv = ":"")+"invoker(fn"+(W.length>0?", ":"")+W+`);
14
+ `,G)N+=`runDestructors(destructors);
15
+ `;else for(var $=j?1:2;$<Q.length;++$){var x=$===1?"thisWired":"arg"+($-2)+"Wired";if(Q[$].destructorFunction!==null)N+=x+"_dtor("+x+"); // "+Q[$].name+`
16
+ `,I.push(x+"_dtor"),h.push(Q[$].destructorFunction)}if(V)N+=`var ret = retType.fromWireType(rv);
17
17
  return ret;
18
- `;R+=`}
19
- `,I.push(R);var i=p0(Function,I).apply(null,v);return i}function l0($,j){var G=[];for(var J=0;J<$;J++)G.push(S[(j>>2)+J]);return G}function d0($,j,G){if(!K.hasOwnProperty($))B$("Replacing nonexistant public symbol");if(K[$].overloadTable!==void 0&&G!==void 0)K[$].overloadTable[G]=j;else K[$]=j,K[$].argCount=G}function o0($,j,G){var J=K["dynCall_"+$];return G&&G.length?J.apply(null,[j].concat(G)):J.call(null,j)}function i0($,j,G){if($.includes("j"))return o0($,j,G);return l.get(j).apply(null,G)}function u0($,j){var G=[];return function(){G.length=arguments.length;for(var J=0;J<arguments.length;J++)G[J]=arguments[J];return i0($,j,G)}}function o($,j){$=A($);function G(){if($.includes("j"))return u0($,j);return l.get(j)}var J=G();if(typeof J!=="function")N("unknown function pointer with signature "+$+": "+j);return J}var T$=void 0;function s0($,j){var G=[],J={};function Q(Z){if(J[Z])return;if(h[Z])return;if(j$[Z]){j$[Z].forEach(Q);return}G.push(Z),J[Z]=!0}throw j.forEach(Q),new T$($+": "+G.map(h$).join([", "]))}function n0($,j,G,J,Q,Z){var O=l0(j,G);$=A($),Q=o(J,Q),x$($,function(){s0("Cannot call "+$+" due to unbound types",O)},j-1),f$([],O,function(Y){var X=[Y[0],null].concat(Y.slice(1));return d0($,m0($,X,null,Q,Z),j-1),[]})}function a0($,j,G){switch(j){case 0:return G?function(Q){return t[Q]}:function(Q){return D[Q]};case 1:return G?function(Q){return M[Q>>1]}:function(Q){return m[Q>>1]};case 2:return G?function(Q){return S[Q>>2]}:function(Q){return C[Q>>2]};default:throw TypeError("Unknown integer type: "+$)}}function t0($,j,G,J,Q){if(j=A(j),Q===-1)Q=4294967295;var Z=G$(G),O=function(E){return E};if(J===0){var Y=32-8*G;O=function(E){return E<<Y>>>Y}}var X=j.includes("unsigned");w($,{name:j,fromWireType:O,toWireType:function(E,L){if(typeof L!=="number"&&typeof L!=="boolean")throw TypeError('Cannot convert "'+V$(L)+'" to '+this.name);if(L<J||L>Q)throw TypeError('Passing a number "'+V$(L)+'" from JS side to C/C++ side to an argument of type "'+j+'", which is outside the valid range ['+J+", "+Q+"]!");return X?L>>>0:L|0},argPackAdvance:8,readValueFromPointer:a0(j,Z,J!==0),destructorFunction:null})}function r0($,j,G){var J=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Q=J[j];function Z(O){O=O>>2;var Y=C,X=Y[O],E=Y[O+1];return new Q(Y$,E,X)}G=A(G),w($,{name:G,fromWireType:Z,argPackAdvance:8,readValueFromPointer:Z},{ignoreDuplicateRegistrations:!0})}function e0($,j){j=A(j);var G=j==="std::string";w($,{name:j,fromWireType:function(J){var Q=C[J>>2],Z;if(G){var O=J+4;for(var Y=0;Y<=Q;++Y){var X=J+4+Y;if(Y==Q||D[X]==0){var E=X-O,L=e$(O,E);if(Z===void 0)Z=L;else Z+=String.fromCharCode(0),Z+=L;O=X+1}}}else{var W=Array(Q);for(var Y=0;Y<Q;++Y)W[Y]=String.fromCharCode(D[J+4+Y]);Z=W.join("")}return B(J),Z},toWireType:function(J,Q){if(Q instanceof ArrayBuffer)Q=new Uint8Array(Q);var Z,O=typeof Q==="string";if(!(O||Q instanceof Uint8Array||Q instanceof Uint8ClampedArray||Q instanceof Int8Array))N("Cannot pass non-string to std::string");if(G&&O)Z=function(){return G0(Q)};else Z=function(){return Q.length};var Y=Z(),X=L$(4+Y+1);if(C[X>>2]=Y,G&&O)j0(Q,X+4,Y+1);else if(O)for(var E=0;E<Y;++E){var L=Q.charCodeAt(E);if(L>255)B(X),N("String has UTF-16 code units that do not fit in 8 bits");D[X+4+E]=L}else for(var E=0;E<Y;++E)D[X+4+E]=Q[E];if(J!==null)J.push(B,X);return X},argPackAdvance:8,readValueFromPointer:$$,destructorFunction:function(J){B(J)}})}function $8($,j,G){G=A(G);var J,Q,Z,O,Y;if(j===2)J=K0,Q=Q0,O=Y0,Z=function(){return m},Y=1;else if(j===4)J=Z0,Q=X0,O=O0,Z=function(){return C},Y=2;w($,{name:G,fromWireType:function(X){var E=C[X>>2],L=Z(),W,R=X+4;for(var f=0;f<=E;++f){var I=X+4+f*j;if(f==E||L[I>>Y]==0){var v=I-R,P=J(R,v);if(W===void 0)W=P;else W+=String.fromCharCode(0),W+=P;R=I+j}}return B(X),W},toWireType:function(X,E){if(typeof E!=="string")N("Cannot pass non-string to C++ string type "+G);var L=O(E),W=L$(4+L+j);if(C[W>>2]=L>>Y,Q(E,W+4,L+j),X!==null)X.push(B,W);return W},argPackAdvance:8,readValueFromPointer:$$,destructorFunction:function(X){B(X)}})}function j8($,j,G,J,Q,Z){e[$]={name:A(j),rawConstructor:o(G,J),rawDestructor:o(Q,Z),fields:[]}}function G8($,j,G,J,Q,Z,O,Y,X,E){e[$].fields.push({fieldName:A(j),getterReturnType:G,getter:o(J,Q),getterContext:Z,setterArgumentType:O,setter:o(Y,X),setterContext:E})}function J8($,j){j=A(j),w($,{isVoid:!0,name:j,argPackAdvance:0,fromWireType:function(){return},toWireType:function(G,J){return}})}var K8={};function Q8($){var j=K8[$];if(j===void 0)return A($);else return j}function y$(){if(typeof globalThis==="object")return globalThis;return function(){return Function}()("return this")()}function Y8($){if($===0)return J$(y$());else return $=Q8($),J$(y$()[$])}function Z8($){if($>4)z[$].refcount+=1}function X8($){var j="";for(var G=0;G<$;++G)j+=(G!==0?", ":"")+"arg"+G;var J="return function emval_allocator_"+$+`(constructor, argTypes, args) {
20
- `;for(var G=0;G<$;++G)J+="var argType"+G+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+G+'], "parameter '+G+`");
21
- var arg`+G+" = argType"+G+`.readValueFromPointer(args);
22
- args += argType`+G+`['argPackAdvance'];
23
- `;return J+="var obj = new constructor("+j+`);
18
+ `;N+=`}
19
+ `,I.push(N);var a=s0(Function,I).apply(null,h);return a}function n0(A,Q){var X=[];for(var Z=0;Z<A;Z++)X.push(M[(Q>>2)+Z]);return X}function o0(A,Q,X){if(!J.hasOwnProperty(A))M1("Replacing nonexistant public symbol");if(J[A].overloadTable!==void 0&&X!==void 0)J[A].overloadTable[X]=Q;else J[A]=Q,J[A].argCount=X}function a0(A,Q,X){var Z=J["dynCall_"+A];return X&&X.length?Z.apply(null,[Q].concat(X)):Z.call(null,Q)}function r0(A,Q,X){if(A.includes("j"))return a0(A,Q,X);return i.get(Q).apply(null,X)}function t0(A,Q){var X=[];return function(){X.length=arguments.length;for(var Z=0;Z<arguments.length;Z++)X[Z]=arguments[Z];return r0(A,Q,X)}}function o(A,Q){A=H(A);function X(){if(A.includes("j"))return t0(A,Q);return i.get(Q)}var Z=X();if(typeof Z!=="function")F("unknown function pointer with signature "+A+": "+Q);return Z}var c1=void 0;function e0(A,Q){var X=[],Z={};function Y(K){if(Z[K])return;if(T[K])return;if(J1[K]){J1[K].forEach(Y);return}X.push(K),Z[K]=!0}throw Q.forEach(Y),new c1(A+": "+X.map(y1).join([", "]))}function A5(A,Q,X,Z,Y,K){var j=n0(Q,X);A=H(A),Y=o(Z,Y),h1(A,function(){e0("Cannot call "+A+" due to unbound types",j)},Q-1),x1([],j,function(G){var $=[G[0],null].concat(G.slice(1));return o0(A,i0(A,$,null,Y,K),Q-1),[]})}function Q5(A,Q,X){switch(Q){case 0:return X?function(Y){return A1[Y]}:function(Y){return D[Y]};case 1:return X?function(Y){return f[Y>>1]}:function(Y){return s[Y>>1]};case 2:return X?function(Y){return M[Y>>2]}:function(Y){return _[Y>>2]};default:throw TypeError("Unknown integer type: "+A)}}function X5(A,Q,X,Z,Y){if(Q=H(Q),Y===-1)Y=4294967295;var K=Y1(X),j=function(V){return V};if(Z===0){var G=32-8*X;j=function(V){return V<<G>>>G}}var $=Q.includes("unsigned");B(A,{name:Q,fromWireType:j,toWireType:function(V,q){if(typeof q!=="number"&&typeof q!=="boolean")throw TypeError('Cannot convert "'+H1(q)+'" to '+this.name);if(q<Z||q>Y)throw TypeError('Passing a number "'+H1(q)+'" from JS side to C/C++ side to an argument of type "'+Q+'", which is outside the valid range ['+Z+", "+Y+"]!");return $?q>>>0:q|0},argPackAdvance:8,readValueFromPointer:Q5(Q,K,Z!==0),destructorFunction:null})}function Z5(A,Q,X){var Z=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Y=Z[Q];function K(j){j=j>>2;var G=_,$=G[j],V=G[j+1];return new Y(V1,V,$)}X=H(X),B(A,{name:X,fromWireType:K,argPackAdvance:8,readValueFromPointer:K},{ignoreDuplicateRegistrations:!0})}function J5(A,Q){Q=H(Q);var X=Q==="std::string";B(A,{name:Q,fromWireType:function(Z){var Y=_[Z>>2],K;if(X){var j=Z+4;for(var G=0;G<=Y;++G){var $=Z+4+G;if(G==Y||D[$]==0){var V=$-j,q=J0(j,V);if(K===void 0)K=q;else K+=String.fromCharCode(0),K+=q;j=$+1}}}else{var W=Array(Y);for(var G=0;G<Y;++G)W[G]=String.fromCharCode(D[Z+4+G]);K=W.join("")}return P(Z),K},toWireType:function(Z,Y){if(Y instanceof ArrayBuffer)Y=new Uint8Array(Y);var K,j=typeof Y==="string";if(!(j||Y instanceof Uint8Array||Y instanceof Uint8ClampedArray||Y instanceof Int8Array))F("Cannot pass non-string to std::string");if(X&&j)K=function(){return K0(Y)};else K=function(){return Y.length};var G=K(),$=b1(4+G+1);if(_[$>>2]=G,X&&j)G0(Y,$+4,G+1);else if(j)for(var V=0;V<G;++V){var q=Y.charCodeAt(V);if(q>255)P($),F("String has UTF-16 code units that do not fit in 8 bits");D[$+4+V]=q}else for(var V=0;V<G;++V)D[$+4+V]=Y[V];if(Z!==null)Z.push(P,$);return $},argPackAdvance:8,readValueFromPointer:Z1,destructorFunction:function(Z){P(Z)}})}function Y5(A,Q,X){X=H(X);var Z,Y,K,j,G;if(Q===2)Z=j0,Y=O0,j=V0,K=function(){return s},G=1;else if(Q===4)Z=q0,Y=W0,j=E0,K=function(){return _},G=2;B(A,{name:X,fromWireType:function($){var V=_[$>>2],q=K(),W,N=$+4;for(var w=0;w<=V;++w){var I=$+4+w*Q;if(w==V||q[I>>G]==0){var h=I-N,x=Z(N,h);if(W===void 0)W=x;else W+=String.fromCharCode(0),W+=x;N=I+Q}}return P($),W},toWireType:function($,V){if(typeof V!=="string")F("Cannot pass non-string to C++ string type "+X);var q=j(V),W=b1(4+q+Q);if(_[W>>2]=q>>G,Y(V,W+4,q+Q),$!==null)$.push(P,W);return W},argPackAdvance:8,readValueFromPointer:Z1,destructorFunction:function($){P($)}})}function G5(A,Q,X,Z,Y,K){X1[A]={name:H(Q),rawConstructor:o(X,Z),rawDestructor:o(Y,K),fields:[]}}function K5(A,Q,X,Z,Y,K,j,G,$,V){X1[A].fields.push({fieldName:H(Q),getterReturnType:X,getter:o(Z,Y),getterContext:K,setterArgumentType:j,setter:o(G,$),setterContext:V})}function $5(A,Q){Q=H(Q),B(A,{isVoid:!0,name:Q,argPackAdvance:0,fromWireType:function(){return},toWireType:function(X,Z){return}})}var j5={};function O5(A){var Q=j5[A];if(Q===void 0)return H(A);else return Q}function p1(){if(typeof globalThis==="object")return globalThis;return function(){return Function}()("return this")()}function V5(A){if(A===0)return G1(p1());else return A=O5(A),G1(p1()[A])}function q5(A){if(A>4)C[A].refcount+=1}function W5(A){var Q="";for(var X=0;X<A;++X)Q+=(X!==0?", ":"")+"arg"+X;var Z="return function emval_allocator_"+A+`(constructor, argTypes, args) {
20
+ `;for(var X=0;X<A;++X)Z+="var argType"+X+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+X+'], "parameter '+X+`");
21
+ var arg`+X+" = argType"+X+`.readValueFromPointer(args);
22
+ args += argType`+X+`['argPackAdvance'];
23
+ `;return Z+="var obj = new constructor("+Q+`);
24
24
  return __emval_register(obj);
25
25
  }
26
- `,Function("requireRegisteredType","Module","__emval_register",J)(v$,K,J$)}var g$={};function O8($){if(!$)N("Cannot use deleted val. handle = "+$);return z[$].value}function q8($,j,G,J){$=O8($);var Q=g$[j];if(!Q)Q=X8(j),g$[j]=Q;return Q($,G,J)}function E8(){r()}function V8($,j,G){D.copyWithin($,j,j+G)}function L8($){try{return a.grow($-Y$.byteLength+65535>>>16),R$(a.buffer),1}catch(j){}}function H8($){var j=D.length;$=$>>>0;var G=2147483648;if($>G)return!1;for(var J=1;J<=4;J*=2){var Q=j*(1+0.2/J);Q=Math.min(Q,$+100663296);var Z=Math.min(G,q0(Math.max($,Q),65536)),O=L8(Z);if(O)return!0}return!1}I$=K.InternalError=q$(Error,"InternalError"),B0(),P$=K.BindingError=q$(Error,"BindingError"),M0(),T$=K.UnboundTypeError=q$(Error,"UnboundTypeError");var U8={w:_0,l:w0,p:I0,s:f0,r:x0,n:T0,d:y0,j:c0,h:n0,c:t0,b:r0,k:e0,g:$8,m:j8,a:G8,t:J8,f:M$,v:Y8,u:Z8,o:q8,i:E8,q:V8,e:H8},P8=k0(),W8=K.___wasm_call_ctors=function(){return(W8=K.___wasm_call_ctors=K.asm.y).apply(null,arguments)},L$=K._malloc=function(){return(L$=K._malloc=K.asm.z).apply(null,arguments)},B=K._free=function(){return(B=K._free=K.asm.A).apply(null,arguments)},c$=K.___getTypeName=function(){return(c$=K.___getTypeName=K.asm.B).apply(null,arguments)},b8=K.___embind_register_native_and_builtin_types=function(){return(b8=K.___embind_register_native_and_builtin_types=K.asm.C).apply(null,arguments)},K$;d=function $(){if(!K$)H$();if(!K$)d=$};function H$($){if($=$||T,x>0)return;if(V0(),x>0)return;function j(){if(K$)return;if(K$=!0,K.calledRun=!0,b$)return;if(L0(),H(K),K.onRuntimeInitialized)K.onRuntimeInitialized();H0()}if(K.setStatus)K.setStatus("Running..."),setTimeout(function(){setTimeout(function(){K.setStatus("")},1),j()},1);else j()}if(K.run=H$,K.preInit){if(typeof K.preInit=="function")K.preInit=[K.preInit];while(K.preInit.length>0)K.preInit.pop()()}return H$(),K.ready}}(),i$=F8;var U$=null,u=null;async function C8(){if(U$)return U$;if(u)return u;return u=(async()=>{try{if(typeof self>"u")global.self=global;if(typeof self<"u"&&!self.location)self.location={href:import.meta.url};let q=null,V=[new URL("./wasm/webp/webp_enc.wasm",import.meta.url).href,new URL("../wasm/webp/webp_enc.wasm",import.meta.url).href],K=null;for(let U of V)try{q=await l$(U);break}catch(b){K=b instanceof Error?b:Error(String(b))}if(!q)throw K||Error("Could not load WASM binary from any path");let H=await i$({wasmBinary:q});return U$=H,H}catch(q){throw u=null,Error(`Failed to load WebP module: ${q instanceof Error?q.message:String(q)}`)}})(),u}function w8(q){let V=Math.max(0,Math.min(100,q?.quality??82)),K=q?.lossless??!1,H=q?.nearLossless??!1;return{quality:V,target_size:0,target_PSNR:0,method:0,sns_strength:0,filter_strength:0,filter_sharpness:0,filter_type:0,partitions:0,segments:1,pass:1,show_compressed:0,preprocessing:0,autofilter:0,partition_limit:0,alpha_compression:0,alpha_filtering:0,alpha_quality:0,lossless:K?1:0,exact:0,image_hint:0,emulate_jpeg_size:0,thread_level:0,low_memory:1,near_lossless:H?V:100,use_delta_palette:0,use_sharp_yuv:0}}async function I8(q,V,K){if(d$(q),o$(V),K?.aborted)throw new DOMException("Aborted","AbortError");let{width:H,height:U,data:b}=q;if(!(b instanceof Uint8Array)&&!(b instanceof Uint8ClampedArray))throw Error("Image data must be Uint8Array or Uint8ClampedArray");let k=await C8();if(K?.aborted)throw new DOMException("Aborted","AbortError");let T=w8(V),g=b instanceof Uint8ClampedArray?new Uint8Array(b.buffer,b.byteOffset,b.length):new Uint8Array(b.buffer,b.byteOffset,b.length),s=k.encode(g,H,U,T);if(K?.aborted)throw new DOMException("Aborted","AbortError");if(!s)throw Error("WebP encoding failed");return s}if(typeof self<"u")self.onmessage=async(q)=>{let V=q.data;if(V?.type==="worker:ping"){self.postMessage({type:"worker:ready"});return}let K=V,H={id:K.id,ok:!1};try{if(K.type==="webp:encode"){let{image:U,options:b}=K.payload,k=new AbortController,T=await I8(U,b,k.signal);H.ok=!0,H.data=T;let g=H.data.buffer;self.postMessage(H,[g])}else H.error=`Unknown message type: ${K.type}`,self.postMessage(H)}catch(U){H.error=U instanceof Error?U.message:String(U),self.postMessage(H)}};export{I8 as webpEncodeClient};
27
- export{h8 as b,d$ as c,I8 as d};
26
+ `,Function("requireRegisteredType","Module","__emval_register",Z)(g1,J,G1)}var m1={};function E5(A){if(!A)F("Cannot use deleted val. handle = "+A);return C[A].value}function L5(A,Q,X,Z){A=E5(A);var Y=m1[Q];if(!Y)Y=W5(Q),m1[Q]=Y;return Y(A,X,Z)}function U5(){Q1()}function H5(A,Q,X){D.copyWithin(A,Q,Q+X)}function b5(A){try{return e.grow(A-V1.byteLength+65535>>>16),z1(e.buffer),1}catch(Q){}}function D5(A){var Q=D.length;A=A>>>0;var X=2147483648;if(A>X)return!1;for(var Z=1;Z<=4;Z*=2){var Y=Q*(1+0.2/Z);Y=Math.min(Y,A+100663296);var K=Math.min(X,L0(Math.max(A,Y),65536)),j=b5(K);if(j)return!0}return!1}w1=J.InternalError=L1(Error,"InternalError"),f0(),v1=J.BindingError=L1(Error,"BindingError"),y0(),c1=J.UnboundTypeError=L1(Error,"UnboundTypeError");var N5={w:S0,l:M0,p:x0,s:v0,r:g0,n:m0,d:l0,j:u0,h:A5,c:X5,b:Z5,k:J5,g:Y5,m:G5,a:K5,t:$5,f:T1,v:V5,u:q5,o:L5,i:U5,q:H5,e:D5},w5=B0(),k5=J.___wasm_call_ctors=function(){return(k5=J.___wasm_call_ctors=J.asm.y).apply(null,arguments)},b1=J._malloc=function(){return(b1=J._malloc=J.asm.z).apply(null,arguments)},P=J._free=function(){return(P=J._free=J.asm.A).apply(null,arguments)},l1=J.___getTypeName=function(){return(l1=J.___getTypeName=J.asm.B).apply(null,arguments)},F5=J.___embind_register_native_and_builtin_types=function(){return(F5=J.___embind_register_native_and_builtin_types=J.asm.C).apply(null,arguments)},K1;n=function A(){if(!K1)D1();if(!K1)n=A};function D1(A){if(A=A||y,v>0)return;if(H0(),v>0)return;function Q(){if(K1)return;if(K1=!0,J.calledRun=!0,N1)return;if(b0(),L(J),J.onRuntimeInitialized)J.onRuntimeInitialized();D0()}if(J.setStatus)J.setStatus("Running..."),setTimeout(function(){setTimeout(function(){J.setStatus("")},1),Q()},1);else Q()}if(J.run=D1,J.preInit){if(typeof J.preInit=="function")J.preInit=[J.preInit];while(J.preInit.length>0)J.preInit.pop()()}return D1(),J.ready}}(),a1=C5;var S=null,t=null;async function R5(){if(S)return S;if(t)return t;return t=(async()=>{try{if(typeof self>"u")global.self=global;if(typeof self<"u"&&!self.location)self.location={href:import.meta.url};if(typeof SharedArrayBuffer>"u"&&typeof window>"u")globalThis.SharedArrayBuffer=ArrayBuffer;let O=async(J,L)=>{try{let E=await i1(L);if(typeof console<"u"&&console.log)console.log(`[WebP] Loaded WASM binary from ${L} (${(E.byteLength/1024).toFixed(1)}KB)`);return J({noInitialRun:!0,wasmBinary:E})}catch(E){if(typeof console<"u"&&console.warn)console.warn("[WebP] Failed to load WASM binary explicitly, trying module initialization without it:",E);return J({noInitialRun:!0})}};if(await o1()){if(typeof console<"u"&&console.log)console.log("[WebP] SIMD support detected, loading SIMD encoder");try{let J=await import("./chunk-t6tcztdc.js");if(S=await O(J.default,"./wasm/webp/webp_enc_simd.wasm"),S)return S}catch(J){if(typeof console<"u"&&console.warn)console.warn("[WebP] Failed to load SIMD encoder, falling back to standard:",J)}}if(S=await O(a1,"./wasm/webp/webp_enc.wasm"),!S)throw Error("Failed to load WebP module");return S}catch(O){throw t=null,Error(`Failed to load WebP module: ${O instanceof Error?O.message:String(O)}`)}})(),t}function _5(O){return{quality:O?.quality??75,target_size:0,target_PSNR:0,method:O?.method??4,sns_strength:O?.sns_strength??50,filter_strength:O?.filter_strength??60,filter_sharpness:O?.filter_sharpness??0,filter_type:O?.filter_type??1,partitions:O?.partitions??0,segments:O?.segments??4,pass:O?.pass??1,show_compressed:0,preprocessing:O?.preprocessing??0,autofilter:O?.autofilter??0,partition_limit:0,alpha_compression:O?.alpha_compression??1,alpha_filtering:O?.alpha_filtering??1,alpha_quality:O?.alpha_quality??O?.quality??75,lossless:O?.lossless?1:0,exact:O?.exact??0,image_hint:O?.image_hint??0,emulate_jpeg_size:0,thread_level:0,low_memory:0,near_lossless:O?.near_lossless??O?.quality??75,use_delta_palette:0,use_sharp_yuv:O?.use_sharp_yuv??0}}async function B5(O,b,J){if(r1(O),t1(b),J?.aborted)throw new DOMException("Aborted","AbortError");let{width:L,height:E,data:U}=O;if(!(U instanceof Uint8Array)&&!(U instanceof Uint8ClampedArray))throw Error("Image data must be Uint8Array or Uint8ClampedArray");let z=performance.now(),y=await R5(),l=performance.now();if(typeof console<"u"&&console.log)console.log(`[WebP] module loading took ${(l-z).toFixed(2)}ms`),console.log(`[WebP] Module type: ${S&&"encode"in S?"Ready":"Unknown"}`);if(J?.aborted)throw new DOMException("Aborted","AbortError");let g=_5(b),c=U instanceof Uint8ClampedArray?new Uint8Array(U.buffer,U.byteOffset,U.length):new Uint8Array(U.buffer,U.byteOffset,U.length);if(typeof console<"u"&&console.log)console.log("[WebP] encode options:",g);let p=performance.now(),k=y.encode(c,L,E,g),j1=performance.now();if(typeof console<"u"&&console.log)console.log(`[WebP] actual encoding took ${(j1-p).toFixed(2)}ms`);if(J?.aborted)throw new DOMException("Aborted","AbortError");if(!k)throw Error("WebP encoding failed");return k}if(typeof self<"u")self.onmessage=async(O)=>{let b=O.data;if(b?.type==="worker:ping"){self.postMessage({type:"worker:ready"});return}let J=b,L={id:J.id,ok:!1};try{if(J.type==="webp:encode"){let{image:E,options:U}=J.payload,z=performance.now(),y=new AbortController,l=await B5(E,U,y.signal),g=performance.now();if(typeof console<"u"&&console.log)console.log(`[WebP Worker] encode took ${(g-z).toFixed(2)}ms`);L.ok=!0,L.data=l;let c=L.data.buffer;self.postMessage(L,[c])}else L.error=`Unknown message type: ${J.type}`,self.postMessage(L)}catch(E){L.error=E instanceof Error?E.message:String(E),self.postMessage(L)}};export{B5 as webpEncodeClient};
28
27
 
29
- //# debugId=8918A320ED88C96064756E2164756E21
28
+ //# debugId=593E335D433A8BF964756E2164756E21