polotno-node 2.15.2 → 2.15.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{A as Ve,a as f,t as I,i as J,k as Ne,b as _e,R as yt,U as Ct,p as D,l as Q,c as Et,P as ee,g as vt,C as $e,T as Le,M as He,d as te,e as St,f as _t,h as xt,v as kt,j as At,s as Pt,m as Mt,n as Ot,o as zt,q as Bt,r as Ft,u as It,w as Rt,x as ze,y as le,V as $,N as Ut,S as ce,z as q,B as be,D as ye,E as Ce,F as Qe,G as Wt,H as Vt,I as Nt,J as $t,K as qe,L as je,O as Ge,Q as re,W as Lt,X as Ht,Y as z,Z as Qt,_ as qt,$ as jt,a0 as Gt,a1 as Kt,a2 as Xt,a3 as Yt,a4 as Zt,a5 as Jt,a6 as ne,a7 as oe,a8 as Dt,a9 as he}from"./index-Dhxj876I.js";class es{constructor(e){this.mutex=new Ve,this.firstMediaStreamTimestamp=null,this.trackTimestampInfo=new WeakMap,this.output=e}onTrackClose(e){}validateAndNormalizeTimestamp(e,s,i){s+=e.source._timestampOffset;let r=this.trackTimestampInfo.get(e);if(!r){if(!i)throw new Error("First packet must be a key packet.");r={maxTimestamp:s,maxTimestampBeforeLastKeyPacket:s},this.trackTimestampInfo.set(e,r)}if(s<0)throw new Error(`Timestamps must be non-negative (got ${s}s).`);if(i&&(r.maxTimestampBeforeLastKeyPacket=r.maxTimestamp),s<r.maxTimestampBeforeLastKeyPacket)throw new Error(`Timestamps cannot be smaller than the largest timestamp of the previous GOP (a GOP begins with a key packet and ends right before the next key packet). Got ${s}s, but largest timestamp is ${r.maxTimestampBeforeLastKeyPacket}s.`);return r.maxTimestamp=Math.max(r.maxTimestamp,s),s}}const Be=/<(?:(\d{2}):)?(\d{2}):(\d{2}).(\d{3})>/g,ts=t=>{const e=Math.floor(t/36e5),s=Math.floor(t%(3600*1e3)/(60*1e3)),i=Math.floor(t%(60*1e3)/1e3),r=t%1e3;return e.toString().padStart(2,"0")+":"+s.toString().padStart(2,"0")+":"+i.toString().padStart(2,"0")+"."+r.toString().padStart(3,"0")};class Fe{constructor(e){this.writer=e,this.helper=new Uint8Array(8),this.helperView=new DataView(this.helper.buffer),this.offsets=new WeakMap}writeU32(e){this.helperView.setUint32(0,e,!1),this.writer.write(this.helper.subarray(0,4))}writeU64(e){this.helperView.setUint32(0,Math.floor(e/2**32),!1),this.helperView.setUint32(4,e,!1),this.writer.write(this.helper.subarray(0,8))}writeAscii(e){for(let s=0;s<e.length;s++)this.helperView.setUint8(s%8,e.charCodeAt(s)),s%8===7&&this.writer.write(this.helper);e.length%8!==0&&this.writer.write(this.helper.subarray(0,e.length%8))}writeBox(e){if(this.offsets.set(e,this.writer.getPos()),e.contents&&!e.children)this.writeBoxHeader(e,e.size??e.contents.byteLength+8),this.writer.write(e.contents);else{const s=this.writer.getPos();if(this.writeBoxHeader(e,0),e.contents&&this.writer.write(e.contents),e.children)for(const n of e.children)n&&this.writeBox(n);const i=this.writer.getPos(),r=e.size??i-s;this.writer.seek(s),this.writeBoxHeader(e,r),this.writer.seek(i)}}writeBoxHeader(e,s){this.writeU32(e.largeSize?1:s),this.writeAscii(e.type),e.largeSize&&this.writeU64(s)}measureBoxHeader(e){return 8+(e.largeSize?8:0)}patchBox(e){const s=this.offsets.get(e);f(s!==void 0);const i=this.writer.getPos();this.writer.seek(s),this.writeBox(e),this.writer.seek(i)}measureBox(e){if(e.contents&&!e.children)return this.measureBoxHeader(e)+e.contents.byteLength;{let s=this.measureBoxHeader(e);if(e.contents&&(s+=e.contents.byteLength),e.children)for(const i of e.children)i&&(s+=this.measureBox(i));return s}}}const b=new Uint8Array(8),R=new DataView(b.buffer),v=t=>[(t%256+256)%256],w=t=>(R.setUint16(0,t,!1),[b[0],b[1]]),Ke=t=>(R.setInt16(0,t,!1),[b[0],b[1]]),Xe=t=>(R.setUint32(0,t,!1),[b[1],b[2],b[3]]),l=t=>(R.setUint32(0,t,!1),[b[0],b[1],b[2],b[3]]),N=t=>(R.setInt32(0,t,!1),[b[0],b[1],b[2],b[3]]),j=t=>(R.setUint32(0,Math.floor(t/2**32),!1),R.setUint32(4,t,!1),[b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7]]),Ye=t=>(R.setInt16(0,2**8*t,!1),[b[0],b[1]]),W=t=>(R.setInt32(0,2**16*t,!1),[b[0],b[1],b[2],b[3]]),fe=t=>(R.setInt32(0,2**30*t,!1),[b[0],b[1],b[2],b[3]]),me=(t,e)=>{const s=[];let i=t;do{let r=i&127;i>>=7,s.length>0&&(r|=128),s.push(r)}while(i>0||e);return s.reverse()},k=(t,e=!1)=>{const s=Array(t.length).fill(null).map((i,r)=>t.charCodeAt(r));return e&&s.push(0),s},xe=t=>{let e=null;for(const s of t)(!e||s.timestamp>e.timestamp)&&(e=s);return e},Ze=t=>{const e=t*(Math.PI/180),s=Math.round(Math.cos(e)),i=Math.round(Math.sin(e));return[s,i,0,-i,s,0,0,0,1]},Je=Ze(0),De=t=>[W(t[0]),W(t[1]),fe(t[2]),W(t[3]),W(t[4]),fe(t[5]),W(t[6]),W(t[7]),fe(t[8])],T=(t,e,s)=>({type:t,contents:e&&new Uint8Array(e.flat(10)),children:s}),C=(t,e,s,i,r)=>T(t,[v(e),Xe(s),i??[]],r),ss=t=>t.isQuickTime?T("ftyp",[k("qt "),l(512),k("qt ")]):t.fragmented?T("ftyp",[k("iso5"),l(512),k("iso5"),k("iso6"),k("mp41")]):T("ftyp",[k("isom"),l(512),k("isom"),t.holdsAvc?k("avc1"):[],k("mp41")]),ae=t=>({type:"mdat",largeSize:t}),is=t=>({type:"free",size:t}),ie=t=>T("moov",void 0,[rs(t.creationTime,t.trackDatas),...t.trackDatas.map(e=>ns(e,t.creationTime)),t.isFragmented?Ns(t.trackDatas):null,Ds(t)]),rs=(t,e)=>{const s=_(Math.max(0,...e.filter(o=>o.samples.length>0).map(o=>{const a=xe(o.samples);return a.timestamp+a.duration})),Ee),i=Math.max(0,...e.map(o=>o.track.id))+1,r=!J(t)||!J(s),n=r?j:l;return C("mvhd",+r,0,[n(t),n(t),l(Ee),n(s),W(1),Ye(1),Array(10).fill(0),De(Je),Array(24).fill(0),l(i)])},ns=(t,e)=>{const s=di(t);return T("trak",void 0,[os(t,e),as(t,e),s.name!==void 0?T("udta",void 0,[T("name",[...I.encode(s.name)])]):null])},os=(t,e)=>{const s=xe(t.samples),i=_(s?s.timestamp+s.duration:0,Ee),r=!J(e)||!J(i),n=r?j:l;let o;if(t.type==="video"){const u=t.track.metadata.rotation;o=Ze(u??0)}else o=Je;let a=2;return t.track.metadata.disposition?.default!==!1&&(a|=1),C("tkhd",+r,a,[n(e),n(e),l(t.track.id),l(0),n(i),Array(8).fill(0),w(0),w(t.track.id),Ye(t.type==="audio"?1:0),w(0),De(o),W(t.type==="video"?t.info.width:0),W(t.type==="video"?t.info.height:0)])},as=(t,e)=>T("mdia",void 0,[cs(t,e),ke(!0,us[t.type],ds[t.type]),ls(t)]),cs=(t,e)=>{const s=xe(t.samples),i=_(s?s.timestamp+s.duration:0,t.timescale),r=!J(e)||!J(i),n=r?j:l;return C("mdhd",+r,0,[n(e),n(e),l(t.timescale),n(i),w(it(t.track.metadata.languageCode??Ct)),w(0)])},us={video:"vide",audio:"soun",subtitle:"text"},ds={video:"MediabunnyVideoHandler",audio:"MediabunnySoundHandler",subtitle:"MediabunnyTextHandler"},ke=(t,e,s,i="\0\0\0\0")=>C("hdlr",0,0,[t?k("mhlr"):l(0),k(e),k(i),l(0),l(0),k(s,!0)]),ls=t=>T("minf",void 0,[ps[t.type](),gs(),bs(t)]),hs=()=>C("vmhd",0,1,[w(0),w(0),w(0),w(0)]),fs=()=>C("smhd",0,0,[w(0),w(0)]),ms=()=>C("nmhd",0,0),ps={video:hs,audio:fs,subtitle:ms},gs=()=>T("dinf",void 0,[ws()]),ws=()=>C("dref",0,0,[l(1)],[Ts()]),Ts=()=>C("url ",0,1),bs=t=>{const e=t.compositionTimeOffsetTable.length>1||t.compositionTimeOffsetTable.some(s=>s.sampleCompositionTimeOffset!==0);return T("stbl",void 0,[ys(t),Bs(t),e?Ws(t):null,e?Vs(t):null,Is(t),Rs(t),Us(t),Fs(t)])},ys=t=>{let e;if(t.type==="video")e=Cs(ii(t.track.source._codec,t.info.decoderConfig.codec),t);else if(t.type==="audio"){const s=st(t.track.source._codec,t.muxer.isQuickTime);f(s),e=xs(s,t)}else t.type==="subtitle"&&(e=Os(oi[t.track.source._codec],t));return f(e),C("stsd",0,0,[l(1)],[e])},Cs=(t,e)=>T(t,[Array(6).fill(0),w(1),w(0),w(0),Array(12).fill(0),w(e.info.width),w(e.info.height),l(4718592),l(4718592),l(0),w(1),Array(32).fill(0),w(24),Ke(65535)],[ri[e.track.source._codec](e),Et(e.info.decoderConfig.colorSpace)?Es(e):null]),Es=t=>T("colr",[k("nclx"),w($e[t.info.decoderConfig.colorSpace.primaries]),w(Le[t.info.decoderConfig.colorSpace.transfer]),w(He[t.info.decoderConfig.colorSpace.matrix]),v((t.info.decoderConfig.colorSpace.fullRange?1:0)<<7)]),vs=t=>t.info.decoderConfig&&T("avcC",[...te(t.info.decoderConfig.description)]),Ss=t=>t.info.decoderConfig&&T("hvcC",[...te(t.info.decoderConfig.description)]),Ie=t=>{if(!t.info.decoderConfig)return null;const e=t.info.decoderConfig,s=e.codec.split("."),i=Number(s[1]),r=Number(s[2]),n=Number(s[3]),o=s[4]?Number(s[4]):1,a=s[8]?Number(s[8]):Number(e.colorSpace?.fullRange??0),u=(n<<4)+(o<<1)+a,c=s[5]?Number(s[5]):e.colorSpace?.primaries?$e[e.colorSpace.primaries]:2,d=s[6]?Number(s[6]):e.colorSpace?.transfer?Le[e.colorSpace.transfer]:2,p=s[7]?Number(s[7]):e.colorSpace?.matrix?He[e.colorSpace.matrix]:2;return C("vpcC",1,0,[v(i),v(r),v(u),v(c),v(d),v(p),w(0)])},_s=t=>T("av1C",vt(t.info.decoderConfig.codec)),xs=(t,e)=>{let s=0,i,r=16;if(ee.includes(e.track.source._codec)){const n=e.track.source._codec,{sampleSize:o}=D(n);r=8*o,r>16&&(s=1)}return s===0?i=[Array(6).fill(0),w(1),w(s),w(0),l(0),w(e.info.numberOfChannels),w(r),w(0),w(0),w(e.info.sampleRate<2**16?e.info.sampleRate:0),w(0)]:i=[Array(6).fill(0),w(1),w(s),w(0),l(0),w(e.info.numberOfChannels),w(Math.min(r,16)),w(0),w(0),w(e.info.sampleRate<2**16?e.info.sampleRate:0),w(0),l(1),l(r/8),l(e.info.numberOfChannels*r/8),l(2)],T(t,i,[ni(e.track.source._codec,e.muxer.isQuickTime)?.(e)??null])},pe=t=>{let e;switch(t.track.source._codec){case"aac":e=64;break;case"mp3":e=107;break;case"vorbis":e=221;break;default:throw new Error(`Unhandled audio codec: ${t.track.source._codec}`)}let s=[...v(e),...v(21),...Xe(0),...l(0),...l(0)];if(t.info.decoderConfig.description){const i=te(t.info.decoderConfig.description);s=[...s,...v(5),...me(i.byteLength),...i]}return s=[...w(1),...v(0),...v(4),...me(s.length),...s,...v(6),...v(1),...v(2)],s=[...v(3),...me(s.length),...s],C("esds",0,0,s)},V=t=>T("wave",void 0,[ks(t),As(t),T("\0\0\0\0")]),ks=t=>T("frma",[k(st(t.track.source._codec,t.muxer.isQuickTime))]),As=t=>{const{littleEndian:e}=D(t.track.source._codec);return T("enda",[w(+e)])},Ps=t=>{let e=t.info.numberOfChannels,s=3840,i=t.info.sampleRate,r=0,n=0,o=new Uint8Array(0);const a=t.info.decoderConfig?.description;if(a){f(a.byteLength>=18);const u=te(a),c=St(u);e=c.outputChannelCount,s=c.preSkip,i=c.inputSampleRate,r=c.outputGain,n=c.channelMappingFamily,c.channelMappingTable&&(o=c.channelMappingTable)}return T("dOps",[v(0),v(e),w(s),l(i),Ke(r),v(n),...o])},Ms=t=>{const e=t.info.decoderConfig?.description;f(e);const s=te(e);return C("dfLa",0,0,[...s.subarray(4)])},B=t=>{const{littleEndian:e,sampleSize:s}=D(t.track.source._codec),i=+e;return C("pcmC",0,0,[v(i),v(8*s)])},Os=(t,e)=>T(t,[Array(6).fill(0),w(1)],[ai[e.track.source._codec](e)]),zs=t=>T("vttC",[...I.encode(t.info.config.description)]),Bs=t=>C("stts",0,0,[l(t.timeToSampleTable.length),t.timeToSampleTable.map(e=>[l(e.sampleCount),l(e.sampleDelta)])]),Fs=t=>{if(t.samples.every(s=>s.type==="key"))return null;const e=[...t.samples.entries()].filter(([,s])=>s.type==="key");return C("stss",0,0,[l(e.length),e.map(([s])=>l(s+1))])},Is=t=>C("stsc",0,0,[l(t.compactlyCodedChunkTable.length),t.compactlyCodedChunkTable.map(e=>[l(e.firstChunk),l(e.samplesPerChunk),l(1)])]),Rs=t=>{if(t.type==="audio"&&t.info.requiresPcmTransformation){const{sampleSize:e}=D(t.track.source._codec);return C("stsz",0,0,[l(e*t.info.numberOfChannels),l(t.samples.reduce((s,i)=>s+_(i.duration,t.timescale),0))])}return C("stsz",0,0,[l(0),l(t.samples.length),t.samples.map(e=>l(e.size))])},Us=t=>t.finalizedChunks.length>0&&Q(t.finalizedChunks).offset>=2**32?C("co64",0,0,[l(t.finalizedChunks.length),t.finalizedChunks.map(e=>j(e.offset))]):C("stco",0,0,[l(t.finalizedChunks.length),t.finalizedChunks.map(e=>l(e.offset))]),Ws=t=>C("ctts",1,0,[l(t.compositionTimeOffsetTable.length),t.compositionTimeOffsetTable.map(e=>[l(e.sampleCount),N(e.sampleCompositionTimeOffset)])]),Vs=t=>{let e=1/0,s=-1/0,i=1/0,r=-1/0;f(t.compositionTimeOffsetTable.length>0),f(t.samples.length>0);for(let o=0;o<t.compositionTimeOffsetTable.length;o++){const a=t.compositionTimeOffsetTable[o];e=Math.min(e,a.sampleCompositionTimeOffset),s=Math.max(s,a.sampleCompositionTimeOffset)}for(let o=0;o<t.samples.length;o++){const a=t.samples[o];i=Math.min(i,_(a.timestamp,t.timescale)),r=Math.max(r,_(a.timestamp+a.duration,t.timescale))}const n=Math.max(-e,0);return r>=2**31?null:C("cslg",0,0,[N(n),N(e),N(s),N(i),N(r)])},Ns=t=>T("mvex",void 0,t.map($s)),$s=t=>C("trex",0,0,[l(t.track.id),l(1),l(0),l(0),l(0)]),Re=(t,e)=>T("moof",void 0,[Ls(t),...e.map(Hs)]),Ls=t=>C("mfhd",0,0,[l(t)]),et=t=>{let e=0,s=0;const i=0,r=0,n=t.type==="delta";return s|=+n,n?e|=1:e|=2,e<<24|s<<16|i<<8|r},Hs=t=>T("traf",void 0,[Qs(t),qs(t),js(t)]),Qs=t=>{f(t.currentChunk);let e=0;e|=8,e|=16,e|=32,e|=131072;const s=t.currentChunk.samples[1]??t.currentChunk.samples[0],i={duration:s.timescaleUnitsToNextSample,size:s.size,flags:et(s)};return C("tfhd",0,e,[l(t.track.id),l(i.duration),l(i.size),l(i.flags)])},qs=t=>(f(t.currentChunk),C("tfdt",1,0,[j(_(t.currentChunk.startTimestamp,t.timescale))])),js=t=>{f(t.currentChunk);const e=t.currentChunk.samples.map(y=>y.timescaleUnitsToNextSample),s=t.currentChunk.samples.map(y=>y.size),i=t.currentChunk.samples.map(et),r=t.currentChunk.samples.map(y=>_(y.timestamp-y.decodeTimestamp,t.timescale)),n=new Set(e),o=new Set(s),a=new Set(i),u=new Set(r),c=a.size===2&&i[0]!==i[1],d=n.size>1,p=o.size>1,h=!c&&a.size>1,m=u.size>1||[...u].some(y=>y!==0);let g=0;return g|=1,g|=4*+c,g|=256*+d,g|=512*+p,g|=1024*+h,g|=2048*+m,C("trun",1,g,[l(t.currentChunk.samples.length),l(t.currentChunk.offset-t.currentChunk.moofOffset||0),c?l(i[0]):[],t.currentChunk.samples.map((y,E)=>[d?l(e[E]):[],p?l(s[E]):[],h?l(i[E]):[],m?N(r[E]):[]])])},Gs=t=>T("mfra",void 0,[...t.map(Ks),Xs()]),Ks=(t,e)=>C("tfra",1,0,[l(t.track.id),l(63),l(t.finalizedChunks.length),t.finalizedChunks.map(i=>[j(_(i.samples[0].timestamp,t.timescale)),j(i.moofOffset),l(e+1),l(1),l(1)])]),Xs=()=>C("mfro",0,0,[l(0)]),Ys=()=>T("vtte"),Zs=(t,e,s,i,r)=>T("vttc",void 0,[r!==null?T("vsid",[N(r)]):null,s!==null?T("iden",[...I.encode(s)]):null,e!==null?T("ctim",[...I.encode(ts(e))]):null,i!==null?T("sttg",[...I.encode(i)]):null,T("payl",[...I.encode(t)])]),Js=t=>T("vtta",[...I.encode(t)]),Ds=t=>{const e=[],s=t.format._options.metadataFormat??"auto",i=t.output._metadataTags;if(s==="mdir"||s==="auto"&&!t.isQuickTime){const r=ti(i);r&&e.push(r)}else if(s==="mdta"){const r=si(i);r&&e.push(r)}else(s==="udta"||s==="auto"&&t.isQuickTime)&&ei(e,t.output._metadataTags);return e.length===0?null:T("udta",void 0,e)},ei=(t,e)=>{for(const{key:s,value:i}of Ne(e))switch(s){case"title":t.push(F("©nam",i));break;case"description":t.push(F("©des",i));break;case"artist":t.push(F("©ART",i));break;case"album":t.push(F("©alb",i));break;case"albumArtist":t.push(F("albr",i));break;case"genre":t.push(F("©gen",i));break;case"date":t.push(F("©day",i.toISOString().slice(0,10)));break;case"comment":t.push(F("©cmt",i));break;case"lyrics":t.push(F("©lyr",i));break;case"raw":break;case"discNumber":case"discsTotal":case"trackNumber":case"tracksTotal":case"images":break;default:_e(s)}if(e.raw)for(const s in e.raw){const i=e.raw[s];i==null||s.length!==4||t.some(r=>r.type===s)||(typeof i=="string"?t.push(F(s,i)):i instanceof Uint8Array&&t.push(T(s,Array.from(i))))}},F=(t,e)=>{const s=I.encode(e);return T(t,[w(s.length),w(it("und")),Array.from(s)])},Ue={"image/jpeg":13,"image/png":14,"image/bmp":27},tt=(t,e)=>{const s=[];for(const{key:i,value:r}of Ne(t))switch(i){case"title":s.push({key:e?"title":"©nam",value:M(r)});break;case"description":s.push({key:e?"description":"©des",value:M(r)});break;case"artist":s.push({key:e?"artist":"©ART",value:M(r)});break;case"album":s.push({key:e?"album":"©alb",value:M(r)});break;case"albumArtist":s.push({key:e?"album_artist":"aART",value:M(r)});break;case"comment":s.push({key:e?"comment":"©cmt",value:M(r)});break;case"genre":s.push({key:e?"genre":"©gen",value:M(r)});break;case"lyrics":s.push({key:e?"lyrics":"©lyr",value:M(r)});break;case"date":s.push({key:e?"date":"©day",value:M(r.toISOString().slice(0,10))});break;case"images":for(const n of r)n.kind==="coverFront"&&s.push({key:"covr",value:T("data",[l(Ue[n.mimeType]??0),l(0),Array.from(n.data)])});break;case"trackNumber":if(e){const n=t.tracksTotal!==void 0?`${r}/${t.tracksTotal}`:r.toString();s.push({key:"track",value:M(n)})}else s.push({key:"trkn",value:T("data",[l(0),l(0),w(0),w(r),w(t.tracksTotal??0),w(0)])});break;case"discNumber":e||s.push({key:"disc",value:T("data",[l(0),l(0),w(0),w(r),w(t.discsTotal??0),w(0)])});break;case"tracksTotal":case"discsTotal":break;case"raw":break;default:_e(i)}if(t.raw)for(const i in t.raw){const r=t.raw[i];r==null||!e&&i.length!==4||s.some(n=>n.key===i)||(typeof r=="string"?s.push({key:i,value:M(r)}):r instanceof Uint8Array?s.push({key:i,value:T("data",[l(0),l(0),Array.from(r)])}):r instanceof yt&&s.push({key:i,value:T("data",[l(Ue[r.mimeType]??0),l(0),Array.from(r.data)])}))}return s},ti=t=>{const e=tt(t,!1);return e.length===0?null:C("meta",0,0,void 0,[ke(!1,"mdir","","appl"),T("ilst",void 0,e.map(s=>T(s.key,void 0,[s.value])))])},si=t=>{const e=tt(t,!0);return e.length===0?null:T("meta",void 0,[ke(!1,"mdta",""),C("keys",0,0,[l(e.length)],e.map(s=>T("mdta",[...I.encode(s.key)]))),T("ilst",void 0,e.map((s,i)=>{const r=String.fromCharCode(...l(i+1));return T(r,void 0,[s.value])}))])},M=t=>T("data",[l(1),l(0),...I.encode(t)]),ii=(t,e)=>{switch(t){case"avc":return e.startsWith("avc3")?"avc3":"avc1";case"hevc":return"hvc1";case"vp8":return"vp08";case"vp9":return"vp09";case"av1":return"av01"}},ri={avc:vs,hevc:Ss,vp8:Ie,vp9:Ie,av1:_s},st=(t,e)=>{switch(t){case"aac":return"mp4a";case"mp3":return"mp4a";case"opus":return"Opus";case"vorbis":return"mp4a";case"flac":return"fLaC";case"ulaw":return"ulaw";case"alaw":return"alaw";case"pcm-u8":return"raw ";case"pcm-s8":return"sowt"}if(e)switch(t){case"pcm-s16":return"sowt";case"pcm-s16be":return"twos";case"pcm-s24":return"in24";case"pcm-s24be":return"in24";case"pcm-s32":return"in32";case"pcm-s32be":return"in32";case"pcm-f32":return"fl32";case"pcm-f32be":return"fl32";case"pcm-f64":return"fl64";case"pcm-f64be":return"fl64"}else switch(t){case"pcm-s16":return"ipcm";case"pcm-s16be":return"ipcm";case"pcm-s24":return"ipcm";case"pcm-s24be":return"ipcm";case"pcm-s32":return"ipcm";case"pcm-s32be":return"ipcm";case"pcm-f32":return"fpcm";case"pcm-f32be":return"fpcm";case"pcm-f64":return"fpcm";case"pcm-f64be":return"fpcm"}},ni=(t,e)=>{switch(t){case"aac":return pe;case"mp3":return pe;case"opus":return Ps;case"vorbis":return pe;case"flac":return Ms}if(e)switch(t){case"pcm-s24":return V;case"pcm-s24be":return V;case"pcm-s32":return V;case"pcm-s32be":return V;case"pcm-f32":return V;case"pcm-f32be":return V;case"pcm-f64":return V;case"pcm-f64be":return V}else switch(t){case"pcm-s16":return B;case"pcm-s16be":return B;case"pcm-s24":return B;case"pcm-s24be":return B;case"pcm-s32":return B;case"pcm-s32be":return B;case"pcm-f32":return B;case"pcm-f32be":return B;case"pcm-f64":return B;case"pcm-f64be":return B}return null},oi={webvtt:"wvtt"},ai={webvtt:zs},it=t=>{f(t.length===3);let e=0;for(let s=0;s<3;s++)e<<=5,e+=t.charCodeAt(s)-96;return e};class ci{constructor(){this.ensureMonotonicity=!1,this.trackedWrites=null,this.trackedStart=-1,this.trackedEnd=-1}start(){}maybeTrackWrites(e){if(!this.trackedWrites)return;let s=this.getPos();if(s<this.trackedStart){if(s+e.byteLength<=this.trackedStart)return;e=e.subarray(this.trackedStart-s),s=0}const i=s+e.byteLength-this.trackedStart;let r=this.trackedWrites.byteLength;for(;r<i;)r*=2;if(r!==this.trackedWrites.byteLength){const n=new Uint8Array(r);n.set(this.trackedWrites,0),this.trackedWrites=n}this.trackedWrites.set(e,s-this.trackedStart),this.trackedEnd=Math.max(this.trackedEnd,s+e.byteLength)}startTrackingWrites(){this.trackedWrites=new Uint8Array(2**10),this.trackedStart=this.getPos(),this.trackedEnd=this.trackedStart}stopTrackingWrites(){if(!this.trackedWrites)throw new Error("Internal error: Can't get tracked writes since nothing was tracked.");const s={data:this.trackedWrites.subarray(0,this.trackedEnd-this.trackedStart),start:this.trackedStart,end:this.trackedEnd};return this.trackedWrites=null,s}}const ge=2**16,we=2**32;class rt extends ci{constructor(e){if(super(),this.pos=0,this.maxPos=0,this.target=e,this.supportsResize="resize"in new ArrayBuffer(0),this.supportsResize)try{this.buffer=new ArrayBuffer(ge,{maxByteLength:we})}catch{this.buffer=new ArrayBuffer(ge),this.supportsResize=!1}else this.buffer=new ArrayBuffer(ge);this.bytes=new Uint8Array(this.buffer)}ensureSize(e){let s=this.buffer.byteLength;for(;s<e;)s*=2;if(s!==this.buffer.byteLength){if(s>we)throw new Error(`ArrayBuffer exceeded maximum size of ${we} bytes. Please consider using another target.`);if(this.supportsResize)this.buffer.resize(s);else{const i=new ArrayBuffer(s),r=new Uint8Array(i);r.set(this.bytes,0),this.buffer=i,this.bytes=r}}}write(e){this.maybeTrackWrites(e),this.ensureSize(this.pos+e.byteLength),this.bytes.set(e,this.pos),this.target.onwrite?.(this.pos,this.pos+e.byteLength),this.pos+=e.byteLength,this.maxPos=Math.max(this.maxPos,this.pos)}seek(e){this.pos=e}getPos(){return this.pos}async flush(){}async finalize(){this.ensureSize(this.pos),this.target.buffer=this.buffer.slice(0,Math.max(this.maxPos,this.pos))}async close(){}getSlice(e,s){return this.bytes.slice(e,s)}}class nt{constructor(){this._output=null,this.onwrite=null}}class ot extends nt{constructor(){super(...arguments),this.buffer=null}_createWriter(){return new rt(this)}}const Ee=1e3,ui=2082844800,di=t=>{const e={},s=t.track;return s.metadata.name!==void 0&&(e.name=s.metadata.name),e},_=(t,e,s=!0)=>{const i=t*e;return s?Math.round(i):i};class li extends es{constructor(e,s){super(e),this.auxTarget=new ot,this.auxWriter=this.auxTarget._createWriter(),this.auxBoxWriter=new Fe(this.auxWriter),this.mdat=null,this.ftypSize=null,this.trackDatas=[],this.allTracksKnown=_t(),this.creationTime=Math.floor(Date.now()/1e3)+ui,this.finalizedChunks=[],this.nextFragmentNumber=1,this.maxWrittenTimestamp=-1/0,this.format=s,this.writer=e._writer,this.boxWriter=new Fe(this.writer),this.isQuickTime=s instanceof dt;const i=this.writer instanceof rt?"in-memory":!1;this.fastStart=s._options.fastStart??i,this.isFragmented=this.fastStart==="fragmented",(this.fastStart==="in-memory"||this.isFragmented)&&(this.writer.ensureMonotonicity=!0),this.minimumFragmentDuration=s._options.minimumFragmentDuration??1}async start(){const e=await this.mutex.acquire(),s=this.output._tracks.some(i=>i.type==="video"&&i.source._codec==="avc");if(this.format._options.onFtyp&&this.writer.startTrackingWrites(),this.boxWriter.writeBox(ss({isQuickTime:this.isQuickTime,holdsAvc:s,fragmented:this.isFragmented})),this.format._options.onFtyp){const{data:i,start:r}=this.writer.stopTrackingWrites();this.format._options.onFtyp(i,r)}if(this.ftypSize=this.writer.getPos(),this.fastStart!=="in-memory")if(this.fastStart==="reserve"){for(const i of this.output._tracks)if(i.metadata.maximumPacketCount===void 0)throw new Error("All tracks must specify maximumPacketCount in their metadata when using fastStart: 'reserve'.")}else this.isFragmented||(this.format._options.onMdat&&this.writer.startTrackingWrites(),this.mdat=ae(!0),this.boxWriter.writeBox(this.mdat));await this.writer.flush(),e()}allTracksAreKnown(){for(const e of this.output._tracks)if(!e.source._closed&&!this.trackDatas.some(s=>s.track===e))return!1;return!0}async getMimeType(){await this.allTracksKnown.promise;const e=this.trackDatas.map(s=>s.type==="video"||s.type==="audio"?s.info.decoderConfig.codec:{webvtt:"wvtt"}[s.track.source._codec]);return xt({isQuickTime:this.isQuickTime,hasVideo:this.trackDatas.some(s=>s.type==="video"),hasAudio:this.trackDatas.some(s=>s.type==="audio"),codecStrings:e})}getVideoTrackData(e,s,i){const r=this.trackDatas.find(c=>c.track===e);if(r)return r;kt(i),f(i),f(i.decoderConfig);const n={...i.decoderConfig};f(n.codedWidth!==void 0),f(n.codedHeight!==void 0);let o=!1;if(e.source._codec==="avc"&&!n.description){const c=At(s.data);if(!c)throw new Error("Couldn't extract an AVCDecoderConfigurationRecord from the AVC packet. Make sure the packets are in Annex B format (as specified in ITU-T-REC-H.264) when not providing a description, or provide a description (must be an AVCDecoderConfigurationRecord as specified in ISO 14496-15) and ensure the packets are in AVCC format.");n.description=Pt(c),o=!0}else if(e.source._codec==="hevc"&&!n.description){const c=Mt(s.data);if(!c)throw new Error("Couldn't extract an HEVCDecoderConfigurationRecord from the HEVC packet. Make sure the packets are in Annex B format (as specified in ITU-T-REC-H.265) when not providing a description, or provide a description (must be an HEVCDecoderConfigurationRecord as specified in ISO 14496-15) and ensure the packets are in HEVC format.");n.description=Ot(c),o=!0}const a=zt(1/(e.metadata.frameRate??57600),1e6).denominator,u={muxer:this,track:e,type:"video",info:{width:n.codedWidth,height:n.codedHeight,decoderConfig:n,requiresAnnexBTransformation:o},timescale:a,samples:[],sampleQueue:[],timestampProcessingQueue:[],timeToSampleTable:[],compositionTimeOffsetTable:[],lastTimescaleUnits:null,lastSample:null,finalizedChunks:[],currentChunk:null,compactlyCodedChunkTable:[]};return this.trackDatas.push(u),this.trackDatas.sort((c,d)=>c.track.id-d.track.id),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),u}getAudioTrackData(e,s){const i=this.trackDatas.find(n=>n.track===e);if(i)return i;Bt(s),f(s),f(s.decoderConfig);const r={muxer:this,track:e,type:"audio",info:{numberOfChannels:s.decoderConfig.numberOfChannels,sampleRate:s.decoderConfig.sampleRate,decoderConfig:s.decoderConfig,requiresPcmTransformation:!this.isFragmented&&ee.includes(e.source._codec)},timescale:s.decoderConfig.sampleRate,samples:[],sampleQueue:[],timestampProcessingQueue:[],timeToSampleTable:[],compositionTimeOffsetTable:[],lastTimescaleUnits:null,lastSample:null,finalizedChunks:[],currentChunk:null,compactlyCodedChunkTable:[]};return this.trackDatas.push(r),this.trackDatas.sort((n,o)=>n.track.id-o.track.id),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),r}getSubtitleTrackData(e,s){const i=this.trackDatas.find(n=>n.track===e);if(i)return i;Ft(s),f(s),f(s.config);const r={muxer:this,track:e,type:"subtitle",info:{config:s.config},timescale:1e3,samples:[],sampleQueue:[],timestampProcessingQueue:[],timeToSampleTable:[],compositionTimeOffsetTable:[],lastTimescaleUnits:null,lastSample:null,finalizedChunks:[],currentChunk:null,compactlyCodedChunkTable:[],lastCueEndTimestamp:0,cueQueue:[],nextSourceId:0,cueToSourceId:new WeakMap};return this.trackDatas.push(r),this.trackDatas.sort((n,o)=>n.track.id-o.track.id),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),r}async addEncodedVideoPacket(e,s,i){const r=await this.mutex.acquire();try{const n=this.getVideoTrackData(e,s,i);let o=s.data;if(n.info.requiresAnnexBTransformation){const c=It(o);if(c.length===0)throw new Error("Failed to transform packet data. Make sure all packets are provided in Annex B format, as specified in ITU-T-REC-H.264 and ITU-T-REC-H.265.");o=Rt(c,4)}const a=this.validateAndNormalizeTimestamp(n.track,s.timestamp,s.type==="key"),u=this.createSampleForTrack(n,o,a,s.duration,s.type);await this.registerSample(n,u)}finally{r()}}async addEncodedAudioPacket(e,s,i){const r=await this.mutex.acquire();try{const n=this.getAudioTrackData(e,i),o=this.validateAndNormalizeTimestamp(n.track,s.timestamp,s.type==="key"),a=this.createSampleForTrack(n,s.data,o,s.duration,s.type);n.info.requiresPcmTransformation&&await this.maybePadWithSilence(n,o),await this.registerSample(n,a)}finally{r()}}async maybePadWithSilence(e,s){const i=Q(e.samples),r=i?i.timestamp+i.duration:0,n=s-r,o=_(n,e.timescale);if(o>0){const{sampleSize:a,silentValue:u}=D(e.info.decoderConfig.codec),c=o*e.info.numberOfChannels,d=new Uint8Array(a*c).fill(u),p=this.createSampleForTrack(e,new Uint8Array(d.buffer),r,n,"key");await this.registerSample(e,p)}}async addSubtitleCue(e,s,i){const r=await this.mutex.acquire();try{const n=this.getSubtitleTrackData(e,i);this.validateAndNormalizeTimestamp(n.track,s.timestamp,!0),e.source._codec==="webvtt"&&(n.cueQueue.push(s),await this.processWebVTTCues(n,s.timestamp))}finally{r()}}async processWebVTTCues(e,s){for(;e.cueQueue.length>0;){const i=new Set([]);for(const c of e.cueQueue)f(c.timestamp<=s),f(e.lastCueEndTimestamp<=c.timestamp+c.duration),i.add(Math.max(c.timestamp,e.lastCueEndTimestamp)),i.add(c.timestamp+c.duration);const r=[...i].sort((c,d)=>c-d),n=r[0],o=r[1]??n;if(s<o)break;if(e.lastCueEndTimestamp<n){this.auxWriter.seek(0);const c=Ys();this.auxBoxWriter.writeBox(c);const d=this.auxWriter.getSlice(0,this.auxWriter.getPos()),p=this.createSampleForTrack(e,d,e.lastCueEndTimestamp,n-e.lastCueEndTimestamp,"key");await this.registerSample(e,p),e.lastCueEndTimestamp=n}this.auxWriter.seek(0);for(let c=0;c<e.cueQueue.length;c++){const d=e.cueQueue[c];if(d.timestamp>=o)break;Be.lastIndex=0;const p=Be.test(d.text),h=d.timestamp+d.duration;let m=e.cueToSourceId.get(d);if(m===void 0&&o<h&&(m=e.nextSourceId++,e.cueToSourceId.set(d,m)),d.notes){const y=Js(d.notes);this.auxBoxWriter.writeBox(y)}const g=Zs(d.text,p?n:null,d.identifier??null,d.settings??null,m??null);this.auxBoxWriter.writeBox(g),h===o&&e.cueQueue.splice(c--,1)}const a=this.auxWriter.getSlice(0,this.auxWriter.getPos()),u=this.createSampleForTrack(e,a,n,o-n,"key");await this.registerSample(e,u),e.lastCueEndTimestamp=o}}createSampleForTrack(e,s,i,r,n){return{timestamp:i,decodeTimestamp:i,duration:r,data:s,size:s.byteLength,type:n,timescaleUnitsToNextSample:_(r,e.timescale)}}processTimestamps(e,s){if(e.timestampProcessingQueue.length===0)return;if(e.type==="audio"&&e.info.requiresPcmTransformation){let r=0;for(let n=0;n<e.timestampProcessingQueue.length;n++){const o=e.timestampProcessingQueue[n],a=_(o.duration,e.timescale);r+=a}if(e.timeToSampleTable.length===0)e.timeToSampleTable.push({sampleCount:r,sampleDelta:1});else{const n=Q(e.timeToSampleTable);n.sampleCount+=r}e.timestampProcessingQueue.length=0;return}const i=e.timestampProcessingQueue.map(r=>r.timestamp).sort((r,n)=>r-n);for(let r=0;r<e.timestampProcessingQueue.length;r++){const n=e.timestampProcessingQueue[r];n.decodeTimestamp=i[r],!this.isFragmented&&e.lastTimescaleUnits===null&&(n.decodeTimestamp=0);const o=_(n.timestamp-n.decodeTimestamp,e.timescale),a=_(n.duration,e.timescale);if(e.lastTimescaleUnits!==null){f(e.lastSample);const u=_(n.decodeTimestamp,e.timescale,!1),c=Math.round(u-e.lastTimescaleUnits);if(f(c>=0),e.lastTimescaleUnits+=c,e.lastSample.timescaleUnitsToNextSample=c,!this.isFragmented){let d=Q(e.timeToSampleTable);if(f(d),d.sampleCount===1){d.sampleDelta=c;const h=e.timeToSampleTable[e.timeToSampleTable.length-2];h&&h.sampleDelta===c&&(h.sampleCount++,e.timeToSampleTable.pop(),d=h)}else d.sampleDelta!==c&&(d.sampleCount--,e.timeToSampleTable.push(d={sampleCount:1,sampleDelta:c}));d.sampleDelta===a?d.sampleCount++:e.timeToSampleTable.push({sampleCount:1,sampleDelta:a});const p=Q(e.compositionTimeOffsetTable);f(p),p.sampleCompositionTimeOffset===o?p.sampleCount++:e.compositionTimeOffsetTable.push({sampleCount:1,sampleCompositionTimeOffset:o})}}else e.lastTimescaleUnits=_(n.decodeTimestamp,e.timescale,!1),this.isFragmented||(e.timeToSampleTable.push({sampleCount:1,sampleDelta:a}),e.compositionTimeOffsetTable.push({sampleCount:1,sampleCompositionTimeOffset:o}));e.lastSample=n}if(e.timestampProcessingQueue.length=0,f(e.lastSample),f(e.lastTimescaleUnits!==null),s!==void 0&&e.lastSample.timescaleUnitsToNextSample===0){f(s.type==="key");const r=_(s.timestamp,e.timescale,!1),n=Math.round(r-e.lastTimescaleUnits);e.lastSample.timescaleUnitsToNextSample=n}}async registerSample(e,s){s.type==="key"&&this.processTimestamps(e,s),e.timestampProcessingQueue.push(s),this.isFragmented?(e.sampleQueue.push(s),await this.interleaveSamples()):this.fastStart==="reserve"?await this.registerSampleFastStartReserve(e,s):await this.addSampleToTrack(e,s)}async addSampleToTrack(e,s){if(!this.isFragmented&&(e.samples.push(s),this.fastStart==="reserve")){const r=e.track.metadata.maximumPacketCount;if(f(r!==void 0),e.samples.length>r)throw new Error(`Track #${e.track.id} has already reached the maximum packet count (${r}). Either add less packets or increase the maximum packet count.`)}let i=!1;if(!e.currentChunk)i=!0;else{e.currentChunk.startTimestamp=Math.min(e.currentChunk.startTimestamp,s.timestamp);const r=s.timestamp-e.currentChunk.startTimestamp;if(this.isFragmented){const n=this.trackDatas.every(o=>{if(e===o)return s.type==="key";const a=o.sampleQueue[0];return a?a.type==="key":o.track.source._closed});r>=this.minimumFragmentDuration&&n&&s.timestamp>this.maxWrittenTimestamp&&(i=!0,await this.finalizeFragment())}else i=r>=.5}i&&(e.currentChunk&&await this.finalizeCurrentChunk(e),e.currentChunk={startTimestamp:s.timestamp,samples:[],offset:null,moofOffset:null}),f(e.currentChunk),e.currentChunk.samples.push(s),this.isFragmented&&(this.maxWrittenTimestamp=Math.max(this.maxWrittenTimestamp,s.timestamp))}async finalizeCurrentChunk(e){if(f(!this.isFragmented),!e.currentChunk)return;e.finalizedChunks.push(e.currentChunk),this.finalizedChunks.push(e.currentChunk);let s=e.currentChunk.samples.length;if(e.type==="audio"&&e.info.requiresPcmTransformation&&(s=e.currentChunk.samples.reduce((i,r)=>i+_(r.duration,e.timescale),0)),(e.compactlyCodedChunkTable.length===0||Q(e.compactlyCodedChunkTable).samplesPerChunk!==s)&&e.compactlyCodedChunkTable.push({firstChunk:e.finalizedChunks.length,samplesPerChunk:s}),this.fastStart==="in-memory"){e.currentChunk.offset=0;return}e.currentChunk.offset=this.writer.getPos();for(const i of e.currentChunk.samples)f(i.data),this.writer.write(i.data),i.data=null;await this.writer.flush()}async interleaveSamples(e=!1){if(f(this.isFragmented),!(!e&&!this.allTracksAreKnown()))e:for(;;){let s=null,i=1/0;for(const n of this.trackDatas){if(!e&&n.sampleQueue.length===0&&!n.track.source._closed)break e;n.sampleQueue.length>0&&n.sampleQueue[0].timestamp<i&&(s=n,i=n.sampleQueue[0].timestamp)}if(!s)break;const r=s.sampleQueue.shift();await this.addSampleToTrack(s,r)}}async finalizeFragment(e=!0){f(this.isFragmented);const s=this.nextFragmentNumber++;if(s===1){this.format._options.onMoov&&this.writer.startTrackingWrites();const m=ie(this);if(this.boxWriter.writeBox(m),this.format._options.onMoov){const{data:g,start:y}=this.writer.stopTrackingWrites();this.format._options.onMoov(g,y)}}const i=this.trackDatas.filter(m=>m.currentChunk),r=Re(s,i),n=this.writer.getPos(),o=n+this.boxWriter.measureBox(r);let a=o+le,u=1/0;for(const m of i){m.currentChunk.offset=a,m.currentChunk.moofOffset=n;for(const g of m.currentChunk.samples)a+=g.size;u=Math.min(u,m.currentChunk.startTimestamp)}const c=a-o,d=c>=2**32;if(d)for(const m of i)m.currentChunk.offset+=ze-le;this.format._options.onMoof&&this.writer.startTrackingWrites();const p=Re(s,i);if(this.boxWriter.writeBox(p),this.format._options.onMoof){const{data:m,start:g}=this.writer.stopTrackingWrites();this.format._options.onMoof(m,g,u)}f(this.writer.getPos()===o),this.format._options.onMdat&&this.writer.startTrackingWrites();const h=ae(d);h.size=c,this.boxWriter.writeBox(h),this.writer.seek(o+(d?ze:le));for(const m of i)for(const g of m.currentChunk.samples)this.writer.write(g.data),g.data=null;if(this.format._options.onMdat){const{data:m,start:g}=this.writer.stopTrackingWrites();this.format._options.onMdat(m,g)}for(const m of i)m.finalizedChunks.push(m.currentChunk),this.finalizedChunks.push(m.currentChunk),m.currentChunk=null;e&&await this.writer.flush()}async registerSampleFastStartReserve(e,s){if(this.allTracksAreKnown()){if(!this.mdat){const i=ie(this),n=this.boxWriter.measureBox(i)+this.computeSampleTableSizeUpperBound()+4096;f(this.ftypSize!==null),this.writer.seek(this.ftypSize+n),this.format._options.onMdat&&this.writer.startTrackingWrites(),this.mdat=ae(!0),this.boxWriter.writeBox(this.mdat);for(const o of this.trackDatas){for(const a of o.sampleQueue)await this.addSampleToTrack(o,a);o.sampleQueue.length=0}}await this.addSampleToTrack(e,s)}else e.sampleQueue.push(s)}computeSampleTableSizeUpperBound(){f(this.fastStart==="reserve");let e=0;for(const s of this.trackDatas){const i=s.track.metadata.maximumPacketCount;f(i!==void 0),e+=8*Math.ceil(2/3*i),e+=4*i,e+=8*Math.ceil(2/3*i),e+=12*Math.ceil(2/3*i),e+=4*i,e+=8*i}return e}async onTrackClose(e){const s=await this.mutex.acquire();if(e.type==="subtitle"&&e.source._codec==="webvtt"){const i=this.trackDatas.find(r=>r.track===e);i&&await this.processWebVTTCues(i,1/0)}this.allTracksAreKnown()&&this.allTracksKnown.resolve(),this.isFragmented&&await this.interleaveSamples(),s()}async finalize(){const e=await this.mutex.acquire();this.allTracksKnown.resolve();for(const s of this.trackDatas)s.type==="subtitle"&&s.track.source._codec==="webvtt"&&await this.processWebVTTCues(s,1/0);if(this.isFragmented){await this.interleaveSamples(!0);for(const s of this.trackDatas)this.processTimestamps(s);await this.finalizeFragment(!1)}else for(const s of this.trackDatas)this.processTimestamps(s),await this.finalizeCurrentChunk(s);if(this.fastStart==="in-memory"){this.mdat=ae(!1);let s;for(let r=0;r<2;r++){const n=ie(this),o=this.boxWriter.measureBox(n);s=this.boxWriter.measureBox(this.mdat);let a=this.writer.getPos()+o+s;for(const u of this.finalizedChunks){u.offset=a;for(const{data:c}of u.samples)f(c),a+=c.byteLength,s+=c.byteLength}if(a<2**32)break;s>=2**32&&(this.mdat.largeSize=!0)}this.format._options.onMoov&&this.writer.startTrackingWrites();const i=ie(this);if(this.boxWriter.writeBox(i),this.format._options.onMoov){const{data:r,start:n}=this.writer.stopTrackingWrites();this.format._options.onMoov(r,n)}this.format._options.onMdat&&this.writer.startTrackingWrites(),this.mdat.size=s,this.boxWriter.writeBox(this.mdat);for(const r of this.finalizedChunks)for(const n of r.samples)f(n.data),this.writer.write(n.data),n.data=null;if(this.format._options.onMdat){const{data:r,start:n}=this.writer.stopTrackingWrites();this.format._options.onMdat(r,n)}}else if(this.isFragmented){const s=this.writer.getPos(),i=Gs(this.trackDatas);this.boxWriter.writeBox(i);const r=this.writer.getPos()-s;this.writer.seek(this.writer.getPos()-4),this.boxWriter.writeU32(r)}else{f(this.mdat);const s=this.boxWriter.offsets.get(this.mdat);f(s!==void 0);const i=this.writer.getPos()-s;if(this.mdat.size=i,this.mdat.largeSize=i>=2**32,this.boxWriter.patchBox(this.mdat),this.format._options.onMdat){const{data:n,start:o}=this.writer.stopTrackingWrites();this.format._options.onMdat(n,o)}const r=ie(this);if(this.fastStart==="reserve"){f(this.ftypSize!==null),this.writer.seek(this.ftypSize),this.format._options.onMoov&&this.writer.startTrackingWrites(),this.boxWriter.writeBox(r);const n=this.boxWriter.offsets.get(this.mdat)-this.writer.getPos();this.boxWriter.writeBox(is(n))}else this.format._options.onMoov&&this.writer.startTrackingWrites(),this.boxWriter.writeBox(r);if(this.format._options.onMoov){const{data:n,start:o}=this.writer.stopTrackingWrites();this.format._options.onMoov(n,o)}}e()}}class at{getSupportedVideoCodecs(){return this.getSupportedCodecs().filter(e=>$.includes(e))}getSupportedAudioCodecs(){return this.getSupportedCodecs().filter(e=>q.includes(e))}getSupportedSubtitleCodecs(){return this.getSupportedCodecs().filter(e=>ce.includes(e))}_codecUnsupportedHint(e){return""}}class ct extends at{constructor(e={}){if(!e||typeof e!="object")throw new TypeError("options must be an object.");if(e.fastStart!==void 0&&![!1,"in-memory","reserve","fragmented"].includes(e.fastStart))throw new TypeError("options.fastStart, when provided, must be false, 'in-memory', 'reserve', or 'fragmented'.");if(e.minimumFragmentDuration!==void 0&&(!Number.isFinite(e.minimumFragmentDuration)||e.minimumFragmentDuration<0))throw new TypeError("options.minimumFragmentDuration, when provided, must be a non-negative number.");if(e.onFtyp!==void 0&&typeof e.onFtyp!="function")throw new TypeError("options.onFtyp, when provided, must be a function.");if(e.onMoov!==void 0&&typeof e.onMoov!="function")throw new TypeError("options.onMoov, when provided, must be a function.");if(e.onMdat!==void 0&&typeof e.onMdat!="function")throw new TypeError("options.onMdat, when provided, must be a function.");if(e.onMoof!==void 0&&typeof e.onMoof!="function")throw new TypeError("options.onMoof, when provided, must be a function.");if(e.metadataFormat!==void 0&&!["mdir","mdta","udta","auto"].includes(e.metadataFormat))throw new TypeError("options.metadataFormat, when provided, must be either 'auto', 'mdir', 'mdta', or 'udta'.");super(),this._options=e}getSupportedTrackCounts(){return{video:{min:0,max:1/0},audio:{min:0,max:1/0},subtitle:{min:0,max:1/0},total:{min:1,max:2**32-1}}}get supportsVideoRotationMetadata(){return!0}_createMuxer(e){return new li(e,this)}}class ut extends ct{constructor(e){super(e)}get _name(){return"MP4"}get fileExtension(){return".mp4"}get mimeType(){return"video/mp4"}getSupportedCodecs(){return[...$,...Ut,"pcm-s16","pcm-s16be","pcm-s24","pcm-s24be","pcm-s32","pcm-s32be","pcm-f32","pcm-f32be","pcm-f64","pcm-f64be",...ce]}_codecUnsupportedHint(e){return new dt().getSupportedCodecs().includes(e)?" Switching to MOV will grant support for this codec.":""}}class dt extends ct{constructor(e){super(e)}get _name(){return"MOV"}get fileExtension(){return".mov"}get mimeType(){return"video/quicktime"}getSupportedCodecs(){return[...$,...q]}_codecUnsupportedHint(e){return new ut().getSupportedCodecs().includes(e)?" Switching to MP4 will grant support for this codec.":""}}const hi=t=>{if(!t||typeof t!="object")throw new TypeError("Encoding config must be an object.");if(!$.includes(t.codec))throw new TypeError(`Invalid video codec '${t.codec}'. Must be one of: ${$.join(", ")}.`);if(!(t.bitrate instanceof K)&&(!Number.isInteger(t.bitrate)||t.bitrate<=0))throw new TypeError("config.bitrate must be a positive integer or a quality.");if(t.keyFrameInterval!==void 0&&(!Number.isFinite(t.keyFrameInterval)||t.keyFrameInterval<0))throw new TypeError("config.keyFrameInterval, when provided, must be a non-negative number.");if(t.sizeChangeBehavior!==void 0&&!["deny","passThrough","fill","contain","cover"].includes(t.sizeChangeBehavior))throw new TypeError("config.sizeChangeBehavior, when provided, must be 'deny', 'passThrough', 'fill', 'contain' or 'cover'.");if(t.onEncodedPacket!==void 0&&typeof t.onEncodedPacket!="function")throw new TypeError("config.onEncodedChunk, when provided, must be a function.");if(t.onEncoderConfig!==void 0&&typeof t.onEncoderConfig!="function")throw new TypeError("config.onEncoderConfig, when provided, must be a function.");lt(t.codec,t)},lt=(t,e)=>{if(!e||typeof e!="object")throw new TypeError("Encoding options must be an object.");if(e.alpha!==void 0&&!["discard","keep"].includes(e.alpha))throw new TypeError("options.alpha, when provided, must be 'discard' or 'keep'.");if(e.bitrateMode!==void 0&&!["constant","variable"].includes(e.bitrateMode))throw new TypeError("bitrateMode, when provided, must be 'constant' or 'variable'.");if(e.latencyMode!==void 0&&!["quality","realtime"].includes(e.latencyMode))throw new TypeError("latencyMode, when provided, must be 'quality' or 'realtime'.");if(e.fullCodecString!==void 0&&typeof e.fullCodecString!="string")throw new TypeError("fullCodecString, when provided, must be a string.");if(e.fullCodecString!==void 0&&Qe(e.fullCodecString)!==t)throw new TypeError(`fullCodecString, when provided, must be a string that matches the specified codec (${t}).`);if(e.hardwareAcceleration!==void 0&&!["no-preference","prefer-hardware","prefer-software"].includes(e.hardwareAcceleration))throw new TypeError("hardwareAcceleration, when provided, must be 'no-preference', 'prefer-hardware' or 'prefer-software'.");if(e.scalabilityMode!==void 0&&typeof e.scalabilityMode!="string")throw new TypeError("scalabilityMode, when provided, must be a string.");if(e.contentHint!==void 0&&typeof e.contentHint!="string")throw new TypeError("contentHint, when provided, must be a string.")},ve=t=>{const e=t.bitrate instanceof K?t.bitrate._toVideoBitrate(t.codec,t.width,t.height):t.bitrate;return{codec:t.fullCodecString??Vt(t.codec,t.width,t.height,e),width:t.width,height:t.height,bitrate:e,bitrateMode:t.bitrateMode,alpha:t.alpha??"discard",framerate:t.framerate,latencyMode:t.latencyMode,hardwareAcceleration:t.hardwareAcceleration,scalabilityMode:t.scalabilityMode,contentHint:t.contentHint,...Wt(t.codec)}},fi=t=>{if(!t||typeof t!="object")throw new TypeError("Encoding config must be an object.");if(!q.includes(t.codec))throw new TypeError(`Invalid audio codec '${t.codec}'. Must be one of: ${q.join(", ")}.`);if(t.bitrate===void 0&&(!ee.includes(t.codec)||t.codec==="flac"))throw new TypeError("config.bitrate must be provided for compressed audio codecs.");if(t.bitrate!==void 0&&!(t.bitrate instanceof K)&&(!Number.isInteger(t.bitrate)||t.bitrate<=0))throw new TypeError("config.bitrate, when provided, must be a positive integer or a quality.");if(t.onEncodedPacket!==void 0&&typeof t.onEncodedPacket!="function")throw new TypeError("config.onEncodedChunk, when provided, must be a function.");if(t.onEncoderConfig!==void 0&&typeof t.onEncoderConfig!="function")throw new TypeError("config.onEncoderConfig, when provided, must be a function.");ht(t.codec,t)},ht=(t,e)=>{if(!e||typeof e!="object")throw new TypeError("Encoding options must be an object.");if(e.bitrateMode!==void 0&&!["constant","variable"].includes(e.bitrateMode))throw new TypeError("bitrateMode, when provided, must be 'constant' or 'variable'.");if(e.fullCodecString!==void 0&&typeof e.fullCodecString!="string")throw new TypeError("fullCodecString, when provided, must be a string.");if(e.fullCodecString!==void 0&&Qe(e.fullCodecString)!==t)throw new TypeError(`fullCodecString, when provided, must be a string that matches the specified codec (${t}).`)},Se=t=>{const e=t.bitrate instanceof K?t.bitrate._toAudioBitrate(t.codec):t.bitrate;return{codec:t.fullCodecString??$t(t.codec,t.numberOfChannels,t.sampleRate),numberOfChannels:t.numberOfChannels,sampleRate:t.sampleRate,bitrate:e,bitrateMode:t.bitrateMode,...Nt(t.codec)}};class K{constructor(e){this._factor=e}_toVideoBitrate(e,s,i){const r=s*i,n={avc:1,hevc:.6,vp9:.6,av1:.4,vp8:1.2},o=1920*1080,a=3e6,u=Math.pow(r/o,.95),p=a*u*n[e]*this._factor;return Math.ceil(p/1e3)*1e3}_toAudioBitrate(e){if(ee.includes(e)||e==="flac")return;const i={aac:128e3,opus:64e3,mp3:16e4,vorbis:64e3}[e];if(!i)throw new Error(`Unhandled codec: ${e}`);let r=i*this._factor;return e==="aac"?r=[96e3,128e3,16e4,192e3].reduce((o,a)=>Math.abs(a-r)<Math.abs(o-r)?a:o):e==="opus"||e==="vorbis"?r=Math.max(6e3,r):e==="mp3"&&(r=[8e3,16e3,24e3,32e3,4e4,48e3,64e3,8e4,96e3,112e3,128e3,16e4,192e3,224e3,256e3,32e4].reduce((o,a)=>Math.abs(a-r)<Math.abs(o-r)?a:o)),Math.round(r/1e3)*1e3}}const ft=new K(2),mi=async(t,e={})=>{const{width:s=1280,height:i=720,bitrate:r=1e6,...n}=e;if(!$.includes(t))return!1;if(!Number.isInteger(s)||s<=0)throw new TypeError("width must be a positive integer.");if(!Number.isInteger(i)||i<=0)throw new TypeError("height must be a positive integer.");if(!(r instanceof K)&&(!Number.isInteger(r)||r<=0))throw new TypeError("bitrate must be a positive integer or a quality.");lt(t,n);let o=null;return be.length>0&&(o??=ve({codec:t,width:s,height:i,bitrate:r,framerate:void 0,...n}),be.some(c=>c.supports(t,o)))?!0:typeof VideoEncoder>"u"||(s%2===1||i%2===1)&&(t==="avc"||t==="hevc")||(o??=ve({codec:t,width:s,height:i,bitrate:r,framerate:void 0,...n,alpha:"discard"}),!(await VideoEncoder.isConfigSupported(o)).supported)?!1:ye()?new Promise(async c=>{try{const d=new VideoEncoder({output:()=>{},error:()=>c(!1)});d.configure(o);const p=new Uint8Array(s*i*4),h=new VideoFrame(p,{format:"RGBA",codedWidth:s,codedHeight:i,timestamp:0});d.encode(h),h.close(),await d.flush(),c(!0)}catch{c(!1)}}):!0},pi=async(t,e={})=>{const{numberOfChannels:s=2,sampleRate:i=48e3,bitrate:r=128e3,...n}=e;if(!q.includes(t))return!1;if(!Number.isInteger(s)||s<=0)throw new TypeError("numberOfChannels must be a positive integer.");if(!Number.isInteger(i)||i<=0)throw new TypeError("sampleRate must be a positive integer.");if(!(r instanceof K)&&(!Number.isInteger(r)||r<=0))throw new TypeError("bitrate must be a positive integer.");ht(t,n);let o=null;return Ce.length>0&&(o??=Se({codec:t,numberOfChannels:s,sampleRate:i,bitrate:r,...n}),Ce.some(u=>u.supports(t,o)))||ee.includes(t)?!0:typeof AudioEncoder>"u"?!1:(o??=Se({codec:t,numberOfChannels:s,sampleRate:i,bitrate:r,...n}),(await AudioEncoder.isConfigSupported(o)).supported===!0)},gi=async(t,e)=>{for(const s of t)if(await mi(s,e))return s;return null},wi=async(t,e)=>{for(const s of t)if(await pi(s,e))return s;return null};class Ae{constructor(){this._connectedTrack=null,this._closingPromise=null,this._closed=!1,this._timestampOffset=0}_ensureValidAdd(){if(!this._connectedTrack)throw new Error("Source is not connected to an output track.");if(this._connectedTrack.output.state==="canceled")throw new Error("Output has been canceled.");if(this._connectedTrack.output.state==="finalizing"||this._connectedTrack.output.state==="finalized")throw new Error("Output has been finalized.");if(this._connectedTrack.output.state==="pending")throw new Error("Output has not started.");if(this._closed)throw new Error("Source is closed.")}async _start(){}async _flushAndClose(e){}close(){if(this._closingPromise)return;const e=this._connectedTrack;if(!e)throw new Error("Cannot call close without connecting the source to an output track.");if(e.output.state==="pending")throw new Error("Cannot call close before output has been started.");this._closingPromise=(async()=>{await this._flushAndClose(!1),this._closed=!0,!(e.output.state==="finalizing"||e.output.state==="finalized")&&e.output._muxer.onTrackClose(e)})()}async _flushOrWaitForOngoingClose(e){return this._closingPromise?this._closingPromise:this._flushAndClose(e)}}class mt extends Ae{constructor(e){if(super(),this._connectedTrack=null,!$.includes(e))throw new TypeError(`Invalid video codec '${e}'. Must be one of: ${$.join(", ")}.`);this._codec=e}}class Ti{constructor(e,s){this.source=e,this.encodingConfig=s,this.ensureEncoderPromise=null,this.encoderInitialized=!1,this.encoder=null,this.muxer=null,this.lastMultipleOfKeyFrameInterval=-1,this.codedWidth=null,this.codedHeight=null,this.resizeCanvas=null,this.customEncoder=null,this.customEncoderCallSerializer=new Ge,this.customEncoderQueueSize=0,this.alphaEncoder=null,this.splitter=null,this.splitterCreationFailed=!1,this.alphaFrameQueue=[],this.error=null,this.errorNeedsNewStack=!0}async add(e,s,i){try{if(this.checkForEncoderError(),this.source._ensureValidAdd(),this.codedWidth!==null&&this.codedHeight!==null){if(e.codedWidth!==this.codedWidth||e.codedHeight!==this.codedHeight){const a=this.encodingConfig.sizeChangeBehavior??"deny";if(a!=="passThrough"){if(a==="deny")throw new Error(`Video sample size must remain constant. Expected ${this.codedWidth}x${this.codedHeight}, got ${e.codedWidth}x${e.codedHeight}. To allow the sample size to change over time, set \`sizeChangeBehavior\` to a value other than 'strict' in the encoding options.`);{let u=!1;this.resizeCanvas||(typeof document<"u"?(this.resizeCanvas=document.createElement("canvas"),this.resizeCanvas.width=this.codedWidth,this.resizeCanvas.height=this.codedHeight):this.resizeCanvas=new OffscreenCanvas(this.codedWidth,this.codedHeight),u=!0);const c=this.resizeCanvas.getContext("2d",{alpha:ye()});f(c),u||(ye()?(c.fillStyle="black",c.fillRect(0,0,this.codedWidth,this.codedHeight)):c.clearRect(0,0,this.codedWidth,this.codedHeight)),e.drawWithFit(c,{fit:a}),s&&e.close(),e=new qe(this.resizeCanvas,{timestamp:e.timestamp,duration:e.duration,rotation:e.rotation}),s=!0}}}}else this.codedWidth=e.codedWidth,this.codedHeight=e.codedHeight;this.encoderInitialized||(this.ensureEncoderPromise||this.ensureEncoder(e),this.encoderInitialized||await this.ensureEncoderPromise),f(this.encoderInitialized);const r=this.encodingConfig.keyFrameInterval??5,n=Math.floor(e.timestamp/r),o={...i,keyFrame:i?.keyFrame||r===0||n!==this.lastMultipleOfKeyFrameInterval};if(this.lastMultipleOfKeyFrameInterval=n,this.customEncoder){this.customEncoderQueueSize++;const a=e.clone(),u=this.customEncoderCallSerializer.call(()=>this.customEncoder.encode(a,o)).then(()=>this.customEncoderQueueSize--).catch(c=>this.error??=c).finally(()=>{a.close()});this.customEncoderQueueSize>=4&&await u}else{f(this.encoder);const a=e.toVideoFrame();if(!this.alphaEncoder)this.encoder.encode(a,o),a.close();else if(!!a.format&&!a.format.includes("A")||this.splitterCreationFailed)this.alphaFrameQueue.push(null),this.encoder.encode(a,o),a.close();else{const c=a.displayWidth,d=a.displayHeight;if(!this.splitter)try{this.splitter=new bi(c,d)}catch(p){console.error("Due to an error, only color data will be encoded.",p),this.splitterCreationFailed=!0,this.alphaFrameQueue.push(null),this.encoder.encode(a,o),a.close()}if(this.splitter){const p=this.splitter.extractColor(a),h=this.splitter.extractAlpha(a);this.alphaFrameQueue.push(h),this.encoder.encode(p,o),p.close(),a.close()}}s&&e.close(),this.encoder.encodeQueueSize>=4&&await new Promise(u=>this.encoder.addEventListener("dequeue",u,{once:!0}))}await this.muxer.mutex.currentPromise}finally{s&&e.close()}}ensureEncoder(e){const s=new Error;this.ensureEncoderPromise=(async()=>{const i=ve({width:e.codedWidth,height:e.codedHeight,...this.encodingConfig,framerate:this.source._connectedTrack?.metadata.frameRate});this.encodingConfig.onEncoderConfig?.(i);const r=be.find(n=>n.supports(this.encodingConfig.codec,i));if(r)this.customEncoder=new r,this.customEncoder.codec=this.encodingConfig.codec,this.customEncoder.config=i,this.customEncoder.onPacket=(n,o)=>{if(!(n instanceof re))throw new TypeError("The first argument passed to onPacket must be an EncodedPacket.");if(o!==void 0&&(!o||typeof o!="object"))throw new TypeError("The second argument passed to onPacket must be an object or undefined.");this.encodingConfig.onEncodedPacket?.(n,o),this.muxer.addEncodedVideoPacket(this.source._connectedTrack,n,o).catch(a=>{this.error??=a,this.errorNeedsNewStack=!1})},await this.customEncoder.init();else{if(typeof VideoEncoder>"u")throw new Error("VideoEncoder is not supported by this browser.");if(i.alpha="discard",this.encodingConfig.alpha==="keep"&&(i.latencyMode="quality"),(i.width%2===1||i.height%2===1)&&(this.encodingConfig.codec==="avc"||this.encodingConfig.codec==="hevc"))throw new Error(`The dimensions ${i.width}x${i.height} are not supported for codec '${this.encodingConfig.codec}'; both width and height must be even numbers. Make sure to round your dimensions to the nearest even number.`);if(!(await VideoEncoder.isConfigSupported(i)).supported)throw new Error(`This specific encoder configuration (${i.codec}, ${i.bitrate} bps, ${i.width}x${i.height}, hardware acceleration: ${i.hardwareAcceleration??"no-preference"}) is not supported by this browser. Consider using another codec or changing your video parameters.`);const a=[],u=[];let c=0,d=0;const p=(h,m,g)=>{const y={};if(m){const x=new Uint8Array(m.byteLength);m.copyTo(x),y.alpha=x}const E=re.fromEncodedChunk(h,y);this.encodingConfig.onEncodedPacket?.(E,g),this.muxer.addEncodedVideoPacket(this.source._connectedTrack,E,g).catch(x=>{this.error??=x,this.errorNeedsNewStack=!1})};this.encoder=new VideoEncoder({output:(h,m)=>{if(!this.alphaEncoder){p(h,null,m);return}const g=this.alphaFrameQueue.shift();f(g!==void 0),g?(this.alphaEncoder.encode(g,{keyFrame:h.type==="key"}),d++,g.close(),a.push({chunk:h,meta:m})):d===0?p(h,null,m):(u.push(c+d),a.push({chunk:h,meta:m}))},error:h=>{h.stack=s.stack,this.error??=h}}),this.encoder.configure(i),this.encodingConfig.alpha==="keep"&&(this.alphaEncoder=new VideoEncoder({output:(h,m)=>{d--;const g=a.shift();for(f(g!==void 0),p(g.chunk,h,g.meta),c++;u.length>0&&u[0]===c;){u.shift();const y=a.shift();f(y!==void 0),p(y.chunk,null,y.meta)}},error:h=>{h.stack=s.stack,this.error??=h}}),this.alphaEncoder.configure(i))}f(this.source._connectedTrack),this.muxer=this.source._connectedTrack.output._muxer,this.encoderInitialized=!0})()}async flushAndClose(e){e||this.checkForEncoderError(),this.customEncoder?(e||this.customEncoderCallSerializer.call(()=>this.customEncoder.flush()),await this.customEncoderCallSerializer.call(()=>this.customEncoder.close())):this.encoder&&(e||(await this.encoder.flush(),await this.alphaEncoder?.flush()),this.encoder.state!=="closed"&&this.encoder.close(),this.alphaEncoder&&this.alphaEncoder.state!=="closed"&&this.alphaEncoder.close(),this.alphaFrameQueue.forEach(s=>s?.close()),this.splitter?.close()),e||this.checkForEncoderError()}getQueueSize(){return this.customEncoder?this.customEncoderQueueSize:this.encoder?.encodeQueueSize??0}checkForEncoderError(){if(this.error)throw this.errorNeedsNewStack&&(this.error.stack=new Error().stack),this.error}}class bi{constructor(e,s){this.lastFrame=null,typeof OffscreenCanvas<"u"?this.canvas=new OffscreenCanvas(e,s):(this.canvas=document.createElement("canvas"),this.canvas.width=e,this.canvas.height=s);const i=this.canvas.getContext("webgl2",{alpha:!0});if(!i)throw new Error("Couldn't acquire WebGL 2 context.");this.gl=i,this.colorProgram=this.createColorProgram(),this.alphaProgram=this.createAlphaProgram(),this.vao=this.createVAO(),this.sourceTexture=this.createTexture(),this.alphaResolutionLocation=this.gl.getUniformLocation(this.alphaProgram,"u_resolution"),this.gl.useProgram(this.colorProgram),this.gl.uniform1i(this.gl.getUniformLocation(this.colorProgram,"u_sourceTexture"),0),this.gl.useProgram(this.alphaProgram),this.gl.uniform1i(this.gl.getUniformLocation(this.alphaProgram,"u_sourceTexture"),0)}createVertexShader(){return this.createShader(this.gl.VERTEX_SHADER,`#version 300 es
1
+ import{A as Ve,a as f,t as I,i as J,k as Ne,b as _e,R as bt,U as Ct,p as D,l as Q,c as Et,P as ee,g as vt,C as $e,T as Le,M as He,d as te,e as St,f as _t,h as xt,v as kt,j as At,s as Pt,m as Mt,n as Ot,o as zt,q as Bt,r as Ft,u as It,w as Rt,x as ze,y as de,V as $,N as Ut,S as ce,z as q,B as ye,D as be,E as Ce,F as Qe,G as Wt,H as Vt,I as Nt,J as $t,K as qe,L as je,O as Ge,Q as re,W as Lt,X as Ht,Y as z,Z as Qt,_ as qt,$ as jt,a0 as Gt,a1 as Kt,a2 as Xt,a3 as Yt,a4 as Zt,a5 as Jt,a6 as ne,a7 as oe,a8 as Dt,a9 as he}from"./index-otgIUTZs.js";class es{constructor(e){this.mutex=new Ve,this.firstMediaStreamTimestamp=null,this.trackTimestampInfo=new WeakMap,this.output=e}onTrackClose(e){}validateAndNormalizeTimestamp(e,s,i){s+=e.source._timestampOffset;let r=this.trackTimestampInfo.get(e);if(!r){if(!i)throw new Error("First packet must be a key packet.");r={maxTimestamp:s,maxTimestampBeforeLastKeyPacket:s},this.trackTimestampInfo.set(e,r)}if(s<0)throw new Error(`Timestamps must be non-negative (got ${s}s).`);if(i&&(r.maxTimestampBeforeLastKeyPacket=r.maxTimestamp),s<r.maxTimestampBeforeLastKeyPacket)throw new Error(`Timestamps cannot be smaller than the largest timestamp of the previous GOP (a GOP begins with a key packet and ends right before the next key packet). Got ${s}s, but largest timestamp is ${r.maxTimestampBeforeLastKeyPacket}s.`);return r.maxTimestamp=Math.max(r.maxTimestamp,s),s}}const Be=/<(?:(\d{2}):)?(\d{2}):(\d{2}).(\d{3})>/g,ts=t=>{const e=Math.floor(t/36e5),s=Math.floor(t%(3600*1e3)/(60*1e3)),i=Math.floor(t%(60*1e3)/1e3),r=t%1e3;return e.toString().padStart(2,"0")+":"+s.toString().padStart(2,"0")+":"+i.toString().padStart(2,"0")+"."+r.toString().padStart(3,"0")};class Fe{constructor(e){this.writer=e,this.helper=new Uint8Array(8),this.helperView=new DataView(this.helper.buffer),this.offsets=new WeakMap}writeU32(e){this.helperView.setUint32(0,e,!1),this.writer.write(this.helper.subarray(0,4))}writeU64(e){this.helperView.setUint32(0,Math.floor(e/2**32),!1),this.helperView.setUint32(4,e,!1),this.writer.write(this.helper.subarray(0,8))}writeAscii(e){for(let s=0;s<e.length;s++)this.helperView.setUint8(s%8,e.charCodeAt(s)),s%8===7&&this.writer.write(this.helper);e.length%8!==0&&this.writer.write(this.helper.subarray(0,e.length%8))}writeBox(e){if(this.offsets.set(e,this.writer.getPos()),e.contents&&!e.children)this.writeBoxHeader(e,e.size??e.contents.byteLength+8),this.writer.write(e.contents);else{const s=this.writer.getPos();if(this.writeBoxHeader(e,0),e.contents&&this.writer.write(e.contents),e.children)for(const n of e.children)n&&this.writeBox(n);const i=this.writer.getPos(),r=e.size??i-s;this.writer.seek(s),this.writeBoxHeader(e,r),this.writer.seek(i)}}writeBoxHeader(e,s){this.writeU32(e.largeSize?1:s),this.writeAscii(e.type),e.largeSize&&this.writeU64(s)}measureBoxHeader(e){return 8+(e.largeSize?8:0)}patchBox(e){const s=this.offsets.get(e);f(s!==void 0);const i=this.writer.getPos();this.writer.seek(s),this.writeBox(e),this.writer.seek(i)}measureBox(e){if(e.contents&&!e.children)return this.measureBoxHeader(e)+e.contents.byteLength;{let s=this.measureBoxHeader(e);if(e.contents&&(s+=e.contents.byteLength),e.children)for(const i of e.children)i&&(s+=this.measureBox(i));return s}}}const y=new Uint8Array(8),R=new DataView(y.buffer),v=t=>[(t%256+256)%256],w=t=>(R.setUint16(0,t,!1),[y[0],y[1]]),Ke=t=>(R.setInt16(0,t,!1),[y[0],y[1]]),Xe=t=>(R.setUint32(0,t,!1),[y[1],y[2],y[3]]),d=t=>(R.setUint32(0,t,!1),[y[0],y[1],y[2],y[3]]),N=t=>(R.setInt32(0,t,!1),[y[0],y[1],y[2],y[3]]),j=t=>(R.setUint32(0,Math.floor(t/2**32),!1),R.setUint32(4,t,!1),[y[0],y[1],y[2],y[3],y[4],y[5],y[6],y[7]]),Ye=t=>(R.setInt16(0,2**8*t,!1),[y[0],y[1]]),W=t=>(R.setInt32(0,2**16*t,!1),[y[0],y[1],y[2],y[3]]),fe=t=>(R.setInt32(0,2**30*t,!1),[y[0],y[1],y[2],y[3]]),me=(t,e)=>{const s=[];let i=t;do{let r=i&127;i>>=7,s.length>0&&(r|=128),s.push(r)}while(i>0||e);return s.reverse()},k=(t,e=!1)=>{const s=Array(t.length).fill(null).map((i,r)=>t.charCodeAt(r));return e&&s.push(0),s},xe=t=>{let e=null;for(const s of t)(!e||s.timestamp>e.timestamp)&&(e=s);return e},Ze=t=>{const e=t*(Math.PI/180),s=Math.round(Math.cos(e)),i=Math.round(Math.sin(e));return[s,i,0,-i,s,0,0,0,1]},Je=Ze(0),De=t=>[W(t[0]),W(t[1]),fe(t[2]),W(t[3]),W(t[4]),fe(t[5]),W(t[6]),W(t[7]),fe(t[8])],T=(t,e,s)=>({type:t,contents:e&&new Uint8Array(e.flat(10)),children:s}),C=(t,e,s,i,r)=>T(t,[v(e),Xe(s),i??[]],r),ss=t=>t.isQuickTime?T("ftyp",[k("qt "),d(512),k("qt ")]):t.fragmented?T("ftyp",[k("iso5"),d(512),k("iso5"),k("iso6"),k("mp41")]):T("ftyp",[k("isom"),d(512),k("isom"),t.holdsAvc?k("avc1"):[],k("mp41")]),ae=t=>({type:"mdat",largeSize:t}),is=t=>({type:"free",size:t}),ie=t=>T("moov",void 0,[rs(t.creationTime,t.trackDatas),...t.trackDatas.map(e=>ns(e,t.creationTime)),t.isFragmented?Ns(t.trackDatas):null,Ds(t)]),rs=(t,e)=>{const s=_(Math.max(0,...e.filter(o=>o.samples.length>0).map(o=>{const a=xe(o.samples);return a.timestamp+a.duration})),Ee),i=Math.max(0,...e.map(o=>o.track.id))+1,r=!J(t)||!J(s),n=r?j:d;return C("mvhd",+r,0,[n(t),n(t),d(Ee),n(s),W(1),Ye(1),Array(10).fill(0),De(Je),Array(24).fill(0),d(i)])},ns=(t,e)=>{const s=li(t);return T("trak",void 0,[os(t,e),as(t,e),s.name!==void 0?T("udta",void 0,[T("name",[...I.encode(s.name)])]):null])},os=(t,e)=>{const s=xe(t.samples),i=_(s?s.timestamp+s.duration:0,Ee),r=!J(e)||!J(i),n=r?j:d;let o;if(t.type==="video"){const u=t.track.metadata.rotation;o=Ze(u??0)}else o=Je;let a=2;return t.track.metadata.disposition?.default!==!1&&(a|=1),C("tkhd",+r,a,[n(e),n(e),d(t.track.id),d(0),n(i),Array(8).fill(0),w(0),w(t.track.id),Ye(t.type==="audio"?1:0),w(0),De(o),W(t.type==="video"?t.info.width:0),W(t.type==="video"?t.info.height:0)])},as=(t,e)=>T("mdia",void 0,[cs(t,e),ke(!0,us[t.type],ls[t.type]),ds(t)]),cs=(t,e)=>{const s=xe(t.samples),i=_(s?s.timestamp+s.duration:0,t.timescale),r=!J(e)||!J(i),n=r?j:d;return C("mdhd",+r,0,[n(e),n(e),d(t.timescale),n(i),w(it(t.track.metadata.languageCode??Ct)),w(0)])},us={video:"vide",audio:"soun",subtitle:"text"},ls={video:"MediabunnyVideoHandler",audio:"MediabunnySoundHandler",subtitle:"MediabunnyTextHandler"},ke=(t,e,s,i="\0\0\0\0")=>C("hdlr",0,0,[t?k("mhlr"):d(0),k(e),k(i),d(0),d(0),k(s,!0)]),ds=t=>T("minf",void 0,[ps[t.type](),gs(),ys(t)]),hs=()=>C("vmhd",0,1,[w(0),w(0),w(0),w(0)]),fs=()=>C("smhd",0,0,[w(0),w(0)]),ms=()=>C("nmhd",0,0),ps={video:hs,audio:fs,subtitle:ms},gs=()=>T("dinf",void 0,[ws()]),ws=()=>C("dref",0,0,[d(1)],[Ts()]),Ts=()=>C("url ",0,1),ys=t=>{const e=t.compositionTimeOffsetTable.length>1||t.compositionTimeOffsetTable.some(s=>s.sampleCompositionTimeOffset!==0);return T("stbl",void 0,[bs(t),Bs(t),e?Ws(t):null,e?Vs(t):null,Is(t),Rs(t),Us(t),Fs(t)])},bs=t=>{let e;if(t.type==="video")e=Cs(ii(t.track.source._codec,t.info.decoderConfig.codec),t);else if(t.type==="audio"){const s=st(t.track.source._codec,t.muxer.isQuickTime);f(s),e=xs(s,t)}else t.type==="subtitle"&&(e=Os(oi[t.track.source._codec],t));return f(e),C("stsd",0,0,[d(1)],[e])},Cs=(t,e)=>T(t,[Array(6).fill(0),w(1),w(0),w(0),Array(12).fill(0),w(e.info.width),w(e.info.height),d(4718592),d(4718592),d(0),w(1),Array(32).fill(0),w(24),Ke(65535)],[ri[e.track.source._codec](e),Et(e.info.decoderConfig.colorSpace)?Es(e):null]),Es=t=>T("colr",[k("nclx"),w($e[t.info.decoderConfig.colorSpace.primaries]),w(Le[t.info.decoderConfig.colorSpace.transfer]),w(He[t.info.decoderConfig.colorSpace.matrix]),v((t.info.decoderConfig.colorSpace.fullRange?1:0)<<7)]),vs=t=>t.info.decoderConfig&&T("avcC",[...te(t.info.decoderConfig.description)]),Ss=t=>t.info.decoderConfig&&T("hvcC",[...te(t.info.decoderConfig.description)]),Ie=t=>{if(!t.info.decoderConfig)return null;const e=t.info.decoderConfig,s=e.codec.split("."),i=Number(s[1]),r=Number(s[2]),n=Number(s[3]),o=s[4]?Number(s[4]):1,a=s[8]?Number(s[8]):Number(e.colorSpace?.fullRange??0),u=(n<<4)+(o<<1)+a,c=s[5]?Number(s[5]):e.colorSpace?.primaries?$e[e.colorSpace.primaries]:2,l=s[6]?Number(s[6]):e.colorSpace?.transfer?Le[e.colorSpace.transfer]:2,m=s[7]?Number(s[7]):e.colorSpace?.matrix?He[e.colorSpace.matrix]:2;return C("vpcC",1,0,[v(i),v(r),v(u),v(c),v(l),v(m),w(0)])},_s=t=>T("av1C",vt(t.info.decoderConfig.codec)),xs=(t,e)=>{let s=0,i,r=16;if(ee.includes(e.track.source._codec)){const n=e.track.source._codec,{sampleSize:o}=D(n);r=8*o,r>16&&(s=1)}return s===0?i=[Array(6).fill(0),w(1),w(s),w(0),d(0),w(e.info.numberOfChannels),w(r),w(0),w(0),w(e.info.sampleRate<2**16?e.info.sampleRate:0),w(0)]:i=[Array(6).fill(0),w(1),w(s),w(0),d(0),w(e.info.numberOfChannels),w(Math.min(r,16)),w(0),w(0),w(e.info.sampleRate<2**16?e.info.sampleRate:0),w(0),d(1),d(r/8),d(e.info.numberOfChannels*r/8),d(2)],T(t,i,[ni(e.track.source._codec,e.muxer.isQuickTime)?.(e)??null])},pe=t=>{let e;switch(t.track.source._codec){case"aac":e=64;break;case"mp3":e=107;break;case"vorbis":e=221;break;default:throw new Error(`Unhandled audio codec: ${t.track.source._codec}`)}let s=[...v(e),...v(21),...Xe(0),...d(0),...d(0)];if(t.info.decoderConfig.description){const i=te(t.info.decoderConfig.description);s=[...s,...v(5),...me(i.byteLength),...i]}return s=[...w(1),...v(0),...v(4),...me(s.length),...s,...v(6),...v(1),...v(2)],s=[...v(3),...me(s.length),...s],C("esds",0,0,s)},V=t=>T("wave",void 0,[ks(t),As(t),T("\0\0\0\0")]),ks=t=>T("frma",[k(st(t.track.source._codec,t.muxer.isQuickTime))]),As=t=>{const{littleEndian:e}=D(t.track.source._codec);return T("enda",[w(+e)])},Ps=t=>{let e=t.info.numberOfChannels,s=3840,i=t.info.sampleRate,r=0,n=0,o=new Uint8Array(0);const a=t.info.decoderConfig?.description;if(a){f(a.byteLength>=18);const u=te(a),c=St(u);e=c.outputChannelCount,s=c.preSkip,i=c.inputSampleRate,r=c.outputGain,n=c.channelMappingFamily,c.channelMappingTable&&(o=c.channelMappingTable)}return T("dOps",[v(0),v(e),w(s),d(i),Ke(r),v(n),...o])},Ms=t=>{const e=t.info.decoderConfig?.description;f(e);const s=te(e);return C("dfLa",0,0,[...s.subarray(4)])},B=t=>{const{littleEndian:e,sampleSize:s}=D(t.track.source._codec),i=+e;return C("pcmC",0,0,[v(i),v(8*s)])},Os=(t,e)=>T(t,[Array(6).fill(0),w(1)],[ai[e.track.source._codec](e)]),zs=t=>T("vttC",[...I.encode(t.info.config.description)]),Bs=t=>C("stts",0,0,[d(t.timeToSampleTable.length),t.timeToSampleTable.map(e=>[d(e.sampleCount),d(e.sampleDelta)])]),Fs=t=>{if(t.samples.every(s=>s.type==="key"))return null;const e=[...t.samples.entries()].filter(([,s])=>s.type==="key");return C("stss",0,0,[d(e.length),e.map(([s])=>d(s+1))])},Is=t=>C("stsc",0,0,[d(t.compactlyCodedChunkTable.length),t.compactlyCodedChunkTable.map(e=>[d(e.firstChunk),d(e.samplesPerChunk),d(1)])]),Rs=t=>{if(t.type==="audio"&&t.info.requiresPcmTransformation){const{sampleSize:e}=D(t.track.source._codec);return C("stsz",0,0,[d(e*t.info.numberOfChannels),d(t.samples.reduce((s,i)=>s+_(i.duration,t.timescale),0))])}return C("stsz",0,0,[d(0),d(t.samples.length),t.samples.map(e=>d(e.size))])},Us=t=>t.finalizedChunks.length>0&&Q(t.finalizedChunks).offset>=2**32?C("co64",0,0,[d(t.finalizedChunks.length),t.finalizedChunks.map(e=>j(e.offset))]):C("stco",0,0,[d(t.finalizedChunks.length),t.finalizedChunks.map(e=>d(e.offset))]),Ws=t=>C("ctts",1,0,[d(t.compositionTimeOffsetTable.length),t.compositionTimeOffsetTable.map(e=>[d(e.sampleCount),N(e.sampleCompositionTimeOffset)])]),Vs=t=>{let e=1/0,s=-1/0,i=1/0,r=-1/0;f(t.compositionTimeOffsetTable.length>0),f(t.samples.length>0);for(let o=0;o<t.compositionTimeOffsetTable.length;o++){const a=t.compositionTimeOffsetTable[o];e=Math.min(e,a.sampleCompositionTimeOffset),s=Math.max(s,a.sampleCompositionTimeOffset)}for(let o=0;o<t.samples.length;o++){const a=t.samples[o];i=Math.min(i,_(a.timestamp,t.timescale)),r=Math.max(r,_(a.timestamp+a.duration,t.timescale))}const n=Math.max(-e,0);return r>=2**31?null:C("cslg",0,0,[N(n),N(e),N(s),N(i),N(r)])},Ns=t=>T("mvex",void 0,t.map($s)),$s=t=>C("trex",0,0,[d(t.track.id),d(1),d(0),d(0),d(0)]),Re=(t,e)=>T("moof",void 0,[Ls(t),...e.map(Hs)]),Ls=t=>C("mfhd",0,0,[d(t)]),et=t=>{let e=0,s=0;const i=0,r=0,n=t.type==="delta";return s|=+n,n?e|=1:e|=2,e<<24|s<<16|i<<8|r},Hs=t=>T("traf",void 0,[Qs(t),qs(t),js(t)]),Qs=t=>{f(t.currentChunk);let e=0;e|=8,e|=16,e|=32,e|=131072;const s=t.currentChunk.samples[1]??t.currentChunk.samples[0],i={duration:s.timescaleUnitsToNextSample,size:s.size,flags:et(s)};return C("tfhd",0,e,[d(t.track.id),d(i.duration),d(i.size),d(i.flags)])},qs=t=>(f(t.currentChunk),C("tfdt",1,0,[j(_(t.currentChunk.startTimestamp,t.timescale))])),js=t=>{f(t.currentChunk);const e=t.currentChunk.samples.map(b=>b.timescaleUnitsToNextSample),s=t.currentChunk.samples.map(b=>b.size),i=t.currentChunk.samples.map(et),r=t.currentChunk.samples.map(b=>_(b.timestamp-b.decodeTimestamp,t.timescale)),n=new Set(e),o=new Set(s),a=new Set(i),u=new Set(r),c=a.size===2&&i[0]!==i[1],l=n.size>1,m=o.size>1,h=!c&&a.size>1,p=u.size>1||[...u].some(b=>b!==0);let g=0;return g|=1,g|=4*+c,g|=256*+l,g|=512*+m,g|=1024*+h,g|=2048*+p,C("trun",1,g,[d(t.currentChunk.samples.length),d(t.currentChunk.offset-t.currentChunk.moofOffset||0),c?d(i[0]):[],t.currentChunk.samples.map((b,E)=>[l?d(e[E]):[],m?d(s[E]):[],h?d(i[E]):[],p?N(r[E]):[]])])},Gs=t=>T("mfra",void 0,[...t.map(Ks),Xs()]),Ks=(t,e)=>C("tfra",1,0,[d(t.track.id),d(63),d(t.finalizedChunks.length),t.finalizedChunks.map(i=>[j(_(i.samples[0].timestamp,t.timescale)),j(i.moofOffset),d(e+1),d(1),d(1)])]),Xs=()=>C("mfro",0,0,[d(0)]),Ys=()=>T("vtte"),Zs=(t,e,s,i,r)=>T("vttc",void 0,[r!==null?T("vsid",[N(r)]):null,s!==null?T("iden",[...I.encode(s)]):null,e!==null?T("ctim",[...I.encode(ts(e))]):null,i!==null?T("sttg",[...I.encode(i)]):null,T("payl",[...I.encode(t)])]),Js=t=>T("vtta",[...I.encode(t)]),Ds=t=>{const e=[],s=t.format._options.metadataFormat??"auto",i=t.output._metadataTags;if(s==="mdir"||s==="auto"&&!t.isQuickTime){const r=ti(i);r&&e.push(r)}else if(s==="mdta"){const r=si(i);r&&e.push(r)}else(s==="udta"||s==="auto"&&t.isQuickTime)&&ei(e,t.output._metadataTags);return e.length===0?null:T("udta",void 0,e)},ei=(t,e)=>{for(const{key:s,value:i}of Ne(e))switch(s){case"title":t.push(F("©nam",i));break;case"description":t.push(F("©des",i));break;case"artist":t.push(F("©ART",i));break;case"album":t.push(F("©alb",i));break;case"albumArtist":t.push(F("albr",i));break;case"genre":t.push(F("©gen",i));break;case"date":t.push(F("©day",i.toISOString().slice(0,10)));break;case"comment":t.push(F("©cmt",i));break;case"lyrics":t.push(F("©lyr",i));break;case"raw":break;case"discNumber":case"discsTotal":case"trackNumber":case"tracksTotal":case"images":break;default:_e(s)}if(e.raw)for(const s in e.raw){const i=e.raw[s];i==null||s.length!==4||t.some(r=>r.type===s)||(typeof i=="string"?t.push(F(s,i)):i instanceof Uint8Array&&t.push(T(s,Array.from(i))))}},F=(t,e)=>{const s=I.encode(e);return T(t,[w(s.length),w(it("und")),Array.from(s)])},Ue={"image/jpeg":13,"image/png":14,"image/bmp":27},tt=(t,e)=>{const s=[];for(const{key:i,value:r}of Ne(t))switch(i){case"title":s.push({key:e?"title":"©nam",value:M(r)});break;case"description":s.push({key:e?"description":"©des",value:M(r)});break;case"artist":s.push({key:e?"artist":"©ART",value:M(r)});break;case"album":s.push({key:e?"album":"©alb",value:M(r)});break;case"albumArtist":s.push({key:e?"album_artist":"aART",value:M(r)});break;case"comment":s.push({key:e?"comment":"©cmt",value:M(r)});break;case"genre":s.push({key:e?"genre":"©gen",value:M(r)});break;case"lyrics":s.push({key:e?"lyrics":"©lyr",value:M(r)});break;case"date":s.push({key:e?"date":"©day",value:M(r.toISOString().slice(0,10))});break;case"images":for(const n of r)n.kind==="coverFront"&&s.push({key:"covr",value:T("data",[d(Ue[n.mimeType]??0),d(0),Array.from(n.data)])});break;case"trackNumber":if(e){const n=t.tracksTotal!==void 0?`${r}/${t.tracksTotal}`:r.toString();s.push({key:"track",value:M(n)})}else s.push({key:"trkn",value:T("data",[d(0),d(0),w(0),w(r),w(t.tracksTotal??0),w(0)])});break;case"discNumber":e||s.push({key:"disc",value:T("data",[d(0),d(0),w(0),w(r),w(t.discsTotal??0),w(0)])});break;case"tracksTotal":case"discsTotal":break;case"raw":break;default:_e(i)}if(t.raw)for(const i in t.raw){const r=t.raw[i];r==null||!e&&i.length!==4||s.some(n=>n.key===i)||(typeof r=="string"?s.push({key:i,value:M(r)}):r instanceof Uint8Array?s.push({key:i,value:T("data",[d(0),d(0),Array.from(r)])}):r instanceof bt&&s.push({key:i,value:T("data",[d(Ue[r.mimeType]??0),d(0),Array.from(r.data)])}))}return s},ti=t=>{const e=tt(t,!1);return e.length===0?null:C("meta",0,0,void 0,[ke(!1,"mdir","","appl"),T("ilst",void 0,e.map(s=>T(s.key,void 0,[s.value])))])},si=t=>{const e=tt(t,!0);return e.length===0?null:T("meta",void 0,[ke(!1,"mdta",""),C("keys",0,0,[d(e.length)],e.map(s=>T("mdta",[...I.encode(s.key)]))),T("ilst",void 0,e.map((s,i)=>{const r=String.fromCharCode(...d(i+1));return T(r,void 0,[s.value])}))])},M=t=>T("data",[d(1),d(0),...I.encode(t)]),ii=(t,e)=>{switch(t){case"avc":return e.startsWith("avc3")?"avc3":"avc1";case"hevc":return"hvc1";case"vp8":return"vp08";case"vp9":return"vp09";case"av1":return"av01"}},ri={avc:vs,hevc:Ss,vp8:Ie,vp9:Ie,av1:_s},st=(t,e)=>{switch(t){case"aac":return"mp4a";case"mp3":return"mp4a";case"opus":return"Opus";case"vorbis":return"mp4a";case"flac":return"fLaC";case"ulaw":return"ulaw";case"alaw":return"alaw";case"pcm-u8":return"raw ";case"pcm-s8":return"sowt"}if(e)switch(t){case"pcm-s16":return"sowt";case"pcm-s16be":return"twos";case"pcm-s24":return"in24";case"pcm-s24be":return"in24";case"pcm-s32":return"in32";case"pcm-s32be":return"in32";case"pcm-f32":return"fl32";case"pcm-f32be":return"fl32";case"pcm-f64":return"fl64";case"pcm-f64be":return"fl64"}else switch(t){case"pcm-s16":return"ipcm";case"pcm-s16be":return"ipcm";case"pcm-s24":return"ipcm";case"pcm-s24be":return"ipcm";case"pcm-s32":return"ipcm";case"pcm-s32be":return"ipcm";case"pcm-f32":return"fpcm";case"pcm-f32be":return"fpcm";case"pcm-f64":return"fpcm";case"pcm-f64be":return"fpcm"}},ni=(t,e)=>{switch(t){case"aac":return pe;case"mp3":return pe;case"opus":return Ps;case"vorbis":return pe;case"flac":return Ms}if(e)switch(t){case"pcm-s24":return V;case"pcm-s24be":return V;case"pcm-s32":return V;case"pcm-s32be":return V;case"pcm-f32":return V;case"pcm-f32be":return V;case"pcm-f64":return V;case"pcm-f64be":return V}else switch(t){case"pcm-s16":return B;case"pcm-s16be":return B;case"pcm-s24":return B;case"pcm-s24be":return B;case"pcm-s32":return B;case"pcm-s32be":return B;case"pcm-f32":return B;case"pcm-f32be":return B;case"pcm-f64":return B;case"pcm-f64be":return B}return null},oi={webvtt:"wvtt"},ai={webvtt:zs},it=t=>{f(t.length===3);let e=0;for(let s=0;s<3;s++)e<<=5,e+=t.charCodeAt(s)-96;return e};class ci{constructor(){this.ensureMonotonicity=!1,this.trackedWrites=null,this.trackedStart=-1,this.trackedEnd=-1}start(){}maybeTrackWrites(e){if(!this.trackedWrites)return;let s=this.getPos();if(s<this.trackedStart){if(s+e.byteLength<=this.trackedStart)return;e=e.subarray(this.trackedStart-s),s=0}const i=s+e.byteLength-this.trackedStart;let r=this.trackedWrites.byteLength;for(;r<i;)r*=2;if(r!==this.trackedWrites.byteLength){const n=new Uint8Array(r);n.set(this.trackedWrites,0),this.trackedWrites=n}this.trackedWrites.set(e,s-this.trackedStart),this.trackedEnd=Math.max(this.trackedEnd,s+e.byteLength)}startTrackingWrites(){this.trackedWrites=new Uint8Array(2**10),this.trackedStart=this.getPos(),this.trackedEnd=this.trackedStart}stopTrackingWrites(){if(!this.trackedWrites)throw new Error("Internal error: Can't get tracked writes since nothing was tracked.");const s={data:this.trackedWrites.subarray(0,this.trackedEnd-this.trackedStart),start:this.trackedStart,end:this.trackedEnd};return this.trackedWrites=null,s}}const ge=2**16,we=2**32;class rt extends ci{constructor(e){if(super(),this.pos=0,this.maxPos=0,this.target=e,this.supportsResize="resize"in new ArrayBuffer(0),this.supportsResize)try{this.buffer=new ArrayBuffer(ge,{maxByteLength:we})}catch{this.buffer=new ArrayBuffer(ge),this.supportsResize=!1}else this.buffer=new ArrayBuffer(ge);this.bytes=new Uint8Array(this.buffer)}ensureSize(e){let s=this.buffer.byteLength;for(;s<e;)s*=2;if(s!==this.buffer.byteLength){if(s>we)throw new Error(`ArrayBuffer exceeded maximum size of ${we} bytes. Please consider using another target.`);if(this.supportsResize)this.buffer.resize(s);else{const i=new ArrayBuffer(s),r=new Uint8Array(i);r.set(this.bytes,0),this.buffer=i,this.bytes=r}}}write(e){this.maybeTrackWrites(e),this.ensureSize(this.pos+e.byteLength),this.bytes.set(e,this.pos),this.target.onwrite?.(this.pos,this.pos+e.byteLength),this.pos+=e.byteLength,this.maxPos=Math.max(this.maxPos,this.pos)}seek(e){this.pos=e}getPos(){return this.pos}async flush(){}async finalize(){this.ensureSize(this.pos),this.target.buffer=this.buffer.slice(0,Math.max(this.maxPos,this.pos))}async close(){}getSlice(e,s){return this.bytes.slice(e,s)}}class nt{constructor(){this._output=null,this.onwrite=null}}class ot extends nt{constructor(){super(...arguments),this.buffer=null}_createWriter(){return new rt(this)}}const Ee=1e3,ui=2082844800,li=t=>{const e={},s=t.track;return s.metadata.name!==void 0&&(e.name=s.metadata.name),e},_=(t,e,s=!0)=>{const i=t*e;return s?Math.round(i):i};class di extends es{constructor(e,s){super(e),this.auxTarget=new ot,this.auxWriter=this.auxTarget._createWriter(),this.auxBoxWriter=new Fe(this.auxWriter),this.mdat=null,this.ftypSize=null,this.trackDatas=[],this.allTracksKnown=_t(),this.creationTime=Math.floor(Date.now()/1e3)+ui,this.finalizedChunks=[],this.nextFragmentNumber=1,this.maxWrittenTimestamp=-1/0,this.format=s,this.writer=e._writer,this.boxWriter=new Fe(this.writer),this.isQuickTime=s instanceof lt;const i=this.writer instanceof rt?"in-memory":!1;this.fastStart=s._options.fastStart??i,this.isFragmented=this.fastStart==="fragmented",(this.fastStart==="in-memory"||this.isFragmented)&&(this.writer.ensureMonotonicity=!0),this.minimumFragmentDuration=s._options.minimumFragmentDuration??1}async start(){const e=await this.mutex.acquire(),s=this.output._tracks.some(i=>i.type==="video"&&i.source._codec==="avc");if(this.format._options.onFtyp&&this.writer.startTrackingWrites(),this.boxWriter.writeBox(ss({isQuickTime:this.isQuickTime,holdsAvc:s,fragmented:this.isFragmented})),this.format._options.onFtyp){const{data:i,start:r}=this.writer.stopTrackingWrites();this.format._options.onFtyp(i,r)}if(this.ftypSize=this.writer.getPos(),this.fastStart!=="in-memory")if(this.fastStart==="reserve"){for(const i of this.output._tracks)if(i.metadata.maximumPacketCount===void 0)throw new Error("All tracks must specify maximumPacketCount in their metadata when using fastStart: 'reserve'.")}else this.isFragmented||(this.format._options.onMdat&&this.writer.startTrackingWrites(),this.mdat=ae(!0),this.boxWriter.writeBox(this.mdat));await this.writer.flush(),e()}allTracksAreKnown(){for(const e of this.output._tracks)if(!e.source._closed&&!this.trackDatas.some(s=>s.track===e))return!1;return!0}async getMimeType(){await this.allTracksKnown.promise;const e=this.trackDatas.map(s=>s.type==="video"||s.type==="audio"?s.info.decoderConfig.codec:{webvtt:"wvtt"}[s.track.source._codec]);return xt({isQuickTime:this.isQuickTime,hasVideo:this.trackDatas.some(s=>s.type==="video"),hasAudio:this.trackDatas.some(s=>s.type==="audio"),codecStrings:e})}getVideoTrackData(e,s,i){const r=this.trackDatas.find(c=>c.track===e);if(r)return r;kt(i),f(i),f(i.decoderConfig);const n={...i.decoderConfig};f(n.codedWidth!==void 0),f(n.codedHeight!==void 0);let o=!1;if(e.source._codec==="avc"&&!n.description){const c=At(s.data);if(!c)throw new Error("Couldn't extract an AVCDecoderConfigurationRecord from the AVC packet. Make sure the packets are in Annex B format (as specified in ITU-T-REC-H.264) when not providing a description, or provide a description (must be an AVCDecoderConfigurationRecord as specified in ISO 14496-15) and ensure the packets are in AVCC format.");n.description=Pt(c),o=!0}else if(e.source._codec==="hevc"&&!n.description){const c=Mt(s.data);if(!c)throw new Error("Couldn't extract an HEVCDecoderConfigurationRecord from the HEVC packet. Make sure the packets are in Annex B format (as specified in ITU-T-REC-H.265) when not providing a description, or provide a description (must be an HEVCDecoderConfigurationRecord as specified in ISO 14496-15) and ensure the packets are in HEVC format.");n.description=Ot(c),o=!0}const a=zt(1/(e.metadata.frameRate??57600),1e6).denominator,u={muxer:this,track:e,type:"video",info:{width:n.codedWidth,height:n.codedHeight,decoderConfig:n,requiresAnnexBTransformation:o},timescale:a,samples:[],sampleQueue:[],timestampProcessingQueue:[],timeToSampleTable:[],compositionTimeOffsetTable:[],lastTimescaleUnits:null,lastSample:null,finalizedChunks:[],currentChunk:null,compactlyCodedChunkTable:[]};return this.trackDatas.push(u),this.trackDatas.sort((c,l)=>c.track.id-l.track.id),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),u}getAudioTrackData(e,s){const i=this.trackDatas.find(n=>n.track===e);if(i)return i;Bt(s),f(s),f(s.decoderConfig);const r={muxer:this,track:e,type:"audio",info:{numberOfChannels:s.decoderConfig.numberOfChannels,sampleRate:s.decoderConfig.sampleRate,decoderConfig:s.decoderConfig,requiresPcmTransformation:!this.isFragmented&&ee.includes(e.source._codec)},timescale:s.decoderConfig.sampleRate,samples:[],sampleQueue:[],timestampProcessingQueue:[],timeToSampleTable:[],compositionTimeOffsetTable:[],lastTimescaleUnits:null,lastSample:null,finalizedChunks:[],currentChunk:null,compactlyCodedChunkTable:[]};return this.trackDatas.push(r),this.trackDatas.sort((n,o)=>n.track.id-o.track.id),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),r}getSubtitleTrackData(e,s){const i=this.trackDatas.find(n=>n.track===e);if(i)return i;Ft(s),f(s),f(s.config);const r={muxer:this,track:e,type:"subtitle",info:{config:s.config},timescale:1e3,samples:[],sampleQueue:[],timestampProcessingQueue:[],timeToSampleTable:[],compositionTimeOffsetTable:[],lastTimescaleUnits:null,lastSample:null,finalizedChunks:[],currentChunk:null,compactlyCodedChunkTable:[],lastCueEndTimestamp:0,cueQueue:[],nextSourceId:0,cueToSourceId:new WeakMap};return this.trackDatas.push(r),this.trackDatas.sort((n,o)=>n.track.id-o.track.id),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),r}async addEncodedVideoPacket(e,s,i){const r=await this.mutex.acquire();try{const n=this.getVideoTrackData(e,s,i);let o=s.data;if(n.info.requiresAnnexBTransformation){const c=It(o);if(c.length===0)throw new Error("Failed to transform packet data. Make sure all packets are provided in Annex B format, as specified in ITU-T-REC-H.264 and ITU-T-REC-H.265.");o=Rt(c,4)}const a=this.validateAndNormalizeTimestamp(n.track,s.timestamp,s.type==="key"),u=this.createSampleForTrack(n,o,a,s.duration,s.type);await this.registerSample(n,u)}finally{r()}}async addEncodedAudioPacket(e,s,i){const r=await this.mutex.acquire();try{const n=this.getAudioTrackData(e,i),o=this.validateAndNormalizeTimestamp(n.track,s.timestamp,s.type==="key"),a=this.createSampleForTrack(n,s.data,o,s.duration,s.type);n.info.requiresPcmTransformation&&await this.maybePadWithSilence(n,o),await this.registerSample(n,a)}finally{r()}}async maybePadWithSilence(e,s){const i=Q(e.samples),r=i?i.timestamp+i.duration:0,n=s-r,o=_(n,e.timescale);if(o>0){const{sampleSize:a,silentValue:u}=D(e.info.decoderConfig.codec),c=o*e.info.numberOfChannels,l=new Uint8Array(a*c).fill(u),m=this.createSampleForTrack(e,new Uint8Array(l.buffer),r,n,"key");await this.registerSample(e,m)}}async addSubtitleCue(e,s,i){const r=await this.mutex.acquire();try{const n=this.getSubtitleTrackData(e,i);this.validateAndNormalizeTimestamp(n.track,s.timestamp,!0),e.source._codec==="webvtt"&&(n.cueQueue.push(s),await this.processWebVTTCues(n,s.timestamp))}finally{r()}}async processWebVTTCues(e,s){for(;e.cueQueue.length>0;){const i=new Set([]);for(const c of e.cueQueue)f(c.timestamp<=s),f(e.lastCueEndTimestamp<=c.timestamp+c.duration),i.add(Math.max(c.timestamp,e.lastCueEndTimestamp)),i.add(c.timestamp+c.duration);const r=[...i].sort((c,l)=>c-l),n=r[0],o=r[1]??n;if(s<o)break;if(e.lastCueEndTimestamp<n){this.auxWriter.seek(0);const c=Ys();this.auxBoxWriter.writeBox(c);const l=this.auxWriter.getSlice(0,this.auxWriter.getPos()),m=this.createSampleForTrack(e,l,e.lastCueEndTimestamp,n-e.lastCueEndTimestamp,"key");await this.registerSample(e,m),e.lastCueEndTimestamp=n}this.auxWriter.seek(0);for(let c=0;c<e.cueQueue.length;c++){const l=e.cueQueue[c];if(l.timestamp>=o)break;Be.lastIndex=0;const m=Be.test(l.text),h=l.timestamp+l.duration;let p=e.cueToSourceId.get(l);if(p===void 0&&o<h&&(p=e.nextSourceId++,e.cueToSourceId.set(l,p)),l.notes){const b=Js(l.notes);this.auxBoxWriter.writeBox(b)}const g=Zs(l.text,m?n:null,l.identifier??null,l.settings??null,p??null);this.auxBoxWriter.writeBox(g),h===o&&e.cueQueue.splice(c--,1)}const a=this.auxWriter.getSlice(0,this.auxWriter.getPos()),u=this.createSampleForTrack(e,a,n,o-n,"key");await this.registerSample(e,u),e.lastCueEndTimestamp=o}}createSampleForTrack(e,s,i,r,n){return{timestamp:i,decodeTimestamp:i,duration:r,data:s,size:s.byteLength,type:n,timescaleUnitsToNextSample:_(r,e.timescale)}}processTimestamps(e,s){if(e.timestampProcessingQueue.length===0)return;if(e.type==="audio"&&e.info.requiresPcmTransformation){let r=0;for(let n=0;n<e.timestampProcessingQueue.length;n++){const o=e.timestampProcessingQueue[n],a=_(o.duration,e.timescale);r+=a}if(e.timeToSampleTable.length===0)e.timeToSampleTable.push({sampleCount:r,sampleDelta:1});else{const n=Q(e.timeToSampleTable);n.sampleCount+=r}e.timestampProcessingQueue.length=0;return}const i=e.timestampProcessingQueue.map(r=>r.timestamp).sort((r,n)=>r-n);for(let r=0;r<e.timestampProcessingQueue.length;r++){const n=e.timestampProcessingQueue[r];n.decodeTimestamp=i[r],!this.isFragmented&&e.lastTimescaleUnits===null&&(n.decodeTimestamp=0);const o=_(n.timestamp-n.decodeTimestamp,e.timescale),a=_(n.duration,e.timescale);if(e.lastTimescaleUnits!==null){f(e.lastSample);const u=_(n.decodeTimestamp,e.timescale,!1),c=Math.round(u-e.lastTimescaleUnits);if(f(c>=0),e.lastTimescaleUnits+=c,e.lastSample.timescaleUnitsToNextSample=c,!this.isFragmented){let l=Q(e.timeToSampleTable);if(f(l),l.sampleCount===1){l.sampleDelta=c;const h=e.timeToSampleTable[e.timeToSampleTable.length-2];h&&h.sampleDelta===c&&(h.sampleCount++,e.timeToSampleTable.pop(),l=h)}else l.sampleDelta!==c&&(l.sampleCount--,e.timeToSampleTable.push(l={sampleCount:1,sampleDelta:c}));l.sampleDelta===a?l.sampleCount++:e.timeToSampleTable.push({sampleCount:1,sampleDelta:a});const m=Q(e.compositionTimeOffsetTable);f(m),m.sampleCompositionTimeOffset===o?m.sampleCount++:e.compositionTimeOffsetTable.push({sampleCount:1,sampleCompositionTimeOffset:o})}}else e.lastTimescaleUnits=_(n.decodeTimestamp,e.timescale,!1),this.isFragmented||(e.timeToSampleTable.push({sampleCount:1,sampleDelta:a}),e.compositionTimeOffsetTable.push({sampleCount:1,sampleCompositionTimeOffset:o}));e.lastSample=n}if(e.timestampProcessingQueue.length=0,f(e.lastSample),f(e.lastTimescaleUnits!==null),s!==void 0&&e.lastSample.timescaleUnitsToNextSample===0){f(s.type==="key");const r=_(s.timestamp,e.timescale,!1),n=Math.round(r-e.lastTimescaleUnits);e.lastSample.timescaleUnitsToNextSample=n}}async registerSample(e,s){s.type==="key"&&this.processTimestamps(e,s),e.timestampProcessingQueue.push(s),this.isFragmented?(e.sampleQueue.push(s),await this.interleaveSamples()):this.fastStart==="reserve"?await this.registerSampleFastStartReserve(e,s):await this.addSampleToTrack(e,s)}async addSampleToTrack(e,s){if(!this.isFragmented&&(e.samples.push(s),this.fastStart==="reserve")){const r=e.track.metadata.maximumPacketCount;if(f(r!==void 0),e.samples.length>r)throw new Error(`Track #${e.track.id} has already reached the maximum packet count (${r}). Either add less packets or increase the maximum packet count.`)}let i=!1;if(!e.currentChunk)i=!0;else{e.currentChunk.startTimestamp=Math.min(e.currentChunk.startTimestamp,s.timestamp);const r=s.timestamp-e.currentChunk.startTimestamp;if(this.isFragmented){const n=this.trackDatas.every(o=>{if(e===o)return s.type==="key";const a=o.sampleQueue[0];return a?a.type==="key":o.track.source._closed});r>=this.minimumFragmentDuration&&n&&s.timestamp>this.maxWrittenTimestamp&&(i=!0,await this.finalizeFragment())}else i=r>=.5}i&&(e.currentChunk&&await this.finalizeCurrentChunk(e),e.currentChunk={startTimestamp:s.timestamp,samples:[],offset:null,moofOffset:null}),f(e.currentChunk),e.currentChunk.samples.push(s),this.isFragmented&&(this.maxWrittenTimestamp=Math.max(this.maxWrittenTimestamp,s.timestamp))}async finalizeCurrentChunk(e){if(f(!this.isFragmented),!e.currentChunk)return;e.finalizedChunks.push(e.currentChunk),this.finalizedChunks.push(e.currentChunk);let s=e.currentChunk.samples.length;if(e.type==="audio"&&e.info.requiresPcmTransformation&&(s=e.currentChunk.samples.reduce((i,r)=>i+_(r.duration,e.timescale),0)),(e.compactlyCodedChunkTable.length===0||Q(e.compactlyCodedChunkTable).samplesPerChunk!==s)&&e.compactlyCodedChunkTable.push({firstChunk:e.finalizedChunks.length,samplesPerChunk:s}),this.fastStart==="in-memory"){e.currentChunk.offset=0;return}e.currentChunk.offset=this.writer.getPos();for(const i of e.currentChunk.samples)f(i.data),this.writer.write(i.data),i.data=null;await this.writer.flush()}async interleaveSamples(e=!1){if(f(this.isFragmented),!(!e&&!this.allTracksAreKnown()))e:for(;;){let s=null,i=1/0;for(const n of this.trackDatas){if(!e&&n.sampleQueue.length===0&&!n.track.source._closed)break e;n.sampleQueue.length>0&&n.sampleQueue[0].timestamp<i&&(s=n,i=n.sampleQueue[0].timestamp)}if(!s)break;const r=s.sampleQueue.shift();await this.addSampleToTrack(s,r)}}async finalizeFragment(e=!0){f(this.isFragmented);const s=this.nextFragmentNumber++;if(s===1){this.format._options.onMoov&&this.writer.startTrackingWrites();const p=ie(this);if(this.boxWriter.writeBox(p),this.format._options.onMoov){const{data:g,start:b}=this.writer.stopTrackingWrites();this.format._options.onMoov(g,b)}}const i=this.trackDatas.filter(p=>p.currentChunk),r=Re(s,i),n=this.writer.getPos(),o=n+this.boxWriter.measureBox(r);let a=o+de,u=1/0;for(const p of i){p.currentChunk.offset=a,p.currentChunk.moofOffset=n;for(const g of p.currentChunk.samples)a+=g.size;u=Math.min(u,p.currentChunk.startTimestamp)}const c=a-o,l=c>=2**32;if(l)for(const p of i)p.currentChunk.offset+=ze-de;this.format._options.onMoof&&this.writer.startTrackingWrites();const m=Re(s,i);if(this.boxWriter.writeBox(m),this.format._options.onMoof){const{data:p,start:g}=this.writer.stopTrackingWrites();this.format._options.onMoof(p,g,u)}f(this.writer.getPos()===o),this.format._options.onMdat&&this.writer.startTrackingWrites();const h=ae(l);h.size=c,this.boxWriter.writeBox(h),this.writer.seek(o+(l?ze:de));for(const p of i)for(const g of p.currentChunk.samples)this.writer.write(g.data),g.data=null;if(this.format._options.onMdat){const{data:p,start:g}=this.writer.stopTrackingWrites();this.format._options.onMdat(p,g)}for(const p of i)p.finalizedChunks.push(p.currentChunk),this.finalizedChunks.push(p.currentChunk),p.currentChunk=null;e&&await this.writer.flush()}async registerSampleFastStartReserve(e,s){if(this.allTracksAreKnown()){if(!this.mdat){const i=ie(this),n=this.boxWriter.measureBox(i)+this.computeSampleTableSizeUpperBound()+4096;f(this.ftypSize!==null),this.writer.seek(this.ftypSize+n),this.format._options.onMdat&&this.writer.startTrackingWrites(),this.mdat=ae(!0),this.boxWriter.writeBox(this.mdat);for(const o of this.trackDatas){for(const a of o.sampleQueue)await this.addSampleToTrack(o,a);o.sampleQueue.length=0}}await this.addSampleToTrack(e,s)}else e.sampleQueue.push(s)}computeSampleTableSizeUpperBound(){f(this.fastStart==="reserve");let e=0;for(const s of this.trackDatas){const i=s.track.metadata.maximumPacketCount;f(i!==void 0),e+=8*Math.ceil(2/3*i),e+=4*i,e+=8*Math.ceil(2/3*i),e+=12*Math.ceil(2/3*i),e+=4*i,e+=8*i}return e}async onTrackClose(e){const s=await this.mutex.acquire();if(e.type==="subtitle"&&e.source._codec==="webvtt"){const i=this.trackDatas.find(r=>r.track===e);i&&await this.processWebVTTCues(i,1/0)}this.allTracksAreKnown()&&this.allTracksKnown.resolve(),this.isFragmented&&await this.interleaveSamples(),s()}async finalize(){const e=await this.mutex.acquire();this.allTracksKnown.resolve();for(const s of this.trackDatas)s.type==="subtitle"&&s.track.source._codec==="webvtt"&&await this.processWebVTTCues(s,1/0);if(this.isFragmented){await this.interleaveSamples(!0);for(const s of this.trackDatas)this.processTimestamps(s);await this.finalizeFragment(!1)}else for(const s of this.trackDatas)this.processTimestamps(s),await this.finalizeCurrentChunk(s);if(this.fastStart==="in-memory"){this.mdat=ae(!1);let s;for(let r=0;r<2;r++){const n=ie(this),o=this.boxWriter.measureBox(n);s=this.boxWriter.measureBox(this.mdat);let a=this.writer.getPos()+o+s;for(const u of this.finalizedChunks){u.offset=a;for(const{data:c}of u.samples)f(c),a+=c.byteLength,s+=c.byteLength}if(a<2**32)break;s>=2**32&&(this.mdat.largeSize=!0)}this.format._options.onMoov&&this.writer.startTrackingWrites();const i=ie(this);if(this.boxWriter.writeBox(i),this.format._options.onMoov){const{data:r,start:n}=this.writer.stopTrackingWrites();this.format._options.onMoov(r,n)}this.format._options.onMdat&&this.writer.startTrackingWrites(),this.mdat.size=s,this.boxWriter.writeBox(this.mdat);for(const r of this.finalizedChunks)for(const n of r.samples)f(n.data),this.writer.write(n.data),n.data=null;if(this.format._options.onMdat){const{data:r,start:n}=this.writer.stopTrackingWrites();this.format._options.onMdat(r,n)}}else if(this.isFragmented){const s=this.writer.getPos(),i=Gs(this.trackDatas);this.boxWriter.writeBox(i);const r=this.writer.getPos()-s;this.writer.seek(this.writer.getPos()-4),this.boxWriter.writeU32(r)}else{f(this.mdat);const s=this.boxWriter.offsets.get(this.mdat);f(s!==void 0);const i=this.writer.getPos()-s;if(this.mdat.size=i,this.mdat.largeSize=i>=2**32,this.boxWriter.patchBox(this.mdat),this.format._options.onMdat){const{data:n,start:o}=this.writer.stopTrackingWrites();this.format._options.onMdat(n,o)}const r=ie(this);if(this.fastStart==="reserve"){f(this.ftypSize!==null),this.writer.seek(this.ftypSize),this.format._options.onMoov&&this.writer.startTrackingWrites(),this.boxWriter.writeBox(r);const n=this.boxWriter.offsets.get(this.mdat)-this.writer.getPos();this.boxWriter.writeBox(is(n))}else this.format._options.onMoov&&this.writer.startTrackingWrites(),this.boxWriter.writeBox(r);if(this.format._options.onMoov){const{data:n,start:o}=this.writer.stopTrackingWrites();this.format._options.onMoov(n,o)}}e()}}class at{getSupportedVideoCodecs(){return this.getSupportedCodecs().filter(e=>$.includes(e))}getSupportedAudioCodecs(){return this.getSupportedCodecs().filter(e=>q.includes(e))}getSupportedSubtitleCodecs(){return this.getSupportedCodecs().filter(e=>ce.includes(e))}_codecUnsupportedHint(e){return""}}class ct extends at{constructor(e={}){if(!e||typeof e!="object")throw new TypeError("options must be an object.");if(e.fastStart!==void 0&&![!1,"in-memory","reserve","fragmented"].includes(e.fastStart))throw new TypeError("options.fastStart, when provided, must be false, 'in-memory', 'reserve', or 'fragmented'.");if(e.minimumFragmentDuration!==void 0&&(!Number.isFinite(e.minimumFragmentDuration)||e.minimumFragmentDuration<0))throw new TypeError("options.minimumFragmentDuration, when provided, must be a non-negative number.");if(e.onFtyp!==void 0&&typeof e.onFtyp!="function")throw new TypeError("options.onFtyp, when provided, must be a function.");if(e.onMoov!==void 0&&typeof e.onMoov!="function")throw new TypeError("options.onMoov, when provided, must be a function.");if(e.onMdat!==void 0&&typeof e.onMdat!="function")throw new TypeError("options.onMdat, when provided, must be a function.");if(e.onMoof!==void 0&&typeof e.onMoof!="function")throw new TypeError("options.onMoof, when provided, must be a function.");if(e.metadataFormat!==void 0&&!["mdir","mdta","udta","auto"].includes(e.metadataFormat))throw new TypeError("options.metadataFormat, when provided, must be either 'auto', 'mdir', 'mdta', or 'udta'.");super(),this._options=e}getSupportedTrackCounts(){return{video:{min:0,max:1/0},audio:{min:0,max:1/0},subtitle:{min:0,max:1/0},total:{min:1,max:2**32-1}}}get supportsVideoRotationMetadata(){return!0}_createMuxer(e){return new di(e,this)}}class ut extends ct{constructor(e){super(e)}get _name(){return"MP4"}get fileExtension(){return".mp4"}get mimeType(){return"video/mp4"}getSupportedCodecs(){return[...$,...Ut,"pcm-s16","pcm-s16be","pcm-s24","pcm-s24be","pcm-s32","pcm-s32be","pcm-f32","pcm-f32be","pcm-f64","pcm-f64be",...ce]}_codecUnsupportedHint(e){return new lt().getSupportedCodecs().includes(e)?" Switching to MOV will grant support for this codec.":""}}class lt extends ct{constructor(e){super(e)}get _name(){return"MOV"}get fileExtension(){return".mov"}get mimeType(){return"video/quicktime"}getSupportedCodecs(){return[...$,...q]}_codecUnsupportedHint(e){return new ut().getSupportedCodecs().includes(e)?" Switching to MP4 will grant support for this codec.":""}}const hi=t=>{if(!t||typeof t!="object")throw new TypeError("Encoding config must be an object.");if(!$.includes(t.codec))throw new TypeError(`Invalid video codec '${t.codec}'. Must be one of: ${$.join(", ")}.`);if(!(t.bitrate instanceof K)&&(!Number.isInteger(t.bitrate)||t.bitrate<=0))throw new TypeError("config.bitrate must be a positive integer or a quality.");if(t.keyFrameInterval!==void 0&&(!Number.isFinite(t.keyFrameInterval)||t.keyFrameInterval<0))throw new TypeError("config.keyFrameInterval, when provided, must be a non-negative number.");if(t.sizeChangeBehavior!==void 0&&!["deny","passThrough","fill","contain","cover"].includes(t.sizeChangeBehavior))throw new TypeError("config.sizeChangeBehavior, when provided, must be 'deny', 'passThrough', 'fill', 'contain' or 'cover'.");if(t.onEncodedPacket!==void 0&&typeof t.onEncodedPacket!="function")throw new TypeError("config.onEncodedChunk, when provided, must be a function.");if(t.onEncoderConfig!==void 0&&typeof t.onEncoderConfig!="function")throw new TypeError("config.onEncoderConfig, when provided, must be a function.");dt(t.codec,t)},dt=(t,e)=>{if(!e||typeof e!="object")throw new TypeError("Encoding options must be an object.");if(e.alpha!==void 0&&!["discard","keep"].includes(e.alpha))throw new TypeError("options.alpha, when provided, must be 'discard' or 'keep'.");if(e.bitrateMode!==void 0&&!["constant","variable"].includes(e.bitrateMode))throw new TypeError("bitrateMode, when provided, must be 'constant' or 'variable'.");if(e.latencyMode!==void 0&&!["quality","realtime"].includes(e.latencyMode))throw new TypeError("latencyMode, when provided, must be 'quality' or 'realtime'.");if(e.fullCodecString!==void 0&&typeof e.fullCodecString!="string")throw new TypeError("fullCodecString, when provided, must be a string.");if(e.fullCodecString!==void 0&&Qe(e.fullCodecString)!==t)throw new TypeError(`fullCodecString, when provided, must be a string that matches the specified codec (${t}).`);if(e.hardwareAcceleration!==void 0&&!["no-preference","prefer-hardware","prefer-software"].includes(e.hardwareAcceleration))throw new TypeError("hardwareAcceleration, when provided, must be 'no-preference', 'prefer-hardware' or 'prefer-software'.");if(e.scalabilityMode!==void 0&&typeof e.scalabilityMode!="string")throw new TypeError("scalabilityMode, when provided, must be a string.");if(e.contentHint!==void 0&&typeof e.contentHint!="string")throw new TypeError("contentHint, when provided, must be a string.")},ve=t=>{const e=t.bitrate instanceof K?t.bitrate._toVideoBitrate(t.codec,t.width,t.height):t.bitrate;return{codec:t.fullCodecString??Vt(t.codec,t.width,t.height,e),width:t.width,height:t.height,bitrate:e,bitrateMode:t.bitrateMode,alpha:t.alpha??"discard",framerate:t.framerate,latencyMode:t.latencyMode,hardwareAcceleration:t.hardwareAcceleration,scalabilityMode:t.scalabilityMode,contentHint:t.contentHint,...Wt(t.codec)}},fi=t=>{if(!t||typeof t!="object")throw new TypeError("Encoding config must be an object.");if(!q.includes(t.codec))throw new TypeError(`Invalid audio codec '${t.codec}'. Must be one of: ${q.join(", ")}.`);if(t.bitrate===void 0&&(!ee.includes(t.codec)||t.codec==="flac"))throw new TypeError("config.bitrate must be provided for compressed audio codecs.");if(t.bitrate!==void 0&&!(t.bitrate instanceof K)&&(!Number.isInteger(t.bitrate)||t.bitrate<=0))throw new TypeError("config.bitrate, when provided, must be a positive integer or a quality.");if(t.onEncodedPacket!==void 0&&typeof t.onEncodedPacket!="function")throw new TypeError("config.onEncodedChunk, when provided, must be a function.");if(t.onEncoderConfig!==void 0&&typeof t.onEncoderConfig!="function")throw new TypeError("config.onEncoderConfig, when provided, must be a function.");ht(t.codec,t)},ht=(t,e)=>{if(!e||typeof e!="object")throw new TypeError("Encoding options must be an object.");if(e.bitrateMode!==void 0&&!["constant","variable"].includes(e.bitrateMode))throw new TypeError("bitrateMode, when provided, must be 'constant' or 'variable'.");if(e.fullCodecString!==void 0&&typeof e.fullCodecString!="string")throw new TypeError("fullCodecString, when provided, must be a string.");if(e.fullCodecString!==void 0&&Qe(e.fullCodecString)!==t)throw new TypeError(`fullCodecString, when provided, must be a string that matches the specified codec (${t}).`)},Se=t=>{const e=t.bitrate instanceof K?t.bitrate._toAudioBitrate(t.codec):t.bitrate;return{codec:t.fullCodecString??$t(t.codec,t.numberOfChannels,t.sampleRate),numberOfChannels:t.numberOfChannels,sampleRate:t.sampleRate,bitrate:e,bitrateMode:t.bitrateMode,...Nt(t.codec)}};class K{constructor(e){this._factor=e}_toVideoBitrate(e,s,i){const r=s*i,n={avc:1,hevc:.6,vp9:.6,av1:.4,vp8:1.2},o=1920*1080,a=3e6,u=Math.pow(r/o,.95),m=a*u*n[e]*this._factor;return Math.ceil(m/1e3)*1e3}_toAudioBitrate(e){if(ee.includes(e)||e==="flac")return;const i={aac:128e3,opus:64e3,mp3:16e4,vorbis:64e3}[e];if(!i)throw new Error(`Unhandled codec: ${e}`);let r=i*this._factor;return e==="aac"?r=[96e3,128e3,16e4,192e3].reduce((o,a)=>Math.abs(a-r)<Math.abs(o-r)?a:o):e==="opus"||e==="vorbis"?r=Math.max(6e3,r):e==="mp3"&&(r=[8e3,16e3,24e3,32e3,4e4,48e3,64e3,8e4,96e3,112e3,128e3,16e4,192e3,224e3,256e3,32e4].reduce((o,a)=>Math.abs(a-r)<Math.abs(o-r)?a:o)),Math.round(r/1e3)*1e3}}const ft=new K(2),mi=async(t,e={})=>{const{width:s=1280,height:i=720,bitrate:r=1e6,...n}=e;if(!$.includes(t))return!1;if(!Number.isInteger(s)||s<=0)throw new TypeError("width must be a positive integer.");if(!Number.isInteger(i)||i<=0)throw new TypeError("height must be a positive integer.");if(!(r instanceof K)&&(!Number.isInteger(r)||r<=0))throw new TypeError("bitrate must be a positive integer or a quality.");dt(t,n);let o=null;return ye.length>0&&(o??=ve({codec:t,width:s,height:i,bitrate:r,framerate:void 0,...n}),ye.some(c=>c.supports(t,o)))?!0:typeof VideoEncoder>"u"||(s%2===1||i%2===1)&&(t==="avc"||t==="hevc")||(o??=ve({codec:t,width:s,height:i,bitrate:r,framerate:void 0,...n,alpha:"discard"}),!(await VideoEncoder.isConfigSupported(o)).supported)?!1:be()?new Promise(async c=>{try{const l=new VideoEncoder({output:()=>{},error:()=>c(!1)});l.configure(o);const m=new Uint8Array(s*i*4),h=new VideoFrame(m,{format:"RGBA",codedWidth:s,codedHeight:i,timestamp:0});l.encode(h),h.close(),await l.flush(),c(!0)}catch{c(!1)}}):!0},pi=async(t,e={})=>{const{numberOfChannels:s=2,sampleRate:i=48e3,bitrate:r=128e3,...n}=e;if(!q.includes(t))return!1;if(!Number.isInteger(s)||s<=0)throw new TypeError("numberOfChannels must be a positive integer.");if(!Number.isInteger(i)||i<=0)throw new TypeError("sampleRate must be a positive integer.");if(!(r instanceof K)&&(!Number.isInteger(r)||r<=0))throw new TypeError("bitrate must be a positive integer.");ht(t,n);let o=null;return Ce.length>0&&(o??=Se({codec:t,numberOfChannels:s,sampleRate:i,bitrate:r,...n}),Ce.some(u=>u.supports(t,o)))||ee.includes(t)?!0:typeof AudioEncoder>"u"?!1:(o??=Se({codec:t,numberOfChannels:s,sampleRate:i,bitrate:r,...n}),(await AudioEncoder.isConfigSupported(o)).supported===!0)},gi=async(t,e)=>{for(const s of t)if(await mi(s,e))return s;return null},wi=async(t,e)=>{for(const s of t)if(await pi(s,e))return s;return null};class Ae{constructor(){this._connectedTrack=null,this._closingPromise=null,this._closed=!1,this._timestampOffset=0}_ensureValidAdd(){if(!this._connectedTrack)throw new Error("Source is not connected to an output track.");if(this._connectedTrack.output.state==="canceled")throw new Error("Output has been canceled.");if(this._connectedTrack.output.state==="finalizing"||this._connectedTrack.output.state==="finalized")throw new Error("Output has been finalized.");if(this._connectedTrack.output.state==="pending")throw new Error("Output has not started.");if(this._closed)throw new Error("Source is closed.")}async _start(){}async _flushAndClose(e){}close(){if(this._closingPromise)return;const e=this._connectedTrack;if(!e)throw new Error("Cannot call close without connecting the source to an output track.");if(e.output.state==="pending")throw new Error("Cannot call close before output has been started.");this._closingPromise=(async()=>{await this._flushAndClose(!1),this._closed=!0,!(e.output.state==="finalizing"||e.output.state==="finalized")&&e.output._muxer.onTrackClose(e)})()}async _flushOrWaitForOngoingClose(e){return this._closingPromise?this._closingPromise:this._flushAndClose(e)}}class mt extends Ae{constructor(e){if(super(),this._connectedTrack=null,!$.includes(e))throw new TypeError(`Invalid video codec '${e}'. Must be one of: ${$.join(", ")}.`);this._codec=e}}class Ti{constructor(e,s){this.source=e,this.encodingConfig=s,this.ensureEncoderPromise=null,this.encoderInitialized=!1,this.encoder=null,this.muxer=null,this.lastMultipleOfKeyFrameInterval=-1,this.codedWidth=null,this.codedHeight=null,this.resizeCanvas=null,this.customEncoder=null,this.customEncoderCallSerializer=new Ge,this.customEncoderQueueSize=0,this.alphaEncoder=null,this.splitter=null,this.splitterCreationFailed=!1,this.alphaFrameQueue=[],this.error=null,this.errorNeedsNewStack=!0}async add(e,s,i){try{if(this.checkForEncoderError(),this.source._ensureValidAdd(),this.codedWidth!==null&&this.codedHeight!==null){if(e.codedWidth!==this.codedWidth||e.codedHeight!==this.codedHeight){const a=this.encodingConfig.sizeChangeBehavior??"deny";if(a!=="passThrough"){if(a==="deny")throw new Error(`Video sample size must remain constant. Expected ${this.codedWidth}x${this.codedHeight}, got ${e.codedWidth}x${e.codedHeight}. To allow the sample size to change over time, set \`sizeChangeBehavior\` to a value other than 'strict' in the encoding options.`);{let u=!1;this.resizeCanvas||(typeof document<"u"?(this.resizeCanvas=document.createElement("canvas"),this.resizeCanvas.width=this.codedWidth,this.resizeCanvas.height=this.codedHeight):this.resizeCanvas=new OffscreenCanvas(this.codedWidth,this.codedHeight),u=!0);const c=this.resizeCanvas.getContext("2d",{alpha:be()});f(c),u||(be()?(c.fillStyle="black",c.fillRect(0,0,this.codedWidth,this.codedHeight)):c.clearRect(0,0,this.codedWidth,this.codedHeight)),e.drawWithFit(c,{fit:a}),s&&e.close(),e=new qe(this.resizeCanvas,{timestamp:e.timestamp,duration:e.duration,rotation:e.rotation}),s=!0}}}}else this.codedWidth=e.codedWidth,this.codedHeight=e.codedHeight;this.encoderInitialized||(this.ensureEncoderPromise||this.ensureEncoder(e),this.encoderInitialized||await this.ensureEncoderPromise),f(this.encoderInitialized);const r=this.encodingConfig.keyFrameInterval??5,n=Math.floor(e.timestamp/r),o={...i,keyFrame:i?.keyFrame||r===0||n!==this.lastMultipleOfKeyFrameInterval};if(this.lastMultipleOfKeyFrameInterval=n,this.customEncoder){this.customEncoderQueueSize++;const a=e.clone(),u=this.customEncoderCallSerializer.call(()=>this.customEncoder.encode(a,o)).then(()=>this.customEncoderQueueSize--).catch(c=>this.error??=c).finally(()=>{a.close()});this.customEncoderQueueSize>=4&&await u}else{f(this.encoder);const a=e.toVideoFrame();if(!this.alphaEncoder)this.encoder.encode(a,o),a.close();else if(!!a.format&&!a.format.includes("A")||this.splitterCreationFailed)this.alphaFrameQueue.push(null),this.encoder.encode(a,o),a.close();else{const c=a.displayWidth,l=a.displayHeight;if(!this.splitter)try{this.splitter=new yi(c,l)}catch(m){console.error("Due to an error, only color data will be encoded.",m),this.splitterCreationFailed=!0,this.alphaFrameQueue.push(null),this.encoder.encode(a,o),a.close()}if(this.splitter){const m=this.splitter.extractColor(a),h=this.splitter.extractAlpha(a);this.alphaFrameQueue.push(h),this.encoder.encode(m,o),m.close(),a.close()}}s&&e.close(),this.encoder.encodeQueueSize>=4&&await new Promise(u=>this.encoder.addEventListener("dequeue",u,{once:!0}))}await this.muxer.mutex.currentPromise}finally{s&&e.close()}}ensureEncoder(e){const s=new Error;this.ensureEncoderPromise=(async()=>{const i=ve({width:e.codedWidth,height:e.codedHeight,...this.encodingConfig,framerate:this.source._connectedTrack?.metadata.frameRate});this.encodingConfig.onEncoderConfig?.(i);const r=ye.find(n=>n.supports(this.encodingConfig.codec,i));if(r)this.customEncoder=new r,this.customEncoder.codec=this.encodingConfig.codec,this.customEncoder.config=i,this.customEncoder.onPacket=(n,o)=>{if(!(n instanceof re))throw new TypeError("The first argument passed to onPacket must be an EncodedPacket.");if(o!==void 0&&(!o||typeof o!="object"))throw new TypeError("The second argument passed to onPacket must be an object or undefined.");this.encodingConfig.onEncodedPacket?.(n,o),this.muxer.addEncodedVideoPacket(this.source._connectedTrack,n,o).catch(a=>{this.error??=a,this.errorNeedsNewStack=!1})},await this.customEncoder.init();else{if(typeof VideoEncoder>"u")throw new Error("VideoEncoder is not supported by this browser.");if(i.alpha="discard",this.encodingConfig.alpha==="keep"&&(i.latencyMode="quality"),(i.width%2===1||i.height%2===1)&&(this.encodingConfig.codec==="avc"||this.encodingConfig.codec==="hevc"))throw new Error(`The dimensions ${i.width}x${i.height} are not supported for codec '${this.encodingConfig.codec}'; both width and height must be even numbers. Make sure to round your dimensions to the nearest even number.`);if(!(await VideoEncoder.isConfigSupported(i)).supported)throw new Error(`This specific encoder configuration (${i.codec}, ${i.bitrate} bps, ${i.width}x${i.height}, hardware acceleration: ${i.hardwareAcceleration??"no-preference"}) is not supported by this browser. Consider using another codec or changing your video parameters.`);const a=[],u=[];let c=0,l=0;const m=(h,p,g)=>{const b={};if(p){const x=new Uint8Array(p.byteLength);p.copyTo(x),b.alpha=x}const E=re.fromEncodedChunk(h,b);this.encodingConfig.onEncodedPacket?.(E,g),this.muxer.addEncodedVideoPacket(this.source._connectedTrack,E,g).catch(x=>{this.error??=x,this.errorNeedsNewStack=!1})};this.encoder=new VideoEncoder({output:(h,p)=>{if(!this.alphaEncoder){m(h,null,p);return}const g=this.alphaFrameQueue.shift();f(g!==void 0),g?(this.alphaEncoder.encode(g,{keyFrame:h.type==="key"}),l++,g.close(),a.push({chunk:h,meta:p})):l===0?m(h,null,p):(u.push(c+l),a.push({chunk:h,meta:p}))},error:h=>{h.stack=s.stack,this.error??=h}}),this.encoder.configure(i),this.encodingConfig.alpha==="keep"&&(this.alphaEncoder=new VideoEncoder({output:(h,p)=>{l--;const g=a.shift();for(f(g!==void 0),m(g.chunk,h,g.meta),c++;u.length>0&&u[0]===c;){u.shift();const b=a.shift();f(b!==void 0),m(b.chunk,null,b.meta)}},error:h=>{h.stack=s.stack,this.error??=h}}),this.alphaEncoder.configure(i))}f(this.source._connectedTrack),this.muxer=this.source._connectedTrack.output._muxer,this.encoderInitialized=!0})()}async flushAndClose(e){e||this.checkForEncoderError(),this.customEncoder?(e||this.customEncoderCallSerializer.call(()=>this.customEncoder.flush()),await this.customEncoderCallSerializer.call(()=>this.customEncoder.close())):this.encoder&&(e||(await this.encoder.flush(),await this.alphaEncoder?.flush()),this.encoder.state!=="closed"&&this.encoder.close(),this.alphaEncoder&&this.alphaEncoder.state!=="closed"&&this.alphaEncoder.close(),this.alphaFrameQueue.forEach(s=>s?.close()),this.splitter?.close()),e||this.checkForEncoderError()}getQueueSize(){return this.customEncoder?this.customEncoderQueueSize:this.encoder?.encodeQueueSize??0}checkForEncoderError(){if(this.error)throw this.errorNeedsNewStack&&(this.error.stack=new Error().stack),this.error}}class yi{constructor(e,s){this.lastFrame=null,typeof OffscreenCanvas<"u"?this.canvas=new OffscreenCanvas(e,s):(this.canvas=document.createElement("canvas"),this.canvas.width=e,this.canvas.height=s);const i=this.canvas.getContext("webgl2",{alpha:!0});if(!i)throw new Error("Couldn't acquire WebGL 2 context.");this.gl=i,this.colorProgram=this.createColorProgram(),this.alphaProgram=this.createAlphaProgram(),this.vao=this.createVAO(),this.sourceTexture=this.createTexture(),this.alphaResolutionLocation=this.gl.getUniformLocation(this.alphaProgram,"u_resolution"),this.gl.useProgram(this.colorProgram),this.gl.uniform1i(this.gl.getUniformLocation(this.colorProgram,"u_sourceTexture"),0),this.gl.useProgram(this.alphaProgram),this.gl.uniform1i(this.gl.getUniformLocation(this.alphaProgram,"u_sourceTexture"),0)}createVertexShader(){return this.createShader(this.gl.VERTEX_SHADER,`#version 300 es
2
2
  in vec2 a_position;
3
3
  in vec2 a_texCoord;
4
4
  out vec2 v_texCoord;
@@ -62,4 +62,4 @@ import{A as Ve,a as f,t as I,i as J,k as Ne,b as _e,R as yt,U as Ct,p as D,l as
62
62
 
63
63
  fragColor = result;
64
64
  }
65
- `),i=this.gl.createProgram();return this.gl.attachShader(i,e),this.gl.attachShader(i,s),this.gl.linkProgram(i),i}createShader(e,s){const i=this.gl.createShader(e);return this.gl.shaderSource(i,s),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)||console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),i}createVAO(){const e=this.gl.createVertexArray();this.gl.bindVertexArray(e);const s=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),i=this.gl.createBuffer();this.gl.bindBuffer(this.gl.ARRAY_BUFFER,i),this.gl.bufferData(this.gl.ARRAY_BUFFER,s,this.gl.STATIC_DRAW);const r=this.gl.getAttribLocation(this.colorProgram,"a_position"),n=this.gl.getAttribLocation(this.colorProgram,"a_texCoord");return this.gl.enableVertexAttribArray(r),this.gl.vertexAttribPointer(r,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(n),this.gl.vertexAttribPointer(n,2,this.gl.FLOAT,!1,16,8),e}createTexture(){const e=this.gl.createTexture();return this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}updateTexture(e){this.lastFrame!==e&&((e.displayWidth!==this.canvas.width||e.displayHeight!==this.canvas.height)&&(this.canvas.width=e.displayWidth,this.canvas.height=e.displayHeight),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,this.sourceTexture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),this.lastFrame=e)}extractColor(e){return this.updateTexture(e),this.gl.useProgram(this.colorProgram),this.gl.viewport(0,0,this.canvas.width,this.canvas.height),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.bindVertexArray(this.vao),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),new VideoFrame(this.canvas,{timestamp:e.timestamp,duration:e.duration??void 0,alpha:"discard"})}extractAlpha(e){this.updateTexture(e),this.gl.useProgram(this.alphaProgram),this.gl.uniform2f(this.alphaResolutionLocation,this.canvas.width,this.canvas.height),this.gl.viewport(0,0,this.canvas.width,this.canvas.height),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.bindVertexArray(this.vao),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4);const{width:s,height:i}=this.canvas,r=Math.ceil(s/2)*Math.ceil(i/2),n=s*i+r*2,o=Math.ceil(n/(s*4));let a=new Uint8Array(4*s*o);this.gl.readPixels(0,0,s,o,this.gl.RGBA,this.gl.UNSIGNED_BYTE,a),a=a.subarray(0,n),f(a[s*i]===128),f(a[a.length-1]===128);const u={format:"I420",codedWidth:s,codedHeight:i,timestamp:e.timestamp,duration:e.duration??void 0,transfer:[a.buffer]};return new VideoFrame(a,u)}close(){this.gl.getExtension("WEBGL_lose_context")?.loseContext(),this.gl=null}}class yi extends mt{constructor(e,s){if(!(typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement)&&!(typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas))throw new TypeError("canvas must be an HTMLCanvasElement or OffscreenCanvas.");hi(s),super(s.codec),this._encoder=new Ti(this,s),this._canvas=e}add(e,s=0,i){if(!Number.isFinite(e)||e<0)throw new TypeError("timestamp must be a non-negative number.");if(!Number.isFinite(s)||s<0)throw new TypeError("duration must be a non-negative number.");const r=new qe(this._canvas,{timestamp:e,duration:s});return this._encoder.add(r,!0,i)}_flushAndClose(e){return this._encoder.flushAndClose(e)}}class pt extends Ae{constructor(e){if(super(),this._connectedTrack=null,!q.includes(e))throw new TypeError(`Invalid audio codec '${e}'. Must be one of: ${q.join(", ")}.`);this._codec=e}}class Ci{constructor(e,s){this.source=e,this.encodingConfig=s,this.ensureEncoderPromise=null,this.encoderInitialized=!1,this.encoder=null,this.muxer=null,this.lastNumberOfChannels=null,this.lastSampleRate=null,this.isPcmEncoder=!1,this.outputSampleSize=null,this.writeOutputValue=null,this.customEncoder=null,this.customEncoderCallSerializer=new Ge,this.customEncoderQueueSize=0,this.lastEndSampleIndex=null,this.error=null,this.errorNeedsNewStack=!0}async add(e,s){try{if(this.checkForEncoderError(),this.source._ensureValidAdd(),this.lastNumberOfChannels!==null&&this.lastSampleRate!==null){if(e.numberOfChannels!==this.lastNumberOfChannels||e.sampleRate!==this.lastSampleRate)throw new Error(`Audio parameters must remain constant. Expected ${this.lastNumberOfChannels} channels at ${this.lastSampleRate} Hz, got ${e.numberOfChannels} channels at ${e.sampleRate} Hz.`)}else this.lastNumberOfChannels=e.numberOfChannels,this.lastSampleRate=e.sampleRate;this.encoderInitialized||(this.ensureEncoderPromise||this.ensureEncoder(e),this.encoderInitialized||await this.ensureEncoderPromise),f(this.encoderInitialized);{const i=Math.round(e.timestamp*e.sampleRate),r=Math.round((e.timestamp+e.duration)*e.sampleRate);if(this.lastEndSampleIndex===null)this.lastEndSampleIndex=r;else{const n=i-this.lastEndSampleIndex;if(n>=64){const o=new je({data:new Float32Array(n*e.numberOfChannels),format:"f32-planar",sampleRate:e.sampleRate,numberOfChannels:e.numberOfChannels,numberOfFrames:n,timestamp:this.lastEndSampleIndex/e.sampleRate});await this.add(o,!0)}this.lastEndSampleIndex+=e.numberOfFrames}}if(this.customEncoder){this.customEncoderQueueSize++;const i=e.clone(),r=this.customEncoderCallSerializer.call(()=>this.customEncoder.encode(i)).then(()=>this.customEncoderQueueSize--).catch(n=>this.error??=n).finally(()=>{i.close()});this.customEncoderQueueSize>=4&&await r,await this.muxer.mutex.currentPromise}else if(this.isPcmEncoder)await this.doPcmEncoding(e,s);else{f(this.encoder);const i=e.toAudioData();this.encoder.encode(i),i.close(),s&&e.close(),this.encoder.encodeQueueSize>=4&&await new Promise(r=>this.encoder.addEventListener("dequeue",r,{once:!0})),await this.muxer.mutex.currentPromise}}finally{s&&e.close()}}async doPcmEncoding(e,s){f(this.outputSampleSize),f(this.writeOutputValue);const{numberOfChannels:i,numberOfFrames:r,sampleRate:n,timestamp:o}=e,a=2048,u=[];for(let h=0;h<r;h+=a){const m=Math.min(a,e.numberOfFrames-h),g=m*i*this.outputSampleSize,y=new ArrayBuffer(g),E=new DataView(y);u.push({frameCount:m,view:E})}const c=e.allocationSize({planeIndex:0,format:"f32-planar"}),d=new Float32Array(c/Float32Array.BYTES_PER_ELEMENT);for(let h=0;h<i;h++){e.copyTo(d,{planeIndex:h,format:"f32-planar"});for(let m=0;m<u.length;m++){const{frameCount:g,view:y}=u[m];for(let E=0;E<g;E++)this.writeOutputValue(y,(E*i+h)*this.outputSampleSize,d[m*a+E])}}s&&e.close();const p={decoderConfig:{codec:this.encodingConfig.codec,numberOfChannels:i,sampleRate:n}};for(let h=0;h<u.length;h++){const{frameCount:m,view:g}=u[h],y=g.buffer,E=h*a,x=new re(new Uint8Array(y),"key",o+E/n,m/n);this.encodingConfig.onEncodedPacket?.(x,p),await this.muxer.addEncodedAudioPacket(this.source._connectedTrack,x,p)}}ensureEncoder(e){const s=new Error;this.ensureEncoderPromise=(async()=>{const{numberOfChannels:i,sampleRate:r}=e,n=Se({numberOfChannels:i,sampleRate:r,...this.encodingConfig});this.encodingConfig.onEncoderConfig?.(n);const o=Ce.find(a=>a.supports(this.encodingConfig.codec,n));if(o)this.customEncoder=new o,this.customEncoder.codec=this.encodingConfig.codec,this.customEncoder.config=n,this.customEncoder.onPacket=(a,u)=>{if(!(a instanceof re))throw new TypeError("The first argument passed to onPacket must be an EncodedPacket.");if(u!==void 0&&(!u||typeof u!="object"))throw new TypeError("The second argument passed to onPacket must be an object or undefined.");this.encodingConfig.onEncodedPacket?.(a,u),this.muxer.addEncodedAudioPacket(this.source._connectedTrack,a,u).catch(c=>{this.error??=c,this.errorNeedsNewStack=!1})},await this.customEncoder.init();else if(ee.includes(this.encodingConfig.codec))this.initPcmEncoder();else{if(typeof AudioEncoder>"u")throw new Error("AudioEncoder is not supported by this browser.");if(!(await AudioEncoder.isConfigSupported(n)).supported)throw new Error(`This specific encoder configuration (${n.codec}, ${n.bitrate} bps, ${n.numberOfChannels} channels, ${n.sampleRate} Hz) is not supported by this browser. Consider using another codec or changing your audio parameters.`);this.encoder=new AudioEncoder({output:(u,c)=>{if(this.encodingConfig.codec==="aac"&&c?.decoderConfig){let p=!1;if(!c.decoderConfig.description||c.decoderConfig.description.byteLength<2?p=!0:p=Lt(te(c.decoderConfig.description)).objectType===0,p){const h=Number(Q(n.codec.split(".")));c.decoderConfig.description=Ht({objectType:h,numberOfChannels:c.decoderConfig.numberOfChannels,sampleRate:c.decoderConfig.sampleRate})}}const d=re.fromEncodedChunk(u);this.encodingConfig.onEncodedPacket?.(d,c),this.muxer.addEncodedAudioPacket(this.source._connectedTrack,d,c).catch(p=>{this.error??=p,this.errorNeedsNewStack=!1})},error:u=>{u.stack=s.stack,this.error??=u}}),this.encoder.configure(n)}f(this.source._connectedTrack),this.muxer=this.source._connectedTrack.output._muxer,this.encoderInitialized=!0})()}initPcmEncoder(){this.isPcmEncoder=!0;const e=this.encodingConfig.codec,{dataType:s,sampleSize:i,littleEndian:r}=D(e);switch(this.outputSampleSize=i,i){case 1:s==="unsigned"?this.writeOutputValue=(n,o,a)=>n.setUint8(o,z((a+1)*127.5,0,255)):s==="signed"?this.writeOutputValue=(n,o,a)=>{n.setInt8(o,z(Math.round(a*128),-128,127))}:s==="ulaw"?this.writeOutputValue=(n,o,a)=>{const u=z(Math.floor(a*32767),-32768,32767);n.setUint8(o,jt(u))}:s==="alaw"?this.writeOutputValue=(n,o,a)=>{const u=z(Math.floor(a*32767),-32768,32767);n.setUint8(o,Gt(u))}:f(!1);break;case 2:s==="unsigned"?this.writeOutputValue=(n,o,a)=>n.setUint16(o,z((a+1)*32767.5,0,65535),r):s==="signed"?this.writeOutputValue=(n,o,a)=>n.setInt16(o,z(Math.round(a*32767),-32768,32767),r):f(!1);break;case 3:s==="unsigned"?this.writeOutputValue=(n,o,a)=>Qt(n,o,z((a+1)*83886075e-1,0,16777215),r):s==="signed"?this.writeOutputValue=(n,o,a)=>qt(n,o,z(Math.round(a*8388607),-8388608,8388607),r):f(!1);break;case 4:s==="unsigned"?this.writeOutputValue=(n,o,a)=>n.setUint32(o,z((a+1)*21474836475e-1,0,4294967295),r):s==="signed"?this.writeOutputValue=(n,o,a)=>n.setInt32(o,z(Math.round(a*2147483647),-2147483648,2147483647),r):s==="float"?this.writeOutputValue=(n,o,a)=>n.setFloat32(o,a,r):f(!1);break;case 8:s==="float"?this.writeOutputValue=(n,o,a)=>n.setFloat64(o,a,r):f(!1);break;default:_e(i),f(!1)}}async flushAndClose(e){e||this.checkForEncoderError(),this.customEncoder?(e||this.customEncoderCallSerializer.call(()=>this.customEncoder.flush()),await this.customEncoderCallSerializer.call(()=>this.customEncoder.close())):this.encoder&&(e||await this.encoder.flush(),this.encoder.state!=="closed"&&this.encoder.close()),e||this.checkForEncoderError()}getQueueSize(){return this.customEncoder?this.customEncoderQueueSize:this.isPcmEncoder?0:this.encoder?.encodeQueueSize??0}checkForEncoderError(){if(this.error)throw this.errorNeedsNewStack&&(this.error.stack=new Error().stack),this.error}}class Ei extends pt{constructor(e){fi(e),super(e.codec),this._accumulatedTime=0,this._encoder=new Ci(this,e)}async add(e){if(!(e instanceof AudioBuffer))throw new TypeError("audioBuffer must be an AudioBuffer.");const s=je._fromAudioBuffer(e,this._accumulatedTime);this._accumulatedTime+=e.duration;for(const i of s)await this._encoder.add(i,!0)}_flushAndClose(e){return this._encoder.flushAndClose(e)}}class vi extends Ae{constructor(e){if(super(),this._connectedTrack=null,!ce.includes(e))throw new TypeError(`Invalid subtitle codec '${e}'. Must be one of: ${ce.join(", ")}.`);this._codec=e}}const Si=["video","audio","subtitle"],Te=t=>{if(!t||typeof t!="object")throw new TypeError("metadata must be an object.");if(t.languageCode!==void 0&&!Xt(t.languageCode))throw new TypeError("metadata.languageCode, when provided, must be a three-letter, ISO 639-2/T language code.");if(t.name!==void 0&&typeof t.name!="string")throw new TypeError("metadata.name, when provided, must be a string.");if(t.disposition!==void 0&&Yt(t.disposition),t.maximumPacketCount!==void 0&&(!Number.isInteger(t.maximumPacketCount)||t.maximumPacketCount<0))throw new TypeError("metadata.maximumPacketCount, when provided, must be a non-negative integer.")};class _i{constructor(e){if(this.state="pending",this._tracks=[],this._startPromise=null,this._cancelPromise=null,this._finalizePromise=null,this._mutex=new Ve,this._metadataTags={},!e||typeof e!="object")throw new TypeError("options must be an object.");if(!(e.format instanceof at))throw new TypeError("options.format must be an OutputFormat.");if(!(e.target instanceof nt))throw new TypeError("options.target must be a Target.");if(e.target._output)throw new Error("Target is already used for another output.");e.target._output=this,this.format=e.format,this.target=e.target,this._writer=e.target._createWriter(),this._muxer=e.format._createMuxer(this)}addVideoTrack(e,s={}){if(!(e instanceof mt))throw new TypeError("source must be a VideoSource.");if(Te(s),s.rotation!==void 0&&![0,90,180,270].includes(s.rotation))throw new TypeError(`Invalid video rotation: ${s.rotation}. Has to be 0, 90, 180 or 270.`);if(!this.format.supportsVideoRotationMetadata&&s.rotation)throw new Error(`${this.format._name} does not support video rotation metadata.`);if(s.frameRate!==void 0&&(!Number.isFinite(s.frameRate)||s.frameRate<=0))throw new TypeError(`Invalid video frame rate: ${s.frameRate}. Must be a positive number.`);this._addTrack("video",e,s)}addAudioTrack(e,s={}){if(!(e instanceof pt))throw new TypeError("source must be an AudioSource.");Te(s),this._addTrack("audio",e,s)}addSubtitleTrack(e,s={}){if(!(e instanceof vi))throw new TypeError("source must be a SubtitleSource.");Te(s),this._addTrack("subtitle",e,s)}setMetadataTags(e){if(Kt(e),this.state!=="pending")throw new Error("Cannot set metadata tags after output has been started or canceled.");this._metadataTags=e}_addTrack(e,s,i){if(this.state!=="pending")throw new Error("Cannot add track after output has been started or canceled.");if(s._connectedTrack)throw new Error("Source is already used for a track.");const r=this.format.getSupportedTrackCounts(),n=this._tracks.reduce((c,d)=>c+(d.type===e?1:0),0),o=r[e].max;if(n===o)throw new Error(o===0?`${this.format._name} does not support ${e} tracks.`:`${this.format._name} does not support more than ${o} ${e} track${o===1?"":"s"}.`);const a=r.total.max;if(this._tracks.length===a)throw new Error(`${this.format._name} does not support more than ${a} tracks${a===1?"":"s"} in total.`);const u={id:this._tracks.length+1,output:this,type:e,source:s,metadata:i};if(u.type==="video"){const c=this.format.getSupportedVideoCodecs();if(c.length===0)throw new Error(`${this.format._name} does not support video tracks.`+this.format._codecUnsupportedHint(u.source._codec));if(!c.includes(u.source._codec))throw new Error(`Codec '${u.source._codec}' cannot be contained within ${this.format._name}. Supported video codecs are: ${c.map(d=>`'${d}'`).join(", ")}.`+this.format._codecUnsupportedHint(u.source._codec))}else if(u.type==="audio"){const c=this.format.getSupportedAudioCodecs();if(c.length===0)throw new Error(`${this.format._name} does not support audio tracks.`+this.format._codecUnsupportedHint(u.source._codec));if(!c.includes(u.source._codec))throw new Error(`Codec '${u.source._codec}' cannot be contained within ${this.format._name}. Supported audio codecs are: ${c.map(d=>`'${d}'`).join(", ")}.`+this.format._codecUnsupportedHint(u.source._codec))}else if(u.type==="subtitle"){const c=this.format.getSupportedSubtitleCodecs();if(c.length===0)throw new Error(`${this.format._name} does not support subtitle tracks.`+this.format._codecUnsupportedHint(u.source._codec));if(!c.includes(u.source._codec))throw new Error(`Codec '${u.source._codec}' cannot be contained within ${this.format._name}. Supported subtitle codecs are: ${c.map(d=>`'${d}'`).join(", ")}.`+this.format._codecUnsupportedHint(u.source._codec))}this._tracks.push(u),s._connectedTrack=u}async start(){const e=this.format.getSupportedTrackCounts();for(const i of Si){const r=this._tracks.reduce((o,a)=>o+(a.type===i?1:0),0),n=e[i].min;if(r<n)throw new Error(n===e[i].max?`${this.format._name} requires exactly ${n} ${i} track${n===1?"":"s"}.`:`${this.format._name} requires at least ${n} ${i} track${n===1?"":"s"}.`)}const s=e.total.min;if(this._tracks.length<s)throw new Error(s===e.total.max?`${this.format._name} requires exactly ${s} track${s===1?"":"s"}.`:`${this.format._name} requires at least ${s} track${s===1?"":"s"}.`);if(this.state==="canceled")throw new Error("Output has been canceled.");return this._startPromise?(console.warn("Output has already been started."),this._startPromise):this._startPromise=(async()=>{this.state="started",this._writer.start();const i=await this._mutex.acquire();await this._muxer.start();const r=this._tracks.map(n=>n.source._start());await Promise.all(r),i()})()}getMimeType(){return this._muxer.getMimeType()}async cancel(){if(this._cancelPromise)return console.warn("Output has already been canceled."),this._cancelPromise;if(this.state==="finalizing"||this.state==="finalized"){console.warn("Output has already been finalized.");return}return this._cancelPromise=(async()=>{this.state="canceled";const e=await this._mutex.acquire(),s=this._tracks.map(i=>i.source._flushOrWaitForOngoingClose(!0));await Promise.all(s),await this._writer.close(),e()})()}async finalize(){if(this.state==="pending")throw new Error("Cannot finalize before starting.");if(this.state==="canceled")throw new Error("Cannot finalize after canceling.");return this._finalizePromise?(console.warn("Output has already been finalized."),this._finalizePromise):this._finalizePromise=(async()=>{this.state="finalizing";const e=await this._mutex.acquire(),s=this._tracks.map(i=>i.source._flushOrWaitForOngoingClose(!1));await Promise.all(s),await this._muxer.finalize(),await this._writer.flush(),await this._writer.finalize(),this.state="finalized",e()})()}}function ue(){try{if(typeof DOMException<"u")return new DOMException("The operation was aborted.","AbortError");throw new Error("DOMException is not available")}catch{const t=new Error("The operation was aborted.");return t.name="AbortError",t}}function G(t){return!!t&&typeof t=="object"&&"name"in t&&t.name==="AbortError"}function S(t){if(t?.aborted)throw ue()}function We(t){return Math.round(t/2)*2}function xi(t){return t.pages.reduce((e,s)=>e+(s.duration||5e3),0)}function ki(t){let e=0;return t.pages.map(s=>{const i=e,r=s.duration||5e3;return e=i+r,{id:s.id,startTime:i,duration:r}})}function gt(t){const e=[];let s=0;for(const i of t.pages){const r=i.duration||5e3;for(const n of i.children)if(n.type==="video"){const o=n.volume!==void 0?n.volume:1;if(o===0)continue;const a=n.startTime||0,u=n.endTime||1,c=n.duration||5e3;e.push({id:n.id,src:n.src,volume:o,startTime:a,endTime:u,duration:c,pageStartTime:s,pageDuration:r})}s+=r}return e}function Ai(t){const e=t.width,s=t.height;if(e%2!==0||s%2!==0){const i=We(e),r=We(s);return console.warn(`[polotno-video-export] Store dimensions ${e}x${s} are not even. Temporarily resizing to ${i}x${r} for H.264 codec compatibility.`),t.setSize(i,r,!0),{width:e,height:s}}return null}function Pi(t,e){t.setSize(e.width,e.height,!0)}async function Mi(t){for(const e of t.pages)t.selectPage(e.id),await t.waitLoading()}function Oi(t,e){const s=Zt(),i=s.sceneCanvas._canvas,r=t.width,n=t.height;if(i.width=r*e,i.height=n*e,i.width<=0||i.height<=0)throw new Error(`Invalid canvas dimensions: ${i.width}x${i.height}`);return{canvas:i,canvases:s}}async function zi(t,e){const s=new _i({target:new ot,format:new ut}),i=await gi(s.format.getSupportedVideoCodecs(),{width:t.width,height:t.height});if(!i)throw new Error("Your browser doesn't support video encoding.");const r=new yi(t,{codec:i,bitrate:ft});return s.addVideoTrack(r,{frameRate:e}),{output:s,canvasSource:r}}async function Bi(t,e,s){if(!s)return{audioBufferSource:null};const i=44100,r=2,n=e.audios&&e.audios.length>0,o=gt(e).length>0;if(!n&&!o)return{audioBufferSource:null};const a=await wi(t.format.getSupportedAudioCodecs(),{numberOfChannels:r,sampleRate:i});if(!a)return console.warn("Browser doesn't support audio encoding, video will be generated without audio."),{audioBufferSource:null};const u=new Ei({codec:a,bitrate:ft});return t.addAudioTrack(u),{audioBufferSource:u,audioCodec:a}}function Fi(t,e,s){const i=e[s];return i&&t>=i.startTime&&t<i.startTime+i.duration?s:e.findIndex(r=>t>=r.startTime&&t<r.startTime+r.duration)}async function Ii(t,e,s,i,r){t.setCurrentTime(e),await t._toCanvas({pixelRatio:i,pageId:t.pages[s]?.id,_skipTimeout:!0,_exportCanvases:r})}async function Ri(t,e,s,i,r,n,o,a,u){const c=1e3/n,d=Math.floor(r/1e3*n)||1;try{S(u),t.setElementsPixelRatio(o),await Mi(t);let p=-1,h=0;const m=300;for(let g=0;g<d;g++){S(u);const y=Date.now(),E=g/n,x=1/n;let U=E*1e3;g===0&&(U=1),g===d-1&&(U=Math.min(r-1,(g+1)*c-1));const O=Fi(U,i,p);if(O!==p&&O>=0&&(t.activePage.set({_rendering:!1}),t.selectPage(t.pages[O].id),t.activePage.set({_rendering:!0}),await t.waitLoading(),S(u),p=O),await Ii(t,U,O,o,s),S(u),await e.add(E,x),a){const L=Date.now();if(g===d-1||L-h>=m){const se=L-y,A=(g+1)/d*.95;a(A,se),h=L}}}}finally{t.pages.forEach(p=>{p.set({_rendering:!1})}),t.setCurrentTime(0)}}async function Ui(t,e){const s=await fetch(t,e?{signal:e}:void 0);if(!s.ok)throw new Error(`Failed to download audio from ${t}`);return s.arrayBuffer()}async function Wi(t,e){return t.decodeAudioData(e)}function Vi(t){return t.startsWith("data:")}function Ni(t){return t.startsWith("file://")}function $i(t){return t.startsWith("http://")||t.startsWith("https://")}function Li(t){const e=t.split(",")[1],s=atob(e),i=new Uint8Array(s.length);for(let r=0;r<s.length;r++)i[r]=s.charCodeAt(r);return i.buffer}async function Hi(t,e){try{if($i(t))return new ne({source:new Dt(t),formats:oe});if(Vi(t)){const s=Li(t);return new ne({source:new he(s),formats:oe})}else if(Ni(t)){const s=await(await fetch(t,e?{signal:e}:void 0)).arrayBuffer();return new ne({source:new he(s),formats:oe})}else{const s=await(await fetch(t,e?{signal:e}:void 0)).arrayBuffer();return new ne({source:new he(s),formats:oe})}}catch(s){return G(s)||e?.aborted||console.error(`Failed to create input from ${t.slice(0,50)}:`,s),null}}async function Qi(t,e){try{S(e);const s=await Hi(t,e);if(!s)return{hasAudio:!1,input:null};const i=await s.getAudioTracks();if(e?.aborted)throw s.dispose(),ue();return i.length===0?(s.dispose(),{hasAudio:!1,input:null}):{hasAudio:!0,input:s}}catch(s){if(G(s))throw s;if(e?.aborted)throw ue();return console.error(`Failed to check audio for ${t.slice(0,50)}:`,s),{hasAudio:!1,input:null}}}function wt(t,e){const s=t.audios||[],i=gt(t),r=s.map(o=>({audio:o,bufferPromise:Ui(o.src,e).catch(a=>(G(a)||e?.aborted||console.error(`Failed to download audio ${o.src}:`,a),null))})),n=i.map(o=>({video:o,inputPromise:Qi(o.src,e).catch(a=>{if(G(a)||e?.aborted)return{hasAudio:!1,input:null};throw a})}));return{storeAudios:r,videoAudios:n}}function qi(t,e,s){const i=(t.delay||0)/1e3,r=t.volume!==void 0?t.volume:1,n=t.startTime||0,o=t.endTime||1,a=t.duration||s.totalDuration,u=n*a/1e3,c=a*(o-n)/1e3;let d=i,p=u,h=Math.min(c,e.duration-u);if(d<0&&(p+=Math.abs(d),h-=Math.abs(d),d=0),h<=0||p>=e.duration)return;const m=s.offlineContext.createBufferSource();m.buffer=e;const g=s.offlineContext.createGain();g.gain.value=r,m.connect(g),g.connect(s.offlineContext.destination),m.start(d,p,h)}function ji(t,e,s){const i=t.startTime*t.duration/1e3,r=t.duration*(t.endTime-t.startTime)/1e3,n=t.pageStartTime/1e3;let o=Math.max(0,n),a=Math.max(0,i),u=Math.min(r,e.duration-a,t.pageDuration/1e3);if(u<=0||a>=e.duration)return;const c=s.offlineContext.createBufferSource();c.buffer=e;const d=s.offlineContext.createGain();d.gain.value=t.volume,c.connect(d),d.connect(s.offlineContext.destination),c.start(o,a,u)}async function Gi(t,e,s,i,r,n,o){S(o);const a=r||wt(t,o);if(a.storeAudios.length+a.videoAudios.length===0)return;const u=44100,c=2,d=typeof i=="string"?i:typeof i?.codec=="string"?i.codec:void 0,p=d?.includes("opus")?960:1024,h=d==="aac"?3:d?.includes("opus")?2:0,m=Math.floor(s/1e3*u),g=Math.floor(m/p)*p,y=h*p,E=Math.max(p,g-y),x=new OfflineAudioContext(c,E,u),U={offlineContext:x,totalDuration:s};n?.(.95);const[O,L]=await Promise.all([Promise.all(a.storeAudios.map(async({audio:A,bufferPromise:de})=>{try{S(o);const P=await de;if(S(o),!P)return null;const X=await Wi(x,P);return{audio:A,audioBuffer:X}}catch(P){if(G(P))throw P;return console.error(`Failed to process audio ${A.src}:`,P),null}})),Promise.all(a.videoAudios.map(async({video:A,inputPromise:de})=>{try{S(o);const{hasAudio:P,input:X}=await de;if(S(o),!P||!X)return null;const Pe=await X.getPrimaryAudioTrack();if(!Pe)return X.dispose(),null;const Tt=new Jt(Pe),Y=[];for await(const H of Tt.buffers())S(o),Y.push(H.buffer);if(X.dispose(),S(o),Y.length===0)return null;const bt=Y.reduce((H,Z)=>H+Z.length,0),Me=x.createBuffer(Y[0].numberOfChannels,bt,Y[0].sampleRate);let Oe=0;for(const H of Y){for(let Z=0;Z<H.numberOfChannels;Z++)Me.getChannelData(Z).set(H.getChannelData(Z),Oe);Oe+=H.length}return{video:A,audioBuffer:Me}}catch(P){if(G(P))throw P;return console.error(`Failed to extract video audio ${A.src}:`,P),null}}))]);n?.(.97),S(o);for(const A of O)A&&qi(A.audio,A.audioBuffer,U);for(const A of L)A&&ji(A.video,A.audioBuffer,U);S(o);const se=await x.startRendering();n?.(.99),S(o),await e.add(se)}async function Xi({store:t,fps:e=30,pixelRatio:s=1,onProgress:i,includeAudio:r=!0,signal:n}){const o=Ai(t);let a=null,u=null,c=null,d=null,p=!1;if(n){S(n);const h=()=>{try{u?.close()}catch{}try{c?.close()}catch{}a?.cancel().catch(()=>{})};n.addEventListener("abort",h,{once:!0}),d=()=>n.removeEventListener("abort",h)}try{S(n);const h=xi(t);if(h===0)throw new Error("Video duration is 0");const m=ki(t),{canvas:g,canvases:y}=Oi(t,s),E=await zi(g,e);a=E.output,u=E.canvasSource;const x=await Bi(a,t,r);c=x.audioBufferSource||null;const U=x.audioCodec;S(n),await a.start(),await Ri(t,u,y,m,h,e,s,i,n),u.close();const O=c?wt(t,n):null;c&&O&&(await Gi(t,c,h,U,O,i,n),c.close()),S(n),await a.finalize();const L=a.target,se=new Blob([L.buffer],{type:a.format.mimeType});return p=!0,se}catch(h){throw G(h)?h:n?.aborted?ue():h}finally{if(d?.(),!p&&a)try{await a.cancel()}catch{}o&&Pi(t,o)}}export{Xi as storeToVideo};
65
+ `),i=this.gl.createProgram();return this.gl.attachShader(i,e),this.gl.attachShader(i,s),this.gl.linkProgram(i),i}createShader(e,s){const i=this.gl.createShader(e);return this.gl.shaderSource(i,s),this.gl.compileShader(i),this.gl.getShaderParameter(i,this.gl.COMPILE_STATUS)||console.error("Shader compile error:",this.gl.getShaderInfoLog(i)),i}createVAO(){const e=this.gl.createVertexArray();this.gl.bindVertexArray(e);const s=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,1,1,1,0]),i=this.gl.createBuffer();this.gl.bindBuffer(this.gl.ARRAY_BUFFER,i),this.gl.bufferData(this.gl.ARRAY_BUFFER,s,this.gl.STATIC_DRAW);const r=this.gl.getAttribLocation(this.colorProgram,"a_position"),n=this.gl.getAttribLocation(this.colorProgram,"a_texCoord");return this.gl.enableVertexAttribArray(r),this.gl.vertexAttribPointer(r,2,this.gl.FLOAT,!1,16,0),this.gl.enableVertexAttribArray(n),this.gl.vertexAttribPointer(n,2,this.gl.FLOAT,!1,16,8),e}createTexture(){const e=this.gl.createTexture();return this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),e}updateTexture(e){this.lastFrame!==e&&((e.displayWidth!==this.canvas.width||e.displayHeight!==this.canvas.height)&&(this.canvas.width=e.displayWidth,this.canvas.height=e.displayHeight),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,this.sourceTexture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),this.lastFrame=e)}extractColor(e){return this.updateTexture(e),this.gl.useProgram(this.colorProgram),this.gl.viewport(0,0,this.canvas.width,this.canvas.height),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.bindVertexArray(this.vao),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),new VideoFrame(this.canvas,{timestamp:e.timestamp,duration:e.duration??void 0,alpha:"discard"})}extractAlpha(e){this.updateTexture(e),this.gl.useProgram(this.alphaProgram),this.gl.uniform2f(this.alphaResolutionLocation,this.canvas.width,this.canvas.height),this.gl.viewport(0,0,this.canvas.width,this.canvas.height),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.bindVertexArray(this.vao),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4);const{width:s,height:i}=this.canvas,r=Math.ceil(s/2)*Math.ceil(i/2),n=s*i+r*2,o=Math.ceil(n/(s*4));let a=new Uint8Array(4*s*o);this.gl.readPixels(0,0,s,o,this.gl.RGBA,this.gl.UNSIGNED_BYTE,a),a=a.subarray(0,n),f(a[s*i]===128),f(a[a.length-1]===128);const u={format:"I420",codedWidth:s,codedHeight:i,timestamp:e.timestamp,duration:e.duration??void 0,transfer:[a.buffer]};return new VideoFrame(a,u)}close(){this.gl.getExtension("WEBGL_lose_context")?.loseContext(),this.gl=null}}class bi extends mt{constructor(e,s){if(!(typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement)&&!(typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas))throw new TypeError("canvas must be an HTMLCanvasElement or OffscreenCanvas.");hi(s),super(s.codec),this._encoder=new Ti(this,s),this._canvas=e}add(e,s=0,i){if(!Number.isFinite(e)||e<0)throw new TypeError("timestamp must be a non-negative number.");if(!Number.isFinite(s)||s<0)throw new TypeError("duration must be a non-negative number.");const r=new qe(this._canvas,{timestamp:e,duration:s});return this._encoder.add(r,!0,i)}_flushAndClose(e){return this._encoder.flushAndClose(e)}}class pt extends Ae{constructor(e){if(super(),this._connectedTrack=null,!q.includes(e))throw new TypeError(`Invalid audio codec '${e}'. Must be one of: ${q.join(", ")}.`);this._codec=e}}class Ci{constructor(e,s){this.source=e,this.encodingConfig=s,this.ensureEncoderPromise=null,this.encoderInitialized=!1,this.encoder=null,this.muxer=null,this.lastNumberOfChannels=null,this.lastSampleRate=null,this.isPcmEncoder=!1,this.outputSampleSize=null,this.writeOutputValue=null,this.customEncoder=null,this.customEncoderCallSerializer=new Ge,this.customEncoderQueueSize=0,this.lastEndSampleIndex=null,this.error=null,this.errorNeedsNewStack=!0}async add(e,s){try{if(this.checkForEncoderError(),this.source._ensureValidAdd(),this.lastNumberOfChannels!==null&&this.lastSampleRate!==null){if(e.numberOfChannels!==this.lastNumberOfChannels||e.sampleRate!==this.lastSampleRate)throw new Error(`Audio parameters must remain constant. Expected ${this.lastNumberOfChannels} channels at ${this.lastSampleRate} Hz, got ${e.numberOfChannels} channels at ${e.sampleRate} Hz.`)}else this.lastNumberOfChannels=e.numberOfChannels,this.lastSampleRate=e.sampleRate;this.encoderInitialized||(this.ensureEncoderPromise||this.ensureEncoder(e),this.encoderInitialized||await this.ensureEncoderPromise),f(this.encoderInitialized);{const i=Math.round(e.timestamp*e.sampleRate),r=Math.round((e.timestamp+e.duration)*e.sampleRate);if(this.lastEndSampleIndex===null)this.lastEndSampleIndex=r;else{const n=i-this.lastEndSampleIndex;if(n>=64){const o=new je({data:new Float32Array(n*e.numberOfChannels),format:"f32-planar",sampleRate:e.sampleRate,numberOfChannels:e.numberOfChannels,numberOfFrames:n,timestamp:this.lastEndSampleIndex/e.sampleRate});await this.add(o,!0)}this.lastEndSampleIndex+=e.numberOfFrames}}if(this.customEncoder){this.customEncoderQueueSize++;const i=e.clone(),r=this.customEncoderCallSerializer.call(()=>this.customEncoder.encode(i)).then(()=>this.customEncoderQueueSize--).catch(n=>this.error??=n).finally(()=>{i.close()});this.customEncoderQueueSize>=4&&await r,await this.muxer.mutex.currentPromise}else if(this.isPcmEncoder)await this.doPcmEncoding(e,s);else{f(this.encoder);const i=e.toAudioData();this.encoder.encode(i),i.close(),s&&e.close(),this.encoder.encodeQueueSize>=4&&await new Promise(r=>this.encoder.addEventListener("dequeue",r,{once:!0})),await this.muxer.mutex.currentPromise}}finally{s&&e.close()}}async doPcmEncoding(e,s){f(this.outputSampleSize),f(this.writeOutputValue);const{numberOfChannels:i,numberOfFrames:r,sampleRate:n,timestamp:o}=e,a=2048,u=[];for(let h=0;h<r;h+=a){const p=Math.min(a,e.numberOfFrames-h),g=p*i*this.outputSampleSize,b=new ArrayBuffer(g),E=new DataView(b);u.push({frameCount:p,view:E})}const c=e.allocationSize({planeIndex:0,format:"f32-planar"}),l=new Float32Array(c/Float32Array.BYTES_PER_ELEMENT);for(let h=0;h<i;h++){e.copyTo(l,{planeIndex:h,format:"f32-planar"});for(let p=0;p<u.length;p++){const{frameCount:g,view:b}=u[p];for(let E=0;E<g;E++)this.writeOutputValue(b,(E*i+h)*this.outputSampleSize,l[p*a+E])}}s&&e.close();const m={decoderConfig:{codec:this.encodingConfig.codec,numberOfChannels:i,sampleRate:n}};for(let h=0;h<u.length;h++){const{frameCount:p,view:g}=u[h],b=g.buffer,E=h*a,x=new re(new Uint8Array(b),"key",o+E/n,p/n);this.encodingConfig.onEncodedPacket?.(x,m),await this.muxer.addEncodedAudioPacket(this.source._connectedTrack,x,m)}}ensureEncoder(e){const s=new Error;this.ensureEncoderPromise=(async()=>{const{numberOfChannels:i,sampleRate:r}=e,n=Se({numberOfChannels:i,sampleRate:r,...this.encodingConfig});this.encodingConfig.onEncoderConfig?.(n);const o=Ce.find(a=>a.supports(this.encodingConfig.codec,n));if(o)this.customEncoder=new o,this.customEncoder.codec=this.encodingConfig.codec,this.customEncoder.config=n,this.customEncoder.onPacket=(a,u)=>{if(!(a instanceof re))throw new TypeError("The first argument passed to onPacket must be an EncodedPacket.");if(u!==void 0&&(!u||typeof u!="object"))throw new TypeError("The second argument passed to onPacket must be an object or undefined.");this.encodingConfig.onEncodedPacket?.(a,u),this.muxer.addEncodedAudioPacket(this.source._connectedTrack,a,u).catch(c=>{this.error??=c,this.errorNeedsNewStack=!1})},await this.customEncoder.init();else if(ee.includes(this.encodingConfig.codec))this.initPcmEncoder();else{if(typeof AudioEncoder>"u")throw new Error("AudioEncoder is not supported by this browser.");if(!(await AudioEncoder.isConfigSupported(n)).supported)throw new Error(`This specific encoder configuration (${n.codec}, ${n.bitrate} bps, ${n.numberOfChannels} channels, ${n.sampleRate} Hz) is not supported by this browser. Consider using another codec or changing your audio parameters.`);this.encoder=new AudioEncoder({output:(u,c)=>{if(this.encodingConfig.codec==="aac"&&c?.decoderConfig){let m=!1;if(!c.decoderConfig.description||c.decoderConfig.description.byteLength<2?m=!0:m=Lt(te(c.decoderConfig.description)).objectType===0,m){const h=Number(Q(n.codec.split(".")));c.decoderConfig.description=Ht({objectType:h,numberOfChannels:c.decoderConfig.numberOfChannels,sampleRate:c.decoderConfig.sampleRate})}}const l=re.fromEncodedChunk(u);this.encodingConfig.onEncodedPacket?.(l,c),this.muxer.addEncodedAudioPacket(this.source._connectedTrack,l,c).catch(m=>{this.error??=m,this.errorNeedsNewStack=!1})},error:u=>{u.stack=s.stack,this.error??=u}}),this.encoder.configure(n)}f(this.source._connectedTrack),this.muxer=this.source._connectedTrack.output._muxer,this.encoderInitialized=!0})()}initPcmEncoder(){this.isPcmEncoder=!0;const e=this.encodingConfig.codec,{dataType:s,sampleSize:i,littleEndian:r}=D(e);switch(this.outputSampleSize=i,i){case 1:s==="unsigned"?this.writeOutputValue=(n,o,a)=>n.setUint8(o,z((a+1)*127.5,0,255)):s==="signed"?this.writeOutputValue=(n,o,a)=>{n.setInt8(o,z(Math.round(a*128),-128,127))}:s==="ulaw"?this.writeOutputValue=(n,o,a)=>{const u=z(Math.floor(a*32767),-32768,32767);n.setUint8(o,jt(u))}:s==="alaw"?this.writeOutputValue=(n,o,a)=>{const u=z(Math.floor(a*32767),-32768,32767);n.setUint8(o,Gt(u))}:f(!1);break;case 2:s==="unsigned"?this.writeOutputValue=(n,o,a)=>n.setUint16(o,z((a+1)*32767.5,0,65535),r):s==="signed"?this.writeOutputValue=(n,o,a)=>n.setInt16(o,z(Math.round(a*32767),-32768,32767),r):f(!1);break;case 3:s==="unsigned"?this.writeOutputValue=(n,o,a)=>Qt(n,o,z((a+1)*83886075e-1,0,16777215),r):s==="signed"?this.writeOutputValue=(n,o,a)=>qt(n,o,z(Math.round(a*8388607),-8388608,8388607),r):f(!1);break;case 4:s==="unsigned"?this.writeOutputValue=(n,o,a)=>n.setUint32(o,z((a+1)*21474836475e-1,0,4294967295),r):s==="signed"?this.writeOutputValue=(n,o,a)=>n.setInt32(o,z(Math.round(a*2147483647),-2147483648,2147483647),r):s==="float"?this.writeOutputValue=(n,o,a)=>n.setFloat32(o,a,r):f(!1);break;case 8:s==="float"?this.writeOutputValue=(n,o,a)=>n.setFloat64(o,a,r):f(!1);break;default:_e(i),f(!1)}}async flushAndClose(e){e||this.checkForEncoderError(),this.customEncoder?(e||this.customEncoderCallSerializer.call(()=>this.customEncoder.flush()),await this.customEncoderCallSerializer.call(()=>this.customEncoder.close())):this.encoder&&(e||await this.encoder.flush(),this.encoder.state!=="closed"&&this.encoder.close()),e||this.checkForEncoderError()}getQueueSize(){return this.customEncoder?this.customEncoderQueueSize:this.isPcmEncoder?0:this.encoder?.encodeQueueSize??0}checkForEncoderError(){if(this.error)throw this.errorNeedsNewStack&&(this.error.stack=new Error().stack),this.error}}class Ei extends pt{constructor(e){fi(e),super(e.codec),this._accumulatedTime=0,this._encoder=new Ci(this,e)}async add(e){if(!(e instanceof AudioBuffer))throw new TypeError("audioBuffer must be an AudioBuffer.");const s=je._fromAudioBuffer(e,this._accumulatedTime);this._accumulatedTime+=e.duration;for(const i of s)await this._encoder.add(i,!0)}_flushAndClose(e){return this._encoder.flushAndClose(e)}}class vi extends Ae{constructor(e){if(super(),this._connectedTrack=null,!ce.includes(e))throw new TypeError(`Invalid subtitle codec '${e}'. Must be one of: ${ce.join(", ")}.`);this._codec=e}}const Si=["video","audio","subtitle"],Te=t=>{if(!t||typeof t!="object")throw new TypeError("metadata must be an object.");if(t.languageCode!==void 0&&!Xt(t.languageCode))throw new TypeError("metadata.languageCode, when provided, must be a three-letter, ISO 639-2/T language code.");if(t.name!==void 0&&typeof t.name!="string")throw new TypeError("metadata.name, when provided, must be a string.");if(t.disposition!==void 0&&Yt(t.disposition),t.maximumPacketCount!==void 0&&(!Number.isInteger(t.maximumPacketCount)||t.maximumPacketCount<0))throw new TypeError("metadata.maximumPacketCount, when provided, must be a non-negative integer.")};class _i{constructor(e){if(this.state="pending",this._tracks=[],this._startPromise=null,this._cancelPromise=null,this._finalizePromise=null,this._mutex=new Ve,this._metadataTags={},!e||typeof e!="object")throw new TypeError("options must be an object.");if(!(e.format instanceof at))throw new TypeError("options.format must be an OutputFormat.");if(!(e.target instanceof nt))throw new TypeError("options.target must be a Target.");if(e.target._output)throw new Error("Target is already used for another output.");e.target._output=this,this.format=e.format,this.target=e.target,this._writer=e.target._createWriter(),this._muxer=e.format._createMuxer(this)}addVideoTrack(e,s={}){if(!(e instanceof mt))throw new TypeError("source must be a VideoSource.");if(Te(s),s.rotation!==void 0&&![0,90,180,270].includes(s.rotation))throw new TypeError(`Invalid video rotation: ${s.rotation}. Has to be 0, 90, 180 or 270.`);if(!this.format.supportsVideoRotationMetadata&&s.rotation)throw new Error(`${this.format._name} does not support video rotation metadata.`);if(s.frameRate!==void 0&&(!Number.isFinite(s.frameRate)||s.frameRate<=0))throw new TypeError(`Invalid video frame rate: ${s.frameRate}. Must be a positive number.`);this._addTrack("video",e,s)}addAudioTrack(e,s={}){if(!(e instanceof pt))throw new TypeError("source must be an AudioSource.");Te(s),this._addTrack("audio",e,s)}addSubtitleTrack(e,s={}){if(!(e instanceof vi))throw new TypeError("source must be a SubtitleSource.");Te(s),this._addTrack("subtitle",e,s)}setMetadataTags(e){if(Kt(e),this.state!=="pending")throw new Error("Cannot set metadata tags after output has been started or canceled.");this._metadataTags=e}_addTrack(e,s,i){if(this.state!=="pending")throw new Error("Cannot add track after output has been started or canceled.");if(s._connectedTrack)throw new Error("Source is already used for a track.");const r=this.format.getSupportedTrackCounts(),n=this._tracks.reduce((c,l)=>c+(l.type===e?1:0),0),o=r[e].max;if(n===o)throw new Error(o===0?`${this.format._name} does not support ${e} tracks.`:`${this.format._name} does not support more than ${o} ${e} track${o===1?"":"s"}.`);const a=r.total.max;if(this._tracks.length===a)throw new Error(`${this.format._name} does not support more than ${a} tracks${a===1?"":"s"} in total.`);const u={id:this._tracks.length+1,output:this,type:e,source:s,metadata:i};if(u.type==="video"){const c=this.format.getSupportedVideoCodecs();if(c.length===0)throw new Error(`${this.format._name} does not support video tracks.`+this.format._codecUnsupportedHint(u.source._codec));if(!c.includes(u.source._codec))throw new Error(`Codec '${u.source._codec}' cannot be contained within ${this.format._name}. Supported video codecs are: ${c.map(l=>`'${l}'`).join(", ")}.`+this.format._codecUnsupportedHint(u.source._codec))}else if(u.type==="audio"){const c=this.format.getSupportedAudioCodecs();if(c.length===0)throw new Error(`${this.format._name} does not support audio tracks.`+this.format._codecUnsupportedHint(u.source._codec));if(!c.includes(u.source._codec))throw new Error(`Codec '${u.source._codec}' cannot be contained within ${this.format._name}. Supported audio codecs are: ${c.map(l=>`'${l}'`).join(", ")}.`+this.format._codecUnsupportedHint(u.source._codec))}else if(u.type==="subtitle"){const c=this.format.getSupportedSubtitleCodecs();if(c.length===0)throw new Error(`${this.format._name} does not support subtitle tracks.`+this.format._codecUnsupportedHint(u.source._codec));if(!c.includes(u.source._codec))throw new Error(`Codec '${u.source._codec}' cannot be contained within ${this.format._name}. Supported subtitle codecs are: ${c.map(l=>`'${l}'`).join(", ")}.`+this.format._codecUnsupportedHint(u.source._codec))}this._tracks.push(u),s._connectedTrack=u}async start(){const e=this.format.getSupportedTrackCounts();for(const i of Si){const r=this._tracks.reduce((o,a)=>o+(a.type===i?1:0),0),n=e[i].min;if(r<n)throw new Error(n===e[i].max?`${this.format._name} requires exactly ${n} ${i} track${n===1?"":"s"}.`:`${this.format._name} requires at least ${n} ${i} track${n===1?"":"s"}.`)}const s=e.total.min;if(this._tracks.length<s)throw new Error(s===e.total.max?`${this.format._name} requires exactly ${s} track${s===1?"":"s"}.`:`${this.format._name} requires at least ${s} track${s===1?"":"s"}.`);if(this.state==="canceled")throw new Error("Output has been canceled.");return this._startPromise?(console.warn("Output has already been started."),this._startPromise):this._startPromise=(async()=>{this.state="started",this._writer.start();const i=await this._mutex.acquire();await this._muxer.start();const r=this._tracks.map(n=>n.source._start());await Promise.all(r),i()})()}getMimeType(){return this._muxer.getMimeType()}async cancel(){if(this._cancelPromise)return console.warn("Output has already been canceled."),this._cancelPromise;if(this.state==="finalizing"||this.state==="finalized"){console.warn("Output has already been finalized.");return}return this._cancelPromise=(async()=>{this.state="canceled";const e=await this._mutex.acquire(),s=this._tracks.map(i=>i.source._flushOrWaitForOngoingClose(!0));await Promise.all(s),await this._writer.close(),e()})()}async finalize(){if(this.state==="pending")throw new Error("Cannot finalize before starting.");if(this.state==="canceled")throw new Error("Cannot finalize after canceling.");return this._finalizePromise?(console.warn("Output has already been finalized."),this._finalizePromise):this._finalizePromise=(async()=>{this.state="finalizing";const e=await this._mutex.acquire(),s=this._tracks.map(i=>i.source._flushOrWaitForOngoingClose(!1));await Promise.all(s),await this._muxer.finalize(),await this._writer.flush(),await this._writer.finalize(),this.state="finalized",e()})()}}function ue(){try{if(typeof DOMException<"u")return new DOMException("The operation was aborted.","AbortError");throw new Error("DOMException is not available")}catch{const t=new Error("The operation was aborted.");return t.name="AbortError",t}}function G(t){return!!t&&typeof t=="object"&&"name"in t&&t.name==="AbortError"}function S(t){if(t?.aborted)throw ue()}function We(t){return Math.round(t/2)*2}function xi(t){return t.pages.reduce((e,s)=>e+(s.duration||5e3),0)}function ki(t){let e=0;return t.pages.map(s=>{const i=e,r=s.duration||5e3;return e=i+r,{id:s.id,startTime:i,duration:r}})}function gt(t){const e=[];let s=0;for(const i of t.pages){const r=i.duration||5e3;for(const n of i.children)if(n.type==="video"){const o=n.volume!==void 0?n.volume:1;if(o===0)continue;const a=n.startTime||0,u=n.endTime||1,c=n.duration||5e3;e.push({id:n.id,src:n.src,volume:o,startTime:a,endTime:u,duration:c,pageStartTime:s,pageDuration:r})}s+=r}return e}function Ai(t){const e=t.width,s=t.height;if(e%2!==0||s%2!==0){const i=We(e),r=We(s);return console.warn(`[polotno-video-export] Store dimensions ${e}x${s} are not even. Temporarily resizing to ${i}x${r} for H.264 codec compatibility.`),t.setSize(i,r,!0),{width:e,height:s}}return null}function Pi(t,e){t.setSize(e.width,e.height,!0)}async function Mi(t){for(const e of t.pages)t.selectPage(e.id),await t.waitLoading()}function Oi(t,e){const s=Zt(),i=s.sceneCanvas._canvas,r=t.width,n=t.height;if(i.width=r*e,i.height=n*e,i.width<=0||i.height<=0)throw new Error(`Invalid canvas dimensions: ${i.width}x${i.height}`);return{canvas:i,canvases:s}}async function zi(t,e){const s=new _i({target:new ot,format:new ut}),i=await gi(s.format.getSupportedVideoCodecs(),{width:t.width,height:t.height});if(!i)throw new Error("Your browser doesn't support video encoding.");const r=new bi(t,{codec:i,bitrate:ft});return s.addVideoTrack(r,{frameRate:e}),{output:s,canvasSource:r}}async function Bi(t,e,s){if(!s)return{audioBufferSource:null};const i=44100,r=2,n=e.audios&&e.audios.length>0,o=gt(e).length>0;if(!n&&!o)return{audioBufferSource:null};const a=t.format.getSupportedAudioCodecs();console.log("supportedCodecs",JSON.stringify(a,null,2));const u=a.filter(h=>h==="aac"||h.startsWith("mp4a")),c=u.length>0?u:a,l=await wi(c,{numberOfChannels:r,sampleRate:i});if(!l)return console.warn("Browser doesn't support audio encoding, video will be generated without audio."),{audioBufferSource:null};const m=new Ei({codec:l,bitrate:ft});return t.addAudioTrack(m),{audioBufferSource:m,audioCodec:l}}function Fi(t,e,s){const i=e[s];return i&&t>=i.startTime&&t<i.startTime+i.duration?s:e.findIndex(r=>t>=r.startTime&&t<r.startTime+r.duration)}async function Ii(t,e,s,i,r){t.setCurrentTime(e),await t._toCanvas({pixelRatio:i,pageId:t.pages[s]?.id,_skipTimeout:!0,_exportCanvases:r})}async function Ri(t,e,s,i,r,n,o,a,u){const c=1e3/n,l=Math.floor(r/1e3*n)||1;try{S(u),t.setElementsPixelRatio(o),await Mi(t);let m=-1,h=0;const p=300;for(let g=0;g<l;g++){S(u);const b=Date.now(),E=g/n,x=1/n;let U=E*1e3;g===0&&(U=1),g===l-1&&(U=Math.min(r-1,(g+1)*c-1));const O=Fi(U,i,m);if(O!==m&&O>=0&&(t.activePage.set({_rendering:!1}),t.selectPage(t.pages[O].id),t.activePage.set({_rendering:!0}),await t.waitLoading(),S(u),m=O),await Ii(t,U,O,o,s),S(u),await e.add(E,x),a){const L=Date.now();if(g===l-1||L-h>=p){const se=L-b,A=(g+1)/l*.95;a(A,se),h=L}}}}finally{t.pages.forEach(m=>{m.set({_rendering:!1})}),t.setCurrentTime(0)}}async function Ui(t,e){const s=await fetch(t,e?{signal:e}:void 0);if(!s.ok)throw new Error(`Failed to download audio from ${t}`);return s.arrayBuffer()}async function Wi(t,e){return t.decodeAudioData(e)}function Vi(t){return t.startsWith("data:")}function Ni(t){return t.startsWith("file://")}function $i(t){return t.startsWith("http://")||t.startsWith("https://")}function Li(t){const e=t.split(",")[1],s=atob(e),i=new Uint8Array(s.length);for(let r=0;r<s.length;r++)i[r]=s.charCodeAt(r);return i.buffer}async function Hi(t,e){try{if($i(t))return new ne({source:new Dt(t),formats:oe});if(Vi(t)){const s=Li(t);return new ne({source:new he(s),formats:oe})}else if(Ni(t)){const s=await(await fetch(t,e?{signal:e}:void 0)).arrayBuffer();return new ne({source:new he(s),formats:oe})}else{const s=await(await fetch(t,e?{signal:e}:void 0)).arrayBuffer();return new ne({source:new he(s),formats:oe})}}catch(s){return G(s)||e?.aborted||console.error(`Failed to create input from ${t.slice(0,50)}:`,s),null}}async function Qi(t,e){try{S(e);const s=await Hi(t,e);if(!s)return{hasAudio:!1,input:null};const i=await s.getAudioTracks();if(e?.aborted)throw s.dispose(),ue();return i.length===0?(s.dispose(),{hasAudio:!1,input:null}):{hasAudio:!0,input:s}}catch(s){if(G(s))throw s;if(e?.aborted)throw ue();return console.error(`Failed to check audio for ${t.slice(0,50)}:`,s),{hasAudio:!1,input:null}}}function wt(t,e){const s=t.audios||[],i=gt(t),r=s.map(o=>({audio:o,bufferPromise:Ui(o.src,e).catch(a=>(G(a)||e?.aborted||console.error(`Failed to download audio ${o.src}:`,a),null))})),n=i.map(o=>({video:o,inputPromise:Qi(o.src,e).catch(a=>{if(G(a)||e?.aborted)return{hasAudio:!1,input:null};throw a})}));return{storeAudios:r,videoAudios:n}}function qi(t,e,s){const i=(t.delay||0)/1e3,r=t.volume!==void 0?t.volume:1,n=t.startTime||0,o=t.endTime||1,a=t.duration||s.totalDuration,u=n*a/1e3,c=a*(o-n)/1e3;let l=i,m=u,h=Math.min(c,e.duration-u);if(l<0&&(m+=Math.abs(l),h-=Math.abs(l),l=0),h<=0||m>=e.duration)return;const p=s.offlineContext.createBufferSource();p.buffer=e;const g=s.offlineContext.createGain();g.gain.value=r,p.connect(g),g.connect(s.offlineContext.destination),p.start(l,m,h)}function ji(t,e,s){const i=t.startTime*t.duration/1e3,r=t.duration*(t.endTime-t.startTime)/1e3,n=t.pageStartTime/1e3;let o=Math.max(0,n),a=Math.max(0,i),u=Math.min(r,e.duration-a,t.pageDuration/1e3);if(u<=0||a>=e.duration)return;const c=s.offlineContext.createBufferSource();c.buffer=e;const l=s.offlineContext.createGain();l.gain.value=t.volume,c.connect(l),l.connect(s.offlineContext.destination),c.start(o,a,u)}async function Gi(t,e,s,i,r,n,o){S(o);const a=r||wt(t,o);if(a.storeAudios.length+a.videoAudios.length===0)return;const u=44100,c=2,l=typeof i=="string"?i:typeof i?.codec=="string"?i.codec:void 0,m=l?.includes("opus")?960:1024,h=l==="aac"?3:l?.includes("opus")?2:0,p=Math.floor(s/1e3*u),g=Math.floor(p/m)*m,b=h*m,E=Math.max(m,g-b),x=new OfflineAudioContext(c,E,u),U={offlineContext:x,totalDuration:s};n?.(.95);const[O,L]=await Promise.all([Promise.all(a.storeAudios.map(async({audio:A,bufferPromise:le})=>{try{S(o);const P=await le;if(S(o),!P)return null;const X=await Wi(x,P);return{audio:A,audioBuffer:X}}catch(P){if(G(P))throw P;return console.error(`Failed to process audio ${A.src}:`,P),null}})),Promise.all(a.videoAudios.map(async({video:A,inputPromise:le})=>{try{S(o);const{hasAudio:P,input:X}=await le;if(S(o),!P||!X)return null;const Pe=await X.getPrimaryAudioTrack();if(!Pe)return X.dispose(),null;const Tt=new Jt(Pe),Y=[];for await(const H of Tt.buffers())S(o),Y.push(H.buffer);if(X.dispose(),S(o),Y.length===0)return null;const yt=Y.reduce((H,Z)=>H+Z.length,0),Me=x.createBuffer(Y[0].numberOfChannels,yt,Y[0].sampleRate);let Oe=0;for(const H of Y){for(let Z=0;Z<H.numberOfChannels;Z++)Me.getChannelData(Z).set(H.getChannelData(Z),Oe);Oe+=H.length}return{video:A,audioBuffer:Me}}catch(P){if(G(P))throw P;return console.error(`Failed to extract video audio ${A.src}:`,P),null}}))]);n?.(.97),S(o);for(const A of O)A&&qi(A.audio,A.audioBuffer,U);for(const A of L)A&&ji(A.video,A.audioBuffer,U);S(o);const se=await x.startRendering();n?.(.99),S(o),await e.add(se)}async function Xi({store:t,fps:e=30,pixelRatio:s=1,onProgress:i,includeAudio:r=!0,signal:n}){const o=Ai(t);let a=null,u=null,c=null,l=null,m=!1;if(n){S(n);const h=()=>{try{u?.close()}catch{}try{c?.close()}catch{}a?.cancel().catch(()=>{})};n.addEventListener("abort",h,{once:!0}),l=()=>n.removeEventListener("abort",h)}try{S(n);const h=xi(t);if(h===0)throw new Error("Video duration is 0");const p=ki(t),{canvas:g,canvases:b}=Oi(t,s),E=await zi(g,e);a=E.output,u=E.canvasSource;const x=await Bi(a,t,r);c=x.audioBufferSource||null;const U=x.audioCodec;S(n),await a.start(),await Ri(t,u,b,p,h,e,s,i,n),u.close();const O=c?wt(t,n):null;c&&O&&(await Gi(t,c,h,U,O,i,n),c.close()),S(n),await a.finalize();const L=a.target,se=new Blob([L.buffer],{type:a.format.mimeType});return m=!0,se}catch(h){throw G(h)?h:n?.aborted?ue():h}finally{if(l?.(),!m&&a)try{await a.cancel()}catch{}o&&Pi(t,o)}}export{Xi as storeToVideo};
@@ -489,7 +489,7 @@ T* `):V.join(` Tj
489
489
  endobj\r
490
490
  `},r.outline.count_r=function(n,i){for(var a=0;a<i.children.length;a++)n.count++,this.count_r(n,i.children[a]);return n.count}}])})(cr.API),(function(t){var e=[192,193,194,195,196,197,198,199];t.processJPEG=function(r,n,i,a,o,s){var l,c=this.decode.DCT_DECODE,f=null;if(typeof r=="string"||this.__addimage__.isArrayBuffer(r)||this.__addimage__.isArrayBufferView(r)){switch(r=o||r,r=this.__addimage__.isArrayBuffer(r)?new Uint8Array(r):r,l=(function(h){for(var d,p=256*h.charCodeAt(4)+h.charCodeAt(5),v=h.length,b={width:0,height:0,numcomponents:1},x=4;x<v;x+=2){if(x+=p,e.indexOf(h.charCodeAt(x+1))!==-1){d=256*h.charCodeAt(x+5)+h.charCodeAt(x+6),b={width:256*h.charCodeAt(x+7)+h.charCodeAt(x+8),height:d,numcomponents:h.charCodeAt(x+9)};break}p=256*h.charCodeAt(x+2)+h.charCodeAt(x+3)}return b})(r=this.__addimage__.isArrayBufferView(r)?this.__addimage__.arrayBufferToBinaryString(r):r),l.numcomponents){case 1:s=this.color_spaces.DEVICE_GRAY;break;case 4:s=this.color_spaces.DEVICE_CMYK;break;case 3:s=this.color_spaces.DEVICE_RGB}f={data:r,width:l.width,height:l.height,colorSpace:s,bitsPerComponent:8,filter:c,index:n,alias:i}}return f}})(cr.API),cr.API.processPNG=function(t,e,r,n){if(this.__addimage__.isArrayBuffer(t)&&(t=new Uint8Array(t)),this.__addimage__.isArrayBufferView(t)){var i,a=KU(t,{checkCrc:!0}),o=a.width,s=a.height,l=a.channels,c=a.palette,f=a.depth;i=c&&l===1?(function(O){for(var M=O.width,F=O.height,T=O.data,R=O.palette,H=O.depth,z=!1,Q=[],oe=[],ee=void 0,X=!1,ne=0,G=0;G<R.length;G++){var j=W8(R[G],4),B=j[0],U=j[1],Y=j[2],J=j[3];Q.push(B,U,Y),J!=null&&(J===0?(ne++,oe.length<1&&oe.push(G)):J<255&&(X=!0))}if(X||ne>1){z=!0,oe=void 0;var Z=M*F;ee=new Uint8Array(Z);for(var ie=new DataView(T.buffer),he=0;he<Z;he++){var ue=Qy(ie,he,H),we=W8(R[ue],4)[3];ee[he]=we}}else ne===0&&(oe=void 0);return{colorSpace:"Indexed",colorsPerPixel:1,sMaskBitsPerComponent:z?8:void 0,colorBytes:T,alphaBytes:ee,needSMask:z,palette:Q,mask:oe}})(a):l===2||l===4?(function(O){for(var M=O.data,F=O.width,T=O.height,R=O.channels,H=O.depth,z=R===2?"DeviceGray":"DeviceRGB",Q=R-1,oe=F*T,ee=Q,X=oe*ee,ne=1*oe,G=Math.ceil(X*H/8),j=Math.ceil(ne*H/8),B=new Uint8Array(G),U=new Uint8Array(j),Y=new DataView(M.buffer),J=new DataView(B.buffer),Z=new DataView(U.buffer),ie=!1,he=0;he<oe;he++){for(var ue=he*R,we=0;we<ee;we++)Zx(J,Qy(Y,ue+we,H),he*ee+we,H);var Te=Qy(Y,ue+ee,H);Te<(1<<H)-1&&(ie=!0),Zx(Z,Te,1*he,H)}return{colorSpace:z,colorsPerPixel:Q,sMaskBitsPerComponent:ie?H:void 0,colorBytes:B,alphaBytes:U,needSMask:ie}})(a):(function(O){var M=O.data,F=O.channels===1?"DeviceGray":"DeviceRGB";return{colorSpace:F,colorsPerPixel:F==="DeviceGray"?1:3,colorBytes:M instanceof Uint16Array?(function(T){for(var R=T.length,H=new Uint8Array(2*R),z=new DataView(H.buffer,H.byteOffset,H.byteLength),Q=0;Q<R;Q++)z.setUint16(2*Q,T[Q],!1);return H})(M):M,needSMask:!1}})(a);var h,d,p,v=i,b=v.colorSpace,x=v.colorsPerPixel,w=v.sMaskBitsPerComponent,S=v.colorBytes,P=v.alphaBytes,_=v.needSMask,E=v.palette,I=v.mask,C=null;return n!==cr.API.image_compression.NONE&&typeof Z5=="function"?(C=(function(O){var M;switch(O){case cr.API.image_compression.FAST:M=11;break;case cr.API.image_compression.MEDIUM:M=13;break;case cr.API.image_compression.SLOW:M=14;break;default:M=12}return M})(n),h=this.decode.FLATE_DECODE,d="/Predictor ".concat(C," /Colors ").concat(x," /BitsPerComponent ").concat(f," /Columns ").concat(o),t=Wx(S,Math.ceil(o*x*f/8),x,f,n),_&&(p=Wx(P,Math.ceil(o*w/8),1,w,n))):(h=void 0,d=void 0,t=S,_&&(p=P)),(this.__addimage__.isArrayBuffer(t)||this.__addimage__.isArrayBufferView(t))&&(t=this.__addimage__.arrayBufferToBinaryString(t)),(p&&this.__addimage__.isArrayBuffer(p)||this.__addimage__.isArrayBufferView(p))&&(p=this.__addimage__.arrayBufferToBinaryString(p)),{alias:r,data:t,index:e,filter:h,decodeParameters:d,transparency:I,palette:E,sMask:p,predictor:C,width:o,height:s,bitsPerComponent:f,sMaskBitsPerComponent:w,colorSpace:b}}},(function(t){t.processGIF89A=function(e,r,n,i){var a=new vq(e),o=a.width,s=a.height,l=[];a.decodeAndBlitFrameRGBA(0,l);var c={data:l,width:o,height:s},f=new Jy(100).encode(c,100);return t.processJPEG.call(this,f,r,n,i)},t.processGIF87A=t.processGIF89A})(cr.API),wu.prototype.parseHeader=function(){if(this.fileSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.reserved=this.datav.getUint32(this.pos,!0),this.pos+=4,this.offset=this.datav.getUint32(this.pos,!0),this.pos+=4,this.headerSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.width=this.datav.getUint32(this.pos,!0),this.pos+=4,this.height=this.datav.getInt32(this.pos,!0),this.pos+=4,this.planes=this.datav.getUint16(this.pos,!0),this.pos+=2,this.bitPP=this.datav.getUint16(this.pos,!0),this.pos+=2,this.compress=this.datav.getUint32(this.pos,!0),this.pos+=4,this.rawSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.hr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.vr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.colors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.importantColors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.bitPP===16&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var t=this.colors===0?1<<this.bitPP:this.colors;this.palette=new Array(t);for(var e=0;e<t;e++){var r=this.datav.getUint8(this.pos++,!0),n=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0);this.palette[e]={red:i,green:n,blue:r,quad:a}}}this.height<0&&(this.height*=-1,this.bottom_up=!1)},wu.prototype.parseBGR=function(){this.pos=this.offset;try{var t="bit"+this.bitPP,e=this.width*this.height*4;this.data=new Uint8Array(e),this[t]()}catch(r){ai.log("bit decode error:"+r)}},wu.prototype.bit1=function(){var t,e=Math.ceil(this.width/8),r=e%4;for(t=this.height-1;t>=0;t--){for(var n=this.bottom_up?t:this.height-1-t,i=0;i<e;i++)for(var a=this.datav.getUint8(this.pos++,!0),o=n*this.width*4+8*i*4,s=0;s<8&&8*i+s<this.width;s++){var l=this.palette[a>>7-s&1];this.data[o+4*s]=l.blue,this.data[o+4*s+1]=l.green,this.data[o+4*s+2]=l.red,this.data[o+4*s+3]=255}r!==0&&(this.pos+=4-r)}},wu.prototype.bit4=function(){for(var t=Math.ceil(this.width/2),e=t%4,r=this.height-1;r>=0;r--){for(var n=this.bottom_up?r:this.height-1-r,i=0;i<t;i++){var a=this.datav.getUint8(this.pos++,!0),o=n*this.width*4+2*i*4,s=a>>4,l=15&a,c=this.palette[s];if(this.data[o]=c.blue,this.data[o+1]=c.green,this.data[o+2]=c.red,this.data[o+3]=255,2*i+1>=this.width)break;c=this.palette[l],this.data[o+4]=c.blue,this.data[o+4+1]=c.green,this.data[o+4+2]=c.red,this.data[o+4+3]=255}e!==0&&(this.pos+=4-e)}},wu.prototype.bit8=function(){for(var t=this.width%4,e=this.height-1;e>=0;e--){for(var r=this.bottom_up?e:this.height-1-e,n=0;n<this.width;n++){var i=this.datav.getUint8(this.pos++,!0),a=r*this.width*4+4*n;if(i<this.palette.length){var o=this.palette[i];this.data[a]=o.red,this.data[a+1]=o.green,this.data[a+2]=o.blue,this.data[a+3]=255}else this.data[a]=255,this.data[a+1]=255,this.data[a+2]=255,this.data[a+3]=255}t!==0&&(this.pos+=4-t)}},wu.prototype.bit15=function(){for(var t=this.width%3,e=parseInt("11111",2),r=this.height-1;r>=0;r--){for(var n=this.bottom_up?r:this.height-1-r,i=0;i<this.width;i++){var a=this.datav.getUint16(this.pos,!0);this.pos+=2;var o=(a&e)/e*255|0,s=(a>>5&e)/e*255|0,l=(a>>10&e)/e*255|0,c=a>>15?255:0,f=n*this.width*4+4*i;this.data[f]=l,this.data[f+1]=s,this.data[f+2]=o,this.data[f+3]=c}this.pos+=t}},wu.prototype.bit16=function(){for(var t=this.width%3,e=parseInt("11111",2),r=parseInt("111111",2),n=this.height-1;n>=0;n--){for(var i=this.bottom_up?n:this.height-1-n,a=0;a<this.width;a++){var o=this.datav.getUint16(this.pos,!0);this.pos+=2;var s=(o&e)/e*255|0,l=(o>>5&r)/r*255|0,c=(o>>11)/e*255|0,f=i*this.width*4+4*a;this.data[f]=c,this.data[f+1]=l,this.data[f+2]=s,this.data[f+3]=255}this.pos+=t}},wu.prototype.bit24=function(){for(var t=this.height-1;t>=0;t--){for(var e=this.bottom_up?t:this.height-1-t,r=0;r<this.width;r++){var n=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),o=e*this.width*4+4*r;this.data[o]=a,this.data[o+1]=i,this.data[o+2]=n,this.data[o+3]=255}this.pos+=this.width%4}},wu.prototype.bit32=function(){for(var t=this.height-1;t>=0;t--)for(var e=this.bottom_up?t:this.height-1-t,r=0;r<this.width;r++){var n=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),o=this.datav.getUint8(this.pos++,!0),s=e*this.width*4+4*r;this.data[s]=a,this.data[s+1]=i,this.data[s+2]=n,this.data[s+3]=o}},wu.prototype.getData=function(){return this.data},(function(t){t.processBMP=function(e,r,n,i){var a=new wu(e,!1),o=a.width,s=a.height,l={data:a.getData(),width:o,height:s},c=new Jy(100).encode(l,100);return t.processJPEG.call(this,c,r,n,i)}})(cr.API),Jx.prototype.getData=function(){return this.data},(function(t){t.processWEBP=function(e,r,n,i){var a=new Jx(e),o=a.width,s=a.height,l={data:a.getData(),width:o,height:s},c=new Jy(100).encode(l,100);return t.processJPEG.call(this,c,r,n,i)}})(cr.API),cr.API.processRGBA=function(t,e,r){for(var n=t.data,i=n.length,a=new Uint8Array(i/4*3),o=new Uint8Array(i/4),s=0,l=0,c=0;c<i;c+=4){var f=n[c],h=n[c+1],d=n[c+2],p=n[c+3];a[s++]=f,a[s++]=h,a[s++]=d,o[l++]=p}var v=this.__addimage__.arrayBufferToBinaryString(a);return{alpha:this.__addimage__.arrayBufferToBinaryString(o),data:v,index:e,alias:r,colorSpace:"DeviceRGB",bitsPerComponent:8,width:t.width,height:t.height}},cr.API.setLanguage=function(t){return this.internal.languageSettings===void 0&&(this.internal.languageSettings={},this.internal.languageSettings.isSubscribed=!1),{af:"Afrikaans",sq:"Albanian",ar:"Arabic (Standard)","ar-DZ":"Arabic (Algeria)","ar-BH":"Arabic (Bahrain)","ar-EG":"Arabic (Egypt)","ar-IQ":"Arabic (Iraq)","ar-JO":"Arabic (Jordan)","ar-KW":"Arabic (Kuwait)","ar-LB":"Arabic (Lebanon)","ar-LY":"Arabic (Libya)","ar-MA":"Arabic (Morocco)","ar-OM":"Arabic (Oman)","ar-QA":"Arabic (Qatar)","ar-SA":"Arabic (Saudi Arabia)","ar-SY":"Arabic (Syria)","ar-TN":"Arabic (Tunisia)","ar-AE":"Arabic (U.A.E.)","ar-YE":"Arabic (Yemen)",an:"Aragonese",hy:"Armenian",as:"Assamese",ast:"Asturian",az:"Azerbaijani",eu:"Basque",be:"Belarusian",bn:"Bengali",bs:"Bosnian",br:"Breton",bg:"Bulgarian",my:"Burmese",ca:"Catalan",ch:"Chamorro",ce:"Chechen",zh:"Chinese","zh-HK":"Chinese (Hong Kong)","zh-CN":"Chinese (PRC)","zh-SG":"Chinese (Singapore)","zh-TW":"Chinese (Taiwan)",cv:"Chuvash",co:"Corsican",cr:"Cree",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch (Standard)","nl-BE":"Dutch (Belgian)",en:"English","en-AU":"English (Australia)","en-BZ":"English (Belize)","en-CA":"English (Canada)","en-IE":"English (Ireland)","en-JM":"English (Jamaica)","en-NZ":"English (New Zealand)","en-PH":"English (Philippines)","en-ZA":"English (South Africa)","en-TT":"English (Trinidad & Tobago)","en-GB":"English (United Kingdom)","en-US":"English (United States)","en-ZW":"English (Zimbabwe)",eo:"Esperanto",et:"Estonian",fo:"Faeroese",fj:"Fijian",fi:"Finnish",fr:"French (Standard)","fr-BE":"French (Belgium)","fr-CA":"French (Canada)","fr-FR":"French (France)","fr-LU":"French (Luxembourg)","fr-MC":"French (Monaco)","fr-CH":"French (Switzerland)",fy:"Frisian",fur:"Friulian",gd:"Gaelic (Scots)","gd-IE":"Gaelic (Irish)",gl:"Galacian",ka:"Georgian",de:"German (Standard)","de-AT":"German (Austria)","de-DE":"German (Germany)","de-LI":"German (Liechtenstein)","de-LU":"German (Luxembourg)","de-CH":"German (Switzerland)",el:"Greek",gu:"Gujurati",ht:"Haitian",he:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",iu:"Inuktitut",ga:"Irish",it:"Italian (Standard)","it-CH":"Italian (Switzerland)",ja:"Japanese",kn:"Kannada",ks:"Kashmiri",kk:"Kazakh",km:"Khmer",ky:"Kirghiz",tlh:"Klingon",ko:"Korean","ko-KP":"Korean (North Korea)","ko-KR":"Korean (South Korea)",la:"Latin",lv:"Latvian",lt:"Lithuanian",lb:"Luxembourgish",mk:"North Macedonia",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mo:"Moldavian",nv:"Navajo",ng:"Ndonga",ne:"Nepali",no:"Norwegian",nb:"Norwegian (Bokmal)",nn:"Norwegian (Nynorsk)",oc:"Occitan",or:"Oriya",om:"Oromo",fa:"Persian","fa-IR":"Persian/Iran",pl:"Polish",pt:"Portuguese","pt-BR":"Portuguese (Brazil)",pa:"Punjabi","pa-IN":"Punjabi (India)","pa-PK":"Punjabi (Pakistan)",qu:"Quechua",rm:"Rhaeto-Romanic",ro:"Romanian","ro-MO":"Romanian (Moldavia)",ru:"Russian","ru-MO":"Russian (Moldavia)",sz:"Sami (Lappish)",sg:"Sango",sa:"Sanskrit",sc:"Sardinian",sd:"Sindhi",si:"Singhalese",sr:"Serbian",sk:"Slovak",sl:"Slovenian",so:"Somani",sb:"Sorbian",es:"Spanish","es-AR":"Spanish (Argentina)","es-BO":"Spanish (Bolivia)","es-CL":"Spanish (Chile)","es-CO":"Spanish (Colombia)","es-CR":"Spanish (Costa Rica)","es-DO":"Spanish (Dominican Republic)","es-EC":"Spanish (Ecuador)","es-SV":"Spanish (El Salvador)","es-GT":"Spanish (Guatemala)","es-HN":"Spanish (Honduras)","es-MX":"Spanish (Mexico)","es-NI":"Spanish (Nicaragua)","es-PA":"Spanish (Panama)","es-PY":"Spanish (Paraguay)","es-PE":"Spanish (Peru)","es-PR":"Spanish (Puerto Rico)","es-ES":"Spanish (Spain)","es-UY":"Spanish (Uruguay)","es-VE":"Spanish (Venezuela)",sx:"Sutu",sw:"Swahili",sv:"Swedish","sv-FI":"Swedish (Finland)","sv-SV":"Swedish (Sweden)",ta:"Tamil",tt:"Tatar",te:"Teluga",th:"Thai",tig:"Tigre",ts:"Tsonga",tn:"Tswana",tr:"Turkish",tk:"Turkmen",uk:"Ukrainian",hsb:"Upper Sorbian",ur:"Urdu",ve:"Venda",vi:"Vietnamese",vo:"Volapuk",wa:"Walloon",cy:"Welsh",xh:"Xhosa",ji:"Yiddish",zu:"Zulu"}[t]!==void 0&&(this.internal.languageSettings.languageCode=t,this.internal.languageSettings.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){this.internal.write("/Lang ("+this.internal.languageSettings.languageCode+")")}),this.internal.languageSettings.isSubscribed=!0)),this},Jd=cr.API,Pg=Jd.getCharWidthsArray=function(t,e){var r,n,i=(e=e||{}).font||this.internal.getFont(),a=e.fontSize||this.internal.getFontSize(),o=e.charSpace||this.internal.getCharSpace(),s=e.widths?e.widths:i.metadata.Unicode.widths,l=s.fof?s.fof:1,c=e.kerning?e.kerning:i.metadata.Unicode.kerning,f=c.fof?c.fof:1,h=e.doKerning!==!1,d=0,p=t.length,v=0,b=s[0]||l,x=[];for(r=0;r<p;r++)n=t.charCodeAt(r),typeof i.metadata.widthOfString=="function"?x.push((i.metadata.widthOfGlyph(i.metadata.characterToGlyph(n))+o*(1e3/a)||0)/1e3):(d=h&&Hn(c[n])==="object"&&!isNaN(parseInt(c[n][v],10))?c[n][v]/f:0,x.push((s[n]||b)/l+d)),v=n;return x},Hx=Jd.getStringUnitWidth=function(t,e){var r=(e=e||{}).fontSize||this.internal.getFontSize(),n=e.font||this.internal.getFont(),i=e.charSpace||this.internal.getCharSpace();return Jd.processArabic&&(t=Jd.processArabic(t)),typeof n.metadata.widthOfString=="function"?n.metadata.widthOfString(t,r,i)/r:Pg.apply(this,arguments).reduce(function(a,o){return a+o},0)},Vx=function(t,e,r,n){for(var i=[],a=0,o=t.length,s=0;a!==o&&s+e[a]<r;)s+=e[a],a++;i.push(t.slice(0,a));var l=a;for(s=0;a!==o;)s+e[a]>n&&(i.push(t.slice(l,a)),s=0,l=a),s+=e[a],a++;return l!==a&&i.push(t.slice(l,a)),i},$x=function(t,e,r){r||(r={});var n,i,a,o,s,l,c,f=[],h=[f],d=r.textIndent||0,p=0,v=0,b=t.split(" "),x=Pg.apply(this,[" ",r])[0];if(l=r.lineIndent===-1?b[0].length+2:r.lineIndent||0){var w=Array(l).join(" "),S=[];b.map(function(_){(_=_.split(/\s*\n/)).length>1?S=S.concat(_.map(function(E,I){return(I&&E.length?`
491
491
  `:"")+E})):S.push(_[0])}),b=S,l=Hx.apply(this,[w,r])}for(a=0,o=b.length;a<o;a++){var P=0;if(n=b[a],l&&n[0]==`
492
- `&&(n=n.substr(1),P=1),d+p+(v=(i=Pg.apply(this,[n,r])).reduce(function(_,E){return _+E},0))>e||P){if(v>e){for(s=Vx.apply(this,[n,i,e-(d+p),e]),f.push(s.shift()),f=[s.pop()];s.length;)h.push([s.shift()]);v=i.slice(n.length-(f[0]?f[0].length:0)).reduce(function(_,E){return _+E},0)}else f=[n];h.push(f),d=v+l,p=x}else f.push(n),d+=p+v,p=x}return c=l?function(_,E){return(E?w:"")+_.join(" ")}:function(_){return _.join(" ")},h.map(c)},Jd.splitTextToSize=function(t,e,r){var n,i=(r=r||{}).fontSize||this.internal.getFontSize(),a=(function(f){if(f.widths&&f.kerning)return{widths:f.widths,kerning:f.kerning};var h=this.internal.getFont(f.fontName,f.fontStyle),d="Unicode";return h.metadata[d]?{widths:h.metadata[d].widths||{0:1},kerning:h.metadata[d].kerning||{}}:{font:h.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}).call(this,r);n=Array.isArray(t)?t:String(t).split(/\r?\n/);var o=1*this.internal.scaleFactor*e/i;a.textIndent=r.textIndent?1*r.textIndent*this.internal.scaleFactor/i:0,a.lineIndent=r.lineIndent;var s,l,c=[];for(s=0,l=n.length;s<l;s++)c=c.concat($x.apply(this,[n[s],o,a]));return c},(function(t){t.__fontmetrics__=t.__fontmetrics__||{};for(var e="0123456789abcdef",r="klmnopqrstuvwxyz",n={},i={},a=0;a<16;a++)n[r[a]]=e[a],i[e[a]]=r[a];var o=function(d){return"0x"+parseInt(d,10).toString(16)},s=t.__fontmetrics__.compress=function(d){var p,v,b,x,w=["{"];for(var S in d){if(p=d[S],isNaN(parseInt(S,10))?v="'"+S+"'":(S=parseInt(S,10),v=(v=o(S).slice(2)).slice(0,-1)+i[v.slice(-1)]),typeof p=="number")p<0?(b=o(p).slice(3),x="-"):(b=o(p).slice(2),x=""),b=x+b.slice(0,-1)+i[b.slice(-1)];else{if(Hn(p)!=="object")throw new Error("Don't know what to do with value type "+Hn(p)+".");b=s(p)}w.push(v+b)}return w.push("}"),w.join("")},l=t.__fontmetrics__.uncompress=function(d){if(typeof d!="string")throw new Error("Invalid argument passed to uncompress.");for(var p,v,b,x,w={},S=1,P=w,_=[],E="",I="",C=d.length-1,O=1;O<C;O+=1)(x=d[O])=="'"?p?(b=p.join(""),p=void 0):p=[]:p?p.push(x):x=="{"?(_.push([P,b]),P={},b=void 0):x=="}"?((v=_.pop())[0][v[1]]=P,b=void 0,P=v[0]):x=="-"?S=-1:b===void 0?n.hasOwnProperty(x)?(E+=n[x],b=parseInt(E,16)*S,S=1,E=""):E+=x:n.hasOwnProperty(x)?(I+=n[x],P[b]=parseInt(I,16)*S,S=1,b=void 0,I=""):I+=x;return w},c={codePages:["WinAnsiEncoding"],WinAnsiEncoding:l("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")},f={Unicode:{Courier:c,"Courier-Bold":c,"Courier-BoldOblique":c,"Courier-Oblique":c,Helvetica:c,"Helvetica-Bold":c,"Helvetica-BoldOblique":c,"Helvetica-Oblique":c,"Times-Roman":c,"Times-Bold":c,"Times-BoldItalic":c,"Times-Italic":c}},h={Unicode:{"Courier-Oblique":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-BoldItalic":l("{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}"),"Helvetica-Bold":l("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),Courier:l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-BoldOblique":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Bold":l("{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}"),Symbol:l("{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}"),Helvetica:l("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}"),"Helvetica-BoldOblique":l("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),ZapfDingbats:l("{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-Bold":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Italic":l("{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}"),"Times-Roman":l("{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}"),"Helvetica-Oblique":l("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")}};t.events.push(["addFont",function(d){var p=d.font,v=h.Unicode[p.postScriptName];v&&(p.metadata.Unicode={},p.metadata.Unicode.widths=v.widths,p.metadata.Unicode.kerning=v.kerning);var b=f.Unicode[p.postScriptName];b&&(p.metadata.Unicode.encoding=b,p.encoding=b.codePages[0])}])})(cr.API),(function(t){var e=function(r){for(var n=r.length,i=new Uint8Array(n),a=0;a<n;a++)i[a]=r.charCodeAt(a);return i};t.API.events.push(["addFont",function(r){var n=void 0,i=r.font,a=r.instance;if(!i.isStandardFont){if(a===void 0)throw new Error("Font does not exist in vFS, import fonts or remove declaration doc.addFont('"+i.postScriptName+"').");if(typeof(n=a.existsFileInVFS(i.postScriptName)===!1?a.loadFile(i.postScriptName):a.getFileFromVFS(i.postScriptName))!="string")throw new Error("Font is not stored as string-data in vFS, import fonts or remove declaration doc.addFont('"+i.postScriptName+"').");(function(o,s){s=/^\x00\x01\x00\x00/.test(s)?e(s):e(zg(s)),o.metadata=t.API.TTFFont.open(s),o.metadata.Unicode=o.metadata.Unicode||{encoding:{},kerning:{},widths:[]},o.metadata.glyIdsUsed=[0]})(i,n)}}])})(cr),cr.API.addSvgAsImage=function(t,e,r,n,i,a,o,s){if(isNaN(e)||isNaN(r))throw ai.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(n)||isNaN(i))throw ai.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var l=document.createElement("canvas");l.width=n,l.height=i;var c=l.getContext("2d");c.fillStyle="#fff",c.fillRect(0,0,l.width,l.height);var f={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},h=this;return(Ar.canvg?Promise.resolve(Ar.canvg):Eg(()=>import("./index.es-D1ZBUUUB.js"),[],import.meta.url)).catch(function(d){return Promise.reject(new Error("Could not load canvg: "+d))}).then(function(d){return d.default?d.default:d}).then(function(d){return d.fromString(c,t,f)},function(){return Promise.reject(new Error("Could not load canvg."))}).then(function(d){return d.render(f)}).then(function(){h.addImage(l.toDataURL("image/jpeg",1),e,r,n,i,o,s)})},cr.API.putTotalPages=function(t){var e,r=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(e=new RegExp(t,"g"),r=this.internal.getNumberOfPages()):(e=new RegExp(this.pdfEscape16(t,this.internal.getFont()),"g"),r=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var n=1;n<=this.internal.getNumberOfPages();n++)for(var i=0;i<this.internal.pages[n].length;i++)this.internal.pages[n][i]=this.internal.pages[n][i].replace(e,r);return this},cr.API.viewerPreferences=function(t,e){var r;t=t||{},e=e||!1;var n,i,a,o={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},s=Object.keys(o),l=[],c=0,f=0,h=0;function d(v,b){var x,w=!1;for(x=0;x<v.length;x+=1)v[x]===b&&(w=!0);return w}if(this.internal.viewerpreferences===void 0&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(o)),this.internal.viewerpreferences.isSubscribed=!1),r=this.internal.viewerpreferences.configuration,t==="reset"||e===!0){var p=s.length;for(h=0;h<p;h+=1)r[s[h]].value=r[s[h]].defaultValue,r[s[h]].explicitSet=!1}if(Hn(t)==="object"){for(i in t)if(a=t[i],d(s,i)&&a!==void 0){if(r[i].type==="boolean"&&typeof a=="boolean")r[i].value=a;else if(r[i].type==="name"&&d(r[i].valueSet,a))r[i].value=a;else if(r[i].type==="integer"&&Number.isInteger(a))r[i].value=a;else if(r[i].type==="array"){for(c=0;c<a.length;c+=1)if(n=!0,a[c].length===1&&typeof a[c][0]=="number")l.push(String(a[c]-1));else if(a[c].length>1){for(f=0;f<a[c].length;f+=1)typeof a[c][f]!="number"&&(n=!1);n===!0&&l.push([a[c][0]-1,a[c][1]-1].join(" "))}r[i].value="["+l.join(" ")+"]"}else r[i].value=r[i].defaultValue;r[i].explicitSet=!0}}return this.internal.viewerpreferences.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){var v,b=[];for(v in r)r[v].explicitSet===!0&&(r[v].type==="name"?b.push("/"+v+" /"+r[v].value):b.push("/"+v+" "+r[v].value));b.length!==0&&this.internal.write(`/ViewerPreferences
492
+ `&&(n=n.substr(1),P=1),d+p+(v=(i=Pg.apply(this,[n,r])).reduce(function(_,E){return _+E},0))>e||P){if(v>e){for(s=Vx.apply(this,[n,i,e-(d+p),e]),f.push(s.shift()),f=[s.pop()];s.length;)h.push([s.shift()]);v=i.slice(n.length-(f[0]?f[0].length:0)).reduce(function(_,E){return _+E},0)}else f=[n];h.push(f),d=v+l,p=x}else f.push(n),d+=p+v,p=x}return c=l?function(_,E){return(E?w:"")+_.join(" ")}:function(_){return _.join(" ")},h.map(c)},Jd.splitTextToSize=function(t,e,r){var n,i=(r=r||{}).fontSize||this.internal.getFontSize(),a=(function(f){if(f.widths&&f.kerning)return{widths:f.widths,kerning:f.kerning};var h=this.internal.getFont(f.fontName,f.fontStyle),d="Unicode";return h.metadata[d]?{widths:h.metadata[d].widths||{0:1},kerning:h.metadata[d].kerning||{}}:{font:h.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}).call(this,r);n=Array.isArray(t)?t:String(t).split(/\r?\n/);var o=1*this.internal.scaleFactor*e/i;a.textIndent=r.textIndent?1*r.textIndent*this.internal.scaleFactor/i:0,a.lineIndent=r.lineIndent;var s,l,c=[];for(s=0,l=n.length;s<l;s++)c=c.concat($x.apply(this,[n[s],o,a]));return c},(function(t){t.__fontmetrics__=t.__fontmetrics__||{};for(var e="0123456789abcdef",r="klmnopqrstuvwxyz",n={},i={},a=0;a<16;a++)n[r[a]]=e[a],i[e[a]]=r[a];var o=function(d){return"0x"+parseInt(d,10).toString(16)},s=t.__fontmetrics__.compress=function(d){var p,v,b,x,w=["{"];for(var S in d){if(p=d[S],isNaN(parseInt(S,10))?v="'"+S+"'":(S=parseInt(S,10),v=(v=o(S).slice(2)).slice(0,-1)+i[v.slice(-1)]),typeof p=="number")p<0?(b=o(p).slice(3),x="-"):(b=o(p).slice(2),x=""),b=x+b.slice(0,-1)+i[b.slice(-1)];else{if(Hn(p)!=="object")throw new Error("Don't know what to do with value type "+Hn(p)+".");b=s(p)}w.push(v+b)}return w.push("}"),w.join("")},l=t.__fontmetrics__.uncompress=function(d){if(typeof d!="string")throw new Error("Invalid argument passed to uncompress.");for(var p,v,b,x,w={},S=1,P=w,_=[],E="",I="",C=d.length-1,O=1;O<C;O+=1)(x=d[O])=="'"?p?(b=p.join(""),p=void 0):p=[]:p?p.push(x):x=="{"?(_.push([P,b]),P={},b=void 0):x=="}"?((v=_.pop())[0][v[1]]=P,b=void 0,P=v[0]):x=="-"?S=-1:b===void 0?n.hasOwnProperty(x)?(E+=n[x],b=parseInt(E,16)*S,S=1,E=""):E+=x:n.hasOwnProperty(x)?(I+=n[x],P[b]=parseInt(I,16)*S,S=1,b=void 0,I=""):I+=x;return w},c={codePages:["WinAnsiEncoding"],WinAnsiEncoding:l("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")},f={Unicode:{Courier:c,"Courier-Bold":c,"Courier-BoldOblique":c,"Courier-Oblique":c,Helvetica:c,"Helvetica-Bold":c,"Helvetica-BoldOblique":c,"Helvetica-Oblique":c,"Times-Roman":c,"Times-Bold":c,"Times-BoldItalic":c,"Times-Italic":c}},h={Unicode:{"Courier-Oblique":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-BoldItalic":l("{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}"),"Helvetica-Bold":l("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),Courier:l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-BoldOblique":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Bold":l("{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}"),Symbol:l("{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}"),Helvetica:l("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}"),"Helvetica-BoldOblique":l("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),ZapfDingbats:l("{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-Bold":l("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Italic":l("{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}"),"Times-Roman":l("{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}"),"Helvetica-Oblique":l("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")}};t.events.push(["addFont",function(d){var p=d.font,v=h.Unicode[p.postScriptName];v&&(p.metadata.Unicode={},p.metadata.Unicode.widths=v.widths,p.metadata.Unicode.kerning=v.kerning);var b=f.Unicode[p.postScriptName];b&&(p.metadata.Unicode.encoding=b,p.encoding=b.codePages[0])}])})(cr.API),(function(t){var e=function(r){for(var n=r.length,i=new Uint8Array(n),a=0;a<n;a++)i[a]=r.charCodeAt(a);return i};t.API.events.push(["addFont",function(r){var n=void 0,i=r.font,a=r.instance;if(!i.isStandardFont){if(a===void 0)throw new Error("Font does not exist in vFS, import fonts or remove declaration doc.addFont('"+i.postScriptName+"').");if(typeof(n=a.existsFileInVFS(i.postScriptName)===!1?a.loadFile(i.postScriptName):a.getFileFromVFS(i.postScriptName))!="string")throw new Error("Font is not stored as string-data in vFS, import fonts or remove declaration doc.addFont('"+i.postScriptName+"').");(function(o,s){s=/^\x00\x01\x00\x00/.test(s)?e(s):e(zg(s)),o.metadata=t.API.TTFFont.open(s),o.metadata.Unicode=o.metadata.Unicode||{encoding:{},kerning:{},widths:[]},o.metadata.glyIdsUsed=[0]})(i,n)}}])})(cr),cr.API.addSvgAsImage=function(t,e,r,n,i,a,o,s){if(isNaN(e)||isNaN(r))throw ai.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(n)||isNaN(i))throw ai.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var l=document.createElement("canvas");l.width=n,l.height=i;var c=l.getContext("2d");c.fillStyle="#fff",c.fillRect(0,0,l.width,l.height);var f={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},h=this;return(Ar.canvg?Promise.resolve(Ar.canvg):Eg(()=>import("./index.es-DscaabWm.js"),[],import.meta.url)).catch(function(d){return Promise.reject(new Error("Could not load canvg: "+d))}).then(function(d){return d.default?d.default:d}).then(function(d){return d.fromString(c,t,f)},function(){return Promise.reject(new Error("Could not load canvg."))}).then(function(d){return d.render(f)}).then(function(){h.addImage(l.toDataURL("image/jpeg",1),e,r,n,i,o,s)})},cr.API.putTotalPages=function(t){var e,r=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(e=new RegExp(t,"g"),r=this.internal.getNumberOfPages()):(e=new RegExp(this.pdfEscape16(t,this.internal.getFont()),"g"),r=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var n=1;n<=this.internal.getNumberOfPages();n++)for(var i=0;i<this.internal.pages[n].length;i++)this.internal.pages[n][i]=this.internal.pages[n][i].replace(e,r);return this},cr.API.viewerPreferences=function(t,e){var r;t=t||{},e=e||!1;var n,i,a,o={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},s=Object.keys(o),l=[],c=0,f=0,h=0;function d(v,b){var x,w=!1;for(x=0;x<v.length;x+=1)v[x]===b&&(w=!0);return w}if(this.internal.viewerpreferences===void 0&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(o)),this.internal.viewerpreferences.isSubscribed=!1),r=this.internal.viewerpreferences.configuration,t==="reset"||e===!0){var p=s.length;for(h=0;h<p;h+=1)r[s[h]].value=r[s[h]].defaultValue,r[s[h]].explicitSet=!1}if(Hn(t)==="object"){for(i in t)if(a=t[i],d(s,i)&&a!==void 0){if(r[i].type==="boolean"&&typeof a=="boolean")r[i].value=a;else if(r[i].type==="name"&&d(r[i].valueSet,a))r[i].value=a;else if(r[i].type==="integer"&&Number.isInteger(a))r[i].value=a;else if(r[i].type==="array"){for(c=0;c<a.length;c+=1)if(n=!0,a[c].length===1&&typeof a[c][0]=="number")l.push(String(a[c]-1));else if(a[c].length>1){for(f=0;f<a[c].length;f+=1)typeof a[c][f]!="number"&&(n=!1);n===!0&&l.push([a[c][0]-1,a[c][1]-1].join(" "))}r[i].value="["+l.join(" ")+"]"}else r[i].value=r[i].defaultValue;r[i].explicitSet=!0}}return this.internal.viewerpreferences.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){var v,b=[];for(v in r)r[v].explicitSet===!0&&(r[v].type==="name"?b.push("/"+v+" /"+r[v].value):b.push("/"+v+" "+r[v].value));b.length!==0&&this.internal.write(`/ViewerPreferences
493
493
  <<
494
494
  `+b.join(`
495
495
  `)+`
@@ -518,4 +518,4 @@ endbfchar
518
518
  CMapName currentdict /CMap defineresource pop
519
519
  end
520
520
  end`};e.events.push(["putFont",function(a){(function(o){var s=o.font,l=o.out,c=o.newObject,f=o.putStream;if(s.metadata instanceof t.API.TTFFont&&s.encoding==="Identity-H"){for(var h=s.metadata.Unicode.widths,d=s.metadata.subset.encode(s.metadata.glyIdsUsed,1),p="",v=0;v<d.length;v++)p+=String.fromCharCode(d[v]);var b=c();f({data:p,addLength1:!0,objectId:b}),l("endobj");var x=c();f({data:n(s.metadata.toUnicode),addLength1:!0,objectId:x}),l("endobj");var w=c();l("<<"),l("/Type /FontDescriptor"),l("/FontName /"+op(s.fontName)),l("/FontFile2 "+b+" 0 R"),l("/FontBBox "+t.API.PDFObject.convert(s.metadata.bbox)),l("/Flags "+s.metadata.flags),l("/StemV "+s.metadata.stemV),l("/ItalicAngle "+s.metadata.italicAngle),l("/Ascent "+s.metadata.ascender),l("/Descent "+s.metadata.decender),l("/CapHeight "+s.metadata.capHeight),l(">>"),l("endobj");var S=c();l("<<"),l("/Type /Font"),l("/BaseFont /"+op(s.fontName)),l("/FontDescriptor "+w+" 0 R"),l("/W "+t.API.PDFObject.convert(h)),l("/CIDToGIDMap /Identity"),l("/DW 1000"),l("/Subtype /CIDFontType2"),l("/CIDSystemInfo"),l("<<"),l("/Supplement 0"),l("/Registry (Adobe)"),l("/Ordering ("+s.encoding+")"),l(">>"),l(">>"),l("endobj"),s.objectNumber=c(),l("<<"),l("/Type /Font"),l("/Subtype /Type0"),l("/ToUnicode "+x+" 0 R"),l("/BaseFont /"+op(s.fontName)),l("/Encoding /"+s.encoding),l("/DescendantFonts ["+S+" 0 R]"),l(">>"),l("endobj"),s.isAlreadyPutted=!0}})(a)}]),e.events.push(["putFont",function(a){(function(o){var s=o.font,l=o.out,c=o.newObject,f=o.putStream;if(s.metadata instanceof t.API.TTFFont&&s.encoding==="WinAnsiEncoding"){for(var h=s.metadata.rawData,d="",p=0;p<h.length;p++)d+=String.fromCharCode(h[p]);var v=c();f({data:d,addLength1:!0,objectId:v}),l("endobj");var b=c();f({data:n(s.metadata.toUnicode),addLength1:!0,objectId:b}),l("endobj");var x=c();l("<<"),l("/Descent "+s.metadata.decender),l("/CapHeight "+s.metadata.capHeight),l("/StemV "+s.metadata.stemV),l("/Type /FontDescriptor"),l("/FontFile2 "+v+" 0 R"),l("/Flags 96"),l("/FontBBox "+t.API.PDFObject.convert(s.metadata.bbox)),l("/FontName /"+op(s.fontName)),l("/ItalicAngle "+s.metadata.italicAngle),l("/Ascent "+s.metadata.ascender),l(">>"),l("endobj"),s.objectNumber=c();for(var w=0;w<s.metadata.hmtx.widths.length;w++)s.metadata.hmtx.widths[w]=parseInt(s.metadata.hmtx.widths[w]*(1e3/s.metadata.head.unitsPerEm));l("<</Subtype/TrueType/Type/Font/ToUnicode "+b+" 0 R/BaseFont/"+op(s.fontName)+"/FontDescriptor "+x+" 0 R/Encoding/"+s.encoding+" /FirstChar 29 /LastChar 255 /Widths "+t.API.PDFObject.convert(s.metadata.hmtx.widths)+">>"),l("endobj"),s.isAlreadyPutted=!0}})(a)}]);var i=function(a){var o,s=a.text||"",l=a.x,c=a.y,f=a.options||{},h=a.mutex||{},d=h.pdfEscape,p=h.activeFontKey,v=h.fonts,b=p,x="",w=0,S="",P=v[b].encoding;if(v[b].encoding!=="Identity-H")return{text:s,x:l,y:c,options:f,mutex:h};for(S=s,b=p,Array.isArray(s)&&(S=s[0]),w=0;w<S.length;w+=1)v[b].metadata.hasOwnProperty("cmap")&&(o=v[b].metadata.cmap.unicode.codeMap[S[w].charCodeAt(0)]),o||S[w].charCodeAt(0)<256&&v[b].metadata.hasOwnProperty("Unicode")?x+=S[w]:x+="";var _="";return parseInt(b.slice(1))<14||P==="WinAnsiEncoding"?_=d(x,b).split("").map(function(E){return E.charCodeAt(0).toString(16)}).join(""):P==="Identity-H"&&(_=r(x,v[b])),h.isHex=!0,{text:_,x:l,y:c,options:f,mutex:h}};e.events.push(["postProcessText",function(a){var o=a.text||"",s=[],l={text:o,x:a.x,y:a.y,options:a.options,mutex:a.mutex};if(Array.isArray(o)){var c=0;for(c=0;c<o.length;c+=1)Array.isArray(o[c])&&o[c].length===3?s.push([i(Object.assign({},l,{text:o[c][0]})).text,o[c][1],o[c][2]]):s.push(i(Object.assign({},l,{text:o[c]})).text);a.text=s}else a.text=i(Object.assign({},l,{text:o})).text}])})(cr),(function(t){var e=function(){return this.internal.vFS===void 0&&(this.internal.vFS={}),!0};t.existsFileInVFS=function(r){return e.call(this),this.internal.vFS[r]!==void 0},t.addFileToVFS=function(r,n){return e.call(this),this.internal.vFS[r]=n,this},t.getFileFromVFS=function(r){return e.call(this),this.internal.vFS[r]!==void 0?this.internal.vFS[r]:null}})(cr.API),(function(t){t.__bidiEngine__=t.prototype.__bidiEngine__=function(n){var i,a,o,s,l,c,f,h=e,d=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],p=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],v={L:0,R:1,EN:2,AN:3,N:4,B:5,S:6},b={0:0,5:1,6:2,7:3,32:4,251:5,254:6,255:7},x=["(",")","(","<",">","<","[","]","[","{","}","{","«","»","«","‹","›","‹","⁅","⁆","⁅","⁽","⁾","⁽","₍","₎","₍","≤","≥","≤","〈","〉","〈","﹙","﹚","﹙","﹛","﹜","﹛","﹝","﹞","﹝","﹤","﹥","﹤"],w=new RegExp(/^([1-4|9]|1[0-9]|2[0-9]|3[0168]|4[04589]|5[012]|7[78]|159|16[0-9]|17[0-2]|21[569]|22[03489]|250)$/),S=!1,P=0;this.__bidiEngine__={};var _=function(T){var R=T.charCodeAt(),H=R>>8,z=b[H];return z!==void 0?h[256*z+(255&R)]:H===252||H===253?"AL":w.test(H)?"L":H===8?"R":"N"},E=function(T){for(var R,H=0;H<T.length;H++){if((R=_(T.charAt(H)))==="L")return!1;if(R==="R")return!0}return!1},I=function(T,R,H,z){var Q,oe,ee,X,ne=R[z];switch(ne){case"L":case"R":case"LRE":case"RLE":case"LRO":case"RLO":case"PDF":S=!1;break;case"N":case"AN":break;case"EN":S&&(ne="AN");break;case"AL":S=!0,ne="R";break;case"WS":case"BN":ne="N";break;case"CS":z<1||z+1>=R.length||(Q=H[z-1])!=="EN"&&Q!=="AN"||(oe=R[z+1])!=="EN"&&oe!=="AN"?ne="N":S&&(oe="AN"),ne=oe===Q?oe:"N";break;case"ES":ne=(Q=z>0?H[z-1]:"B")==="EN"&&z+1<R.length&&R[z+1]==="EN"?"EN":"N";break;case"ET":if(z>0&&H[z-1]==="EN"){ne="EN";break}if(S){ne="N";break}for(ee=z+1,X=R.length;ee<X&&R[ee]==="ET";)ee++;ne=ee<X&&R[ee]==="EN"?"EN":"N";break;case"NSM":if(o&&!s){for(X=R.length,ee=z+1;ee<X&&R[ee]==="NSM";)ee++;if(ee<X){var G=T[z],j=G>=1425&&G<=2303||G===64286;if(Q=R[ee],j&&(Q==="R"||Q==="AL")){ne="R";break}}}ne=z<1||(Q=R[z-1])==="B"?"N":H[z-1];break;case"B":S=!1,i=!0,ne=P;break;case"S":a=!0,ne="N"}return ne},C=function(T,R,H){var z=T.split("");return H&&O(z,H,{hiLevel:P}),z.reverse(),R&&R.reverse(),z.join("")},O=function(T,R,H){var z,Q,oe,ee,X,ne=-1,G=T.length,j=0,B=[],U=P?p:d,Y=[];for(S=!1,i=!1,a=!1,Q=0;Q<G;Q++)Y[Q]=_(T[Q]);for(oe=0;oe<G;oe++){if(X=j,B[oe]=I(T,Y,B,oe),z=240&(j=U[X][v[B[oe]]]),j&=15,R[oe]=ee=U[j][5],z>0)if(z===16){for(Q=ne;Q<oe;Q++)R[Q]=1;ne=-1}else ne=-1;if(U[j][6])ne===-1&&(ne=oe);else if(ne>-1){for(Q=ne;Q<oe;Q++)R[Q]=ee;ne=-1}Y[oe]==="B"&&(R[oe]=0),H.hiLevel|=ee}a&&(function(J,Z,ie){for(var he=0;he<ie;he++)if(J[he]==="S"){Z[he]=P;for(var ue=he-1;ue>=0&&J[ue]==="WS";ue--)Z[ue]=P}})(Y,R,G)},M=function(T,R,H,z,Q){if(!(Q.hiLevel<T)){if(T===1&&P===1&&!i)return R.reverse(),void(H&&H.reverse());for(var oe,ee,X,ne,G=R.length,j=0;j<G;){if(z[j]>=T){for(X=j+1;X<G&&z[X]>=T;)X++;for(ne=j,ee=X-1;ne<ee;ne++,ee--)oe=R[ne],R[ne]=R[ee],R[ee]=oe,H&&(oe=H[ne],H[ne]=H[ee],H[ee]=oe);j=X}j++}}},F=function(T,R,H){var z=T.split(""),Q={hiLevel:P};return H||(H=[]),O(z,H,Q),(function(oe,ee,X){if(X.hiLevel!==0&&f)for(var ne,G=0;G<oe.length;G++)ee[G]===1&&(ne=x.indexOf(oe[G]))>=0&&(oe[G]=x[ne+1])})(z,H,Q),M(2,z,R,H,Q),M(1,z,R,H,Q),z.join("")};return this.__bidiEngine__.doBidiReorder=function(T,R,H){if((function(Q,oe){if(oe)for(var ee=0;ee<Q.length;ee++)oe[ee]=ee;s===void 0&&(s=E(Q)),c===void 0&&(c=E(Q))})(T,R),o||!l||c)if(o&&l&&s^c)P=s?1:0,T=C(T,R,H);else if(!o&&l&&c)P=s?1:0,T=F(T,R,H),T=C(T,R);else if(!o||s||l||c){if(o&&!l&&s^c)T=C(T,R),s?(P=0,T=F(T,R,H)):(P=1,T=F(T,R,H),T=C(T,R));else if(o&&s&&!l&&c)P=1,T=F(T,R,H),T=C(T,R);else if(!o&&!l&&s^c){var z=f;s?(P=1,T=F(T,R,H),P=0,f=!1,T=F(T,R,H),f=z):(P=0,T=F(T,R,H),T=C(T,R),P=1,f=!1,T=F(T,R,H),f=z,T=C(T,R))}}else P=0,T=F(T,R,H);else P=s?1:0,T=F(T,R,H);return T},this.__bidiEngine__.setOptions=function(T){T&&(o=T.isInputVisual,l=T.isOutputVisual,s=T.isInputRtl,c=T.isOutputRtl,f=T.isSymmetricSwapping)},this.__bidiEngine__.setOptions(n),this.__bidiEngine__};var e=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","N","ET","ET","ET","ET","N","N","N","N","L","N","N","BN","N","N","ET","ET","EN","EN","N","L","N","N","N","EN","L","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","N","N","N","N","N","ET","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","NSM","R","NSM","NSM","R","NSM","NSM","R","NSM","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","N","N","N","N","N","R","R","R","R","R","N","N","N","N","N","N","N","N","N","N","N","AN","AN","AN","AN","AN","AN","N","N","AL","ET","ET","AL","CS","AL","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","N","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","NSM","NSM","N","NSM","NSM","NSM","NSM","AL","AL","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","R","N","N","N","N","R","N","N","N","N","N","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","BN","BN","BN","L","R","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","B","LRE","RLE","PDF","LRO","RLO","CS","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","BN","BN","BN","BN","BN","N","LRI","RLI","FSI","PDI","BN","BN","BN","BN","BN","BN","EN","L","N","N","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","L","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","N","N","N","N","N","R","NSM","R","R","R","R","R","R","R","R","R","R","ES","R","R","R","R","R","R","R","R","R","R","R","R","R","N","R","R","R","R","R","N","R","N","R","R","N","R","R","N","R","R","R","R","R","R","R","R","R","R","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","CS","N","N","CS","N","N","N","N","N","N","N","N","N","ET","N","N","ES","ES","N","N","N","N","N","ET","ET","N","N","N","N","N","AL","AL","AL","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","BN","N","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","N","N","N","ET","ET","N","N","N","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N"],r=new t.__bidiEngine__({isInputVisual:!0});t.API.events.push(["postProcessText",function(n){var i=n.text;n.x,n.y;var a=n.options||{};n.mutex,a.lang;var o=[];if(a.isInputVisual=typeof a.isInputVisual!="boolean"||a.isInputVisual,r.setOptions(a),Object.prototype.toString.call(i)==="[object Array]"){var s=0;for(o=[],s=0;s<i.length;s+=1)Object.prototype.toString.call(i[s])==="[object Array]"?o.push([r.doBidiReorder(i[s][0]),i[s][1],i[s][2]]):o.push([r.doBidiReorder(i[s])]);n.text=o}else n.text=r.doBidiReorder(i);r.setOptions({isInputVisual:!0})}])})(cr),cr.API.TTFFont=(function(){function t(e){var r;if(this.rawData=e,r=this.contents=new ph(e),this.contents.pos=4,r.readString(4)==="ttcf")throw new Error("TTCF not supported.");r.pos=0,this.parse(),this.subset=new Nq(this),this.registerTTF()}return t.open=function(e){return new t(e)},t.prototype.parse=function(){return this.directory=new yq(this.contents),this.head=new wq(this),this.name=new Pq(this),this.cmap=new hP(this),this.toUnicode={},this.hhea=new xq(this),this.maxp=new Eq(this),this.hmtx=new Cq(this),this.post=new _q(this),this.os2=new Sq(this),this.loca=new Iq(this),this.glyf=new Aq(this),this.ascender=this.os2.exists&&this.os2.ascender||this.hhea.ascender,this.decender=this.os2.exists&&this.os2.decender||this.hhea.decender,this.lineGap=this.os2.exists&&this.os2.lineGap||this.hhea.lineGap,this.bbox=[this.head.xMin,this.head.yMin,this.head.xMax,this.head.yMax]},t.prototype.registerTTF=function(){var e,r,n,i,a;if(this.scaleFactor=1e3/this.head.unitsPerEm,this.bbox=(function(){var o,s,l,c;for(c=[],o=0,s=(l=this.bbox).length;o<s;o++)e=l[o],c.push(Math.round(e*this.scaleFactor));return c}).call(this),this.stemV=0,this.post.exists?(n=255&(i=this.post.italic_angle),32768&(r=i>>16)&&(r=-(1+(65535^r))),this.italicAngle=+(r+"."+n)):this.italicAngle=0,this.ascender=Math.round(this.ascender*this.scaleFactor),this.decender=Math.round(this.decender*this.scaleFactor),this.lineGap=Math.round(this.lineGap*this.scaleFactor),this.capHeight=this.os2.exists&&this.os2.capHeight||this.ascender,this.xHeight=this.os2.exists&&this.os2.xHeight||0,this.familyClass=(this.os2.exists&&this.os2.familyClass||0)>>8,this.isSerif=(a=this.familyClass)===1||a===2||a===3||a===4||a===5||a===7,this.isScript=this.familyClass===10,this.flags=0,this.post.isFixedPitch&&(this.flags|=1),this.isSerif&&(this.flags|=2),this.isScript&&(this.flags|=8),this.italicAngle!==0&&(this.flags|=64),this.flags|=32,!this.cmap.unicode)throw new Error("No unicode cmap for font")},t.prototype.characterToGlyph=function(e){var r;return((r=this.cmap.unicode)!=null?r.codeMap[e]:void 0)||0},t.prototype.widthOfGlyph=function(e){var r;return r=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(e).advance*r},t.prototype.widthOfString=function(e,r,n){var i,a,o,s;for(o=0,a=0,s=(e=""+e).length;0<=s?a<s:a>s;a=0<=s?++a:--a)i=e.charCodeAt(a),o+=this.widthOfGlyph(this.characterToGlyph(i))+n*(1e3/r)||0;return o*(r/1e3)},t.prototype.lineHeight=function(e,r){var n;return r==null&&(r=!1),n=r?this.lineGap:0,(this.ascender+n-this.decender)/1e3*e},t})();var Mu,ph=(function(){function t(e){this.data=e??[],this.pos=0,this.length=this.data.length}return t.prototype.readByte=function(){return this.data[this.pos++]},t.prototype.writeByte=function(e){return this.data[this.pos++]=e},t.prototype.readUInt32=function(){return 16777216*this.readByte()+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()},t.prototype.writeUInt32=function(e){return this.writeByte(e>>>24&255),this.writeByte(e>>16&255),this.writeByte(e>>8&255),this.writeByte(255&e)},t.prototype.readInt32=function(){var e;return(e=this.readUInt32())>=2147483648?e-4294967296:e},t.prototype.writeInt32=function(e){return e<0&&(e+=4294967296),this.writeUInt32(e)},t.prototype.readUInt16=function(){return this.readByte()<<8|this.readByte()},t.prototype.writeUInt16=function(e){return this.writeByte(e>>8&255),this.writeByte(255&e)},t.prototype.readInt16=function(){var e;return(e=this.readUInt16())>=32768?e-65536:e},t.prototype.writeInt16=function(e){return e<0&&(e+=65536),this.writeUInt16(e)},t.prototype.readString=function(e){var r,n;for(n=[],r=0;0<=e?r<e:r>e;r=0<=e?++r:--r)n[r]=String.fromCharCode(this.readByte());return n.join("")},t.prototype.writeString=function(e){var r,n,i;for(i=[],r=0,n=e.length;0<=n?r<n:r>n;r=0<=n?++r:--r)i.push(this.writeByte(e.charCodeAt(r)));return i},t.prototype.readShort=function(){return this.readInt16()},t.prototype.writeShort=function(e){return this.writeInt16(e)},t.prototype.readLongLong=function(){var e,r,n,i,a,o,s,l;return e=this.readByte(),r=this.readByte(),n=this.readByte(),i=this.readByte(),a=this.readByte(),o=this.readByte(),s=this.readByte(),l=this.readByte(),128&e?-1*(72057594037927940*(255^e)+281474976710656*(255^r)+1099511627776*(255^n)+4294967296*(255^i)+16777216*(255^a)+65536*(255^o)+256*(255^s)+(255^l)+1):72057594037927940*e+281474976710656*r+1099511627776*n+4294967296*i+16777216*a+65536*o+256*s+l},t.prototype.writeLongLong=function(e){var r,n;return r=Math.floor(e/4294967296),n=4294967295&e,this.writeByte(r>>24&255),this.writeByte(r>>16&255),this.writeByte(r>>8&255),this.writeByte(255&r),this.writeByte(n>>24&255),this.writeByte(n>>16&255),this.writeByte(n>>8&255),this.writeByte(255&n)},t.prototype.readInt=function(){return this.readInt32()},t.prototype.writeInt=function(e){return this.writeInt32(e)},t.prototype.read=function(e){var r,n;for(r=[],n=0;0<=e?n<e:n>e;n=0<=e?++n:--n)r.push(this.readByte());return r},t.prototype.write=function(e){var r,n,i,a;for(a=[],n=0,i=e.length;n<i;n++)r=e[n],a.push(this.writeByte(r));return a},t})(),yq=(function(){var t;function e(r){var n,i,a;for(this.scalarType=r.readInt(),this.tableCount=r.readShort(),this.searchRange=r.readShort(),this.entrySelector=r.readShort(),this.rangeShift=r.readShort(),this.tables={},i=0,a=this.tableCount;0<=a?i<a:i>a;i=0<=a?++i:--i)n={tag:r.readString(4),checksum:r.readInt(),offset:r.readInt(),length:r.readInt()},this.tables[n.tag]=n}return e.prototype.encode=function(r){var n,i,a,o,s,l,c,f,h,d,p,v,b;for(b in p=Object.keys(r).length,l=Math.log(2),h=16*Math.floor(Math.log(p)/l),o=Math.floor(h/l),f=16*p-h,(i=new ph).writeInt(this.scalarType),i.writeShort(p),i.writeShort(h),i.writeShort(o),i.writeShort(f),a=16*p,c=i.pos+a,s=null,v=[],r)for(d=r[b],i.writeString(b),i.writeInt(t(d)),i.writeInt(c),i.writeInt(d.length),v=v.concat(d),b==="head"&&(s=c),c+=d.length;c%4;)v.push(0),c++;return i.write(v),n=2981146554-t(i.data),i.pos=s+8,i.writeUInt32(n),i.data},t=function(r){var n,i,a,o;for(r=dP.call(r);r.length%4;)r.push(0);for(a=new ph(r),i=0,n=0,o=r.length;n<o;n=n+=4)i+=a.readUInt32();return 4294967295&i},e})(),bq={}.hasOwnProperty,Sc=function(t,e){for(var r in e)bq.call(e,r)&&(t[r]=e[r]);function n(){this.constructor=t}return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};Mu=(function(){function t(e){var r;this.file=e,r=this.file.directory.tables[this.tag],this.exists=!!r,r&&(this.offset=r.offset,this.length=r.length,this.parse(this.file.contents))}return t.prototype.parse=function(){},t.prototype.encode=function(){},t.prototype.raw=function(){return this.exists?(this.file.contents.pos=this.offset,this.file.contents.read(this.length)):null},t})();var wq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Sc(t,Mu),t.prototype.tag="head",t.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.revision=e.readInt(),this.checkSumAdjustment=e.readInt(),this.magicNumber=e.readInt(),this.flags=e.readShort(),this.unitsPerEm=e.readShort(),this.created=e.readLongLong(),this.modified=e.readLongLong(),this.xMin=e.readShort(),this.yMin=e.readShort(),this.xMax=e.readShort(),this.yMax=e.readShort(),this.macStyle=e.readShort(),this.lowestRecPPEM=e.readShort(),this.fontDirectionHint=e.readShort(),this.indexToLocFormat=e.readShort(),this.glyphDataFormat=e.readShort()},t.prototype.encode=function(e){var r;return(r=new ph).writeInt(this.version),r.writeInt(this.revision),r.writeInt(this.checkSumAdjustment),r.writeInt(this.magicNumber),r.writeShort(this.flags),r.writeShort(this.unitsPerEm),r.writeLongLong(this.created),r.writeLongLong(this.modified),r.writeShort(this.xMin),r.writeShort(this.yMin),r.writeShort(this.xMax),r.writeShort(this.yMax),r.writeShort(this.macStyle),r.writeShort(this.lowestRecPPEM),r.writeShort(this.fontDirectionHint),r.writeShort(e),r.writeShort(this.glyphDataFormat),r.data},t})(),eS=(function(){function t(e,r){var n,i,a,o,s,l,c,f,h,d,p,v,b,x,w,S,P;switch(this.platformID=e.readUInt16(),this.encodingID=e.readShort(),this.offset=r+e.readInt(),h=e.pos,e.pos=this.offset,this.format=e.readUInt16(),this.length=e.readUInt16(),this.language=e.readUInt16(),this.isUnicode=this.platformID===3&&this.encodingID===1&&this.format===4||this.platformID===0&&this.format===4,this.codeMap={},this.format){case 0:for(l=0;l<256;++l)this.codeMap[l]=e.readByte();break;case 4:for(p=e.readUInt16(),d=p/2,e.pos+=6,a=(function(){var _,E;for(E=[],l=_=0;0<=d?_<d:_>d;l=0<=d?++_:--_)E.push(e.readUInt16());return E})(),e.pos+=2,b=(function(){var _,E;for(E=[],l=_=0;0<=d?_<d:_>d;l=0<=d?++_:--_)E.push(e.readUInt16());return E})(),c=(function(){var _,E;for(E=[],l=_=0;0<=d?_<d:_>d;l=0<=d?++_:--_)E.push(e.readUInt16());return E})(),f=(function(){var _,E;for(E=[],l=_=0;0<=d?_<d:_>d;l=0<=d?++_:--_)E.push(e.readUInt16());return E})(),i=(this.length-e.pos+this.offset)/2,s=(function(){var _,E;for(E=[],l=_=0;0<=i?_<i:_>i;l=0<=i?++_:--_)E.push(e.readUInt16());return E})(),l=w=0,P=a.length;w<P;l=++w)for(x=a[l],n=S=v=b[l];v<=x?S<=x:S>=x;n=v<=x?++S:--S)f[l]===0?o=n+c[l]:(o=s[f[l]/2+(n-v)-(d-l)]||0)!==0&&(o+=c[l]),this.codeMap[n]=65535&o}e.pos=h}return t.encode=function(e,r){var n,i,a,o,s,l,c,f,h,d,p,v,b,x,w,S,P,_,E,I,C,O,M,F,T,R,H,z,Q,oe,ee,X,ne,G,j,B,U,Y,J,Z,ie,he,ue,we,Te,qe;switch(z=new ph,o=Object.keys(e).sort(function(ze,rt){return ze-rt}),r){case"macroman":for(b=0,x=(function(){var ze=[];for(v=0;v<256;++v)ze.push(0);return ze})(),S={0:0},a={},Q=0,ne=o.length;Q<ne;Q++)S[ue=e[i=o[Q]]]==null&&(S[ue]=++b),a[i]={old:e[i],new:S[e[i]]},x[i]=S[e[i]];return z.writeUInt16(1),z.writeUInt16(0),z.writeUInt32(12),z.writeUInt16(0),z.writeUInt16(262),z.writeUInt16(0),z.write(x),{charMap:a,subtable:z.data,maxGlyphID:b+1};case"unicode":for(R=[],h=[],P=0,S={},n={},w=c=null,oe=0,G=o.length;oe<G;oe++)S[E=e[i=o[oe]]]==null&&(S[E]=++P),n[i]={old:E,new:S[E]},s=S[E]-i,w!=null&&s===c||(w&&h.push(w),R.push(i),c=s),w=i;for(w&&h.push(w),h.push(65535),R.push(65535),F=2*(M=R.length),O=2*Math.pow(Math.log(M)/Math.LN2,2),d=Math.log(O/2)/Math.LN2,C=2*M-O,l=[],I=[],p=[],v=ee=0,j=R.length;ee<j;v=++ee){if(T=R[v],f=h[v],T===65535){l.push(0),I.push(0);break}if(T-(H=n[T].new)>=32768)for(l.push(0),I.push(2*(p.length+M-v)),i=X=T;T<=f?X<=f:X>=f;i=T<=f?++X:--X)p.push(n[i].new);else l.push(H-T),I.push(0)}for(z.writeUInt16(3),z.writeUInt16(1),z.writeUInt32(12),z.writeUInt16(4),z.writeUInt16(16+8*M+2*p.length),z.writeUInt16(0),z.writeUInt16(F),z.writeUInt16(O),z.writeUInt16(d),z.writeUInt16(C),ie=0,B=h.length;ie<B;ie++)i=h[ie],z.writeUInt16(i);for(z.writeUInt16(0),he=0,U=R.length;he<U;he++)i=R[he],z.writeUInt16(i);for(we=0,Y=l.length;we<Y;we++)s=l[we],z.writeUInt16(s);for(Te=0,J=I.length;Te<J;Te++)_=I[Te],z.writeUInt16(_);for(qe=0,Z=p.length;qe<Z;qe++)b=p[qe],z.writeUInt16(b);return{charMap:n,subtable:z.data,maxGlyphID:P+1}}},t})(),hP=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Sc(t,Mu),t.prototype.tag="cmap",t.prototype.parse=function(e){var r,n,i;for(e.pos=this.offset,this.version=e.readUInt16(),i=e.readUInt16(),this.tables=[],this.unicode=null,n=0;0<=i?n<i:n>i;n=0<=i?++n:--n)r=new eS(e,this.offset),this.tables.push(r),r.isUnicode&&this.unicode==null&&(this.unicode=r);return!0},t.encode=function(e,r){var n,i;return r==null&&(r="macroman"),n=eS.encode(e,r),(i=new ph).writeUInt16(0),i.writeUInt16(1),n.table=i.data.concat(n.subtable),n},t})(),xq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Sc(t,Mu),t.prototype.tag="hhea",t.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.ascender=e.readShort(),this.decender=e.readShort(),this.lineGap=e.readShort(),this.advanceWidthMax=e.readShort(),this.minLeftSideBearing=e.readShort(),this.minRightSideBearing=e.readShort(),this.xMaxExtent=e.readShort(),this.caretSlopeRise=e.readShort(),this.caretSlopeRun=e.readShort(),this.caretOffset=e.readShort(),e.pos+=8,this.metricDataFormat=e.readShort(),this.numberOfMetrics=e.readUInt16()},t})(),Sq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Sc(t,Mu),t.prototype.tag="OS/2",t.prototype.parse=function(e){if(e.pos=this.offset,this.version=e.readUInt16(),this.averageCharWidth=e.readShort(),this.weightClass=e.readUInt16(),this.widthClass=e.readUInt16(),this.type=e.readShort(),this.ySubscriptXSize=e.readShort(),this.ySubscriptYSize=e.readShort(),this.ySubscriptXOffset=e.readShort(),this.ySubscriptYOffset=e.readShort(),this.ySuperscriptXSize=e.readShort(),this.ySuperscriptYSize=e.readShort(),this.ySuperscriptXOffset=e.readShort(),this.ySuperscriptYOffset=e.readShort(),this.yStrikeoutSize=e.readShort(),this.yStrikeoutPosition=e.readShort(),this.familyClass=e.readShort(),this.panose=(function(){var r,n;for(n=[],r=0;r<10;++r)n.push(e.readByte());return n})(),this.charRange=(function(){var r,n;for(n=[],r=0;r<4;++r)n.push(e.readInt());return n})(),this.vendorID=e.readString(4),this.selection=e.readShort(),this.firstCharIndex=e.readShort(),this.lastCharIndex=e.readShort(),this.version>0&&(this.ascent=e.readShort(),this.descent=e.readShort(),this.lineGap=e.readShort(),this.winAscent=e.readShort(),this.winDescent=e.readShort(),this.codePageRange=(function(){var r,n;for(n=[],r=0;r<2;r=++r)n.push(e.readInt());return n})(),this.version>1))return this.xHeight=e.readShort(),this.capHeight=e.readShort(),this.defaultChar=e.readShort(),this.breakChar=e.readShort(),this.maxContext=e.readShort()},t})(),_q=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Sc(t,Mu),t.prototype.tag="post",t.prototype.parse=function(e){var r,n,i;switch(e.pos=this.offset,this.format=e.readInt(),this.italicAngle=e.readInt(),this.underlinePosition=e.readShort(),this.underlineThickness=e.readShort(),this.isFixedPitch=e.readInt(),this.minMemType42=e.readInt(),this.maxMemType42=e.readInt(),this.minMemType1=e.readInt(),this.maxMemType1=e.readInt(),this.format){case 65536:case 196608:break;case 131072:var a;for(n=e.readUInt16(),this.glyphNameIndex=[],a=0;0<=n?a<n:a>n;a=0<=n?++a:--a)this.glyphNameIndex.push(e.readUInt16());for(this.names=[],i=[];e.pos<this.offset+this.length;)r=e.readByte(),i.push(this.names.push(e.readString(r)));return i;case 151552:return n=e.readUInt16(),this.offsets=e.read(n);case 262144:return this.map=(function(){var o,s,l;for(l=[],a=o=0,s=this.file.maxp.numGlyphs;0<=s?o<s:o>s;a=0<=s?++o:--o)l.push(e.readUInt32());return l}).call(this)}},t})(),kq=function(t,e){this.raw=t,this.length=t.length,this.platformID=e.platformID,this.encodingID=e.encodingID,this.languageID=e.languageID},Pq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Sc(t,Mu),t.prototype.tag="name",t.prototype.parse=function(e){var r,n,i,a,o,s,l,c,f,h,d;for(e.pos=this.offset,e.readShort(),r=e.readShort(),s=e.readShort(),n=[],a=0;0<=r?a<r:a>r;a=0<=r?++a:--a)n.push({platformID:e.readShort(),encodingID:e.readShort(),languageID:e.readShort(),nameID:e.readShort(),length:e.readShort(),offset:this.offset+s+e.readShort()});for(l={},a=f=0,h=n.length;f<h;a=++f)i=n[a],e.pos=i.offset,c=e.readString(i.length),o=new kq(c,i),l[d=i.nameID]==null&&(l[d]=[]),l[i.nameID].push(o);this.strings=l,this.copyright=l[0],this.fontFamily=l[1],this.fontSubfamily=l[2],this.uniqueSubfamily=l[3],this.fontName=l[4],this.version=l[5];try{this.postscriptName=l[6][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}catch{this.postscriptName=l[4][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}return this.trademark=l[7],this.manufacturer=l[8],this.designer=l[9],this.description=l[10],this.vendorUrl=l[11],this.designerUrl=l[12],this.license=l[13],this.licenseUrl=l[14],this.preferredFamily=l[15],this.preferredSubfamily=l[17],this.compatibleFull=l[18],this.sampleText=l[19]},t})(),Eq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Sc(t,Mu),t.prototype.tag="maxp",t.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.numGlyphs=e.readUInt16(),this.maxPoints=e.readUInt16(),this.maxContours=e.readUInt16(),this.maxCompositePoints=e.readUInt16(),this.maxComponentContours=e.readUInt16(),this.maxZones=e.readUInt16(),this.maxTwilightPoints=e.readUInt16(),this.maxStorage=e.readUInt16(),this.maxFunctionDefs=e.readUInt16(),this.maxInstructionDefs=e.readUInt16(),this.maxStackElements=e.readUInt16(),this.maxSizeOfInstructions=e.readUInt16(),this.maxComponentElements=e.readUInt16(),this.maxComponentDepth=e.readUInt16()},t})(),Cq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Sc(t,Mu),t.prototype.tag="hmtx",t.prototype.parse=function(e){var r,n,i,a,o,s,l;for(e.pos=this.offset,this.metrics=[],r=0,s=this.file.hhea.numberOfMetrics;0<=s?r<s:r>s;r=0<=s?++r:--r)this.metrics.push({advance:e.readUInt16(),lsb:e.readInt16()});for(i=this.file.maxp.numGlyphs-this.file.hhea.numberOfMetrics,this.leftSideBearings=(function(){var c,f;for(f=[],r=c=0;0<=i?c<i:c>i;r=0<=i?++c:--c)f.push(e.readInt16());return f})(),this.widths=(function(){var c,f,h,d;for(d=[],c=0,f=(h=this.metrics).length;c<f;c++)a=h[c],d.push(a.advance);return d}).call(this),n=this.widths[this.widths.length-1],l=[],r=o=0;0<=i?o<i:o>i;r=0<=i?++o:--o)l.push(this.widths.push(n));return l},t.prototype.forGlyph=function(e){return e in this.metrics?this.metrics[e]:{advance:this.metrics[this.metrics.length-1].advance,lsb:this.leftSideBearings[e-this.metrics.length]}},t})(),dP=[].slice,Aq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Sc(t,Mu),t.prototype.tag="glyf",t.prototype.parse=function(){return this.cache={}},t.prototype.glyphFor=function(e){var r,n,i,a,o,s,l,c,f,h;return e in this.cache?this.cache[e]:(a=this.file.loca,r=this.file.contents,n=a.indexOf(e),(i=a.lengthOf(e))===0?this.cache[e]=null:(r.pos=this.offset+n,o=(s=new ph(r.read(i))).readShort(),c=s.readShort(),h=s.readShort(),l=s.readShort(),f=s.readShort(),this.cache[e]=o===-1?new Oq(s,c,h,l,f):new Tq(s,o,c,h,l,f),this.cache[e]))},t.prototype.encode=function(e,r,n){var i,a,o,s,l;for(o=[],a=[],s=0,l=r.length;s<l;s++)i=e[r[s]],a.push(o.length),i&&(o=o.concat(i.encode(n)));return a.push(o.length),{table:o,offsets:a}},t})(),Tq=(function(){function t(e,r,n,i,a,o){this.raw=e,this.numberOfContours=r,this.xMin=n,this.yMin=i,this.xMax=a,this.yMax=o,this.compound=!1}return t.prototype.encode=function(){return this.raw.data},t})(),Oq=(function(){function t(e,r,n,i,a){var o,s;for(this.raw=e,this.xMin=r,this.yMin=n,this.xMax=i,this.yMax=a,this.compound=!0,this.glyphIDs=[],this.glyphOffsets=[],o=this.raw;s=o.readShort(),this.glyphOffsets.push(o.pos),this.glyphIDs.push(o.readUInt16()),32&s;)o.pos+=1&s?4:2,128&s?o.pos+=8:64&s?o.pos+=4:8&s&&(o.pos+=2)}return t.prototype.encode=function(){var e,r,n;for(r=new ph(dP.call(this.raw.data)),e=0,n=this.glyphIDs.length;e<n;++e)r.pos=this.glyphOffsets[e];return r.data},t})(),Iq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Sc(t,Mu),t.prototype.tag="loca",t.prototype.parse=function(e){var r,n;return e.pos=this.offset,r=this.file.head.indexToLocFormat,this.offsets=r===0?(function(){var i,a;for(a=[],n=0,i=this.length;n<i;n+=2)a.push(2*e.readUInt16());return a}).call(this):(function(){var i,a;for(a=[],n=0,i=this.length;n<i;n+=4)a.push(e.readUInt32());return a}).call(this)},t.prototype.indexOf=function(e){return this.offsets[e]},t.prototype.lengthOf=function(e){return this.offsets[e+1]-this.offsets[e]},t.prototype.encode=function(e,r){for(var n=new Uint32Array(this.offsets.length),i=0,a=0,o=0;o<n.length;++o)if(n[o]=i,a<r.length&&r[a]==o){++a,n[o]=i;var s=this.offsets[o],l=this.offsets[o+1]-s;l>0&&(i+=l)}for(var c=new Array(4*n.length),f=0;f<n.length;++f)c[4*f+3]=255&n[f],c[4*f+2]=(65280&n[f])>>8,c[4*f+1]=(16711680&n[f])>>16,c[4*f]=(4278190080&n[f])>>24;return c},t})(),Nq=(function(){function t(e){this.font=e,this.subset={},this.unicodes={},this.next=33}return t.prototype.generateCmap=function(){var e,r,n,i,a;for(r in i=this.font.cmap.tables[0].codeMap,e={},a=this.subset)n=a[r],e[r]=i[n];return e},t.prototype.glyphsFor=function(e){var r,n,i,a,o,s,l;for(i={},o=0,s=e.length;o<s;o++)i[a=e[o]]=this.font.glyf.glyphFor(a);for(a in r=[],i)(n=i[a])!=null&&n.compound&&r.push.apply(r,n.glyphIDs);if(r.length>0)for(a in l=this.glyphsFor(r))n=l[a],i[a]=n;return i},t.prototype.encode=function(e,r){var n,i,a,o,s,l,c,f,h,d,p,v,b,x,w;for(i in n=hP.encode(this.generateCmap(),"unicode"),o=this.glyphsFor(e),p={0:0},w=n.charMap)p[(l=w[i]).old]=l.new;for(v in d=n.maxGlyphID,o)v in p||(p[v]=d++);return f=(function(S){var P,_;for(P in _={},S)_[S[P]]=P;return _})(p),h=Object.keys(f).sort(function(S,P){return S-P}),b=(function(){var S,P,_;for(_=[],S=0,P=h.length;S<P;S++)s=h[S],_.push(f[s]);return _})(),a=this.font.glyf.encode(o,b,p),c=this.font.loca.encode(a.offsets,b),x={cmap:this.font.cmap.raw(),glyf:a.table,loca:c,hmtx:this.font.hmtx.raw(),hhea:this.font.hhea.raw(),maxp:this.font.maxp.raw(),post:this.font.post.raw(),name:this.font.name.raw(),head:this.font.head.encode(r)},this.font.os2.exists&&(x["OS/2"]=this.font.os2.raw()),this.font.directory.encode(x)},t})();cr.API.PDFObject=(function(){var t;function e(){}return t=function(r,n){return(Array(n+1).join("0")+r).slice(-n)},e.convert=function(r){var n,i,a,o;if(Array.isArray(r))return"["+(function(){var s,l,c;for(c=[],s=0,l=r.length;s<l;s++)n=r[s],c.push(e.convert(n));return c})().join(" ")+"]";if(typeof r=="string")return"/"+r;if(r?.isString)return"("+r+")";if(r instanceof Date)return"(D:"+t(r.getUTCFullYear(),4)+t(r.getUTCMonth(),2)+t(r.getUTCDate(),2)+t(r.getUTCHours(),2)+t(r.getUTCMinutes(),2)+t(r.getUTCSeconds(),2)+"Z)";if({}.toString.call(r)==="[object Object]"){for(i in a=["<<"],r)o=r[i],a.push("/"+i+" "+e.convert(o));return a.push(">>"),a.join(`
521
- `)}return""+r},e})();window.jspdf={jsPDF:cr};Tt.prototype._requestDraw=()=>{};YI(!1);Z_("change-font-size");const Lq=new URLSearchParams(location.search).get("key"),pP=KB({key:Lq});window.store=pP;let e5=null;window.loadVideoExportModule=async()=>(e5||(e5=Eg(()=>import("./index-7OP1ndqK.js"),[],import.meta.url)),await e5);window.config={addGlobalFont:tN,setRichTextEnabled:uN,setTextVerticalResizeEnabled:lN,setTextOverflow:Z_,onLoadError:eN,setAssetLoadTimeout:KI,setFontLoadTimeout:ZI,unstable_setTextSplitAllowed:fN};const Rq=rS.createRoot(document.getElementById("root"));Rq.render(se.createElement(Vj,{visiblePagesOffset:0,renderOnlyActivePage:!0,store:pP,components:{PageControls:()=>null,Tooltip:()=>null}}));export{wH as $,Wm as A,yH as B,qb as C,R5 as D,bH as E,cH as F,fH as G,oH as H,hH as I,lH as J,nh as K,ih as L,Vb as M,$M as N,l7 as O,of as P,go as Q,j0 as R,aH as S,Hb as T,ku as U,nH as V,p7 as W,uH as X,bp as Y,o7 as Z,Qq as _,$e as a,xH as a0,tH as a1,s7 as a2,rH as a3,Yq as a4,SH as a5,UF as a6,DF as a7,BF as a8,f8 as a9,$g as aa,Hn as ab,dd as ac,Dp as b,Zq as c,uh as d,cD as e,wl as f,sH as g,CD as h,Xq as i,tD as j,eH as k,Pl as l,nD as m,vH as n,Jq as o,m7 as p,pH as q,gH as r,mH as s,Kq as t,Km as u,dH as v,JM as w,E0 as x,rp as y,iH as z};
521
+ `)}return""+r},e})();window.jspdf={jsPDF:cr};Tt.prototype._requestDraw=()=>{};YI(!1);Z_("change-font-size");const Lq=new URLSearchParams(location.search).get("key"),pP=KB({key:Lq});window.store=pP;let e5=null;window.loadVideoExportModule=async()=>(e5||(e5=Eg(()=>import("./index-CISFBCmc.js"),[],import.meta.url)),await e5);window.config={addGlobalFont:tN,setRichTextEnabled:uN,setTextVerticalResizeEnabled:lN,setTextOverflow:Z_,onLoadError:eN,setAssetLoadTimeout:KI,setFontLoadTimeout:ZI,unstable_setTextSplitAllowed:fN};const Rq=rS.createRoot(document.getElementById("root"));Rq.render(se.createElement(Vj,{visiblePagesOffset:0,renderOnlyActivePage:!0,store:pP,components:{PageControls:()=>null,Tooltip:()=>null}}));export{wH as $,Wm as A,yH as B,qb as C,R5 as D,bH as E,cH as F,fH as G,oH as H,hH as I,lH as J,nh as K,ih as L,Vb as M,$M as N,l7 as O,of as P,go as Q,j0 as R,aH as S,Hb as T,ku as U,nH as V,p7 as W,uH as X,bp as Y,o7 as Z,Qq as _,$e as a,xH as a0,tH as a1,s7 as a2,rH as a3,Yq as a4,SH as a5,UF as a6,DF as a7,BF as a8,f8 as a9,$g as aa,Hn as ab,dd as ac,Dp as b,Zq as c,uh as d,cD as e,wl as f,sH as g,CD as h,Xq as i,tD as j,eH as k,Pl as l,nD as m,vH as n,Jq as o,m7 as p,pH as q,gH as r,mH as s,Kq as t,Km as u,dH as v,JM as w,E0 as x,rp as y,iH as z};
@@ -1,4 +1,4 @@
1
- import{aa as Da,ab as Va,ac as il}from"./index-Dhxj876I.js";var fn={},cn={},cr,vn;function Q(){if(vn)return cr;vn=1;var n=function(e){return e&&e.Math===Math&&e};return cr=n(typeof globalThis=="object"&&globalThis)||n(typeof window=="object"&&window)||n(typeof self=="object"&&self)||n(typeof Da=="object"&&Da)||n(typeof cr=="object"&&cr)||(function(){return this})()||Function("return this")(),cr}var Qr={},Zr,gn;function Z(){return gn||(gn=1,Zr=function(n){try{return!!n()}catch{return!0}}),Zr}var Jr,dn;function we(){if(dn)return Jr;dn=1;var n=Z();return Jr=!n(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),Jr}var et,pn;function Ar(){if(pn)return et;pn=1;var n=Z();return et=!n(function(){var e=(function(){}).bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),et}var rt,yn;function ne(){if(yn)return rt;yn=1;var n=Ar(),e=Function.prototype.call;return rt=n?e.bind(e):function(){return e.apply(e,arguments)},rt}var tt={},mn;function Yl(){if(mn)return tt;mn=1;var n={}.propertyIsEnumerable,e=Object.getOwnPropertyDescriptor,r=e&&!n.call({1:2},1);return tt.f=r?function(i){var a=e(this,i);return!!a&&a.enumerable}:n,tt}var it,bn;function Fa(){return bn||(bn=1,it=function(n,e){return{enumerable:!(n&1),configurable:!(n&2),writable:!(n&4),value:e}}),it}var at,xn;function J(){if(xn)return at;xn=1;var n=Ar(),e=Function.prototype,r=e.call,t=n&&e.bind.bind(r,r);return at=n?t:function(i){return function(){return r.apply(i,arguments)}},at}var nt,On;function er(){if(On)return nt;On=1;var n=J(),e=n({}.toString),r=n("".slice);return nt=function(t){return r(e(t),8,-1)},nt}var st,Tn;function al(){if(Tn)return st;Tn=1;var n=J(),e=Z(),r=er(),t=Object,i=n("".split);return st=e(function(){return!t("z").propertyIsEnumerable(0)})?function(a){return r(a)==="String"?i(a,""):t(a)}:t,st}var ot,Sn;function Ir(){return Sn||(Sn=1,ot=function(n){return n==null}),ot}var ut,En;function Pe(){if(En)return ut;En=1;var n=Ir(),e=TypeError;return ut=function(r){if(n(r))throw new e("Can't call method on "+r);return r},ut}var lt,Rn;function dr(){if(Rn)return lt;Rn=1;var n=al(),e=Pe();return lt=function(r){return n(e(r))},lt}var ht,Cn;function re(){if(Cn)return ht;Cn=1;var n=typeof document=="object"&&document.all;return ht=typeof n>"u"&&n!==void 0?function(e){return typeof e=="function"||e===n}:function(e){return typeof e=="function"},ht}var ft,wn;function pe(){if(wn)return ft;wn=1;var n=re();return ft=function(e){return typeof e=="object"?e!==null:n(e)},ft}var ct,Pn;function rr(){if(Pn)return ct;Pn=1;var n=Q(),e=re(),r=function(t){return e(t)?t:void 0};return ct=function(t,i){return arguments.length<2?r(n[t]):n[t]&&n[t][i]},ct}var vt,An;function Nr(){if(An)return vt;An=1;var n=J();return vt=n({}.isPrototypeOf),vt}var gt,In;function pr(){if(In)return gt;In=1;var n=Q(),e=n.navigator,r=e&&e.userAgent;return gt=r?String(r):"",gt}var dt,Nn;function Ua(){if(Nn)return dt;Nn=1;var n=Q(),e=pr(),r=n.process,t=n.Deno,i=r&&r.versions||t&&t.version,a=i&&i.v8,s,o;return a&&(s=a.split("."),o=s[0]>0&&s[0]<4?1:+(s[0]+s[1])),!o&&e&&(s=e.match(/Edge\/(\d+)/),(!s||s[1]>=74)&&(s=e.match(/Chrome\/(\d+)/),s&&(o=+s[1]))),dt=o,dt}var pt,_n;function nl(){if(_n)return pt;_n=1;var n=Ua(),e=Z(),r=Q(),t=r.String;return pt=!!Object.getOwnPropertySymbols&&!e(function(){var i=Symbol("symbol detection");return!t(i)||!(Object(i)instanceof Symbol)||!Symbol.sham&&n&&n<41}),pt}var yt,Mn;function sl(){if(Mn)return yt;Mn=1;var n=nl();return yt=n&&!Symbol.sham&&typeof Symbol.iterator=="symbol",yt}var mt,qn;function ol(){if(qn)return mt;qn=1;var n=rr(),e=re(),r=Nr(),t=sl(),i=Object;return mt=t?function(a){return typeof a=="symbol"}:function(a){var s=n("Symbol");return e(s)&&r(s.prototype,i(a))},mt}var bt,Dn;function _r(){if(Dn)return bt;Dn=1;var n=String;return bt=function(e){try{return n(e)}catch{return"Object"}},bt}var xt,Vn;function Fe(){if(Vn)return xt;Vn=1;var n=re(),e=_r(),r=TypeError;return xt=function(t){if(n(t))return t;throw new r(e(t)+" is not a function")},xt}var Ot,Ln;function nr(){if(Ln)return Ot;Ln=1;var n=Fe(),e=Ir();return Ot=function(r,t){var i=r[t];return e(i)?void 0:n(i)},Ot}var Tt,kn;function Xl(){if(kn)return Tt;kn=1;var n=ne(),e=re(),r=pe(),t=TypeError;return Tt=function(i,a){var s,o;if(a==="string"&&e(s=i.toString)&&!r(o=n(s,i))||e(s=i.valueOf)&&!r(o=n(s,i))||a!=="string"&&e(s=i.toString)&&!r(o=n(s,i)))return o;throw new t("Can't convert object to primitive value")},Tt}var St={exports:{}},Et,jn;function Me(){return jn||(jn=1,Et=!1),Et}var Rt,Bn;function Ga(){if(Bn)return Rt;Bn=1;var n=Q(),e=Object.defineProperty;return Rt=function(r,t){try{e(n,r,{value:t,configurable:!0,writable:!0})}catch{n[r]=t}return t},Rt}var Fn;function $a(){if(Fn)return St.exports;Fn=1;var n=Me(),e=Q(),r=Ga(),t="__core-js_shared__",i=St.exports=e[t]||r(t,{});return(i.versions||(i.versions=[])).push({version:"3.47.0",mode:n?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru), 2025 CoreJS Company (core-js.io)",license:"https://github.com/zloirock/core-js/blob/v3.47.0/LICENSE",source:"https://github.com/zloirock/core-js"}),St.exports}var Ct,Un;function za(){if(Un)return Ct;Un=1;var n=$a();return Ct=function(e,r){return n[e]||(n[e]=r||{})},Ct}var wt,Gn;function Mr(){if(Gn)return wt;Gn=1;var n=Pe(),e=Object;return wt=function(r){return e(n(r))},wt}var Pt,$n;function Ae(){if($n)return Pt;$n=1;var n=J(),e=Mr(),r=n({}.hasOwnProperty);return Pt=Object.hasOwn||function(i,a){return r(e(i),a)},Pt}var At,zn;function ul(){if(zn)return At;zn=1;var n=J(),e=0,r=Math.random(),t=n(1.1.toString);return At=function(i){return"Symbol("+(i===void 0?"":i)+")_"+t(++e+r,36)},At}var It,Hn;function ae(){if(Hn)return It;Hn=1;var n=Q(),e=za(),r=Ae(),t=ul(),i=nl(),a=sl(),s=n.Symbol,o=e("wks"),u=a?s.for||s:s&&s.withoutSetter||t;return It=function(l){return r(o,l)||(o[l]=i&&r(s,l)?s[l]:u("Symbol."+l)),o[l]},It}var Nt,Wn;function Kl(){if(Wn)return Nt;Wn=1;var n=ne(),e=pe(),r=ol(),t=nr(),i=Xl(),a=ae(),s=TypeError,o=a("toPrimitive");return Nt=function(u,l){if(!e(u)||r(u))return u;var h=t(u,o),c;if(h){if(l===void 0&&(l="default"),c=n(h,u,l),!e(c)||r(c))return c;throw new s("Can't convert object to primitive value")}return l===void 0&&(l="number"),i(u,l)},Nt}var _t,Yn;function ll(){if(Yn)return _t;Yn=1;var n=Kl(),e=ol();return _t=function(r){var t=n(r,"string");return e(t)?t:t+""},_t}var Mt,Xn;function qr(){if(Xn)return Mt;Xn=1;var n=Q(),e=pe(),r=n.document,t=e(r)&&e(r.createElement);return Mt=function(i){return t?r.createElement(i):{}},Mt}var qt,Kn;function hl(){if(Kn)return qt;Kn=1;var n=we(),e=Z(),r=qr();return qt=!n&&!e(function(){return Object.defineProperty(r("div"),"a",{get:function(){return 7}}).a!==7}),qt}var Qn;function Dr(){if(Qn)return Qr;Qn=1;var n=we(),e=ne(),r=Yl(),t=Fa(),i=dr(),a=ll(),s=Ae(),o=hl(),u=Object.getOwnPropertyDescriptor;return Qr.f=n?u:function(h,c){if(h=i(h),c=a(c),o)try{return u(h,c)}catch{}if(s(h,c))return t(!e(r.f,h,c),h[c])},Qr}var Dt={},Vt,Zn;function fl(){if(Zn)return Vt;Zn=1;var n=we(),e=Z();return Vt=n&&e(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),Vt}var Lt,Jn;function le(){if(Jn)return Lt;Jn=1;var n=pe(),e=String,r=TypeError;return Lt=function(t){if(n(t))return t;throw new r(e(t)+" is not an object")},Lt}var es;function Ye(){if(es)return Dt;es=1;var n=we(),e=hl(),r=fl(),t=le(),i=ll(),a=TypeError,s=Object.defineProperty,o=Object.getOwnPropertyDescriptor,u="enumerable",l="configurable",h="writable";return Dt.f=n?r?function(v,f,g){if(t(v),f=i(f),t(g),typeof v=="function"&&f==="prototype"&&"value"in g&&h in g&&!g[h]){var d=o(v,f);d&&d[h]&&(v[f]=g.value,g={configurable:l in g?g[l]:d[l],enumerable:u in g?g[u]:d[u],writable:!1})}return s(v,f,g)}:s:function(v,f,g){if(t(v),f=i(f),t(g),e)try{return s(v,f,g)}catch{}if("get"in g||"set"in g)throw new a("Accessors not supported");return"value"in g&&(v[f]=g.value),v},Dt}var kt,rs;function yr(){if(rs)return kt;rs=1;var n=we(),e=Ye(),r=Fa();return kt=n?function(t,i,a){return e.f(t,i,r(1,a))}:function(t,i,a){return t[i]=a,t},kt}var jt={exports:{}},Bt,ts;function Vr(){if(ts)return Bt;ts=1;var n=we(),e=Ae(),r=Function.prototype,t=n&&Object.getOwnPropertyDescriptor,i=e(r,"name"),a=i&&(function(){}).name==="something",s=i&&(!n||n&&t(r,"name").configurable);return Bt={EXISTS:i,PROPER:a,CONFIGURABLE:s},Bt}var Ft,is;function Ha(){if(is)return Ft;is=1;var n=J(),e=re(),r=$a(),t=n(Function.toString);return e(r.inspectSource)||(r.inspectSource=function(i){return t(i)}),Ft=r.inspectSource,Ft}var Ut,as;function Ql(){if(as)return Ut;as=1;var n=Q(),e=re(),r=n.WeakMap;return Ut=e(r)&&/native code/.test(String(r)),Ut}var Gt,ns;function Wa(){if(ns)return Gt;ns=1;var n=za(),e=ul(),r=n("keys");return Gt=function(t){return r[t]||(r[t]=e(t))},Gt}var $t,ss;function Ya(){return ss||(ss=1,$t={}),$t}var zt,os;function Lr(){if(os)return zt;os=1;var n=Ql(),e=Q(),r=pe(),t=yr(),i=Ae(),a=$a(),s=Wa(),o=Ya(),u="Object already initialized",l=e.TypeError,h=e.WeakMap,c,v,f,g=function(m){return f(m)?v(m):c(m,{})},d=function(m){return function(b){var x;if(!r(b)||(x=v(b)).type!==m)throw new l("Incompatible receiver, "+m+" required");return x}};if(n||a.state){var p=a.state||(a.state=new h);p.get=p.get,p.has=p.has,p.set=p.set,c=function(m,b){if(p.has(m))throw new l(u);return b.facade=m,p.set(m,b),b},v=function(m){return p.get(m)||{}},f=function(m){return p.has(m)}}else{var y=s("state");o[y]=!0,c=function(m,b){if(i(m,y))throw new l(u);return b.facade=m,t(m,y,b),b},v=function(m){return i(m,y)?m[y]:{}},f=function(m){return i(m,y)}}return zt={set:c,get:v,has:f,enforce:g,getterFor:d},zt}var us;function cl(){if(us)return jt.exports;us=1;var n=J(),e=Z(),r=re(),t=Ae(),i=we(),a=Vr().CONFIGURABLE,s=Ha(),o=Lr(),u=o.enforce,l=o.get,h=String,c=Object.defineProperty,v=n("".slice),f=n("".replace),g=n([].join),d=i&&!e(function(){return c(function(){},"length",{value:8}).length!==8}),p=String(String).split("String"),y=jt.exports=function(m,b,x){v(h(b),0,7)==="Symbol("&&(b="["+f(h(b),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),x&&x.getter&&(b="get "+b),x&&x.setter&&(b="set "+b),(!t(m,"name")||a&&m.name!==b)&&(i?c(m,"name",{value:b,configurable:!0}):m.name=b),d&&x&&t(x,"arity")&&m.length!==x.arity&&c(m,"length",{value:x.arity});try{x&&t(x,"constructor")&&x.constructor?i&&c(m,"prototype",{writable:!1}):m.prototype&&(m.prototype=void 0)}catch{}var S=u(m);return t(S,"source")||(S.source=g(p,typeof b=="string"?b:"")),m};return Function.prototype.toString=y(function(){return r(this)&&l(this).source||s(this)},"toString"),jt.exports}var Ht,ls;function tr(){if(ls)return Ht;ls=1;var n=re(),e=Ye(),r=cl(),t=Ga();return Ht=function(i,a,s,o){o||(o={});var u=o.enumerable,l=o.name!==void 0?o.name:a;if(n(s)&&r(s,l,o),o.global)u?i[a]=s:t(a,s);else{try{o.unsafe?i[a]&&(u=!0):delete i[a]}catch{}u?i[a]=s:e.f(i,a,{value:s,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return i},Ht}var Wt={},Yt,hs;function Zl(){if(hs)return Yt;hs=1;var n=Math.ceil,e=Math.floor;return Yt=Math.trunc||function(t){var i=+t;return(i>0?e:n)(i)},Yt}var Xt,fs;function kr(){if(fs)return Xt;fs=1;var n=Zl();return Xt=function(e){var r=+e;return r!==r||r===0?0:n(r)},Xt}var Kt,cs;function Jl(){if(cs)return Kt;cs=1;var n=kr(),e=Math.max,r=Math.min;return Kt=function(t,i){var a=n(t);return a<0?e(a+i,0):r(a,i)},Kt}var Qt,vs;function sr(){if(vs)return Qt;vs=1;var n=kr(),e=Math.min;return Qt=function(r){var t=n(r);return t>0?e(t,9007199254740991):0},Qt}var Zt,gs;function Xa(){if(gs)return Zt;gs=1;var n=sr();return Zt=function(e){return n(e.length)},Zt}var Jt,ds;function vl(){if(ds)return Jt;ds=1;var n=dr(),e=Jl(),r=Xa(),t=function(i){return function(a,s,o){var u=n(a),l=r(u);if(l===0)return!i&&-1;var h=e(o,l),c;if(i&&s!==s){for(;l>h;)if(c=u[h++],c!==c)return!0}else for(;l>h;h++)if((i||h in u)&&u[h]===s)return i||h||0;return!i&&-1}};return Jt={includes:t(!0),indexOf:t(!1)},Jt}var ei,ps;function gl(){if(ps)return ei;ps=1;var n=J(),e=Ae(),r=dr(),t=vl().indexOf,i=Ya(),a=n([].push);return ei=function(s,o){var u=r(s),l=0,h=[],c;for(c in u)!e(i,c)&&e(u,c)&&a(h,c);for(;o.length>l;)e(u,c=o[l++])&&(~t(h,c)||a(h,c));return h},ei}var ri,ys;function Ka(){return ys||(ys=1,ri=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]),ri}var ms;function eh(){if(ms)return Wt;ms=1;var n=gl(),e=Ka(),r=e.concat("length","prototype");return Wt.f=Object.getOwnPropertyNames||function(i){return n(i,r)},Wt}var ti={},bs;function rh(){return bs||(bs=1,ti.f=Object.getOwnPropertySymbols),ti}var ii,xs;function th(){if(xs)return ii;xs=1;var n=rr(),e=J(),r=eh(),t=rh(),i=le(),a=e([].concat);return ii=n("Reflect","ownKeys")||function(o){var u=r.f(i(o)),l=t.f;return l?a(u,l(o)):u},ii}var ai,Os;function ih(){if(Os)return ai;Os=1;var n=Ae(),e=th(),r=Dr(),t=Ye();return ai=function(i,a,s){for(var o=e(a),u=t.f,l=r.f,h=0;h<o.length;h++){var c=o[h];!n(i,c)&&!(s&&n(s,c))&&u(i,c,l(a,c))}},ai}var ni,Ts;function dl(){if(Ts)return ni;Ts=1;var n=Z(),e=re(),r=/#|\.prototype\./,t=function(u,l){var h=a[i(u)];return h===o?!0:h===s?!1:e(l)?n(l):!!l},i=t.normalize=function(u){return String(u).replace(r,".").toLowerCase()},a=t.data={},s=t.NATIVE="N",o=t.POLYFILL="P";return ni=t,ni}var si,Ss;function he(){if(Ss)return si;Ss=1;var n=Q(),e=Dr().f,r=yr(),t=tr(),i=Ga(),a=ih(),s=dl();return si=function(o,u){var l=o.target,h=o.global,c=o.stat,v,f,g,d,p,y;if(h?f=n:c?f=n[l]||i(l,{}):f=n[l]&&n[l].prototype,f)for(g in u){if(p=u[g],o.dontCallGetSet?(y=e(f,g),d=y&&y.value):d=f[g],v=s(h?g:l+(c?".":"#")+g,o.forced),!v&&d!==void 0){if(typeof p==typeof d)continue;a(p,d)}(o.sham||d&&d.sham)&&r(p,"sham",!0),t(f,g,p,o)}},si}var oi,Es;function pl(){if(Es)return oi;Es=1;var n=Q(),e=pr(),r=er(),t=function(i){return e.slice(0,i.length)===i};return oi=(function(){return t("Bun/")?"BUN":t("Cloudflare-Workers")?"CLOUDFLARE":t("Deno/")?"DENO":t("Node.js/")?"NODE":n.Bun&&typeof Bun.version=="string"?"BUN":n.Deno&&typeof Deno.version=="object"?"DENO":r(n.process)==="process"?"NODE":n.window&&n.document?"BROWSER":"REST"})(),oi}var ui,Rs;function jr(){if(Rs)return ui;Rs=1;var n=pl();return ui=n==="NODE",ui}var li,Cs;function ah(){if(Cs)return li;Cs=1;var n=Q();return li=n,li}var hi,ws;function nh(){if(ws)return hi;ws=1;var n=J(),e=Fe();return hi=function(r,t,i){try{return n(e(Object.getOwnPropertyDescriptor(r,t)[i]))}catch{}},hi}var fi,Ps;function sh(){if(Ps)return fi;Ps=1;var n=pe();return fi=function(e){return n(e)||e===null},fi}var ci,As;function oh(){if(As)return ci;As=1;var n=sh(),e=String,r=TypeError;return ci=function(t){if(n(t))return t;throw new r("Can't set "+e(t)+" as a prototype")},ci}var vi,Is;function yl(){if(Is)return vi;Is=1;var n=nh(),e=pe(),r=Pe(),t=oh();return vi=Object.setPrototypeOf||("__proto__"in{}?(function(){var i=!1,a={},s;try{s=n(Object.prototype,"__proto__","set"),s(a,[]),i=a instanceof Array}catch{}return function(u,l){return r(u),t(l),e(u)&&(i?s(u,l):u.__proto__=l),u}})():void 0),vi}var gi,Ns;function Br(){if(Ns)return gi;Ns=1;var n=Ye().f,e=Ae(),r=ae(),t=r("toStringTag");return gi=function(i,a,s){i&&!s&&(i=i.prototype),i&&!e(i,t)&&n(i,t,{configurable:!0,value:a})},gi}var di,_s;function uh(){if(_s)return di;_s=1;var n=cl(),e=Ye();return di=function(r,t,i){return i.get&&n(i.get,t,{getter:!0}),i.set&&n(i.set,t,{setter:!0}),e.f(r,t,i)},di}var pi,Ms;function lh(){if(Ms)return pi;Ms=1;var n=rr(),e=uh(),r=ae(),t=we(),i=r("species");return pi=function(a){var s=n(a);t&&s&&!s[i]&&e(s,i,{configurable:!0,get:function(){return this}})},pi}var yi,qs;function hh(){if(qs)return yi;qs=1;var n=Nr(),e=TypeError;return yi=function(r,t){if(n(t,r))return r;throw new e("Incorrect invocation")},yi}var mi,Ds;function fh(){if(Ds)return mi;Ds=1;var n=ae(),e=n("toStringTag"),r={};return r[e]="z",mi=String(r)==="[object z]",mi}var bi,Vs;function Qa(){if(Vs)return bi;Vs=1;var n=fh(),e=re(),r=er(),t=ae(),i=t("toStringTag"),a=Object,s=r((function(){return arguments})())==="Arguments",o=function(u,l){try{return u[l]}catch{}};return bi=n?r:function(u){var l,h,c;return u===void 0?"Undefined":u===null?"Null":typeof(h=o(l=a(u),i))=="string"?h:s?r(l):(c=r(l))==="Object"&&e(l.callee)?"Arguments":c},bi}var xi,Ls;function ch(){if(Ls)return xi;Ls=1;var n=J(),e=Z(),r=re(),t=Qa(),i=rr(),a=Ha(),s=function(){},o=i("Reflect","construct"),u=/^\s*(?:class|function)\b/,l=n(u.exec),h=!u.test(s),c=function(g){if(!r(g))return!1;try{return o(s,[],g),!0}catch{return!1}},v=function(g){if(!r(g))return!1;switch(t(g)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return h||!!l(u,a(g))}catch{return!0}};return v.sham=!0,xi=!o||e(function(){var f;return c(c.call)||!c(Object)||!c(function(){f=!0})||f})?v:c,xi}var Oi,ks;function vh(){if(ks)return Oi;ks=1;var n=ch(),e=_r(),r=TypeError;return Oi=function(t){if(n(t))return t;throw new r(e(t)+" is not a constructor")},Oi}var Ti,js;function ml(){if(js)return Ti;js=1;var n=le(),e=vh(),r=Ir(),t=ae(),i=t("species");return Ti=function(a,s){var o=n(a).constructor,u;return o===void 0||r(u=n(o)[i])?s:e(u)},Ti}var Si,Bs;function bl(){if(Bs)return Si;Bs=1;var n=Ar(),e=Function.prototype,r=e.apply,t=e.call;return Si=typeof Reflect=="object"&&Reflect.apply||(n?t.bind(r):function(){return t.apply(r,arguments)}),Si}var Ei,Fs;function Fr(){if(Fs)return Ei;Fs=1;var n=er(),e=J();return Ei=function(r){if(n(r)==="Function")return e(r)},Ei}var Ri,Us;function Za(){if(Us)return Ri;Us=1;var n=Fr(),e=Fe(),r=Ar(),t=n(n.bind);return Ri=function(i,a){return e(i),a===void 0?i:r?t(i,a):function(){return i.apply(a,arguments)}},Ri}var Ci,Gs;function xl(){if(Gs)return Ci;Gs=1;var n=rr();return Ci=n("document","documentElement"),Ci}var wi,$s;function gh(){if($s)return wi;$s=1;var n=J();return wi=n([].slice),wi}var Pi,zs;function dh(){if(zs)return Pi;zs=1;var n=TypeError;return Pi=function(e,r){if(e<r)throw new n("Not enough arguments");return e},Pi}var Ai,Hs;function Ol(){if(Hs)return Ai;Hs=1;var n=pr();return Ai=/(?:ipad|iphone|ipod).*applewebkit/i.test(n),Ai}var Ii,Ws;function Tl(){if(Ws)return Ii;Ws=1;var n=Q(),e=bl(),r=Za(),t=re(),i=Ae(),a=Z(),s=xl(),o=gh(),u=qr(),l=dh(),h=Ol(),c=jr(),v=n.setImmediate,f=n.clearImmediate,g=n.process,d=n.Dispatch,p=n.Function,y=n.MessageChannel,m=n.String,b=0,x={},S="onreadystatechange",E,O,P,_;a(function(){E=n.location});var A=function(C){if(i(x,C)){var w=x[C];delete x[C],w()}},q=function(C){return function(){A(C)}},I=function(C){A(C.data)},j=function(C){n.postMessage(m(C),E.protocol+"//"+E.host)};return(!v||!f)&&(v=function(w){l(arguments.length,1);var U=t(w)?w:p(w),L=o(arguments,1);return x[++b]=function(){e(U,void 0,L)},O(b),b},f=function(w){delete x[w]},c?O=function(C){g.nextTick(q(C))}:d&&d.now?O=function(C){d.now(q(C))}:y&&!h?(P=new y,_=P.port2,P.port1.onmessage=I,O=r(_.postMessage,_)):n.addEventListener&&t(n.postMessage)&&!n.importScripts&&E&&E.protocol!=="file:"&&!a(j)?(O=j,n.addEventListener("message",I,!1)):S in u("script")?O=function(C){s.appendChild(u("script"))[S]=function(){s.removeChild(this),A(C)}}:O=function(C){setTimeout(q(C),0)}),Ii={set:v,clear:f},Ii}var Ni,Ys;function ph(){if(Ys)return Ni;Ys=1;var n=Q(),e=we(),r=Object.getOwnPropertyDescriptor;return Ni=function(t){if(!e)return n[t];var i=r(n,t);return i&&i.value},Ni}var _i,Xs;function Sl(){if(Xs)return _i;Xs=1;var n=function(){this.head=null,this.tail=null};return n.prototype={add:function(e){var r={item:e,next:null},t=this.tail;t?t.next=r:this.head=r,this.tail=r},get:function(){var e=this.head;if(e){var r=this.head=e.next;return r===null&&(this.tail=null),e.item}}},_i=n,_i}var Mi,Ks;function yh(){if(Ks)return Mi;Ks=1;var n=pr();return Mi=/ipad|iphone|ipod/i.test(n)&&typeof Pebble<"u",Mi}var qi,Qs;function mh(){if(Qs)return qi;Qs=1;var n=pr();return qi=/web0s(?!.*chrome)/i.test(n),qi}var Di,Zs;function bh(){if(Zs)return Di;Zs=1;var n=Q(),e=ph(),r=Za(),t=Tl().set,i=Sl(),a=Ol(),s=yh(),o=mh(),u=jr(),l=n.MutationObserver||n.WebKitMutationObserver,h=n.document,c=n.process,v=n.Promise,f=e("queueMicrotask"),g,d,p,y,m;if(!f){var b=new i,x=function(){var S,E;for(u&&(S=c.domain)&&S.exit();E=b.get();)try{E()}catch(O){throw b.head&&g(),O}S&&S.enter()};!a&&!u&&!o&&l&&h?(d=!0,p=h.createTextNode(""),new l(x).observe(p,{characterData:!0}),g=function(){p.data=d=!d}):!s&&v&&v.resolve?(y=v.resolve(void 0),y.constructor=v,m=r(y.then,y),g=function(){m(x)}):u?g=function(){c.nextTick(x)}:(t=r(t,n),g=function(){t(x)}),f=function(S){b.head||g(),b.add(S)}}return Di=f,Di}var Vi,Js;function xh(){return Js||(Js=1,Vi=function(n,e){try{arguments.length===1?console.error(n):console.error(n,e)}catch{}}),Vi}var Li,eo;function Ja(){return eo||(eo=1,Li=function(n){try{return{error:!1,value:n()}}catch(e){return{error:!0,value:e}}}),Li}var ki,ro;function mr(){if(ro)return ki;ro=1;var n=Q();return ki=n.Promise,ki}var ji,to;function br(){if(to)return ji;to=1;var n=Q(),e=mr(),r=re(),t=dl(),i=Ha(),a=ae(),s=pl(),o=Me(),u=Ua(),l=e&&e.prototype,h=a("species"),c=!1,v=r(n.PromiseRejectionEvent),f=t("Promise",function(){var g=i(e),d=g!==String(e);if(!d&&u===66||o&&!(l.catch&&l.finally))return!0;if(!u||u<51||!/native code/.test(g)){var p=new e(function(b){b(1)}),y=function(b){b(function(){},function(){})},m=p.constructor={};if(m[h]=y,c=p.then(function(){})instanceof y,!c)return!0}return!d&&(s==="BROWSER"||s==="DENO")&&!v});return ji={CONSTRUCTOR:f,REJECTION_EVENT:v,SUBCLASSING:c},ji}var Bi={},io;function xr(){if(io)return Bi;io=1;var n=Fe(),e=TypeError,r=function(t){var i,a;this.promise=new t(function(s,o){if(i!==void 0||a!==void 0)throw new e("Bad Promise constructor");i=s,a=o}),this.resolve=n(i),this.reject=n(a)};return Bi.f=function(t){return new r(t)},Bi}var ao;function Oh(){if(ao)return cn;ao=1;var n=he(),e=Me(),r=jr(),t=Q(),i=ah(),a=ne(),s=tr(),o=yl(),u=Br(),l=lh(),h=Fe(),c=re(),v=pe(),f=hh(),g=ml(),d=Tl().set,p=bh(),y=xh(),m=Ja(),b=Sl(),x=Lr(),S=mr(),E=br(),O=xr(),P="Promise",_=E.CONSTRUCTOR,A=E.REJECTION_EVENT,q=E.SUBCLASSING,I=x.getterFor(P),j=x.set,C=S&&S.prototype,w=S,U=C,L=t.TypeError,V=t.document,M=t.process,N=O.f,k=N,z=!!(V&&V.createEvent&&t.dispatchEvent),H="unhandledrejection",X="rejectionhandled",se=0,be=1,oe=2,Ue=1,Ge=2,fe,Ne,_e,me,ce=function(R){var B;return v(R)&&c(B=R.then)?B:!1},xe=function(R,B){var G=B.value,$=B.state===be,W=$?R.ok:R.fail,Te=R.resolve,Le=R.reject,Se=R.domain,Ee,lr,hr;try{W?($||(B.rejection===Ge&&$e(B),B.rejection=Ue),W===!0?Ee=G:(Se&&Se.enter(),Ee=W(G),Se&&(Se.exit(),hr=!0)),Ee===R.promise?Le(new L("Promise-chain cycle")):(lr=ce(Ee))?a(lr,Ee,Te,Le):Te(Ee)):Le(G)}catch(fr){Se&&!hr&&Se.exit(),Le(fr)}},De=function(R,B){R.notified||(R.notified=!0,p(function(){for(var G=R.reactions,$;$=G.get();)xe($,R);R.notified=!1,B&&!R.rejection&&Xe(R)}))},Ve=function(R,B,G){var $,W;z?($=V.createEvent("Event"),$.promise=B,$.reason=G,$.initEvent(R,!1,!0),t.dispatchEvent($)):$={promise:B,reason:G},!A&&(W=t["on"+R])?W($):R===H&&y("Unhandled promise rejection",G)},Xe=function(R){a(d,t,function(){var B=R.facade,G=R.value,$=ur(R),W;if($&&(W=m(function(){r?M.emit("unhandledRejection",G,B):Ve(H,B,G)}),R.rejection=r||ur(R)?Ge:Ue,W.error))throw W.value})},ur=function(R){return R.rejection!==Ue&&!R.parent},$e=function(R){a(d,t,function(){var B=R.facade;r?M.emit("rejectionHandled",B):Ve(X,B,R.value)})},ve=function(R,B,G){return function($){R(B,$,G)}},ge=function(R,B,G){R.done||(R.done=!0,G&&(R=G),R.value=B,R.state=oe,De(R,!0))},Oe=function(R,B,G){if(!R.done){R.done=!0,G&&(R=G);try{if(R.facade===B)throw new L("Promise can't be resolved itself");var $=ce(B);$?p(function(){var W={done:!1};try{a($,B,ve(Oe,W,R),ve(ge,W,R))}catch(Te){ge(W,Te,R)}}):(R.value=B,R.state=be,De(R,!1))}catch(W){ge({done:!1},W,R)}}};if(_&&(w=function(B){f(this,U),h(B),a(fe,this);var G=I(this);try{B(ve(Oe,G),ve(ge,G))}catch($){ge(G,$)}},U=w.prototype,fe=function(B){j(this,{type:P,done:!1,notified:!1,parent:!1,reactions:new b,rejection:!1,state:se,value:null})},fe.prototype=s(U,"then",function(B,G){var $=I(this),W=N(g(this,w));return $.parent=!0,W.ok=c(B)?B:!0,W.fail=c(G)&&G,W.domain=r?M.domain:void 0,$.state===se?$.reactions.add(W):p(function(){xe(W,$)}),W.promise}),Ne=function(){var R=new fe,B=I(R);this.promise=R,this.resolve=ve(Oe,B),this.reject=ve(ge,B)},O.f=N=function(R){return R===w||R===_e?new Ne(R):k(R)},!e&&c(S)&&C!==Object.prototype)){me=C.then,q||s(C,"then",function(B,G){var $=this;return new w(function(W,Te){a(me,$,W,Te)}).then(B,G)},{unsafe:!0});try{delete C.constructor}catch{}o&&o(C,U)}return n({global:!0,constructor:!0,wrap:!0,forced:_},{Promise:w}),_e=i.Promise,u(w,P,!1,!0),l(P),cn}var no={},Fi,so;function Or(){return so||(so=1,Fi={}),Fi}var Ui,oo;function Th(){if(oo)return Ui;oo=1;var n=ae(),e=Or(),r=n("iterator"),t=Array.prototype;return Ui=function(i){return i!==void 0&&(e.Array===i||t[r]===i)},Ui}var Gi,uo;function El(){if(uo)return Gi;uo=1;var n=Qa(),e=nr(),r=Ir(),t=Or(),i=ae(),a=i("iterator");return Gi=function(s){if(!r(s))return e(s,a)||e(s,"@@iterator")||t[n(s)]},Gi}var $i,lo;function Sh(){if(lo)return $i;lo=1;var n=ne(),e=Fe(),r=le(),t=_r(),i=El(),a=TypeError;return $i=function(s,o){var u=arguments.length<2?i(s):o;if(e(u))return r(n(u,s));throw new a(t(s)+" is not iterable")},$i}var zi,ho;function Eh(){if(ho)return zi;ho=1;var n=ne(),e=le(),r=nr();return zi=function(t,i,a){var s,o;e(t);try{if(s=r(t,"return"),!s){if(i==="throw")throw a;return a}s=n(s,t)}catch(u){o=!0,s=u}if(i==="throw")throw a;if(o)throw s;return e(s),a},zi}var Hi,fo;function Rl(){if(fo)return Hi;fo=1;var n=Za(),e=ne(),r=le(),t=_r(),i=Th(),a=Xa(),s=Nr(),o=Sh(),u=El(),l=Eh(),h=TypeError,c=function(f,g){this.stopped=f,this.result=g},v=c.prototype;return Hi=function(f,g,d){var p=d&&d.that,y=!!(d&&d.AS_ENTRIES),m=!!(d&&d.IS_RECORD),b=!!(d&&d.IS_ITERATOR),x=!!(d&&d.INTERRUPTED),S=n(g,p),E,O,P,_,A,q,I,j=function(w){return E&&l(E,"normal"),new c(!0,w)},C=function(w){return y?(r(w),x?S(w[0],w[1],j):S(w[0],w[1])):x?S(w,j):S(w)};if(m)E=f.iterator;else if(b)E=f;else{if(O=u(f),!O)throw new h(t(f)+" is not iterable");if(i(O)){for(P=0,_=a(f);_>P;P++)if(A=C(f[P]),A&&s(v,A))return A;return new c(!1)}E=o(f,O)}for(q=m?f.next:E.next;!(I=e(q,E)).done;){try{A=C(I.value)}catch(w){l(E,"throw",w)}if(typeof A=="object"&&A&&s(v,A))return A}return new c(!1)},Hi}var Wi,co;function Rh(){if(co)return Wi;co=1;var n=ae(),e=n("iterator"),r=!1;try{var t=0,i={next:function(){return{done:!!t++}},return:function(){r=!0}};i[e]=function(){return this},Array.from(i,function(){throw 2})}catch{}return Wi=function(a,s){try{if(!s&&!r)return!1}catch{return!1}var o=!1;try{var u={};u[e]=function(){return{next:function(){return{done:o=!0}}}},a(u)}catch{}return o},Wi}var Yi,vo;function Cl(){if(vo)return Yi;vo=1;var n=mr(),e=Rh(),r=br().CONSTRUCTOR;return Yi=r||!e(function(t){n.all(t).then(void 0,function(){})}),Yi}var go;function Ch(){if(go)return no;go=1;var n=he(),e=ne(),r=Fe(),t=xr(),i=Ja(),a=Rl(),s=Cl();return n({target:"Promise",stat:!0,forced:s},{all:function(u){var l=this,h=t.f(l),c=h.resolve,v=h.reject,f=i(function(){var g=r(l.resolve),d=[],p=0,y=1;a(u,function(m){var b=p++,x=!1;y++,e(g,l,m).then(function(S){x||(x=!0,d[b]=S,--y||c(d))},v)}),--y||c(d)});return f.error&&v(f.value),h.promise}}),no}var po={},yo;function wh(){if(yo)return po;yo=1;var n=he(),e=Me(),r=br().CONSTRUCTOR,t=mr(),i=rr(),a=re(),s=tr(),o=t&&t.prototype;if(n({target:"Promise",proto:!0,forced:r,real:!0},{catch:function(l){return this.then(void 0,l)}}),!e&&a(t)){var u=i("Promise").prototype.catch;o.catch!==u&&s(o,"catch",u,{unsafe:!0})}return po}var mo={},bo;function Ph(){if(bo)return mo;bo=1;var n=he(),e=ne(),r=Fe(),t=xr(),i=Ja(),a=Rl(),s=Cl();return n({target:"Promise",stat:!0,forced:s},{race:function(u){var l=this,h=t.f(l),c=h.reject,v=i(function(){var f=r(l.resolve);a(u,function(g){e(f,l,g).then(h.resolve,c)})});return v.error&&c(v.value),h.promise}}),mo}var xo={},Oo;function Ah(){if(Oo)return xo;Oo=1;var n=he(),e=xr(),r=br().CONSTRUCTOR;return n({target:"Promise",stat:!0,forced:r},{reject:function(i){var a=e.f(this),s=a.reject;return s(i),a.promise}}),xo}var To={},Xi,So;function Ih(){if(So)return Xi;So=1;var n=le(),e=pe(),r=xr();return Xi=function(t,i){if(n(t),e(i)&&i.constructor===t)return i;var a=r.f(t),s=a.resolve;return s(i),a.promise},Xi}var Eo;function Nh(){if(Eo)return To;Eo=1;var n=he(),e=rr(),r=Me(),t=mr(),i=br().CONSTRUCTOR,a=Ih(),s=e("Promise"),o=r&&!i;return n({target:"Promise",stat:!0,forced:r||i},{resolve:function(l){return a(o&&this===s?t:this,l)}}),To}var Ro;function _h(){return Ro||(Ro=1,Oh(),Ch(),wh(),Ph(),Ah(),Nh()),fn}_h();function Co(n,e,r,t,i,a,s){try{var o=n[a](s),u=o.value}catch(l){return void r(l)}o.done?e(u):Promise.resolve(u).then(t,i)}function Be(n){return function(){var e=this,r=arguments;return new Promise(function(t,i){var a=n.apply(e,r);function s(u){Co(a,t,i,s,o,"next",u)}function o(u){Co(a,t,i,s,o,"throw",u)}s(void 0)})}}var wo={},Po={},Ki,Ao;function qe(){if(Ao)return Ki;Ao=1;var n=Qa(),e=String;return Ki=function(r){if(n(r)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return e(r)},Ki}var Qi,Io;function wl(){if(Io)return Qi;Io=1;var n=le();return Qi=function(){var e=n(this),r="";return e.hasIndices&&(r+="d"),e.global&&(r+="g"),e.ignoreCase&&(r+="i"),e.multiline&&(r+="m"),e.dotAll&&(r+="s"),e.unicode&&(r+="u"),e.unicodeSets&&(r+="v"),e.sticky&&(r+="y"),r},Qi}var Zi,No;function Pl(){if(No)return Zi;No=1;var n=Z(),e=Q(),r=e.RegExp,t=n(function(){var s=r("a","y");return s.lastIndex=2,s.exec("abcd")!==null}),i=t||n(function(){return!r("a","y").sticky}),a=t||n(function(){var s=r("^r","gy");return s.lastIndex=2,s.exec("str")!==null});return Zi={BROKEN_CARET:a,MISSED_STICKY:i,UNSUPPORTED_Y:t},Zi}var Ji={},ea,_o;function Mh(){if(_o)return ea;_o=1;var n=gl(),e=Ka();return ea=Object.keys||function(t){return n(t,e)},ea}var Mo;function qh(){if(Mo)return Ji;Mo=1;var n=we(),e=fl(),r=Ye(),t=le(),i=dr(),a=Mh();return Ji.f=n&&!e?Object.defineProperties:function(o,u){t(o);for(var l=i(u),h=a(u),c=h.length,v=0,f;c>v;)r.f(o,f=h[v++],l[f]);return o},Ji}var ra,qo;function Ur(){if(qo)return ra;qo=1;var n=le(),e=qh(),r=Ka(),t=Ya(),i=xl(),a=qr(),s=Wa(),o=">",u="<",l="prototype",h="script",c=s("IE_PROTO"),v=function(){},f=function(m){return u+h+o+m+u+"/"+h+o},g=function(m){m.write(f("")),m.close();var b=m.parentWindow.Object;return m=null,b},d=function(){var m=a("iframe"),b="java"+h+":",x;return m.style.display="none",i.appendChild(m),m.src=String(b),x=m.contentWindow.document,x.open(),x.write(f("document.F=Object")),x.close(),x.F},p,y=function(){try{p=new ActiveXObject("htmlfile")}catch{}y=typeof document<"u"?document.domain&&p?g(p):d():g(p);for(var m=r.length;m--;)delete y[l][r[m]];return y()};return t[c]=!0,ra=Object.create||function(b,x){var S;return b!==null?(v[l]=n(b),S=new v,v[l]=null,S[c]=b):S=y(),x===void 0?S:e.f(S,x)},ra}var ta,Do;function Dh(){if(Do)return ta;Do=1;var n=Z(),e=Q(),r=e.RegExp;return ta=n(function(){var t=r(".","s");return!(t.dotAll&&t.test(`
1
+ import{aa as Da,ab as Va,ac as il}from"./index-otgIUTZs.js";var fn={},cn={},cr,vn;function Q(){if(vn)return cr;vn=1;var n=function(e){return e&&e.Math===Math&&e};return cr=n(typeof globalThis=="object"&&globalThis)||n(typeof window=="object"&&window)||n(typeof self=="object"&&self)||n(typeof Da=="object"&&Da)||n(typeof cr=="object"&&cr)||(function(){return this})()||Function("return this")(),cr}var Qr={},Zr,gn;function Z(){return gn||(gn=1,Zr=function(n){try{return!!n()}catch{return!0}}),Zr}var Jr,dn;function we(){if(dn)return Jr;dn=1;var n=Z();return Jr=!n(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),Jr}var et,pn;function Ar(){if(pn)return et;pn=1;var n=Z();return et=!n(function(){var e=(function(){}).bind();return typeof e!="function"||e.hasOwnProperty("prototype")}),et}var rt,yn;function ne(){if(yn)return rt;yn=1;var n=Ar(),e=Function.prototype.call;return rt=n?e.bind(e):function(){return e.apply(e,arguments)},rt}var tt={},mn;function Yl(){if(mn)return tt;mn=1;var n={}.propertyIsEnumerable,e=Object.getOwnPropertyDescriptor,r=e&&!n.call({1:2},1);return tt.f=r?function(i){var a=e(this,i);return!!a&&a.enumerable}:n,tt}var it,bn;function Fa(){return bn||(bn=1,it=function(n,e){return{enumerable:!(n&1),configurable:!(n&2),writable:!(n&4),value:e}}),it}var at,xn;function J(){if(xn)return at;xn=1;var n=Ar(),e=Function.prototype,r=e.call,t=n&&e.bind.bind(r,r);return at=n?t:function(i){return function(){return r.apply(i,arguments)}},at}var nt,On;function er(){if(On)return nt;On=1;var n=J(),e=n({}.toString),r=n("".slice);return nt=function(t){return r(e(t),8,-1)},nt}var st,Tn;function al(){if(Tn)return st;Tn=1;var n=J(),e=Z(),r=er(),t=Object,i=n("".split);return st=e(function(){return!t("z").propertyIsEnumerable(0)})?function(a){return r(a)==="String"?i(a,""):t(a)}:t,st}var ot,Sn;function Ir(){return Sn||(Sn=1,ot=function(n){return n==null}),ot}var ut,En;function Pe(){if(En)return ut;En=1;var n=Ir(),e=TypeError;return ut=function(r){if(n(r))throw new e("Can't call method on "+r);return r},ut}var lt,Rn;function dr(){if(Rn)return lt;Rn=1;var n=al(),e=Pe();return lt=function(r){return n(e(r))},lt}var ht,Cn;function re(){if(Cn)return ht;Cn=1;var n=typeof document=="object"&&document.all;return ht=typeof n>"u"&&n!==void 0?function(e){return typeof e=="function"||e===n}:function(e){return typeof e=="function"},ht}var ft,wn;function pe(){if(wn)return ft;wn=1;var n=re();return ft=function(e){return typeof e=="object"?e!==null:n(e)},ft}var ct,Pn;function rr(){if(Pn)return ct;Pn=1;var n=Q(),e=re(),r=function(t){return e(t)?t:void 0};return ct=function(t,i){return arguments.length<2?r(n[t]):n[t]&&n[t][i]},ct}var vt,An;function Nr(){if(An)return vt;An=1;var n=J();return vt=n({}.isPrototypeOf),vt}var gt,In;function pr(){if(In)return gt;In=1;var n=Q(),e=n.navigator,r=e&&e.userAgent;return gt=r?String(r):"",gt}var dt,Nn;function Ua(){if(Nn)return dt;Nn=1;var n=Q(),e=pr(),r=n.process,t=n.Deno,i=r&&r.versions||t&&t.version,a=i&&i.v8,s,o;return a&&(s=a.split("."),o=s[0]>0&&s[0]<4?1:+(s[0]+s[1])),!o&&e&&(s=e.match(/Edge\/(\d+)/),(!s||s[1]>=74)&&(s=e.match(/Chrome\/(\d+)/),s&&(o=+s[1]))),dt=o,dt}var pt,_n;function nl(){if(_n)return pt;_n=1;var n=Ua(),e=Z(),r=Q(),t=r.String;return pt=!!Object.getOwnPropertySymbols&&!e(function(){var i=Symbol("symbol detection");return!t(i)||!(Object(i)instanceof Symbol)||!Symbol.sham&&n&&n<41}),pt}var yt,Mn;function sl(){if(Mn)return yt;Mn=1;var n=nl();return yt=n&&!Symbol.sham&&typeof Symbol.iterator=="symbol",yt}var mt,qn;function ol(){if(qn)return mt;qn=1;var n=rr(),e=re(),r=Nr(),t=sl(),i=Object;return mt=t?function(a){return typeof a=="symbol"}:function(a){var s=n("Symbol");return e(s)&&r(s.prototype,i(a))},mt}var bt,Dn;function _r(){if(Dn)return bt;Dn=1;var n=String;return bt=function(e){try{return n(e)}catch{return"Object"}},bt}var xt,Vn;function Fe(){if(Vn)return xt;Vn=1;var n=re(),e=_r(),r=TypeError;return xt=function(t){if(n(t))return t;throw new r(e(t)+" is not a function")},xt}var Ot,Ln;function nr(){if(Ln)return Ot;Ln=1;var n=Fe(),e=Ir();return Ot=function(r,t){var i=r[t];return e(i)?void 0:n(i)},Ot}var Tt,kn;function Xl(){if(kn)return Tt;kn=1;var n=ne(),e=re(),r=pe(),t=TypeError;return Tt=function(i,a){var s,o;if(a==="string"&&e(s=i.toString)&&!r(o=n(s,i))||e(s=i.valueOf)&&!r(o=n(s,i))||a!=="string"&&e(s=i.toString)&&!r(o=n(s,i)))return o;throw new t("Can't convert object to primitive value")},Tt}var St={exports:{}},Et,jn;function Me(){return jn||(jn=1,Et=!1),Et}var Rt,Bn;function Ga(){if(Bn)return Rt;Bn=1;var n=Q(),e=Object.defineProperty;return Rt=function(r,t){try{e(n,r,{value:t,configurable:!0,writable:!0})}catch{n[r]=t}return t},Rt}var Fn;function $a(){if(Fn)return St.exports;Fn=1;var n=Me(),e=Q(),r=Ga(),t="__core-js_shared__",i=St.exports=e[t]||r(t,{});return(i.versions||(i.versions=[])).push({version:"3.47.0",mode:n?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru), 2025 CoreJS Company (core-js.io)",license:"https://github.com/zloirock/core-js/blob/v3.47.0/LICENSE",source:"https://github.com/zloirock/core-js"}),St.exports}var Ct,Un;function za(){if(Un)return Ct;Un=1;var n=$a();return Ct=function(e,r){return n[e]||(n[e]=r||{})},Ct}var wt,Gn;function Mr(){if(Gn)return wt;Gn=1;var n=Pe(),e=Object;return wt=function(r){return e(n(r))},wt}var Pt,$n;function Ae(){if($n)return Pt;$n=1;var n=J(),e=Mr(),r=n({}.hasOwnProperty);return Pt=Object.hasOwn||function(i,a){return r(e(i),a)},Pt}var At,zn;function ul(){if(zn)return At;zn=1;var n=J(),e=0,r=Math.random(),t=n(1.1.toString);return At=function(i){return"Symbol("+(i===void 0?"":i)+")_"+t(++e+r,36)},At}var It,Hn;function ae(){if(Hn)return It;Hn=1;var n=Q(),e=za(),r=Ae(),t=ul(),i=nl(),a=sl(),s=n.Symbol,o=e("wks"),u=a?s.for||s:s&&s.withoutSetter||t;return It=function(l){return r(o,l)||(o[l]=i&&r(s,l)?s[l]:u("Symbol."+l)),o[l]},It}var Nt,Wn;function Kl(){if(Wn)return Nt;Wn=1;var n=ne(),e=pe(),r=ol(),t=nr(),i=Xl(),a=ae(),s=TypeError,o=a("toPrimitive");return Nt=function(u,l){if(!e(u)||r(u))return u;var h=t(u,o),c;if(h){if(l===void 0&&(l="default"),c=n(h,u,l),!e(c)||r(c))return c;throw new s("Can't convert object to primitive value")}return l===void 0&&(l="number"),i(u,l)},Nt}var _t,Yn;function ll(){if(Yn)return _t;Yn=1;var n=Kl(),e=ol();return _t=function(r){var t=n(r,"string");return e(t)?t:t+""},_t}var Mt,Xn;function qr(){if(Xn)return Mt;Xn=1;var n=Q(),e=pe(),r=n.document,t=e(r)&&e(r.createElement);return Mt=function(i){return t?r.createElement(i):{}},Mt}var qt,Kn;function hl(){if(Kn)return qt;Kn=1;var n=we(),e=Z(),r=qr();return qt=!n&&!e(function(){return Object.defineProperty(r("div"),"a",{get:function(){return 7}}).a!==7}),qt}var Qn;function Dr(){if(Qn)return Qr;Qn=1;var n=we(),e=ne(),r=Yl(),t=Fa(),i=dr(),a=ll(),s=Ae(),o=hl(),u=Object.getOwnPropertyDescriptor;return Qr.f=n?u:function(h,c){if(h=i(h),c=a(c),o)try{return u(h,c)}catch{}if(s(h,c))return t(!e(r.f,h,c),h[c])},Qr}var Dt={},Vt,Zn;function fl(){if(Zn)return Vt;Zn=1;var n=we(),e=Z();return Vt=n&&e(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),Vt}var Lt,Jn;function le(){if(Jn)return Lt;Jn=1;var n=pe(),e=String,r=TypeError;return Lt=function(t){if(n(t))return t;throw new r(e(t)+" is not an object")},Lt}var es;function Ye(){if(es)return Dt;es=1;var n=we(),e=hl(),r=fl(),t=le(),i=ll(),a=TypeError,s=Object.defineProperty,o=Object.getOwnPropertyDescriptor,u="enumerable",l="configurable",h="writable";return Dt.f=n?r?function(v,f,g){if(t(v),f=i(f),t(g),typeof v=="function"&&f==="prototype"&&"value"in g&&h in g&&!g[h]){var d=o(v,f);d&&d[h]&&(v[f]=g.value,g={configurable:l in g?g[l]:d[l],enumerable:u in g?g[u]:d[u],writable:!1})}return s(v,f,g)}:s:function(v,f,g){if(t(v),f=i(f),t(g),e)try{return s(v,f,g)}catch{}if("get"in g||"set"in g)throw new a("Accessors not supported");return"value"in g&&(v[f]=g.value),v},Dt}var kt,rs;function yr(){if(rs)return kt;rs=1;var n=we(),e=Ye(),r=Fa();return kt=n?function(t,i,a){return e.f(t,i,r(1,a))}:function(t,i,a){return t[i]=a,t},kt}var jt={exports:{}},Bt,ts;function Vr(){if(ts)return Bt;ts=1;var n=we(),e=Ae(),r=Function.prototype,t=n&&Object.getOwnPropertyDescriptor,i=e(r,"name"),a=i&&(function(){}).name==="something",s=i&&(!n||n&&t(r,"name").configurable);return Bt={EXISTS:i,PROPER:a,CONFIGURABLE:s},Bt}var Ft,is;function Ha(){if(is)return Ft;is=1;var n=J(),e=re(),r=$a(),t=n(Function.toString);return e(r.inspectSource)||(r.inspectSource=function(i){return t(i)}),Ft=r.inspectSource,Ft}var Ut,as;function Ql(){if(as)return Ut;as=1;var n=Q(),e=re(),r=n.WeakMap;return Ut=e(r)&&/native code/.test(String(r)),Ut}var Gt,ns;function Wa(){if(ns)return Gt;ns=1;var n=za(),e=ul(),r=n("keys");return Gt=function(t){return r[t]||(r[t]=e(t))},Gt}var $t,ss;function Ya(){return ss||(ss=1,$t={}),$t}var zt,os;function Lr(){if(os)return zt;os=1;var n=Ql(),e=Q(),r=pe(),t=yr(),i=Ae(),a=$a(),s=Wa(),o=Ya(),u="Object already initialized",l=e.TypeError,h=e.WeakMap,c,v,f,g=function(m){return f(m)?v(m):c(m,{})},d=function(m){return function(b){var x;if(!r(b)||(x=v(b)).type!==m)throw new l("Incompatible receiver, "+m+" required");return x}};if(n||a.state){var p=a.state||(a.state=new h);p.get=p.get,p.has=p.has,p.set=p.set,c=function(m,b){if(p.has(m))throw new l(u);return b.facade=m,p.set(m,b),b},v=function(m){return p.get(m)||{}},f=function(m){return p.has(m)}}else{var y=s("state");o[y]=!0,c=function(m,b){if(i(m,y))throw new l(u);return b.facade=m,t(m,y,b),b},v=function(m){return i(m,y)?m[y]:{}},f=function(m){return i(m,y)}}return zt={set:c,get:v,has:f,enforce:g,getterFor:d},zt}var us;function cl(){if(us)return jt.exports;us=1;var n=J(),e=Z(),r=re(),t=Ae(),i=we(),a=Vr().CONFIGURABLE,s=Ha(),o=Lr(),u=o.enforce,l=o.get,h=String,c=Object.defineProperty,v=n("".slice),f=n("".replace),g=n([].join),d=i&&!e(function(){return c(function(){},"length",{value:8}).length!==8}),p=String(String).split("String"),y=jt.exports=function(m,b,x){v(h(b),0,7)==="Symbol("&&(b="["+f(h(b),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),x&&x.getter&&(b="get "+b),x&&x.setter&&(b="set "+b),(!t(m,"name")||a&&m.name!==b)&&(i?c(m,"name",{value:b,configurable:!0}):m.name=b),d&&x&&t(x,"arity")&&m.length!==x.arity&&c(m,"length",{value:x.arity});try{x&&t(x,"constructor")&&x.constructor?i&&c(m,"prototype",{writable:!1}):m.prototype&&(m.prototype=void 0)}catch{}var S=u(m);return t(S,"source")||(S.source=g(p,typeof b=="string"?b:"")),m};return Function.prototype.toString=y(function(){return r(this)&&l(this).source||s(this)},"toString"),jt.exports}var Ht,ls;function tr(){if(ls)return Ht;ls=1;var n=re(),e=Ye(),r=cl(),t=Ga();return Ht=function(i,a,s,o){o||(o={});var u=o.enumerable,l=o.name!==void 0?o.name:a;if(n(s)&&r(s,l,o),o.global)u?i[a]=s:t(a,s);else{try{o.unsafe?i[a]&&(u=!0):delete i[a]}catch{}u?i[a]=s:e.f(i,a,{value:s,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return i},Ht}var Wt={},Yt,hs;function Zl(){if(hs)return Yt;hs=1;var n=Math.ceil,e=Math.floor;return Yt=Math.trunc||function(t){var i=+t;return(i>0?e:n)(i)},Yt}var Xt,fs;function kr(){if(fs)return Xt;fs=1;var n=Zl();return Xt=function(e){var r=+e;return r!==r||r===0?0:n(r)},Xt}var Kt,cs;function Jl(){if(cs)return Kt;cs=1;var n=kr(),e=Math.max,r=Math.min;return Kt=function(t,i){var a=n(t);return a<0?e(a+i,0):r(a,i)},Kt}var Qt,vs;function sr(){if(vs)return Qt;vs=1;var n=kr(),e=Math.min;return Qt=function(r){var t=n(r);return t>0?e(t,9007199254740991):0},Qt}var Zt,gs;function Xa(){if(gs)return Zt;gs=1;var n=sr();return Zt=function(e){return n(e.length)},Zt}var Jt,ds;function vl(){if(ds)return Jt;ds=1;var n=dr(),e=Jl(),r=Xa(),t=function(i){return function(a,s,o){var u=n(a),l=r(u);if(l===0)return!i&&-1;var h=e(o,l),c;if(i&&s!==s){for(;l>h;)if(c=u[h++],c!==c)return!0}else for(;l>h;h++)if((i||h in u)&&u[h]===s)return i||h||0;return!i&&-1}};return Jt={includes:t(!0),indexOf:t(!1)},Jt}var ei,ps;function gl(){if(ps)return ei;ps=1;var n=J(),e=Ae(),r=dr(),t=vl().indexOf,i=Ya(),a=n([].push);return ei=function(s,o){var u=r(s),l=0,h=[],c;for(c in u)!e(i,c)&&e(u,c)&&a(h,c);for(;o.length>l;)e(u,c=o[l++])&&(~t(h,c)||a(h,c));return h},ei}var ri,ys;function Ka(){return ys||(ys=1,ri=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]),ri}var ms;function eh(){if(ms)return Wt;ms=1;var n=gl(),e=Ka(),r=e.concat("length","prototype");return Wt.f=Object.getOwnPropertyNames||function(i){return n(i,r)},Wt}var ti={},bs;function rh(){return bs||(bs=1,ti.f=Object.getOwnPropertySymbols),ti}var ii,xs;function th(){if(xs)return ii;xs=1;var n=rr(),e=J(),r=eh(),t=rh(),i=le(),a=e([].concat);return ii=n("Reflect","ownKeys")||function(o){var u=r.f(i(o)),l=t.f;return l?a(u,l(o)):u},ii}var ai,Os;function ih(){if(Os)return ai;Os=1;var n=Ae(),e=th(),r=Dr(),t=Ye();return ai=function(i,a,s){for(var o=e(a),u=t.f,l=r.f,h=0;h<o.length;h++){var c=o[h];!n(i,c)&&!(s&&n(s,c))&&u(i,c,l(a,c))}},ai}var ni,Ts;function dl(){if(Ts)return ni;Ts=1;var n=Z(),e=re(),r=/#|\.prototype\./,t=function(u,l){var h=a[i(u)];return h===o?!0:h===s?!1:e(l)?n(l):!!l},i=t.normalize=function(u){return String(u).replace(r,".").toLowerCase()},a=t.data={},s=t.NATIVE="N",o=t.POLYFILL="P";return ni=t,ni}var si,Ss;function he(){if(Ss)return si;Ss=1;var n=Q(),e=Dr().f,r=yr(),t=tr(),i=Ga(),a=ih(),s=dl();return si=function(o,u){var l=o.target,h=o.global,c=o.stat,v,f,g,d,p,y;if(h?f=n:c?f=n[l]||i(l,{}):f=n[l]&&n[l].prototype,f)for(g in u){if(p=u[g],o.dontCallGetSet?(y=e(f,g),d=y&&y.value):d=f[g],v=s(h?g:l+(c?".":"#")+g,o.forced),!v&&d!==void 0){if(typeof p==typeof d)continue;a(p,d)}(o.sham||d&&d.sham)&&r(p,"sham",!0),t(f,g,p,o)}},si}var oi,Es;function pl(){if(Es)return oi;Es=1;var n=Q(),e=pr(),r=er(),t=function(i){return e.slice(0,i.length)===i};return oi=(function(){return t("Bun/")?"BUN":t("Cloudflare-Workers")?"CLOUDFLARE":t("Deno/")?"DENO":t("Node.js/")?"NODE":n.Bun&&typeof Bun.version=="string"?"BUN":n.Deno&&typeof Deno.version=="object"?"DENO":r(n.process)==="process"?"NODE":n.window&&n.document?"BROWSER":"REST"})(),oi}var ui,Rs;function jr(){if(Rs)return ui;Rs=1;var n=pl();return ui=n==="NODE",ui}var li,Cs;function ah(){if(Cs)return li;Cs=1;var n=Q();return li=n,li}var hi,ws;function nh(){if(ws)return hi;ws=1;var n=J(),e=Fe();return hi=function(r,t,i){try{return n(e(Object.getOwnPropertyDescriptor(r,t)[i]))}catch{}},hi}var fi,Ps;function sh(){if(Ps)return fi;Ps=1;var n=pe();return fi=function(e){return n(e)||e===null},fi}var ci,As;function oh(){if(As)return ci;As=1;var n=sh(),e=String,r=TypeError;return ci=function(t){if(n(t))return t;throw new r("Can't set "+e(t)+" as a prototype")},ci}var vi,Is;function yl(){if(Is)return vi;Is=1;var n=nh(),e=pe(),r=Pe(),t=oh();return vi=Object.setPrototypeOf||("__proto__"in{}?(function(){var i=!1,a={},s;try{s=n(Object.prototype,"__proto__","set"),s(a,[]),i=a instanceof Array}catch{}return function(u,l){return r(u),t(l),e(u)&&(i?s(u,l):u.__proto__=l),u}})():void 0),vi}var gi,Ns;function Br(){if(Ns)return gi;Ns=1;var n=Ye().f,e=Ae(),r=ae(),t=r("toStringTag");return gi=function(i,a,s){i&&!s&&(i=i.prototype),i&&!e(i,t)&&n(i,t,{configurable:!0,value:a})},gi}var di,_s;function uh(){if(_s)return di;_s=1;var n=cl(),e=Ye();return di=function(r,t,i){return i.get&&n(i.get,t,{getter:!0}),i.set&&n(i.set,t,{setter:!0}),e.f(r,t,i)},di}var pi,Ms;function lh(){if(Ms)return pi;Ms=1;var n=rr(),e=uh(),r=ae(),t=we(),i=r("species");return pi=function(a){var s=n(a);t&&s&&!s[i]&&e(s,i,{configurable:!0,get:function(){return this}})},pi}var yi,qs;function hh(){if(qs)return yi;qs=1;var n=Nr(),e=TypeError;return yi=function(r,t){if(n(t,r))return r;throw new e("Incorrect invocation")},yi}var mi,Ds;function fh(){if(Ds)return mi;Ds=1;var n=ae(),e=n("toStringTag"),r={};return r[e]="z",mi=String(r)==="[object z]",mi}var bi,Vs;function Qa(){if(Vs)return bi;Vs=1;var n=fh(),e=re(),r=er(),t=ae(),i=t("toStringTag"),a=Object,s=r((function(){return arguments})())==="Arguments",o=function(u,l){try{return u[l]}catch{}};return bi=n?r:function(u){var l,h,c;return u===void 0?"Undefined":u===null?"Null":typeof(h=o(l=a(u),i))=="string"?h:s?r(l):(c=r(l))==="Object"&&e(l.callee)?"Arguments":c},bi}var xi,Ls;function ch(){if(Ls)return xi;Ls=1;var n=J(),e=Z(),r=re(),t=Qa(),i=rr(),a=Ha(),s=function(){},o=i("Reflect","construct"),u=/^\s*(?:class|function)\b/,l=n(u.exec),h=!u.test(s),c=function(g){if(!r(g))return!1;try{return o(s,[],g),!0}catch{return!1}},v=function(g){if(!r(g))return!1;switch(t(g)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return h||!!l(u,a(g))}catch{return!0}};return v.sham=!0,xi=!o||e(function(){var f;return c(c.call)||!c(Object)||!c(function(){f=!0})||f})?v:c,xi}var Oi,ks;function vh(){if(ks)return Oi;ks=1;var n=ch(),e=_r(),r=TypeError;return Oi=function(t){if(n(t))return t;throw new r(e(t)+" is not a constructor")},Oi}var Ti,js;function ml(){if(js)return Ti;js=1;var n=le(),e=vh(),r=Ir(),t=ae(),i=t("species");return Ti=function(a,s){var o=n(a).constructor,u;return o===void 0||r(u=n(o)[i])?s:e(u)},Ti}var Si,Bs;function bl(){if(Bs)return Si;Bs=1;var n=Ar(),e=Function.prototype,r=e.apply,t=e.call;return Si=typeof Reflect=="object"&&Reflect.apply||(n?t.bind(r):function(){return t.apply(r,arguments)}),Si}var Ei,Fs;function Fr(){if(Fs)return Ei;Fs=1;var n=er(),e=J();return Ei=function(r){if(n(r)==="Function")return e(r)},Ei}var Ri,Us;function Za(){if(Us)return Ri;Us=1;var n=Fr(),e=Fe(),r=Ar(),t=n(n.bind);return Ri=function(i,a){return e(i),a===void 0?i:r?t(i,a):function(){return i.apply(a,arguments)}},Ri}var Ci,Gs;function xl(){if(Gs)return Ci;Gs=1;var n=rr();return Ci=n("document","documentElement"),Ci}var wi,$s;function gh(){if($s)return wi;$s=1;var n=J();return wi=n([].slice),wi}var Pi,zs;function dh(){if(zs)return Pi;zs=1;var n=TypeError;return Pi=function(e,r){if(e<r)throw new n("Not enough arguments");return e},Pi}var Ai,Hs;function Ol(){if(Hs)return Ai;Hs=1;var n=pr();return Ai=/(?:ipad|iphone|ipod).*applewebkit/i.test(n),Ai}var Ii,Ws;function Tl(){if(Ws)return Ii;Ws=1;var n=Q(),e=bl(),r=Za(),t=re(),i=Ae(),a=Z(),s=xl(),o=gh(),u=qr(),l=dh(),h=Ol(),c=jr(),v=n.setImmediate,f=n.clearImmediate,g=n.process,d=n.Dispatch,p=n.Function,y=n.MessageChannel,m=n.String,b=0,x={},S="onreadystatechange",E,O,P,_;a(function(){E=n.location});var A=function(C){if(i(x,C)){var w=x[C];delete x[C],w()}},q=function(C){return function(){A(C)}},I=function(C){A(C.data)},j=function(C){n.postMessage(m(C),E.protocol+"//"+E.host)};return(!v||!f)&&(v=function(w){l(arguments.length,1);var U=t(w)?w:p(w),L=o(arguments,1);return x[++b]=function(){e(U,void 0,L)},O(b),b},f=function(w){delete x[w]},c?O=function(C){g.nextTick(q(C))}:d&&d.now?O=function(C){d.now(q(C))}:y&&!h?(P=new y,_=P.port2,P.port1.onmessage=I,O=r(_.postMessage,_)):n.addEventListener&&t(n.postMessage)&&!n.importScripts&&E&&E.protocol!=="file:"&&!a(j)?(O=j,n.addEventListener("message",I,!1)):S in u("script")?O=function(C){s.appendChild(u("script"))[S]=function(){s.removeChild(this),A(C)}}:O=function(C){setTimeout(q(C),0)}),Ii={set:v,clear:f},Ii}var Ni,Ys;function ph(){if(Ys)return Ni;Ys=1;var n=Q(),e=we(),r=Object.getOwnPropertyDescriptor;return Ni=function(t){if(!e)return n[t];var i=r(n,t);return i&&i.value},Ni}var _i,Xs;function Sl(){if(Xs)return _i;Xs=1;var n=function(){this.head=null,this.tail=null};return n.prototype={add:function(e){var r={item:e,next:null},t=this.tail;t?t.next=r:this.head=r,this.tail=r},get:function(){var e=this.head;if(e){var r=this.head=e.next;return r===null&&(this.tail=null),e.item}}},_i=n,_i}var Mi,Ks;function yh(){if(Ks)return Mi;Ks=1;var n=pr();return Mi=/ipad|iphone|ipod/i.test(n)&&typeof Pebble<"u",Mi}var qi,Qs;function mh(){if(Qs)return qi;Qs=1;var n=pr();return qi=/web0s(?!.*chrome)/i.test(n),qi}var Di,Zs;function bh(){if(Zs)return Di;Zs=1;var n=Q(),e=ph(),r=Za(),t=Tl().set,i=Sl(),a=Ol(),s=yh(),o=mh(),u=jr(),l=n.MutationObserver||n.WebKitMutationObserver,h=n.document,c=n.process,v=n.Promise,f=e("queueMicrotask"),g,d,p,y,m;if(!f){var b=new i,x=function(){var S,E;for(u&&(S=c.domain)&&S.exit();E=b.get();)try{E()}catch(O){throw b.head&&g(),O}S&&S.enter()};!a&&!u&&!o&&l&&h?(d=!0,p=h.createTextNode(""),new l(x).observe(p,{characterData:!0}),g=function(){p.data=d=!d}):!s&&v&&v.resolve?(y=v.resolve(void 0),y.constructor=v,m=r(y.then,y),g=function(){m(x)}):u?g=function(){c.nextTick(x)}:(t=r(t,n),g=function(){t(x)}),f=function(S){b.head||g(),b.add(S)}}return Di=f,Di}var Vi,Js;function xh(){return Js||(Js=1,Vi=function(n,e){try{arguments.length===1?console.error(n):console.error(n,e)}catch{}}),Vi}var Li,eo;function Ja(){return eo||(eo=1,Li=function(n){try{return{error:!1,value:n()}}catch(e){return{error:!0,value:e}}}),Li}var ki,ro;function mr(){if(ro)return ki;ro=1;var n=Q();return ki=n.Promise,ki}var ji,to;function br(){if(to)return ji;to=1;var n=Q(),e=mr(),r=re(),t=dl(),i=Ha(),a=ae(),s=pl(),o=Me(),u=Ua(),l=e&&e.prototype,h=a("species"),c=!1,v=r(n.PromiseRejectionEvent),f=t("Promise",function(){var g=i(e),d=g!==String(e);if(!d&&u===66||o&&!(l.catch&&l.finally))return!0;if(!u||u<51||!/native code/.test(g)){var p=new e(function(b){b(1)}),y=function(b){b(function(){},function(){})},m=p.constructor={};if(m[h]=y,c=p.then(function(){})instanceof y,!c)return!0}return!d&&(s==="BROWSER"||s==="DENO")&&!v});return ji={CONSTRUCTOR:f,REJECTION_EVENT:v,SUBCLASSING:c},ji}var Bi={},io;function xr(){if(io)return Bi;io=1;var n=Fe(),e=TypeError,r=function(t){var i,a;this.promise=new t(function(s,o){if(i!==void 0||a!==void 0)throw new e("Bad Promise constructor");i=s,a=o}),this.resolve=n(i),this.reject=n(a)};return Bi.f=function(t){return new r(t)},Bi}var ao;function Oh(){if(ao)return cn;ao=1;var n=he(),e=Me(),r=jr(),t=Q(),i=ah(),a=ne(),s=tr(),o=yl(),u=Br(),l=lh(),h=Fe(),c=re(),v=pe(),f=hh(),g=ml(),d=Tl().set,p=bh(),y=xh(),m=Ja(),b=Sl(),x=Lr(),S=mr(),E=br(),O=xr(),P="Promise",_=E.CONSTRUCTOR,A=E.REJECTION_EVENT,q=E.SUBCLASSING,I=x.getterFor(P),j=x.set,C=S&&S.prototype,w=S,U=C,L=t.TypeError,V=t.document,M=t.process,N=O.f,k=N,z=!!(V&&V.createEvent&&t.dispatchEvent),H="unhandledrejection",X="rejectionhandled",se=0,be=1,oe=2,Ue=1,Ge=2,fe,Ne,_e,me,ce=function(R){var B;return v(R)&&c(B=R.then)?B:!1},xe=function(R,B){var G=B.value,$=B.state===be,W=$?R.ok:R.fail,Te=R.resolve,Le=R.reject,Se=R.domain,Ee,lr,hr;try{W?($||(B.rejection===Ge&&$e(B),B.rejection=Ue),W===!0?Ee=G:(Se&&Se.enter(),Ee=W(G),Se&&(Se.exit(),hr=!0)),Ee===R.promise?Le(new L("Promise-chain cycle")):(lr=ce(Ee))?a(lr,Ee,Te,Le):Te(Ee)):Le(G)}catch(fr){Se&&!hr&&Se.exit(),Le(fr)}},De=function(R,B){R.notified||(R.notified=!0,p(function(){for(var G=R.reactions,$;$=G.get();)xe($,R);R.notified=!1,B&&!R.rejection&&Xe(R)}))},Ve=function(R,B,G){var $,W;z?($=V.createEvent("Event"),$.promise=B,$.reason=G,$.initEvent(R,!1,!0),t.dispatchEvent($)):$={promise:B,reason:G},!A&&(W=t["on"+R])?W($):R===H&&y("Unhandled promise rejection",G)},Xe=function(R){a(d,t,function(){var B=R.facade,G=R.value,$=ur(R),W;if($&&(W=m(function(){r?M.emit("unhandledRejection",G,B):Ve(H,B,G)}),R.rejection=r||ur(R)?Ge:Ue,W.error))throw W.value})},ur=function(R){return R.rejection!==Ue&&!R.parent},$e=function(R){a(d,t,function(){var B=R.facade;r?M.emit("rejectionHandled",B):Ve(X,B,R.value)})},ve=function(R,B,G){return function($){R(B,$,G)}},ge=function(R,B,G){R.done||(R.done=!0,G&&(R=G),R.value=B,R.state=oe,De(R,!0))},Oe=function(R,B,G){if(!R.done){R.done=!0,G&&(R=G);try{if(R.facade===B)throw new L("Promise can't be resolved itself");var $=ce(B);$?p(function(){var W={done:!1};try{a($,B,ve(Oe,W,R),ve(ge,W,R))}catch(Te){ge(W,Te,R)}}):(R.value=B,R.state=be,De(R,!1))}catch(W){ge({done:!1},W,R)}}};if(_&&(w=function(B){f(this,U),h(B),a(fe,this);var G=I(this);try{B(ve(Oe,G),ve(ge,G))}catch($){ge(G,$)}},U=w.prototype,fe=function(B){j(this,{type:P,done:!1,notified:!1,parent:!1,reactions:new b,rejection:!1,state:se,value:null})},fe.prototype=s(U,"then",function(B,G){var $=I(this),W=N(g(this,w));return $.parent=!0,W.ok=c(B)?B:!0,W.fail=c(G)&&G,W.domain=r?M.domain:void 0,$.state===se?$.reactions.add(W):p(function(){xe(W,$)}),W.promise}),Ne=function(){var R=new fe,B=I(R);this.promise=R,this.resolve=ve(Oe,B),this.reject=ve(ge,B)},O.f=N=function(R){return R===w||R===_e?new Ne(R):k(R)},!e&&c(S)&&C!==Object.prototype)){me=C.then,q||s(C,"then",function(B,G){var $=this;return new w(function(W,Te){a(me,$,W,Te)}).then(B,G)},{unsafe:!0});try{delete C.constructor}catch{}o&&o(C,U)}return n({global:!0,constructor:!0,wrap:!0,forced:_},{Promise:w}),_e=i.Promise,u(w,P,!1,!0),l(P),cn}var no={},Fi,so;function Or(){return so||(so=1,Fi={}),Fi}var Ui,oo;function Th(){if(oo)return Ui;oo=1;var n=ae(),e=Or(),r=n("iterator"),t=Array.prototype;return Ui=function(i){return i!==void 0&&(e.Array===i||t[r]===i)},Ui}var Gi,uo;function El(){if(uo)return Gi;uo=1;var n=Qa(),e=nr(),r=Ir(),t=Or(),i=ae(),a=i("iterator");return Gi=function(s){if(!r(s))return e(s,a)||e(s,"@@iterator")||t[n(s)]},Gi}var $i,lo;function Sh(){if(lo)return $i;lo=1;var n=ne(),e=Fe(),r=le(),t=_r(),i=El(),a=TypeError;return $i=function(s,o){var u=arguments.length<2?i(s):o;if(e(u))return r(n(u,s));throw new a(t(s)+" is not iterable")},$i}var zi,ho;function Eh(){if(ho)return zi;ho=1;var n=ne(),e=le(),r=nr();return zi=function(t,i,a){var s,o;e(t);try{if(s=r(t,"return"),!s){if(i==="throw")throw a;return a}s=n(s,t)}catch(u){o=!0,s=u}if(i==="throw")throw a;if(o)throw s;return e(s),a},zi}var Hi,fo;function Rl(){if(fo)return Hi;fo=1;var n=Za(),e=ne(),r=le(),t=_r(),i=Th(),a=Xa(),s=Nr(),o=Sh(),u=El(),l=Eh(),h=TypeError,c=function(f,g){this.stopped=f,this.result=g},v=c.prototype;return Hi=function(f,g,d){var p=d&&d.that,y=!!(d&&d.AS_ENTRIES),m=!!(d&&d.IS_RECORD),b=!!(d&&d.IS_ITERATOR),x=!!(d&&d.INTERRUPTED),S=n(g,p),E,O,P,_,A,q,I,j=function(w){return E&&l(E,"normal"),new c(!0,w)},C=function(w){return y?(r(w),x?S(w[0],w[1],j):S(w[0],w[1])):x?S(w,j):S(w)};if(m)E=f.iterator;else if(b)E=f;else{if(O=u(f),!O)throw new h(t(f)+" is not iterable");if(i(O)){for(P=0,_=a(f);_>P;P++)if(A=C(f[P]),A&&s(v,A))return A;return new c(!1)}E=o(f,O)}for(q=m?f.next:E.next;!(I=e(q,E)).done;){try{A=C(I.value)}catch(w){l(E,"throw",w)}if(typeof A=="object"&&A&&s(v,A))return A}return new c(!1)},Hi}var Wi,co;function Rh(){if(co)return Wi;co=1;var n=ae(),e=n("iterator"),r=!1;try{var t=0,i={next:function(){return{done:!!t++}},return:function(){r=!0}};i[e]=function(){return this},Array.from(i,function(){throw 2})}catch{}return Wi=function(a,s){try{if(!s&&!r)return!1}catch{return!1}var o=!1;try{var u={};u[e]=function(){return{next:function(){return{done:o=!0}}}},a(u)}catch{}return o},Wi}var Yi,vo;function Cl(){if(vo)return Yi;vo=1;var n=mr(),e=Rh(),r=br().CONSTRUCTOR;return Yi=r||!e(function(t){n.all(t).then(void 0,function(){})}),Yi}var go;function Ch(){if(go)return no;go=1;var n=he(),e=ne(),r=Fe(),t=xr(),i=Ja(),a=Rl(),s=Cl();return n({target:"Promise",stat:!0,forced:s},{all:function(u){var l=this,h=t.f(l),c=h.resolve,v=h.reject,f=i(function(){var g=r(l.resolve),d=[],p=0,y=1;a(u,function(m){var b=p++,x=!1;y++,e(g,l,m).then(function(S){x||(x=!0,d[b]=S,--y||c(d))},v)}),--y||c(d)});return f.error&&v(f.value),h.promise}}),no}var po={},yo;function wh(){if(yo)return po;yo=1;var n=he(),e=Me(),r=br().CONSTRUCTOR,t=mr(),i=rr(),a=re(),s=tr(),o=t&&t.prototype;if(n({target:"Promise",proto:!0,forced:r,real:!0},{catch:function(l){return this.then(void 0,l)}}),!e&&a(t)){var u=i("Promise").prototype.catch;o.catch!==u&&s(o,"catch",u,{unsafe:!0})}return po}var mo={},bo;function Ph(){if(bo)return mo;bo=1;var n=he(),e=ne(),r=Fe(),t=xr(),i=Ja(),a=Rl(),s=Cl();return n({target:"Promise",stat:!0,forced:s},{race:function(u){var l=this,h=t.f(l),c=h.reject,v=i(function(){var f=r(l.resolve);a(u,function(g){e(f,l,g).then(h.resolve,c)})});return v.error&&c(v.value),h.promise}}),mo}var xo={},Oo;function Ah(){if(Oo)return xo;Oo=1;var n=he(),e=xr(),r=br().CONSTRUCTOR;return n({target:"Promise",stat:!0,forced:r},{reject:function(i){var a=e.f(this),s=a.reject;return s(i),a.promise}}),xo}var To={},Xi,So;function Ih(){if(So)return Xi;So=1;var n=le(),e=pe(),r=xr();return Xi=function(t,i){if(n(t),e(i)&&i.constructor===t)return i;var a=r.f(t),s=a.resolve;return s(i),a.promise},Xi}var Eo;function Nh(){if(Eo)return To;Eo=1;var n=he(),e=rr(),r=Me(),t=mr(),i=br().CONSTRUCTOR,a=Ih(),s=e("Promise"),o=r&&!i;return n({target:"Promise",stat:!0,forced:r||i},{resolve:function(l){return a(o&&this===s?t:this,l)}}),To}var Ro;function _h(){return Ro||(Ro=1,Oh(),Ch(),wh(),Ph(),Ah(),Nh()),fn}_h();function Co(n,e,r,t,i,a,s){try{var o=n[a](s),u=o.value}catch(l){return void r(l)}o.done?e(u):Promise.resolve(u).then(t,i)}function Be(n){return function(){var e=this,r=arguments;return new Promise(function(t,i){var a=n.apply(e,r);function s(u){Co(a,t,i,s,o,"next",u)}function o(u){Co(a,t,i,s,o,"throw",u)}s(void 0)})}}var wo={},Po={},Ki,Ao;function qe(){if(Ao)return Ki;Ao=1;var n=Qa(),e=String;return Ki=function(r){if(n(r)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return e(r)},Ki}var Qi,Io;function wl(){if(Io)return Qi;Io=1;var n=le();return Qi=function(){var e=n(this),r="";return e.hasIndices&&(r+="d"),e.global&&(r+="g"),e.ignoreCase&&(r+="i"),e.multiline&&(r+="m"),e.dotAll&&(r+="s"),e.unicode&&(r+="u"),e.unicodeSets&&(r+="v"),e.sticky&&(r+="y"),r},Qi}var Zi,No;function Pl(){if(No)return Zi;No=1;var n=Z(),e=Q(),r=e.RegExp,t=n(function(){var s=r("a","y");return s.lastIndex=2,s.exec("abcd")!==null}),i=t||n(function(){return!r("a","y").sticky}),a=t||n(function(){var s=r("^r","gy");return s.lastIndex=2,s.exec("str")!==null});return Zi={BROKEN_CARET:a,MISSED_STICKY:i,UNSUPPORTED_Y:t},Zi}var Ji={},ea,_o;function Mh(){if(_o)return ea;_o=1;var n=gl(),e=Ka();return ea=Object.keys||function(t){return n(t,e)},ea}var Mo;function qh(){if(Mo)return Ji;Mo=1;var n=we(),e=fl(),r=Ye(),t=le(),i=dr(),a=Mh();return Ji.f=n&&!e?Object.defineProperties:function(o,u){t(o);for(var l=i(u),h=a(u),c=h.length,v=0,f;c>v;)r.f(o,f=h[v++],l[f]);return o},Ji}var ra,qo;function Ur(){if(qo)return ra;qo=1;var n=le(),e=qh(),r=Ka(),t=Ya(),i=xl(),a=qr(),s=Wa(),o=">",u="<",l="prototype",h="script",c=s("IE_PROTO"),v=function(){},f=function(m){return u+h+o+m+u+"/"+h+o},g=function(m){m.write(f("")),m.close();var b=m.parentWindow.Object;return m=null,b},d=function(){var m=a("iframe"),b="java"+h+":",x;return m.style.display="none",i.appendChild(m),m.src=String(b),x=m.contentWindow.document,x.open(),x.write(f("document.F=Object")),x.close(),x.F},p,y=function(){try{p=new ActiveXObject("htmlfile")}catch{}y=typeof document<"u"?document.domain&&p?g(p):d():g(p);for(var m=r.length;m--;)delete y[l][r[m]];return y()};return t[c]=!0,ra=Object.create||function(b,x){var S;return b!==null?(v[l]=n(b),S=new v,v[l]=null,S[c]=b):S=y(),x===void 0?S:e.f(S,x)},ra}var ta,Do;function Dh(){if(Do)return ta;Do=1;var n=Z(),e=Q(),r=e.RegExp;return ta=n(function(){var t=r(".","s");return!(t.dotAll&&t.test(`
2
2
  `)&&t.flags==="s")}),ta}var ia,Vo;function Vh(){if(Vo)return ia;Vo=1;var n=Z(),e=Q(),r=e.RegExp;return ia=n(function(){var t=r("(?<a>b)","g");return t.exec("b").groups.a!=="b"||"b".replace(t,"$<a>c")!=="bc"}),ia}var aa,Lo;function en(){if(Lo)return aa;Lo=1;var n=ne(),e=J(),r=qe(),t=wl(),i=Pl(),a=za(),s=Ur(),o=Lr().get,u=Dh(),l=Vh(),h=a("native-string-replace",String.prototype.replace),c=RegExp.prototype.exec,v=c,f=e("".charAt),g=e("".indexOf),d=e("".replace),p=e("".slice),y=(function(){var S=/a/,E=/b*/g;return n(c,S,"a"),n(c,E,"a"),S.lastIndex!==0||E.lastIndex!==0})(),m=i.BROKEN_CARET,b=/()??/.exec("")[1]!==void 0,x=y||b||m||u||l;return x&&(v=function(E){var O=this,P=o(O),_=r(E),A=P.raw,q,I,j,C,w,U,L;if(A)return A.lastIndex=O.lastIndex,q=n(v,A,_),O.lastIndex=A.lastIndex,q;var V=P.groups,M=m&&O.sticky,N=n(t,O),k=O.source,z=0,H=_;if(M&&(N=d(N,"y",""),g(N,"g")===-1&&(N+="g"),H=p(_,O.lastIndex),O.lastIndex>0&&(!O.multiline||O.multiline&&f(_,O.lastIndex-1)!==`
3
3
  `)&&(k="(?: "+k+")",H=" "+H,z++),I=new RegExp("^(?:"+k+")",N)),b&&(I=new RegExp("^"+k+"$(?!\\s)",N)),y&&(j=O.lastIndex),C=n(c,M?I:O,H),M?C?(C.input=p(C.input,z),C[0]=p(C[0],z),C.index=O.lastIndex,O.lastIndex+=C[0].length):O.lastIndex=0:y&&C&&(O.lastIndex=O.global?C.index+C[0].length:j),b&&C&&C.length>1&&n(h,C[0],I,function(){for(w=1;w<arguments.length-2;w++)arguments[w]===void 0&&(C[w]=void 0)}),C&&V)for(C.groups=U=s(null),w=0;w<V.length;w++)L=V[w],U[L[0]]=C[L[1]];return C}),aa=v,aa}var ko;function Lh(){if(ko)return Po;ko=1;var n=he(),e=en();return n({target:"RegExp",proto:!0,forced:/./.exec!==e},{exec:e}),Po}var na,jo;function rn(){if(jo)return na;jo=1,Lh();var n=ne(),e=tr(),r=en(),t=Z(),i=ae(),a=yr(),s=i("species"),o=RegExp.prototype;return na=function(u,l,h,c){var v=i(u),f=!t(function(){var y={};return y[v]=function(){return 7},""[u](y)!==7}),g=f&&!t(function(){var y=!1,m=/a/;if(u==="split"){var b={};b[s]=function(){return m},m={constructor:b,flags:""},m[v]=/./[v]}return m.exec=function(){return y=!0,null},m[v](""),!y});if(!f||!g||h){var d=/./[v],p=l(v,""[u],function(y,m,b,x,S){var E=m.exec;return E===r||E===o.exec?f&&!S?{done:!0,value:n(d,m,b,x)}:{done:!0,value:n(y,b,m,x)}:{done:!1}});e(String.prototype,u,p[0]),e(o,v,p[1])}c&&a(o[v],"sham",!0)},na}var sa,Bo;function kh(){if(Bo)return sa;Bo=1;var n=J(),e=kr(),r=qe(),t=Pe(),i=n("".charAt),a=n("".charCodeAt),s=n("".slice),o=function(u){return function(l,h){var c=r(t(l)),v=e(h),f=c.length,g,d;return v<0||v>=f?u?"":void 0:(g=a(c,v),g<55296||g>56319||v+1===f||(d=a(c,v+1))<56320||d>57343?u?i(c,v):g:u?s(c,v,v+2):(g-55296<<10)+(d-56320)+65536)}};return sa={codeAt:o(!1),charAt:o(!0)},sa}var oa,Fo;function tn(){if(Fo)return oa;Fo=1;var n=kh().charAt;return oa=function(e,r,t){return r+(t?n(e,r).length:1)},oa}var ua,Uo;function jh(){if(Uo)return ua;Uo=1;var n=Q(),e=Z(),r=n.RegExp,t=!e(function(){var i=!0;try{r(".","d")}catch{i=!1}var a={},s="",o=i?"dgimsy":"gimsy",u=function(v,f){Object.defineProperty(a,v,{get:function(){return s+=f,!0}})},l={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};i&&(l.hasIndices="d");for(var h in l)u(h,l[h]);var c=Object.getOwnPropertyDescriptor(r.prototype,"flags").get.call(a);return c!==o||s!==o});return ua={correct:t},ua}var la,Go;function an(){if(Go)return la;Go=1;var n=ne(),e=Ae(),r=Nr(),t=jh(),i=wl(),a=RegExp.prototype;return la=t.correct?function(s){return s.flags}:function(s){return!t.correct&&r(a,s)&&!e(s,"flags")?n(i,s):s.flags},la}var ha,$o;function nn(){if($o)return ha;$o=1;var n=ne(),e=le(),r=re(),t=er(),i=en(),a=TypeError;return ha=function(s,o){var u=s.exec;if(r(u)){var l=n(u,s,o);return l!==null&&e(l),l}if(t(s)==="RegExp")return n(i,s,o);throw new a("RegExp#exec called on incompatible receiver")},ha}var zo;function Bh(){if(zo)return wo;zo=1;var n=ne(),e=J(),r=rn(),t=le(),i=pe(),a=sr(),s=qe(),o=Pe(),u=nr(),l=tn(),h=an(),c=nn(),v=e("".indexOf);return r("match",function(f,g,d){return[function(y){var m=o(this),b=i(y)?u(y,f):void 0;return b?n(b,y,m):new RegExp(y)[f](s(m))},function(p){var y=t(this),m=s(p),b=d(g,y,m);if(b.done)return b.value;var x=s(h(y));if(v(x,"g")===-1)return c(y,m);var S=v(x,"u")!==-1;y.lastIndex=0;for(var E=[],O=0,P;(P=c(y,m))!==null;){var _=s(P[0]);E[O]=_,_===""&&(y.lastIndex=l(m,a(y.lastIndex),S)),O++}return O===0?null:E}]}),wo}Bh();var Ho={},fa,Wo;function Fh(){if(Wo)return fa;Wo=1;var n=J(),e=Mr(),r=Math.floor,t=n("".charAt),i=n("".replace),a=n("".slice),s=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,o=/\$([$&'`]|\d{1,2})/g;return fa=function(u,l,h,c,v,f){var g=h+u.length,d=c.length,p=o;return v!==void 0&&(v=e(v),p=s),i(f,p,function(y,m){var b;switch(t(m,0)){case"$":return"$";case"&":return u;case"`":return a(l,0,h);case"'":return a(l,g);case"<":b=v[a(m,1,-1)];break;default:var x=+m;if(x===0)return y;if(x>d){var S=r(x/10);return S===0?y:S<=d?c[S-1]===void 0?t(m,1):c[S-1]+t(m,1):y}b=c[x-1]}return b===void 0?"":b})},fa}var Yo;function Uh(){if(Yo)return Ho;Yo=1;var n=bl(),e=ne(),r=J(),t=rn(),i=Z(),a=le(),s=re(),o=pe(),u=kr(),l=sr(),h=qe(),c=Pe(),v=tn(),f=nr(),g=Fh(),d=an(),p=nn(),y=ae(),m=y("replace"),b=Math.max,x=Math.min,S=r([].concat),E=r([].push),O=r("".indexOf),P=r("".slice),_=function(j){return j===void 0?j:String(j)},A=(function(){return"a".replace(/./,"$0")==="$0"})(),q=(function(){return/./[m]?/./[m]("a","$0")==="":!1})(),I=!i(function(){var j=/./;return j.exec=function(){var C=[];return C.groups={a:"7"},C},"".replace(j,"$<a>")!=="7"});return t("replace",function(j,C,w){var U=q?"$":"$0";return[function(V,M){var N=c(this),k=o(V)?f(V,m):void 0;return k?e(k,V,N,M):e(C,h(N),V,M)},function(L,V){var M=a(this),N=h(L);if(typeof V=="string"&&O(V,U)===-1&&O(V,"$<")===-1){var k=w(C,M,N,V);if(k.done)return k.value}var z=s(V);z||(V=h(V));var H=h(d(M)),X=O(H,"g")!==-1,se;X&&(se=O(H,"u")!==-1,M.lastIndex=0);for(var be=[],oe;oe=p(M,N),!(oe===null||(E(be,oe),!X));){var Ue=h(oe[0]);Ue===""&&(M.lastIndex=v(N,l(M.lastIndex),se))}for(var Ge="",fe=0,Ne=0;Ne<be.length;Ne++){oe=be[Ne];for(var _e=h(oe[0]),me=b(x(u(oe.index),N.length),0),ce=[],xe,De=1;De<oe.length;De++)E(ce,_(oe[De]));var Ve=oe.groups;if(z){var Xe=S([_e],ce,me,N);Ve!==void 0&&E(Xe,Ve),xe=h(n(V,void 0,Xe))}else xe=g(_e,N,me,ce,Ve,V);me>=fe&&(Ge+=P(N,fe,me)+xe,fe=me+_e.length)}return Ge+P(N,fe)}]},!I||!A||q),Ho}Uh();var Xo={},ca,Ko;function Gh(){if(Ko)return ca;Ko=1;var n=pe(),e=er(),r=ae(),t=r("match");return ca=function(i){var a;return n(i)&&((a=i[t])!==void 0?!!a:e(i)==="RegExp")},ca}var va,Qo;function sn(){if(Qo)return va;Qo=1;var n=Gh(),e=TypeError;return va=function(r){if(n(r))throw new e("The method doesn't accept regular expressions");return r},va}var ga,Zo;function on(){if(Zo)return ga;Zo=1;var n=ae(),e=n("match");return ga=function(r){var t=/./;try{"/./"[r](t)}catch{try{return t[e]=!1,"/./"[r](t)}catch{}}return!1},ga}var Jo;function $h(){if(Jo)return Xo;Jo=1;var n=he(),e=Fr(),r=Dr().f,t=sr(),i=qe(),a=sn(),s=Pe(),o=on(),u=Me(),l=e("".slice),h=Math.min,c=o("startsWith"),v=!u&&!c&&!!(function(){var f=r(String.prototype,"startsWith");return f&&!f.writable})();return n({target:"String",proto:!0,forced:!v&&!c},{startsWith:function(g){var d=i(s(this));a(g);var p=t(h(arguments.length>1?arguments[1]:void 0,d.length)),y=i(g);return l(d,p,p+y.length)===y}}),Xo}$h();var da,eu;function zh(){if(eu)return da;eu=1;var n=ae(),e=Ur(),r=Ye().f,t=n("unscopables"),i=Array.prototype;return i[t]===void 0&&r(i,t,{configurable:!0,value:e(null)}),da=function(a){i[t][a]=!0},da}var pa,ru;function Hh(){if(ru)return pa;ru=1;var n=Z();return pa=!n(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),pa}var ya,tu;function Al(){if(tu)return ya;tu=1;var n=Ae(),e=re(),r=Mr(),t=Wa(),i=Hh(),a=t("IE_PROTO"),s=Object,o=s.prototype;return ya=i?s.getPrototypeOf:function(u){var l=r(u);if(n(l,a))return l[a];var h=l.constructor;return e(h)&&l instanceof h?h.prototype:l instanceof s?o:null},ya}var ma,iu;function Il(){if(iu)return ma;iu=1;var n=Z(),e=re(),r=pe(),t=Ur(),i=Al(),a=tr(),s=ae(),o=Me(),u=s("iterator"),l=!1,h,c,v;[].keys&&(v=[].keys(),"next"in v?(c=i(i(v)),c!==Object.prototype&&(h=c)):l=!0);var f=!r(h)||n(function(){var g={};return h[u].call(g)!==g});return f?h={}:o&&(h=t(h)),e(h[u])||a(h,u,function(){return this}),ma={IteratorPrototype:h,BUGGY_SAFARI_ITERATORS:l},ma}var ba,au;function Wh(){if(au)return ba;au=1;var n=Il().IteratorPrototype,e=Ur(),r=Fa(),t=Br(),i=Or(),a=function(){return this};return ba=function(s,o,u,l){var h=o+" Iterator";return s.prototype=e(n,{next:r(+!l,u)}),t(s,h,!1,!0),i[h]=a,s},ba}var xa,nu;function Yh(){if(nu)return xa;nu=1;var n=he(),e=ne(),r=Me(),t=Vr(),i=re(),a=Wh(),s=Al(),o=yl(),u=Br(),l=yr(),h=tr(),c=ae(),v=Or(),f=Il(),g=t.PROPER,d=t.CONFIGURABLE,p=f.IteratorPrototype,y=f.BUGGY_SAFARI_ITERATORS,m=c("iterator"),b="keys",x="values",S="entries",E=function(){return this};return xa=function(O,P,_,A,q,I,j){a(_,P,A);var C=function(X){if(X===q&&M)return M;if(!y&&X&&X in L)return L[X];switch(X){case b:return function(){return new _(this,X)};case x:return function(){return new _(this,X)};case S:return function(){return new _(this,X)}}return function(){return new _(this)}},w=P+" Iterator",U=!1,L=O.prototype,V=L[m]||L["@@iterator"]||q&&L[q],M=!y&&V||C(q),N=P==="Array"&&L.entries||V,k,z,H;if(N&&(k=s(N.call(new O)),k!==Object.prototype&&k.next&&(!r&&s(k)!==p&&(o?o(k,p):i(k[m])||h(k,m,E)),u(k,w,!0,!0),r&&(v[w]=E))),g&&q===x&&V&&V.name!==x&&(!r&&d?l(L,"name",x):(U=!0,M=function(){return e(V,this)})),q)if(z={values:C(x),keys:I?M:C(b),entries:C(S)},j)for(H in z)(y||U||!(H in L))&&h(L,H,z[H]);else n({target:P,proto:!0,forced:y||U},z);return(!r||j)&&L[m]!==M&&h(L,m,M,{name:q}),v[P]=M,z},xa}var Oa,su;function Xh(){return su||(su=1,Oa=function(n,e){return{value:n,done:e}}),Oa}var Ta,ou;function Nl(){if(ou)return Ta;ou=1;var n=dr(),e=zh(),r=Or(),t=Lr(),i=Ye().f,a=Yh(),s=Xh(),o=Me(),u=we(),l="Array Iterator",h=t.set,c=t.getterFor(l);Ta=a(Array,"Array",function(f,g){h(this,{type:l,target:n(f),index:0,kind:g})},function(){var f=c(this),g=f.target,d=f.index++;if(!g||d>=g.length)return f.target=null,s(void 0,!0);switch(f.kind){case"keys":return s(d,!1);case"values":return s(g[d],!1)}return s([d,g[d]],!1)},"values");var v=r.Arguments=r.Array;if(e("keys"),e("values"),e("entries"),!o&&u&&v.name!=="values")try{i(v,"name",{value:"values"})}catch{}return Ta}Nl();var uu={},Sa,lu;function Kh(){return lu||(lu=1,Sa={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}),Sa}var Ea,hu;function Qh(){if(hu)return Ea;hu=1;var n=qr(),e=n("span").classList,r=e&&e.constructor&&e.constructor.prototype;return Ea=r===Object.prototype?void 0:r,Ea}var fu;function Zh(){if(fu)return uu;fu=1;var n=Q(),e=Kh(),r=Qh(),t=Nl(),i=yr(),a=Br(),s=ae(),o=s("iterator"),u=t.values,l=function(c,v){if(c){if(c[o]!==u)try{i(c,o,u)}catch{c[o]=u}if(a(c,v,!0),e[v]){for(var f in t)if(c[f]!==t[f])try{i(c,f,t[f])}catch{c[f]=t[f]}}}};for(var h in e)l(n[h]&&n[h].prototype,h);return l(r,"DOMTokenList"),uu}Zh();function Jh(n,e){if(Va(n)!="object"||!n)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var t=r.call(n,e);if(Va(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function ef(n){var e=Jh(n,"string");return Va(e)=="symbol"?e:e+""}function un(n,e,r){return(e=ef(e))in n?Object.defineProperty(n,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[e]=r,n}var cu={},Ra,vu;function rf(){if(vu)return Ra;vu=1;var n=Fe(),e=Mr(),r=al(),t=Xa(),i=TypeError,a="Reduce of empty array with no initial value",s=function(o){return function(u,l,h,c){var v=e(u),f=r(v),g=t(v);if(n(l),g===0&&h<2)throw new i(a);var d=o?g-1:0,p=o?-1:1;if(h<2)for(;;){if(d in f){c=f[d],d+=p;break}if(d+=p,o?d<0:g<=d)throw new i(a)}for(;o?d>=0:g>d;d+=p)d in f&&(c=l(c,f[d],d,v));return c}};return Ra={left:s(!1),right:s(!0)},Ra}var Ca,gu;function _l(){if(gu)return Ca;gu=1;var n=Z();return Ca=function(e,r){var t=[][e];return!!t&&n(function(){t.call(null,r||function(){return 1},1)})},Ca}var du;function tf(){if(du)return cu;du=1;var n=he(),e=rf().left,r=_l(),t=Ua(),i=jr(),a=!i&&t>79&&t<83,s=a||!r("reduce");return n({target:"Array",proto:!0,forced:s},{reduce:function(u){var l=arguments.length;return e(this,u,l,l>1?arguments[1]:void 0)}}),cu}tf();var pu={},yu;function af(){if(yu)return pu;yu=1;var n=he(),e=Fr(),r=Dr().f,t=sr(),i=qe(),a=sn(),s=Pe(),o=on(),u=Me(),l=e("".slice),h=Math.min,c=o("endsWith"),v=!u&&!c&&!!(function(){var f=r(String.prototype,"endsWith");return f&&!f.writable})();return n({target:"String",proto:!0,forced:!v&&!c},{endsWith:function(g){var d=i(s(this));a(g);var p=arguments.length>1?arguments[1]:void 0,y=d.length,m=p===void 0?y:h(t(p),y),b=i(g);return l(d,m-b.length,m)===b}}),pu}af();var mu={},bu;function nf(){if(bu)return mu;bu=1;var n=ne(),e=J(),r=rn(),t=le(),i=pe(),a=Pe(),s=ml(),o=tn(),u=sr(),l=qe(),h=nr(),c=nn(),v=Pl(),f=Z(),g=v.UNSUPPORTED_Y,d=4294967295,p=Math.min,y=e([].push),m=e("".slice),b=!f(function(){var S=/(?:)/,E=S.exec;S.exec=function(){return E.apply(this,arguments)};var O="ab".split(S);return O.length!==2||O[0]!=="a"||O[1]!=="b"}),x="abbc".split(/(b)*/)[1]==="c"||"test".split(/(?:)/,-1).length!==4||"ab".split(/(?:ab)*/).length!==2||".".split(/(.?)(.?)/).length!==4||".".split(/()()/).length>1||"".split(/.?/).length;return r("split",function(S,E,O){var P="0".split(void 0,0).length?function(_,A){return _===void 0&&A===0?[]:n(E,this,_,A)}:E;return[function(A,q){var I=a(this),j=i(A)?h(A,S):void 0;return j?n(j,A,I,q):n(P,l(I),A,q)},function(_,A){var q=t(this),I=l(_);if(!x){var j=O(P,q,I,A,P!==E);if(j.done)return j.value}var C=s(q,RegExp),w=q.unicode,U=(q.ignoreCase?"i":"")+(q.multiline?"m":"")+(q.unicode?"u":"")+(g?"g":"y"),L=new C(g?"^(?:"+q.source+")":q,U),V=A===void 0?d:A>>>0;if(V===0)return[];if(I.length===0)return c(L,I)===null?[I]:[];for(var M=0,N=0,k=[];N<I.length;){L.lastIndex=g?0:N;var z=c(L,g?m(I,N):I),H;if(z===null||(H=p(u(L.lastIndex+(g?N:0)),I.length))===M)N=o(I,N,w);else{if(y(k,m(I,M,N)),k.length===V)return k;for(var X=1;X<=z.length-1;X++)if(y(k,z[X]),k.length===V)return k;N=M=H}}return y(k,m(I,M)),k}]},x||!b,g),mu}nf();var vr={exports:{}},Ze={exports:{}},sf=Ze.exports,xu;function of(){return xu||(xu=1,(function(){var n,e,r,t,i,a;typeof performance<"u"&&performance!==null&&performance.now?Ze.exports=function(){return performance.now()}:typeof process<"u"&&process!==null&&process.hrtime?(Ze.exports=function(){return(n()-i)/1e6},e=process.hrtime,n=function(){var s;return s=e(),s[0]*1e9+s[1]},t=n(),a=process.uptime()*1e9,i=t-a):Date.now?(Ze.exports=function(){return Date.now()-r},r=Date.now()):(Ze.exports=function(){return new Date().getTime()-r},r=new Date().getTime())}).call(sf)),Ze.exports}var Ou;function uf(){if(Ou)return vr.exports;Ou=1;for(var n=of(),e=typeof window>"u"?Da:window,r=["moz","webkit"],t="AnimationFrame",i=e["request"+t],a=e["cancel"+t]||e["cancelRequest"+t],s=0;!i&&s<r.length;s++)i=e[r[s]+"Request"+t],a=e[r[s]+"Cancel"+t]||e[r[s]+"CancelRequest"+t];if(!i||!a){var o=0,u=0,l=[],h=1e3/60;i=function(c){if(l.length===0){var v=n(),f=Math.max(0,h-(v-o));o=f+v,setTimeout(function(){var g=l.slice(0);l.length=0;for(var d=0;d<g.length;d++)if(!g[d].cancelled)try{g[d].callback(o)}catch(p){setTimeout(function(){throw p},0)}},Math.round(f))}return l.push({handle:++u,callback:c,cancelled:!1}),u},a=function(c){for(var v=0;v<l.length;v++)l[v].handle===c&&(l[v].cancelled=!0)}}return vr.exports=function(c){return i.call(e,c)},vr.exports.cancel=function(){a.apply(e,arguments)},vr.exports.polyfill=function(c){c||(c=e),c.requestAnimationFrame=i,c.cancelAnimationFrame=a},vr.exports}var lf=uf();const wa=il(lf);var Tu={},Pa,Su;function Ml(){return Su||(Su=1,Pa=`
4
4
  \v\f\r                 \u2028\u2029\uFEFF`),Pa}var Aa,Eu;function hf(){if(Eu)return Aa;Eu=1;var n=J(),e=Pe(),r=qe(),t=Ml(),i=n("".replace),a=RegExp("^["+t+"]+"),s=RegExp("(^|[^"+t+"])["+t+"]+$"),o=function(u){return function(l){var h=r(e(l));return u&1&&(h=i(h,a,"")),u&2&&(h=i(h,s,"$1")),h}};return Aa={start:o(1),end:o(2),trim:o(3)},Aa}var Ia,Ru;function ff(){if(Ru)return Ia;Ru=1;var n=Vr().PROPER,e=Z(),r=Ml(),t="​…᠎";return Ia=function(i){return e(function(){return!!r[i]()||t[i]()!==t||n&&r[i].name!==i})},Ia}var Cu;function cf(){if(Cu)return Tu;Cu=1;var n=he(),e=hf().trim,r=ff();return n({target:"String",proto:!0,forced:r("trim")},{trim:function(){return e(this)}}),Tu}cf();var Na,wu;function vf(){return wu||(wu=1,Na=function(n){this.ok=!1,this.alpha=1,n.charAt(0)=="#"&&(n=n.substr(1,6)),n=n.replace(/ /g,""),n=n.toLowerCase();var e={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};n=e[n]||n;for(var r=[{re:/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*((?:\d?\.)?\d)\)$/,example:["rgba(123, 234, 45, 0.8)","rgba(255,234,245,1.0)"],process:function(u){return[parseInt(u[1]),parseInt(u[2]),parseInt(u[3]),parseFloat(u[4])]}},{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(u){return[parseInt(u[1]),parseInt(u[2]),parseInt(u[3])]}},{re:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,example:["#00ff00","336699"],process:function(u){return[parseInt(u[1],16),parseInt(u[2],16),parseInt(u[3],16)]}},{re:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,example:["#fb0","f0f"],process:function(u){return[parseInt(u[1]+u[1],16),parseInt(u[2]+u[2],16),parseInt(u[3]+u[3],16)]}}],t=0;t<r.length;t++){var i=r[t].re,a=r[t].process,s=i.exec(n);if(s){var o=a(s);this.r=o[0],this.g=o[1],this.b=o[2],o.length>3&&(this.alpha=o[3]),this.ok=!0}}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.alpha=this.alpha<0?0:this.alpha>1||isNaN(this.alpha)?1:this.alpha,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toRGBA=function(){return"rgba("+this.r+", "+this.g+", "+this.b+", "+this.alpha+")"},this.toHex=function(){var u=this.r.toString(16),l=this.g.toString(16),h=this.b.toString(16);return u.length==1&&(u="0"+u),l.length==1&&(l="0"+l),h.length==1&&(h="0"+h),"#"+u+l+h},this.getHelpXML=function(){for(var u=new Array,l=0;l<r.length;l++)for(var h=r[l].example,c=0;c<h.length;c++)u[u.length]=h[c];for(var v in e)u[u.length]=v;var f=document.createElement("ul");f.setAttribute("id","rgbcolor-examples");for(var l=0;l<u.length;l++)try{var g=document.createElement("li"),d=new RGBColor(u[l]),p=document.createElement("div");p.style.cssText="margin: 3px; border: 1px solid black; background:"+d.toHex()+"; color:"+d.toHex(),p.appendChild(document.createTextNode("test"));var y=document.createTextNode(" "+u[l]+" -> "+d.toRGB()+" -> "+d.toHex());g.appendChild(p),g.appendChild(y),f.appendChild(g)}catch{}return f}}),Na}var gf=vf();const La=il(gf);var Pu={},Au;function df(){if(Au)return Pu;Au=1;var n=he(),e=Fr(),r=vl().indexOf,t=_l(),i=e([].indexOf),a=!!i&&1/i([1],1,-0)<0,s=a||!t("indexOf");return n({target:"Array",proto:!0,forced:s},{indexOf:function(u){var l=arguments.length>1?arguments[1]:void 0;return a?i(this,u,l)||0:r(this,u,l)}}),Pu}df();var Iu={},Nu;function pf(){if(Nu)return Iu;Nu=1;var n=he(),e=J(),r=sn(),t=Pe(),i=qe(),a=on(),s=e("".indexOf);return n({target:"String",proto:!0,forced:!a("includes")},{includes:function(u){return!!~s(i(t(this)),i(r(u)),arguments.length>1?arguments[1]:void 0)}}),Iu}pf();var _u={},_a,Mu;function yf(){if(Mu)return _a;Mu=1;var n=er();return _a=Array.isArray||function(r){return n(r)==="Array"},_a}var qu;function mf(){if(qu)return _u;qu=1;var n=he(),e=J(),r=yf(),t=e([].reverse),i=[1,2];return n({target:"Array",proto:!0,forced:String(i)===String(i.reverse())},{reverse:function(){return r(this)&&(this.length=this.length),t(this)}}),_u}mf();var ql=function(n,e){return(ql=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])})(n,e)};function Dl(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}ql(n,e),n.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function bf(n){var e="";Array.isArray(n)||(n=[n]);for(var r=0;r<n.length;r++){var t=n[r];if(t.type===T.CLOSE_PATH)e+="z";else if(t.type===T.HORIZ_LINE_TO)e+=(t.relative?"h":"H")+t.x;else if(t.type===T.VERT_LINE_TO)e+=(t.relative?"v":"V")+t.y;else if(t.type===T.MOVE_TO)e+=(t.relative?"m":"M")+t.x+" "+t.y;else if(t.type===T.LINE_TO)e+=(t.relative?"l":"L")+t.x+" "+t.y;else if(t.type===T.CURVE_TO)e+=(t.relative?"c":"C")+t.x1+" "+t.y1+" "+t.x2+" "+t.y2+" "+t.x+" "+t.y;else if(t.type===T.SMOOTH_CURVE_TO)e+=(t.relative?"s":"S")+t.x2+" "+t.y2+" "+t.x+" "+t.y;else if(t.type===T.QUAD_TO)e+=(t.relative?"q":"Q")+t.x1+" "+t.y1+" "+t.x+" "+t.y;else if(t.type===T.SMOOTH_QUAD_TO)e+=(t.relative?"t":"T")+t.x+" "+t.y;else{if(t.type!==T.ARC)throw new Error('Unexpected command type "'+t.type+'" at index '+r+".");e+=(t.relative?"a":"A")+t.rX+" "+t.rY+" "+t.xRot+" "+ +t.lArcFlag+" "+ +t.sweepFlag+" "+t.x+" "+t.y}}return e}function ka(n,e){var r=n[0],t=n[1];return[r*Math.cos(e)-t*Math.sin(e),r*Math.sin(e)+t*Math.cos(e)]}function Ce(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];for(var r=0;r<n.length;r++)if(typeof n[r]!="number")throw new Error("assertNumbers arguments["+r+"] is not a number. "+typeof n[r]+" == typeof "+n[r]);return!0}var ze=Math.PI;function Ma(n,e,r){n.lArcFlag=n.lArcFlag===0?0:1,n.sweepFlag=n.sweepFlag===0?0:1;var t=n.rX,i=n.rY,a=n.x,s=n.y;t=Math.abs(n.rX),i=Math.abs(n.rY);var o=ka([(e-a)/2,(r-s)/2],-n.xRot/180*ze),u=o[0],l=o[1],h=Math.pow(u,2)/Math.pow(t,2)+Math.pow(l,2)/Math.pow(i,2);1<h&&(t*=Math.sqrt(h),i*=Math.sqrt(h)),n.rX=t,n.rY=i;var c=Math.pow(t,2)*Math.pow(l,2)+Math.pow(i,2)*Math.pow(u,2),v=(n.lArcFlag!==n.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(t,2)*Math.pow(i,2)-c)/c)),f=t*l/i*v,g=-i*u/t*v,d=ka([f,g],n.xRot/180*ze);n.cX=d[0]+(e+a)/2,n.cY=d[1]+(r+s)/2,n.phi1=Math.atan2((l-g)/i,(u-f)/t),n.phi2=Math.atan2((-l-g)/i,(-u-f)/t),n.sweepFlag===0&&n.phi2>n.phi1&&(n.phi2-=2*ze),n.sweepFlag===1&&n.phi2<n.phi1&&(n.phi2+=2*ze),n.phi1*=180/ze,n.phi2*=180/ze}function Du(n,e,r){Ce(n,e,r);var t=n*n+e*e-r*r;if(0>t)return[];if(t===0)return[[n*r/(n*n+e*e),e*r/(n*n+e*e)]];var i=Math.sqrt(t);return[[(n*r+e*i)/(n*n+e*e),(e*r-n*i)/(n*n+e*e)],[(n*r-e*i)/(n*n+e*e),(e*r+n*i)/(n*n+e*e)]]}var ie,ke=Math.PI/180;function Vu(n,e,r){return(1-r)*n+r*e}function Lu(n,e,r,t){return n+Math.cos(t/180*ze)*e+Math.sin(t/180*ze)*r}function ku(n,e,r,t){var i=1e-6,a=e-n,s=r-e,o=3*a+3*(t-r)-6*s,u=6*(s-a),l=3*a;return Math.abs(o)<i?[-l/u]:(function(h,c,v){var f=h*h/4-c;if(f<-v)return[];if(f<=v)return[-h/2];var g=Math.sqrt(f);return[-h/2-g,-h/2+g]})(u/o,l/o,i)}function ju(n,e,r,t,i){var a=1-i;return n*(a*a*a)+e*(3*a*a*i)+r*(3*a*i*i)+t*(i*i*i)}(function(n){function e(){return i((function(o,u,l){return o.relative&&(o.x1!==void 0&&(o.x1+=u),o.y1!==void 0&&(o.y1+=l),o.x2!==void 0&&(o.x2+=u),o.y2!==void 0&&(o.y2+=l),o.x!==void 0&&(o.x+=u),o.y!==void 0&&(o.y+=l),o.relative=!1),o}))}function r(){var o=NaN,u=NaN,l=NaN,h=NaN;return i((function(c,v,f){return c.type&T.SMOOTH_CURVE_TO&&(c.type=T.CURVE_TO,o=isNaN(o)?v:o,u=isNaN(u)?f:u,c.x1=c.relative?v-o:2*v-o,c.y1=c.relative?f-u:2*f-u),c.type&T.CURVE_TO?(o=c.relative?v+c.x2:c.x2,u=c.relative?f+c.y2:c.y2):(o=NaN,u=NaN),c.type&T.SMOOTH_QUAD_TO&&(c.type=T.QUAD_TO,l=isNaN(l)?v:l,h=isNaN(h)?f:h,c.x1=c.relative?v-l:2*v-l,c.y1=c.relative?f-h:2*f-h),c.type&T.QUAD_TO?(l=c.relative?v+c.x1:c.x1,h=c.relative?f+c.y1:c.y1):(l=NaN,h=NaN),c}))}function t(){var o=NaN,u=NaN;return i((function(l,h,c){if(l.type&T.SMOOTH_QUAD_TO&&(l.type=T.QUAD_TO,o=isNaN(o)?h:o,u=isNaN(u)?c:u,l.x1=l.relative?h-o:2*h-o,l.y1=l.relative?c-u:2*c-u),l.type&T.QUAD_TO){o=l.relative?h+l.x1:l.x1,u=l.relative?c+l.y1:l.y1;var v=l.x1,f=l.y1;l.type=T.CURVE_TO,l.x1=((l.relative?0:h)+2*v)/3,l.y1=((l.relative?0:c)+2*f)/3,l.x2=(l.x+2*v)/3,l.y2=(l.y+2*f)/3}else o=NaN,u=NaN;return l}))}function i(o){var u=0,l=0,h=NaN,c=NaN;return function(v){if(isNaN(h)&&!(v.type&T.MOVE_TO))throw new Error("path must start with moveto");var f=o(v,u,l,h,c);return v.type&T.CLOSE_PATH&&(u=h,l=c),v.x!==void 0&&(u=v.relative?u+v.x:v.x),v.y!==void 0&&(l=v.relative?l+v.y:v.y),v.type&T.MOVE_TO&&(h=u,c=l),f}}function a(o,u,l,h,c,v){return Ce(o,u,l,h,c,v),i((function(f,g,d,p){var y=f.x1,m=f.x2,b=f.relative&&!isNaN(p),x=f.x!==void 0?f.x:b?0:g,S=f.y!==void 0?f.y:b?0:d;function E(z){return z*z}f.type&T.HORIZ_LINE_TO&&u!==0&&(f.type=T.LINE_TO,f.y=f.relative?0:d),f.type&T.VERT_LINE_TO&&l!==0&&(f.type=T.LINE_TO,f.x=f.relative?0:g),f.x!==void 0&&(f.x=f.x*o+S*l+(b?0:c)),f.y!==void 0&&(f.y=x*u+f.y*h+(b?0:v)),f.x1!==void 0&&(f.x1=f.x1*o+f.y1*l+(b?0:c)),f.y1!==void 0&&(f.y1=y*u+f.y1*h+(b?0:v)),f.x2!==void 0&&(f.x2=f.x2*o+f.y2*l+(b?0:c)),f.y2!==void 0&&(f.y2=m*u+f.y2*h+(b?0:v));var O=o*h-u*l;if(f.xRot!==void 0&&(o!==1||u!==0||l!==0||h!==1))if(O===0)delete f.rX,delete f.rY,delete f.xRot,delete f.lArcFlag,delete f.sweepFlag,f.type=T.LINE_TO;else{var P=f.xRot*Math.PI/180,_=Math.sin(P),A=Math.cos(P),q=1/E(f.rX),I=1/E(f.rY),j=E(A)*q+E(_)*I,C=2*_*A*(q-I),w=E(_)*q+E(A)*I,U=j*h*h-C*u*h+w*u*u,L=C*(o*h+u*l)-2*(j*l*h+w*o*u),V=j*l*l-C*o*l+w*o*o,M=(Math.atan2(L,U-V)+Math.PI)%Math.PI/2,N=Math.sin(M),k=Math.cos(M);f.rX=Math.abs(O)/Math.sqrt(U*E(k)+L*N*k+V*E(N)),f.rY=Math.abs(O)/Math.sqrt(U*E(N)-L*N*k+V*E(k)),f.xRot=180*M/Math.PI}return f.sweepFlag!==void 0&&0>O&&(f.sweepFlag=+!f.sweepFlag),f}))}function s(){return function(o){var u={};for(var l in o)u[l]=o[l];return u}}n.ROUND=function(o){function u(l){return Math.round(l*o)/o}return o===void 0&&(o=1e13),Ce(o),function(l){return l.x1!==void 0&&(l.x1=u(l.x1)),l.y1!==void 0&&(l.y1=u(l.y1)),l.x2!==void 0&&(l.x2=u(l.x2)),l.y2!==void 0&&(l.y2=u(l.y2)),l.x!==void 0&&(l.x=u(l.x)),l.y!==void 0&&(l.y=u(l.y)),l.rX!==void 0&&(l.rX=u(l.rX)),l.rY!==void 0&&(l.rY=u(l.rY)),l}},n.TO_ABS=e,n.TO_REL=function(){return i((function(o,u,l){return o.relative||(o.x1!==void 0&&(o.x1-=u),o.y1!==void 0&&(o.y1-=l),o.x2!==void 0&&(o.x2-=u),o.y2!==void 0&&(o.y2-=l),o.x!==void 0&&(o.x-=u),o.y!==void 0&&(o.y-=l),o.relative=!0),o}))},n.NORMALIZE_HVZ=function(o,u,l){return o===void 0&&(o=!0),u===void 0&&(u=!0),l===void 0&&(l=!0),i((function(h,c,v,f,g){if(isNaN(f)&&!(h.type&T.MOVE_TO))throw new Error("path must start with moveto");return u&&h.type&T.HORIZ_LINE_TO&&(h.type=T.LINE_TO,h.y=h.relative?0:v),l&&h.type&T.VERT_LINE_TO&&(h.type=T.LINE_TO,h.x=h.relative?0:c),o&&h.type&T.CLOSE_PATH&&(h.type=T.LINE_TO,h.x=h.relative?f-c:f,h.y=h.relative?g-v:g),h.type&T.ARC&&(h.rX===0||h.rY===0)&&(h.type=T.LINE_TO,delete h.rX,delete h.rY,delete h.xRot,delete h.lArcFlag,delete h.sweepFlag),h}))},n.NORMALIZE_ST=r,n.QT_TO_C=t,n.INFO=i,n.SANITIZE=function(o){o===void 0&&(o=0),Ce(o);var u=NaN,l=NaN,h=NaN,c=NaN;return i((function(v,f,g,d,p){var y=Math.abs,m=!1,b=0,x=0;if(v.type&T.SMOOTH_CURVE_TO&&(b=isNaN(u)?0:f-u,x=isNaN(l)?0:g-l),v.type&(T.CURVE_TO|T.SMOOTH_CURVE_TO)?(u=v.relative?f+v.x2:v.x2,l=v.relative?g+v.y2:v.y2):(u=NaN,l=NaN),v.type&T.SMOOTH_QUAD_TO?(h=isNaN(h)?f:2*f-h,c=isNaN(c)?g:2*g-c):v.type&T.QUAD_TO?(h=v.relative?f+v.x1:v.x1,c=v.relative?g+v.y1:v.y2):(h=NaN,c=NaN),v.type&T.LINE_COMMANDS||v.type&T.ARC&&(v.rX===0||v.rY===0||!v.lArcFlag)||v.type&T.CURVE_TO||v.type&T.SMOOTH_CURVE_TO||v.type&T.QUAD_TO||v.type&T.SMOOTH_QUAD_TO){var S=v.x===void 0?0:v.relative?v.x:v.x-f,E=v.y===void 0?0:v.relative?v.y:v.y-g;b=isNaN(h)?v.x1===void 0?b:v.relative?v.x:v.x1-f:h-f,x=isNaN(c)?v.y1===void 0?x:v.relative?v.y:v.y1-g:c-g;var O=v.x2===void 0?0:v.relative?v.x:v.x2-f,P=v.y2===void 0?0:v.relative?v.y:v.y2-g;y(S)<=o&&y(E)<=o&&y(b)<=o&&y(x)<=o&&y(O)<=o&&y(P)<=o&&(m=!0)}return v.type&T.CLOSE_PATH&&y(f-d)<=o&&y(g-p)<=o&&(m=!0),m?[]:v}))},n.MATRIX=a,n.ROTATE=function(o,u,l){u===void 0&&(u=0),l===void 0&&(l=0),Ce(o,u,l);var h=Math.sin(o),c=Math.cos(o);return a(c,h,-h,c,u-u*c+l*h,l-u*h-l*c)},n.TRANSLATE=function(o,u){return u===void 0&&(u=0),Ce(o,u),a(1,0,0,1,o,u)},n.SCALE=function(o,u){return u===void 0&&(u=o),Ce(o,u),a(o,0,0,u,0,0)},n.SKEW_X=function(o){return Ce(o),a(1,0,Math.atan(o),1,0,0)},n.SKEW_Y=function(o){return Ce(o),a(1,Math.atan(o),0,1,0,0)},n.X_AXIS_SYMMETRY=function(o){return o===void 0&&(o=0),Ce(o),a(-1,0,0,1,o,0)},n.Y_AXIS_SYMMETRY=function(o){return o===void 0&&(o=0),Ce(o),a(1,0,0,-1,0,o)},n.A_TO_C=function(){return i((function(o,u,l){return T.ARC===o.type?(function(h,c,v){var f,g,d,p;h.cX||Ma(h,c,v);for(var y=Math.min(h.phi1,h.phi2),m=Math.max(h.phi1,h.phi2)-y,b=Math.ceil(m/90),x=new Array(b),S=c,E=v,O=0;O<b;O++){var P=Vu(h.phi1,h.phi2,O/b),_=Vu(h.phi1,h.phi2,(O+1)/b),A=_-P,q=4/3*Math.tan(A*ke/4),I=[Math.cos(P*ke)-q*Math.sin(P*ke),Math.sin(P*ke)+q*Math.cos(P*ke)],j=I[0],C=I[1],w=[Math.cos(_*ke),Math.sin(_*ke)],U=w[0],L=w[1],V=[U+q*Math.sin(_*ke),L-q*Math.cos(_*ke)],M=V[0],N=V[1];x[O]={relative:h.relative,type:T.CURVE_TO};var k=function(z,H){var X=ka([z*h.rX,H*h.rY],h.xRot),se=X[0],be=X[1];return[h.cX+se,h.cY+be]};f=k(j,C),x[O].x1=f[0],x[O].y1=f[1],g=k(M,N),x[O].x2=g[0],x[O].y2=g[1],d=k(U,L),x[O].x=d[0],x[O].y=d[1],h.relative&&(x[O].x1-=S,x[O].y1-=E,x[O].x2-=S,x[O].y2-=E,x[O].x-=S,x[O].y-=E),S=(p=[x[O].x,x[O].y])[0],E=p[1]}return x})(o,o.relative?0:u,o.relative?0:l):o}))},n.ANNOTATE_ARCS=function(){return i((function(o,u,l){return o.relative&&(u=0,l=0),T.ARC===o.type&&Ma(o,u,l),o}))},n.CLONE=s,n.CALCULATE_BOUNDS=function(){var o=function(v){var f={};for(var g in v)f[g]=v[g];return f},u=e(),l=t(),h=r(),c=i((function(v,f,g){var d=h(l(u(o(v))));function p(N){N>c.maxX&&(c.maxX=N),N<c.minX&&(c.minX=N)}function y(N){N>c.maxY&&(c.maxY=N),N<c.minY&&(c.minY=N)}if(d.type&T.DRAWING_COMMANDS&&(p(f),y(g)),d.type&T.HORIZ_LINE_TO&&p(d.x),d.type&T.VERT_LINE_TO&&y(d.y),d.type&T.LINE_TO&&(p(d.x),y(d.y)),d.type&T.CURVE_TO){p(d.x),y(d.y);for(var m=0,b=ku(f,d.x1,d.x2,d.x);m<b.length;m++)0<(M=b[m])&&1>M&&p(ju(f,d.x1,d.x2,d.x,M));for(var x=0,S=ku(g,d.y1,d.y2,d.y);x<S.length;x++)0<(M=S[x])&&1>M&&y(ju(g,d.y1,d.y2,d.y,M))}if(d.type&T.ARC){p(d.x),y(d.y),Ma(d,f,g);for(var E=d.xRot/180*Math.PI,O=Math.cos(E)*d.rX,P=Math.sin(E)*d.rX,_=-Math.sin(E)*d.rY,A=Math.cos(E)*d.rY,q=d.phi1<d.phi2?[d.phi1,d.phi2]:-180>d.phi2?[d.phi2+360,d.phi1+360]:[d.phi2,d.phi1],I=q[0],j=q[1],C=function(N){var k=N[0],z=N[1],H=180*Math.atan2(z,k)/Math.PI;return H<I?H+360:H},w=0,U=Du(_,-O,0).map(C);w<U.length;w++)(M=U[w])>I&&M<j&&p(Lu(d.cX,O,_,M));for(var L=0,V=Du(A,-P,0).map(C);L<V.length;L++){var M;(M=V[L])>I&&M<j&&y(Lu(d.cY,P,A,M))}}return v}));return c.minX=1/0,c.maxX=-1/0,c.minY=1/0,c.maxY=-1/0,c}})(ie||(ie={}));var Re,Vl=(function(){function n(){}return n.prototype.round=function(e){return this.transform(ie.ROUND(e))},n.prototype.toAbs=function(){return this.transform(ie.TO_ABS())},n.prototype.toRel=function(){return this.transform(ie.TO_REL())},n.prototype.normalizeHVZ=function(e,r,t){return this.transform(ie.NORMALIZE_HVZ(e,r,t))},n.prototype.normalizeST=function(){return this.transform(ie.NORMALIZE_ST())},n.prototype.qtToC=function(){return this.transform(ie.QT_TO_C())},n.prototype.aToC=function(){return this.transform(ie.A_TO_C())},n.prototype.sanitize=function(e){return this.transform(ie.SANITIZE(e))},n.prototype.translate=function(e,r){return this.transform(ie.TRANSLATE(e,r))},n.prototype.scale=function(e,r){return this.transform(ie.SCALE(e,r))},n.prototype.rotate=function(e,r,t){return this.transform(ie.ROTATE(e,r,t))},n.prototype.matrix=function(e,r,t,i,a,s){return this.transform(ie.MATRIX(e,r,t,i,a,s))},n.prototype.skewX=function(e){return this.transform(ie.SKEW_X(e))},n.prototype.skewY=function(e){return this.transform(ie.SKEW_Y(e))},n.prototype.xSymmetry=function(e){return this.transform(ie.X_AXIS_SYMMETRY(e))},n.prototype.ySymmetry=function(e){return this.transform(ie.Y_AXIS_SYMMETRY(e))},n.prototype.annotateArcs=function(){return this.transform(ie.ANNOTATE_ARCS())},n})(),xf=function(n){return n===" "||n===" "||n==="\r"||n===`
package/dist/index.html CHANGED
@@ -8,7 +8,7 @@
8
8
  }
9
9
  </style>
10
10
  <meta name="viewport" content="width=device-width, initial-scale=1" />
11
- <script type="module" crossorigin src="./assets/index-Dhxj876I.js"></script>
11
+ <script type="module" crossorigin src="./assets/index-otgIUTZs.js"></script>
12
12
  </head>
13
13
  <body>
14
14
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polotno-node",
3
- "version": "2.15.2",
3
+ "version": "2.15.4",
4
4
  "description": "Polotno workflow from NodeJS",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -22,7 +22,7 @@
22
22
  ],
23
23
  "browserslist": "> 0.5%, last 2 versions, not dead",
24
24
  "devDependencies": {
25
- "@polotno/video-export": "^0.0.7",
25
+ "@polotno/video-export": "^0.0.8",
26
26
  "axios": "^1.13.2",
27
27
  "dotenv": "^17.2.3",
28
28
  "fluent-ffmpeg": "^2.1.3",
@@ -33,14 +33,14 @@
33
33
  "polotno": "2.34.2",
34
34
  "react": "^18.3.1",
35
35
  "react-dom": "^18.3.1",
36
- "vite": "^7.3.0",
36
+ "vite": "^7.3.1",
37
37
  "vitest": "^4.0.16",
38
38
  "web-audio-api": "^0.2.2"
39
39
  },
40
40
  "author": "Anton Lavrenov",
41
41
  "license": "MIT",
42
42
  "dependencies": {
43
- "@sparticuz/chromium": "^143.0.0",
43
+ "@sparticuz/chromium": "^143.0.4",
44
44
  "puppeteer": "24.34.0",
45
45
  "puppeteer-core": "24.34.0",
46
46
  "tmp": "^0.2.5"