PageSourceSearch

https://online-reader.com/assets/index-C-c0bgMW.js

js online-reader.com collected 2026-10-05 05:44:22 UTC 208,892 bytes, 11 lines download raw bytes

vendor: 16,338 bytes, line 1
1function wt(e){let n=e.length;for(;--n>=0;)e[n]=0}const Bl=3,zl=258,es=29,Nl=256,Ul=Nl+1+es,ts=30,Gl=512,Vl=new Array((Ul+2)*2);wt(Vl);const $l=new Array(ts*2);wt($l);const Hl=new Array(Gl);wt(Hl);const Wl=new Array(zl-Bl+1);wt(Wl);const Xl=new Array(es);wt(Xl);const Kl=new Array(ts);wt(Kl);const Yl=(e,n,t,o)=>{let i=e&65535|0,s=e>>>16&65535|0,l=0;for(;t!==0;){l=t>2e3?2e3:t,t-=l;do i=i+n[o++]|0,s=s+i|0;while(--l);i%=65521,s%=65521}return i|s<<16|0};var eo=Yl;const ql=()=>{let e,n=[];for(var t=0;t<256;t++){e=t;for(var o=0;o<8;o++)e=e&1?3988292384^e>>>1:e>>>1;n[t]=e}return n},Zl=new Uint32Array(ql()),Jl=(e,n,t,o)=>{const i=Zl,s=o+t;e^=-1;for(let l=o;l<s;l++)e=e>>>8^i[(e^n[l])&255];return e^-1};var ze=Jl,to={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ns={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8};const Ql=(e,n)=>Object.prototype.hasOwnProperty.call(e,n);var ea=function(e){const n=Array.prototype.slice.call(arguments,1);for(;n.length;){const t=n.shift();if(t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(const o in t)Ql(t,o)&&(e[o]=t[o])}}return e},ta=e=>{let n=0;for(let o=0,i=e.length;o<i;o++)n+=e[o].length;const t=new Uint8Array(n);for(let o=0,i=0,s=e.length;o<s;o++){let l=e[o];t.set(l,i),i+=l.length}return t},os={assign:ea,flattenChunks:ta};let is=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{is=!1}const Vt=new Uint8Array(256);for(let e=0;e<256;e++)Vt[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Vt[254]=Vt[254]=1;var na=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let n,t,o,i,s,l=e.length,a=0;for(i=0;i<l;i++)t=e.charCodeAt(i),(t&64512)===55296&&i+1<l&&(o=e.charCodeAt(i+1),(o&64512)===56320&&(t=65536+(t-55296<<10)+(o-56320),i++)),a+=t<128?1:t<2048?2:t<65536?3:4;for(n=new Uint8Array(a),s=0,i=0;s<a;i++)t=e.charCodeAt(i),(t&64512)===55296&&i+1<l&&(o=e.charCodeAt(i+1),(o&64512)===56320&&(t=65536+(t-55296<<10)+(o-56320),i++)),t<128?n[s++]=t:t<2048?(n[s++]=192|t>>>6,n[s++]=128|t&63):t<65536?(n[s++]=224|t>>>12,n[s++]=128|t>>>6&63,n[s++]=128|t&63):(n[s++]=240|t>>>18,n[s++]=128|t>>>12&63,n[s++]=128|t>>>6&63,n[s++]=128|t&63);return n};const oa=(e,n)=>{if(n<65534&&e.subarray&&is)return String.fromCharCode.apply(null,e.length===n?e:e.subarray(0,n));let t="";for(let o=0;o<n;o++)t+=String.fromCharCode(e[o]);return t};var ia=(e,n)=>{const t=n||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,n));let o,i;const s=new Array(t*2);for(i=0,o=0;o<t;){let l=e[o++];if(l<128){s[i++]=l;continue}let a=Vt[l];if(a>4){s[i++]=65533,o+=a-1;continue}for(l&=a===2?31:a===3?15:7;a>1&&o<t;)l=l<<6|e[o++]&63,a--;if(a>1){s[i++]=65533;continue}l<65536?s[i++]=l:(l-=65536,s[i++]=55296|l>>10&1023,s[i++]=56320|l&1023)}return oa(s,i)},sa=(e,n)=>{n=n||e.length,n>e.length&&(n=e.length);let t=n-1;for(;t>=0&&(e[t]&192)===128;)t--;return t<0||t===0?n:t+Vt[e[t]]>n?t:n},no={string2buf:na,buf2string:ia,utf8border:sa};function la(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var aa=la;const Yt=16209,ra=16191;var ca=function(n,t){let o,i,s,l,a,r,c,f,h,u,d,p,y,g,m,b,v,S,x,L,k,A,R,B;const U=n.state;o=n.next_in,R=n.input,i=o+(n.avail_in-5),s=n.next_out,B=n.output,l=s-(t-n.avail_out),a=s+(n.avail_out-257),r=U.dmax,c=U.wsize,f=U.whave,h=U.wnext,u=U.window,d=U.hold,p=U.bits,y=U.lencode,g=U.distcode,m=(1<<U.lenbits)-1,b=(1<<U.distbits)-1;e:do{p<15&&(d+=R[o++]<<p,p+=8,d+=R[o++]<<p,p+=8),v=y[d&m];t:for(;;){if(S=v>>>24,d>>>=S,p-=S,S=v>>>16&255,S===0)B[s++]=v&65535;else if(S&16){x=v&65535,S&=15,S&&(p<S&&(d+=R[o++]<<p,p+=8),x+=d&(1<<S)-1,d>>>=S,p-=S),p<15&&(d+=R[o++]<<p,p+=8,d+=R[o++]<<p,p+=8),v=g[d&b];n:for(;;){if(S=v>>>24,d>>>=S,p-=S,S=v>>>16&255,S&16){if(L=v&65535,S&=15,p<S&&(d+=R[o++]<<p,p+=8,p<S&&(d+=R[o++]<<p,p+=8)),L+=d&(1<<S)-1,L>r){n.msg="invalid distance too far back",U.mode=Yt;break e}if(d>>>=S,p-=S,S=s-l,L>S){if(S=L-S,S>f&&U.sane){n.msg="invalid distance too far back",U.mode=Yt;break e}if(k=0,A=u,h===0){if(k+=c-S,S<x){x-=S;do B[s++]=u[k++];while(--S);k=s-L,A=B}}else if(h<S){if(k+=c+h-S,S-=h,S<x){x-=S;do B[s++]=u[k++];while(--S);if(k=0,h<x){S=h,x-=S;do B[s++]=u[k++];while(--S);k=s-L,A=B}}}else if(k+=h-S,S<x){x-=S;do B[s++]=u[k++];while(--S);k=s-L,A=B}for(;x>2;)B[s++]=A[k++],B[s++]=A[k++],B[s++]=A[k++],x-=3;x&&(B[s++]=A[k++],x>1&&(B[s++]=A[k++]))}else{k=s-L;do B[s++]=B[k++],B[s++]=B[k++],B[s++]=B[k++],x-=3;while(x>2);x&&(B[s++]=B[k++],x>1&&(B[s++]=B[k++]))}}else if(S&64){n.msg="invalid distance code",U.mode=Yt;break e}else{v=g[(v&65535)+(d&(1<<S)-1)];continue n}break}}else if(S&64)if(S&32){U.mode=ra;break e}else{n.msg="invalid literal/length code",U.mode=Yt;break e}else{v=y[(v&65535)+(d&(1<<S)-1)];continue t}break}}while(o<i&&s<a);x=p>>3,o-=x,p-=x<<3,d&=(1<<p)-1,n.next_in=o,n.next_out=s,n.avail_in=o<i?5+(i-o):5-(o-i),n.avail_out=s<a?257+(a-s):257-(s-a),U.hold=d,U.bits=p};const mt=15,ko=852,xo=592,Fo=0,Rn=1,Oo=2,fa=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),ua=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),da=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),ha=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),pa=(e,n,t,o,i,s,l,a)=>{const r=a.bits;let c=0,f=0,h=0,u=0,d=0,p=0,y=0,g=0,m=0,b=0,v,S,x,L,k,A=null,R;const B=new Uint16Array(mt+1),U=new Uint16Array(mt+1);let le=null,ce,fe,V;for(c=0;c<=mt;c++)B[c]=0;for(f=0;f<o;f++)B[n[t+f]]++;for(d=r,u=mt;u>=1&&B[u]===0;u--);if(d>u&&(d=u),u===0)return i[s++]=1<<24|64<<16|0,i[s++]=1<<24|64<<16|0,a.bits=1,0;for(h=1;h<u&&B[h]===0;h++);for(d<h&&(d=h),g=1,c=1;c<=mt;c++)if(g<<=1,g-=B[c],g<0)return-1;if(g>0&&(e===Fo||u!==1))return-1;for(U[1]=0,c=1;c<mt;c++)U[c+1]=U[c]+B[c];for(f=0;f<o;f++)n[t+f]!==0&&(l[U[n[t+f]]++]=f);if(e===Fo?(A=le=l,R=20):e===Rn?(A=fa,le=ua,R=257):(A=da,le=ha,R=0),b=0,f=0,c=h,k=s,p=d,y=0,x=-1,m=1<<d,L=m-1,e===Rn&&m>ko||e===Oo&&m>xo)return 1;for(;;){ce=c-y,l[f]+1<R?(fe=0,V=l[f]):l[f]>=R?(fe=le[l[f]-R],V=A[l[f]-R]):(fe=96,V=0),v=1<<c-y,S=1<<p,h=S;do S-=v,i[k+(b>>y)+S]=ce<<24|fe<<16|V|0;while(S!==0);for(v=1<<c-1;b&v;)v>>=1;if(v!==0?(b&=v-1,b+=v):b=0,f++,--B[c]===0){if(c===u)break;c=n[t+l[f]]}if(c>d&&(b&L)!==x){for(y===0&&(y=d),k+=h,p=c-y,g=1<<p;p+y<u&&(g-=B[p+y],!(g<=0));)p++,g<<=1;if(m+=1<<p,e===Rn&&m>ko||e===Oo&&m>xo)return 1;x=b&L,i[x]=d<<24|p<<16|k-s|0}}return b!==0&&(i[k+b]=c-y<<24|64<<16|0),a.bits=d,0};var _t=pa;const ma=0,ss=1,ls=2,{Z_FINISH:Co,Z_BLOCK:ga,Z_TREES:qt,Z_OK:dt,Z_STREAM_END:ba,Z_NEED_DICT:ya,Z_STREAM_ERROR:Pe,Z_DATA_ERROR:as,Z_MEM_ERROR:rs,Z_BUF_ERROR:Sa,Z_DEFLATED:Io}=ns,Ln=16180,Do=16181,wo=16182,Lo=16183,Eo=16184,Po=16185,Ao=16186,To=16187,Mo=16188,Ro=16189,xn=16190,We=16191,_n=16192,_o=16193,jn=16194,jo=16195,Bo=16196,zo=16197,No=16198,Zt=16199,Jt=16200,Uo=16201,Go=16202,Vo=16203,$o=16204,Ho=16205,Bn=16206,Wo=16207,Xo=16208,se=16209,cs=16210,fs=16211,va=852,ka=592,xa=15,Fa=xa,Ko=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function Oa(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const pt=e=>{if(!e)return 1;const n=e.state;return!n||n.strm!==e||n.mode<Ln||n.mode>fs?1:0},us=e=>{if(pt(e))return Pe;const n=e.state;return e.total_in=e.total_out=n.total=0,e.msg="",n.wrap&&(e.adler=n.wrap&1),n.mode=Ln,n.last=0,n.havedict=0,n.flags=-1,n.dmax=32768,n.head=null,n.hold=0,n.bits=0,n.lencode=n.lendyn=new Int32Array(va),n.distcode=n.distdyn=new Int32Array(ka),n.sane=1,n.back=-1,dt},ds=e=>{if(pt(e))return Pe;const n=e.state;return n.wsize=0,n.whave=0,n.wnext=0,us(e)},hs=(e,n)=>{let t;if(pt(e))return Pe;const o=e.state;return n<0?(t=0,n=-n):(t=(n>>4)+5,n<48&&(n&=15)),n&&(n<8||n>15)?Pe:(o.window!==null&&o.wbits!==n&&(o.window=null),o.wrap=t,o.wbits=n,ds(e))},ps=(e,n)=>{if(!e)return Pe;const t=new Oa;e.state=t,t.strm=e,t.window=null,t.mode=Ln;const o=hs(e,n);return o!==dt&&(e.state=null),o},Ca=e=>ps(e,Fa);let Yo=!0,zn,Nn;const Ia=e=>{if(Yo){zn=new Int32Array(512),Nn=new Int32Array(32);let n=0;for(;n<144;)e.lens[n++]=8;for(;n<256;)e.lens[n++]=9;for(;n<280;)e.lens[n++]=7;for(;n<288;)e.lens[n++]=8;for(_t(ss,e.lens,0,288,zn,0,e.work,{bits:9}),n=0;n<32;)e.lens[n++]=5;_t(ls,e.lens,0,32,Nn,0,e.work,{bits:5}),Yo=!1}e.lencode=zn,e.lenbits=9,e.distcode=Nn,e.distbits=5},ms=(e,n,t,o)=>{let i;const s=e.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),o>=s.wsize?(s.window.set(n.subarray(t-s.wsize,t),0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>o&&(i=o),s.window.set(n.subarray(t-o,t-o+i),s.wnext),o-=i,o?(s.window.set(n.subarray(t-o,t),0),s.wnext=o,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=i))),0},Da=(e,n)=>{let t,o,i,s,l,a,r,c,f,h,u,d,p,y,g=0,m,b,v,S,x,L,k,A;const R=new Uint8Array(4);let B,U;const le=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(pt(e)||!e.output||!e.input&&e.avail_in!==0)return Pe;t=e.state,t.mode===We&&(t.mode=_n),l=e.next_out,i=e.output,r=e.avail_out,s=e.next_in,o=e.input,a=e.avail_in,c=t.hold,f=t.bits,h=a,u=r,A=dt;e:for(;;)switch(t.mode){case Ln:if(t.wrap===0){t.mode=_n;break}for(;f<16;){if(a===0)break e;a--,c+=o[s++]<<f,f+=8}if(t.wrap&2&&c===35615){t.wbits===0&&(t.wbits=15),t.check=0,R[0]=c&255,R[1]=c>>>8&255,t.check=ze(t.check,R,2,0),c=0,f=0,t.mode=Do;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((c&255)<<8)+(c>>8))%31){e.msg="incorrect header check",t.mode=se;break}if((c&15)!==Io){e.msg="unknown compression method",t.mode=se;break}if(c>>>=4,f-=4,k=(c&15)+8,t.wbits===0&&(t.wbits=k),k>15||k>t.wbits){e.msg="invalid window size",t.mode=se;break}t.dmax=1<<t.wbits,t.flags=0,e.adler=t.check=1,t.mode=c&512?Ro:We,c=0,f=0;break;case Do:for(;f<16;){if(a===0)break e;a--,c+=o[s++]<<f,f+=8}if(t.flags=c,(t.flags&255)!==Io){e.msg="unknown compression method",t.mode=se;break}if(t.flags&57344){e.msg="unknown header flags set",t.mode=se;break}t.head&&(t.head.text=c>>8&1),t.flags&512&&t.wrap&4&&(R[0]=c&255,R[1]=c>>>8&255,t.check=ze(t.check,R,2,0)),c=0,f=0,t.mode=wo;case wo:for(;f<32;){if(a===0)break e;a--,c+=o[s++]<<f,f+=8}t.head&&(t.head.time=c),t.flags&512&&t.wrap&4&&(R[0]=c&255,R[1]=c>>>8&255,R[2]=c>>>16&255,R[3]=c>>>24&255,t.check=ze(t.check,R,4,0)),c=0,f=0,t.mode=Lo;case Lo:for(;f<16;){if(a===0)break e;a--,c+=o[s++]<<f,f+=8}t.head&&(t.head.xflags=c&255,t.head.os=c>>8),t.flags&512&&t.wrap&4&&(R[0]=c&255,R[1]=c>>>8&255,t.check=ze(t.check,R,2,0)),c=0,f=0,t.mode=Eo;case Eo:if(t.flags&1024){for(;f<16;){if(a===0)break e;a--,c+=o[s++]<<f,f+=8}t.length=c,t.head&&(t.head.extra_len=c),t.flags&512&&t.wrap&4&&(R[0]=c&255,R[1]=c>>>8&255,t.check=ze(t.check,R,2,0)),c=0,f=0}else t.head&&(t.head.extra=null);t.mode=Po;case Po:if(t.flags&1024&&(d=t.length,d>a&&(d=a),d&&(t.head&&(k=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(o.subarray(s,s+d),k)),t.flags&512&&t.wrap&4&&(t.check=ze(t.check,o,d,s)),a-=d,s+=d,t.length-=d),t.length))break e;t.length=0,t.mode=Ao;case Ao:if(t.flags&2048){if(a===0)break e;d=0;do k=o[s+d++],t.head&&k&&t.length<65536&&(t.head.name+=String.fromCharCode(k));while(k&&d<a);if(t.flags&512&&t.wrap&4&&(t.check=ze(t.check,o,d,s)),a-=d,s+=d,k)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=To;case To:if(t.flags&4096){if(a===0)break e;d=0;do k=o[s+d++],t.head&&k&&t.length<65536&&(t.head.comment+=String.fromCharCode(k));while(k&&d<a);if(t.flags&512&&t.wrap&4&&(t.check=ze(t.check,o,d,s)),a-=d,s+=d,k)break e}else t.head&&(t.head.comment=null);t.mode=Mo;case Mo:if(t.flags&512){for(;f<16;){if(a===0)break e;a--,c+=o[s++]<<f,f+=8}if(t.wrap&4&&c!==(t.check&65535)){e.msg="header crc mismatch",t.mode=se;break}c=0,f=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),e.adler=t.check=0,t.mode=We;break;case Ro:for(;f<32;){if(a===0)break e;a--,c+=o[s++]<<f,f+=8}e.adler=t.check=Ko(c),c=0,f=0,t.mode=xn;case xn:if(t.havedict===0)return e.next_out=l,e.avail_out=r,e.next_in=s,e.avail_in=a,t.hold=c,t.bits=f,ya;e.adler=t.check=1,t.mode=We;case We:if(n===ga||n===qt)break e;case _n:if(t.last){c>>>=f&7,f-=f&7,t.mode=Bn;break}for(;f<3;){if(a===0)break e;a--,c+=o[s++]<<f,f+=8}switch(t.last=c&1,c>>>=1,f-=1,c&3){case 0:t.mode=_o;break;case 1:if(Ia(t),t.mode=Zt,n===qt){c>>>=2,f-=2;break e}break;case 2:t.mode=Bo;break;case 3:e.msg="invalid block type",t.mode=se}c>>>=2,f-=2;break;case _o:for(c>>>=f&7,f-=f&7;f<32;){if(a===0)break e;a--,c+=o[s++]<<f,f+=8}if((c&65535)!==(c>>>16^65535)){e.msg="invalid stored block lengths",t.mode=se;break}if(t.length=c&65535,c=0,f=0,t.mode=jn,n===qt)break e;case jn:t.mode=jo;case jo:if(d=t.length,d){if(d>a&&(d=a),d>r&&(d=r),d===0)break e;i.set(o.subarray(s,s+d),l),a-=d,s+=d,r-=d,l+=d,t.length-=d;break}t.mode=We;break;case Bo:for(;f<14;){if(a===0)break e;a--,c+=o[s++]<<f,f+=8}if(t.nlen=(c&31)+257,c>>>=5,f-=5,t.ndist=(c&31)+1,c>>>=5,f-=5,t.ncode=(c&15)+4,c>>>=4,f-=4,t.nlen>286||t.ndist>30){e.msg="too many length or distance symbols",t.mode=se;break}t.have=0,t.mode=zo;case zo:for(;t.have<t.ncode;){for(;f<3;){if(a===0)break e;a--,c+=o[s++]<<f,f+=8}t.lens[le[t.have++]]=c&7,c>>>=3,f-=3}for(;t.have<19;)t.lens[le[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,B={bits:t.lenbits},A=_t(ma,t.lens,0,19,t.lencode,0,t.work,B),t.lenbits=B.bits,A){e.msg="invalid code lengths set",t.mode=se;break}t.have=0,t.mode=No;case No:for(;t.have<t.nlen+t.ndist;){for(;g=t.lencode[c&(1<<t.lenbits)-1],m=g>>>24,b=g>>>16&255,v=g&65535,!(m<=f);){if(a===0)break e;a--,c+=o[s++]<<f,f+=8}if(v<16)c>>>=m,f-=m,t.lens[t.have++]=v;else{if(v===16){for(U=m+2;f<U;){if(a===0)break e;a--,c+=o[s++]<<f,f+=8}if(c>>>=m,f-=m,t.have===0){e.msg="invalid bit length repeat",t.mode=se;break}k=t.lens[t.have-1],d=3+(c&3),c>>>=2,f-=2}else if(v===17){for(U=m+3;f<U;){if(a===0)break e;a--,c+=o[s++]<<f,f+=8}c>>>=m,f-=m,k=0,d=3+(c&7),c>>>=3,f-=3}else{for(U=m+7;f<U;){if(a===0)break e;a--,c+=o[s++]<<f,f+=8}c>>>=m,f-=m,k=0,d=11+(c&127),c>>>=7,f-=7}if(t.have+d>t.nlen+t.ndist){e.msg="invalid bit length repeat",t.mode=se;break}for(;d--;)t.lens[t.have++]=k}}if(t.mode===se)break;if(t.lens[256]===0){e.msg="invalid code -- missing end-of-block",t.mode=se;break}if(t.lenbits=9,B={bits:t.lenbits},A=_t(ss,t.lens,0,t.nlen,t.lencode,0,t.work,B),t.lenbits=B.bits,A){e.msg="invalid literal/lengths set",t.mode=se;break}if(t.distbits=6,t.distcode=t.distdyn,B={bits:t.distbits},A=_t(ls,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,B),t.distbits=B.bits,A){e.msg="invalid distances set",t.mode=se;break}if(t.mode=Zt,n===qt)break e;case Zt:t.mode=Jt;case Jt:if(a>=6&&r>=258){e.next_out=l,e.avail_out=r,e.next_in=s,e.avail_in=a,t.hold=c,t.bits=f,ca(e,u),l=e.next_out,i=e.output,r=e.avail_out,s=e.next_in,o=e.input,a=e.avail_in,c=t.hold,f=t.bits,t.mode===We&&(t.back=-1);break}for(t.back=0;g=t.lencode[c&(1<<t.lenbits)-1],m=g>>>24,b=g>>>16&255,v=g&65535,!(m<=f);){if(a===0)break e;a--,c+=o[s++]<<f,f+=8}if(b&&!(b&240)){for(S=m,x=b,L=v;g=t.lencode[L+((c&(1<<S+x)-1)>>S)],m=g>>>24,b=g>>>16&255,v=g&65535,!(S+m<=f);){if(a===0)break e;a--,c+=o[s++]<<f,f+=8}c>>>=S,f-=S,t.back+=S}if(c>>>=m,f-=m,t.back+=m,t.length=v,b===0){t.mode=Ho;break}if(b&32){t.back=-1,t.mode=We;break}if(b&64){e.msg="invalid literal/length code",t.mode=se;break}t.extra=b&15,t.mode=Uo;case Uo:if(t.extra){for(U=t.extra;f<U;){if(a===0)break e;a--,c+=o[s++]<<f,f+=8}t.length+=c&(1<<t.extra)-1,c>>>=t.extra,f-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=Go;case Go:for(;
vendor: 5,498 bytes, line 1
1g=t.distcode[c&(1<<t.distbits)-1],m=g>>>24,b=g>>>16&255,v=g&65535,!(m<=f);){if(a===0)break e;a--,c+=o[s++]<<f,f+=8}if(!(b&240)){for(S=m,x=b,L=v;g=t.distcode[L+((c&(1<<S+x)-1)>>S)],m=g>>>24,b=g>>>16&255,v=g&65535,!(S+m<=f);){if(a===0)break e;a--,c+=o[s++]<<f,f+=8}c>>>=S,f-=S,t.back+=S}if(c>>>=m,f-=m,t.back+=m,b&64){e.msg="invalid distance code",t.mode=se;break}t.offset=v,t.extra=b&15,t.mode=Vo;case Vo:if(t.extra){for(U=t.extra;f<U;){if(a===0)break e;a--,c+=o[s++]<<f,f+=8}t.offset+=c&(1<<t.extra)-1,c>>>=t.extra,f-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){e.msg="invalid distance too far back",t.mode=se;break}t.mode=$o;case $o:if(r===0)break e;if(d=u-r,t.offset>d){if(d=t.offset-d,d>t.whave&&t.sane){e.msg="invalid distance too far back",t.mode=se;break}d>t.wnext?(d-=t.wnext,p=t.wsize-d):p=t.wnext-d,d>t.length&&(d=t.length),y=t.window}else y=i,p=l-t.offset,d=t.length;d>r&&(d=r),r-=d,t.length-=d;do i[l++]=y[p++];while(--d);t.length===0&&(t.mode=Jt);break;case Ho:if(r===0)break e;i[l++]=t.length,r--,t.mode=Jt;break;case Bn:if(t.wrap){for(;f<32;){if(a===0)break e;a--,c|=o[s++]<<f,f+=8}if(u-=r,e.total_out+=u,t.total+=u,t.wrap&4&&u&&(e.adler=t.check=t.flags?ze(t.check,i,u,l-u):eo(t.check,i,u,l-u)),u=r,t.wrap&4&&(t.flags?c:Ko(c))!==t.check){e.msg="incorrect data check",t.mode=se;break}c=0,f=0}t.mode=Wo;case Wo:if(t.wrap&&t.flags){for(;f<32;){if(a===0)break e;a--,c+=o[s++]<<f,f+=8}if(t.wrap&4&&c!==(t.total&4294967295)){e.msg="incorrect length check",t.mode=se;break}c=0,f=0}t.mode=Xo;case Xo:A=ba;break e;case se:A=as;break e;case cs:return rs;case fs:default:return Pe}return e.next_out=l,e.avail_out=r,e.next_in=s,e.avail_in=a,t.hold=c,t.bits=f,(t.wsize||u!==e.avail_out&&t.mode<se&&(t.mode<Bn||n!==Co))&&ms(e,e.output,e.next_out,u-e.avail_out),h-=e.avail_in,u-=e.avail_out,e.total_in+=h,e.total_out+=u,t.total+=u,t.wrap&4&&u&&(e.adler=t.check=t.flags?ze(t.check,i,u,e.next_out-u):eo(t.check,i,u,e.next_out-u)),e.data_type=t.bits+(t.last?64:0)+(t.mode===We?128:0)+(t.mode===Zt||t.mode===jn?256:0),(h===0&&u===0||n===Co)&&A===dt&&(A=Sa),A},wa=e=>{if(pt(e))return Pe;let n=e.state;return n.window&&(n.window=null),e.state=null,dt},La=(e,n)=>{if(pt(e))return Pe;const t=e.state;return t.wrap&2?(t.head=n,n.done=!1,dt):Pe},Ea=(e,n)=>{const t=n.length;let o,i,s;return pt(e)||(o=e.state,o.wrap!==0&&o.mode!==xn)?Pe:o.mode===xn&&(i=1,i=eo(i,n,t,0),i!==o.check)?as:(s=ms(e,n,t,t),s?(o.mode=cs,rs):(o.havedict=1,dt))};var Pa=ds,Aa=hs,Ta=us,Ma=Ca,Ra=ps,_a=Da,ja=wa,Ba=La,za=Ea,Na="pako inflate (from Nodeca project)",Ye={inflateReset:Pa,inflateReset2:Aa,inflateResetKeep:Ta,inflateInit:Ma,inflateInit2:Ra,inflate:_a,inflateEnd:ja,inflateGetHeader:Ba,inflateSetDictionary:za,inflateInfo:Na};function Ua(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var Ga=Ua;const gs=Object.prototype.toString,{Z_NO_FLUSH:Va,Z_FINISH:$a,Z_OK:$t,Z_STREAM_END:Un,Z_NEED_DICT:Gn,Z_STREAM_ERROR:Ha,Z_DATA_ERROR:qo,Z_MEM_ERROR:Wa}=ns;function En(e){this.options=os.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const n=this.options;n.raw&&n.windowBits>=0&&n.windowBits<16&&(n.windowBits=-n.windowBits,n.windowBits===0&&(n.windowBits=-15)),n.windowBits>=0&&n.windowBits<16&&!(e&&e.windowBits)&&(n.windowBits+=32),n.windowBits>15&&n.windowBits<48&&(n.windowBits&15||(n.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new aa,this.strm.avail_out=0;let t=Ye.inflateInit2(this.strm,n.windowBits);if(t!==$t)throw new Error(to[t]);if(this.header=new Ga,Ye.inflateGetHeader(this.strm,this.header),n.dictionary&&(typeof n.dictionary=="string"?n.dictionary=no.string2buf(n.dictionary):gs.call(n.dictionary)==="[object ArrayBuffer]"&&(n.dictionary=new Uint8Array(n.dictionary)),n.raw&&(t=Ye.inflateSetDictionary(this.strm,n.dictionary),t!==$t)))throw new Error(to[t])}En.prototype.push=function(e,n){const t=this.strm,o=this.options.chunkSize,i=this.options.dictionary;let s,l,a;if(this.ended)return!1;for(n===~~n?l=n:l=n===!0?$a:Va,gs.call(e)==="[object ArrayBuffer]"?t.input=new Uint8Array(e):t.input=e,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(o),t.next_out=0,t.avail_out=o),s=Ye.inflate(t,l),s===Gn&&i&&(s=Ye.inflateSetDictionary(t,i),s===$t?s=Ye.inflate(t,l):s===qo&&(s=Gn));t.avail_in>0&&s===Un&&t.state.wrap>0&&e[t.next_in]!==0;)Ye.inflateReset(t),s=Ye.inflate(t,l);switch(s){case Ha:case qo:case Gn:case Wa:return this.onEnd(s),this.ended=!0,!1}if(a=t.avail_out,t.next_out&&(t.avail_out===0||s===Un))if(this.options.to==="string"){let r=no.utf8border(t.output,t.next_out),c=t.next_out-r,f=no.buf2string(t.output,r);t.next_out=c,t.avail_out=o-c,c&&t.output.set(t.output.subarray(r,r+c),0),this.onData(f)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(s===$t&&a===0)){if(s===Un)return s=Ye.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};En.prototype.onData=function(e){this.chunks.push(e)};En.prototype.onEnd=function(e){e===$t&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=os.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Xa(e,n){const t=new En(n);if(t.push(e),t.err)throw t.msg||to[t.err];return t.result}var Ka=Xa,Ya={inflate:Ka};const{inflate:qa}=Ya;var Za=qa;const jt=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,5
17,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),Qt=4017,en=799,tn=3406,nn=2276,on=1567,sn=3784,gt=5793,ln=2896,Ja=100,Zo=64*1024*1024;let oo=0;function Ot(e){const n=oo+e;if(n>Zo){const t=Math.ceil((n-Zo)/1024/1024);throw new Error(`Max memory limit exceeded by at least ${t}MB`)}oo=n}function Qa(e,n){let t=16;for(;t>0&&!e[t-1];)t--;const o=[{children:[],index:0}];let i=0,s=o[0];for(let l=0;l<t;l++){for(let a=0;a<e[l];a++){for(s=o.pop(),s.children[s.index]=n[i];s.index>0;){if(o.length===0)throw new Error("Could not recreate Huffman Table");s=o.pop()}for(s.index++,o.push(s);o.length<=l;){const r={children:[],index:0};o.push(r),s.children[s.index]=r.children,s=r}i++}if(l+1<t){const a={children:[],index:0};o.push(a),s.children[s.index]=a.children,s=a}}return o[0].children}function er(e,n,t,o,i,s,l,a,r){const c=t.mcusPerLine,f=t.progressive,h=n;let u=0,d=0;function p(){if(d>0)return d--,u>>d&1;if(u=e[n++],u==255){const _=e[n++];if(_)throw new Error(`unexpected marker: ${(u<<8|_).toString(16)}`)}return d=7,u>>>7}function y(_){let z=_;for(;;){if(z=z[p()],typeof z=="number")return z;if(z===void 0)throw new Error("invalid huffman sequence")}}function g(_){let z=0;for(;_>0;)z=z<<1|p(),_--;return z}function m(_){let z=g(_);return z>=1<<_-1?z:z+(-1<<_)+1}function b(_,z){const J=y(_.huffmanTableDC),ae=J===0?0:m(J);z[0]=_.pred+=ae;let ie=1;for(;ie<64;){const ge=y(_.huffmanTableAC),ve=ge&15,Be=ge>>4;if(ve===0){if(Be<15)break;ie+=16;continue}ie+=Be;const st=jt[ie];z[st]=m(ve),ie++}}function v(_,z){const J=y(_.huffmanTableDC),ae=J===0?0:m(J)<<r;z[0]=_.pred+=ae}function S(_,z){z[0]|=p()<<r}let x=0;function L(_,z){if(x>0){x--;return}let J=s,ae=l;for(;J<=ae;){const ie=y(_.huffmanTableAC),ge=ie&15,ve=ie>>4;if(ge===0){if(ve<15){x=g(ve)+(1<<ve)-1;break}J+=16;continue}J+=ve;const Be=jt[J];z[Be]=m(ge)*(1<<r),J++}}let k=0,A=0;function R(_,z){let J=s,ae=l,ie=0;for(;J<=ae;){const ge=jt[J],ve=z[ge]<0?-1:1;switch(k){case 0:const Be=y(_.huffmanTableAC),st=Be&15;if(ie=Be>>4,st===0)ie<15?(x=g(ie)+(1<<ie),k=4):(ie=16,k=1);else{if(st!==1)throw new Error("invalid ACn encoding");A=m(st),k=ie?2:3}continue;case 1:case 2:z[ge]?z[ge]+=(p()<<r)*ve:(ie--,ie===0&&(k=k==2?3:0));break;case 3:z[ge]?z[ge]+=(p()<<r)*ve:(z[ge]=A<<r,k=0);break;case 4:z[ge]&&(z[ge]+=(p()<<r)*ve);break}J++}k===4&&(x--,x===0&&(k=0))}function B(_,z,J,ae,ie){const ge=J/c|0,ve=J%c,Be=ge*_.v+ae,st=ve*_.h+ie;_.blocks[Be]!==void 0&&z(_,_.blocks[Be][st])}function U(_,z,J){const ae=J/_.blocksPerLine|0,ie=J%_.blocksPerLine;_.blocks[ae]!==void 0&&z(_,_.blocks[ae][ie])}const le=o.length;let ce,fe;f?s===0?fe=a===0?v:S:fe=a===0?L:R:fe=b;let V=0,q;le==1?q=o[0].blocksPerLine*o[0].blocksPerColumn:q=c*t.mcusPerColumn,i||(i=q);let me,$e,He;for(;V<q;){for(let _=0;_<le;_++)o[_].pred=0;if(x=0,le==1){ce=o[0];for(let _=0;_<i;_++)U(ce,fe,V),V++}else for(let _=0;_<i;_++){for(let z=0;z<le;z++){ce=o[z],me=ce.h,$e=ce.v;for(let J=0;J<$e;J++)for(let ae=0;ae<me;ae++)B(ce,fe,V,J,ae)}if(V++,V===q)break}if(V===q)do{if(e[n]===255&&e[n+1]!==0)break;n+=1}while(n<e.length-2);if(d=0,He=e[n]<<8|e[n+1],He<65280)throw new Error("marker was not found");if(He>=65488&&He<=65495)n+=2;else break}return n-h}function tr(e){const n=[],t=e.blocksPerLine,o=e.blocksPerColumn,i=t<<3,s=new Int32Array(64),l=new Uint8Array(64);function a(r,c,f){const h=e.quantizationTable,u=f;for(let d=0;d<64;d++)u[d]=r[d]*h[d];for(let d=0;d<8;++d){const p=8*d;if(u[1+p]==0&&u[2+p]==0&&u[3+p]==0&&u[4+p]==0&&u[5+p]==0&&u[6+p]==0&&u[7+p]==0){const A=gt*u[0+p]+512>>10;u[0+p]=A,u[1+p]=A,u[2+p]=A,u[3+p]=A,u[4+p]=A,u[5+p]=A,u[6+p]=A,u[7+p]=A;continue}let y=gt*u[0+p]+128>>8,g=gt*u[4+p]+128>>8,m=u[2+p],b=u[6+p],v=ln*(u[1+p]-u[7+p])+128>>8,S=ln*(u[1+p]+u[7+p])+128>>8,x=u[3+p]<<4,L=u[5+p]<<4,k=y-g+1>>1;y=y+g+1>>1,g=k,k=m*sn+b*on+128>>8,m=m*on-b*sn+128>>8,b=k,k=v-L+1>>1,v=v+L+1>>1,L=k,k=S+x+1>>1,x=S-x+1>>1,S=k,k=y-b+1>>1,y=y+b+1>>1,b=k,k=g-m+1>>1,g=g+m+1>>1,m=k,k=v*nn+S*tn+2048>>12,v=v*tn-S*nn+2048>>12,S=k,k=x*en+L*Qt+2048>>12,x=x*Qt-L*en+2048>>12,L=k,u[0+p]=y+S,u[7+p]=y-S,u[1+p]=g+L,u[6+p]=g-L,u[2+p]=m+x,u[5+p]=m-x,u[3+p]=b+v,u[4+p]=b-v}for(let d=0;d<8;++d){const p=d;if(u[1*8+p]==0&&u[2*8+p]==0&&u[3*8+p]==0&&u[4*8+p]==0&&u[5*8+p]==0&&u[6*8+p]==0&&u[7*8+p]==0){const A=gt*f[d+0]+8192>>14;u[0*8+p]=A,u[1*8+p]=A,u[2*8+p]=A,u[3*8+p]=A,u[4*8+p]=A,u[5*8+p]=A,u[6*8+p]=A,u[7*8+p]=A;continue}let y=gt*u[0*8+p]+2048>>12,g=gt*u[4*8+p]+2048>>12,m=u[2*8+p],b=u[6*8+p],v=ln*(u[1*8+p]-u[7*8+p])+2048>>12,S=ln*(u[1*8+p]+u[7*8+p])+2048>>12,x=u[3*8+p],L=u[5*8+p],k=y-g+1>>1;y=y+g+1>>1,g=k,k=m*sn+b*on+2048>>12,m=m*on-b*sn+2048>>12,b=k,k=v-L+1>>1,v=v+L+1>>1,L=k,k=S+x+1>>1,x=S-x+1>>1,S=k,k=y-b+1>>1,y=y+b+1>>1,b=k,k=g-m+1>>1,g=g+m+1>>1,m=k,k=v*nn+S*tn+2048>>12,v=v*tn-S*nn+2048>>12,S=k,k=x*en+L*Qt+2048>>12,x=x*Qt-L*en+2048>>12,L=k,u[0*8+p]=y+S,u[7*8+p]=y-S,u[1*8+p]=g+L,u[6*8+p]=g-L,u[2*8+p]=m+x,u[5*8+p]=m-x,u[3*8+p]=b+v,u[4*8+p]=b-v}for(let d=0;d<64;++d){const p=128+(u[d]+8>>4);c[d]=p<0?0:p>255?255:p}}Ot(i*o*8);for(let r=0;r<o;r++){const c=r<<3;for(let f=0;f<8;f++)n.push(new Uint8Array(i));for(let f=0;f<t;f++){a(e.blocks[r][f],l,s);let h=0;const u=f<<3;for(let d=0;d<8;d++){const p=n[c+d];for(let y=0;y<8;y++)p[u+y]=l[h++]}}}return n}function qe(e){return e<0?0:e>255?255:e}function nr(e){const n={width:0,height:0,comments:[],adobe:void 0,components:[],exifBuffer:void 0,jfif:void 0},t=Ja*1e3*1e3;let o=0;function i(){const m=e[o]<<8|e[o+1];return o+=2,m}function s(){const m=i(),b=e.subarray(o,o+m-2);return o+=b.length,b}function l(m){let b=0,v=0;for(let L in m.components)if(m.components.hasOwnProperty(L)){const k=m.components[L];b<k.h&&(b=k.h),v<k.v&&(v=k.v)}const S=Math.ceil(m.samplesPerLine/8/b),x=Math.ceil(m.scanLines/8/v);for(let L in m.components)if(m.components.hasOwnProperty(L)){const k=m.components[L],A=Math.ceil(Math.ceil(m.samplesPerLine/8)*k.h/b),R=Math.ceil(Math.ceil(m.scanLines/8)*k.v/v),B=S*k.h,U=x*k.v,le=U*B,ce=[];Ot(le*256);for(let fe=0;fe<U;fe++){const V=[];for(let q=0;q<B;q++)V.push(new Int32Array(64));
1ce.push(V)}k.blocksPerLine=A,k.blocksPerColumn=R,k.blocks=ce}m.maxH=b,m.maxV=v,m.mcusPerLine=S,m.mcusPerColumn=x}let a=null,r=null,c,f=0,h=[],u=[],d=[],p=[],y=i(),g=-1;if(y!=65496)throw new Error("SOI not found");for(y=i();y!=65497;){switch(y){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:{const m=s();if(y===65534){let b="";for(let v=0;v<m.byteLength;v++)b+=String.fromCharCode(m[v]);n.comments.push(b)}y===65504&&m[0]===74&&m[1]===70&&m[2]===73&&m[3]===70&&m[4]===0&&(a={version:{major:m[5],minor:m[6]},densityUnits:m[7],xDensity:m[8]<<8|m[9],yDensity:m[10]<<8|m[11],thumbWidth:m[12],thumbHeight:m[13],thumbData:m.subarray(14,14+3*m[12]*m[13])}),y===65505&&m[0]===69&&m[1]===120&&m[2]===105&&m[3]===102&&m[4]===0&&(n.exifBuffer=m.subarray(5,m.length)),y===65518&&m[0]===65&&m[1]===100&&m[2]===111&&m[3]===98&&m[4]===101&&m[5]===0&&(r={version:m[6],flags0:m[7]<<8|m[8],flags1:m[9]<<8|m[10],transformCode:m[11]});break}case 65499:{const b=i()+o-2;for(;o<b;){const v=e[o++];Ot(64*4);const S=new Int32Array(64);if(v>>4)if(v>>4===1)for(let x=0;x<64;x++){const L=jt[x];S[L]=i()}else throw new Error("DQT: invalid table spec");else for(let x=0;x<64;x++){const L=jt[x];S[L]=e[o++]}h[v&15]=S}break}case 65472:case 65473:case 65474:{i(),c={extended:y===65473,progressive:y===65474,precision:e[o++],scanLines:i(),samplesPerLine:i(),components:{},componentsOrder:[],maxH:0,maxV:0,mcusPerLine:0,mcusPerColumn:0};const m=c.scanLines*c.samplesPerLine;if(m>t){const v=Math.ceil((m-t)/1e6);throw new Error(`maxResolutionInMP limit exceeded by ${v}MP`)}const b=e[o++];for(let v=0;v<b;v++){const S=e[o],x=e[o+1]>>4,L=e[o+1]&15,k=e[o+2];c.componentsOrder.push(S),c.components[S]={h:x,v:L,quantizationIdx:k,blocksPerColumn:0,blocksPerLine:0,blocks:[],pred:0},o+=3}l(c),u.push(c);break}case 65476:{const m=i();for(let b=2;b<m;){const v=e[o++],S=new Uint8Array(16);let x=0;for(let R=0;R<16;R++,o++)x+=S[R]=e[o];Ot(16+x);const L=new Uint8Array(x);for(let R=0;R<x;R++,o++)L[R]=e[o];b+=17+x;const k=v&15,A=v>>4?d:p;A[k]=Qa(S,L)}break}case 65501:i(),f=i();break;case 65500:i(),i();break;case 65498:{i();const m=e[o++],b=[];for(let k=0;k<m;k++){const A=c.components[e[o++]],R=e[o++];A.huffmanTableDC=p[R>>4],A.huffmanTableAC=d[R&15],b.push(A)}const v=e[o++],S=e[o++],x=e[o++],L=er(e,o,c,b,f,v,S,x>>4,x&15);o+=L;break}case 65535:e[o]!==255&&o--;break;default:{if(e[o-3]==255&&e[o-2]>=192&&e[o-2]<=254){o-=3;break}else if(y===224||y==225){if(g!==-1)throw new Error(`first unknown JPEG marker at offset ${g.toString(16)}, second unknown JPEG marker ${y.toString(16)} at offset ${(o-1).toString(16)}`);g=o-1;const m=i();if(e[o+m-2]===255){o+=m-2;break}}throw new Error("unknown JPEG marker "+y.toString(16))}}y=i()}if(u.length!=1)throw new Error("only single frame JPEGs supported");for(let m=0;m<u.length;m++){const b=u[m].components;for(let v in b)b[v].quantizationTable=h[b[v].quantizationIdx],delete b[v].quantizationIdx}n.width=c.samplesPerLine,n.height=c.scanLines,n.jfif=a,n.adobe=r,n.components=[];for(let m=0;m<c.componentsOrder.length;m++){const b=c.components[c.componentsOrder[m]];n.components.push({lines:tr(b),scaleX:b.h/c.maxH,scaleY:b.v/c.maxV})}return n}function or(e){let n=0,t=!1;const o=e.width,i=e.height,s=o*i*e.components.length;Ot(s);const l=new Uint8Array(s);switch(e.components.length){case 1:{const a=e.components[0];for(let r=0;r<i;r++){const c=a.lines[0|r*a.scaleY];for(let f=0;f<o;f++){const h=c[0|f*a.scaleX];l[n++]=h}}break}case 2:{const a=e.components[0],r=e.components[1];for(let c=0;c<i;c++){const f=a.lines[0|c*a.scaleY],h=r.lines[0|c*r.scaleY];for(let u=0;u<o;u++){const d=f[0|u*a.scaleX];l[n++]=d;const p=h[0|u*r.scaleX];l[n++]=p}}break}case 3:{t=!0,e.adobe&&e.adobe.transformCode&&(t=!0);const a=e.components[0],r=e.components[1],c=e.components[2];for(let f=0;f<i;f++){const h=a.lines[0|f*a.scaleY],u=r.lines[0|f*r.scaleY],d=c.lines[0|f*c.scaleY];for(let p=0;p<o;p++){let y,g,m,b,v,S;t?(y=h[0|p*a.scaleX],g=u[0|p*r.scaleX],m=d[0|p*c.scaleX],b=qe(y+1.402*(m-128)),v=qe(y-.3441363*(g-128)-.71413636
1*(m-128)),S=qe(y+1.772*(g-128))):(b=h[0|p*a.scaleX],v=u[0|p*r.scaleX],S=d[0|p*c.scaleX]),l[n++]=b,l[n++]=v,l[n++]=S}}break}case 4:{if(!e.adobe)throw new Error("Unsupported color mode (4 components)");t=!1,e.adobe&&e.adobe.transformCode&&(t=!0);const a=e.components[0],r=e.components[1],c=e.components[2],f=e.components[3];for(let h=0;h<i;h++){const u=a.lines[0|h*a.scaleY],d=r.lines[0|h*r.scaleY],p=c.lines[0|h*c.scaleY],y=f.lines[0|h*f.scaleY];for(let g=0;g<o;g++){let m,b,v,S,x,L,k;t?(m=u[0|g*a.scaleX],b=d[0|g*r.scaleX],v=p[0|g*c.scaleX],S=y[0|g*f.scaleX],x=255-qe(m+1.402*(v-128)),L=255-qe(m-.3441363*(b-128)-.71413636*(v-128)),k=255-qe(m+1.772*(b-128))):(x=u[0|g*a.scaleX],L=d[0|g*r.scaleX],k=p[0|g*c.scaleX],S=y[0|g*f.scaleX]),l[n++]=255-x,l[n++]=255-L,l[n++]=255-k,l[n++]=255-S}}break}default:throw new Error("Unsupported color mode")}return l}function ir(e,n){if(oo=0,e.length===0)throw new Error("Empty jpeg buffer");const t=nr(e);Ot(t.width*t.height*4);const o=or(t),i=n(t.width,t.height),s=i.width,l=i.height,a=i.data;let r=0,c=0;switch(t.components.length){case 1:for(let f=0;f<l;f++)for(let h=0;h<s;h++){const u=o[r++];a[c++]=u,a[c++]=u,a[c++]=u,a[c++]=255}break;case 3:for(let f=0;f<l;f++)for(let h=0;h<s;h++){const u=o[r++],d=o[r++],p=o[r++];a[c++]=u,a[c++]=d,a[c++]=p,a[c++]=255}break;case 4:for(let f=0;f<l;f++)for(let h=0;h<s;h++){const u=o[r++],d=o[r++],p=o[r++],y=o[r++],g=255-qe(u*(1-y/255)+y),m=255-qe(d*(1-y/255)+y),b=255-qe(p*(1-y/255)+y);a[c++]=g,a[c++]=m,a[c++]=b,a[c++]=255}break;default:throw new Error("Unsupported color mode")}return i}const bs={},It={pass:"pass through",norm:"normal",diss:"dissolve",dark:"darken","mul ":"multiply",idiv:"color burn",lbrn:"linear burn",dkCl:"darker color",lite:"lighten",scrn:"screen","div ":"color dodge",lddg:"linear dodge",lgCl:"lighter color",over:"overlay",sLit:"soft light",hLit:"hard light",vLit:"vivid light",lLit:"linear light",pLit:"pin light",hMix:"hard mix",diff:"difference",smud:"exclusion",fsub:"subtract",fdiv:"divide","hue ":"hue","sat ":"saturation",colr:"color","lum ":"luminosity"};Object.keys(It).forEach(e=>bs[It[e]]=e);const Jo=["none","red","orange","yellow","green","blue","violet","gray"],sr=["LMsk","Lr16","Lr32","Layr","Mt16","Mt32","Mtrn","Alph","FMsk","lnk2","FEid","FXid","PxSD","cinf"];function lr(e){const n={};return Object.keys(e).forEach(t=>n[e[t]]=t),n}function j(e,n,t){const o=lr(t);return{decode:l=>{const a=l.split(".")[1];if(a&&!o[a])throw new Error(`Unrecognized value for enum: '${l}'`);return o[a]||n},encode:l=>{if(l&&!t[l])throw new Error(`Invalid value for enum: '${l}'`);return`${e}.${t[l]||t[n]}`}}}var Qo;(function(e){e[e.RGB=0]="RGB",e[e.HSB=1]="HSB",e[e.CMYK=2]="CMYK",e[e.Lab=7]="Lab",e[e.Grayscale=8]="Grayscale"})(Qo||(Qo={}));var ei;(function(e){e[e.PositionRelativeToLayer=1]="PositionRelativeToLayer",e[e.LayerMaskDisabled=2]="LayerMaskDisabled",e[e.InvertLayerMaskWhenBlending=4]="InvertLayerMaskWhenBlending",e[e.LayerMaskFromRenderingOtherData=8]="LayerMaskFromRenderingOtherData",e[e.MaskHasParametersAppliedToIt=16]="MaskHasParametersAppliedToIt"})(ei||(ei={}));var ti;(function(e){e[e.UserMaskDensity=1]="UserMaskDensity",e[e.UserMaskFeather=2]="UserMaskFeather",e[e.VectorMaskDensity=4]="VectorMaskDensity",e[e.VectorMaskFeather=8]="VectorMaskFeather"})(ti||(ti={}));function ar(e,n){switch(e){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return n?3:e+1;case-1:return n?4:3;default:return e+1}}function ys(e,n,t){return e<n?n:e>t?t:e}function rr({data:e}){const n=e instanceof Float32Array?1:e instanceof Uint16Array?65535:255;for(let t=0,o=e.length|0;t<o;t=t+4|0)e[t+0]=0,e[t+1]=0,e[t+2]=0,e[t+3]=n}function io(e){const n=Pn(e.width,e.height);let t;if(e.data instanceof Uint8ClampedArray)t=e;else{t=fo(e.width,e.height);const o=e.data,i=t.data;if(o instanceof Float32Array)for(let s=0,l=o.length;s<l;s+=4)i[s+0]=Math.round(Math.pow(o[s+0],1/2.2)*255),i[s+1]=Math.round(Math.pow(o[s+1],1/2.2)*255),i[s+2]=Math.round(Math.pow(o[s+2],1/2.2)*255),i[s+3]=Math.round(o[s+3]*255);else{const s=o instanceof Uint16Array?8:0;for(let l=0,a=o.length;l<a;l++)i[l]=o[l]>>>s}}return n.getContext("2d").putImageData(t,0,0),n}function cr(e,n,t,o){if(!(e instanceof Uint8Array||e instanceof Uint8ClampedArray))throw new Error("Invalid bit depth");for(let i=0,s=0,l=0;i<o;i++)for(let a=0;a<t;){let r=e[l++];for(let c=0;c<8&&a<t;c++,a++,s+=4){const f=r&128?0:255;r=r<<1,n[s+0]=f,n[s+1]=f,n[s+2]=f,n[s+3]=255}}}function fr(e,{data:n,width:t,height:o},i,s){if(!t||!o)return;const l=4*t|0;let a=0,r=i.length*2*o|0;for(const c of i)for(let f=0,h=c|0;f<o;f++){const u=f*l|0,d=u+l|0,p=d+c-4|0,y=p-4|0,g=r;for(h=u+c|0;h<d;h=h+4|0)if(h<y){let b=n[h];h=h+4|0;let v=n[h];h=h+4|0;let S=n[h];if(b===v&&b===S){let x=3;for(;x<128&&h<p&&n[h+4|0]===b;)x=x+1|0,h=h+4|0;e[r++]=1-x,e[r++]=b}else{const x=r;let L=!0,k=1;for(e[r++]=0,e[r++]=b;h<p&&k<128;)if(h=h+4|0,b=v,v=S,S=n[h],b===v&&b===S){h=h-12|0,L=!1;break}else k++,e[r++]=b;L&&(k<127?(e[r++]=v,e[r++]=S,k+=2):k<128?(e[r++]=v,k++,h=h-4|0):h=h-8|0),e[x]=k-1}}
1else h===p?(e[r++]=0,e[r++]=n[h]):(e[r++]=1,e[r++]=n[h],h=h+4|0,e[r++]=n[h]);const m=r-g;e[a++]=m>>8&255,e[a++]=m&255}return e.slice(0,r)}function ur(e){const n=Pn(100,100);try{const t=n.getContext("2d"),o=ir(e,(i,s)=>t.createImageData(i,s));n.width=o.width,n.height=o.height,t.putImageData(o,0,0)}catch(t){console.error("JPEG decompression error",t.message)}return n}let Pn=()=>{throw new Error("Canvas not initialized, use initializeCanvas method to set up createCanvas method")},Vn,fo=(e,n)=>(Vn||(Vn=Pn(1,1)),Vn.getContext("2d").createImageData(e,n));typeof document<"u"&&(Pn=(e,n)=>{const t=document.createElement("canvas");return t.width=e,t.height=n,t});var Ss=br,dr=vr,Ue=[],we=[],hr=typeof Uint8Array<"u"?Uint8Array:Array,$n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var bt=0,pr=$n.length;bt<pr;++bt)Ue[bt]=$n[bt],we[$n.charCodeAt(bt)]=bt;we[45]=62;we[95]=63;function mr(e){var n=e.length;if(n%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=e.indexOf("=");t===-1&&(t=n);var o=t===n?0:4-t%4;return[t,o]}function gr(e,n,t){return(n+t)*3/4-t}function br(e){var n,t=mr(e),o=t[0],i=t[1],s=new hr(gr(e,o,i)),l=0,a=i>0?o-4:o,r;for(r=0;r<a;r+=4)n=we[e.charCodeAt(r)]<<18|we[e.charCodeAt(r+1)]<<12|we[e.charCodeAt(r+2)]<<6|we[e.charCodeAt(r+3)],s[l++]=n>>16&255,s[l++]=n>>8&255,s[l++]=n&255;return i===2&&(n=we[e.charCodeAt(r)]<<2|we[e.charCodeAt(r+1)]>>4,s[l++]=n&255),i===1&&(n=we[e.charCodeAt(r)]<<10|we[e.charCodeAt(r+1)]<<4|we[e.charCodeAt(r+2)]>>2,s[l++]=n>>8&255,s[l++]=n&255),s}function yr(e){return Ue[e>>18&63]+Ue[e>>12&63]+Ue[e>>6&63]+Ue[e&63]}function Sr(e,n,t){for(var o,i=[],s=n;s<t;s+=3)o=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(e[s+2]&255),i.push(yr(o));return i.join("")}function vr(e){for(var n,t=e.length,o=t%3,i=[],s=16383,l=0,a=t-o;l<a;l+=s)i.push(Sr(e,l,l+s>a?a:l+s));return o===1?(n=e[t-1],i.push(Ue[n>>2]+Ue[n<<4&63]+"==")):o===2&&(n=(e[t-2]<<8)+e[t-1],i.push(Ue[n>>10]+Ue[n>>4&63]+Ue[n<<2&63]+"=")),i.join("")}function so(e){return e&4294967168?e&4294965248?e&4294901760?4:3:2:1}function kr(e){let n=0;for(let t=0;t<e.length;t++){const o=e.charCodeAt(t);if(o>=55296&&o<=56319){if(t+1<e.length){const i=e.charCodeAt(t+1);(i&64512)===56320&&(t++,n+=so(((o&1023)<<10)+(i&1023)+65536))}}else n+=so(o)}return n}function ni(e,n,t){const o=so(t);switch(o){case 1:e[n]=t;break;case 2:e[n]=t>>6&31|192,e[n+1]=t&63|128;break;case 3:e[n]=t>>12&15|224,e[n+1]=t>>6&63|128,e[n+2]=t&63|128;break;default:e[n]=t>>18&7|240,e[n+1]=t>>12&63|128,e[n+2]=t>>6&63|128,e[n+3]=t&63|128;break}return o}function xr(e,n,t){for(let o=0;o<t.length;o++){const i=t.charCodeAt(o);if(i>=55296&&i<=56319){if(o+1<t.length){const s=t.charCodeAt(o+1);if((s&64512)===56320){o++;const l=((i&1023)<<10)+(s&1023)+65536;n+=ni(e,n,l)}}}else n+=ni(e,n,i)}return n}function vs(e){if(e.length>1e3&&typeof TextEncoder<"u")return new TextEncoder().encode(e);const n=new Uint8Array(kr(e));return xr(n,0,e),n}function yt(e,n){if(n>=e.length)throw Error("Invalid byte index");const t=e[n];if((t&192)===128)return t&63;throw Error("Invalid continuation byte")}function ks(e){if(e.byteLength>1e3&&typeof TextDecoder<"u")return new TextDecoder().decode(e);let n=[];for(let t=0;t<e.length;){const o=e[t++];let i;if(!(o&128))i=o;else if((o&224)===192){const s=yt(e,t++);if(i=(o&31)<<6|s,i<128)throw Error("Invalid continuation byte")}else if((o&240)===224){const s=yt(e,t++),l=yt(e,t++);if(i=(o&15)<<12|s<<6|l,i<2048)throw Error("Invalid continuation byte");if(i>=55296&&i<=57343)throw Error(`Lone surrogate U+${i.toString(16).toUpperCase()} is not a scalar value`)}else if((o&248)===240){const s=yt(e,t++),l=yt(e,t++),a=yt(e,t++);if(i=(o&15)<<18|s<<12|l<<6|a,i<65536||i>1114111)throw Error("Invalid continuation byte")}else throw Error("Invalid UTF-8 detected");i>65535&&(i-=65536,n.push(String.fromCharCode(i>>>10&1023|55296)),i=56320|i&1023),n.push(String.fromCharCode(i))}return n.join("")}var Fr=function(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,o=Object.getOwnPropertySymbols(e);i<o.length;i++)n.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(e,o[i])&&(t[o[i]]=e[o[i]]);return t};function Or(e){const n={};return Object.keys(e).forEach(t=>n[e[t]]=t),n}const Mt={"#Ang":"Angle","#Rsl":"Density","#Rlt":"Distance","#Nne":"None","#Prc":"Percent","#Pxl":"Pixels","#Mlm":"Millimeters","#Pnt":"Points",RrPi:"Picas",RrIn:"Inches",RrCm:"Centimeters"},an=Or(Mt);function D(e,n){return{name:e,classID:n}}const X=D("","null"),xs={strokeStyleContent:D("","solidColorLayer"),printProofSetup:D("Proof Setup","proofSetup"),Grad:D("Gradient","Grdn"),Trnf:D("Transform","Trnf"),patternFill:D("","patternFill"),ebbl:D("","ebbl"),SoFi:D("","SoFi"),GrFl:D("","GrFl"),sdwC:D("","RGBC"),hglC:D("","RGBC"),"Clr ":D("","RGBC"),tintColor:D("","RGBC"),Ofst:D("","Pnt "),ChFX:D("","ChFX"),MpgS:D("","ShpC"),DrSh:D("","DrSh"),IrSh:D("","IrSh"),OrGl:D("","OrGl"),IrGl:D("","IrGl"),TrnS:D("","ShpC"),Ptrn:D("","Ptrn"),FrFX:D("","FrFX"),phase:D("","Pnt "),frameStep:X,duration:X,workInTime:X,workOutTime:X,audioClipGroupList:X,bounds:D("","Rctn"),customEnvelopeWarp:D("","customEnvelopeWarp"),warp:D("","warp"),"Sz  ":D("","Pnt "),origin:D("","Pnt "),autoExpandOffset:D("","Pnt "),keyOriginShapeBBox:D("","unitRect"),Vrsn:X,psVersion:X,docDefaultNewArtboardBackgroun
1dColor:D("","RGBC"),artboardRect:D("","classFloatRect"),keyOriginRRectRadii:D("","radii"),keyOriginBoxCorners:X,rectangleCornerA:D("","Pnt "),rectangleCornerB:D("","Pnt "),rectangleCornerC:D("","Pnt "),rectangleCornerD:D("","Pnt "),compInfo:X,quiltWarp:D("","quiltWarp"),generatorSettings:X,crema:X,FrIn:X,blendOptions:X,FXRf:X,Lefx:X,time:X,animKey:X,timeScope:X,inTime:X,outTime:X,sheetStyle:X,translation:X,Skew:X,boundingBox:D("","boundingBox"),"Lnk ":D("","ExternalFileLink"),frameReader:D("","FrameReader"),effectParams:D("","motionTrackEffectParams"),Impr:D("None","none"),Anch:D("","Pnt "),"Fwd ":D("","Pnt "),"Bwd ":D("","Pnt "),FlrC:D("","Pnt "),meshBoundaryPath:D("","pathClass"),filterFX:D("","filterFXStyle"),Fltr:D("","rigidTransform"),FrgC:D("","RGBC"),BckC:D("","RGBC"),sdwM:D("Parameters","adaptCorrectTones"),hglM:D("Parameters","adaptCorrectTones"),customShape:D("","customShape"),origFXRefPoint:X,FXRefPoint:X,ClMg:D("","ClMg")},Fs={"Crv ":D("","CrPt"),Clrs:D("","Clrt"),Trns:D("","TrnS"),keyDescriptorList:X,solidFillMulti:D("","SoFi"),gradientFillMulti:D("","GrFl"),dropShadowMulti:D("","DrSh"),innerShadowMulti:D("","IrSh"),frameFXMulti:D("","FrFX"),FrIn:X,FSts:X,LaSt:X,sheetTimelineOptions:X,trackList:D("","animationTrack"),globalTrackList:D("","animationTrack"),keyList:X,audioClipGroupList:X,audioClipList:X,countObjectList:D("","countObject"),countGroupList:D("","countGroup"),slices:D("","slice"),"Pts ":D("","Pthp"),SbpL:D("","SbpL"),pathComponents:D("","PaCm"),filterFXList:D("","filterFX"),puppetShapeList:D("","puppetShape"),channelDenoise:D("","channelDenoiseParams"),ShrP:D("","Pnt "),layerSettings:X,list:X,Adjs:D("","CrvA")},oi={TEXT:["Txt ","printerName","Nm  ","Idnt","blackAndWhitePresetFileName","LUT3DFileName","presetFileName","curvesPresetFileName","mixerPresetFileName","placed","description","reason","artboardPresetName","json","clipID","relPath","fullPath","mediaDescriptor","Msge","altTag","url","cellText","preset","KnNm","FPth","comment","originalPath"],tdta:["EngineData","LUT3DFileData","indexArray","originalVertexArray","deformedVertexArray","LqMe"],long:["TextIndex","RndS","Mdpn","Smth","Lctn","strokeStyleVersion","LaID","Vrsn","Cnt ","Brgh","Cntr","means","vibrance","Strt","bwPresetKind","comp","compID","originalCompID","curvesPresetKind","mixerPresetKind","uOrder","vOrder","PgNm","totalPages","Crop","numerator","denominator","frameCount","Annt","keyOriginType","unitValueQuadVersion","keyOriginIndex","major","minor","fix","docDefaultNewArtboardBackgroundType","artboardBackgroundType","numModifyingFX","deformNumRows","deformNumCols","FrID","FrDl","FsID","LCnt","AFrm","AFSt","numBefore","numAfter","Spcn","minOpacity","maxOpacity","BlnM","sheetID","gblA","globalAltitude","descVersion","frameReaderType","LyrI","zoomOrigin","fontSize","Rds ","sliceID","topOutset","leftOutset","bottomOutset","rightOutset","filterID","meshQuality","meshExpansion","meshRigidity","VrsM","VrsN","NmbG","WLMn","WLMx","AmMn","AmMx","SclH","SclV","Lvl ","TlNm","TlOf","FlRs","Thsh","ShrS","ShrE","FlRs","Vrnc","Strg","ExtS","ExtD","HrzS","VrtS","NmbR","EdgF","Ang1","Ang2","Ang3","Ang4","lastAppliedComp","capturedInfo"],enum:["textGridding","Ornt","warpStyle","warpRotate","Inte","Bltn","ClrS","BlrQ","bvlT","bvlS","bvlD","Md  ","glwS","GrdF","GlwT","RplS","BlrM","SmBM","strokeStyleLineCapType","strokeStyleLineJoinType","strokeStyleLineAlignment","strokeStyleBlendMode","PntT","Styl","lookupType","LUTFormat","dataOrder","tableOrder","enableCompCore","enableCompCoreGPU","compCoreSupport","compCoreGPUSupport","Engn","enableCompCoreThreads","gs99","FrDs","trackID","animInterpStyle","horzAlign","vertAlign","bgColorType","shapeOperation","UndA","Wvtp","Drct","WndM","Edg ","FlCl","IntE","IntC","Cnvr","Fl  ","Dstr","MztT","Lns ","ExtT","DspM","ExtR","ZZTy","SphM","SmBQ","placedLayerOCIOConversion","gradientsInterpolationMethod"],bool:["PstS","printSixteenBit","masterFXSwitch","enab","uglg","antialiasGloss","useShape","useTexture","uglg","antialiasGloss","useShape","Vsbl","useTexture","Algn","Rvrs","Dthr","Invr","VctC","ShTr","layerConceals","strokeEnabled","fillEnabled","strokeStyleScaleLock","
1strokeStyleStrokeAdjust","hardProof","MpBl","paperWhite","useLegacy","Auto","Lab ","useTint","keyShapeInvalidated","autoExpandEnabled","autoNestEnabled","autoPositionEnabled","shrinkwrapOnSaveEnabled","present","showInDialog","overprint","sheetDisclosed","lightsDisclosed","meshesDisclosed","materialsDisclosed","hasMotion","muted","Effc","selected","autoScope","fillCanvas","cellTextIsHTML","Smoo","Clsp","validAtPosition","rigidType","hasoptions","filterMaskEnable","filterMaskLinked","filterMaskExtendWithWhite","removeJPEGArtifact","Mnch","ExtF","ExtM","moreAccurate","GpuY","LIWy","Cnty"],doub:["warpValue","warpPerspective","warpPerspectiveOther","Intr","Wdth","Hght","strokeStyleMiterLimit","strokeStyleResolution","layerTime","keyOriginResolution","xx","xy","yx","yy","tx","ty","FrGA","frameRate","audioLevel","rotation","X   ","Y   ","redFloat","greenFloat","blueFloat","imageResolution","PuX0","PuX1","PuX2","PuX3","PuY0","PuY1","PuY2","PuY3"],UntF:["sdwO","hglO","lagl","Lald","srgR","blur","Sftn","Opct","Dstn","Angl","Ckmt","Nose","Inpr","ShdN","strokeStyleLineWidth","strokeStyleLineDashOffset","strokeStyleOpacity","H   ","Top ","Left","Btom","Rght","Rslt","topRight","topLeft","bottomLeft","bottomRight","ClNs","Shrp"],VlLs:["Crv ","Clrs","Mnm ","Mxm ","Trns","pathList","strokeStyleLineDashSet","FrLs","slices","LaSt","Trnf","nonAffineTransform","keyDescriptorList","guideIndeces","gradientFillMulti","solidFillMulti","frameFXMulti","innerShadowMulti","dropShadowMulti","FrIn","FSts","FsFr","sheetTimelineOptions","audioClipList","trackList","globalTrackList","keyList","audioClipList","warpValues","selectedPin","Pts ","SbpL","pathComponents","pinOffsets","posFinalPins","pinVertexIndices","PinP","PnRt","PnOv","PnDp","filterFXList","puppetShapeList","ShrP","channelDenoise","Mtrx","layerSettings","list","compList","Adjs"],ObAr:["meshPoints","quiltSliceX","quiltSliceY"],"obj ":["null","Chnl"],"Pth ":["DspF"]},Cr=["Rd  ","Grn ","Bl  ","Yllw","Ylw ","Cyn ","Mgnt","Blck","Gry ","Lmnc","A   ","B   "],Os={"Mnm ":"long","Mxm ":"long",FrLs:"long",strokeStyleLineDashSet:"UntF",Trnf:"doub",nonAffineTransform:"doub",keyDescriptorList:"Objc",gradientFillMulti:"Objc",solidFillMulti:"Objc",frameFXMulti:"Objc",innerShadowMulti:"Objc",dropShadowMulti:"Objc",LaSt:"Objc",FrIn:"Objc",FSts:"Objc",FsFr:"long",blendOptions:"Objc",sheetTimelineOptions:"Objc",keyList:"Objc",warpValues:"doub",selectedPin:"long","Pts ":"Objc",SbpL:"Objc",pathComponents:"Objc",pinOffsets:"doub",posFinalPins:"doub",pinVertexIndices:"long",PinP:"doub",PnRt:"long",PnOv:"bool",PnDp:"doub",filterFXList:"Objc",puppetShapeList:"Objc",ShrP:"Objc",channelDenoise:"Objc",Mtrx:"long",compList:"long",Chnl:"enum"},Fn={};for(const e of Object.keys(oi))for(const n of oi[e])Fn[n]=e;for(const e of Object.keys(xs))Fn[e]||(Fn[e]="Objc");for(const e of Object.keys(Fs))Os[e]="Objc";function Ir(e,n,t,o){return e==="presetKind"?typeof n=="string"?"enum":"long":e==="null"&&t==="slices"?"TEXT":e==="groupID"?t==="slices"?"long":"TEXT":e==="Sz  "?"Wdth"in n?"Objc":"units"in n?"UntF":"doub":e==="Type"?typeof n=="string"?"enum":"long":e==="AntA"?typeof n=="string"?"enum":"bool":(e==="Hrzn"||e==="Vrtc")&&(o.Type==="keyType.Pstn"||o._classID==="Ofst")?"long":e==="Hrzn"||e==="Vrtc"||e==="Top "||e==="Left"||e==="Btom"||e==="Rght"?t==="slices"?"long":typeof n=="number"?"doub":"UntF":e==="Vrsn"?typeof n=="number"?"long":"Objc":e==="Rd  "||e==="Grn "||e==="Bl  "?t==="artd"?"long":"doub":e==="Trnf"?Array.isArray(n)?"VlLs":"Objc":Fn[e]}function Ze(e){const n=T(e);return Mn(e,n||4)}function Je(e,n){if(n.length===4&&n!=="warp"&&n!=="time"&&n!=="hold"&&n!=="list")G(e,0),N(e,n);else{G(e,n.length);for(let t=0;t<n.length;t++)P(e,n.charCodeAt(t))}}function Cs(e,n){const t=rt(e),o=n?{_name:t.name,_classID:t.classID}:{},i=F(e);for(let s=0;s<i;s++){const l=Ze(e),a=ne(e),r=Ds(e,a,n);o[l]=r}return o}function Is(e,n,t,o,i){ht(e,n),Je(e,t);const s=Object.keys(o);let l=s.length;"_name"in o&&l--,"_classID"in o&&l--,O(e,l);for(const a of s){if(a==="_name"||a==="_classID")continue;let r=Ir(a,o[a],i,o),c=xs[a];a==="bounds"&&i==="text"?c=D("","bounds"):a==="origin"?r=i==="slices"?"enum":"Objc":(a==="Cyn "||a==="Mgnt"||a==="Ylw "||a==="Blck")&&o._classID==="CMYC"?r="doub":/^PN[a-z][a-z]$/.test(a)?r="TEXT":/^PT[a-z][a-z]$/.test(a)?r="long":/^PF[a-z][a-z]$/.test(a)||(a==="Rds "||a==="Thsh")&&typeof o[a]=="number"&&o._classID==="SmrB"?r="doub":a==="ClSz"||a==="Rds "||a==="Amnt"?r=typeof o[a]=="number"?"long":"UntF":(a==="sdwM"||a==="hglM")&&typeof o[a]=="string"||a==="blur"&&typeof o[a]=="string"?r="enum":a==="Hght"&&typeof o[a]=="number"&&o._classID==="Embs"||a==="Angl"&&typeof o[a]=="number"&&(o._classID==="Embs"||o._classID==="smartSharpen"||o._classID==="Twrl"||o._classID==="MtnB")?r="long":a==="Angl"&&typeof o[a]=="number"?r="doub":a==="bounds"&&i==="slices"?(r="Objc",c=D("","Rct1")):a==="Scl "?typeof o[a]=="object"&&"Hrzn"in o[a]?(r="Objc",c=X):typeof o[a]=="number"?r="long":r="UntF":a==="audioClipGroupList"&&s.length===1?r="VlLs":(a==="Strt"||a==="Brgh")&&"H   "in o?r="doub":a==="Wdth"&&typeof o[a]=="object"?r="UntF":a==="Ofst"&&typeof o[a]=="number"?r="long":a==="Strt"&&typeof o[a]=="object"?(r="Objc",c=X):Cr.indexOf(a)!==-1?r=t==="RGBC"&&i!=="artd"?"doub":"long":a==="profile"?r=t==="printOutput"?"TEXT":"tdta":a==="strokeStyleContent"?o[a]["Clr "]?c=D("","solidColorLayer"):o[a].Grad?c=D("","gradientLayer"):o[a].Ptrn&&(c=D("","patternLayer")):a==="bounds"&&i==="quiltWarp"&&(c=D("","classFloatRect")),c&&c.classID==="RGBC"&&"H   "in o[a]&&(c={classID:"HSBC",name:""}),Je(e,a),N(e,r||"long"),ws(e,r||"long",o[a],a,c,i)}}function Ds(e,n,t){switch(n){case"obj ":return wr(e);case"Objc":case"GlbO":return Cs(e,t);case"VlLs":{const o=T(e),i=[];for(let s=0;s<o;s++){const l=ne(e);i.push(Ds(e,l,t))}return i}case"doub":return Ee(e);case"UntF":{const o=ne(e),i=Ee(e);if(!Mt[o])throw new Error(`Invalid units: ${o}`);return{units:Mt[o],value:i}}case"UnFl":{const o=ne(e),i=Me(e);if(!Mt[o])throw new Error(`Invalid units: ${o}`);return{units:Mt[o],value:i}}case"TEXT":return ue(e);case"enum":{const o=Ze(e),i=Ze(e);return`${o}.${i}`}case"long":return T(e);case"comp":{const o=F(e),i=F(e);return{low:o,high:i}}case"bool":return!!w(e);case"type":case"GlbC":return rt(e);case"alis":{const o=T(e);return Mn(e,o)}case"tdta":{const o=T(e);return re(e,o)}case"ObAr":{T(e),ue(e),Ze(e);const o=T(e),i=[];for(let s=0;s<o;s++){const l=Ze(e);ne(e),ne(e);const a=T(e),r=[];for(let c=0;c<a;c++)r.push(Ee(e));i.push({type:l,values:r})}return i}case"Pth ":{T(e);const o=ne(e);Ei(e);const i=Ei(e),s=zr(e,i);return{sig:o,path:s}}default:throw new Error(`Invalid TySh descriptor OSType: ${n} at ${e.offset.toString(16)}`)}}const Dr={meshPoints:"rationalPoint",quiltSliceX:"UntF",quiltSliceY:"UntF"};function ws(e,n,t,o,i,s){switch(n){case"obj ":Lr(e,o,t);break;case"Objc":case"GlbO":{if(typeof t!="object")throw new Error(`Invalid struct value: ${JSON.stringify(t)}, key: ${o}`);if(!i)throw new Error(`Missing ext type for: '${o}' (${JSON.stringify(t)})`);const l=t._name||i.name,a=t._classID||i.classID;Is(e,l,a,t,s);break}case"VlLs":if(!Array.isArray(t))throw new Error(`Invalid list value: ${JSON.stringify(t)}, key: ${o}`);G(e,t.length);for(let l=0;l<t.length;l++){const a=Os[o];N(e,a||"long"),ws(e,a||"long",t[l],`${o}[]`,Fs[o],s)}break;case"doub":if(typeof t!="number")throw new Error(`Invalid number value: ${JSON.stringify(t)}, key: ${o}`);Ge(e,t);break;case"UntF":if(!an[t.units])throw new Error(`Invalid units: ${t.units} in ${o}`);N(e,an[t.units]),Ge(e,t.value);break;case"UnFl":if(!an[t.units])throw new Error(`Invalid units: ${t.units} in ${o}`);N(e,an[t.units]),Re(e,t.value);break;case"TEXT":ht(e,t);break;case"enum":{if(typeof t!="string")throw new Error(`Invalid enum value: ${JSON.stringify(t)}, key: ${o}`);const[l,a]=t.split(".");Je(e,l),Je(e,a);break}case"long":if(typeof t!="number")throw new Error(`Invalid integer value: ${JSON.stringify(t)}, key: ${o}`);G(e,t);break;case"bool":if(typeof t!="boolean")throw new Error(`Invalid boolean value: ${JSON.stringify(t)}, key: ${o}`);P(e,t?1:0);break;case"tdta":G(e,t.byteLength),Ve(e,t);break;case"ObAr":{G(e,16),ht(e,"");const l=Dr[o];if(!l)throw new Error(`Not implemented ObArType for: ${o}`);Je(e,l),G(e,t.length);for(let a=0;a<t.length;a++){Je(e,t[a].type),N(e,"UnFl"),N(e,"#Pxl"),G(e,t[a].values.length);for(let r=0;r<t[a].values.length;r++)Ge(e,t[a].values[r])}break}case"Pth ":{const l=12+t.path.length*2;G(e,l),N(e,t.sig),Ki(e,l),Ki(e,t.path.length),Dc(e,t.path);break}default:throw new Error(`Not implemented descriptor OSType: ${n}`)}}function wr(e){const n=T(e),t=[];for(let o=0;o<n;o++){const i=ne(e);switch(i){case"prop":{rt(e);const s=Ze(e);t.push(s);break}case"Clss":t.push(rt(e));break;case"Enmr":{rt(e);const s=Ze(e),l=Ze(e);t.push(`${s}.${l}`);break}
1case"rele":{rt(e),t.push(F(e));break}case"Idnt":t.push(T(e));break;case"indx":t.push(T(e));break;case"name":{rt(e),t.push(ue(e));break}default:throw new Error(`Invalid descriptor reference type: ${i}`)}}return t}function Lr(e,n,t){G(e,t.length);for(let o=0;o<t.length;o++){const i=t[o];let s="unknown";switch(typeof i=="string"&&(/^[a-z ]+\.[a-z ]+$/i.test(i)?s="Enmr":s="name"),N(e,s),s){case"Enmr":{const[l,a]=i.split(".");ii(e,"\0",l),Je(e,l),Je(e,a);break}case"name":{ii(e,"\0","Lyr "),Se(e,i+"\0");break}default:throw new Error(`Invalid descriptor reference type: ${s}`)}}return t}function rt(e){const n=ue(e),t=Ze(e);return{name:n,classID:t}}function ii(e,n,t){Se(e,n),Je(e,t)}function H(e,n=!1){const t=F(e);if(t!==16)throw new Error(`Invalid descriptor version: ${t}`);return Cs(e,n)}function W(e,n,t,o,i=""){O(e,16),Is(e,n,t,o,i)}function Bt(e){return{x:e.Hrzn,y:e.Vrtc}}function zt(e){return{Hrzn:e.x,Vrtc:e.y}}function si(e){return{top:Q(e["Top "]),left:Q(e.Left),right:Q(e.Rght),bottom:Q(e.Btom)}}function li(e){return{Left:oe(e.left,"bounds.left"),"Top ":oe(e.top,"bounds.top"),Rght:oe(e.right,"bounds.right"),Btom:oe(e.bottom,"bounds.bottom")}}function ai(e){const n={enabled:!!e.enab,position:Tn.decode(e.Styl),fillType:$s.decode(e.PntT),blendMode:Le.decode(e["Md  "]),opacity:te(e.Opct),size:Q(e["Sz  "])};return e.present!==void 0&&(n.present=e.present),e.showInDialog!==void 0&&(n.showInDialog=e.showInDialog),e.overprint!==void 0&&(n.overprint=e.overprint),e["Clr "]&&(n.color=_e(e["Clr "])),e.Grad&&(n.gradient=Ts(e)),e.Ptrn&&(n.pattern=Ms(e)),n}function ri(e){let n={};return n.enab=!!e.enabled,e.present!==void 0&&(n.present=!!e.present),e.showInDialog!==void 0&&(n.showInDialog=!!e.showInDialog),n.Styl=Tn.encode(e.position),n.PntT=$s.encode(e.fillType),n["Md  "]=Le.encode(e.blendMode),n.Opct=he(e.opacity),n["Sz  "]=oe(e.size,"size"),e.color&&(n["Clr "]=je(e.color)),e.gradient&&(n=Object.assign(Object.assign({},n),Rs(e.gradient))),e.pattern&&(n=Object.assign(Object.assign({},n),_s(e.pattern))),e.overprint!==void 0&&(n.overprint=!!e.overprint),n}function Ht(e,n,t){var o,i,s;const l=t?{"Scl ":De((o=e.scale)!==null&&o!==void 0?o:1),masterFXSwitch:!e.disabled}:{masterFXSwitch:!e.disabled,"Scl ":De((i=e.scale)!==null&&i!==void 0?i:1)},a=["dropShadow","innerShadow","solidFill","gradientOverlay","stroke"];for(const f of a)if(e[f]&&!Array.isArray(e[f]))throw new Error(`${f} should be an array`);const r=f=>!!f&&f.length>1&&t,c=f=>!!f&&f.length>=1&&(!t||f.length===1);if(c(e.dropShadow)&&(l.DrSh=xe(e.dropShadow[0],"dropShadow",n)),r(e.dropShadow)&&(l.dropShadowMulti=e.dropShadow.map(f=>xe(f,"dropShadow",n))),c(e.innerShadow)&&(l.IrSh=xe(e.innerShadow[0],"innerShadow",n)),r(e.innerShadow)&&(l.innerShadowMulti=e.innerShadow.map(f=>xe(f,"innerShadow",n))),e.outerGlow&&(l.OrGl=xe(e.outerGlow,"outerGlow",n)),r(e.solidFill)&&(l.solidFillMulti=e.solidFill.map(f=>xe(f,"solidFill",n))),r(e.gradientOverlay)&&(l.gradientFillMulti=e.gradientOverlay.map(f=>xe(f,"gradientOverlay",n))),r(e.stroke)&&(l.frameFXMulti=e.stroke.map(f=>ri(f))),e.innerGlow&&(l.IrGl=xe(e.innerGlow,"innerGlow",n)),e.bevel&&(l.ebbl=xe(e.bevel,"bevel",n)),c(e.solidFill)&&(l.SoFi=xe(e.solidFill[0],"solidFill",n)),e.patternOverlay&&(l.patternFill=xe(e.patternOverlay,"patternOverlay",n)),c(e.gradientOverlay)&&(l.GrFl=xe(e.gradientOverlay[0],"gradientOverlay",n)),e.satin&&(l.ChFX=xe(e.satin,"satin",n)),c(e.stroke)&&(l.FrFX=ri((s=e.stroke)===null||s===void 0?void 0:s[0])),t){l.numModifyingFX=0;for(const f of Object.keys(e)){const h=e[f];if(Array.isArray(h))for(const u of h)u.enabled&&l.numModifyingFX++;else h.enabled&&l.numModifyingFX++}}return l}function Wt(e,n){const t={},{masterFXSwitch:o,DrSh:i,dropShadowMulti:s,IrSh:l,innerShadowMulti:a,OrGl:r,IrGl:c,ebbl:f,SoFi:h,solidFillMulti:u,patternFill:d,GrFl:p,gradientFillMulti:y,ChFX:g,FrFX:m,frameFXMulti:b,numModifyingFX:v}=e,S=Fr(e,["masterFXSwitch","DrSh","dropShadowMulti","IrSh","innerShadowMulti","OrGl","IrGl","ebbl","SoFi","solidFillMulti","patternFill","GrFl","gradientFillMulti","ChFX","FrFX","frameFXMulti","numModifyingFX"]);return o||(t.disabled=!0),e["Scl "]&&(t.scale=te(e["Scl "])),i&&(t.dropShadow=[ke(i,n)]),s&&(t.dropShadow=s.map(x=>ke(x,n))),l&&(t.innerShadow=[ke(l,n)]),a&&(t.innerShadow=a.map(x=>ke(x,n))),r&&(t.outerGlow=ke(r,n)),c&&(t.innerGlow=ke(c,n)),f&&(t.bevel=ke(f,n)),h&&(t.solidFill=[ke(h,n)]),u&&(t.solidFill=u.map(x=>ke(x,n))),d&&(t.patternOverlay=ke(d,n)),p&&(t.gradientOverlay=[ke(p,n)]),y&&(t.gradientOverlay=y.map(x=>ke(x,n))),g&&(t.satin=ke(g,n)),m&&(t.stroke=[ai(m)]),b&&(t.stroke=b.map(x=>ai(x))),n&&Object.keys(S).length>1&&console.log("Unhandled effect keys:",S),t}function ci(e,n){const t=[];for(let o=0;o<e.length;o++){const i=e[o],{time:{denominator:s,numerator:l},selected:a,animKey:r}=i,c={numerator:l,denominator:s},f=Gs.decode(i.animInterpStyle);switch(r.Type){case"keyType.Opct":t.push({interpolation:f,time:c,selected:a,type:"opacity",value:te(r.Opct)});break;case"keyType.Pstn":t.push({interpolation:f,time:c,selected:a,type:"position",x:r.Hrzn,y:r.Vrtc});break;case"keyType.Trnf":t.push({interpolation:f,time:c,selected:a,type:"transform",scale:Bt(r["Scl "]),skew:Bt(r.Skew),rotation:r.rotation,translation:Bt(r.translation)});break;case"keyType.sheetStyle":{const h={interpolation:f,time:c,selected:a,type:"style"};r.sheetStyle.Lefx&&(h.style=Wt(r.sheetStyle.Lefx,n)),t.push(h);break}case"keyType.globalLighting":{t.push({interpolation:f,time:c,selected:a,type:"globalLighting",globalAngle:r.gblA,globalAltitude:r.globalAltitude});break}default:throw new Error("Unsupported keyType value")}}return t}function fi(e){const n=[];for(let t=0;t<e.length;t++){const o=e[t],{time:i,selected:s=!1,interpolation:l}=o,a=Gs.encode(l);let r;switch(o.type){case"opacity":r={Type:"keyType.Opct",Opct:he(o.value)};break;case"position":r={Type:"keyType.Pstn",Hrzn:o.x,Vrtc:o.y};break;case"transform":r={Type:"keyType.Trnf","Scl ":zt(o.scale),Skew:zt(o.skew),rotation:o.rotation,translation:zt(o.translation)};break;case"style":r={Type:"keyType.sheetStyle",sheetStyle:{Vrsn:1,blendOptions:{}}},o.style&&(r.sheetStyle={Vrsn:1,Lefx:Ht(o.style,!1,!1),blendOptions:{}});break;case"globalLighting":{r={Type:"keyType.globalLighting",gblA:o.globalAngle,globalAltitude:o.globalAltitude};break}default:throw new Error("Unsupported keyType value")}n.push({Vrsn:1,animInterpStyle:a,time:i,animKey:r,selected:s})}return n}function Ls(e,n){const t=[];for(let o=0;o<e.length;o++){const i=e[o],s={type:Vs.decode(i.trackID),enabled:i.enab,keys:ci(i.keyList,n)};i.effectParams&&(s.effectParams={fillCanvas:i.effectParams.fillCanvas,zoomOrigin:i.effectParams.zoomOrigin,keys:ci(i.effectParams.keyList,n)}),t.push(s)}return t}function Es(e){const n=[];for(let t=0;t<e.length;t++){const o=e[t];n.push(Object.assign(Object.assign({trackID:Vs.encode(o.type),Vrsn:1,enab:!!o.enabled,Effc:!!o.effectParams},o.effectParams?{effectParams:{keyList:fi(o.keys),fillCanvas:o.effectParams.fillCanvas,zoomOrigin:o.effectParams.zoomOrigin}}:{}),{keyList:fi(o.keys)}))}return n}function ke(e,n){const t={};for(const o of Object.keys(e)){const i=e[o];switch(o){case"enab":t.enabled=!!i;break;case"uglg":t.useGlobalLight=!!i;break;case"AntA":t.antialiased=!!i;break;case"Algn":t.align=!!i;break;case"Dthr":t.dither=!!i;break;case"Invr":t.invert=!!i;break;case"Rvrs":t.reverse=!!i;break;case"Clr ":t.color=_e(i);break;case"hglC":t.highlightColor=_e(i);break;case"sdwC":t.shadowColor=_e(i);break;case"Styl":t.position=Tn.decode(i);break;case"Md  ":t.blendMode=Le.decode(i);break;case"hglM":t.highlightBlendMode=Le.decode(i);break;case"sdwM":t.shadowBlendMode=Le.decode(i);break;
1case"bvlS":t.style=js.decode(i);break;case"bvlD":t.direction=zs.decode(i);break;case"bvlT":t.technique=Bs.decode(i);break;case"GlwT":t.technique=Ns.decode(i);break;case"glwS":t.source=Us.decode(i);break;case"Type":t.type=An.decode(i);break;case"gs99":t.interpolationMethod=Dt.decode(i);break;case"Opct":t.opacity=te(i);break;case"hglO":t.highlightOpacity=te(i);break;case"sdwO":t.shadowOpacity=te(i);break;case"lagl":t.angle=vn(i);break;case"Angl":t.angle=vn(i);break;case"Lald":t.altitude=vn(i);break;case"Sftn":t.soften=Q(i);break;case"srgR":t.strength=te(i);break;case"blur":t.size=Q(i);break;case"Nose":t.noise=te(i);break;case"Inpr":t.range=te(i);break;case"Ckmt":t.choke=Q(i);break;case"ShdN":t.jitter=te(i);break;case"Dstn":t.distance=Q(i);break;case"Scl ":t.scale=te(i);break;case"Ptrn":t.pattern={name:i["Nm  "],id:i.Idnt};break;case"phase":t.phase={x:i.Hrzn,y:i.Vrtc};break;case"Ofst":t.offset={x:te(i.Hrzn),y:te(i.Vrtc)};break;case"MpgS":case"TrnS":t.contour={name:i["Nm  "],curve:i["Crv "].map(s=>({x:s.Hrzn,y:s.Vrtc}))};break;case"Grad":t.gradient=Ps(i);break;case"useTexture":case"useShape":case"layerConceals":case"present":case"showInDialog":case"antialiasGloss":t[o]=i;break;case"_name":case"_classID":break;default:n&&console.log(`Invalid effect key: '${o}', value:`,i)}}return t}function xe(e,n,t){const o={enab:!1};n==="dropShadow"&&(o.TrnS={"Nm  ":"","Crv ":[]});for(const i of Object.keys(e)){const s=i,l=e[s];switch(s){case"enabled":o.enab=!!l;break;case"useGlobalLight":o.uglg=!!l;break;case"antialiased":o.AntA=!!l;break;case"align":o.Algn=!!l;break;case"dither":o.Dthr=!!l;break;case"invert":o.Invr=!!l;break;case"reverse":o.Rvrs=!!l;break;case"color":o["Clr "]=je(l);break;case"highlightColor":o.hglC=je(l);break;case"shadowColor":o.sdwC=je(l);break;case"position":o.Styl=Tn.encode(l);break;case"blendMode":o["Md  "]=Le.encode(l);break;case"highlightBlendMode":o.hglM=Le.encode(l);break;case"shadowBlendMode":o.sdwM=Le.encode(l);break;case"style":o.bvlS=js.encode(l);break;case"direction":o.bvlD=zs.encode(l);break;case"technique":n==="bevel"?o.bvlT=Bs.encode(l):o.GlwT=Ns.encode(l);break;case"source":o.glwS=Us.encode(l);break;case"type":o.Type=An.encode(l);break;case"interpolationMethod":o.gs99=Dt.encode(l);break;case"opacity":o.Opct=he(l);break;case"highlightOpacity":o.hglO=he(l);break;case"shadowOpacity":o.sdwO=he(l);break;case"angle":n==="gradientOverlay"||n==="patternFill"?o.Angl=Nt(l):o.lagl=Nt(l);break;case"altitude":o.Lald=Nt(l);break;case"soften":o.Sftn=oe(l,s);break;case"strength":o.srgR=he(l);break;case"size":o.blur=oe(l,s);break;case"noise":o.Nose=he(l);break;case"range":o.Inpr=he(l);break;case"choke":o.Ckmt=oe(l,s);break;case"jitter":o.ShdN=he(l);break;case"distance":o.Dstn=oe(l,s);break;case"scale":o["Scl "]=he(l);break;case"pattern":o.Ptrn={"Nm  ":l.name,Idnt:l.id};break;case"phase":o.phase={Hrzn:l.x,Vrtc:l.y};break;case"offset":o.Ofst={Hrzn:he(l.x),Vrtc:he(l.y)};break;case"contour":{o[n==="satin"?"MpgS":"TrnS"]={"Nm  ":l.name,"Crv ":l.curve.map(a=>({Hrzn:a.x,Vrtc:a.y}))};break}case"gradient":o.Grad=As(l);break;case"useTexture":case"useShape":case"layerConceals":case"present":case"showInDialog":case"antialiasGloss":o[s]=l;break;default:t&&console.log(`Invalid effect key: '${s}', value:`,l)}}return o}function Ps(e){if(e.GrdF==="GrdF.CstS"){const n=e.Intr||4096;return{type:"solid",name:e["Nm  "],smoothness:e.Intr/4096,colorStops:e.Clrs.map(t=>({color:_e(t["Clr "]),location:t.Lctn/n,midpoint:t.Mdpn/100})),opacityStops:e.Trns.map(t=>({opacity:te(t.Opct),location:t.Lctn/n,midpoint:t.Mdpn/100}))}}else return{type:"noise",name:e["Nm  "],roughness:e.Smth/4096,colorModel:On.decode(e.ClrS),randomSeed:e.RndS,restrictColors:!!e.VctC,addTransparency:!!e.ShTr,min:e["Mnm "].map(n=>n/100),max:e["Mxm "].map(n=>n/100)}}function As(e){var n,t;if(e.type==="solid"){const o=Math.round(((n=e.smoothness)!==null&&n!==void 0?n:1)*4096);return{"Nm  ":e.name||"",GrdF:"GrdF.CstS",Intr:o,Clrs:e.colorStops.map(i=>{var s;return{"Clr ":je(i.color),Type:"Clry.UsrS",Lctn:Math.round(i.location*o),Mdpn:Math.round(((s=i.midpoint)!==null&&s!==void 0?s:.5)*100)}}),Trns:e.opacityStops.map(i=>{var s;return{Opct:he(i.opacity),Lctn:Math.round(i.location*o),Mdpn:Math.round(((s=i.midpoint)!==null&&s!==void 0?s:.5)*100)}})}}else return{GrdF:"GrdF.ClNs","Nm  ":e.name||"",ShTr:!!e.addTransparency,VctC:!!e.restrictColors,ClrS:On.encode(e.colorModel),RndS:e.randomSeed||0,Smth:Math.round(((t=e.roughness)!==null&&t!==void 0?t:1)*4096),"Mnm ":(e.min||[0,0,0,0]).map(o=>o*100),"Mxm ":(e.max||[1,1,1,1]).map(o=>o*100)}}function Ts(e){const n=Ps(e.Grad);return n.style=An.decode(e.Type),e.Dthr!==void 0&&(n.dither=e.Dthr),e.gradientsInterpolationMethod!==void 0&&(n.interpolationMethod=Dt.decode(e.gradientsInterpolationMethod)),e.Rvrs!==void 0&&(n.reverse=e.Rvrs),e.Angl!==void 0&&(n.angle=vn(e.Angl)),e["Scl "]!==void 0&&(n.scale=te(e["Scl "])),e.Algn!==void 0&&(n.align=e.Algn),e.Ofst!==void 0&&(n.offset={x:te(e.Ofst.Hrzn),y:te(e.Ofst.Vrtc)}),n}function Ms(e){const n={name:e.Ptrn["Nm  "],id:e.Ptrn.Idnt};
1return e.Lnkd!==void 0&&(n.linked=e.Lnkd),e.phase!==void 0&&(n.phase={x:e.phase.Hrzn,y:e.phase.Vrtc}),n}function Xt(e){if("Grad"in e)return Ts(e);if("Ptrn"in e)return Object.assign({type:"pattern"},Ms(e));if("Clr "in e)return{type:"color",color:_e(e["Clr "])};throw new Error("Invalid vector content")}function Rs(e){const n={};return e.dither!==void 0&&(n.Dthr=e.dither),e.interpolationMethod!==void 0&&(n.gradientsInterpolationMethod=Dt.encode(e.interpolationMethod)),e.reverse!==void 0&&(n.Rvrs=e.reverse),e.angle!==void 0&&(n.Angl=Nt(e.angle)),n.Type=An.encode(e.style),e.align!==void 0&&(n.Algn=e.align),e.scale!==void 0&&(n["Scl "]=he(e.scale)),e.offset&&(n.Ofst={Hrzn:he(e.offset.x),Vrtc:he(e.offset.y)}),n.Grad=As(e),n}function _s(e){const n={Ptrn:{"Nm  ":e.name||"",Idnt:e.id||""}};return e.linked!==void 0&&(n.Lnkd=!!e.linked),e.phase!==void 0&&(n.phase={Hrzn:e.phase.x,Vrtc:e.phase.y}),n}function Kt(e){return e.type==="color"?{key:"SoCo",descriptor:{"Clr ":je(e.color)}}:e.type==="pattern"?{key:"PtFl",descriptor:_s(e)}:{key:"GdFl",descriptor:Rs(e)}}function _e(e){if("H   "in e)return{h:Er(e["H   "]),s:e.Strt,b:e.Brgh};if("Rd  "in e)return{r:e["Rd  "],g:e["Grn "],b:e["Bl  "]};if("Cyn "in e)return{c:e["Cyn "],m:e.Mgnt,y:e["Ylw "],k:e.Blck};if("Gry "in e)return{k:e["Gry "]};if("Lmnc"in e)return{l:e.Lmnc,a:e["A   "],b:e["B   "]};if("redFloat"in e)return{fr:e.redFloat,fg:e.greenFloat,fb:e.blueFloat};throw new Error("Unsupported color descriptor")}function je(e){if(e){if("r"in e)return{_name:"",_classID:"RGBC","Rd  ":e.r||0,"Grn ":e.g||0,"Bl  ":e.b||0};if("fr"in e)return{_name:"",_classID:"RGBC",redFloat:e.fr,greenFloat:e.fg,blueFloat:e.fb};if("h"in e)return{_name:"",_classID:"HSBC","H   ":Nt(e.h*360),Strt:e.s||0,Brgh:e.b||0};if("c"in e)return{_name:"",_classID:"CMYC","Cyn ":e.c||0,Mgnt:e.m||0,"Ylw ":e.y||0,Blck:e.k||0};if("l"in e)return{_name:"",_classID:"LABC",Lmnc:e.l||0,"A   ":e.a||0,"B   ":e.b||0};if("k"in e)return{_name:"",_classID:"GRYC","Gry ":e.k};throw new Error("Invalid color value")}else return{_name:"",_classID:"RGBC","Rd  ":0,"Grn ":0,"Bl  ":0}}function vn(e){if(e===void 0)return 0;if(e.units!=="Angle")throw new Error(`Invalid units: ${e.units}`);return e.value}function te(e){if(e===void 0)return 1;if(e.units!=="Percent")throw new Error(`Invalid units: ${e.units}`);return e.value/100}function Er(e){if(e===void 0)return 1;if(e.units==="Percent")return e.value/100;if(e.units==="Angle")return e.value/360;throw new Error(`Invalid units: ${e.units}`)}function Q({units:e,value:n}){if(e!=="Pixels"&&e!=="Millimeters"&&e!=="Points"&&e!=="None"&&e!=="Picas"&&e!=="Inches"&&e!=="Centimeters"&&e!=="Density")throw new Error(`Invalid units: ${JSON.stringify({units:e,value:n})}`);return{value:n,units:e}}function nt(e,n="Pixels"){return typeof e=="number"?{value:e,units:n}:Q(e)}function Nt(e){return{units:"Angle",value:e||0}}function he(e){return{units:"Percent",value:Math.round((e||0)*100)}}function De(e){return{units:"Percent",value:(e||0)*100}}function oe(e,n){if(e==null)return{units:"Pixels",value:0};if(typeof e!="object")throw new Error(`Invalid value: ${JSON.stringify(e)} (key: ${n}) (should have value and units)`);const{units:t,value:o}=e;if(typeof o!="number")throw new Error(`Invalid value in ${JSON.stringify(e)} (key: ${n})`);if(t!=="Pixels"&&t!=="Millimeters"&&t!=="Points"&&t!=="None"&&t!=="Picas"&&t!=="Inches"&&t!=="Centimeters"&&t!=="Density")throw new Error(`Invalid units in ${JSON.stringify(e)} (key: ${n})`);return{units:t,value:o}}function ye({numerator:e,denominator:n}){return{numerator:e,denominator:n}}const ui=j("textGridding","none",{none:"None",round:"Rnd "}),Ut=j("Ornt","horizontal",{horizontal:"Hrzn",vertical:"Vrtc"}),di=j("Annt","sharp",{none:"Anno",sharp:"antiAliasSharp",crisp:"AnCr",strong:"AnSt",smooth:"AnSm",platform:"antiAliasPlatformGray",platformLCD:"antiAliasPlatformLCD"}),uo=j("warpStyle","none",{none:"warpNone",arc:"warpArc",arcLower:"warpArcLower",arcUpper:"warpArcUpper",arch:"warpArch",bulge:"warpBulge",shellLower:"warpShellLower",shellUpper:"warpShellUpper",flag:"warpFlag",wave:"warpWave",fish:"warpFish",rise:"warpRise",fisheye:"warpFisheye",inflate:"warpInflate",squeeze:"warpSqueeze",twist:"warpTwist",cylinder:"warpCylinder",custom:"warpCustom"}),Le=j("BlnM","normal",{normal:"Nrml",dissolve:"Dslv",darken:"Drkn",multiply:"Mltp","color burn":"CBrn","linear burn":"linearBurn","darker color":"darkerColor",lighten:"Lghn",screen:"Scrn","color dodge":"CDdg","linear dodge":"linearDodge","lighter color":"lighterColor",overlay:"Ovrl","soft light":"SftL","hard light":"HrdL","vivid light":"vividLight","linear light":"linearLight","pin light":"pinLight","hard mix":"hardMix",difference:"Dfrn",exclusion:"Xclu",subtract:"blendSubtraction",divide:"blendDivide",hue:"H   ",saturation:"Strt",color:"Clr ",luminosity:"Lmns","linear height":"linearHeight",he
1ight:"Hght",subtraction:"Sbtr"}),js=j("BESl","inner bevel",{"inner bevel":"InrB","outer bevel":"OtrB",emboss:"Embs","pillow emboss":"PlEb","stroke emboss":"strokeEmboss"}),Bs=j("bvlT","smooth",{smooth:"SfBL","chisel hard":"PrBL","chisel soft":"Slmt"}),zs=j("BESs","up",{up:"In  ",down:"Out "}),Ns=j("BETE","softer",{softer:"SfBL",precise:"PrBL"}),Us=j("IGSr","edge",{edge:"SrcE",center:"SrcC"}),An=j("GrdT","linear",{linear:"Lnr ",radial:"Rdl ",angle:"Angl",reflected:"Rflc",diamond:"Dmnd"}),Gs=j("animInterpStyle","linear",{linear:"Lnr ",hold:"hold"}),Vs=j("stdTrackID","opacity",{opacity:"opacityTrack",style:"styleTrack",sheetTransform:"sheetTransformTrack",sheetPosition:"sheetPositionTrack",globalLighting:"globalLightingTrack"}),Dt=j("gradientInterpolationMethodType","perceptual",{perceptual:"Perc",linear:"Lnr ",classic:"Gcls",smooth:"Smoo"}),On=j("ClrS","rgb",{rgb:"RGBC",hsb:"HSBl",lab:"LbCl",hsl:"HSLC"}),Tn=j("FStl","outside",{outside:"OutF",center:"CtrF",inside:"InsF"}),$s=j("FrFl","color",{color:"SClr",gradient:"GrFl",pattern:"Ptrn"}),hi=j("ESliceType","image",{image:"Img ",noImage:"noImage"}),pi=j("ESliceHorzAlign","default",{default:"default"}),mi=j("ESliceVertAlign","default",{default:"default"}),gi=j("ESliceOrigin","userGenerated",{userGenerated:"userGenerated",autoGenerated:"autoGenerated",layer:"layer"}),bi=j("ESliceBGColorType","none",{none:"None",matte:"matte",color:"Clr "}),yi=j("strokeStyleLineCapType","butt",{butt:"strokeStyleButtCap",round:"strokeStyleRoundCap",square:"strokeStyleSquareCap"}),Si=j("strokeStyleLineJoinType","miter",{miter:"strokeStyleMiterJoin",round:"strokeStyleRoundJoin",bevel:"strokeStyleBevelJoin"}),vi=j("strokeStyleLineAlignment","inside",{inside:"strokeStyleAlignInside",center:"strokeStyleAlignCenter",outside:"strokeStyleAlignOutside"}),Hs=j("BlrM","ispinmage",{spin:"Spn ",zoom:"Zm  "}),Ws=j("BlrQ","good",{draft:"Drft",good:"Gd  ",best:"Bst "}),Xs=j("SmBM","normal",{normal:"SBMN","edge only":"SBME","overlay edge":"SBMO"}),Ks=j("SmBQ","medium",{low:"SBQL",medium:"SBQM",high:"SBQH"}),Ys=j("DspM","stretch to fit",{"stretch to fit":"StrF",tile:"Tile"}),Ct=j("UndA","repeat edge pixels",{"wrap around":"WrpA","repeat edge pixels":"RptE"}),qs=j("Cnvr","rectangular to polar",{"rectangular to polar":"RctP","polar to rectangular":"PlrR"}),Zs=j("RplS","medium",{small:"Sml ",medium:"Mdm ",large:"Lrg "}),Js=j("SphM","normal",{normal:"Nrml","horizontal only":"HrzO","vertical only":"VrtO"}),Qs=j("Wvtp","sine",{sine:"WvSn",triangle:"WvTr",square:"WvSq"}),el=j("ZZTy","pond ripples",{"around center":"ArnC","out from center"
1:"OtFr","pond ripples":"PndR"}),tl=j("Dstr","uniform",{uniform:"Unfr",gaussian:"Gsn "}),Gt=j("Chnl","composite",{red:"Rd  ",green:"Grn ",blue:"Bl  ",composite:"Cmps"}),nl=j("MztT","fine dots",{"fine dots":"FnDt","medium dots":"MdmD","grainy dots":"GrnD","coarse dots":"CrsD","short lines":"ShrL","medium lines":"MdmL","long lines":"LngL","short strokes":"ShSt","medium strokes":"MdmS","long strokes":"LngS"}),ol=j("Lns ","50-300mm zoom",{"50-300mm zoom":"Zm  ","32mm prime":"Nkn ","105mm prime":"Nkn1","movie prime":"PnVs"}),il=j("blurType","gaussian blur",{"gaussian blur":"GsnB","lens blur":"lensBlur","motion blur":"MtnB"}),sl=j("DfsM","normal",{normal:"Nrml","darken only":"DrkO","lighten only":"LghO",anisotropic:"anisotropic"}),ll=j("ExtT","blocks",{blocks:"Blks",pyramids:"Pyrm"}),al=j("ExtR","random",{random:"Rndm","level-based":"LvlB"}),rl=j("FlCl","background color",{"background color":"FlBc","foreground color":"FlFr","inverse image":"FlIn","unaltered image":"FlSm"}),cl=j("CntE","upper",{lower:"Lwr ",upper:"Upr "}),fl=j("WndM","wind",{wind:"Wnd ",blast:"Blst",stagger:"Stgr"}),ul=j("Drct","from the right",{left:"Left",right:"Rght"}),dl=j("IntE","odd lines",{"odd lines":"ElmO","even lines":"ElmE"}),hl=j("IntC","interpolation",{duplication:"CrtD",interpolation:"CrtI"}),pl=j("FlMd","wrap around",{"set to transparent":"Bckg","repeat edge pixels":"Rpt ","wrap around":"Wrp "});j("prjM","fisheye",{fisheye:"fisP",perspective:"perP",auto:"auto","full spherical":"fusP"});const ml=j("presetKindType","presetKindCustom",{custom:"presetKindCustom",default:"presetKindDefault"}),gl={};function Y(e,n,t,o){const i={key:e,has:n,read:t,write:o};gl[i.key]=i}const rn=[void 0,"PPI","PPCM"],cn=[void 0,"Inches","Centimeters","Points","Picas","Columns"],ki="0123456789abcdef";function xi(e){return e<=57?e-48:e-87}function Pr(e,n){return xi(e.charCodeAt(n))<<4|xi(e.charCodeAt(n+1))}function ho(e,n){const t=re(e,n);return ks(t)}function po(e,n){const t=vs(n);Ve(e,t)}function Ar(e){const n=w(e),t=re(e,n);let o=!1;for(let i=0;i<t.byteLength;i++)if(t[i]&128){o=!0;break}return o?new TextDecoder("gbk").decode(t):ks(t)}function Tr(e,n){let t="";for(let i=0,s=n.codePointAt(i++);s!==void 0;s=n.codePointAt(i++))t+=s>127?"?":String.fromCodePoint(s);const o=vs(t);P(e,o.byteLength),Ve(e,o)}Y(1061,e=>e.captionDigest!==void 0,(e,n)=>{let t="";for(let o=0;o<16;o++){const i=w(e);t+=ki[i>>4],t+=ki[i&15]}n.captionDigest=t},(e,n)=>{for(let t=0;t<16;t++)P(e,Pr(n.captionDigest,t*2))});Y(1060,e=>e.xmpMetadata!==void 0,(e,n,t)=>{n.xmpMetadata=ho(e,t())},(e,n)=>{po(e,n.xmpMetadata)});const fn=j("Inte","perceptual",{perceptual:"Img ",saturation:"Grp ","relative colorimetric":"Clrm","absolute colorimetric":"AClr"});Y(1082,e=>e.printInformation!==void 0,(e,n)=>{var t,o;const i=H(e);n.printInformation={printerName:i.printerName||"",renderingIntent:fn.decode((t=i.Inte)!==null&&t!==void 0?t:"Inte.Img ")};const s=n.printInformation;i.PstS!==void 0&&(s.printerManagesColors=i.PstS),i["Nm  "]!==void 0&&(s.printerProfile=i["Nm  "]),i.MpBl!==void 0&&(s.blackPointCompensation=i.MpBl),i.printSixteenBit!==void 0&&(s.printSixteenBit=i.printSixteenBit),i.hardProof!==void 0&&(s.hardProof=i.hardProof),i.printProofSetup&&("Bltn"in i.printProofSetup?s.proofSetup={builtin:i.printProofSetup.Bltn.split(".")[1]}:s.proofSetup={profile:i.printProofSetup.profile,renderingIntent:fn.decode((o=i.printProofSetup.Inte)!==null&&o!==void 0?o:"Inte.Img "),blackPointCompensation:!!i.printProofSetup.MpBl,paperWhite:!!i.printProofSetup.paperWhite})},(e,n)=>{var t,o;const i=n.printInformation,s={};i.printerManagesColors?s.PstS=!0:(i.hardProof!==void 0&&(s.hardProof=!!i.hardProof),s.ClrS="ClrS.RGBC",s["Nm  "]=(t=i.printerProfile)!==null&&t!==void 0?t:"CIE RGB"),s.Inte=fn.encode(i.renderingIntent),i.printerManagesColors||(s.MpBl=!!i.blackPointCompensation),s.printSixteenBit=!!i.printSixteenBit,s.printerName=i.printerName||"",i.proofSetup&&"profile"in i.proofSetup?s.printProofSetup={profile:i.proofSetup.profile||"",Inte:fn.encode(i.proofSetup.renderingIntent),MpBl:!!i.proofSetup.blackPointCompensation,paperWhite:!!i.proofSetup.paperWhite}:s.printProofSetup={Bltn:!((o=i.proofSetup)===null||o===void 0)&&o.builtin?`builtinProof.${i.proofSetup.builtin}`:"builtinProof.proofCMYK"},W(e,"","printOutput",s)});Y(1005,e=>e.resolutionInfo!==void 0,(e,n)=>{const t=Fe(e),o=I(e),i=I(e),s=Fe(e),l=I(e),a=I(e);n.resolutionInfo={horizontalResolution:t,horizontalResolutionUnit:rn[o]||"PPI",widthUnit:cn[i]||"Inches",verticalResolution:s,verticalResolutionUnit:rn[l]||"PPI",heightUnit:cn[a]||"Inches"}},(e,n)=>{const t=n.resolutionInfo;Ce(e,t.horizontalResolution||0),C(e,Math.max(1,rn.indexOf(t.horizontalResolutionUnit))),C(e,Math.max(1,cn.indexOf(t.widthUnit))),Ce(e,t.verticalResolution||0),C(e,Math.max(1,rn.indexOf(t.verticalResolutionUnit))),C(e,Math.max(1,cn.indexOf(t.heightUnit)))});
1const Fi=["centered","size to fit","user defined"];Y(1062,e=>e.printScale!==void 0,(e,n)=>{n.printScale={style:Fi[$(e)],x:Me(e),y:Me(e),scale:Me(e)}},(e,n)=>{const{style:t,x:o,y:i,scale:s}=n.printScale;K(e,Math.max(0,Fi.indexOf(t))),Re(e,o||0),Re(e,i||0),Re(e,s||0)});Y(1006,e=>e.alphaChannelNames!==void 0,(e,n,t)=>{if(n.alphaChannelNames)E(e,t());else for(n.alphaChannelNames=[];t()>0;){const o=Ar(e);n.alphaChannelNames.push(o)}},(e,n)=>{for(const t of n.alphaChannelNames)Tr(e,t)});Y(1045,e=>e.alphaChannelNames!==void 0,(e,n,t)=>{for(n.alphaChannelNames=[];t()>0;)n.alphaChannelNames.push(ue(e))},(e,n)=>{for(const t of n.alphaChannelNames)ht(e,t)});Y(1053,e=>e.alphaIdentifiers!==void 0,(e,n,t)=>{for(n.alphaIdentifiers=[];t()>=4;)n.alphaIdentifiers.push(F(e))},(e,n)=>{for(const t of n.alphaIdentifiers)O(e,t)});Y(1010,e=>e.backgroundColor!==void 0,(e,n)=>n.backgroundColor=de(e),(e,n)=>pe(e,n.backgroundColor));Y(1037,e=>e.globalAngle!==void 0,(e,n)=>n.globalAngle=T(e),(e,n)=>G(e,n.globalAngle));Y(1049,e=>e.globalAltitude!==void 0,(e,n)=>n.globalAltitude=F(e),(e,n)=>O(e,n.globalAltitude));Y(1011,e=>e.printFlags!==void 0,(e,n)=>{n.printFlags={labels:!!w(e),cropMarks:!!w(e),colorBars:!!w(e),registrationMarks:!!w(e),negative:!!w(e),flip:!!w(e),interpolate:!!w(e),caption:!!w(e),printFlags:!!w(e)}},(e,n)=>{const t=n.printFlags;P(e,t.labels?1:0),P(e,t.cropMarks?1:0),P(e,t.colorBars?1:0),P(e,t.registrationMarks?1:0),P(e,t.negative?1:0),P(e,t.flip?1:0),P(e,t.interpolate?1:0),P(e,t.caption?1:0),P(e,t.printFlags?1:0)});Y(1034,e=>e.copyrighted!==void 0,(e,n)=>{n.copyrighted=!!w(e)},(e,n)=>{P(e,n.copyrighted?1:0)});Y(1035,e=>e.url!==void 0,(e,n,t)=>{n.url=Mn(e,t())},(e,n)=>{Cc(e,n.url)});Y(1080,e=>e.countInformation!==void 0,(e,n)=>{const t=H(e);n.countInformation=t.countGroupList.map(o=>({color:{r:o["Rd  "],g:o["Grn "],b:o["Bl  "]},name:o["Nm  "],size:o["Rds "],fontSize:o.fontSize,visible:o.Vsbl,points:o.countObjectList.map(i=>({x:i["X   "],y:i["Y   "]}))}))},(e,n)=>{const t={Vrsn:1,countGroupList:n.countInformation.map(o=>({"Rd  ":o.color.r,"Grn ":o.color.g,"Bl  ":o.color.b,"Nm  ":o.name,"Rds ":o.size,fontSize:o.fontSize,Vsbl:o.visible,countObjectList:o.points.map(i=>({"X   ":i.x,"Y   ":i.y}))}))};W(e,"","Cnt ",t)});Y(1024,e=>e.layerState!==void 0,(e,n)=>n.layerState=I(e),(e,n)=>C(e,n.layerState));Y(1026,e=>e.layersGroup!==void 0,(e,n,t)=>{for(n.layersGroup=[];t()>0;)n.layersGroup.push(I(e))},(e,n)=>{for(const t of n.layersGroup)C(e,t)});Y(1072,e=>e.layerGroupsEnabledId!==void 0,(e,n,t)=>{for(n.layerGroupsEnabledId=[];t()>0;)n.layerGroupsEnabledId.push(w(e))},(e,n)=>{for(const t of n.layerGroupsEnabledId)P(e,t)});Y(1069,e=>e.layerSelectionIds!==void 0,(e,n)=>{let t=I(e);for(n.layerSelectionIds=[];t--;)n.layerSelectionIds.push(F(e))},(e,n)=>{C(e,n.layerSelectionIds.length);for(const t of n.layerSelectionIds)O(e,t)});Y(1032,e=>e.gridAndGuidesInformation!==void 0,(e,n)=>{const t=F(e),o=F(e),i=F(e),s=F(e);if(t!==1)throw new Error(`Invalid 1032 resource version: ${t}`);n.gridAndGuidesInformation={grid:{horizontal:o,vertical:i},guides:[]};for(let l=0;l<s;l++)n.gridAndGuidesInformation.guides.push({location:F(e)/32,direction:w(e)?"horizontal":"vertical"})},(e,n)=>{const t=n.gridAndGuidesInformation,o=t.grid||{horizontal:18*32,vertical:18*32},i=t.guides||[];O(e,1),O(e,o.horizontal),O(e,o.vertical),O(e,i.length);for(const s of i)O(e,s.location*32),P(e,s.direction==="horizontal"?1:0)});Y(1065,e=>e.layerComps!==void 0,(e,n)=>{const t=H(e,!0);n.layerComps={list:[]};for(const o of t.list)n.layerComps.list.push({id:o.compID,name:o["Nm  "],capturedInfo:o.capturedInfo}),"comment"in o&&(n.layerComps.list[n.layerComps.list.length-1].comment=o.comment);"lastAppliedComp"in t&&(n.layerComps.lastApplied=t.lastAppliedComp)},(e,n)=>{const t=n.layerComps,o={list:[]};for(const i of t.list){const s={};s._classID="Comp",s["Nm  "]=i.name,"comment"in i&&(s.comment=i.comment),s.compID=i.id,s.capturedInfo=i.capturedInfo,o.list.push(s)}"lastApplied"in t&&(o.lastAppliedComp=t.lastApplied),W(e,"","CompList",o)});const Oi=["normal",void 0,void 0,void 0,void 0,void 0,void 0,"multiply","screen",void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,"difference"];Y(1078,e=>e.onionSkins!==void 0,(e,n)=>{const t=H(e);n.onionSkins={enabled:t.enab,framesBefore:t.numBefore,framesAfter:t.numAfter,frameSpacing:t.Spcn,minOpacity:t.minOpacity/100,maxOpacity:t.maxOpacity/100,blendMode:Oi[t.BlnM]||"normal"}},(e,n)=>{const t=n.onionSkins,o={Vrsn:1,enab:t.enabled,numBefore:t.framesBefore,numAfter:t.framesAfter,Spcn:t.frameSpacing,minOpacity:t.minOpacity*100|0,maxOpacity:t.maxOpacity*100|0,BlnM:Math.max(0,Oi.indexOf(t.blendMode))};W(e,"","null",o)});Y(1075,e=>e.timelineInformation!==void 0,(e,n)=>{var t,o;const i=H(e);n.timelineInformation={enabled:i.enab,frameStep:ye(i.frameStep),frameRate:i.frameRate,time:ye(i.time),duration:ye(i.duration),workInTime:ye(i.workInTime),workOutTime:ye(i.workOutTime),repeats:i.LCnt,hasMotion:i.hasMotion,globalTracks:Ls(i.globalTrackList,!!e.logMissingFeatures)},!((o=(t=i.audioClipGroupList)===null||t===void 0?void 0:t.audioClipGroupList)===null||o===void 0)&&o.length&&(n.timelineInformation.audioClipGroups=i.audioClipGroupList.audioClipGroupList.map(s=>({id:s.groupID,muted:s.muted,audioClips:s.audioClipList.map(({clipID:l,timeScope:a,muted:r,audioLevel:c,frameReader:f})=>({id:l,start:ye(a.Strt),duration:ye(a.duration),inTime:ye(a.inTime),outTime:ye(a.outTime),muted:r,audioLevel:c,frameReader:{type:f.frameReaderType,mediaDescriptor:f.mediaDescriptor,link:{name:f["Lnk "]["Nm  "],fullPath:f["Lnk "].fullPath,relativePath:f["Lnk "].relPath}}}))})))},(e,n)=>{var t;const o=n.timelineInformation,i={Vrsn:1,enab:o.enabled,frameStep:o.frameStep,frameRate:o.frameRate,time:o.time,duration:o.duration,workInTime:o.workInTime,workOutTime:o.workOutTime,LCnt:o.repeats,globalTrackList:Es(o.globalTracks),audioClipGroupList:{audioClipGroupList:(t=o.audioClipGroups)===null||t===void 0?void 0:t.map(s=>({groupID:s.id,muted:s.muted,audioClipList:s.audioClips.map(l=>({clipID:l.id,timeScope:{Vrsn:1,Strt:l.start,duration:l.duration,inTime:l.inTime,outTime:l.outTime},frameReader:{frameReaderType:l.frameReader.type,descVersion:1,"Lnk ":{descVersion:1,"Nm  ":l.frameReader.link.name,fullPath:l.frameReader.link.fullPath,relPath:l.frameReader.link.relativePath},mediaDescriptor:l.frameReader.mediaDescriptor},muted:l.muted,audioLevel:l.audioLevel}))}))},hasMotion:o.hasMotion};W(e,"","null",i,"anim")});Y(1076,e=>e.sheetDisclosure!==void 0,(e,n)=>{const t=H(e);n.sheetDisclosure={},t.sheetTimelineOptions&&(n.sheetDisclosure.sheetTimelineOptions=t.sheetTimelineOptions.map(o=>({sheetID:o.sheetID,sheetDisclosed:o.sheetDisclosed,lightsDisclosed:o.lightsDisclosed,meshesDisclosed:o.meshesDisclosed,materialsDisclosed:o.materialsDisclosed})))},(e,n)=>{const t=n.sheetDisclosure,o={Vrsn:1};t.sheetTimelineOptions&&(o.sheetTimelineOptions=t.sheetTimelineOptions.map(i=>({Vrsn:2,sheetID:i.sheetID,sheetDisclosed:i.sheetDisclosed,lightsDisclosed:i.lightsDisclosed,meshesDisclosed:i.meshesDisclosed,materialsDisclosed:i.materialsDisclosed}))),W(e,"","null",o)});Y(1054,e=>e.urlsList!==void 0,(e,n)=>{const t=F(e);n.urlsList=[];for(let o=0;o<t;o++){if(ne(e)!=="slic"&&e.throwForMissingFeatures)throw new Error("Unknown long");const s=F(e),l=ue(e);n.urlsList.push({id:s,url:l,ref:"slice"})}},(e,n)=>{const t=n.urlsList;O(e,t.length);for(let o=0;o<t.length;o++)N(e,"slic"),O(e,t[o].id),Se(e,t[o].url)});function Ci(e){return{"Top ":e.top,Left:e.left,Btom:e.bottom,Rght:e.right}}function Ii(e){return{top:e["Top "],left:e.Left,bottom:e.Btom,right:e.Rght}}function un(e,n){return e[Math.max(0,Math.min(e.length-1,n))]}const Di=["autoGenerated","layer","userGenerated"],wi=["noImage","image"],dn=["default"];Y(1050,e=>e.slices?e.slices.length:0,(e,n)=>{const t=F(e);if(t===6){n.slices||(n.slices=[]);const o=T(e),i=T(e),s=T(e),l=T(e),a=ue(e),r=F(e);n.slices.push({bounds:{top:o,left:i,bottom:s,right:l},groupName:a,slices:[]});
1const c=n.slices[n.slices.length-1].slices;for(let h=0;h<r;h++){const u=F(e),d=F(e),p=un(Di,F(e)),y=p=="layer"?F(e):0,g=ue(e),m=un(wi,F(e)),b=T(e),v=T(e),S=T(e),x=T(e),L=ue(e),k=ue(e),A=ue(e),R=ue(e),B=!!w(e),U=ue(e),le=un(dn,F(e)),ce=un(dn,F(e)),fe=w(e),V=w(e),q=w(e),me=w(e),$e=fe+V+q+me===0?"none":fe===0?"matte":"color";c.push({id:u,groupId:d,origin:p,associatedLayerId:y,name:g,target:k,message:A,altTag:R,cellTextIsHTML:B,cellText:U,horizontalAlignment:le,verticalAlignment:ce,type:m,url:L,bounds:{top:v,left:b,bottom:x,right:S},backgroundColorType:$e,backgroundColor:{r:V,g:q,b:me,a:fe}})}H(e).slices.forEach(h=>{const u=c.find(d=>h.sliceID==d.id);u&&(u.topOutset=h.topOutset,u.leftOutset=h.leftOutset,u.bottomOutset=h.bottomOutset,u.rightOutset=h.rightOutset)})}else if(t===7||t===8){const o=H(e);n.slices||(n.slices=[]),n.slices.push({groupName:o.baseName,bounds:Ii(o.bounds),slices:o.slices.map(i=>Object.assign(Object.assign({},i["Nm  "]?{name:i["Nm  "]}:{}),{id:i.sliceID,groupId:i.groupID,associatedLayerId:0,origin:gi.decode(i.origin),type:hi.decode(i.Type),bounds:Ii(i.bounds),url:i.url,target:i.null,message:i.Msge,altTag:i.altTag,cellTextIsHTML:i.cellTextIsHTML,cellText:i.cellText,horizontalAlignment:pi.decode(i.horzAlign),verticalAlignment:mi.decode(i.vertAlign),backgroundColorType:bi.decode(i.bgColorType),backgroundColor:i.bgColor?{r:i.bgColor["Rd  "],g:i.bgColor["Grn "],b:i.bgColor["Bl  "],a:i.bgColor.alpha}:{r:0,g:0,b:0,a:0},topOutset:i.topOutset||0,leftOutset:i.leftOutset||0,bottomOutset:i.bottomOutset||0,rightOutset:i.rightOutset||0}))})}else throw new Error(`Invalid slices version (${t})`)},(e,n,t)=>{const{bounds:o,groupName:i,slices:s}=n.slices[t];O(e,6),G(e,o.top),G(e,o.left),G(e,o.bottom),G(e,o.right),Se(e,i),O(e,s.length);for(let a=0;a<s.length;a++){const r=s[a];let{a:c,r:f,g:h,b:u}=r.backgroundColor;r.backgroundColorType==="none"?c=f=h=u=0:r.backgroundColorType==="matte"&&(c=0,f=h=u=255),O(e,r.id),O(e,r.groupId),O(e,Di.indexOf(r.origin)),r.origin==="layer"&&O(e,r.associatedLayerId),Se(e,r.name||""),O(e,wi.indexOf(r.type)),G(e,r.bounds.left),G(e,r.bounds.top),G(e,r.bounds.right),G(e,r.bounds.bottom),Se(e,r.url),Se(e,r.target),Se(e,r.message),Se(e,r.altTag),P(e,r.cellTextIsHTML?1:0),Se(e,r.cellText),O(e,dn.indexOf(r.horizontalAlignment)),O(e,dn.indexOf(r.verticalAlignment)),P(e,c),P(e,f),P(e,h),P(e,u)}const l={bounds:Ci(o),slices:[]};s.forEach(a=>{const r=Object.assign(Object.assign({sliceID:a.id,groupID:a.groupId,origin:gi.encode(a.origin),Type:hi.encode(a.type),bounds:Ci(a.bounds)},a.name?{"Nm  ":a.name}:{}),{url:a.url,null:a.target,Msge:a.message,altTag:a.altTag,cellTextIsHTML:a.cellTextIsHTML,cellText:a.cellText,horzAlign:pi.encode(a.horizontalAlignment),vertAlign:mi.encode(a.verticalAlignment),bgColorType:bi.encode(a.backgroundColorType)});if(a.backgroundColorType==="color"){const{r:c,g:f,b:h,a:u}=a.backgroundColor;r.bgColor={"Rd  ":c,"Grn ":f,"Bl  ":h,alpha:u}}r.topOutset=a.topOutset||0,r.leftOutset=a.leftOutset||0,r.bottomOutset=a.bottomOutset||0,r.rightOutset=a.rightOutset||0,l.slices.push(r)}),W(e,"","null",l,"slices")});Y(1064,e=>e.pixelAspectRatio!==void 0,(e,n)=>{if(F(e)>2)throw new Error("Invalid pixelAspectRatio version");n.pixelAspectRatio={aspect:Ee(e)}},(e,n)=>{O(e,2),Ge(e,n.pixelAspectRatio.aspect)});Y(1041,e=>e.iccUntaggedProfile!==void 0,(e,n)=>{n.iccUntaggedProfile=!!w(e)},(e,n)=>{P(e,n.iccUntaggedProfile?1:0)});Y(1044,e=>e.idsSeedNumber!==void 0,(e,n)=>n.idsSeedNumber=F(e),(e,n)=>O(e,n.idsSeedNumber));Y(1036,e=>e.thumbnail!==void 0||e.thumbnailRaw!==void 0,(e,n,t)=>{const o=F(e),i=F(e),s=F(e);F(e),F(e),F(e);const l=I(e),a=I(e);if(o!==1||l!==24||a!==1){e.logMissingFeatures&&e.log(`Invalid thumbnail data (format: ${o}, bitsPerPixel: ${l}, planes: ${a})`),E(e,t());return}const r=t(),c=re(e,r);e.useRawThumbnail?n.thumbnailRaw={width:i,height:s,data:c}:c.byteLength&&(n.thumbnail=ur(c))},(e,n)=>{var t;let o=0,i=0,s=new Uint8Array(0);if(n.thumbnailRaw)o=n.thumbnailRaw.width,i=n.thumbnailRaw.height,s=n.thumbnailRaw.data;else try{const h=(t=n.thumbnail.toDataURL("image/jpeg",1))===null||t===void 0?void 0:t.substring(23);h&&(s=Ss(h),o=n.thumbnail.width,i=n.thumbnail.height)}catch{}
1const l=24,a=Math.floor((o*l+31)/32)*4,r=1,c=a*i*r,f=s.length;O(e,1),O(e,o),O(e,i),O(e,a),O(e,c),O(e,f),C(e,l),C(e,r),Ve(e,s)});Y(1057,e=>e.versionInfo!==void 0,(e,n,t)=>{if(F(e)!==1)throw new Error("Invalid versionInfo version");n.versionInfo={hasRealMergedData:!!w(e),writerName:ue(e),readerName:ue(e),fileVersion:F(e)},E(e,t())},(e,n)=>{const t=n.versionInfo;O(e,1),P(e,t.hasRealMergedData?1:0),Se(e,t.writerName),Se(e,t.readerName),O(e,t.fileVersion)});Y(7e3,e=>e.imageReadyVariables!==void 0,(e,n,t)=>{n.imageReadyVariables=ho(e,t())},(e,n)=>{po(e,n.imageReadyVariables)});Y(7001,e=>e.imageReadyDataSets!==void 0,(e,n,t)=>{n.imageReadyDataSets=ho(e,t())},(e,n)=>{po(e,n.imageReadyDataSets)});Y(1088,e=>e.pathSelectionState!==void 0,(e,n,t)=>{const o=H(e);n.pathSelectionState=o.null},(e,n)=>{const t={null:n.pathSelectionState};W(e,"","null",t)});const Li=j("FrmD","",{auto:"Auto",none:"None",dispose:"Disp"});Y(4e3,e=>e.animations!==void 0,(e,n,t)=>{const o=ne(e);if(o==="mani")ot(e,"IRFR"),Ie(e,1,i=>{for(;i()>0;){ot(e,"8BIM");const s=ne(e);Ie(e,1,l=>{if(s==="AnDs"){const a=H(e);n.animations={frames:a.FrIn.map(r=>({id:r.FrID,delay:(r.FrDl||0)/100,dispose:r.FrDs?Li.decode(r.FrDs):"auto"})),animations:a.FSts.map(r=>({id:r.FsID,frames:r.FsFr,repeats:r.LCnt,activeFrame:r.AFrm||0}))}}else if(s==="Roll"){const a=re(e,l());e.logDevFeatures&&e.log("#4000 Roll",a)}else e.logMissingFeatures&&e.log("Unhandled subsection in #4000",s)})}});else if(o==="mopt"){const i=re(e,t());e.logDevFeatures&&e.log("#4000 mopt",i)}else e.logMissingFeatures&&e.log("Unhandled key in #4000:",o)},(e,n)=>{n.animations&&(N(e,"mani"),N(e,"IRFR"),ct(e,1,()=>{N(e,"8BIM"),N(e,"AnDs"),ct(e,1,()=>{const t={FrIn:[],FSts:[]};for(let o=0;o<n.animations.frames.length;o++){const i=n.animations.frames[o],s={FrID:i.id};i.delay&&(s.FrDl=i.delay*100|0),s.FrDs=Li.encode(i.dispose),t.FrIn.push(s)}for(let o=0;o<n.animations.animations.length;o++){const i=n.animations.animations[o],s={FsID:i.id,AFrm:i.activeFrame|0,FsFr:i.frames,LCnt:i.repeats|0};t.FSts.push(s)}W(e,"","null",t)})}))});var Mr=function(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,o=Object.getOwnPropertySymbols(e);i<o.length;i++)n.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(e,o[i])&&(t[o[i]]=e[o[i]]);return t};const bl=[0,1,3,2],Rr=["bitmap","grayscale","indexed","RGB","CMYK","multichannel","duotone","lab"];function Cn(e){const n=e.width*e.height*4;for(let t=0;t<n;t+=4){const o=e.data[t];e.data[t+1]=o,e.data[t+2]=o}}function In(e,n,t){return{view:new DataView(e,n,t),offset:0,strict:!1,debug:!1,large:!1,globalAlpha:!1,log:console.log}}function lo(e,n){if(e.strict)throw new Error(n);e.debug&&e.log(n)}function w(e){return e.offset+=1,e.view.getUint8(e.offset-1)}function _r(e){return e.view.getUint8(e.offset)}function $(e){return e.offset+=2,e.view.getInt16(e.offset-2,!1)}function I(e){return e.offset+=2,e.view.getUint16(e.offset-2,!1)}function jr(e){return e.offset+=2,e.view.getUint16(e.offset-2,!0)}function T(e){return e.offset+=4,e.view.getInt32(e.offset-4,!1)}function Ei(e){return e.offset+=4,e.view.getInt32(e.offset-4,!0)}function F(e){return e.offset+=4,e.view.getUint32(e.offset-4,!1)}function Me(e){return e.offset+=4,e.view.getFloat32(e.offset-4,!1)}function Ee(e){return e.offset+=8,e.view.getFloat64(e.offset-8,!1)}function Fe(e){return T(e)/65536}function Ae(e){return T(e)/(1<<24)}function re(e,n){const t=e.view.byteOffset+e.offset;if(e.offset+=n,t+n>e.view.buffer.byteLength){if(lo(e,"Reading bytes exceeding buffer length"),n>100*1024*1024)throw new Error("Reading past end of file");const o=new Uint8Array(n),i=Math.min(n,e.view.byteLength-t);return i>0&&o.set(new Uint8Array(e.view.buffer,t,i)),o}else return new Uint8Array(e.view.buffer,t,n)}function ne(e){return yl(e,4)}function Br(e,n){const t=String.fromCharCode(e.view.getUint8(n))+String.fromCharCode(e.view.getUint8(n+1))+String.fromCharCode(e.view.getUint8(n+2))+String.fromCharCode(e.view.getUint8(n+3));return t=="8BIM"||t=="8B64"}function Qe(e,n){let t=w(e);const o=t?yl(e,t):"";for(;++t%n;)e.offset++;return o}function ue(e){const n=F(e);return mo(e,n)}function mo(e,n){let t="";for(;n--;){const o=I(e);(o||n>0)&&(t+=String.fromCharCode(o))}return t}function zr(e,n){let t="";for(;n--;){const o=jr(e);(o||n>0)&&(t+=String.fromCharCode(o))}return t}function Mn(e,n){let t="";for(;n--;)t+=String.fromCharCode(w(e));return t}function E(e,n){e.offset+=n}function ot(e,n,t){const o=e.offset,i=ne(e);if(i!==n&&i!==t)throw new Error(`Invalid signature: '${i}' at 0x${o.toString(16)}`)}function yl(e,n){const t=re(e,n);let o="";for(let i=0;i<t.length;i++)o+=String.fromCharCode(t[i]);return o}function Nr(e){return e==="8BIM"||e==="MeSa"||e==="AgHg"||e==="PHUT"||e==="DCSR"}function Ur(e,n={}){var t;ot(e,"8BPS");const o=I(e);if(o!==1&&o!==2)throw new Error(`Invalid PSD file version: ${o}`);E(e,6);const i=I(e),s=F(e),l=F(e),a=I(e),r=I(e),c=o===1?3e4:3e5;if(l>c||s>c)throw new Error(`Invalid size: ${l}x${s}`);if(i>16)throw new Error(`Invalid channel count: ${i}`);if(![1,8,16,32].includes(a))throw new Error(`Invalid bitsPerChannel: ${a}`);if(bl.indexOf(r)===-1)throw new Error(`Color mode not supported: ${(t=Rr[r])!==null&&t!==void 0?t:r}`);const f={width:l,height:s,channels:i,bitsPerChannel:a,colorMode:r};Object.assign(e,n),e.large=o===2,e.globalAlpha=!1,Ie(e,1,m=>{if(m()){if(r===2){if(m()!=768)throw new Error("Invalid color palette size");f.palette=[];for(let b=0;b<256;b++)f.palette.push({r:w(e),g:0,b:0});for(let b=0;b<256;b++)f.palette[b].g=w(e);for(let b=0;b<256;b++)f.palette[b].b=w(e)}E(e,m())}});const h={};Ie(e,1,m=>{for(;m()>0;){Sl(e,Nr);const b=I(e);Qe(e,2),Ie(e,2,v=>{const S=gl[b],x=b===1036&&!!e.skipThumbnail;if(S&&!x)try{S.read(e,h,v)}catch(L){if(e.throwForMissingFeatures)throw L;E(e,v())}else E(e,v())})}});const{layersGroup:u,layerGroupsEnabledId:d}=h,p=Mr(h,["layersGroup","layerGroupsEnabledId"]);Object.keys(p)&&(f.imageResources=p),Ie(e,1,m=>{if(Ie(e,2,b=>{go(e,f,h),E(e,b())},void 0,e.large),m()>0){const b=Xr(e);b&&(f.globalLayerMaskInfo=b)}else E(e,m());for(;m()>0;){for(;m()&&_r(e)===0;)E(e,1);
1m()>=12?vl(e,f,f,h):E(e,m())}},void 0,e.large);const y=f.children&&f.children.length;return e.skipCompositeImageData&&(e.skipLayerImageData||y)||qr(e,f),f}function go(e,n,t){var o,i;const{layersGroup:s=[],layerGroupsEnabledId:l=[]}=t;let a=$(e);a<0&&(e.globalAlpha=!0,a=-a);const r=[],c=[];for(let h=0;h<a;h++){const{layer:u,channels:d}=Gr(e,n,t);s[h]!==void 0&&(u.linkGroup=s[h]),l[h]!==void 0&&(u.linkGroupEnabled=!!l[h]),r.push(u),c.push(d)}for(let h=0;h<a;h++)Hr(e,n,r[h],c[h]);n.children||(n.children=[]);const f=[n];for(let h=r.length-1;h>=0;h--){const u=r[h],d=u.sectionDivider?u.sectionDivider.type:0;d===1||d===2?(u.opened=d===1,u.children=[],!((o=u.sectionDivider)===null||o===void 0)&&o.key&&(u.blendMode=(i=It[u.sectionDivider.key])!==null&&i!==void 0?i:u.blendMode),f[f.length-1].children.unshift(u),f.push(u)):d===3?f.pop():f[f.length-1].children.unshift(u)}}function Gr(e,n,t){const o={};o.top=T(e),o.left=T(e),o.bottom=T(e),o.right=T(e);const i=I(e),s=[];for(let r=0;r<i;r++){let c=$(e),f=F(e);if(e.large){if(f!==0)throw new Error("Sizes larger than 4GB are not supported");f=F(e)}s.push({id:c,length:f})}ot(e,"8BIM");const l=ne(e);if(!It[l])throw new Error(`Invalid blend mode: '${l}'`);o.blendMode=It[l],o.opacity=w(e)/255,o.clipping=w(e)===1;const a=w(e);return o.transparencyProtected=(a&1)!==0,o.hidden=(a&2)!==0,a&32&&(o.effectsOpen=!0),E(e,1),Ie(e,1,r=>{Vr(e,o);const c=$r(e);for(c&&(o.blendingRanges=c),o.name=Qe(e,1);r()>4&&!Br(e,e.offset);)e.offset++;for(;r()>=12;)vl(e,o,n,t);E(e,r())}),{layer:o,channels:s}}function Vr(e,n){return Ie(e,1,t=>{if(!t())return;const o={};n.mask=o,o.top=T(e),o.left=T(e),o.bottom=T(e),o.right=T(e),o.defaultColor=w(e);const i=w(e);if(o.positionRelativeToLayer=(i&1)!==0,o.disabled=(i&2)!==0,o.fromVectorData=(i&8)!==0,t()>=18){const s={};n.realMask=s;const l=w(e);s.positionRelativeToLayer=(l&1)!==0,s.disabled=(l&2)!==0,s.fromVectorData=(l&8)!==0,s.defaultColor=w(e),s.top=T(e),s.left=T(e),s.bottom=T(e),s.right=T(e)}if(i&16){const s=w(e);s&1&&(o.userMaskDensity=w(e)/255),s&2&&(o.userMaskFeather=Ee(e)),s&4&&(o.vectorMaskDensity=w(e)/255),s&8&&(o.vectorMaskFeather=Ee(e))}E(e,t())})}function hn(e){return[w(e),w(e),w(e),w(e)]}function $r(e){return Ie(e,1,n=>{const t=hn(e),o=hn(e),i=[];for(;n()>0;){const s=hn(e),l=hn(e);i.push({sourceRange:s,destRange:l})}return{compositeGrayBlendSource:t,compositeGraphBlendDestinationRange:o,ranges:i}})}function Hr(e,n,t,o){if(e.skipLayerImageData)return;const{colorMode:i=3,bitsPerChannel:s=8}=n;t.rawData={colorMode:i,bitsPerChannel:s,channels:[],large:e.large};for(const l of o){const a=e.offset;let r=0,c;if(l.length===1)throw new Error("Invalid channel length");if(l.length){if(r=I(e),r>3&&(e.offset-=1,r=I(e)),r>3&&(e.offset-=3,r=I(e)),r>3)throw new Error(`Invalid compression: ${r}`);l.length>2&&(c=re(e,l.length-2))}e.offset=a+l.length,t.rawData.channels.push({id:l.id,compression:r,data:c})}e.useRawData||Wr(t,!!e.useImageData,!!e.throwForMissingFeatures)}function Pi({data:e},n){const t=e instanceof Float32Array?1:e instanceof Uint16Array?65535:255,o=(n?4:3)|0,i=e.length|0,s=(n?5:4)|0;for(let l=o;l<i;l=l+s|0)e[l]=t}function Wr(e,n,t){if(!e.rawData)return;const{colorMode:o,bitsPerChannel:i,channels:s,large:l}=e.rawData,a=(e.right||0)-(e.left||0),r=(e.bottom||0)-(e.top||0),c=o===4;let f,h=!1;if(a&&r)if(c){if(i!==8)throw new Error("bitsPerChannel Not supproted");f={width:a,height:r,data:new Uint8ClampedArray(a*r*5)}}else f=ao(a,r,i);for(const{id:u,compression:d,data:p}of s){if(!p)continue;const y=In(p.buffer,p.byteOffset,p.byteLength);if(u===-2||u===-3){const g=u===-2?e.mask:e.realMask;if(!g)throw new Error(`Missing layer ${u===-2?"mask":"real mask"} data`);const m=(g.right||0)-(g.left||0),b=(g.bottom||0)-(g.top||0);if(m<0||b<0||m>3e4||b>3e4)throw new Error("Invalid mask size");if(m&&b){const v=ao(m,b,i);Ai(y,p.byteLength,v,d,m,b,i,0,l,4),Cn(v),Pi(v,!1),n?g.imageData=v:g.canvas=io(v)}}else{const g=ar(u,c);let m=f;if(g<0&&(m=void 0,t))throw new Error(`Channel not supported: ${u}`);Ai(y,p.byteLength,m,d,a,r,i,g,l,c?5:4),m&&o===1&&Cn(m)}u===-1&&(h=!0)}if(f){if(h||Pi(f,c),c){const u=f;f=fo(u.width,u.height),kl(u,f,!1)}n?e.imageData=f:e.canvas=io(f)}delete e.rawData}
1function Ai(e,n,t,o,i,s,l,a,r,c){if(n)if(o===0){n!==i*s*Math.floor(l/8)&&e.log(`Invalid length (${n}, ${i*s*Math.floor(l/8)})`);const f=re(e,n);Fl(f,t,l,c,a)}else if(o===1)ft(e,t,i,s,l,c,[a],r);else if(o===2){const f=re(e,n);Ti(f,t,i,s,l,c,a,!1)}else if(o===3){const f=re(e,n);Ti(f,t,i,s,l,c,a,!0)}else throw new Error(`Invalid Compression type: ${o}`)}function Xr(e){return Ie(e,1,n=>{if(!n())return;const t=I(e),o=I(e),i=I(e),s=I(e),l=I(e),a=I(e)/255,r=w(e);return E(e,n()),{overlayColorSpace:t,colorSpace1:o,colorSpace2:i,colorSpace3:s,colorSpace4:l,opacity:a,kind:r}})}const Kr=[0,1,-1,2,-2,3,-3,4,-4];function Sl(e,n){const t=e.offset;let o="";for(const i of Kr){try{e.offset=t+i,o=ne(e)}catch{}if(n(o))break}if(!n(o))throw new Error(`Invalid signature: '${o}' at 0x${t.toString(16)}`);return o}function Yr(e){return e==="8BIM"||e==="8B64"}function vl(e,n,t,o){const i=Sl(e,Yr),s=ne(e),l=i==="8B64"||e.large&&sr.indexOf(s)!==-1;Ie(e,2,a=>{const r=Dn[s];if(r)try{r.read(e,n,a,t,o)}catch(c){if(e.throwForMissingFeatures)throw c}else e.logMissingFeatures&&e.log(`Unhandled additional info: ${s}`),E(e,a());a()&&(e.logMissingFeatures&&e.log(`Unread ${a()} bytes left for additional info: ${s}`),E(e,a()))},!1,l)}function ao(e,n,t,o=4){if(t===1||t===8)return o===4?fo(e,n):{width:e,height:n,data:new Uint8ClampedArray(e*n*o)};if(t===16)return{width:e,height:n,data:new Uint16Array(e*n*o)};if(t===32)return{width:e,height:n,data:new Float32Array(e*n*o)};throw new Error(`Invalid bitDepth (${t})`)}function qr(e,n){var t;const o=I(e),i=(t=n.bitsPerChannel)!==null&&t!==void 0?t:8;if(bl.indexOf(n.colorMode)===-1)throw new Error(`Color mode not supported: ${n.colorMode}`);if(o!==0&&o!==1)throw new Error(`Compression type not supported: ${o}`);const s=ao(n.width,n.height,i);switch(rr(s),n.colorMode){case 0:{if(i!==1)throw new Error("Invalid bitsPerChannel for bitmap color mode");let l;if(o===0)l=re(e,Math.ceil(n.width/8)*n.height);else if(o===1)l=new Uint8Array(n.width*n.height),ft(e,{data:l,width:n.width,height:n.height},n.width,n.height,8,1,[0],e.large);else throw new Error(`Bitmap compression not supported: ${o}`);cr(l,s.data,n.width,n.height);break}case 3:case 1:{const l=n.colorMode===1?[0]:[0,1,2];if(n.channels&&n.channels>3)for(let a=3;a<n.channels;a++)l.push(a);else e.globalAlpha&&l.push(3);if(o===0)for(let a=0;a<l.length;a++){const r=re(e,n.width*n.height*Math.floor(i/8));Fl(r,s,i,4,l[a])}else o===1&&(e.offset,ft(e,s,n.width,n.height,i,4,l,e.large));n.colorMode===1&&Cn(s);break}case 2:{if(i!==8)throw new Error("bitsPerChannel Not supproted");if(n.channels!==1)throw new Error("Invalid channel count");if(!n.palette)throw new Error("Missing color palette");if(o===0)throw new Error("Not implemented");if(o===1){const l={width:s.width,height:s.height,data:new Uint8Array(s.width*s.height)};ft(e,l,n.width,n.height,i,1,[0],e.large),Zr(l,s,n.palette)}else throw new Error("Not implemented");break}case 4:{if(i!==8)throw new Error("bitsPerChannel Not supproted");if(n.channels!==4)throw new Error("Invalid channel count");const l=[0,1,2,3];if(e.globalAlpha&&l.push(4),o===0)throw new Error("Not implemented");if(o===1){const a={width:s.width,height:s.height,data:new Uint8Array(s.width*s.height*5)};e.offset,ft(e,a,n.width,n.height,i,5,l,e.large),kl(a,s,!0)}else throw new Error("Not implemented");break}default:throw new Error(`Color mode not supported: ${n.colorMode}`)}if(e.globalAlpha){if(n.bitsPerChannel!==8)throw new Error("bitsPerChannel Not supproted");const l=s.data,a=s.width*s.height*4;for(let r=0;r<a;r+=4){const c=l[r+3];if(c!=0&&c!=255){const h=1/(c/255),u=255*(1-h);l[r+0]=l[r+0]*h+u,l[r+1]=l[r+1]*h+u,l[r+2]=l[r+2]*h+u}}}e.useImageData?n.imageData=s:n.canvas=io(s)}function kl(e,n,t){const o=n.width*n.height*4,i=e.data,s=n.data;for(let l=0,a=0;a<o;l+=5,a+=4){const r=i[l],c=i[l+1],f=i[l+2],h=i[l+3];s[a]=(r*h|0)/255|0,s[a+1]=(c*h|0)/255|0,s[a+2]=(f*h|0)/255|0,s[a+3]=t?255-i[l+4]:i[l+4]}}function Zr(e,n,t){const o=e.width*e.height,i=e.data,s=n.data;for(let l=0,a=0;l<o;l++,a+=4){const r=t[i[l]];s[a+0]=r.r,s[a+1]=r.g,s[a+2]=r.b,s[a+3]=255}}function Jr(e,n){if(e.byteLength/e.length!==n.byteLength/n.length)throw new Error("Invalid array types")}function xl(e,n){if(n===8)return e;if(n===16){for(let t=0;t<e.byteLength;t+=2){const o=e[t];e[t]=e[t+1],e[t+1]=o}if(e.byteOffset%2){const t=new Uint16Array(e.byteLength/2);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength).set(e),t}else return new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2)}else if(n===32)if(e.byteOffset%4){const t=new Float32Array(e.byteLength/4);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength).set(e),t}else return new Float32Array(e.buffer,e.byteOffset,e.byteLength/4);else throw new Error(`Invalid bitDepth (${n})`)}function ro(e,n,t,o){Jr(e.data,n);const i=e.width*e.height,s=e.data;for(let l=0,a=t|0;l<i;l++,a=a+o|0)s[a]=n[l]}
1function Fl(e,n,t,o,i){if(t==32)for(let l=0;l<e.byteLength;l+=4){const a=e[l+0],r=e[l+1],c=e[l+2],f=e[l+3];e[l+0]=f,e[l+1]=c,e[l+2]=r,e[l+3]=a}const s=xl(e,t);n&&i<o&&ro(n,s,i,o)}function Hn(e,n,t,o){for(let i=0;i<t;i++){const s=i*n;for(let l=1,a=s+1;l<n;l++,a++)e[a]=(e[a-1]+e[a])%o}}function Ti(e,n,t,o,i,s,l,a){const r=Za(e);if(n&&l<s){const c=xl(r,i);if(i===8)a&&Hn(r,t,o,256),ro(n,r,l,s);else if(i===16)a&&Hn(c,t,o,65536),ro(n,c,l,s);else if(i===32){a&&Hn(r,t*4,o,256);let f=l;const h=new Uint32Array(n.data.buffer,n.data.byteOffset,n.data.length);for(let u=0;u<o;u++){let d=t*4*u;for(let p=0;p<t;p++,d++,f+=s){const y=d+t,g=y+t,m=g+t;h[f]=(r[d]<<24|r[y]<<16|r[g]<<8|r[m])>>>0}}}else throw new Error("Invalid bitDepth")}}function ft(e,n,t,o,i,s,l,a){const r=n&&n.data;let c;if(a){c=new Uint32Array(l.length*o);for(let h=0,u=0;h<l.length;h++)for(let d=0;d<o;d++,u++)c[u]=F(e)}else{c=new Uint16Array(l.length*o);for(let h=0,u=0;h<l.length;h++)for(let d=0;d<o;d++,u++)c[u]=I(e)}const f=s-1|0;for(let h=0,u=0;h<l.length;h++){const d=l[h]|0,p=h>f||d>f;if(!r||p)for(let y=0;y<o;y++,u++)E(e,c[u]);else for(let y=0,g=d|0;y<o;y++,u++){const m=c[u],b=re(e,m);for(let v=0,S=0;v<m;v++){let x=b[v];if(x>128){const L=b[++v];x=256-x|0;for(let k=0;k<=x&&S<t;k=k+1|0,S=S+1|0)r[g]=L,g=g+s|0}else if(x<128)for(let L=0;L<=x&&S<t;L=L+1|0,S=S+1|0)r[g]=b[++v],g=g+s|0}}}}function Ie(e,n,t,o=!0,i=!1){let s=F(e);if(i){if(s!==0)throw new Error("Sizes larger than 4GB are not supported");s=F(e)}if(s<=0&&o)return;let l=e.offset+s;if(l>e.view.byteLength)throw new Error("Section exceeds file size");const a=t(()=>l-e.offset);for(e.offset!==l&&(e.offset>l?lo(e,"Exceeded section limits"):lo(e,"Unread section data"));s%n;)s++,l++;return e.offset=l,a}function de(e){switch(I(e)){case 0:{const t=I(e)/257,o=I(e)/257,i=I(e)/257;return E(e,2),{r:t,g:o,b:i}}case 1:{const t=I(e)/65535,o=I(e)/65535,i=I(e)/65535;return E(e,2),{h:t,s:o,b:i}}case 2:{const t=I(e)/257,o=I(e)/257,i=I(e)/257,s=I(e)/257;return{c:t,m:o,y:i,k:s}}case 7:{const t=$(e)/1e4,o=$(e),i=$(e),s=o<0?o/12800:o/12700,l=i<0?i/12800:i/12700;return E(e,2),{l:t,a:s,b:l}}case 8:{const t=I(e)*255/1e4;return E(e,6),{k:t}}default:throw new Error("Invalid color space")}}function Qr(e){let n=F(e);for(;n%4;)n++;const t=e.offset+n,o=F(e);if(o!==1)throw new Error(`Invalid pattern version: ${o}`);const i=F(e),s=$(e),l=$(e);if(i!==3&&i!==1&&i!==2)throw new Error(`Unsupported pattern color mode: ${i}`);let a=ue(e);const r=Qe(e,1),c=[];if(i===2){for(let v=0;v<256;v++)c.push({r:w(e),g:w(e),b:w(e)});E(e,4)}const f=F(e);if(f!==3)throw new Error(`Invalid pattern VMAL version: ${f}`);F(e);const h=F(e),u=F(e),d=F(e),p=F(e),y=F(e),g=p-u,m=d-h,b=new Uint8Array(g*m*4);for(let v=3;v<b.byteLength;v+=4)b[v]=255;for(let v=0,S=0;v<y+2;v++){if(!F(e))continue;const L=F(e),k=F(e),A=F(e),R=F(e),B=F(e),U=F(e),le=I(e),ce=w(e),fe=L-23,V=re(e,fe);if(k!==8||le!==8)throw new Error("16bit pixel depth not supported for patterns");const q=U-R,me=B-A,$e=R-u,He=A-h;if(ce===0){if(i===3&&S<3)for(let _=0;_<me;_++)for(let z=0;z<q;z++){const J=z+_*q,ae=($e+z+(_+He)*g)*4;b[ae+S]=V[J]}if(i===1&&S<1)for(let _=0;_<me;_++)for(let z=0;z<q;z++){const J=z+_*q,ae=($e+z+(_+He)*g)*4,ie=V[J];b[ae+0]=ie,b[ae+1]=ie,b[ae+2]=ie}if(i===2)throw new Error("Indexed pattern color mode not implemented")}else if(ce===1){const _={data:b,width:g,height:m},z={data:new Uint8Array(q*me),width:q,height:me},J=In(V.buffer,V.byteOffset,V.byteLength);if(i===3&&S<3&&(ft(J,z,q,me,8,1,[0],!1),Mi(z,_,$e,He,S)),i===1&&S<1&&(ft(J,z,q,me,8,1,[0],!1),Mi(z,_,$e,He,0),Cn(_)),i===2)throw new Error("Indexed pattern color mode not implemented")}else throw new Error("Invalid pattern compression mode");S++}return e.offset=t,{id:r,name:a,x:s,y:l,bounds:{x:u,y:h,w:g,h:m},data:b}}function Mi(e,n,t,o,i){const s=e.width,l=e.height,a=n.width;for(let r=0;r<l;r++)for(let c=0;c<s;c++){const f=c+r*s,h=(t+c+(r+o)*a)*4,u=e.data[f];n.data[h+i]=u}}const Ol=[void 0,"outer bevel","inner bevel","emboss","pillow emboss","stroke emboss"];function St(e){return ot(e,"8BIM"),It[ne(e)]||"normal"}function kt(e,n){N(e,"8BIM"),N(e,bs[n]||"norm")}function vt(e){return w(e)/255}function xt(e,n){P(e,Math.round(n*255)|0)}function ec(e){const n=I(e);if(n!==0)throw new Error(`Invalid effects layer version: ${n}`);const t=I(e),o={};for(let i=0;i<t;i++){ot(e,"8BIM");const s=ne(e);switch(s){case"cmnS":{const l=F(e),a=F(e),r=!!w(e);if(E(e,2),l!==7||a!==0||!r)throw new Error("Invalid effects common state");break}case"dsdw":case"isdw":{const l=F(e),a=F(e);if(l!==41&&l!==51)throw new Error(`Invalid shadow size: ${l}`);if(a!==0&&a!==2)throw new Error(`Invalid shadow version: ${a}`);const r=Fe(e);Fe(e);const c=Fe(e),f=Fe(e),h=de(e),u=St(e),d=!!w(e),p=!!w(e),y=vt(e);l>=51&&de(e);const g={size:{units:"Pixels",value:r},distance:{units:"Pixels",value:f},angle:c,color:h,blendMode:u,enabled:d,useGlobalLight:p,opacity:y};s==="dsdw"?o.dropShadow=[g]:o.innerShadow=[g];break}case"oglw":{const l=F(e),a=F(e);if(l!==32&&l!==42)throw new Error(`Invalid outer glow size: ${l}`);if(a!==0&&a!==2)throw new Error(`Invalid outer glow version: ${a}`);const r=Fe(e);Fe(e);const c=de(e),f=St(e),h=!!w(e),u=vt(e);l>=42&&de(e),o.outerGlow={size:{units:"Pixels",value:r},color:c,blendMode:f,enabled:h,opacity:u};break}case"iglw":{const l=F(e),a=F(e);if(l!==32&&l!==43)throw new Error(`Invalid inner glow size: ${l}`);if(a!==0&&a!==2)throw new Error(`Invalid inner glow version: ${a}`);const r=Fe(e);Fe(e);const c=de(e),f=St(e),h=!!w(e),u=vt(e);l>=43&&(w(e),de(e)),o.innerGlow={size:{units:"Pixels",value:r},color:c,blendMode:f,enabled:h,opacity:u};break}case"bevl":{const l=F(e),a=F(e);if(l!==58&&l!==78)throw new Error(`Invalid bevel size: ${l}`);if(a!==0&&a!==2)throw new Error(`Invalid bevel version: ${a}`);const r=Fe(e),c=Fe(e),f=Fe(e),h=St(e),u=St(e),d=de(e),p=de(e),y=Ol[w(e)]||"inner bevel",g=vt(e),m=vt(e),b=!!w(e),v=!!w(e),S=w(e)?"down":"up";l>=78&&(de(e),de(e)),o.bevel={size:{units:"Pixels",value:f},angle:r,strength:c,highlightBlendMode:h,shadowBlendMode:u,highlightColor:d,shadowColor:p,style:y,highlightOpacity:g,shadowOpacity:m,enabled:b,useGlobalLight:v,direction:S};break}case"sofi":{const l=F(e),a=F(e);if(l!==34)throw new Error(`Invalid effects solid fill info size: ${l}`);
1if(a!==2)throw new Error(`Invalid effects solid fill info version: ${a}`);const r=St(e),c=de(e),f=vt(e),h=!!w(e);de(e),o.solidFill=[{blendMode:r,color:c,opacity:f,enabled:h}];break}default:throw new Error(`Invalid effect type: '${s}'`)}}return o}function Ri(e,n){var t;O(e,51),O(e,2),Ce(e,n.size&&n.size.value||0),Ce(e,0),Ce(e,n.angle||0),Ce(e,n.distance&&n.distance.value||0),pe(e,n.color),kt(e,n.blendMode),P(e,n.enabled?1:0),P(e,n.useGlobalLight?1:0),xt(e,(t=n.opacity)!==null&&t!==void 0?t:1),pe(e,n.color)}function tc(e,n){var t,o,i,s,l,a;const r=(t=n.dropShadow)===null||t===void 0?void 0:t[0],c=(o=n.innerShadow)===null||o===void 0?void 0:o[0],f=n.outerGlow,h=n.innerGlow,u=n.bevel,d=(i=n.solidFill)===null||i===void 0?void 0:i[0];let p=1;if(r&&p++,c&&p++,f&&p++,h&&p++,u&&p++,d&&p++,C(e,0),C(e,p),N(e,"8BIM"),N(e,"cmnS"),O(e,7),O(e,0),P(e,1),Z(e,2),r&&(N(e,"8BIM"),N(e,"dsdw"),Ri(e,r)),c&&(N(e,"8BIM"),N(e,"isdw"),Ri(e,c)),f&&(N(e,"8BIM"),N(e,"oglw"),O(e,42),O(e,2),Ce(e,((s=f.size)===null||s===void 0?void 0:s.value)||0),Ce(e,0),pe(e,f.color),kt(e,f.blendMode),P(e,f.enabled?1:0),xt(e,f.opacity||0),pe(e,f.color)),h&&(N(e,"8BIM"),N(e,"iglw"),O(e,43),O(e,2),Ce(e,((l=h.size)===null||l===void 0?void 0:l.value)||0),Ce(e,0),pe(e,h.color),kt(e,h.blendMode),P(e,h.enabled?1:0),xt(e,h.opacity||0),P(e,0),pe(e,h.color)),u){N(e,"8BIM"),N(e,"bevl"),O(e,78),O(e,2),Ce(e,u.angle||0),Ce(e,u.strength||0),Ce(e,((a=u.size)===null||a===void 0?void 0:a.value)||0),kt(e,u.highlightBlendMode),kt(e,u.shadowBlendMode),pe(e,u.highlightColor),pe(e,u.shadowColor);const y=Ol.indexOf(u.style);P(e,y<=0?1:y),xt(e,u.highlightOpacity||0),xt(e,u.shadowOpacity||0),P(e,u.enabled?1:0),P(e,u.useGlobalLight?1:0),P(e,u.direction==="down"?1:0),pe(e,u.highlightColor),pe(e,u.shadowColor)}d&&(N(e,"8BIM"),N(e,"sofi"),O(e,34),O(e,2),kt(e,d.blendMode),pe(e,d.color),xt(e,d.opacity||0),P(e,d.enabled?1:0),pe(e,d.color))}function _i(e){return e===32||e===10||e===13||e===9}function ji(e){return e>=48&&e<=57||e===46||e===45}function Cl(e){let n=0;function t(){for(;n<e.length&&_i(e[n]);)n++}function o(){let u=e[n];return n++,u===92&&(u=e[n],n++),u}function i(){let u="";if(e[n]===41)return n++,u;if(e[n]!==254||e[n+1]!==255)throw new Error("Invalid utf-16 BOM");for(n+=2;n<e.length&&e[n]!==41;){const d=o(),p=o(),y=d<<8|p;u+=String.fromCharCode(y)}return n++,u}let s=null;const l=[];function a(u){l.length?(r(u),l.push(u)):(l.push(u),s=u)}function r(u){if(!l.length)throw new Error("Invalid data");const d=l[l.length-1];if(typeof d=="string")l[l.length-2][d]=u,f();else if(Array.isArray(d))d.push(u);else throw new Error("Invalid data")}function c(u){l.length||a({});const d=l[l.length-1];if(d&&typeof d=="string")r(u==="nil"?null:`/${u}`);else if(d&&typeof d=="object")l.push(u);else throw new Error("Invalid data")}function f(){if(!l.length)throw new Error("Invalid data");l.pop()}t();let h=e.length;for(;h>0&&e[h-1]===0;)h--;for(;n<h;){const u=n,d=e[u];if(d===60&&e[u+1]===60)n+=2,a({});else if(d===62&&e[u+1]===62)n+=2,f();else if(d===47){n+=1;const p=n;for(;n<e.length&&!_i(e[n]);)n++;let y="";for(let g=p;g<n;g++)y+=String.fromCharCode(e[g]);c(y)}else if(d===40)n+=1,r(i());else if(d===91)n+=1,a([]);else if(d===93)n+=1,f();else if(d===110&&e[u+1]===117&&e[u+2]===108&&e[u+3]===108)n+=4,r(null);else if(d===116&&e[u+1]===114&&e[u+2]===117&&e[u+3]===101)n+=4,r(!0);else if(d===102&&e[u+1]===97&&e[u+2]===108&&e[u+3]===115&&e[u+4]===101)n+=5,r(!1);else if(ji(d)){let p="";for(;n<e.length&&ji(e[n]);)p+=String.fromCharCode(e[n]),n++;r(parseFloat(p))}else n+=1,console.log(`Invalid token '${String.fromCharCode(d)}' (${d}) at ${n}`);t()}return s}const nc=["Axis","XY","Zone","WordSpacing","FirstLineIndent","GlyphSpacing","StartIndent","EndIndent","SpaceBefore","SpaceAfter","LetterSpacing","Values","GridSize","GridLeading","PointBase","BoxBounds","TransformPoint0","TransformPoint1","TransformPoint2","FontSize","Leading","HorizontalScale","VerticalScale","BaselineShift","Tsume","OutlineWidth","AutoLeading"],oc=["RunLengthArray"];function ic(e,n=!1){let t=new Uint8Array(1024),o=0,i=0;function s(y){if(o>=t.length){const g=new Uint8Array(t.length*2);g.set(t),t=g}t[o]=y,o++}function l(y){for(let g=0;g<y.length;g++)s(y.charCodeAt(g))}function a(){if(n)l(" ");else for(let y=0;y<i;y++)l("	")}function r(y,g){a(),l(`/${y}`),p(g,y,!0),n||l(`
2`)}function c(y){return y.toString()}function f(y){return y.toFixed(5).replace(/(\d)0+$/g,"$1").replace(/^0+\.([1-9])/g,".$1").replace(/^-0+\.0(\d)/g,"-.0$1")}function h(y,g){return g&&nc.indexOf(g)!==-1||(y|0)!==y?f(y):c(y)}function u(y){const g=Object.keys(y);return g.indexOf("98")!==-1&&g.unshift(...g.splice(g.indexOf("99"),1)),g.indexOf("99")!==-1&&g.unshift(...g.splice(g.indexOf("99"),1)),g}
2function d(y){(y===40||y===41||y===92)&&s(92),s(y)}function p(y,g,m=!1){function b(){m?l(" "):a()}if(y===null)b(),l(n?"/nil":"null");else if(typeof y=="number")b(),l(h(y,g));else if(typeof y=="boolean")b(),l(y?"true":"false");else if(typeof y=="string")if(b(),(g==="99"||g==="98")&&y.charAt(0)==="/")l(y);else{l("("),s(254),s(255);for(let v=0;v<y.length;v++){const S=y.charCodeAt(v);d(S>>8&255),d(S&255)}l(")")}else if(Array.isArray(y))if(b(),y.every(v=>typeof v=="number")){l("[");const v=oc.indexOf(g)!==-1;for(const S of y)l(" "),l(v?h(S):f(S));l(" ]")}else{l("["),n||l(`
3`);for(const v of y)p(v,g),n||l(`
4`);a(),l("]")}else if(typeof y=="object"){m&&!n&&l(`
5`),a(),l("<<"),n||l(`
6`),i++;for(const v of u(y))r(v,y[v]);i--,a(),l(">>")}}if(n){if(typeof e=="object")for(const y of u(e))r(y,e[y])}else l(`
7
8`),p(e);return t.slice(0,o)}const Il={name:"MyriadPro-Regular",script:0,type:0,synthetic:0},pn={justification:"left",firstLineIndent:0,startIndent:0,endIndent:0,spaceBefore:0,spaceAfter:0,autoHyphenate:!0,hyphenatedWordSize:6,preHyphen:2,postHyphen:2,consecutiveHyphens:8,zone:36,wordSpacing:[.8,1,1.33],letterSpacing:[0,0,0],glyphSpacing:[1,1,1],autoLeading:1.2,leadingType:0,hanging:!1,burasagari:!1,kinsokuOrder:0,everyLineComposer:!1},sc={font:Il,fontSize:12,fauxBold:!1,fauxItalic:!1,autoLeading:!0,leading:0,horizontalScale:1,verticalScale:1,tracking:0,autoKerning:!0,kerning:0,baselineShift:0,fontCaps:0,fontBaseline:0,underline:!1,strikethrough:!1,ligatures:!0,dLigatures:!1,baselineDirection:2,tsume:0,styleRunAlignment:2,language:0,noBreak:!1,fillColor:{r:0,g:0,b:0},strokeColor:{r:0,g:0,b:0},fillFlag:!0,strokeFlag:!1,fillFirst:!0,yUnderline:1,outlineWidth:1,characterDirection:0,hindiNumbers:!1,kashida:1,diacriticPos:2},lc={isOn:!1,show:!1,size:18,leading:22,color:{r:0,g:0,b:255},leadingFillColor:{r:0,g:0,b:255},alignLineHeightToGridFlags:!1},bo=["justification","firstLineIndent","startIndent","endIndent","spaceBefore","spaceAfter","autoHyphenate","hyphenatedWordSize","preHyphen","postHyphen","consecutiveHyphens","zone","wordSpacing","letterSpacing","glyphSpacing","autoLeading","leadingType","hanging","burasagari","kinsokuOrder","everyLineComposer"],yo=["font","fontSize","fauxBold","fauxItalic","autoLeading","leading","horizontalScale","verticalScale","tracking","autoKerning","kerning","baselineShift","fontCaps","fontBaseline","underline","strikethrough","ligatures","dLigatures","baselineDirection","tsume","styleRunAlignment","language","noBreak","fillColor","strokeColor","fillFlag","strokeFlag","fillFirst","yUnderline","outlineWidth","characterDirection","hindiNumbers","kashida","diacriticPos"],Dl=["none","crisp","strong","smooth","sharp"],wl=["left","right","center","justify-left","justify-right","justify-center","justify-all"];function Ll(e){return e.substring(0,1).toUpperCase()+e.substring(1)}function ac(e){const n=e.Values;switch(e.Type){case 0:return{k:n[1]*255};case 1:return n[0]===1?{r:n[1]*255,g:n[2]*255,b:n[3]*255}:{r:n[1]*255,g:n[2]*255,b:n[3]*255,a:n[0]*255};case 2:return{c:n[1]*255,m:n[2]*255,y:n[3]*255,k:n[4]*255};default:throw new Error("Unknown color type in text layer")}}function co(e){if(e){if("r"in e)return{Type:1,Values:["a"in e?e.a/255:1,e.r/255,e.g/255,e.b/255]};if("c"in e)return{Type:2,Values:[1,e.c/255,e.m/255,e.y/255,e.k/255]};if("k"in e)return{Type:0,Values:[1,e.k/255]};throw new Error("Invalid color type in text layer")}else return{Type:1,Values:[0,0,0,0]}}function Bi(e,n){if(!e||!n||e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0}function zi(e,n){if(!e||!n)return!1;for(const t of Object.keys(e))if(e[t]!==n[t])return!1;for(const t of Object.keys(n))if(e[t]!==n[t])return!1;return!0}function rc(e,n){for(let t=0;t<e.length;t++)if(e[t].name===n.name)return t;return e.push(n),e.length-1}function El(e,n,t){const o={};for(const i of n){const s=Ll(i);e[s]!==void 0&&(i==="justification"?o[i]=wl[e[s]]:i==="font"?o[i]=t[e[s]]:i==="fillColor"||i==="strokeColor"?o[i]=ac(e[s]):o[i]=e[s])}return o}function Pl(e,n,t){var o;const i={};for(const s of n){const l=Ll(s);e[s]!==void 0&&(s==="justification"?i[l]=wl.indexOf((o=e[s])!==null&&o!==void 0?o:"left"):s==="font"?i[l]=rc(t,e[s]):s==="fillColor"||s==="strokeColor"?i[l]=co(e[s]):i[l]=e[s])}return i}function cc(e,n){return El(e,bo,n)}
8function fc(e,n){return El(e,yo,n)}function mn(e,n){return Pl(e,bo,n)}function Wn(e,n){return Pl(e,yo,n)}function Ni(e,n,t){if(n.length){for(const o of t){const i=n[0].style[o];if(i!==void 0){let l=!1;Array.isArray(i)?l=n.every(a=>Bi(a.style[o],i)):typeof i=="object"?l=n.every(a=>zi(a.style[o],i)):l=n.every(a=>a.style[o]===i),l&&(e[o]=i)}if(e[o]!==void 0)for(const l of n){let a=!1;Array.isArray(i)?a=Bi(l.style[o],i):typeof i=="object"?a=zi(l.style[o],i):a=l.style[o]===i,a&&delete l.style[o]}}n.every(o=>Object.keys(o.style).length===0)&&(n.length=0)}}function uc(e){var n,t,o,i,s,l;const a=e.EngineDict,r=e.ResourceDict,c=r.FontSet.map(g=>({name:g.Name,script:g.Script,type:g.FontType,synthetic:g.Synthetic}));let f=a.Editor.Text.replace(/\r/g,`
9`),h=0;for(;/\n$/.test(f);)f=f.substring(0,f.length-1),h++;const u={text:f,antiAlias:(n=Dl[a.AntiAlias])!==null&&n!==void 0?n:"smooth",useFractionalGlyphWidths:!!a.UseFractionalGlyphWidths,superscriptSize:r.SuperscriptSize,superscriptPosition:r.SuperscriptPosition,subscriptSize:r.SubscriptSize,subscriptPosition:r.SubscriptPosition,smallCapSize:r.SmallCapSize},d=(l=(s=(i=(o=(t=a.Rendered)===null||t===void 0?void 0:t.Shapes)===null||o===void 0?void 0:o.Children)===null||i===void 0?void 0:i[0])===null||s===void 0?void 0:s.Cookie)===null||l===void 0?void 0:l.Photoshop;d&&(u.shapeType=d.ShapeType===1?"box":"point",d.PointBase&&(u.pointBase=d.PointBase),d.BoxBounds&&(u.boxBounds=d.BoxBounds));const p=a.ParagraphRun;u.paragraphStyle={},u.paragraphStyleRuns=[];for(let g=0;g<p.RunArray.length;g++){const m=p.RunArray[g],b=p.RunLengthArray[g],v=cc(m.ParagraphSheet.Properties,c);u.paragraphStyleRuns.push({length:b,style:v})}for(let g=h;u.paragraphStyleRuns.length&&g>0;g--)--u.paragraphStyleRuns[u.paragraphStyleRuns.length-1].length===0&&u.paragraphStyleRuns.pop();Ni(u.paragraphStyle,u.paragraphStyleRuns,bo),u.paragraphStyleRuns.length||delete u.paragraphStyleRuns;const y=a.StyleRun;u.style={},u.styleRuns=[];for(let g=0;g<y.RunArray.length;g++){const m=y.RunLengthArray[g],b=fc(y.RunArray[g].StyleSheet.StyleSheetData,c);b.font||(b.font=c[0]),u.styleRuns.push({length:m,style:b})}for(let g=h;u.styleRuns.length&&g>0;g--)--u.styleRuns[u.styleRuns.length-1].length===0&&u.styleRuns.pop();return Ni(u.style,u.styleRuns,yo),u.styleRuns.length||delete u.styleRuns,u}function dc(e){var n,t,o,i,s,l,a,r,c,f,h,u;const d=`${(e.text||"").replace(/\r?\n/g,"\r")}\r`,p=[{name:"AdobeInvisFont",script:0,type:0,synthetic:0}],y=((n=e.style)===null||n===void 0?void 0:n.font)||((o=(t=e.styleRuns)===null||t===void 0?void 0:t.find(V=>V.style.font))===null||o===void 0?void 0:o.style.font)||Il,g=[],m=[],b=e.paragraphStyleRuns;if(b&&b.length){let V=d.length;for(const q of b){let me=Math.min(q.length,V);V-=me,me&&(V===1&&q===b[b.length-1]&&(me++,V--),m.push(me),g.push({ParagraphSheet:{DefaultStyleSheet:0,Properties:mn(Object.assign(Object.assign(Object.assign({},pn),e.paragraphStyle),q.style),p)},Adjustments:{Axis:[1,0,1],XY:[0,0]}}))}V&&(m.push(V),g.push({ParagraphSheet:{DefaultStyleSheet:0,Properties:mn(Object.assign(Object.assign({},pn),e.paragraphStyle),p)},Adjustments:{Axis:[1,0,1],XY:[0,0]}}))}else for(let V=0,q=0;V<d.length;V++)d.charCodeAt(V)===13&&(m.push(V-q+1),g.push({ParagraphSheet:{DefaultStyleSheet:0,Properties:mn(Object.assign(Object.assign({},pn),e.paragraphStyle),p)},Adjustments:{Axis:[1,0,1],XY:[0,0]}}),q=V+1);const v=Wn(Object.assign(Object.assign({},sc),{font:y}),p),S=e.styleRuns||[{length:d.length,style:e.style||{}}],x=[],L=[];let k=d.length;for(const V of S){let q=Math.min(V.length,k);k-=q,q&&(k===1&&V===S[S.length-1]&&(q++,k--),L.push(q),x.push({StyleSheet:{StyleSheetData:Wn(Object.assign(Object.assign({kerning:0,autoKerning:!0,fillColor:{r:0,g:0,b:0}},e.style),V.style),p)}}))}k&&S.length&&(L.push(k),x.push({StyleSheet:{StyleSheetData:Wn(Object.assign({kerning:0,autoKerning:!0,fillColor:{r:0,g:0,b:0}},e.style),p)}}));const A=Object.assign(Object.assign({},lc),e.gridInfo),R=e.orientation==="vertical"?2:0,B=e.orientation==="vertical"?1:0,U=e.shapeType==="box"?1:0,le={ShapeType:U};U===0?le.PointBase=e.pointBase||[0,0]:le.BoxBounds=e.boxBounds||[0,0,0,0],le.Base={ShapeType:U,TransformPoint0:[1,0],TransformPoint1:[0,1],TransformPoint2:[0,0]};const ce={KinsokuSet:[{Name:"PhotoshopKinsokuHard",NoStart:"、。,.・:;?!ー―’”)〕]}〉》」』】ヽヾゝゞ々ぁぃぅぇぉっゃゅょゎァィゥェォッャュョヮヵヶ゛゜?!)]},.:;℃℉¢%‰",NoEnd:"‘“(〔[{〈《「『【([{¥$£@§〒#",Keep:"―‥",Hanging:"、。.,"},{Name:"PhotoshopKinsokuSoft",NoStart:"、。,.・:;?!’”)〕]}〉》」』】ヽヾゝゞ々",NoEnd:"‘“(〔[{〈《「『【",Keep:"―‥",Hanging:"、。.,"}],MojiKumiSet:[{InternalName:"Photoshop6MojiKumiSet1"},{InternalName:"Photoshop6MojiKumiSet2"},{InternalName:"Photoshop6MojiKumiSet3"},{InternalName:"Photoshop6MojiKumiSet4"}],TheNormalStyleSheet:0,TheNormalParagraphSheet:0,ParagraphSheetSet:[{Name:"Normal RGB",DefaultStyleSheet:0,Properties:mn(Object.assign(Object.assign({},pn),e.paragraphStyle),p)}],StyleSheetSet:[{Name:"Normal RGB",StyleSheetData:v}],FontSet:p.map(V=>({Name:V.name,Script:V.script||0,FontType:V.type||0,Synthetic:V.synthetic||0})),SuperscriptSize:(i=e.superscriptSize)!==null&&i!==void 0?i:.583,SuperscriptPosition:(s=e.superscriptPosition)!==null&&s!==void 0?s:.333,SubscriptSize:(l=e.subscriptSize)!==null&&l!==void 0?l:.583,SubscriptPosition:(a=e.subscriptPosition)!==null&&a!==void 0?a:.333,SmallCapSize:(r=e.smallCapSize)!==null&&r!==void 0?r:.7};return{EngineDict:{Editor:{Text:d},ParagraphRun:{DefaultRunData:{ParagraphSheet:{DefaultStyleSheet:0,Properties:{}},Adjustments:{Axis:[1,0,1],XY:[0,0]}},RunArray:g,RunLengthArray:m,IsJoinable:1},StyleRun:{DefaultRunData:{StyleSheet:{StyleSheetData:{}}}
9,RunArray:x,RunLengthArray:L,IsJoinable:2},GridInfo:{GridIsOn:!!A.isOn,ShowGrid:!!A.show,GridSize:(c=A.size)!==null&&c!==void 0?c:18,GridLeading:(f=A.leading)!==null&&f!==void 0?f:22,GridColor:co(A.color),GridLeadingFillColor:co(A.color),AlignLineHeightToGridFlags:!!A.alignLineHeightToGridFlags},AntiAlias:Dl.indexOf((h=e.antiAlias)!==null&&h!==void 0?h:"sharp"),UseFractionalGlyphWidths:(u=e.useFractionalGlyphWidths)!==null&&u!==void 0?u:!0,Rendered:{Version:1,Shapes:{WritingDirection:R,Children:[{ShapeType:U,Procession:B,Lines:{WritingDirection:R,Children:[]},Cookie:{Photoshop:le}}]}}},ResourceDict:Object.assign({},ce),DocumentResources:Object.assign({},ce)}}const Xn={0:{uproot:!0,children:{0:{name:"Type"},1:{name:"Values"}}}},So={0:{name:"Font"},1:{name:"FontSize"},2:{name:"FauxBold"},3:{name:"FauxItalic"},4:{name:"AutoLeading"},5:{name:"Leading"},6:{name:"HorizontalScale"},7:{name:"VerticalScale"},8:{name:"Tracking"},9:{name:"BaselineShift"},11:{name:"Kerning?"},12:{name:"FontCaps"},13:{name:"FontBaseline"},15:{name:"Strikethrough?"},16:{name:"Underline?"},18:{name:"Ligatures"},19:{name:"DLigatures"},23:{name:"Fractions"},24:{name:"Ordinals"},28:{name:"StylisticAlternates"},30:{name:"OldStyle?"},35:{name:"BaselineDirection"},38:{name:"Language"},52:{name:"NoBreak"},53:{name:"FillColor",children:Xn},54:{name:"StrokeColor",children:Xn},55:{children:{99:{uproot:!0}}},79:{children:Xn}},Kn={0:{name:"Justification"},1:{name:"FirstLineIndent"},2:{name:"StartIndent"},3:{name:"EndIndent"},4:{name:"SpaceBefore"},5:{name:"SpaceAfter"},7:{name:"AutoLeading"},9:{name:"AutoHyphenate"},10:{name:"HyphenatedWordSize"},11:{name:"PreHyphen"},12:{name:"PostHyphen"},13:{name:"ConsecutiveHyphens?"},14:{name:"Zone"},15:{name:"HypenateCapitalizedWords"},17:{name:"WordSpacing"},18:{name:"LetterSpacing"},19:{name:"GlyphSpacing"},32:{name:"StyleSheet",children:So}},Ui={name:"StyleSheetData",children:So},hc={0:{name:"ResourceDict",children:{1:{name:"FontSet",children:{0:{uproot:!0,children:{0:{uproot:!0,children:{0:{uproot:!0,children:{0:{name:"Name"},2:{name:"FontType"}}}}}}}}},2:{name:"2",children:{}},3:{name:"MojiKumiSet",children:{0:{uproot:!0,children:{0:{uproot:!0,children:{0:{name:"InternalName"}}}}}}},4:{name:"KinsokuSet",children:{0:{uproot:!0,children:{0:{uproot:!0,children:{0:{name:"Name"},5:{uproot:!0,children:{0:{name:"NoStart"},1:{name:"NoEnd"},2:{name:"Keep"},3:{name:"Hanging"},4:{name:"Name"}}}}}}}}},5:{name:"StyleSheetSet",children:{0:{uproot:!0,children:{0:{uproot:!0,children:{0:{name:"Name"},6:Ui}}}}}},6:{name:"ParagraphSheetSet",children:{0:{uproot:!0,children:{0:{uproot:!0,children:{0:{name:"Name"},5:{name:"Properties",children:Kn},6:{name:"DefaultStyleSheet"}}}}}}},8:{name:"TextFrameSet",children:{0:{uproot:!0,children:{0:{name:"path",children:{0:{name:"name"},1:{name:"bezierCurve",children:{0:{name:"controlPoints"}}},2:{name:"data",children:{0:{name:"type"},1:{name:"orientation"},2:{name:"frameMatrix"},4:{name:"4"},6:{name:"textRange"},7:{name:"rowGutter"},8:{name:"columnGutter"},9:{name:"9"},10:{name:"baselineAlignment",children:{0:{name:"flag"},1:{name:"min"}}},11:{name:"pathData",children:{1:{name:"1"},0:{name:"reversed"},2:{name:"2"},3:{name:"3"},4:{name:"spacing"},5:{name:"5"},6:{name:"6"},7:{name:"7"},18:{name:"18"}}},12:{name:"12"},13:{name:"13"}}},3:{name:"3"},97:{name:"uuid"}}}}}}},9:{name:"Predefined",children:{0:{children:{0:{uproot:!0}}},1:{children:{0:{uproot:!0}}}}}}},1:{name:"EngineDict",children:{0:{name:"0",children:{3:{name:"SuperscriptSize"},4:{name:"SuperscriptPosition"},5:{name:"SubscriptSize"},6:{name:"SubscriptPosition"},7:{name:"SmallCapSize"},8:{name:"UseFractionalGlyphWidths"},15:{children:{0:{uproot:!0}}}}},1:{name:"Editors?",children:{0:{name:"Editor",children:{0:{name:"Text"},5:{name:"ParagraphRun",children:{0:{name:"RunArray",children:{0:{name:"ParagraphSheet",children:{0:{uproot:!0,children:{0:{name:"0"},5:{name:"5",children:Kn},6:{name:"6"}}}}},1:{name:"RunLength"}}}}},6:{name:"StyleRun",children:{0:{name:"RunArray",children:{0:{name:"StyleSheet",children:{0:{uproot:!0,children:{6:Ui}}}},1:{name:"RunLength"}}}}}}},1:{name:"FontVectorData ???"}}},2:{name:"StyleSheet",children:So},3:{name:"ParagraphSheet",children:Kn}}}};function Rt(e,n){var t,o;if(e===null)return e;if(Array.isArray(e))return e.map(s=>Rt(s,n));if(typeof e!="object")return e;let i={};for(const s of Object.keys(e))if(n[s])if(n[s].uproot){s!=="99"&&(i=Rt(e[s],(t=n[s].children)!==null&&t!==void 0?t:{})),e[99]&&(i._type=e[99]);break}else i[n[s].name||s]=Rt(e[s],(o=n[s].children)!==null&&o!==void 0?o:{});else s==="99"?i._type=e[s]:i[s]=Rt(e[s],{});return i}function pc(e){return Rt(e,hc)}const Oe="abcdefghijklmnopqrstuvwxyz",Dn={};function M(e,n,t,o){const i={key:e,has:n,read:t,write:o};Dn[i.key]=i}function it(e,n){Dn[e]=Dn[n]}function ee(e){return n=>n[e]!==void 0}function Yn(e){if(F(e))throw new Error(`Resource size above 4 GB limit at ${e.offset.toString(16)}`);return F(e)}function qn(e,n){O(e,0),O(e,n)}M("TySh",ee("text"),(e,n,t)=>{if($(e)!==1)throw new Error("Invalid TySh version");const o=[];for(let l=0;l<6;l++)o.push(Ee(e));if($(e)!==50)throw new Error("Invalid TySh text version");const i=H(e);if($(e)!==1)throw new Error("Invalid TySh warp version");const s=H(e);
9if(n.text={transform:o,left:Me(e),top:Me(e),right:Me(e),bottom:Me(e),text:i["Txt "].replace(/\r/g,`
10`),index:i.TextIndex||0,gridding:ui.decode(i.textGridding),antiAlias:di.decode(i.AntA),orientation:Ut.decode(i.Ornt),warp:{style:uo.decode(s.warpStyle),value:s.warpValue||0,perspective:s.warpPerspective||0,perspectiveOther:s.warpPerspectiveOther||0,rotate:Ut.decode(s.warpRotate)}},i.bounds&&(n.text.bounds=si(i.bounds)),i.boundingBox&&(n.text.boundingBox=si(i.boundingBox)),i.EngineData){const l=Cl(i.EngineData),a=uc(l);n.text=Object.assign(Object.assign({},n.text),a)}E(e,t())},(e,n)=>{const t=n.text,o=t.warp||{},i=t.transform||[1,0,0,1,0,0],s=Object.assign(Object.assign(Object.assign({"Txt ":(t.text||"").replace(/\r?\n/g,"\r"),textGridding:ui.encode(t.gridding),Ornt:Ut.encode(t.orientation),AntA:di.encode(t.antiAlias)},t.bounds?{bounds:li(t.bounds)}:{}),t.boundingBox?{boundingBox:li(t.boundingBox)}:{}),{TextIndex:t.index||0,EngineData:ic(dc(t))});K(e,1);for(let l=0;l<6;l++)Ge(e,i[l]);K(e,50),W(e,"","TxLr",s,"text"),K(e,1),W(e,"","warp",wn(o)),Re(e,t.left),Re(e,t.top),Re(e,t.right),Re(e,t.bottom)});M("SoCo",e=>e.vectorFill!==void 0&&e.vectorStroke===void 0&&e.vectorFill.type==="color",(e,n)=>{const t=H(e);n.vectorFill=Xt(t)},(e,n)=>{const{descriptor:t}=Kt(n.vectorFill);W(e,"","null",t)});M("GdFl",e=>e.vectorFill!==void 0&&e.vectorStroke===void 0&&(e.vectorFill.type==="solid"||e.vectorFill.type==="noise"),(e,n,t)=>{const o=H(e);n.vectorFill=Xt(o),E(e,t())},(e,n)=>{const{descriptor:t}=Kt(n.vectorFill);W(e,"","null",t)});M("PtFl",e=>e.vectorFill!==void 0&&e.vectorStroke===void 0&&e.vectorFill.type==="pattern",(e,n)=>{const t=H(e);n.vectorFill=Xt(t)},(e,n)=>{const{descriptor:t}=Kt(n.vectorFill);W(e,"","null",t)});M("vscg",e=>e.vectorFill!==void 0&&e.vectorStroke!==void 0,(e,n,t)=>{ne(e);const o=H(e);n.vectorFill=Xt(o),E(e,t())},(e,n)=>{const{descriptor:t,key:o}=Kt(n.vectorFill);N(e,o),W(e,"","null",t)});function mc(e,n,t){const o=Ae(e)*t,i=Ae(e)*n,s=Ae(e)*t,l=Ae(e)*n,a=Ae(e)*t,r=Ae(e)*n;return[i,o,l,s,r,a]}function gc(e,n,t,o){Te(e,n[1]/o),Te(e,n[0]/t),Te(e,n[3]/o),Te(e,n[2]/t),Te(e,n[5]/o),Te(e,n[4]/t)}const Al=["exclude","combine","subtract","intersect"];function bc(e,n,t,o,i){const s=e.offset+i,l=n.paths;let a;for(;s-e.offset>=26;){const r=I(e);switch(r){case 0:case 3:{I(e);const c=$(e),f=I(e);E(e,18),a={open:r===3,knots:[],fillRule:f===2?"non-zero":"even-odd"},c!==-1&&(a.operation=Al[c]),l.push(a);break}case 1:case 2:case 4:case 5:a.knots.push({linked:r===1||r===4,points:mc(e,t,o)});break;case 6:E(e,24);break;case 7:{const c=Ae(e),f=Ae(e),h=Ae(e),u=Ae(e),d=Ae(e);E(e,4),n.clipboard={top:c,left:f,bottom:h,right:u,resolution:d};break}case 8:n.fillStartsWithAllPixels=!!I(e),E(e,22);break;default:throw new Error("Invalid vmsk section")}}return l}M("vmsk",ee("vectorMask"),(e,n,t,{width:o,height:i})=>{if(F(e)!==3)throw new Error("Invalid vmsk version");n.vectorMask={paths:[]};const s=n.vectorMask,l=F(e);s.invert=(l&1)!==0,s.notLink=(l&2)!==0,s.disable=(l&4)!==0,bc(e,s,o,i,t()),E(e,t())},(e,n,{width:t,height:o})=>{const i=n.vectorMask,s=(i.invert?1:0)|(i.notLink?2:0)|(i.disable?4:0);O(e,3),O(e,s),C(e,6),Z(e,24);const l=i.clipboard;l&&(C(e,7),Te(e,l.top),Te(e,l.left),Te(e,l.bottom),Te(e,l.right),Te(e,l.resolution),Z(e,4)),C(e,8),C(e,i.fillStartsWithAllPixels?1:0),Z(e,22);for(const a of i.paths){C(e,a.open?3:0),C(e,a.knots.length),C(e,a.operation?Al.indexOf(a.operation):-1),C(e,a.fillRule==="non-zero"?2:1),Z(e,18);const r=a.open?4:1,c=a.open?5:2;for(const{linked:f,points:h}of a.knots)C(e,f?r:c),gc(e,h,t,o)}});it("vsms","vmsk");M("vowv",ee("vowv"),(e,n)=>{n.vowv=F(e)},(e,n)=>{O(e,n.vowv)});M("vogk",ee("vectorOrigination"),(e,n,t)=>{if(T(e)!==1)throw new Error("Invalid vogk version");const o=H(e);n.vectorOrigination={keyDescriptorList:[]};for(const i of o.keyDescriptorList){const s={};i.keyShapeInvalidated!=null&&(s.keyShapeInvalidated=i.keyShapeInvalidated),i.keyOriginType!=null&&(s.keyOriginType=i.keyOriginType),i.keyOriginResolution!=null&&(s.keyOriginResolution=i.keyOriginResolution),i.keyOriginShapeBBox&&(s.keyOriginShapeBoundingBox={top:nt(i.keyOriginShapeBBox["Top "]),left:nt(i.keyOriginShapeBBox.Left),bottom:nt(i.keyOriginShapeBBox.Btom),right:nt(i.keyOriginShapeBBox.Rght)});const l=i.keyOriginRRectRadii;l&&(s.keyOriginRRectRadii={topRight:Q(l.topRight),topLeft:Q(l.topLeft),bottomLeft:Q(l.bottomLeft),bottomRight:Q(l.bottomRight)});const a=i.keyOriginBoxCorners;a&&(s.keyOriginBoxCorners=[{x:a.rectangleCornerA.Hrzn,y:a.rectangleCornerA.Vrtc},{x:a.rectangleCornerB.Hrzn,y:a.rectangleCornerB.Vrtc},{x:a.rectangleCornerC.Hrzn,y:a.rectangleCornerC.Vrtc},{x:a.rectangleCornerD.Hrzn,y:a.rectangleCornerD.Vrtc}]);const r=i.Trnf;r&&(s.transform=[r.xx,r.xy,r.yx,r.yy,r.tx,r.ty]),n.vectorOrigination.keyDescriptorList.push(s)}E(e,t())},(e,n)=>{const t=n.vectorOrigination,o={keyDescriptorList:[]};for(let i=0;i<t.keyDescriptorList.length;i++){const s=t.keyDescriptorList[i];o.keyDescriptorList.push({});const l=o.keyDescriptorList[o.keyDescriptorList.length-1];s.keyOriginType!=null&&(l.keyOriginType=s.keyOriginType),s.keyOriginResolution!=null&&(l.keyOriginResolution=s.keyOriginResolution);const a=s.keyOriginRRectRadii;
10a&&(l.keyOriginRRectRadii={unitValueQuadVersion:1,topRight:oe(a.topRight,"topRight"),topLeft:oe(a.topLeft,"topLeft"),bottomLeft:oe(a.bottomLeft,"bottomLeft"),bottomRight:oe(a.bottomRight,"bottomRight")});const r=s.keyOriginShapeBoundingBox;r&&(l.keyOriginShapeBBox={unitValueQuadVersion:1,"Top ":oe(r.top,"top"),Left:oe(r.left,"left"),Btom:oe(r.bottom,"bottom"),Rght:oe(r.right,"right")});const c=s.keyOriginBoxCorners;c&&c.length===4&&(l.keyOriginBoxCorners={rectangleCornerA:{Hrzn:c[0].x,Vrtc:c[0].y},rectangleCornerB:{Hrzn:c[1].x,Vrtc:c[1].y},rectangleCornerC:{Hrzn:c[2].x,Vrtc:c[2].y},rectangleCornerD:{Hrzn:c[3].x,Vrtc:c[3].y}});const f=s.transform;f&&f.length===6&&(l.Trnf={xx:f[0],xy:f[1],yx:f[2],yy:f[3],tx:f[4],ty:f[5]}),s.keyShapeInvalidated!=null&&(l.keyShapeInvalidated=s.keyShapeInvalidated),l.keyOriginIndex=i}G(e,1),W(e,"","null",o)});M("lmfx",e=>e.effects!==void 0&&_l(e.effects),(e,n,t)=>{if(F(e)!==0)throw new Error("Invalid lmfx version");const i=H(e);n.effects=Wt(i,!!e.logMissingFeatures),E(e,t())},(e,n,t,o)=>{const i=Ht(n.effects,!!o.logMissingFeatures,!0);O(e,0),W(e,"","null",i)});M("lrFX",ee("effects"),(e,n,t)=>{n.effects||(n.effects=ec(e)),E(e,t())},(e,n)=>{tc(e,n.effects)});M("luni",ee("name"),(e,n,t)=>{if(t()>4){const o=F(e);t()>=o*2?n.name=mo(e,o):e.logDevFeatures&&e.log("name in luni section is too long")}else e.logDevFeatures&&e.log("empty luni section");E(e,t())},(e,n)=>{Se(e,n.name)});M("lnsr",ee("nameSource"),(e,n)=>n.nameSource=ne(e),(e,n)=>N(e,n.nameSource));M("lyid",ee("id"),(e,n)=>{n.id=F(e)},(e,n,t,o)=>{let i=n.id;for(;o.layerIds.has(i);)i+=100;O(e,i),o.layerIds.add(i),o.layerToId.set(n,i)});M("lsct",ee("sectionDivider"),(e,n,t)=>{n.sectionDivider={type:F(e)},t()&&(ot(e,"8BIM"),n.sectionDivider.key=ne(e)),t()&&(n.sectionDivider.subType=F(e))},(e,n)=>{O(e,n.sectionDivider.type),n.sectionDivider.key&&(N(e,"8BIM"),N(e,n.sectionDivider.key),n.sectionDivider.subType!==void 0&&O(e,n.sectionDivider.subType))});it("lsdk","lsct");M("clbl",ee("blendClippendElements"),(e,n)=>{n.blendClippendElements=!!w(e),E(e,3)},(e,n)=>{P(e,n.blendClippendElements?1:0),Z(e,3)});M("infx",ee("blendInteriorElements"),(e,n)=>{n.blendInteriorElements=!!w(e),E(e,3)},(e,n)=>{P(e,n.blendInteriorElements?1:0),Z(e,3)});M("knko",ee("knockout"),(e,n)=>{n.knockout=!!w(e),E(e,3)},(e,n)=>{P(e,n.knockout?1:0),Z(e,3)});M("lmgm",ee("layerMaskAsGlobalMask"),(e,n)=>{n.layerMaskAsGlobalMask=!!w(e),E(e,3)},(e,n)=>{P(e,n.layerMaskAsGlobalMask?1:0),Z(e,3)});M("lspf",ee("protected"),(e,n)=>{const t=F(e);n.protected={transparency:(t&1)!==0,composite:(t&2)!==0,position:(t&4)!==0},t&8&&(n.protected.artboards=!0)},(e,n)=>{const t=(n.protected.transparency?1:0)|(n.protected.composite?2:0)|(n.protected.position?4:0)|(n.protected.artboards?8:0);O(e,t)});M("lclr",ee("layerColor"),(e,n)=>{const t=I(e);E(e,6),n.layerColor=Jo[t]},(e,n)=>{const t=Jo.indexOf(n.layerColor);C(e,t===-1?0:t),Z(e,6)});M("shmd",e=>e.timestamp!==void 0||e.animationFrames!==void 0||e.animationFrameFlags!==void 0||e.timeline!==void 0||e.comps!==void 0,(e,n,t)=>{const o=F(e);for(let i=0;i<o;i++){ot(e,"8BIM");const s=ne(e);w(e),E(e,3),Ie(e,1,l=>{if(s==="cust"){const a=H(e);a.layerTime!==void 0&&(n.timestamp=a.layerTime)}else if(s==="mlst"){const a=H(e);n.animationFrames=[];for(let r=0;r<a.LaSt.length;r++){const c=a.LaSt[r],f={frames:c.FrLs};c.enab!==void 0&&(f.enable=c.enab),c.Ofst&&(f.offset=Bt(c.Ofst)),c.FXRf&&(f.referencePoint=Bt(c.FXRf)),c.Lefx&&(f.effects=Wt(c.Lefx,!!e.logMissingFeatures)),c.blendOptions&&c.blendOptions.Opct&&(f.opacity=te(c.blendOptions.Opct)),n.animationFrames.push(f)}}else if(s==="mdyn"){I(e);const a=w(e),r=w(e);n.animationFrameFlags={propagateFrameOne:!a,unifyLayerPosition:(r&1)!==0,unifyLayerStyle:(r&2)!==0,unifyLayerVisibility:(r&4)!==0}}else if(s==="tmln"){const a=H(e),r=a.timeScope,c={start:ye(r.Strt),duration:ye(r.duration),inTime:ye(r.inTime),outTime:ye(r.outTime),autoScope:a.autoScope,audioLevel:a.audioLevel};a.trackList&&(c.tracks=Ls(a.trackList,!!e.logMissingFeatures)),n.timeline=c}else if(s==="cmls"){const a=H(e);n.comps={settings:[]},a.origFXRefPoint&&(n.comps.originalEffectsReferencePoint={x:a.origFXRefPoint.Hrzn,y:a.origFXRefPoint.Vrtc});for(const r of a.layerSettings){n.comps.settings.push({compList:r.compList});const c=n.comps.settings[n.comps.settings.length-1];"enab"in r&&(c.enabled=r.enab),r.Ofst&&(c.offset={x:r.Ofst.Hrzn,y:r.Ofst.Vrtc}),r.FXRefPoint&&(c.effectsReferencePoint={x:r.FXRefPoint.Hrzn,y:r.FXRefPoint.Vrtc})}}else s==="extn"&&H(e),e.logMissingFeatures&&e.log('Unhandled "shmd" section key',s);E(e,l())})}E(e,t())},(e,n,t,o)=>{const{animationFrames:i,animationFrameFlags:s,timestamp:l,timeline:a,comps:r}=n;let c=0;i&&c++,s&&c++,a&&c++,l!==void 0&&c++,r&&c++,O(e,c),i&&(N(e,"8BIM"),N(e,"mlst"),P(e,0),Z(e,3),ct(e,2,()=>{var f;const h={LaID:(f=n.id)!==null&&f!==void 0?f:0,LaSt:[]};for(let u=0;u<i.length;u++){const d=i[u],p={};d.enable!==void 0&&(p.enab=d.enable),p.FrLs=d.frames,d.offset&&(p.Ofst=zt(d.offset)),d.referencePoint&&(p.FXRf=zt(d.referencePoint)),d.effects&&(p.Lefx=Ht(d.effects,!1,!1)),d.opacity!==void 0&&(p.blendOptions={Opct:he(d.opacity)}),h.LaSt.push(p)}W(e,"","null",h)},!0)),s&&(N(e,"8BIM"),N(e,"mdyn"),P(e,0),Z(e,3),ct(e,2,()=>{C(e,0),P(e,s.propagateFrameOne?0:15),P(e,(s.unifyLayerPosition?1:0)|(s.unifyLayerStyle?2:0)|(s.unifyLayerVisibility?4:0))})),a&&(N(e,"8BIM"),N(e,"tmln"),P(e,0),Z(e,3),ct(e,2,()=>{const f={Vrsn:1,timeScope:{Vrsn:1,Strt:a.start,duration:a.duration,inTime:a.inTime,outTime:a.outTime},autoScope:a.autoScope,audioLevel:a.audioLevel};a.tracks&&(f.trackList=Es(a.tracks));const h=o.layerToId.get(n)||n.id;if(!h)throw new Error("You need to provide layer.id value whan writing document with animations");f.LyrI=h,W(e,"","null",f,"anim")},!0)),l!==void 0&&(N(e,"8BIM"),N(e,"cust"),P(e,0),Z(e,3),ct(e,2,()=>{W(e,"","metadata",{layerTime:l})},!0)),r&&(N(e,"8BIM"),N(e,"cmls"),P(e,0),Z(e,3),ct(e,2,()=>{const f=o.layerToId.get(n)||n.id;if(!f)throw new Error("You need to provide layer.id value whan writing document with layer comps");const h={};r.originalEffectsReferencePoint&&(h.origFXRefPoint={Hrzn:r.originalEffectsReferencePoint.x,Vrtc:r.originalEffectsReferencePoint.y}),h.LyrI=f,h.layerSettings=[];for(const u of r.settings){const d={};u.enabled!==void 0&&(d.enab=u.enabled),u.offset&&(d.Ofst={Hrzn:u.offset.x,Vrtc:u.offset.y}),u.effectsReferencePoint&&(d.FXRefPoint={Hrzn:u.effectsReferencePoint.x,Vrtc:u.effectsReferencePoint.y}),d.compList=u.compList,h.layerSettings.push(d)}W(e,"","null",h)},!0))});M("PxSc",()=>!1,(e,n)=>{const t=H(e,!0);t.pixelSourceType===1986285651?n.pixelSource={type:"vdPS",origin:{x:t.origin.Hrzn,y:t.origin.Vrtc},interpretation:{interpretAlpha:t.interpretation.interpretAlpha.split(".")[1],profile:t.interpretation.profile},frameReader:{type:"QTFR",link:{name:t.frameReader["Lnk "]["Nm  "],fullPath:t.frameReader["Lnk "].fullPath,originalPath:t.frameReader["Lnk "].originalPath,relativePath:t.frameReader["Lnk "].relPath,alias:t.frameReader["Lnk "].alis},mediaDescriptor:t.frameReader.mediaDescriptor},showAlteredVideo:t.showAlteredVideo}:e.log("Unknown pixelSourceType")},(e,n)=>{const t=n.pixelSource,o={_name:"",_classID:"PixelSource",pixelSourceType:1986285651,descVersion:1,origin:{Hrzn:t.origin.x,Vrtc:t.origin.y},interpretation:{_name:"",_classID:"footageInterpretation",Vrsn:1,interpretAlpha:`alphaInterpretation.${t.interpretation.interpretAlpha}`,profile:t.interpretation.profile},frameReader:{_name:"",_classID:"FrameReader",frameReaderType:1364477522,descVersion:1,"Lnk ":{_name:"",_classID:"Exter
10nalFileLink",descVersion:2,"Nm  ":t.frameReader.link.name,fullPath:t.frameReader.link.fullPath,originalPath:t.frameReader.link.originalPath,alis:t.frameReader.link.alias,relPath:t.frameReader.link.relativePath},mediaDescriptor:t.frameReader.mediaDescriptor},showAlteredVideo:t.showAlteredVideo};W(e,"","PixelSource",o)});M("vstk",ee("vectorStroke"),(e,n,t)=>{const o=H(e);n.vectorStroke={strokeEnabled:o.strokeEnabled,fillEnabled:o.fillEnabled,lineWidth:Q(o.strokeStyleLineWidth),lineDashOffset:Q(o.strokeStyleLineDashOffset),miterLimit:o.strokeStyleMiterLimit,lineCapType:yi.decode(o.strokeStyleLineCapType),lineJoinType:Si.decode(o.strokeStyleLineJoinType),lineAlignment:vi.decode(o.strokeStyleLineAlignment),scaleLock:o.strokeStyleScaleLock,strokeAdjust:o.strokeStyleStrokeAdjust,lineDashSet:o.strokeStyleLineDashSet.map(Q),blendMode:Le.decode(o.strokeStyleBlendMode),opacity:te(o.strokeStyleOpacity),content:Xt(o.strokeStyleContent),resolution:o.strokeStyleResolution},E(e,t())},(e,n)=>{var t,o,i;const s=n.vectorStroke,l={strokeStyleVersion:2,strokeEnabled:!!s.strokeEnabled,fillEnabled:!!s.fillEnabled,strokeStyleLineWidth:s.lineWidth||{value:3,units:"Points"},strokeStyleLineDashOffset:s.lineDashOffset||{value:0,units:"Points"},strokeStyleMiterLimit:(t=s.miterLimit)!==null&&t!==void 0?t:100,strokeStyleLineCapType:yi.encode(s.lineCapType),strokeStyleLineJoinType:Si.encode(s.lineJoinType),strokeStyleLineAlignment:vi.encode(s.lineAlignment),strokeStyleScaleLock:!!s.scaleLock,strokeStyleStrokeAdjust:!!s.strokeAdjust,strokeStyleLineDashSet:s.lineDashSet||[],strokeStyleBlendMode:Le.encode(s.blendMode),strokeStyleOpacity:he((o=s.opacity)!==null&&o!==void 0?o:1),strokeStyleContent:Kt(s.content||{type:"color",color:{r:0,g:0,b:0}}).descriptor,strokeStyleResolution:(i=s.resolution)!==null&&i!==void 0?i:72};W(e,"","strokeStyle",l)});M("artb",ee("artboard"),(e,n,t)=>{const o=H(e),i=o.artboardRect;n.artboard={rect:{top:i["Top "],left:i.Left,bottom:i.Btom,right:i.Rght},guideIndices:o.guideIndeces,presetName:o.artboardPresetName,color:_e(o["Clr "]),backgroundType:o.artboardBackgroundType},E(e,t())},(e,n)=>{var t;const o=n.artboard,i=o.rect,s={artboardRect:{"Top ":i.top,Left:i.left,Btom:i.bottom,Rght:i.right},guideIndeces:o.guideIndices||[],artboardPresetName:o.presetName||"","Clr ":je(o.color),artboardBackgroundType:(t=o.backgroundType)!==null&&t!==void 0?t:1};W(e,"","artboard",s)});M("sn2P",ee("usingAlignedRendering"),(e,n)=>n.usingAlignedRendering=!!F(e),(e,n)=>O(e,n.usingAlignedRendering?1:0));const Ft=["unknown","vector","raster","image stack"];function Tl(e){var n,t,o,i,s,l;const a=Object.assign(Object.assign({style:uo.decode(e.warpStyle)},e.warpValues?{values:e.warpValues}:{value:e.warpValue||0}),{perspective:e.warpPerspective||0,perspectiveOther:e.warpPerspectiveOther||0,rotate:Ut.decode(e.warpRotate),bounds:e.bounds&&{top:nt(e.bounds["Top "]),left:nt(e.bounds.Left),bottom:nt(e.bounds.Btom),right:nt(e.bounds.Rght)},uOrder:e.uOrder,vOrder:e.vOrder});(e.deformNumRows!=null||e.deformNumCols!=null)&&(a.deformNumRows=e.deformNumRows,a.deformNumCols=e.deformNumCols);const r=e.customEnvelopeWarp;if(r){a.customEnvelopeWarp={meshPoints:[]};const c=((n=r.meshPoints.find(h=>h.type==="Hrzn"))===null||n===void 0?void 0:n.values)||[],f=((t=r.meshPoints.find(h=>h.type==="Vrtc"))===null||t===void 0?void 0:t.values)||[];for(let h=0;h<c.length;h++)a.customEnvelopeWarp.meshPoints.push({x:c[h],y:f[h]});(r.quiltSliceX||r.quiltSliceY)&&(a.customEnvelopeWarp.quiltSliceX=((i=(o=r.quiltSliceX)===null||o===void 0?void 0:o[0])===null||i===void 0?void 0:i.values)||[],a.customEnvelopeWarp.quiltSliceY=((l=(s=r.quiltSliceY)===null||s===void 0?void 0:s[0])===null||l===void 0?void 0:l.values)||[])}return a}function vo(e){var n,t;return e.deformNumCols!=null||e.deformNumRows!=null||((n=e.customEnvelopeWarp)===null||n===void 0?void 0:n.quiltSliceX)||((t=e.customEnvelopeWarp)===null||t===void 0?void 0:t.quiltSliceY)}function wn(e){const n=e.bounds,t=Object.assign(Object.assign({warpStyle:uo.encode(e.style)},e.values?{warpValues:e.values}:{warpValue:e.value||0}),{warpPerspective:e.perspective||0,warpPerspectiveOther:e.perspectiveOther||0,warpRotate:Ut.encode(e.rotate),bounds:{"Top ":oe(n&&n.top||{units:"Pixels",value:0},"bounds.top"),Left:oe(n&&n.left||{units:"Pixels",value:0},"bounds.left"),Btom:oe(n&&n.bottom||{units:"Pixels",value:0},"bounds.bottom"),Rght:oe(n&&n.right||{units:"Pixels",value:0},"bounds.right")},uOrder:e.uOrder||0,vOrder:e.vOrder||0}),o=vo(e);if(o){const s=t;s.deformNumRows=e.deformNumRows||0,s.deformNumCols=e.deformNumCols||0}const i=e.customEnvelopeWarp;if(i){const s=i.meshPoints||[];if(o){const l=t;l.customEnvelopeWarp={_name:"",_classID:"customEnvelopeWarp",quiltSliceX:[{type:"quiltSliceX",values:i.quiltSliceX||[]}],quiltSliceY:[{type:"quiltSliceY",values:i.quiltSliceY||[]}],meshPoints:[{type:"Hrzn",values:s.map(a=>a.x)},{type:"Vrtc",values:s.map(a=>a.y)}]}}else t.customEnvelopeWarp={_name:"",_classID:"customEnvelopeWarp",meshPoints:[{type:"Hrzn",values:s.map(l=>l.x)}
10,{type:"Vrtc",values:s.map(l=>l.y)}]}}return t}M("PlLd",ee("placedLayer"),(e,n,t)=>{if(ne(e)!=="plcL")throw new Error("Invalid PlLd signature");if(T(e)!==3)throw new Error("Invalid PlLd version");const o=Qe(e,1),i=T(e),s=T(e);T(e);const l=T(e);if(!Ft[l])throw new Error("Invalid PlLd type");const a=[];for(let f=0;f<8;f++)a.push(Ee(e));const r=T(e);if(r!==0)throw new Error(`Invalid Warp version ${r}`);const c=H(e);n.placedLayer=n.placedLayer||{id:o,type:Ft[l],pageNumber:i,totalPages:s,transform:a,warp:Tl(c)},E(e,t())},(e,n)=>{const t=n.placedLayer;if(N(e,"plcL"),G(e,3),!t.id||typeof t.id!="string"||!/^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$/.test(t.id))throw new Error("Placed layer ID must be in a GUID format (example: 20953ddb-9391-11ec-b4f1-c15674f50bc4)");if(ut(e,t.id,1),G(e,1),G(e,1),G(e,16),Ft.indexOf(t.type)===-1)throw new Error("Invalid placedLayer type");G(e,Ft.indexOf(t.type));for(let l=0;l<8;l++)Ge(e,t.transform[l]);G(e,0);const o=Ml(t),s=vo(o)?"quiltWarp":"warp";W(e,"",s,wn(o),s)});function yc(e){return new Float32Array(e.buffer.slice(e.byteOffset),0,e.byteLength/4)}function Sc(e){return new Uint32Array(e.buffer.slice(e.byteOffset),0,e.byteLength/4)}function Zn(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function kn(e){const n=[];for(let t=0;t<e.length;t+=2)n.push({x:e[t],y:e[t+1]});return n}function Lt(e){const n=[];for(let t=0;t<e.length;t++)n.push(e[t].x,e[t].y);return n}function Gi(e){return kn(yc(e))}function Et(e){return{x:Q(e.Hrzn),y:Q(e.Vrtc)}}function Pt(e){return{_name:"",_classID:"Pnt ",Hrzn:oe(e.x,"x"),Vrtc:oe(e.y,"y")}}function vc(e,n){const t={name:e["Nm  "],opacity:te(e.blendOptions.Opct),blendMode:Le.decode(e.blendOptions["Md  "]),enabled:e.enab,hasOptions:e.hasoptions,foregroundColor:_e(e.FrgC),backgroundColor:_e(e.BckC)};if("Fltr"in e)switch(e.Fltr._classID){case"boxblur":return Object.assign(Object.assign({},t),{type:"box blur",filter:{radius:Q(e.Fltr["Rds "])}});case"GsnB":return Object.assign(Object.assign({},t),{type:"gaussian blur",filter:{radius:Q(e.Fltr["Rds "])}});case"MtnB":return Object.assign(Object.assign({},t),{type:"motion blur",filter:{angle:e.Fltr.Angl,distance:Q(e.Fltr.Dstn)}});case"RdlB":return Object.assign(Object.assign({},t),{type:"radial blur",filter:{amount:e.Fltr.Amnt,method:Hs.decode(e.Fltr.BlrM),quality:Ws.decode(e.Fltr.BlrQ)}});case"shapeBlur":return Object.assign(Object.assign({},t),{type:"shape blur",filter:{radius:Q(e.Fltr["Rds "]),customShape:{name:e.Fltr.customShape["Nm  "],id:e.Fltr.customShape.Idnt}}});case"SmrB":return Object.assign(Object.assign({},t),{type:"smart blur",filter:{radius:e.Fltr["Rds "],threshold:e.Fltr.Thsh,quality:Ks.decode(e.Fltr.SmBQ),mode:Xs.decode(e.Fltr.SmBM)}});case"surfaceBlur":return Object.assign(Object.assign({},t),{type:"surface blur",filter:{radius:Q(e.Fltr["Rds "]),threshold:e.Fltr.Thsh}});case"Dspl":return Object.assign(Object.assign({},t),{type:"displace",filter:{horizontalScale:e.Fltr.HrzS,verticalScale:e.Fltr.VrtS,displacementMap:Ys.decode(e.Fltr.DspM),undefinedAreas:Ct.decode(e.Fltr.UndA),displacementFile:{signature:e.Fltr.DspF.sig,path:e.Fltr.DspF.path}}});case"Pnch":return Object.assign(Object.assign({},t),{type:"pinch",filter:{amount:e.Fltr.Amnt}});case"Plr ":return Object.assign(Object.assign({},t),{type:"polar coordinates",filter:{conversion:qs.decode(e.Fltr.Cnvr)}});case"Rple":return Object.assign(Object.assign({},t),{type:"ripple",filter:{amount:e.Fltr.Amnt,size:Zs.decode(e.Fltr.RplS)}});case"Shr ":return Object.assign(Object.assign({},t),{type:"shear",filter:{shearPoints:e.Fltr.ShrP.map(o=>({x:o.Hrzn,y:o.Vrtc})),shearStart:e.Fltr.ShrS,shearEnd:e.Fltr.ShrE,undefinedAreas:Ct.decode(e.Fltr.UndA)}});case"Sphr":return Object.assign(Object.assign({},t),{type:"spherize",filter:{amount:e.Fltr.Amnt,mode:Js.decode(e.Fltr.SphM)}});case"Twrl":return Object.assign(Object.assign({},t),{type:"twirl",filter:{angle:e.Fltr.Angl}});case"Wave":return Object.assign(Object.assign({},t),{type:"wave",filter:{numberOfGenerators:e.Fltr.NmbG,type:Qs.decode(e.Fltr.Wvtp),wavelength:{min:e.Fltr.WLMn,max:e.Fltr.WLMx},amplitude:{min:e.Fltr.AmMn,max:e.Fltr.AmMx},scale:{x:e.Fltr.SclH,y:e.Fltr.SclV},randomSeed:e.Fltr.RndS,undefinedAreas:Ct.decode(e.Fltr.UndA)}});case"ZgZg":return Object.assign(Object.assign({},t),{type:"zigzag",filter:{amount:e.Fltr.Amnt,ridges:e.Fltr.NmbR,style:el.decode(e.Fltr.ZZTy)}});case"AdNs":return Object.assign(Object.assign({},t),{type:"add noise",filter:{amount:te(e.Fltr.Nose),distribution:tl.decode(e.Fltr.Dstr),monochromatic:e.Fltr.Mnch,randomSeed:e.Fltr.FlRs}});case"DstS":return Object.assign(Object.assign({},t),{type:"dust and scratches",filter:{radius:e.Fltr["Rds "],threshold:e.Fltr.Thsh}});case"Mdn ":return Object.assign(Object.assign({},t),{type:"median",filter:{radius:Q(e.Fltr["Rds "])}});case"denoise":return Object.assign(Object.assign({},t),{type:"reduce noise",filter:{preset:e.Fltr.preset,removeJpegArtifact:e.Fltr.removeJPEGArtifact,reduceColorNoise:te(e.Fltr.ClNs),sharpenDetails:te(e.Fltr.Shrp),channelDenoise:e.Fltr.channelDenoise.map(o=>Object.assign({channels:o.Chnl.map(Gt.decode),amount:o.Amnt},o.EdgF?{preserveDetails:o.EdgF}:{}))}});case"ClrH":return Object.assign(Object.assign({},t),{type:"color halftone",filter:{radius:e.Fltr["Rds "],angle1:e.Fltr.Ang1,angle2:e.Fltr.Ang2,angle3:e.Fltr.Ang3,angle4:e.Fltr.Ang4}});case"Crst":return Object.assign(Object.assign({},t),{type:"crystallize",filter:{cellSize:e.Fltr.ClSz,randomSeed:e.Fltr.FlRs}});case"Mztn":return Object.assign(Object.assign({},t),{type:"mezzotint",filter:{type:nl.decode(e.Fltr.MztT),randomSeed:e.Fltr.FlRs}});case"Msc ":return Object.assign(Object.assign({},t),{type:"mosaic",filter:{cellSize:Q(e.Fltr.ClSz)}});case"Pntl":return Object.assign(Object.assign({},t),{type:"pointillize",filter:{cellSize:e.Fltr.ClSz,randomSeed:e.Fltr.FlRs}});case"Clds":return Object.assign(Object.assign({},t),{type:"clouds",filter:{randomSeed:e.Fltr.FlRs}});case"DfrC":return Object.assign(Object.assign({},t),{type:"difference clouds",filter:{randomSeed:e.Fltr.FlRs}});case"Fbrs":return Object.assign(Object.assign({}
10,t),{type:"fibers",filter:{variance:e.Fltr.Vrnc,strength:e.Fltr.Strg,randomSeed:e.Fltr.RndS}});case"LnsF":return Object.assign(Object.assign({},t),{type:"lens flare",filter:{brightness:e.Fltr.Brgh,position:{x:e.Fltr.FlrC.Hrzn,y:e.Fltr.FlrC.Vrtc},lensType:ol.decode(e.Fltr["Lns "])}});case"smartSharpen":return Object.assign(Object.assign({},t),{type:"smart sharpen",filter:{amount:te(e.Fltr.Amnt),radius:Q(e.Fltr["Rds "]),threshold:e.Fltr.Thsh,angle:e.Fltr.Angl,moreAccurate:e.Fltr.moreAccurate,blur:il.decode(e.Fltr.blur),preset:e.Fltr.preset,shadow:{fadeAmount:te(e.Fltr.sdwM.Amnt),tonalWidth:te(e.Fltr.sdwM.Wdth),radius:e.Fltr.sdwM["Rds "]},highlight:{fadeAmount:te(e.Fltr.hglM.Amnt),tonalWidth:te(e.Fltr.hglM.Wdth),radius:e.Fltr.hglM["Rds "]}}});case"UnsM":return Object.assign(Object.assign({},t),{type:"unsharp mask",filter:{amount:te(e.Fltr.Amnt),radius:Q(e.Fltr["Rds "]),threshold:e.Fltr.Thsh}});case"Dfs ":return Object.assign(Object.assign({},t),{type:"diffuse",filter:{mode:sl.decode(e.Fltr["Md  "]),randomSeed:e.Fltr.FlRs}});case"Embs":return Object.assign(Object.assign({},t),{type:"emboss",filter:{angle:e.Fltr.Angl,height:e.Fltr.Hght,amount:e.Fltr.Amnt}});case"Extr":return Object.assign(Object.assign({},t),{type:"extrude",filter:{type:ll.decode(e.Fltr.ExtT),size:e.Fltr.ExtS,depth:e.Fltr.ExtD,depthMode:al.decode(e.Fltr.ExtR),randomSeed:e.Fltr.FlRs,solidFrontFaces:e.Fltr.ExtF,maskIncompleteBlocks:e.Fltr.ExtM}});case"Tls ":return Object.assign(Object.assign({},t),{type:"tiles",filter:{numberOfTiles:e.Fltr.TlNm,maximumOffset:e.Fltr.TlOf,fillEmptyAreaWith:rl.decode(e.Fltr.FlCl),randomSeed:e.Fltr.FlRs}});case"TrcC":return Object.assign(Object.assign({},t),{type:"trace contour",filter:{level:e.Fltr["Lvl "],edge:cl.decode(e.Fltr["Edg "])}});case"Wnd ":return Object.assign(Object.assign({},t),{type:"wind",filter:{method:fl.decode(e.Fltr.WndM),direction:ul.decode(e.Fltr.Drct)}});case"Dntr":return Object.assign(Object.assign({},t),{type:"de-interlace",filter:{eliminate:dl.decode(e.Fltr.IntE),newFieldsBy:hl.decode(e.Fltr.IntC)}});case"Cstm":return Object.assign(Object.assign({},t),{type:"custom",filter:{scale:e.Fltr["Scl "],offset:e.Fltr.Ofst,matrix:e.Fltr.Mtrx}});case"HghP":return Object.assign(Object.assign({},t),{type:"high pass",filter:{radius:Q(e.Fltr["Rds "])}});case"Mxm ":return Object.assign(Object.assign({},t),{type:"maximum",filter:{radius:Q(e.Fltr["Rds "])}});case"Mnm ":return Object.assign(Object.assign({},t),{type:"minimum",filter:{radius:Q(e.Fltr["Rds "])}});case"Ofst":return Object.assign(Object.assign({},t),{type:"offset",filter:{horizontal:e.Fltr.Hrzn,vertical:e.Fltr.Vrtc,undefinedAreas:pl.decode(e.Fltr["Fl  "])}});case"rigidTransform":return Object.assign(Object.assign({},t),{type:"puppet",filter:{rigidType:e.Fltr.rigidType,bounds:[{x:e.Fltr.PuX0,y:e.Fltr.PuY0},{x:e.Fltr.PuX1,y:e.Fltr.PuY1},{x:e.Fltr.PuX2,y:e.Fltr.PuY2},{x:e.Fltr.PuX3,y:e.Fltr.PuY3}],puppetShapeList:e.Fltr.puppetShapeList.map(o=>({rigidType:o.rigidType,originalVertexArray:Gi(o.originalVertexArray),deformedVertexArray:Gi(o.deformedVertexArray),indexArray:Array.from(Sc(o.indexArray)),pinOffsets:kn(o.pinOffsets),posFinalPins:kn(o.posFinalPins),pinVertexIndices:o.pinVertexIndices,selectedPin:o.selectedPin,pinPosition:kn(o.PinP),pinRotation:o.PnRt,pinOverlay:o.PnOv,pinDepth:o.PnDp,meshQuality:o.meshQuality,meshExpansion:o.meshExpansion,meshRigidity:o.meshRigidity,imageResolution:o.imageResolution,meshBoundaryPath:{pathComponents:o.meshBoundaryPath.pathComponents.map(i=>({shapeOperation:i.shapeOperation.split(".")[1],paths:i.SbpL.map(s=>({closed:s.Clsp,points:s["Pts "].map(l=>({anchor:Et(l.Anch),forward:Et(l["Fwd "]),backward:Et(l["Bwd "]),smooth:l.Smoo}))}))}))}}))}});case"PbPl":{const o=[],i=e.Fltr;for(let s=0;s<Oe.length&&i[`PN${Oe[s]}a`];s++)for(let l=0;l<Oe.length&&i[`PN${Oe[s]}${Oe[l]}`];l++)o.push({name:i[`PN${Oe[s]}${Oe[l]}`],value:i[`PF${Oe[s]}${Oe[l]}`]});return Object.assign(Object.assign({},t),{type:"oil paint plugin",filter:{name:e.Fltr.KnNm,gpu:e.Fltr.GpuY,lighting:e.Fltr.LIWy,parameters:o}})}case"HsbP":return Object.assign(Object.assign({},t),{type:"hsb/hsl",filter:{inputMode:On.decode(e.Fltr.Inpt),rowOrder:On.decode(e.Fltr.Otpt)}});case"oilPaint":return Object.assign(Object.assign({},t),{type:"oil paint",filter:{lightingOn:e.Fltr.lightingOn,stylization:e.Fltr.stylization,cleanliness:e.Fltr.cleanliness,brushScale:e.Fltr.brushScale,microBrush:e.Fltr.microBrush,lightDirection:e.Fltr.LghD,specularity:e.Fltr.specularity}});case"LqFy":return Object.assign(Object.assign({},t),{type:"liquify",filter:{liquifyMesh:e.Fltr.LqMe}});case"perspectiveWarpTransform":return Object.assign(Object.assign({},t),{type:"perspective warp",filter:{vertices:e.Fltr.vertices.map(Et),warpedVertices:e.Fltr.warpedVertices.map(Et),quads:e.Fltr.quads.map(o=>o.indices)}});case"Crvs":return Object.assign(Object.assign({},t),{type:"curves",filter:Object.assign({presetKind:ml.decode(e.Fltr.presetKind)},e.Fltr.Adjs?{adjustments:e.Fltr.Adjs.map(o=>{const i=o.Chnl.map(Gt.decode);
10if(o["Crv "])return{channels:i,curve:o["Crv "].map(s=>{const l={x:s.Hrzn,y:s.Vrtc};return s.Cnty&&(l.curved=!0),l})};if(o.Mpng)return{channels:i,values:o.Mpng};throw new Error("Unknown curve adjustment")})}:{})});case"BrgC":return Object.assign(Object.assign({},t),{type:"brightness/contrast",filter:{brightness:e.Fltr.Brgh,contrast:e.Fltr.Cntr,useLegacy:!!e.Fltr.useLegacy}});default:if(n.throwForMissingFeatures)throw new Error(`Unknown filter classId: ${e.Fltr._classID}`);return}else switch(e.filterID){case 1098281575:return Object.assign(Object.assign({},t),{type:"average"});case 1114403360:return Object.assign(Object.assign({},t),{type:"blur"});case 1114403405:return Object.assign(Object.assign({},t),{type:"blur more"});case 1148416099:return Object.assign(Object.assign({},t),{type:"despeckle"});case 1180922912:return Object.assign(Object.assign({},t),{type:"facet"});case 1181902701:return Object.assign(Object.assign({},t),{type:"fragment"});case 1399353968:return Object.assign(Object.assign({},t),{type:"sharpen"});case 1399353925:return Object.assign(Object.assign({},t),{type:"sharpen edges"});case 1399353933:return Object.assign(Object.assign({},t),{type:"sharpen more"});case 1181639749:return Object.assign(Object.assign({},t),{type:"find edges"});case 1399616122:return Object.assign(Object.assign({},t),{type:"solarize"});case 1314149187:return Object.assign(Object.assign({},t),{type:"ntsc colors"});case 1231976050:return Object.assign(Object.assign({},t),{type:"invert"});default:if(n.throwForMissingFeatures)throw new Error(`Unknown filterID: ${e.filterID}`)}}function kc(e,n){return{enabled:e.enab,validAtPosition:e.validAtPosition,maskEnabled:e.filterMaskEnable,maskLinked:e.filterMaskLinked,maskExtendWithWhite:e.filterMaskExtendWithWhite,list:e.filterFXList.map(t=>vc(t,n)).filter(t=>!!t)}}function Ne(e){return oe(e.radius,"radius")}function xc(e){const n={_name:"",_classID:"filterFX","Nm  ":e.name,blendOptions:{_name:"",_classID:"blendOptions",Opct:De(e.opacity),"Md  ":Le.encode(e.blendMode)},enab:e.enabled,hasoptions:e.hasOptions,FrgC:je(e.foregroundColor),BckC:je(e.backgroundColor)};switch(e.type){case"average":return Object.assign(Object.assign({},n),{filterID:1098281575});case"blur":return Object.assign(Object.assign({},n),{filterID:1114403360});case"blur more":return Object.assign(Object.assign({},n),{filterID:1114403405});case"box blur":return Object.assign(Object.assign({},n),{Fltr:{_name:"Box Blur",_classID:"boxblur","Rds ":Ne(e.filter)},filterID:697});case"gaussian blur":return Object.assign(Object.assign({},n),{Fltr:{_name:"Gaussian Blur",_classID:"GsnB","Rds ":Ne(e.filter)},filterID:1198747202});case"motion blur":return Object.assign(Object.assign({},n),{Fltr:{_name:"Motion Blur",_classID:"MtnB",Angl:e.filter.angle,Dstn:oe(e.filter.distance,"distance")},filterID:1299476034});case"radial blur":return Object.assign(Object.assign({},n),{Fltr:{_name:"Radial Blur",_classID:"RdlB",Amnt:e.filter.amount,BlrM:Hs.encode(e.filter.method),BlrQ:Ws.encode(e.filter.quality)},filterID:1382313026});case"shape blur":return Object.assign(Object.assign({},n),{Fltr:{_name:"Shape Blur",_classID:"shapeBlur","Rds ":Ne(e.filter),customShape:{_name:"",_classID:"customShape","Nm  ":e.filter.customShape.name,Idnt:e.filter.customShape.id}},filterID:702});case"smart blur":return Object.assign(Object.assign({},n),{Fltr:{_name:"Smart Blur",_classID:"SmrB","Rds ":e.filter.radius,Thsh:e.filter.threshold,SmBQ:Ks.encode(e.filter.quality),SmBM:Xs.encode(e.filter.mode)},filterID:1399681602});case"surface blur":return Object.assign(Object.assign({},n),{Fltr:{_name:"Surface Blur",_classID:"surfaceBlur","Rds ":Ne(e.filter),Thsh:e.filter.threshold},filterID:701});case"displace":return Object.assign(Object.assign({},n),{Fltr:{_name:"Displace",_classID:"Dspl",HrzS:e.filter.horizontalScale,VrtS:e.filter.verticalScale,DspM:Ys.encode(e.filter.displacementMap),UndA:Ct.encode(e.filter.undefinedAreas),DspF:{sig:e.filter.displacementFile.signature,path:e.filter.displacementFile.path}},filterID:1148416108});case"pinch":return Object.assign(Object.assign({},n),{Fltr:{_name:"Pinch",_classID:"Pnch",Amnt:e.filter.amount},filterID:1349411688});case"polar coordinates":return Object.assign(Object.assign({},n),{Fltr:{_name:"Polar Coordinates",_classID:"Plr ",Cnvr:qs.encode(e.filter.conversion)},filterID:1349284384});case"ripple":return Object.assign(Object.assign({},n),{Fltr:{_name:"Ripple",_classID:"Rple",Amnt:e.filter.amount,RplS:Zs.encode(e.filter.size)},filterID:1383099493});case"shear":return Object.assign(Object.assign({},n),{Fltr:{_name:"Shear",_classID:"Shr ",ShrP:e.filter.shearPoints.map(t=>({_name:"",_classID:"Pnt ",Hrzn:t.x,Vrtc:t.y})),UndA:Ct.encode(e.filter.undefinedAreas),ShrS:e.filter.shearStart,ShrE:e.filter.shearEnd},filterID:1399353888});case"spherize":return Object.assign(Object.assign({},n),{Fltr:{_name:"Spherize",_classID:"Sphr",Amnt:e.filter.amount,SphM:Js.encode(e.filter.mode)},filterID:1399875698});case"twirl":return Object.assign(Object.assign({},n),{Fltr:{_name:"Twirl",_classID:"Twrl",Angl:e.filter.angle},filterID:1417114220});case"wave":return Object.assign(Object.assign({},n),{Fltr:{_name:"Wave",_classID:"Wave",Wvtp:Qs.encode(e.filter.type),NmbG:e.filter.numberOfGenerators,WLMn:e.filter.wavelength.min,WLMx:e.filter.wavelength.max,AmMn:e.filter.amplitude.min,AmMx:e.filter.amplitude.max,SclH:e.filter.scale.x,SclV:e.filter.scale.y,UndA:Ct.encode(e.filter.undefinedAreas),RndS:e.filter.randomSeed},filterID:1466005093});case"zigzag":return Object.assign(Object.assign({},n),{Fltr:{_name:"ZigZag",_classID:"ZgZg",Amnt:e.filter.amount,NmbR:e.filter.ridges,Z
10ZTy:el.encode(e.filter.style)},filterID:1516722791});case"add noise":return Object.assign(Object.assign({},n),{Fltr:{_name:"Add Noise",_classID:"AdNs",Dstr:tl.encode(e.filter.distribution),Nose:De(e.filter.amount),Mnch:e.filter.monochromatic,FlRs:e.filter.randomSeed},filterID:1097092723});case"despeckle":return Object.assign(Object.assign({},n),{filterID:1148416099});case"dust and scratches":return Object.assign(Object.assign({},n),{Fltr:{_name:"Dust & Scratches",_classID:"DstS","Rds ":e.filter.radius,Thsh:e.filter.threshold},filterID:1148417107});case"median":return Object.assign(Object.assign({},n),{Fltr:{_name:"Median",_classID:"Mdn ","Rds ":Ne(e.filter)},filterID:1298427424});case"reduce noise":return Object.assign(Object.assign({},n),{Fltr:{_name:"Reduce Noise",_classID:"denoise",ClNs:De(e.filter.reduceColorNoise),Shrp:De(e.filter.sharpenDetails),removeJPEGArtifact:e.filter.removeJpegArtifact,channelDenoise:e.filter.channelDenoise.map(t=>Object.assign({_name:"",_classID:"channelDenoiseParams",Chnl:t.channels.map(o=>Gt.encode(o)),Amnt:t.amount},t.preserveDetails?{EdgF:t.preserveDetails}:{})),preset:e.filter.preset},filterID:633});case"color halftone":return Object.assign(Object.assign({},n),{Fltr:{_name:"Color Halftone",_classID:"ClrH","Rds ":e.filter.radius,Ang1:e.filter.angle1,Ang2:e.filter.angle2,Ang3:e.filter.angle3,Ang4:e.filter.angle4},filterID:1131180616});case"crystallize":return Object.assign(Object.assign({},n),{Fltr:{_name:"Crystallize",_classID:"Crst",ClSz:e.filter.cellSize,FlRs:e.filter.randomSeed},filterID:1131574132});case"facet":return Object.assign(Object.assign({},n),{filterID:1180922912});case"fragment":return Object.assign(Object.assign({},n),{filterID:1181902701});case"mezzotint":return Object.assign(Object.assign({},n),{Fltr:{_name:"Mezzotint",_classID:"Mztn",MztT:nl.encode(e.filter.type),FlRs:e.filter.randomSeed},filterID:1299870830});case"mosaic":return Object.assign(Object.assign({},n),{Fltr:{_name:"Mosaic",_classID:"Msc ",ClSz:oe(e.filter.cellSize,"cellSize")},filterID:1299407648});case"pointillize":return Object.assign(Object.assign({},n),{Fltr:{_name:"Pointillize",_classID:"Pntl",ClSz:e.filter.cellSize,FlRs:e.filter.randomSeed},filterID:1349416044});case"clouds":return Object.assign(Object.assign({},n),{Fltr:{_name:"Clouds",_classID:"Clds",FlRs:e.filter.randomSeed},filterID:1131177075});case"difference clouds":return Object.assign(Object.assign({},n),{Fltr:{_name:"Difference Clouds",_classID:"DfrC",FlRs:e.filter.randomSeed},filterID:1147564611});case"fibers":return Object.assign(Object.assign({},n),{Fltr:{_name:"Fibers",_classID:"Fbrs",Vrnc:e.filter.variance,Strg:e.filter.strength,RndS:e.filter.randomSeed},filterID:1180856947});case"lens flare":return Object.assign(Object.assign({},n),{Fltr:{_name:"Lens Flare",_classID:"LnsF",Brgh:e.filter.brightness,FlrC:{_name:"",_classID:"Pnt ",Hrzn:e.filter.position.x,Vrtc:e.filter.position.y},"Lns ":ol.encode(e.filter.lensType)},filterID:1282306886});case"sharpen":return Object.assign(Object.assign({},n),{filterID:1399353968});case"sharpen edges":return Object.assign(Object.assign({},n),{filterID:1399353925});case"sharpen more":return Object.assign(Object.assign({},n),{filterID:1399353933});case"smart sharpen":return Object.assign(Object.assign({},n),{Fltr:{_name:"Smart Sharpen",_classID:"smartSharpen",Amnt:De(e.filter.amount),"Rds ":Ne(e.filter),Thsh:e.filter.threshold,Angl:e.filter.angle,moreAccurate:e.filter.moreAccurate,blur:il.encode(e.filter.blur),preset:e.filter.preset,sdwM:{_name:"Parameters",_classID:"adaptCorrectTones",Amnt:De(e.filter.shadow.fadeAmount),Wdth:De(e.filter.shadow.tonalWidth),"Rds ":e.filter.shadow.radius},hglM:{_name:"Parameters",_classID:"adaptCorrectTones",Amnt:De(e.filter.highlight.fadeAmount),Wdth:De(e.filter.highlight.tonalWidth),"Rds ":e.filter.highlight.radius}},filterID:698});case"unsharp mask":return Object.assign(Object.assign({},n),{Fltr:{_name:"Unsharp Mask",_classID:"UnsM",Amnt:De(e.filter.amount),"Rds ":Ne(e.filter),Thsh:e.filter.threshold},filterID:1433301837});case"diffuse":return Object.assign(Object.assign({},n),{Fltr:{_name:"Diffuse",_classID:"Dfs ","Md  ":sl.encode(e.filter.mode),FlRs:e.filter.randomSeed},filterID:1147564832});case"emboss":return Object.assign(Object.assign({},n),{Fltr:{_name:"Emboss",_classID:"Embs",Angl:e.filter.angle,Hght:e.filter.height,Amnt:e.filter.amount},filterID:1164796531});case"extrude":return Object.assign(Object.assign({},n),{Fltr:{_name:"Extrude",_classID:"Extr",ExtS:e.filter.size,ExtD:e.filter.depth,ExtF:e.filter.solidFrontFaces,ExtM:e.filter.maskIncompleteBlocks,ExtT:ll.encode(e.filter.type),ExtR:al.encode(e.filter.depthMode),FlRs:e.filter.randomSeed},filterID:1165522034});case"find edges":return Object.assign(Object.assign({},n),{filterID:1181639749});case"solarize":return Object.assign(Object.assign({},n),{filterID:1399616122});case"tiles":return Object.assign(Object.assign({},n),{Fltr:{_name:"Tiles",_classID:"Tls ",TlNm:e.filter.numberOfTiles,TlOf:e.filter.maximumOffset,FlCl:rl.encode(e.filter.fillEmptyAreaWith),FlRs:e.filter.randomSeed},filterID:1416393504});case"trace contour":return Object.assign(Object.assign({},n),{Fltr:{_name:"Trace Contour",_classID:"TrcC","Lvl ":e.filter.level,"Edg ":cl.encode(e.filter.edge)},filterID:1416782659});case"wind":return Object.assign(Object.assign({},n),{Fltr:{_name:"Wind",_classID:"Wnd ",WndM:fl.encode(e.filter.method),Drct:ul.encode(e.filter.direction)},filterID:1466852384});case"de-interlace":return Object.assign(Object.assign({},n),{Fltr:{_name:"De-Interlace",_classID:"Dntr",IntE:dl.encode(e.filter.eliminate),IntC:hl.encode(e.filter.newFieldsBy)},filterID:1148089458});case"ntsc colors":return Object.assign(Object.assign({},n),{filterID:1314149187});case"invert":return Object.assign(Object.assign({},n),{filterID:1231976050});
10case"custom":return Object.assign(Object.assign({},n),{Fltr:{_name:"Custom",_classID:"Cstm","Scl ":e.filter.scale,Ofst:e.filter.offset,Mtrx:e.filter.matrix},filterID:1131639917});case"high pass":return Object.assign(Object.assign({},n),{Fltr:{_name:"High Pass",_classID:"HghP","Rds ":Ne(e.filter)},filterID:1214736464});case"maximum":return Object.assign(Object.assign({},n),{Fltr:{_name:"Maximum",_classID:"Mxm ","Rds ":Ne(e.filter)},filterID:1299737888});case"minimum":return Object.assign(Object.assign({},n),{Fltr:{_name:"Minimum",_classID:"Mnm ","Rds ":Ne(e.filter)},filterID:1299082528});case"offset":return Object.assign(Object.assign({},n),{Fltr:{_name:"Offset",_classID:"Ofst",Hrzn:e.filter.horizontal,Vrtc:e.filter.vertical,"Fl  ":pl.encode(e.filter.undefinedAreas)},filterID:1332114292});case"puppet":return Object.assign(Object.assign({},n),{Fltr:{_name:"Rigid Transform",_classID:"rigidTransform",null:["Ordn.Trgt"],rigidType:e.filter.rigidType,puppetShapeList:e.filter.puppetShapeList.map(t=>({_name:"",_classID:"puppetShape",rigidType:t.rigidType,VrsM:1,VrsN:0,originalVertexArray:Zn(new Float32Array(Lt(t.originalVertexArray))),deformedVertexArray:Zn(new Float32Array(Lt(t.deformedVertexArray))),indexArray:Zn(new Uint32Array(t.indexArray)),pinOffsets:Lt(t.pinOffsets),posFinalPins:Lt(t.posFinalPins),pinVertexIndices:t.pinVertexIndices,PinP:Lt(t.pinPosition),PnRt:t.pinRotation,PnOv:t.pinOverlay,PnDp:t.pinDepth,meshQuality:t.meshQuality,meshExpansion:t.meshExpansion,meshRigidity:t.meshRigidity,imageResolution:t.imageResolution,meshBoundaryPath:{_name:"",_classID:"pathClass",pathComponents:t.meshBoundaryPath.pathComponents.map(o=>({_name:"",_classID:"PaCm",shapeOperation:`shapeOperation.${o.shapeOperation}`,SbpL:o.paths.map(i=>({_name:"",_classID:"Sbpl",Clsp:i.closed,"Pts ":i.points.map(s=>({_name:"",_classID:"Pthp",Anch:Pt(s.anchor),"Fwd ":Pt(s.forward),"Bwd ":Pt(s.backward),Smoo:s.smooth}))}))}))},selectedPin:t.selectedPin})),PuX0:e.filter.bounds[0].x,PuX1:e.filter.bounds[1].x,PuX2:e.filter.bounds[2].x,PuX3:e.filter.bounds[3].x,PuY0:e.filter.bounds[0].y,PuY1:e.filter.bounds[1].y,PuY2:e.filter.bounds[2].y,PuY3:e.filter.bounds[3].y},filterID:991});case"oil paint plugin":{const t={};for(let o=0;o<e.filter.parameters.length;o++){const{name:i,value:s}=e.filter.parameters[o],l=`${Oe[Math.floor(o/Oe.length)]}${Oe[o%Oe.length]}`;t[`PN${l}`]=i,t[`PT${l}`]=0,t[`PF${l}`]=s}return Object.assign(Object.assign({},n),{Fltr:Object.assign({_name:"Oil Paint Plugin",_classID:"PbPl",KnNm:e.filter.name,GpuY:e.filter.gpu,LIWy:e.filter.lighting,FPth:"1"},t),filterID:1348620396})}case"oil paint":return Object.assign(Object.assign({},n),{Fltr:{_name:"Oil Paint",_classID:"oilPaint",lightingOn:e.filter.lightingOn,stylization:e.filter.stylization,cleanliness:e.filter.cleanliness,brushScale:e.filter.brushScale,microBrush:e.filter.microBrush,LghD:e.filter.lightDirection,specularity:e.filter.specularity},filterID:1122});case"liquify":return Object.assign(Object.assign({},n),{Fltr:{_name:"Liquify",_classID:"LqFy",LqMe:e.filter.liquifyMesh},filterID:1282492025});case"perspective warp":return Object.assign(Object.assign({},n),{Fltr:{_name:"Perspective Warp",_classID:"perspectiveWarpTransform",vertices:e.filter.vertices.map(Pt),warpedVertices:e.filter.warpedVertices.map(Pt),quads:e.filter.quads.map(t=>({indices:t}))},filterID:442});case"curves":return Object.assign(Object.assign({},n),{Fltr:Object.assign({_name:"Curves",_classID:"Crvs",presetKind:ml.encode(e.filter.presetKind)},e.filter.adjustments?{Adjs:e.filter.adjustments.map(t=>"curve"in t?{_name:"",_classID:"CrvA",Chnl:t.channels.map(Gt.encode),"Crv ":t.curve.map(o=>Object.assign({_name:"",_classID:"Pnt ",Hrzn:o.x,Vrtc:o.y},o.curved?{Cnty:!0}:{}))}:{_name:"",_classID:"CrvA",Chnl:t.channels.map(Gt.encode),Mpng:t.values})}:{}),filterID:1131574899});case"brightness/contrast":return Object.assign(Object.assign({},n),{Fltr:{_name:"Brightness/Contrast",_classID:"BrgC",Brgh:e.filter.brightness,Cntr:e.filter.contrast,useLegacy:!!e.filter.useLegacy},filterID:1114793795});default:throw new Error(`Unknow filter type: ${e.type}`)}}function Ml(e){if(e.warp)return e.warp;if(!e.width||!e.height)throw new Error("You must provide width and height of the linked image in placedLayer");const n=e.width,t=e.height,o=0,i=n/3,s=n*2/3,l=n,a=0,r=t/3,c=t*2/3,f=t;return{style:"custom",value:0,perspective:0,perspectiveOther:0,rotate:"horizontal",bounds:{top:{value:0,units:"Pixels"},left:{value:0,units:"Pixels"},bottom:{value:t,units:"Pixels"},right:{value:n,units:"Pixels"}},uOrder:4,vOrder:4,customEnvelopeWarp:{meshPoints:[{x:o,y:a},{x:i,y:a},{x:s,y:a},{x:l,y:a},{x:o,y:r},{x:i,y:r},{x:s,y:r},{x:l,y:r},{x:o,y:c},{x:i,y:c},{x:s,y:c},{x:l,y:c},{x:o,y:f},{x:i,y:f},{x:s,y:f},{x:l,y:f}]}}}M("SoLd",ee("placedLayer"),(e,n,t)=>{if(ne(e)!=="soLD")throw new Error("Invalid SoLd type");const o=T(e);if(o!==4&&o!==5)throw new Error("Invalid SoLd version");const i=H(e,!0);n.placedLayer={id:i.Idnt,placed:i.placed,type:Ft[i.Type],pageNumber:i.PgNm,totalPages:i.totalPages,frameStep:ye(i.frameStep),duration:ye(i.duration),frameCount:i.frameCount,transform:i.Trnf,width:i["Sz  "].Wdth,height:i["Sz  "].Hght,resolution:Q(i.Rslt),warp:Tl(i.quiltWarp||i.warp)},i.nonAffineTransform&&i.nonAffineTransform.some((s,l)=>s!==i.Trnf[l])&&(n.placedLayer.nonAffineTransform=i.nonAffineTransform),i.Crop&&(n.placedLayer.crop=i.Crop),i.comp&&(n.placedLayer.comp=i.comp),i.compInfo&&(n.placedLayer.compInfo={compID:i.compInfo.compID,originalCompID:i.compInfo.originalCompID}
10),i.filterFX&&(n.placedLayer.filter=kc(i.filterFX,e)),E(e,t())},(e,n)=>{var t,o;N(e,"soLD"),G(e,4);const i=n.placedLayer;if(!i.id||typeof i.id!="string"||!/^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$/.test(i.id))throw new Error("Placed layer ID must be in a GUID format (example: 20953ddb-9391-11ec-b4f1-c15674f50bc4)");const s=Object.assign(Object.assign({Idnt:i.id,placed:(t=i.placed)!==null&&t!==void 0?t:i.id,PgNm:i.pageNumber||1,totalPages:i.totalPages||1},i.crop?{Crop:i.crop}:{}),{frameStep:i.frameStep||{numerator:0,denominator:600},duration:i.duration||{numerator:0,denominator:600},frameCount:i.frameCount||0,Annt:16,Type:Ft.indexOf(i.type),Trnf:i.transform,nonAffineTransform:(o=i.nonAffineTransform)!==null&&o!==void 0?o:i.transform,warp:wn(Ml(i)),"Sz  ":{_name:"",_classID:"Pnt ",Wdth:i.width||0,Hght:i.height||0},Rslt:i.resolution?oe(i.resolution,"resolution"):{units:"Density",value:72}});if(i.filter&&(s.filterFX={_name:"",_classID:"filterFXStyle",enab:i.filter.enabled,validAtPosition:i.filter.validAtPosition,filterMaskEnable:i.filter.maskEnabled,filterMaskLinked:i.filter.maskLinked,filterMaskExtendWithWhite:i.filter.maskExtendWithWhite,filterFXList:i.filter.list.map(l=>xc(l))}),i.warp&&vo(i.warp)){const l=wn(i.warp);s.quiltWarp=l,s.warp={warpStyle:"warpStyle.warpNone",warpValue:l.warpValue,warpPerspective:l.warpPerspective,warpPerspectiveOther:l.warpPerspectiveOther,warpRotate:l.warpRotate,bounds:l.bounds,uOrder:l.uOrder,vOrder:l.vOrder}}else delete s.quiltWarp;i.comp&&(s.comp=i.comp),i.compInfo&&(s.compInfo=i.compInfo),W(e,"","null",s,s.quiltWarp?"quiltWarp":"warp")});it("SoLE","SoLd");M("fxrp",ee("referencePoint"),(e,n)=>{n.referencePoint={x:Ee(e),y:Ee(e)}},(e,n)=>{Ge(e,n.referencePoint.x),Ge(e,n.referencePoint.y)});M("Lr16",()=>!1,(e,n,t,o,i)=>{go(e,o,i)},(e,n)=>{});M("Lr32",()=>!1,(e,n,t,o,i)=>{go(e,o,i)},(e,n)=>{});M("LMsk",ee("userMask"),(e,n)=>{if(n.userMask={colorSpace:de(e),opacity:I(e)/255},w(e)!==128)throw new Error("Invalid flag value");E(e,1)},(e,n)=>{const t=n.userMask;pe(e,t.colorSpace),C(e,ys(t.opacity,0,1)*255),P(e,128),Z(e,1)});M("Patt",e=>!!(e.patterns&&e.patterns.length>0),(e,n,t)=>{for(;t()>0;){const o=Qr(e);n.patterns===void 0&&(n.patterns=[]),n.patterns.push(o)}},(e,n,t,o)=>{const i=n.patterns||[];for(const s of i)Lc(e,s)});it("Pat2","Patt");it("Pat3","Patt");function Vi(e){const n=T(e),t=T(e),o=T(e),i=T(e);return{top:n,left:t,bottom:o,right:i}}function $i(e,n){G(e,n.top),G(e,n.left),G(e,n.bottom),G(e,n.right)}M("Anno",e=>e.annotations!==void 0,(e,n,t)=>{const o=I(e),i=I(e);if(o!==2||i!==1)throw new Error("Invalid Anno version");const s=F(e),l=[];for(let a=0;a<s;a++){F(e);const r=ne(e),c=!!w(e);w(e),I(e);const f=Vi(e),h=Vi(e),u=de(e),d=Qe(e,2),p=Qe(e,2),y=Qe(e,2);F(e),ne(e);const g=F(e);let m;if(r==="txtA")g>=2&&I(e)===65279?m=mo(e,(g-2)/2):(e.offset-=2,m=Mn(e,g)),m=m.replace(/\r/g,`
11`);else if(r==="sndA")m=re(e,g);else throw new Error("Unknown annotation type");l.push({type:r==="txtA"?"text":"sound",open:c,iconLocation:f,popupLocation:h,color:u,author:d,name:p,date:y,data:m})}n.annotations=l,E(e,t())},(e,n)=>{const t=n.annotations;C(e,2),C(e,1),O(e,t.length);for(const o of t){const i=o.type==="sound";if(i&&!(o.data instanceof Uint8Array))throw new Error("Sound annotation data should be Uint8Array");if(!i&&typeof o.data!="string")throw new Error("Text annotation data should be string");const s=e.offset;O(e,0),N(e,i?"sndA":"txtA"),P(e,o.open?1:0),P(e,28),C(e,1),$i(e,o.iconLocation),$i(e,o.popupLocation),pe(e,o.color),ut(e,o.author||"",2),ut(e,o.name||"",2),ut(e,o.date||"",2);const l=e.offset;O(e,0),N(e,i?"sndM":"txtC"),O(e,0);const a=e.offset;if(i)Ve(e,o.data);else{C(e,65279);const r=o.data.replace(/\n/g,"\r");for(let c=0;c<r.length;c++)C(e,r.charCodeAt(c))}e.view.setUint32(s,e.offset-s,!1),e.view.setUint32(l,e.offset-l,!1),e.view.setUint32(a-4,e.offset-a,!1)}});function Rl(e){M(e,n=>{const t=n;return!(!t.linkedFiles||!t.linkedFiles.length||e==="lnkE"&&!t.linkedFiles.some(o=>o.linkedFile))},(n,t,o,i)=>{const s=t;for(s.linkedFiles=s.linkedFiles||[];o()>8;){let l=Yn(n);const a=n.offset,r=ne(n),c=T(n),f=Qe(n,1),h=ue(n),u=ne(n).trim(),d=ne(n).trim(),p=Yn(n),g=w(n)?H(n):void 0,m=r==="liFE"?H(n):void 0,b={id:f,name:h};if(u&&(b.type=u),d&&(b.creator=d),g&&(b.descriptor={compInfo:{compID:g.compInfo.compID,originalCompID:g.compInfo.originalCompID}}),r==="liFE"&&c>3){const S=T(n),x=w(n),L=w(n),k=w(n),A=w(n),R=Ee(n),B=Math.floor(R),U=(R-B)*1e3;b.time=new Date(Date.UTC(S,x,L,k,A,B,U)).toISOString()}const v=r==="liFE"?Yn(n):0;for(r==="liFA"&&E(n,8),r==="liFD"&&(b.data=re(n,p)),c>=5&&(b.childDocumentID=ue(n)),c>=6&&(b.assetModTime=Ee(n)),c>=7&&(b.assetLockedState=w(n)),r==="liFE"&&c===2&&(b.data=re(n,v)),n.skipLinkedFilesData&&(b.data=void 0),e==="lnkE"&&(b.linkedFile={fileSize:v,name:m?.["Nm  "]||"",fullPath:m?.fullPath||"",originalPath:m?.originalPath||"",relativePath:m?.relPath||""}),s.linkedFiles.push(b);l%4;)l++;n.offset=a+l}E(n,o())},(n,t)=>{var o,i,s,l,a,r,c,f,h;const u=t;for(const d of u.linkedFiles){if(e==="lnkE"!=!!d.linkedFile)continue;let p=2;d.assetLockedState!=null?p=7:d.assetModTime!=null?p=6:d.childDocumentID!=null?p=5:e==="lnkE"&&(p=3),qn(n,0);const y=n.offset;if(N(n,e==="lnkE"?"liFE":d.data?"liFD":"liFA"),G(n,p),!d.id||typeof d.id!="string"||!/^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$/.test(d.id))throw new Error("Linked file ID must be in a GUID format (example: 20953ddb-9391-11ec-b4f1-c15674f50bc4)");if(ut(n,d.id,1),ht(n,d.name||""),N(n,d.type?`${d.type}    `.substring(0,4):"    "),N(n,d.creator?`${d.creator}    `.substring(0,4):"\0\0\0\0"),qn(n,d.data?d.data.byteLength:0),d.descriptor&&d.descriptor.compInfo){const m={compInfo:{compID:d.descriptor.compInfo.compID,originalCompID:d.descriptor.compInfo.originalCompID}};P(n,1),W(n,"","null",m)}else P(n,0);if(e==="lnkE"){const m={descVersion:2,"Nm  ":(i=(o=d.linkedFile)===null||o===void 0?void 0:o.name)!==null&&i!==void 0?i:"",fullPath:(l=(s=d.linkedFile)===null||s===void 0?void 0:s.fullPath)!==null&&l!==void 0?l:"",originalPath:(r=(a=d.linkedFile)===null||a===void 0?void 0:a.originalPath)!==null&&r!==void 0?r:"",relPath:(f=(c=d.linkedFile)===null||c===void 0?void 0:c.relativePath)!==null&&f!==void 0?f:""};W(n,"","ExternalFileLink",m);const b=d.time?new Date(d.time):new Date;G(n,b.getUTCFullYear()),P(n,b.getUTCMonth()),P(n,b.getUTCDate()),P(n,b.getUTCHours()),P(n,b.getUTCMinutes()),Ge(n,b.getUTCSeconds()+b.getUTCMilliseconds()/1e3)}d.data?Ve(n,d.data):qn(n,((h=d.linkedFile)===null||h===void 0?void 0:h.fileSize)||0),p>=5&&ht(n,d.childDocumentID||""),p>=6&&Ge(n,d.assetModTime||0),p>=7&&P(n,d.assetLockedState||0);let g=n.offset-y;for(n.view.setUint32(y-4,g,!1);g%4;)g++,P(n,0)}})}Rl("lnk2");Rl("lnkE");it("lnkD","lnk2");it("lnk3","lnk2");M("pths",ee("pathList"),(e,n)=>{H(e,!0),n.pathList=[]},(e,n)=>{W(e,"","pathsDataClass",{pathList:[]})});M("lyvr",ee("version"),(e,n)=>n.version=F(e),(e,n)=>O(e,n.version));M("lfxs",()=>!1,(e,n,t)=>{if(F(e)!==0)throw new Error("Invalid lfxs version");const i=H(e);
11n.effects=Wt(i,!!e.logMissingFeatures),E(e,t())},(e,n,t,o)=>{const i=Ht(n.effects,!!o.logMissingFeatures,!0);O(e,0),W(e,"","null",i)});function be(e){return n=>!!n.adjustment&&n.adjustment.type===e}M("brit",be("brightness/contrast"),(e,n,t)=>{n.adjustment||(n.adjustment={type:"brightness/contrast",brightness:$(e),contrast:$(e),meanValue:$(e),labColorOnly:!!w(e),useLegacy:!0}),E(e,t())},(e,n)=>{var t;const o=n.adjustment;K(e,o.brightness||0),K(e,o.contrast||0),K(e,(t=o.meanValue)!==null&&t!==void 0?t:127),P(e,o.labColorOnly?1:0),Z(e,1)});function gn(e){const n=$(e),t=$(e),o=$(e),i=$(e),s=$(e)/100;return{shadowInput:n,highlightInput:t,shadowOutput:o,highlightOutput:i,midtoneInput:s}}function At(e,n){K(e,n.shadowInput),K(e,n.highlightInput),K(e,n.shadowOutput),K(e,n.highlightOutput),K(e,Math.round(n.midtoneInput*100))}M("levl",be("levels"),(e,n,t)=>{if(I(e)!==2)throw new Error("Invalid levl version");n.adjustment=Object.assign(Object.assign({},n.adjustment),{type:"levels",rgb:gn(e),red:gn(e),green:gn(e),blue:gn(e)}),E(e,t())},(e,n)=>{const t=n.adjustment,o={shadowInput:0,highlightInput:255,shadowOutput:0,highlightOutput:255,midtoneInput:1};C(e,2),At(e,t.rgb||o),At(e,t.red||o),At(e,t.blue||o),At(e,t.green||o);for(let i=0;i<59;i++)At(e,o)});function bn(e){const n=I(e),t=[];for(let o=0;o<n;o++){const i=$(e),s=$(e);t.push({input:s,output:i})}return t}function tt(e,n){C(e,n.length);for(const t of n)C(e,t.output),C(e,t.input)}M("curv",be("curves"),(e,n,t)=>{if(w(e),I(e)!==1)throw new Error("Invalid curv version");I(e);const o=I(e),i={type:"curves"};o&1&&(i.rgb=bn(e)),o&2&&(i.red=bn(e)),o&4&&(i.green=bn(e)),o&8&&(i.blue=bn(e)),n.adjustment=Object.assign(Object.assign({}
11,n.adjustment),i),E(e,t())},(e,n)=>{const t=n.adjustment,{rgb:o,red:i,green:s,blue:l}=t;let a=0,r=0;o&&o.length&&(a|=1,r++),i&&i.length&&(a|=2,r++),s&&s.length&&(a|=4,r++),l&&l.length&&(a|=8,r++),P(e,0),C(e,1),C(e,0),C(e,a),o&&o.length&&tt(e,o),i&&i.length&&tt(e,i),s&&s.length&&tt(e,s),l&&l.length&&tt(e,l),N(e,"Crv "),C(e,4),C(e,0),C(e,r),o&&o.length&&(C(e,0),tt(e,o)),i&&i.length&&(C(e,1),tt(e,i)),s&&s.length&&(C(e,2),tt(e,s)),l&&l.length&&(C(e,3),tt(e,l))});M("expA",be("exposure"),(e,n,t)=>{if(I(e)!==1)throw new Error("Invalid expA version");n.adjustment=Object.assign(Object.assign({},n.adjustment),{type:"exposure",exposure:Me(e),offset:Me(e),gamma:Me(e)}),E(e,t())},(e,n)=>{const t=n.adjustment;C(e,1),Re(e,t.exposure),Re(e,t.offset),Re(e,t.gamma),Z(e,2)});M("vibA",be("vibrance"),(e,n,t)=>{const o=H(e);n.adjustment={type:"vibrance"},o.vibrance!==void 0&&(n.adjustment.vibrance=o.vibrance),o.Strt!==void 0&&(n.adjustment.saturation=o.Strt),E(e,t())},(e,n)=>{const t=n.adjustment,o={};t.vibrance!==void 0&&(o.vibrance=t.vibrance),t.saturation!==void 0&&(o.Strt=t.saturation),W(e,"","null",o)});function lt(e){return{a:$(e),b:$(e),c:$(e),d:$(e),hue:$(e),saturation:$(e),lightness:$(e)}}function at(e,n){const t=n||{};K(e,t.a||0),K(e,t.b||0),K(e,t.c||0),K(e,t.d||0),K(e,t.hue||0),K(e,t.saturation||0),K(e,t.lightness||0)}M("hue2",be("hue/saturation"),(e,n,t)=>{if(I(e)!==2)throw new Error("Invalid hue2 version");n.adjustment=Object.assign(Object.assign({},n.adjustment),{type:"hue/saturation",master:lt(e),reds:lt(e),yellows:lt(e),greens:lt(e),cyans:lt(e),blues:lt(e),magentas:lt(e)}),E(e,t())},(e,n)=>{const t=n.adjustment;C(e,2),at(e,t.master),at(e,t.reds),at(e,t.yellows),at(e,t.greens),at(e,t.cyans),at(e,t.blues),at(e,t.magentas)});function Jn(e){return{cyanRed:$(e),magentaGreen:$(e),yellowBlue:$(e)}}function Qn(e,n){K(e,n.cyanRed||0),K(e,n.magentaGreen||0),K(e,n.yellowBlue||0)}M("blnc",be("color balance"),(e,n,t)=>{n.adjustment={type:"color balance",shadows:Jn(e),midtones:Jn(e),highlights:Jn(e),preserveLuminosity:!!w(e)}
11,E(e,t())},(e,n)=>{const t=n.adjustment;Qn(e,t.shadows||{}),Qn(e,t.midtones||{}),Qn(e,t.highlights||{}),P(e,t.preserveLuminosity?1:0),Z(e,1)});M("blwh",be("black & white"),(e,n,t)=>{const o=H(e);n.adjustment={type:"black & white",reds:o["Rd  "],yellows:o.Yllw,greens:o["Grn "],cyans:o["Cyn "],blues:o["Bl  "],magentas:o.Mgnt,useTint:!!o.useTint,presetKind:o.bwPresetKind,presetFileName:o.blackAndWhitePresetFileName},o.tintColor!==void 0&&(n.adjustment.tintColor=_e(o.tintColor)),E(e,t())},(e,n)=>{const t=n.adjustment,o={"Rd  ":t.reds||0,Yllw:t.yellows||0,"Grn ":t.greens||0,"Cyn ":t.cyans||0,"Bl  ":t.blues||0,Mgnt:t.magentas||0,useTint:!!t.useTint,tintColor:je(t.tintColor),bwPresetKind:t.presetKind||0,blackAndWhitePresetFileName:t.presetFileName||""};W(e,"","null",o)});M("phfl",be("photo filter"),(e,n,t)=>{const o=I(e);if(o!==2&&o!==3)throw new Error("Invalid phfl version");let i;o===2?i=de(e):i={l:T(e)/100,a:T(e)/100,b:T(e)/100},n.adjustment={type:"photo filter",color:i,density:F(e)/100,preserveLuminosity:!!w(e)},E(e,t())},(e,n)=>{const t=n.adjustment;C(e,2),pe(e,t.color||{l:0,a:0,b:0}),O(e,(t.density||0)*100),P(e,t.preserveLuminosity?1:0),Z(e,3)});function yn(e){const n=$(e),t=$(e),o=$(e);E(e,2);const i=$(e);return{red:n,green:t,blue:o,constant:i}}function Tt(e,n){const t=n||{};K(e,t.red),K(e,t.green),K(e,t.blue),Z(e,2),K(e,t.constant)}M("mixr",be("channel mixer"),(e,n,t)=>{if(I(e)!==1)throw new Error("Invalid mixr version");const o=n.adjustment=Object.assign(Object.assign({},n.adjustment),{type:"channel mixer",monochrome:!!I(e)});o.monochrome||(o.red=yn(e),o.green=yn(e),o.blue=yn(e)),o.gray=yn(e),E(e,t())},(e,n)=>{const t=n.adjustment;C(e,1),C(e,t.monochrome?1:0),t.monochrome?(Tt(e,t.gray),Z(e,3*5*2)):(Tt(e,t.red),Tt(e,t.green),Tt(e,t.blue),Tt(e,t.gray))});const Hi=j("colorLookupType","3DLUT",{"3dlut":"3DLUT",abstractProfile:"abstractProfile",deviceLinkProfile:"deviceLinkProfile"}),Wi=j("LUTFormatType","look",{look:"LUTFormatLOOK",cube:"LUTFormatCUBE","3dl":"LUTFormat3DL"}),Sn=j("colorLookupOrder","rgb",{rgb:"rgbOrder",bgr:"bgrOrder"});M("clrL",be("color lookup"),(e,n,t)=>{if(I(e)!==1)throw new Error("Invalid clrL version");const o=H(e);n.adjustment={type:"color lookup"};const i=n.adjustment;o.lookupType!==void 0&&(i.lookupType=Hi.decode(o.lookupType)),o["Nm  "]!==void 0&&(i.name=o["Nm  "]),o.Dthr!==void 0&&(i.dither=o.Dthr),o.profile!==void 0&&(i.profile=o.profile),o.LUTFormat!==void 0&&(i.lutFormat=Wi.decode(o.LUTFormat)),o.dataOrder!==void 0&&(i.dataOrder=Sn.decode(o.dataOrder)),o.tableOrder!==void 0&&(i.tableOrder=Sn.decode(o.tableOrder)),o.LUT3DFileData!==void 0&&(i.lut3DFileData=o.LUT3DFileData),o.LUT3DFileName!==void 0&&(i.lut3DFileName=o.LUT3DFileName),E(e,t())},(e,n)=>{const t=n.adjustment,o={};t.lookupType!==void 0&&(o.lookupType=Hi.encode(t.lookupType)),t.name!==void 0&&(o["Nm  "]=t.name),t.dither!==void 0&&(o.Dthr=t.dither),t.profile!==void 0&&(o.profile=t.profile),t.lutFormat!==void 0&&(o.LUTFormat=Wi.encode(t.lutFormat)),t.dataOrder!==void 0&&(o.dataOrder=Sn.encode(t.dataOrder)),t.tableOrder!==void 0&&(o.tableOrder=Sn.encode(t.tableOrder)),t.lut3DFileData!==void 0&&(o.LUT3DFileData=t.lut3DFileData),t.lut3DFileName!==void 0&&(o.LUT3DFileName=t.lut3DFileName),C(e,1),W(e,"","null",o)});M("nvrt",be("invert"),(e,n,t)=>{n.adjustment={type:"invert"},E(e,t())},()=>{});M("post",be("posterize"),(e,n,t)=>{n.adjustment={type:"posterize",levels:I(e)}
11,E(e,t())},(e,n)=>{var t;const o=n.adjustment;C(e,(t=o.levels)!==null&&t!==void 0?t:4),Z(e,2)});M("thrs",be("threshold"),(e,n,t)=>{n.adjustment={type:"threshold",level:I(e)},E(e,t())},(e,n)=>{var t;const o=n.adjustment;C(e,(t=o.level)!==null&&t!==void 0?t:128),Z(e,2)});const Xi=["","","","rgb","hsb","","lab"];M("grdm",be("gradient map"),(e,n,t)=>{const o=I(e);if(o!==1&&o!==3)throw new Error("Invalid grdm version");const i={type:"gradient map",gradientType:"solid"};i.reverse=!!w(e),i.dither=!!w(e);const s=!!w(e);if(e.offset--,s){const h=ne(e);i.method=Dt.decode(h)}i.name=ue(e),i.colorStops=[],i.opacityStops=[];const l=I(e);for(let h=0;h<l;h++)i.colorStops.push({location:F(e),midpoint:F(e)/100,color:de(e)}),E(e,2);const a=I(e);for(let h=0;h<a;h++)i.opacityStops.push({location:F(e),midpoint:F(e)/100,opacity:I(e)/255});if(I(e)!==2)throw new Error("Invalid grdm expansion count");const c=I(e);if(i.smoothness=c/4096,I(e)!==32)throw new Error("Invalid grdm length");i.gradientType=I(e)?"noise":"solid",i.randomSeed=F(e),i.addTransparency=!!I(e),i.restrictColors=!!I(e),i.roughness=F(e)/4096,i.colorModel=Xi[I(e)]||"rgb",i.min=[I(e)/32768,I(e)/32768,I(e)/32768,I(e)/32768],i.max=[I(e)/32768,I(e)/32768,I(e)/32768,I(e)/32768],E(e,t());for(const h of i.colorStops)h.location/=c;for(const h of i.opacityStops)h.location/=c;n.adjustment=i},(e,n)=>{var t,o,i;const s=n.adjustment;C(e,s.method!==void 0?3:1),P(e,s.reverse?1:0),P(e,s.dither?1:0),s.method!==void 0&&N(e,Dt.encode(s.method)),ht(e,s.name||""),C(e,s.colorStops&&s.colorStops.length||0);const l=Math.round(((t=s.smoothness)!==null&&t!==void 0?t:1)*4096);for(const r of s.colorStops||[])O(e,Math.round(r.location*l)),O(e,Math.round(r.midpoint*100)),pe(e,r.color),Z(e,2);C(e,s.opacityStops&&s.opacityStops.length||0);for(const r of s.opacityStops||[])O(e,Math.round(r.location*l)),O(e,Math.round(r.midpoint*100)),C(e,Math.round(r.opacity*255));C(e,2),C(e,l),C(e,32),C(e,s.gradientType==="noise"?1:0),O(e,s.randomSeed||0),C(e,s.addTransparency?1:0),C(e,s.restrictColors?1:0),O(e,Math.round(((o=s.roughness)!==null&&o!==void 0?o:1)*4096));const a=Xi.indexOf((i=s.colorModel)!==null&&i!==void 0?i:"rgb");C(e,a===-1?3:a);for(let r=0;r<4;r++)C(e,Math.round((s.min&&s.min[r]||0)*32768));for(let r=0;r<4;r++)C(e,Math.round((s.max&&s.max[r]||0)*32768));Z(e,4)});function Xe(e){return{c:$(e),m:$(e),y:$(e),k:$(e)}}function Ke(e,n){const t=n||{};K(e,t.c),K(e,t.m),K(e,t.y),K(e,t.k)}M("selc",be("selective color"),(e,n)=>{if(I(e)!==1)throw new Error("Invalid selc version");const t=I(e)?"absolute":"relative";E(e,8),n.adjustment={type:"selective color",mode:t,reds:Xe(e),yellows:Xe(e),greens:Xe(e),cyans:Xe(e),blues:Xe(e),magentas:Xe(e),whites:Xe(e),neutrals:Xe(e),blacks:Xe(e)}},(e,n)=>{const t=n.adjustment;C(e,1),C(e,t.mode==="absolute"?1:0),Z(e,8),Ke(e,t.reds),Ke(e,t.yellows),Ke(e,t.greens),Ke(e,t.cyans),Ke(e,t.blues),Ke(e,t.magentas),Ke(e,t.whites),Ke(e,t.neutrals),Ke(e,t.blacks)});M("CgEd",e=>{const n=e.adjustment;return n?n.type==="brightness/contrast"&&!n.useLegacy||(n.type==="levels"||n.type==="curves"||n.type==="exposure"||n.type==="channel mixer"||n.type==="hue/saturation")&&n.presetFileName!==void 0:!1},(e,n,t)=>{const o=H(e);if(o.Vrsn!==1)throw new Error("Invalid CgEd version");"presetFileName"in o?n.adjustment=Object.assign(Object.assign({},n.adjustment),{presetKind:o.presetKind,presetFileName:o.presetFileName}):"curvesPresetFileName"in o?n.adjustment=Object.assign(Object.assign({},n.adjustment),{presetKind:o.curvesPresetKind,presetFileName:o.curvesPresetFileName}):"mixerPresetFileName"in o?n.adjustment=Object.assign(Object.assign({},n.adjustment),{presetKind:o.mixerPresetKind,presetFileName:o.mixerPresetFileName}):n.adjustment={type:"brightness/contrast",brightness:o.Brgh,contrast:o.Cntr,meanValue:o.means,useLegacy:!!o.useLegacy,labColorOnly:!!o["Lab "],auto:!!o.Auto},E(e,t())},(e,n)=>{var t,o,i,s;const l=n.adjustment;if(l.type==="levels"||l.type==="exposure"||l.type==="hue/saturation"){const a={Vrsn:1,presetKind:(t=l.presetKind)!==null&&t!==void 0?t:1,presetFileName:l.presetFileName||""};W(e,"","null",a)}else if(l.type==="curves"){const a={Vrsn:1,curvesPresetKind:(o=l.presetKind)!==null&&o!==void 0?o:1,curvesPresetFileName:l.presetFileName||""};W(e,"","null",a)}else if(l.type==="channel mixer"){const a={Vrsn:1,mixerPresetKind:(i=l.presetKind)!==null&&i!==void 0?i:1,mixerPresetFileName:l.presetFileName||""};W(e,"","null",a)}else if(l.type==="brightness/contrast"){const a={Vrsn:1,Brgh:l.brightness||0,Cntr:l.contrast||0,means:(s=l.meanValue)!==null&&s!==void 0?s:127,"Lab ":!!l.labColorOnly,useLegacy:!!l.useLegacy,Auto:!!l.auto};W(e,"","null",a)}else throw new Error("Unhandled CgEd case")});function Fc(e){const n=[];function t(o){var i;if(o.children)for(const s of o.children)((i=s.text)===null||i===void 0?void 0:i.index)!==void 0&&(n[s.text.index]=s),t(s)}return t(e),n}M("Txt2",ee("engineData"),(e,n,t,o)=>{const i=re(e,t());n.engineData=dr(i);const s=Fc(o),l=Cl(i),r=pc(l).ResourceDict.TextFrameSet;if(r)for(let c=0;c<r.length;c++){const f=s[c];r[c].path&&f?.text&&(f.text.textPath=r[c].path)}},(e,n)=>{const t=Ss(n.engineData);Ve(e,t)});M("FEid",ee("filterEffectsMasks"),(e,n,t)=>{const o=T(e);if(o<1||o>3)throw new Error(`Invalid filterEffects version ${o}`);for(n.filterEffectsMasks=[];t()>8;){if(F(e))throw new Error("filterEffects: 64 bit length is not supported");const i=F(e),s=e.offset+i,l=Qe(e,1),a=T(e);if(a!==1)throw new Error(`Invalid filterEffect version ${a}`);if(F(e))throw new Error("filterEffect: 64 bit length is not supported");F(e);const r=T(e),c=T(e),f=T(e),h=T(e),u=T(e),d=T(e),p=[];for(let g=0;g<d+2;g++)if(T(e)){if(F(e))throw new Error("filterEffect: 64 bit length is not supported");const b=F(e);if(!b)throw new Error("filterEffect: Empty channel");const v=I(e),S=re(e,b-2);p.push({compressionMode:v,data:S})}else p.push(void 0);if(n.filterEffectsMasks.push({id:l,top:r,left:c,bottom:f,right:h,depth:u,channels:p}),e.offset<s&&w(e)){const g=T(e),m=T(e),b=T(e),v=T(e);if(F(e))throw new Error("filterEffect: 64 bit length is not supported");const S=F(e),x=I(e),L=re(e,S-2);n.filterEffectsMasks[n.filterEffectsMasks.length-1].extra={top:g,left:m,bottom:b,right:v,compressionMode:x,data:L}}e.offset=s;let y=i;for(;y%4;)e.offset++,y++}},(e,n)=>{var t;G(e,3);for(const o of n.filterEffectsMasks){O(e,0),O(e,0);const i=e.offset;ut(e,o.id,1),G(e,1),O(e,0),O(e,0);const s=e.offset;G(e,o.top),G(e,o.left),G(e,o.bottom),G(e,o.right),G(e,o.depth);const l=Math.max(0,o.channels.length-2);G(e,l);for(let c=0;c<l+2;c++){const f=o.channels[c];G(e,f?1:0),f&&(O(e,0),O(e,f.data.length+2),C(e,f.compressionMode),Ve(e,f.data))}e.view.setUint32(s-4,e.offset-s,!1);const a=(t=n.filterEffectsMasks[n.filterEffectsMasks.length-1])===null||t===void 0?void 0:t.extra;a&&(P(e,1),G(e,a.top),G(e,a.left),G(e,a.bottom),G(e,a.right),O(e,0),O(e,a.data.byteLength+2),C(e,a.compressionMode),Ve(e,a.data));let r=e.offset-i;for(e.view.setUint32(i-4,r,!1);r%4;)Z(e,1),r++}});it("FXid","FEid");M("FMsk",ee("filterMask"),(e,n)=>{n.filterMask={colorSpace:de(e),opacity:I(e)/255}},(e,n)=>{var t;pe(e,n.filterMask.colorSpace),C(e,ys((t=n.filterMask.opacity)!==null&&t!==void 0?t:1,0,1)*255)});M("artd",e=>e.artboards!==void 0,(e,n,t)=>{const o=H(e);n.artboards={count:o["Cnt "],autoExpandOffset:{horizontal:o.autoExpandOffset.Hrzn,vertical:o.autoExpandOffset.Vrtc},origin:{horizontal:o.origin.Hrzn,vertical:o.origin.Vrtc},autoExpandEnabled:o.autoExpandEnabled,autoNestEnabled:o.autoNestEnabled,autoPositionEnabled:o.autoPositionEnabled,shrinkwrapOnSaveEnabled:!!o.shrinkwrapOnSaveEnabled,docDefaultNewArtboardBackgroun
11dColor:_e(o.docDefaultNewArtboardBackgroundColor),docDefaultNewArtboardBackgroundType:o.docDefaultNewArtboardBackgroundType},E(e,t())},(e,n)=>{var t,o,i,s,l;const a=n.artboards,r={"Cnt ":a.count,autoExpandOffset:a.autoExpandOffset?{Hrzn:a.autoExpandOffset.horizontal,Vrtc:a.autoExpandOffset.vertical}:{Hrzn:0,Vrtc:0},origin:a.origin?{Hrzn:a.origin.horizontal,Vrtc:a.origin.vertical}:{Hrzn:0,Vrtc:0},autoExpandEnabled:(t=a.autoExpandEnabled)!==null&&t!==void 0?t:!0,autoNestEnabled:(o=a.autoNestEnabled)!==null&&o!==void 0?o:!0,autoPositionEnabled:(i=a.autoPositionEnabled)!==null&&i!==void 0?i:!0,shrinkwrapOnSaveEnabled:(s=a.shrinkwrapOnSaveEnabled)!==null&&s!==void 0?s:!0,docDefaultNewArtboardBackgroundColor:je(a.docDefaultNewArtboardBackgroundColor),docDefaultNewArtboardBackgroundType:(l=a.docDefaultNewArtboardBackgroundType)!==null&&l!==void 0?l:1};W(e,"","null",r,"artd")});function _l(e){return Object.keys(e).map(n=>e[n]).some(n=>Array.isArray(n)&&n.length>1)}M("lfx2",e=>e.effects!==void 0&&!_l(e.effects),(e,n,t)=>{if(F(e)!==0)throw new Error("Invalid lfx2 version");const i=H(e);
11n.effects=Wt(i,!!e.logMissingFeatures),E(e,t())},(e,n,t,o)=>{const i=Ht(n.effects,!!o.logMissingFeatures,!0);O(e,0),W(e,"","null",i)});M("cinf",ee("compositorUsed"),(e,n,t)=>{const o=H(e);function i(s){return s.split(".")[1]}n.compositorUsed={description:o.description,reason:o.reason,engine:i(o.Engn)},o.Vrsn&&(n.compositorUsed.version=o.Vrsn),o.psVersion&&(n.compositorUsed.photoshopVersion=o.psVersion),o.enableCompCore&&(n.compositorUsed.enableCompCore=i(o.enableCompCore)),o.enableCompCoreGPU&&(n.compositorUsed.enableCompCoreGPU=i(o.enableCompCoreGPU)),o.enableCompCoreThreads&&(n.compositorUsed.enableCompCoreThreads=i(o.enableCompCoreThreads)),o.compCoreSupport&&(n.compositorUsed.compCoreSupport=i(o.compCoreSupport)),o.compCoreGPUSupport&&(n.compositorUsed.compCoreGPUSupport=i(o.compCoreGPUSupport)),E(e,t())},(e,n)=>{const t=n.compositorUsed,o={Vrsn:t.version||{major:1,minor:0,fix:0}};t.photoshopVersion&&(o.psVersion=t.photoshopVersion),o.description=t.description,o.reason=t.reason,o.Engn=`Engn.${t.engine}`,t.enableCompCore&&(o.enableCompCore=`enable.${t.enableCompCore}`),t.enableCompCoreGPU&&(o.enableCompCoreGPU=`enable.${t.enableCompCoreGPU}`),t.enableCompCoreThreads&&(o.enableCompCoreThreads=`enable.${t.enableCompCoreThreads}`),t.compCoreSupport&&(o.compCoreSupport=`reason.${t.compCoreSupport}`),t.compCoreGPUSupport&&(o.compCoreGPUSupport=`reason.${t.compCoreGPUSupport}`),W(e,"","null",o)});M("extn",e=>e._extn!==void 0,(e,n)=>{H(e)},(e,n)=>{});M("iOpa",ee("fillOpacity"),(e,n)=>{n.fillOpacity=w(e)/255,E(e,3)},(e,n)=>{P(e,n.fillOpacity*255),Z(e,3)});M("brst",ee("channelBlendingRestrictions"),(e,n,t)=>{for(n.channelBlendingRestrictions=[];t()>4;)n.channelBlendingRestrictions.push(T(e))},(e,n)=>{for(const t of n.channelBlendingRestrictions)G(e,t)});M("tsly",ee("transparencyShapesLayer"),(e,n)=>{n.transparencyShapesLayer=!!w(e),E(e,3)},(e,n)=>{P(e,n.transparencyShapesLayer?1:0),Z(e,3)});function P(e,n){const t=et(e,1);e.view.setUint8(t,n)}function K(e,n){const t=et(e,2);e.view.setInt16(t,n,!1)}function C(e,n){const t=et(e,2);e.view.setUint16(t,n,!1)}function Oc(e,n){const t=et(e,2);e.view.setUint16(t,n,!0)}function G(e,n){const t=et(e,4);e.view.setInt32(t,n,!1)}function Ki(e,n){const t=et(e,4);e.view.setInt32(t,n,!0)}function O(e,n){const t=et(e,4);e.view.setUint32(t,n,!1)}function Re(e,n){const t=et(e,4);e.view.setFloat32(t,n,!1)}function Ge(e,n){const t=et(e,8);e.view.setFloat64(t,n,!1)}function Ce(e,n){G(e,n*65536)}function Te(e,n){G(e,n*(1<<24))}function Ve(e,n){n&&(jl(e,e.offset+n.length),new Uint8Array(e.buffer).set(n,e.offset),e.offset+=n.length)}function Z(e,n){for(let t=0;t<n;t++)P(e,0)}function N(e,n){if(n.length!==4)throw new Error(`Invalid signature: '${n}'`);for(let t=0;t<4;t++)P(e,n.charCodeAt(t))}function Cc(e,n){for(let t=0;t<n.length;t++)P(e,n.charCodeAt(t))}function ut(e,n,t){let o=n.length;if(o>255)throw new Error("String too long");P(e,o);for(let i=0;i<o;i++){const s=n.charCodeAt(i);P(e,s<128?s:63)}for(;++o%t;)P(e,0)}function Ic(e,n){for(let t=0;t<n.length;t++)C(e,n.charCodeAt(t))}function Dc(e,n){for(let t=0;t<n.length;t++)Oc(e,n.charCodeAt(t))}function Se(e,n){O(e,n.length),Ic(e,n)}function ht(e,n){O(e,n.length+1);for(let t=0;t<n.length;t++)C(e,n.charCodeAt(t));C(e,0)}function ct(e,n,t,o=!1,i=!1){i&&O(e,0);const s=e.offset;O(e,0),t();let l=e.offset-s-4,a=l;for(;a%n;)P(e,0),a++;o&&(l=a),e.view.setUint32(s,l,!1)}function wc(e,n){let t=e.buffer.byteLength;do t*=2;while(n>t);const o=new ArrayBuffer(t),i=new Uint8Array(o),s=new Uint8Array(e.buffer);i.set(s),e.buffer=o,e.view=new DataView(e.buffer)}function jl(e,n){n>e.buffer.byteLength&&wc(e,n)}function et(e,n){const t=e.offset;return jl(e,e.offset+=n),t}function pe(e,n){n?"r"in n?(C(e,0),C(e,Math.round(n.r*257)),C(e,Math.round(n.g*257)),C(e,Math.round(n.b*257)),C(e,0)):"fr"in n?(C(e,0),C(e,Math.round(n.fr*255*257)),C(e,Math.round(n.fg*255*257)),C(e,Math.round(n.fb*255*257)),C(e,0)):"l"in n?(C(e,7),K(e,Math.round(n.l*1e4)),K(e,Math.round(n.a<0?n.a*12800:n.a*12700)),K(e,Math.round(n.b<0?n.b*12800:n.b*12700)),C(e,0)):"h"in n?(C(e,1),C(e,Math.round(n.h*65535)),C(e,Math.round(n.s*65535)),C(e,Math.round(n.b*65535)),C(e,0)):"c"in n?(C(e,2),C(e,Math.round(n.c*257)),C(e,Math.round(n.m*257)),C(e,Math.round(n.y*257)),C(e,Math.round(n.k*257))):(C(e,8),C(e,Math.round(n.k*1e4/255)),Z(e,6)):(C(e,0),Z(e,8))}function Lc(e,n){const t=n.bounds.w,o=n.bounds.h,i={width:t,height:o,data:n.data};O(e,0);const s=e.offset;O(e,1),O(e,3),K(e,n.x),K(e,n.y),Se(e,n.name+"\0"),ut(e,n.id,1),O(e,3),O(e,0);const l=e.offset,a=n.bounds.y,r=n.bounds.x,c=a+o,f=r+t;O(e,a),O(e,r),O(e,c),O(e,f),O(e,24);for(let d=0;d<26;d++){const p=d<3?d:d===25?3:-1;if(p<0){O(e,0);continue}const y=new Uint8Array(t*o+2*o+2*t+16),g=fr(y,i,[p]);O(e,1),O(e,g.length+4+16+2+1),O(e,8),O(e,a),O(e,r),O(e,c),O(e,f),C(e,8),P(e,1),Ve(e,g)}const h=e.offset-l;let u=e.offset-s;for(;u%4;)Z(e,1),u++;e.view.setUint32(l-4,h,!1),e.view.setUint32(s-4,u,!1)}var Yi;(function(e){e[e.Bitmap=0]="Bitmap",e[e.Grayscale=1]="Grayscale",e[e.Indexed=2]="Indexed",e[e.RGB=3]="RGB",e[e.CMYK=4]="CMYK",e[e.Multichannel=7]="Multichannel",e[e.Duotone=8]="Duotone",e[e.Lab=9]="Lab"}
11)(Yi||(Yi={}));var qi;(function(e){e[e.Other=0]="Other",e[e.OpenFolder=1]="OpenFolder",e[e.ClosedFolder=2]="ClosedFolder",e[e.BoundingSectionDivider=3]="BoundingSectionDivider"})(qi||(qi={}));var Zi;(function(e){e[e.None=0]="None",e[e.Visibility=1]="Visibility",e[e.Position=2]="Position",e[e.Appearance=4]="Appearance"})(Zi||(Zi={}));var Ji;(function(e){e[e.Color0=0]="Color0",e[e.Color1=1]="Color1",e[e.Color2=2]="Color2",e[e.Color3=3]="Color3",e[e.Transparency=-1]="Transparency",e[e.UserMask=-2]="UserMask",e[e.RealUserMask=-3]="RealUserMask"})(Ji||(Ji={}));var Qi;(function(e){e[e.RawData=0]="RawData",e[e.RleCompressed=1]="RleCompressed",e[e.ZipWithoutPrediction=2]="ZipWithoutPrediction",e[e.ZipWithPrediction=3]="ZipWithPrediction"})(Qi||(Qi={}));function Ec(e,n){const t="buffer"in e?In(e.buffer,e.byteOffset,e.byteLength):In(e);return Ur(t,n)}export{Ji as ChannelID,Yi as ColorMode,Qi as Compression,Zi as LayerCompCapturedInfo,qi as SectionDividerType,Ec as readPsd};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.