Skip to content

🎥 Make videos programmatically with React

fix color table types

Jonny Burger559bac69f0dd
diff --git a/packages/gif/src/gifuct/index.ts b/packages/gif/src/gifuct/index.ts
index ddb43c364d..02e4f0c701 100644
--- a/packages/gif/src/gifuct/index.ts
+++ b/packages/gif/src/gifuct/index.ts
@@ -42,7 +42,9 @@ export const decompressFrame = (
width: frame.image.descriptor.width,
height: frame.image.descriptor.height,
},
- colorTable: gct,
+ colorTable: image.descriptor.lct?.exists
+ ? (image.lct as [number, number, number][])
+ : gct,
delay: (frame.gce.delay || 10) * 10,
disposalType: frame.gce.extras.disposal,
transparentIndex: frame.gce.extras.transparentColorGiven
diff --git a/packages/gif/src/gifuct/types.ts b/packages/gif/src/gifuct/types.ts
index 3744f9df37..ffe22a9eb9 100644
--- a/packages/gif/src/gifuct/types.ts
+++ b/packages/gif/src/gifuct/types.ts
@@ -49,6 +49,7 @@ export type Frame = {
height: number;
lct: Lct;
};
+ lct: [number, number, number][] | undefined;
};
};
diff --git a/packages/gif/src/worker/source.ts b/packages/gif/src/worker/source.ts
index 93d522fbb8..53c665d814 100644
--- a/packages/gif/src/worker/source.ts
+++ b/packages/gif/src/worker/source.ts
@@ -1,4 +1,4 @@
// Auto-generated by build.mjs
export const src =
// eslint-disable-next-line no-template-curly-in-string
- "\"use strict\";(()=>{var N=Object.create;var j=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var Y=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty;var T=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var re=(t,e,r,n)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let o of V(e))!ee.call(t,o)&&o!==r&&j(t,o,{get:()=>e[o],enumerable:!(n=Q(e,o))||n.enumerable});return t};var G=(t,e,r)=>(r=t!=null?N(Y(t)):{},re(e||!t||!t.__esModule?j(r,\"default\",{value:t,enumerable:!0}):r,t));var z=T(y=>{\"use strict\";Object.defineProperty(y,\"__esModule\",{value:!0});y.loop=y.conditional=y.parse=void 0;var te=function t(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:n;if(Array.isArray(r))r.forEach(function(a){return t(e,a,n,o)});else if(typeof r==\"function\")r(e,n,o,t);else{var i=Object.keys(r)[0];Array.isArray(r[i])?(o[i]={},t(e,r[i],n,o[i])):o[i]=r[i](e,n,o,t)}return n};y.parse=te;var ne=function(e,r){return function(n,o,i,a){r(n,o,i)&&a(n,e,o,i)}};y.conditional=ne;var ae=function(e,r){return function(n,o,i,a){for(var c=[],d=n.pos;r(n,o,i);){var u={};if(a(n,e,o,u),n.pos===d)break;d=n.pos,c.push(u)}return c}};y.loop=ae});var E=T(p=>{\"use strict\";Object.defineProperty(p,\"__esModule\",{value:!0});p.readBits=p.readArray=p.readUnsigned=p.readString=p.peekBytes=p.readBytes=p.peekByte=p.readByte=p.buildStream=void 0;var oe=function(e){return{data:e,pos:0}};p.buildStream=oe;var W=function(){return function(e){return e.data[e.pos++]}};p.readByte=W;var ie=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return function(r){return r.data[r.pos+e]}};p.peekByte=ie;var _=function(e){return function(r){return r.data.subarray(r.pos,r.pos+=e)}};p.readBytes=_;var se=function(e){return function(r){return r.data.subarray(r.pos,r.pos+e)}};p.peekBytes=se;var de=function(e){return function(r){return Array.from(_(e)(r)).map(function(n){return String.fromCharCode(n)}).join(\"\")}};p.readString=de;var ce=function(e){return function(r){var n=_(2)(r);return e?(n[1]<<8)+n[0]:(n[0]<<8)+n[1]}};p.readUnsigned=ce;var ue=function(e,r){return function(n,o,i){for(var a=typeof r==\"function\"?r(n,o,i):r,c=_(e),d=new Array(a),u=0;u<a;u++)d[u]=c(n);return d}};p.readArray=ue;var le=function(e,r,n){for(var o=0,i=0;i<n;i++)o+=e[r+i]&&Math.pow(2,n-i-1);return o},pe=function(e){return function(r){for(var n=W()(r),o=new Array(8),i=0;i<8;i++)o[7-i]=!!(n&1<<i);return Object.keys(e).reduce(function(a,c){var d=e[c];return d.length?a[c]=le(o,d.index,d.length):a[c]=o[d.index],a},{})}};p.readBits=pe});var K=T(I=>{\"use strict\";Object.defineProperty(I,\"__esModule\",{value:!0});I.default=void 0;var h=z(),s=E(),F={blocks:function(e){for(var r=0,n=[],o=e.data.length,i=0,a=(0,s.readByte)()(e);a!==r&&a;a=(0,s.readByte)()(e)){if(e.pos+a>=o){var c=o-e.pos;n.push((0,s.readBytes)(c)(e)),i+=c;break}n.push((0,s.readBytes)(a)(e)),i+=a}for(var d=new Uint8Array(i),u=0,f=0;f<n.length;f++)d.set(n[f],u),u+=n[f].length;return d}},fe=(0,h.conditional)({gce:[{codes:(0,s.readBytes)(2)},{byteSize:(0,s.readByte)()},{extras:(0,s.readBits)({future:{index:0,length:3},disposal:{index:3,length:3},userInput:{index:6},transparentColorGiven:{index:7}})},{delay:(0,s.readUnsigned)(!0)},{transparentColorIndex:(0,s.readByte)()},{terminator:(0,s.readByte)()}]},function(t){var e=(0,s.peekBytes)(2)(t);return e[0]===33&&e[1]===249}),me=(0,h.conditional)({image:[{code:(0,s.readByte)()},{descriptor:[{left:(0,s.readUnsigned)(!0)},{top:(0,s.readUnsigned)(!0)},{width:(0,s.readUnsigned)(!0)},{height:(0,s.readUnsigned)(!0)},{lct:(0,s.readBits)({exists:{index:0},interlaced:{index:1},sort:{index:2},future:{index:3,length:2},size:{index:5,length:3}})}]},(0,h.conditional)({lct:(0,s.readArray)(3,function(t,e,r){return Math.pow(2,r.descriptor.lct.size+1)})},function(t,e,r){return r.descriptor.lct.exists}),{data:[{minCodeSize:(0,s.readByte)()},F]}]},function(t){return(0,s.peekByte)()(t)===44}),ge=(0,h.conditional)({text:[{codes:(0,s.readBytes)(2)},{blockSize:(0,s.readByte)()},{preData:function(e,r,n){return(0,s.readBytes)(n.text.blockSize)(e)}},F]},function(t){var e=(0,s.peekBytes)(2)(t);return e[0]===33&&e[1]===1}),ye=(0,h.conditional)({application:[{codes:(0,s.readBytes)(2)},{blockSize:(0,s.readByte)()},{id:function(e,r,n){return(0,s.readString)(n.blockSize)(e)}},F]},function(t){var e=(0,s.peekBytes)(2)(t);return e[0]===33&&e[1]===255}),he=(0,h.conditional)({comment:[{codes:(0,s.readBytes)(2)},F]},function(t){var e=(0,s.peekBytes)(2)(t);return e[0]===33&&e[1]===254}),ve=[{header:[{signature:(0,s.readString)(3)},{version:(0,s.readString)(3)}]},{lsd:[{width:(0,s.readUnsigned)(!0)},{height:(0,s.readUnsigned)(!0)},{gct:(0,s.readBits)({exists:{index:0},resolution:{index:1,length:3},sort:{index:4},size:{index:5,length:3}})},{backgroundColorIndex:(0,s.readByte)()},{pixelAspectRatio:(0,s.readByte)()}]},(0,h.conditional)({gct:(0,s.readArray)(3,function(t,e){return Math.pow(2,e.lsd.gct.size+1)})},function(t,e){return e.lsd.gct.exists}),{frames:(0,h.loop)([fe,ye,he,me,ge],function(t){var e=(0,s.peekByte)()(t);return e===33||e===44})}],be=ve;I.default=be});var D=G(z()),O=G(E()),R=G(K());var X=(t,e)=>{let r=new Array(t.length),n=t.length/e,o=function(d,u){let f=t.slice(u*e,(u+1)*e);r.splice(...[d*e,e].concat(f))},i=[0,4,2,1],a=[8,8,4,2],c=0;for(let d=0;d<4;d++)for(let u=i[d];u<n;u+=a[d])o(u,c),c++;return r};var Z=(t,e,r)=>{let i=r,a,c,d,u,f;var B;let l,m;var C,b,g,k,P;let v=new Array(r),U=new Array(4096),A=new Array(4096),S=new Array(4096+1),M=t,x=1<<M,J=x+1;for(a=x+2,f=-1,d=M+1,c=(1<<d)-1,l=0;l<x;l++)U[l]=0,A[l]=l;var C,B,b,g,P,k;for(C=B=b=g=P=k=0,m=0;m<i;){if(g===0){if(B<d){C+=e[k]<<B,B+=8,k++;continue}if(l=C&c,C>>=d,B-=d,l>a||l===J)break;if(l===x){d=M+1,c=(1<<d)-1,a=x+2,f=-1;continue}if(f===-1){S[g++]=A[l],f=l,b=l;continue}for(u=l,l===a&&(S[g++]=b,l=f);l>x;)S[g++]=A[l],l=U[l];b=A[l]&255,S[g++]=b,a<4096&&(U[a]=f,A[a]=b,a++,!(a&c)&&a<4096&&(d++,c+=a)),f=u}g--,v[P++]=S[g],m++}for(m=P;m<i;m++)v[m]=0;return v};var q=t=>{let e=new Uint8Array(t);return(0,D.parse)((0,O.buildStream)(e),R.default)},L=(t,e)=>{var a;if(!t.image){console.warn(\"gif frame does not have associated image.\");return}let{image:r}=t,n=r.descriptor.width*r.descriptor.height,o=Z(r.data.minCodeSize,r.data.blocks,n);return(a=r.descriptor.lct)!=null&&a.interlaced&&(o=X(o,r.descriptor.width)),{pixels:o,dims:{top:t.image.descriptor.top,left:t.image.descriptor.left,width:t.image.descriptor.width,height:t.image.descriptor.height},colorTable:e,delay:(t.gce.delay||10)*10,disposalType:t.gce.extras.disposal,transparentIndex:t.gce.extras.transparentColorGiven?t.gce.transparentColorIndex:-1}};var $=t=>t.frames.filter(e=>!(\"application\"in e)).map(e=>e.image?L(e,t.gct):null).filter(Boolean).map(e=>e);var xe=t=>{let e=null;for(let r of t.frames)e=r.gce?r.gce:e,\"image\"in r&&!(\"gce\"in r)&&e!==null&&(r.gce=e)},H=(t,{signal:e})=>fetch(t,{signal:e}).then(r=>{var n;if(!((n=r.headers.get(\"Content-Type\"))!=null&&n.includes(\"image/gif\")))throw Error(`Wrong content type: \"${r.headers.get(\"Content-Type\")}\"`);return r.arrayBuffer()}).then(r=>q(r)).then(r=>(xe(r),r)).then(r=>Promise.all([$(r),{width:r.lsd.width,height:r.lsd.height}])).then(([r,n])=>{let o=[],i=n.width*n.height*4,a=new Uint8ClampedArray(i);for(let c=0;c<r.length;++c){let d=r[c],u=r[c].disposalType===3?a.slice():null;if(o.push(Be(a,d,n)),r[c].disposalType===2)a=new Uint8ClampedArray(i);else if(r[c].disposalType===3){if(!u)throw Error(\"Disposal type 3 without previous frame\");a=u}else a=o[c].slice()}return{...n,loaded:!0,delays:r.map(c=>c.delay),frames:o}}),Be=(t,e,r)=>{let{width:n,height:o,top:i,left:a}=e.dims,c=i*r.width+a;for(let d=0;d<o;d++)for(let u=0;u<n;u++){let f=d*n+u,l=e.pixels[f];if(l!==e.transparentIndex){let m=c+d*r.width+u,v=e.colorTable[l];t[m*4]=v[0],t[m*4+1]=v[1],t[m*4+2]=v[2],t[m*4+3]=l===e.transparentIndex?0:255}}return t};var w=new Map;self.addEventListener(\"message\",t=>{let{type:e,src:r}=t.data||t;switch(e){case\"parse\":{if(!w.has(r)){let n=new AbortController,o={signal:n.signal};w.set(r,n),H(r,o).then(i=>{self.postMessage(Object.assign(i,{src:r}),i.frames.map(a=>a.buffer))}).catch(i=>{self.postMessage({src:r,error:i,loaded:!0})}).finally(()=>{w.delete(r)})}break}case\"cancel\":{w.has(r)&&(w.get(r).abort(),w.delete(r));break}default:break}});})();\n";
\ No newline at end of file
+ "\"use strict\";(()=>{var N=Object.create;var j=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var Y=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty;var T=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var re=(t,e,r,n)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let o of V(e))!ee.call(t,o)&&o!==r&&j(t,o,{get:()=>e[o],enumerable:!(n=Q(e,o))||n.enumerable});return t};var G=(t,e,r)=>(r=t!=null?N(Y(t)):{},re(e||!t||!t.__esModule?j(r,\"default\",{value:t,enumerable:!0}):r,t));var z=T(y=>{\"use strict\";Object.defineProperty(y,\"__esModule\",{value:!0});y.loop=y.conditional=y.parse=void 0;var te=function t(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:n;if(Array.isArray(r))r.forEach(function(a){return t(e,a,n,o)});else if(typeof r==\"function\")r(e,n,o,t);else{var i=Object.keys(r)[0];Array.isArray(r[i])?(o[i]={},t(e,r[i],n,o[i])):o[i]=r[i](e,n,o,t)}return n};y.parse=te;var ne=function(e,r){return function(n,o,i,a){r(n,o,i)&&a(n,e,o,i)}};y.conditional=ne;var ae=function(e,r){return function(n,o,i,a){for(var c=[],d=n.pos;r(n,o,i);){var u={};if(a(n,e,o,u),n.pos===d)break;d=n.pos,c.push(u)}return c}};y.loop=ae});var E=T(p=>{\"use strict\";Object.defineProperty(p,\"__esModule\",{value:!0});p.readBits=p.readArray=p.readUnsigned=p.readString=p.peekBytes=p.readBytes=p.peekByte=p.readByte=p.buildStream=void 0;var oe=function(e){return{data:e,pos:0}};p.buildStream=oe;var W=function(){return function(e){return e.data[e.pos++]}};p.readByte=W;var ie=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return function(r){return r.data[r.pos+e]}};p.peekByte=ie;var _=function(e){return function(r){return r.data.subarray(r.pos,r.pos+=e)}};p.readBytes=_;var se=function(e){return function(r){return r.data.subarray(r.pos,r.pos+e)}};p.peekBytes=se;var de=function(e){return function(r){return Array.from(_(e)(r)).map(function(n){return String.fromCharCode(n)}).join(\"\")}};p.readString=de;var ce=function(e){return function(r){var n=_(2)(r);return e?(n[1]<<8)+n[0]:(n[0]<<8)+n[1]}};p.readUnsigned=ce;var ue=function(e,r){return function(n,o,i){for(var a=typeof r==\"function\"?r(n,o,i):r,c=_(e),d=new Array(a),u=0;u<a;u++)d[u]=c(n);return d}};p.readArray=ue;var le=function(e,r,n){for(var o=0,i=0;i<n;i++)o+=e[r+i]&&Math.pow(2,n-i-1);return o},pe=function(e){return function(r){for(var n=W()(r),o=new Array(8),i=0;i<8;i++)o[7-i]=!!(n&1<<i);return Object.keys(e).reduce(function(a,c){var d=e[c];return d.length?a[c]=le(o,d.index,d.length):a[c]=o[d.index],a},{})}};p.readBits=pe});var K=T(I=>{\"use strict\";Object.defineProperty(I,\"__esModule\",{value:!0});I.default=void 0;var h=z(),s=E(),F={blocks:function(e){for(var r=0,n=[],o=e.data.length,i=0,a=(0,s.readByte)()(e);a!==r&&a;a=(0,s.readByte)()(e)){if(e.pos+a>=o){var c=o-e.pos;n.push((0,s.readBytes)(c)(e)),i+=c;break}n.push((0,s.readBytes)(a)(e)),i+=a}for(var d=new Uint8Array(i),u=0,f=0;f<n.length;f++)d.set(n[f],u),u+=n[f].length;return d}},fe=(0,h.conditional)({gce:[{codes:(0,s.readBytes)(2)},{byteSize:(0,s.readByte)()},{extras:(0,s.readBits)({future:{index:0,length:3},disposal:{index:3,length:3},userInput:{index:6},transparentColorGiven:{index:7}})},{delay:(0,s.readUnsigned)(!0)},{transparentColorIndex:(0,s.readByte)()},{terminator:(0,s.readByte)()}]},function(t){var e=(0,s.peekBytes)(2)(t);return e[0]===33&&e[1]===249}),me=(0,h.conditional)({image:[{code:(0,s.readByte)()},{descriptor:[{left:(0,s.readUnsigned)(!0)},{top:(0,s.readUnsigned)(!0)},{width:(0,s.readUnsigned)(!0)},{height:(0,s.readUnsigned)(!0)},{lct:(0,s.readBits)({exists:{index:0},interlaced:{index:1},sort:{index:2},future:{index:3,length:2},size:{index:5,length:3}})}]},(0,h.conditional)({lct:(0,s.readArray)(3,function(t,e,r){return Math.pow(2,r.descriptor.lct.size+1)})},function(t,e,r){return r.descriptor.lct.exists}),{data:[{minCodeSize:(0,s.readByte)()},F]}]},function(t){return(0,s.peekByte)()(t)===44}),ge=(0,h.conditional)({text:[{codes:(0,s.readBytes)(2)},{blockSize:(0,s.readByte)()},{preData:function(e,r,n){return(0,s.readBytes)(n.text.blockSize)(e)}},F]},function(t){var e=(0,s.peekBytes)(2)(t);return e[0]===33&&e[1]===1}),ye=(0,h.conditional)({application:[{codes:(0,s.readBytes)(2)},{blockSize:(0,s.readByte)()},{id:function(e,r,n){return(0,s.readString)(n.blockSize)(e)}},F]},function(t){var e=(0,s.peekBytes)(2)(t);return e[0]===33&&e[1]===255}),he=(0,h.conditional)({comment:[{codes:(0,s.readBytes)(2)},F]},function(t){var e=(0,s.peekBytes)(2)(t);return e[0]===33&&e[1]===254}),ve=[{header:[{signature:(0,s.readString)(3)},{version:(0,s.readString)(3)}]},{lsd:[{width:(0,s.readUnsigned)(!0)},{height:(0,s.readUnsigned)(!0)},{gct:(0,s.readBits)({exists:{index:0},resolution:{index:1,length:3},sort:{index:4},size:{index:5,length:3}})},{backgroundColorIndex:(0,s.readByte)()},{pixelAspectRatio:(0,s.readByte)()}]},(0,h.conditional)({gct:(0,s.readArray)(3,function(t,e){return Math.pow(2,e.lsd.gct.size+1)})},function(t,e){return e.lsd.gct.exists}),{frames:(0,h.loop)([fe,ye,he,me,ge],function(t){var e=(0,s.peekByte)()(t);return e===33||e===44})}],be=ve;I.default=be});var D=G(z()),O=G(E()),R=G(K());var X=(t,e)=>{let r=new Array(t.length),n=t.length/e,o=function(d,u){let f=t.slice(u*e,(u+1)*e);r.splice(...[d*e,e].concat(f))},i=[0,4,2,1],a=[8,8,4,2],c=0;for(let d=0;d<4;d++)for(let u=i[d];u<n;u+=a[d])o(u,c),c++;return r};var Z=(t,e,r)=>{let i=r,a,c,d,u,f;var B;let l,m;var C,b,g,k,P;let v=new Array(r),U=new Array(4096),A=new Array(4096),S=new Array(4096+1),M=t,x=1<<M,J=x+1;for(a=x+2,f=-1,d=M+1,c=(1<<d)-1,l=0;l<x;l++)U[l]=0,A[l]=l;var C,B,b,g,P,k;for(C=B=b=g=P=k=0,m=0;m<i;){if(g===0){if(B<d){C+=e[k]<<B,B+=8,k++;continue}if(l=C&c,C>>=d,B-=d,l>a||l===J)break;if(l===x){d=M+1,c=(1<<d)-1,a=x+2,f=-1;continue}if(f===-1){S[g++]=A[l],f=l,b=l;continue}for(u=l,l===a&&(S[g++]=b,l=f);l>x;)S[g++]=A[l],l=U[l];b=A[l]&255,S[g++]=b,a<4096&&(U[a]=f,A[a]=b,a++,!(a&c)&&a<4096&&(d++,c+=a)),f=u}g--,v[P++]=S[g],m++}for(m=P;m<i;m++)v[m]=0;return v};var q=t=>{let e=new Uint8Array(t);return(0,D.parse)((0,O.buildStream)(e),R.default)},L=(t,e)=>{var a,c;if(!t.image){console.warn(\"gif frame does not have associated image.\");return}let{image:r}=t,n=r.descriptor.width*r.descriptor.height,o=Z(r.data.minCodeSize,r.data.blocks,n);return(a=r.descriptor.lct)!=null&&a.interlaced&&(o=X(o,r.descriptor.width)),{pixels:o,dims:{top:t.image.descriptor.top,left:t.image.descriptor.left,width:t.image.descriptor.width,height:t.image.descriptor.height},colorTable:(c=r.descriptor.lct)!=null&&c.exists?r.lct:e,delay:(t.gce.delay||10)*10,disposalType:t.gce.extras.disposal,transparentIndex:t.gce.extras.transparentColorGiven?t.gce.transparentColorIndex:-1}};var $=t=>t.frames.filter(e=>!(\"application\"in e)).map(e=>e.image?L(e,t.gct):null).filter(Boolean).map(e=>e);var xe=t=>{let e=null;for(let r of t.frames)e=r.gce?r.gce:e,\"image\"in r&&!(\"gce\"in r)&&e!==null&&(r.gce=e)},H=(t,{signal:e})=>fetch(t,{signal:e}).then(r=>{var n;if(!((n=r.headers.get(\"Content-Type\"))!=null&&n.includes(\"image/gif\")))throw Error(`Wrong content type: \"${r.headers.get(\"Content-Type\")}\"`);return r.arrayBuffer()}).then(r=>q(r)).then(r=>(xe(r),r)).then(r=>Promise.all([$(r),{width:r.lsd.width,height:r.lsd.height}])).then(([r,n])=>{let o=[],i=n.width*n.height*4,a=new Uint8ClampedArray(i);for(let c=0;c<r.length;++c){let d=r[c],u=r[c].disposalType===3?a.slice():null;if(o.push(Be(a,d,n)),r[c].disposalType===2)a=new Uint8ClampedArray(i);else if(r[c].disposalType===3){if(!u)throw Error(\"Disposal type 3 without previous frame\");a=u}else a=o[c].slice()}return{...n,loaded:!0,delays:r.map(c=>c.delay),frames:o}}),Be=(t,e,r)=>{let{width:n,height:o,top:i,left:a}=e.dims,c=i*r.width+a;for(let d=0;d<o;d++)for(let u=0;u<n;u++){let f=d*n+u,l=e.pixels[f];if(l!==e.transparentIndex){let m=c+d*r.width+u,v=e.colorTable[l];t[m*4]=v[0],t[m*4+1]=v[1],t[m*4+2]=v[2],t[m*4+3]=l===e.transparentIndex?0:255}}return t};var w=new Map;self.addEventListener(\"message\",t=>{let{type:e,src:r}=t.data||t;switch(e){case\"parse\":{if(!w.has(r)){let n=new AbortController,o={signal:n.signal};w.set(r,n),H(r,o).then(i=>{self.postMessage(Object.assign(i,{src:r}),i.frames.map(a=>a.buffer))}).catch(i=>{self.postMessage({src:r,error:i,loaded:!0})}).finally(()=>{w.delete(r)})}break}case\"cancel\":{w.has(r)&&(w.get(r).abort(),w.delete(r));break}default:break}});})();\n";
\ No newline at end of file