OctoSpaccHub/static/MatrixStickerHelper/gifskiWasm.mjs

9 lines
2.6 KiB
JavaScript
Raw Permalink Normal View History

2024-01-08 22:15:40 +01:00
/**
* Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
* Original file: /npm/gifski-wasm@1.0.1/dist/encode.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
let e,n=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});n.decode();let t=null;function r(){return null!==t&&t.buffer===e.memory.buffer||(t=new Uint8Array(e.memory.buffer)),t}let a=0;function i(e){return null==e}let o,s=null;function u(){return null!==s&&s.buffer===e.memory.buffer||(s=new Int32Array(e.memory.buffer)),s}function c(n,t,o,s,c,f,l,w,y){try{const A=e.__wbindgen_add_to_stack_pointer(-16);var b=function(e,n){const t=n(1*e.length);return r().set(e,t/1),a=e.length,t}(n,e.__wbindgen_malloc),m=a;e.encode(A,b,m,t,o,s,c,i(f)?16777215:f,!i(l),i(l)?0:l,!i(w),i(w)?0:w,!i(y),i(y)?0:y);var d=u()[A/4+0],_=u()[A/4+1],g=(p=d,h=_,r().subarray(p/1,p/1+h)).slice();return e.__wbindgen_free(d,1*_),g}finally{e.__wbindgen_add_to_stack_pointer(16)}var p,h}async function f(t){void 0===t&&(t=new URL("gifski_wasm_bg.wasm",import.meta.url));const a={wbg:{}};a.wbg.__wbindgen_throw=function(e,t){throw new Error((a=e,i=t,n.decode(r().subarray(a,a+i))));var a,i},("string"==typeof t||"function"==typeof Request&&t instanceof Request||"function"==typeof URL&&t instanceof URL)&&(t=fetch(t));const{instance:i,module:o}=await async function(e,n){if("function"==typeof Response&&e instanceof Response){if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(e,n)}catch(n){if("application/wasm"==e.headers.get("Content-Type"))throw n;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n)}const t=await e.arrayBuffer();return await WebAssembly.instantiate(t,n)}{const t=await WebAssembly.instantiate(e,n);return t instanceof WebAssembly.Instance?{instance:t,module:e}:t}}(await t,a);return e=i.exports,f.__wbindgen_wasm_module=o,e}async function l(e){return o||(o=f(e)),o}async function w({frames:e,width:n,height:t,fps:r,quality:a,repeat:i,resizeWidth:o,resizeHeight:s}){await l();const u=e.length,f=function(e){return e.reduce(((e,n)=>{let t=n instanceof ImageData||"data"in n?n.data:n;return 0===e.length?new Uint8Array([...t]):new Uint8Array([...e,...t])}),new Uint8Array)}(e),w=await c(f,u,n,t,r,a,i,o,s);if(!w)throw new Error("Encoding error.");return w}export{w as default,l as init};
//# sourceMappingURL=/sm/0ab991bbadedff9172e10cdbaf8863ccfe6ed2722a690eb1ed55d8a76f12d2ee.map