2021-08-16 13:23:25 +02:00
|
|
|
(()=>{"use strict";"undefined"!=typeof window&&window.innerHeight,Math.round(425),new Set(["newMessage","newScheduledMessage","deleteMessages","deleteScheduledMessages","deleteHistory"]),new Set(["image/png","image/gif","image/jpeg","video/mp4","video/avi","video/quicktime"]),self.onerror=e=>{console.error(e),r({type:"unhandledError",error:{message:e.error.message||"Uncaught exception in worker"}})},self.addEventListener("unhandledrejection",(e=>{console.error(e),r({type:"unhandledError",error:{message:e.reason.message||"Uncaught rejection in worker"}})}));const e=new Map;function r(e,r){r?postMessage(e,r):postMessage(e)}let t;self.importScripts("rlottie-wasm.js");const n=new Promise((e=>{Module.onRuntimeInitialized=()=>{t={init:Module.cwrap("lottie_init","",[]),destroy:Module.cwrap("lottie_destroy","",["number"]),resize:Module.cwrap("lottie_resize","",["number","number","number"]),buffer:Module.cwrap("lottie_buffer","number",["number"]),render:Module.cwrap("lottie_render","",["number","number"]),loadFromData:Module.cwrap("lottie_load_from_data","number",["number","number"])},e()}})),s=new Map;var a;a={init:async function(e,r,a,o,i,d){t||await n;const c=JSON.stringify(r),l=allocate(intArrayFromString(c),"i8",0),m=t.init(),u=t.loadFromData(m,l);t.resize(m,a,a),s.set(e,{imgSize:a,reduceFactor:i,handle:m}),d(Math.ceil(u/i))},renderFrames:async function(e,r,a,o){t||await n;const{imgSize:i,reduceFactor:d,handle:c}=s.get(e);for(let e=r;e<=a;e++){const r=e*d;t.render(c,r);const n=t.buffer(c),s=Module.HEAPU8.subarray(n,n+i*i*4);o(e,new Uint8ClampedArray(s).buffer)}},destroy:function(e){const r=s.get(e);t.destroy(r.handle),s.delete(e)}},onmessage=async t=>{const{data:n}=t;switch(n.type){case"callMethod":{const{messageId:t,name:s,args:o}=n;try{if(t){const n=(...e)=>{const n=e[e.length-1];r({type:"methodCallback",messageId:t,callbackArgs:e},n instanceof ArrayBuffer?[n]:void 0)};e.set(t,n),o.push(n)}const[n,i]=await a[s](...o)||[];t&&r({type:"methodResponse",messageId:t,response:n},i)}catch(e){t&&r({type:"methodResponse",messageId:t,error:{message:e.message}})}t&&e.delete(t);break}case"cancelProgress":{const r=e.get(n.messageId);r&&(r.isCanceled=!0);break}}}})();
|