polotno-node 2.15.5 → 2.15.7
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.
- package/dist/assets/index-A296L9Ae.js +521 -0
- package/dist/assets/index-DUf3mRG9.js +65 -0
- package/dist/assets/{index.es-D1V6G-tI.js → index.es-DhuWYA8x.js} +1 -1
- package/dist/index.html +1 -1
- package/instance.js +0 -1
- package/package.json +7 -7
- package/dist/assets/index-A85RyHs4.js +0 -65
- package/dist/assets/index-B90zTBt3.js +0 -521
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import{A as $e,a as m,t as I,i as J,k as Le,b as _e,U as vt,R as St,p as D,l as q,c as _t,P as ee,g as xt,C as He,T as Qe,M as qe,d as te,e as kt,f as At,h as Pt,v as Mt,j as Ot,s as zt,m as Ft,n as Bt,o as It,q as Rt,r as ze,F as Fe,u as Ut,w as Wt,x as je,y as Vt,z as Nt,B as $t,D as Lt,E as Ht,G as Be,H as le,V as L,N as Qt,S as ce,I as j,J as be,K as ye,L as Ce,O as Ge,Q as qt,W as jt,X as Gt,Y as Kt,Z as Ke,_ as Xe,$ as Ye,a0 as re,a1 as Xt,a2 as z,a3 as Yt,a4 as Zt,a5 as Jt,a6 as Dt,a7 as es,a8 as ts,a9 as ss,aa as is,ab as rs,ac as ne,ad as oe,ae as ns,af as he}from"./index-A296L9Ae.js";class os{constructor(e){this.mutex=new $e,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 Ie=/<(?:(\d{2}):)?(\d{2}):(\d{2}).(\d{3})>/g,as=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 Re{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);m(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]]),Ze=t=>(R.setInt16(0,t,!1),[b[0],b[1]]),Je=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]]),$=t=>(R.setInt32(0,t,!1),[b[0],b[1],b[2],b[3]]),G=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]]),De=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()},A=(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},et=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]},tt=et(0),st=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),Je(s),i??[]],r),cs=t=>t.isQuickTime?T("ftyp",[A("qt "),l(512),A("qt ")]):t.fragmented?T("ftyp",[A("iso5"),l(512),A("iso5"),A("iso6"),A("mp41")]):T("ftyp",[A("isom"),l(512),A("isom"),t.holdsAvc?A("avc1"):[],A("mp41")]),ae=t=>({type:"mdat",largeSize:t}),us=t=>({type:"free",size:t}),ie=t=>T("moov",void 0,[ds(t.creationTime,t.trackDatas),...t.trackDatas.map(e=>ls(e,t.creationTime)),t.isFragmented?js(t.trackDatas):null,ni(t)]),ds=(t,e)=>{const s=x(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?G:l;return C("mvhd",+r,0,[n(t),n(t),l(Ee),n(s),W(1),De(1),Array(10).fill(0),st(tt),Array(24).fill(0),l(i)])},ls=(t,e)=>{const s=gi(t);return T("trak",void 0,[hs(t,e),fs(t,e),s.name!==void 0?T("udta",void 0,[T("name",[...I.encode(s.name)])]):null])},hs=(t,e)=>{const s=xe(t.samples),i=x(s?s.timestamp+s.duration:0,Ee),r=!J(e)||!J(i),n=r?G:l;let o;if(t.type==="video"){const u=t.track.metadata.rotation;o=et(u??0)}else o=tt;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),De(t.type==="audio"?1:0),w(0),st(o),W(t.type==="video"?t.info.width:0),W(t.type==="video"?t.info.height:0)])},fs=(t,e)=>T("mdia",void 0,[ms(t,e),ke(!0,ps[t.type],gs[t.type]),ws(t)]),ms=(t,e)=>{const s=xe(t.samples),i=x(s?s.timestamp+s.duration:0,t.timescale),r=!J(e)||!J(i),n=r?G:l;return C("mdhd",+r,0,[n(e),n(e),l(t.timescale),n(i),w(ot(t.track.metadata.languageCode??vt)),w(0)])},ps={video:"vide",audio:"soun",subtitle:"text"},gs={video:"MediabunnyVideoHandler",audio:"MediabunnySoundHandler",subtitle:"MediabunnyTextHandler"},ke=(t,e,s,i="\0\0\0\0")=>C("hdlr",0,0,[t?A("mhlr"):l(0),A(e),A(i),l(0),l(0),A(s,!0)]),ws=t=>T("minf",void 0,[Cs[t.type](),Es(),_s(t)]),Ts=()=>C("vmhd",0,1,[w(0),w(0),w(0),w(0)]),bs=()=>C("smhd",0,0,[w(0),w(0)]),ys=()=>C("nmhd",0,0),Cs={video:Ts,audio:bs,subtitle:ys},Es=()=>T("dinf",void 0,[vs()]),vs=()=>C("dref",0,0,[l(1)],[Ss()]),Ss=()=>C("url ",0,1),_s=t=>{const e=t.compositionTimeOffsetTable.length>1||t.compositionTimeOffsetTable.some(s=>s.sampleCompositionTimeOffset!==0);return T("stbl",void 0,[xs(t),Vs(t),e?Qs(t):null,e?qs(t):null,$s(t),Ls(t),Hs(t),Ns(t)])},xs=t=>{let e;if(t.type==="video")e=ks(ui(t.track.source._codec,t.info.decoderConfig.codec),t);else if(t.type==="audio"){const s=nt(t.track.source._codec,t.muxer.isQuickTime);m(s),e=zs(s,t)}else t.type==="subtitle"&&(e=Us(hi[t.track.source._codec],t));return m(e),C("stsd",0,0,[l(1)],[e])},ks=(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),Ze(65535)],[di[e.track.source._codec](e),_t(e.info.decoderConfig.colorSpace)?As(e):null]),As=t=>T("colr",[A("nclx"),w(He[t.info.decoderConfig.colorSpace.primaries]),w(Qe[t.info.decoderConfig.colorSpace.transfer]),w(qe[t.info.decoderConfig.colorSpace.matrix]),v((t.info.decoderConfig.colorSpace.fullRange?1:0)<<7)]),Ps=t=>t.info.decoderConfig&&T("avcC",[...te(t.info.decoderConfig.description)]),Ms=t=>t.info.decoderConfig&&T("hvcC",[...te(t.info.decoderConfig.description)]),Ue=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?He[e.colorSpace.primaries]:2,d=s[6]?Number(s[6]):e.colorSpace?.transfer?Qe[e.colorSpace.transfer]:2,p=s[7]?Number(s[7]):e.colorSpace?.matrix?qe[e.colorSpace.matrix]:2;return C("vpcC",1,0,[v(i),v(r),v(u),v(c),v(d),v(p),w(0)])},Os=t=>T("av1C",xt(t.info.decoderConfig.codec)),zs=(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,[li(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),...Je(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)},N=t=>T("wave",void 0,[Fs(t),Bs(t),T("\0\0\0\0")]),Fs=t=>T("frma",[A(nt(t.track.source._codec,t.muxer.isQuickTime))]),Bs=t=>{const{littleEndian:e}=D(t.track.source._codec);return T("enda",[w(+e)])},Is=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){m(a.byteLength>=18);const u=te(a),c=kt(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),Ze(r),v(n),...o])},Rs=t=>{const e=t.info.decoderConfig?.description;m(e);const s=te(e);return C("dfLa",0,0,[...s.subarray(4)])},F=t=>{const{littleEndian:e,sampleSize:s}=D(t.track.source._codec),i=+e;return C("pcmC",0,0,[v(i),v(8*s)])},Us=(t,e)=>T(t,[Array(6).fill(0),w(1)],[fi[e.track.source._codec](e)]),Ws=t=>T("vttC",[...I.encode(t.info.config.description)]),Vs=t=>C("stts",0,0,[l(t.timeToSampleTable.length),t.timeToSampleTable.map(e=>[l(e.sampleCount),l(e.sampleDelta)])]),Ns=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))])},$s=t=>C("stsc",0,0,[l(t.compactlyCodedChunkTable.length),t.compactlyCodedChunkTable.map(e=>[l(e.firstChunk),l(e.samplesPerChunk),l(1)])]),Ls=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+x(i.duration,t.timescale),0))])}return C("stsz",0,0,[l(0),l(t.samples.length),t.samples.map(e=>l(e.size))])},Hs=t=>t.finalizedChunks.length>0&&q(t.finalizedChunks).offset>=2**32?C("co64",0,0,[l(t.finalizedChunks.length),t.finalizedChunks.map(e=>G(e.offset))]):C("stco",0,0,[l(t.finalizedChunks.length),t.finalizedChunks.map(e=>l(e.offset))]),Qs=t=>C("ctts",1,0,[l(t.compositionTimeOffsetTable.length),t.compositionTimeOffsetTable.map(e=>[l(e.sampleCount),$(e.sampleCompositionTimeOffset)])]),qs=t=>{let e=1/0,s=-1/0,i=1/0,r=-1/0;m(t.compositionTimeOffsetTable.length>0),m(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,x(a.timestamp,t.timescale)),r=Math.max(r,x(a.timestamp+a.duration,t.timescale))}const n=Math.max(-e,0);return r>=2**31?null:C("cslg",0,0,[$(n),$(e),$(s),$(i),$(r)])},js=t=>T("mvex",void 0,t.map(Gs)),Gs=t=>C("trex",0,0,[l(t.track.id),l(1),l(0),l(0),l(0)]),We=(t,e)=>T("moof",void 0,[Ks(t),...e.map(Xs)]),Ks=t=>C("mfhd",0,0,[l(t)]),it=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},Xs=t=>T("traf",void 0,[Ys(t),Zs(t),Js(t)]),Ys=t=>{m(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:it(s)};return C("tfhd",0,e,[l(t.track.id),l(i.duration),l(i.size),l(i.flags)])},Zs=t=>(m(t.currentChunk),C("tfdt",1,0,[G(x(t.currentChunk.startTimestamp,t.timescale))])),Js=t=>{m(t.currentChunk);const e=t.currentChunk.samples.map(y=>y.timescaleUnitsToNextSample),s=t.currentChunk.samples.map(y=>y.size),i=t.currentChunk.samples.map(it),r=t.currentChunk.samples.map(y=>x(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,f=!c&&a.size>1,h=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*+f,g|=2048*+h,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]):[],f?l(i[E]):[],h?$(r[E]):[]])])},Ds=t=>T("mfra",void 0,[...t.map(ei),ti()]),ei=(t,e)=>C("tfra",1,0,[l(t.track.id),l(63),l(t.finalizedChunks.length),t.finalizedChunks.map(i=>[G(x(i.samples[0].timestamp,t.timescale)),G(i.moofOffset),l(e+1),l(1),l(1)])]),ti=()=>C("mfro",0,0,[l(0)]),si=()=>T("vtte"),ii=(t,e,s,i,r)=>T("vttc",void 0,[r!==null?T("vsid",[$(r)]):null,s!==null?T("iden",[...I.encode(s)]):null,e!==null?T("ctim",[...I.encode(as(e))]):null,i!==null?T("sttg",[...I.encode(i)]):null,T("payl",[...I.encode(t)])]),ri=t=>T("vtta",[...I.encode(t)]),ni=t=>{const e=[],s=t.format._options.metadataFormat??"auto",i=t.output._metadataTags;if(s==="mdir"||s==="auto"&&!t.isQuickTime){const r=ai(i);r&&e.push(r)}else if(s==="mdta"){const r=ci(i);r&&e.push(r)}else(s==="udta"||s==="auto"&&t.isQuickTime)&&oi(e,t.output._metadataTags);return e.length===0?null:T("udta",void 0,e)},oi=(t,e)=>{for(const{key:s,value:i}of Le(e))switch(s){case"title":t.push(B("©nam",i));break;case"description":t.push(B("©des",i));break;case"artist":t.push(B("©ART",i));break;case"album":t.push(B("©alb",i));break;case"albumArtist":t.push(B("albr",i));break;case"genre":t.push(B("©gen",i));break;case"date":t.push(B("©day",i.toISOString().slice(0,10)));break;case"comment":t.push(B("©cmt",i));break;case"lyrics":t.push(B("©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(B(s,i)):i instanceof Uint8Array&&t.push(T(s,Array.from(i))))}},B=(t,e)=>{const s=I.encode(e);return T(t,[w(s.length),w(ot("und")),Array.from(s)])},Ve={"image/jpeg":13,"image/png":14,"image/bmp":27},rt=(t,e)=>{const s=[];for(const{key:i,value:r}of Le(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(Ve[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 St&&s.push({key:i,value:T("data",[l(Ve[r.mimeType]??0),l(0),Array.from(r.data)])}))}return s},ai=t=>{const e=rt(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])))])},ci=t=>{const e=rt(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)]),ui=(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"}},di={avc:Ps,hevc:Ms,vp8:Ue,vp9:Ue,av1:Os},nt=(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"}},li=(t,e)=>{switch(t){case"aac":return pe;case"mp3":return pe;case"opus":return Is;case"vorbis":return pe;case"flac":return Rs}if(e)switch(t){case"pcm-s24":return N;case"pcm-s24be":return N;case"pcm-s32":return N;case"pcm-s32be":return N;case"pcm-f32":return N;case"pcm-f32be":return N;case"pcm-f64":return N;case"pcm-f64be":return N}else switch(t){case"pcm-s16":return F;case"pcm-s16be":return F;case"pcm-s24":return F;case"pcm-s24be":return F;case"pcm-s32":return F;case"pcm-s32be":return F;case"pcm-f32":return F;case"pcm-f32be":return F;case"pcm-f64":return F;case"pcm-f64be":return F}return null},hi={webvtt:"wvtt"},fi={webvtt:Ws},ot=t=>{m(t.length===3);let e=0;for(let s=0;s<3;s++)e<<=5,e+=t.charCodeAt(s)-96;return e};class mi{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 at extends mi{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 ct{constructor(){this._output=null,this.onwrite=null}}class ut extends ct{constructor(){super(...arguments),this.buffer=null}_createWriter(){return new at(this)}}const Ee=1e3,pi=2082844800,gi=t=>{const e={},s=t.track;return s.metadata.name!==void 0&&(e.name=s.metadata.name),e},x=(t,e,s=!0)=>{const i=t*e;return s?Math.round(i):i};class wi extends os{constructor(e,s){super(e),this.auxTarget=new ut,this.auxWriter=this.auxTarget._createWriter(),this.auxBoxWriter=new Re(this.auxWriter),this.mdat=null,this.ftypSize=null,this.trackDatas=[],this.allTracksKnown=At(),this.creationTime=Math.floor(Date.now()/1e3)+pi,this.finalizedChunks=[],this.nextFragmentNumber=1,this.maxWrittenTimestamp=-1/0,this.format=s,this.writer=e._writer,this.boxWriter=new Re(this.writer),this.isQuickTime=s instanceof ft;const i=this.writer instanceof at?"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(cs({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 Pt({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;Mt(i),m(i),m(i.decoderConfig);const n={...i.decoderConfig};m(n.codedWidth!==void 0),m(n.codedHeight!==void 0);let o=!1;if(e.source._codec==="avc"&&!n.description){const c=Ot(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=zt(c),o=!0}else if(e.source._codec==="hevc"&&!n.description){const c=Ft(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=Bt(c),o=!0}const a=It(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,i){const r=this.trackDatas.find(u=>u.track===e);if(r)return r;Rt(i),m(i),m(i.decoderConfig);const n={...i.decoderConfig};let o=!1;if(e.source._codec==="aac"&&!n.description){const u=ze(Fe.tempFromBytes(s.data));if(!u)throw new Error("Couldn't parse ADTS header from the AAC packet. Make sure the packets are in ADTS format (as specified in ISO 13818-7) when not providing a description, or provide a description (must be an AudioSpecificConfig as specified in ISO 14496-3) and ensure the packets are raw AAC data.");const c=Ut[u.samplingFrequencyIndex],d=Wt[u.channelConfiguration];if(c===void 0||d===void 0)throw new Error("Invalid ADTS frame header.");n.description=je({objectType:u.objectType,sampleRate:c,numberOfChannels:d}),o=!0}const a={muxer:this,track:e,type:"audio",info:{numberOfChannels:i.decoderConfig.numberOfChannels,sampleRate:i.decoderConfig.sampleRate,decoderConfig:n,requiresPcmTransformation:!this.isFragmented&&ee.includes(e.source._codec),requiresAdtsStripping:o},timescale:i.decoderConfig.sampleRate,samples:[],sampleQueue:[],timestampProcessingQueue:[],timeToSampleTable:[],compositionTimeOffsetTable:[],lastTimescaleUnits:null,lastSample:null,finalizedChunks:[],currentChunk:null,compactlyCodedChunkTable:[]};return this.trackDatas.push(a),this.trackDatas.sort((u,c)=>u.track.id-c.track.id),this.allTracksAreKnown()&&this.allTracksKnown.resolve(),a}getSubtitleTrackData(e,s){const i=this.trackDatas.find(n=>n.track===e);if(i)return i;Vt(s),m(s),m(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=[...Nt(o)].map(d=>o.subarray(d.offset,d.offset+d.length));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=$t(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,s,i);let o=s.data;if(n.info.requiresAdtsStripping){const c=ze(Fe.tempFromBytes(o));if(!c)throw new Error("Expected ADTS frame, didn't get one.");const d=c.crcCheck===null?Lt:Ht;o=o.subarray(d)}const a=this.validateAndNormalizeTimestamp(n.track,s.timestamp,s.type==="key"),u=this.createSampleForTrack(n,o,a,s.duration,s.type);n.info.requiresPcmTransformation&&await this.maybePadWithSilence(n,a),await this.registerSample(n,u)}finally{r()}}async maybePadWithSilence(e,s){const i=q(e.samples),r=i?i.timestamp+i.duration:0,n=s-r,o=x(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)m(c.timestamp<=s),m(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=si();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;Ie.lastIndex=0;const p=Ie.test(d.text),f=d.timestamp+d.duration;let h=e.cueToSourceId.get(d);if(h===void 0&&o<f&&(h=e.nextSourceId++,e.cueToSourceId.set(d,h)),d.notes){const y=ri(d.notes);this.auxBoxWriter.writeBox(y)}const g=ii(d.text,p?n:null,d.identifier??null,d.settings??null,h??null);this.auxBoxWriter.writeBox(g),f===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:x(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=x(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=x(n.timestamp-n.decodeTimestamp,e.timescale),a=x(n.duration,e.timescale);if(e.lastTimescaleUnits!==null){m(e.lastSample);const u=x(n.decodeTimestamp,e.timescale,!1),c=Math.round(u-e.lastTimescaleUnits);if(m(c>=0),e.lastTimescaleUnits+=c,e.lastSample.timescaleUnitsToNextSample=c,!this.isFragmented){let d=q(e.timeToSampleTable);if(m(d),d.sampleCount===1){d.sampleDelta=c;const f=e.timeToSampleTable[e.timeToSampleTable.length-2];f&&f.sampleDelta===c&&(f.sampleCount++,e.timeToSampleTable.pop(),d=f)}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);m(p),p.sampleCompositionTimeOffset===o?p.sampleCount++:e.compositionTimeOffsetTable.push({sampleCount:1,sampleCompositionTimeOffset:o})}}else e.lastTimescaleUnits=x(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,m(e.lastSample),m(e.lastTimescaleUnits!==null),s!==void 0&&e.lastSample.timescaleUnitsToNextSample===0){m(s.type==="key");const r=x(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(m(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}),m(e.currentChunk),e.currentChunk.samples.push(s),this.isFragmented&&(this.maxWrittenTimestamp=Math.max(this.maxWrittenTimestamp,s.timestamp))}async finalizeCurrentChunk(e){if(m(!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+x(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)m(i.data),this.writer.write(i.data),i.data=null;await this.writer.flush()}async interleaveSamples(e=!1){if(m(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){m(this.isFragmented);const s=this.nextFragmentNumber++;if(s===1){this.format._options.onMoov&&this.writer.startTrackingWrites();const h=ie(this);if(this.boxWriter.writeBox(h),this.format._options.onMoov){const{data:g,start:y}=this.writer.stopTrackingWrites();this.format._options.onMoov(g,y)}}const i=this.trackDatas.filter(h=>h.currentChunk),r=We(s,i),n=this.writer.getPos(),o=n+this.boxWriter.measureBox(r);let a=o+le,u=1/0;for(const h of i){h.currentChunk.offset=a,h.currentChunk.moofOffset=n;for(const g of h.currentChunk.samples)a+=g.size;u=Math.min(u,h.currentChunk.startTimestamp)}const c=a-o,d=c>=2**32;if(d)for(const h of i)h.currentChunk.offset+=Be-le;this.format._options.onMoof&&this.writer.startTrackingWrites();const p=We(s,i);if(this.boxWriter.writeBox(p),this.format._options.onMoof){const{data:h,start:g}=this.writer.stopTrackingWrites();this.format._options.onMoof(h,g,u)}m(this.writer.getPos()===o),this.format._options.onMdat&&this.writer.startTrackingWrites();const f=ae(d);f.size=c,this.boxWriter.writeBox(f),this.writer.seek(o+(d?Be:le));for(const h of i)for(const g of h.currentChunk.samples)this.writer.write(g.data),g.data=null;if(this.format._options.onMdat){const{data:h,start:g}=this.writer.stopTrackingWrites();this.format._options.onMdat(h,g)}for(const h of i)h.finalizedChunks.push(h.currentChunk),this.finalizedChunks.push(h.currentChunk),h.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;m(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(){m(this.fastStart==="reserve");let e=0;for(const s of this.trackDatas){const i=s.track.metadata.maximumPacketCount;m(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)m(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)m(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=Ds(this.trackDatas);this.boxWriter.writeBox(i);const r=this.writer.getPos()-s;this.writer.seek(this.writer.getPos()-4),this.boxWriter.writeU32(r)}else{m(this.mdat);const s=this.boxWriter.offsets.get(this.mdat);m(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"){m(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(us(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 dt{getSupportedVideoCodecs(){return this.getSupportedCodecs().filter(e=>L.includes(e))}getSupportedAudioCodecs(){return this.getSupportedCodecs().filter(e=>j.includes(e))}getSupportedSubtitleCodecs(){return this.getSupportedCodecs().filter(e=>ce.includes(e))}_codecUnsupportedHint(e){return""}}class lt extends dt{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:4294967295},audio:{min:0,max:4294967295},subtitle:{min:0,max:4294967295},total:{min:1,max:4294967295}}}get supportsVideoRotationMetadata(){return!0}_createMuxer(e){return new wi(e,this)}}class ht extends lt{constructor(e){super(e)}get _name(){return"MP4"}get fileExtension(){return".mp4"}get mimeType(){return"video/mp4"}getSupportedCodecs(){return[...L,...Qt,"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 ft().getSupportedCodecs().includes(e)?" Switching to MOV will grant support for this codec.":""}}class ft extends lt{constructor(e){super(e)}get _name(){return"MOV"}get fileExtension(){return".mov"}get mimeType(){return"video/quicktime"}getSupportedCodecs(){return[...L,...j]}_codecUnsupportedHint(e){return new ht().getSupportedCodecs().includes(e)?" Switching to MP4 will grant support for this codec.":""}}const Ti=t=>{if(!t||typeof t!="object")throw new TypeError("Encoding config must be an object.");if(!L.includes(t.codec))throw new TypeError(`Invalid video codec '${t.codec}'. Must be one of: ${L.join(", ")}.`);if(!(t.bitrate instanceof X)&&(!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.");mt(t.codec,t)},mt=(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&&Ge(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 X?t.bitrate._toVideoBitrate(t.codec,t.width,t.height):t.bitrate;return{codec:t.fullCodecString??jt(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,...qt(t.codec)}},bi=t=>{if(!t||typeof t!="object")throw new TypeError("Encoding config must be an object.");if(!j.includes(t.codec))throw new TypeError(`Invalid audio codec '${t.codec}'. Must be one of: ${j.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 X)&&(!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.");pt(t.codec,t)},pt=(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&&Ge(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 X?t.bitrate._toAudioBitrate(t.codec):t.bitrate;return{codec:t.fullCodecString??Kt(t.codec,t.numberOfChannels,t.sampleRate),numberOfChannels:t.numberOfChannels,sampleRate:t.sampleRate,bitrate:e,bitrateMode:t.bitrateMode,...Gt(t.codec)}};class X{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 gt=new X(2),yi=async(t,e={})=>{const{width:s=1280,height:i=720,bitrate:r=1e6,...n}=e;if(!L.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 X)&&(!Number.isInteger(r)||r<=0))throw new TypeError("bitrate must be a positive integer or a quality.");mt(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),f=new VideoFrame(p,{format:"RGBA",codedWidth:s,codedHeight:i,timestamp:0});d.encode(f),f.close(),await d.flush(),c(!0)}catch{c(!1)}}):!0},Ci=async(t,e={})=>{const{numberOfChannels:s=2,sampleRate:i=48e3,bitrate:r=128e3,...n}=e;if(!j.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 X)&&(!Number.isInteger(r)||r<=0))throw new TypeError("bitrate must be a positive integer.");pt(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)},Ei=async(t,e)=>{for(const s of t)if(await yi(s,e))return s;return null},vi=async(t,e)=>{for(const s of t)if(await Ci(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??=(async()=>{await this._flushAndClose(e),this._closed=!0})()}}class wt extends Ae{constructor(e){if(super(),this._connectedTrack=null,!L.includes(e))throw new TypeError(`Invalid video codec '${e}'. Must be one of: ${L.join(", ")}.`);this._codec=e}}class Si{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 Ye,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()});m(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 Ke(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),m(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{m(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 _i(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),f=this.splitter.extractAlpha(a);this.alphaFrameQueue.push(f),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=(f,h,g)=>{const y={};if(h){const k=new Uint8Array(h.byteLength);h.copyTo(k),y.alpha=k}const E=re.fromEncodedChunk(f,y);this.encodingConfig.onEncodedPacket?.(E,g),this.muxer.addEncodedVideoPacket(this.source._connectedTrack,E,g).catch(k=>{this.error??=k,this.errorNeedsNewStack=!1})};this.encoder=new VideoEncoder({output:(f,h)=>{if(!this.alphaEncoder){p(f,null,h);return}const g=this.alphaFrameQueue.shift();m(g!==void 0),g?(this.alphaEncoder.encode(g,{keyFrame:f.type==="key"}),d++,g.close(),a.push({chunk:f,meta:h})):d===0?p(f,null,h):(u.push(c+d),a.push({chunk:f,meta:h}))},error:f=>{f.stack=s.stack,this.error??=f}}),this.encoder.configure(i),this.encodingConfig.alpha==="keep"&&(this.alphaEncoder=new VideoEncoder({output:(f,h)=>{d--;const g=a.shift();for(m(g!==void 0),p(g.chunk,f,g.meta),c++;u.length>0&&u[0]===c;){u.shift();const y=a.shift();m(y!==void 0),p(y.chunk,null,y.meta)}},error:f=>{f.stack=s.stack,this.error??=f}}),this.alphaEncoder.configure(i))}m(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 _i{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
|
+
in vec2 a_position;
|
|
3
|
+
in vec2 a_texCoord;
|
|
4
|
+
out vec2 v_texCoord;
|
|
5
|
+
|
|
6
|
+
void main() {
|
|
7
|
+
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
8
|
+
v_texCoord = a_texCoord;
|
|
9
|
+
}
|
|
10
|
+
`)}createColorProgram(){const e=this.createVertexShader(),s=this.createShader(this.gl.FRAGMENT_SHADER,`#version 300 es
|
|
11
|
+
precision highp float;
|
|
12
|
+
|
|
13
|
+
uniform sampler2D u_sourceTexture;
|
|
14
|
+
in vec2 v_texCoord;
|
|
15
|
+
out vec4 fragColor;
|
|
16
|
+
|
|
17
|
+
void main() {
|
|
18
|
+
vec4 source = texture(u_sourceTexture, v_texCoord);
|
|
19
|
+
fragColor = vec4(source.rgb, 1.0);
|
|
20
|
+
}
|
|
21
|
+
`),i=this.gl.createProgram();return this.gl.attachShader(i,e),this.gl.attachShader(i,s),this.gl.linkProgram(i),i}createAlphaProgram(){const e=this.createVertexShader(),s=this.createShader(this.gl.FRAGMENT_SHADER,`#version 300 es
|
|
22
|
+
precision highp float;
|
|
23
|
+
|
|
24
|
+
uniform sampler2D u_sourceTexture;
|
|
25
|
+
uniform vec2 u_resolution; // The width and height of the canvas
|
|
26
|
+
in vec2 v_texCoord;
|
|
27
|
+
out vec4 fragColor;
|
|
28
|
+
|
|
29
|
+
// This function determines the value for a single byte in the YUV stream
|
|
30
|
+
float getByteValue(float byteOffset) {
|
|
31
|
+
float width = u_resolution.x;
|
|
32
|
+
float height = u_resolution.y;
|
|
33
|
+
|
|
34
|
+
float yPlaneSize = width * height;
|
|
35
|
+
|
|
36
|
+
if (byteOffset < yPlaneSize) {
|
|
37
|
+
// This byte is in the luma plane. Find the corresponding pixel coordinates to sample from
|
|
38
|
+
float y = floor(byteOffset / width);
|
|
39
|
+
float x = mod(byteOffset, width);
|
|
40
|
+
|
|
41
|
+
// Add 0.5 to sample the center of the texel
|
|
42
|
+
vec2 sampleCoord = (vec2(x, y) + 0.5) / u_resolution;
|
|
43
|
+
|
|
44
|
+
// The luma value is the alpha from the source texture
|
|
45
|
+
return texture(u_sourceTexture, sampleCoord).a;
|
|
46
|
+
} else {
|
|
47
|
+
// Write a fixed value for chroma and beyond
|
|
48
|
+
return 128.0 / 255.0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
void main() {
|
|
53
|
+
// Each fragment writes 4 bytes (R, G, B, A)
|
|
54
|
+
float pixelIndex = floor(gl_FragCoord.y) * u_resolution.x + floor(gl_FragCoord.x);
|
|
55
|
+
float baseByteOffset = pixelIndex * 4.0;
|
|
56
|
+
|
|
57
|
+
vec4 result;
|
|
58
|
+
for (int i = 0; i < 4; i++) {
|
|
59
|
+
float currentByteOffset = baseByteOffset + float(i);
|
|
60
|
+
result[i] = getByteValue(currentByteOffset);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
fragColor = result;
|
|
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),m(a[s*i]===128),m(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 xi extends wt{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.");Ti(s),super(s.codec),this._encoder=new Si(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 Ke(this._canvas,{timestamp:e,duration:s});return this._encoder.add(r,!0,i)}_flushAndClose(e){return this._encoder.flushAndClose(e)}}class Tt extends Ae{constructor(e){if(super(),this._connectedTrack=null,!j.includes(e))throw new TypeError(`Invalid audio codec '${e}'. Must be one of: ${j.join(", ")}.`);this._codec=e}}class ki{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 Ye,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),m(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 Xe({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{m(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){m(this.outputSampleSize),m(this.writeOutputValue);const{numberOfChannels:i,numberOfFrames:r,sampleRate:n,timestamp:o}=e,a=2048,u=[];for(let f=0;f<r;f+=a){const h=Math.min(a,e.numberOfFrames-f),g=h*i*this.outputSampleSize,y=new ArrayBuffer(g),E=new DataView(y);u.push({frameCount:h,view:E})}const c=e.allocationSize({planeIndex:0,format:"f32-planar"}),d=new Float32Array(c/Float32Array.BYTES_PER_ELEMENT);for(let f=0;f<i;f++){e.copyTo(d,{planeIndex:f,format:"f32-planar"});for(let h=0;h<u.length;h++){const{frameCount:g,view:y}=u[h];for(let E=0;E<g;E++)this.writeOutputValue(y,(E*i+f)*this.outputSampleSize,d[h*a+E])}}s&&e.close();const p={decoderConfig:{codec:this.encodingConfig.codec,numberOfChannels:i,sampleRate:n}};for(let f=0;f<u.length;f++){const{frameCount:h,view:g}=u[f],y=g.buffer,E=f*a,k=new re(new Uint8Array(y),"key",o+E/n,h/n);this.encodingConfig.onEncodedPacket?.(k,p),await this.muxer.addEncodedAudioPacket(this.source._connectedTrack,k,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=Xt(te(c.decoderConfig.description)).objectType===0,p){const f=Number(q(n.codec.split(".")));c.decoderConfig.description=je({objectType:f,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)}m(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,Dt(u))}:m(!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):m(!1);break;case 3:s==="unsigned"?this.writeOutputValue=(n,o,a)=>Yt(n,o,z((a+1)*83886075e-1,0,16777215),r):s==="signed"?this.writeOutputValue=(n,o,a)=>Zt(n,o,z(Math.round(a*8388607),-8388608,8388607),r):m(!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):m(!1);break;case 8:s==="float"?this.writeOutputValue=(n,o,a)=>n.setFloat64(o,a,r):m(!1);break;default:_e(i),m(!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 Ai extends Tt{constructor(e){bi(e),super(e.codec),this._accumulatedTime=0,this._encoder=new ki(this,e)}async add(e){if(!(e instanceof AudioBuffer))throw new TypeError("audioBuffer must be an AudioBuffer.");const s=Xe._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 Pi 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 Mi=["video","audio","subtitle"],Te=t=>{if(!t||typeof t!="object")throw new TypeError("metadata must be an object.");if(t.languageCode!==void 0&&!ts(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&&ss(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 Oi{constructor(e){if(this.state="pending",this._tracks=[],this._startPromise=null,this._cancelPromise=null,this._finalizePromise=null,this._mutex=new $e,this._metadataTags={},!e||typeof e!="object")throw new TypeError("options must be an object.");if(!(e.format instanceof dt))throw new TypeError("options.format must be an OutputFormat.");if(!(e.target instanceof ct))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 wt))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 Tt))throw new TypeError("source must be an AudioSource.");Te(s),this._addTrack("audio",e,s)}addSubtitleTrack(e,s={}){if(!(e instanceof Pi))throw new TypeError("source must be a SubtitleSource.");Te(s),this._addTrack("subtitle",e,s)}setMetadataTags(e){if(es(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 Mi){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 K(t){return!!t&&typeof t=="object"&&"name"in t&&t.name==="AbortError"}function _(t){if(t?.aborted)throw ue()}function Ne(t){return Math.round(t/2)*2}function zi(t){return t.pages.reduce((e,s)=>e+(s.duration||5e3),0)}function Fi(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 Bi(t){let e=t.width,s=t.height;for(const i of t.pages){const r=i.width==="auto"?t.width:i.width,n=i.height==="auto"?t.height:i.height;e=Math.max(e,r),s=Math.max(s,n)}return{width:Ne(e),height:Ne(s)}}function bt(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 Ii(t,e){const s=[];for(const i of t.pages)s.push({pageId:i.id,width:i.width,height:i.height}),i.set({width:e.width,height:e.height});return s}function Ri(t,e){for(const{pageId:s,width:i,height:r}of e){const n=t.pages.find(o=>o.id===s);n&&n.set({width:i,height:r})}}function Ui(t,e){const s=is(),i=s.sceneCanvas._canvas;if(i.width=t.width*e,i.height=t.height*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 Wi(t,e){const s=new Oi({target:new ut,format:new ht}),i=await Ei(s.format.getSupportedVideoCodecs(),{width:t.width,height:t.height});if(!i)throw new Error("Your browser doesn't support video encoding.");const r=new xi(t,{codec:i,bitrate:gt});return s.addVideoTrack(r,{frameRate:e}),{output:s,canvasSource:r}}async function Vi(t,e,s){if(!s)return{audioBufferSource:null};const i=44100,r=2,n=e.audios&&e.audios.length>0,o=bt(e).length>0;if(!n&&!o)return{audioBufferSource:null};const a=t.format.getSupportedAudioCodecs(),u=["aac","mp3","flac"],c=[...u.filter(f=>a.includes(f)),...a.filter(f=>!u.includes(f))],d=await vi(c,{numberOfChannels:r,sampleRate:i});if(!d)return console.warn("[polotno-video-export] Browser doesn't support audio encoding, video will be generated without audio. Tried codecs: "+c.join(", ")),{audioBufferSource:null};const p=new Ai({codec:d,bitrate:gt});return t.addAudioTrack(p),{audioBufferSource:p,audioCodec:d}}function Ni(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 $i(t,e,s,i,r){t.setCurrentTime(e),await t._toCanvas({pixelRatio:i,pageId:t.pages[s]?.id,_skipTimeout:!0,_exportCanvases:r})}async function Li(t,e,s,i,r,n,o,a,u){const c=1e3/n,d=Math.floor(r/1e3*n)||1;try{_(u),t.setElementsPixelRatio(o);let p=-1,f=0;const h=300;for(let g=0;g<d;g++){_(u);const y=Date.now(),E=g/n,k=1/n;let O=E*1e3;g===0&&(O=1),g===d-1&&(O=Math.min(r-1,(g+1)*c-1));const U=Ni(O,i,p);if(U!==p&&U>=0&&(t.activePage.set({_rendering:!1}),t.selectPage(t.pages[U].id),t.activePage.set({_rendering:!0}),await t.waitLoading(),_(u),p=U),await $i(t,O,U,o,s),_(u),await e.add(E,k),a){const V=Date.now();if(g===d-1||V-f>=h){const se=V-y,S=(g+1)/d*.95;a(S,se),f=V}}}}finally{t.pages.forEach(p=>{p.set({_rendering:!1})}),t.setCurrentTime(0)}}async function Hi(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 Qi(t,e){return t.decodeAudioData(e)}function qi(t){return t.startsWith("data:")}function ji(t){return t.startsWith("file://")}function Gi(t){return t.startsWith("http://")||t.startsWith("https://")}function Ki(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 Xi(t,e){try{if(Gi(t))return new ne({source:new ns(t),formats:oe});if(qi(t)){const s=Ki(t);return new ne({source:new he(s),formats:oe})}else if(ji(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 K(s)||e?.aborted||console.error(`Failed to create input from ${t.slice(0,50)}:`,s),null}}async function Yi(t,e){try{_(e);const s=await Xi(t,e);if(!s)return console.log(`[polotno-video-export] checkVideoAudio: createInputFromSource returned null for ${t.slice(0,80)}`),{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(K(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 yt(t,e){const s=t.audios||[],i=bt(t),r=s.map(o=>({audio:o,bufferPromise:Hi(o.src,e).catch(a=>(K(a)||e?.aborted||console.error(`Failed to download audio ${o.src}:`,a),null))})),n=i.map(o=>({video:o,inputPromise:Yi(o.src,e).catch(a=>{if(K(a)||e?.aborted)return{hasAudio:!1,input:null};throw a})}));return{storeAudios:r,videoAudios:n}}function Zi(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,f=Math.min(c,e.duration-u);if(d<0&&(p+=Math.abs(d),f-=Math.abs(d),d=0),f<=0||p>=e.duration)return;const h=s.offlineContext.createBufferSource();h.buffer=e;const g=s.offlineContext.createGain();g.gain.value=r,h.connect(g),g.connect(s.offlineContext.destination),h.start(d,p,f)}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 Di(t,e,s,i,r,n,o){_(o);const a=r||yt(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,f=d==="aac"?3:d?.includes("opus")?2:0,h=Math.floor(s/1e3*u),g=Math.floor(h/p)*p,y=f*p,E=Math.max(p,g-y),k=new OfflineAudioContext(c,E,u),O={offlineContext:k,totalDuration:s};n?.(.95);const[U,V]=await Promise.all([Promise.all(a.storeAudios.map(async({audio:S,bufferPromise:de})=>{try{_(o);const P=await de;if(_(o),!P)return null;const H=await Qi(k,P);return{audio:S,audioBuffer:H}}catch(P){if(K(P))throw P;return console.error(`Failed to process audio ${S.src}:`,P),null}})),Promise.all(a.videoAudios.map(async({video:S,inputPromise:de})=>{try{_(o);const{hasAudio:P,input:H}=await de;if(_(o),!P||!H)return console.log(`[polotno-video-export] Video ${S.id} has no audio track or input failed. hasAudio=${P}, input=${!!H}`),null;const Pe=await H.getPrimaryAudioTrack();if(!Pe)return console.log(`[polotno-video-export] Video ${S.id} getPrimaryAudioTrack returned null`),H.dispose(),null;const Ct=new rs(Pe),Y=[];for await(const Q of Ct.buffers())_(o),Y.push(Q.buffer);if(H.dispose(),_(o),Y.length===0)return console.log(`[polotno-video-export] Video ${S.id} AudioBufferSink returned 0 buffers`),null;const Et=Y.reduce((Q,Z)=>Q+Z.length,0),Me=k.createBuffer(Y[0].numberOfChannels,Et,Y[0].sampleRate);let Oe=0;for(const Q of Y){for(let Z=0;Z<Q.numberOfChannels;Z++)Me.getChannelData(Z).set(Q.getChannelData(Z),Oe);Oe+=Q.length}return{video:S,audioBuffer:Me}}catch(P){if(K(P))throw P;return console.error(`Failed to extract video audio ${S.src}:`,P),null}}))]);n?.(.97),_(o);for(const S of U)S&&Zi(S.audio,S.audioBuffer,O);for(const S of V)S&&Ji(S.video,S.audioBuffer,O);_(o);const se=await k.startRendering();n?.(.99),_(o),await e.add(se)}async function tr({store:t,fps:e=30,pixelRatio:s=1,onProgress:i,includeAudio:r=!0,signal:n}){const o=Bi(t),a=Ii(t,o);let u=null,c=null,d=null,p=null,f=!1;if(n){_(n);const h=()=>{try{c?.close()}catch{}try{d?.close()}catch{}u?.cancel().catch(()=>{})};n.addEventListener("abort",h,{once:!0}),p=()=>n.removeEventListener("abort",h)}try{_(n);const h=zi(t);if(h===0)throw new Error("Video duration is 0");const g=Fi(t),{canvas:y,canvases:E}=Ui(o,s),k=await Wi(y,e);u=k.output,c=k.canvasSource;const O=await Vi(u,t,r);d=O.audioBufferSource||null;const U=O.audioCodec;_(n),await u.start(),await Li(t,c,E,g,h,e,s,i,n),c.close();const V=d?yt(t,n):null;d&&V&&(await Di(t,d,h,U,V,i,n),d.close()),_(n),await u.finalize();const se=u.target,S=new Blob([se.buffer],{type:u.format.mimeType});return f=!0,S}catch(h){throw K(h)?h:n?.aborted?ue():h}finally{if(p?.(),!f&&u)try{await u.cancel()}catch{}Ri(t,a)}}export{tr as storeToVideo};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aa as Da,ab as Va,ac as il}from"./index-B90zTBt3.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{ag as Da,ah as Va,ai as il}from"./index-A296L9Ae.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.48.0",mode:n?"pure":"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.48.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-
|
|
11
|
+
<script type="module" crossorigin src="./assets/index-A296L9Ae.js"></script>
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|
|
14
14
|
<div id="root"></div>
|
package/instance.js
CHANGED
|
@@ -617,7 +617,6 @@ module.exports.createInstance = async ({
|
|
|
617
617
|
async (json, attrs) => {
|
|
618
618
|
const pixelRatio = attrs.pixelRatio || 1;
|
|
619
619
|
store.loadJSON(json);
|
|
620
|
-
await store.waitLoading();
|
|
621
620
|
window.__polotnoThrowAssetErrorIfAny(attrs);
|
|
622
621
|
|
|
623
622
|
// keep store internals consistent with image/pdf exports
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "polotno-node",
|
|
3
|
-
"version": "2.15.
|
|
3
|
+
"version": "2.15.7",
|
|
4
4
|
"description": "Polotno workflow from NodeJS",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -22,27 +22,27 @@
|
|
|
22
22
|
],
|
|
23
23
|
"browserslist": "> 0.5%, last 2 versions, not dead",
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@polotno/video-export": "^0.0.
|
|
25
|
+
"@polotno/video-export": "^0.0.11",
|
|
26
26
|
"axios": "^1.13.2",
|
|
27
27
|
"dotenv": "^17.2.3",
|
|
28
28
|
"fluent-ffmpeg": "^2.1.3",
|
|
29
|
-
"jspdf": "^
|
|
29
|
+
"jspdf": "^4.0.0",
|
|
30
30
|
"patch-package": "^8.0.1",
|
|
31
31
|
"pixelmatch": "^7.1.0",
|
|
32
32
|
"pngjs": "^7.0.0",
|
|
33
|
-
"polotno": "2.
|
|
33
|
+
"polotno": "^2.35.2",
|
|
34
34
|
"react": "^18.3.1",
|
|
35
35
|
"react-dom": "^18.3.1",
|
|
36
36
|
"vite": "^7.3.1",
|
|
37
|
-
"vitest": "^4.0.
|
|
37
|
+
"vitest": "^4.0.17",
|
|
38
38
|
"web-audio-api": "^0.2.2"
|
|
39
39
|
},
|
|
40
40
|
"author": "Anton Lavrenov",
|
|
41
41
|
"license": "MIT",
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@sparticuz/chromium": "^143.0.4",
|
|
44
|
-
"puppeteer": "24.
|
|
45
|
-
"puppeteer-core": "24.
|
|
44
|
+
"puppeteer": "24.36.0",
|
|
45
|
+
"puppeteer-core": "24.36.0",
|
|
46
46
|
"tmp": "^0.2.5"
|
|
47
47
|
},
|
|
48
48
|
"bugs": {
|