mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-11 08:39:59 +01:00
2 lines
2.2 KiB
JavaScript
2 lines
2.2 KiB
JavaScript
(()=>{"use strict";"undefined"!=typeof window&&window.innerHeight,Math.round(425),new Set(["newMessage","newScheduledMessage","deleteMessages","deleteScheduledMessages","deleteHistory"]);const e=new Set(["image/png","image/gif","image/jpeg"]),r=new Set(["video/mp4"]);new Set([...e,...r]),self.onerror=e=>{console.error(e),n({type:"unhandledError",error:{message:e.error.message||"Uncaught exception in worker"}})},self.addEventListener("unhandledrejection",(e=>{console.error(e),n({type:"unhandledError",error:{message:e.reason.message||"Uncaught rejection in worker"}})}));const t=new Map;function n(e,r){r?postMessage(e,r):postMessage(e)}let s;self.importScripts("rlottie-wasm.js");const a=new Promise((e=>{Module.onRuntimeInitialized=()=>{s={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()}})),o=new Map;var i;i={init:async function(e,r,t,n,i,d){s||await a;const c=JSON.stringify(r),l=allocate(intArrayFromString(c),"i8",0),m=s.init(),u=s.loadFromData(m,l);s.resize(m,t,t),o.set(e,{imgSize:t,reduceFactor:i,handle:m}),d(Math.ceil(u/i))},renderFrames:async function(e,r,t,n){s||await a;const{imgSize:i,reduceFactor:d,handle:c}=o.get(e);for(let e=r;e<=t;e++){const r=e*d;s.render(c,r);const t=s.buffer(c),a=Module.HEAPU8.subarray(t,t+i*i*4);n(e,new Uint8ClampedArray(a).buffer)}},destroy:function(e){const r=o.get(e);s.destroy(r.handle),o.delete(e)}},onmessage=async e=>{const{data:r}=e;switch(r.type){case"callMethod":{const{messageId:e,name:s,args:a}=r;try{if(e){const r=(...r)=>{const t=r[r.length-1];n({type:"methodCallback",messageId:e,callbackArgs:r},t instanceof ArrayBuffer?[t]:void 0)};t.set(e,r),a.push(r)}const[r,o]=await i[s](...a)||[];e&&n({type:"methodResponse",messageId:e,response:r},o)}catch(r){e&&n({type:"methodResponse",messageId:e,error:{message:r.message}})}e&&t.delete(e);break}case"cancelProgress":{const e=t.get(r.messageId);e&&(e.isCanceled=!0);break}}}})();
|
|
//# sourceMappingURL=354.66f9ca14284fc8fced2c.js.map
|