From 5b721eb4903f3e172991869f894fa45772ab54f8 Mon Sep 17 00:00:00 2001 From: zhaohappy <2281756061@qq.com> Date: Tue, 10 Dec 2024 22:35:16 +0800 Subject: [PATCH] =?UTF-8?q?build:=20=E9=87=8D=E6=96=B0=E7=BC=96=E8=AF=91?= =?UTF-8?q?=20avplayer=20=E5=92=8C=20avtranscoder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/avplayer-ui/118.avplayer.js | 2 +- dist/avplayer-ui/331.avplayer.js | 2 +- dist/avplayer-ui/433.avplayer.js | 2 +- dist/avplayer-ui/avplayer.js | 2 +- dist/avplayer/118.avplayer.js | 2 +- dist/avplayer/331.avplayer.js | 2 +- dist/avplayer/433.avplayer.js | 2 +- dist/avplayer/avplayer.js | 2 +- dist/avtranscoder/118.avtranscoder.js | 2 +- dist/avtranscoder/331.avtranscoder.js | 2 +- dist/avtranscoder/411.avtranscoder.js | 2 +- dist/avtranscoder/433.avtranscoder.js | 2 +- dist/avtranscoder/47.avtranscoder.js | 2 +- dist/avtranscoder/888.avtranscoder.js | 2 +- dist/avtranscoder/952.avtranscoder.js | 2 +- dist/avtranscoder/avtranscoder.js | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dist/avplayer-ui/118.avplayer.js b/dist/avplayer-ui/118.avplayer.js index 7804cfe..86aed3e 100644 --- a/dist/avplayer-ui/118.avplayer.js +++ b/dist/avplayer-ui/118.avplayer.js @@ -1 +1 @@ -"use strict";(self.webpackChunkAVPlayer=self.webpackChunkAVPlayer||[]).push([[118],{85947:(t,i,e)=>{e.d(i,{A:()=>r});var s=e(134);class r{constructor(){(0,s.A)(this,"type",-1),(0,s.A)(this,"onStreamAdd",void 0)}async destroy(t){}}},29118:(t,i,e)=>{e.r(i),e.d(i,{default:()=>P});var s=e(134),r=e(63939),n=e(50932),a=e(38743),h=e(4624),o=e(54712),d=e(87400),g=e(9705),l=e(92647),p=e(85947),u=e(14686),f=e(37837),c=e(71517),m=e(82348),w=e(35336),b=e(77231),I=e(52071),k=e(44328),S=e(72739),B=e(79630),v=e(43607);const y="src/avformat/formats/IOggFormat.ts";class P extends p.A{constructor(){super(),(0,s.A)(this,"type",4),(0,s.A)(this,"headerPagesPayload",void 0),(0,s.A)(this,"page",void 0),(0,s.A)(this,"curSegIndex",void 0),(0,s.A)(this,"curSegStart",void 0),(0,s.A)(this,"segCount",void 0),(0,s.A)(this,"segIndex",void 0),(0,s.A)(this,"currentPts",void 0),(0,s.A)(this,"firstPos",void 0),(0,s.A)(this,"firstGranulePosition",void 0),(0,s.A)(this,"paddingPayload",void 0),this.page=new a.B,this.headerPagesPayload=[]}init(t){t.ioReader&&t.ioReader.setEndian(!1),t.ioReader&&t.ioReader.setEndian(!1),this.curSegIndex=-1,this.curSegStart=0,this.currentPts=BigInt(0),this.segCount=0,this.segIndex=0,this.firstGranulePosition=BigInt(0)}async estimateTotalBlock(t){let i=BigInt(0);const e=t.ioReader.getPos(),s=this.currentPts,r=await t.ioReader.fileSize();for(await t.ioReader.seek(v.T9(r-BigInt(195072),BigInt(0))),await this.syncPage(t);;)try{this.page.reset(),await this.page.read(t.ioReader),i=this.page.granulePosition}catch(t){break}return await t.ioReader.seek(e),this.currentPts=s,i}async getNextSegment(t){if(this.curSegIndex<0){this.page.granulePosition>BigInt(0)&&(this.currentPts=this.page.granulePosition),this.page.reset(),await this.page.read(t.ioReader),this.curSegIndex=0,this.curSegStart=0,this.segIndex=-1,this.segCount=0;for(let t=0;t{const e=t.split("=");if(e.length>1){const t=e.shift(),s=e.join("=");i.metadata[t]=s}}))}async createStream(t,i){if(i.length<8)return 0;let e=new m.A(i.length,!1);e.appendBuffer(i);const s=e.peekString(8);if("OpusHead"===s){const s=new o.q;s.read(e);const r=new o.o;i=await this.getNextSegment(t),e=new m.A(i.length,!1),e.appendBuffer(i),r.read(e),this.headerPagesPayload=[s,r];const n=t.createStream();n.codecpar.codecType=1,n.codecpar.codecId=86076,n.codecpar.sampleRate=s.sampleRate,n.codecpar.chLayout.nbChannels=s.channels,n.timeBase.den=n.codecpar.sampleRate,n.timeBase.num=1,n.privData={serialNumber:this.page.serialNumber},this.addComment(r,n),n.duration=await this.estimateTotalBlock(t)}else if("vorbis"===s.slice(1,7)){const s=[i],r=new d.m;r.read(e);const n=new d.G;i=await this.getNextSegment(t),e=new m.A(i.length,!1),e.appendBuffer(i),n.read(e),s.push(i),this.headerPagesPayload=[r,n];const a=t.createStream();a.codecpar.codecType=1,a.codecpar.codecId=86021,a.codecpar.sampleRate=r.sampleRate,a.codecpar.chLayout.nbChannels=r.channels,a.timeBase.den=a.codecpar.sampleRate,a.timeBase.num=1,a.privData={serialNumber:this.page.serialNumber},this.addComment(n,a),s.push(await this.getNextSegment(t));const h=s.reduce(((t,i)=>t+2+i.length),0),o=(0,f.sY)(h),g=new w.A(h,!0,new B.A(o,h));s.forEach((t=>{g.writeUint16(t.length),g.writeBuffer(t)})),a.codecpar.extradata=o,a.codecpar.extradataSize=h,a.duration=await this.estimateTotalBlock(t)}else if("FLAC"===s.slice(1,5)){e.setEndian(!0),e.skip(1),e.skip(4),e.skip(1),e.skip(1),e.readUint16(),e.skip(4);const s=e.readUint8(),r=e.readUint24();if(0!==s)return g.LR;{const s=t.createStream();s.codecpar.codecType=1,s.codecpar.codecId=86028;const n=(0,f.sY)(r);e.peekBuffer(r,(0,u.s3)(n,r)),e.skip(10);const h=e.readUint24();s.codecpar.sampleRate=h>>4,s.codecpar.chLayout.nbChannels=1+((15&h)>>>1),s.timeBase.den=s.codecpar.sampleRate,s.timeBase.num=1,s.privData={serialNumber:this.page.serialNumber},s.codecpar.extradata=n,s.codecpar.extradataSize=r;const o=new a.h;i=await this.getNextSegment(t),e=new m.A(i.length-4,!1),e.appendBuffer(i.subarray(4)),o.read(e),s.duration=await this.estimateTotalBlock(t),this.addComment(o,s),this.headerPagesPayload=[o]}}else{if("Speex"!==s.slice(0,5))return 0;{const s=t.createStream();s.codecpar.codecType=1,s.codecpar.codecId=86051;const r=(0,f.sY)(i.length);(0,u.lW)(r,i.length,i),s.codecpar.extradata=r,s.codecpar.extradataSize=i.length,e.seek(BigInt(36)),s.codecpar.sampleRate=e.readUint32(),e.seek(BigInt(48)),s.codecpar.chLayout.nbChannels=e.readUint32(),s.timeBase.den=s.codecpar.sampleRate,s.timeBase.num=1,s.privData={serialNumber:this.page.serialNumber};const n=new a.h;i=await this.getNextSegment(t),e=new m.A(i.length,!1),e.appendBuffer(i),n.read(e),s.duration=await this.estimateTotalBlock(t),this.addComment(n,s),this.headerPagesPayload=[n]}}return 1}async readHeader(t){try{if("OggS"!==await t.ioReader.peekString(4))return h.z3("the file format is not oggs",y,387),g.LR;for(;;){let i=this.paddingPayload||await this.getNextSegment(t);this.paddingPayload&&(this.paddingPayload=null);const e=await this.createStream(t,i);if(e<0)return e;if(!e){this.paddingPayload=i;break}}return this.firstPos=this.paddingPayload?this.page.pos:t.ioReader.getPos(),0}catch(i){return h.z3(i.message,y,409),t.ioReader.error}}async readAVPacket(t,i){n.M[17](i+56,t.ioReader.getPos());try{const e=this.paddingPayload||await this.getNextSegment(t);this.paddingPayload&&(this.paddingPayload=null);let s=this.currentPts+(this.page.granulePosition-this.currentPts)/BigInt(Math.floor(this.segCount))*BigInt(Math.floor(this.segIndex));n.M[17](i+16,s),n.M[17](i+8,s),this.firstGranulePosition||(this.firstGranulePosition=this.page.granulePosition);const a=t.streams.find((t=>t.privData&&t.privData.serialNumber===this.page.serialNumber));if(!a)return await this.createStream(t,e),this.readAVPacket(t,i);n.M[15](i+32,a.index),n.M[15](i+76,a.timeBase.den),n.M[15](i+72,a.timeBase.num),1===a.codecpar.codecType&&n.M[15](i+36,1|r.f[15](i+36));const h=[e];for(;this.curSegIndex<0;)try{if(!(1&(await t.ioReader.peekBuffer(6))[5]))break;h.push(await this.getNextSegment(t))}catch(t){break}const o=(0,l.A)(Uint8Array,h),d=o.length,g=(0,f.sY)(d);return(0,u.lW)(g,d,o),(0,c.NX)(i,g,d),0}catch(i){return-1048576!==t.ioReader.error?(h.z3(`read packet error, ${i}`,y,478),g.LR):t.ioReader.error}}async syncPage(t){let i=b.Dh,e=BigInt(0);for(;;)try{if("OggS"===await t.ioReader.peekString(4)){i=t.ioReader.getPos(),this.page.reset(),await this.page.read(t.ioReader),e=this.page.granulePosition;let s=0;for(;3!==s&&"OggS"===await t.ioReader.peekString(4);)s++,this.page.reset(),await this.page.read(t.ioReader);if(3===s)break}await t.ioReader.skip(1)}catch(t){break}if(i!==b.Dh){for(await t.ioReader.seek(i);1&(await t.ioReader.peekBuffer(6))[5];)this.page.reset(),await this.page.read(t.ioReader),e=this.page.granulePosition;this.currentPts=e-this.firstGranulePosition,this.curSegIndex=-1}}async seek(t,i,e,s){const r=t.ioReader.getPos();if(2&s){const i=await t.ioReader.fileSize();return i<=BigInt(0)?BigInt(g.E$):(ei&&(e=i),await t.ioReader.seek(e),4&s||await this.syncPage(t),r)}return(0,k.k)(e,i.timeBase,b.i0){e.d(i,{B:()=>h,h:()=>o});var s=e(134),r=e(77231),n=e(50011);class a{constructor(){(0,s.A)(this,"list",void 0),this.list=[]}read(t,i){for(let e=0;et+i),0);i&&(this.payload=await t.readBuffer(i))}async readPageHeader(t){if(this.capturePattern=await t.readString(4),this.streamStructureVersion=await t.readUint8(),this.headerTypeFlag=await t.readUint8(),this.granulePosition=await t.readUint64(),this.serialNumber=await t.readUint32(),this.pageSequenceNumber=await t.readUint32(),this.crcCheckSum=await t.readUint32(),this.numberPageSegments=await t.readUint8(),this.numberPageSegments)for(let i=0;i{e.d(i,{o:()=>h,q:()=>a});var s=e(134),r=e(38743);class n{constructor(){(0,s.A)(this,"streamCount",void 0),(0,s.A)(this,"coupledStreamCount",void 0),(0,s.A)(this,"mapping",void 0),this.streamCount=1,this.coupledStreamCount=0,this.mapping=new Uint8Array(1)}read(t){this.streamCount=t.readUint8(),this.coupledStreamCount=t.readUint8(),this.mapping=t.readBuffer(this.streamCount+this.coupledStreamCount)}write(t){t.writeUint8(this.streamCount),t.writeUint8(this.coupledStreamCount),t.writeBuffer(this.mapping)}}class a{constructor(){(0,s.A)(this,"streamIndex",void 0),(0,s.A)(this,"signature",void 0),(0,s.A)(this,"version",void 0),(0,s.A)(this,"channels",void 0),(0,s.A)(this,"preSkip",void 0),(0,s.A)(this,"sampleRate",void 0),(0,s.A)(this,"outputGain",void 0),(0,s.A)(this,"channelMappingFamily",void 0),(0,s.A)(this,"channelMappingTable",void 0),this.signature="OpusHead",this.version=1,this.channels=1,this.preSkip=0,this.sampleRate=48e3,this.outputGain=0,this.channelMappingFamily=0,this.channelMappingTable=new n}read(t){this.signature=t.readString(8),this.version=t.readUint8(),this.channels=t.readUint8(),this.preSkip=t.readUint16(),this.sampleRate=t.readUint32(),this.outputGain=t.readInt16(),this.channelMappingFamily=t.readUint8(),0!==this.channelMappingFamily&&this.channelMappingTable.read(t)}write(t){t.writeString(this.signature),t.writeUint8(this.version),t.writeUint8(this.channels),t.writeUint16(this.preSkip),t.writeUint32(this.sampleRate),t.writeInt16(this.outputGain),t.writeUint8(this.channelMappingFamily),0!==this.channelMappingFamily&&this.channelMappingTable.write(t)}setCodec(t){this.sampleRate=t.sampleRate,this.channels=t.chLayout.nbChannels,this.channelMappingFamily=t.format}}class h extends r.h{constructor(){super(),this.signature="OpusTags"}read(t){this.signature=t.readString(8),super.read(t)}write(t){t.writeString(this.signature),super.write(t)}addComment(t){this.comments.addComment(t)}setCodec(t){}}},87400:(t,i,e)=>{e.d(i,{G:()=>a,m:()=>n});var s=e(134),r=e(38743);class n{constructor(t="vorbis"){(0,s.A)(this,"streamIndex",void 0),(0,s.A)(this,"packetType",void 0),(0,s.A)(this,"signature",void 0),(0,s.A)(this,"version",void 0),(0,s.A)(this,"channels",void 0),(0,s.A)(this,"sampleRate",void 0),(0,s.A)(this,"bitrateMaximum",void 0),(0,s.A)(this,"bitrateNominal",void 0),(0,s.A)(this,"bitrateMinimum",void 0),(0,s.A)(this,"blocksize0",void 0),(0,s.A)(this,"blocksize1",void 0),(0,s.A)(this,"framingFlag",void 0),this.signature=t,this.version=0,this.channels=1,this.sampleRate=48e3,this.bitrateMaximum=0,this.bitrateNominal=0,this.bitrateMinimum=0,this.blocksize0=2048,this.blocksize1=256}read(t){this.packetType=t.readUint8(),this.signature=t.readString(6),this.version=t.readUint32(),this.channels=t.readUint8(),this.sampleRate=t.readInt32(),this.bitrateMaximum=t.readInt32(),this.bitrateNominal=t.readInt32(),this.bitrateMinimum=t.readInt32();const i=255&t.readUint8();this.blocksize0=Math.pow(2,i>>>4),this.blocksize1=Math.pow(2,15&i),this.framingFlag=t.readUint8()}write(t){t.writeUint8(1),t.writeString(this.signature),t.writeUint32(this.version),t.writeUint8(this.channels),t.writeInt32(this.sampleRate),t.writeInt32(this.bitrateMaximum),t.writeInt32(this.bitrateNominal),t.writeInt32(this.bitrateMinimum),t.writeUint8(Math.log2(this.blocksize0)<<4|Math.log2(this.blocksize1)),t.writeUint8(1)}setCodec(t){this.sampleRate=t.sampleRate,this.channels=t.chLayout.nbChannels}}class a extends r.h{constructor(t="vorbis"){super(),(0,s.A)(this,"packetType",void 0),(0,s.A)(this,"framingFlag",void 0),this.signature=t,this.packetType=1,this.framingFlag=1}read(t){this.packetType=t.readUint8(),this.signature=t.readString(6),super.read(t),"vorbis"===this.signature&&(this.framingFlag=t.readUint8())}write(t){t.writeUint8(this.packetType),t.writeString(this.signature),super.write(t),"vorbis"===this.signature&&t.writeUint8(this.framingFlag)}addComment(t){this.comments.addComment(t)}setCodec(t){}}},2187:(t,i,e)=>{e.d(i,{d:()=>a});var s=e(72739),r=e(44328),n=e(77231);function a(t,i,e){let a=BigInt(0);return s.__(t,(t=>{a+=t.codecpar.bitrate*(0,r.k)(i,e,n.i0)/BigInt(8e3)})),a}},52071:(t,i,e)=>{e.d(i,{A:()=>u});var s=e(63939),r=e(9599),n=e(29170),a=e(77231),h=e(44328),o=e(2187),d=e(71517),g=e(9705),l=e(4624);const p="src/avformat/function/seekInBytes.ts";async function u(t,i,e,u,f,c){const m=t.ioReader.getPos(),w=await t.ioReader.fileSize();let b=a.Dh,I=e;i.startTime!==a.Dh?I-=i.startTime:I-=i.firstDTS;const k=(0,h.k)(e,i.timeBase,a.i0);if(kB&&(S=B),S=0)){b=a.Dh;break}{const t=(0,h.k)(s.f[17](y+8),(0,n.A)(y+72,r.P),a.i0),e=t-k;if(l.Yz(`try to seek to pos: ${S}, got packet pts: ${s.f[17](y+8)}(${t}ms), diff: ${e}ms`,p,102),e<=BigInt(0)&&-eBigInt(0)?(P=S,S=A+P>>BigInt(1)):(A=S,S=A+P>>BigInt(1))}if(8&t.ioReader.flags)break}return(0,d.Qe)(y),b!==a.Dh?(l.Yz(`finally seek to pos ${b}`,p,133),await t.ioReader.seek(b),await c(t),m):(await t.ioReader.seek(m),8&t.ioReader.flags?BigInt(g.LT):BigInt(g.E$))}},82348:(t,i,e)=>{e.d(i,{A:()=>h});var s=e(134),r=e(4624),n=e(50011);const a="src/common/io/IOReaderSync.ts";class h{constructor(t=1048576,i=!0,e){if((0,s.A)(this,"data",void 0),(0,s.A)(this,"buffer",void 0),(0,s.A)(this,"pointer",void 0),(0,s.A)(this,"endPointer",void 0),(0,s.A)(this,"pos",void 0),(0,s.A)(this,"size",void 0),(0,s.A)(this,"littleEndian",void 0),(0,s.A)(this,"fileSize_",void 0),(0,s.A)(this,"error",void 0),(0,s.A)(this,"onFlush",void 0),(0,s.A)(this,"onSeek",void 0),(0,s.A)(this,"onSize",void 0),(0,s.A)(this,"flags",void 0),this.pos=BigInt(0),this.pointer=0,this.error=0,this.endPointer=0,this.littleEndian=!i,this.flags=0,e&&e.view)this.size=e.length,this.buffer=e,this.data=e.view;else if(e&&!e.byteOffset)this.size=e.length,this.buffer=e,this.data=new DataView(this.buffer.buffer);else{if(e)throw new Error("not support subarray of ArrayBuffer");this.size=Math.max(t,102400),this.buffer=new Uint8Array(this.size),this.data=new DataView(this.buffer.buffer)}}readUint8(){this.remainingLength()<1&&this.flush(1);const t=this.data.getUint8(this.pointer);return this.pointer++,this.pos++,t}peekUint8(){return this.remainingLength()<1&&this.flush(1),this.data.getUint8(this.pointer)}readUint16(){this.remainingLength()<2&&this.flush(2);const t=this.data.getUint16(this.pointer,this.littleEndian);return this.pointer+=2,this.pos+=BigInt(2),t}peekUint16(){return this.remainingLength()<2&&this.flush(2),this.data.getUint16(this.pointer,this.littleEndian)}readUint24(){this.remainingLength()<3&&this.flush(3);const t=this.readUint16(),i=this.readUint8();return this.littleEndian?i<<16|t:t<<8|i}peekUint24(){this.remainingLength()<3&&this.flush(3);const t=this.pointer,i=this.pos,e=this.readUint16(),s=this.readUint8(),r=this.littleEndian?s<<16|e:e<<8|s;return this.pointer=t,this.pos=i,r}readUint32(){this.remainingLength()<4&&this.flush(4);const t=this.data.getUint32(this.pointer,this.littleEndian);return this.pointer+=4,this.pos+=BigInt(4),t}peekUint32(){return this.remainingLength()<4&&this.flush(4),this.data.getUint32(this.pointer,this.littleEndian)}readUint64(){this.remainingLength()<8&&this.flush(8);const t=this.data.getBigUint64(this.pointer,this.littleEndian);return this.pointer+=8,this.pos+=BigInt(8),t}peekUint64(){return this.remainingLength()<8&&this.flush(8),this.data.getBigUint64(this.pointer,this.littleEndian)}readInt8(){this.remainingLength()<1&&this.flush(1);const t=this.data.getInt8(this.pointer);return this.pointer++,this.pos++,t}peekInt8(){return this.remainingLength()<1&&this.flush(1),this.data.getInt8(this.pointer)}readInt16(){this.remainingLength()<2&&this.flush(2);const t=this.data.getInt16(this.pointer,this.littleEndian);return this.pointer+=2,this.pos+=BigInt(2),t}peekInt16(){return this.remainingLength()<2&&this.flush(2),this.data.getInt16(this.pointer,this.littleEndian)}readInt24(){const t=this.readUint24();return 8388608&t?t-16777216:t}peekInt24(){const t=this.peekUint24();return 8388608&t?t-16777216:t}readInt32(){this.remainingLength()<4&&this.flush(4);const t=this.data.getInt32(this.pointer,this.littleEndian);return this.pointer+=4,this.pos+=BigInt(4),t}peekInt32(){return this.remainingLength()<4&&this.flush(4),this.data.getInt32(this.pointer,this.littleEndian)}readInt64(){this.remainingLength()<8&&this.flush(8);const t=this.data.getBigInt64(this.pointer,this.littleEndian);return this.pointer+=8,this.pos+=BigInt(8),t}peekInt64(){return this.remainingLength()<8&&this.flush(8),this.data.getBigInt64(this.pointer,this.littleEndian)}readFloat(){this.remainingLength()<4&&this.flush(4);const t=this.data.getFloat32(this.pointer,this.littleEndian);return this.pointer+=4,this.pos+=BigInt(4),t}peekFloat(){return this.remainingLength()<4&&this.flush(4),this.data.getFloat32(this.pointer,this.littleEndian)}readDouble(){this.remainingLength()<8&&this.flush(8);const t=this.data.getFloat64(this.pointer,this.littleEndian);return this.pointer+=8,this.pos+=BigInt(8),t}peekDouble(){return this.remainingLength()<8&&this.flush(8),this.data.getFloat64(this.pointer,this.littleEndian)}readHex(t=1){let i="";for(let e=0;ethis.size&&(this.error=-1048574,r.h2("peekHex, length too large",a,412)),this.remainingLength()0){const s=this.remainingLength();i.set(this.buffer.subarray(this.pointer,this.pointer+s),e),e+=s,this.pointer+=s,this.pos+=BigInt(s),t-=s}for(;t>0;){this.flush();const s=Math.min(this.endPointer-this.pointer,t);i.set(this.buffer.subarray(this.pointer,this.pointer+s),e),e+=s,this.pointer+=s,this.pos+=BigInt(s),t-=s}}else i.set(this.buffer.subarray(this.pointer,this.pointer+t),0),this.pointer+=t,this.pos+=BigInt(t);return i}peekBuffer(t,i){return t?(t>this.size&&(this.error=-1048574,r.h2("peekBuffer, length too large",a,505)),this.remainingLength()0){const s=this.remainingLength();i.set(this.buffer.subarray(this.pointer,this.pointer+s),e),e+=s,this.pointer+=s,this.pos+=BigInt(s),t-=s}for(;t>0;){try{this.flush()}catch(t){if(-1048576===this.error&&e)return e;throw t}const s=Math.min(this.endPointer-this.pointer,t);i.set(this.buffer.subarray(this.pointer,this.pointer+s),e),e+=s,this.pointer+=s,this.pos+=BigInt(s),t-=s}return e}return i.set(this.buffer.subarray(this.pointer,this.pointer+t),0),this.pointer+=t,this.pos+=BigInt(t),t}readString(t=1){const i=this.readBuffer(t);return n.decode(i)}peekString(t=1){const i=this.peekBuffer(t);return n.decode(i)}readLine(){let t="";for(;;){let i=!1;for(let e=this.pointer;e=t&&(this.pointer+=t),this.pos+=BigInt(i)}remainingLength(){return this.endPointer-this.pointer}flush(t=0){if(this.onFlush||(this.error=-1048574,r.h2("IOReader error, flush failed because of no flush callback",a,720)),!(this.size-this.remainingLength()<=0)){if(t=Math.min(t,this.size),this.pointer0&&this.pointer+i=t.length)this.buffer.set(t,this.endPointer),this.endPointer+=t.length;else if(this.buffer.set(this.buffer.subarray(this.pointer,this.endPointer),0),this.endPointer=this.endPointer-this.pointer,this.pointer=0,this.size-this.endPointer>=t.length)this.buffer.set(t,this.endPointer),this.endPointer+=t.length;else{const i=Math.min(this.size-this.endPointer,t.length);this.buffer.set(t.subarray(0,i),this.endPointer),this.endPointer+=i,r.R8("IOReader, call appendBuffer but the buffer's size is lagger then the remaining size",a,838)}}reset(){this.pointer=this.endPointer=0,this.pos=BigInt(0),this.error=0}setEndian(t){this.littleEndian=!t}fileSize(){if(this.fileSize_)return this.fileSize_;if(!this.onSize)return r.R8("IOReader error, fileSize failed because of no onSize callback",a,871),BigInt(0);try{this.fileSize_=this.onSize()}catch(t){r.R8(`IOReader error, call fileSize failed: ${t}`,a,878),this.fileSize_=BigInt(0)}return this.fileSize_}getBufferSize(){return this.size}pipe(t,i){if(i)if(this.remainingLength()0){const e=this.remainingLength();t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+e)),this.pointer+=e,this.pos+=BigInt(e),i-=e}for(;i>0;){this.flush();const e=Math.min(this.endPointer-this.pointer,i);t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+e)),this.pointer+=e,this.pos+=BigInt(e),i-=e}}else t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+i)),this.pointer+=i,this.pos+=BigInt(i);else{if(this.remainingLength()>0){const i=this.remainingLength();t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+i)),this.pointer+=i,this.pos+=BigInt(i)}for(;this.onFlush(this.buffer.subarray(0))>0;){const i=this.remainingLength();t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+i)),this.pointer+=i,this.pos+=BigInt(i)}}}}},35336:(t,i,e)=>{e.d(i,{A:()=>n});var s=e(134),r=e(50011);class n{constructor(t=1048576,i=!0,e){if((0,s.A)(this,"data",void 0),(0,s.A)(this,"buffer",void 0),(0,s.A)(this,"pointer",void 0),(0,s.A)(this,"pos",void 0),(0,s.A)(this,"size",void 0),(0,s.A)(this,"littleEndian",void 0),(0,s.A)(this,"error",void 0),(0,s.A)(this,"onFlush",void 0),(0,s.A)(this,"onSeek",void 0),this.pointer=0,this.pos=BigInt(0),this.size=t,this.littleEndian=!i,this.error=0,e&&e.view)this.size=e.length,this.buffer=e,this.data=e.view;else if(e&&!e.byteOffset)this.size=e.length,this.buffer=e,this.data=new DataView(this.buffer.buffer);else{if(e)throw new Error("not support subarray of ArrayBuffer");this.buffer=new Uint8Array(this.size),this.data=new DataView(this.buffer.buffer)}}writeUint8(t){this.remainingLength()<1&&this.flush(),this.data.setUint8(this.pointer,t),this.pointer++,this.pos++}writeUint16(t){this.remainingLength()<2&&this.flush(),this.data.setUint16(this.pointer,t,this.littleEndian),this.pointer+=2,this.pos+=BigInt(2)}writeUint24(t){this.remainingLength()<3&&this.flush();const i=(16711680&t)>>16,e=(65280&t)>>8,s=255&t;this.littleEndian?(this.writeUint8(s),this.writeUint8(e),this.writeUint8(i)):(this.writeUint8(i),this.writeUint8(e),this.writeUint8(s))}writeUint32(t){this.remainingLength()<4&&this.flush(),this.data.setUint32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}writeUint64(t){this.remainingLength()<8&&this.flush(),this.data.setBigUint64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}writeInt8(t){this.remainingLength()<1&&this.flush(),this.data.setInt8(this.pointer,t),this.pointer++,this.pos++}writeInt16(t){this.remainingLength()<2&&this.flush(),this.data.setInt16(this.pointer,t,this.littleEndian),this.pointer+=2,this.pos+=BigInt(2)}writeInt24(t){this.writeUint24(t<0?t+16777216:t)}writeInt32(t){this.remainingLength()<4&&this.flush(),this.data.setInt32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}writeInt64(t){this.remainingLength()<8&&this.flush(),this.data.setBigInt64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}writeFloat(t){this.remainingLength()<4&&this.flush(),this.data.setFloat32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}writeDouble(t){this.remainingLength()<8&&this.flush(),this.data.setFloat64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}getPointer(){return this.pointer}getPos(){return this.pos}remainingLength(){return this.size-this.pointer}writeBuffer(t){if(!t.length)return;let i=t.length;if(this.remainingLength()0;){this.flush();const s=Math.min(this.size,i);this.buffer.set(t.subarray(e,e+s),this.pointer),this.pointer+=s,this.pos+=BigInt(s),e+=s,i-=s}}else this.buffer.set(t,this.pointer),this.pointer+=i,this.pos+=BigInt(i)}writeString(t){const i=r.encode(t);return this.writeBuffer(i),i.length}flush(){if(!this.onFlush)throw this.error=-1048574,Error("IOWriter error, flush failed because of no flush callback");if(this.pointer){const t=this.onFlush(this.buffer.subarray(0,this.pointer));if(0!==t)throw this.error=t,Error("IOWriter error, flush failed")}this.pointer=0}flushToPos(t){if(!this.onFlush)throw this.error=-1048574,Error("IOWriter error, flush failed because of no flush callback");if(this.pointer){const i=this.onFlush(this.buffer.subarray(0,this.pointer),t);if(0!==i)throw this.error=i,Error("IOWriter error, flush failed")}this.pointer=0}seek(t){if(!this.onSeek)throw this.error=-1048574,Error("IOWriter error, seek failed because of no seek callback");this.flush();const i=this.onSeek(t);if(0!==i)throw this.error=i,Error("IOWriter error, seek failed");this.pos=t}seekInline(t){const i=this.pointer;this.pointer=Math.max(0,Math.min(this.size,t)),this.pos+=BigInt(this.pointer-i)}skip(t){const i=this.pointer;this.pointer=Math.min(this.size,this.pointer+t),this.pos+=BigInt(this.pointer-i)}back(t){const i=this.pointer;this.pointer=Math.max(0,this.pointer-t),this.pos+=BigInt(this.pointer-i)}getBuffer(){return this.buffer.subarray(0,this.pointer)}setEndian(t){this.littleEndian=!t}reset(){this.pointer=0,this.pos=BigInt(0),this.error=0}getBufferSize(){return this.size}}}}]); \ No newline at end of file +"use strict";(self.webpackChunkAVPlayer=self.webpackChunkAVPlayer||[]).push([[118],{85947:(t,i,e)=>{e.d(i,{A:()=>r});var s=e(134);class r{constructor(){(0,s.A)(this,"type",-1),(0,s.A)(this,"onStreamAdd",void 0)}async destroy(t){}}},29118:(t,i,e)=>{e.r(i),e.d(i,{default:()=>P});var s=e(134),r=e(63939),n=e(50932),a=e(38743),h=e(4624),o=e(54712),d=e(87400),g=e(9705),l=e(92647),p=e(85947),u=e(14686),f=e(37837),c=e(71517),m=e(82348),w=e(35336),b=e(77231),I=e(52071),k=e(44328),S=e(72739),B=e(79630),v=e(43607);const y="src/avformat/formats/IOggFormat.ts";class P extends p.A{constructor(){super(),(0,s.A)(this,"type",4),(0,s.A)(this,"headerPagesPayload",void 0),(0,s.A)(this,"page",void 0),(0,s.A)(this,"curSegIndex",void 0),(0,s.A)(this,"curSegStart",void 0),(0,s.A)(this,"segCount",void 0),(0,s.A)(this,"segIndex",void 0),(0,s.A)(this,"currentPts",void 0),(0,s.A)(this,"firstPos",void 0),(0,s.A)(this,"firstGranulePosition",void 0),(0,s.A)(this,"paddingPayload",void 0),this.page=new a.B,this.headerPagesPayload=[]}init(t){t.ioReader&&t.ioReader.setEndian(!1),t.ioReader&&t.ioReader.setEndian(!1),this.curSegIndex=-1,this.curSegStart=0,this.currentPts=BigInt(0),this.segCount=0,this.segIndex=0,this.firstGranulePosition=BigInt(0)}async estimateTotalBlock(t){let i=BigInt(0);const e=t.ioReader.getPos(),s=this.currentPts,r=await t.ioReader.fileSize();for(await t.ioReader.seek(v.T9(r-BigInt(195072),BigInt(0))),await this.syncPage(t);;)try{this.page.reset(),await this.page.read(t.ioReader),i=this.page.granulePosition}catch(t){break}return await t.ioReader.seek(e),this.currentPts=s,i}async getNextSegment(t){if(this.curSegIndex<0){this.page.granulePosition>BigInt(0)&&(this.currentPts=this.page.granulePosition),this.page.reset(),await this.page.read(t.ioReader),this.curSegIndex=0,this.curSegStart=0,this.segIndex=-1,this.segCount=0;for(let t=0;t{const e=t.split("=");if(e.length>1){const t=e.shift(),s=e.join("=");i.metadata[t]=s}}))}async createStream(t,i){if(i.length<8)return 0;let e=new m.A(i.length,!1);e.appendBuffer(i);const s=e.peekString(8);if("OpusHead"===s){const s=new o.q;s.read(e);const r=new o.o;i=await this.getNextSegment(t),e=new m.A(i.length,!1),e.appendBuffer(i),r.read(e),this.headerPagesPayload=[s,r];const n=t.createStream();n.codecpar.codecType=1,n.codecpar.codecId=86076,n.codecpar.sampleRate=s.sampleRate,n.codecpar.chLayout.nbChannels=s.channels,n.timeBase.den=n.codecpar.sampleRate,n.timeBase.num=1,n.privData={serialNumber:this.page.serialNumber},this.addComment(r,n),n.duration=await this.estimateTotalBlock(t)}else if("vorbis"===s.slice(1,7)){const s=[i],r=new d.m;r.read(e);const n=new d.G;i=await this.getNextSegment(t),e=new m.A(i.length,!1),e.appendBuffer(i),n.read(e),s.push(i),this.headerPagesPayload=[r,n];const a=t.createStream();a.codecpar.codecType=1,a.codecpar.codecId=86021,a.codecpar.sampleRate=r.sampleRate,a.codecpar.chLayout.nbChannels=r.channels,a.timeBase.den=a.codecpar.sampleRate,a.timeBase.num=1,a.privData={serialNumber:this.page.serialNumber},this.addComment(n,a),s.push(await this.getNextSegment(t));const h=s.reduce(((t,i)=>t+2+i.length),0),o=(0,f.sY)(h),g=new w.A(h,!0,new B.A(o,h));s.forEach((t=>{g.writeUint16(t.length),g.writeBuffer(t)})),a.codecpar.extradata=o,a.codecpar.extradataSize=h,a.duration=await this.estimateTotalBlock(t)}else if("FLAC"===s.slice(1,5)){e.setEndian(!0),e.skip(1),e.skip(4),e.skip(1),e.skip(1),e.readUint16(),e.skip(4);const s=e.readUint8(),r=e.readUint24();if(0!==s)return g.LR;{const s=t.createStream();s.codecpar.codecType=1,s.codecpar.codecId=86028;const n=(0,f.sY)(r);e.peekBuffer(r,(0,u.s3)(n,r)),e.skip(10);const h=e.readUint24();s.codecpar.sampleRate=h>>4,s.codecpar.chLayout.nbChannels=1+((15&h)>>>1),s.timeBase.den=s.codecpar.sampleRate,s.timeBase.num=1,s.privData={serialNumber:this.page.serialNumber},s.codecpar.extradata=n,s.codecpar.extradataSize=r;const o=new a.h;i=await this.getNextSegment(t),e=new m.A(i.length-4,!1),e.appendBuffer(i.subarray(4)),o.read(e),s.duration=await this.estimateTotalBlock(t),this.addComment(o,s),this.headerPagesPayload=[o]}}else{if("Speex"!==s.slice(0,5))return 0;{const s=t.createStream();s.codecpar.codecType=1,s.codecpar.codecId=86051;const r=(0,f.sY)(i.length);(0,u.lW)(r,i.length,i),s.codecpar.extradata=r,s.codecpar.extradataSize=i.length,e.seek(BigInt(36)),s.codecpar.sampleRate=e.readUint32(),e.seek(BigInt(48)),s.codecpar.chLayout.nbChannels=e.readUint32(),s.timeBase.den=s.codecpar.sampleRate,s.timeBase.num=1,s.privData={serialNumber:this.page.serialNumber};const n=new a.h;i=await this.getNextSegment(t),e=new m.A(i.length,!1),e.appendBuffer(i),n.read(e),s.duration=await this.estimateTotalBlock(t),this.addComment(n,s),this.headerPagesPayload=[n]}}return 1}async readHeader(t){try{if("OggS"!==await t.ioReader.peekString(4))return h.z3("the file format is not oggs",y,387),g.LR;for(;;){let i=this.paddingPayload||await this.getNextSegment(t);this.paddingPayload&&(this.paddingPayload=null);const e=await this.createStream(t,i);if(e<0)return e;if(!e){this.paddingPayload=i;break}}return this.firstPos=this.paddingPayload?this.page.pos:t.ioReader.getPos(),0}catch(i){return h.z3(i.message,y,409),t.ioReader.error}}async readAVPacket(t,i){n.M[17](i+56,t.ioReader.getPos());try{const e=this.paddingPayload||await this.getNextSegment(t);this.paddingPayload&&(this.paddingPayload=null);let s=this.currentPts+(this.page.granulePosition-this.currentPts)/BigInt(Math.floor(this.segCount))*BigInt(Math.floor(this.segIndex));n.M[17](i+16,s),n.M[17](i+8,s),this.firstGranulePosition||(this.firstGranulePosition=this.page.granulePosition);const a=t.streams.find((t=>t.privData&&t.privData.serialNumber===this.page.serialNumber));if(!a)return await this.createStream(t,e),this.readAVPacket(t,i);n.M[15](i+32,a.index),n.M[15](i+76,a.timeBase.den),n.M[15](i+72,a.timeBase.num),1===a.codecpar.codecType&&n.M[15](i+36,1|r.f[15](i+36));const h=[e];for(;this.curSegIndex<0;)try{if(!(1&(await t.ioReader.peekBuffer(6))[5]))break;h.push(await this.getNextSegment(t))}catch(t){break}const o=(0,l.A)(Uint8Array,h),d=o.length,g=(0,f.sY)(d);return(0,u.lW)(g,d,o),(0,c.NX)(i,g,d),0}catch(i){return-1048576!==t.ioReader.error?(h.z3(`read packet error, ${i}`,y,478),g.LR):t.ioReader.error}}async syncPage(t){let i=b.Dh,e=BigInt(0);for(;;)try{if("OggS"===await t.ioReader.peekString(4)){i=t.ioReader.getPos(),this.page.reset(),await this.page.read(t.ioReader),e=this.page.granulePosition;let s=0;for(;3!==s&&"OggS"===await t.ioReader.peekString(4);)s++,this.page.reset(),await this.page.read(t.ioReader);if(3===s)break}await t.ioReader.skip(1)}catch(t){break}if(i!==b.Dh){for(await t.ioReader.seek(i);1&(await t.ioReader.peekBuffer(6))[5];)this.page.reset(),await this.page.read(t.ioReader),e=this.page.granulePosition;this.currentPts=e-this.firstGranulePosition,this.curSegIndex=-1}}async seek(t,i,e,s){const r=t.ioReader.getPos();if(2&s){const i=await t.ioReader.fileSize();return i<=BigInt(0)?BigInt(g.E$):(ei&&(e=i),await t.ioReader.seek(e),4&s||await this.syncPage(t),r)}return(0,k.k)(e,i.timeBase,b.i0){e.d(i,{B:()=>h,h:()=>o});var s=e(134),r=e(77231),n=e(50011);class a{constructor(){(0,s.A)(this,"list",void 0),this.list=[]}read(t,i){for(let e=0;et+i),0);i&&(this.payload=await t.readBuffer(i))}async readPageHeader(t){if(this.capturePattern=await t.readString(4),this.streamStructureVersion=await t.readUint8(),this.headerTypeFlag=await t.readUint8(),this.granulePosition=await t.readUint64(),this.serialNumber=await t.readUint32(),this.pageSequenceNumber=await t.readUint32(),this.crcCheckSum=await t.readUint32(),this.numberPageSegments=await t.readUint8(),this.numberPageSegments)for(let i=0;i{e.d(i,{o:()=>h,q:()=>a});var s=e(134),r=e(38743);class n{constructor(){(0,s.A)(this,"streamCount",void 0),(0,s.A)(this,"coupledStreamCount",void 0),(0,s.A)(this,"mapping",void 0),this.streamCount=1,this.coupledStreamCount=0,this.mapping=new Uint8Array(1)}read(t){this.streamCount=t.readUint8(),this.coupledStreamCount=t.readUint8(),this.mapping=t.readBuffer(this.streamCount+this.coupledStreamCount)}write(t){t.writeUint8(this.streamCount),t.writeUint8(this.coupledStreamCount),t.writeBuffer(this.mapping)}}class a{constructor(){(0,s.A)(this,"streamIndex",void 0),(0,s.A)(this,"signature",void 0),(0,s.A)(this,"version",void 0),(0,s.A)(this,"channels",void 0),(0,s.A)(this,"preSkip",void 0),(0,s.A)(this,"sampleRate",void 0),(0,s.A)(this,"outputGain",void 0),(0,s.A)(this,"channelMappingFamily",void 0),(0,s.A)(this,"channelMappingTable",void 0),this.signature="OpusHead",this.version=1,this.channels=1,this.preSkip=0,this.sampleRate=48e3,this.outputGain=0,this.channelMappingFamily=0,this.channelMappingTable=new n}read(t){this.signature=t.readString(8),this.version=t.readUint8(),this.channels=t.readUint8(),this.preSkip=t.readUint16(),this.sampleRate=t.readUint32(),this.outputGain=t.readInt16(),this.channelMappingFamily=t.readUint8(),0!==this.channelMappingFamily&&this.channelMappingTable.read(t)}write(t){t.writeString(this.signature),t.writeUint8(this.version),t.writeUint8(this.channels),t.writeUint16(this.preSkip),t.writeUint32(this.sampleRate),t.writeInt16(this.outputGain),t.writeUint8(this.channelMappingFamily),0!==this.channelMappingFamily&&this.channelMappingTable.write(t)}setCodec(t){this.sampleRate=t.sampleRate,this.channels=t.chLayout.nbChannels,this.channelMappingFamily=t.format}}class h extends r.h{constructor(){super(),this.signature="OpusTags"}read(t){this.signature=t.readString(8),super.read(t)}write(t){t.writeString(this.signature),super.write(t)}addComment(t){this.comments.addComment(t)}setCodec(t){}}},87400:(t,i,e)=>{e.d(i,{G:()=>a,m:()=>n});var s=e(134),r=e(38743);class n{constructor(t="vorbis"){(0,s.A)(this,"streamIndex",void 0),(0,s.A)(this,"packetType",void 0),(0,s.A)(this,"signature",void 0),(0,s.A)(this,"version",void 0),(0,s.A)(this,"channels",void 0),(0,s.A)(this,"sampleRate",void 0),(0,s.A)(this,"bitrateMaximum",void 0),(0,s.A)(this,"bitrateNominal",void 0),(0,s.A)(this,"bitrateMinimum",void 0),(0,s.A)(this,"blocksize0",void 0),(0,s.A)(this,"blocksize1",void 0),(0,s.A)(this,"framingFlag",void 0),this.signature=t,this.version=0,this.channels=1,this.sampleRate=48e3,this.bitrateMaximum=0,this.bitrateNominal=0,this.bitrateMinimum=0,this.blocksize0=2048,this.blocksize1=256}read(t){this.packetType=t.readUint8(),this.signature=t.readString(6),this.version=t.readUint32(),this.channels=t.readUint8(),this.sampleRate=t.readInt32(),this.bitrateMaximum=t.readInt32(),this.bitrateNominal=t.readInt32(),this.bitrateMinimum=t.readInt32();const i=255&t.readUint8();this.blocksize0=Math.pow(2,i>>>4),this.blocksize1=Math.pow(2,15&i),this.framingFlag=t.readUint8()}write(t){t.writeUint8(1),t.writeString(this.signature),t.writeUint32(this.version),t.writeUint8(this.channels),t.writeInt32(this.sampleRate),t.writeInt32(this.bitrateMaximum),t.writeInt32(this.bitrateNominal),t.writeInt32(this.bitrateMinimum),t.writeUint8(Math.log2(this.blocksize0)<<4|Math.log2(this.blocksize1)),t.writeUint8(1)}setCodec(t){this.sampleRate=t.sampleRate,this.channels=t.chLayout.nbChannels}}class a extends r.h{constructor(t="vorbis"){super(),(0,s.A)(this,"packetType",void 0),(0,s.A)(this,"framingFlag",void 0),this.signature=t,this.packetType=1,this.framingFlag=1}read(t){this.packetType=t.readUint8(),this.signature=t.readString(6),super.read(t),"vorbis"===this.signature&&(this.framingFlag=t.readUint8())}write(t){t.writeUint8(this.packetType),t.writeString(this.signature),super.write(t),"vorbis"===this.signature&&t.writeUint8(this.framingFlag)}addComment(t){this.comments.addComment(t)}setCodec(t){}}},2187:(t,i,e)=>{e.d(i,{d:()=>a});var s=e(72739),r=e(44328),n=e(77231);function a(t,i,e){let a=BigInt(0);return s.__(t,(t=>{a+=t.codecpar.bitrate*(0,r.k)(i,e,n.i0)/BigInt(8e3)})),a}},52071:(t,i,e)=>{e.d(i,{A:()=>u});var s=e(63939),r=e(9599),n=e(29170),a=e(77231),h=e(44328),o=e(2187),d=e(71517),g=e(9705),l=e(4624);const p="src/avformat/function/seekInBytes.ts";async function u(t,i,e,u,f,c){const m=t.ioReader.getPos(),w=await t.ioReader.fileSize();let b=a.Dh,I=e;i.startTime!==a.Dh?I-=i.startTime:I-=i.firstDTS;const k=(0,h.k)(e,i.timeBase,a.i0);if(kB&&(S=B),S=0)){b=a.Dh;break}{const t=(0,h.k)(s.f[17](y+8),(0,n.A)(y+72,r.P),a.i0),e=t-k;if(l.Yz(`try to seek to pos: ${S}, got packet pts: ${s.f[17](y+8)}(${t}ms), diff: ${e}ms`,p,102),e<=BigInt(0)&&-eBigInt(0)?(P=S,S=A+P>>BigInt(1)):(A=S,S=A+P>>BigInt(1))}if(8&t.ioReader.flags)break}return(0,d.Qe)(y),b!==a.Dh?(l.Yz(`finally seek to pos ${b}`,p,133),await t.ioReader.seek(b),await c(t),m):(await t.ioReader.seek(m),8&t.ioReader.flags?BigInt(g.LT):BigInt(g.E$))}},82348:(t,i,e)=>{e.d(i,{A:()=>h});var s=e(134),r=e(4624),n=e(50011);const a="src/common/io/IOReaderSync.ts";class h{constructor(t=1048576,i=!0,e){if((0,s.A)(this,"data",void 0),(0,s.A)(this,"buffer",void 0),(0,s.A)(this,"pointer",void 0),(0,s.A)(this,"endPointer",void 0),(0,s.A)(this,"pos",void 0),(0,s.A)(this,"size",void 0),(0,s.A)(this,"littleEndian",void 0),(0,s.A)(this,"fileSize_",void 0),(0,s.A)(this,"error",void 0),(0,s.A)(this,"onFlush",void 0),(0,s.A)(this,"onSeek",void 0),(0,s.A)(this,"onSize",void 0),(0,s.A)(this,"flags",void 0),this.pos=BigInt(0),this.pointer=0,this.error=0,this.endPointer=0,this.littleEndian=!i,this.flags=0,e&&e.view)this.size=e.length,this.buffer=e,this.data=e.view;else if(e&&!e.byteOffset)this.size=e.length,this.buffer=e,this.data=new DataView(this.buffer.buffer);else{if(e)throw new Error("not support subarray of ArrayBuffer");this.size=Math.max(t,102400),this.buffer=new Uint8Array(this.size),this.data=new DataView(this.buffer.buffer)}}readUint8(){this.remainingLength()<1&&this.flush(1);const t=this.data.getUint8(this.pointer);return this.pointer++,this.pos++,t}peekUint8(){return this.remainingLength()<1&&this.flush(1),this.data.getUint8(this.pointer)}readUint16(){this.remainingLength()<2&&this.flush(2);const t=this.data.getUint16(this.pointer,this.littleEndian);return this.pointer+=2,this.pos+=BigInt(2),t}peekUint16(){return this.remainingLength()<2&&this.flush(2),this.data.getUint16(this.pointer,this.littleEndian)}readUint24(){this.remainingLength()<3&&this.flush(3);const t=this.readUint16(),i=this.readUint8();return this.littleEndian?i<<16|t:t<<8|i}peekUint24(){this.remainingLength()<3&&this.flush(3);const t=this.pointer,i=this.pos,e=this.readUint16(),s=this.readUint8(),r=this.littleEndian?s<<16|e:e<<8|s;return this.pointer=t,this.pos=i,r}readUint32(){this.remainingLength()<4&&this.flush(4);const t=this.data.getUint32(this.pointer,this.littleEndian);return this.pointer+=4,this.pos+=BigInt(4),t}peekUint32(){return this.remainingLength()<4&&this.flush(4),this.data.getUint32(this.pointer,this.littleEndian)}readUint64(){this.remainingLength()<8&&this.flush(8);const t=this.data.getBigUint64(this.pointer,this.littleEndian);return this.pointer+=8,this.pos+=BigInt(8),t}peekUint64(){return this.remainingLength()<8&&this.flush(8),this.data.getBigUint64(this.pointer,this.littleEndian)}readInt8(){this.remainingLength()<1&&this.flush(1);const t=this.data.getInt8(this.pointer);return this.pointer++,this.pos++,t}peekInt8(){return this.remainingLength()<1&&this.flush(1),this.data.getInt8(this.pointer)}readInt16(){this.remainingLength()<2&&this.flush(2);const t=this.data.getInt16(this.pointer,this.littleEndian);return this.pointer+=2,this.pos+=BigInt(2),t}peekInt16(){return this.remainingLength()<2&&this.flush(2),this.data.getInt16(this.pointer,this.littleEndian)}readInt24(){const t=this.readUint24();return 8388608&t?t-16777216:t}peekInt24(){const t=this.peekUint24();return 8388608&t?t-16777216:t}readInt32(){this.remainingLength()<4&&this.flush(4);const t=this.data.getInt32(this.pointer,this.littleEndian);return this.pointer+=4,this.pos+=BigInt(4),t}peekInt32(){return this.remainingLength()<4&&this.flush(4),this.data.getInt32(this.pointer,this.littleEndian)}readInt64(){this.remainingLength()<8&&this.flush(8);const t=this.data.getBigInt64(this.pointer,this.littleEndian);return this.pointer+=8,this.pos+=BigInt(8),t}peekInt64(){return this.remainingLength()<8&&this.flush(8),this.data.getBigInt64(this.pointer,this.littleEndian)}readFloat(){this.remainingLength()<4&&this.flush(4);const t=this.data.getFloat32(this.pointer,this.littleEndian);return this.pointer+=4,this.pos+=BigInt(4),t}peekFloat(){return this.remainingLength()<4&&this.flush(4),this.data.getFloat32(this.pointer,this.littleEndian)}readDouble(){this.remainingLength()<8&&this.flush(8);const t=this.data.getFloat64(this.pointer,this.littleEndian);return this.pointer+=8,this.pos+=BigInt(8),t}peekDouble(){return this.remainingLength()<8&&this.flush(8),this.data.getFloat64(this.pointer,this.littleEndian)}readHex(t=1){let i="";for(let e=0;ethis.size&&(this.error=-1048574,r.h2("peekHex, length too large",a,412)),this.remainingLength()0){const s=this.remainingLength();i.set(this.buffer.subarray(this.pointer,this.pointer+s),e),e+=s,this.pointer+=s,this.pos+=BigInt(s),t-=s}for(;t>0;){this.flush();const s=Math.min(this.endPointer-this.pointer,t);i.set(this.buffer.subarray(this.pointer,this.pointer+s),e),e+=s,this.pointer+=s,this.pos+=BigInt(s),t-=s}}else i.set(this.buffer.subarray(this.pointer,this.pointer+t),0),this.pointer+=t,this.pos+=BigInt(t);return i}peekBuffer(t,i){return t?(t>this.size&&(this.error=-1048574,r.h2("peekBuffer, length too large",a,505)),this.remainingLength()0){const s=this.remainingLength();i.set(this.buffer.subarray(this.pointer,this.pointer+s),e),e+=s,this.pointer+=s,this.pos+=BigInt(s),t-=s}for(;t>0;){try{this.flush()}catch(t){if(-1048576===this.error&&e)return e;throw t}const s=Math.min(this.endPointer-this.pointer,t);i.set(this.buffer.subarray(this.pointer,this.pointer+s),e),e+=s,this.pointer+=s,this.pos+=BigInt(s),t-=s}return e}return i.set(this.buffer.subarray(this.pointer,this.pointer+t),0),this.pointer+=t,this.pos+=BigInt(t),t}readString(t=1){const i=this.readBuffer(t);return n.decode(i)}peekString(t=1){const i=this.peekBuffer(t);return n.decode(i)}readLine(){let t="";for(;;){let i=!1;for(let e=this.pointer;e=t&&(this.pointer+=t),this.pos+=BigInt(i)}remainingLength(){return this.endPointer-this.pointer}flush(t=0){if(this.onFlush||(this.error=-1048574,r.h2("IOReader error, flush failed because of no flush callback",a,720)),!(this.size-this.remainingLength()<=0)){if(t=Math.min(t,this.size),this.pointer0&&this.pointer+i=t.length)this.buffer.set(t,this.endPointer),this.endPointer+=t.length;else if(this.buffer.set(this.buffer.subarray(this.pointer,this.endPointer),0),this.endPointer=this.endPointer-this.pointer,this.pointer=0,this.size-this.endPointer>=t.length)this.buffer.set(t,this.endPointer),this.endPointer+=t.length;else{const i=Math.min(this.size-this.endPointer,t.length);this.buffer.set(t.subarray(0,i),this.endPointer),this.endPointer+=i,r.R8("IOReader, call appendBuffer but the buffer's size is lagger then the remaining size",a,838)}}reset(){this.pointer=this.endPointer=0,this.pos=BigInt(0),this.error=0}setEndian(t){this.littleEndian=!t}fileSize(){if(this.fileSize_)return this.fileSize_;if(!this.onSize)return r.R8("IOReader error, fileSize failed because of no onSize callback",a,871),BigInt(0);try{this.fileSize_=this.onSize()}catch(t){r.R8(`IOReader error, call fileSize failed: ${t}`,a,878),this.fileSize_=BigInt(0)}return this.fileSize_}getBufferSize(){return this.size}pipe(t,i){if(i)if(this.remainingLength()0){const e=this.remainingLength();t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+e)),this.pointer+=e,this.pos+=BigInt(e),i-=e}for(;i>0;){this.flush();const e=Math.min(this.endPointer-this.pointer,i);t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+e)),this.pointer+=e,this.pos+=BigInt(e),i-=e}}else t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+i)),this.pointer+=i,this.pos+=BigInt(i);else{if(this.remainingLength()>0){const i=this.remainingLength();t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+i)),this.pointer+=i,this.pos+=BigInt(i)}for(;this.onFlush(this.buffer.subarray(0))>0;){const i=this.remainingLength();t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+i)),this.pointer+=i,this.pos+=BigInt(i)}}}}},35336:(t,i,e)=>{e.d(i,{A:()=>n});var s=e(134),r=e(50011);class n{constructor(t=1048576,i=!0,e){if((0,s.A)(this,"data",void 0),(0,s.A)(this,"buffer",void 0),(0,s.A)(this,"pointer",void 0),(0,s.A)(this,"pos",void 0),(0,s.A)(this,"size",void 0),(0,s.A)(this,"littleEndian",void 0),(0,s.A)(this,"error",void 0),(0,s.A)(this,"onFlush",void 0),(0,s.A)(this,"onSeek",void 0),this.pointer=0,this.pos=BigInt(0),this.size=t,this.littleEndian=!i,this.error=0,e&&e.view)this.size=e.length,this.buffer=e,this.data=e.view;else if(e&&!e.byteOffset)this.size=e.length,this.buffer=e,this.data=new DataView(this.buffer.buffer);else{if(e)throw new Error("not support subarray of ArrayBuffer");this.buffer=new Uint8Array(this.size),this.data=new DataView(this.buffer.buffer)}}writeUint8(t){this.remainingLength()<1&&this.flush(),this.data.setUint8(this.pointer,t),this.pointer++,this.pos++}writeUint16(t){this.remainingLength()<2&&this.flush(),this.data.setUint16(this.pointer,t,this.littleEndian),this.pointer+=2,this.pos+=BigInt(2)}writeUint24(t){this.remainingLength()<3&&this.flush();const i=(16711680&t)>>16,e=(65280&t)>>8,s=255&t;this.littleEndian?(this.writeUint8(s),this.writeUint8(e),this.writeUint8(i)):(this.writeUint8(i),this.writeUint8(e),this.writeUint8(s))}writeUint32(t){this.remainingLength()<4&&this.flush(),this.data.setUint32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}writeUint64(t){this.remainingLength()<8&&this.flush(),this.data.setBigUint64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}writeInt8(t){this.remainingLength()<1&&this.flush(),this.data.setInt8(this.pointer,t),this.pointer++,this.pos++}writeInt16(t){this.remainingLength()<2&&this.flush(),this.data.setInt16(this.pointer,t,this.littleEndian),this.pointer+=2,this.pos+=BigInt(2)}writeInt24(t){this.writeUint24(t<0?t+16777216:t)}writeInt32(t){this.remainingLength()<4&&this.flush(),this.data.setInt32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}writeInt64(t){this.remainingLength()<8&&this.flush(),this.data.setBigInt64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}writeFloat(t){this.remainingLength()<4&&this.flush(),this.data.setFloat32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}writeDouble(t){this.remainingLength()<8&&this.flush(),this.data.setFloat64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}getPointer(){return this.pointer}getPos(){return this.pos}remainingLength(){return this.size-this.pointer}writeBuffer(t){if(!t.length)return;let i=t.length;if(this.remainingLength()0;){this.flush();const s=Math.min(this.size,i);this.buffer.set(t.subarray(e,e+s),this.pointer),this.pointer+=s,this.pos+=BigInt(s),e+=s,i-=s}}else this.buffer.set(t,this.pointer),this.pointer+=i,this.pos+=BigInt(i)}writeString(t){const i=r.encode(t);return this.writeBuffer(i),i.length}flush(){if(!this.onFlush)throw this.error=-1048574,Error("IOWriter error, flush failed because of no flush callback");if(this.pointer){const t=this.onFlush(this.buffer.subarray(0,this.pointer));if(0!==t)throw this.error=t,Error("IOWriter error, flush failed")}this.pointer=0}flushToPos(t){if(!this.onFlush)throw this.error=-1048574,Error("IOWriter error, flush failed because of no flush callback");if(this.pointer){const i=this.onFlush(this.buffer.subarray(0,this.pointer),t);if(0!==i)throw this.error=i,Error("IOWriter error, flush failed")}this.pointer=0}seek(t){if(!this.onSeek)throw this.error=-1048574,Error("IOWriter error, seek failed because of no seek callback");this.flush();const i=this.onSeek(t);if(0!==i)throw this.error=i,Error("IOWriter error, seek failed");this.pos=t}seekInline(t){const i=this.pointer;this.pointer=Math.max(0,Math.min(this.size,t)),this.pos+=BigInt(this.pointer-i)}skip(t){const i=this.pointer;this.pointer=Math.min(this.size,this.pointer+t),this.pos+=BigInt(this.pointer-i)}back(t){const i=this.pointer;this.pointer=Math.max(0,this.pointer-t),this.pos+=BigInt(this.pointer-i)}getBuffer(){return this.buffer.subarray(0,this.pointer)}setEndian(t){this.littleEndian=!t}reset(){this.pointer=0,this.pos=BigInt(0),this.error=0}getBufferSize(){return this.size}}}}]); \ No newline at end of file diff --git a/dist/avplayer-ui/331.avplayer.js b/dist/avplayer-ui/331.avplayer.js index fae9890..751ebfa 100644 --- a/dist/avplayer-ui/331.avplayer.js +++ b/dist/avplayer-ui/331.avplayer.js @@ -1 +1 @@ -"use strict";(self.webpackChunkAVPlayer=self.webpackChunkAVPlayer||[]).push([[331],{64436:(e,t,a)=>{a.d(t,{A:()=>o});var r=a(134),i=a(63939),n=(a(77162),a(37837)),s=a(71766);class o{constructor(){(0,r.A)(this,"inCodecpar",void 0),(0,r.A)(this,"inTimeBase",void 0),(0,r.A)(this,"outCodecpar",void 0)}init(e,t){return this.inCodecpar=(0,n.Gy)(168),(0,s.Yi)(this.inCodecpar,e),this.inTimeBase={den:i.f[15](t+4),num:i.f[15](t)},0}destroy(){this.inCodecpar&&((0,s.dn)(this.inCodecpar),this.inCodecpar=0)}}},50848:(e,t,a)=>{a.d(t,{A:()=>x});var r=a(134),i=a(63939),n=a(50932),s=a(77162),o=a(29170),c=a(64436),d=a(14686),l=a(4624),p=a(9705),h=a(77231),f=a(95832),u=a(44328),m=a(37837),g=a(71517),A=a(67672);class x extends c.A{constructor(...e){super(...e),(0,r.A)(this,"streamMuxConfig",void 0),(0,r.A)(this,"caches",void 0)}init(e,t){return super.init(e,t),this.caches=[],this.streamMuxConfig={profile:h.N_,sampleRate:h.N_,channels:h.N_},0}sendAVPacket(e){let t=0,a=i.f[17](e+16)||i.f[17](e+8);const r=(0,d.s3)(i.f[20](e+24),i.f[15](e+28)).slice();for(;t{a.d(t,{A:()=>y});var r=a(134),i=a(63939),n=a(50932),s=a(77162),o=a(29170),c=a(64436),d=a(14686),l=a(4624),p=a(9705),h=a(77231),f=a(95832),u=a(44328),m=a(37837),g=a(71517),A=a(37246),x=a(67672);class y extends c.A{constructor(...e){super(...e),(0,r.A)(this,"bitReader",void 0),(0,r.A)(this,"streamMuxConfig",void 0),(0,r.A)(this,"caches",void 0),(0,r.A)(this,"refSampleDuration",void 0)}init(e,t){return super.init(e,t),this.caches=[],this.refSampleDuration=BigInt(0),this.bitReader=new A.A,this.streamMuxConfig={profile:h.N_,sampleRate:h.N_,channels:h.N_},0}sendAVPacket(e){const t=(0,d.s3)(i.f[20](e+24),i.f[15](e+28));this.bitReader.appendBuffer(t);let a=i.f[17](e+16)||i.f[17](e+8);for(;this.bitReader.remainingLength()>=20;){const e=this.bitReader.getPointer(),t=f.f7(null,this.bitReader);if(x.ai(t))return l.z3("AACLATMParser parse failed","src/avformat/bsf/aac/LATM2RawFilter.ts",94),this.bitReader.reset(),p.LR;if(t.framePayloadLength>=this.bitReader.remainingLength()){this.bitReader.skipPadding(),this.bitReader.setPointer(e);break}t.useSameStreamMux||(this.streamMuxConfig.profile=t.profile,this.streamMuxConfig.sampleRate=t.sampleRate,this.streamMuxConfig.channels=t.channels);const r=t.framePayloadLength,c=new Uint8Array(r);for(let e=0;e{a.d(t,{A:()=>m});var r=a(134),i=a(63939),n=a(50932),s=a(64436),o=a(77231),c=a(44328),d=a(22576),l=a(4624),p=a(9705),h=a(71517),f=a(37837),u=a(14686);class m extends s.A{constructor(...e){super(...e),(0,r.A)(this,"caches",void 0)}init(e,t){return super.init(e,t),this.caches=[],0}sendAVPacket(e){let t=0,a=i.f[17](e+16)||i.f[17](e+8);const r=(0,h.iI)(e);for(;t>5;if(1023!==e)return l.z3(`MpegtsOpusParser found syncWord not 0x3ff, got: 0x${e.toString(16)}`,"src/avformat/bsf/opus/Mpegts2RawFilter.ts",67),p.LR;const n=!!(16&r[t+1]),s=!!(8&r[t+1]);let h=t+2,f=0;for(;255===r[h];)f+=255,h++;f+=r[h],h++,h+=n?2:0,h+=s?2:0;let u=r.subarray(h,h+f);const m=i.f[15](this.inCodecpar+136)>0?i.f[15](this.inCodecpar+136):48e3,g=(0,c.k)(BigInt(Math.floor(d.kt(u)/m*o.SF)),o.KR,this.inTimeBase);this.caches.push({dts:a,buffer:u.slice(),duration:Number(g)}),a+=g,t=h+f}}receiveAVPacket(e){if(this.caches.length){(0,h.Up)(e);const t=this.caches.shift(),a=(0,f.sY)(t.buffer.length);return(0,u.lW)(a,t.buffer.length,t.buffer),(0,h.NX)(e,a,t.buffer.length),n.M[17](e+16,t.dts),n.M[17](e+8,t.dts),n.M[15](e+36,1|i.f[15](e+36)),n.M[17](e+48,BigInt(Math.floor(t.duration))),0}return p.LR}reset(){return 0}}},85947:(e,t,a)=>{a.d(t,{A:()=>i});var r=a(134);class i{constructor(){(0,r.A)(this,"type",-1),(0,r.A)(this,"onStreamAdd",void 0)}async destroy(e){}}},59331:(e,t,a)=>{a.r(t),a.d(t,{default:()=>z});var r=a(134),i=a(63939),n=a(50932),s=a(4624),o=a(19770),c=a(53783),d=a(27274),l=a(39e3),p=a(9705),h=a(51660),f=a(39144),u=a(52088),m=a(6403),g=a(85947),A=a(86191),x=a(71517),y=a(77231),I=a(52071),b=a(44328),P=a(72739),k=a(64093),M=a(62815),C=a(67659),S=a(59166),R=a(95832),v=a(22576),U=a(87518),w=a(43290),B=a(37837),L=a(14686),T=a(67672);const F="src/avformat/formats/IMpegtsFormat.ts";class z extends g.A{constructor(){super(),(0,r.A)(this,"type",2),(0,r.A)(this,"context",void 0),(0,r.A)(this,"firstTSPacketPos",void 0),(0,r.A)(this,"cacheAVPacket",void 0),this.context=(0,o.A)()}init(e){e.ioReader&&e.ioReader.setEndian(!0),this.cacheAVPacket=0}async destroy(e){this.cacheAVPacket&&((0,x.Qe)(this.cacheAVPacket),this.cacheAVPacket=0),P.__(e.streams,(e=>{const t=e.privData;t.filter&&(t.filter.destroy(),t.filter=null)}))}async readHeader(e){try{let t=0,a=await c.q(e.ioReader);for(a||(a=d.ZT),this.context.tsPacketSize=a,this.context.tsPacketSize!==d.VG&&71!==await e.ioReader.peekUint8()&&await this.syncTSPacket(e,!1);!this.context.hasPAT||!this.context.hasPMT;){const t=await c.n(e.ioReader,this.context);t.payload&&(0!==t.pid&&t.pid!==this.context.currentPmtPid&&134!==this.context.pmt.pid2StreamType.get(t.pid)||(0,l.A)(t,this.context))}return this.context.hasPAT&&this.context.hasPMT?(this.firstTSPacketPos=e.ioReader.getPos(),t):p.LR}catch(t){return s.z3(t.message,F,147),e.ioReader.error}}checkExtradata(e,t){if(!t.codecpar.extradata){let a=(0,x.rU)(e,1);if(!a)return;t.codecpar.extradata=(0,B.sY)(i.f[15](a+4)),(0,L.Mr)(t.codecpar.extradata,i.f[20](a),i.f[15](a+4)),t.codecpar.extradataSize=i.f[15](a+4),(0,x.Is)(e,1),27===t.codecpar.codecId?M.XC(t,(0,L.JW)(t.codecpar.extradata,t.codecpar.extradataSize)):173===t.codecpar.codecId?C.XC(t,(0,L.JW)(t.codecpar.extradata,t.codecpar.extradataSize)):196===t.codecpar.codecId?S.XC(t,(0,L.JW)(t.codecpar.extradata,t.codecpar.extradataSize)):86018===t.codecpar.codecId?R.XC(t,(0,L.JW)(t.codecpar.extradata,t.codecpar.extradataSize)):86076===t.codecpar.codecId&&v.XC(t,(0,L.JW)(t.codecpar.extradata,t.codecpar.extradataSize))}}parsePESSlice(e,t,a,r){const o=(0,f.A)(a);(0,h.A)(o),(o.randomAccessIndicator||1===r.codecpar.codecType)&&n.M[15](t+36,1|i.f[15](t+36));const c=r.codecpar.codecId;27!==c&&173!==c&&196!==c||n.M[15](t+80,2),n.M[15](t+32,r.index),n.M[17](t+16,o.dts),n.M[17](t+8,o.pts),n.M[17](t+56,o.pos),n.M[15](t+76,9e4),n.M[15](t+72,1),r.startTime===y.Dh&&(r.startTime=i.f[17](t+8)||i.f[17](t+16));const d=(0,B.sY)(o.payload.length);(0,L.lW)(d,o.payload.length,o.payload),(0,x.NX)(t,d,o.payload.length),(0,u.A)(a);const l=r.privData;if(l.filter){let a=0;if(a=l.filter.sendAVPacket(t),a<0)return s.z3("send avpacket to bsf failed",F,223),p.LR;if(a=l.filter.receiveAVPacket(t),a<0)return s.z3("receive avpacket from bsf failed",F,230),p.LR;for(n.M[15](t+76,9e4),n.M[15](t+72,1),n.M[15](t+32,r.index),this.checkExtradata(t,r);;){const t=this.cacheAVPacket||(0,x._5)();if(a=l.filter.receiveAVPacket(t),0!==a){this.cacheAVPacket=t;break}n.M[15](t+76,9e4),n.M[15](t+72,1),n.M[15](t+32,r.index),this.checkExtradata(t,r),e.interval.packetBuffer.push(t),this.cacheAVPacket=0}}else{const e=this.context.pmt.pid2StreamType.get(l.pid);if(3===e||4===e){n.M[15](t+36,1|i.f[15](t+36));const e=(0,x.iI)(t),a=e[1]>>>3&3,s=(6&e[1])>>1,o=(12&e[2])>>>2,c=3&~(e[3]>>>6)?2:1,d=k.Au(s),l=k.Y2(a,o);(r.codecpar.profile!==d||r.codecpar.sampleRate!==l||r.codecpar.chLayout.nbChannels!==c)&&(r.codecpar.profile=d,r.codecpar.sampleRate=l,r.codecpar.chLayout.nbChannels=c)}else if(27===r.codecpar.codecId)r.codecpar.extradata||(M.ci(t,!0),this.checkExtradata(t,r),r.codecpar.bitFormat=2);else if(173===r.codecpar.codecId)r.codecpar.extradata||(C.ci(t,!0),this.checkExtradata(t,r),r.codecpar.bitFormat=2);else if(196===r.codecpar.codecId)r.codecpar.extradata||(S.ci(t,!0),this.checkExtradata(t,r),r.codecpar.bitFormat=2);else if(86019===r.codecpar.codecId||86056===r.codecpar.codecId){if(r.codecpar.sampleRate===y.N_){const e=U.R((0,x.iI)(t));T.ai(e)||(r.codecpar.sampleRate=e.sampleRate,r.codecpar.chLayout.nbChannels=e.channels)}}else if(86020===r.codecpar.codecId&&r.codecpar.sampleRate===y.N_){const e=w.R((0,x.iI)(t));T.ai(e)||(r.codecpar.sampleRate=e.sampleRate,r.codecpar.chLayout.nbChannels=e.channels)}}return 0}async readAVPacket_(e,t){if(this.context.ioEnd){if(!this.context.tsSliceQueueMap.size)return-1048576;const a=this.context.tsSliceQueueMap.values();let r;for(;;){const e=a.next();if(e.value&&e.value.slices.length){r=e.value;break}if(e.done)break}if(!r)return-1048576;const i=e.streams.find((e=>e.privData.pid===r.pid));return i?this.parsePESSlice(e,t,r,i):((0,u.A)(r),this.readAVPacket_(e,t))}try{for(;;){if(this.context.tsPacketSize!==d.VG&&71!==await e.ioReader.peekUint8()){try{await e.ioReader.flush()}catch(e){}await this.syncTSPacket(e,!1)}const i=await c.n(e.ioReader,this.context);if(!i.payload)continue;if(0===i.pid||i.pid===this.context.currentPmtPid||134===this.context.pmt.pid2StreamType.get(i.pid)){(0,l.A)(i,this.context);continue}const n=this.context.pmt.pid2StreamType.get(i.pid);if(!n)continue;let s=e.streams.find((e=>e.privData.pid===i.pid));s||(s=e.createStream(),(0,A.A)(i.pid,s,this.context));let o=i.payload[4]<<8|i.payload[5],p=this.context.tsSliceQueueMap.get(i.pid),h=!1;if(p){if(p.totalLength>0&&i.payloadUnitStartIndicator){const a=this.parsePESSlice(e,t,p,s);if(a<0)return a;h=!0}}else{if(!i.payloadUnitStartIndicator)continue;p=new m.pi,this.context.tsSliceQueueMap.set(i.pid,p)}var a,r;if(i.payloadUnitStartIndicator&&(p.randomAccessIndicator=null!==(a=null===(r=i.adaptationFieldInfo)||void 0===r?void 0:r.randomAccessIndicator)&&void 0!==a?a:0,p.pos=i.pos,p.pid=i.pid,p.streamType=n,p.expectedLength=0===o?0:o+6),p.slices.push(i.payload),p.totalLength+=i.payload.length,p.expectedLength>0&&p.expectedLength===p.totalLength){const a=this.parsePESSlice(e,t,p,s);if(a<0)return a;h=!0}if(h)return 0}}catch(a){return-1048576!==e.ioReader.error||this.context.ioEnd?-1048576===e.ioReader.error?-1048576:(s.z3(`read packet error, ${a}`,F,474),p.LR):(this.context.ioEnd=!0,this.readAVPacket_(e,t))}}async readAVPacket(e,t){try{return this.readAVPacket_(e,t)}catch(t){return-1048576!==e.ioReader.error&&s.z3(t.message,F,487),e.ioReader.error}}async syncTSPacket(e,t=!0){let a=y.Dh;for(;;)try{if(71===await e.ioReader.readUint8()){a=this.context.tsPacketSize===d.VG?e.ioReader.getPos()-BigInt(5):e.ioReader.getPos()-BigInt(1);let t=0,r=e.ioReader.getPos();for(;t<=10&&(await e.ioReader.skip(this.context.tsPacketSize-1),71===await e.ioReader.readUint8());)t++;if(t<10){a=y.Dh,await e.ioReader.seek(r);continue}break}}catch(e){a=y.Dh;break}if(a!==y.Dh&&(await e.ioReader.seek(a),t))for(;;){if((await c.n(e.ioReader,this.context)).payloadUnitStartIndicator){await e.ioReader.seek(a),e.streams.forEach((e=>{let t=this.context.tsSliceQueueMap.get(e.privData.pid);t&&(0,u.A)(t)}));break}a=e.ioReader.getPos()}}async seek(e,t,a,r){let i=e.ioReader.getPos();if(this.context.tsSliceQueueMap.forEach((e=>{e.slices.length&&e.pos{this.context.tsSliceQueueMap.delete(t)})),16&r){const r=(0,b.k)(a,t.timeBase,y.i0);return await e.ioReader.seek(r,!0),this.context.ioEnd=!1,BigInt(0)}if(2&r){const t=await e.ioReader.fileSize();return t<=BigInt(0)?BigInt(p.E$):(at&&(a=t),await e.ioReader.seek(a),4&r||await this.syncTSPacket(e),this.context.ioEnd=!1,i)}{if(t&&t.sampleIndexes.length){let r=P.El(t.sampleIndexes,(e=>e.pts>a?-1:1));if(r>0&&(0,b.k)(a-t.sampleIndexes[r-1].pts,t.timeBase,y.i0)=0&&(this.context.ioEnd=!1),r}}getAnalyzeStreamsCount(){var e,t;return null!==(e=null===(t=this.context.pmt)||void 0===t?void 0:t.pid2StreamType.size)&&void 0!==e?e:0}}},89564:(e,t,a)=>{a.d(t,{A:()=>i});var r=a(27274);function i(e,t,a){const i=new Uint8Array(r.GV);let n=0,s=0;for(let r=0;rs&&(s=i[e])}}return s-Math.max(n-10*s,0)/10}},52088:(e,t,a)=>{function r(e){e.slices=[],e.totalLength=0,e.expectedLength=-1}a.d(t,{A:()=>r})},19770:(e,t,a)=>{a.d(t,{A:()=>o});var r=a(80662),i=a.n(r),n=a(77231),s=a(6403);function o(){return{currentProgram:n.N_,currentPmtPid:n.N_,tsPacketSize:n.N_,hasPAT:!1,hasPMT:!1,tsSliceQueueMap:new(i()),pat:new s.Cd,pmt:new s.I4,program2Pmt:new(i()),ioEnd:!1,startPid:256,delay:BigInt(0)}}},76538:(e,t,a)=>{a.d(t,{A:()=>i});var r=a(77231);function i(){return{pid:r.N_,filter:null,tsPacket:null,pes:null,continuityCounter:0,pesSlices:{total:0,buffers:[]},latm:!1}}},39e3:(e,t,a)=>{a.d(t,{A:()=>s});var r=a(6403),i=a(52088),n=a(63599);function s(e,t){const a=t.tsSliceQueueMap.get(e.pid);if(e.payloadUnitStartIndicator){const c=e.payload[0];if(a&&a.totalLength>0){const r=e.payload.slice(1,Math.min(1+c,e.payload.length));a.slices.push(r),a.totalLength+=r.length,a.totalLength===a.expectedLength?((0,n.A)(e.pid,a,t),(0,i.A)(a)):((0,i.A)(a),t.tsSliceQueueMap.delete(e.pid))}for(let a=1+c;a{a.d(t,{A:()=>h});var r=a(61499),i=a(76538),n=a(27274),s=a(50848),o=a(36488),c=a(61702),d=a(22576),l=a(37837),p=a(14686);function h(e,t,a){t.timeBase.den=9e4,t.timeBase.num=1;const h=(0,i.A)();h.pid=e,t.privData=h;const f=a.pmt.pid2StreamType.get(e);if(6===f){const r=a.pmt.pid2ESDescriptor.get(e);if(t.codecpar.codecType=2,r){var u;const e=r.find((e=>5===e.tag));if(e&&(null===(u=e.buffer)||void 0===u?void 0:u.length)>=4)if("O"===String.fromCharCode(e.buffer[0])||"p"===String.fromCharCode(e.buffer[1])||"u"===String.fromCharCode(e.buffer[2])||"s"===String.fromCharCode(e.buffer[3])){t.codecpar.codecType=1,t.codecpar.codecId=86076,t.codecpar.sampleRate=48e3;const e=r.find((e=>127===e.tag));if(e&&128===e.buffer[0]){t.codecpar.chLayout.nbChannels=15&e.buffer[1]?15&e.buffer[1]:2;const a=d.Ij(t.codecpar);a&&(t.codecpar.extradata=(0,l.sY)(a.length),(0,p.lW)(t.codecpar.extradata,a.length,a),t.codecpar.extradataSize=a.length)}}else if("A"===String.fromCharCode(e.buffer[0])||"V"===String.fromCharCode(e.buffer[1])||"0"===String.fromCharCode(e.buffer[2])||"1"===String.fromCharCode(e.buffer[3])){t.codecpar.codecType=0,t.codecpar.codecId=225;const e=r.find((e=>128===e.tag));e&&(t.codecpar.extradata=(0,l.sY)(e.buffer.length),(0,p.lW)(t.codecpar.extradata,e.buffer.length,e.buffer),t.codecpar.extradataSize=e.buffer.length)}}}else{const e=n.$x[f];e?(t.codecpar.codecType=e[0],t.codecpar.codecId=e[1]):t.codecpar.codecType=2}let m;switch(f){case 15:m=new s.A;break;case 17:m=new o.A;break;case 27:case 36:break;case 6:86076===t.codecpar.codecId&&(m=new c.A)}return m&&(t.privData.filter=m,m.init(t.codecpar[r.o9],t.timeBase[r.o9])),t}},31239:(e,t,a)=>{function r(e,t){let a=0,r=e[a++];if(t.adaptationFieldInfo.discontinuityIndicator=r>>7&1,t.adaptationFieldInfo.randomAccessIndicator=r>>6&1,t.adaptationFieldInfo.elementaryStreamPriorityIndicator=r>>5&1,t.adaptationFieldInfo.pcrFlag=r>>4&1,t.adaptationFieldInfo.opcrFlag=r>>3&1,t.adaptationFieldInfo.splicingPointFlag=r>>2&1,t.adaptationFieldInfo.transportPrivateDataFlag=r>>1&1,t.adaptationFieldInfo.adaptationFieldExtensionFlag=1&r,t.adaptationFieldInfo.pcrFlag){const r=BigInt(Math.floor(e[a++]<<25|e[a++]<<17|e[a++]<<9|e[a++]<<1|e[a]>>7)),i=BigInt(Math.floor((1&e[a++])<<8|e[a++]));t.adaptationFieldInfo.pcr=r*BigInt(300)+i}if(t.adaptationFieldInfo.opcrFlag){const r=BigInt(Math.floor(e[a++]<<25|e[a++]<<17|e[a++]<<9|e[a++]<<1|e[a]>>7)),i=BigInt(Math.floor((1&e[a++])<<8|e[a++]));t.adaptationFieldInfo.pcr=r*BigInt(300)+i}if(t.adaptationFieldInfo.splicingPointFlag&&(t.adaptationFieldInfo.spliceCountDown=e[a++]),t.adaptationFieldInfo.transportPrivateDataFlag){const r=e[a++];t.adaptationFieldInfo.transportPrivateData=e.subarray(a,a+r),a+=r}if(t.adaptationFieldInfo.adaptationFieldExtensionFlag){const r=e[a++];t.adaptationFieldInfo.extension=e.subarray(a,a+r),a+=r}}a.d(t,{A:()=>r})},20549:(e,t,a)=>{a.d(t,{A:()=>c});var r=a(31865),i=a(6403),n=a(92647),s=a(4624);const o="src/avformat/formats/mpegts/function/parsePAT.ts";function c(e,t){let a=0;const c=new r.A((0,n.A)(Uint8Array,e.slices),!0),d=c.readUint8();0!==d&&s.z3(`parsePAT: table_id ${d} is not corresponded to PAT!`,o,40);const l=4095&c.readUint16();c.readUint16(),a=c.readUint8();const p=a>>1&31,h=1&a,f=c.readUint8();let u;if(c.readUint8(),1===h&&0===f)u=new i.Cd,u.versionNumber=p;else if(u=t.pat,!u)return void s.z3("can not found PAT in mpegts context",o,64);const m=l-5-4,g=Number(BigInt.asIntN(32,c.getPos()))+m;let A=-1,x=-1;for(;c.getPos(){a.d(t,{A:()=>o});var r=a(77231),i=a(4624),n=a(9705);const s="src/avformat/formats/mpegts/function/parsePES.ts";function o(e){const t=e.data,a=t[3],o=t[4]<<8|t[5];let c=0,d=0,l=0;if(188!==a&&190!==a&&191!==a&&240!==a&&241!==a&&255!==a&&242!==a&&248!==a){let a=r.Dh,p=r.Dh;for(;;){if(6+d>=t.length)return;if(l=t[6+d],255!==l)break;d++}if(64==(192&l)&&(d+=2,l=t[6+d]),32==(224&l))c+=5,a=a=BigInt(Math.floor(536870912*(14&t[6+d])+4194304*(255&t[7+d])+16384*(254&t[8+d])+128*(255&t[9+d])+(254&t[10+d])/2)),16&l?(p=BigInt(Math.floor(536870912*(14&t[11+d])+4194304*(255&t[12+d])+16384*(254&t[13+d])+128*(255&t[14+d])+(254&t[15+d])/2)),c+=5):p=a;else if(128==(192&l)){const e=(192&t[7+d])>>>6;c=3+t[8+d],2!==e&&3!==e||(a=BigInt(Math.floor(536870912*(14&t[9+d])+4194304*(255&t[10+d])+16384*(254&t[11+d])+128*(255&t[12+d])+(254&t[13+d])/2)),p=3===e?BigInt(Math.floor(536870912*(14&t[14+d])+4194304*(255&t[15+d])+16384*(254&t[16+d])+128*(255&t[17+d])+(254&t[18+d])/2)):a)}else{if(15!==l)return i.z3("invalid data",s,121),n.LR;c=1}e.dts=p,e.pts=a;const h=6+d+c;let f=0;if(0!==o){if(o{a.d(t,{A:()=>i});var r=a(6403);function i(e){let t=new Uint8Array(e.totalLength);for(let a=0,r=0;a{a.d(t,{A:()=>c});var r=a(31865),i=a(6403),n=a(92647),s=a(4624);const o="src/avformat/formats/mpegts/function/parsePMT.ts";function c(e,t){let a=0;const c=new r.A((0,n.A)(Uint8Array,e.slices),!0),d=c.readUint8();2!==d&&s.z3(`parse PMT: table_id ${d} is not corresponded to PAT!`,o,40);const l=4095&c.readUint16(),p=c.readUint16();a=c.readUint8();const h=a>>1&31,f=1&a,u=c.readUint8();let m;if(c.readUint8(),1===f&&0===u)m=new i.I4,m.programNumber=p,m.versionNumber=h,t.program2Pmt.set(p,m),t.hasPMT=!0;else if(m=t.program2Pmt.get(p),!m)return void s.z3("can not found PMT in mpegts context",o,68);m.pcrPid=8191&c.readUint16();const g=4095&c.readUint16();c.skip(g);let A=Number(BigInt.asIntN(32,c.getPos()))+(l-9-g-4);for(;c.getPos()0){const e=[],r=Number(BigInt.asIntN(32,c.getPos()))+a;for(;c.getPos()0&&(t.buffer=c.readBuffer(a)),e.push(t)}m.pid2ESDescriptor.set(t,e)}}p===t.currentProgram&&(t.pmt||s.pq("parsed first PMT",o,111),t.pmt=m)}},43383:(e,t,a)=>{function r(e,t){}a.d(t,{A:()=>r})},63599:(e,t,a)=>{a.d(t,{A:()=>s});var r=a(20549),i=a(65945),n=a(43383);function s(e,t,a){0===e?(0,r.A)(t,a):e===a.currentPmtPid?(0,i.A)(t,a):a.pmt&&134===a.pmt.pid2StreamType.get(e)&&(0,n.A)(t,a)}},53783:(e,t,a)=>{a.d(t,{n:()=>p,q:()=>l});var r=a(27274),i=a(89564),n=a(4624),s=a(6403),o=a(31239),c=a(20576);const d="src/avformat/formats/mpegts/impegts.ts";async function l(e){let t;try{t=await e.peekBuffer(r.pm)}catch(a){-1048576!==e.error&&(t=await e.peekBuffer(e.remainingLength()))}if(t&&t.length>=r.ZT){const e=(0,i.A)(t,r.ZT,!1),a=(0,i.A)(t,r.VG,!1),s=(0,i.A)(t,r.eR,!1);let o=(0,c.A)([e,s,a]);t.lengtho?l=r.ZT:a>o?l=r.VG:s>o&&(l=r.eR),n.Yz(`got ts packet size: ${l}`,d,72),l}return 0}async function p(e,t){const a=e.getPos();let i=0;t.tsPacketSize===r.VG&&await e.skip(4);const c=await e.readUint8();71!==c&&n.h2(`found syncByte not 0x47, value: ${c.toString(16)}`,d,94);const l=new s.am;l.pos=a,i=await e.readUint16(),l.payloadUnitStartIndicator=i>>14&1,l.transportPriority=i>>13&1,l.pid=8191&i,i=await e.readUint8(),l.adaptationFieldControl=i>>4&3,l.continuityCounter=15&i;let p=4;if(2===l.adaptationFieldControl||3===l.adaptationFieldControl){const a=await e.readUint8();if(5+a===r.ZT)return(0,o.A)(await e.readBuffer(a),l),t.tsPacketSize===r.eR&&await e.skip(16),l;a>0&&(0,o.A)(await e.readBuffer(a),l),p=5+a}return 1!==l.adaptationFieldControl&&3!==l.adaptationFieldControl||(l.payload=await e.readBuffer(r.ZT-p)),t.tsPacketSize===r.eR&&await e.skip(16),l}},27274:(e,t,a)=>{a.d(t,{$x:()=>d,GV:()=>s,VG:()=>i,ZT:()=>n,eR:()=>r,hY:()=>c,pm:()=>o});const r=204,i=192,n=188,s=204,o=8192,c=5,d={15:[1,86018],17:[1,86018],3:[1,86017],4:[1,86017],1:[0,2],2:[0,2],27:[0,27],16:[0,12],36:[0,173],51:[0,196],129:[1,86019],135:[1,86056],130:[1,86020]}},6403:(e,t,a)=>{a.d(t,{Cd:()=>l,I4:()=>h,am:()=>c,kJ:()=>p,pi:()=>d,xf:()=>f});var r=a(134),i=a(80662),n=a.n(i),s=a(77231);class o{constructor(){(0,r.A)(this,"discontinuityIndicator",0),(0,r.A)(this,"randomAccessIndicator",0),(0,r.A)(this,"elementaryStreamPriorityIndicator",0),(0,r.A)(this,"pcrFlag",0),(0,r.A)(this,"opcrFlag",0),(0,r.A)(this,"splicingPointFlag",0),(0,r.A)(this,"transportPrivateDataFlag",0),(0,r.A)(this,"adaptationFieldExtensionFlag",0),(0,r.A)(this,"pcr",BigInt(0)),(0,r.A)(this,"opcr",BigInt(0)),(0,r.A)(this,"spliceCountDown",0),(0,r.A)(this,"transportPrivateData",null),(0,r.A)(this,"extension",null)}}class c{constructor(){(0,r.A)(this,"pos",s.Dh),(0,r.A)(this,"payloadUnitStartIndicator",0),(0,r.A)(this,"transportPriority",0),(0,r.A)(this,"pid",s.N_),(0,r.A)(this,"adaptationFieldControl",0),(0,r.A)(this,"continuityCounter",0),(0,r.A)(this,"transportScramblingControl",0),(0,r.A)(this,"adaptationFieldInfo",new o),(0,r.A)(this,"payload",null)}}class d{constructor(){(0,r.A)(this,"slices",[]),(0,r.A)(this,"totalLength",0),(0,r.A)(this,"expectedLength",s.N_),(0,r.A)(this,"randomAccessIndicator",0),(0,r.A)(this,"pid",s.N_),(0,r.A)(this,"streamType",0),(0,r.A)(this,"pos",s.Dh)}}class l{constructor(){(0,r.A)(this,"versionNumber",0),(0,r.A)(this,"networkPid",s.N_),(0,r.A)(this,"program2PmtPid",new(n()))}}class p{constructor(){(0,r.A)(this,"tag",void 0),(0,r.A)(this,"buffer",void 0)}}class h{constructor(){(0,r.A)(this,"versionNumber",0),(0,r.A)(this,"programNumber",0),(0,r.A)(this,"pcrPid",0),(0,r.A)(this,"pid2StreamType",new(n())),(0,r.A)(this,"pid2ESDescriptor",new(n()))}}class f{constructor(){(0,r.A)(this,"pid",s.N_),(0,r.A)(this,"streamType",0),(0,r.A)(this,"streamId",s.N_),(0,r.A)(this,"dts",s.Dh),(0,r.A)(this,"pts",s.Dh),(0,r.A)(this,"pos",s.Dh),(0,r.A)(this,"payload",null),(0,r.A)(this,"data",null),(0,r.A)(this,"randomAccessIndicator",0)}}},2187:(e,t,a)=>{a.d(t,{d:()=>s});var r=a(72739),i=a(44328),n=a(77231);function s(e,t,a){let s=BigInt(0);return r.__(e,(e=>{s+=e.codecpar.bitrate*(0,i.k)(t,a,n.i0)/BigInt(8e3)})),s}},52071:(e,t,a)=>{a.d(t,{A:()=>f});var r=a(63939),i=a(9599),n=a(29170),s=a(77231),o=a(44328),c=a(2187),d=a(71517),l=a(9705),p=a(4624);const h="src/avformat/function/seekInBytes.ts";async function f(e,t,a,f,u,m){const g=e.ioReader.getPos(),A=await e.ioReader.fileSize();let x=s.Dh,y=a;t.startTime!==s.Dh?y-=t.startTime:y-=t.firstDTS;const I=(0,o.k)(a,t.timeBase,s.i0);if(IP&&(b=P),b=0)){x=s.Dh;break}{const e=(0,o.k)(r.f[17](M+8),(0,n.A)(M+72,i.P),s.i0),a=e-I;if(p.Yz(`try to seek to pos: ${b}, got packet pts: ${r.f[17](M+8)}(${e}ms), diff: ${a}ms`,h,102),a<=BigInt(0)&&-aBigInt(0)?(C=b,b=S+C>>BigInt(1)):(S=b,b=S+C>>BigInt(1))}if(8&e.ioReader.flags)break}return(0,d.Qe)(M),x!==s.Dh?(p.Yz(`finally seek to pos ${x}`,h,133),await e.ioReader.seek(x),await m(e),g):(await e.ioReader.seek(g),8&e.ioReader.flags?BigInt(l.LT):BigInt(l.E$))}},95832:(e,t,a)=>{a.d(t,{Bq:()=>p,Ij:()=>l,XC:()=>d,f7:()=>h,uF:()=>n});var r=a(77231),i=a(37246);const n={1:"Main",2:"LC",3:"LC",4:"LC",5:"HE",6:"HE"},s={96e3:0,88200:1,64e3:2,48e3:3,44100:4,32e3:5,24e3:6,22050:7,16e3:8,12e3:9,11025:10,8e3:11,7350:12},o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,r.N_,r.N_,r.N_],c=[r.N_,1,2,3,4,5,6,7];function d(e,t){if(!t&&e.sideData[1]&&(t=e.sideData[1]),t){const{profile:a,sampleRate:i,channels:n}=function(e){let t=r.N_,a=r.N_,i=r.N_;var n,s;return e.length>=2&&(t=e[0]>>3&31,a=null!==(n=o[(7&e[0])<<1|e[1]>>7])&&void 0!==n?n:48e3,i=null!==(s=c[e[1]>>3&15])&&void 0!==s?s:2),{profile:t,sampleRate:a,channels:i}}(t);e.codecpar.profile=a,e.codecpar.sampleRate=i,e.codecpar.chLayout.nbChannels=n}}function l(e){const t=s[e.sampleRate],a=e.chLayout.nbChannels,i=e.profile===r.N_?2:e.profile,n=new Uint8Array(2);return n[0]=(31&i)<<3|(14&t)>>1,n[1]=(1&t)<<7|(15&a)<<3,n}function p(e){if(e.length<7)return-1;const t=e[0]<<4|e[1]>>4;if(4095!==t)return-1;const a=1&e[1],r=(192&e[2])>>>6,i=(60&e[2])>>>2,n=(1&e[2])<<2|(192&e[3])>>>6,s=(3&e[3])<<11|e[4]<<3|(224&e[5])>>>5,d=3&e[6];let l=1===a?7:9,p=s-l;return{syncWord:t,profile:r+1,sampleRate:o[i],channels:c[n],aacFrameLength:s,numberOfRawDataBlocksInFrame:d,headerLength:l,framePayloadLength:p}}function h(e,t){function a(){const e=t.readU(2);let a=0;for(let r=0;r<=e;r++)a<<=8,a|=t.readU(8);return a}t||(t=new i.A).appendBuffer(e);const r=t.getPointer(),n={syncWord:0,profile:0,sampleRate:0,channels:0,useSameStreamMux:!1,headerLength:0,framePayloadLength:0,muxLengthBytes:0},s=t.readU(11);if(695!==s)return-1;n.syncWord=s,n.muxLengthBytes=t.readU(13);const d=1===t.readU1();if(n.useSameStreamMux=d,!d){const e=1===t.readU1();if(e&&1===t.readU1())return-1;if(e&&a(),1!==t.readU1())return-1;if(0!==t.readU(6))return-1;if(0!==t.readU(4))return-1;if(0!==t.readU(3))return-1;let r=e?a():0;const i=t.readU(5);r-=5;const s=t.readU(4);r-=4;const d=t.readU(4);if(r-=4,t.readU(3),r-=3,r>0&&t.readU(r),0!==t.readU(3))return-1;if(t.readU(8),1===t.readU1())if(e)a();else{let e=0;for(;;){e<<=8;const a=1===t.readU1();if(e+=t.readU(8),!a)break}}1===t.readU1()&&t.readU(8),n.profile=i+1,n.sampleRate=o[s],n.channels=c[d]}let l=0;for(;;){const e=t.readU(8);if(l+=e,255!==e)break}return n.framePayloadLength=l,n.headerLength=t.getPointer()-r+(8===t.getBitLeft()?0:1),n}},87518:(e,t,a)=>{a.d(t,{R:()=>f,j:()=>i});var r=a(37246);const i=[3,4,3,7,259,263,1539,1543],n=[[64,69,96],[64,70,96],[80,87,120],[80,88,120],[96,104,144],[96,105,144],[112,121,168],[112,122,168],[128,139,192],[128,140,192],[160,174,240],[160,175,240],[192,208,288],[192,209,288],[224,243,336],[224,244,336],[256,278,384],[256,279,384],[320,348,480],[320,349,480],[384,417,576],[384,418,576],[448,487,672],[448,488,672],[512,557,768],[512,558,768],[640,696,960],[640,697,960],[768,835,1152],[768,836,1152],[896,975,1344],[896,976,1344],[1024,1114,1536],[1024,1115,1536],[1152,1253,1728],[1152,1254,1728],[1280,1393,1920],[1280,1394,1920]],s=[4,5,6,5],o=[4,6,7,6],c=[48e3,44100,32e3,0],d=[32,40,48,56,64,80,96,112,128,160,192,224,256,320,384,448,512,576,640],l=[2,1,2,3,3,4,4,5],p=[1,2,3,6],h=7;function f(e){const t=new r.A(e.length);t.appendBuffer(e);const a={syncWord:0,crc1:0,srCode:0,bitstreamId:0,bitstreamMode:0,channelMode:0,lfeOn:0,frameType:0,substreamId:0,centerMixLevel:0,surroundMixLevel:0,channelMap:0,numBlocks:0,dolbySurroundMode:0,srShift:0,sampleRate:0,bitrate:0,channels:0,frameSize:0,channelLayout:BigInt(0),ac3BitrateCode:0};if(a.syncWord=t.readU(16),2935!==a.syncWord)return-1;if(a.bitstreamId=31&t.peekU(29),a.bitstreamId>16)return-2;if(a.numBlocks=6,a.ac3BitrateCode=-1,a.centerMixLevel=5,a.surroundMixLevel=6,a.dolbySurroundMode=0,a.bitstreamId<=10){if(a.crc1=t.readU(16),a.srCode=t.readU(2),3===a.srCode)return-3;const e=t.readU(6);if(e>37)return-4;a.ac3BitrateCode=e>>1,t.readU(5),a.bitstreamMode=t.readU(3),a.channelMode=t.readU(3),2==a.channelMode?a.dolbySurroundMode=t.readU(2):(1&a.channelMode&&1!=a.channelMode&&(a.centerMixLevel=s[t.readU(2)]),4&a.channelMode&&(a.surroundMixLevel=o[t.readU(2)])),a.lfeOn=t.readU(1),a.srShift=Math.max(a.bitstreamId,8)-8,a.sampleRate=c[a.srCode]>>a.srShift,a.bitrate=1e3*d[a.ac3BitrateCode]>>a.srShift,a.channels=l[a.channelMode]+a.lfeOn,a.frameSize=2*n[e][a.srCode],a.frameType=2,a.substreamId=0}else{if(a.crc1=0,a.frameType=t.readU(2),3==a.frameType)return-5;if(a.substreamId=t.readU(3),a.frameSize=t.readU(11)+1<<1,a.frameSize{a.d(t,{R:()=>d,u:()=>c});var r=a(37246),i=a(95073);const n=[1,2,2,2,2,3,3,4,4,5,6,6,6,7,8,8],s=[0,8e3,16e3,32e3,0,0,11025,22050,44100,0,0,12e3,24e3,48e3,96e3,192e3],o=[32e3,56e3,64e3,96e3,112e3,128e3,192e3,224e3,256e3,32e4,384e3,448e3,512e3,576e3,64e4,768e3,96e4,1024e3,1152e3,128e4,1344e3,1408e3,1411200,1472e3,1536e3,192e4,2048e3,3072e3,384e4,0,0,0],c=32;function d(e){const t=new r.A(e.length);t.appendBuffer(e);const a={syncWord:0,frameType:0,deficitSamples:0,crcFlag:0,sampleBlock:0,frameSize:0,channelIndex:0,sampleRateIndex:0,bitrateIndex:0,channels:0,sampleRate:0,bitrate:0};return a.syncWord=t.readU(32),2147385345!==a.syncWord&&4269736320!==a.syncWord?-1:(a.frameType=t.readU1(),a.deficitSamples=t.readU(5)+1,a.crcFlag=t.readU1(),a.sampleBlock=t.readU(7)+1,a.frameSize=(0,i.A)(t.readU(14)+1,4),a.channelIndex=t.readU(6),a.sampleRateIndex=t.readU(4),a.bitrateIndex=t.readU(5),a.channels=n[a.channelIndex],a.sampleRate=s[a.sampleRateIndex],a.bitrate=o[a.bitrateIndex],a)}},64093:(e,t,a)=>{a.d(t,{Au:()=>x,He:()=>y,XC:()=>I,Y2:()=>m,hG:()=>g,oz:()=>A});var r=a(77231);const i=[44100,48e3,32e3,0],n=[22050,24e3,16e3,0],s=[11025,12e3,8e3,0],o=[0,1152,1152,384],c=[0,576,1152,384],d=[0,576,1152,384],l=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],p=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],h=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],f=[0,32,48,56,64,80,96,112,128,144,160,176,192,224,256,-1],u=[0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,-1];function m(e,t){switch(e){case 0:return s[t];case 2:return n[t];case 3:return i[t]}return r.N_}function g(e,t){switch(e){case 0:return d[t];case 2:return c[t];case 3:return o[t]}return r.N_}function A(e,t,a){switch(t){case 1:switch(e){case 0:case 2:return u[a];case 3:return h[a]}break;case 2:switch(e){case 0:case 2:return u[a];case 3:return p[a]}case 3:switch(e){case 0:case 2:return f[a];case 3:return l[a]}}return r.N_}function x(e){switch(e){case 1:return 34;case 2:return 33;case 3:return 32}return r.N_}const y={32:"Layer1",33:"Layer2",34:"Layer3"};function I(e,t){if(t&&t.length>=4){const a=t[1]>>>3&3,r=(6&t[1])>>1,i=(12&t[2])>>>2,n=3&~(t[3]>>>6)?2:1,s=x(r),o=m(a,i);e.codecpar.profile=s,e.codecpar.sampleRate=o,e.codecpar.chLayout.nbChannels=n}}},22576:(e,t,a)=>{a.d(t,{Ij:()=>d,XC:()=>c,kt:()=>o});var r=a(31865),i=a(729),n=a(44328);const s=[480,960,1920,2880,480,960,1920,2880,480,960,1920,2880,480,960,480,960,120,240,480,960,120,240,480,960,120,240,480,960,120,240,480,960];function o(e){let t=0,a=0,r=0;if(e.length<1)return 0;switch(t=e[0],a=s[t>>3],3&t){case 0:r=1;break;case 1:case 2:r=2;break;case 3:if(e.length<2)return 0;r=63&e[1]}return r*a}function c(e,t){if(!t&&e.sideData[1]&&(t=e.sideData[1]),t&&t.length>=19){const a=new r.A(t,!1);a.skip(9),e.codecpar.chLayout.nbChannels=a.readUint8(),e.codecpar.initialPadding=a.readUint16(),e.codecpar.sampleRate=a.readUint32(),e.codecpar.seekPreroll=Number((0,n.k)(BigInt(80),{den:1e3,num:1},{den:48e3,num:1}))}}function d(e){const t=new Uint8Array(19),a=new i.A(t,!1);return a.writeString("OpusHead"),a.writeUint8(1),a.writeUint8(e.chLayout.nbChannels),a.writeUint16(e.initialPadding),a.writeUint32(e.sampleRate),t}},20576:(e,t,a)=>{function r(e){if(0===e.length)return 0;const t=e.slice().sort(((e,t)=>e-t)),a=Math.floor(t.length/2);return t.length%2==1?t[a]:(t[a-1]+t[a])/2}a.d(t,{A:()=>r})}}]); \ No newline at end of file +"use strict";(self.webpackChunkAVPlayer=self.webpackChunkAVPlayer||[]).push([[331],{64436:(e,t,a)=>{a.d(t,{A:()=>o});var r=a(134),i=a(63939),n=(a(77162),a(37837)),s=a(71766);class o{constructor(){(0,r.A)(this,"inCodecpar",void 0),(0,r.A)(this,"inTimeBase",void 0),(0,r.A)(this,"outCodecpar",void 0)}init(e,t){return this.inCodecpar=(0,n.Gy)(168),(0,s.Yi)(this.inCodecpar,e),this.inTimeBase={den:i.f[15](t+4),num:i.f[15](t)},0}destroy(){this.inCodecpar&&((0,s.dn)(this.inCodecpar),this.inCodecpar=0)}}},50848:(e,t,a)=>{a.d(t,{A:()=>x});var r=a(134),i=a(63939),n=a(50932),s=a(77162),o=a(29170),c=a(64436),d=a(14686),l=a(4624),p=a(9705),h=a(77231),f=a(95832),u=a(44328),m=a(37837),g=a(71517),A=a(67672);class x extends c.A{constructor(...e){super(...e),(0,r.A)(this,"streamMuxConfig",void 0),(0,r.A)(this,"caches",void 0)}init(e,t){return super.init(e,t),this.caches=[],this.streamMuxConfig={profile:h.N_,sampleRate:h.N_,channels:h.N_},0}sendAVPacket(e){let t=0,a=i.f[17](e+16)||i.f[17](e+8);const r=(0,d.s3)(i.f[20](e+24),i.f[15](e+28)).slice();for(;t{a.d(t,{A:()=>y});var r=a(134),i=a(63939),n=a(50932),s=a(77162),o=a(29170),c=a(64436),d=a(14686),l=a(4624),p=a(9705),h=a(77231),f=a(95832),u=a(44328),m=a(37837),g=a(71517),A=a(37246),x=a(67672);class y extends c.A{constructor(...e){super(...e),(0,r.A)(this,"bitReader",void 0),(0,r.A)(this,"streamMuxConfig",void 0),(0,r.A)(this,"caches",void 0),(0,r.A)(this,"refSampleDuration",void 0)}init(e,t){return super.init(e,t),this.caches=[],this.refSampleDuration=BigInt(0),this.bitReader=new A.A,this.streamMuxConfig={profile:h.N_,sampleRate:h.N_,channels:h.N_},0}sendAVPacket(e){const t=(0,d.s3)(i.f[20](e+24),i.f[15](e+28));this.bitReader.appendBuffer(t);let a=i.f[17](e+16)||i.f[17](e+8);for(;this.bitReader.remainingLength()>=20;){const e=this.bitReader.getPointer(),t=f.f7(null,this.bitReader);if(x.ai(t))return l.z3("AACLATMParser parse failed","src/avformat/bsf/aac/LATM2RawFilter.ts",94),this.bitReader.reset(),p.LR;if(t.framePayloadLength>=this.bitReader.remainingLength()){this.bitReader.skipPadding(),this.bitReader.setPointer(e);break}t.useSameStreamMux||(this.streamMuxConfig.profile=t.profile,this.streamMuxConfig.sampleRate=t.sampleRate,this.streamMuxConfig.channels=t.channels);const r=t.framePayloadLength,c=new Uint8Array(r);for(let e=0;e{a.d(t,{A:()=>m});var r=a(134),i=a(63939),n=a(50932),s=a(64436),o=a(77231),c=a(44328),d=a(22576),l=a(4624),p=a(9705),h=a(71517),f=a(37837),u=a(14686);class m extends s.A{constructor(...e){super(...e),(0,r.A)(this,"caches",void 0)}init(e,t){return super.init(e,t),this.caches=[],0}sendAVPacket(e){let t=0,a=i.f[17](e+16)||i.f[17](e+8);const r=(0,h.iI)(e);for(;t>5;if(1023!==e)return l.z3(`MpegtsOpusParser found syncWord not 0x3ff, got: 0x${e.toString(16)}`,"src/avformat/bsf/opus/Mpegts2RawFilter.ts",67),p.LR;const n=!!(16&r[t+1]),s=!!(8&r[t+1]);let h=t+2,f=0;for(;255===r[h];)f+=255,h++;f+=r[h],h++,h+=n?2:0,h+=s?2:0;let u=r.subarray(h,h+f);const m=i.f[15](this.inCodecpar+136)>0?i.f[15](this.inCodecpar+136):48e3,g=(0,c.k)(BigInt(Math.floor(d.kt(u)/m*o.SF)),o.KR,this.inTimeBase);this.caches.push({dts:a,buffer:u.slice(),duration:Number(g)}),a+=g,t=h+f}}receiveAVPacket(e){if(this.caches.length){(0,h.Up)(e);const t=this.caches.shift(),a=(0,f.sY)(t.buffer.length);return(0,u.lW)(a,t.buffer.length,t.buffer),(0,h.NX)(e,a,t.buffer.length),n.M[17](e+16,t.dts),n.M[17](e+8,t.dts),n.M[15](e+36,1|i.f[15](e+36)),n.M[17](e+48,BigInt(Math.floor(t.duration))),0}return p.LR}reset(){return 0}}},85947:(e,t,a)=>{a.d(t,{A:()=>i});var r=a(134);class i{constructor(){(0,r.A)(this,"type",-1),(0,r.A)(this,"onStreamAdd",void 0)}async destroy(e){}}},59331:(e,t,a)=>{a.r(t),a.d(t,{default:()=>z});var r=a(134),i=a(63939),n=a(50932),s=a(4624),o=a(19770),c=a(53783),d=a(27274),l=a(39e3),p=a(9705),h=a(51660),f=a(39144),u=a(52088),m=a(6403),g=a(85947),A=a(86191),x=a(71517),y=a(77231),I=a(52071),b=a(44328),P=a(72739),k=a(64093),M=a(62815),C=a(67659),S=a(59166),R=a(95832),v=a(22576),U=a(87518),w=a(43290),B=a(37837),L=a(14686),T=a(67672);const F="src/avformat/formats/IMpegtsFormat.ts";class z extends g.A{constructor(){super(),(0,r.A)(this,"type",2),(0,r.A)(this,"context",void 0),(0,r.A)(this,"firstTSPacketPos",void 0),(0,r.A)(this,"cacheAVPacket",void 0),this.context=(0,o.A)()}init(e){e.ioReader&&e.ioReader.setEndian(!0),this.cacheAVPacket=0}async destroy(e){this.cacheAVPacket&&((0,x.Qe)(this.cacheAVPacket),this.cacheAVPacket=0),P.__(e.streams,(e=>{const t=e.privData;t.filter&&(t.filter.destroy(),t.filter=null)}))}async readHeader(e){try{let t=0,a=await c.q(e.ioReader);for(a||(a=d.ZT),this.context.tsPacketSize=a,this.context.tsPacketSize!==d.VG&&71!==await e.ioReader.peekUint8()&&await this.syncTSPacket(e,!1);!this.context.hasPAT||!this.context.hasPMT;){const t=await c.$(e.ioReader,this.context);t.payload&&(0!==t.pid&&t.pid!==this.context.currentPmtPid&&134!==this.context.pmt.pid2StreamType.get(t.pid)||(0,l.A)(t,this.context))}return this.context.hasPAT&&this.context.hasPMT?(this.firstTSPacketPos=e.ioReader.getPos(),t):p.LR}catch(t){return s.z3(t.message,F,147),e.ioReader.error}}checkExtradata(e,t){if(!t.codecpar.extradata){let a=(0,x.rU)(e,1);if(!a)return;t.codecpar.extradata=(0,B.sY)(i.f[15](a+4)),(0,L.Mr)(t.codecpar.extradata,i.f[20](a),i.f[15](a+4)),t.codecpar.extradataSize=i.f[15](a+4),(0,x.Is)(e,1),27===t.codecpar.codecId?M.XC(t,(0,L.JW)(t.codecpar.extradata,t.codecpar.extradataSize)):173===t.codecpar.codecId?C.XC(t,(0,L.JW)(t.codecpar.extradata,t.codecpar.extradataSize)):196===t.codecpar.codecId?S.XC(t,(0,L.JW)(t.codecpar.extradata,t.codecpar.extradataSize)):86018===t.codecpar.codecId?R.XC(t,(0,L.JW)(t.codecpar.extradata,t.codecpar.extradataSize)):86076===t.codecpar.codecId&&v.XC(t,(0,L.JW)(t.codecpar.extradata,t.codecpar.extradataSize))}}parsePESSlice(e,t,a,r){const o=(0,f.A)(a);(0,h.A)(o),(o.randomAccessIndicator||1===r.codecpar.codecType)&&n.M[15](t+36,1|i.f[15](t+36));const c=r.codecpar.codecId;27!==c&&173!==c&&196!==c||n.M[15](t+80,2),n.M[15](t+32,r.index),n.M[17](t+16,o.dts),n.M[17](t+8,o.pts),n.M[17](t+56,o.pos),n.M[15](t+76,9e4),n.M[15](t+72,1),r.startTime===y.Dh&&(r.startTime=i.f[17](t+8)||i.f[17](t+16));const d=(0,B.sY)(o.payload.length);(0,L.lW)(d,o.payload.length,o.payload),(0,x.NX)(t,d,o.payload.length),(0,u.A)(a);const l=r.privData;if(l.filter){let a=0;if(a=l.filter.sendAVPacket(t),a<0)return s.z3("send avpacket to bsf failed",F,223),p.LR;if(a=l.filter.receiveAVPacket(t),a<0)return s.z3("receive avpacket from bsf failed",F,230),p.LR;for(n.M[15](t+76,9e4),n.M[15](t+72,1),n.M[15](t+32,r.index),this.checkExtradata(t,r);;){const t=this.cacheAVPacket||(0,x._5)();if(a=l.filter.receiveAVPacket(t),0!==a){this.cacheAVPacket=t;break}n.M[15](t+76,9e4),n.M[15](t+72,1),n.M[15](t+32,r.index),this.checkExtradata(t,r),e.interval.packetBuffer.push(t),this.cacheAVPacket=0}}else{const e=this.context.pmt.pid2StreamType.get(l.pid);if(3===e||4===e){n.M[15](t+36,1|i.f[15](t+36));const e=(0,x.iI)(t),a=e[1]>>>3&3,s=(6&e[1])>>1,o=(12&e[2])>>>2,c=3&~(e[3]>>>6)?2:1,d=k.Au(s),l=k.Y2(a,o);(r.codecpar.profile!==d||r.codecpar.sampleRate!==l||r.codecpar.chLayout.nbChannels!==c)&&(r.codecpar.profile=d,r.codecpar.sampleRate=l,r.codecpar.chLayout.nbChannels=c)}else if(27===r.codecpar.codecId)r.codecpar.extradata||(M.ci(t,!0),this.checkExtradata(t,r),r.codecpar.bitFormat=2);else if(173===r.codecpar.codecId)r.codecpar.extradata||(C.ci(t,!0),this.checkExtradata(t,r),r.codecpar.bitFormat=2);else if(196===r.codecpar.codecId)r.codecpar.extradata||(S.ci(t,!0),this.checkExtradata(t,r),r.codecpar.bitFormat=2);else if(86019===r.codecpar.codecId||86056===r.codecpar.codecId){if(r.codecpar.sampleRate===y.N_){const e=U.R((0,x.iI)(t));T.ai(e)||(r.codecpar.sampleRate=e.sampleRate,r.codecpar.chLayout.nbChannels=e.channels)}}else if(86020===r.codecpar.codecId&&r.codecpar.sampleRate===y.N_){const e=w.R((0,x.iI)(t));T.ai(e)||(r.codecpar.sampleRate=e.sampleRate,r.codecpar.chLayout.nbChannels=e.channels)}}return 0}async readAVPacket_(e,t){if(this.context.ioEnd){if(!this.context.tsSliceQueueMap.size)return-1048576;const a=this.context.tsSliceQueueMap.values();let r;for(;;){const e=a.next();if(e.value&&e.value.slices.length){r=e.value;break}if(e.done)break}if(!r)return-1048576;const i=e.streams.find((e=>e.privData.pid===r.pid));return i?this.parsePESSlice(e,t,r,i):((0,u.A)(r),this.readAVPacket_(e,t))}try{for(;;){if(this.context.tsPacketSize!==d.VG&&71!==await e.ioReader.peekUint8()){try{await e.ioReader.flush()}catch(e){}await this.syncTSPacket(e,!1)}const i=await c.$(e.ioReader,this.context);if(!i.payload)continue;if(0===i.pid||i.pid===this.context.currentPmtPid||134===this.context.pmt.pid2StreamType.get(i.pid)){(0,l.A)(i,this.context);continue}const n=this.context.pmt.pid2StreamType.get(i.pid);if(!n)continue;let s=e.streams.find((e=>e.privData.pid===i.pid));s||(s=e.createStream(),(0,A.A)(i.pid,s,this.context));let o=i.payload[4]<<8|i.payload[5],p=this.context.tsSliceQueueMap.get(i.pid),h=!1;if(p){if(p.totalLength>0&&i.payloadUnitStartIndicator){const a=this.parsePESSlice(e,t,p,s);if(a<0)return a;h=!0}}else{if(!i.payloadUnitStartIndicator)continue;p=new m.pi,this.context.tsSliceQueueMap.set(i.pid,p)}var a,r;if(i.payloadUnitStartIndicator&&(p.randomAccessIndicator=null!==(a=null===(r=i.adaptationFieldInfo)||void 0===r?void 0:r.randomAccessIndicator)&&void 0!==a?a:0,p.pos=i.pos,p.pid=i.pid,p.streamType=n,p.expectedLength=0===o?0:o+6),p.slices.push(i.payload),p.totalLength+=i.payload.length,p.expectedLength>0&&p.expectedLength===p.totalLength){const a=this.parsePESSlice(e,t,p,s);if(a<0)return a;h=!0}if(h)return 0}}catch(a){return-1048576!==e.ioReader.error||this.context.ioEnd?-1048576===e.ioReader.error?-1048576:(s.z3(`read packet error, ${a}`,F,474),p.LR):(this.context.ioEnd=!0,this.readAVPacket_(e,t))}}async readAVPacket(e,t){try{return this.readAVPacket_(e,t)}catch(t){return-1048576!==e.ioReader.error&&s.z3(t.message,F,487),e.ioReader.error}}async syncTSPacket(e,t=!0){let a=y.Dh;for(;;)try{if(71===await e.ioReader.readUint8()){a=this.context.tsPacketSize===d.VG?e.ioReader.getPos()-BigInt(5):e.ioReader.getPos()-BigInt(1);let t=0,r=e.ioReader.getPos();for(;t<=10&&(await e.ioReader.skip(this.context.tsPacketSize-1),71===await e.ioReader.readUint8());)t++;if(t<10){a=y.Dh,await e.ioReader.seek(r);continue}break}}catch(e){a=y.Dh;break}if(a!==y.Dh&&(await e.ioReader.seek(a),t))for(;;){if((await c.$(e.ioReader,this.context)).payloadUnitStartIndicator){await e.ioReader.seek(a),e.streams.forEach((e=>{let t=this.context.tsSliceQueueMap.get(e.privData.pid);t&&(0,u.A)(t)}));break}a=e.ioReader.getPos()}}async seek(e,t,a,r){let i=e.ioReader.getPos();if(this.context.tsSliceQueueMap.forEach((e=>{e.slices.length&&e.pos{this.context.tsSliceQueueMap.delete(t)})),16&r){const r=(0,b.k)(a,t.timeBase,y.i0);return await e.ioReader.seek(r,!0),this.context.ioEnd=!1,BigInt(0)}if(2&r){const t=await e.ioReader.fileSize();return t<=BigInt(0)?BigInt(p.E$):(at&&(a=t),await e.ioReader.seek(a),4&r||await this.syncTSPacket(e),this.context.ioEnd=!1,i)}{if(t&&t.sampleIndexes.length){let r=P.El(t.sampleIndexes,(e=>e.pts>a?-1:1));if(r>0&&(0,b.k)(a-t.sampleIndexes[r-1].pts,t.timeBase,y.i0)=0&&(this.context.ioEnd=!1),r}}getAnalyzeStreamsCount(){var e,t;return null!==(e=null===(t=this.context.pmt)||void 0===t?void 0:t.pid2StreamType.size)&&void 0!==e?e:0}}},89564:(e,t,a)=>{a.d(t,{A:()=>i});var r=a(27274);function i(e,t,a){const i=new Uint8Array(r.GV);let n=0,s=0;for(let r=0;rs&&(s=i[e])}}return s-Math.max(n-10*s,0)/10}},52088:(e,t,a)=>{function r(e){e.slices=[],e.totalLength=0,e.expectedLength=-1}a.d(t,{A:()=>r})},19770:(e,t,a)=>{a.d(t,{A:()=>o});var r=a(80662),i=a.n(r),n=a(77231),s=a(6403);function o(){return{currentProgram:n.N_,currentPmtPid:n.N_,tsPacketSize:n.N_,hasPAT:!1,hasPMT:!1,tsSliceQueueMap:new(i()),pat:new s.Cd,pmt:new s.I4,program2Pmt:new(i()),ioEnd:!1,startPid:256,delay:BigInt(0)}}},76538:(e,t,a)=>{a.d(t,{A:()=>i});var r=a(77231);function i(){return{pid:r.N_,filter:null,tsPacket:null,pes:null,continuityCounter:0,pesSlices:{total:0,buffers:[]},latm:!1}}},39e3:(e,t,a)=>{a.d(t,{A:()=>s});var r=a(6403),i=a(52088),n=a(63599);function s(e,t){const a=t.tsSliceQueueMap.get(e.pid);if(e.payloadUnitStartIndicator){const c=e.payload[0];if(a&&a.totalLength>0){const r=e.payload.slice(1,Math.min(1+c,e.payload.length));a.slices.push(r),a.totalLength+=r.length,a.totalLength===a.expectedLength?((0,n.A)(e.pid,a,t),(0,i.A)(a)):((0,i.A)(a),t.tsSliceQueueMap.delete(e.pid))}for(let a=1+c;a{a.d(t,{A:()=>h});var r=a(61499),i=a(76538),n=a(27274),s=a(50848),o=a(36488),c=a(61702),d=a(22576),l=a(37837),p=a(14686);function h(e,t,a){t.timeBase.den=9e4,t.timeBase.num=1;const h=(0,i.A)();h.pid=e,t.privData=h;const f=a.pmt.pid2StreamType.get(e);if(6===f){const r=a.pmt.pid2ESDescriptor.get(e);if(t.codecpar.codecType=2,r){var u;const e=r.find((e=>5===e.tag));if(e&&(null===(u=e.buffer)||void 0===u?void 0:u.length)>=4)if("O"===String.fromCharCode(e.buffer[0])||"p"===String.fromCharCode(e.buffer[1])||"u"===String.fromCharCode(e.buffer[2])||"s"===String.fromCharCode(e.buffer[3])){t.codecpar.codecType=1,t.codecpar.codecId=86076,t.codecpar.sampleRate=48e3;const e=r.find((e=>127===e.tag));if(e&&128===e.buffer[0]){t.codecpar.chLayout.nbChannels=15&e.buffer[1]?15&e.buffer[1]:2;const a=d.Ij(t.codecpar);a&&(t.codecpar.extradata=(0,l.sY)(a.length),(0,p.lW)(t.codecpar.extradata,a.length,a),t.codecpar.extradataSize=a.length)}}else if("A"===String.fromCharCode(e.buffer[0])||"V"===String.fromCharCode(e.buffer[1])||"0"===String.fromCharCode(e.buffer[2])||"1"===String.fromCharCode(e.buffer[3])){t.codecpar.codecType=0,t.codecpar.codecId=225;const e=r.find((e=>128===e.tag));e&&(t.codecpar.extradata=(0,l.sY)(e.buffer.length),(0,p.lW)(t.codecpar.extradata,e.buffer.length,e.buffer),t.codecpar.extradataSize=e.buffer.length)}}}else{const e=n.$x[f];e?(t.codecpar.codecType=e[0],t.codecpar.codecId=e[1]):t.codecpar.codecType=2}let m;switch(f){case 15:m=new s.A;break;case 17:m=new o.A;break;case 27:case 36:break;case 6:86076===t.codecpar.codecId&&(m=new c.A)}return m&&(t.privData.filter=m,m.init(t.codecpar[r.o9],t.timeBase[r.o9])),t}},31239:(e,t,a)=>{function r(e,t){let a=0,r=e[a++];if(t.adaptationFieldInfo.discontinuityIndicator=r>>7&1,t.adaptationFieldInfo.randomAccessIndicator=r>>6&1,t.adaptationFieldInfo.elementaryStreamPriorityIndicator=r>>5&1,t.adaptationFieldInfo.pcrFlag=r>>4&1,t.adaptationFieldInfo.opcrFlag=r>>3&1,t.adaptationFieldInfo.splicingPointFlag=r>>2&1,t.adaptationFieldInfo.transportPrivateDataFlag=r>>1&1,t.adaptationFieldInfo.adaptationFieldExtensionFlag=1&r,t.adaptationFieldInfo.pcrFlag){const r=BigInt(Math.floor(e[a++]<<25|e[a++]<<17|e[a++]<<9|e[a++]<<1|e[a]>>7)),i=BigInt(Math.floor((1&e[a++])<<8|e[a++]));t.adaptationFieldInfo.pcr=r*BigInt(300)+i}if(t.adaptationFieldInfo.opcrFlag){const r=BigInt(Math.floor(e[a++]<<25|e[a++]<<17|e[a++]<<9|e[a++]<<1|e[a]>>7)),i=BigInt(Math.floor((1&e[a++])<<8|e[a++]));t.adaptationFieldInfo.pcr=r*BigInt(300)+i}if(t.adaptationFieldInfo.splicingPointFlag&&(t.adaptationFieldInfo.spliceCountDown=e[a++]),t.adaptationFieldInfo.transportPrivateDataFlag){const r=e[a++];t.adaptationFieldInfo.transportPrivateData=e.subarray(a,a+r),a+=r}if(t.adaptationFieldInfo.adaptationFieldExtensionFlag){const r=e[a++];t.adaptationFieldInfo.extension=e.subarray(a,a+r),a+=r}}a.d(t,{A:()=>r})},20549:(e,t,a)=>{a.d(t,{A:()=>c});var r=a(31865),i=a(6403),n=a(92647),s=a(4624);const o="src/avformat/formats/mpegts/function/parsePAT.ts";function c(e,t){let a=0;const c=new r.A((0,n.A)(Uint8Array,e.slices),!0),d=c.readUint8();0!==d&&s.z3(`parsePAT: table_id ${d} is not corresponded to PAT!`,o,40);const l=4095&c.readUint16();c.readUint16(),a=c.readUint8();const p=a>>1&31,h=1&a,f=c.readUint8();let u;if(c.readUint8(),1===h&&0===f)u=new i.Cd,u.versionNumber=p;else if(u=t.pat,!u)return void s.z3("can not found PAT in mpegts context",o,64);const m=l-5-4,g=Number(BigInt.asIntN(32,c.getPos()))+m;let A=-1,x=-1;for(;c.getPos(){a.d(t,{A:()=>o});var r=a(77231),i=a(4624),n=a(9705);const s="src/avformat/formats/mpegts/function/parsePES.ts";function o(e){const t=e.data,a=t[3],o=t[4]<<8|t[5];let c=0,d=0,l=0;if(188!==a&&190!==a&&191!==a&&240!==a&&241!==a&&255!==a&&242!==a&&248!==a){let a=r.Dh,p=r.Dh;for(;;){if(6+d>=t.length)return;if(l=t[6+d],255!==l)break;d++}if(64==(192&l)&&(d+=2,l=t[6+d]),32==(224&l))c+=5,a=a=BigInt(Math.floor(536870912*(14&t[6+d])+4194304*(255&t[7+d])+16384*(254&t[8+d])+128*(255&t[9+d])+(254&t[10+d])/2)),16&l?(p=BigInt(Math.floor(536870912*(14&t[11+d])+4194304*(255&t[12+d])+16384*(254&t[13+d])+128*(255&t[14+d])+(254&t[15+d])/2)),c+=5):p=a;else if(128==(192&l)){const e=(192&t[7+d])>>>6;c=3+t[8+d],2!==e&&3!==e||(a=BigInt(Math.floor(536870912*(14&t[9+d])+4194304*(255&t[10+d])+16384*(254&t[11+d])+128*(255&t[12+d])+(254&t[13+d])/2)),p=3===e?BigInt(Math.floor(536870912*(14&t[14+d])+4194304*(255&t[15+d])+16384*(254&t[16+d])+128*(255&t[17+d])+(254&t[18+d])/2)):a)}else{if(15!==l)return i.z3("invalid data",s,121),n.LR;c=1}e.dts=p,e.pts=a;const h=6+d+c;let f=0;if(0!==o){if(o{a.d(t,{A:()=>i});var r=a(6403);function i(e){let t=new Uint8Array(e.totalLength);for(let a=0,r=0;a{a.d(t,{A:()=>c});var r=a(31865),i=a(6403),n=a(92647),s=a(4624);const o="src/avformat/formats/mpegts/function/parsePMT.ts";function c(e,t){let a=0;const c=new r.A((0,n.A)(Uint8Array,e.slices),!0),d=c.readUint8();2!==d&&s.z3(`parse PMT: table_id ${d} is not corresponded to PAT!`,o,40);const l=4095&c.readUint16(),p=c.readUint16();a=c.readUint8();const h=a>>1&31,f=1&a,u=c.readUint8();let m;if(c.readUint8(),1===f&&0===u)m=new i.I4,m.programNumber=p,m.versionNumber=h,t.program2Pmt.set(p,m),t.hasPMT=!0;else if(m=t.program2Pmt.get(p),!m)return void s.z3("can not found PMT in mpegts context",o,68);m.pcrPid=8191&c.readUint16();const g=4095&c.readUint16();c.skip(g);let A=Number(BigInt.asIntN(32,c.getPos()))+(l-9-g-4);for(;c.getPos()0){const e=[],r=Number(BigInt.asIntN(32,c.getPos()))+a;for(;c.getPos()0&&(t.buffer=c.readBuffer(a)),e.push(t)}m.pid2ESDescriptor.set(t,e)}}p===t.currentProgram&&(t.pmt||s.pq("parsed first PMT",o,111),t.pmt=m)}},43383:(e,t,a)=>{function r(e,t){}a.d(t,{A:()=>r})},63599:(e,t,a)=>{a.d(t,{A:()=>s});var r=a(20549),i=a(65945),n=a(43383);function s(e,t,a){0===e?(0,r.A)(t,a):e===a.currentPmtPid?(0,i.A)(t,a):a.pmt&&134===a.pmt.pid2StreamType.get(e)&&(0,n.A)(t,a)}},53783:(e,t,a)=>{a.d(t,{$:()=>p,q:()=>l});var r=a(27274),i=a(89564),n=a(4624),s=a(6403),o=a(31239),c=a(20576);const d="src/avformat/formats/mpegts/impegts.ts";async function l(e){let t;try{t=await e.peekBuffer(r.pm)}catch(a){-1048576!==e.error&&(t=await e.peekBuffer(e.remainingLength()))}if(t&&t.length>=r.ZT){const e=(0,i.A)(t,r.ZT,!1),a=(0,i.A)(t,r.VG,!1),s=(0,i.A)(t,r.eR,!1);let o=(0,c.A)([e,s,a]);t.lengtho?l=r.ZT:a>o?l=r.VG:s>o&&(l=r.eR),n.Yz(`got ts packet size: ${l}`,d,72),l}return 0}async function p(e,t){const a=e.getPos();let i=0;t.tsPacketSize===r.VG&&await e.skip(4);const c=await e.readUint8();71!==c&&n.h2(`found syncByte not 0x47, value: ${c.toString(16)}`,d,94);const l=new s.am;l.pos=a,i=await e.readUint16(),l.payloadUnitStartIndicator=i>>14&1,l.transportPriority=i>>13&1,l.pid=8191&i,i=await e.readUint8(),l.adaptationFieldControl=i>>4&3,l.continuityCounter=15&i;let p=4;if(2===l.adaptationFieldControl||3===l.adaptationFieldControl){const a=await e.readUint8();if(5+a===r.ZT)return(0,o.A)(await e.readBuffer(a),l),t.tsPacketSize===r.eR&&await e.skip(16),l;a>0&&(0,o.A)(await e.readBuffer(a),l),p=5+a}return 1!==l.adaptationFieldControl&&3!==l.adaptationFieldControl||(l.payload=await e.readBuffer(r.ZT-p)),t.tsPacketSize===r.eR&&await e.skip(16),l}},27274:(e,t,a)=>{a.d(t,{$x:()=>d,GV:()=>s,VG:()=>i,ZT:()=>n,eR:()=>r,hY:()=>c,pm:()=>o});const r=204,i=192,n=188,s=204,o=8192,c=5,d={15:[1,86018],17:[1,86018],3:[1,86017],4:[1,86017],1:[0,2],2:[0,2],27:[0,27],16:[0,12],36:[0,173],51:[0,196],129:[1,86019],135:[1,86056],130:[1,86020]}},6403:(e,t,a)=>{a.d(t,{Cd:()=>l,I4:()=>h,am:()=>c,kJ:()=>p,pi:()=>d,xf:()=>f});var r=a(134),i=a(80662),n=a.n(i),s=a(77231);class o{constructor(){(0,r.A)(this,"discontinuityIndicator",0),(0,r.A)(this,"randomAccessIndicator",0),(0,r.A)(this,"elementaryStreamPriorityIndicator",0),(0,r.A)(this,"pcrFlag",0),(0,r.A)(this,"opcrFlag",0),(0,r.A)(this,"splicingPointFlag",0),(0,r.A)(this,"transportPrivateDataFlag",0),(0,r.A)(this,"adaptationFieldExtensionFlag",0),(0,r.A)(this,"pcr",BigInt(0)),(0,r.A)(this,"opcr",BigInt(0)),(0,r.A)(this,"spliceCountDown",0),(0,r.A)(this,"transportPrivateData",null),(0,r.A)(this,"extension",null)}}class c{constructor(){(0,r.A)(this,"pos",s.Dh),(0,r.A)(this,"payloadUnitStartIndicator",0),(0,r.A)(this,"transportPriority",0),(0,r.A)(this,"pid",s.N_),(0,r.A)(this,"adaptationFieldControl",0),(0,r.A)(this,"continuityCounter",0),(0,r.A)(this,"transportScramblingControl",0),(0,r.A)(this,"adaptationFieldInfo",new o),(0,r.A)(this,"payload",null)}}class d{constructor(){(0,r.A)(this,"slices",[]),(0,r.A)(this,"totalLength",0),(0,r.A)(this,"expectedLength",s.N_),(0,r.A)(this,"randomAccessIndicator",0),(0,r.A)(this,"pid",s.N_),(0,r.A)(this,"streamType",0),(0,r.A)(this,"pos",s.Dh)}}class l{constructor(){(0,r.A)(this,"versionNumber",0),(0,r.A)(this,"networkPid",s.N_),(0,r.A)(this,"program2PmtPid",new(n()))}}class p{constructor(){(0,r.A)(this,"tag",void 0),(0,r.A)(this,"buffer",void 0)}}class h{constructor(){(0,r.A)(this,"versionNumber",0),(0,r.A)(this,"programNumber",0),(0,r.A)(this,"pcrPid",0),(0,r.A)(this,"pid2StreamType",new(n())),(0,r.A)(this,"pid2ESDescriptor",new(n()))}}class f{constructor(){(0,r.A)(this,"pid",s.N_),(0,r.A)(this,"streamType",0),(0,r.A)(this,"streamId",s.N_),(0,r.A)(this,"dts",s.Dh),(0,r.A)(this,"pts",s.Dh),(0,r.A)(this,"pos",s.Dh),(0,r.A)(this,"payload",null),(0,r.A)(this,"data",null),(0,r.A)(this,"randomAccessIndicator",0)}}},2187:(e,t,a)=>{a.d(t,{d:()=>s});var r=a(72739),i=a(44328),n=a(77231);function s(e,t,a){let s=BigInt(0);return r.__(e,(e=>{s+=e.codecpar.bitrate*(0,i.k)(t,a,n.i0)/BigInt(8e3)})),s}},52071:(e,t,a)=>{a.d(t,{A:()=>f});var r=a(63939),i=a(9599),n=a(29170),s=a(77231),o=a(44328),c=a(2187),d=a(71517),l=a(9705),p=a(4624);const h="src/avformat/function/seekInBytes.ts";async function f(e,t,a,f,u,m){const g=e.ioReader.getPos(),A=await e.ioReader.fileSize();let x=s.Dh,y=a;t.startTime!==s.Dh?y-=t.startTime:y-=t.firstDTS;const I=(0,o.k)(a,t.timeBase,s.i0);if(IP&&(b=P),b=0)){x=s.Dh;break}{const e=(0,o.k)(r.f[17](M+8),(0,n.A)(M+72,i.P),s.i0),a=e-I;if(p.Yz(`try to seek to pos: ${b}, got packet pts: ${r.f[17](M+8)}(${e}ms), diff: ${a}ms`,h,102),a<=BigInt(0)&&-aBigInt(0)?(C=b,b=S+C>>BigInt(1)):(S=b,b=S+C>>BigInt(1))}if(8&e.ioReader.flags)break}return(0,d.Qe)(M),x!==s.Dh?(p.Yz(`finally seek to pos ${x}`,h,133),await e.ioReader.seek(x),await m(e),g):(await e.ioReader.seek(g),8&e.ioReader.flags?BigInt(l.LT):BigInt(l.E$))}},95832:(e,t,a)=>{a.d(t,{Bq:()=>p,Ij:()=>l,XC:()=>d,f7:()=>h,uF:()=>n});var r=a(77231),i=a(37246);const n={1:"Main",2:"LC",3:"LC",4:"LC",5:"HE",6:"HE"},s={96e3:0,88200:1,64e3:2,48e3:3,44100:4,32e3:5,24e3:6,22050:7,16e3:8,12e3:9,11025:10,8e3:11,7350:12},o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,r.N_,r.N_,r.N_],c=[r.N_,1,2,3,4,5,6,7];function d(e,t){if(!t&&e.sideData[1]&&(t=e.sideData[1]),t){const{profile:a,sampleRate:i,channels:n}=function(e){let t=r.N_,a=r.N_,i=r.N_;var n,s;return e.length>=2&&(t=e[0]>>3&31,a=null!==(n=o[(7&e[0])<<1|e[1]>>7])&&void 0!==n?n:48e3,i=null!==(s=c[e[1]>>3&15])&&void 0!==s?s:2),{profile:t,sampleRate:a,channels:i}}(t);e.codecpar.profile=a,e.codecpar.sampleRate=i,e.codecpar.chLayout.nbChannels=n}}function l(e){const t=s[e.sampleRate],a=e.chLayout.nbChannels,i=e.profile===r.N_?2:e.profile,n=new Uint8Array(2);return n[0]=(31&i)<<3|(14&t)>>1,n[1]=(1&t)<<7|(15&a)<<3,n}function p(e){if(e.length<7)return-1;const t=e[0]<<4|e[1]>>4;if(4095!==t)return-1;const a=1&e[1],r=(192&e[2])>>>6,i=(60&e[2])>>>2,n=(1&e[2])<<2|(192&e[3])>>>6,s=(3&e[3])<<11|e[4]<<3|(224&e[5])>>>5,d=3&e[6];let l=1===a?7:9,p=s-l;return{syncWord:t,profile:r+1,sampleRate:o[i],channels:c[n],aacFrameLength:s,numberOfRawDataBlocksInFrame:d,headerLength:l,framePayloadLength:p}}function h(e,t){function a(){const e=t.readU(2);let a=0;for(let r=0;r<=e;r++)a<<=8,a|=t.readU(8);return a}t||(t=new i.A).appendBuffer(e);const r=t.getPointer(),n={syncWord:0,profile:0,sampleRate:0,channels:0,useSameStreamMux:!1,headerLength:0,framePayloadLength:0,muxLengthBytes:0},s=t.readU(11);if(695!==s)return-1;n.syncWord=s,n.muxLengthBytes=t.readU(13);const d=1===t.readU1();if(n.useSameStreamMux=d,!d){const e=1===t.readU1();if(e&&1===t.readU1())return-1;if(e&&a(),1!==t.readU1())return-1;if(0!==t.readU(6))return-1;if(0!==t.readU(4))return-1;if(0!==t.readU(3))return-1;let r=e?a():0;const i=t.readU(5);r-=5;const s=t.readU(4);r-=4;const d=t.readU(4);if(r-=4,t.readU(3),r-=3,r>0&&t.readU(r),0!==t.readU(3))return-1;if(t.readU(8),1===t.readU1())if(e)a();else{let e=0;for(;;){e<<=8;const a=1===t.readU1();if(e+=t.readU(8),!a)break}}1===t.readU1()&&t.readU(8),n.profile=i+1,n.sampleRate=o[s],n.channels=c[d]}let l=0;for(;;){const e=t.readU(8);if(l+=e,255!==e)break}return n.framePayloadLength=l,n.headerLength=t.getPointer()-r+(8===t.getBitLeft()?0:1),n}},87518:(e,t,a)=>{a.d(t,{R:()=>f,j:()=>i});var r=a(37246);const i=[3,4,3,7,259,263,1539,1543],n=[[64,69,96],[64,70,96],[80,87,120],[80,88,120],[96,104,144],[96,105,144],[112,121,168],[112,122,168],[128,139,192],[128,140,192],[160,174,240],[160,175,240],[192,208,288],[192,209,288],[224,243,336],[224,244,336],[256,278,384],[256,279,384],[320,348,480],[320,349,480],[384,417,576],[384,418,576],[448,487,672],[448,488,672],[512,557,768],[512,558,768],[640,696,960],[640,697,960],[768,835,1152],[768,836,1152],[896,975,1344],[896,976,1344],[1024,1114,1536],[1024,1115,1536],[1152,1253,1728],[1152,1254,1728],[1280,1393,1920],[1280,1394,1920]],s=[4,5,6,5],o=[4,6,7,6],c=[48e3,44100,32e3,0],d=[32,40,48,56,64,80,96,112,128,160,192,224,256,320,384,448,512,576,640],l=[2,1,2,3,3,4,4,5],p=[1,2,3,6],h=7;function f(e){const t=new r.A(e.length);t.appendBuffer(e);const a={syncWord:0,crc1:0,srCode:0,bitstreamId:0,bitstreamMode:0,channelMode:0,lfeOn:0,frameType:0,substreamId:0,centerMixLevel:0,surroundMixLevel:0,channelMap:0,numBlocks:0,dolbySurroundMode:0,srShift:0,sampleRate:0,bitrate:0,channels:0,frameSize:0,channelLayout:BigInt(0),ac3BitrateCode:0};if(a.syncWord=t.readU(16),2935!==a.syncWord)return-1;if(a.bitstreamId=31&t.peekU(29),a.bitstreamId>16)return-2;if(a.numBlocks=6,a.ac3BitrateCode=-1,a.centerMixLevel=5,a.surroundMixLevel=6,a.dolbySurroundMode=0,a.bitstreamId<=10){if(a.crc1=t.readU(16),a.srCode=t.readU(2),3===a.srCode)return-3;const e=t.readU(6);if(e>37)return-4;a.ac3BitrateCode=e>>1,t.readU(5),a.bitstreamMode=t.readU(3),a.channelMode=t.readU(3),2==a.channelMode?a.dolbySurroundMode=t.readU(2):(1&a.channelMode&&1!=a.channelMode&&(a.centerMixLevel=s[t.readU(2)]),4&a.channelMode&&(a.surroundMixLevel=o[t.readU(2)])),a.lfeOn=t.readU(1),a.srShift=Math.max(a.bitstreamId,8)-8,a.sampleRate=c[a.srCode]>>a.srShift,a.bitrate=1e3*d[a.ac3BitrateCode]>>a.srShift,a.channels=l[a.channelMode]+a.lfeOn,a.frameSize=2*n[e][a.srCode],a.frameType=2,a.substreamId=0}else{if(a.crc1=0,a.frameType=t.readU(2),3==a.frameType)return-5;if(a.substreamId=t.readU(3),a.frameSize=t.readU(11)+1<<1,a.frameSize{a.d(t,{R:()=>d,u:()=>c});var r=a(37246),i=a(95073);const n=[1,2,2,2,2,3,3,4,4,5,6,6,6,7,8,8],s=[0,8e3,16e3,32e3,0,0,11025,22050,44100,0,0,12e3,24e3,48e3,96e3,192e3],o=[32e3,56e3,64e3,96e3,112e3,128e3,192e3,224e3,256e3,32e4,384e3,448e3,512e3,576e3,64e4,768e3,96e4,1024e3,1152e3,128e4,1344e3,1408e3,1411200,1472e3,1536e3,192e4,2048e3,3072e3,384e4,0,0,0],c=32;function d(e){const t=new r.A(e.length);t.appendBuffer(e);const a={syncWord:0,frameType:0,deficitSamples:0,crcFlag:0,sampleBlock:0,frameSize:0,channelIndex:0,sampleRateIndex:0,bitrateIndex:0,channels:0,sampleRate:0,bitrate:0};return a.syncWord=t.readU(32),2147385345!==a.syncWord&&4269736320!==a.syncWord?-1:(a.frameType=t.readU1(),a.deficitSamples=t.readU(5)+1,a.crcFlag=t.readU1(),a.sampleBlock=t.readU(7)+1,a.frameSize=(0,i.A)(t.readU(14)+1,4),a.channelIndex=t.readU(6),a.sampleRateIndex=t.readU(4),a.bitrateIndex=t.readU(5),a.channels=n[a.channelIndex],a.sampleRate=s[a.sampleRateIndex],a.bitrate=o[a.bitrateIndex],a)}},64093:(e,t,a)=>{a.d(t,{Au:()=>x,He:()=>y,XC:()=>I,Y2:()=>m,hG:()=>g,oz:()=>A});var r=a(77231);const i=[44100,48e3,32e3,0],n=[22050,24e3,16e3,0],s=[11025,12e3,8e3,0],o=[0,1152,1152,384],c=[0,576,1152,384],d=[0,576,1152,384],l=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],p=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],h=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],f=[0,32,48,56,64,80,96,112,128,144,160,176,192,224,256,-1],u=[0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,-1];function m(e,t){switch(e){case 0:return s[t];case 2:return n[t];case 3:return i[t]}return r.N_}function g(e,t){switch(e){case 0:return d[t];case 2:return c[t];case 3:return o[t]}return r.N_}function A(e,t,a){switch(t){case 1:switch(e){case 0:case 2:return u[a];case 3:return h[a]}break;case 2:switch(e){case 0:case 2:return u[a];case 3:return p[a]}case 3:switch(e){case 0:case 2:return f[a];case 3:return l[a]}}return r.N_}function x(e){switch(e){case 1:return 34;case 2:return 33;case 3:return 32}return r.N_}const y={32:"Layer1",33:"Layer2",34:"Layer3"};function I(e,t){if(t&&t.length>=4){const a=t[1]>>>3&3,r=(6&t[1])>>1,i=(12&t[2])>>>2,n=3&~(t[3]>>>6)?2:1,s=x(r),o=m(a,i);e.codecpar.profile=s,e.codecpar.sampleRate=o,e.codecpar.chLayout.nbChannels=n}}},22576:(e,t,a)=>{a.d(t,{Ij:()=>d,XC:()=>c,kt:()=>o});var r=a(31865),i=a(729),n=a(44328);const s=[480,960,1920,2880,480,960,1920,2880,480,960,1920,2880,480,960,480,960,120,240,480,960,120,240,480,960,120,240,480,960,120,240,480,960];function o(e){let t=0,a=0,r=0;if(e.length<1)return 0;switch(t=e[0],a=s[t>>3],3&t){case 0:r=1;break;case 1:case 2:r=2;break;case 3:if(e.length<2)return 0;r=63&e[1]}return r*a}function c(e,t){if(!t&&e.sideData[1]&&(t=e.sideData[1]),t&&t.length>=19){const a=new r.A(t,!1);a.skip(9),e.codecpar.chLayout.nbChannels=a.readUint8(),e.codecpar.initialPadding=a.readUint16(),e.codecpar.sampleRate=a.readUint32(),e.codecpar.seekPreroll=Number((0,n.k)(BigInt(80),{den:1e3,num:1},{den:48e3,num:1}))}}function d(e){const t=new Uint8Array(19),a=new i.A(t,!1);return a.writeString("OpusHead"),a.writeUint8(1),a.writeUint8(e.chLayout.nbChannels),a.writeUint16(e.initialPadding),a.writeUint32(e.sampleRate),t}},20576:(e,t,a)=>{function r(e){if(0===e.length)return 0;const t=e.slice().sort(((e,t)=>e-t)),a=Math.floor(t.length/2);return t.length%2==1?t[a]:(t[a-1]+t[a])/2}a.d(t,{A:()=>r})}}]); \ No newline at end of file diff --git a/dist/avplayer-ui/433.avplayer.js b/dist/avplayer-ui/433.avplayer.js index aa7f964..8a197d7 100644 --- a/dist/avplayer-ui/433.avplayer.js +++ b/dist/avplayer-ui/433.avplayer.js @@ -1 +1 @@ -(self.webpackChunkAVPlayer=self.webpackChunkAVPlayer||[]).push([[433],{70509:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var s=i(134);class a{constructor(){(0,s.A)(this,"onFlush",void 0)}}},97801:(t,e,i)=>{"use strict";i.d(e,{A:()=>T});var s=i(134),a=i(70509),r=i(13258),n=i(51678),o=i(13724),h=i(4624);const l="src/avnetwork/bsp/aes/AESDecryptPipe.ts",c=16;let d=!0;const u=new Uint8Array(c).fill(c);class T extends a.A{constructor(t=1048576){super(),(0,s.A)(this,"buffer",void 0),(0,s.A)(this,"aesSoftDecryptor",void 0),(0,s.A)(this,"aesWebDecryptor",void 0),(0,s.A)(this,"aesTargetDecryptor",void 0),(0,s.A)(this,"pointer",void 0),(0,s.A)(this,"endPointer",void 0),(0,s.A)(this,"size",void 0),(0,s.A)(this,"ended",void 0),(0,s.A)(this,"iv",void 0),(0,s.A)(this,"key",void 0),this.size=t,this.pointer=0,this.endPointer=0,this.ended=!1,this.buffer=new Uint8Array(t),this.aesSoftDecryptor=new r.A,n.A.isSupport()&&d&&(this.aesWebDecryptor=new n.A),this.aesTargetDecryptor=this.aesWebDecryptor||this.aesSoftDecryptor}remainingLength(){return this.endPointer-this.pointer}async expandKey(t,e){this.key=t,this.iv=e,this.aesWebDecryptor&&await this.aesWebDecryptor.expandKey(t),this.aesSoftDecryptor.expandKey(t)}async flush_(t){for(;;){const e=await this.onFlush(t);if(-1048575!==e)return e;await new o.A(0)}}async flush(){if(this.size-this.remainingLength()<=0)return;this.pointer{"use strict";i.r(e),i.d(e,{default:()=>p});var s=i(134),a=i(80662),r=i.n(a),n=i(13724),o=i(82800),h=i(95335),l=i(8507),c=i(48182),d=i(77580),u=i(86932),T=i(4624),E=i(97801),f=i(67672);const A="src/avnetwork/ioLoader/HlsIOLoader.ts";class p extends o.A{constructor(...t){super(...t),(0,s.A)(this,"info",void 0),(0,s.A)(this,"range",void 0),(0,s.A)(this,"masterPlaylist",void 0),(0,s.A)(this,"mediaPlayList",void 0),(0,s.A)(this,"mediaPlayListIndex",void 0),(0,s.A)(this,"fetchedMap",void 0),(0,s.A)(this,"fetchedHistoryList",void 0),(0,s.A)(this,"mediaListUrl",void 0),(0,s.A)(this,"segmentIndex",void 0),(0,s.A)(this,"currentUri",void 0),(0,s.A)(this,"loader",void 0),(0,s.A)(this,"minBuffer",void 0),(0,s.A)(this,"keyMap",void 0),(0,s.A)(this,"currentIV",void 0),(0,s.A)(this,"currentKey",void 0),(0,s.A)(this,"aesDecryptPipe",void 0),(0,s.A)(this,"initLoaded",void 0)}async fetchMasterPlayList(){var t,e,i;const s={method:"GET",headers:{},mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};null!==(t=this.info.httpOptions)&&void 0!==t&&t.headers&&h.__(this.info.httpOptions.headers,((t,e)=>{s.headers[e]=t})),null!==(e=this.info.httpOptions)&&void 0!==e&&e.credentials&&(s.credentials=this.info.httpOptions.credentials),null!==(i=this.info.httpOptions)&&void 0!==i&&i.referrerPolicy&&(s.referrerPolicy=this.info.httpOptions.referrerPolicy);try{const t=await fetch(this.info.url,s),e=await t.text(),i=(0,c.A)(e);if(i.isMasterPlaylist)this.masterPlaylist=i;else{if(this.mediaPlayList=i,this.options.isLive&&(!this.mediaPlayList.segments||this.mediaPlayList.segments.length<2)){var a;let t=5;return null!==(a=this.mediaPlayList.segments)&&void 0!==a&&a.length&&(t=this.mediaPlayList.segments[0].duration*(2-this.mediaPlayList.segments.length)),T.R8(`wait for min buffer time, now segments: ${this.mediaPlayList.segments.length}`,A,116),await new n.A(t),this.fetchMasterPlayList()}this.minBuffer=this.mediaPlayList.duration||0,this.mediaPlayList.endlist&&(this.options.isLive=!1),this.mediaListUrl=this.info.url}return i}catch(t){if(this.retryCount{a.headers[e]=t})),null!==(e=this.info.httpOptions)&&void 0!==e&&e.credentials&&(a.credentials=this.info.httpOptions.credentials),null!==(i=this.info.httpOptions)&&void 0!==i&&i.referrerPolicy&&(a.referrerPolicy=this.info.httpOptions.referrerPolicy);try{const t=await fetch(s,a),e=await t.text();if(this.mediaPlayList=(0,c.A)(e),this.options.isLive&&(!this.mediaPlayList.segments||this.mediaPlayList.segments.length<2)){var r;let t=5;return null!==(r=this.mediaPlayList.segments)&&void 0!==r&&r.length&&(t=this.mediaPlayList.segments[0].duration*(2-this.mediaPlayList.segments.length)),T.R8(`wait for min buffer time, now segments: ${this.mediaPlayList.segments.length}`,A,196),await new n.A(t),this.fetchMediaPlayList()}return this.minBuffer=this.mediaPlayList.duration||0,this.mediaPlayList.endlist&&(this.options.isLive=!1),this.status=2,this.retryCount=0,this.mediaPlayList}catch(t){if(this.retryCountthis.loader.read(t),await this.aesDecryptPipe.expandKey(this.currentKey,this.currentIV)}async read(t){let e=0;if(this.loader){if(e=this.aesDecryptPipe?await this.aesDecryptPipe.read(t):await this.loader.read(t),-1048576!==e)return e;if(this.initLoaded){if(this.options.isLive)this.fetchedMap.set(this.currentUri,!0),10===this.fetchedHistoryList.length&&this.fetchedMap.delete(this.fetchedHistoryList.shift()),this.fetchedHistoryList.push(this.currentUri),this.segmentIndex++;else if(this.segmentIndex++,this.segmentIndex>=this.mediaPlayList.segments.length)return T.pq("hls segments ended",A,317),this.status=4,-1048576}else this.initLoaded=!0;this.loader=null}if(this.options.isLive){const e=this.mediaPlayList.segments.filter((t=>!this.fetchedMap.get(t.uri)));if(!e.length){if(this.mediaPlayList.endlist)return this.status=4,-1048576;const e=(this.minBuffer-((0,u.A)()-this.mediaPlayList.timestamp)/1e3)/2;return e>0&&await new n.A(e),await this.fetchMediaPlayList(),this.read(t)}this.currentUri=e[0].uri,this.initLoaded&&await this.checkNeedDecrypt(e[0],this.segmentIndex),this.loader=new d.A(h.X$({},this.options,{disableSegment:!0,loop:!1}));const i=(0,l.ll)(this.mediaListUrl,this.initLoaded?this.currentUri:e[0].map.uri),s={from:0,to:-1},a=this.initLoaded?e[0].byterange:e[0].map.byterange;return a&&(s.from=a.offset,s.to=a.offset+a.length),await this.loader.open(h.X$({},this.info,{url:i}),s),this.aesDecryptPipe?this.aesDecryptPipe.read(t):this.loader.read(t)}{this.loader=new d.A(h.X$({},this.options,{disableSegment:!0,loop:!1}));let e=this.mediaPlayList.segments[this.segmentIndex];for(;!e.uri;)e=this.mediaPlayList.segments[++this.segmentIndex];this.initLoaded&&await this.checkNeedDecrypt(e,this.segmentIndex);const i=(0,l.ll)(this.mediaListUrl,this.initLoaded?e.uri:e.map.uri),s={from:0,to:-1},a=this.initLoaded?e.byterange:e.map.byterange;return a&&(s.from=a.offset,s.to=a.offset+a.length),await this.loader.open(h.X$({},this.info,{url:i}),s),this.aesDecryptPipe?this.aesDecryptPipe.read(t):this.loader.read(t)}}async seek(t){this.loader&&(await this.loader.abort(),this.loader=null);let e=0,i=Number(t),s=0;for(let t=0;t=i)){s=t;break}return this.segmentIndex=s,4===this.status&&(this.status=2),0}async size(){return BigInt(0)}async abort(){this.loader&&(await this.loader.abort(),this.loader=null)}async stop(){await this.abort(),this.status=0}getDuration(){return this.mediaPlayList.duration}getVideoList(){var t,e;return{list:null!==(t=null===(e=this.masterPlaylist)||void 0===e?void 0:e.variants.map((t=>{var e,i,s,a,r;return{width:null!==(e=null===(i=t.resolution)||void 0===i?void 0:i.width)&&void 0!==e?e:0,height:null!==(s=null===(a=t.resolution)||void 0===a?void 0:a.height)&&void 0!==s?s:0,frameRate:null!==(r=t.frameRate)&&void 0!==r?r:0,codecs:t.codecs}})))&&void 0!==t?t:[],selectedIndex:0}}selectVideo(t){this.mediaPlayListIndex=t,this.fetchMediaPlayList()}getMinBuffer(){return this.minBuffer}}},48182:(t,e,i)=>{"use strict";i.d(e,{A:()=>L});var s=i(7210),a=i.n(s),r=i(43929),n=i.n(r),o=i(69736),h=i.n(o),l=i(80662),c=i.n(l),d=i(67756),u=i(64608),T=i(4624);const E="src/avprotocol/m3u8/parser.ts";function f(t){return d.Bq(t,'"')}function A(t){const e=d.gI(t,",");return{duration:d.Ro(e[0]),title:decodeURIComponent(escape(e[1]))}}function p(t){const e=d.gI(t,"@");return{length:d.Ro(e[0]),offset:e[1]?d.Ro(e[1]):-1}}function m(t){const e=d.gI(t,"x");return{width:d.Ro(e[0]),height:d.Ro(e[1])}}function y(t){const e="ALLOWED-CPC: Each entry must consit of KEYFORMAT and Content Protection Configuration",i=t.split(",");0===i.length&&T.z3(e,E,102);const s=[];for(const t of i){const[i,a]=d.gI(t,":");i&&a?s.push({format:i,cpcList:a.split("/")}):T.z3(e,E,108)}return s}function g(t){const e=d.m2(t);return 16!==e.length&&T.z3("IV must be a 128-bit unsigned integer",E,119),e}function X(t,e){e.IV&&t.compatibleVersion<2&&(t.compatibleVersion=2),(e.KEYFORMAT||e.KEYFORMATVERSIONS)&&t.compatibleVersion<5&&(t.compatibleVersion=5)}function S(t){const e={};for(const s of d.HG(t)){const[t,a]=d.gI(s,"="),r=f(a);switch(t){case"URI":e[t]=r;break;case"START-DATE":case"END-DATE":e[t]=new Date(r);break;case"IV":e[t]=g(r);break;case"BYTERANGE":e[t]=p(r);break;case"RESOLUTION":e[t]=m(r);break;case"ALLOWED-CPC":e[t]=y(r);break;case"END-ON-NEXT":case"DEFAULT":case"AUTOSELECT":case"FORCED":case"PRECISE":case"CAN-BLOCK-RELOAD":case"INDEPENDENT":case"GAP":e[t]="YES"===r;break;case"DURATION":case"PLANNED-DURATION":case"BANDWIDTH":case"AVERAGE-BANDWIDTH":case"FRAME-RATE":case"TIME-OFFSET":case"CAN-SKIP-UNTIL":case"HOLD-BACK":case"PART-HOLD-BACK":case"PART-TARGET":case"BYTERANGE-START":case"BYTERANGE-LENGTH":case"LAST-MSN":case"LAST-PART":case"SKIPPED-SEGMENTS":case"SCORE":case"PROGRAM-ID":e[t]=d.Ro(r);break;default:t.startsWith("SCTE35-")?e[t]=d.m2(r):t.startsWith("X-")?e[t]=(i=a).startsWith('"')?f(i):i.startsWith("0x")||i.startsWith("0X")?d.m2(i):d.Ro(i):("VIDEO-RANGE"===t&&"SDR"!==r&&"HLG"!==r&&"PQ"!==r&&T.h2(`VIDEO-RANGE: unknown value "${r}"`,E,206),e[t]=r)}}var i;return e}function I(t,e,i){const s=function({attributes:t}){return new u.ru({type:t.TYPE,uri:t.URI,groupId:t["GROUP-ID"],language:t.LANGUAGE,assocLanguage:t["ASSOC-LANGUAGE"],name:t.NAME,isDefault:t.DEFAULT,autoselect:t.AUTOSELECT,forced:t.FORCED,instreamId:t["INSTREAM-ID"],characteristics:t.CHARACTERISTICS,channels:t.CHANNELS})}(e),a=t[d.Th(i)],r=function(t,e){let i=!1;for(const s of t){if(s.name===e.name)return"All EXT-X-MEDIA tags in the same Group MUST have different NAME attributes.";s.isDefault&&(i=!0)}return i&&e.isDefault?"EXT-X-MEDIA A Group MUST NOT have more than one member with a DEFAULT attribute of YES.":""}(a,s);r&&T.h2(r,E,315),a.push(s),s.isDefault&&(t.currentRenditions[d.Th(i)]=a.length-1)}function N(t,e,i,s,a){const r=new u.KT({uri:i,bandwidth:e.BANDWIDTH,averageBandwidth:e["AVERAGE-BANDWIDTH"],score:e.SCORE,codecs:e.CODECS,resolution:e.RESOLUTION,frameRate:e["FRAME-RATE"],hdcpLevel:e["HDCP-LEVEL"],allowedCpc:e["ALLOWED-CPC"],videoRange:e["VIDEO-RANGE"],stableVariantId:e["STABLE-VARIANT-ID"],programId:e["PROGRAM-ID"]});for(const i of t)if("EXT-X-MEDIA"===i.name){const t=i.attributes,s=t.TYPE;if(s&&t["GROUP-ID"]||T.h2("EXT-X-MEDIA TYPE attribute is REQUIRED.",E,355),e[s]===t["GROUP-ID"]&&(I(r,i,s),"CLOSED-CAPTIONS"===s))for(const{instreamId:t}of r.closedCaptions)if(t&&t.startsWith("SERVICE")&&a.compatibleVersion<7){a.compatibleVersion=7;break}}return function(t,e,i){for(const s of["AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS"])"CLOSED-CAPTIONS"===s&&"NONE"===t[s]?(i.isClosedCaptionsNone=!0,e.closedCaptions=[]):t[s]&&!e[d.Th(s)].some((e=>e.groupId===t[s]))&&T.h2(`${s} attribute MUST match the value of the GROUP-ID attribute of an EXT-X-MEDIA tag whose TYPE attribute is ${s}.`,E,330)}(e,r,a),r.isIFrameOnly=s,r}function v(t,e){if(t.method!==e.method)return!1;if(t.uri!==e.uri)return!1;if(t.iv){if(!e.iv)return!1;if(t.iv.length!==e.iv.length)return!1;for(let i=0;io.targetDuration&&T.h2("EXTINF duration, when rounded to the nearest integer, MUST be less than or equal to the target duration",E,517),l.duration=s.duration,l.title=s.title;else if("EXT-X-BYTERANGE"===i)o.compatibleVersion<4&&(o.compatibleVersion=4),l.byterange=s;else if("EXT-X-DISCONTINUITY"===i)l.parts.length>0&&T.h2("EXT-X-DISCONTINUITY must appear before the first EXT-X-PART tag of the Parent Segment.",E,530),l.discontinuity=!0;else if("EXT-X-KEY"===i)l.parts.length>0&&T.h2("EXT-X-KEY must appear before the first EXT-X-PART tag of the Parent Segment.",E,536),"NONE"!==a.METHOD&&(X(o,a),l.key=new u.Uz({method:a.METHOD,uri:a.URI,iv:a.IV,format:a.KEYFORMAT,formatVersion:a.KEYFORMATVERSIONS}));else if("EXT-X-MAP"===i)l.parts.length>0&&T.h2("EXT-X-MAP must appear before the first EXT-X-PART tag of the Parent Segment.",E,552),o.compatibleVersion<5&&(o.compatibleVersion=5),o.hasMap=!0,l.map=new u.qP({uri:a.URI,byterange:a.BYTERANGE});else if("EXT-X-PROGRAM-DATE-TIME"===i)l.programDateTime=s;else if("EXT-X-DATERANGE"===i){const t={};for(const e of h()(a))(e.startsWith("SCTE35-")||e.startsWith("X-"))&&(t[e]=a[e]);l.dateRange=new u.ad({id:a.ID,classId:a.CLASS,start:a["START-DATE"],end:a["END-DATE"],duration:a.DURATION,plannedDuration:a["PLANNED-DURATION"],endOnNext:a["END-ON-NEXT"],attributes:t})}else if("EXT-X-CUE-OUT"===i)l.markers.push(new u.xC({type:"OUT",duration:a&&a.DURATION||s}));else if("EXT-X-CUE-IN"===i)l.markers.push(new u.xC({type:"IN"}));else if("EXT-X-CUE-OUT-CONT"===i||"EXT-X-CUE"===i||"EXT-OATCLS-SCTE35"===i||"EXT-X-ASSET"===i||"EXT-X-SCTE35"===i)l.markers.push(new u.xC({type:"RAW",tagName:i,value:s}));else if("EXT-X-PRELOAD-HINT"!==i||a.TYPE)if("EXT-X-PRELOAD-HINT"===i&&"PART"===a.TYPE&&d)T.h2("Servers should not add more than one EXT-X-PRELOAD-HINT tag with the same TYPE attribute to a Playlist.",E,612);else if("EXT-X-PART"!==i&&"EXT-X-PRELOAD-HINT"!==i||a.URI){if("EXT-X-PRELOAD-HINT"===i&&"MAP"===a.TYPE)c&&T.h2("Servers should not add more than one EXT-X-PRELOAD-HINT tag with the same TYPE attribute to a Playlist.",E,619),c=!0,o.hasMap=!0,l.map=new u.qP({hint:!0,uri:a.URI,byterange:{length:a["BYTERANGE-LENGTH"],offset:a["BYTERANGE-START"]||0}});else if("EXT-X-PART"===i||"EXT-X-PRELOAD-HINT"===i&&"PART"===a.TYPE){"EXT-X-PART"!==i||a.DURATION||T.h2("EXT-X-PART: DURATION attribute is mandatory",E,631),"EXT-X-PRELOAD-HINT"===i&&(d=!0);const t=new u.nw({hint:"EXT-X-PRELOAD-HINT"===i,uri:a.URI,byterange:"EXT-X-PART"===i?a.BYTERANGE:{length:a["BYTERANGE-LENGTH"],offset:a["BYTERANGE-START"]||0},duration:a.DURATION,independent:a.INDEPENDENT,gap:a.GAP});l.parts.push(t)}}else T.h2("EXT-X-PART / EXT-X-PRELOAD-HINT: URI attribute is mandatory",E,615);else T.h2("EXT-X-PRELOAD-HINT: TYPE attribute is mandatory",E,609)}return l}function P(t,e,i,s,a,r,n){const o=new u.Vd({uri:e,mediaSequenceNumber:a,discontinuitySequence:r});for(let e=i;e<=s;e++){const{name:i,attributes:s}=t[e];"EXTINF"===i?T.h2("A prefetch segment must not be advertised with an EXTINF tag.",E,663):"EXT-X-DISCONTINUITY"===i?T.h2("A prefetch segment must not be advertised with an EXT-X-DISCONTINUITY tag.",E,666):"EXT-X-PREFETCH-DISCONTINUITY"===i?o.discontinuity=!0:"EXT-X-KEY"===i?"NONE"!==s.METHOD&&(X(n,s),o.key=new u.Uz({method:s.METHOD,uri:s.URI,iv:s.IV,format:s.KEYFORMAT,formatVersion:s.KEYFORMATVERSIONS})):"EXT-X-MAP"===i&&T.h2("Prefetch segments must not be advertised with an EXT-X-MAP tag.",E,684)}return o}function D(t,e,i,s,a){const{discontinuity:r,key:n,map:o,byterange:h,uri:l}=e;if(r&&(e.discontinuitySequence=i+1),n||(e.key=s),o||(e.map=a),h&&-1===h.offset){const{segments:e}=t;if(e.length>0){const t=e[e.length-1];t.byterange&&t.uri===l?h.offset=t.byterange.offset+t.byterange.length:T.h2("If offset of EXT-X-BYTERANGE is not present, a previous Media Segment MUST be a sub-range of the same media resource",E,900)}else T.h2("If offset of EXT-X-BYTERANGE is not present, a previous Media Segment MUST appear in the Playlist file",E,904)}return t.segments.push(e),[e.discontinuitySequence,e.key,e.map]}function b(t,e){const[i,s]=function(t){const e=t.indexOf(":");return-1===e?[t.slice(1).trim(),null]:[t.slice(1,e).trim(),t.slice(e+1).trim()]}(t),r=function(t){switch(t){case"EXTM3U":case"EXT-X-VERSION":return"Basic";case"EXTINF":case"EXT-X-BYTERANGE":case"EXT-X-DISCONTINUITY":case"EXT-X-PREFETCH-DISCONTINUITY":case"EXT-X-KEY":case"EXT-X-MAP":case"EXT-X-PROGRAM-DATE-TIME":case"EXT-X-DATERANGE":case"EXT-X-CUE-OUT":case"EXT-X-CUE-IN":case"EXT-X-CUE-OUT-CONT":case"EXT-X-CUE":case"EXT-OATCLS-SCTE35":case"EXT-X-ASSET":case"EXT-X-SCTE35":case"EXT-X-PART":case"EXT-X-PRELOAD-HINT":return"Segment";case"EXT-X-TARGETDURATION":case"EXT-X-MEDIA-SEQUENCE":case"EXT-X-DISCONTINUITY-SEQUENCE":case"EXT-X-ENDLIST":case"EXT-X-PLAYLIST-TYPE":case"EXT-X-I-FRAMES-ONLY":case"EXT-X-SERVER-CONTROL":case"EXT-X-PART-INF":case"EXT-X-PREFETCH":case"EXT-X-RENDITION-REPORT":case"EXT-X-SKIP":return"MediaPlaylist";case"EXT-X-MEDIA":case"EXT-X-STREAM-INF":case"EXT-X-I-FRAME-STREAM-INF":case"EXT-X-SESSION-DATA":case"EXT-X-SESSION-KEY":return"MasterPlaylist";case"EXT-X-INDEPENDENT-SEGMENTS":case"EXT-X-START":return"MediaorMasterPlaylist";default:return"Unknown"}}(i);if(function(t,e){if("Segment"===t||"MediaPlaylist"===t)return void 0===e.isMasterPlaylist?void(e.isMasterPlaylist=!1):void(e.isMasterPlaylist&&T.h2("The file contains both media and master playlist tags.",E,1011));if("MasterPlaylist"===t){if(void 0===e.isMasterPlaylist)return void(e.isMasterPlaylist=!0);!1===e.isMasterPlaylist&&T.h2("The file contains both media and master playlist tags.",E,1021)}}(r,e),"Unknown"===r)return null;"MediaPlaylist"===r&&"EXT-X-RENDITION-REPORT"!==i&&"EXT-X-PREFETCH"!==i&&(e.hash[i]&&T.h2("There MUST NOT be more than one Media Playlist tag of each type in any Media Playlist",E,1042),e.hash[i]=!0);const[n,o]=function(t,e){switch(t){case"EXTM3U":case"EXT-X-DISCONTINUITY":case"EXT-X-ENDLIST":case"EXT-X-I-FRAMES-ONLY":case"EXT-X-INDEPENDENT-SEGMENTS":case"EXT-X-CUE-IN":return[null,null];case"EXT-X-VERSION":case"EXT-X-TARGETDURATION":case"EXT-X-MEDIA-SEQUENCE":case"EXT-X-DISCONTINUITY-SEQUENCE":return[d.Ro(e),null];case"EXT-X-CUE-OUT":return a()(Number(e))?[null,S(e)]:[d.Ro(e),null];case"EXT-X-KEY":case"EXT-X-MAP":case"EXT-X-DATERANGE":case"EXT-X-MEDIA":case"EXT-X-STREAM-INF":case"EXT-X-I-FRAME-STREAM-INF":case"EXT-X-SESSION-DATA":case"EXT-X-SESSION-KEY":case"EXT-X-START":case"EXT-X-SERVER-CONTROL":case"EXT-X-PART-INF":case"EXT-X-PART":case"EXT-X-PRELOAD-HINT":case"EXT-X-RENDITION-REPORT":case"EXT-X-SKIP":return[null,S(e)];case"EXTINF":return[A(e),null];case"EXT-X-BYTERANGE":return[p(e),null];case"EXT-X-PROGRAM-DATE-TIME":return[new Date(e),null];default:return[e,null]}}(i,s);return{name:i,category:r,value:n,attributes:o}}function O(t,e){let i;return e.isMasterPlaylist?i=function(t,e){const i=new u.ts;let s=!1;for(const[a,{name:r,value:n,attributes:o}]of t.entries())if("EXT-X-VERSION"===r)i.version=n;else if("EXT-X-STREAM-INF"===r){const r=t[a+1];("string"!=typeof r||r.startsWith("#EXT"))&&T.h2("EXT-X-STREAM-INF must be followed by a URI line",E,417);const n=N(t,o,r,!1,e);n&&("number"==typeof n.score&&(s=!0,n.score<0&&T.h2("SCORE attribute on EXT-X-STREAM-INF must be positive decimal-floating-point number.",E,424)),i.variants.push(n))}else if("EXT-X-I-FRAME-STREAM-INF"===r){const s=N(t,o,o.URI,!0,e);s&&i.variants.push(s)}else if("EXT-X-SESSION-DATA"===r){const t=new u.pf({id:o["DATA-ID"],value:o.VALUE,uri:o.URI,language:o.LANGUAGE});i.sessionDataList.some((e=>e.id===t.id&&e.language===t.language))&&T.h2("A Playlist MUST NOT contain more than one EXT-X-SESSION-DATA tag with the same DATA-ID attribute and the same LANGUAGE attribute.",E,444),i.sessionDataList.push(t)}else if("EXT-X-SESSION-KEY"===r){"NONE"===o.METHOD&&T.h2("EXT-X-SESSION-KEY: The value of the METHOD attribute MUST NOT be NONE",E,450);const t=new u.Uz({method:o.METHOD,uri:o.URI,iv:o.IV,format:o.KEYFORMAT,formatVersion:o.KEYFORMATVERSIONS});i.sessionKeyList.some((e=>v(e,t)))&&T.h2("A Master Playlist MUST NOT contain more than one EXT-X-SESSION-KEY tag with the same METHOD, URI, IV, KEYFORMAT, and KEYFORMATVERSIONS attribute values.",E,460),X(e,o),i.sessionKeyList.push(t)}else"EXT-X-INDEPENDENT-SEGMENTS"===r?(i.independentSegments&&T.h2("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist",E,467),i.independentSegments=!0):"EXT-X-START"===r&&(i.start&&T.h2("EXT-X-START tag MUST NOT appear more than once in a Playlist",E,473),"number"!=typeof o["TIME-OFFSET"]&&T.h2("EXT-X-START: TIME-OFFSET attribute is REQUIRED",E,476),i.start={offset:o["TIME-OFFSET"],precise:o.PRECISE||!1});if(s)for(const t of i.variants)"number"!=typeof t.score&&T.h2("If any Variant Stream contains the SCORE attribute, then all Variant Streams in the Master Playlist SHOULD have a SCORE attribute",E,484);if(e.isClosedCaptionsNone)for(const t of i.variants)t.closedCaptions.length>0&&T.h2("If there is a variant with CLOSED-CAPTIONS attribute of NONE, all EXT-X-STREAM-INF tags MUST have this attribute with a value of NONE",E,491);return i}(t,e):(i=function(t,e){const i=new u.tk;let s=-1,a=0,r=!1,n=!1,o=0,h=null,l=null,d=!1;for(const[c,f]of t.entries()){const{name:A,value:p,attributes:m,category:y}=f;if("Segment"!==y){if("EXT-X-VERSION"===A)void 0===i.version?i.version=p:T.h2("A Playlist file MUST NOT contain more than one EXT-X-VERSION tag.",E,716);else if("EXT-X-TARGETDURATION"===A)i.targetDuration=e.targetDuration=p;else if("EXT-X-MEDIA-SEQUENCE"===A)i.segments.length>0&&T.h2("The EXT-X-MEDIA-SEQUENCE tag MUST appear before the first Media Segment in the Playlist.",E,724),i.mediaSequenceBase=a=p;else if("EXT-X-DISCONTINUITY-SEQUENCE"===A)i.segments.length>0&&T.h2("The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before the first Media Segment in the Playlist.",E,730),r&&T.h2("The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before any EXT-X-DISCONTINUITY tag.",E,733),i.discontinuitySequenceBase=o=p;else if("EXT-X-ENDLIST"===A)i.endlist=!0;else if("EXT-X-PLAYLIST-TYPE"===A)i.playlistType=p;else if("EXT-X-I-FRAMES-ONLY"===A)e.compatibleVersion<4&&(e.compatibleVersion=4),i.isIFrame=!0;else if("EXT-X-INDEPENDENT-SEGMENTS"===A)i.independentSegments&&T.h2("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist",E,751),i.independentSegments=!0;else if("EXT-X-START"===A)i.start&&T.h2("EXT-X-START tag MUST NOT appear more than once in a Playlist",E,757),"number"!=typeof m["TIME-OFFSET"]&&T.h2("EXT-X-START: TIME-OFFSET attribute is REQUIRED",E,760),i.start={offset:m["TIME-OFFSET"],precise:m.PRECISE||!1};else if("EXT-X-SERVER-CONTROL"===A)m["CAN-BLOCK-RELOAD"]||T.h2("EXT-X-SERVER-CONTROL: CAN-BLOCK-RELOAD=YES is mandatory for Low-Latency HLS",E,766),i.lowLatencyCompatibility={canBlockReload:m["CAN-BLOCK-RELOAD"],canSkipUntil:m["CAN-SKIP-UNTIL"],holdBack:m["HOLD-BACK"],partHoldBack:m["PART-HOLD-BACK"]};else if("EXT-X-PART-INF"===A)m["PART-TARGET"]||T.h2("EXT-X-PART-INF: PART-TARGET attribute is mandatory",E,777),i.partTargetDuration=m["PART-TARGET"];else if("EXT-X-RENDITION-REPORT"===A)m.URI||T.h2("EXT-X-RENDITION-REPORT: URI attribute is mandatory",E,783),0===m.URI.search(/^[a-z]+:/)&&T.h2("EXT-X-RENDITION-REPORT: URI must be relative to the playlist uri",E,786),i.renditionReports.push(new u.h4({uri:m.URI,lastMSN:m["LAST-MSN"],lastPart:m["LAST-PART"]}));else if("EXT-X-SKIP"===A)m["SKIPPED-SEGMENTS"]||T.h2("EXT-X-SKIP: SKIPPED-SEGMENTS attribute is mandatory",E,796),e.compatibleVersion<9&&(e.compatibleVersion=9),i.skip=m["SKIPPED-SEGMENTS"],a+=i.skip;else if("EXT-X-PREFETCH"===A){const r=P(t,p,-1===s?c:s,c-1,a++,o,e);r&&(r.discontinuity&&(r.discontinuitySequence++,o=r.discontinuitySequence),r.key?h=r.key:r.key=h,i.prefetchSegments.push(r)),n=!0,s=-1}else if("string"==typeof f){-1===s&&T.h2("A URI line is not preceded by any segment tags",E,833),i.targetDuration||T.h2("The EXT-X-TARGETDURATION tag is REQUIRED",E,836),n&&T.h2("These segments must appear after all complete segments.",E,839);const r=R(t,f,s,c-1,a++,o,e);r&&([o,h,l]=D(i,r,o,h,l),!d&&r.parts.length>0&&(d=!0)),s=-1}}else-1===s&&(s=c),"EXT-X-DISCONTINUITY"===A&&(r=!0)}if(-1!==s){const r=R(t,"",s,t.length-1,a++,o,e);if(r){var f;const{parts:t}=r;!(t.length>0)||i.endlist||null!==(f=t[t.length-1])&&void 0!==f&&f.hint||T.h2("If the Playlist contains EXT-X-PART tags and does not contain an EXT-X-ENDLIST tag, the Playlist must contain an EXT-X-PRELOAD-HINT tag with a TYPE=PART attribute",E,856),D(i,r,h,l),!d&&r.parts.length>0&&(d=!0)}}return function(t){const e=new(c()),i=new(c());let s=!1,a=!1;for(let r=t.length-1;r>=0;r--){const{programDateTime:n,dateRange:o}=t[r];if(n&&(a=!0),o&&o.start){s=!0,o.endOnNext&&(o.end||o.duration)&&T.h2("An EXT-X-DATERANGE tag with an END-ON-NEXT=YES attribute MUST NOT contain DURATION or END-DATE attributes.",E,924);const t=o.start.getTime(),a=o.duration||0;o.end&&o.duration&&t+1e3*a!==o.end.getTime()&&T.h2("END-DATE MUST be equal to the value of the START-DATE attribute plus the value of the DURATION",E,930),o.endOnNext&&(o.end=e.get(o.classId)),e.set(o.classId,o.start);const r=o.end?o.end.getTime():o.start.getTime()+1e3*(o.duration||0),n=i.get(o.classId);if(n){for(const e of n)(e.start<=t&&e.end>t||e.start>=t&&e.start0&&ti&&T.h2("PART-TARGET is the maximum duration of any Partial Segment",E,985),t0&&(t.lastPart=e.parts.length-1)}}(i,d),i.duration=i.segments.reduce(((t,e)=>"number"==typeof e.duration?t+e.duration:t),0),i}(t,e),!i.isIFrame&&e.hasMap&&e.compatibleVersion<6&&(e.compatibleVersion=6)),e.compatibleVersion>1&&(!i.version||i.version{"use strict";i.d(e,{KT:()=>n,Uz:()=>h,Vd:()=>m,Y4:()=>A,ad:()=>c,h4:()=>y,nw:()=>p,pf:()=>o,qP:()=>l,ru:()=>r,tk:()=>f,ts:()=>E,xC:()=>d});var s=i(134),a=i(86932);class r{constructor({type:t,uri:e,groupId:i,language:a,assocLanguage:r,name:n,isDefault:o,autoselect:h,forced:l,instreamId:c,characteristics:d,channels:u}){(0,s.A)(this,"type",void 0),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"groupId",void 0),(0,s.A)(this,"language",void 0),(0,s.A)(this,"assocLanguage",void 0),(0,s.A)(this,"name",void 0),(0,s.A)(this,"isDefault",void 0),(0,s.A)(this,"autoselect",void 0),(0,s.A)(this,"forced",void 0),(0,s.A)(this,"instreamId",void 0),(0,s.A)(this,"characteristics",void 0),(0,s.A)(this,"channels",void 0),this.type=t,this.uri=e,this.groupId=i,this.language=a,this.assocLanguage=r,this.name=n,this.isDefault=o,this.autoselect=h,this.forced=l,this.instreamId=c,this.characteristics=d,this.channels=u}}class n{constructor({uri:t,isIFrameOnly:e=!1,bandwidth:i,averageBandwidth:a,score:r,codecs:n,resolution:o,frameRate:h,hdcpLevel:l,allowedCpc:c,videoRange:d,stableVariantId:u,programId:T,audio:E=[],video:f=[],subtitles:A=[],closedCaptions:p=[],currentRenditions:m={audio:0,video:0,subtitles:0,closedCaptions:0}}){(0,s.A)(this,"uri",void 0),(0,s.A)(this,"isIFrameOnly",void 0),(0,s.A)(this,"bandwidth",void 0),(0,s.A)(this,"averageBandwidth",void 0),(0,s.A)(this,"score",void 0),(0,s.A)(this,"codecs",void 0),(0,s.A)(this,"resolution",void 0),(0,s.A)(this,"frameRate",void 0),(0,s.A)(this,"hdcpLevel",void 0),(0,s.A)(this,"allowedCpc",void 0),(0,s.A)(this,"videoRange",void 0),(0,s.A)(this,"stableVariantId",void 0),(0,s.A)(this,"programId",void 0),(0,s.A)(this,"audio",void 0),(0,s.A)(this,"video",void 0),(0,s.A)(this,"subtitles",void 0),(0,s.A)(this,"closedCaptions",void 0),(0,s.A)(this,"currentRenditions",void 0),this.uri=t,this.isIFrameOnly=e,this.bandwidth=i,this.averageBandwidth=a,this.score=r,this.codecs=n,this.resolution=o,this.frameRate=h,this.hdcpLevel=l,this.allowedCpc=c,this.videoRange=d,this.stableVariantId=u,this.programId=T,this.audio=E,this.video=f,this.subtitles=A,this.closedCaptions=p,this.currentRenditions=m}}class o{constructor({id:t,value:e,uri:i,language:a}){(0,s.A)(this,"id",void 0),(0,s.A)(this,"value",void 0),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"language",void 0),this.id=t,this.value=e,this.uri=i,this.language=a}}class h{constructor({method:t,uri:e,iv:i,format:a,formatVersion:r}){(0,s.A)(this,"method",void 0),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"iv",void 0),(0,s.A)(this,"format",void 0),(0,s.A)(this,"formatVersion",void 0),this.method=t,this.uri=e,this.iv=i,this.format=a,this.formatVersion=r}}class l{constructor({hint:t=!1,uri:e,mimeType:i,byterange:a}){(0,s.A)(this,"hint",void 0),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"mimeType",void 0),(0,s.A)(this,"byterange",void 0),this.hint=t,this.uri=e,this.mimeType=i,this.byterange=a}}class c{constructor({id:t,classId:e,start:i,end:a,duration:r,plannedDuration:n,endOnNext:o,attributes:h={}}){(0,s.A)(this,"id",void 0),(0,s.A)(this,"classId",void 0),(0,s.A)(this,"start",void 0),(0,s.A)(this,"end",void 0),(0,s.A)(this,"duration",void 0),(0,s.A)(this,"plannedDuration",void 0),(0,s.A)(this,"endOnNext",void 0),(0,s.A)(this,"attributes",void 0),this.id=t,this.classId=e,this.start=i,this.end=a,this.duration=r,this.plannedDuration=n,this.endOnNext=o,this.attributes=h}}class d{constructor({type:t,duration:e,tagName:i,value:a}){(0,s.A)(this,"type",void 0),(0,s.A)(this,"duration",void 0),(0,s.A)(this,"tagName",void 0),(0,s.A)(this,"value",void 0),this.type=t,this.duration=e,this.tagName=i,this.value=a}}class u{constructor(t){(0,s.A)(this,"type",void 0),this.type=t}}class T extends u{constructor({isMasterPlaylist:t,uri:e,version:i,independentSegments:a=!1,start:r,source:n}){super("playlist"),(0,s.A)(this,"isMasterPlaylist",void 0),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"version",void 0),(0,s.A)(this,"independentSegments",void 0),(0,s.A)(this,"start",void 0),(0,s.A)(this,"source",void 0),this.isMasterPlaylist=t,this.uri=e,this.version=i,this.independentSegments=a,this.start=r,this.source=n}}class E extends T{constructor(t={}){super({...t,isMasterPlaylist:!0}),(0,s.A)(this,"variants",void 0),(0,s.A)(this,"currentVariant",void 0),(0,s.A)(this,"sessionDataList",void 0),(0,s.A)(this,"sessionKeyList",void 0);const{variants:e=[],currentVariant:i,sessionDataList:a=[],sessionKeyList:r=[]}=t;this.variants=e,this.currentVariant=i,this.sessionDataList=a,this.sessionKeyList=r}}class f extends T{constructor(t={}){super({...t,isMasterPlaylist:!1}),(0,s.A)(this,"targetDuration",void 0),(0,s.A)(this,"mediaSequenceBase",void 0),(0,s.A)(this,"discontinuitySequenceBase",void 0),(0,s.A)(this,"endlist",void 0),(0,s.A)(this,"playlistType",void 0),(0,s.A)(this,"isIFrame",void 0),(0,s.A)(this,"segments",void 0),(0,s.A)(this,"prefetchSegments",void 0),(0,s.A)(this,"lowLatencyCompatibility",void 0),(0,s.A)(this,"partTargetDuration",void 0),(0,s.A)(this,"renditionReports",void 0),(0,s.A)(this,"skip",void 0),(0,s.A)(this,"hash",void 0),(0,s.A)(this,"duration",void 0),(0,s.A)(this,"timestamp",void 0);const{targetDuration:e,mediaSequenceBase:i=0,discontinuitySequenceBase:r=0,endlist:n=!1,playlistType:o,isIFrame:h,segments:l=[],prefetchSegments:c=[],lowLatencyCompatibility:d,partTargetDuration:u,renditionReports:T=[],skip:E=0,hash:f,duration:A=0}=t;this.targetDuration=e,this.mediaSequenceBase=i,this.discontinuitySequenceBase=r,this.endlist=n,this.playlistType=o,this.isIFrame=h,this.segments=l,this.prefetchSegments=c,this.lowLatencyCompatibility=d,this.partTargetDuration=u,this.renditionReports=T,this.skip=E,this.hash=f,this.duration=A,this.timestamp=(0,a.A)()}}class A extends u{constructor({uri:t,mimeType:e,data:i,duration:a,title:r,byterange:n,discontinuity:o,mediaSequenceNumber:h=0,discontinuitySequence:l=0,key:c,map:d,programDateTime:u,dateRange:T,markers:E=[],parts:f=[]}){super("segment"),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"mimeType",void 0),(0,s.A)(this,"data",void 0),(0,s.A)(this,"duration",void 0),(0,s.A)(this,"title",void 0),(0,s.A)(this,"byterange",void 0),(0,s.A)(this,"discontinuity",void 0),(0,s.A)(this,"mediaSequenceNumber",void 0),(0,s.A)(this,"discontinuitySequence",void 0),(0,s.A)(this,"key",void 0),(0,s.A)(this,"map",void 0),(0,s.A)(this,"programDateTime",void 0),(0,s.A)(this,"dateRange",void 0),(0,s.A)(this,"markers",void 0),(0,s.A)(this,"parts",void 0),this.uri=t,this.mimeType=e,this.data=i,this.duration=a,this.title=r,this.byterange=n,this.discontinuity=o,this.mediaSequenceNumber=h,this.discontinuitySequence=l,this.key=c,this.map=d,this.programDateTime=u,this.dateRange=T,this.markers=E,this.parts=f}}class p extends u{constructor({hint:t=!1,uri:e,duration:i,independent:a,byterange:r,gap:n}){super("part"),(0,s.A)(this,"hint",void 0),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"duration",void 0),(0,s.A)(this,"independent",void 0),(0,s.A)(this,"byterange",void 0),(0,s.A)(this,"gap",void 0),this.hint=t,this.uri=e,this.duration=i,this.independent=a,this.duration=i,this.byterange=r,this.gap=n}}class m extends u{constructor({uri:t,discontinuity:e,mediaSequenceNumber:i=0,discontinuitySequence:a=0,key:r}){super("prefetch"),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"discontinuity",void 0),(0,s.A)(this,"mediaSequenceNumber",void 0),(0,s.A)(this,"discontinuitySequence",void 0),(0,s.A)(this,"key",void 0),this.uri=t,this.discontinuity=e,this.mediaSequenceNumber=i,this.discontinuitySequence=a,this.key=r}}class y{constructor({uri:t,lastMSN:e,lastPart:i}){(0,s.A)(this,"uri",void 0),(0,s.A)(this,"lastMSN",void 0),(0,s.A)(this,"lastPart",void 0),this.uri=t,this.lastMSN=e,this.lastPart=i}}},67756:(t,e,i)=>{"use strict";i.d(e,{Bq:()=>u,HG:()=>T,Ro:()=>l,Th:()=>E,gI:()=>d,m2:()=>c});var s=i(99704),a=i.n(s),r=i(17735),n=i.n(r),o=i(7210),h=i.n(o);function l(t,e=10){if("number"==typeof t)return t;const i=10===e?a()(t):n()(t,e);return h()(i)?0:i}function c(t){(t.startsWith("0x")||t.startsWith("0X"))&&(t=t.slice(2));const e=[];for(let i=0;i{"use strict";i.d(e,{A:()=>a});var s=i(134);class a{constructor(t=0){(0,s.A)(this,"rcon",[0,1,2,4,8,16,32,64,128,27,54]),(0,s.A)(this,"subMix",[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)]),(0,s.A)(this,"invSubMix",[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)]),(0,s.A)(this,"sBox",new Uint32Array(256)),(0,s.A)(this,"invSBox",new Uint32Array(256)),(0,s.A)(this,"key",new Uint32Array(0)),(0,s.A)(this,"ksRows",0),(0,s.A)(this,"keySize",0),(0,s.A)(this,"keySchedule",void 0),(0,s.A)(this,"invKeySchedule",void 0),this.initTable()}uint8ArrayToUint32Array_(t){const e=new DataView(t),i=new Uint32Array(4);for(let t=0;t<4;t++)i[t]=e.getUint32(4*t);return i}initTable(){const t=this.sBox,e=this.invSBox,i=this.subMix,s=i[0],a=i[1],r=i[2],n=i[3],o=this.invSubMix,h=o[0],l=o[1],c=o[2],d=o[3],u=new Uint32Array(256);let T=0,E=0,f=0;for(f=0;f<256;f++)u[f]=f<128?f<<1:f<<1^283;for(f=0;f<256;f++){let i=E^E<<1^E<<2^E<<3^E<<4;i=i>>>8^255&i^99,t[T]=i,e[i]=T;const o=u[T],f=u[o],A=u[f];let p=257*u[i]^16843008*i;s[T]=p<<24|p>>>8,a[T]=p<<16|p>>>16,r[T]=p<<8|p>>>24,n[T]=p,p=16843009*A^65537*f^257*o^16843008*T,h[i]=p<<24|p>>>8,l[i]=p<<16|p>>>16,c[i]=p<<8|p>>>24,d[i]=p,T?(T=o^u[u[u[A^o]]],E^=u[u[E]]):T=E=1}}async expandKey(t){const e=this.uint8ArrayToUint32Array_(t);if(this.key){let t=!0,i=0;for(;ia});var s=i(134);class a{constructor(t=0){(0,s.A)(this,"subtle",void 0),(0,s.A)(this,"key",void 0),(0,s.A)(this,"mode",void 0),(0,s.A)(this,"keyBuffer",void 0),this.mode=t,this.subtle=crypto.subtle||crypto.webkitSubtle}getSubtleAlgoName(){switch(this.mode){case 0:return"AES-CBC";case 1:return"AES-CTR"}}async expandKey(t){let e=new Uint8Array(t);if(this.keyBuffer){let t=!0,i=0;for(;i{"use strict";i.d(e,{A:()=>r});var s=i(67672),a=i(72739);function r(t,e){const i=[];return s.ai(t)&&(t+=""),t&&s.Yj(t)&&a.__(t.split(e),((t,e)=>{(t=t.trim())&&i.push(t)})),i}},8507:(t,e,i)=>{"use strict";i.d(e,{ll:()=>f,mA:()=>n,qg:()=>o}),i(73146);var s=i(67672),a=i(6498),r=i(72739);function n(t,e="&"){const i={};if(s.Yj(t)&&t.indexOf("=")>=0){let s=t.charAt(0),n="?"===s||"#"===s?1:0;n>0&&(t=t.substr(n)),r.__((0,a.A)(t,e),(t=>{let e=t.split("=");if(2===e.length){var s;let t=null===(s=e[0])||void 0===s?void 0:s.trim();t&&(i[t]=decodeURIComponent(e[1]))}}))}return i}function o(t){const e=t,i=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],s=/:\/\/([^\/@]*@?)\[(\S+)\]/;let a="";s.test(t)&&(t=t.replace(s,((t,e,i)=>(a=i,`://${e||""}a.b`))));const r={},n=/^(?:(?![^:@\/]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*)(?::([^:@\/]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(t);let o=14;for(;o--;){var h;r[i[o]]=null!==(h=n[o])&&void 0!==h?h:""}return a&&(r.host=a,r.source=e,r.authority=a+(r.port?":"+r.port:"")),{protocol:r.protocol,file:r.file,host:r.host,port:r.port,user:r.user,password:r.password,origin:`${r.protocol}://${r.authority}`,pathname:r.path,search:`?${r.query}`,hash:r.anchor?`#${r.anchor}`:""}}i(95335);const h=/(?:\/|^)\.(?=\/)/g,l=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,c=/^(?=([^\/?#]*))\1([^]*)$/,d=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/;function u(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}function T(t){const e=d.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null}function E(t){for(t=t.split("").reverse().join("").replace(h,"");t.length!==(t=t.replace(l,"")).length;);return t.split("").reverse().join("")}function f(t,e,i){if(i=i||{},t=t.trim(),!(e=e.trim())){if(!i.alwaysNormalize)return t;let e=T(t);if(!e)throw new Error("Error trying to parse base URL.");return e.path=E(e.path),u(e)}let s=T(e);if(!s)throw new Error("Error trying to parse relative URL.");if(s.scheme)return i.alwaysNormalize?(s.path=E(s.path),u(s)):e;let a=T(t);if(!a)throw new Error("Error trying to parse base URL.");if(!a.netLoc&&a.path&&"/"!==a.path[0]){let t=c.exec(a.path);a.netLoc=t[1],a.path=t[2]}a.netLoc&&!a.path&&(a.path="/");const r={scheme:a.scheme,netLoc:s.netLoc,path:null,params:s.params,query:s.query,fragment:s.fragment};if(!s.netLoc&&(r.netLoc=a.netLoc,"/"!==s.path[0]))if(s.path){let t=a.path,e=t.substring(0,t.lastIndexOf("/")+1)+s.path;r.path=E(e)}else r.path=a.path,s.params||(r.params=a.params,s.query||(r.query=a.query));return null===r.path&&(r.path=i.alwaysNormalize?E(s.path):s.path),u(r)}},85079:(t,e,i)=>{var s=i(46438),a=s.JSON||(s.JSON={stringify:JSON.stringify});t.exports=function(t){return a.stringify.apply(a,arguments)}},63342:(t,e,i)=>{i(5882),t.exports=i(46438).Number.isInteger},11837:(t,e,i)=>{i(21489),t.exports=i(46438).Number.isNaN},19737:(t,e,i)=>{i(56477),t.exports=i(46438).Number.parseFloat},58886:(t,e,i)=>{i(15706),t.exports=i(46438).Number.parseInt},25194:(t,e,i)=>{var s=i(24401),a=Math.floor;t.exports=function(t){return!s(t)&&isFinite(t)&&a(t)===t}},5882:(t,e,i)=>{var s=i(88535);s(s.S,"Number",{isInteger:i(25194)})},21489:(t,e,i)=>{var s=i(88535);s(s.S,"Number",{isNaN:function(t){return t!=t}})},56477:(t,e,i)=>{var s=i(88535),a=i(49709);s(s.S+s.F*(Number.parseFloat!=a),"Number",{parseFloat:a})},15706:(t,e,i)=>{var s=i(88535),a=i(15722);s(s.S+s.F*(Number.parseInt!=a),"Number",{parseInt:a})},73146:(t,e,i)=>{t.exports=i(85079)},43929:(t,e,i)=>{t.exports=i(63342)},7210:(t,e,i)=>{t.exports=i(11837)},99704:(t,e,i)=>{t.exports=i(19737)},17735:(t,e,i)=>{t.exports=i(58886)}}]); \ No newline at end of file +(self.webpackChunkAVPlayer=self.webpackChunkAVPlayer||[]).push([[433],{70509:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var s=i(134);class a{constructor(){(0,s.A)(this,"onFlush",void 0)}}},97801:(t,e,i)=>{"use strict";i.d(e,{A:()=>T});var s=i(134),a=i(70509),r=i(13258),n=i(51678),o=i(13724),h=i(4624);const l="src/avnetwork/bsp/aes/AESDecryptPipe.ts",c=16;let u=!0;const d=new Uint8Array(c).fill(c);class T extends a.A{constructor(t=1048576){super(),(0,s.A)(this,"buffer",void 0),(0,s.A)(this,"aesSoftDecryptor",void 0),(0,s.A)(this,"aesWebDecryptor",void 0),(0,s.A)(this,"aesTargetDecryptor",void 0),(0,s.A)(this,"pointer",void 0),(0,s.A)(this,"endPointer",void 0),(0,s.A)(this,"size",void 0),(0,s.A)(this,"ended",void 0),(0,s.A)(this,"iv",void 0),(0,s.A)(this,"key",void 0),this.size=t,this.pointer=0,this.endPointer=0,this.ended=!1,this.buffer=new Uint8Array(t),this.aesSoftDecryptor=new r.A,n.A.isSupport()&&u&&(this.aesWebDecryptor=new n.A),this.aesTargetDecryptor=this.aesWebDecryptor||this.aesSoftDecryptor}remainingLength(){return this.endPointer-this.pointer}async expandKey(t,e){this.key=t,this.iv=e,this.aesWebDecryptor&&await this.aesWebDecryptor.expandKey(t),this.aesSoftDecryptor.expandKey(t)}async flush_(t){for(;;){const e=await this.onFlush(t);if(-1048575!==e)return e;await new o.A(0)}}async flush(){if(this.size-this.remainingLength()<=0)return;this.pointer{"use strict";i.r(e),i.d(e,{default:()=>p});var s=i(134),a=i(80662),r=i.n(a),n=i(13724),o=i(82800),h=i(95335),l=i(8507),c=i(48182),u=i(77580),d=i(86932),T=i(4624),E=i(97801),f=i(67672);const A="src/avnetwork/ioLoader/HlsIOLoader.ts";class p extends o.A{constructor(...t){super(...t),(0,s.A)(this,"info",void 0),(0,s.A)(this,"range",void 0),(0,s.A)(this,"masterPlaylist",void 0),(0,s.A)(this,"mediaPlayList",void 0),(0,s.A)(this,"mediaPlayListIndex",void 0),(0,s.A)(this,"fetchedMap",void 0),(0,s.A)(this,"fetchedHistoryList",void 0),(0,s.A)(this,"mediaListUrl",void 0),(0,s.A)(this,"segmentIndex",void 0),(0,s.A)(this,"currentUri",void 0),(0,s.A)(this,"loader",void 0),(0,s.A)(this,"minBuffer",void 0),(0,s.A)(this,"keyMap",void 0),(0,s.A)(this,"currentIV",void 0),(0,s.A)(this,"currentKey",void 0),(0,s.A)(this,"aesDecryptPipe",void 0),(0,s.A)(this,"initLoaded",void 0)}getFetchParams(t="GET"){var e,i,s;const a={method:"GET",headers:{},mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};return null!==(e=this.info.httpOptions)&&void 0!==e&&e.headers&&h.__(this.info.httpOptions.headers,((t,e)=>{a.headers[e]=t})),null!==(i=this.info.httpOptions)&&void 0!==i&&i.credentials&&(a.credentials=this.info.httpOptions.credentials),null!==(s=this.info.httpOptions)&&void 0!==s&&s.referrerPolicy&&(a.referrerPolicy=this.info.httpOptions.referrerPolicy),a}async fetchMasterPlayList(){try{const e=await fetch(this.info.url,this.getFetchParams()),i=await e.text(),s=(0,c.A)(i);if(s.isMasterPlaylist)this.masterPlaylist=s;else{if(this.mediaPlayList=s,this.options.isLive&&(!this.mediaPlayList.segments||this.mediaPlayList.segments.length<2)){var t;let e=5;return null!==(t=this.mediaPlayList.segments)&&void 0!==t&&t.length&&(e=this.mediaPlayList.segments[0].duration*(2-this.mediaPlayList.segments.length)),T.R8(`wait for min buffer time, now segments: ${this.mediaPlayList.segments.length}`,A,119),await new n.A(e),this.fetchMasterPlayList()}this.minBuffer=this.mediaPlayList.duration||0,this.mediaPlayList.endlist&&(this.options.isLive=!1),this.mediaListUrl=this.info.url}return s}catch(t){if(this.retryCountthis.loader.read(t),await this.aesDecryptPipe.expandKey(this.currentKey,this.currentIV)}async read(t){let e=0;if(this.loader){if(e=this.aesDecryptPipe?await this.aesDecryptPipe.read(t):await this.loader.read(t),-1048576!==e)return e;if(this.initLoaded){if(this.options.isLive)this.fetchedMap.set(this.currentUri,!0),10===this.fetchedHistoryList.length&&this.fetchedMap.delete(this.fetchedHistoryList.shift()),this.fetchedHistoryList.push(this.currentUri),this.segmentIndex++;else if(this.segmentIndex++,this.segmentIndex>=this.mediaPlayList.segments.length)return T.pq("hls segments ended",A,299),this.status=4,-1048576}else this.initLoaded=!0;this.loader=null}if(this.options.isLive){const e=this.mediaPlayList.segments.filter((t=>!this.fetchedMap.get(t.uri)));if(!e.length){if(this.mediaPlayList.endlist)return this.status=4,-1048576;const e=(this.minBuffer-((0,d.A)()-this.mediaPlayList.timestamp)/1e3)/2;return e>0&&await new n.A(e),await this.fetchMediaPlayList(),this.read(t)}this.currentUri=e[0].uri,this.initLoaded&&await this.checkNeedDecrypt(e[0],this.segmentIndex),this.loader=new u.A(h.X$({},this.options,{disableSegment:!0,loop:!1}));const i=(0,l.ll)(this.mediaListUrl,this.initLoaded?this.currentUri:e[0].map.uri),s={from:0,to:-1},a=this.initLoaded?e[0].byterange:e[0].map.byterange;return a&&(s.from=a.offset,s.to=a.offset+a.length),await this.loader.open(h.X$({},this.info,{url:i}),s),this.aesDecryptPipe?this.aesDecryptPipe.read(t):this.loader.read(t)}{this.loader=new u.A(h.X$({},this.options,{disableSegment:!0,loop:!1}));let e=this.mediaPlayList.segments[this.segmentIndex];for(;!e.uri;)e=this.mediaPlayList.segments[++this.segmentIndex];this.initLoaded&&await this.checkNeedDecrypt(e,this.segmentIndex);const i=(0,l.ll)(this.mediaListUrl,this.initLoaded?e.uri:e.map.uri),s={from:0,to:-1},a=this.initLoaded?e.byterange:e.map.byterange;return a&&(s.from=a.offset,s.to=a.offset+a.length),await this.loader.open(h.X$({},this.info,{url:i}),s),this.aesDecryptPipe?this.aesDecryptPipe.read(t):this.loader.read(t)}}async seek(t){this.loader&&(await this.loader.abort(),this.loader=null);let e=0,i=Number(t),s=0;for(let t=0;t=i)){s=t;break}return this.segmentIndex=s,4===this.status&&(this.status=2),0}async size(){return BigInt(0)}async abort(){this.loader&&(await this.loader.abort(),this.loader=null)}async stop(){await this.abort(),this.status=0}getDuration(){return this.mediaPlayList.duration}getVideoList(){var t,e;return{list:null!==(t=null===(e=this.masterPlaylist)||void 0===e?void 0:e.variants.map((t=>{var e,i,s,a,r;return{width:null!==(e=null===(i=t.resolution)||void 0===i?void 0:i.width)&&void 0!==e?e:0,height:null!==(s=null===(a=t.resolution)||void 0===a?void 0:a.height)&&void 0!==s?s:0,frameRate:null!==(r=t.frameRate)&&void 0!==r?r:0,codecs:t.codecs}})))&&void 0!==t?t:[],selectedIndex:0}}selectVideo(t){this.mediaPlayListIndex=t,this.fetchMediaPlayList()}getMinBuffer(){return this.minBuffer}}},48182:(t,e,i)=>{"use strict";i.d(e,{A:()=>L});var s=i(7210),a=i.n(s),r=i(43929),n=i.n(r),o=i(69736),h=i.n(o),l=i(80662),c=i.n(l),u=i(67756),d=i(64608),T=i(4624);const E="src/avprotocol/m3u8/parser.ts";function f(t){return u.Bq(t,'"')}function A(t){const e=u.gI(t,",");return{duration:u.Ro(e[0]),title:decodeURIComponent(escape(e[1]))}}function p(t){const e=u.gI(t,"@");return{length:u.Ro(e[0]),offset:e[1]?u.Ro(e[1]):-1}}function m(t){const e=u.gI(t,"x");return{width:u.Ro(e[0]),height:u.Ro(e[1])}}function y(t){const e="ALLOWED-CPC: Each entry must consit of KEYFORMAT and Content Protection Configuration",i=t.split(",");0===i.length&&T.z3(e,E,102);const s=[];for(const t of i){const[i,a]=u.gI(t,":");i&&a?s.push({format:i,cpcList:a.split("/")}):T.z3(e,E,108)}return s}function g(t){const e=u.m2(t);return 16!==e.length&&T.z3("IV must be a 128-bit unsigned integer",E,119),e}function X(t,e){e.IV&&t.compatibleVersion<2&&(t.compatibleVersion=2),(e.KEYFORMAT||e.KEYFORMATVERSIONS)&&t.compatibleVersion<5&&(t.compatibleVersion=5)}function S(t){const e={};for(const s of u.HG(t)){const[t,a]=u.gI(s,"="),r=f(a);switch(t){case"URI":e[t]=r;break;case"START-DATE":case"END-DATE":e[t]=new Date(r);break;case"IV":e[t]=g(r);break;case"BYTERANGE":e[t]=p(r);break;case"RESOLUTION":e[t]=m(r);break;case"ALLOWED-CPC":e[t]=y(r);break;case"END-ON-NEXT":case"DEFAULT":case"AUTOSELECT":case"FORCED":case"PRECISE":case"CAN-BLOCK-RELOAD":case"INDEPENDENT":case"GAP":e[t]="YES"===r;break;case"DURATION":case"PLANNED-DURATION":case"BANDWIDTH":case"AVERAGE-BANDWIDTH":case"FRAME-RATE":case"TIME-OFFSET":case"CAN-SKIP-UNTIL":case"HOLD-BACK":case"PART-HOLD-BACK":case"PART-TARGET":case"BYTERANGE-START":case"BYTERANGE-LENGTH":case"LAST-MSN":case"LAST-PART":case"SKIPPED-SEGMENTS":case"SCORE":case"PROGRAM-ID":e[t]=u.Ro(r);break;default:t.startsWith("SCTE35-")?e[t]=u.m2(r):t.startsWith("X-")?e[t]=(i=a).startsWith('"')?f(i):i.startsWith("0x")||i.startsWith("0X")?u.m2(i):u.Ro(i):("VIDEO-RANGE"===t&&"SDR"!==r&&"HLG"!==r&&"PQ"!==r&&T.h2(`VIDEO-RANGE: unknown value "${r}"`,E,206),e[t]=r)}}var i;return e}function I(t,e,i){const s=function({attributes:t}){return new d.ru({type:t.TYPE,uri:t.URI,groupId:t["GROUP-ID"],language:t.LANGUAGE,assocLanguage:t["ASSOC-LANGUAGE"],name:t.NAME,isDefault:t.DEFAULT,autoselect:t.AUTOSELECT,forced:t.FORCED,instreamId:t["INSTREAM-ID"],characteristics:t.CHARACTERISTICS,channels:t.CHANNELS})}(e),a=t[u.Th(i)],r=function(t,e){let i=!1;for(const s of t){if(s.name===e.name)return"All EXT-X-MEDIA tags in the same Group MUST have different NAME attributes.";s.isDefault&&(i=!0)}return i&&e.isDefault?"EXT-X-MEDIA A Group MUST NOT have more than one member with a DEFAULT attribute of YES.":""}(a,s);r&&T.h2(r,E,315),a.push(s),s.isDefault&&(t.currentRenditions[u.Th(i)]=a.length-1)}function N(t,e,i,s,a){const r=new d.KT({uri:i,bandwidth:e.BANDWIDTH,averageBandwidth:e["AVERAGE-BANDWIDTH"],score:e.SCORE,codecs:e.CODECS,resolution:e.RESOLUTION,frameRate:e["FRAME-RATE"],hdcpLevel:e["HDCP-LEVEL"],allowedCpc:e["ALLOWED-CPC"],videoRange:e["VIDEO-RANGE"],stableVariantId:e["STABLE-VARIANT-ID"],programId:e["PROGRAM-ID"]});for(const i of t)if("EXT-X-MEDIA"===i.name){const t=i.attributes,s=t.TYPE;if(s&&t["GROUP-ID"]||T.h2("EXT-X-MEDIA TYPE attribute is REQUIRED.",E,355),e[s]===t["GROUP-ID"]&&(I(r,i,s),"CLOSED-CAPTIONS"===s))for(const{instreamId:t}of r.closedCaptions)if(t&&t.startsWith("SERVICE")&&a.compatibleVersion<7){a.compatibleVersion=7;break}}return function(t,e,i){for(const s of["AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS"])"CLOSED-CAPTIONS"===s&&"NONE"===t[s]?(i.isClosedCaptionsNone=!0,e.closedCaptions=[]):t[s]&&!e[u.Th(s)].some((e=>e.groupId===t[s]))&&T.h2(`${s} attribute MUST match the value of the GROUP-ID attribute of an EXT-X-MEDIA tag whose TYPE attribute is ${s}.`,E,330)}(e,r,a),r.isIFrameOnly=s,r}function v(t,e){if(t.method!==e.method)return!1;if(t.uri!==e.uri)return!1;if(t.iv){if(!e.iv)return!1;if(t.iv.length!==e.iv.length)return!1;for(let i=0;io.targetDuration&&T.h2("EXTINF duration, when rounded to the nearest integer, MUST be less than or equal to the target duration",E,517),l.duration=s.duration,l.title=s.title;else if("EXT-X-BYTERANGE"===i)o.compatibleVersion<4&&(o.compatibleVersion=4),l.byterange=s;else if("EXT-X-DISCONTINUITY"===i)l.parts.length>0&&T.h2("EXT-X-DISCONTINUITY must appear before the first EXT-X-PART tag of the Parent Segment.",E,530),l.discontinuity=!0;else if("EXT-X-KEY"===i)l.parts.length>0&&T.h2("EXT-X-KEY must appear before the first EXT-X-PART tag of the Parent Segment.",E,536),"NONE"!==a.METHOD&&(X(o,a),l.key=new d.Uz({method:a.METHOD,uri:a.URI,iv:a.IV,format:a.KEYFORMAT,formatVersion:a.KEYFORMATVERSIONS}));else if("EXT-X-MAP"===i)l.parts.length>0&&T.h2("EXT-X-MAP must appear before the first EXT-X-PART tag of the Parent Segment.",E,552),o.compatibleVersion<5&&(o.compatibleVersion=5),o.hasMap=!0,l.map=new d.qP({uri:a.URI,byterange:a.BYTERANGE});else if("EXT-X-PROGRAM-DATE-TIME"===i)l.programDateTime=s;else if("EXT-X-DATERANGE"===i){const t={};for(const e of h()(a))(e.startsWith("SCTE35-")||e.startsWith("X-"))&&(t[e]=a[e]);l.dateRange=new d.ad({id:a.ID,classId:a.CLASS,start:a["START-DATE"],end:a["END-DATE"],duration:a.DURATION,plannedDuration:a["PLANNED-DURATION"],endOnNext:a["END-ON-NEXT"],attributes:t})}else if("EXT-X-CUE-OUT"===i)l.markers.push(new d.xC({type:"OUT",duration:a&&a.DURATION||s}));else if("EXT-X-CUE-IN"===i)l.markers.push(new d.xC({type:"IN"}));else if("EXT-X-CUE-OUT-CONT"===i||"EXT-X-CUE"===i||"EXT-OATCLS-SCTE35"===i||"EXT-X-ASSET"===i||"EXT-X-SCTE35"===i)l.markers.push(new d.xC({type:"RAW",tagName:i,value:s}));else if("EXT-X-PRELOAD-HINT"!==i||a.TYPE)if("EXT-X-PRELOAD-HINT"===i&&"PART"===a.TYPE&&u)T.h2("Servers should not add more than one EXT-X-PRELOAD-HINT tag with the same TYPE attribute to a Playlist.",E,612);else if("EXT-X-PART"!==i&&"EXT-X-PRELOAD-HINT"!==i||a.URI){if("EXT-X-PRELOAD-HINT"===i&&"MAP"===a.TYPE)c&&T.h2("Servers should not add more than one EXT-X-PRELOAD-HINT tag with the same TYPE attribute to a Playlist.",E,619),c=!0,o.hasMap=!0,l.map=new d.qP({hint:!0,uri:a.URI,byterange:{length:a["BYTERANGE-LENGTH"],offset:a["BYTERANGE-START"]||0}});else if("EXT-X-PART"===i||"EXT-X-PRELOAD-HINT"===i&&"PART"===a.TYPE){"EXT-X-PART"!==i||a.DURATION||T.h2("EXT-X-PART: DURATION attribute is mandatory",E,631),"EXT-X-PRELOAD-HINT"===i&&(u=!0);const t=new d.nw({hint:"EXT-X-PRELOAD-HINT"===i,uri:a.URI,byterange:"EXT-X-PART"===i?a.BYTERANGE:{length:a["BYTERANGE-LENGTH"],offset:a["BYTERANGE-START"]||0},duration:a.DURATION,independent:a.INDEPENDENT,gap:a.GAP});l.parts.push(t)}}else T.h2("EXT-X-PART / EXT-X-PRELOAD-HINT: URI attribute is mandatory",E,615);else T.h2("EXT-X-PRELOAD-HINT: TYPE attribute is mandatory",E,609)}return l}function P(t,e,i,s,a,r,n){const o=new d.Vd({uri:e,mediaSequenceNumber:a,discontinuitySequence:r});for(let e=i;e<=s;e++){const{name:i,attributes:s}=t[e];"EXTINF"===i?T.h2("A prefetch segment must not be advertised with an EXTINF tag.",E,663):"EXT-X-DISCONTINUITY"===i?T.h2("A prefetch segment must not be advertised with an EXT-X-DISCONTINUITY tag.",E,666):"EXT-X-PREFETCH-DISCONTINUITY"===i?o.discontinuity=!0:"EXT-X-KEY"===i?"NONE"!==s.METHOD&&(X(n,s),o.key=new d.Uz({method:s.METHOD,uri:s.URI,iv:s.IV,format:s.KEYFORMAT,formatVersion:s.KEYFORMATVERSIONS})):"EXT-X-MAP"===i&&T.h2("Prefetch segments must not be advertised with an EXT-X-MAP tag.",E,684)}return o}function D(t,e,i,s,a){const{discontinuity:r,key:n,map:o,byterange:h,uri:l}=e;if(r&&(e.discontinuitySequence=i+1),n||(e.key=s),o||(e.map=a),h&&-1===h.offset){const{segments:e}=t;if(e.length>0){const t=e[e.length-1];t.byterange&&t.uri===l?h.offset=t.byterange.offset+t.byterange.length:T.h2("If offset of EXT-X-BYTERANGE is not present, a previous Media Segment MUST be a sub-range of the same media resource",E,900)}else T.h2("If offset of EXT-X-BYTERANGE is not present, a previous Media Segment MUST appear in the Playlist file",E,904)}return t.segments.push(e),[e.discontinuitySequence,e.key,e.map]}function b(t,e){const[i,s]=function(t){const e=t.indexOf(":");return-1===e?[t.slice(1).trim(),null]:[t.slice(1,e).trim(),t.slice(e+1).trim()]}(t),r=function(t){switch(t){case"EXTM3U":case"EXT-X-VERSION":return"Basic";case"EXTINF":case"EXT-X-BYTERANGE":case"EXT-X-DISCONTINUITY":case"EXT-X-PREFETCH-DISCONTINUITY":case"EXT-X-KEY":case"EXT-X-MAP":case"EXT-X-PROGRAM-DATE-TIME":case"EXT-X-DATERANGE":case"EXT-X-CUE-OUT":case"EXT-X-CUE-IN":case"EXT-X-CUE-OUT-CONT":case"EXT-X-CUE":case"EXT-OATCLS-SCTE35":case"EXT-X-ASSET":case"EXT-X-SCTE35":case"EXT-X-PART":case"EXT-X-PRELOAD-HINT":return"Segment";case"EXT-X-TARGETDURATION":case"EXT-X-MEDIA-SEQUENCE":case"EXT-X-DISCONTINUITY-SEQUENCE":case"EXT-X-ENDLIST":case"EXT-X-PLAYLIST-TYPE":case"EXT-X-I-FRAMES-ONLY":case"EXT-X-SERVER-CONTROL":case"EXT-X-PART-INF":case"EXT-X-PREFETCH":case"EXT-X-RENDITION-REPORT":case"EXT-X-SKIP":return"MediaPlaylist";case"EXT-X-MEDIA":case"EXT-X-STREAM-INF":case"EXT-X-I-FRAME-STREAM-INF":case"EXT-X-SESSION-DATA":case"EXT-X-SESSION-KEY":return"MasterPlaylist";case"EXT-X-INDEPENDENT-SEGMENTS":case"EXT-X-START":return"MediaorMasterPlaylist";default:return"Unknown"}}(i);if(function(t,e){if("Segment"===t||"MediaPlaylist"===t)return void 0===e.isMasterPlaylist?void(e.isMasterPlaylist=!1):void(e.isMasterPlaylist&&T.h2("The file contains both media and master playlist tags.",E,1011));if("MasterPlaylist"===t){if(void 0===e.isMasterPlaylist)return void(e.isMasterPlaylist=!0);!1===e.isMasterPlaylist&&T.h2("The file contains both media and master playlist tags.",E,1021)}}(r,e),"Unknown"===r)return null;"MediaPlaylist"===r&&"EXT-X-RENDITION-REPORT"!==i&&"EXT-X-PREFETCH"!==i&&(e.hash[i]&&T.h2("There MUST NOT be more than one Media Playlist tag of each type in any Media Playlist",E,1042),e.hash[i]=!0);const[n,o]=function(t,e){switch(t){case"EXTM3U":case"EXT-X-DISCONTINUITY":case"EXT-X-ENDLIST":case"EXT-X-I-FRAMES-ONLY":case"EXT-X-INDEPENDENT-SEGMENTS":case"EXT-X-CUE-IN":return[null,null];case"EXT-X-VERSION":case"EXT-X-TARGETDURATION":case"EXT-X-MEDIA-SEQUENCE":case"EXT-X-DISCONTINUITY-SEQUENCE":return[u.Ro(e),null];case"EXT-X-CUE-OUT":return a()(Number(e))?[null,S(e)]:[u.Ro(e),null];case"EXT-X-KEY":case"EXT-X-MAP":case"EXT-X-DATERANGE":case"EXT-X-MEDIA":case"EXT-X-STREAM-INF":case"EXT-X-I-FRAME-STREAM-INF":case"EXT-X-SESSION-DATA":case"EXT-X-SESSION-KEY":case"EXT-X-START":case"EXT-X-SERVER-CONTROL":case"EXT-X-PART-INF":case"EXT-X-PART":case"EXT-X-PRELOAD-HINT":case"EXT-X-RENDITION-REPORT":case"EXT-X-SKIP":return[null,S(e)];case"EXTINF":return[A(e),null];case"EXT-X-BYTERANGE":return[p(e),null];case"EXT-X-PROGRAM-DATE-TIME":return[new Date(e),null];default:return[e,null]}}(i,s);return{name:i,category:r,value:n,attributes:o}}function O(t,e){let i;return e.isMasterPlaylist?i=function(t,e){const i=new d.ts;let s=!1;for(const[a,{name:r,value:n,attributes:o}]of t.entries())if("EXT-X-VERSION"===r)i.version=n;else if("EXT-X-STREAM-INF"===r){const r=t[a+1];("string"!=typeof r||r.startsWith("#EXT"))&&T.h2("EXT-X-STREAM-INF must be followed by a URI line",E,417);const n=N(t,o,r,!1,e);n&&("number"==typeof n.score&&(s=!0,n.score<0&&T.h2("SCORE attribute on EXT-X-STREAM-INF must be positive decimal-floating-point number.",E,424)),i.variants.push(n))}else if("EXT-X-I-FRAME-STREAM-INF"===r){const s=N(t,o,o.URI,!0,e);s&&i.variants.push(s)}else if("EXT-X-SESSION-DATA"===r){const t=new d.pf({id:o["DATA-ID"],value:o.VALUE,uri:o.URI,language:o.LANGUAGE});i.sessionDataList.some((e=>e.id===t.id&&e.language===t.language))&&T.h2("A Playlist MUST NOT contain more than one EXT-X-SESSION-DATA tag with the same DATA-ID attribute and the same LANGUAGE attribute.",E,444),i.sessionDataList.push(t)}else if("EXT-X-SESSION-KEY"===r){"NONE"===o.METHOD&&T.h2("EXT-X-SESSION-KEY: The value of the METHOD attribute MUST NOT be NONE",E,450);const t=new d.Uz({method:o.METHOD,uri:o.URI,iv:o.IV,format:o.KEYFORMAT,formatVersion:o.KEYFORMATVERSIONS});i.sessionKeyList.some((e=>v(e,t)))&&T.h2("A Master Playlist MUST NOT contain more than one EXT-X-SESSION-KEY tag with the same METHOD, URI, IV, KEYFORMAT, and KEYFORMATVERSIONS attribute values.",E,460),X(e,o),i.sessionKeyList.push(t)}else"EXT-X-INDEPENDENT-SEGMENTS"===r?(i.independentSegments&&T.h2("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist",E,467),i.independentSegments=!0):"EXT-X-START"===r&&(i.start&&T.h2("EXT-X-START tag MUST NOT appear more than once in a Playlist",E,473),"number"!=typeof o["TIME-OFFSET"]&&T.h2("EXT-X-START: TIME-OFFSET attribute is REQUIRED",E,476),i.start={offset:o["TIME-OFFSET"],precise:o.PRECISE||!1});if(s)for(const t of i.variants)"number"!=typeof t.score&&T.h2("If any Variant Stream contains the SCORE attribute, then all Variant Streams in the Master Playlist SHOULD have a SCORE attribute",E,484);if(e.isClosedCaptionsNone)for(const t of i.variants)t.closedCaptions.length>0&&T.h2("If there is a variant with CLOSED-CAPTIONS attribute of NONE, all EXT-X-STREAM-INF tags MUST have this attribute with a value of NONE",E,491);return i}(t,e):(i=function(t,e){const i=new d.tk;let s=-1,a=0,r=!1,n=!1,o=0,h=null,l=null,u=!1;for(const[c,f]of t.entries()){const{name:A,value:p,attributes:m,category:y}=f;if("Segment"!==y){if("EXT-X-VERSION"===A)void 0===i.version?i.version=p:T.h2("A Playlist file MUST NOT contain more than one EXT-X-VERSION tag.",E,716);else if("EXT-X-TARGETDURATION"===A)i.targetDuration=e.targetDuration=p;else if("EXT-X-MEDIA-SEQUENCE"===A)i.segments.length>0&&T.h2("The EXT-X-MEDIA-SEQUENCE tag MUST appear before the first Media Segment in the Playlist.",E,724),i.mediaSequenceBase=a=p;else if("EXT-X-DISCONTINUITY-SEQUENCE"===A)i.segments.length>0&&T.h2("The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before the first Media Segment in the Playlist.",E,730),r&&T.h2("The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before any EXT-X-DISCONTINUITY tag.",E,733),i.discontinuitySequenceBase=o=p;else if("EXT-X-ENDLIST"===A)i.endlist=!0;else if("EXT-X-PLAYLIST-TYPE"===A)i.playlistType=p;else if("EXT-X-I-FRAMES-ONLY"===A)e.compatibleVersion<4&&(e.compatibleVersion=4),i.isIFrame=!0;else if("EXT-X-INDEPENDENT-SEGMENTS"===A)i.independentSegments&&T.h2("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist",E,751),i.independentSegments=!0;else if("EXT-X-START"===A)i.start&&T.h2("EXT-X-START tag MUST NOT appear more than once in a Playlist",E,757),"number"!=typeof m["TIME-OFFSET"]&&T.h2("EXT-X-START: TIME-OFFSET attribute is REQUIRED",E,760),i.start={offset:m["TIME-OFFSET"],precise:m.PRECISE||!1};else if("EXT-X-SERVER-CONTROL"===A)m["CAN-BLOCK-RELOAD"]||T.h2("EXT-X-SERVER-CONTROL: CAN-BLOCK-RELOAD=YES is mandatory for Low-Latency HLS",E,766),i.lowLatencyCompatibility={canBlockReload:m["CAN-BLOCK-RELOAD"],canSkipUntil:m["CAN-SKIP-UNTIL"],holdBack:m["HOLD-BACK"],partHoldBack:m["PART-HOLD-BACK"]};else if("EXT-X-PART-INF"===A)m["PART-TARGET"]||T.h2("EXT-X-PART-INF: PART-TARGET attribute is mandatory",E,777),i.partTargetDuration=m["PART-TARGET"];else if("EXT-X-RENDITION-REPORT"===A)m.URI||T.h2("EXT-X-RENDITION-REPORT: URI attribute is mandatory",E,783),0===m.URI.search(/^[a-z]+:/)&&T.h2("EXT-X-RENDITION-REPORT: URI must be relative to the playlist uri",E,786),i.renditionReports.push(new d.h4({uri:m.URI,lastMSN:m["LAST-MSN"],lastPart:m["LAST-PART"]}));else if("EXT-X-SKIP"===A)m["SKIPPED-SEGMENTS"]||T.h2("EXT-X-SKIP: SKIPPED-SEGMENTS attribute is mandatory",E,796),e.compatibleVersion<9&&(e.compatibleVersion=9),i.skip=m["SKIPPED-SEGMENTS"],a+=i.skip;else if("EXT-X-PREFETCH"===A){const r=P(t,p,-1===s?c:s,c-1,a++,o,e);r&&(r.discontinuity&&(r.discontinuitySequence++,o=r.discontinuitySequence),r.key?h=r.key:r.key=h,i.prefetchSegments.push(r)),n=!0,s=-1}else if("string"==typeof f){-1===s&&T.h2("A URI line is not preceded by any segment tags",E,833),i.targetDuration||T.h2("The EXT-X-TARGETDURATION tag is REQUIRED",E,836),n&&T.h2("These segments must appear after all complete segments.",E,839);const r=R(t,f,s,c-1,a++,o,e);r&&([o,h,l]=D(i,r,o,h,l),!u&&r.parts.length>0&&(u=!0)),s=-1}}else-1===s&&(s=c),"EXT-X-DISCONTINUITY"===A&&(r=!0)}if(-1!==s){const r=R(t,"",s,t.length-1,a++,o,e);if(r){var f;const{parts:t}=r;!(t.length>0)||i.endlist||null!==(f=t[t.length-1])&&void 0!==f&&f.hint||T.h2("If the Playlist contains EXT-X-PART tags and does not contain an EXT-X-ENDLIST tag, the Playlist must contain an EXT-X-PRELOAD-HINT tag with a TYPE=PART attribute",E,856),D(i,r,h,l),!u&&r.parts.length>0&&(u=!0)}}return function(t){const e=new(c()),i=new(c());let s=!1,a=!1;for(let r=t.length-1;r>=0;r--){const{programDateTime:n,dateRange:o}=t[r];if(n&&(a=!0),o&&o.start){s=!0,o.endOnNext&&(o.end||o.duration)&&T.h2("An EXT-X-DATERANGE tag with an END-ON-NEXT=YES attribute MUST NOT contain DURATION or END-DATE attributes.",E,924);const t=o.start.getTime(),a=o.duration||0;o.end&&o.duration&&t+1e3*a!==o.end.getTime()&&T.h2("END-DATE MUST be equal to the value of the START-DATE attribute plus the value of the DURATION",E,930),o.endOnNext&&(o.end=e.get(o.classId)),e.set(o.classId,o.start);const r=o.end?o.end.getTime():o.start.getTime()+1e3*(o.duration||0),n=i.get(o.classId);if(n){for(const e of n)(e.start<=t&&e.end>t||e.start>=t&&e.start0&&ti&&T.h2("PART-TARGET is the maximum duration of any Partial Segment",E,985),t0&&(t.lastPart=e.parts.length-1)}}(i,u),i.duration=i.segments.reduce(((t,e)=>"number"==typeof e.duration?t+e.duration:t),0),i}(t,e),!i.isIFrame&&e.hasMap&&e.compatibleVersion<6&&(e.compatibleVersion=6)),e.compatibleVersion>1&&(!i.version||i.version{"use strict";i.d(e,{KT:()=>n,Uz:()=>h,Vd:()=>m,Y4:()=>A,ad:()=>c,h4:()=>y,nw:()=>p,pf:()=>o,qP:()=>l,ru:()=>r,tk:()=>f,ts:()=>E,xC:()=>u});var s=i(134),a=i(86932);class r{constructor({type:t,uri:e,groupId:i,language:a,assocLanguage:r,name:n,isDefault:o,autoselect:h,forced:l,instreamId:c,characteristics:u,channels:d}){(0,s.A)(this,"type",void 0),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"groupId",void 0),(0,s.A)(this,"language",void 0),(0,s.A)(this,"assocLanguage",void 0),(0,s.A)(this,"name",void 0),(0,s.A)(this,"isDefault",void 0),(0,s.A)(this,"autoselect",void 0),(0,s.A)(this,"forced",void 0),(0,s.A)(this,"instreamId",void 0),(0,s.A)(this,"characteristics",void 0),(0,s.A)(this,"channels",void 0),this.type=t,this.uri=e,this.groupId=i,this.language=a,this.assocLanguage=r,this.name=n,this.isDefault=o,this.autoselect=h,this.forced=l,this.instreamId=c,this.characteristics=u,this.channels=d}}class n{constructor({uri:t,isIFrameOnly:e=!1,bandwidth:i,averageBandwidth:a,score:r,codecs:n,resolution:o,frameRate:h,hdcpLevel:l,allowedCpc:c,videoRange:u,stableVariantId:d,programId:T,audio:E=[],video:f=[],subtitles:A=[],closedCaptions:p=[],currentRenditions:m={audio:0,video:0,subtitles:0,closedCaptions:0}}){(0,s.A)(this,"uri",void 0),(0,s.A)(this,"isIFrameOnly",void 0),(0,s.A)(this,"bandwidth",void 0),(0,s.A)(this,"averageBandwidth",void 0),(0,s.A)(this,"score",void 0),(0,s.A)(this,"codecs",void 0),(0,s.A)(this,"resolution",void 0),(0,s.A)(this,"frameRate",void 0),(0,s.A)(this,"hdcpLevel",void 0),(0,s.A)(this,"allowedCpc",void 0),(0,s.A)(this,"videoRange",void 0),(0,s.A)(this,"stableVariantId",void 0),(0,s.A)(this,"programId",void 0),(0,s.A)(this,"audio",void 0),(0,s.A)(this,"video",void 0),(0,s.A)(this,"subtitles",void 0),(0,s.A)(this,"closedCaptions",void 0),(0,s.A)(this,"currentRenditions",void 0),this.uri=t,this.isIFrameOnly=e,this.bandwidth=i,this.averageBandwidth=a,this.score=r,this.codecs=n,this.resolution=o,this.frameRate=h,this.hdcpLevel=l,this.allowedCpc=c,this.videoRange=u,this.stableVariantId=d,this.programId=T,this.audio=E,this.video=f,this.subtitles=A,this.closedCaptions=p,this.currentRenditions=m}}class o{constructor({id:t,value:e,uri:i,language:a}){(0,s.A)(this,"id",void 0),(0,s.A)(this,"value",void 0),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"language",void 0),this.id=t,this.value=e,this.uri=i,this.language=a}}class h{constructor({method:t,uri:e,iv:i,format:a,formatVersion:r}){(0,s.A)(this,"method",void 0),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"iv",void 0),(0,s.A)(this,"format",void 0),(0,s.A)(this,"formatVersion",void 0),this.method=t,this.uri=e,this.iv=i,this.format=a,this.formatVersion=r}}class l{constructor({hint:t=!1,uri:e,mimeType:i,byterange:a}){(0,s.A)(this,"hint",void 0),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"mimeType",void 0),(0,s.A)(this,"byterange",void 0),this.hint=t,this.uri=e,this.mimeType=i,this.byterange=a}}class c{constructor({id:t,classId:e,start:i,end:a,duration:r,plannedDuration:n,endOnNext:o,attributes:h={}}){(0,s.A)(this,"id",void 0),(0,s.A)(this,"classId",void 0),(0,s.A)(this,"start",void 0),(0,s.A)(this,"end",void 0),(0,s.A)(this,"duration",void 0),(0,s.A)(this,"plannedDuration",void 0),(0,s.A)(this,"endOnNext",void 0),(0,s.A)(this,"attributes",void 0),this.id=t,this.classId=e,this.start=i,this.end=a,this.duration=r,this.plannedDuration=n,this.endOnNext=o,this.attributes=h}}class u{constructor({type:t,duration:e,tagName:i,value:a}){(0,s.A)(this,"type",void 0),(0,s.A)(this,"duration",void 0),(0,s.A)(this,"tagName",void 0),(0,s.A)(this,"value",void 0),this.type=t,this.duration=e,this.tagName=i,this.value=a}}class d{constructor(t){(0,s.A)(this,"type",void 0),this.type=t}}class T extends d{constructor({isMasterPlaylist:t,uri:e,version:i,independentSegments:a=!1,start:r,source:n}){super("playlist"),(0,s.A)(this,"isMasterPlaylist",void 0),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"version",void 0),(0,s.A)(this,"independentSegments",void 0),(0,s.A)(this,"start",void 0),(0,s.A)(this,"source",void 0),this.isMasterPlaylist=t,this.uri=e,this.version=i,this.independentSegments=a,this.start=r,this.source=n}}class E extends T{constructor(t={}){super({...t,isMasterPlaylist:!0}),(0,s.A)(this,"variants",void 0),(0,s.A)(this,"currentVariant",void 0),(0,s.A)(this,"sessionDataList",void 0),(0,s.A)(this,"sessionKeyList",void 0);const{variants:e=[],currentVariant:i,sessionDataList:a=[],sessionKeyList:r=[]}=t;this.variants=e,this.currentVariant=i,this.sessionDataList=a,this.sessionKeyList=r}}class f extends T{constructor(t={}){super({...t,isMasterPlaylist:!1}),(0,s.A)(this,"targetDuration",void 0),(0,s.A)(this,"mediaSequenceBase",void 0),(0,s.A)(this,"discontinuitySequenceBase",void 0),(0,s.A)(this,"endlist",void 0),(0,s.A)(this,"playlistType",void 0),(0,s.A)(this,"isIFrame",void 0),(0,s.A)(this,"segments",void 0),(0,s.A)(this,"prefetchSegments",void 0),(0,s.A)(this,"lowLatencyCompatibility",void 0),(0,s.A)(this,"partTargetDuration",void 0),(0,s.A)(this,"renditionReports",void 0),(0,s.A)(this,"skip",void 0),(0,s.A)(this,"hash",void 0),(0,s.A)(this,"duration",void 0),(0,s.A)(this,"timestamp",void 0);const{targetDuration:e,mediaSequenceBase:i=0,discontinuitySequenceBase:r=0,endlist:n=!1,playlistType:o,isIFrame:h,segments:l=[],prefetchSegments:c=[],lowLatencyCompatibility:u,partTargetDuration:d,renditionReports:T=[],skip:E=0,hash:f,duration:A=0}=t;this.targetDuration=e,this.mediaSequenceBase=i,this.discontinuitySequenceBase=r,this.endlist=n,this.playlistType=o,this.isIFrame=h,this.segments=l,this.prefetchSegments=c,this.lowLatencyCompatibility=u,this.partTargetDuration=d,this.renditionReports=T,this.skip=E,this.hash=f,this.duration=A,this.timestamp=(0,a.A)()}}class A extends d{constructor({uri:t,mimeType:e,data:i,duration:a,title:r,byterange:n,discontinuity:o,mediaSequenceNumber:h=0,discontinuitySequence:l=0,key:c,map:u,programDateTime:d,dateRange:T,markers:E=[],parts:f=[]}){super("segment"),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"mimeType",void 0),(0,s.A)(this,"data",void 0),(0,s.A)(this,"duration",void 0),(0,s.A)(this,"title",void 0),(0,s.A)(this,"byterange",void 0),(0,s.A)(this,"discontinuity",void 0),(0,s.A)(this,"mediaSequenceNumber",void 0),(0,s.A)(this,"discontinuitySequence",void 0),(0,s.A)(this,"key",void 0),(0,s.A)(this,"map",void 0),(0,s.A)(this,"programDateTime",void 0),(0,s.A)(this,"dateRange",void 0),(0,s.A)(this,"markers",void 0),(0,s.A)(this,"parts",void 0),this.uri=t,this.mimeType=e,this.data=i,this.duration=a,this.title=r,this.byterange=n,this.discontinuity=o,this.mediaSequenceNumber=h,this.discontinuitySequence=l,this.key=c,this.map=u,this.programDateTime=d,this.dateRange=T,this.markers=E,this.parts=f}}class p extends d{constructor({hint:t=!1,uri:e,duration:i,independent:a,byterange:r,gap:n}){super("part"),(0,s.A)(this,"hint",void 0),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"duration",void 0),(0,s.A)(this,"independent",void 0),(0,s.A)(this,"byterange",void 0),(0,s.A)(this,"gap",void 0),this.hint=t,this.uri=e,this.duration=i,this.independent=a,this.duration=i,this.byterange=r,this.gap=n}}class m extends d{constructor({uri:t,discontinuity:e,mediaSequenceNumber:i=0,discontinuitySequence:a=0,key:r}){super("prefetch"),(0,s.A)(this,"uri",void 0),(0,s.A)(this,"discontinuity",void 0),(0,s.A)(this,"mediaSequenceNumber",void 0),(0,s.A)(this,"discontinuitySequence",void 0),(0,s.A)(this,"key",void 0),this.uri=t,this.discontinuity=e,this.mediaSequenceNumber=i,this.discontinuitySequence=a,this.key=r}}class y{constructor({uri:t,lastMSN:e,lastPart:i}){(0,s.A)(this,"uri",void 0),(0,s.A)(this,"lastMSN",void 0),(0,s.A)(this,"lastPart",void 0),this.uri=t,this.lastMSN=e,this.lastPart=i}}},67756:(t,e,i)=>{"use strict";i.d(e,{Bq:()=>d,HG:()=>T,Ro:()=>l,Th:()=>E,gI:()=>u,m2:()=>c});var s=i(99704),a=i.n(s),r=i(17735),n=i.n(r),o=i(7210),h=i.n(o);function l(t,e=10){if("number"==typeof t)return t;const i=10===e?a()(t):n()(t,e);return h()(i)?0:i}function c(t){(t.startsWith("0x")||t.startsWith("0X"))&&(t=t.slice(2));const e=[];for(let i=0;i{"use strict";i.d(e,{A:()=>a});var s=i(134);class a{constructor(t=0){(0,s.A)(this,"rcon",[0,1,2,4,8,16,32,64,128,27,54]),(0,s.A)(this,"subMix",[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)]),(0,s.A)(this,"invSubMix",[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)]),(0,s.A)(this,"sBox",new Uint32Array(256)),(0,s.A)(this,"invSBox",new Uint32Array(256)),(0,s.A)(this,"key",new Uint32Array(0)),(0,s.A)(this,"ksRows",0),(0,s.A)(this,"keySize",0),(0,s.A)(this,"keySchedule",void 0),(0,s.A)(this,"invKeySchedule",void 0),this.initTable()}uint8ArrayToUint32Array_(t){const e=new DataView(t),i=new Uint32Array(4);for(let t=0;t<4;t++)i[t]=e.getUint32(4*t);return i}initTable(){const t=this.sBox,e=this.invSBox,i=this.subMix,s=i[0],a=i[1],r=i[2],n=i[3],o=this.invSubMix,h=o[0],l=o[1],c=o[2],u=o[3],d=new Uint32Array(256);let T=0,E=0,f=0;for(f=0;f<256;f++)d[f]=f<128?f<<1:f<<1^283;for(f=0;f<256;f++){let i=E^E<<1^E<<2^E<<3^E<<4;i=i>>>8^255&i^99,t[T]=i,e[i]=T;const o=d[T],f=d[o],A=d[f];let p=257*d[i]^16843008*i;s[T]=p<<24|p>>>8,a[T]=p<<16|p>>>16,r[T]=p<<8|p>>>24,n[T]=p,p=16843009*A^65537*f^257*o^16843008*T,h[i]=p<<24|p>>>8,l[i]=p<<16|p>>>16,c[i]=p<<8|p>>>24,u[i]=p,T?(T=o^d[d[d[A^o]]],E^=d[d[E]]):T=E=1}}async expandKey(t){const e=this.uint8ArrayToUint32Array_(t);if(this.key){let t=!0,i=0;for(;ia});var s=i(134);class a{constructor(t=0){(0,s.A)(this,"subtle",void 0),(0,s.A)(this,"key",void 0),(0,s.A)(this,"mode",void 0),(0,s.A)(this,"keyBuffer",void 0),this.mode=t,this.subtle=crypto.subtle||crypto.webkitSubtle}getSubtleAlgoName(){switch(this.mode){case 0:return"AES-CBC";case 1:return"AES-CTR"}}async expandKey(t){let e=new Uint8Array(t);if(this.keyBuffer){let t=!0,i=0;for(;i{"use strict";i.d(e,{A:()=>r});var s=i(67672),a=i(72739);function r(t,e){const i=[];return s.ai(t)&&(t+=""),t&&s.Yj(t)&&a.__(t.split(e),((t,e)=>{(t=t.trim())&&i.push(t)})),i}},8507:(t,e,i)=>{"use strict";i.d(e,{ll:()=>f,mA:()=>n,qg:()=>o}),i(73146);var s=i(67672),a=i(6498),r=i(72739);function n(t,e="&"){const i={};if(s.Yj(t)&&t.indexOf("=")>=0){let s=t.charAt(0),n="?"===s||"#"===s?1:0;n>0&&(t=t.substr(n)),r.__((0,a.A)(t,e),(t=>{let e=t.split("=");if(2===e.length){var s;let t=null===(s=e[0])||void 0===s?void 0:s.trim();t&&(i[t]=decodeURIComponent(e[1]))}}))}return i}function o(t){const e=t,i=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],s=/:\/\/([^\/@]*@?)\[(\S+)\]/;let a="";s.test(t)&&(t=t.replace(s,((t,e,i)=>(a=i,`://${e||""}a.b`))));const r={},n=/^(?:(?![^:@\/]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*)(?::([^:@\/]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(t);let o=14;for(;o--;){var h;r[i[o]]=null!==(h=n[o])&&void 0!==h?h:""}return a&&(r.host=a,r.source=e,r.authority=a+(r.port?":"+r.port:"")),{protocol:r.protocol,file:r.file,host:r.host,port:r.port,user:r.user,password:r.password,origin:`${r.protocol}://${r.authority}`,pathname:r.path,search:`?${r.query}`,hash:r.anchor?`#${r.anchor}`:""}}i(95335);const h=/(?:\/|^)\.(?=\/)/g,l=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,c=/^(?=([^\/?#]*))\1([^]*)$/,u=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/;function d(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}function T(t){const e=u.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null}function E(t){for(t=t.split("").reverse().join("").replace(h,"");t.length!==(t=t.replace(l,"")).length;);return t.split("").reverse().join("")}function f(t,e,i){if(i=i||{},t=t.trim(),!(e=e.trim())){if(!i.alwaysNormalize)return t;let e=T(t);if(!e)throw new Error("Error trying to parse base URL.");return e.path=E(e.path),d(e)}let s=T(e);if(!s)throw new Error("Error trying to parse relative URL.");if(s.scheme)return i.alwaysNormalize?(s.path=E(s.path),d(s)):e;let a=T(t);if(!a)throw new Error("Error trying to parse base URL.");if(!a.netLoc&&a.path&&"/"!==a.path[0]){let t=c.exec(a.path);a.netLoc=t[1],a.path=t[2]}a.netLoc&&!a.path&&(a.path="/");const r={scheme:a.scheme,netLoc:s.netLoc,path:null,params:s.params,query:s.query,fragment:s.fragment};if(!s.netLoc&&(r.netLoc=a.netLoc,"/"!==s.path[0]))if(s.path){let t=a.path,e=t.substring(0,t.lastIndexOf("/")+1)+s.path;r.path=E(e)}else r.path=a.path,s.params||(r.params=a.params,s.query||(r.query=a.query));return null===r.path&&(r.path=i.alwaysNormalize?E(s.path):s.path),d(r)}},85079:(t,e,i)=>{var s=i(46438),a=s.JSON||(s.JSON={stringify:JSON.stringify});t.exports=function(t){return a.stringify.apply(a,arguments)}},63342:(t,e,i)=>{i(5882),t.exports=i(46438).Number.isInteger},11837:(t,e,i)=>{i(21489),t.exports=i(46438).Number.isNaN},19737:(t,e,i)=>{i(56477),t.exports=i(46438).Number.parseFloat},58886:(t,e,i)=>{i(15706),t.exports=i(46438).Number.parseInt},25194:(t,e,i)=>{var s=i(24401),a=Math.floor;t.exports=function(t){return!s(t)&&isFinite(t)&&a(t)===t}},5882:(t,e,i)=>{var s=i(88535);s(s.S,"Number",{isInteger:i(25194)})},21489:(t,e,i)=>{var s=i(88535);s(s.S,"Number",{isNaN:function(t){return t!=t}})},56477:(t,e,i)=>{var s=i(88535),a=i(49709);s(s.S+s.F*(Number.parseFloat!=a),"Number",{parseFloat:a})},15706:(t,e,i)=>{var s=i(88535),a=i(15722);s(s.S+s.F*(Number.parseInt!=a),"Number",{parseInt:a})},73146:(t,e,i)=>{t.exports=i(85079)},43929:(t,e,i)=>{t.exports=i(63342)},7210:(t,e,i)=>{t.exports=i(11837)},99704:(t,e,i)=>{t.exports=i(19737)},17735:(t,e,i)=>{t.exports=i(58886)}}]); \ No newline at end of file diff --git a/dist/avplayer-ui/avplayer.js b/dist/avplayer-ui/avplayer.js index a702890..bd870d3 100644 --- a/dist/avplayer-ui/avplayer.js +++ b/dist/avplayer-ui/avplayer.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.AVPlayer=e():t.AVPlayer=e()}(self,(()=>(()=>{var t,e,i={83327:t=>{var e,i,r,s,a,n,o,l,c,h,u,d,f,p,m,g,v,y,A,b,x,w,k,T,_;t.exports=(e=void 0,i=!0,r={class:"avplayer-ui-player"},s={class:"avplayer-ui-title"},a={d:"M511.6 76.3C264.3 76.2 64 276.4 64 523.5 64 718.9 189.3 885 363.8 946c23.5 5.9 19.9-10.8 19.9-22.2v-77.5c-135.7 15.9-141.2-73.9-150.3-88.9C215 726 171.5 718 184.5 703c30.9-15.9 62.4 4 98.9 57.9 26.4 39.1 77.9 32.5 104 26 5.7-23.5 17.9-44.5 34.7-60.8-140.6-25.2-199.2-111-199.2-213 0-49.5 16.3-95 48.3-131.7-20.4-60.5 1.9-112.3 4.9-120 58.1-5.2 118.5 41.6 123.2 45.3 33-8.9 70.7-13.6 112.9-13.6 42.4 0 80.2 4.9 113.5 13.9 11.3-8.6 67.3-48.8 121.3-43.9 2.9 7.7 24.7 58.3 5.5 118 32.4 36.8 48.9 82.7 48.9 132.3 0 102.2-59 188.1-200 212.9a127.5 127.5 0 0 1 38.1 91v112.5c.8 9 0 17.9 15 17.9 177.1-59.7 304.6-227 304.6-424.1 0-247.2-200.4-447.3-447.5-447.3z"},n={viewBox:"64 64 896 896"},o={href:"https://github.com/zhaohappy/libmedia",target:"_blank"},l={class:"avplayer-ui-header"},c={class:"avplayer-ui-progress-container"},h={class:"avplayer-ui-control-item"},u={class:"avplayer-ui-footer-left"},d={class:"avplayer-ui-footer-right"},f={class:"avplayer-ui-control"},p={class:"avplayer-ui-footer"},m={d:"m10 17 5-5-5-5v10z"},g={viewBox:"0 0 24 24"},v={class:"avplayer-ui-pcm-visualization-container"},y={height:"min(80vh, 80vw)",width:"min(80vh, 80vw)"},A={class:"avplayer-ui-pcm-visualization-mask"},b={class:"avplayer-ui-mask"},x={class:"avplayer-ui-mask info"},w={class:"avplayer-ui-mask showSettings"},k={class:"avplayer-ui-menu-item"},T={class:"avplayer-ui-menu"},_={type:"text/css"},function(t,I,S,P,C,M,B,E,D,R,U,L,F,O,$,N,z,V,W,G,j,H,q,Y,K,Q,X,Z,J,tt,et,it,rt,st,at,nt,ot,lt){lt.push({children:function(){var I=[];return I.push({context:X,events:{click:C("click","playClick(true)","click","","playClick",{execute:function(t,e){return[!0]}})},nativeAttrs:r,operator:H,ref:"playerContainer",tag:"div",type:3}),N(at,at.length-1,"hasHeader").value?I.push({children:function(){var t=[];return t.push({context:X,nativeAttrs:s,operator:H,tag:"span",text:W(N(at,at.length-1,"title").value),type:3}),t.push({children:[{children:[{context:X,isPure:i,isStatic:i,isSvg:i,nativeAttrs:a,operator:H,tag:"path",type:3}],context:X,isPure:i,isStatic:i,isSvg:i,nativeAttrs:n,operator:H,tag:"svg",type:3}],context:X,isPure:i,isStatic:i,nativeAttrs:o,operator:H,tag:"a",type:3}),t.length?t:e}(),context:X,nativeAttrs:l,operator:H,tag:"div",type:3}):I.push({isPure:i,operator:j,text:"",type:2}),I.push({children:function(){var t=[];return N(at,at.length-1,"isLive").value?t.push({isPure:i,operator:j,text:"",type:2}):t.push({children:function(){var t=[];return t.push({context:X,operator:q,props:{indicatorUrl:N(at,at.length-1,"indicatorUrl").value,player:N(at,at.length-1,"player").value},tag:"Progress",type:4}),t.length?t:e}(),context:X,nativeAttrs:c,operator:H,tag:"div",type:3}),t.push({children:function(){var t=[];return t.push({children:function(){var t=[];return t.push({children:function(){var t=[];return t.push({context:X,model:P(N(at,at.length-1,"played")),operator:q,props:{language:N(at,at.length-1,"language").value,player:N(at,at.length-1,"player").value},ref:"play",tag:"Play",type:4}),t.length?t:e}(),context:X,nativeAttrs:h,operator:H,tag:"div",type:3}),t.push({children:function(){var t=[];return t.push({context:X,operator:q,props:{language:N(at,at.length-1,"language").value,player:N(at,at.length-1,"player").value},tag:"Volume",type:4}),t.length?t:e}(),context:X,nativeAttrs:h,operator:H,tag:"div",type:3}),N(at,at.length-1,"isLive").value?t.push({isPure:i,operator:j,text:"",type:2}):t.push({children:function(){var t=[];return t.push({context:X,operator:q,props:{language:N(at,at.length-1,"language").value,player:N(at,at.length-1,"player").value},tag:"Loop",type:4}),t.length?t:e}(),context:X,nativeAttrs:h,operator:H,tag:"div",type:3}),N(at,at.length-1,"isLive").value?t.push({isPure:i,operator:j,text:"",type:2}):t.push({children:function(){var t=[];return t.push({context:X,operator:q,props:{language:N(at,at.length-1,"language").value,player:N(at,at.length-1,"player").value},tag:"Timer",type:4}),t.length?t:e}(),context:X,nativeAttrs:h,operator:H,tag:"div",type:3}),t.length?t:e}(),context:X,nativeAttrs:u,operator:H,tag:"div",type:3}),t.push({children:function(){var t=[];return N(at,at.length-1,"hasVideoTrack").value?t.push({children:function(){var t=[];return t.push({context:X,operator:q,props:{language:N(at,at.length-1,"language").value,player:N(at,at.length-1,"player").value},tag:"VideoTrack",type:4}),t.length?t:e}(),context:X,nativeAttrs:h,operator:H,tag:"div",type:3}):t.push({isPure:i,operator:j,text:"",type:2}),N(at,at.length-1,"hasAudioTrack").value?t.push({children:function(){var t=[];return t.push({context:X,operator:q,props:{language:N(at,at.length-1,"language").value,player:N(at,at.length-1,"player").value},tag:"AudioTrack",type:4}),t.length?t:e}(),context:X,nativeAttrs:h,operator:H,tag:"div",type:3}):t.push({isPure:i,operator:j,text:"",type:2}),N(at,at.length-1,"hasSubtitleTrack").value?t.push({children:function(){var t=[];return t.push({context:X,operator:q,props:{language:N(at,at.length-1,"language").value,player:N(at,at.length-1,"player").value},tag:"SubtitleTrack",type:4}),t.length?t:e}(),context:X,nativeAttrs:h,operator:H,tag:"div",type:3}):t.push({isPure:i,operator:j,text:"",type:2}),t.push({children:function(){var t=[];return t.push({context:X,operator:q,props:{language:N(at,at.length-1,"language").value,player:N(at,at.length-1,"player").value},tag:"Playrate",type:4}),t.length?t:e}(),context:X,nativeAttrs:h,operator:H,tag:"div",type:3}),t.push({children:function(){var t=[];return t.push({context:X,operator:q,props:{language:N(at,at.length-1,"language").value,player:N(at,at.length-1,"player").value},tag:"Setting",type:4}),t.length?t:e}(),context:X,nativeAttrs:h,operator:H,tag:"div",type:3}),N(at,at.length-1,"hasPip").value?t.push({children:function(){var t=[];return t.push({context:X,operator:q,props:{language:N(at,at.length-1,"language").value,player:N(at,at.length-1,"player").value},tag:"Pip",type:4}),t.length?t:e}(),context:X,nativeAttrs:h,operator:H,tag:"div",type:3}):t.push({isPure:i,operator:j,text:"",type:2}),t.push({children:function(){var t=[];return t.push({context:X,operator:q,props:{dom:N(at,at.length-1,"fullscreenDom").value,language:N(at,at.length-1,"language").value,player:N(at,at.length-1,"player").value},tag:"Fullscreen",type:4}),t.length?t:e}(),context:X,nativeAttrs:h,operator:H,tag:"div",type:3}),t.length?t:e}(),context:X,nativeAttrs:d,operator:H,tag:"div",type:3}),t.length?t:e}(),context:X,nativeAttrs:f,operator:H,tag:"div",type:3}),t.length?t:e}(),context:X,nativeAttrs:p,operator:H,tag:"div",type:3}),N(at,at.length-1,"hasFolder").value?I.push({children:function(){var t=[];return t.push({children:[{children:[{context:X,isPure:i,isStatic:i,isSvg:i,nativeAttrs:m,operator:H,tag:"path",type:3}],context:X,isPure:i,isStatic:i,isSvg:i,nativeAttrs:g,operator:H,tag:"svg",type:3}],context:X,events:{click:C("click","toggleFold()","click","","toggleFold")},nativeAttrs:{class:"avplayer-ui-folder-toggle hint--right","data-hint":N(at,at.length-1,"folded").value?$(at,at.length-1,"language.TIP_UNFOLD",["language","TIP_UNFOLD"],i).value:$(at,at.length-1,"language.TIP_FOLD",["language","TIP_FOLD"],i).value},operator:H,tag:"div",type:3}),t.push({context:X,operator:q,props:{language:N(at,at.length-1,"language").value,player:N(at,at.length-1,"player").value},tag:"Folder",type:4}),t.length?t:e}(),context:X,nativeAttrs:{class:"avplayer-ui-folder-container","data-fold":N(at,at.length-1,"folded").value?1:0},operator:H,tag:"div",type:3}):I.push({isPure:i,operator:j,text:"",type:2}),I.push({context:X,operator:q,props:{error:N(at,at.length-1,"error").value,language:N(at,at.length-1,"language").value,player:N(at,at.length-1,"player").value},tag:"LoadingTip",type:4}),N(at,at.length-1,"hasPcmVisualization").value&&!N(at,at.length-1,"loading").value?I.push({children:function(){var t=[];return t.push({children:function(){var t=[];return t.push({context:X,operator:q,props:{language:N(at,at.length-1,"language").value,player:N(at,at.length-1,"player").value},tag:"PcmVisualization",type:4}),t.length?t:e}(),context:X,nativeAttrs:v,nativeStyles:y,operator:H,tag:"div",type:3}),t.length?t:e}(),context:X,nativeAttrs:A,operator:H,tag:"div",type:3}):I.push({isPure:i,operator:j,text:"",type:2}),I.push({children:function(){var t=[];return t.push({children:function(){var t=[];return N(at,at.length-1,"error").value?t.push({context:X,nativeAttrs:{src:N(at,at.length-1,"errorStateUrl").value},operator:H,tag:"img",type:3}):N(at,at.length-1,"played").value?t.push({isPure:i,operator:j,text:"",type:2}):t.push({context:X,events:{click:C("click","playClick()","click","","playClick")},nativeAttrs:{src:N(at,at.length-1,"pauseStateUrl").value},operator:H,tag:"img",type:3}),t.length?t:e}(),context:X,nativeAttrs:{class:"avplayer-ui-state","data-show":N(at,at.length-1,"title").value&&!N(at,at.length-1,"played").value&&!N(at,at.length-1,"loading").value||N(at,at.length-1,"error").value?1:0},operator:H,tag:"div",type:3}),t.length?t:e}(),context:X,nativeAttrs:b,operator:H,tag:"div",type:3}),N(at,at.length-1,"showInfo").value?I.push({children:function(){var t=[];return t.push({context:X,operator:q,props:{language:N(at,at.length-1,"language").value,player:N(at,at.length-1,"player").value},tag:"Info",type:4}),t.length?t:e}(),context:X,nativeAttrs:x,operator:H,tag:"div",type:3}):I.push({isPure:i,operator:j,text:"",type:2}),N(at,at.length-1,"showSettings").value?I.push({children:function(){var t=[];return t.push({context:X,operator:q,props:{language:N(at,at.length-1,"language").value,player:N(at,at.length-1,"player").value},tag:"Settings",type:4}),t.length?t:e}(),context:X,nativeAttrs:w,operator:H,tag:"div",type:3}):I.push({isPure:i,operator:j,text:"",type:2}),N(at,at.length-1,"showMenu").value?I.push({children:function(){var t=[];return D(N(at,at.length-1,"menu"),(function(e,i,r,s){t.push({context:X,events:{click:C("click","menuAction(action)","click","","menuAction",{execute:function(t,i){return[N(e,e.length-1,"action").value]}})},key:N(e,e.length-1,"action").value,nativeAttrs:k,operator:H,tag:"div",text:W(N(e,e.length-1,"name").value),type:3})})),t.length?t:e}(),context:X,events:{outside:C("outside","menuOutside()","outside","","menuOutside")},nativeAttrs:T,nativeStyles:t("top: "+W(N(at,at.length-1,"menuTop").value)+"px; left: "+W(N(at,at.length-1,"menuLeft").value)+"px;"),operator:H,tag:"div",type:3}):I.push({isPure:i,operator:j,text:"",type:2}),I.push({context:X,html:W(N(at,at.length-1,"style").value),nativeAttrs:_,operator:H,tag:"style",type:3}),I.length?I:e}(),context:X,events:{mousemove:C("mousemove","mousemove()","mousemove","","mousemove")},nativeAttrs:{class:"avplayer-ui-container","data-bar-show":N(at,at.length-1,"showBar").value?1:0,id:"avplayer-ui-container"},operator:H,tag:"div",type:3})})},82723:t=>{var e,i,r,s,a;t.exports=(e=void 0,i={class:"avplayer-ui-control-audio-track-value"},r={class:"libmedia-ui-selector"},s={type:"text/css"},a={class:"avplayer-ui-control-audio-track"},function(t,n,o,l,c,h,u,d,f,p,m,g,v,y,A,b,x,w,k,T,_,I,S,P,C,M,B,E,D,R,U,L,F,O,$,N,z,V){V.push({children:function(){var t=[];return t.push({context:B,nativeAttrs:i,operator:I,tag:"div",text:k(A($,$.length-1,"language.CONTROL_AUDIO_TRACK",["language","CONTROL_AUDIO_TRACK"],!0).value),type:3}),t.push({children:function(){var t=[];return f(b($,$.length-1,"list"),(function(e,i,r,s,a){t.push({context:B,events:{click:c("click","change(i)","click","","change",{execute:function(t,e){return[a]}})},key:b(e,e.length-1,"id").value,nativeAttrs:{class:"libmedia-ui-selector-item "+(b(e,e.length-1,"selectIndex").value===a?"active":"")},operator:I,tag:"div",text:k(b(e,e.length-1,"name").value),type:3})})),t.length?t:e}(),context:B,nativeAttrs:r,operator:I,tag:"div",type:3}),t.push({context:B,html:k(b($,$.length-1,"style").value),nativeAttrs:s,operator:I,tag:"style",type:3}),t.length?t:e}(),context:B,nativeAttrs:a,operator:I,tag:"div",type:3})})},22179:t=>{var e,i,r,s,a;t.exports=(e=!0,i={d:"M768 298.666667h170.666667v85.333333h-256V128h85.333333v170.666667zM341.333333 384H85.333333V298.666667h170.666667V128h85.333333v256z m426.666667 341.333333v170.666667h-85.333333v-256h256v85.333333h-170.666667zM341.333333 640v256H256v-170.666667H85.333333v-85.333333h256z",fill:"#ffffff"},r={class:"icon",version:"1.1",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},s={d:"M625.777778 256h142.222222V398.222222h113.777778V142.222222H625.777778v113.777778zM256 398.222222V256H398.222222v-113.777778H142.222222V398.222222h113.777778zM768 625.777778v142.222222H625.777778v113.777778h256V625.777778h-113.777778zM398.222222 768H256V625.777778h-113.777778v256H398.222222v-113.777778z",fill:"#ffffff"},a={type:"text/css"},function(t,n,o,l,c,h,u,d,f,p,m,g,v,y,A,b,x,w,k,T,_,I,S,P,C,M,B,E,D,R,U,L,F,O,$,N,z,V){V.push({children:function(){var t=[];return b($,$.length-1,"fullscreen").value?t.push({children:[{context:B,isPure:e,isStatic:e,isSvg:e,nativeAttrs:i,operator:I,tag:"path",type:3}],context:B,isPure:e,isStatic:e,isSvg:e,nativeAttrs:r,operator:I,tag:"svg",type:3}):t.push({children:[{context:B,isPure:e,isStatic:e,isSvg:e,nativeAttrs:s,operator:I,tag:"path",type:3}],context:B,isPure:e,isStatic:e,isSvg:e,nativeAttrs:r,operator:I,tag:"svg",type:3}),t.push({context:B,html:k(b($,$.length-1,"style").value),nativeAttrs:a,operator:I,tag:"style",type:3}),t.length?t:void 0}(),context:B,events:{click:c("click","fullscreenClick()","click","","fullscreenClick")},nativeAttrs:{class:"avplayer-ui-control-fullscreen hint--top","data-hint":A($,$.length-1,"language.TIP_FULLSCREEN",["language","TIP_FULLSCREEN"],e).value},operator:I,tag:"div",type:3})})},82237:t=>{var e,i,r,s,a,n;t.exports=(e=!0,i={d:"M9 8.877a3 3 0 0 0-2.995 2.824L6 11.877v4a3 3 0 0 0 2.824 2.995l.176.005a1 1 0 1 1 0 2 5 5 0 0 1-4.995-4.783L4 15.877v-4a5 5 0 0 1 4.783-4.995L9 6.877h3V5.5a.5.5 0 0 1 .834-.372L17 8.878H9Zm11 10a3 3 0 0 0 2.995-2.823l.005-.177v-4a3 3 0 0 0-2.824-2.995L20 8.877a1 1 0 0 1 0-2 5 5 0 0 1 4.995 4.783l.005.217v4a5 5 0 0 1-4.783 4.996l-.217.004h-3v1.378a.5.5 0 0 1-.834.371L12 18.877h8Z","fill-rule":"nonzero"},r={"fill-rule":"evenodd"},s={viewBox:"0 0 28 28",xmlns:"http://www.w3.org/2000/svg"},a={d:"M16.859 14.22c2.738 0 4.958 2.164 4.958 4.834 0 2.67-2.22 4.834-4.958 4.834-2.739 0-4.959-2.164-4.959-4.834 0-2.67 2.22-4.835 4.959-4.835Zm0 .966c-2.19 0-3.967 1.732-3.967 3.868s1.776 3.867 3.967 3.867c2.19 0 3.967-1.731 3.967-3.867s-1.776-3.868-3.967-3.868Zm-1.206 2.02.069.056 2.975 2.9a.475.475 0 0 1 0 .684.506.506 0 0 1-.633.056l-.068-.056-2.975-2.9a.475.475 0 0 1 0-.684.506.506 0 0 1 .632-.056ZM12.591 4.9a.69.69 0 0 1 .456.171l3.812 3.346H11.9v-.001H8.925c-1.584 0-2.88 1.208-2.97 2.731l-.005.17v3.868c0 1.545 1.239 2.808 2.8 2.896l.175.005.992-.001v1.934h-.992c-2.664 0-4.838-2.048-4.953-4.619l-.005-.215v-3.868c0-2.597 2.101-4.717 4.737-4.83l.221-.004H11.9v-.892c0-.382.31-.691.691-.691Zm7.243 1.68c2.19.433 3.856 2.274 3.961 4.512l.006.225v3.868c0 .432-.058.85-.167 1.248l-1.817-2.215v-2.9c0-1.263-.827-2.338-1.982-2.736V6.581Z","fill-rule":"nonzero"},n={type:"text/css"},function(t,o,l,c,h,u,d,f,p,m,g,v,y,A,b,x,w,k,T,_,I,S,P,C,M,B,E,D,R,U,L,F,O,$,N,z,V,W){W.push({children:function(){var t=[];return x(N,N.length-1,"loop").value?t.push({children:[{children:[{context:E,isPure:e,isStatic:e,isSvg:e,nativeAttrs:i,operator:S,tag:"path",type:3}],context:E,isPure:e,isStatic:e,isSvg:e,nativeAttrs:r,operator:S,tag:"g",type:3}],context:E,isPure:e,isStatic:e,isSvg:e,nativeAttrs:s,operator:S,tag:"svg",type:3}):t.push({children:[{children:[{context:E,isPure:e,isStatic:e,isSvg:e,nativeAttrs:a,operator:S,tag:"path",type:3}],context:E,isPure:e,isStatic:e,isSvg:e,nativeAttrs:r,operator:S,tag:"g",type:3}],context:E,isPure:e,isStatic:e,isSvg:e,nativeAttrs:s,operator:S,tag:"svg",type:3}),t.push({context:E,html:T(x(N,N.length-1,"style").value),nativeAttrs:n,operator:S,tag:"style",type:3}),t.length?t:void 0}(),context:E,events:{click:h("click","change()","click","","change")},nativeAttrs:{class:"avplayer-ui-control-loop hint--top","data-hint":x(N,N.length-1,"loop").value?b(N,N.length-1,"language.TIP_LOOP_STOP",["language","TIP_LOOP_STOP"],e).value:b(N,N.length-1,"language.TIP_LOOP_START",["language","TIP_LOOP_START"],e).value},operator:S,tag:"div",type:3})})},16979:t=>{var e,i,r,s;t.exports=(e=!0,i={d:"M23.625 15.75c.966 0 1.75.784 1.75 1.75v4.375a1.75 1.75 0 0 1-1.75 1.75H17.5a1.75 1.75 0 0 1-1.75-1.75V17.5c0-.966.784-1.75 1.75-1.75h6.125ZM21 5.25a2.625 2.625 0 0 1 2.62 2.47l.005.155v5.25a.875.875 0 0 1-1.744.102l-.006-.102v-5.25a.875.875 0 0 0-.773-.87L21 7H7a.875.875 0 0 0-.87.773l-.005.102V19.25c0 .449.338.819.773.87l.102.005h6.125a.875.875 0 0 1 .102 1.744l-.102.006H7a2.625 2.625 0 0 1-2.62-2.47l-.005-.155V7.875a2.625 2.625 0 0 1 2.47-2.62L7 5.25h14Z","fill-rule":"evenodd","stroke-width":".5"},r={viewBox:"0 0 28 28",xmlns:"http://www.w3.org/2000/svg"},s={type:"text/css"},function(t,a,n,o,l,c,h,u,d,f,p,m,g,v,y,A,b,x,w,k,T,_,I,S,P,C,M,B,E,D,R,U,L,F,O,$,N,z){z.push({children:function(){var t=[];return t.push({children:[{children:[{context:M,isPure:e,isStatic:e,isSvg:e,nativeAttrs:i,operator:_,tag:"path",type:3}],context:M,isPure:e,isStatic:e,isSvg:e,operator:_,tag:"g",type:3}],context:M,isPure:e,isStatic:e,isSvg:e,nativeAttrs:r,operator:_,tag:"svg",type:3}),t.push({context:M,html:w(A(O,O.length-1,"style").value),nativeAttrs:s,operator:_,tag:"style",type:3}),t.length?t:void 0}(),context:M,events:{click:l("click","pipClick()","click","","pipClick")},nativeAttrs:{class:"avplayer-ui-control-pip hint--top","data-hint":A(O,O.length-1,"pip").value?y(O,O.length-1,"language.TIP_PIP_STOP",["language","TIP_PIP_STOP"],e).value:y(O,O.length-1,"language.TIP_PIP_START",["language","TIP_PIP_START"],e).value},operator:_,tag:"div",type:3})})},1449:t=>{var e,i,r,s,a;t.exports=(e=!0,i={d:"M7 3a2 2 0 0 0-2 2v12a2 2 0 1 0 4 0V5a2 2 0 0 0-2-2zM15 3a2 2 0 0 0-2 2v12a2 2 0 1 0 4 0V5a2 2 0 0 0-2-2z"},r={viewBox:"0 0 22 22",xmlns:"http://www.w3.org/2000/svg"},s={d:"M17.982 9.275L8.06 3.27A2.013 2.013 0 0 0 5 4.994v12.011a2.017 2.017 0 0 0 3.06 1.725l9.922-6.005a2.017 2.017 0 0 0 0-3.45z"},a={type:"text/css"},function(t,n,o,l,c,h,u,d,f,p,m,g,v,y,A,b,x,w,k,T,_,I,S,P,C,M,B,E,D,R,U,L,F,O,$,N,z,V){V.push({children:function(){var t=[];return b($,$.length-1,"played").value?t.push({children:[{context:B,isPure:e,isStatic:e,isSvg:e,nativeAttrs:i,operator:I,tag:"path",type:3}],context:B,isPure:e,isStatic:e,isSvg:e,nativeAttrs:r,operator:I,tag:"svg",type:3}):t.push({children:[{context:B,isPure:e,isStatic:e,isSvg:e,nativeAttrs:s,operator:I,tag:"path",type:3}],context:B,isPure:e,isStatic:e,isSvg:e,nativeAttrs:r,operator:I,tag:"svg",type:3}),t.push({context:B,html:k(b($,$.length-1,"style").value),nativeAttrs:a,operator:I,tag:"style",type:3}),t.length?t:void 0}(),context:B,events:{click:c("click","playClick()","click","","playClick")},nativeAttrs:{class:"avplayer-ui-control-play hint--top","data-hint":b($,$.length-1,"played").value?A($,$.length-1,"language.TIP_PAUSE",["language","TIP_PAUSE"],e).value:A($,$.length-1,"language.TIP_PLAY",["language","TIP_PLAY"],e).value},operator:I,tag:"div",type:3})})},8809:t=>{var e,i,r,s,a,n,o;t.exports=(i=void 0,r=!0,s={class:"avplayer-ui-control-play-rate-value"},a={class:"libmedia-ui-selector"},n={type:"text/css"},o={class:"avplayer-ui-control-play-rate"},function(t,l,c,h,u,d,f,p,m,g,v,y,A,b,x,w,k,T,_,I,S,P,C,M,B,E,D,R,U,L,F,O,$,N,z,V,W,G){G.push({children:function(){var t=[];return t.push({context:D,nativeAttrs:s,operator:P,tag:"div",text:_(x(z,z.length-1,"language.CONTROL_PLAYRATE",["language","CONTROL_PLAYRATE"],r).value),type:3}),t.push({children:function(){var t=[];return m(w(z,z.length-1,"list"),(function(s,a,n,o,l){t.push({children:function(){var t=[];return t.push({isPure:r,operator:I,text:_((e=s[s.length-1],T(e.getScope(),e.keypath)).value)+"x",type:1}),t.length?t:i}(),context:D,events:{click:u("click","change(i)","click","","change",{execute:function(t,e){return[l]}})},key:(e=s[s.length-1],T(e.getScope(),e.keypath)).value,nativeAttrs:{class:"libmedia-ui-selector-item "+(w(s,s.length-1,"index").value===l?"active":"")},operator:P,tag:"div",type:3})})),t.length?t:i}(),context:D,nativeAttrs:a,operator:P,tag:"div",type:3}),t.push({context:D,html:_(w(z,z.length-1,"style").value),nativeAttrs:n,operator:P,tag:"style",type:3}),t.length?t:i}(),context:D,nativeAttrs:o,operator:P,tag:"div",type:3})})},78675:t=>{var e,i,r,s,a;t.exports=(e=!0,i={cx:"11",cy:"11",r:"2"},r={d:"M19.164 8.861L17.6 8.6a6.978 6.978 0 0 0-1.186-2.099l.574-1.533a1 1 0 0 0-.436-1.217l-1.997-1.153a1.001 1.001 0 0 0-1.272.23l-1.008 1.225a7.04 7.04 0 0 0-2.55.001L8.716 2.829a1 1 0 0 0-1.272-.23L5.447 3.751a1 1 0 0 0-.436 1.217l.574 1.533A6.997 6.997 0 0 0 4.4 8.6l-1.564.261A.999.999 0 0 0 2 9.847v2.306c0 .489.353.906.836.986l1.613.269a7 7 0 0 0 1.228 2.075l-.558 1.487a1 1 0 0 0 .436 1.217l1.997 1.153c.423.244.961.147 1.272-.23l1.04-1.263a7.089 7.089 0 0 0 2.272 0l1.04 1.263a1 1 0 0 0 1.272.23l1.997-1.153a1 1 0 0 0 .436-1.217l-.557-1.487c.521-.61.94-1.31 1.228-2.075l1.613-.269a.999.999 0 0 0 .835-.986V9.847a.999.999 0 0 0-.836-.986zM11 15a4 4 0 1 1 0-8 4 4 0 0 1 0 8z"},s={viewBox:"0 0 22 22",xmlns:"http://www.w3.org/2000/svg"},a={type:"text/css"},function(t,n,o,l,c,h,u,d,f,p,m,g,v,y,A,b,x,w,k,T,_,I,S,P,C,M,B,E,D,R,U,L,F,O,$,N,z,V){V.push({children:function(){var t=[];return t.push({children:[{context:B,isPure:e,isStatic:e,isSvg:e,nativeAttrs:i,operator:I,tag:"circle",type:3},{context:B,isPure:e,isStatic:e,isSvg:e,nativeAttrs:r,operator:I,tag:"path",type:3}],context:B,isPure:e,isStatic:e,isSvg:e,nativeAttrs:s,operator:I,tag:"svg",type:3}),t.push({context:B,html:k(b($,$.length-1,"style").value),nativeAttrs:a,operator:I,tag:"style",type:3}),t.length?t:void 0}(),context:B,events:{click:c("click","click()","click","","click")},nativeAttrs:{class:"avplayer-ui-control-settings hint--top","data-hint":A($,$.length-1,"language.TIP_SETTING",["language","TIP_SETTING"],e).value},operator:I,tag:"div",type:3})})},95683:t=>{var e,i,r,s,a,n,o;t.exports=(e=void 0,i=!0,r={class:"avplayer-ui-control-subtitle-track-value"},s={display:"none"},a={class:"libmedia-ui-selector"},n={type:"text/css"},o={class:"avplayer-ui-control-subtitle-track"},function(t,l,c,h,u,d,f,p,m,g,v,y,A,b,x,w,k,T,_,I,S,P,C,M,B,E,D,R,U,L,F,O,$,N,z,V,W,G){G.push({children:function(){var t=[];return t.push({context:D,nativeAttrs:r,operator:P,tag:"div",text:_(x(z,z.length-1,"language.CONTROL_SUBTITLE_TRACK",["language","CONTROL_SUBTITLE_TRACK"],i).value),type:3}),t.push({children:function(){var t,r=[];return m(w(z,z.length-1,"list"),(function(t,e,i,s,a){r.push({context:D,events:{click:u("click","change(i)","click","","change",{execute:function(t,e){return[a]}})},key:w(t,t.length-1,"id").value,nativeAttrs:{class:"libmedia-ui-selector-item "+(w(t,t.length-1,"selectIndex").value===a?"active":"")},operator:P,tag:"div",text:_(w(t,t.length-1,"name").value),type:3})})),r.push((t={children:function(){var t=[];return t.push({isPure:i,operator:I,text:_(x(z,z.length-1,"language.CONTROL_SUBTITLE_TRACK_ADD",["language","CONTROL_SUBTITLE_TRACK_ADD"],i).value),type:1}),w(z,z.length-1,"canUseFilePicker").value?t.push({isPure:i,operator:S,text:"",type:2}):t.push({context:D,events:{change:u("change","fileChange()","change","","fileChange")},nativeAttrs:{accept:w(z,z.length-1,"accept").value,id:"avplayer-file-open-subtitle",type:"file"},nativeStyles:s,operator:P,tag:"input",type:3}),t.length?t:e}(),context:D,nativeAttrs:{class:"libmedia-ui-selector-item"},operator:P,tag:"label",type:3},w(z,z.length-1,"canUseFilePicker").value?y(t,"events","click",u("click","openFile()","click","","openFile")):y(t,"nativeAttrs","for","avplayer-file-open-subtitle"),t)),r.length?r:e}(),context:D,nativeAttrs:a,operator:P,tag:"div",type:3}),t.push({context:D,html:_(w(z,z.length-1,"style").value),nativeAttrs:n,operator:P,tag:"style",type:3}),t.length?t:e}(),context:D,nativeAttrs:o,operator:P,tag:"div",type:3})})},9127:t=>{var e,i,r,s,a,n;t.exports=(i=!0,r={class:"avplayer-ui-time-label"},s={class:"avplayer-ui-time-div"},a={type:"text/css"},n={class:"avplayer-ui-control-timer"},function(t,o,l,c,h,u,d,f,p,m,g,v,y,A,b,x,w,k,T,_,I,S,P,C,M,B,E,D,R,U,L,F,O,$,N,z,V,W){W.push({children:function(){var t=[];return t.push({context:E,nativeAttrs:r,operator:S,tag:"span",text:T(k((e=x(N,N.length-1,"formatTime",R&&R.formatTime||U.formatTime).value,"function"==typeof e?e(x(N,N.length-1,"currentTime").value):D.fatal("[formatTime(currentTime)] is not a function."))).value),type:3}),t.push({context:E,html:" / ",isPure:i,isStatic:i,nativeAttrs:s,operator:S,tag:"span",type:3}),t.push({context:E,nativeAttrs:r,operator:S,tag:"span",text:T(k((e=x(N,N.length-1,"formatTime",R&&R.formatTime||U.formatTime).value,"function"==typeof e?e(x(N,N.length-1,"totalTime").value):D.fatal("[formatTime(totalTime)] is not a function."))).value),type:3}),t.push({context:E,html:T(x(N,N.length-1,"style").value),nativeAttrs:a,operator:S,tag:"style",type:3}),t.length?t:void 0}(),context:E,nativeAttrs:n,operator:S,tag:"div",type:3})})},43145:t=>{var e,i,r,s,a;t.exports=(e=void 0,i={class:"avplayer-ui-control-video-track-value"},r={class:"libmedia-ui-selector"},s={type:"text/css"},a={class:"avplayer-ui-control-video-track"},function(t,n,o,l,c,h,u,d,f,p,m,g,v,y,A,b,x,w,k,T,_,I,S,P,C,M,B,E,D,R,U,L,F,O,$,N,z,V){V.push({children:function(){var t=[];return t.push({context:B,nativeAttrs:i,operator:I,tag:"div",text:k(A($,$.length-1,"language.CONTROL_VIDEO_TRACK",["language","CONTROL_VIDEO_TRACK"],!0).value),type:3}),t.push({children:function(){var t=[];return f(b($,$.length-1,"list"),(function(e,i,r,s,a){t.push({context:B,events:{click:c("click","change(i)","click","","change",{execute:function(t,e){return[a]}})},key:b(e,e.length-1,"id").value,nativeAttrs:{class:"libmedia-ui-selector-item "+(b(e,e.length-1,"selectIndex").value===a?"active":"")},operator:I,tag:"div",text:k(b(e,e.length-1,"name").value),type:3})})),t.length?t:e}(),context:B,nativeAttrs:r,operator:I,tag:"div",type:3}),t.push({context:B,html:k(b($,$.length-1,"style").value),nativeAttrs:s,operator:I,tag:"style",type:3}),t.length?t:e}(),context:B,nativeAttrs:a,operator:I,tag:"div",type:3})})},93069:t=>{var e,i,r,s,a,n,o,l,c,h,u,d,f;t.exports=(e=void 0,i=!0,r={d:"M10.188 4.65L6 8H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h1l4.188 3.35a.5.5 0 0 0 .812-.39V5.04a.498.498 0 0 0-.812-.39zM14.446 3.778a1 1 0 0 0-.862 1.804 6.002 6.002 0 0 1-.007 10.838 1 1 0 0 0 .86 1.806A8.001 8.001 0 0 0 19 11a8.001 8.001 0 0 0-4.554-7.222z"},s={d:"M15 11a3.998 3.998 0 0 0-2-3.465v6.93A3.998 3.998 0 0 0 15 11z"},a={viewBox:"0 0 22 22",xmlns:"http://www.w3.org/2000/svg"},n={d:"M15 11a3.998 3.998 0 0 0-2-3.465v2.636l1.865 1.865A4.02 4.02 0 0 0 15 11z"},o={d:"M13.583 5.583A5.998 5.998 0 0 1 17 11a6 6 0 0 1-.585 2.587l1.477 1.477a8.001 8.001 0 0 0-3.446-11.286 1 1 0 0 0-.863 1.805zM18.778 18.778l-2.121-2.121-1.414-1.414-1.415-1.415L13 13l-2-2-3.889-3.889-3.889-3.889a.999.999 0 1 0-1.414 1.414L5.172 8H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h1l4.188 3.35a.5.5 0 0 0 .812-.39v-3.131l2.587 2.587-.01.005a1 1 0 0 0 .86 1.806c.215-.102.424-.214.627-.333l2.3 2.3a1.001 1.001 0 0 0 1.414-1.416zM11 5.04a.5.5 0 0 0-.813-.39L8.682 5.854 11 8.172V5.04z"},l={class:"avplayer-ui-volume-icon"},c={class:"avplayer-ui-volume-value"},h={class:"avplayer-ui-volume-inner"},u={class:"avplayer-ui-volume-panel"},d={type:"text/css"},f={class:"avplayer-ui-control-volume"},function(t,p,m,g,v,y,A,b,x,w,k,T,_,I,S,P,C,M,B,E,D,R,U,L,F,O,$,N,z,V,W,G,j,H,q,Y,K,Q){Q.push({children:function(){var t=[];return t.push({children:function(){var t=[];return P(q,q.length-1,"volume").value?t.push({children:[{context:$,isPure:i,isStatic:i,isSvg:i,nativeAttrs:r,operator:R,tag:"path",type:3},{context:$,isPure:i,isStatic:i,isSvg:i,nativeAttrs:s,operator:R,tag:"path",type:3}],context:$,isPure:i,isStatic:i,isSvg:i,nativeAttrs:a,operator:R,tag:"svg",type:3}):t.push({children:[{context:$,isPure:i,isStatic:i,isSvg:i,nativeAttrs:n,operator:R,tag:"path",type:3},{context:$,isPure:i,isStatic:i,isSvg:i,nativeAttrs:o,operator:R,tag:"path",type:3}],context:$,isPure:i,isStatic:i,isSvg:i,nativeAttrs:a,operator:R,tag:"svg",type:3}),t.length?t:e}(),context:$,events:{click:v("click","volumeClick()","click","","volumeClick")},nativeAttrs:l,operator:R,tag:"div",type:3}),t.push({children:function(){var t=[];return t.push({children:function(){var t=[];return t.push({context:$,nativeAttrs:c,operator:R,tag:"div",text:B(P(q,q.length-1,"volume").value),type:3}),t.push({context:$,model:g(P(q,q.length-1,"volume")),operator:U,tag:"Slider",type:4}),t.length?t:e}(),context:$,nativeAttrs:h,operator:R,tag:"div",type:3}),t.length?t:e}(),context:$,nativeAttrs:u,operator:R,tag:"div",type:3}),t.push({context:$,html:B(P(q,q.length-1,"style").value),nativeAttrs:d,operator:R,tag:"style",type:3}),t.length?t:e}(),context:$,nativeAttrs:f,operator:R,tag:"div",type:3})})},94907:t=>{var e,i,r,s,a,n,o,l,c,h,u,d,f,p,m,g,v,y,A,b,x,w,k,T,_,I,S;t.exports=(i=void 0,r=!0,s={d:"M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"},a={viewBox:"0 0 24 24"},n={class:"avplayer-ui-folder-icon dir"},o={class:"avplayer-ui-folder-open-name"},l={class:"avplayer-ui-folder-open-dir item"},c={"stroke-width":"0"},h={"stroke-linecap":"round","stroke-linejoin":"round"},u={d:"M21 11V15.8C21 16.9201 21 17.4802 20.782 17.908C20.5903 18.2843 20.2843 18.5903 19.908 18.782C19.4802 19 18.9201 19 17.8 19H6.2C5.0799 19 4.51984 19 4.09202 18.782C3.71569 18.5903 3.40973 18.2843 3.21799 17.908C3 17.4802 3 16.9201 3 15.8V8.2C3 7.0799 3 6.51984 3.21799 6.09202C3.40973 5.71569 3.71569 5.40973 4.09202 5.21799C4.51984 5 5.0799 5 6.2 5H15M21 11L15 5M21 11H16.6C16.0399 11 15.7599 11 15.546 10.891C15.3578 10.7951 15.2049 10.6422 15.109 10.454C15 10.2401 15 9.96005 15 9.4V5","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},d={fill:"none",transform:"rotate(270)",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},f={class:"avplayer-ui-folder-icon file"},p={display:"none"},m={class:"avplayer-ui-folder-open"},g={type:"checkbox"},v={class:"avplayer-ui-url-open-live"},y={"clip-rule":"evenodd",d:"M10 1C9.73478 1 9.48043 1.10536 9.29289 1.29289L3.29289 7.29289C3.10536 7.48043 3 7.73478 3 8V20C3 21.6569 4.34315 23 6 23H7C7.55228 23 8 22.5523 8 22C8 21.4477 7.55228 21 7 21H6C5.44772 21 5 20.5523 5 20V9H10C10.5523 9 11 8.55228 11 8V3H18C18.5523 3 19 3.44772 19 4V7C19 7.55228 19.4477 8 20 8C20.5523 8 21 7.55228 21 7V4C21 2.34315 19.6569 1 18 1H10ZM9 7H6.41421L9 4.41421V7ZM12.5 24","fill-rule":"evenodd"},A={stroke:"none"},b={d:"M17 15V18M17 21V18M17 18H14M17 18H20",stroke:"","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},x={fill:"none",height:"120%",viewBox:"00 0 24 24",width:"120%",x:"-4",xmlns:"http://www.w3.org/2000/svg",y:"-4"},w={fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},k={class:"avplayer-ui-url-open"},T={class:"avplayer-ui-folder-list",role:"list"},_={class:"avplayer-ui-folder-list-container"},I={type:"text/css"},S={class:"avplayer-ui-folder"},function(t,P,C,M,B,E,D,R,U,L,F,O,$,N,z,V,W,G,j,H,q,Y,K,Q,X,Z,J,tt,et,it,rt,st,at,nt,ot,lt,ct,ht){ht.push({children:function(){var S=[];return S.push({children:function(){var t,e=[];return V(ot,ot.length-1,"canOpenFolder").value?e.push({children:function(){var t=[];return t.push({children:[{children:[{context:J,isPure:r,isStatic:r,isSvg:r,nativeAttrs:s,operator:Y,tag:"path",type:3}],context:J,isPure:r,isStatic:r,isSvg:r,nativeAttrs:a,operator:Y,tag:"svg",type:3}],context:J,isPure:r,isStatic:r,nativeAttrs:n,operator:Y,tag:"div",type:3}),t.push({context:J,nativeAttrs:o,operator:Y,tag:"div",text:j(z(ot,ot.length-1,"language.FOLDER_OPEN_DIR",["language","FOLDER_OPEN_DIR"],r).value),type:3}),t.length?t:i}(),context:J,events:{click:B("click","openDir()","click","","openDir")},nativeAttrs:l,operator:Y,tag:"div",type:3}):e.push({isPure:r,operator:q,text:"",type:2}),e.push((t={children:function(){var t=[];return t.push({children:[{children:[{context:J,isPure:r,isStatic:r,isSvg:r,nativeAttrs:c,operator:Y,tag:"g",type:3},{context:J,isPure:r,isStatic:r,isSvg:r,nativeAttrs:h,operator:Y,tag:"g",type:3},{children:[{isPure:r,operator:H,text:" ",type:1},{context:J,isPure:r,isStatic:r,isSvg:r,nativeAttrs:u,operator:Y,tag:"path",type:3},{isPure:r,operator:H,text:" ",type:1}],context:J,isPure:r,isStatic:r,isSvg:r,operator:Y,tag:"g",type:3}],context:J,isPure:r,isStatic:r,isSvg:r,nativeAttrs:d,operator:Y,tag:"svg",type:3}],context:J,isPure:r,isStatic:r,nativeAttrs:f,operator:Y,tag:"div",type:3}),t.push({context:J,nativeAttrs:o,operator:Y,tag:"div",text:j(z(ot,ot.length-1,"language.FOLDER_OPEN_FILE",["language","FOLDER_OPEN_FILE"],r).value),type:3}),V(ot,ot.length-1,"canUseFilePicker").value?t.push({isPure:r,operator:q,text:"",type:2}):t.push({context:J,events:{change:B("change","fileChange()","change","","fileChange")},nativeAttrs:{accept:V(ot,ot.length-1,"accept").value,id:"avplayer-file-open-input",type:"file"},nativeStyles:p,operator:Y,tag:"input",type:3}),t.length?t:i}(),context:J,nativeAttrs:{class:"avplayer-ui-folder-open-file item"},operator:Y,tag:"label",type:3},V(ot,ot.length-1,"canUseFilePicker").value?O(t,"events","click",B("click","openFile()","click","","openFile")):O(t,"nativeAttrs","for","avplayer-file-open-input"),t)),e.length?e:i}(),context:J,nativeAttrs:m,operator:Y,tag:"div",type:3}),S.push({children:function(){var t=[];return t.push({context:J,nativeAttrs:{class:"avplayer-ui-url-open-input",placeholder:z(ot,ot.length-1,"language.FOLDER_OPEN_URL_PLACEHOLDER",["language","FOLDER_OPEN_URL_PLACEHOLDER"],r).value,type:"text"},operator:Y,ref:"url",tag:"input",type:3}),t.push({children:function(){var t=[];return t.push({context:J,nativeAttrs:g,operator:Y,ref:"live",tag:"input",type:3}),t.push({context:J,operator:Y,tag:"span",text:j(z(ot,ot.length-1,"language.CHECKBOX_LIVE",["language","CHECKBOX_LIVE"],r).value),type:3}),t.length?t:i}(),context:J,nativeAttrs:v,operator:Y,tag:"label",type:3}),t.push({children:[{children:[{context:J,isPure:r,isStatic:r,isSvg:r,nativeAttrs:c,operator:Y,tag:"g",type:3},{context:J,isPure:r,isStatic:r,isSvg:r,nativeAttrs:h,operator:Y,tag:"g",type:3},{children:[{isPure:r,operator:H,text:" ",type:1},{context:J,isPure:r,isStatic:r,isSvg:r,nativeAttrs:y,nativeStyles:A,operator:Y,tag:"path",type:3},{isPure:r,operator:H,text:" ",type:1}],context:J,isPure:r,isStatic:r,isSvg:r,operator:Y,tag:"g",type:3},{children:[{children:[{context:J,isPure:r,isStatic:r,isSvg:r,nativeAttrs:b,operator:Y,tag:"path",type:3}],context:J,isPure:r,isStatic:r,isSvg:r,operator:Y,tag:"g",type:3}],context:J,isPure:r,isStatic:r,isSvg:r,nativeAttrs:x,operator:Y,tag:"svg",type:3}],context:J,isPure:r,isStatic:r,isSvg:r,nativeAttrs:w,operator:Y,tag:"svg",type:3}],context:J,events:{click:B("click","openUrl()","click","","openUrl")},nativeAttrs:{class:"avplayer-ui-folder-icon add hint--top","data-hint":z(ot,ot.length-1,"language.BUTTON_ADD",["language","BUTTON_ADD"],r).value},operator:Y,tag:"div",type:3}),t.length?t:i}(),context:J,nativeAttrs:k,operator:Y,tag:"div",type:3}),S.push({children:function(){var t=[];return t.push({children:function(){var t=[];return U(V(ot,ot.length-1,"root"),(function(i,r,s,a){t.push({context:J,key:G(r.name,i[i.length-1].getKeypath("name")).value,operator:K,props:{language:V(i,i.length-1,"language").value,node:(e=i[i.length-1],G(e.getScope(),e.keypath)).value},ref:G(r.id,i[i.length-1].getKeypath("id")).value,tag:"FolderNode",type:4})})),t.length?t:i}(),context:J,nativeAttrs:T,operator:Y,tag:"ul",type:3}),t.length?t:i}(),context:J,events:{keydown:B("keydown","preventDefault()","keydown","","preventDefault"),keyup:B("keyup","preventDefault()","keyup","","preventDefault")},nativeAttrs:_,operator:Y,ref:"scroll",tag:"div",type:3}),S.push({context:J,nativeAttrs:{class:"avplayer-ui-folder-tip","data-show":V(ot,ot.length-1,"tipShow").value?1:0},nativeStyles:t("top: "+j(V(ot,ot.length-1,"tipTop").value)+"px"),operator:Y,tag:"div",text:j(V(ot,ot.length-1,"tip").value),type:3}),S.push({context:J,html:j(V(ot,ot.length-1,"style").value),nativeAttrs:I,operator:Y,tag:"style",type:3}),S.length?S:i}(),context:J,nativeAttrs:S,operator:Y,tag:"div",type:3})})},81747:t=>{var e,i,r,s,a,n,o,l,c,h,u,d,f,p,m,g,v,y,A,b,x,w,k,T,_;t.exports=(i=void 0,r=!0,s={d:"m10 17 5-5-5-5v10z"},a={viewBox:"0 0 24 24"},n={d:"M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"},o={class:"avplayer-ui-folder-icon dir"},l={"stroke-width":"0"},c={"stroke-linecap":"round","stroke-linejoin":"round"},h={"clip-rule":"evenodd",d:"M10 1C9.73478 1 9.48043 1.10536 9.29289 1.29289L3.29289 7.29289C3.10536 7.48043 3 7.73478 3 8V20C3 21.6569 4.34315 23 6 23H7C7.55228 23 8 22.5523 8 22C8 21.4477 7.55228 21 7 21H6C5.44772 21 5 20.5523 5 20V9H10C10.5523 9 11 8.55228 11 8V3H18C18.5523 3 19 3.44772 19 4V7C19 7.55228 19.4477 8 20 8C20.5523 8 21 7.55228 21 7V4C21 2.34315 19.6569 1 18 1H10ZM9 7H6.41421L9 4.41421V7ZM12.5 24","fill-rule":"evenodd"},u={d:"M255.994,0.006C114.607,0.013,0.012,114.612,0,256c0.012,141.387,114.607,255.986,255.994,255.994 C397.393,511.986,511.992,397.387,512,256C511.992,114.612,397.393,0.013,255.994,0.006z M97.607,97.612 c23.34-23.328,51.761-41.475,83.455-52.725c-15.183,18.375-27.84,41.906-37.757,69.116H82.772 C87.452,108.308,92.396,102.824,97.607,97.612z M65.612,138.003h69.986c-9.008,31.929-14.41,67.834-15.363,105.997H32.327 C34.374,205.196,46.3,169.088,65.612,138.003z M65.612,373.997C46.3,342.912,34.374,306.804,32.327,268h87.991 c0.961,38.124,6.21,74.092,15.206,105.998H65.612z M97.607,414.386c-5.211-5.211-10.156-10.695-14.836-16.39h60.573 c4.28,11.774,9.019,22.944,14.312,33.21c6.954,13.438,14.758,25.468,23.348,35.89C149.332,455.846,120.931,437.699,97.607,414.386z M243.998,479.667c-3.746-0.196-7.469-0.477-11.164-0.86c-5.89-2.64-11.722-6.25-17.5-10.961 c-17.632-14.359-33.976-38.671-46.398-69.85h75.061V479.667z M243.998,373.997h-83.436c-9.477-31.171-15.316-67.311-16.328-105.998 h99.763V373.997z M243.998,244H144.31c1.008-38.71,6.875-74.819,16.359-105.997h83.33V244z M243.998,114.003h-74.951 c3.109-7.79,6.367-15.312,9.934-22.195c10.64-20.625,23.17-36.89,36.354-47.656c5.777-4.71,11.609-8.32,17.5-10.96 c3.695-0.382,7.417-0.664,11.164-0.859V114.003z M446.392,138.003c19.312,31.085,31.234,67.194,33.281,105.997h-87.991 c-0.961-38.124-6.21-74.092-15.21-105.997H446.392z M414.393,97.612c5.211,5.211,10.156,10.696,14.836,16.391h-60.577 c-4.281-11.773-9.023-22.945-14.312-33.21c-6.953-13.437-14.758-25.468-23.347-35.89C362.668,56.16,391.065,74.301,414.393,97.612z M267.998,32.333c3.746,0.195,7.469,0.484,11.16,0.859c5.89,2.649,11.723,6.25,17.504,10.96 c17.636,14.359,33.976,38.671,46.397,69.85h-75.061V32.333z M267.998,138.003h83.436c9.476,31.171,15.32,67.31,16.328,105.997 h-99.764V138.003z M267.998,268h99.685c-1.007,38.71-6.874,74.818-16.359,105.998h-83.326V268z M296.661,467.846 c-5.781,4.711-11.614,8.313-17.504,10.961c-3.691,0.375-7.414,0.664-11.16,0.86v-81.67h74.951 c-3.109,7.789-6.367,15.312-9.933,22.195C322.376,440.816,309.845,457.081,296.661,467.846z M414.393,414.386 c-23.336,23.328-51.764,41.476-83.459,52.725c15.187-18.375,27.835-41.905,37.757-69.115h60.538 C424.548,403.692,419.604,409.176,414.393,414.386z M446.392,373.997h-69.998c9.008-31.929,14.414-67.842,15.367-105.998h87.912 C477.626,306.804,465.704,342.912,446.392,373.997z"},d={fill:"none",height:"65%",viewBox:"00 0 512 512",width:"65%",x:"8",xmlns:"http://www.w3.org/2000/svg",y:"8"},f={fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},p={class:"avplayer-ui-folder-icon url"},m={"clip-rule":"evenodd",d:"M10 1C9.73478 1 9.48043 1.10536 9.29289 1.29289L3.29289 7.29289C3.10536 7.48043 3 7.73478 3 8V20C3 21.6569 4.34315 23 6 23H7C7.55228 23 8 22.5523 8 22C8 21.4477 7.55228 21 7 21H6C5.44772 21 5 20.5523 5 20V9H10C10.5523 9 11 8.55228 11 8V3H18C18.5523 3 19 3.44772 19 4V7C19 7.55228 19.4477 8 20 8C20.5523 8 21 7.55228 21 7V4C21 2.34315 19.6569 1 18 1H10ZM9 7H6.41421L9 4.41421V7ZM12.5 24C13.8807 24 15 22.8807 15 21.5V12.8673L20 12.153V18.05C19.8384 18.0172 19.6712 18 19.5 18C18.1193 18 17 19.1193 17 20.5C17 21.8807 18.1193 23 19.5 23C20.8807 23 22 21.8807 22 20.5V11C22 10.7101 21.8742 10.4345 21.6552 10.2445C21.4362 10.0546 21.1456 9.96905 20.8586 10.0101L13.8586 11.0101C13.3659 11.0804 13 11.5023 13 12V19.05C12.8384 19.0172 12.6712 19 12.5 19C11.1193 19 10 20.1193 10 21.5C10 22.8807 11.1193 24 12.5 24Z","fill-rule":"evenodd"},g={class:"avplayer-ui-folder-icon music"},v={"clip-rule":"evenodd",d:"M10 1C9.73478 1 9.48043 1.10536 9.29289 1.29289L3.29289 7.29289C3.10536 7.48043 3 7.73478 3 8V20C3 21.6569 4.34315 23 6 23H8C8.55228 23 9 22.5523 9 22C9 21.4477 8.55228 21 8 21H6C5.44772 21 5 20.5523 5 20V9H10C10.5523 9 11 8.55228 11 8V3H18C18.5523 3 19 3.44772 19 4V7C19 7.55228 19.4477 8 20 8C20.5523 8 21 7.55228 21 7V4C21 2.34315 19.6569 1 18 1H10ZM9 7H6.41421L9 4.41421V7ZM12 17C12 14.2386 14.2386 12 17 12C19.7614 12 22 14.2386 22 17C22 19.7614 19.7614 22 17 22C14.2386 22 12 19.7614 12 17ZM17 10C13.134 10 10 13.134 10 17C10 20.866 13.134 24 17 24C20.866 24 24 20.866 24 17C24 13.134 20.866 10 17 10ZM16.5547 14.1679C16.2478 13.9634 15.8533 13.9443 15.5281 14.1183C15.203 14.2923 15 14.6312 15 15V19C15 19.3688 15.203 19.7077 15.5281 19.8817C15.8533 20.0557 16.2478 20.0366 16.5547 19.8321L19.5547 17.8321C19.8329 17.6466 20 17.3344 20 17C20 16.6656 19.8329 16.3534 19.5547 16.1679L16.5547 14.1679Z","fill-rule":"evenodd"},y={class:"avplayer-ui-folder-icon mov"},A={class:"avplayer-ui-folder-node-name"},b={d:"M7 3a2 2 0 0 0-2 2v12a2 2 0 1 0 4 0V5a2 2 0 0 0-2-2zM15 3a2 2 0 0 0-2 2v12a2 2 0 1 0 4 0V5a2 2 0 0 0-2-2z"},x={viewBox:"0 0 22 22",xmlns:"http://www.w3.org/2000/svg"},w={d:"M17.982 9.275L8.06 3.27A2.013 2.013 0 0 0 5 4.994v12.011a2.017 2.017 0 0 0 3.06 1.725l9.922-6.005a2.017 2.017 0 0 0 0-3.45z"},k={d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"},T={class:"avplayer-ui-folder-list",role:"list"},_={class:"avplayer-ui-folder-list-li",role:"listitem"},function(t,I,S,P,C,M,B,E,D,R,U,L,F,O,$,N,z,V,W,G,j,H,q,Y,K,Q,X,Z,J,tt,et,it,rt,st,at,nt,ot,lt){lt.push({children:function(){var _=[];return _.push({children:function(){var t=[];return V((e=N(at,at.length-1,"isFolder",J&&J.isFolder||tt.isFolder).value,"function"==typeof e?e(N(at,at.length-1,"node").value):Z.fatal("[isFolder(node)] is not a function."))).value?(t.push({children:[{children:[{context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:s,operator:H,tag:"path",type:3}],context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:a,operator:H,tag:"svg",type:3}],context:X,events:{click:C("click","toggle()","click","","toggle")},nativeAttrs:{class:"avplayer-ui-folder-expand hint--right","data-hint":$(at,at.length-1,"node.opened",["node","opened"],r).value?$(at,at.length-1,"language.TIP_FOLD",["language","TIP_FOLD"],r).value:$(at,at.length-1,"language.TIP_UNFOLD",["language","TIP_UNFOLD"],r).value,"data-open":$(at,at.length-1,"node.opened",["node","opened"],r).value?1:0},operator:H,tag:"div",type:3}),t.push({children:[{children:[{context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:n,operator:H,tag:"path",type:3}],context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:a,operator:H,tag:"svg",type:3}],context:X,isPure:r,isStatic:r,nativeAttrs:o,operator:H,tag:"div",type:3})):V((e=N(at,at.length-1,"isUrl",J&&J.isUrl||tt.isUrl).value,"function"==typeof e?e(N(at,at.length-1,"node").value):Z.fatal("[isUrl(node)] is not a function."))).value?t.push({children:[{children:[{context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:l,operator:H,tag:"g",type:3},{context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:c,operator:H,tag:"g",type:3},{children:[{isPure:r,operator:G,text:" ",type:1},{context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:h,operator:H,tag:"path",type:3},{isPure:r,operator:G,text:" ",type:1}],context:X,isPure:r,isStatic:r,isSvg:r,operator:H,tag:"g",type:3},{children:[{children:[{context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:u,operator:H,tag:"path",type:3},{isPure:r,operator:G,text:" ",type:1}],context:X,isPure:r,isStatic:r,isSvg:r,operator:H,tag:"g",type:3}],context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:d,operator:H,tag:"svg",type:3}],context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:f,operator:H,tag:"svg",type:3}],context:X,isPure:r,isStatic:r,nativeAttrs:p,operator:H,tag:"div",type:3}):V((e=N(at,at.length-1,"isMusic",J&&J.isMusic||tt.isMusic).value,"function"==typeof e?e(N(at,at.length-1,"node").value):Z.fatal("[isMusic(node)] is not a function."))).value?t.push({children:[{children:[{context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:l,operator:H,tag:"g",type:3},{context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:c,operator:H,tag:"g",type:3},{children:[{isPure:r,operator:G,text:" ",type:1},{context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:m,operator:H,tag:"path",type:3},{isPure:r,operator:G,text:" ",type:1}],context:X,isPure:r,isStatic:r,isSvg:r,operator:H,tag:"g",type:3}],context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:f,operator:H,tag:"svg",type:3}],context:X,isPure:r,isStatic:r,nativeAttrs:g,operator:H,tag:"div",type:3}):t.push({children:[{children:[{context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:l,operator:H,tag:"g",type:3},{context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:c,operator:H,tag:"g",type:3},{children:[{isPure:r,operator:G,text:" ",type:1},{context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:v,operator:H,tag:"path",type:3},{isPure:r,operator:G,text:" ",type:1}],context:X,isPure:r,isStatic:r,isSvg:r,operator:H,tag:"g",type:3}],context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:f,operator:H,tag:"svg",type:3}],context:X,isPure:r,isStatic:r,nativeAttrs:y,operator:H,tag:"div",type:3}),t.push({context:X,events:{mouseenter:C("mouseenter","mouseenter()","mouseenter","","mouseenter"),mouseleave:C("mouseleave","mouseleave()","mouseleave","","mouseleave")},nativeAttrs:A,operator:H,ref:"name",tag:"div",text:W($(at,at.length-1,"node.name",["node","name"],r).value),type:3}),V((e=N(at,at.length-1,"isFolder",J&&J.isFolder||tt.isFolder).value,"function"==typeof e?e(N(at,at.length-1,"node").value):Z.fatal("[isFolder(node)] is not a function."))).value?t.push({isPure:r,operator:j,text:"",type:2}):t.push({children:function(){var t=[];return $(at,at.length-1,"node.played",["node","played"],r).value&&!$(at,at.length-1,"node.paused",["node","paused"],r).value?t.push({children:[{context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:b,operator:H,tag:"path",type:3}],context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:x,operator:H,tag:"svg",type:3}):t.push({children:[{context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:w,operator:H,tag:"path",type:3}],context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:x,operator:H,tag:"svg",type:3}),t.length?t:i}(),context:X,events:{click:C("click","play()","click","","play")},nativeAttrs:{class:"avplayer-ui-folder-icon play hint--top","data-hint":!$(at,at.length-1,"node.played",["node","played"],r).value||$(at,at.length-1,"node.paused",["node","paused"],r).value?$(at,at.length-1,"language.TIP_PLAY",["language","TIP_PLAY"],r).value:$(at,at.length-1,"language.TIP_PAUSE",["language","TIP_PAUSE"],r).value},operator:H,tag:"div",type:3}),$(at,at.length-1,"node.depth",["node","depth"],r).value?t.push({isPure:r,operator:j,text:"",type:2}):t.push({children:[{children:[{context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:k,operator:H,tag:"path",type:3}],context:X,isPure:r,isStatic:r,isSvg:r,nativeAttrs:a,operator:H,tag:"svg",type:3}],context:X,events:{click:C("click","delete()","click","","delete")},nativeAttrs:{class:"avplayer-ui-folder-icon delete hint--top","data-hint":$(at,at.length-1,"language.TIP_DELETE",["language","TIP_DELETE"],r).value},operator:H,tag:"div",type:3}),t.length?t:i}(),context:X,nativeAttrs:{class:"avplayer-ui-folder-node "+($(at,at.length-1,"node.played",["node","played"],r).value?"active":"")},nativeStyles:t("padding-inline-start: "+W(V((e=N(at,at.length-1,"paddingStart",J&&J.paddingStart||tt.paddingStart).value,"function"==typeof e?e(N(at,at.length-1,"node").value):Z.fatal("[paddingStart(node)] is not a function."))).value)+"px;"),operator:H,tag:"div",type:3}),V((e=N(at,at.length-1,"isFolder",J&&J.isFolder||tt.isFolder).value,"function"==typeof e?e(N(at,at.length-1,"node").value):Z.fatal("[isFolder(node)] is not a function."))).value&&$(at,at.length-1,"node.opened",["node","opened"],r).value?_.push({children:function(){var t=[];return D($(at,at.length-1,"node.children",["node","children"],r),(function(i,r,s,a){t.push({context:X,key:V(r.name,i[i.length-1].getKeypath("name")).value,operator:q,props:{language:N(i,i.length-1,"language").value,node:(e=i[i.length-1],V(e.getScope(),e.keypath)).value},ref:V(r.id,i[i.length-1].getKeypath("id")).value,tag:"FolderNode",type:4})})),t.length?t:i}(),context:X,nativeAttrs:T,operator:H,tag:"ul",type:3}):_.push({isPure:r,operator:j,text:"",type:2}),_.length?_:i}(),context:X,nativeAttrs:_,operator:H,tag:"li",type:3})})},15491:t=>{var e,i,r,s,a,n,o,l,c,h,u,d,f;t.exports=(e=void 0,i=!0,r={class:"avplayer-ui-info-title"},s={d:"m8 6.939 3.182-3.182a.75.75 0 1 1 1.061 1.061L9.061 8l3.182 3.182a.75.75 0 1 1-1.061 1.061L8 9.061l-3.182 3.182a.75.75 0 1 1-1.061-1.061L6.939 8 3.757 4.818a.75.75 0 1 1 1.061-1.061L8 6.939z"},a={"data-pointer":"none",space:"preserve",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},n={class:"avplayer-ui-info-close"},o={class:"avplayer-ui-info-format"},l={class:"avplayer-ui-info-line-title"},c={class:"avplayer-ui-info-line-value"},h={class:"avplayer-ui-info-line"},u={class:"avplayer-ui-info-panel"},d={type:"text/css"},f={class:"avplayer-ui-info"},function(t,p,m,g,v,y,A,b,x,w,k,T,_,I,S,P,C,M,B,E,D,R,U,L,F,O,$,N,z,V,W,G,j,H,q,Y,K,Q){Q.push({children:function(){var t=[];return t.push({context:$,nativeAttrs:r,operator:R,tag:"div",text:B(S(q,q.length-1,"language.INFO_TITLE",["language","INFO_TITLE"],i).value),type:3}),t.push({children:[{children:[{context:$,isPure:i,isStatic:i,isSvg:i,nativeAttrs:s,operator:R,tag:"path",type:3}],context:$,isPure:i,isStatic:i,isSvg:i,nativeAttrs:a,operator:R,tag:"svg",type:3}],context:$,events:{click:v("click","close()","click","","close")},nativeAttrs:n,operator:R,tag:"span",type:3}),t.push({children:function(){var t=[];return t.push({children:function(){var t=[];return t.push({context:$,html:B(P(q,q.length-1,"info").value),operator:R,tag:"span",type:3}),t.length?t:e}(),context:$,nativeAttrs:o,operator:R,tag:"div",type:3}),x(P(q,q.length-1,"list"),(function(i,r,s,a){t.push({children:function(){var t=[];return t.push({context:$,nativeAttrs:l,operator:R,tag:"span",text:B(P(i,i.length-1,"key").value),type:3}),t.push({context:$,nativeAttrs:c,operator:R,tag:"span",text:B(P(i,i.length-1,"value").value),type:3}),t.length?t:e}(),context:$,nativeAttrs:h,operator:R,tag:"div",type:3})})),t.length?t:e}(),context:$,events:{keydown:v("keydown","preventDefault()","keydown","","preventDefault"),keyup:v("keyup","preventDefault()","keyup","","preventDefault")},nativeAttrs:u,operator:R,tag:"div",type:3}),t.push({context:$,html:B(P(q,q.length-1,"style").value),nativeAttrs:d,operator:R,tag:"style",type:3}),t.length?t:e}(),context:$,nativeAttrs:f,operator:R,tag:"div",type:3})})},32849:t=>{var e,i,r,s,a;t.exports=(e=!0,i={cx:"50",cy:"50",fill:"none",r:"20"},r={class:"avplayer-ui-circular",viewBox:"25 25 50 50"},s={class:"avplayer-ui-loading-spinner"},a={type:"text/css"},function(t,n,o,l,c,h,u,d,f,p,m,g,v,y,A,b,x,w,k,T,_,I,S,P,C,M,B,E,D,R,U,L,F,O,$,N,z,V){V.push({children:function(){var t=[];return t.push({children:[{children:[{context:B,isPure:e,isStatic:e,isSvg:e,nativeAttrs:i,operator:I,tag:"circle",type:3}],context:B,isPure:e,isStatic:e,isSvg:e,nativeAttrs:r,operator:I,tag:"svg",type:3}],context:B,isPure:e,isStatic:e,nativeAttrs:s,operator:I,tag:"div",type:3}),t.push({context:B,html:k(b($,$.length-1,"style").value),nativeAttrs:a,operator:I,tag:"style",type:3}),t.length?t:void 0}(),context:B,nativeAttrs:{class:"avplayer-ui-loading-mask","data-loading":b($,$.length-1,"loading").value?1:0},operator:I,tag:"div",type:3})})},23077:t=>{var e,i,r,s,a;t.exports=(i=void 0,r=!0,s={class:"avplayer-ui-loading-message-list"},a={type:"text/css"},function(t,n,o,l,c,h,u,d,f,p,m,g,v,y,A,b,x,w,k,T,_,I,S,P,C,M,B,E,D,R,U,L,F,O,$,N,z,V){V.push({children:function(){var n=[];return n.push({children:function(){var s=[];return f(b($,$.length-1,"message"),(function(i,a,n,o,l){s.push({context:B,key:(e=i[i.length-1],w(e.getScope(),e.keypath)).value,nativeAttrs:{class:"avplayer-ui-loading-message","data-last":A(i,i.length-1,"message.length",["message","length"],r).value-1===l?1:0},nativeStyles:t("bottom: "+k(30*(A(i,i.length-1,"message.length",["message","length"],r).value-1-l))+"px;"),operator:I,tag:"div",text:k((e=i[i.length-1],w(e.getScope(),e.keypath)).value),type:3})})),s.length?s:i}(),context:B,nativeAttrs:s,operator:I,tag:"div",type:3}),n.push({context:B,html:k(b($,$.length-1,"style").value),nativeAttrs:a,operator:I,tag:"style",type:3}),n.length?n:i}(),context:B,nativeAttrs:{class:"avplayer-ui-loading-tip","data-show":b($,$.length-1,"showMessage").value?1:0},operator:I,tag:"div",type:3})})},65051:t=>{var e,i;t.exports=(e={type:"text/css"},i={class:"avplayer-ui-pcm-visualization"},function(t,r,s,a,n,o,l,c,h,u,d,f,p,m,g,v,y,A,b,x,w,k,T,_,I,S,P,C,M,B,E,D,R,U,L,F,O,$){$.push({children:function(){var t=[];return t.push({context:P,operator:k,ref:"canvas",tag:"canvas",type:3}),t.push({context:P,html:b(v(L,L.length-1,"style").value),nativeAttrs:e,operator:k,tag:"style",type:3}),t.length?t:void 0}(),context:P,nativeAttrs:i,operator:k,tag:"div",type:3})})},90577:t=>{var e,i,r,s,a,n,o,l,c,h,u,d,f,p,m;t.exports=(i=void 0,r=!0,s={class:"avplayer-ui-progress-hover"},a={class:"avplayer-ui-progress-loaded"},n={class:"avplayer-ui-progress-played"},o={class:"avplayer-ui-progress-chapter-item"},l={class:"avplayer-ui-progress-chapter"},c={class:"avplayer-ui-icon-indicator"},h={class:"avplayer-ui-progress-indicator"},u={class:"avplayer-ui-progress-tip"},d={class:"avplayer-ui-progress-inner"},f={class:"libmedia-ui-progress-thumb"},p={type:"text/css"},m={class:"avplayer-ui-progress"},function(t,g,v,y,A,b,x,w,k,T,_,I,S,P,C,M,B,E,D,R,U,L,F,O,$,N,z,V,W,G,j,H,q,Y,K,Q,X,Z){Z.push({children:function(){var m=[];return m.push({children:function(){var d=[];return d.push({context:z,nativeAttrs:s,nativeStyles:t("width: "+D(M(K,K.length-1,"hoverWidth").value)+"%;"),operator:L,tag:"div",type:3}),d.push({context:z,nativeAttrs:a,nativeStyles:t("width: "+D(M(K,K.length-1,"loadedWidth").value)+"%;"),operator:L,tag:"div",type:3}),d.push({context:z,nativeAttrs:n,nativeStyles:t("width: "+D(M(K,K.length-1,"playedWidth").value)+"%;"),operator:L,tag:"div",type:3}),d.push({children:function(){var r=[];return k(M(K,K.length-1,"chapters"),(function(i,s,a,n){r.push({context:z,events:{click:A("click","chapterClick(this)","click","","chapterClick",{execute:function(t,r){return[(e=i[i.length-1],E(e.getScope(),e.keypath)).value]}}),mouseenter:A("mouseenter","chapterEnter(this)","mouseenter","","chapterEnter",{execute:function(t,r){return[(e=i[i.length-1],E(e.getScope(),e.keypath)).value]}}),mouseleave:A("mouseleave","chapterLeave(this)","mouseleave","","chapterLeave",{execute:function(t,r){return[(e=i[i.length-1],E(e.getScope(),e.keypath)).value]}})},key:E(s.text,i[i.length-1].getKeypath("text")).value,nativeAttrs:o,nativeStyles:t("left: "+D(M(i,i.length-1,"left").value)+"%;"),operator:L,tag:"span",type:3})})),r.length?r:i}(),context:z,nativeAttrs:l,operator:L,tag:"div",type:3}),M(K,K.length-1,"indicatorUrl").value?d.push({children:function(){var t=[];return t.push({children:function(){var t=[];return t.push({context:z,nativeAttrs:{draggable:"false",height:M(K,K.length-1,"indicatorSize").value,src:M(K,K.length-1,"indicatorUrl").value,width:M(K,K.length-1,"indicatorSize").value},operator:L,tag:"img",type:3}),t.length?t:i}(),context:z,nativeAttrs:c,operator:L,tag:"i",type:3}),t.length?t:i}(),context:z,events:{mousedown:A("mousedown","indicatorDown()","mousedown","","indicatorDown")},nativeAttrs:h,nativeStyles:t("left: "+D(M(K,K.length-1,"playedWidth").value)+"%;"),operator:L,tag:"div",type:3}):d.push({isPure:r,operator:U,text:"",type:2}),d.push({context:z,nativeAttrs:u,nativeStyles:t("left: "+D(M(K,K.length-1,"hoverWidth").value)+"%; display: "+D(M(K,K.length-1,"showTip").value?"block":"none")+";"),operator:L,tag:"div",text:D(M(K,K.length-1,"hoverChapter").value||E((e=M(K,K.length-1,"formatTime",W&&W.formatTime||G.formatTime).value,"function"==typeof e?e(M(K,K.length-1,"hoverTime").value):V.fatal("[formatTime(hoverTime)] is not a function."))).value),type:3}),d.length?d:i}(),context:z,events:{click:A("click","hoverClick()","click","","hoverClick"),mouseenter:A("mouseenter","hoverEnter()","mouseenter","","hoverEnter"),mouseleave:A("mouseleave","hoverLeave()","mouseleave","","hoverLeave"),mousemove:A("mousemove","hoverMove()","mousemove","","hoverMove")},nativeAttrs:d,operator:L,ref:"slider",tag:"div",type:3}),m.push({context:z,isPure:r,isStatic:r,nativeAttrs:f,operator:L,tag:"div",type:3}),m.push({context:z,html:D(M(K,K.length-1,"style").value),nativeAttrs:p,operator:L,tag:"style",type:3}),m.length?m:i}(),context:z,nativeAttrs:m,operator:L,tag:"div",type:3})})},42461:t=>{var e,i,r,s,a,n,o,l,c,h,u;t.exports=(e=void 0,i=!0,r={class:"avplayer-ui-settings-title"},s={d:"m8 6.939 3.182-3.182a.75.75 0 1 1 1.061 1.061L9.061 8l3.182 3.182a.75.75 0 1 1-1.061 1.061L8 9.061l-3.182 3.182a.75.75 0 1 1-1.061-1.061L6.939 8 3.757 4.818a.75.75 0 1 1 1.061-1.061L8 6.939z"},a={"data-pointer":"none",space:"preserve",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},n={class:"avplayer-ui-settings-close"},o={class:"avplayer-ui-settings-tabs"},l={class:"avplayer-ui-settings-context"},c={class:"avplayer-ui-settings-panel"},h={type:"text/css"},u={class:"avplayer-ui-settings"},function(t,d,f,p,m,g,v,y,A,b,x,w,k,T,_,I,S,P,C,M,B,E,D,R,U,L,F,O,$,N,z,V,W,G,j,H,q,Y){Y.push({children:function(){var t=[];return t.push({context:F,nativeAttrs:r,operator:E,tag:"div",text:C(_(j,j.length-1,"language.SETTINGS_TITLE",["language","SETTINGS_TITLE"],i).value),type:3}),t.push({children:[{children:[{context:F,isPure:i,isStatic:i,isSvg:i,nativeAttrs:s,operator:E,tag:"path",type:3}],context:F,isPure:i,isStatic:i,isSvg:i,nativeAttrs:a,operator:E,tag:"svg",type:3}],context:F,events:{click:m("click","close()","click","","close")},nativeAttrs:n,operator:E,tag:"span",type:3}),t.push({children:function(){var t=[];return t.push({children:function(){var t=[];return A(I(j,j.length-1,"list"),(function(e,i,r,s){t.push({context:F,events:{click:m("click","set('tab', id)","click","","set",{execute:function(t,i){return["tab",I(e,e.length-1,"id").value]}})},nativeAttrs:{class:"avplayer-ui-settings-tab "+(I(e,e.length-1,"id").value===I(e,e.length-1,"tab").value?"active":"")},operator:E,tag:"div",text:C(I(e,e.length-1,"name").value),type:3})})),t.length?t:e}(),context:F,nativeAttrs:o,operator:E,tag:"div",type:3}),t.push({context:F,isPure:i,isStatic:i,nativeAttrs:l,operator:E,tag:"div",type:3}),t.length?t:e}(),context:F,nativeAttrs:c,operator:E,tag:"div",type:3}),t.push({context:F,html:C(I(j,j.length-1,"style").value),nativeAttrs:h,operator:E,tag:"style",type:3}),t.length?t:e}(),context:F,nativeAttrs:u,operator:E,tag:"div",type:3})})},82042:t=>{var e,i,r,s;t.exports=(e=void 0,i={class:"libmedia-ui-slider-inner"},r={class:"libmedia-ui-slider-outer"},s={class:"libmedia-ui-slider-thumb"},function(t,a,n,o,l,c,h,u,d,f,p,m,g,v,y,A,b,x,w,k,T,_,I,S,P,C,M,B,E,D,R,U,L,F,O,$,N,z){z.push({children:function(){var t=[];return t.push({children:function(){var t=[];return t.push({context:M,nativeAttrs:i,nativeStyles:a(A(O,O.length-1,"offset").value),operator:_,tag:"div",type:3}),t.length?t:e}(),context:M,nativeAttrs:r,operator:_,ref:"slider",tag:"div",type:3}),t.push({context:M,events:{mousedown:l("mousedown","mousedown()","mousedown","","mousedown")},nativeAttrs:s,nativeStyles:a(A(O,O.length-1,"offset").value),operator:_,tag:"div",type:3}),t.length?t:e}(),context:M,nativeAttrs:{class:"libmedia-ui-slider","data-direction":A(O,O.length-1,"direction").value},operator:_,tag:"div",type:3})})},89739:t=>{t.exports="html{--libmedia-ui-theme:#23ade5;--libmedia-ui-font-color:#fff;--libmedia-ui-background-color:#000;--libmedia-ui-text-shadow-color:rgba(0,0,0,0.502);--libmedia-ui-transition-duration:.2s;--libmedia-ui-padding:10px;--libmedia-ui-border-radius:3px;--libmedia-ui-progress-height:6px;--libmedia-ui-progress-color:rgba(255,255,255,0.251);--libmedia-ui-hover-color:rgba(255,255,255,0.251);--libmedia-ui-loaded-color:rgba(255,255,255,0.251);--libmedia-ui-state-size:80px;--libmedia-ui-state-opacity:.8;--libmedia-ui-header-height:40px;--libmedia-ui-bottom-height:100px;--libmedia-ui-bottom-offset:51px;--libmedia-ui-bottom-gap:5px;--libmedia-ui-chapter-width:8px;--libmedia-ui-chapter-color:rgba(255,255,255,0.502);--libmedia-ui-control-height:46px;--libmedia-ui-control-opacity:.75;--libmedia-ui-control-icon-size:28px;--libmedia-ui-control-icon-scale:1.1;--libmedia-ui-volume-height:120px;--libmedia-ui-slider-thumb-size:14px;--libmedia-ui-slider-thickness:2px;--libmedia-ui-lock-size:36px;--libmedia-ui-indicator-scale:0;--libmedia-ui-indicator-size:16px;--libmedia-ui-fullscreen-web-index:9999;--libmedia-ui-settings-icon-size:24px;--libmedia-ui-settings-max-height:300px;--libmedia-ui-selector-max-height:300px;--libmedia-ui-contextmenus-min-width:250px;--libmedia-ui-subtitle-font-size:20px;--libmedia-ui-subtitle-gap:5px;--libmedia-ui-subtitle-bottom:15px;--libmedia-ui-subtitle-border:#000;--libmedia-ui-widget-background:rgba(0,0,0,0.851);--libmedia-ui-widget-hover-background:rgba(255,255,255,0.102);--libmedia-ui-tip-background:rgba(0,0,0,0.702);--libmedia-ui-tip-font-color:#fff;--libmedia-ui-scrollbar-size:4px;--libmedia-ui-scrollbar-background:rgba(255,255,255,0.251);--libmedia-ui-scrollbar-background-hover:rgba(255,255,255,0.502);--libmedia-ui-mini-progress-height:2px;--libmedia-ui-folder-width:300px}[class*=\"hint--\"]{font-style:normal;position:relative}[class*=\"hint--\"]:before,[class*=\"hint--\"]:after{visibility:hidden;opacity:0;z-index:1000000;pointer-events:none;transition:all .3s;position:absolute;transform:translate3d(0,0,0)}[class*=\"hint--\"]:hover:before,[class*=\"hint--\"]:hover:after{visibility:visible;opacity:1;transition-delay:.1s}[class*=\"hint--\"]:before{content:\"\";z-index:1000001;background:none;border:6px solid rgba(0,0,0,0);position:absolute}[class*=\"hint--\"]:after{color:var(--libmedia-ui-tip-font-color);white-space:nowrap;background:var(--libmedia-ui-tip-background);padding:8px 10px;font-size:12px;line-height:12px}[class*=\"hint--\"][data-hint]:after{content:attr(data-hint)}[data-hint=\"\"]:before,[data-hint=\"\"]:after{display:none !important}.hint--top-left:before,.hint--top-right:before,.hint--top:before{border-top-color:var(--libmedia-ui-tip-background)}.hint--bottom-left:before,.hint--bottom-right:before,.hint--bottom:before{border-bottom-color:var(--libmedia-ui-tip-background)}.hint--left:before{border-left-color:var(--libmedia-ui-tip-background)}.hint--right:before{border-right-color:var(--libmedia-ui-tip-background)}.hint--top:before{margin-bottom:-11px}.hint--top:before,.hint--top:after{bottom:100%;left:50%}.hint--top:before{left:calc(50% - 6px)}.hint--top:after{transform:translateX(-50%)}.hint--top:hover:before{transform:translateY(-8px)}.hint--top:hover:after{transform:translateX(-50%) translateY(-8px)}.hint--bottom:before{margin-top:-11px}.hint--bottom:before,.hint--bottom:after{top:100%;left:50%}.hint--bottom:before{left:calc(50% - 6px)}.hint--bottom:after{transform:translateX(-50%)}.hint--bottom:hover:before{transform:translateY(8px)}.hint--bottom:hover:after{transform:translateX(-50%) translateY(8px)}.hint--right:before{margin-bottom:-6px;margin-left:-11px}.hint--right:after{margin-bottom:-14px}.hint--right:before,.hint--right:after{bottom:50%;left:100%}.hint--right:hover:before,.hint--right:hover:after{transform:translateX(8px)}.hint--left:before{margin-bottom:-6px;margin-right:-11px}.hint--left:after{margin-bottom:-14px}.hint--left:before,.hint--left:after{bottom:50%;right:100%}.hint--left:hover:before,.hint--left:hover:after{transform:translateX(-8px)}.hint--top-left:before{margin-bottom:-11px}.hint--top-left:before,.hint--top-left:after{bottom:100%;left:50%}.hint--top-left:before{left:calc(50% - 6px)}.hint--top-left:after{margin-left:12px;transform:translateX(-100%)}.hint--top-left:hover:before{transform:translateY(-8px)}.hint--top-left:hover:after{transform:translateX(-100%) translateY(-8px)}.hint--top-right:before{margin-bottom:-11px}.hint--top-right:before,.hint--top-right:after{bottom:100%;left:50%}.hint--top-right:before{left:calc(50% - 6px)}.hint--top-right:after{margin-left:-12px;transform:translateX(0)}.hint--top-right:hover:before,.hint--top-right:hover:after{transform:translateY(-8px)}.hint--bottom-left:before{margin-top:-11px}.hint--bottom-left:before,.hint--bottom-left:after{top:100%;left:50%}.hint--bottom-left:before{left:calc(50% - 6px)}.hint--bottom-left:after{margin-left:12px;transform:translateX(-100%)}.hint--bottom-left:hover:before{transform:translateY(8px)}.hint--bottom-left:hover:after{transform:translateX(-100%) translateY(8px)}.hint--bottom-right:before{margin-top:-11px}.hint--bottom-right:before,.hint--bottom-right:after{top:100%;left:50%}.hint--bottom-right:before{left:calc(50% - 6px)}.hint--bottom-right:after{margin-left:-12px;transform:translateX(0)}.hint--bottom-right:hover:before,.hint--bottom-right:hover:after{transform:translateY(8px)}.hint--small:after,.hint--medium:after,.hint--large:after{white-space:normal;word-wrap:break-word;line-height:1.4em}.hint--small:after{width:80px}.hint--medium:after{width:150px}.hint--large:after{width:300px}[class*=\"hint--\"]:after{text-shadow:0 -1px #000;box-shadow:4px 4px 8px rgba(0,0,0,0.302)}.hint--error:after{text-shadow:0 -1px #592726;background-color:#b34e4d}.hint--error.hint--top-left:before,.hint--error.hint--top-right:before,.hint--error.hint--top:before{border-top-color:#b34e4d}.hint--error.hint--bottom-left:before,.hint--error.hint--bottom-right:before,.hint--error.hint--bottom:before{border-bottom-color:#b34e4d}.hint--error.hint--left:before{border-left-color:#b34e4d}.hint--error.hint--right:before{border-right-color:#b34e4d}.hint--warning:after{text-shadow:0 -1px #6c5328;background-color:#c09854}.hint--warning.hint--top-left:before,.hint--warning.hint--top-right:before,.hint--warning.hint--top:before{border-top-color:#c09854}.hint--warning.hint--bottom-left:before,.hint--warning.hint--bottom-right:before,.hint--warning.hint--bottom:before{border-bottom-color:#c09854}.hint--warning.hint--left:before{border-left-color:#c09854}.hint--warning.hint--right:before{border-right-color:#c09854}.hint--info:after{text-shadow:0 -1px #1a3c4d;background-color:#3986ac}.hint--info.hint--top-left:before,.hint--info.hint--top-right:before,.hint--info.hint--top:before{border-top-color:#3986ac}.hint--info.hint--bottom-left:before,.hint--info.hint--bottom-right:before,.hint--info.hint--bottom:before{border-bottom-color:#3986ac}.hint--info.hint--left:before{border-left-color:#3986ac}.hint--info.hint--right:before{border-right-color:#3986ac}.hint--success:after{text-shadow:0 -1px #1a321a;background-color:#458746}.hint--success.hint--top-left:before,.hint--success.hint--top-right:before,.hint--success.hint--top:before{border-top-color:#458746}.hint--success.hint--bottom-left:before,.hint--success.hint--bottom-right:before,.hint--success.hint--bottom:before{border-bottom-color:#458746}.hint--success.hint--left:before{border-left-color:#458746}.hint--success.hint--right:before{border-right-color:#458746}.hint--always:after,.hint--always:before{opacity:1;visibility:visible}.hint--always.hint--top:before{transform:translateY(-8px)}.hint--always.hint--top:after{transform:translateX(-50%) translateY(-8px)}.hint--always.hint--top-left:before{transform:translateY(-8px)}.hint--always.hint--top-left:after{transform:translateX(-100%) translateY(-8px)}.hint--always.hint--top-right:before,.hint--always.hint--top-right:after{transform:translateY(-8px)}.hint--always.hint--bottom:before{transform:translateY(8px)}.hint--always.hint--bottom:after{transform:translateX(-50%) translateY(8px)}.hint--always.hint--bottom-left:before{transform:translateY(8px)}.hint--always.hint--bottom-left:after{transform:translateX(-100%) translateY(8px)}.hint--always.hint--bottom-right:before,.hint--always.hint--bottom-right:after{transform:translateY(8px)}.hint--always.hint--left:before,.hint--always.hint--left:after{transform:translateX(-8px)}.hint--always.hint--right:before,.hint--always.hint--right:after{transform:translateX(8px)}.hint--rounded:after{border-radius:4px}.hint--no-animate:before,.hint--no-animate:after{transition-duration:0s}.hint--bounce:before,.hint--bounce:after{transition:opacity .3s,visibility .3s,transform .3s cubic-bezier(.71,1.7,.77,1.24)}.hint--no-shadow:before,.hint--no-shadow:after{text-shadow:initial;box-shadow:initial}.hint--no-arrow:before{display:none}.libmedia-ui-selector{text-align:center;border-radius:var(--libmedia-ui-border-radius);opacity:0;pointer-events:none;bottom:var(--libmedia-ui-control-height);max-height:var(--libmedia-ui-selector-max-height);background-color:var(--libmedia-ui-widget-background);transition:all var(--libmedia-ui-transition-duration) ease;flex-direction:column;align-items:center;display:flex;position:absolute;overflow:hidden auto}.libmedia-ui-selector .libmedia-ui-selector-item{flex-shrink:0;justify-content:center;align-items:center;width:100%;padding:10px 15px;line-height:1;display:flex;cursor:pointer}.libmedia-ui-selector .libmedia-ui-selector-item.active{color:var(--libmedia-ui-theme)}.libmedia-ui-selector .libmedia-ui-selector-item:hover{background-color:var(--libmedia-ui-widget-hover-background)}.libmedia-ui-slider{cursor:pointer;width:100%;height:100%;position:relative;justify-content:center;display:flex}.libmedia-ui-slider .libmedia-ui-slider-outer{border-radius:var(--libmedia-ui-border-radius);background-color:rgba(255,255,255,0.251);justify-content:center;display:flex;position:relative;overflow:hidden}.libmedia-ui-slider .libmedia-ui-slider-outer .libmedia-ui-slider-inner{background-color:var(--libmedia-ui-theme);width:100%;height:100%;position:absolute}.libmedia-ui-slider .libmedia-ui-slider-thumb{width:var(--libmedia-ui-slider-thumb-size);height:var(--libmedia-ui-slider-thumb-size);background-color:var(--libmedia-ui-theme);transition:transform var(--libmedia-ui-transition-duration) ease;border-radius:100%;flex-shrink:0;position:absolute;transform:scale(1)}.libmedia-ui-slider[data-direction='vertical'] .libmedia-ui-slider-outer{width:var(--libmedia-ui-slider-thickness);height:100%}.libmedia-ui-slider[data-direction='vertical'] .libmedia-ui-slider-thumb{margin-top:calc(var(--libmedia-ui-slider-thumb-size) / -2)}.libmedia-ui-slider[data-direction='horizontal'] .libmedia-ui-slider-outer{width:100%;height:var(--libmedia-ui-slider-thickness)}.libmedia-ui-slider[data-direction='horizontal'] .libmedia-ui-slider-thumb{margin-right:calc(var(--libmedia-ui-slider-thumb-size) / -2)}.avplayer-ui-container{width:100%;height:100%;user-select:none;color:var(--libmedia-ui-font-color);background-color:var(--libmedia-ui-background-color);text-shadow:0 0 2px var(--libmedia-ui-text-shadow-color)}.avplayer-ui-container *{box-sizing:border-box;outline:none}.avplayer-ui-container svg{fill:var(--libmedia-ui-font-color)}.avplayer-ui-container .avplayer-ui-header{width:100%;height:var(--libmedia-ui-header-height);position:absolute;top:0;text-align:center;padding:0 var(--libmedia-ui-padding);transition:all var(--libmedia-ui-transition-duration) ease;background-size:100% var(--libmedia-ui-header-height);background-image:linear-gradient(to bottom,#000,rgba(0,0,0,0.4),rgba(0,0,0,0))}.avplayer-ui-container .avplayer-ui-header .avplayer-ui-title{line-height:var(--libmedia-ui-header-height);font-size:16px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.avplayer-ui-container .avplayer-ui-header a{position:absolute;right:calc((var(--libmedia-ui-header-height) - 16px) / 2);top:calc((var(--libmedia-ui-header-height) - 16px) / 2);height:16px}.avplayer-ui-container .avplayer-ui-header a svg{height:16px;width:16px}.avplayer-ui-container .avplayer-ui-player{width:100%;height:100%;position:absolute;top:0;left:0;overflow:hidden;cursor:pointer}.avplayer-ui-container .avplayer-ui-player canvas,.avplayer-ui-container .avplayer-ui-player video{background-color:#000}.avplayer-ui-container .avplayer-ui-footer{padding:0 var(--libmedia-ui-padding);transition:all var(--libmedia-ui-transition-duration) ease;background-size:100% var(--libmedia-ui-bottom-height);background-image:linear-gradient(to top,#000,rgba(0,0,0,0.4),rgba(0,0,0,0));flex-direction:column;justify-content:flex-end;width:100%;height:var(--libmedia-ui-bottom-height);display:flex;position:absolute;bottom:0}.avplayer-ui-container .avplayer-ui-footer .avplayer-ui-progress-container{pointer-events:auto;padding-bottom:var(--libmedia-ui-bottom-gap);position:relative;transition:transform var(--libmedia-ui-transition-duration) ease}.avplayer-ui-container .avplayer-ui-footer .avplayer-ui-control{height:var(--libmedia-ui-control-height);justify-content:space-between;align-items:center;display:flex;position:relative;transition:transform var(--libmedia-ui-transition-duration) ease}.avplayer-ui-container .avplayer-ui-footer .avplayer-ui-control .avplayer-ui-control-item{cursor:pointer;white-space:nowrap;opacity:var(--libmedia-ui-control-opacity);min-height:var(--libmedia-ui-control-height);min-width:var(--libmedia-ui-control-height);transition:opacity var(--libmedia-ui-transition-duration) ease;flex-shrink:0;justify-content:center;align-items:center;display:flex;position:relative}.avplayer-ui-container .avplayer-ui-footer .avplayer-ui-control .avplayer-ui-control-item svg{height:var(--libmedia-ui-control-icon-size);width:var(--libmedia-ui-control-icon-size);transform:scale(var(--libmedia-ui-control-icon-scale));transition:transform var(--libmedia-ui-transition-duration) ease}.avplayer-ui-container .avplayer-ui-footer .avplayer-ui-control .avplayer-ui-control-item:hover{cursor:pointer;opacity:1}.avplayer-ui-container .avplayer-ui-footer .avplayer-ui-control .avplayer-ui-footer-left{height:100%;display:flex}.avplayer-ui-container .avplayer-ui-footer .avplayer-ui-control .avplayer-ui-footer-right{height:100%;display:flex;justify-content:flex-end}.avplayer-ui-container .avplayer-ui-footer:hover .avplayer-ui-progress .avplayer-ui-progress-inner .avplayer-ui-progress-indicator{transform:scale(1)}.avplayer-ui-container .avplayer-ui-folder-container{position:absolute;top:0;left:0;transition:all var(--libmedia-ui-transition-duration) ease;width:var(--libmedia-ui-folder-width);bottom:calc(var(--libmedia-ui-progress-height) + var(--libmedia-ui-bottom-gap) + var(--libmedia-ui-control-height));box-shadow:2px 0 8px rgba(0,0,0,0.6);background-color:var(--libmedia-ui-widget-background);border-top-right-radius:8px;border-bottom-right-radius:8px}.avplayer-ui-container .avplayer-ui-folder-container .avplayer-ui-folder-toggle{width:24px;height:60px;justify-content:center;align-items:center;display:flex;cursor:pointer;border-top-right-radius:8px;border-bottom-right-radius:8px;box-shadow:2px 0 8px rgba(0,0,0,0.6);transition:all var(--libmedia-ui-transition-duration) ease;position:absolute;right:-24px;top:50%;transform:translateY(-50%);opacity:1}.avplayer-ui-container .avplayer-ui-folder-container .avplayer-ui-folder-toggle svg{width:24px;height:24px;opacity:var(--libmedia-ui-control-opacity);transform:rotate(180deg)}.avplayer-ui-container .avplayer-ui-folder-container .avplayer-ui-folder-toggle:hover svg{opacity:1}.avplayer-ui-container .avplayer-ui-folder-container[data-fold='1']{transform:translateX(calc(var(--libmedia-ui-folder-width) * -1))}.avplayer-ui-container .avplayer-ui-folder-container[data-fold='1'] .avplayer-ui-folder-toggle svg{transform:rotate(0)}.avplayer-ui-container .avplayer-ui-mask{pointer-events:none;justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:absolute}.avplayer-ui-container .avplayer-ui-mask .avplayer-ui-state{opacity:0;width:var(--libmedia-ui-state-size);height:var(--libmedia-ui-state-size);transition:all var(--libmedia-ui-transition-duration) ease;justify-content:center;align-items:center;display:flex;transform:scale(2)}.avplayer-ui-container .avplayer-ui-mask .avplayer-ui-state img{vertical-align:top;max-width:100%}.avplayer-ui-container .avplayer-ui-mask .avplayer-ui-state[data-show='1']{cursor:pointer;pointer-events:auto;opacity:var(--libmedia-ui-state-opacity);transform:scale(1)}.avplayer-ui-container .avplayer-ui-mask.info{height:calc(100% - var(--libmedia-ui-bottom-height))}.avplayer-ui-container .avplayer-ui-mask.showSettings{height:calc(100% - var(--libmedia-ui-bottom-height))}.avplayer-ui-container .avplayer-ui-pcm-visualization-mask{pointer-events:none;justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:absolute;transition:all var(--libmedia-ui-transition-duration) ease}.avplayer-ui-container .avplayer-ui-menu{position:fixed;border-radius:var(--libmedia-ui-border-radius);background-color:var(--libmedia-ui-widget-background);transition:all var(--libmedia-ui-transition-duration) ease}.avplayer-ui-container .avplayer-ui-menu .avplayer-ui-menu-item{padding:10px 60px;font-size:14px;cursor:pointer}.avplayer-ui-container .avplayer-ui-menu .avplayer-ui-menu-item:hover{background-color:var(--libmedia-ui-widget-hover-background)}.avplayer-ui-container[data-bar-show='0']{cursor:none}.avplayer-ui-container[data-bar-show='0'] .avplayer-ui-player{cursor:none}.avplayer-ui-container[data-bar-show='0'] .avplayer-ui-header{transform:translateY(calc(var(--libmedia-ui-header-height) * -1))}.avplayer-ui-container[data-bar-show='0'] .avplayer-ui-footer{transform:translateY(var(--libmedia-ui-bottom-height))}.avplayer-ui-container[data-bar-show='0'] .avplayer-ui-footer .avplayer-ui-progress-container{transform:translateY(calc((var(--libmedia-ui-bottom-height) - var(--libmedia-ui-bottom-gap) - var(--libmedia-ui-progress-height) * 0.5 - var(--libmedia-ui-control-height)) * -1))}.avplayer-ui-container[data-bar-show='0'] .avplayer-ui-folder-container{opacity:0;transform:translateX(calc(var(--libmedia-ui-folder-width) * -1))}.avplayer-ui-container[data-bar-show='0'] .avplayer-ui-folder-container .avplayer-ui-folder-toggle{pointer-events:none}.avplayer-ui-container[data-bar-show='0'] .avplayer-ui-pcm-visualization-mask{background-color:rgba(0,0,0,0.5)}@keyframes icon_scale{0%{transform:scale(1);transform-origin:center center}50%{transform:scale(1.2);transform-origin:center center}100%{transform:scale(1);transform-origin:center center}}@keyframes icon_rotate{0%{transform:rotate(0);transform-origin:center center}100%{transform:rotate(120deg);transform-origin:center center}}"},42567:t=>{t.exports=".avplayer-ui-control-audio-track{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.avplayer-ui-control-audio-track:hover .libmedia-ui-selector{opacity:1;pointer-events:auto}"},9371:t=>{t.exports=".avplayer-ui-control-fullscreen{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.avplayer-ui-control-fullscreen:hover svg{animation:icon_scale .4s ease both}"},85885:t=>{t.exports=".avplayer-ui-control-loop{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.avplayer-ui-control-loop:hover svg{animation:icon_scale .4s ease both}"},6187:t=>{t.exports=".avplayer-ui-control-pip{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.avplayer-ui-control-pip:hover svg{animation:icon_scale .4s ease both}"},70409:t=>{t.exports=".avplayer-ui-control-play{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.avplayer-ui-control-play:hover svg{animation:icon_scale .4s ease both}"},63197:t=>{t.exports=".avplayer-ui-control-play-rate{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.avplayer-ui-control-play-rate:hover .libmedia-ui-selector{opacity:1;pointer-events:auto}"},51819:t=>{t.exports=".avplayer-ui-control-settings{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.avplayer-ui-control-settings:hover svg{animation:icon_rotate .4s ease both}"},35995:t=>{t.exports=".avplayer-ui-control-subtitle-track{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.avplayer-ui-control-subtitle-track:hover .libmedia-ui-selector{opacity:1;pointer-events:auto}"},27983:t=>{t.exports=".avplayer-ui-control-timer{display:flex;align-items:center;justify-content:center;cursor:pointer;padding:0 10px;opacity:var(--libmedia-ui-control-opacity)}.avplayer-ui-control-timer .avplayer-ui-time-label{min-width:66px}.avplayer-ui-control-timer .avplayer-ui-time-div{transform:translateX(-1px)}.avplayer-ui-control-timer:hover{opacity:1}"},27189:t=>{t.exports=".avplayer-ui-control-video-track{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.avplayer-ui-control-video-track:hover .libmedia-ui-selector{opacity:1;pointer-events:auto}"},80253:t=>{t.exports=".avplayer-ui-control-volume{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.avplayer-ui-control-volume:hover svg{animation:icon_scale .4s ease both}.avplayer-ui-control-volume:hover .avplayer-ui-volume-panel{opacity:1;pointer-events:auto}.avplayer-ui-control-volume .avplayer-ui-volume-icon{justify-content:center;align-items:center;display:flex}.avplayer-ui-control-volume .avplayer-ui-volume-panel{text-align:center;opacity:0;pointer-events:none;left:0;right:0;bottom:var(--libmedia-ui-control-height);width:var(--libmedia-ui-control-height);height:var(--libmedia-ui-volume-height);transition:all ease;transition:all var(--libmedia-ui-transition-duration) ease 0s;justify-content:center;align-items:center;padding:0 5px;font-size:12px;display:flex;position:absolute;z-index:1}.avplayer-ui-control-volume .avplayer-ui-volume-panel .avplayer-ui-volume-inner{border-radius:var(--libmedia-ui-border-radius);background-color:var(--libmedia-ui-widget-background);flex-direction:column;align-items:center;gap:10px;width:100%;height:100%;padding:10px 0 12px;display:flex}.avplayer-ui-control-volume .avplayer-ui-volume-panel .avplayer-ui-volume-inner .libmedia-ui-slider{flex:1}"},50055:t=>{t.exports=".avplayer-ui-folder{width:100%;height:100%;padding:var(--libmedia-ui-padding) 0;transition:all var(--libmedia-ui-transition-duration) ease}.avplayer-ui-folder ul{margin:0;padding:0;list-style:none}.avplayer-ui-folder svg{width:24px;height:24px}.avplayer-ui-folder .avplayer-ui-folder-open{display:flex;justify-content:center;align-items:center;height:30px;margin-bottom:10px;width:var(--libmedia-ui-folder-width);padding-right:var(--libmedia-ui-padding)}.avplayer-ui-folder .avplayer-ui-folder-open .avplayer-ui-folder-open-dir{transform:scale(.9)}.avplayer-ui-folder .avplayer-ui-folder-open .avplayer-ui-folder-open-dir .avplayer-ui-folder-open-name{margin-left:3px}.avplayer-ui-folder .avplayer-ui-folder-open .avplayer-ui-folder-open-file{transform:scale(.9)}.avplayer-ui-folder .avplayer-ui-folder-open .avplayer-ui-folder-open-file svg{stroke:var(--libmedia-ui-font-color);fill:none}.avplayer-ui-folder .avplayer-ui-folder-open .item{cursor:pointer;display:flex;justify-content:center;align-items:center;opacity:var(--libmedia-ui-control-opacity);transition:opacity var(--libmedia-ui-transition-duration) ease}.avplayer-ui-folder .avplayer-ui-folder-open .item:hover{opacity:1}.avplayer-ui-folder .avplayer-ui-folder-open .avplayer-ui-folder-open-name{display:inline-block;font-size:12px}.avplayer-ui-folder .avplayer-ui-folder-open .item + .item{margin-left:20px}.avplayer-ui-folder .avplayer-ui-url-open{display:flex;justify-content:center;align-items:center;margin-bottom:10px;height:30px;width:var(--libmedia-ui-folder-width);padding:0 var(--libmedia-ui-padding);opacity:var(--libmedia-ui-control-opacity);transition:opacity var(--libmedia-ui-transition-duration) ease}.avplayer-ui-folder .avplayer-ui-url-open .avplayer-ui-url-open-input{flex:1;font-size:12px;border:1px;border-radius:4px;color:var(--libmedia-ui-font-color);outline:none;border:1px solid var(--libmedia-ui-font-color);background:none;height:28px;line-height:28px;margin-left:14px;padding-left:10px}.avplayer-ui-folder .avplayer-ui-url-open .avplayer-ui-url-open-input::placeholder{color:var(--libmedia-ui-font-color)}.avplayer-ui-folder .avplayer-ui-url-open .avplayer-ui-folder-icon{width:30px;transform:scale(.9)}.avplayer-ui-folder .avplayer-ui-url-open .avplayer-ui-folder-icon svg{stroke:var(--libmedia-ui-font-color)}.avplayer-ui-folder .avplayer-ui-url-open .avplayer-ui-folder-icon:hover{cursor:pointer}.avplayer-ui-folder .avplayer-ui-url-open .avplayer-ui-folder-icon:hover svg{animation:icon_scale .4s ease both}.avplayer-ui-folder .avplayer-ui-url-open .avplayer-ui-url-open-live{display:flex;justify-content:center;align-items:center;font-size:12px}.avplayer-ui-folder .avplayer-ui-url-open:hover{opacity:1}.avplayer-ui-folder .avplayer-ui-folder-list-container{position:absolute;top:90px;bottom:0;left:0;right:0;overflow:auto}.avplayer-ui-folder .avplayer-ui-folder-list-container::-webkit-scrollbar{display:none}.avplayer-ui-folder .avplayer-ui-folder-node{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;height:30px;width:var(--libmedia-ui-folder-width);padding-right:var(--libmedia-ui-padding);opacity:var(--libmedia-ui-control-opacity);transition:opacity var(--libmedia-ui-transition-duration) ease}.avplayer-ui-folder .avplayer-ui-folder-node.active{background-color:var(--libmedia-ui-theme) !important}.avplayer-ui-folder .avplayer-ui-folder-node:hover{background-color:var(--libmedia-ui-widget-hover-background);opacity:1}.avplayer-ui-folder .avplayer-ui-folder-expand{cursor:pointer;font-size:0;display:flex;justify-content:center;align-items:center;transition:transform linear .1s;width:24px;height:100%}.avplayer-ui-folder .avplayer-ui-folder-expand svg{transform:rotate(0)}.avplayer-ui-folder .avplayer-ui-folder-expand[data-open='1'] svg{transform:rotate(90deg)}.avplayer-ui-folder .avplayer-ui-folder-icon{display:flex;justify-content:center;align-items:center;width:24px;height:100%}.avplayer-ui-folder .avplayer-ui-folder-icon.mov{margin-left:24px;transform:scale(.9)}.avplayer-ui-folder .avplayer-ui-folder-icon.music{margin-left:24px}.avplayer-ui-folder .avplayer-ui-folder-icon.url{margin-left:24px}.avplayer-ui-folder .avplayer-ui-folder-icon.play,.avplayer-ui-folder .avplayer-ui-folder-icon.delete{cursor:pointer;transform:scale(.8)}.avplayer-ui-folder .avplayer-ui-folder-icon.play:hover svg,.avplayer-ui-folder .avplayer-ui-folder-icon.delete:hover svg{animation:icon_scale .4s ease both}.avplayer-ui-folder .avplayer-ui-folder-node-name{padding:0 5px;min-width:100px;flex-grow:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.avplayer-ui-folder .avplayer-ui-folder-tip{text-shadow:0 -1px var(--libmedia-ui-tip-background);box-shadow:4px 4px 8px var(--libmedia-ui-tip-background);color:var(--libmedia-ui-tip-font-color);white-space:nowrap;background:var(--libmedia-ui-tip-background);padding:8px 10px;font-size:12px;line-height:12px;opacity:0;pointer-events:none;transition:all var(--libmedia-ui-transition-duration) ease .1s,top 0s ease 0s;position:absolute;transform:translate3d(0,0,0);left:100%}.avplayer-ui-folder .avplayer-ui-folder-tip::before{content:\"\";border:5px solid rgba(0,0,0,0);position:absolute;border-right-color:var(--libmedia-ui-tip-background);left:-10px;transform:translateY(1px)}.avplayer-ui-folder .avplayer-ui-folder-tip[data-show='1']{transform:translateX(8px);opacity:1}"},90615:t=>{t.exports=".avplayer-ui-info{pointer-events:auto;background:var(--libmedia-ui-tip-background);border-radius:4px;color:#fff;line-height:18px;padding-bottom:15px;text-align:center;text-align:left;-webkit-font-smoothing:antialiased;position:relative;max-height:80%;max-width:80%;user-select:text;display:flex;flex-direction:column}.avplayer-ui-info .avplayer-ui-info-title{border-bottom:1px solid rgba(255,255,255,0.1);font-size:16px;line-height:40px;text-align:center;height:41px}.avplayer-ui-info .avplayer-ui-info-close{fill:#fff;color:#fff;cursor:pointer;height:22px;position:absolute;right:10px;top:8px;width:22px}.avplayer-ui-info .avplayer-ui-info-panel{flex:1;padding:15px 26px 0;position:relative;overflow:auto;scrollbar-width:thin}.avplayer-ui-info .avplayer-ui-info-panel::-webkit-scrollbar{width:8px;height:8px}.avplayer-ui-info .avplayer-ui-info-panel .avplayer-ui-info-format{font-size:12px;font-weight:500}.avplayer-ui-info .avplayer-ui-info-panel .avplayer-ui-info-line{min-width:290px}.avplayer-ui-info .avplayer-ui-info-panel .avplayer-ui-info-line .avplayer-ui-info-line-title{font-size:12px;font-weight:500;margin-right:10px;text-align:right;text-indent:-99em;width:190px;display:inline-block}.avplayer-ui-info .avplayer-ui-info-panel .avplayer-ui-info-line .avplayer-ui-info-line-value{color:#999;font-size:12px;font-weight:400;margin-right:6px}"},57817:t=>{t.exports=".avplayer-ui-loading-mask{position:absolute;width:100%;height:100%;text-align:center;top:0;left:0;display:flex;align-items:center;justify-content:center;opacity:0;pointer-events:none;transition:all var(--libmedia-ui-transition-duration) ease}.avplayer-ui-loading-mask .avplayer-ui-loading-spinner{top:50%;margin-top:-21px;width:100%;text-align:center;position:absolute}.avplayer-ui-loading-mask .avplayer-ui-loading-spinner .avplayer-ui-circular{height:42px;width:42px;animation:loading-rotate 2s linear infinite}.avplayer-ui-loading-mask .avplayer-ui-loading-spinner .avplayer-ui-circular circle{animation:loading-dash 1.5s ease-in-out infinite;stroke-dasharray:90,150;stroke-dashoffset:0;stroke-width:2;stroke:var(--libmedia-ui-theme);stroke-linecap:round}.avplayer-ui-loading-mask[data-loading='1']{opacity:1;pointer-events:auto}@keyframes loading-rotate{to{transform:rotate(1turn)}}@keyframes loading-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40px}to{stroke-dasharray:90,150;stroke-dashoffset:-120px}}"},6453:t=>{t.exports=".avplayer-ui-loading-tip{position:absolute;right:20px;bottom:calc(var(--libmedia-ui-bottom-height) + 10px);opacity:1;pointer-events:none;transition:all 1s ease}.avplayer-ui-loading-tip .avplayer-ui-loading-message{transition:bottom .1s ease,transform 1s ease;border-radius:var(--libmedia-ui-border-radius);white-space:nowrap;background-color:var(--libmedia-ui-tip-background);padding:3px 5px;font-size:12px;line-height:1;position:absolute;right:0}.avplayer-ui-loading-tip .avplayer-ui-loading-message[data-last='1']{animation:avplayer-ui-loading-message-last .1s ease}.avplayer-ui-loading-tip[data-show='0']{opacity:0}.avplayer-ui-loading-tip[data-show='0'] .avplayer-ui-loading-message{transform:translateY(-40px)}@keyframes avplayer-ui-loading-message-last{0%{opacity:0}100%{opacity:1}}"},9067:t=>{t.exports=".avplayer-ui-pcm-visualization{width:100%;height:100%}.avplayer-ui-pcm-visualization canvas{width:100%;height:100%}"},57165:t=>{t.exports=".avplayer-ui-progress{cursor:pointer;height:var(--libmedia-ui-progress-height);justify-content:center;align-items:center;display:flex;position:relative}.avplayer-ui-progress:hover .avplayer-ui-progress-inner{height:100%}.avplayer-ui-progress .avplayer-ui-progress-inner{transition:height var(--libmedia-ui-transition-duration) ease;background-color:var(--libmedia-ui-progress-color);align-items:center;width:100%;height:50%;display:flex;position:relative}.avplayer-ui-progress .avplayer-ui-progress-inner .avplayer-ui-progress-hover{background-color:var(--libmedia-ui-hover-color);width:0%;height:100%;position:absolute}.avplayer-ui-progress .avplayer-ui-progress-inner .avplayer-ui-progress-loaded{background-color:var(--libmedia-ui-loaded-color);width:0%;height:100%;position:absolute}.avplayer-ui-progress .avplayer-ui-progress-inner .avplayer-ui-progress-played{background-color:var(--libmedia-ui-theme);width:0%;height:100%;position:absolute}.avplayer-ui-progress .avplayer-ui-progress-inner .avplayer-ui-progress-chapter{pointer-events:none;width:100%;height:100%;position:absolute}.avplayer-ui-progress .avplayer-ui-progress-inner .avplayer-ui-progress-indicator{width:var(--libmedia-ui-indicator-size);height:var(--libmedia-ui-indicator-size);transform:scale(var(--libmedia-ui-indicator-scale));margin-left:calc(var(--libmedia-ui-indicator-size) / -2);transition:transform var(--libmedia-ui-transition-duration) ease;border-radius:50%;justify-content:center;align-items:center;display:flex;position:absolute;left:0}.avplayer-ui-progress .avplayer-ui-progress-inner .avplayer-ui-progress-indicator:hover{transform:scale(1.2) !important}.avplayer-ui-progress .avplayer-ui-progress-inner .avplayer-ui-progress-indicator .avplayer-ui-icon-indicator{width:100%;height:100%}.avplayer-ui-progress .avplayer-ui-progress-inner .avplayer-ui-progress-chapter{pointer-events:none;width:100%;height:100%;position:absolute;overflow:hidden}.avplayer-ui-progress .avplayer-ui-progress-inner .avplayer-ui-progress-chapter .avplayer-ui-progress-chapter-item{pointer-events:auto;transform:translateX(calc(var(--libmedia-ui-chapter-width) / -2));background-color:var(--libmedia-ui-chapter-color);width:var(--libmedia-ui-chapter-width);height:100%;position:absolute}.avplayer-ui-progress .avplayer-ui-progress-inner .avplayer-ui-progress-tip{border-radius:var(--libmedia-ui-border-radius);white-space:nowrap;background-color:var(--libmedia-ui-tip-background);transform:translateX(-50%);padding:3px 5px;font-size:12px;line-height:1;display:none;position:absolute;top:-25px;left:0}.avplayer-ui-progress .libmedia-ui-progress-thumb{bottom:calc(var(--libmedia-ui-bottom-gap) + 10px);border-radius:var(--libmedia-ui-border-radius);pointer-events:none;background-color:var(--libmedia-ui-widget-background);display:none;position:absolute;left:0;box-shadow:0 1px 3px rgba(0,0,0,0.2),0 1px 2px -1px rgba(0,0,0,0.2)}"},9217:t=>{t.exports=".avplayer-ui-settings{pointer-events:auto;background:var(--libmedia-ui-tip-background);border-radius:4px;color:#fff;position:relative;max-height:100%;max-width:80%;width:600px;height:500px;display:flex;flex-direction:column}.avplayer-ui-settings .avplayer-ui-settings-title{border-bottom:1px solid rgba(255,255,255,0.1);font-size:16px;line-height:40px;text-align:center;height:41px}.avplayer-ui-settings .avplayer-ui-settings-close{fill:#fff;color:#fff;cursor:pointer;height:22px;position:absolute;right:10px;top:8px;width:22px}.avplayer-ui-settings .avplayer-ui-settings-panel{flex:1;position:relative;display:flex;overflow:hidden}.avplayer-ui-settings .avplayer-ui-settings-panel .avplayer-ui-settings-tabs{width:141px;height:100%;padding:20px;overflow:auto;transition:all var(--libmedia-ui-transition-duration) ease;border-right:1px solid rgba(255,255,255,0.1)}.avplayer-ui-settings .avplayer-ui-settings-panel .avplayer-ui-settings-tabs .avplayer-ui-settings-tab{width:100px;height:36px;text-align:center;line-height:36px;cursor:pointer;border-radius:4px;font-size:14px;opacity:var(--libmedia-ui-control-opacity);background-color:var(--libmedia-ui-widget-hover-background)}.avplayer-ui-settings .avplayer-ui-settings-panel .avplayer-ui-settings-tabs .avplayer-ui-settings-tab:hover{opacity:1}.avplayer-ui-settings .avplayer-ui-settings-panel .avplayer-ui-settings-tabs .avplayer-ui-settings-tab.active{opacity:1;background-color:var(--libmedia-ui-theme)}.avplayer-ui-settings .avplayer-ui-settings-panel .avplayer-ui-settings-tabs .avplayer-ui-settings-tab + .avplayer-ui-settings-tab{margin-top:10px}.avplayer-ui-settings .avplayer-ui-settings-panel .avplayer-ui-settings-context{flex:1;height:100%;overflow:auto;padding:20px}"},92246:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var r=i(134),s=i(16030),a=i(4624);class n{constructor(t){(0,r.A)(this,"resampler",void 0),(0,r.A)(this,"options",void 0),(0,r.A)(this,"inputParameters",void 0),(0,r.A)(this,"outputParameters",void 0),this.options=t,this.resampler=new s.A(this.options.resource)}async open(t,e){this.inputParameters=t,this.outputParameters=e,await this.resampler.run(),this.resampler.call("resample_set_input_parameters",t.sampleRate,t.channels,t.format,t.layout||0),this.resampler.call("resample_set_output_parameters",e.sampleRate,e.channels,e.format,e.layout||0);let i=this.resampler.call("resample_init");i<0&&a.h2(`open resampler failed, ret: ${i}`,"src/audioresample/Resampler.ts",84)}resample(t,e,i){return this.resampler.call("resample_process",t,e,i)}getOutputSampleCount(t){return this.resampler.call("resample_nb_sample",t)}close(){this.resampler.call("resample_destroy"),this.resampler.destroy(),this.resampler=null}getInputPCMParameters(){return this.inputParameters}getOutputPCMParameters(){return this.outputParameters}}},70089:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(134),s=i(16030);class a{constructor(t){(0,r.A)(this,"processor",void 0),(0,r.A)(this,"options",void 0),this.options=t,this.processor=new s.A(this.options.resource)}async open(t){await this.processor.run(),this.processor.call("stretchpitch_init"),this.processor.call("stretchpitch_set_channels",t.channels),this.processor.call("stretchpitch_set_samplerate",t.sampleRate)}setRate(t){this.processor.call("stretchpitch_set_rate",t)}setRateChange(t){this.processor.call("stretchpitch_set_rate_change",t)}setTempo(t){this.processor.call("stretchpitch_set_tempo",t)}setTempoChange(t){this.processor.call("stretchpitch_set_tempo_change",t)}setPitch(t){this.processor.call("stretchpitch_set_pitch",t)}setPitchOctaves(t){this.processor.call("stretchpitch_set_pitch_octaves",t)}setPitchSemiTones(t){this.processor.call("stretchpitch_set_pitch_semi_tones",t)}sendSamples(t,e){this.processor.call("stretchpitch_send_samples",t,e)}receiveSamples(t,e){return this.processor.call("stretchpitch_receive_samples",t,e)}flush(){this.processor.call("stretchpitch_flush")}clear(){this.processor.call("stretchpitch_clear")}getUnprocessedSamplesCount(){return this.processor.call("stretchpitch_get_unprocessed_samples_num")}getInputOutputSamplesRatio(){return this.processor.call("stretchpitch_get_input_output_sample_ratio")}getLatency(){return this.processor.call("get_latency")}close(){this.processor.call("stretchpitch_destroy"),this.processor.destroy(),this.processor=null}}},53616:(t,e,i)=>{"use strict";i.d(e,{A:()=>u});var r=i(134),s=i(63939),a=i(9705),n=i(26235),o=i(59996),l=i(62624),c=i(9787),h=i(43950);class u{constructor(t){(0,r.A)(this,"options",void 0),(0,r.A)(this,"frame",void 0),(0,r.A)(this,"decoder",void 0),this.options=t}getAVFrame(){return this.frame?this.frame:this.frame={pts:BigInt(0),duration:BigInt(0),rects:[],timeBase:{den:1,num:1}}}outputAVFrame(){this.frame&&(this.options.onReceiveSubtitle&&this.options.onReceiveSubtitle(this.frame),this.frame=null)}receiveAVFrame(){return this.decoder.receiveAVFrame(this.getAVFrame())}async open(t){switch(s.f[15](t+4)){case 94226:this.decoder=new n.A;break;case 94232:this.decoder=new l.A;break;case 94210:case 94225:this.decoder=new h.A;break;case 94213:this.decoder=new c.A;break;case 94212:case 94230:this.decoder=new o.A;break;default:return a.r8}return 0}decode(t){let e=this.decoder.sendAVPacket(t);if(e)return e;for(;;){if(e=this.receiveAVFrame(),1!==e){if(e<0)return e;break}this.outputAVFrame()}return 0}async flush(){for(this.decoder.flush();;){if(this.receiveAVFrame()<1)return;this.outputAVFrame()}}close(){this.frame&&(this.frame=null)}}},59996:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var r=i(134),s=i(63939),a=i(81023),n=i(71517),o=i(50011);class l extends a.A{constructor(){super(),(0,r.A)(this,"queue",void 0),this.queue=[]}sendAVPacket(t){return this.queue.push({data:(0,n.iI)(t).slice(),pts:s.f[17](t+8),duration:s.f[17](t+48),timeBase:{den:s.f[15](t+76),num:s.f[15](t+72)}}),0}receiveAVFrame(t){if(this.queue.length){const e=this.queue.shift();t.pts=e.pts,t.duration=e.duration,t.timeBase.den=e.timeBase.den,t.timeBase.num=e.timeBase.num;let i=o.decode(e.data);return/^\w+?\s*:/.test(i)||(i="Dialogue: "+i),t.rects.push({type:3,text:i,flags:0}),1}return 0}flush(){return 0}}},81023:(t,e,i)=>{"use strict";i.d(e,{A:()=>r});class r{}},43950:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var r=i(134),s=i(63939),a=i(81023),n=i(71517),o=i(50011);class l extends a.A{constructor(){super(),(0,r.A)(this,"queue",void 0),this.queue=[]}sendAVPacket(t){return this.queue.push({data:(0,n.iI)(t).slice(),pts:s.f[17](t+8),duration:s.f[17](t+48),timeBase:{den:s.f[15](t+76),num:s.f[15](t+72)}}),0}receiveAVFrame(t){if(this.queue.length){const e=this.queue.shift();return t.pts=e.pts,t.duration=e.duration,t.timeBase.den=e.timeBase.den,t.timeBase.num=e.timeBase.num,t.rects.push({type:1,text:o.decode(e.data),flags:0}),1}return 0}flush(){return 0}}},9787:(t,e,i)=>{"use strict";i.d(e,{A:()=>c});var r=i(134),s=i(63939),a=i(81023),n=i(71517),o=i(50011),l=i(4624);class c extends a.A{constructor(){super(),(0,r.A)(this,"queue",void 0),this.queue=[]}sendAVPacket(t){const e=(0,n.iI)(t).slice();if(e.length<2)return 0;const i=e[0]<<8|e[1];if(i+2>e.length)return l.R8(`invalid timed text data, need ${i+2} but got ${e.length}, ignore it`,"src/avcodec/subtitle/decoder/TimedTextDecoder.ts",59),0;const r=o.decode(e.subarray(2,2+i));return this.queue.push({text:r,pts:s.f[17](t+8),duration:s.f[17](t+48),timeBase:{den:s.f[15](t+76),num:s.f[15](t+72)}}),0}receiveAVFrame(t){if(this.queue.length){const e=this.queue.shift();return t.pts=e.pts,t.duration=e.duration,t.timeBase.den=e.timeBase.den,t.timeBase.num=e.timeBase.num,t.rects.push({type:1,text:e.text,flags:0}),1}return 0}flush(){return 0}}},62624:(t,e,i)=>{"use strict";i.d(e,{A:()=>h});var r=i(134),s=i(63939),a=i(81023),n=i(50011),o=i(71517),l=i(77231),c=i(38115);class h extends a.A{constructor(){super(),(0,r.A)(this,"queue",void 0),this.queue=[]}sendAVPacket(t){let e=n.decode((0,o.iI)(t));return e?(/{"use strict";i.d(e,{A:()=>h});var r=i(134),s=i(63939),a=i(81023),n=i(50011),o=i(71517),l=i(54825),c=i(77231);class h extends a.A{constructor(){super(),(0,r.A)(this,"queue",void 0),this.queue=[]}findTimelineTag(t){const e=t.indexOf("<");if(e>=0){const i=t.indexOf(">",e);if(i>e&&/^(\d{2,}:)?\d{2}:\d{2}\.\d{1,3}$/.test(t.substring(e+1,i)))return{start:e,end:i}}return{start:-1,end:-1}}sendAVPacket(t){let e=n.decode((0,o.iI)(t)),i=s.f[17](t+8);const r=i+s.f[17](t+48),a=[];for(;;){const{start:r,end:n}=this.findTimelineTag(e);if(r<0)break;const o=(0,l.j)(e.substring(r+1,n));a.push(e.substring(0,r)),this.queue.push({context:a.join(""),pts:i,duration:o-i,timeBase:{den:s.f[15](t+76),num:s.f[15](t+72)}}),i=o,e=e.substring(n+1)}return a.push(e),this.queue.push({context:a.join(""),pts:i,duration:r-i,timeBase:{den:s.f[15](t+76),num:s.f[15](t+72)}}),0}receiveAVFrame(t){if(this.queue.length){const e=this.queue.shift();return t.pts=e.pts,t.duration=e.duration,t.timeBase.den=c.qs,t.timeBase.num=1,t.rects.push({type:2,text:e.context,flags:0}),1}return 0}flush(){return 0}}},75742:(t,e,i)=>{"use strict";i.d(e,{A:()=>f});var r=i(134),s=i(11473),a=i(16030),n=i(56024),o=i(4624),l=i(95797),c=(i(56490),i(95335)),h=i(73749),u=i(67672),d=i(37837);class f{constructor(t){(0,r.A)(this,"options",void 0),(0,r.A)(this,"decoder",void 0),(0,r.A)(this,"frame",void 0),(0,r.A)(this,"decoderOptions",0),this.options=t,this.decoder=new a.A(t.resource)}getAVFrame(){return this.frame?this.frame:this.frame=this.options.avframePool?this.options.avframePool.alloc():(0,n.FP)()}outputAVFrame(){this.frame&&(this.options.onReceiveFrame?this.options.onReceiveFrame(this.frame):this.options.avframePool?this.options.avframePool.release(this.frame):(0,n.xj)(this.frame),this.frame=0)}receiveAVFrame(){return this.decoder.call("decoder_receive",this.getAVFrame())}async open(t,e={}){await this.decoder.run(),c.HP(e).length&&(this.decoderOptions&&(h.AO(this.decoderOptions),s.s_.free(this.decoderOptions),this.decoderOptions=0),this.decoderOptions=(0,d.Gy)(8),c.__(e,((t,e)=>{(u.Yj(t)||u.Yj(e))&&h.a5(this.decoderOptions,e,t)})));let i=0;l.A.jspi?i=await this.decoder.callAsync("decoder_open",t,0,1,this.decoderOptions):(i=this.decoder.call("decoder_open",t,0,1,this.decoderOptions),await this.decoder.childThreadsReady()),i<0&&o.h2(`open audio decoder failed, ret: ${i}`,"src/avcodec/wasmcodec/AudioDecoder.ts",113)}decode(t){let e=this.decoder.call("decoder_decode",t);if(e)return e;for(;;){if(e=this.receiveAVFrame(),1!==e){if(e<0)return e;break}this.outputAVFrame()}return 0}async flush(){for(this.decoder.call("decoder_flush");;){if(this.receiveAVFrame()<1)return;this.outputAVFrame()}}close(){this.decoder.call("decoder_close"),this.decoder.destroy(),this.decoder=null,this.frame&&(this.options.avframePool?this.options.avframePool.release(this.frame):(0,n.xj)(this.frame),this.frame=0),this.decoderOptions&&(h.AO(this.decoderOptions),s.s_.free(this.decoderOptions),this.decoderOptions=0)}}},40417:(t,e,i)=>{"use strict";i.d(e,{A:()=>f});var r=i(134),s=i(11473),a=i(16030),n=i(56024),o=i(4624),l=i(95797),c=(i(56490),i(95335)),h=i(73749),u=i(67672),d=i(37837);class f{constructor(t){(0,r.A)(this,"options",void 0),(0,r.A)(this,"decoder",void 0),(0,r.A)(this,"frame",void 0),(0,r.A)(this,"parameters",void 0),(0,r.A)(this,"decoderOptions",0),this.options=t,this.decoder=new a.A(this.options.resource)}getAVFrame(){return this.frame?this.frame:this.frame=this.options.avframePool?this.options.avframePool.alloc():(0,n.FP)()}outputAVFrame(){this.frame&&(this.options.onReceiveFrame?this.options.onReceiveFrame(this.frame):this.options.avframePool?this.options.avframePool.release(this.frame):(0,n.xj)(this.frame),this.frame=0)}receiveAVFrame(){return this.decoder.call("decoder_receive",this.getAVFrame())}async open(t,e=1,i={}){await this.decoder.run(null,e);let r=0;c.HP(i).length&&(this.decoderOptions&&(h.AO(this.decoderOptions),s.s_.free(this.decoderOptions),this.decoderOptions=0),this.decoderOptions=(0,d.Gy)(8),c.__(i,((t,e)=>{(u.Yj(t)||u.Yj(e))&&h.a5(this.decoderOptions,e,t)}))),l.A.jspi?r=await this.decoder.callAsync("decoder_open",t,0,e,this.decoderOptions):(r=this.decoder.call("decoder_open",t,0,e,this.decoderOptions),await this.decoder.childThreadsReady()),r<0&&o.h2(`open video decoder failed, ret: ${r}`,"src/avcodec/wasmcodec/VideoDecoder.ts",151),this.parameters=t}decode(t){let e=this.decoder.call("decoder_decode",t);if(e)return e;for(;;){if(e=this.receiveAVFrame(),1!==e){if(e<0)return e;break}this.outputAVFrame()}return 0}async flush(){for(this.decoder.call("decoder_flush");;){if(this.receiveAVFrame()<1)return;this.outputAVFrame()}}close(){this.decoder.call("decoder_close"),this.decoder.destroy(),this.decoder=null,this.frame&&(this.options.avframePool?this.options.avframePool.release(this.frame):(0,n.xj)(this.frame),this.frame=0),this.parameters=0,this.decoderOptions&&(h.AO(this.decoderOptions),s.s_.free(this.decoderOptions),this.decoderOptions=0)}setSkipFrameDiscard(t){this.decoder.call("decoder_discard",t)}}},77104:(t,e,i)=>{"use strict";i.d(e,{A:()=>h});var r=i(134),s=i(63939),a=i(79756),n=i(14686),o=i(71517),l=i(22898),c=i(4624);class h{constructor(t){(0,r.A)(this,"options",void 0),(0,r.A)(this,"decoder",void 0),(0,r.A)(this,"parameters",void 0),(0,r.A)(this,"extradata",void 0),(0,r.A)(this,"currentError",void 0),this.options=t}output(t){this.options.onReceiveFrame?this.options.onReceiveFrame(t):t.close()}error(t){this.currentError=t,this.options.onError(t)}async open(t){this.currentError=null,this.parameters=t,this.extradata=null,0!==s.f[20](t+12)&&(this.extradata=(0,n.s3)(s.f[20](t+12),s.f[15](t+16)).slice());const e={codec:(0,a.A)(this.parameters),sampleRate:s.f[15](t+136),numberOfChannels:s.f[15](t+116),description:this.extradata};if(e.description||delete e.description,!(await AudioDecoder.isConfigSupported(e)).supported)throw new Error("not support");if(this.decoder&&"closed"!==this.decoder.state&&this.decoder.close(),this.decoder=new AudioDecoder({output:this.output.bind(this),error:this.error.bind(this)}),this.decoder.reset(),this.decoder.configure(e),this.currentError)throw this.currentError}changeExtraData(t){if(t.length===this.extradata.length){let e=!0;for(let i=0;i{"use strict";i.d(e,{A:()=>f});var r=i(134),s=i(63939),a=i(86834),n=i(28875),o=i(14686),l=i(71517),c=i(39365),h=i(28917),u=i(4624),d=i(44690);class f{constructor(t){(0,r.A)(this,"decoder",void 0),(0,r.A)(this,"options",void 0),(0,r.A)(this,"parameters",void 0),(0,r.A)(this,"extradata",void 0),(0,r.A)(this,"currentError",void 0),(0,r.A)(this,"inputQueue",void 0),(0,r.A)(this,"outputQueue",void 0),(0,r.A)(this,"sort",void 0),(0,r.A)(this,"keyframeRequire",void 0),this.options=t,this.inputQueue=[],this.outputQueue=[],this.sort=a.A.safari||d.A.ios}async output(t){if(this.sort){let e=0;for(;et.timestamp){this.outputQueue.splice(e,0,t);break}for(e===this.outputQueue.length&&this.outputQueue.push(t);this.outputQueue.length>2&&this.outputQueue[0].timestamp===this.inputQueue[0];){const t=this.outputQueue.shift();this.options.onReceiveFrame?this.options.onReceiveFrame(t):t.close(),this.inputQueue.shift()}}else this.options.onReceiveFrame?this.options.onReceiveFrame(t):t.close()}error(t){this.currentError=t,this.options.onError(t)}changeExtraData(t){var e;if(t.length===this.extradata.length){let e=!0;for(let i=0;ir){this.inputQueue.splice(t,0,r);break}t===this.inputQueue.length&&this.inputQueue.push(r)}try{this.decoder.decode(a)}catch(t){return u.z3(`decode error, ${t}`,"src/avcodec/webcodec/VideoDecoder.ts",225),-1}return i&&(this.keyframeRequire=!1),0}async flush(){if(await this.decoder.flush(),this.sort)for(;this.outputQueue.length;){const t=this.outputQueue.shift();this.options.onReceiveFrame?this.options.onReceiveFrame(t):t.close()}this.keyframeRequire=!0}close(){var t;this.decoder&&"closed"!==this.decoder.state&&this.decoder.close(),this.decoder=null,this.currentError=null,null!==(t=this.outputQueue)&&void 0!==t&&t.length&&this.outputQueue.forEach((t=>{t.close()})),this.inputQueue=null,this.outputQueue=null}getQueueLength(){return this.decoder.decodeQueueSize}setSkipFrameDiscard(t){}static async isSupported(t,e){let i=null;0!==s.f[20](t+12)&&(i=(0,o.s3)(s.f[20](t+12),s.f[15](t+16)).slice());const r={codec:(0,n.A)(t),codedWidth:s.f[15](t+56),codedHeight:s.f[15](t+60),description:2!==s.f[15](t+160)?i:void 0,hardwareAcceleration:(0,c.C)(null==e||e)};return r.description||delete r.description,(await VideoDecoder.isConfigSupported(r)).supported}}},44315:(t,e,i)=>{"use strict";i.d(e,{Xv:()=>p,fG:()=>m,oD:()=>f});var r=i(134),s=i(63939),a=i(50932),n=i(68960),o=i(71517),l=i(7417),c=i(73783);const h=l.z1(4,4),u=l.z1(4,4);class d{constructor(){(0,r.A)(this,"packetBuffer",void 0),this.packetBuffer=[]}}class f{constructor(){(0,r.A)(this,"metadataHeaderPadding",-1),(0,r.A)(this,"metadata",void 0),(0,r.A)(this,"streams",void 0),(0,r.A)(this,"options",void 0),(0,r.A)(this,"chapters",void 0),(0,r.A)(this,"privateData",void 0),(0,r.A)(this,"processPrivateData",void 0),(0,r.A)(this,"iformat",void 0),(0,r.A)(this,"oformat",void 0),(0,r.A)(this,"ioReader",void 0),(0,r.A)(this,"ioWriter",void 0),(0,r.A)(this,"errorFlag",void 0),(0,r.A)(this,"interval",void 0),(0,r.A)(this,"streamIndex",void 0),(0,r.A)(this,"getDecoderResource",null),this.streams=[],this.errorFlag=0,this.streamIndex=0,this.interval=new d,this.options={},this.privateData={},this.metadata={},this.chapters=[]}get format(){return this.iformat?this.iformat.type:this.oformat?this.oformat.type:-1}getStreamById(t){return this.streams.find((e=>e.id===t))}getStreamByIndex(t){return this.streams.find((e=>e.index===t))}getStreamByMediaType(t){return this.streams.find((e=>{var i;return(null===(i=e.codecpar)||void 0===i?void 0:i.codecType)===t}))}createStream(){const t=new n.A;return t.index=this.streamIndex++,(0,c.s2)(u),t.id=s.f[15](h),a.M[15](h,t.id+1),(0,c.Tl)(u),this.removeStreamByIndex(t.index),this.streams.push(t),t}addStream(t){this.removeStreamByIndex(t.index),this.streams.push(t)}removeStream(t){this.removeStreamByIndex(t.index)}removeStreamById(t){const e=this.streams.findIndex((e=>e.id===t));if(e>-1){const t=this.streams.splice(e,1);t[0]&&t[0].destroy()}}removeStreamByIndex(t){const e=this.streams.findIndex((e=>e.index===t));if(e>-1){const t=this.streams.splice(e,1);t[0]&&t[0].destroy()}}async destroy(){this.oformat&&this.oformat.destroy(this),this.iformat&&await this.iformat.destroy(this),this.interval.packetBuffer.length&&this.interval.packetBuffer.forEach((t=>{(0,o.Qe)(t)})),this.streams.forEach((t=>{t.destroy()})),this.streams=[],this.interval=null,this.ioReader=this.ioWriter=null,this.oformat=this.iformat=null}}function p(){return new f}function m(){return new f}},64436:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var r=i(134),s=i(63939),a=(i(77162),i(37837)),n=i(71766);class o{constructor(){(0,r.A)(this,"inCodecpar",void 0),(0,r.A)(this,"inTimeBase",void 0),(0,r.A)(this,"outCodecpar",void 0)}init(t,e){return this.inCodecpar=(0,a.Gy)(168),(0,n.Yi)(this.inCodecpar,t),this.inTimeBase={den:s.f[15](e+4),num:s.f[15](e)},0}destroy(){this.inCodecpar&&((0,n.dn)(this.inCodecpar),this.inCodecpar=0)}}},26173:(t,e,i)=>{"use strict";i.d(e,{A:()=>g});var r=i(134),s=i(63939),a=i(50932),n=i(64436),o=i(71517),l=i(62815),c=i(67659),h=i(59166),u=i(14686),d=i(9705),f=i(60264),p=i(37837),m=i(4624);class g extends n.A{constructor(...t){super(...t),(0,r.A)(this,"cache",void 0),(0,r.A)(this,"cached",void 0)}init(t,e){return super.init(t,e),this.cache=(0,o._5)(),this.cached=!1,0}destroy(){super.destroy(),(0,o.Qe)(this.cache),this.cache=0}sendAVPacket(t){const e=(0,u.JW)(s.f[20](t+24),s.f[15](t+28));if(1!==s.f[15](t+80)&&(0,f.Bs)(e)){let i;if((0,o.zu)(this.cache,t),27===s.f[15](this.inCodecpar+4)?i=l.oT(e):173===s.f[15](this.inCodecpar+4)?i=c.oT(e):196===s.f[15](this.inCodecpar+4)?i=h.oT(e):m.h2(`not support for codecId: ${s.f[15](this.inCodecpar+4)}`,"src/avformat/bsf/h2645/Annexb2AvccFilter.ts",91),a.M[15](this.cache+80,1),(0,o.NX)(this.cache,i.bufferPointer,i.length),i.key&&a.M[15](this.cache+36,1|s.f[15](this.cache+36)),i.extradata){const t=(0,p.sY)(i.extradata.length);(0,u.lW)(t,i.extradata.length,i.extradata),(0,o.Ow)(this.cache,1,t,i.extradata.length)}}else(0,o.rN)(this.cache,t);return this.cached=!0,0}receiveAVPacket(t){return this.cached?((0,o.Up)(t),(0,o.rN)(t,this.cache),this.cached=!1,0):d.LR}reset(){return 0}}},16160:(t,e,i)=>{"use strict";i.d(e,{V:()=>s,v:()=>r});const r=256e3,s=BigInt(5e3)},75:(t,e,i)=>{"use strict";i.d(e,{Cj:()=>I,Ib:()=>k,ho:()=>w,jF:()=>S});var r=i(61499),s=i(63939),a=i(36981),n=i(29170),o=i(9599),l=i(95335),c=i(72739),h=i(77231),u=i(31425),d=i(44328),f=i(71517),p=i(16160),m=i(9705),g=i(4624),v=i(40417),y=i(75742),A=i(56024);const b="src/avformat/demux.ts",x={fastOpen:!1,maxAnalyzeDuration:1e3};async function w(t,e={}){const i=l.X$({},x,e);return t.ioReader||g.h2("need IOReader",b,71),t.iformat||g.h2("need iformat",b,74),2===t.iformat.type&&(i.maxAnalyzeDuration=Math.max(i.maxAnalyzeDuration,2e3)),t.iformat.init(t),t.options=i,t.iformat.readHeader(t)}async function k(t){const e=t.iformat.getAnalyzeStreamsCount(),i={},m={},g={};let b=0;const x=[];let w=0;const k={},T={};function _(){if(!t.getDecoderResource)return!0;for(let e=0;e=e&&(0,u.$)(t)&&t.options.fastOpen&&_());){b||(b=(0,f._5)());let e=!1;if(w=await I(t,b),0!==w)break;const c=t.getStreamByIndex(s.f[15](b+32));if(s.f[15](b+28)&&(e=!0,x.push(b),i[c.index]||(c.firstDTS=s.f[17](b+16),c.startTime=s.f[17](b+8),i[c.index]=!0),s.f[17](b+8){c.codecpar.format=s.f[15](t+80),c.codecpar.frameSize=s.f[15](t+76),c.codecpar.sampleRate=s.f[15](t+152),c.codecpar.chLayout=(0,n.A)(t+288,a.r),(0,A.xj)(t),T[c.index]=!0},onError:()=>{T[c.index]=!0}}):0===c.codecpar.codecType&&(i.threadModule&&delete i.threadModule,e=new v.A({resource:i,onReceiveFrame:t=>{c.codecpar.format=s.f[15](t+80),c.codecpar.colorSpace=s.f[15](t+220),c.codecpar.colorPrimaries=s.f[15](t+212),c.codecpar.colorTrc=s.f[15](t+216),c.codecpar.chromaLocation=s.f[15](t+224),c.codecpar.sampleAspectRatio=(0,n.A)(t+92,o.P),c.codecpar.width=s.f[15](t+68),c.codecpar.height=s.f[15](t+72),(0,A.xj)(t),T[c.index]=!0},onError:()=>{T[c.index]=!0}})),await e.open(c.codecpar[r.o9]),k[c.index]=e)}e&&e.decode(b)}if(m[c.index]&&12===m[c.index].length){let t=BigInt(0);for(let e=1;e0)c.codecpar.frameSize=Math.round(e/c.timeBase.den*c.timeBase.num*c.codecpar.sampleRate);else if(0===c.codecpar.codecType){const t=c.timeBase.den*c.timeBase.num/e;c.codecpar.framerate.num=Math.round(t),c.codecpar.framerate.den=1}const i=Number(s.f[17](b+16)-c.firstDTS)*c.timeBase.num/c.timeBase.den;i&&(c.codecpar.bitrate=BigInt(Math.floor(8*g[c.index]/i)))}if(c.firstDTS!==h.Dh&&s.f[17](b+16)-c.firstDTS>(0,d.k)(BigInt(Math.floor(t.options.maxAnalyzeDuration)),h.i0,c.timeBase)){l.__(m,((e,i)=>{const r=t.getStreamByIndex(+i);if(e&&e.length>1){let t=BigInt(0);for(let i=1;i0)r.codecpar.frameSize=Math.round(i/r.timeBase.den*r.timeBase.num*r.codecpar.sampleRate);else if(0===r.codecpar.codecType){const t=r.timeBase.den*r.timeBase.num/i;r.codecpar.framerate.num=Math.round(t),r.codecpar.framerate.den=1}const a=Number(s.f[17](b+16)-r.firstDTS)*r.timeBase.num/r.timeBase.den;a&&(r.codecpar.bitrate=BigInt(Math.floor(8*g[r.index]/a)))}})),e&&(b=0);break}e&&(b=0)}return b&&(0,f.Qe)(b),x.length&&(t.interval.packetBuffer=x.concat(t.interval.packetBuffer)),l.__(k,(t=>{t&&t.close()})),-1048576===w?0:0!==w?w:(2===t.iformat.type&&1&t.ioReader.flags&&await async function(t){const e=await t.ioReader.fileSize();if(e<=BigInt(0))return;const i=t.interval.packetBuffer;t.interval.packetBuffer=[];let r=t.ioReader.getPos(),a=0;for(;a<4;){const i=e-BigInt(Math.floor(p.v<BigInt(0)&&(r=n);const o={},l=(0,f._5)();for(;!(await I(t,l)<0);){let e=s.f[17](l+8);const i=t.getStreamByIndex(s.f[15](l+32));i.startTime!==h.Dh?e-=i.startTime:e-=i.firstDTS,e>BigInt(0)&&((i.duration===h.Dh||!o[s.f[15](l+32)]||i.duration{if(t.duration===h.Dh)return u=!1,!1})),u)break;a++}c.__(t.interval.packetBuffer,(t=>{(0,f.Qe)(t)})),t.interval.packetBuffer=i,await t.iformat.seek(t,null,r,2)}(t),0)}function T(t,e){const i=c.El(t.sampleIndexes,(t=>t.pts-1?(t.sampleIndexesPosMap.set(s.f[17](e+56),i),t.sampleIndexes.splice(i,0,r)):(t.sampleIndexesPosMap.set(s.f[17](e+56),t.sampleIndexes.length),t.sampleIndexes.push(r))}async function _(t,e){const i=t.getStreamByIndex(s.f[15](e+32));let r=0;if(i&&(27===i.codecpar.codecId||173===i.codecpar.codecId||196===i.codecpar.codecId||86018===i.codecpar.codecId))if(!s.f[15](e+28)&&(0,f.fQ)(e,1))for(;;){const i=(0,f._5)();if(r=await t.iformat.readAVPacket(t,i),0!==r){if(t.interval.packetBuffer.length){let i=t.interval.packetBuffer.shift();return(0,f.Up)(e),(0,f.rN)(e,i),(0,f.Qe)(i),_(t,e)}return r}if(s.f[15](i+32)!==s.f[15](e+32))t.interval.packetBuffer.push(i);else{if(s.f[15](i+28))return(0,f.Zx)(e,i),(0,f.Qe)(i),0;(0,f.Up)(e),(0,f.rN)(e,i),(0,f.Qe)(i)}}else if(32&s.f[15](e+36))return I(t,e);if(1&t.ioReader.flags&&!i.sampleIndexesPosMap.has(s.f[17](e+56)))if(0===i.codecpar.codecType)1&s.f[15](e+36)&&T(i,e);else if(1===i.codecpar.codecType){const t=c.El(i.sampleIndexes,(t=>t.pts=p.V||t>0&&t=p.V||0===t&&(0,d.k)(i.sampleIndexes[0].pts-s.f[17](e+8),(0,n.A)(e+72,o.P),h.i0)>=p.V)&&T(i,e)}return 0}async function I(t,e){let i=0;if((0,f.Up)(e),t.interval.packetBuffer.length){const i=t.interval.packetBuffer.shift();return(0,f.rN)(e,i),(0,f.Qe)(i),_(t,e)}return i=await t.iformat.readAVPacket(t,e),0!==i?((0,f.Up)(e),i):_(t,e)}async function S(t,e,i,r){let s=e>-1?t.streams.find((t=>t.index===e)):null;if(s||(s=t.getStreamByMediaType(0),s||(s=t.getStreamByMediaType(1)),s||(s=t.getStreamByMediaType(3))),!s)return g.z3(`not found any stream to seek, streamIndex: ${s.index}`,b,577),BigInt(m.LR);g.Yz(`seek in ${0===s.codecpar.codecType?"video":"audio"} stream, streamIndex: ${s.index}, timestamp: ${i}, flags: ${r}`,b,581),i=(0,d.k)(i,h.i0,s.timeBase);const a=await t.iformat.seek(t,s,i,r);return a>=BigInt(0)?(c.__(t.interval.packetBuffer,(t=>{(0,f.Qe)(t)})),t.interval.packetBuffer.length=0,BigInt(0)):a}},548:(t,e,i)=>{"use strict";i.d(e,{Ay:()=>C,L_:()=>S,eG:()=>I,yl:()=>_});var r=i(69736),s=i.n(r),a=i(61499),n=i(63939),o=i(9599),l=i(29170),c=i(44315),h=i(95335),u=i(62751),d=i(67672),f=i(44328),p=i(77231),m=i(20525),g=i(62100),v=i(95832),y=i(62815),A=i(67659),b=i(21477),x=i(82014),w=i(64093);function k(t){t<0&&(t=BigInt(0));const e=Number(BigInt.asIntN(32,t%BigInt(1e3))),i=Number(BigInt.asIntN(32,t/BigInt(1e3)%BigInt(60))),r=Number(BigInt.asIntN(32,t/BigInt(1e3)/BigInt(60)%BigInt(60))),s=Number(BigInt.asIntN(32,t/BigInt(1e3)/BigInt(3600)));return m.GP("%02d:%02d:%02d.%03d",s,r,i,e)}function T(t){return t{if(e===t)return r=i,!1})),r}function I(t,e){return 1===t?_(u.n1,e):0===t?_(u._R,e):3===t?_(u.Xp,e):"unknown"}function S(t){return _(u.iW,t)}function P(t,e){switch(t){case 86018:return v.uF[e]||"LC";case 86017:return w.He[e]||"Layer3";case 27:return y.tZ[e]||"High";case 173:return A.dT[e]||"Main";case 225:return b.zk[e]||"Main";case 167:return x.wN[e]||"Profile0"}}function C(t,e){let i="";return t.forEach(((t,r)=>{if(t instanceof c.oD){const e=[];for(let i=0;i{d.Ik(t)&&d.YO(t)||(r+=` ${e}: ${t}\n`)})));let a=BigInt(0),c=BigInt(0),m=-BigInt(1);return t.streams.forEach((t=>{const e=(0,f.k)(t.duration,t.timeBase,p.i0),i=(0,f.k)(t.startTime,t.timeBase,p.i0);e>a&&(a=e),(i{r+=function(t,e,i){const r=_(u.Mb,n.f[15](t.codecpar)),a=[];if(1===n.f[15](t.codecpar)){const e=P(n.f[15](t.codecpar+4),n.f[15](t.codecpar+48)),i=_(u.n1,n.f[15](t.codecpar+4));a.push(`${i}${e?` (${e})`:""}`),a.push(`${n.f[15](t.codecpar+136)} Hz`);let r=`${n.f[15](t.codecpar+116)} channels`;1===n.f[15](t.codecpar+116)?r="mono":2===n.f[15](t.codecpar+116)&&(r="stereo"),a.push(r),a.push(_(u.Sz,n.f[15](t.codecpar+28))),n.f[17](t.codecpar+32)>BigInt(0)&&a.push(`${T(n.f[17](t.codecpar+32))}`)}else if(0===n.f[15](t.codecpar)){const e=P(n.f[15](t.codecpar+4),n.f[15](t.codecpar+48)),i=_(u._R,n.f[15](t.codecpar+4));if(a.push(`${i}${e?` (${e})`:""}`),n.f[15](t.codecpar+28)!==p.N_){const e=_(u.qO,n.f[15](t.codecpar+28)),i=_(u.mX,n.f[15](t.codecpar+84),"tv"),r=_(u._m,n.f[15](t.codecpar+96),"bt709");a.push(`${e}(${i}, ${r})`)}const r={num:n.f[15](t.codecpar+56)*n.f[15](t.codecpar+64),den:n.f[15](t.codecpar+60)*n.f[15](t.codecpar+68)};(0,f.iU)(r),a.push(`${n.f[15](t.codecpar+56)}x${n.f[15](t.codecpar+60)} [SAR: ${n.f[15](t.codecpar+64)}:${n.f[15](t.codecpar+68)} DAR ${r.num}:${r.den}]`),n.f[17](t.codecpar+32)>BigInt(0)&&a.push(`${T(n.f[17](t.codecpar+32))}`),(0,f.lb)((0,l.A)(t.codecpar+72,o.P))>0&&(a.push(`${(0,f.lb)((0,l.A)(t.codecpar+72,o.P)).toFixed(2)} fps`),a.push(`${(0,f.lb)((0,l.A)(t.codecpar+72,o.P)).toFixed(2)} tbr`)),a.push(`${c=BigInt(Math.floor((0,f.lb)({num:t.timeBase.den,den:t.timeBase.num}))),cBigInt(0)&&a.push(`${T(n.f[17](t.codecpar+32))}`)}else n.f[17](t.codecpar+32)>BigInt(0)&&a.push(`${T(n.f[17](t.codecpar+32))}`);var c;let m="";t.disposition&&(m=" ",1&t.disposition&&(m+=`(${_(u.Ki,1)}) `),2&t.disposition&&(m+=`(${_(u.Ki,2)}) `),4&t.disposition&&(m+=`(${_(u.Ki,4)}) `),8&t.disposition&&(m+=`(${_(u.Ki,8)}) `),16&t.disposition&&(m+=`(${_(u.Ki,16)}) `),32&t.disposition&&(m+=`(${_(u.Ki,32)}) `),64&t.disposition&&(m+=`(${_(u.Ki,64)}) `),128&t.disposition&&(m+=`(${_(u.Ki,128)}) `),256&t.disposition&&(m+=`(${_(u.Ki,256)}) `),512&t.disposition&&(m+=`(${_(u.Ki,512)}) `),1024&t.disposition&&(m+=`(${_(u.Ki,1024)}) `),2048&t.disposition&&(m+=`(${_(u.Ki,2048)}) `),65536&t.disposition&&(m+=`(${_(u.Ki,65536)}) `),131072&t.disposition&&(m+=`(${_(u.Ki,131072)}) `),262144&t.disposition&&(m+=`(${_(u.Ki,262144)}) `),524288&t.disposition&&(m+=`(${_(u.Ki,524288)}) `),1048576&t.disposition&&(m+=`(${_(u.Ki,1048576)}) `));let v=`${i}Stream #${e}:${t.index} ${r}: ${a.join(", ")}${m}\n`;return s()(t.metadata).length&&(v+=`${i} Metadata:\n`,h.__(t.metadata,((e,r)=>{d.Ik(e)||d.YO(e)?"matrix"===r&&0===n.f[15](t.codecpar)&&(v+=`${i} ${r}: [${e.toString()}]\n`):v+=`${i} ${r}: ${e}\n`}))),v}(t,e," ")})),r}(t,r,e[r])})),i}},51597:(t,e,i)=>{"use strict";i.d(e,{A:()=>s,E:()=>a});var r=i(134);class s{constructor(){(0,r.A)(this,"type",-1)}async destroy(t){}}const a={15:[86018],10:[86017,86019,86018,12,27],17:[86028],0:[86017,86018,86051,69645,86049,65543,65542,12,27,173,225,167,196],5:[139,167],8:[86021,86076,86018,86017,86028,86032,86020,86056,65557,65537,65536,139,167,225,27,173,196,12,30,94226],9:[86021,86076,139,167,225,94226],1:[86021,86076,86018,86017,86028,86051,86019,86056,167,225,27,173,196,12,94226,94213],14:[86017],2:[86076,86018,86017,86019,,86020,86065,86056,12,225,27,173,196],3:[86058,86016,86017,86019,,86020,2,12,27,173,196],4:[86021,86076,86028,86051],16:[],18:[94226],20:[94230,94212],19:[94225],21:[94232],11:[27],12:[173],13:[196],6:[86076,86018,86017,65543,65542,2,12,27,173,139,167,225],7:[86017,86018,86051,69645,86049,65543,65542,12,27,173,225,167,196]}},69765:(t,e,i)=>{"use strict";i.d(e,{A:()=>B});var r=i(134),s=i(61499),a=i(63939),n=i(9599),o=i(29170),l=i(51597),c=i(9690),h=i(65977),u=i(75473),d=i(38106),f=i(3384),p=i(35336),m=i(72739),g=i(4624),v=i(92647),y=i(79804),A=i(77231),b=i(95335),x=i(20841),w=i(59989),k=i(44328),T=i(71517),_=i(26173),I=i(67672),S=i(87518),P=i(14686);const C="src/avformat/formats/OMovFormat.ts",M={fragmentMode:0,movMode:0,fragment:!1,fastOpen:!1,defaultBaseIsMoof:!1};class B extends l.A{constructor(t={}){super(),(0,r.A)(this,"type",1),(0,r.A)(this,"context",void 0),(0,r.A)(this,"options",void 0),(0,r.A)(this,"annexb2AvccFilter",void 0),this.options=b.X$({},M,t),this.context=(0,c.A)()}init(t){t.ioWriter.setEndian(!0);const e=t.getStreamByMediaType(0);return e&&(this.annexb2AvccFilter=new _.A,this.annexb2AvccFilter.init(e.codecpar[s.o9],e.timeBase[s.o9])),0}async destroy(t){this.annexb2AvccFilter&&(this.annexb2AvccFilter.destroy(),this.annexb2AvccFilter=null)}enableStreams(t){const e=[],i=[];for(let t=0;t<5;t++)e[t]=0,i[t]=-1;m.__(t.streams,((t,r)=>{if(-1===t.codecpar.codecType||t.codecpar.codecType>=5)return!0;i[t.codecpar.codecType]<0&&(i[t.codecpar.codecType]=r),1&t.disposition&&(e[t.codecpar.codecType]++,t.privData.flags|=1)}));for(let r=0;r<5;r++)switch(r){case 0:case 1:case 3:e[r]>1&&(t.streams[e[r]].privData.perStreamGrouping=!0),!e[r]&&i[r]>=0&&(t.streams[i[r]].privData.flags|=1)}}writeHeader(t){if(this.context.majorBrand=(0,h.A)("isom"),this.context.minorVersion=512,this.context.compatibleBrand=[(0,h.A)("isom")],this.context.timescale=1e3,this.options.fragment&&(this.context.compatibleBrand.push((0,h.A)("iso6")),this.context.fragment=!0),1===this.options.movMode&&(this.context.isom=!0,this.context.majorBrand=(0,h.A)("qt "),this.context.compatibleBrand=[this.context.majorBrand]),1!==this.options.movMode){this.context.compatibleBrand.push((0,h.A)("iso2"));const e=t.getStreamByMediaType(0);e&&27===e.codecpar.codecId&&this.context.compatibleBrand.push((0,h.A)("avc1")),this.context.compatibleBrand.push((0,h.A)("mp41"))}if(u.l7(t.ioWriter,this.context),this.context.holdMoovPos=t.ioWriter.getPos(),this.options.fragment)this.context.currentFragment={pos:BigInt(0),currentTrack:null,sequence:1,tracks:[],size:0,firstWrote:!1},m.__(t.streams,((t,e)=>{const i=(0,d.A)();t.privData=i,i.chunkOffsets=[],i.cttsSampleCounts=[],i.cttsSampleOffsets=[],i.stscFirstChunk=[],i.stscSamplesPerChunk=[],i.stscSampleDescriptionIndex=[],i.stssSampleNumbers=[],i.sampleSizes=[],i.sttsSampleCounts=[],i.sttsSampleDeltas=[],i.alternateGroup=e;const r=(0,f.A)();r.baseIsMoof=this.options.defaultBaseIsMoof,r.streamIndex=t.index,r.trackId=this.context.nextTrackId++,i.trackId=r.trackId,r.ioWriter=new p.A,r.ioWriter.onFlush=t=>(r.buffers.push(t.slice()),0),this.context.currentFragment.tracks.push(r)})),this.enableStreams(t),u.dI(t.ioWriter,t,this.context),t.ioWriter.flush();else{m.__(t.streams,((t,e)=>{const i=(0,d.A)();t.privData=i,i.trackId=this.context.nextTrackId++,i.chunkOffsets=[],i.cttsSampleCounts=[],i.cttsSampleOffsets=[],i.stscFirstChunk=[],i.stscSamplesPerChunk=[],i.stscSampleDescriptionIndex=[],i.stssSampleNumbers=[],i.sampleSizes=[],i.sttsSampleCounts=[],i.sttsSampleDeltas=[],i.alternateGroup=e})),this.enableStreams(t);const e=t.ioWriter.getPos();t.ioWriter.writeUint32(0),t.ioWriter.writeUint32((0,h.A)("mdat")),this.context.boxsPositionInfo.push({pos:e,type:"mdat",size:0})}return 0}updateCurrentChunk(t){let e=this.context.currentChunk;if(!e.sampleCount)return;const i=t.streams.find((t=>t.index===e.streamIndex)).privData;i.chunkCount++,i.chunkOffsets.push(e.pos),i.stscFirstChunk.length?i.lastStscCount!==e.sampleCount&&(i.stscFirstChunk.push(i.chunkCount),i.stscSamplesPerChunk.push(e.sampleCount),i.stscSampleDescriptionIndex.push(1),i.lastStscCount=e.sampleCount):(i.stscFirstChunk.push(i.chunkCount),i.stscSamplesPerChunk.push(e.sampleCount),i.stscSampleDescriptionIndex.push(1),i.lastStscCount=e.sampleCount)}checkMdat(t,e){const i=this.context.boxsPositionInfo[this.context.boxsPositionInfo.length-1];if("mdat"!==i.type)return void g.z3("last box is not mdat",C,301);const r=t.ioWriter.getPos(),s=Number(r-i.pos);s+e>A.f7&&(i.size=s,t.ioWriter.writeUint32(0),t.ioWriter.writeUint32((0,h.A)("mdat")),this.context.boxsPositionInfo.push({pos:r,type:"mdat",size:0}))}updateCurrentFragment(t,e){if(this.context.currentFragment.firstWrote){m.__(this.context.currentFragment.tracks,(i=>{const r=t.streams.find((t=>t.index===i.streamIndex));if(!i.sampleCount||!r)return!0;const s=r.privData;var a;i.baseDataOffset=t.ioWriter.getPos(),i.sampleDurations.length?e&&i.sampleDurations.length===i.sampleSizes.length-1&&i.sampleDurations.push(Number(e-s.lastDts)):1===r.codecpar.codecType?e?i.sampleDurations.push(Number(e-s.lastDts)):r.codecpar.frameSize>0?i.sampleDurations.push(Number((0,k.k)(BigInt(r.codecpar.frameSize/r.codecpar.sampleRate*A.SF),A.KR,r.timeBase))):(r.codecpar.codecId,i.sampleDurations.push(Number((0,k.k)(BigInt(1024/r.codecpar.sampleRate*A.SF),A.KR,r.timeBase)))):0===r.codecpar.codecType?e?i.sampleDurations.push(Number(e-s.lastDts)):(0,k.lb)(r.codecpar.framerate)>0?i.sampleDurations.push(Number((0,k.k)(BigInt(Math.floor(1/(0,k.lb)(r.codecpar.framerate)*A.SF)),A.KR,r.timeBase))):i.sampleDurations.push(r.timeBase.den/(30*r.timeBase.num)>>>0):i.sampleDurations.push(0),s.lastDuration=i.sampleDurations[i.sampleSizes.length-1],(1===i.sampleFlags.length||(0,w.A)(i.sampleFlags,1))&&(i.firstSampleFlags=i.sampleFlags[0],i.defaultSampleFlags=null!==(a=i.sampleFlags[1])&&void 0!==a?a:i.firstSampleFlags,i.sampleFlags=[]),(1===i.sampleSizes.length||(0,w.A)(i.sampleSizes))&&(i.defaultSampleSize=i.sampleSizes[0],i.sampleSizes=[]),(1===i.sampleDurations.length||(0,w.A)(i.sampleDurations))&&(i.defaultSampleDuration=i.sampleDurations[0],i.sampleDurations=[]),1===r.codecpar.codecType?i.defaultSampleFlags=33554432:i.sampleFlags.length&&(i.defaultSampleFlags=i.sampleFlags[0]),i.sampleSizes.length&&(i.defaultSampleSize=i.sampleSizes[0]),i.sampleDurations.length&&(i.defaultSampleDuration=i.sampleDurations[0])})),t.ioWriter.flush(),u.Ro(t.ioWriter,t,this.context);let i=this.context.currentFragment.size+8;const r=[];let s=8;m.__(this.context.currentFragment.tracks,(e=>{if(!e.sampleCount)return!0;e.ioWriter.flush();const a=(0,v.A)(Uint8Array,e.buffers);e.dataOffset=i,i+=a.length,s+=a.length,r.push(a),(0,x.A)(t.ioWriter,e.dataOffsetPos,e.dataOffset,"int32"),e.buffers=[],e.sampleFlags=[],e.sampleSizes=[],e.sampleDurations=[],e.sampleCompositionTimeOffset=[],e.sampleCount=0,e.firstSampleFlags=0})),t.ioWriter.writeUint32(s),t.ioWriter.writeUint32((0,h.A)("mdat")),m.__(r,(e=>{t.ioWriter.writeBuffer(e)})),(0,y.A)(t.ioWriter,this.context),t.ioWriter.flush(),this.context.currentFragment.firstWrote=!1,this.context.currentFragment.sequence++}}handleEAC3(t,e){this.context.ac3Info||(this.context.ac3Info={done:!1,numBlocks:0,dataRate:0,ac3BitrateCode:-1,numIndSub:0,substream:[]});const i=this.context.ac3Info,r=S.R((0,P.s3)(a.f[20](t+24),a.f[15](t+28)));if(I.ai(r))i.done=!0;else if(i.dataRate=Math.max(i.dataRate,r.bitrate/1e3),i.ac3BitrateCode=Math.max(i.ac3BitrateCode,r.ac3BitrateCode),!i.done){if(r.bitstreamId<=10&&0!=r.substreamId)return;if(0===r.frameType||2==r.frameType){var s;if(r.substreamId>i.numIndSub+1)return;if(r.substreamId==i.numIndSub+1)return;if(r.substreamIdt.streamIndex===a.f[15](e+32)));if(c){if((0===this.options.fragmentMode&&0===i.codecpar.codecType&&1&a.f[15](e+36)||1===this.options.fragmentMode)&&(1===this.context.currentFragment.tracks.length?this.updateCurrentFragment(t,s):this.updateCurrentFragment(t)),c.ioWriter.writeBuffer((0,T.iI)(e)),c.sampleSizes.length||(c.baseMediaDecodeTime=s),c.sampleSizes.length&&(!c.sampleDurations[c.sampleSizes.length-1]||c.sampleDurations[c.sampleSizes.length-1]<=0)&&(c.sampleDurations[c.sampleSizes.length-1]=Number(s-r.lastDts)),a.f[17](e+48)>0&&c.sampleDurations.push(Number((0,k.k)(a.f[17](e+48),(0,o.A)(e+72,n.P),i.timeBase))),c.sampleSizes.push(a.f[15](e+28)),0===i.codecpar.codecType){let t=0;1&a.f[15](e+36)?t|=33554432:t|=16842752,c.sampleCompositionTimeOffset.push(Number((l||s)-s)),c.sampleFlags.push(t)}c.sampleCount++,r.lastPts=l>r.lastPts?l:r.lastPts,r.lastDts=s,this.context.currentFragment.firstWrote=!0}else g.R8(`can not found track width streamIndex ${a.f[15](e+32)}, ignore it`,C,635)}else{this.checkMdat(t,a.f[15](e+28));const n=t.ioWriter.getPos();let o=this.context.currentChunk;if(o?o.streamIndex!==a.f[15](e+32)?(this.updateCurrentChunk(t),o.streamIndex=a.f[15](e+32),o.sampleCount=1,o.pos=n):o.sampleCount++:o=this.context.currentChunk={pos:n,streamIndex:a.f[15](e+32),sampleCount:1},t.ioWriter.writeBuffer((0,T.iI)(e)),r.sampleSizes.push(a.f[15](e+28)),0===i.codecpar.codecType&&1&a.f[15](e+36)&&r.stssSampleNumbers.push(r.sampleSizes.length),r.firstWrote){const t=Number(s-r.lastDts);r.sttsSampleCounts.length&&r.sttsSampleDeltas[r.sttsSampleDeltas.length-1]===t?r.sttsSampleCounts[r.sttsSampleCounts.length-1]++:(r.sttsSampleCounts.push(1),r.sttsSampleDeltas.push(t))}else r.startDts=s,r.startCT=Number((l||s)-s),r.firstWrote=!0;if(0===i.codecpar.codecType){const t=Number((l||s)-s);r.cttsSampleCounts.length&&r.cttsSampleOffsets[r.cttsSampleOffsets.length-1]===t?r.cttsSampleCounts[r.cttsSampleCounts.length-1]++:(r.cttsSampleCounts.push(1),r.cttsSampleOffsets.push(t))}r.lastPts=(l||s)>r.lastPts?l||s:r.lastPts,r.lastDts=s}return 0}writeTrailer(t){if(this.context.fragment)m.__(this.context.currentFragment.tracks,(e=>{const i=t.streams.find((t=>t.index===e.streamIndex)).privData;e.sampleCount&&(e.sampleDurations.length?e.sampleDurations.push(e.sampleDurations[e.sampleDurations.length-1]):e.sampleDurations=[i.lastDuration])})),this.updateCurrentFragment(t),t.ioWriter.writeUint32(8),t.ioWriter.writeString("mfra"),t.ioWriter.flush();else{this.updateCurrentChunk(t);let e,i=BigInt(0);m.__(t.streams,(t=>{const r=t.privData;r.sampleSizes.length&&(r.sttsSampleDeltas.length?r.sttsSampleCounts[r.sttsSampleCounts.length-1]++:(r.sttsSampleCounts=[1],r.sttsSampleDeltas=[0])),r.lastPts>i&&(i=r.lastPts,e=t.timeBase)})),i&&(this.context.duration=(0,k.k)(i,e,{den:1e3,num:1}));const r=this.context.boxsPositionInfo[this.context.boxsPositionInfo.length-1];if("mdat"!==r.type&&g.z3("last box is not mdat",C,751),r.size=Number(t.ioWriter.getPos()-r.pos),(0,y.A)(t.ioWriter,this.context),this.options.fastOpen){t.ioWriter.flush();let e=[];const i=t.ioWriter.onFlush;t.ioWriter.onFlush=t=>(e.push(t.slice()),0),u.dI(t.ioWriter,t,this.context),t.ioWriter.flush();let r=(0,v.A)(Uint8Array,e);m.__(t.streams,(t=>{const e=t.privData;if(e.chunkOffsets.length)for(let t=0;t{const i=t.streams.find((t=>t.index===e.streamIndex)).privData;e.sampleCount&&(e.sampleDurations.length?e.sampleDurations.push(e.sampleDurations[e.sampleDurations.length-1]):e.sampleDurations=[i.lastDuration])})),this.updateCurrentFragment(t)),t.ioWriter.flush(),0}}},5028:(t,e,i)=>{"use strict";i.d(e,{Q:()=>r});const r=["ReadOrder","Layer","Start","End","Style","Name","MarginL","MarginR","MarginV","Effect","Text"]},51785:(t,e,i)=>{"use strict";i.d(e,{Bp:()=>c,Ew:()=>u,wj:()=>d}),i(7210);var r=i(4624),s=i(5028),a=i(54825),n=i(44453),o=i(93935);const l="src/avformat/formats/ass/iass.ts";function c(t){return function(t,e){const i=e.match(/Format\s*:\s*(.*)/i)[1].split(/\s*,\s*/),s=[];for(let e=0;et.toLowerCase()===i[e].toLowerCase()));a||r.R8(`not support ass field(${i[e]})`,l,40),s.push(a||i[e])}return s}(s.Q,t)}function h(t,e){let i=e.split(",");if(i.length>t.length){const e=i.slice(t.length-1).join(",");i=i.slice(0,t.length-1),i.push(e)}return i}function u(t,e,i,r){const[,,s]=e.match(/^(\w+?)\s*:\s*(.*)/i),n=h(t,s);return{start:(0,a.j)(n[i]),end:(0,a.j)(n[r])}}function d(t,e){const[,i,r]=e.match(/^(\w+?)\s*:\s*(.*)/i);let s=0;switch(i){case"Comment":s=2;break;case"Dialogue":s=1;break;case"Command":s=6;break;case"Movie":s=5;break;case"Picture":s=3;break;case"Sound":s=4}const l=h(t,r),c={type:s};for(let e=0;e{"use strict";i.d(e,{_l:()=>r,gQ:()=>s});const r=["hmhd","nmhd","iods","xml ","url ","bxml","ipro","mere","stts","ctts","stss","stsz","stz2","stsc","stco","co64","stsd","dref","mvhd","tkhd","mdhd","hdlr"],s=["moov","trak","edts","mdia","minf","dinf","stbl","mvex","moof","traf","vttc","tref","iref","mfra","hnti","hinf","strd","sinf","rinf","schi","trgr","udta","iprp","ipco","strk","meco"]},3384:(t,e,i)=>{"use strict";function r(){return{trackId:0,baseDataOffset:BigInt(0),defaultSampleDuration:0,defaultSampleSize:0,defaultSampleFlags:0,baseMediaDecodeTime:BigInt(0),sampleCount:0,dataOffset:0,dataOffsetPos:BigInt(0),firstSampleFlags:0,sampleDurations:[],sampleSizes:[],sampleFlags:[],sampleCompositionTimeOffset:[],baseIsMoof:!1,ioWriter:null,buffers:[]}}i.d(e,{A:()=>r})},9690:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(77231);function s(){return{isom:!1,timescale:r.N_,duration:r.Dh,foundMoov:!1,foundMdat:!1,majorBrand:0,minorVersion:0,compatibleBrand:[],creationTime:BigInt(0),modificationTime:BigInt(0),rate:r.N_,volume:r.N_,matrix:null,nextTrackId:1,fragment:!1,trexs:[],currentFragment:null,boxsPositionInfo:[],holdMoovPos:BigInt(0),currentChunk:null}}},38106:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(77231);function s(){return{chunkOffsets:null,cttsSampleCounts:null,cttsSampleOffsets:null,stscFirstChunk:null,stscSamplesPerChunk:null,stscSampleDescriptionIndex:null,stssSampleNumbersMap:null,stssSampleNumbers:null,sampleSizes:null,sttsSampleCounts:null,sttsSampleDeltas:null,timescale:0,duration:BigInt(0),trackId:r.N_,layer:0,alternateGroup:0,volume:0,matrix:null,width:0,height:0,audioCid:0,samplesPerFrame:0,bytesPerFrame:0,currentSample:0,sampleEnd:!1,samplesIndex:[],fragIndexes:[],lastPts:BigInt(0),lastDts:BigInt(0),startDts:BigInt(0),startCT:0,lastDuration:0,chunkCount:0,firstWrote:!1,lastStscCount:0,perStreamGrouping:!1,index:0,flags:0}}},79804:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(72739);function s(t,e){const i=t.getPos(),s=t.getPointer(),a=i-BigInt(Math.floor(s)),n=[];r.__(e.boxsPositionInfo,(e=>{e.pos=a?(t.seekInline(s+Number(e.pos-i)),t.writeUint32(e.size)):n.push(e)})),r.__(n,(e=>{t.seek(e.pos),t.writeUint32(e.size)})),n.length?t.seek(i):t.seekInline(s),e.boxsPositionInfo=[]}},14202:(t,e,i)=>{"use strict";i.d(e,{BB:()=>s,Ip:()=>a,Jl:()=>r});const r={1:function(t){return[{type:"tkhd"},{type:"mdia",children:[{type:"mdhd"},{type:"hdlr"},{type:"minf",children:[{type:"smhd"},t.isom?{type:"minf_hdlr"}:null,{type:"dinf",children:[{type:"dref",children:[{type:"url "}]}]},{type:"stbl",children:[{type:"stsd"},{type:"stts"},{type:"stsc"},{type:"stsz"},{type:"stco"}]}]}]}]},0:function(t){return[{type:"tkhd"},{type:"mdia",children:[{type:"mdhd"},{type:"hdlr"},{type:"minf",children:[{type:"vmhd"},t.isom?{type:"minf_hdlr"}:null,{type:"dinf",children:[{type:"dref",children:[{type:"url "}]}]},{type:"stbl",children:[{type:"stsd"},{type:"stts"},{type:"stsc"},{type:"stsz"},{type:"stco"}]}]}]}]}},s={1:function(t){return[{type:"tkhd"},{type:"edts"},{type:"mdia",children:[{type:"mdhd"},{type:"hdlr"},{type:"minf",children:[{type:"smhd"},t.isom?{type:"minf_hdlr"}:null,{type:"dinf",children:[{type:"dref",children:[{type:"url "}]}]},{type:"stbl",children:[{type:"stsd"},{type:"stts"},{type:"stsc"},{type:"stsz"},{type:"stco"}]}]}]}]},0:function(t){return[{type:"tkhd"},{type:"edts"},{type:"mdia",children:[{type:"mdhd"},{type:"hdlr"},{type:"minf",children:[{type:"vmhd"},t.isom?{type:"minf_hdlr"}:null,{type:"dinf",children:[{type:"dref",children:[{type:"url "}]}]},{type:"stbl",children:[{type:"stsd"},{type:"stts"},{type:"stss"},{type:"ctts"},{type:"stsc"},{type:"stsz"},{type:"stco"}]}]}]}]}},a=[{type:"tfhd"},{type:"tfdt"},{type:"trun"}]},6660:(t,e,i)=>{"use strict";i.d(e,{Q9:()=>a,f3:()=>n,uf:()=>o,zs:()=>s});var r=i(65977);const s={86018:64,86017:105,86076:173,86028:193,86021:221,12:32,27:33,173:35,196:51,167:177,0:0},a={32:12,33:27,35:173,51:196,177:167,64:86018,102:86018,103:86018,104:86018,105:86017,107:86017,173:86076,193:86028,221:86021,0:0},n={vide:0,soun:1,clcp:3,sbtl:3,subt:3,subp:3,text:3},o={[(0,r.A)("mp4a")]:86018,1836253269:86017,[(0,r.A)("Opus")]:86076,[(0,r.A)("fLaC")]:86028,[(0,r.A)("spex")]:86051,[(0,r.A)("SPXN")]:86051,[(0,r.A)("ac-3")]:86019,[(0,r.A)("sac3")]:86019,[r.A.mp4v]:12,[(0,r.A)("av01")]:225,[(0,r.A)("vp08")]:139,[(0,r.A)("vp09")]:167,[(0,r.A)("avc1")]:27,[(0,r.A)("hev1")]:173,[(0,r.A)("hvc1")]:173,[(0,r.A)("vvc1")]:196,[(0,r.A)("vvi1")]:196,[(0,r.A)("text")]:94213,[(0,r.A)("tx3g")]:94213}},75473:(t,e,i)=>{"use strict";i.d(e,{Ro:()=>d,dI:()=>u,l7:()=>c});var r=i(65977),s=i(21071),a=i(72739),n=i(80025),o=i(14202),l=i(79804);function c(t,e){t.flush();const i=t.getPointer(),s=t.getPos();t.writeUint32(0),t.writeUint32((0,r.A)("ftyp")),t.writeUint32(e.majorBrand||(0,r.A)("isom")),t.writeUint32(e.minorVersion||512),a.__(e.compatibleBrand,(e=>{t.writeUint32(e)})),function(t,e,i){const r=t.getPointer();t.seekInline(e),t.writeUint32(i),t.seekInline(r)}(t,i,Number(t.getPos()-s)),e.isom?(t.writeUint32(8),t.writeUint32((0,r.A)("wide"))):e.fragment||(t.writeUint32(8),t.writeUint32((0,r.A)("free")))}function h(t,e,i,o){a.__(e,(e=>{if(!e)return!0;if(n.A[e.type])n.A[e.type](t,i,o);else if(e.children){const s=t.getPos();t.writeUint32(0),t.writeUint32((0,r.A)(e.type)),h(t,e.children,i,o),o.boxsPositionInfo.push({pos:s,type:e.type,size:Number(t.getPos()-s)})}else!function(t,e){const i=a.zy(s._l,e);t.writeUint32(i?12:8),t.writeUint32((0,r.A)(e)),i&&t.writeUint32(0)}(t,e.type)}))}function u(t,e,i){const s=t.getPos();if(t.writeUint32(0),t.writeUint32((0,r.A)("moov")),n.A.mvhd(t,null,i),a.__(e.streams,(e=>{const s=t.getPos();t.writeUint32(0),t.writeUint32((0,r.A)("trak")),h(t,i.fragment?o.Jl[e.codecpar.codecType](i):o.BB[e.codecpar.codecType](i),e,i),i.boxsPositionInfo.push({pos:s,type:"trak",size:Number(t.getPos()-s)})})),i.fragment){const s=t.getPos();t.writeUint32(0),t.writeUint32((0,r.A)("mvex")),a.__(e.streams,(e=>{n.A.trex(t,e,i)})),i.boxsPositionInfo.push({pos:s,type:"mvex",size:Number(t.getPos()-s)})}i.boxsPositionInfo.push({pos:s,type:"moov",size:Number(t.getPos()-s)}),(0,l.A)(t,i)}function d(t,e,i){const s=t.getPos();t.writeUint32(0),t.writeUint32((0,r.A)("moof")),n.A.mfhd(t,null,i),a.__(i.currentFragment.tracks,(s=>{if(!s.sampleCount)return!0;const a=t.getPos();t.writeUint32(0),t.writeUint32((0,r.A)("traf"));const n=e.streams.find((t=>t.privData.trackId===s.trackId));h(t,o.Ip,n,i),i.boxsPositionInfo.push({pos:a,type:"traf",size:Number(t.getPos()-a)})}));const l=Number(t.getPos()-s);i.boxsPositionInfo.push({pos:s,type:"moof",size:l}),i.currentFragment.size=l}},39878:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(14686);function s(t,e,i){var s;t.writeUint32(8+(null!==(s=e.codecpar.extradataSize)&&void 0!==s?s:0)),t.writeString("av1C"),i.fragment&&e.sideData[1]?(t.writeBuffer(e.sideData[1]),delete e.sideData[1]):e.codecpar.extradata&&t.writeBuffer((0,r.s3)(e.codecpar.extradata,e.codecpar.extradataSize))}},61600:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(14686);function s(t,e,i){var s;t.writeUint32(8+(null!==(s=e.codecpar.extradataSize)&&void 0!==s?s:0)),t.writeString("avcC"),i.fragment&&e.sideData[1]?(t.writeBuffer(e.sideData[1]),delete e.sideData[1]):e.codecpar.extradata&&t.writeBuffer((0,r.s3)(e.codecpar.extradata,e.codecpar.extradataSize))}},93861:(t,e,i)=>{"use strict";function r(t,e,i){t.writeUint32(20),t.writeString("btrt"),t.writeUint32(0),t.writeUint32(0),t.writeUint32(0)}i.d(e,{A:()=>r})},34445:(t,e,i)=>{"use strict";function r(t,e,i){const r=e.privData.chunkOffsets||[];t.writeUint32(8+8*r.length),t.writeString("co64"),t.writeUint8(0),t.writeUint24(0),t.writeUint32(r.length);for(let e=0;er})},853:(t,e,i)=>{"use strict";function r(t,e,i){const r=e.sideData[28];if(r)t.writeUint32(12+r.length),t.writeString("colr"),t.writeString("prof"),t.writeBuffer(r);else{const i=2===e.codecpar.colorRange;t.writeUint32(19),t.writeString("colr"),t.writeString("nclx"),t.writeUint16(e.codecpar.colorPrimaries),t.writeUint16(e.codecpar.colorTrc),t.writeUint16(e.codecpar.colorSpace),t.writeUint8(i?128:0)}}i.d(e,{A:()=>r})},18387:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(4624);const s="src/avformat/formats/mov/writing/ctts.ts";function a(t,e,i){const a=e.privData,n=a.cttsSampleCounts||[],o=a.cttsSampleOffsets||[];n.length!==o.length&&r.R8("ctts sampleCounts's length is not match sampleOffsets's length",s,39);const l=Math.min(n.length,o.length);t.writeUint32(16+8*l),t.writeString("ctts"),t.writeUint8(1),t.writeUint24(0),t.writeUint32(l);for(let e=0;e{"use strict";i.d(e,{A:()=>s});var r=i(83314);function s(t,e,i){t.writeUint32(11),t.writeString("dac3");const s=new r.A(3),a=i.ac3Info;s.writeU(2,a.substream[0].fscod),s.writeU(5,a.substream[0].bsid),s.writeU(3,a.substream[0].bsmod),s.writeU(3,a.substream[0].acmod),s.writeU(1,a.substream[0].lfeon),s.writeU(5,a.ac3BitrateCode),s.writeU(5,0),t.writeBuffer(s.getBuffer())}},55668:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(83314);function s(t,e,i){const s=i.ac3Info,a=new r.A(2+(34*(s.numIndSub+1)+7>>3));a.writeU(13,s.dataRate),a.writeU(3,s.numIndSub);for(let t=0;t{"use strict";i.d(e,{A:()=>n});var r=i(14686),s=i(4624);const a="src/avformat/formats/mov/writing/dfla.ts";function n(t,e,i){let n;i.fragment&&e.sideData[1]?(n=e.sideData[1],delete e.sideData[1]):e.codecpar.extradata&&(n=(0,r.s3)(e.codecpar.extradata,e.codecpar.extradataSize)),n?(t.writeUint32(n.length+16),t.writeString("dfLa"),t.writeUint8(0),t.writeUint24(0),t.writeUint8(128),t.writeUint24(n.length),t.writeBuffer(n)):s.z3("invalid extradata",a,56)}},82181:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(14686),s=i(31865);function a(t,e,i){let a;if(i.fragment&&e.sideData[1]?(a=e.sideData[1],delete e.sideData[1]):e.codecpar.extradata&&(a=(0,r.s3)(e.codecpar.extradata,e.codecpar.extradataSize)),!a||a.length<19)t.writeUint32(19),t.writeString("dOps"),t.writeUint8(0),t.writeUint8(e.codecpar.chLayout.nbChannels),t.writeUint16(e.codecpar.initialPadding),t.writeUint32(e.codecpar.sampleRate),t.writeUint16(0),t.writeUint8(0);else{const e=new s.A(a,!1);t.writeUint32(a.length),t.writeString("dOps"),t.writeUint8(0),e.seek(9),t.writeUint8(e.readUint8()),t.writeUint16(e.readUint16()),t.writeUint32(e.readUint32()),t.writeUint16(e.readUint16()),t.writeBuffer(a.subarray(18))}}},12412:(t,e,i)=>{"use strict";function r(t,e,i){t.writeUint32(28),t.writeString("dref"),t.writeUint32(0),t.writeUint32(1),t.writeUint32(12),t.writeString("url "),t.writeUint32(1)}i.d(e,{A:()=>r})},44473:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(77231),s=i(44328);function a(t,e,i){const a=e.privData;let n=(0,s.k)(a.lastPts,e.timeBase,{den:i.timescale,num:1}),o=a.startCT;const l=(0,s.k)(a.startDts+BigInt(Math.floor(o)),e.timeBase,{den:a.timescale,num:1});let c=n0?1:0),u=24+h*(1===c?20:12);t.writeUint32(u),t.writeString("edts"),t.writeUint32(u-8),t.writeString("elst"),t.writeUint8(c),t.writeUint24(0),t.writeUint32(h),l>0?(1===c?(t.writeUint64(l),t.writeInt64(r.Dh)):(t.writeUint32(Number(l)),t.writeInt32(-1)),t.writeUint32(65536)):(o=-Math.min(Number(a.startDts),0),n+=l),i.fragment&&(n=BigInt(0)),1===c?(t.writeUint64(n),t.writeInt64(BigInt(Math.floor(o)))):(t.writeUint32(Number(n)),t.writeInt32(o)),t.writeUint32(65536)}},4652:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var r=i(6660),s=i(14686);function a(t,e,i){t.writeUint8(e);for(let e=3;e>0;e--)t.writeUint8(i>>7*e|128);t.writeUint8(127&i)}function n(t,e,i){const n=e.privData,o=e.codecpar.extradata?5+e.codecpar.extradataSize:0,l=t.getPos();t.writeUint32(0),t.writeString("esds"),t.writeUint32(0),a(t,3,21+o+5+1),t.writeUint16(n.trackId),t.writeUint8(0),a(t,4,13+o),(86016===e.codecpar.codecId||86017===e.codecpar.codecId)&&e.codecpar.sampleRate>24e3?t.writeUint8(107):t.writeUint8(r.zs[e.codecpar.codecId]),94208===e.codecpar.codecId?t.writeUint8(225):1===e.codecpar.codecType?t.writeUint8(21):t.writeUint8(17),t.writeUint24(0),t.writeUint32(0),t.writeUint32(0),e.codecpar.extradata&&(a(t,5,e.codecpar.extradataSize),t.writeBuffer((0,s.s3)(e.codecpar.extradata,e.codecpar.extradataSize))),a(t,6,1),t.writeUint8(2),i.boxsPositionInfo.push({pos:l,type:"esds",size:Number(t.getPos()-l)})}},87384:(t,e,i)=>{"use strict";function r(t,e,i,r,s,a,n){t.writeInt32(Math.floor(65536*e)),t.writeInt32(Math.floor(65536*i)),t.writeInt32(0),t.writeInt32(Math.floor(65536*r)),t.writeInt32(Math.floor(65536*s)),t.writeInt32(0),t.writeInt32(Math.floor(65536*a)),t.writeInt32(Math.floor(65536*n)),t.writeInt32(1073741824)}i.d(e,{A:()=>r})},17923:(t,e,i)=>{"use strict";function r(t,e,i){const r=t.getPos();t.writeUint32(0),t.writeString("hdlr"),t.writeUint8(0),t.writeUint24(0);let s="dhlr",a="url ",n="DataHandler";e&&(s="mhlr",1===e.codecpar.codecType?(a="soun",n="SoundHandler"):0===e.codecpar.codecType?(a="vide",n="VideoHandler"):3===e.codecpar.codecType?(a="text",n="SubtitleHandler"):(e.metadata.handlerName&&(n=e.metadata.handlerName),e.metadata.hdlrType&&(a=e.metadata.hdlrType))),t.writeString(s),t.writeString(a),t.writeUint32(0),t.writeUint32(0),t.writeUint32(0),e&&!i.isom||t.writeUint8(n.length),t.writeString(n),e&&!i.isom&&t.writeUint8(0),i.boxsPositionInfo.push({pos:r,type:"hdlr",size:Number(t.getPos()-r)})}i.d(e,{A:()=>r})},78669:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(14686);function s(t,e,i){var s;t.writeUint32(8+(null!==(s=e.codecpar.extradataSize)&&void 0!==s?s:0)),t.writeString("hvcC"),i.fragment&&e.sideData[1]?(t.writeBuffer(e.sideData[1]),delete e.sideData[1]):e.codecpar.extradata&&t.writeBuffer((0,r.s3)(e.codecpar.extradata,e.codecpar.extradataSize))}},6e3:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(77231);function s(t,e,i){const s=e.privData.lastPts,a=e.metadata.creationTime||0,n=e.metadata.modificationTime||0,o=e.metadata.language||21956;let l=s{"use strict";function r(t,e,i){t.writeUint32(16),t.writeString("mfhd"),t.writeUint8(0),t.writeUint24(0),t.writeUint32(i.currentFragment.sequence)}i.d(e,{A:()=>r})},48669:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(17923);function s(t,e,i){(0,r.A)(t,null,i)}},7114:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(77231),s=i(87384);function a(t,e,i){const a=i.duration,n=i.creationTime||0,o=i.modificationTime||0,l=i.timescale||0;let c=i.nextTrackId||1;i.fragment&&(c=2);let h=a{"use strict";function r(t,e,i){t.writeUint32(16),t.writeString("pasp"),t.writeUint32(1),t.writeUint32(1)}i.d(e,{A:()=>r})},11573:(t,e,i)=>{"use strict";function r(t,e,i){t.writeUint32(16),t.writeString("smhd"),t.writeUint32(0),t.writeUint16(0),t.writeUint16(0)}i.d(e,{A:()=>r})},2204:(t,e,i)=>{"use strict";function r(t,e,i){const r=e.privData.chunkOffsets||[];t.writeUint32(16+4*r.length),t.writeString("stco"),t.writeUint8(0),t.writeUint24(0),t.writeUint32(r.length);for(let e=0;er})},84360:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(4624);const s="src/avformat/formats/mov/writing/stsc.ts";function a(t,e,i){const a=e.privData,n=a.stscFirstChunk,o=a.stscSamplesPerChunk,l=a.stscSampleDescriptionIndex;n.length===o.length&&n.length===l.length||r.R8("ctts firstChunk's length is not match samplesPerChunk's length or sampleDescriptionIndex's length",s,42);const c=Math.min(n.length,o.length,l.length);t.writeUint32(16+12*c),t.writeString("stsc"),t.writeUint8(0),t.writeUint24(0),t.writeUint32(c);for(let e=0;e{"use strict";i.d(e,{A:()=>x});var r=i(61600),s=i(78669),a=i(1263),n=i(99193),o=i(39878),l=i(47280),c=i(82181),h=i(4652),u=i(853),d=i(65629),f=i(93861),p=i(57756),m=i(80648),g=i(55668),v=i(14686),y=i(61619);const A={27:"avc1",173:"hvc1",196:"vvc1",225:"av01",167:"vp09",86019:"ac-3",86056:"ec-3"};function b(t){if(t.codecTag)return(0,y.A)(t.codecTag);let e=A[t.codecId];return e||(e=0===t.codecType?"mp4v":1===t.codecType?86076===t.codecId?"Opus":86028===t.codecId?"fLaC":"mp4a":3===t.codecType?"text":"none"),e}function x(t,e,i){const y=t.getPos();t.writeUint32(0),t.writeString("stsd"),t.writeUint8(0),t.writeUint24(0),t.writeUint32(1),1===e.codecpar.codecType?function(t,e,i){const r=t.getPos(),s=b(e.codecpar),a=i.isom?1:0;t.writeUint32(0),t.writeString(s),t.writeUint32(0),t.writeUint16(0),t.writeUint16(1),t.writeUint16(a),t.writeUint16(0),t.writeUint32(0),i.isom?(t.writeUint16(e.codecpar.chLayout.nbChannels),65541===e.codecpar.codecId||65540===e.codecpar.codecId?t.writeUint16(8):69643===e.codecpar.codecId?t.writeUint16(e.codecpar.bitsPerCodedSample):t.writeUint16(16),t.writeUint16(-2)):(86028===e.codecpar.codecId||86032===e.codecpar.codecId||86076===e.codecpar.codecId?t.writeUint16(e.codecpar.chLayout.nbChannels):t.writeUint16(2),86028===e.codecpar.codecId||86032===e.codecpar.codecId?t.writeUint16(e.codecpar.bitsPerCodedSample):t.writeUint16(16),t.writeUint16(0)),t.writeUint16(0),86076===e.codecpar.codecId?t.writeUint16(48e3):86060===e.codecpar.codecId?t.writeUint32(e.codecpar.sampleRate):t.writeUint16(e.codecpar.sampleRate),86060!==e.codecpar.codecId&&t.writeUint16(0),1===a&&(t.writeUint32(e.codecpar.frameSize),t.writeUint32(0),t.writeUint32(0),t.writeUint32(2)),!i.isom||86018!==e.codecpar.codecId&&86019!==e.codecpar.codecId&&86056!==e.codecpar.codecId&&73728!==e.codecpar.codecId&&86032!==e.codecpar.codecId&&69638!==e.codecpar.codecId&&69633!==e.codecpar.codecId&&86035!==e.codecpar.codecId?86028===e.codecpar.codecId?(0,l.A)(t,e,i):86076===e.codecpar.codecId?(0,c.A)(t,e,i):86019===e.codecpar.codecId?(0,m.A)(t,e,i):86056===e.codecpar.codecId?(0,g.A)(t,e,i):"mp4a"==s&&(0,h.A)(t,e,i):(0,p.A)(t,e,i),i.isom||(0,f.A)(t,e,i),i.boxsPositionInfo.push({pos:r,type:s,size:Number(t.getPos()-r)})}(t,e,i):0===e.codecpar.codecType?function(t,e,i){const l=t.getPos(),c=b(e.codecpar),p=13==e.codecpar.codecId&&15==e.codecpar.format||13==e.codecpar.codecId&&1==e.codecpar.format||202==e.codecpar.codecId||203==e.codecpar.codecId||156==e.codecpar.codecId||127==e.codecpar.codecId;t.writeUint32(0),t.writeString(c),t.writeUint32(0),t.writeUint16(0),t.writeUint16(1),t.writeUint16(p?2:0),t.writeUint16(0),i.isom?(t.writeString("FFMP"),13===e.codecpar.codecId||p?(t.writeUint32(0),t.writeUint32(1024)):(t.writeUint32(512),t.writeUint32(512))):(t.writeUint32(0),t.writeUint32(0),t.writeUint32(0)),t.writeUint16(e.codecpar.width),t.writeUint16(e.codecpar.height),t.writeUint32(4718592),t.writeUint32(4718592),t.writeUint32(0),t.writeUint16(1);let m=e.metadata.compressorName||"";if(m=m.slice(0,31),t.writeUint8(m.length),t.writeString(m),m.length<31){let e=31-m.length;for(;e>0;)t.writeUint8(0),e--}i.isom&&e.codecpar.bitsPerCodedSample?t.writeUint16(e.codecpar.bitsPerCodedSample):t.writeUint16(24),t.writeUint16(65535),"mp4v"===c?(0,h.A)(t,e,i):27===e.codecpar.codecId?(0,r.A)(t,e,i):173===e.codecpar.codecId?(0,s.A)(t,e,i):196===e.codecpar.codecId?(0,a.A)(t,e,i):167===e.codecpar.codecId?(0,n.A)(t,e,i):225===e.codecpar.codecId&&(0,o.A)(t,e,i),(0,u.A)(t,e,i),(0,d.A)(t,e,i),i.isom||(0,f.A)(t,e,i),i.boxsPositionInfo.push({pos:l,type:c,size:Number(t.getPos()-l)})}(t,e,i):3===e.codecpar.codecType&&function(t,e,i){const r=t.getPos(),s=b(e.codecpar);t.writeUint32(0),t.writeString(s),t.writeUint32(0),t.writeUint16(0),t.writeUint16(1),94208===e.codecpar.codecId?(0,h.A)(t,e,i):e.codecpar.extradata&&t.writeBuffer((0,v.s3)(e.codecpar.extradata,e.codecpar.extradataSize)),i.isom||(0,f.A)(t,e,i),i.boxsPositionInfo.push({pos:r,type:s,size:Number(t.getPos()-r)})}(t,e,i),i.boxsPositionInfo.push({pos:y,type:"esds",size:Number(t.getPos()-y)})}},20184:(t,e,i)=>{"use strict";function r(t,e,i){const r=e.privData.stssSampleNumbers;t.writeUint32(16+4*r.length),t.writeString("stss"),t.writeUint8(0),t.writeUint24(0),t.writeUint32(r.length);for(let e=0;er})},57247:(t,e,i)=>{"use strict";function r(t,e,i){const r=e.privData.sampleSizes;t.writeUint32(20+4*r.length),t.writeString("stsz"),t.writeUint8(0),t.writeUint24(0),t.writeUint32(0),t.writeUint32(r.length);for(let e=0;er})},86051:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(4624);const s="src/avformat/formats/mov/writing/stts.ts";function a(t,e,i){const a=e.privData,n=a.sttsSampleCounts||[],o=a.sttsSampleDeltas||[];n.length!==o.length&&r.R8("stts sampleCounts's length is not match sampleDeltas's length",s,39);const l=Math.min(n.length,o.length);t.writeUint32(16+8*l),t.writeString("stts"),t.writeUint8(0),t.writeUint24(0),t.writeUint32(l);for(let e=0;e{"use strict";function r(t,e,i){const r=i.currentFragment.tracks.find((t=>t.trackId===e.privData.trackId)),s=r?r.baseMediaDecodeTime:BigInt(0);t.writeUint32(20),t.writeString("tfdt"),t.writeUint8(1),t.writeUint24(0),t.writeUint64(s)}i.d(e,{A:()=>r})},11903:(t,e,i)=>{"use strict";function r(t,e,i){const r=i.currentFragment.tracks.find((t=>t.trackId===e.privData.trackId));let s=57;r.baseIsMoof&&(s&=-2,s|=131072);const a=t.getPos();t.writeUint32(0),t.writeString("tfhd"),t.writeUint8(0),t.writeUint24(s),t.writeUint32(r.trackId),1&s&&t.writeUint64(r.baseDataOffset),8&s&&t.writeUint32(r.defaultSampleDuration),16&s&&t.writeUint32(r.defaultSampleSize),32&s&&t.writeUint32(r.defaultSampleFlags),i.boxsPositionInfo.push({pos:a,type:"tfhd",size:Number(t.getPos()-a)})}i.d(e,{A:()=>r})},59868:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var r=i(77231),s=i(87384),a=i(44328);function n(t,e,i){const n=e.privData,o=(0,a.k)(n.lastPts,e.timeBase,{den:i.timescale,num:1}),l=e.metadata.creationTime||0,c=e.metadata.modificationTime||0,h=n.layer||0,u=n.alternateGroup||0;let d=e.codecpar.width>0?e.codecpar.width:0,f=e.codecpar.height>0?e.codecpar.height:0;d{"use strict";function r(t,e,i){var r,s,a;const n=i.currentFragment.tracks.find((t=>t.trackId===e.privData.trackId)),o=i.trexs.find((t=>{t.trackId,e.privData.trackId})),l=null!==(r=null==o?void 0:o.duration)&&void 0!==r?r:0,c=null!==(s=null==o?void 0:o.size)&&void 0!==s?s:0,h=null!==(a=null==o?void 0:o.flags)&&void 0!==a?a:0;t.writeUint32(32),t.writeString("trex"),t.writeUint8(0),t.writeUint24(0),t.writeUint32(n.trackId),t.writeUint32(1),t.writeUint32(l),t.writeUint32(c),t.writeUint32(h)}i.d(e,{A:()=>r})},48516:(t,e,i)=>{"use strict";function r(t,e,i){const r=e.privData,s=i.currentFragment.tracks.find((t=>t.trackId===r.trackId)),a=s.firstSampleFlags||0,n=s.dataOffset||0,o=s.sampleDurations,l=s.sampleSizes,c=s.sampleFlags,h=s.sampleCompositionTimeOffset,u=s.sampleCount,d=o.length>0,f=l.length>0,p=c.length>0,m=h.length>0,g=0!==a;let v=1;g&&(v|=4),d&&(v|=256),f&&(v|=512),p&&(v|=1024),m&&(v|=2048);const y=t.getPos();t.writeUint32(0),t.writeString("trun"),t.writeUint8(1),t.writeUint24(v),t.writeUint32(u),s.dataOffsetPos=t.getPos(),t.writeInt32(n),g&&t.writeUint32(a);for(let e=0;er})},54012:(t,e,i)=>{"use strict";function r(t,e,i){t.writeUint32(20),t.writeString("vmhd"),t.writeUint8(0),t.writeUint24(1),t.writeUint64(BigInt(0))}i.d(e,{A:()=>r})},99193:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(14686);function s(t,e,i){var s;t.writeUint32(12+(null!==(s=e.codecpar.extradataSize)&&void 0!==s?s:0)),t.writeString("vpcC"),t.writeUint8(1),t.writeUint24(0),i.fragment&&e.sideData[1]?(t.writeBuffer(e.sideData[1]),delete e.sideData[1]):e.codecpar.extradata&&t.writeBuffer((0,r.s3)(e.codecpar.extradata,e.codecpar.extradataSize))}},1263:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(14686);function s(t,e,i){var s;t.writeUint32(8+(null!==(s=e.codecpar.extradataSize)&&void 0!==s?s:0)),t.writeString("vvcC"),t.writeUint8(0),t.writeUint24(0),i.fragment&&e.sideData[1]?(t.writeBuffer(e.sideData[1]),delete e.sideData[1]):e.codecpar.extradata&&t.writeBuffer((0,r.s3)(e.codecpar.extradata,e.codecpar.extradataSize))}},57756:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(14686),s=i(4652);function a(t,e,i){const a=t.getPos();t.writeUint32(0),t.writeString("wave"),86035!==e.codecpar.codecId&&(t.writeUint32(12),t.writeString("frma"),t.writeUint32(e.codecpar.codecTag)),86018===e.codecpar.codecId?(t.writeUint32(12),t.writeString("mp4a"),t.writeUint32(0),(0,s.A)(t,e,i)):i.fragment&&e.sideData[1]?(t.writeBuffer(e.sideData[1]),delete e.sideData[1]):e.codecpar.extradata&&t.writeBuffer((0,r.s3)(e.codecpar.extradata,e.codecpar.extradataSize)),t.writeUint32(8),t.writeUint32(0),i.boxsPositionInfo.push({pos:a,type:"wave",size:Number(t.getPos()-a)})}},80025:(t,e,i)=>{"use strict";i.d(e,{A:()=>_});var r=i(86051),s=i(18387),a=i(20184),n=i(57247),o=i(84360),l=i(2204),c=i(34445),h=i(6e3),u=i(7114),d=i(59868),f=i(17923),p=i(69301),m=i(54012),g=i(44473),v=i(11573),y=i(12412),A=i(35010),b=i(31130),x=i(11903),w=i(11251),k=i(48516),T=i(48669);const _={stts:r.A,ctts:s.A,stss:a.A,stsz:n.A,stsc:o.A,stco:l.A,co64:c.A,mdhd:h.A,mvhd:u.A,tkhd:d.A,hdlr:f.A,stsd:p.A,vmhd:m.A,edts:g.A,smhd:v.A,dref:y.A,trex:A.A,mfhd:b.A,tfhd:x.A,tfdt:w.A,trun:k.A,minf_hdlr:T.A}},38115:(t,e,i)=>{"use strict";i.d(e,{q:()=>o});var r=i(79331),s=i(67672),a=i(72739),n=i(54825);function o(t){const e=(0,r.A)(t,{aloneValueName:"context"});if(!e.tt)return{queue:[],head:{}};const i=[];function o(t){let e="";return a.__(t,(t=>{s.Yj(t)?e+=t:t.context?e+=`<${t.tagName}>${t.context}`:e+=`<${t.tagName}/>`})),e}function l(t,e,r){var a;const l=(0,n.j)(e||t.begin);let c=t.context||"",h=t.region||"Default";s.YO(c)&&(c=o(c)),null!==(a=t.span)&&void 0!==a&&a.context&&(t.span.region&&(h=t.span.region),s.Yj(t.span.context)?c+=t.span.context:c+=o(t.span.context)),i.push({context:c,pts:l,region:h,duration:t.dur?(0,n.j)(t.dur):(0,n.j)(r||t.end)-l})}function c(t,e,i){s.YO(t)?a.__(t,(t=>{l(t,e,i)})):l(t,e,i)}return e.tt.body&&e.tt.body.div&&(s.YO(e.tt.body.div)?a.__(e.tt.body.div,(t=>{t.p&&c(t.p,t.begin,t.end)})):e.tt.body.div.p&&c(e.tt.body.div.p,e.tt.body.div.begin,e.tt.body.end)),{queue:i,head:e.tt.head||{}}}},59989:(t,e,i)=>{"use strict";function r(t,e=0){if(!t)return!1;if(t.length<2)return!0;let i=t[e],r=e+1;for(;rr})},31425:(t,e,i)=>{"use strict";i.d(e,{$:()=>n});var r=i(77231),s=i(72739),a=i(44328);function n(t){let e=!0;return s.__(t.streams,(t=>{switch(t.codecpar.codecType){case 1:t.codecpar.chLayout.nbChannels!==r.N_&&t.codecpar.sampleRate!==r.N_&&t.codecpar.frameSize!==r.N_&&t.codecpar.bitrate!==BigInt(0)||(e=!1);break;case 0:0!==(0,a.lb)(t.codecpar.framerate)&&t.codecpar.width!==r.N_&&t.codecpar.height!==r.N_&&t.codecpar.bitrate!==BigInt(0)||(e=!1),27!==t.codecpar.codecId&&173!==t.codecpar.codecId&&196!==t.codecpar.codecId&&12!==t.codecpar.codecId||t.codecpar.profile!==r.N_&&t.codecpar.level!==r.N_||(e=!1)}})),e}},61619:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(67672);function s(t,e=4){let i="";for(let s=0;s>>=8):(i=String.fromCharCode(Number(t&BigInt(255)))+i,t>>=BigInt(8));return i}},65977:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(4624);const s="src/avformat/function/mktag.ts";function a(t){4!==t.length&&r.R8(`tag length is not 4, tag: ${t}`,s,30);let e=0;for(let i=0;i<4;i++)e=e<<8|t.charCodeAt(i);return e}},20841:(t,e,i)=>{"use strict";function r(t,e,i,r){const s=t.getPos(),a=t.getPointer(),n=s-BigInt(Math.floor(a));let o=!1;switch(e=n?(t.seekInline(a+Number(e-s)),o=!0):t.seek(e),r){case"uint8":t.writeUint8(255&i);break;case"int8":t.writeInt8(i);break;case"uint16":t.writeUint16(65535&i);break;case"int16":t.writeInt16(i);break;case"uint32":t.writeUint32(i>>>0);break;case"int32":t.writeInt32(i);break;case"uint64":t.writeUint64(BigInt.asUintN(64,i));break;case"int64":t.writeInt64(i);break;case"float":t.writeFloat(i);break;case"double":t.writeDouble(i)}o?t.seekInline(a):t.seek(s)}i.d(e,{A:()=>r})},92174:(t,e,i)=>{"use strict";i.d(e,{XA:()=>v,bX:()=>A,bx:()=>g,dJ:()=>y,ho:()=>m});var r=i(80662),s=i.n(r),a=i(63939),n=i(50932),o=i(95335),l=i(4624),c=i(51597),h=i(72739),u=i(9705),d=i(548);const f="src/avformat/mux.ts",p={paddingZero:!1};function m(t,e={}){const i=o.X$({},p,e);t.ioWriter||l.h2("need ioWriter",f,52),t.oformat||l.h2("need oformat",f,55),t.options=i,t.processPrivateData={first:new(s())};let r=c.E[t.oformat.type];if(r)for(let e=0;e69683)return l.z3(`format ${(0,d.L_)(t.oformat.type)} not support codecId ${(0,d.eG)(t.streams[e].codecpar.codecType,i)}`,f,71),u.r8}else if(!h.zy(r,i))return l.z3(`format ${(0,d.L_)(t.oformat.type)} not support codecId ${(0,d.eG)(t.streams[e].codecpar.codecType,i)}`,f,76),u.r8}return t.oformat.init(t)}function g(t){return t.oformat.writeHeader(t),0}function v(t,e){const i=t.processPrivateData;return i.first.has(a.f[15](e+32))||(a.f[17](e+16)>BigInt(0)?i.first.set(a.f[15](e+32),a.f[17](e+16)):i.first.set(a.f[15](e+32),BigInt(0))),t.options.paddingZero&&(n.M[17](e+16,a.f[17](e+16)-i.first.get(a.f[15](e+32))),n.M[17](e+8,a.f[17](e+8)-i.first.get(a.f[15](e+32)))),t.oformat.writeAVPacket(t,e)}function y(t){return t.oformat.writeTrailer(t),0}function A(t){t.oformat.flush(t)}},49847:(t,e,i)=>{"use strict";i.d(e,{A:()=>r});class r{constructor(){}get ext(){throw new Error("need implemented ext getter")}get flags(){return 0}get name(){return"CustomIOLoader."+Math.random()}get minBuffer(){return 4}write(t){throw new Error("need implemented write function")}}},77580:(t,e,i)=>{"use strict";i.d(e,{A:()=>d});var r=i(134),s=i(29967),a=i.n(s),n=i(13724),o=i(82800),l=i(95335),c=i(4624),h=i(9705);const u="src/avnetwork/ioLoader/FetchIOLoader.ts";class d extends o.A{constructor(t={}){super(t),(0,r.A)(this,"contentLength",void 0),(0,r.A)(this,"receivedLength",void 0),(0,r.A)(this,"info",void 0),(0,r.A)(this,"range",void 0),(0,r.A)(this,"startBytes",void 0),(0,r.A)(this,"endBytes",void 0),(0,r.A)(this,"eofIndex",void 0),(0,r.A)(this,"abortController",void 0),(0,r.A)(this,"reader",void 0),(0,r.A)(this,"buffers",void 0),(0,r.A)(this,"supportRange",void 0)}async getTotalSize(t,e={}){var i,r,s;const n={method:t,headers:{},mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};null!==(i=this.info.httpOptions)&&void 0!==i&&i.headers&&l.__(this.info.httpOptions.headers,((t,e)=>{n.headers[e]=t})),l.__(e,((t,e)=>{n.headers[e]=t})),null!==(r=this.info.httpOptions)&&void 0!==r&&r.credentials&&(n.credentials=this.info.httpOptions.credentials),null!==(s=this.info.httpOptions)&&void 0!==s&&s.referrerPolicy&&(n.referrerPolicy=this.info.httpOptions.referrerPolicy),"function"==typeof AbortController&&(this.abortController=new AbortController,n.signal=this.abortController.signal);try{const t=await fetch(this.info.url,n);if(t.ok&&t.status>=200&&t.status<=299){this.abortController&&(this.abortController.abort(),this.abortController=null);const e=t.headers.get("Accept-Ranges");e&&-1===e.indexOf("bytes")&&(this.supportRange=!1);const i=t.headers.get("Content-Range");if(i){const t=i.split("/")[1];if(t)return a()(t)}const r=t.headers.get("X-Content-Length")||t.headers.get("Content-Length");if(null!=r)return a()(r)}}catch(t){}return 0}async open(t,e){var i;if(this.info=t,this.range=e,this.range.to||(this.range.to=-1),this.range.from=Math.max(this.range.from,0),this.eofIndex<0&&(this.eofIndex=e.to),this.startBytes=0,this.endBytes=-1,this.receivedLength=0,this.buffers=[],this.supportRange=!0,this.range&&!this.options.isLive&&(this.startBytes=null!==(i=this.range.from)&&void 0!==i?i:0),this.status=1,!this.options.isLive&&!this.options.disableSegment){let t=await this.getTotalSize("HEAD");t||(t=await this.getTotalSize("Get",{range:"bytes=0-1"})),t<=2&&(t=0),t?(this.contentLength=t,this.range.to<0&&(this.eofIndex=this.contentLength+this.range.to),this.supportRange&&(this.endBytes=Math.min(this.startBytes+this.options.preload-1,this.eofIndex))):this.endBytes=-1}return this.status=2,0}async openReader(){var t,e,i;const r={method:"GET",headers:{},mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};null!==(t=this.info.httpOptions)&&void 0!==t&&t.headers&&l.__(this.info.httpOptions.headers,((t,e)=>{r.headers[e]=t})),this.options.isLive||this.options.disableSegment||(r.headers.range=`bytes=${this.startBytes}-${this.endBytes>0?this.endBytes:""}`),null!==(e=this.info.httpOptions)&&void 0!==e&&e.credentials&&(r.credentials=this.info.httpOptions.credentials),null!==(i=this.info.httpOptions)&&void 0!==i&&i.referrerPolicy&&(r.referrerPolicy=this.info.httpOptions.referrerPolicy),this.abortController&&this.abortController.abort(),"function"==typeof AbortController&&(this.abortController=new AbortController,r.signal=this.abortController.signal);try{const t=await fetch(this.info.url,r);t.ok&&t.status>=200&&t.status<=299?this.reader=t.body.getReader():(this.status=3,c.h2(`FetchStreamLoader: Http code invalid, ${t.status} ${t.statusText}`,u,233))}catch(t){if(this.retryCountt.length-i?(t.set(e.subarray(0,t.length-i),i),this.buffers.unshift(e.subarray(t.length-i)),i=t.length):(t.set(e,i),i+=e.length)}if(i>=t.length)return t.length+e;if(4===this.status)return i>0?i+e:e>0?e:-1048576;this.reader||await this.openReader();const{value:r,done:s}=await this.reader.read();return s?null!==this.contentLength&&this.receivedLength+this.range.from=this.eofIndex?(this.status=4,this.startBytes=0,i>0?i+e:e>0?e:-1048576):(await this.reader.cancel(),this.abortController&&(this.abortController.abort(),this.abortController=null),this.reader=null,this.startBytes=this.endBytes+1,this.endBytes=Math.min(this.startBytes+this.options.preload-1,this.eofIndex),this.readInterval(t.subarray(i),i)):(this.receivedLength+=r.length,r.length>t.length-i?(t.set(r.subarray(0,t.length-i),i),this.buffers.push(r.subarray(t.length-i)),t.length+e):(t.set(r,i),i+=r.length,i+e))}async read(t){return this.readInterval(t)}async seek(t){return this.supportRange?(await this.abort(),this.receivedLength=Number(t)-this.range.from,this.startBytes=Number(t),this.options.disableSegment||(this.endBytes=Math.min(this.startBytes+this.options.preload,this.eofIndex)),this.buffers.length=0,4===this.status&&(this.status=2),0):h.NU}async size(){return this.options.isLive?BigInt(0):BigInt(Math.floor(this.contentLength||0))}async abort(){this.reader&&(await this.reader.cancel(),this.abortController&&(this.abortController.abort(),this.abortController=null),this.reader=null)}async stop(){await this.abort(),this.status=0}}},79686:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var r=i(134),s=i(54001),a=i.n(s),n=i(82800);const o=i(67672).Pc(Blob.prototype.arrayBuffer);class l extends n.A{constructor(...t){super(...t),(0,r.A)(this,"info",void 0),(0,r.A)(this,"range",void 0),(0,r.A)(this,"readPos",void 0),(0,r.A)(this,"endPos",void 0),(0,r.A)(this,"reader",void 0),(0,r.A)(this,"readerResolve",void 0)}async open(t,e){return this.info=t,this.range=e,this.readPos=0,this.endPos=this.info.file.size,e.from>0&&(this.readPos=e.from),e.to>0&&(this.endPos=e.to),this.status=2,0}async readBufferByReader(t){this.reader||(this.reader=new FileReader,this.reader.onloadend=t=>{this.readerResolve&&this.readerResolve(t.target.result)});const e=File.prototype.slice||File.prototype.mozSlice||File.prototype.webkitSlice;return new(a())((i=>{this.readerResolve=i,this.reader.readAsArrayBuffer(e.call(this.info.file,this.readPos,this.readPos+t))}))}async read(t){if(this.readPos>=this.endPos)return this.status=4,-1048576;const e=Math.min(t.length,this.endPos-this.readPos);return o?t.set(new Uint8Array(await this.info.file.slice(this.readPos,this.readPos+e).arrayBuffer()),0):t.set(new Uint8Array(await this.readBufferByReader(e)),0),this.readPos+=e,this.readPos>=this.endPos&&(this.status=4),e}async seek(t){return this.readPos=Number(t),4===this.status&&(this.status=2),0}async size(){return BigInt(Math.floor(this.info.file.size))}async stop(){this.status=0}}},82800:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var r=i(134),s=i(95335);const a={isLive:!0,preload:5242880,retryCount:20,retryInterval:1};class n{constructor(t={}){(0,r.A)(this,"options",void 0),(0,r.A)(this,"status",void 0),(0,r.A)(this,"retryCount",void 0),(0,r.A)(this,"retryTimeout",void 0),this.options=t,this.status=0,this.retryCount=0,this.options=s.X$({},a),s.X$(this.options,t)}write(t){throw new Error("need implemented write function")}}},36773:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var r=i(134),s=i(54001),a=i.n(s),n=i(82800);class o extends n.A{constructor(t={}){super(t),(0,r.A)(this,"readQueue",void 0),(0,r.A)(this,"consume",void 0),this.readQueue=[]}async readInterval(t,e=0){let i=0;for(;this.readQueue.length&&it.length-i?(t.set(e.subarray(0,t.length-i),i),this.readQueue.unshift(e.subarray(t.length-i)),i=t.length):(t.set(e,i),i+=e.length)}return i>0||e?i+e:4===this.status||0===this.status?i>0?i+e:e>0?e:-1048576:3===this.status?i>0?i+e:e>0?e:-1048573:(await new(a())((t=>{this.consume=t})),this.consume=null,this.readInterval(t,e))}async read(t){return this.readInterval(t)}async write(t){return this.send(t)}}},14619:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var r=i(134),s=i(54001),a=i.n(s),n=i(36773);class o extends n.A{constructor(...t){super(...t),(0,r.A)(this,"info",void 0),(0,r.A)(this,"socket",void 0)}async send(t){return this.socket?(this.socket.send(t.slice()),0):-1048574}open(t){return this.info=t,this.status=1,new(a())((e=>{this.socket=new WebSocket(t.url),this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.status=2,e(0)},this.socket.onerror=()=>{this.status=3,e(-1048573),this.consume&&this.consume()},this.socket.onmessage=t=>{let e=t.data;this.readQueue.push(new Uint8Array(e)),this.consume&&this.consume()}}))}seek(t,e){throw new Error("Method not implemented.")}size(){throw new Error("Method not implemented.")}async stop(){this.socket&&(this.socket.close(),this.socket=null),this.status=4,this.consume&&this.consume()}}},42383:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var r=i(134),s=i(54001),a=i.n(s),n=i(36773);class o extends n.A{constructor(...t){super(...t),(0,r.A)(this,"info",void 0),(0,r.A)(this,"transport",void 0),(0,r.A)(this,"datagramReader",void 0),(0,r.A)(this,"reader",void 0),(0,r.A)(this,"datagramWriter",void 0),(0,r.A)(this,"writer",void 0),(0,r.A)(this,"stream",void 0),(0,r.A)(this,"readPacketQueue",void 0),(0,r.A)(this,"consumePacket",void 0)}async send(t){return this.writer?(this.writer.write(t.slice()),0):-1048574}async handleRead(){let t=!1;for(;;)try{const{value:e,done:i}=await this.reader.read();if(i){t=i;break}this.readQueue.push(e)}catch(e){t||(this.status=3,this.consume&&this.consume());break}}async readDatagram(){let t=!1;for(;;)try{const{value:e,done:i}=await this.datagramReader.read();if(i){t=!0;break}this.readPacketQueue.push(e)}catch(e){t||(this.status=3,this.consumePacket&&this.consumePacket());break}}async open(t){return this.info=t,this.transport=new WebTransport(t.url,t.webtransportOptions),this.readPacketQueue=[],this.status=1,await this.transport.ready,this.transport.closed.then((()=>{this.transport?this.status=3:this.status=4})),this.status=2,this.stream=await this.transport.createBidirectionalStream(),this.reader=this.stream.readable.getReader(),this.writer=this.stream.writable.getWriter(),this.datagramReader=this.transport.datagrams.readable.getReader(),this.datagramWriter=this.transport.datagrams.writable.getWriter(),this.handleRead(),this.readDatagram(),0}async readPacket(t){for(;;){if(this.readPacketQueue.length){const e=this.readPacketQueue.shift();return t.set(e,0),e.length}if(4===this.status||0===this.status)return-1048576;if(3===this.status)return-1048573;await new(a())((t=>{this.consumePacket=t})),this.consumePacket=null}}async writePacket(t){return this.datagramWriter?(this.datagramWriter.write(t.slice()),0):-1048574}seek(t,e){throw new Error("Method not implemented.")}size(){throw new Error("Method not implemented.")}async stop(){this.transport&&(this.transport.close(),this.transport=null),this.status=4,this.consume&&this.consume()}}},18667:(t,e,i)=>{"use strict";i.d(e,{A:()=>M});var r=i(54001),s=i.n(r),a=i(63939),n=i(50932),o=i(12264),l=i(29170),c=i(9599),h=i(44527),u=i(9705),d=i(84149),f=i(75742),p=i(4624),m=i(16041),g=(i(77162),i(77104)),v=i(84290),y=i(72739),A=i(86932),b=i(36204),x=i(44328),w=i(77231),k=i(94561),T=i(72703),_=i(71762),I=i(37837),S=i(71766),P=i(67672);const C="src/avpipeline/AudioDecodePipeline.ts";class M extends h.A{constructor(){super()}createWebcodecDecoder(t){return new g.A({onError:e=>{p.z3(`audio decode error, taskId: ${t.taskId}, error: ${e}`,C,93),t.openReject&&(t.openReject(u.r8),t.openReject=null)},onReceiveFrame(e){const i=(0,b.t)(e,t.avframePool.alloc());n.M[17](i+104,(0,x.k)(a.f[17](i+104),w.KR,t.timeBase)),n.M[15](i+124,t.timeBase.den),n.M[15](i+120,t.timeBase.num),t.frameCaches.push(i),n.M[17](t.stats+56,a.f[17](t.stats+56)+BigInt(1)),t.lastDecodeTimestamp&&n.M[15](t.stats+248,Math.max((0,A.A)()-t.lastDecodeTimestamp,a.f[15](t.stats+248))),t.lastDecodeTimestamp=(0,A.A)(),e.close()}})}createWasmcodecDecoder(t,e){return new f.A({resource:e,onError:e=>{p.z3(`audio decode error, taskId: ${t.taskId}, error: ${e}`,C,124),t.openReject&&(t.openReject(u.r8),t.openReject=null)},onReceiveFrame(e){t.frameCaches.push(e),n.M[17](t.stats+56,a.f[17](t.stats+56)+BigInt(1)),t.lastDecodeTimestamp&&n.M[15](t.stats+248,Math.max((0,A.A)()-t.lastDecodeTimestamp,a.f[15](t.stats+248))),t.lastDecodeTimestamp=(0,A.A)()},avframePool:t.avframePool})}async pullAVPacketInternal(t,e){const i=await e.request("pull");if(P.ai(i))return i;{const e=t.avpacketPool.alloc();return(0,_.r0)(i,e),e}}async createTask(t){const e=new d.Ay(t.leftPort),i=new d.Ay(t.rightPort),r=[],s=new m.A((0,l.A)(t.avframeList,o.A),t.avframeListMutex),h={...t,resource:await(0,k.A)(t.resource),frameCaches:r,inputEnd:!1,decoder:null,parameters:0,lastDecodeTimestamp:0,avframePool:s,avpacketPool:new v.A((0,l.A)(t.avpacketList,o.A),t.avpacketListMutex),openReject:null};return h.resource?h.decoder=this.createWasmcodecDecoder(h,h.resource):h.decoder=this.createWebcodecDecoder(h),this.tasks.set(t.taskId,h),i.on(d.S3,(async s=>{switch(s.method){case"pull":if(r.length){const t=r.shift();i.reply(s,t);break}if(!h.inputEnd){for(;;){if(r.length){const t=r.shift();i.reply(s,t);break}const o=await this.pullAVPacketInternal(h,e);if(-1048576===o){if(await h.decoder.flush(),h.inputEnd=!0,r.length){const t=r.shift();i.reply(s,t);break}p.pq(`audio decoder ended, taskId: ${h.taskId}`,C,218),i.reply(s,-1048576);break}if(!(o>0)){p.z3(`audio decode pull avpacket error, taskId: ${t.taskId}, ret: ${o}`,C,236),i.reply(s,o);break}{const e=h.decoder.decode(o,(0,x.k)(a.f[17](o+8),(0,l.A)(o+72,c.P),w.KR));h.avpacketPool.release(o),e<0&&(n.M[15](h.stats+48,a.f[15](h.stats+48)+1),p.z3(`audio decode error, taskId: ${t.taskId}, ret: ${e}`,C,231))}}break}i.reply(s,-1048576)}})),0}async open(t,e,i={}){const r=this.tasks.get(t);if(r){r.wasmDecoderOptions=i;const t=(0,I.Gy)(168);return(0,T.A)(e)?(0,S.Yi)(t,e):(0,_.T8)(e,t),r.parameters&&(0,S.dn)(r.parameters),r.parameters=t,new(s())((async(e,i)=>{r.openReject=e;try{await r.decoder.open(t,r.wasmDecoderOptions)}catch(t){return p.z3(`open audio decoder failed, error: ${t}`,C,273),void e(u.r8)}e(0)}))}p.h2("task not found",C,280)}async reopenDecoder(t,e,i,r){const a=this.tasks.get(t);if(a){r&&(a.wasmDecoderOptions=r);const t=(0,I.Gy)(168);let n;return(0,T.A)(e)?(0,S.Yi)(t,e):(0,_.T8)(e,t),a.parameters&&(0,S.dn)(a.parameters),a.parameters=t,i?(i=await(0,k.A)(i),n=this.createWasmcodecDecoder(a,i)):n=this.createWebcodecDecoder(a),new(s())((async(e,r)=>{a.openReject=e;try{await n.open(t),i&&(a.resource=i),a.decoder.close(),a.decoder=n,p.Yz(`reopen audio decoder, taskId: ${a.taskId}`,C,323)}catch(t){return p.z3(`reopen audio decoder failed, error: ${t}`,C,326),void e(u.r8)}e(0)}))}p.h2("task not found",C,333)}async resetTask(t){const e=this.tasks.get(t);e&&(e.decoder&&await e.decoder.flush(),y.__(e.frameCaches,(t=>{e.avframePool.release(t)})),e.frameCaches.length=0,e.inputEnd=!1,e.lastDecodeTimestamp=(0,A.A)(),p.pq(`reset audio decoder, taskId: ${e.taskId}`,C,349))}async registerTask(t){return this.tasks.has(t.taskId)?u.lh:this.createTask(t)}async unregisterTask(t){const e=this.tasks.get(t);e&&(e.rightPort.close(),e.leftPort.close(),e.decoder.close(),e.frameCaches.forEach((t=>{e.avframePool.release(t)})),e.parameters&&(0,S.dn)(e.parameters),this.tasks.delete(t))}}},59377:(t,e,i)=>{"use strict";i.d(e,{A:()=>R});var r=i(134),s=i(80662),a=i.n(s),n=i(54001),o=i.n(n),l=i(61499),c=i(12264),h=i(74503),u=i(73783),d=i(29170),f=i(63939),p=i(50932),m=i(94300),g=i(10278),v=i(44527),y=i(9705),A=i(84149),b=i(4624),x=i(16041),w=i(92246),k=i(47442),T=i(37837),_=i(70089),I=i(14686),S=i(44328),P=i(77231),C=i(86932),M=i(13724),B=i(43607),E=i(94561);const D="src/avpipeline/AudioRenderPipeline.ts";class R extends v.A{constructor(){super(),(0,r.A)(this,"avPCMBufferPool",void 0),(0,r.A)(this,"avPCMBufferList",void 0),(0,r.A)(this,"avPCMBufferListMutex",void 0),this.avPCMBufferList=(0,h.A)(c.A),this.avPCMBufferListMutex=(0,h.A)(u.eu),this.avPCMBufferPool=new k.A(this.avPCMBufferList,this.avPCMBufferListMutex[l.o9])}async createTask(t){const e=new A.Ay(t.leftPort),i=new A.Ay(t.rightPort),r=new A.Ay(t.controlPort),s={...t,leftIPCPort:e,rightIPCPort:i,controlIPCPort:r,resamplerResource:await(0,E.A)(t.resamplerResource),stretchpitcherResource:await(0,E.A)(t.stretchpitcherResource),resampler:null,stretchpitcher:new(a()),outPCMBuffer:null,waitPCMBuffer:0,waitAVFrame:0,waitPCMBufferPos:0,frameEnded:!1,stretchpitcherEnded:!1,playRate:1,playTempo:1,playPitch:1,useStretchpitcher:!1,lastNotifyPTS:BigInt(0),currentPTS:P.Dh,firstPlayed:!1,seeking:!1,pausing:!1,stopping:!1,seekSync:null,receivePCMSync:null,paddingAVFrame:0,fakePlayStartTimestamp:0,fakePlaySamples:BigInt(0),fakePlayTimer:null,fakePlay:!1,lastRenderTimestamp:0,avframePool:new x.A((0,d.A)(t.avframeList,c.A),t.avframeListMutex)};s.startPTS=(0,S.k)(s.startPTS,s.timeBase,P.i0);for(let e=0;e{let t;if(s.paddingAVFrame?(t=s.paddingAVFrame,s.paddingAVFrame=0):t=await s.leftIPCPort.request("pull"),-1048576===t){for(let t=0;t{let e=0;if(s.seeking&&(await new(o())((t=>{s.receivePCMSync=t})),s.stopping))return-1048576;if(s.enableJitterBuffer&&f.f[15](s.stats+32)/f.f[15](s.stats+244)*1e3<=f.f[15](s.stats+280)&&this.setPlayRate(s.taskId,1),s.frameEnded&&s.useStretchpitcher){let i=0;for(let r=0;r>>1))/s.playSampleRate*1e3>>>0,r=B.T9(s.currentPTS-BigInt(Math.floor(i)),BigInt(0));return p.M[17](s.stats+328,r),s.currentPTS-s.lastNotifyPTS>=BigInt(1e3)&&(s.lastNotifyPTS=s.currentPTS,s.controlIPCPort.notify("syncPts",{pts:r})),s.seekSync&&(s.seekSync(),s.seekSync=null),0};return i.on(A.S3,(async t=>{switch(t.method){case"pull":{if(s.fakePlay&&(s.fakePlay=!1,s.fakePlayTimer&&(clearTimeout(s.fakePlayTimer),s.fakePlayTimer=null),s.fakePlaySamples=BigInt(0),s.fakePlayStartTimestamp=0),s.frameEnded&&(s.stretchpitcherEnded||!s.useStretchpitcher))return void i.reply(t,-1048576);const e=t.params.buffer,r=await u(e);i.reply(t,r);break}case"pullBuffer":{if(s.fakePlay&&(s.fakePlay=!1,s.fakePlayTimer&&(clearTimeout(s.fakePlayTimer),s.fakePlayTimer=null),s.fakePlaySamples=BigInt(0),s.fakePlayStartTimestamp=0),s.frameEnded&&(s.stretchpitcherEnded||!s.useStretchpitcher))return void i.reply(t,-1048576);const e=t.params.nbSamples;if(!s.outPCMBuffer||s.outPCMBuffer.maxnbSamples!==e){s.outPCMBuffer&&((0,T.aI)(s.outPCMBuffer.data),(0,T.aI)(s.outPCMBuffer[l.o9]),(0,m.A)(s.outPCMBuffer)),s.outPCMBuffer=(0,h.A)(g.A),s.outPCMBuffer.data=(0,T.sY)(4*s.playChannels);const t=(0,T.Gy)(4*e*s.playChannels);for(let i=0;i{e.seekSync=t}))),e.seeking=!0,e.stretchpitcher.size)for(const t of e.stretchpitcher.keys())e.stretchpitcher.get(t).clear();e.waitPCMBuffer&&(e.waitAVFrame&&(p.M[20](e.waitPCMBuffer,0),p.M[15](e.waitPCMBuffer+12,0),e.avframePool.release(e.waitAVFrame),e.waitAVFrame=0),this.avPCMBufferPool.release(e.waitPCMBuffer),e.waitPCMBuffer=0),b.Yz(`before seek end, taskId: ${e.taskId}`,D,652)}}async syncSeekTime(t,e,i){const r=this.tasks.get(t);if(r){let s=!1;for(;;){if(!r.leftIPCPort)return r.frameEnded=!0,void b.R8(`pull audio frame end after unregisterTask, taskId: ${t}`,D,666);let a=(0,C.A)(),n=f.f[15](r.stats+120);for(;!s&&i&&f.f[15](r.stats+120)>i;)await new M.A(0),(0,C.A)()-a>200&&n===f.f[15](r.stats+120)&&(s=!0),n!==f.f[15](r.stats+120)&&(n=f.f[15](r.stats+120),a=(0,C.A)());let o=await r.leftIPCPort.request("pull");if(o<0){b.R8(`pull audio frame end after seek, taskId: ${t}`,D,688),r.frameEnded=!0;break}if(e=e){r.paddingAVFrame=o,r.frameEnded=!1,r.lastNotifyPTS=l,p.M[17](r.stats+328,l);break}r.avframePool.release(o)}b.Yz(`sync seek time end, taskId: ${r.taskId}`,D,719)}}async afterSeek(t,e){const i=this.tasks.get(t);i&&(i.seeking=!1,i.receivePCMSync&&(i.receivePCMSync(),i.receivePCMSync=null),i.pausing||(i.fakePlay&&(i.fakePlayStartTimestamp=(0,C.A)(),i.fakePlaySamples=BigInt(0),this.fakePlayNext(i)),i.lastRenderTimestamp=(0,C.A)()),b.Yz(`after seek end, taskId: ${i.taskId}`,D,741))}async restart(t){const e=this.tasks.get(t);if(e){var i;if(e.lastNotifyPTS=BigInt(0),e.frameEnded=!1,e.firstPlayed=!1,e.stretchpitcherEnded=!1,null!==(i=e.stretchpitcher)&&void 0!==i&&i.size)for(let t=0;t>>0;i/=t.playRate*t.playTempo,t.currentPTS=(0,S.k)(f.f[17](e+104),t.timeBase,P.i0);const r=BigInt(Math.floor((0,C.A)()-t.fakePlayStartTimestamp))*BigInt(0|f.f[15](e+152))/BigInt(1e3);i-=Number(r-t.fakePlaySamples)/f.f[15](e+152)*1e3>>>0,t.fakePlaySamples+=BigInt(0|f.f[15](e+76)),t.avframePool.release(e),t.currentPTS-t.lastNotifyPTS>=BigInt(1e3)&&(t.lastNotifyPTS=t.currentPTS,t.controlIPCPort.notify("syncPts",{pts:t.currentPTS})),t.fakePlayTimer=setTimeout((()=>{t.fakePlayTimer=null,this.fakePlayNext(t)}),i)}async fakePlay(t){const e=this.tasks.get(t);e&&(e.fakePlayStartTimestamp=(0,C.A)(),e.fakePlay=!0,e.fakePlaySamples=BigInt(0),this.fakePlayNext(e),b.pq(`start fake play, taskId: ${e.taskId}`,D,820))}async pause(t){const e=this.tasks.get(t);e&&(e.pausing=!0,e.fakePlay&&e.fakePlayTimer&&(clearTimeout(e.fakePlayTimer),e.fakePlayTimer=null),b.pq(`task paused, taskId: ${e.taskId}`,D,835))}async unpause(t){const e=this.tasks.get(t);e&&(e.pausing=!1,e.fakePlay&&(e.fakePlayStartTimestamp=(0,C.A)(),e.fakePlaySamples=BigInt(0),e.lastRenderTimestamp=(0,C.A)(),this.fakePlayNext(e)),b.pq(`task unpaused, taskId: ${e.taskId}`,D,850))}async stop(t){const e=this.tasks.get(t);e&&(e.stopping=!0,e.receivePCMSync&&(e.receivePCMSync(),e.receivePCMSync=null),b.pq(`task stopping, taskId: ${e.taskId}`,D,862))}async registerTask(t){return this.tasks.has(t.taskId)?y.lh:this.createTask(t)}async unregisterTask(t){const e=this.tasks.get(t);if(e){if(e.fakePlayTimer&&(clearTimeout(e.fakePlayTimer),e.fakePlayTimer=null),e.resampler&&e.resampler.close(),e.stretchpitcher.size){for(const t of e.stretchpitcher.keys())e.stretchpitcher.get(t).close();e.stretchpitcher.clear()}e.outPCMBuffer&&((0,T.aI)(e.outPCMBuffer.data),(0,T.aI)(e.outPCMBuffer[l.o9]),(0,m.A)(e.outPCMBuffer)),e.waitPCMBuffer&&(e.waitAVFrame&&(p.M[20](e.waitPCMBuffer,0),p.M[15](e.waitPCMBuffer+12,0),e.avframePool.release(e.waitAVFrame)),this.avPCMBufferPool.release(e.waitPCMBuffer),e.waitPCMBuffer=0),e.paddingAVFrame&&e.avframePool.release(e.paddingAVFrame),e.leftIPCPort&&(e.leftIPCPort.destroy(),e.leftIPCPort=null),e.rightIPCPort&&(e.rightIPCPort.destroy(),e.rightIPCPort=null),this.tasks.delete(t)}}async clear(){await super.clear(),this.avPCMBufferList.clear((t=>{f.f[20](t)&&((0,T.aI)(f.f[20](t)),(0,T.aI)(t))}),20),(0,m.A)(this.avPCMBufferList),(0,m.A)(this.avPCMBufferListMutex)}}},72480:(t,e,i)=>{"use strict";i.d(e,{A:()=>V});var r=i(80662),s=i.n(r),a=i(61499),n=i(12264),o=i(29170),l=i(63939),c=i(50932),h=i(9599),u=i(44527),d=i(9705),f=i(84149),p=i(44315),m=i(24175),g=i(34531),v=i(75),y=i(37837),A=i(79630),b=i(4624),x=i(84290),w=i(39148),k=i(72739),T=i(44328),_=i(77231),I=i(43607),S=i(71517),P=i(14686),C=i(49032),M=i(94561),B=i(39638),E=i(26429),D=i(71762),R=i(72703),U=i(67672),L=i(62815),F=i(67659),O=i(59166),$=i(95797);const N="src/avpipeline/DemuxPipeline.ts",z=-1;class V extends u.A{constructor(){super()}createTask(t){let e,i;if(t.mainTaskId){const r=this.tasks.get(t.mainTaskId);e=r.leftIPCPort,i=r.controlIPCPort}else e=new f.Ay(t.leftPort),t.controlPort&&(i=new f.Ay(t.controlPort));const r=t.bufferLength||1048576,a=(0,y.sY)(r);if(!a)return d.gR;const l=(0,y.sY)(r);if(!l)return d.gR;const c=new A.A(a,r),h=new m.A(r,!0,c),u=new A.A(l,r),v=new g.A(r,!0,u);t.isLive||(h.flags|=1),t.flags&&(h.flags|=t.flags),h.onFlush=async i=>{const r={pointer:i.byteOffset,length:i.length};t.ioloaderOptions&&(r.ioloaderOptions=t.ioloaderOptions);try{const t=await e.request("read",r);return U.ai(t)?t:((0,P.lW)(r.pointer,t.length,t),t.length)}catch(t){return-1048574}},h.onSeek=async i=>{try{const r={pos:i};return t.ioloaderOptions&&(r.ioloaderOptions=t.ioloaderOptions),e.request("seek",r)}catch(t){return-1048574}},h.onSize=async()=>{try{return e.request("size")}catch(t){return BigInt(-1048574)}},v.onFlush=async t=>{const i={pointer:t.byteOffset,length:t.length};try{return await e.request("write",i)}catch(t){return-1048574}};const b=(0,p.Xv)();return b.ioReader=h,b.ioWriter=v,$.A.wasmBaseSupported&&(b.getDecoderResource=async(t,e)=>{if(!i)return;const r=await i.request("getDecoderResource",{codecId:e,mediaType:t});return(0,M.A)(r,0===t)}),this.tasks.set(t.taskId,{...t,leftIPCPort:e,rightIPCPorts:new(s()),controlIPCPort:i,formatContext:b,ioReader:h,iBuffer:a,oBuffer:l,cacheAVPackets:new(s()),cacheRequests:new(s()),streamIndexFlush:new(s()),realFormat:-1,demuxEnded:!1,loop:null,gopCounter:0,lastKeyFramePts:BigInt(0),lastAudioDts:BigInt(0),lastVideoDts:BigInt(0),avpacketPool:new x.A((0,o.A)(t.avpacketList,n.A),t.avpacketListMutex)}),0}async openStream(t,e=3e3){const r=this.tasks.get(t);if(r){let t,s,a=await r.leftIPCPort.request("open");if(a<0)return b.z3(`open ioloader failed, ret: ${a}`,N,295),a;try{6!==r.format?(t=await(0,C.A)(r.ioReader,r.format),r.format=t):t=r.format}catch(t){return d.LR}switch(t){case 0:s=new((await i.e(969).then(i.bind(i,28773))).default)(r.formatOptions);break;case 1:s=new((await i.e(531).then(i.bind(i,92047))).default)(r.formatOptions);break;case 2:s=new((await Promise.all([i.e(217),i.e(331)]).then(i.bind(i,59331))).default);break;case 3:s=new((await Promise.all([i.e(217),i.e(855)]).then(i.bind(i,83855))).default);break;case 5:s=new((await i.e(634).then(i.bind(i,16634))).default);break;case 4:s=new((await i.e(118).then(i.bind(i,29118))).default);break;case 14:s=new((await i.e(839).then(i.bind(i,6839))).default);break;case 8:case 9:s=new((await i.e(941).then(i.bind(i,34577))).default);break;case 15:s=new((await i.e(94).then(i.bind(i,47094))).default);break;case 17:s=new((await i.e(453).then(i.bind(i,18453))).default);break;case 16:s=new((await i.e(791).then(i.bind(i,3791))).default);break;case 18:s=new((await i.e(611).then(i.bind(i,85611))).default);break;case 19:s=new((await i.e(70).then(i.bind(i,78070))).default);break;case 20:s=new((await i.e(344).then(i.bind(i,47344))).default);break;case 21:s=new((await i.e(854).then(i.bind(i,98854))).default);break;case 11:s=new((await i.e(299).then(i.bind(i,5299))).default)(r.formatOptions);break;case 12:s=new((await i.e(487).then(i.bind(i,85487))).default)(r.formatOptions);break;case 13:s=new((await i.e(808).then(i.bind(i,95808))).default)(r.formatOptions);break;case 6:s=new((await i.e(522).then(i.bind(i,50522))).default)(r.formatOptions);break;default:return b.z3("format not support",N,489),d.E$}return r.realFormat=t,r.formatContext.iformat=s,v.ho(r.formatContext,{maxAnalyzeDuration:e,fastOpen:r.isLive})}b.h2("task not found",N,504)}async getFormat(t){const e=this.tasks.get(t);if(e)return e.realFormat;b.h2("task not found",N,514)}async analyzeStreams(t){const e=this.tasks.get(t);if(e){let t=await v.Ib(e.formatContext);if(t)return t;const i=[];for(let t=0;t{a.push(t.data.buffer)})),e.reply(i,s,null,a),void t.avpacketPool.release(r)}e.reply(i,r)}async connectStreamTask(t,e,i){const r=this.tasks.get(t);if(r){const t=new f.Ay(i);r.cacheAVPackets.set(e,[]),t.streamIndex=e,t.on(f.S3,(async e=>{switch(e.method){case"pull":{const i=r.cacheAVPackets.get(t.streamIndex);if(i.length){const s=i.shift();0!==r.stats&&(1===r.formatContext.streams[l.f[15](s+32)].codecpar.codecType?c.M[15](r.stats+32,l.f[15](r.stats+32)-1):0===r.formatContext.streams[l.f[15](s+32)].codecpar.codecType&&c.M[15](r.stats+120,l.f[15](r.stats+120)-1)),this.replyAVPacket(r,t,e,s)}else r.demuxEnded?t.reply(e,-1048576):(r.cacheRequests.set(t.streamIndex,e),r.loop&&r.loop.isStarted()&&r.loop.resetInterval());break}}})),r.rightIPCPorts.set(e,t),b.Yz(`connect stream ${e}, taskId: ${r.taskId}`,N,615)}else b.h2("task not found",N,618)}async changeConnectStream(t,e,i,r=!0){const s=this.tasks.get(t);if(s){if(e===i)return;const t=s.cacheAVPackets.get(i),a=s.rightIPCPorts.get(i),n=s.cacheRequests.get(i);t||b.R8(`oldStreamIndex ${i} not found`,N,635),await s.loop.stopBeforeNextTick(),r?(k.__(t,(t=>{s.avpacketPool.release(t)})),t.length=0):s.streamIndexFlush.set(e,!0),a.streamIndex=e,s.cacheAVPackets.set(e,t),s.rightIPCPorts.set(e,a),s.cacheAVPackets.delete(i),s.rightIPCPorts.delete(i),n&&(s.cacheRequests.set(e,n),s.cacheRequests.delete(i)),r||s.loop.start(),b.Yz(`changed connect stream, new ${e}, old: ${i}, force: ${r}, taskId: ${s.taskId}`,N,667)}else b.h2("task not found",N,670)}async doDemux(t,e){const i=t.avpacketPool.alloc();let r=await v.Cj(t.formatContext,i);if(r){t.avpacketPool.release(i),-1048576!==r&&b.z3(`demux error, ret: ${r}, taskId: ${t.taskId}`,N,800);for(let e of t.cacheRequests.keys())t.cacheAVPackets.get(e).length||(t.rightIPCPorts.get(e).reply(t.cacheRequests.get(e),-1048576),t.cacheRequests.delete(e))}else{const r=l.f[15](i+32);if(0!==t.stats)if(1===t.formatContext.streams[r].codecpar.codecType&&t.cacheAVPackets.has(r)){if(c.M[17](t.stats+24,l.f[17](t.stats+24)+BigInt(1)),c.M[17](t.stats+16,l.f[17](t.stats+16)+BigInt(0|l.f[15](i+28))),l.f[17](t.stats+24)>1&&l.f[17](i+16)>t.lastAudioDts){const e=t.cacheAVPackets.get(r);e&&e.length?c.M[15](t.stats+244,Math.round(l.f[15](i+76)/l.f[15](i+72)/(Number(BigInt.asIntN(32,l.f[17](i+16)-l.f[17](e[0]+16)))/e.length))):c.M[15](t.stats+244,Math.round(l.f[15](i+76)/l.f[15](i+72)/Number(BigInt.asIntN(32,l.f[17](i+16)-t.lastAudioDts))))}t.lastAudioDts=l.f[17](i+16)}else if(0===t.formatContext.streams[r].codecpar.codecType&&t.cacheAVPackets.has(r)){if(c.M[17](t.stats+112,l.f[17](t.stats+112)+BigInt(1)),c.M[17](t.stats+104,l.f[17](t.stats+104)+BigInt(0|l.f[15](i+28))),1&l.f[15](i+36)?(c.M[17](t.stats+176,l.f[17](t.stats+176)+BigInt(1)),l.f[17](t.stats+176)>1&&l.f[17](i+8)>t.lastKeyFramePts&&(c.M[15](t.stats+96,t.gopCounter),t.gopCounter=1,c.M[15](t.stats+92,Number(BigInt.asIntN(32,(0,T.k)(l.f[17](i+8)-t.lastKeyFramePts,(0,o.A)(i+72,h.P),_.i0))))),t.lastKeyFramePts=l.f[17](i+8)):t.gopCounter++,l.f[17](t.stats+112)>1&&l.f[17](i+16)>t.lastVideoDts){const e=t.cacheAVPackets.get(r);e&&e.length?c.M[15](t.stats+232,Math.round(l.f[15](i+76)/l.f[15](i+72)/(Number(BigInt.asIntN(32,l.f[17](i+16)-l.f[17](e[0]+16)))/e.length))):c.M[15](t.stats+232,Math.round(l.f[15](i+76)/l.f[15](i+72)/Number(BigInt.asIntN(32,l.f[17](i+16)-t.lastVideoDts))))}t.lastVideoDts=l.f[17](i+16)}if(t.streamIndexFlush.get(r)){const e=t.formatContext.streams.find((t=>t.index===r));if(!(0,S.rU)(i,1)&&e&&e.codecpar.extradataSize){const t=(0,y.sY)(e.codecpar.extradataSize);(0,P.Mr)(t,e.codecpar.extradata,e.codecpar.extradataSize),(0,S.Ow)(i,1,t,e.codecpar.extradataSize)}t.streamIndexFlush.set(r,!1)}t.cacheRequests.has(r)?(this.replyAVPacket(t,t.rightIPCPorts.get(r),t.cacheRequests.get(r),i),t.cacheRequests.delete(r)):t.cacheAVPackets.has(r)?(t.cacheAVPackets.get(r).push(i),0!==t.stats&&(1===t.formatContext.streams[r].codecpar.codecType?c.M[15](t.stats+32,l.f[15](t.stats+32)+1):0===t.formatContext.streams[r].codecpar.codecType&&c.M[15](t.stats+120,l.f[15](t.stats+120)+1)),3===t.formatContext.streams[r].codecpar.codecType&&t.cacheAVPackets.get(r).length>e&&t.avpacketPool.release(t.cacheAVPackets.get(r).shift())):t.rightIPCPorts.has(z)?t.cacheRequests.has(z)?(this.replyAVPacket(t,t.rightIPCPorts.get(z),t.cacheRequests.get(z),i),t.cacheRequests.delete(z)):t.cacheAVPackets.get(z).push(i):t.avpacketPool.release(i)}return r}async startDemux(t,e,i){const r=this.tasks.get(t);if(r){if(i=Math.max(i,2===r.format?20:10),r.loop&&r.loop.destroy(),r.loop=new w.A((async()=>{if(!e){let t=!1;if(r.cacheAVPackets.forEach(((e,s)=>{const a=r.formatContext.streams.find((t=>t.index===s));e.length{e.length>i&&(t=!0)})),t)break;if(await this.doDemux(r,i))return void(r.demuxEnded=!0)}r.loop.start(),b.Yz(`start demux loop, taskId: ${r.taskId}`,N,875)}else b.h2("task not found",N,878)}async seek(t,e,i,r=-1){const s=this.tasks.get(t);if(s){if(s.loop){await s.loop.stopBeforeNextTick();let t=await v.jF(s.formatContext,r,e,i);if(t>=BigInt(0)){s.cacheAVPackets.forEach((t=>{k.__(t,(t=>{s.avpacketPool.release(t)})),t.length=0})),0!==s.stats&&s.cacheAVPackets.forEach(((t,e)=>{const i=s.formatContext.streams.find((t=>t.index===e));1===i.codecpar.codecType?c.M[15](s.stats+32,0):0===i.codecpar.codecType&&c.M[15](s.stats+120,0)}));const i=s.avpacketPool.alloc();for(;t=await v.Cj(s.formatContext,i),!(t<0||s.cacheAVPackets.has(l.f[15](i+32))););if(t>=0){s.demuxEnded=!1;const t=l.f[15](i+32);s.cacheAVPackets.get(t).push(i),0!==s.stats&&(1===s.formatContext.streams[l.f[15](i+32)].codecpar.codecType?c.M[15](s.stats+32,l.f[15](s.stats+32)+1):0===s.formatContext.streams[l.f[15](i+32)].codecpar.codecType&&c.M[15](s.stats+120,l.f[15](s.stats+120)+1)),s.loop.start();let e=l.f[17](i+8);return s.formatContext.streams[t].startTime!==_.Dh?e-=s.formatContext.streams[t].startTime:e-=s.formatContext.streams[t].firstDTS,(0,T.k)(I.T9(e,BigInt(0)),(0,o.A)(i+72,h.P),_.i0)}return b.R8(`got first packet failed after seek, taskId: ${s.taskId}`,N,946),s.avpacketPool.release(i),s.demuxEnded=!0,e}return t}{b.pq("seek before demux loop start",N,957);let t=await v.jF(s.formatContext,-1,e,i);return t<0?t:e}}}async croppingAVPacketQueue(t,e){const i=this.tasks.get(t);if(i){let r=e;const a=new(s());function n(t,e){if(!(1&l.f[15](t+36)))return!1;let i=0!==(0,S.rU)(t,1);return i||2!==l.f[15](t+80)||(27===e?i=!!L.S1((0,S.iI)(t)):173===e?i=!!F.S1((0,S.iI)(t)):196===e&&(i=!!O.S1((0,S.iI)(t)))),i}i.cacheAVPackets.forEach(((t,s)=>{const c=i.formatContext.streams[s].codecpar.codecType,u=i.formatContext.streams[s].codecpar.codecId;if(0===c){const i=l.f[17](t[t.length-1]+16);let c=t.length-2;for(c=t.length-2;c>=0;c--)if(1&l.f[15](t[c]+36)&&(0,T.k)(i-l.f[17](t[c]+16),(0,o.A)(t[c]+72,h.P),_.i0)>=e){r=I.T9(r,(0,T.k)(i-l.f[17](t[c]+16),(0,o.A)(t[c]+72,h.P),_.i0));break}if((27===u||173===u||196===u)&&c>0&&!n(t[c],u))for(let e=c-1;e>0;e--)if(1&l.f[15](t[e]+36)&&n(t[e],u)){r=I.T9(r,(0,T.k)(i-l.f[17](t[e]+16),(0,o.A)(t[e]+72,h.P),_.i0)),c=e;break}c>0&&a.set(s,c)}})),i.cacheAVPackets.forEach(((t,e)=>{if(0!==i.formatContext.streams[e].codecpar.codecType){const i=l.f[17](t[t.length-1]+16);let s=t.length-2;for(s=t.length-2;s>=0&&!((0,T.k)(i-l.f[17](t[s]+16),(0,o.A)(t[s]+72,h.P),_.i0)>=r);s--);s>=0&&a.set(e,s)}})),a.size===i.cacheAVPackets.size&&a.forEach(((t,e)=>{const r=i.cacheAVPackets.get(e);r.splice(0,t).forEach((t=>{i.avpacketPool.release(t)}));const s=i.formatContext.streams[e].codecpar.codecType;0!==i.stats&&(1===s?c.M[15](i.stats+32,r.length):0===s&&c.M[15](i.stats+120,r.length))}))}}async stop(t){const e=this.tasks.get(t);e&&(e.formatContext.ioReader.flags|=8)}async registerTask(t){return this.tasks.has(t.taskId)?d.lh:this.createTask(t)}async unregisterTask(t){const e=this.tasks.get(t);e&&(e.loop&&(await e.loop.stopBeforeNextTick(),e.loop.destroy()),e.cacheAVPackets.forEach((t=>{t.forEach((t=>{e.avpacketPool.release(t)}))})),e.cacheRequests.forEach(((t,i)=>{e.rightIPCPorts.get(i).reply(t,-1048576)})),e.cacheRequests.clear(),await e.formatContext.destroy(),e.leftIPCPort.destroy(),e.rightIPCPorts.forEach((t=>{t.destroy()})),e.rightIPCPorts.clear(),e.iBuffer&&((0,y.Eb)(e.iBuffer),e.iBuffer=0),e.oBuffer&&((0,y.Eb)(e.oBuffer),e.oBuffer=0),this.tasks.delete(t))}}},87243:(t,e,i)=>{"use strict";i.d(e,{A:()=>m});var r=i(63939),s=i(50932),a=i(44527),n=i(77580),o=i(9705),l=i(84149),c=i(14686),h=i(79686),u=i(4624),d=i(14619),f=i(42383);const p="src/avpipeline/IOPipeline.ts";class m extends a.A{constructor(){super()}async createTask(t){let e;switch(t.type){case 0:e=new n.A(t.options);break;case 1:e=new h.A(t.options);break;case 2:e=new d.A(t.options);break;case 3:e=new f.A(t.options);break;case 4:e=new((await i.e(433).then(i.bind(i,15433))).default)(t.options);break;case 5:e=new((await i.e(576).then(i.bind(i,41576))).default)(t.options);break;case 6:e=new((await i.e(543).then(i.bind(i,67543))).default)(t.options)}if(!e)return o.UY;const a=new l.Ay(t.rightPort),m={...t,ioLoader:e,ipcPort:a};return a.on(l.S3,(async i=>{switch(i.method){case"open":try{const r=await e.open(t.info,t.range);if(r<0){u.z3(`loader open error, ${r}, taskId: ${t.taskId}`,p,127),a.reply(i,null,r);break}a.reply(i,r)}catch(e){u.z3(`loader open error, ${e}, taskId: ${t.taskId}`,p,134),a.reply(i,null,e)}break;case"read":{const n=i.params.pointer,l=i.params.length,h=i.params.ioloaderOptions,d=(0,c.JW)(n,l);try{const t=await e.read(d,h);s.M[17](m.stats+192,r.f[17](m.stats+192)+BigInt(0|t)),a.reply(i,t)}catch(e){u.z3(`loader read error, ${e}, taskId: ${t.taskId}`,p,155),a.reply(i,o.LR)}break}case"write":{const n=i.params.pointer,l=i.params.length,h=(0,c.JW)(n,l);try{const t=await e.write(h);s.M[17](m.stats+200,r.f[17](m.stats+200)+BigInt(0|l)),a.reply(i,t)}catch(e){u.z3(`loader write error, ${e}, taskId: ${t.taskId}`,p,177),a.reply(i,o.LR)}break}case"seek":{const r=i.params.pos,s=i.params.ioloaderOptions;try{const n=await e.seek(r,s);if(n<0){u.z3(`loader seek error, ${n}, taskId: ${t.taskId}`,p,193),a.reply(i,null,n);break}a.reply(i,n)}catch(e){u.z3(`loader seek error, ${e}, taskId: ${t.taskId}`,p,200),a.reply(i,null,e)}break}case"size":a.reply(i,await e.size())}})),this.tasks.set(t.taskId,m),0}async open(t){const e=this.tasks.get(t);if(e)return await e.ioLoader.open(e.info,e.range),0}async getDuration(t){const e=this.tasks.get(t);if(e)return 4===e.type||5===e.type?e.ioLoader.getDuration():0}async hasAudio(t){const e=this.tasks.get(t);return!(!e||5!==e.type)&&e.ioLoader.hasAudio()}async hasVideo(t){const e=this.tasks.get(t);return!(!e||5!==e.type)&&e.ioLoader.hasVideo()}async hasSubtitle(t){const e=this.tasks.get(t);return!(!e||5!==e.type)&&e.ioLoader.hasSubtitle()}async getVideoList(t){const e=this.tasks.get(t);if(e){if(5===e.type)return e.ioLoader.getVideoList();if(4===e.type)return e.ioLoader.getVideoList()}return{list:[],selectedIndex:0}}async getAudioList(t){const e=this.tasks.get(t);return e&&5===e.type?e.ioLoader.getAudioList():{list:[],selectedIndex:0}}async getSubtitleList(t){const e=this.tasks.get(t);return e&&5===e.type?e.ioLoader.getSubtitleList():{list:[],selectedIndex:0}}async selectVideo(t,e){const i=this.tasks.get(t);if(i)if(5===i.type)i.ioLoader.selectVideo(e);else if(4===i.type)return i.ioLoader.selectVideo(e)}async selectAudio(t,e){const i=this.tasks.get(t);i&&5===i.type&&i.ioLoader.selectAudio(e)}async selectSubtitle(t,e){const i=this.tasks.get(t);i&&5===i.type&&i.ioLoader.selectSubtitle(e)}async getMinBuffer(t){const e=this.tasks.get(t);if(e){if(5===e.type)return e.ioLoader.getMinBuffer();if(4===e.type)return e.ioLoader.getMinBuffer()}return 0}async registerTask(t){return this.tasks.has(t.taskId)?o.lh:this.createTask(t)}async unregisterTask(t){const e=this.tasks.get(t);e&&(await e.ioLoader.stop(),e.ipcPort.destroy(),this.tasks.delete(t))}}},44527:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var r=i(134),s=i(80662),a=i.n(s),n=i(4624);class o{constructor(){(0,r.A)(this,"tasks",void 0),this.tasks=new(a())}async clear(){if(this.tasks.size)for(const t of this.tasks.keys())await this.unregisterTask(t)}async setLogLevel(t){n.V$(t)}async getTaskCount(){return this.tasks.size}}},31138:(t,e,i)=>{"use strict";i.d(e,{A:()=>D});var r=i(54001),s=i.n(r),a=i(63939),n=i(50932),o=i(12264),l=i(29170),c=i(9599),h=i(44527),u=i(9705),d=i(84149),f=i(40417),p=i(71039),m=i(4624),g=i(16041),v=i(67672),y=i(72739),A=i(13724),b=(i(77162),i(84290)),x=i(39638),w=i(44328),k=i(86932),T=(i(77231),i(95797)),_=i(72703),I=i(94561),S=i(71762),P=i(37837),C=i(71766),M=i(71517),B=i(14686);const E="src/avpipeline/VideoDecodePipeline.ts";class D extends h.A{constructor(){super()}createWebCodecDecoder(t,e=!0){return new p.A({onError:e=>{if(t.hardwareRetryCount>3||!t.firstDecoded)t.targetDecoder===t.hardwareDecoder&&(t.targetDecoder=t.softwareDecoder,t.hardwareDecoder.close(),t.hardwareDecoder=null,t.decoderReady=this.openSoftwareDecoder(t),m.R8(`video decode error width hardware(${t.hardwareRetryCount}), taskId: ${t.taskId}, error: ${e}, try to fallback to software decoder`,E,128));else{t.hardwareRetryCount++;try{m.pq(`retry open hardware decoder(${t.hardwareRetryCount}), taskId: ${t.taskId}`,E,134),t.decoderReady=t.hardwareDecoder.open(t.parameters)}catch(e){m.R8(`retry open hardware decoder failed, fallback to software decoder, taskId: ${t.taskId}`,E,138)}}t.needKeyFrame=!0,t.leftIPCPort.request("requestKeyframe")},onReceiveFrame(e){t.firstDecoded=!0,t.frameCaches.push(e),n.M[17](t.stats+144,a.f[17](t.stats+144)+BigInt(1)),t.lastDecodeTimestamp&&n.M[15](t.stats+256,Math.max((0,k.A)()-t.lastDecodeTimestamp,a.f[15](t.stats+256))),t.lastDecodeTimestamp=(0,k.A)()},enableHardwareAcceleration:e})}createWasmcodecDecoder(t,e){return new f.A({resource:e,onError:e=>{m.z3(`video decode error, taskId: ${t.taskId}, error: ${e}`,E,164),t.openReject&&(t.openReject(u.r8),t.openReject=null)},onReceiveFrame(e){t.firstDecoded=!0,t.frameCaches.push(e),n.M[17](t.stats+144,a.f[17](t.stats+144)+BigInt(1)),t.lastDecodeTimestamp&&n.M[15](t.stats+256,Math.max((0,k.A)()-t.lastDecodeTimestamp,a.f[15](t.stats+256))),t.lastDecodeTimestamp=(0,k.A)()},avframePool:t.avframePool})}async pullAVPacketInternal(t,e){const i=await e.request("pull");if(v.ai(i))return i;{const e=t.avpacketPool.alloc();return(0,S.r0)(i,e),e}}async createTask(t){const e=new d.Ay(t.leftPort),i=new d.Ay(t.rightPort),r=[],c=new g.A((0,l.A)(t.avframeList,o.A),t.avframeListMutex),h={...t,resource:await(0,I.A)(t.resource,!0),leftIPCPort:e,rightIPCPort:i,softwareDecoder:null,hardwareDecoder:null,frameCaches:r,inputEnd:!1,targetDecoder:null,needKeyFrame:!0,parameters:0,hardwareRetryCount:0,lastDecodeTimestamp:0,firstDecoded:!1,decoderReady:null,softwareDecoderOpened:!1,avframePool:c,avpacketPool:new b.A((0,l.A)(t.avpacketList,o.A),t.avpacketListMutex)};return h.softwareDecoder=h.resource?this.createWasmcodecDecoder(h,h.resource):T.A.videoDecoder?this.createWebCodecDecoder(h,!1):null,h.softwareDecoder?(T.A.videoDecoder&&t.enableHardware&&(h.hardwareDecoder=this.createWebCodecDecoder(h)),h.targetDecoder=h.hardwareDecoder||h.softwareDecoder,this.tasks.set(t.taskId,h),i.on(d.S3,(async o=>{switch(o.method){case"pull":if(r.length){const t=r.shift();i.reply(o,t,null,(0,_.A)(t)||v.ai(t)?null:[t]);break}if(!h.inputEnd){for(;;){if(r.length){const t=r.shift();i.reply(o,t,null,(0,_.A)(t)||v.ai(t)?null:[t]);break}h.decoderReady&&(await h.decoderReady,h.decoderReady=null);const l=await this.pullAVPacketInternal(h,e);if(-1048576===l){if(h.targetDecoder===h.hardwareDecoder){let t=await s().race([new A.A(2),h.targetDecoder.flush()]);v.ai(t)&&m.R8(`video hardware decoder flush failed, ignore it, taskId: ${h.taskId}`,E,279)}else await h.targetDecoder.flush();if(h.inputEnd=!0,h.targetDecoder===h.hardwareDecoder&&await new A.A(0),r.length){const t=r.shift();i.reply(o,t,null,h.targetDecoder===h.hardwareDecoder?[t]:null);break}m.pq(`video decoder ended, taskId: ${h.taskId}`,E,296),i.reply(o,-1048576);break}if(!(l>0)){m.z3(`video decode pull avpacket error, taskId: ${t.taskId}, ret: ${l}`,E,416),i.reply(o,l);break}{if(h.needKeyFrame){if(!(1&a.f[15](l+36))){h.avpacketPool.release(l);continue}h.needKeyFrame=!1}let e=h.targetDecoder.decode(l);if(1&a.f[15](l+36)){const t=(0,M.rU)(l,1);0!==t&&(a.f[20](h.parameters+12)&&(0,P.Eb)(a.f[20](h.parameters+12)),n.M[15](h.parameters+16,a.f[15](t+4)),n.M[20](h.parameters+12,(0,P.sY)(a.f[15](t+4))),(0,B.Mr)(a.f[20](h.parameters+12),a.f[20](t),a.f[15](t+4)))}if(e<0){if(n.M[15](h.stats+136,a.f[15](h.stats+136)+1),h.targetDecoder instanceof p.A&&h.softwareDecoder){if(m.R8(`video decode error from hardware, taskId: ${h.taskId}, error: ${e}, try to fallback to software decoder`,E,337),h.targetDecoder===h.hardwareDecoder)h.hardwareDecoder.close(),h.hardwareDecoder=null;else{if(!h.resource){m.z3(`cannot fallback to wasm video decoder because of resource not found , taskId: ${t.taskId}`,E,349),i.reply(o,u.r8);break}h.softwareDecoder.close(),h.softwareDecoder=this.createWasmcodecDecoder(h,h.resource),h.softwareDecoderOpened=!1}try{await this.openSoftwareDecoder(h),h.targetDecoder=h.softwareDecoder}catch(e){m.z3(`video software decoder open error, taskId: ${t.taskId}`,E,359),i.reply(o,u.r8);break}if(!(1&a.f[15](l+36))){h.avpacketPool.release(l),h.needKeyFrame=!0,h.leftIPCPort.request("requestKeyframe");continue}if(e=h.targetDecoder.decode(l),e>=0){h.avpacketPool.release(l);continue}if(h.targetDecoder instanceof p.A&&h.resource){m.R8(`video decode error width webcodecs soft decoder, taskId: ${h.taskId}, error: ${e}, try to fallback to wasm software decoder`,E,373),h.softwareDecoder.close(),h.softwareDecoder=this.createWasmcodecDecoder(h,h.resource),h.softwareDecoderOpened=!1;try{await this.openSoftwareDecoder(h),h.targetDecoder=h.softwareDecoder}catch(e){m.z3(`video wasm software decoder open error, taskId: ${t.taskId}`,E,383),i.reply(o,u.r8);break}if(e=h.targetDecoder.decode(l),e>=0){h.avpacketPool.release(l);continue}}}h.avpacketPool.release(l),m.z3(`video decode error, taskId: ${t.taskId}, ret: ${e}`,E,402),i.reply(o,e);break}for(h.avpacketPool.release(l);h.targetDecoder instanceof p.A&&h.targetDecoder.getQueueLength()>20;)await new A.A(0)}}break}m.pq(`video decoder ended, taskId: ${h.taskId}`,E,423),i.reply(o,-1048576)}})),0):(m.z3("software decoder not support",E,236),u.lh)}async openSoftwareDecoder(t){if(t.softwareDecoder&&!t.softwareDecoderOpened){const e=t.parameters;let i=1;if((0,x.A)()){let t=a.f[15](e+56)*a.f[15](e+60),r=(0,w.lb)((0,l.A)(e+72,c.P));t>=2073600&&t<=2211840?(173!==a.f[15](e+4)&&196!==a.f[15](e+4)&&225!==a.f[15](e+4)||(i=2),r>30?(i=2,173!==a.f[15](e+4)&&196!==a.f[15](e+4)&&225!==a.f[15](e+4)||(i=4)):r>60&&(i=4,173!==a.f[15](e+4)&&196!==a.f[15](e+4)&&225!==a.f[15](e+4)||(i=6))):t>2211840&&t<=8294400?(i=4,173!==a.f[15](e+4)&&196!==a.f[15](e+4)&&225!==a.f[15](e+4)||(i=6)):t>8294400&&(i=6,173!==a.f[15](e+4)&&196!==a.f[15](e+4)&&225!==a.f[15](e+4)||(i=8)),i=Math.min(i,navigator.hardwareConcurrency)}try{await t.softwareDecoder.open(e,i,t.wasmDecoderOptions)}catch(r){if(!(t.softwareDecoder instanceof p.A&&t.resource))throw r;m.R8(`webcodecs software decoder open failed, ${r}, try to fallback to wasm software decoder`,E,494),t.softwareDecoder.close(),t.softwareDecoder=this.createWasmcodecDecoder(t,t.resource),await t.softwareDecoder.open(e,i),t.targetDecoder=t.softwareDecoder}t.softwareDecoderOpened=!0}}async reopenDecoder(t,e,i,r){const a=this.tasks.get(t);if(a){const t=(0,P.Gy)(168);let n;(0,_.A)(e)?(0,C.Yi)(t,e):(0,S.T8)(e,t),a.parameters&&(0,C.dn)(a.parameters),a.parameters=t,r&&(a.wasmDecoderOptions=r),i&&(i=await(0,I.A)(i,!0)),n=a.preferWebCodecs&&T.A.videoDecoder&&p.A.isSupported(t,!1)?this.createWebCodecDecoder(a,!1):i?this.createWasmcodecDecoder(a,i):T.A.videoDecoder?this.createWebCodecDecoder(a,!1):null;let o=T.A.videoDecoder&&a.enableHardware?this.createWebCodecDecoder(a,!0):null;return new(s())((async(e,r)=>{if(a.openReject=e,a.softwareDecoder&&a.softwareDecoder.close(),a.hardwareDecoder&&a.hardwareDecoder.close(),a.softwareDecoder=n,a.hardwareDecoder=o,a.targetDecoder=a.hardwareDecoder||a.softwareDecoder,a.hardwareRetryCount=0,a.hardwareDecoder)try{await a.hardwareDecoder.open(t),m.Yz(`reopen video hardware decoder, taskId: ${a.taskId}`,E,569)}catch(t){m.z3(`cannot reopen hardware decoder, ${t}, taskId: ${a.taskId}`,E,572),a.hardwareDecoder.close(),a.hardwareDecoder=null,a.targetDecoder=a.softwareDecoder}if(i&&(a.resource=i),a.targetDecoder===a.softwareDecoder)try{await this.openSoftwareDecoder(a),m.Yz(`reopen video soft decoder, taskId: ${a.taskId}`,E,587)}catch(t){if(m.z3(`reopen video software decoder failed, error: ${t}`,E,590),!a.hardwareDecoder)return void e(u.r8)}e(0)}))}m.h2("task not found",E,600)}async open(t,e,i={}){const r=this.tasks.get(t);if(r){r.wasmDecoderOptions=i;const t=(0,P.Gy)(168);if((0,_.A)(e)?(0,C.Yi)(t,e):(0,S.T8)(e,t),r.parameters&&(0,C.dn)(r.parameters),r.parameters=t,r.preferWebCodecs&&T.A.videoDecoder&&p.A.isSupported(t,!1)&&r.softwareDecoder instanceof f.A){r.softwareDecoder.close();const t=this.createWebCodecDecoder(r,!1);r.softwareDecoder===r.targetDecoder&&(r.targetDecoder=t),r.softwareDecoder=t}return new(s())((async(e,i)=>{if(r.openReject=e,r.hardwareDecoder)try{await r.hardwareDecoder.open(t)}catch(t){m.z3(`cannot open hardware decoder, ${t}`,E,640),r.hardwareDecoder.close(),r.hardwareDecoder=null,r.targetDecoder=r.softwareDecoder}if(r.targetDecoder===r.softwareDecoder)try{await this.openSoftwareDecoder(r)}catch(t){if(m.z3(`open video software decoder failed, error: ${t}`,E,652),!r.hardwareDecoder)return void e(u.r8)}e(0)}))}m.h2("task not found",E,662)}async setPlayRate(t,e){const i=this.tasks.get(t);if(i&&i.softwareDecoder){let t=-16,r=(0,w.lb)((0,l.A)(i.parameters+72,c.P));t=r>=120?e<=1?-16:e<1.5||e<3?8:32:r>=60?e<1.5?-16:e<3?8:e<8?24:32:-16,i.softwareDecoder.setSkipFrameDiscard(t)}}async resetTask(t){const e=this.tasks.get(t);e&&(e.targetDecoder===e.softwareDecoder?await e.targetDecoder.flush():e.targetDecoder===e.hardwareDecoder&&(e.hardwareDecoder.close(),e.hardwareDecoder=this.createWebCodecDecoder(e),await e.hardwareDecoder.open(e.parameters),e.targetDecoder=e.hardwareDecoder),y.__(e.frameCaches,(t=>{(0,_.A)(t)?e.avframePool.release(t):t.close()})),e.frameCaches.length=0,e.needKeyFrame=!0,e.inputEnd=!1,e.lastDecodeTimestamp=(0,k.A)(),m.pq(`reset video decoder, taskId: ${e.taskId}`,E,733))}async registerTask(t){return this.tasks.has(t.taskId)?u.lh:this.createTask(t)}async unregisterTask(t){const e=this.tasks.get(t);e&&(e.rightPort.close(),e.leftPort.close(),e.softwareDecoder&&e.softwareDecoder.close(),e.hardwareDecoder&&e.hardwareDecoder.close(),e.frameCaches.forEach((t=>{(0,_.A)(t)?e.avframePool.release(t):t.close()})),e.parameters&&(0,C.dn)(e.parameters),this.tasks.delete(t))}async getTasksInfo(){const t=[];return this.tasks.forEach((e=>{t.push({codecId:a.f[15](e.parameters+4),width:a.f[15](e.parameters+56),height:a.f[15](e.parameters+60),framerate:(0,w.lb)((0,l.A)(e.parameters+72,c.P)),hardware:e.targetDecoder===e.hardwareDecoder})})),t}}},33968:(t,e,i)=>{"use strict";i.d(e,{A:()=>V});var r=i(54001),s=i.n(r),a=i(12264),n=i(29170),o=i(63939),l=i(50932),c=i(44527),h=i(9705),u=i(84149),d=i(67672),f=i(72739),p=i(16041),m=i(95797),g=i(39148),v=i(86932),y=i(44328),A=i(77231),b=i(86834),x=i(4624),w=i(43607),k=i(15045),T=i(88103),_=i(54750),I=i(55196),S=i(43813),P=i(99293),C=i(37977),M=i(1052),B=i(90058),E=i(39638),D=i(7972),R=i(72703),U=i(44690);const L="src/avpipeline/VideoRenderPipeline.ts",F=[C.A,M.A];F.push(B.A);const O=[I.A,S.A];var $;O.push(P.A),function(t){t[t.None=0]="None",t[t.Accelerate=1]="Accelerate",t[t.Decelerate=2]="Decelerate"}($||($={}));let N=!1;const z=["bt2020","bt2100","st2048","p3-dcl","hlg"];class V extends c.A{constructor(){super()}async createTask(t){const e=new u.Ay(t.leftPort),i=new u.Ay(t.controlPort),r={...t,leftIPCPort:e,controlIPCPort:i,render:null,currentPTS:A.Dh,firstPTS:BigInt(0),startTimestamp:BigInt(0),playRate:BigInt(100),targetRate:BigInt(100),frontFrame:null,backFrame:null,renderFrame:null,renderFrameCount:BigInt(0),loop:null,renderRedyed:!1,adjust:$.None,adjustDiff:BigInt(0),lastAdjustTimestamp:BigInt(0),firstRendered:!1,canvasUpdated:!1,renderCreating:!1,renderRecreateCount:0,pauseTimestamp:0,pauseCurrentPts:BigInt(0),lastNotifyPTS:BigInt(0),skipRender:!1,isSupport:()=>!1,frontBuffered:!1,ended:!1,seeking:!1,seekSync:null,afterPullResolver:null,pausing:!1,lastRenderTimestamp:0,avframePool:new p.A((0,n.A)(t.avframeList,a.A),t.avframeListMutex)};return r.startPTS=(0,y.k)(r.startPTS,r.timeBase,A.i0),i.on(u.Wo,(async t=>{switch(t.method){case"syncPts":{const e=t.params.pts,i=Math.abs(Number(e-r.currentPTS));i>100&&r.currentPTS>BigInt(0)&&(e>r.currentPTS?(r.adjust=$.Accelerate,x.Yz(`video render sync pts accelerate, targetPTS: ${e}, currentPTS: ${r.currentPTS}, diff: ${i}, taskId: ${r.taskId}`,L,237)):(r.adjust=$.Decelerate,x.Yz(`video render sync pts decelerate, targetPTS: ${e}, currentPTS: ${r.currentPTS}, diff: ${i} taskId: ${r.taskId}`,L,241)),r.adjustDiff=BigInt(Math.floor(i)));break}case"skipRender":r.skipRender=t.params.skipRender}})),this.tasks.set(t.taskId,r),0}swap(t){if(t.seeking)return;if(t.backFrame&&((0,R.A)(t.backFrame)?t.avframePool.release(t.backFrame):t.backFrame.close()),t.backFrame=null,!t.frontBuffered)return!1;if(t.backFrame=t.frontFrame,t.frontFrame=null,t.ended)return;t.frontBuffered=!1;const e=(0,v.A)();return t.leftIPCPort.request("pull").then((i=>{if(t.afterPullResolver&&t.afterPullResolver(),d.ai(i)&&i<0)return t.ended=!0,void(t.frontFrame=null);const r=(0,v.A)()-e;if(r>1e3&&(t.startTimestamp+=BigInt(Math.floor(r))),t.frontFrame=i,t.frontBuffered=!0,t.seekSync)return t.seekSync(),void(t.seekSync=null);t.backFrame||this.swap(t)})),!0}async createRender(t,e,i=!1){var r;if(!t.renderCreating)if(t.renderCreating=!0,t.renderRedyed=!1,t.render&&t.render.destroy(),(0,R.A)(e)?t.enableWebGPU&&m.A.webgpu&&!N?f.__(F,(i=>{if(i.isSupport(e))return t.render=new i(t.canvas,{devicePixelRatio:t.devicePixelRatio,renderMode:t.renderMode,onRenderContextLost:()=>{t.canvasUpdated=!1,t.renderRedyed=!1,x.R8("render context lost",L,376),t.controlIPCPort.notify("updateCanvas")}}),t.isSupport=i.isSupport,!1})):f.__(O,(i=>{if(i.isSupport(e))return t.render=new i(t.canvas,{devicePixelRatio:t.devicePixelRatio,renderMode:t.renderMode,onRenderContextLost:()=>{t.canvasUpdated=!1,t.renderRedyed=!1,x.R8("render context lost",L,394),t.controlIPCPort.notify("updateCanvas")}}),t.isSupport=i.isSupport,!1})):t.enableWebGPU&&m.A.webgpu&&!N&&((b.A.chrome||b.A.newEdge)&&b.A.checkVersion(b.A.majorVersion,"116",!0)||b.A.safari&&b.A.checkVersion(b.A.majorVersion,"17.4",!0)||U.A.ios&&b.A.checkVersion(U.A.version,"17.4",!0)||b.A.firefox&&b.A.checkVersion(b.A.majorVersion,"129",!0))&&(r=e.colorSpace.primaries,!f.zy(z,r))?(t.render=new _.A(t.canvas,{devicePixelRatio:t.devicePixelRatio,renderMode:t.renderMode,onRenderContextLost:()=>{t.canvasUpdated=!1,t.renderRedyed=!1,x.R8("render context lost",L,346),t.controlIPCPort.notify("updateCanvas")}}),t.isSupport=_.A.isSupport):(t.render=new T.A(t.canvas,{devicePixelRatio:t.devicePixelRatio,renderMode:t.renderMode}),t.isSupport=T.A.isSupport),t.render){try{var s,a,n;await t.render.init(),t.render.viewport(t.viewportWidth,t.viewportHeight),t.render.setRotate(null!==(s=t.renderRotate)&&void 0!==s?s:0,!1),t.render.enableHorizontalFlip(null!==(a=t.flipHorizontal)&&void 0!==a&&a),t.render.enableVerticalFlip(null!==(n=t.flipVertical)&&void 0!==n&&n),t.render.render(e),t.render.clear()}catch(r){if(t.render instanceof k.A&&!i)return N=!0,t.renderCreating=!1,x.R8("not support webgpu render, try to fallback to webgl render",L,423),this.createRender(t,e,!0);if(i){if(t.renderCreating=!1,x.R8("canvas context lost after fallback, wait for recreate canvas",L,428),t.renderRecreateCount<3)return t.renderRecreateCount++,void t.controlIPCPort.notify("updateCanvas");throw r}}t.renderRedyed=!0,t.renderCreating=!1,t.renderRecreateCount=0}else t.renderCreating=!1}async play(t){const e=this.tasks.get(t);if(e){if(e.loop&&x.h2("task has already call play",L,450),e.backFrame=await e.leftIPCPort.request("pull"),d.ai(e.backFrame)&&e.backFrame<0)return e.backFrame=0,x.pq(`video render ended, taskId: ${e.taskId}`,L,457),void e.controlIPCPort.notify("ended");e.frontFrame=await e.leftIPCPort.request("pull"),e.frontBuffered=!0,e.ended=!1,d.ai(e.frontFrame)&&e.frontFrame<0&&(e.ended=!0,e.frontBuffered=!1,e.frontFrame=0),await this.createRender(e,e.backFrame),e.firstPTS=(0,y.k)((0,R.A)(e.backFrame)?o.f[17](e.backFrame+104):BigInt(Math.floor(e.backFrame.timestamp)),e.timeBase,A.i0),x.Yz(`got first video frame, pts: ${(0,R.A)(e.backFrame)?o.f[17](e.backFrame+104):BigInt(Math.floor(e.backFrame.timestamp))}(${e.firstPTS}ms), taskId: ${e.taskId}`,L,481),e.firstPTS{if(!e.backFrame)return void(e.ended?(e.render&&e.renderRedyed&&e.render.clear(),e.loop.stop(),e.adjust=$.None,x.pq(`video render ended, taskId: ${e.taskId}`,L,509),e.controlIPCPort.notify("ended")):e.loop.emptyTask());if(!e.isSupport(e.backFrame)){if(e.render)return e.renderRedyed=!1,e.renderFrame=e.backFrame,void e.controlIPCPort.notify("updateCanvas");this.createRender(e,e.backFrame)}const i=(0,y.k)((0,R.A)(e.backFrame)?o.f[17](e.backFrame+104):BigInt(Math.floor(e.backFrame.timestamp)),e.timeBase,A.i0);if(iBigInt(5e3)))return x.R8(`dropping frame with pts ${i}, which is earlier then the last rendered frame(${e.currentPTS}), taskId: ${e.taskId}`,L,539),void this.swap(e);e.startTimestamp=BigInt(Math.floor((0,v.A)()))-i*BigInt(100)/e.targetRate}else i-e.currentPTS>BigInt(5e3)&&(e.startTimestamp=BigInt(Math.floor((0,v.A)()))-i*BigInt(100)/e.targetRate);if(e.adjust===$.Accelerate){if(e.adjustDiff<=0)e.adjust=$.None,e.startTimestamp=BigInt(Math.floor((0,v.A)()))-i*BigInt(100)/e.targetRate,e.lastAdjustTimestamp=BigInt(0);else if(BigInt(Math.floor((0,v.A)()))-e.lastAdjustTimestamp>=BigInt(200)){const t=e.adjustDiff<=BigInt(100)?e.adjustDiff:w.jk(e.adjustDiff,BigInt(100))*BigInt(100)/e.targetRate;e.startTimestamp-=t,e.adjustDiff-=t,x.Yz(`video render accelerate startTimestamp sub: ${t}, taskId: ${e.taskId}`,L,564),e.lastAdjustTimestamp=BigInt(Math.floor((0,v.A)()))}}else if(e.adjust===$.Decelerate)if(e.adjustDiff<=0)e.adjust=$.None,e.startTimestamp=BigInt(Math.floor((0,v.A)()))-i*BigInt(100)/e.targetRate,e.lastAdjustTimestamp=BigInt(0);else if(BigInt(Math.floor((0,v.A)()))-e.lastAdjustTimestamp>=BigInt(300)){const t=e.adjustDiff=BigInt(1e3)&&(e.lastNotifyPTS=i,e.controlIPCPort.notify("syncPts",{pts:i})),this.swap(e)):e.loop.emptyTask(),e.playRate!==e.targetRate&&(e.startTimestamp=BigInt(Math.floor((0,v.A)()))-i*BigInt(100)/e.targetRate,e.playRate=e.targetRate)}),0,i),e.loop.start()}else x.h2("task not found",L,658)}async restart(t){const e=this.tasks.get(t);e&&(e.loop||x.h2("task has not played",L,666),e.loop.isStarted()&&x.h2("task has already run",L,670),e.backFrame&&((0,R.A)(e.backFrame)?e.avframePool.release(e.backFrame):e.backFrame.close()),e.frontFrame&&((0,R.A)(e.frontFrame)?e.avframePool.release(e.frontFrame):e.frontFrame.close()),e.backFrame=await e.leftIPCPort.request("pull"),e.frontFrame=await e.leftIPCPort.request("pull"),e.frontBuffered=!0,e.ended=!1,e.adjust=$.None,e.lastNotifyPTS=A.Dh,e.firstRendered=!1,e.firstPTS=(0,y.k)((0,R.A)(e.backFrame)?o.f[17](e.backFrame+104):BigInt(Math.floor(e.backFrame.timestamp)),e.timeBase,A.i0),e.currentPTS=e.firstPTS,e.firstPTS!1,i.canvasUpdated=!0,i.firstRendered=!1,i.renderRedyed=!1):x.h2("task not found",L,767)}async setPlayRate(t,e){const i=this.tasks.get(t);i&&(i.enableJitterBuffer&&o.f[15](i.stats+120)/o.f[15](i.stats+232)*1e3<=o.f[15](i.stats+280)&&(e=1),i.targetRate=BigInt(Math.floor(Math.floor(100*e))))}async setRenderMode(t,e){const i=this.tasks.get(t);i&&i.render&&(i.renderMode=e,i.render.setRenderMode(e),(0,D.A)((()=>{i.pausing&&i.backFrame&&i.render&&i.render.render(i.backFrame)})))}async setRenderRotate(t,e){const i=this.tasks.get(t);i&&i.render&&(i.renderRotate=e,i.render.setRotate(e),(0,D.A)((()=>{i.pausing&&i.backFrame&&i.render&&i.render.render(i.backFrame)})))}async enableHorizontalFlip(t,e){const i=this.tasks.get(t);i&&i.render&&(i.flipHorizontal=e,i.render.enableHorizontalFlip(e),(0,D.A)((()=>{i.pausing&&i.backFrame&&i.render&&i.render.render(i.backFrame)})))}async enableVerticalFlip(t,e){const i=this.tasks.get(t);i&&i.render&&(i.flipVertical=e,i.render.enableVerticalFlip(e),(0,D.A)((()=>{i.pausing&&i.backFrame&&i.render&&i.render.render(i.backFrame)})))}async resize(t,e,i){const r=this.tasks.get(t);r&&r.render&&(r.render.viewport(e,i),(0,D.A)((()=>{r.pausing&&r.backFrame&&r.render&&r.render.render(r.backFrame)})))}async setSkipRender(t,e){const i=this.tasks.get(t);i&&(i.skipRender=e,l.M[15](i.stats+260,0),i.lastRenderTimestamp=(0,v.A)())}async beforeSeek(t){const e=this.tasks.get(t);e&&(e.ended||e.frontBuffered||(x.Yz(`wait current pull front frame before seek, taskId: ${e.taskId}`,L,872),await new(s())((t=>{e.seekSync=t}))),e.seeking=!0,e.loop.stop(),e.backFrame&&((0,R.A)(e.backFrame)?e.avframePool.release(e.backFrame):e.backFrame.close()),e.frontFrame&&((0,R.A)(e.frontFrame)?e.avframePool.release(e.frontFrame):e.frontFrame.close()),e.frontFrame=null,e.backFrame=null,e.currentPTS=A.Dh,x.Yz(`before seek end, taskId: ${e.taskId}`,L,900))}async syncSeekTime(t,e,i){const r=this.tasks.get(t);if(r){for(;;){if(r.afterPullResolver)return r.ended=!0,r.adjust=$.None,r.backFrame=null,void x.R8(`pull video frame end after unregisterTask, taskId: ${t}`,L,913);if(r.backFrame=await r.leftIPCPort.request("pull"),d.ai(r.backFrame)&&r.backFrame<0)return r.ended=!0,r.adjust=$.None,r.backFrame=null,void x.R8(`pull video frame end after seek, taskId: ${t}`,L,923);if(e=e){l.M[17](r.stats+336,i);break}(0,R.A)(r.backFrame)?r.avframePool.release(r.backFrame):r.backFrame.close()}x.Yz(`sync seek time end, taskId: ${r.taskId}`,L,956)}}async afterSeek(t,e){const i=this.tasks.get(t);if(i){if(i.ended)return i.seeking=!1,i.controlIPCPort.notify("ended"),i.afterPullResolver&&(i.afterPullResolver(),i.afterPullResolver=null),void x.Yz(`after seek end with task ended, taskId: ${i.taskId}`,L,971);if(i.startTimestamp=BigInt(Math.floor((0,v.A)()))-(e+i.startPTS)*BigInt(100)/i.playRate,i.frontFrame=await i.leftIPCPort.request("pull"),d.ai(i.frontFrame)&&i.frontFrame<0?(i.frontFrame=null,i.frontBuffered=!1,i.ended=!0):(i.frontBuffered=!0,i.ended=!1),i.afterPullResolver)return i.backFrame&&((0,R.A)(i.backFrame)?i.avframePool.release(i.backFrame):i.backFrame.close(),i.backFrame=null),i.frontFrame&&((0,R.A)(i.frontFrame)?i.avframePool.release(i.frontFrame):i.frontFrame.close(),i.frontFrame=null),i.seeking=!1,i.ended=!0,i.afterPullResolver(),i.afterPullResolver=null,void x.Yz(`after seek end with unregisterTask call, taskId: ${i.taskId}`,L,1011);i.adjust=$.None,i.lastRenderTimestamp=(0,v.A)(),i.currentPTS=(0,y.k)((0,R.A)(i.backFrame)?o.f[17](i.backFrame+104):BigInt(Math.floor(i.backFrame.timestamp)),i.timeBase,A.i0),l.M[17](i.stats+336,i.currentPTS),x.Yz(`got first video frame, pts: ${(0,R.A)(i.backFrame)?o.f[17](i.backFrame+104):BigInt(Math.floor(i.backFrame.timestamp))}(${i.currentPTS}ms), taskId: ${i.taskId}`,L,1025),i.seeking=!1,i.pausing?i.backFrame&&(i.render.render(i.backFrame),i.pauseCurrentPts=i.currentPTS,i.pauseTimestamp=(0,v.A)()):i.loop.start(),x.Yz(`after seek end, taskId: ${i.taskId}`,L,1041)}}async renderNextFrame(t){const e=this.tasks.get(t);if(e&&e.backFrame){const t=(0,y.k)((0,R.A)(e.backFrame)?o.f[17](e.backFrame+104):BigInt(Math.floor(e.backFrame.timestamp)),e.timeBase,A.i0);e.render.render(e.backFrame),l.M[17](e.stats+336,t),l.M[17](e.stats+160,o.f[17](e.stats+160)+BigInt(1)),e.currentPTS=t,this.swap(e)}}async registerTask(t){return this.tasks.has(t.taskId)?h.lh:await this.createTask(t)}async unregisterTask(t){const e=this.tasks.get(t);if(e){const i=!!e.loop;e.loop&&(await e.loop.stopBeforeNextTick(),e.loop.destroy(),e.loop=null),!i||e.ended||e.frontFrame||await new(s())((t=>{e.afterPullResolver=t})),e.render&&(e.render.destroy(),e.render=null),e.backFrame&&((0,R.A)(e.backFrame)&&e.backFrame>0?e.avframePool.release(e.backFrame):e.backFrame.close(),e.backFrame=null),e.frontFrame&&((0,R.A)(e.frontFrame)&&e.frontFrame>0?e.avframePool.release(e.frontFrame):e.frontFrame.close(),e.frontFrame=null),e.leftIPCPort.destroy(),e.controlIPCPort.destroy(),this.tasks.delete(t)}}}},30128:(t,e,i)=>{"use strict";i.d(e,{A:()=>u});var r,s,a=i(134),n=i(80662),o=i.n(n),l=i(61499),c=i(12085);class h{constructor(){(0,a.A)(this,"min",void 0),(0,a.A)(this,"max",void 0)}}r=h.prototype,(s=new(o())).set("min",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}),s.set("max",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:4,8:0}),(0,c.A)(r,l.Og,!0),(0,c.A)(r,l.dc,4),(0,c.A)(r,l.g7,8),(0,c.A)(r,l.JY,s);class u{constructor(){(0,a.A)(this,"channels",void 0),(0,a.A)(this,"sampleRate",void 0),(0,a.A)(this,"audioFrameSize",void 0),(0,a.A)(this,"audioPacketBytes",void 0),(0,a.A)(this,"audioPacketCount",void 0),(0,a.A)(this,"audioPacketQueueLength",void 0),(0,a.A)(this,"audioDropPacketCount",void 0),(0,a.A)(this,"audioDecodeErrorPacketCount",void 0),(0,a.A)(this,"audioEncodeErrorFrameCount",void 0),(0,a.A)(this,"audioFrameDecodeCount",void 0),(0,a.A)(this,"audioPacketEncodeCount",void 0),(0,a.A)(this,"audioFrameRenderCount",void 0),(0,a.A)(this,"audioFrameDropCount",void 0),(0,a.A)(this,"width",void 0),(0,a.A)(this,"height",void 0),(0,a.A)(this,"keyFrameInterval",void 0),(0,a.A)(this,"gop",void 0),(0,a.A)(this,"videoPacketBytes",void 0),(0,a.A)(this,"videoPacketCount",void 0),(0,a.A)(this,"videoPacketQueueLength",void 0),(0,a.A)(this,"videoDropPacketCount",void 0),(0,a.A)(this,"videoDecodeErrorPacketCount",void 0),(0,a.A)(this,"videoEncodeErrorFrameCount",void 0),(0,a.A)(this,"videoFrameDecodeCount",void 0),(0,a.A)(this,"videoPacketEncodeCount",void 0),(0,a.A)(this,"videoFrameRenderCount",void 0),(0,a.A)(this,"videoFrameDropCount",void 0),(0,a.A)(this,"keyFrameCount",void 0),(0,a.A)(this,"bufferDropBytes",void 0),(0,a.A)(this,"bufferReceiveBytes",void 0),(0,a.A)(this,"bufferSendBytes",void 0),(0,a.A)(this,"bufferOutputBytes",void 0),(0,a.A)(this,"audioBitrate",void 0),(0,a.A)(this,"videoBitrate",void 0),(0,a.A)(this,"videoDecodeFramerate",void 0),(0,a.A)(this,"videoRenderFramerate",void 0),(0,a.A)(this,"videoEncodeFramerate",void 0),(0,a.A)(this,"audioDecodeFramerate",void 0),(0,a.A)(this,"audioRenderFramerate",void 0),(0,a.A)(this,"audioEncodeFramerate",void 0),(0,a.A)(this,"audioFrameDecodeIntervalMax",void 0),(0,a.A)(this,"audioFrameRenderIntervalMax",void 0),(0,a.A)(this,"videoFrameDecodeIntervalMax",void 0),(0,a.A)(this,"videoFrameRenderIntervalMax",void 0),(0,a.A)(this,"bandwidth",void 0),(0,a.A)(this,"jitter",void 0),(0,a.A)(this,"jitterBuffer",void 0),(0,a.A)(this,"audioStutter",void 0),(0,a.A)(this,"videoStutter",void 0),(0,a.A)(this,"audiocodec",void 0),(0,a.A)(this,"videocodec",void 0),(0,a.A)(this,"firstAudioMuxDts",void 0),(0,a.A)(this,"lastAudioMuxDts",void 0),(0,a.A)(this,"firstVideoMuxDts",void 0),(0,a.A)(this,"lastVideoMuxDts",void 0),(0,a.A)(this,"audioCurrentTime",void 0),(0,a.A)(this,"videoCurrentTime",void 0)}}!function(t){var e=new(o());e.set("channels",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}),e.set("sampleRate",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:4,8:0}),e.set("audioFrameSize",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:8,8:0}),e.set("audioPacketBytes",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:16,8:0}),e.set("audioPacketCount",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:24,8:0}),e.set("audioPacketQueueLength",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:32,8:0}),e.set("audioDropPacketCount",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:40,8:0}),e.set("audioDecodeErrorPacketCount",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:48,8:0}),e.set("audioEncodeErrorFrameCount",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:52,8:0}),e.set("audioFrameDecodeCount",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:56,8:0}),e.set("audioPacketEncodeCount",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:64,8:0}),e.set("audioFrameRenderCount",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:72,8:0}),e.set("audioFrameDropCount",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:80,8:0}),e.set("width",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:84,8:0}),e.set("height",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:88,8:0}),e.set("keyFrameInterval",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:92,8:0}),e.set("gop",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:96,8:0}),e.set("videoPacketBytes",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:104,8:0}),e.set("videoPacketCount",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:112,8:0}),e.set("videoPacketQueueLength",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:120,8:0}),e.set("videoDropPacketCount",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:128,8:0}),e.set("videoDecodeErrorPacketCount",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:136,8:0}),e.set("videoEncodeErrorFrameCount",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:140,8:0}),e.set("videoFrameDecodeCount",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:144,8:0}),e.set("videoPacketEncodeCount",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:152,8:0}),e.set("videoFrameRenderCount",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:160,8:0}),e.set("videoFrameDropCount",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:168,8:0}),e.set("keyFrameCount",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:176,8:0}),e.set("bufferDropBytes",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:184,8:0}),e.set("bufferReceiveBytes",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:192,8:0}),e.set("bufferSendBytes",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:200,8:0}),e.set("bufferOutputBytes",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:208,8:0}),e.set("audioBitrate",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:216,8:0}),e.set("videoBitrate",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:220,8:0}),e.set("videoDecodeFramerate",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:224,8:0}),e.set("videoRenderFramerate",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:228,8:0}),e.set("videoEncodeFramerate",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:232,8:0}),e.set("audioDecodeFramerate",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:236,8:0}),e.set("audioRenderFramerate",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:240,8:0}),e.set("audioEncodeFramerate",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:244,8:0}),e.set("audioFrameDecodeIntervalMax",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:248,8:0}),e.set("audioFrameRenderIntervalMax",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:252,8:0}),e.set("videoFrameDecodeIntervalMax",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:256,8:0}),e.set("videoFrameRenderIntervalMax",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:260,8:0}),e.set("bandwidth",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:264,8:0}),e.set("jitter",{0:19,1:0,2:0,3:0,4:0,5:0,6:0,7:272,8:0}),e.set("jitterBuffer",{0:h,1:0,2:0,3:0,4:0,5:0,6:0,7:280,8:0}),e.set("audioStutter",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:288,8:0}),e.set("videoStutter",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:292,8:0}),e.set("firstAudioMuxDts",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:296,8:0}),e.set("lastAudioMuxDts",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:304,8:0}),e.set("firstVideoMuxDts",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:312,8:0}),e.set("lastVideoMuxDts",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:320,8:0}),e.set("audioCurrentTime",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:328,8:0}),e.set("videoCurrentTime",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:336,8:0}),(0,c.A)(t,l.Og,!0),(0,c.A)(t,l.dc,8),(0,c.A)(t,l.g7,344),(0,c.A)(t,l.JY,e)}(u.prototype)},61634:(t,e,i)=>{"use strict";i.d(e,{A:()=>Ut,K:()=>Dt});var r=i(134),s=i(66681),a=i.n(s),n=i(54001),o=i.n(n),l=i(73146),c=i.n(l),h=i(80662),u=i.n(h),d=i(61499),f=i(52277),p=i(74503),m=i(63939),g=i(9599),v=i(29170),y=i(77162),A=i(94300),b=i(87243),x=i(72480),w=i(31138),k=i(18667),T=i(88506),_=i(96172),I=i(8284),S=i(67672),P=i(95335),C=i(76045),M=i(56024),B=i(71517),E=i(59377),D=i(33968),R=i(8507),U=i(26429),L=i(41324),F=i(88397),O=i(11473),$=i(11628),N=i(28090),z=i(47595),V=i(4624),W=i(95797),G=i(48641),j=i(36),H=i(86834),q=i(44328),Y=i(77231),K=(i(30128),i(14686)),Q=i(67593),X=i(28875),Z=i(10333),J=i(85224),tt=i(25115),et=i(39365),it=i(13724),rt=i(78201),st=i(73783),at=i(43607),nt=i(76750),ot=i(2368),lt=i(79756),ct=i(62751),ht=i(548),ut=i(72739),dt=i(24310),ft=i(93147),pt=i(40031),mt=i(94561),gt=i(44690),vt=i(84149),yt=i(9705),At=i(77580),bt=i(79686),xt=i(49847),wt=i(71762),kt=i(29998),Tt=i(40097),_t=i(21678),It=i(21862),St=i(364),Pt=i(14619),Ct=i(36773),Mt=i(42383);const Bt="src/avplayer/AVPlayer.ts",Et={1:"cover",0:"contain"},Dt=[27,173,12,196,225,139,167,30,86018,86017,86076,86028,86051,86021,86019,86056,86020,94226,94225,94230,94212,94232,94213,94210],Rt={enableHardware:!0,enableWebGPU:!0,enableWorker:!0,enableWebCodecs:!0,loop:!1,jitterBufferMax:4,jitterBufferMin:1,lowLatency:!1,preLoadTime:4};class Ut extends _.A{constructor(t){super(!0),(0,r.A)(this,"VideoDecoderThread",void 0),(0,r.A)(this,"VideoRenderThread",void 0),(0,r.A)(this,"VideoPipelineProxy",void 0),(0,r.A)(this,"GlobalData",void 0),(0,r.A)(this,"taskId",void 0),(0,r.A)(this,"subTaskId",void 0),(0,r.A)(this,"subtitleTaskId",void 0),(0,r.A)(this,"ext",void 0),(0,r.A)(this,"source",void 0),(0,r.A)(this,"ioIPCPort",void 0),(0,r.A)(this,"options",void 0),(0,r.A)(this,"ioloader2DemuxerChannel",void 0),(0,r.A)(this,"demuxer2VideoDecoderChannel",void 0),(0,r.A)(this,"demuxer2AudioDecoderChannel",void 0),(0,r.A)(this,"videoDecoder2VideoRenderChannel",void 0),(0,r.A)(this,"audioDecoder2AudioRenderChannel",void 0),(0,r.A)(this,"audioRender2AudioWorkletChannel",void 0),(0,r.A)(this,"audioSourceNode",void 0),(0,r.A)(this,"gainNode",void 0),(0,r.A)(this,"formatContext",void 0),(0,r.A)(this,"canvas",void 0),(0,r.A)(this,"updateCanvas",void 0),(0,r.A)(this,"video",void 0),(0,r.A)(this,"audio",void 0),(0,r.A)(this,"controller",void 0),(0,r.A)(this,"volume",void 0),(0,r.A)(this,"playRate",void 0),(0,r.A)(this,"renderMode",void 0),(0,r.A)(this,"renderRotate",void 0),(0,r.A)(this,"flipHorizontal",void 0),(0,r.A)(this,"flipVertical",void 0),(0,r.A)(this,"useMSE",void 0),(0,r.A)(this,"audioEnded",void 0),(0,r.A)(this,"videoEnded",void 0),(0,r.A)(this,"status",void 0),(0,r.A)(this,"lastStatus",void 0),(0,r.A)(this,"playChannels",void 0),(0,r.A)(this,"statsController",void 0),(0,r.A)(this,"jitterBufferController",void 0),(0,r.A)(this,"selectedVideoStream",void 0),(0,r.A)(this,"selectedAudioStream",void 0),(0,r.A)(this,"selectedSubtitleStream",void 0),(0,r.A)(this,"lastSelectedInnerSubtitleStreamIndex",void 0),(0,r.A)(this,"subtitleRender",void 0),(0,r.A)(this,"externalSubtitleTasks",void 0),this.options=P.X$({},Rt,t),this.taskId=(0,I.A)(),this.status=0,this.volume=1,this.playRate=1,this.renderMode=0,this.renderRotate=0,this.flipHorizontal=!1,this.flipVertical=!1,this.GlobalData=(0,p.A)(f.M),this.statsController=new rt.A(this.GlobalData[d.o9]+32,!(U.USE_THREADS||!W.A.worker||!this.options.enableWorker),this),this.externalSubtitleTasks=[],this.lastSelectedInnerSubtitleStreamIndex=-1,st.Ts(this.GlobalData[d.o9]+24),st.Ts(this.GlobalData[d.o9]+28),V.pq(`create player, taskId: ${this.taskId}`,Bt,436)}get currentTime(){var t;return this.useMSE?BigInt(Math.floor(1e3*((null===(t=this.video||this.audio)||void 0===t?void 0:t.currentTime)||0))):this.selectedAudioStream?this.GlobalData.stats.audioCurrentTime:this.selectedVideoStream?this.GlobalData.stats.videoCurrentTime:BigInt(0)}isCodecIdSupported(t){return t>65536&&t<=65572||ut.zy(Dt,t)}findBestStream(t,e){if(this.options.findBestStream)return this.options.findBestStream(t,e);const i=t.filter((t=>m.f[15](t.codecpar)===e));if(i.length){if(1===i.length)return i[0];const t=i.find((t=>!!(1&t.disposition)));return t&&this.isCodecIdSupported(m.f[15](t.codecpar+4))?t:i.find((t=>this.isCodecIdSupported(m.f[15](t.codecpar+4))))||i[0]}}async checkUseMSE(){{if(!W.A.mse)return!1;if(!W.A.wasmPlayerSupported)return!0;const t=this.findBestStream(this.formatContext.streams,0),e=this.findBestStream(this.formatContext.streams,1);if(t&&!(0,nt.A)().isTypeSupported((0,Z.A)(t.codecpar)))return V.R8(`can not support mse for codec: ${(0,Z.A)(t.codecpar)}, taskId: ${this.taskId}`,Bt,497),!1;if(e&&!(0,nt.A)().isTypeSupported((0,J.A)(e.codecpar)))return V.R8(`can not support mse for codec: ${(0,J.A)(e.codecpar)}, taskId: ${this.taskId}`,Bt,501),!1;if(this.options.checkUseMES)return this.options.checkUseMES(this.formatContext.streams);if(t){if((0,dt.A)(t.codecpar))return V.pq("use mse because of hdr",Bt,513),!0;if(m.f[15](t.codecpar+56)*m.f[15](t.codecpar+60)>2073600){if(!W.A.videoDecoder)return!0;let e=null;if(0!==m.f[20](t.codecpar+12)&&(e=(0,K.s3)(m.f[20](t.codecpar+12),m.f[15](t.codecpar+16))),!(await VideoDecoder.isConfigSupported({codec:(0,X.A)(t.codecpar),codedWidth:m.f[15](t.codecpar+56),codedHeight:m.f[15](t.codecpar+60),description:e,hardwareAcceleration:(0,et.C)(!0)})).supported)return!0}else if(m.f[15](t.codecpar+56)*m.f[15](t.codecpar+60)==2073600&&(H.A.safari&&!H.A.checkVersion(H.A.version,"16.1",!0)||gt.A.ios&&!H.A.checkVersion(gt.A.version,"16.1",!0))&&(0,q.lb)((0,v.A)(t.codecpar+72,g.P))>30)return!0}}return!1}createCanvas(){const t=document.createElement("canvas");return t.id="avplayer-canvas-"+(0,I.A)(),t.className="avplayer-canvas",t.width=this.options.container.offsetWidth*devicePixelRatio,t.height=this.options.container.offsetHeight*devicePixelRatio,t.style.cssText="\n width: 100%;\n height: 100%;\n ",t.ondragstart=()=>!1,a()(t,"currentTime",{enumerable:!0,configurable:!1,get:()=>Number(this.currentTime)/1e3,set:t=>{this.seek(BigInt(Math.floor(Math.floor(1e3*t))))}}),t}createVideo(){this.video&&this.options.container.removeChild(this.video);const t=document.createElement("video");t.autoplay=!0,t.className="avplayer-video",t.style.cssText="\n width: 100%;\n height: 100%;\n ",this.options.container.appendChild(t),this.video=t}createAudio(){this.audio&&this.options.container.removeChild(this.audio);const t=document.createElement("audio");t.autoplay=!0,t.className="avplayer-audio",this.options.container.appendChild(t),this.audio=t}handleTimeupdate(t){let e=0;t.ontimeupdate=()=>{const i=t.currentTime;Math.abs(i-e)>=1&&(6===this.status&&(this.fire(N.E9,[this.currentTime]),Ut.MSEThread.setCurrentTime(this.taskId,i)),e=i)},t.onended=()=>{this.audioEnded=!0,this.videoEnded=!0,this.handleEnded()},t.onwaiting=()=>{this.audio===t?this.GlobalData.stats.audioStutter++:(this.GlobalData.stats.audioStutter++,this.GlobalData.stats.videoStutter++)},t.oncanplay=()=>{6===this.status&&t.play()}}async handleEnded(){if(this.audioEnded&&this.videoEnded)if(V.pq(`player ended, taskId: ${this.taskId}`,Bt,646),this.options.loop&&!this.options.isLive){V.pq(`loop play, taskId: ${this.taskId}`,Bt,650),this.isHls()?await Ut.DemuxerThread.seek(this.taskId,BigInt(0),16):this.isDash()?(await Ut.DemuxerThread.seek(this.taskId,BigInt(0),16),this.subTaskId&&await Ut.DemuxerThread.seek(this.subTaskId,BigInt(0),16),this.subtitleTaskId&&await Ut.DemuxerThread.seek(this.subtitleTaskId,BigInt(0),16)):await Ut.DemuxerThread.seek(this.taskId,BigInt(0),8);for(let t=0;tthis.currentTime,avpacketList:this.GlobalData[d.o9],avpacketListMutex:this.GlobalData[d.o9]+24,codecpar:t.codecpar,container:this.options.container,videoWidth:null!==(i=m.f[15]((null===(r=this.selectedVideoStream)||void 0===r?void 0:r.codecpar)+56))&&void 0!==i?i:0,videoHeight:null!==(s=m.f[15]((null===(a=this.selectedVideoStream)||void 0===a?void 0:a.codecpar)+60))&&void 0!==s?s:0}),this.subtitleRender.setDemuxTask(e),this.selectedSubtitleStream=t,e===this.taskId&&(this.lastSelectedInnerSubtitleStreamIndex=t.index),Ut.DemuxerThread.connectStreamTask.transfer(this.subtitleRender.getDemuxerPort(e)).invoke(e,t.index,this.subtitleRender.getDemuxerPort(e))}async loadExternalSubtitle(t){if(1!==this.status&&2!==this.status||V.h2("player has already destroyed",Bt,851),t.source||V.h2("external subtitle must has source",Bt,855),this.externalSubtitleTasks.some((e=>e.source===t.source)))return void V.R8("external subtitle has already loaded",Bt,859);const e=(0,I.A)(),i=(0,Q.A)(this.options.enableWorker),r=P.X$({taskId:e,streamId:-1,ioloader2DemuxerChannel:i},t);let s="",a=0,n=0;S.Yj(t.source)?(n|=4,s=R.qg(t.source).file.split(".").pop(),a=await Ut.IOThread.registerTask.transfer(i.port1).invoke({type:0,info:{url:t.source},range:{from:-1,to:-1},taskId:e,options:{isLive:this.options.isLive},rightPort:i.port1,stats:this.GlobalData[d.o9]+32})):(s=t.source.name.split(".").pop(),a=await Ut.IOThread.registerTask.transfer(i.port1).invoke({type:1,info:{file:t.source},range:{from:-1,to:-1},taskId:e,options:{isLive:this.options.isLive},rightPort:i.port1,stats:this.GlobalData[d.o9]+32})),a<0&&V.h2(`register io task failed, ret: ${a}, taskId: ${this.taskId}`,Bt,923),await Ut.DemuxerThread.registerTask.transfer(i.port2).invoke({taskId:e,leftPort:i.port2,format:ct.HR[s],stats:0,isLive:!1,flags:n,avpacketList:this.GlobalData[d.o9],avpacketListMutex:this.GlobalData[d.o9]+24}),a=await Ut.DemuxerThread.openStream(e),a<0&&V.h2(`open external subtitle failed, ret: ${a}, taskId: ${e}`,Bt,940);let o=await Ut.DemuxerThread.analyzeStreams(e);if(S.ai(o))return void V.h2(`analyze stream failed, ret: ${o}`,Bt,944);o.streams.length||V.h2("not found any stream",Bt,948);const l=o.streams[0];this.formatContext.streams.push(l),r.streamId=l.id,t.lang&&(l.metadata.language=t.lang),t.title&&(l.metadata.title=t.title);const c=7===this.status||6===this.status||8===this.status||9===this.status;return c&&await Ut.DemuxerThread.seek(e,this.currentTime,8),c&&!this.subtitleRender?(this.createSubtitleRender(l,e),this.subtitleRender.start()):this.subtitleRender&&await Ut.DemuxerThread.connectStreamTask.transfer(this.subtitleRender.getDemuxerPort(e)).invoke(e,l.index,this.subtitleRender.getDemuxerPort(e)),await Ut.DemuxerThread.startDemux(e,!1,10),this.externalSubtitleTasks.push(r),this.fire(N.xv),0}async load(t,e={}){V.pq(`call load, taskId: ${this.taskId}`,Bt,1e3),this.status=3,this.fire(N.F5),this.controller=new $.A(this,this.options.enableWorker),this.ioloader2DemuxerChannel=(0,Q.A)(this.options.enableWorker),(0,K.sO)(this.GlobalData[d.o9]+32,0,344),this.externalSubtitleTasks.length=0,await Ut.startDemuxPipeline(this.options.enableWorker);let i=0,r=0;if(S.Yj(t)){i|=4;let{info:s,type:a,ext:n}=await(0,St.A)(t,e.ext,e.http);this.ext=n,r=await Ut.IOThread.registerTask.transfer(this.ioloader2DemuxerChannel.port1).invoke({type:a,info:{...s,httpOptions:e.http,webtransportOptions:e.webtransport,uri:e.uri},range:{from:-1,to:-1},taskId:this.taskId,options:{isLive:this.options.isLive},rightPort:this.ioloader2DemuxerChannel.port1,stats:this.GlobalData[d.o9]+32})}else t instanceof File?(this.options.isLive=!1,this.ext=t.name.split(".").pop(),r=await Ut.IOThread.registerTask.transfer(this.ioloader2DemuxerChannel.port1).invoke({type:1,info:{file:t},range:{from:-1,to:-1},taskId:this.taskId,options:{isLive:!1},rightPort:this.ioloader2DemuxerChannel.port1,stats:this.GlobalData[d.o9]+32})):t instanceof xt.A?(i|=t.flags||0,this.ext=t.ext,this.ioIPCPort=new vt.Ay(this.ioloader2DemuxerChannel.port1),this.ioIPCPort.on(vt.S3,(async e=>{switch(e.method){case"open":try{const i=await t.open();if(i<0){V.z3(`custom loader open error, ${i}, taskId: ${this.taskId}`,Bt,1077),this.ioIPCPort.reply(e,null,i);break}this.ioIPCPort.reply(e,i)}catch(t){V.z3(`loader open error, ${t}, taskId: ${this.taskId}`,Bt,1084),this.ioIPCPort.reply(e,null,t)}break;case"read":{const i=e.params.pointer,r=e.params.length,s=e.params.ioloaderOptions,a=Ut.IODemuxProxy?new Uint8Array(r):(0,K.JW)(i,r);try{const i=await t.read(a,s);this.GlobalData.stats.bufferReceiveBytes+=BigInt(0|i),this.ioIPCPort.reply(e,Ut.IODemuxProxy?a:i,null,Ut.IODemuxProxy?[a.buffer]:null)}catch(t){V.z3(`loader read error, ${t}, taskId: ${this.taskId}`,Bt,1102),this.ioIPCPort.reply(e,yt.LR)}break}case"write":{const i=e.params.pointer,r=e.params.length,s=(0,K.JW)(i,r);try{const i=await t.write(s);this.GlobalData.stats.bufferSendBytes+=r,this.ioIPCPort.reply(e,i)}catch(t){V.z3(`loader write error, ${t}, taskId: ${this.taskId}`,Bt,1124),this.ioIPCPort.reply(e,yt.LR)}break}case"seek":{const i=e.params.pos,r=e.params.ioloaderOptions;try{const s=await t.seek(i,r);if(s<0){V.z3(`custom loader seek error, ${s}, taskId: ${this.taskId}`,Bt,1140),this.ioIPCPort.reply(e,null,s);break}this.ioIPCPort.reply(e,s)}catch(t){V.z3(`loader seek error, ${t}, taskId: ${this.taskId}`,Bt,1147),this.ioIPCPort.reply(e,null,t)}break}case"size":this.ioIPCPort.reply(e,await t.size())}}))):V.h2("invalid source",Bt,1161);r<0&&V.h2(`register io task failed, ret: ${r}, taskId: ${this.taskId}`,Bt,1165),(this.isDash()||this.isHls())&&(i|=2);const s=P.X$({},e.formatOptions||{});if(this.isDash()){await Ut.IOThread.open(this.taskId);const t=await Ut.IOThread.hasAudio(this.taskId),e=await Ut.IOThread.hasVideo(this.taskId);t&&e?(this.subTaskId=(0,I.A)(),await Ut.DemuxerThread.registerTask.transfer(this.ioloader2DemuxerChannel.port2,this.controller.getDemuxerControlPort()).invoke({taskId:this.taskId,leftPort:this.ioloader2DemuxerChannel.port2,controlPort:this.controller.getDemuxerControlPort(),format:ct.HR[this.ext],stats:this.GlobalData[d.o9]+32,isLive:this.options.isLive,flags:i,ioloaderOptions:{mediaType:"audio"},formatOptions:s,avpacketList:this.GlobalData[d.o9],avpacketListMutex:this.GlobalData[d.o9]+24}),await Ut.DemuxerThread.registerTask({taskId:this.subTaskId,mainTaskId:this.taskId,flags:i,format:ct.HR[this.ext],stats:this.GlobalData[d.o9]+32,isLive:this.options.isLive,ioloaderOptions:{mediaType:"video"},formatOptions:s,avpacketList:this.GlobalData[d.o9],avpacketListMutex:this.GlobalData[d.o9]+24})):await Ut.DemuxerThread.registerTask.transfer(this.ioloader2DemuxerChannel.port2,this.controller.getDemuxerControlPort()).invoke({taskId:this.taskId,leftPort:this.ioloader2DemuxerChannel.port2,controlPort:this.controller.getDemuxerControlPort(),format:ct.HR[this.ext],stats:this.GlobalData[d.o9]+32,isLive:this.options.isLive,flags:i,ioloaderOptions:{mediaType:t?"audio":"video"},formatOptions:s,avpacketList:this.GlobalData[d.o9],avpacketListMutex:this.GlobalData[d.o9]+24})}else"rtsp"!==this.ext&&"rtmp"!==this.ext||(s.uri=e.uri||t.replace(/^\S+:\/\//,this.ext+"://")),await Ut.DemuxerThread.registerTask.transfer(this.ioloader2DemuxerChannel.port2,this.controller.getDemuxerControlPort()).invoke({taskId:this.taskId,leftPort:this.ioloader2DemuxerChannel.port2,controlPort:this.controller.getDemuxerControlPort(),format:ct.HR[this.ext],formatOptions:s,stats:this.GlobalData[d.o9]+32,isLive:this.options.isLive,flags:i,avpacketList:this.GlobalData[d.o9],avpacketListMutex:this.GlobalData[d.o9]+24});(this.isDash()||this.isHls())&&await Ut.IOThread.hasSubtitle(this.taskId)&&(this.subtitleTaskId=(0,I.A)(),await Ut.DemuxerThread.registerTask({taskId:this.subtitleTaskId,mainTaskId:this.taskId,flags:i,format:ct.HR[this.ext],stats:this.GlobalData[d.o9]+32,isLive:this.options.isLive,ioloaderOptions:{mediaType:"subtitle"},avpacketList:this.GlobalData[d.o9],avpacketListMutex:this.GlobalData[d.o9]+24})),this.fire(N.Gd,[0]),r=await Ut.DemuxerThread.openStream(this.taskId),r<0&&V.h2(`open stream failed, ret: ${r}, taskId: ${this.taskId}`,Bt,1281),this.fire(N.Gd,[1,this.ext]);let a=await Ut.DemuxerThread.analyzeStreams(this.taskId);if(S.ai(a))V.h2(`analyze stream failed, ret: ${a}`,Bt,1288);else{if(a.streams.length||V.h2("not found any stream",Bt,1292),this.subTaskId){r=await Ut.DemuxerThread.openStream(this.subTaskId),r<0&&V.h2(`open stream failed, ret: ${r}, taskId: ${this.subTaskId}`,Bt,1298);const t=await Ut.DemuxerThread.analyzeStreams(this.subTaskId);if(S.ai(t))return void V.h2(`analyze stream failed, ret: ${t}`,Bt,1302);t.streams.length||V.h2("not found any stream",Bt,1306),a.streams=a.streams.concat(t.streams)}if(this.subtitleTaskId){r=await Ut.DemuxerThread.openStream(this.subtitleTaskId),r<0&&V.h2(`open subtitle stream failed, ret: ${r}, taskId: ${this.subtitleTaskId}`,Bt,1314);const t=await Ut.DemuxerThread.analyzeStreams(this.subtitleTaskId);if(S.ai(t))return void V.h2(`analyze subtitle stream failed, ret: ${t}`,Bt,1318);t.streams.length||V.h2("not found any stream",Bt,1322),a.streams=a.streams.concat(t.streams)}if(this.formatContext=a,this.source=t,e.externalSubtitles)for(let t=0;t{1===m.f[15](t.codecpar)?this.GlobalData.stats.audiocodec=(0,lt.A)(t.codecpar):0===m.f[15](t.codecpar)&&(this.GlobalData.stats.videocodec=(0,X.A)(t.codecpar))})),this.isHls()||this.isDash()){const t=1e3*await Ut.IOThread.getDuration(this.taskId);if(t>0)for(let e=0;e{var e;V.Yz(`cropping buffer by jitter buffer, max: ${t}, taskId: ${this.taskId}`,Bt,1382),null===(e=Ut.DemuxerThread)||void 0===e||e.croppingAVPacketQueue(this.taskId,BigInt(0|t))},onSetPlayRate:t=>{V.Yz(`set play rate by jitter buffer, rate: ${t}, taskId: ${this.taskId}`,Bt,1386),this.useMSE?(Ut.MSEThread.setPlayRate(this.taskId,t),this.video?this.video.playbackRate=t:this.audio&&(this.audio.playbackRate=t)):(this.audioDecoder2AudioRenderChannel&&Ut.AudioRenderThread.setPlayTempo(this.taskId,t),this.videoDecoder2VideoRenderChannel&&this.VideoRenderThread.setPlayRate(this.taskId,t))}}})}V.pq("\nAVPlayer version v0.1.2-8-g708d86a Copyright (c) 2024-present the libmedia developers\n"+(0,ht.Ay)([a],[{from:S.Yj(t)?t:t.name,tag:"Input"}]),Bt,1409),this.status=4,this.fire(N.S2)}}async play(t={audio:!0,video:!0,subtitle:!0}){if(V.pq(`call play, options: ${c()(t)}, status: ${this.status} taskId: ${this.taskId}`,Bt,1431),6===this.status)return;t.audio||t.video||(V.R8(`video and audio must play one, ignore options, we will try to play video and audio, taskId: ${this.taskId}`,Bt,1438),t.audio=!0,t.video=!0);const e=[];if(7===this.status)return this.selectedAudioStream&&this.selectedVideoStream&&this.GlobalData.stats.videoCurrentTime-this.GlobalData.stats.audioCurrentTime>BigInt(400)&&await Ut.AudioRenderThread.syncSeekTime(this.taskId,this.GlobalData.stats.videoCurrentTime),this.useMSE?(e.push(Ut.MSEThread.unpause(this.taskId)),this.audio?this.audio.play():this.video&&this.video.play()):(this.audioSourceNode&&(e.push(this.audioSourceNode.request("unpause")),e.push(Ut.AudioRenderThread.unpause(this.taskId))),this.videoDecoder2VideoRenderChannel&&e.push(this.VideoRenderThread.unpause(this.taskId))),o().all(e).then((()=>{this.status=6,this.fire(N.CN),this.jitterBufferController&&this.jitterBufferController.start(),this.subtitleRender&&this.subtitleRender.start()}));if(this.status=5,this.fire(N.d6),this.useMSE=await this.checkUseMSE(),this.audioEnded=!0,this.videoEnded=!0,this.useMSE){await Ut.startMSEPipeline(this.options.enableWorker),Ut.MSEThread.setPlayRate(this.taskId,this.playRate);const e=this.findBestStream(this.formatContext.streams,0),i=this.findBestStream(this.formatContext.streams,1);let r=!1;await Ut.MSEThread.registerTask.transfer(this.controller.getMuxerControlPort()).invoke({taskId:this.taskId,stats:this.GlobalData[d.o9]+32,controlPort:this.controller.getMuxerControlPort(),isLive:this.options.isLive,avpacketList:this.GlobalData[d.o9],avpacketListMutex:this.GlobalData[d.o9]+24,enableJitterBuffer:!!this.jitterBufferController}),e&&t.video&&(this.fire(N.Gd,[3,e]),r=!0,this.selectedVideoStream=e,this.videoEnded=!1,this.demuxer2VideoDecoderChannel=(0,Q.A)(this.options.enableWorker),await Ut.DemuxerThread.connectStreamTask.transfer(this.demuxer2VideoDecoderChannel.port1).invoke(this.subTaskId||this.taskId,e.index,this.demuxer2VideoDecoderChannel.port1),await Ut.MSEThread.addStream.transfer(this.demuxer2VideoDecoderChannel.port2).invoke(this.taskId,e.index,(0,wt.Wu)(e.codecpar),e.timeBase,e.startTime,this.demuxer2VideoDecoderChannel.port2)),i&&t.audio&&(this.fire(N.Gd,[2,i]),this.selectedAudioStream=i,this.audioEnded=!1,this.demuxer2AudioDecoderChannel=(0,Q.A)(this.options.enableWorker),await Ut.DemuxerThread.connectStreamTask.transfer(this.demuxer2AudioDecoderChannel.port1).invoke(this.taskId,i.index,this.demuxer2AudioDecoderChannel.port1),await Ut.MSEThread.addStream.transfer(this.demuxer2AudioDecoderChannel.port2).invoke(this.taskId,i.index,(0,wt.Wu)(i.codecpar),i.timeBase,i.startTime,this.demuxer2AudioDecoderChannel.port2)),r?this.createVideo():this.createAudio();const s=await Ut.MSEThread.getMediaSource(this.taskId);s&&(W.A.workerMSE&&s instanceof MediaSourceHandle?(this.video||this.audio).srcObject=s:(this.video||this.audio).src=URL.createObjectURL(s),this.handleTimeupdate(this.video||this.audio))}else{let e=BigInt(0),i=BigInt(0);const r=this.findBestStream(this.formatContext.streams,0),s=this.findBestStream(this.formatContext.streams,1);if(r&&t.video){this.fire(N.Gd,[3,r]),this.selectedVideoStream=r,await Ut.startVideoRenderPipeline(this.options.enableWorker),await this.createVideoDecoderThread(this.options.enableWorker),i=(0,q.k)(r.startTime,r.timeBase,Y.i0),this.demuxer2VideoDecoderChannel=(0,Q.A)(this.options.enableWorker),this.videoDecoder2VideoRenderChannel=(0,Q.A)(this.options.enableWorker);let t=await this.getResource("decoder",m.f[15](r.codecpar+4),m.f[15](r.codecpar));t||(W.A.videoDecoder?(await VideoDecoder.isConfigSupported({codec:(0,X.A)(r.codecpar)})).supported||V.h2(`${(0,ht.eG)(m.f[15](r.codecpar),m.f[15](r.codecpar+4))} codecId ${m.f[15](r.codecpar+4)} not support`,Bt,1596):V.h2(`${(0,ht.eG)(m.f[15](r.codecpar),m.f[15](r.codecpar+4))} codecId ${m.f[15](r.codecpar+4)} not support`,Bt,1600)),await this.VideoDecoderThread.registerTask.transfer(this.demuxer2VideoDecoderChannel.port2,this.videoDecoder2VideoRenderChannel.port1).invoke({taskId:this.taskId,resource:t,leftPort:this.demuxer2VideoDecoderChannel.port2,rightPort:this.videoDecoder2VideoRenderChannel.port1,stats:this.GlobalData[d.o9]+32,enableHardware:this.options.enableHardware&&this.options.enableWebCodecs,avpacketList:this.GlobalData[d.o9],avpacketListMutex:this.GlobalData[d.o9]+24,avframeList:this.GlobalData[d.o9]+12,avframeListMutex:this.GlobalData[d.o9]+28,preferWebCodecs:!(0,dt.A)(r.codecpar)&&!(0,ft.A)(r.codecpar)&&this.options.enableWebCodecs}),await this.VideoDecoderThread.open(this.taskId,(0,wt.Wu)(r.codecpar))<0&&V.h2(`cannot open video ${(0,ht.eG)(m.f[15](r.codecpar),m.f[15](r.codecpar+4))} decoder`,Bt,1623),await Ut.DemuxerThread.connectStreamTask.transfer(this.demuxer2VideoDecoderChannel.port1).invoke(this.subTaskId||this.taskId,r.index,this.demuxer2VideoDecoderChannel.port1),this.VideoDecoderThread.setPlayRate(this.taskId,this.playRate)}if(s&&t.audio){this.fire(N.Gd,[2,s]),this.selectedAudioStream=s,await Ut.startAudioPipeline(this.options.enableWorker),"suspended"===Ut.audioContext.state&&await o().race([Ut.audioContext.resume(),new it.A(.1)]),e=(0,q.k)(s.startTime,s.timeBase,Y.i0),this.demuxer2AudioDecoderChannel=(0,Q.A)(this.options.enableWorker),this.audioDecoder2AudioRenderChannel=(0,Q.A)(this.options.enableWorker);let t=await this.getResource("decoder",m.f[15](s.codecpar+4),m.f[15](s.codecpar));t||(W.A.audioDecoder?(await AudioDecoder.isConfigSupported({codec:(0,lt.A)(s.codecpar),sampleRate:m.f[15](s.codecpar+136),numberOfChannels:m.f[15](s.codecpar+116)})).supported||V.h2(`${(0,ht.eG)(m.f[15](s.codecpar),m.f[15](s.codecpar+4))} codecId ${m.f[15](s.codecpar+4)} not support`,Bt,1659):V.h2(`${(0,ht.eG)(m.f[15](s.codecpar),m.f[15](s.codecpar+4))} codecId ${m.f[15](s.codecpar+4)} not support`,Bt,1663)),await Ut.AudioDecoderThread.registerTask.transfer(this.demuxer2AudioDecoderChannel.port2,this.audioDecoder2AudioRenderChannel.port1).invoke({taskId:this.taskId,resource:t,leftPort:this.demuxer2AudioDecoderChannel.port2,rightPort:this.audioDecoder2AudioRenderChannel.port1,stats:this.GlobalData[d.o9]+32,timeBase:{num:s.timeBase.num,den:s.timeBase.den},avpacketList:this.GlobalData[d.o9],avpacketListMutex:this.GlobalData[d.o9]+24,avframeList:this.GlobalData[d.o9]+12,avframeListMutex:this.GlobalData[d.o9]+28}),await Ut.AudioDecoderThread.open(this.taskId,(0,wt.Wu)(s.codecpar))<0&&V.h2(`cannot open audio ${(0,ht.eG)(m.f[15](s.codecpar),m.f[15](s.codecpar+4))} decoder`,Bt,1688),await Ut.DemuxerThread.connectStreamTask.transfer(this.demuxer2AudioDecoderChannel.port1).invoke(this.taskId,s.index,this.demuxer2AudioDecoderChannel.port1)}if(this.videoDecoder2VideoRenderChannel){this.canvas=this.createCanvas(),this.options.container.appendChild(this.canvas);const t=(0,z.A)()&&(U.USE_THREADS||W.A.worker&&this.options.enableWorker)?this.canvas.transferControlToOffscreen():this.canvas;r.metadata.matrix&&(this.renderRotate=-Math.atan2(r.metadata.matrix[3],r.metadata.matrix[0])*(180/Math.PI)),await this.VideoRenderThread.registerTask.transfer(this.videoDecoder2VideoRenderChannel.port2,this.controller.getVideoRenderControlPort(),t).invoke({taskId:this.taskId,leftPort:this.videoDecoder2VideoRenderChannel.port2,controlPort:this.controller.getVideoRenderControlPort(),canvas:t,renderMode:this.renderMode,renderRotate:this.renderRotate,flipHorizontal:this.flipHorizontal,flipVertical:this.flipVertical,timeBase:{num:r.timeBase.num,den:r.timeBase.den},viewportWidth:this.options.container.offsetWidth,viewportHeight:this.options.container.offsetHeight,devicePixelRatio,stats:this.GlobalData[d.o9]+32,enableWebGPU:this.options.enableWebGPU,startPTS:r.startTime,avframeList:this.GlobalData[d.o9]+12,avframeListMutex:this.GlobalData[d.o9]+28,enableJitterBuffer:!!this.jitterBufferController&&!this.audioDecoder2AudioRenderChannel}),this.videoEnded=!1,this.VideoRenderThread.setPlayRate(this.taskId,this.playRate)}if(this.audioDecoder2AudioRenderChannel){this.audioRender2AudioWorkletChannel=new MessageChannel,this.playChannels=Math.max(m.f[15](s.codecpar+116),Math.min(Ut.audioContext.destination.channelCount,2));let t,e=await this.getResource("resampler"),i=await this.getResource("stretchpitcher");e||V.h2("resampler not found",Bt,1758),i||V.h2("stretch pitcher not found",Bt,1761),await Ut.AudioRenderThread.registerTask.transfer(this.audioDecoder2AudioRenderChannel.port2,this.audioRender2AudioWorkletChannel.port1,this.controller.getAudioRenderControlPort()).invoke({taskId:this.taskId,leftPort:this.audioDecoder2AudioRenderChannel.port2,rightPort:this.audioRender2AudioWorkletChannel.port1,controlPort:this.controller.getAudioRenderControlPort(),playFormat:8,playSampleRate:Ut.audioContext.sampleRate,playChannels:this.playChannels,resamplerResource:e,stretchpitcherResource:i,stats:this.GlobalData[d.o9]+32,timeBase:{num:s.timeBase.num,den:s.timeBase.den},startPTS:s.startTime,avframeList:this.GlobalData[d.o9]+12,avframeListMutex:this.GlobalData[d.o9]+28,enableJitterBuffer:!!this.jitterBufferController}),t=W.A.audioWorklet?F.A:G.A,this.audioSourceNode=new t(Ut.audioContext,{onEnded:()=>{this.onAudioEnded()},onFirstRendered:()=>{this.onFirstAudioRendered()},onStutter:()=>{this.onAudioStutter()}},{numberOfInputs:1,numberOfOutputs:1,outputChannelCount:[this.playChannels],isMainWorker:!!Ut.AudioPipelineProxy}),!U.USE_THREADS||!W.A.audioWorklet||H.A.safari&&!H.A.checkVersion(H.A.version,"16.1",!0)||gt.A.ios&&!H.A.checkVersion(gt.A.version,"16.1",!0)||await this.audioSourceNode.request("init",{memory:O.ce}),Ut.AudioRenderThread.setPlayTempo(this.taskId,this.playRate),this.gainNode=Ut.audioContext.createGain(),this.gainNode.connect(Ut.audioContext.destination),this.audioSourceNode.connect(this.gainNode),this.setVolume(this.volume),this.audioEnded=!1}this.audioDecoder2AudioRenderChannel?this.controller.setTimeUpdateListenType(1):this.videoDecoder2VideoRenderChannel&&this.controller.setTimeUpdateListenType(0),this.videoDecoder2VideoRenderChannel&&this.audioDecoder2AudioRenderChannel&&at.tn(i-e)>BigInt(1e4)&&this.controller.setEnableAudioVideoSync(!1)}{const e=this.findBestStream(this.formatContext.streams,3);if(e&&t.subtitle&&this.isCodecIdSupported(m.f[15](e.codecpar+4))){const t=this.externalSubtitleTasks.find((t=>t.streamId===e.id));this.createSubtitleRender(e,t?t.taskId:this.subtitleTaskId||this.taskId)}if(this.subtitleRender&&this.externalSubtitleTasks.length)for(let t=0;te.id===this.externalSubtitleTasks[t].streamId));i!==e&&await Ut.DemuxerThread.connectStreamTask.transfer(this.subtitleRender.getDemuxerPort(this.externalSubtitleTasks[t].taskId)).invoke(this.externalSubtitleTasks[t].taskId,i.index,this.subtitleRender.getDemuxerPort(this.externalSubtitleTasks[t].taskId))}}let i=10;if(S.Yj(this.source)||this.source instanceof xt.A){let t=this.options.isLive?this.options.jitterBufferMin:this.options.preLoadTime;this.source instanceof xt.A&&(t=Math.max(t,this.source.minBuffer)),this.formatContext.streams.forEach((e=>{i=Math.max(Math.ceil((0,q.lb)((0,v.A)(e.codecpar+72,g.P))*t),i)}))}return e.push(Ut.DemuxerThread.startDemux(this.taskId,this.options.isLive,i)),this.subTaskId&&e.push(Ut.DemuxerThread.startDemux(this.subTaskId,this.options.isLive,i)),this.subtitleTaskId&&e.push(Ut.DemuxerThread.startDemux(this.subtitleTaskId,this.options.isLive,i)),o().all(e).then((async()=>{if(this.useMSE){var t,e;await o().all([null===(t=this.video)||void 0===t?void 0:t.play(),null===(e=this.audio)||void 0===e?void 0:e.play()]).catch((t=>{if(this.video)return this.video.muted=!0,this.fire(N.IY),V.R8("the audioContext was not started. It must be resumed after a user gesture",Bt,1906),this.video.play();throw t}))}else{const t=[];if(this.videoDecoder2VideoRenderChannel&&t.push(this.VideoRenderThread.play(this.taskId)),this.audioDecoder2AudioRenderChannel&&t.push(this.audioSourceNode.request("start",{port:this.audioRender2AudioWorkletChannel.port2,channels:this.playChannels},[this.audioRender2AudioWorkletChannel.port2])),await o().all(t),this.audioSourceNode&&"suspended"===Ut.audioContext.state){if("suspended"===Ut.audioContext.state&&(this.fire(N.IY),V.R8("the audioContext was not started. It must be resumed after a user gesture",Bt,1929)),!this.videoDecoder2VideoRenderChannel)throw new Error("the audioContext was not started. It must be resumed after a user gesture");await Ut.AudioRenderThread.fakePlay(this.taskId),this.controller.setTimeUpdateListenType(0)}}this.status=6,this.fire(N.CN),this.statsController.start(),this.jitterBufferController&&this.jitterBufferController.start(),this.subtitleRender&&this.subtitleRender.start()}))}async pause(){if(V.pq(`call pause, taskId: ${this.taskId}`,Bt,1958),!this.options.isLive){const t=[];return this.useMSE?(this.audio&&this.audio.pause(),this.video&&this.video.pause(),t.push(Ut.MSEThread.pause(this.taskId))):(this.audioSourceNode&&(t.push(this.audioSourceNode.request("pause")),t.push(Ut.AudioRenderThread.pause(this.taskId))),this.videoDecoder2VideoRenderChannel&&t.push(this.VideoRenderThread.pause(this.taskId))),o().all(t).then((()=>{8===this.status?this.lastStatus=7:this.status=7,this.fire(N.NN),this.jitterBufferController&&this.jitterBufferController.stop(),this.subtitleRender&&this.subtitleRender.pause()}))}V.R8(`pause can only used in vod, taskId: ${this.taskId}`,Bt,1998)}async doSeek(t,e,i={}){var r,s;this.useMSE?await Ut.MSEThread.beforeSeek(this.taskId):await o().all([null===(r=Ut.AudioRenderThread)||void 0===r?void 0:r.beforeSeek(this.taskId),null===(s=this.VideoRenderThread)||void 0===s?void 0:s.beforeSeek(this.taskId)]),i.onBeforeSeek&&await i.onBeforeSeek();let a=-BigInt(1);if(this.isHls()?a=await Ut.DemuxerThread.seek(this.taskId,t,16):this.isDash()?(a=await Ut.DemuxerThread.seek(this.taskId,t,16),this.subTaskId&&await Ut.DemuxerThread.seek(this.subTaskId,t,16)):a=await Ut.DemuxerThread.seek(this.taskId,t,8,e),this.subtitleTaskId&&await Ut.DemuxerThread.seek(this.subtitleTaskId,t,16),a>=BigInt(0)?V.Yz(`seeked to packet timestamp: ${a}, taskId: ${this.taskId}`,Bt,2040):V.z3(`demuxer seek failed, code: ${a}, taskId: ${this.taskId}`,Bt,2043),this.useMSE)if(a>=BigInt(0)){const e=await Ut.MSEThread.afterSeek(this.taskId,a>t?a:t);this.video?this.video.currentTime=e:this.audio&&(this.audio.currentTime=e)}else await Ut.MSEThread.afterSeek(this.taskId,Y.Dh);else{let e=20;var n,l,c,h,u,d,f,p,y,A;this.formatContext.streams.forEach((t=>{0===m.f[15](t.codecpar)&&(e=Math.max(Math.ceil((0,q.lb)((0,v.A)(t.codecpar+72,g.P))),e))})),a>=BigInt(0)?(await o().all([null===(n=Ut.AudioDecoderThread)||void 0===n?void 0:n.resetTask(this.taskId),null===(l=this.VideoDecoderThread)||void 0===l?void 0:l.resetTask(this.taskId)]),await o().all([null===(c=Ut.AudioRenderThread)||void 0===c?void 0:c.syncSeekTime(this.taskId,a>t?a:t,e),null===(h=this.VideoRenderThread)||void 0===h?void 0:h.syncSeekTime(this.taskId,a>t?a:t,e)]),await o().all([null===(u=Ut.AudioRenderThread)||void 0===u?void 0:u.afterSeek(this.taskId,a>t?a:t),null===(d=this.VideoRenderThread)||void 0===d?void 0:d.afterSeek(this.taskId,a>t?a:t)])):(await o().all([null===(f=Ut.AudioRenderThread)||void 0===f?void 0:f.syncSeekTime(this.taskId,Y.Dh,e),null===(p=this.VideoRenderThread)||void 0===p?void 0:p.syncSeekTime(this.taskId,Y.Dh,e)]),await o().all([null===(y=Ut.AudioRenderThread)||void 0===y?void 0:y.afterSeek(this.taskId,Y.Dh),null===(A=this.VideoRenderThread)||void 0===A?void 0:A.afterSeek(this.taskId,Y.Dh)])),this.jitterBufferController&&this.jitterBufferController.reset()}for(let t=0;t({...t,mediaType:(0,ht.yl)(ct.Mb,m.f[15](t.codecpar)),codecparProxy:(0,v.A)(t.codecpar,y.A)})))}getSelectedVideoStreamId(){return this.selectedVideoStream?this.selectedVideoStream.id:-1}getSelectedAudioStreamId(){return this.selectedAudioStream?this.selectedAudioStream.id:-1}getSelectedSubtitleStreamId(){return this.selectedSubtitleStream?this.selectedSubtitleStream.id:-1}getChapters(){return this.formatContext.chapters}getDuration(){if(!this.options.isLive){let t=BigInt(0);return this.formatContext.streams.forEach((e=>{if(1===m.f[15](e.codecpar)||0===m.f[15](e.codecpar)){const i=(0,q.k)(e.duration,{den:e.timeBase.den,num:e.timeBase.num},Y.i0);i>t&&(t=i)}})),t}return BigInt(0)}async stop(){var t;if(V.pq(`call stop, taskId: ${this.taskId}`,Bt,2256),0!==this.status){this.audioSourceNode&&(8===this.status&&await Ut.AudioRenderThread.stop(this.taskId),await this.audioSourceNode.request("stop"),this.audioSourceNode.disconnect(),this.audioSourceNode=null),8===this.status&&Ut.DemuxerThread&&(await Ut.DemuxerThread.stop(this.taskId),this.subTaskId&&await Ut.DemuxerThread.stop(this.subTaskId),this.subtitleTaskId&&await Ut.DemuxerThread.stop(this.subtitleTaskId)),this.VideoRenderThread&&await this.VideoRenderThread.unregisterTask(this.taskId),Ut.AudioRenderThread&&await Ut.AudioRenderThread.unregisterTask(this.taskId),this.VideoDecoderThread&&await this.VideoDecoderThread.unregisterTask(this.taskId),Ut.AudioDecoderThread&&await Ut.AudioDecoderThread.unregisterTask(this.taskId),Ut.MSEThread&&await Ut.MSEThread.unregisterTask(this.taskId),Ut.DemuxerThread&&(await Ut.DemuxerThread.unregisterTask(this.taskId),this.subTaskId&&await Ut.DemuxerThread.unregisterTask(this.subTaskId),this.subtitleTaskId&&await Ut.DemuxerThread.unregisterTask(this.subtitleTaskId)),Ut.IOThread&&await Ut.IOThread.unregisterTask(this.taskId),this.ioIPCPort&&(await this.source.stop(),this.ioIPCPort.destroy(),this.ioIPCPort=null);for(let t=0;tt.streamId===this.selectedSubtitleStream.id));t&&Ut.DemuxerThread.seek(t.taskId,this.currentTime,8),this.subtitleRender.reset(),this.subtitleRender.start()}else this.subtitleRender.stop()}resize(t,e){var i;this.useMSE||null===(i=this.VideoRenderThread)||void 0===i||i.resize(this.taskId,t,e),V.pq(`player call resize, width: ${t}, height: ${e}, taskId: ${this.taskId}`,Bt,2648)}isMSE(){return this.useMSE}isLive(){return this.options.isLive}async getVideoList(){var t;return null===(t=Ut.IOThread)||void 0===t?void 0:t.getVideoList(this.taskId)}async getAudioList(){var t;return null===(t=Ut.IOThread)||void 0===t?void 0:t.getAudioList(this.taskId)}async getSubtitleList(){var t;return null===(t=Ut.IOThread)||void 0===t?void 0:t.getSubtitleList(this.taskId)}getStatus(){return this.status}hasAudio(){return!!this.selectedAudioStream}hasVideo(){return!!this.selectedVideoStream}hasSubtitle(){return!!this.selectedSubtitleStream}getSource(){return this.source}getFormatContext(){return this.formatContext}getExternalSubtitle(){return this.externalSubtitleTasks.map((t=>({source:t.source,lang:t.lang,title:t.title})))}getOptions(){return this.options}setIsLive(t){this.options.isLive=t}getAudioOutputNode(){return this.gainNode}isPictureInPicture(){return this.useMSE?this.video&&document.pictureInPictureElement===this.video:!(!this.canvas||"object"!=typeof documentPictureInPicture)&&documentPictureInPicture.window&&documentPictureInPicture.window.document.body.querySelector("#"+this.canvas.id)===this.canvas}async selectVideo(t){var e;if(this.isHls()||this.isDash())return V.pq(`call IOThread selectVideo, index: ${t}, taskId: ${this.taskId}`,Bt,2813),null===(e=Ut.IOThread)||void 0===e?void 0:e.selectVideo(this.taskId,t);{const e=this.formatContext.streams.find((e=>e.id===t));if(this.selectedVideoStream&&e&&0===m.f[15](e.codecpar)&&e!==this.selectedVideoStream){if(9===this.status)return void V.R8(`player is changing now, taskId: ${this.taskId}`,Bt,2821);this.lastStatus=this.status,this.status=9,this.fire(N.Wt,[0,e.id,this.selectedVideoStream.id]),this.useMSE?await this.doSeek(this.currentTime,e.index,{onBeforeSeek:async()=>{await Ut.DemuxerThread.changeConnectStream(this.taskId,e.index,this.selectedVideoStream.index),await Ut.MSEThread.reAddStream(this.taskId,e.index,(0,wt.Wu)(e.codecpar),e.timeBase,e.startTime)}}):await this.doSeek(this.currentTime,e.index,{onBeforeSeek:async()=>{await Ut.DemuxerThread.changeConnectStream(this.taskId,e.index,this.selectedVideoStream.index),await this.VideoDecoderThread.reopenDecoder(this.taskId,(0,wt.Wu)(e.codecpar),await this.getResource("decoder",m.f[15](e.codecpar+4),0))}}),V.pq(`changed selected video stream, from ${this.selectedVideoStream.id} to ${e.id}, taskId: ${this.taskId}`,Bt,2849),this.selectedVideoStream=e,this.subtitleRender&&this.subtitleRender.updateVideoResolution(m.f[15](e.codecpar+56),m.f[15](e.codecpar+60)),this.status=this.lastStatus,this.fire(N.Rj,[0,e.id,this.selectedVideoStream.id])}else V.z3(`call selectVideo failed, id: ${t}, taskId: ${this.taskId}`,Bt,2860)}}async selectAudio(t){var e;if(this.isHls()||this.isDash())return V.pq(`call IOThread selectAudio, index: ${t}, taskId: ${this.taskId}`,Bt,2873),null===(e=Ut.IOThread)||void 0===e?void 0:e.selectAudio(this.taskId,t);{const e=this.formatContext.streams.find((e=>e.id===t));if(this.selectedAudioStream&&e&&1===m.f[15](e.codecpar)&&e!==this.selectedAudioStream){if(9===this.status)return void V.R8(`player is changing now, taskId: ${this.taskId}`,Bt,2880);if(this.lastStatus=this.status,this.status=9,this.fire(N.Wt,[1,e.id,this.selectedAudioStream.id]),m.f[15](e.codecpar+4)!==m.f[15](this.selectedAudioStream.codecpar+4)||this.useMSE&&(m.f[15](e.codecpar+136)!==m.f[15](this.selectedAudioStream.codecpar+136)||m.f[15](e.codecpar+116)!==m.f[15](this.selectedAudioStream.codecpar+116))){let t=e.index;this.selectedVideoStream&&(t=this.selectedVideoStream.index),this.useMSE?await this.doSeek(this.currentTime,t,{onBeforeSeek:async()=>{await Ut.DemuxerThread.changeConnectStream(this.taskId,e.index,this.selectedAudioStream.index),await Ut.MSEThread.reAddStream(this.taskId,e.index,(0,wt.Wu)(e.codecpar),e.timeBase,e.startTime)}}):await this.doSeek(this.currentTime,t,{onBeforeSeek:async()=>{await Ut.DemuxerThread.changeConnectStream(this.taskId,e.index,this.selectedAudioStream.index),await Ut.AudioDecoderThread.reopenDecoder(this.taskId,(0,wt.Wu)(e.codecpar),await this.getResource("decoder",m.f[15](e.codecpar+4),1))}})}else await Ut.DemuxerThread.changeConnectStream(this.taskId,e.index,this.selectedAudioStream.index,!1);V.pq(`changed selected audio stream, from ${this.selectedAudioStream.id} to ${e.id}, taskId: ${this.taskId}`,Bt,2921),this.selectedAudioStream=e,this.status=this.lastStatus,this.fire(N.Rj,[1,e.id,this.selectedAudioStream.id])}else V.z3(`call selectAudio failed, id: ${t}, taskId: ${this.taskId}`,Bt,2930)}}async selectSubtitle(t){if(this.isHls()||this.isDash()){var e;V.pq(`call IOThread selectSubtitle, index: ${t}, taskId: ${this.taskId}`,Bt,2944),await(null===(e=Ut.IOThread)||void 0===e?void 0:e.selectSubtitle(this.taskId,t)),this.subtitleTaskId&&await Ut.DemuxerThread.seek(this.subtitleTaskId,this.currentTime,16),this.subtitleRender&&(this.subtitleRender.reset(),this.subtitleRender.start())}else{const e=this.formatContext.streams.find((e=>e.id===t));if(this.selectedSubtitleStream&&e&&3===m.f[15](e.codecpar)&&e!==this.selectedSubtitleStream){if(9===this.status)return void V.R8(`player is changing now, taskId: ${this.taskId}`,Bt,2958);this.lastStatus=this.status,this.status=9,this.fire(N.Wt,[3,e.id,this.selectedSubtitleStream.id]),this.subtitleRender.reopenDecoder(e.codecpar);const t=this.externalSubtitleTasks.find((t=>t.streamId===e.id));t?(this.subtitleRender.setDemuxTask(t.taskId),this.subtitleRender.reset(),await Ut.DemuxerThread.seek(t.taskId,this.currentTime,8,e.index)):(this.subtitleRender.setDemuxTask(this.taskId),-1===this.lastSelectedInnerSubtitleStreamIndex?await Ut.DemuxerThread.connectStreamTask.transfer(this.subtitleRender.getDemuxerPort(this.taskId)).invoke(this.taskId,e.index,this.subtitleRender.getDemuxerPort(this.taskId)):await Ut.DemuxerThread.changeConnectStream(this.taskId,e.index,this.lastSelectedInnerSubtitleStreamIndex,!1),this.externalSubtitleTasks.find((t=>t.streamId===this.selectedSubtitleStream.id))&&this.subtitleRender.reset(),this.lastSelectedInnerSubtitleStreamIndex=e.index),this.subtitleRender&&this.subtitleRender.start(),V.pq(`changed selected subtitle stream, from ${this.selectedSubtitleStream.id} to ${e.id}, taskId: ${this.taskId}`,Bt,2997),this.selectedSubtitleStream=e,this.status=this.lastStatus,this.fire(N.Rj,[3,e.id,this.selectedSubtitleStream.id])}else V.z3(`call selectSubtitle failed, id: ${t}, taskId: ${this.taskId}`,Bt,3005)}}async playNextFrame(){!this.useMSE&&7===this.status&&this.selectedVideoStream&&await this.VideoRenderThread.renderNextFrame(this.taskId)}enterFullscreen(){const t=this.options.container;t.requestFullscreen?t.requestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.msRequestFullscreen&&t.msRequestFullscreen(),V.pq(`player call enterFullscreen, taskId: ${this.taskId}`,Bt,3037)}exitFullscreen(){document.exitFullscreen?document.exitFullscreen():document.mozExitFullScreen?document.mozExitFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen(),V.pq(`player call exitFullscreen, taskId: ${this.taskId}`,Bt,3053)}snapshot(t="png",e=1){if(this.useMSE&&this.video){const i=document.createElement("canvas");return i.width=this.video.videoWidth,i.height=this.video.videoHeight,i.getContext("2d").drawImage(this.video,0,0),i.toDataURL(`image/${t}`,e)}if(this.canvas)return this.canvas.toDataURL(`image/${t}`,e)}getStats(){return this.GlobalData.stats}async destroy(){V.pq(`call destroy, taskId: ${this.taskId}`,Bt,3092),2!==this.status?(await this.stop(),this.VideoPipelineProxy&&(await this.VideoDecoderThread.clear(),await this.VideoRenderThread.clear(),await this.VideoPipelineProxy.destroy(),this.VideoDecoderThread=null,this.VideoPipelineProxy=null),this.VideoDecoderThread&&(await this.VideoDecoderThread.clear(),(0,T.nE)(this.VideoDecoderThread),this.VideoDecoderThread=null),this.VideoRenderThread=null,this.GlobalData&&(this.GlobalData.avframeList.clear((t=>{(0,M.to)(t)}),20),this.GlobalData.avpacketList.clear((t=>{(0,B.Up)(t)}),20),st.zr(this.GlobalData[d.o9]+24),st.zr(this.GlobalData[d.o9]+28),(0,A.A)(this.GlobalData),this.GlobalData=null),this.status=2):V.R8(`player has already destroyed, taskId: ${this.taskId}`,Bt,3095)}onVideoEnded(){this.videoEnded=!0,this.handleEnded()}onAudioEnded(){this.audioEnded=!0,this.handleEnded()}onCanvasUpdated(){this.updateCanvas=this.createCanvas();const t=(0,z.A)()&&(U.USE_THREADS||W.A.worker&&this.options.enableWorker)?this.updateCanvas.transferControlToOffscreen():this.updateCanvas;this.VideoRenderThread.updateCanvas.transfer(t).invoke(this.taskId,t)}async onGetDecoderResource(t,e){return this.getResource("decoder",e,t)}onFirstVideoRendered(){V.pq(`first video frame rendered, taskId: ${this.taskId}`,Bt,3181),this.fire(N.NX)}onFirstAudioRendered(){V.pq(`first audio frame rendered, taskId: ${this.taskId}`,Bt,3189),this.fire(N.Sw)}onAudioStutter(){6===this.status&&this.GlobalData.stats.audioStutter++}onVideoStutter(){6===this.status&&this.GlobalData.stats.videoStutter++}onFirstVideoRenderedAfterUpdateCanvas(){this.updateCanvas&&(this.canvas&&this.options.container.removeChild(this.canvas),this.canvas=this.updateCanvas,this.options.container.appendChild(this.canvas),this.updateCanvas=null)}onTimeUpdate(t){this.fire(N.E9,[t])}onMSESeek(t){this.audio?this.audio.currentTime=t:this.video&&(this.video.currentTime=t)}async createVideoDecoderThread(t=!0){this.VideoDecoderThread||(!U.USE_THREADS&&W.A.worker&&t&&(0,z.A)()?(this.VideoPipelineProxy=new _t.A,await this.VideoPipelineProxy.run(),this.VideoPipelineProxy.setLogLevel(Ut.level),this.VideoDecoderThread=this.VideoPipelineProxy.VideoDecodePipeline,this.VideoRenderThread=this.VideoPipelineProxy.VideoRenderPipeline):(this.VideoDecoderThread=await(0,T.pt)(w.A,{name:"VideoDecoderThread"},31138).run(),this.VideoDecoderThread.setLogLevel(Ut.level),this.VideoRenderThread=Ut.VideoRenderThread))}static async startDemuxPipeline(t=!0){return Ut.DemuxThreadReady?Ut.DemuxThreadReady:Ut.DemuxThreadReady=new(o())((async e=>{!U.USE_THREADS&&W.A.worker&&t?(Ut.IODemuxProxy=new kt.A,await Ut.IODemuxProxy.run(),Ut.IODemuxProxy.setLogLevel(Ut.level),Ut.IOThread=Ut.IODemuxProxy.IOPipeline,Ut.DemuxerThread=Ut.IODemuxProxy.DemuxPipeline):(Ut.IOThread=await(0,T.pt)(b.A,{name:"IOThread"},87243).run(),Ut.IOThread.setLogLevel(Ut.level),Ut.DemuxerThread=await(0,T.pt)(x.A,{name:"DemuxerThread"},72480).run(),Ut.DemuxerThread.setLogLevel(Ut.level)),e()}))}static async startAudioPipeline(t=!0){return Ut.AudioThreadReady?Ut.AudioThreadReady:Ut.AudioThreadReady=new(o())((async e=>{Ut.audioContext||(Ut.audioContext=new(AudioContext||webkitAudioContext)),W.A.audioWorklet&&await(0,L.A)(Ut.audioContext,!U.USE_THREADS||H.A.safari&&!H.A.checkVersion(H.A.version,"16.1",!0)||gt.A.ios&&!H.A.checkVersion(gt.A.version,"16.1",!0)?34268:5676),!U.USE_THREADS&&W.A.worker&&t?(Ut.AudioPipelineProxy=new Tt.A,await Ut.AudioPipelineProxy.run(),Ut.AudioPipelineProxy.setLogLevel(Ut.level),Ut.AudioDecoderThread=Ut.AudioPipelineProxy.AudioDecodePipeline,Ut.AudioRenderThread=Ut.AudioPipelineProxy.AudioRenderPipeline):(Ut.AudioDecoderThread=await(0,T.pt)(k.A,{name:"AudioDecoderThread"},18667).run(),Ut.AudioDecoderThread.setLogLevel(Ut.level),Ut.AudioRenderThread=await(0,T.pt)(E.A,{name:"AudioRenderThread"},59377).run(),Ut.AudioRenderThread.setLogLevel(Ut.level)),e()}))}static async startVideoRenderPipeline(t=!0){return Ut.VideoThreadReady?Ut.VideoThreadReady:Ut.VideoThreadReady=new(o())((async e=>{!U.USE_THREADS&&W.A.worker&&t&&(0,z.A)()||(Ut.VideoRenderThread=await(0,T.pt)(D.A,{name:"VideoRenderThread",disableWorker:!(0,z.A)()},33968).run(),Ut.VideoRenderThread.setLogLevel(Ut.level)),e()}))}static async startMSEPipeline(t=!0){return Ut.MSEThreadReady?Ut.MSEThreadReady:Ut.MSEThreadReady=new(o())((async e=>{!U.USE_THREADS&&W.A.worker&&t&&W.A.workerMSE?(Ut.MSEPipelineProxy=new It.A,await Ut.MSEPipelineProxy.run(),Ut.MSEPipelineProxy.setLogLevel(Ut.level),Ut.MSEThread=Ut.MSEPipelineProxy.MSEPipeline):(Ut.MSEThread=await(0,T.pt)(tt.A,{name:"MSEThread",disableWorker:!W.A.workerMSE},25115).run(),Ut.MSEThread.setLogLevel(Ut.level)),e()}))}static async startPipelines(t=!0){await Ut.startDemuxPipeline(t),await Ut.startAudioPipeline(t),await Ut.startVideoRenderPipeline(t),await Ut.startMSEPipeline(t),V.pq("AVPlayer pipelines started",Bt,3397)}static async stopPipelines(){Ut.VideoRenderThread&&(await Ut.VideoRenderThread.clear(),(0,T.nE)(Ut.VideoRenderThread)),Ut.AudioPipelineProxy&&(await Ut.AudioRenderThread.clear(),await Ut.AudioDecoderThread.clear(),await Ut.AudioPipelineProxy.destroy(),Ut.AudioRenderThread=null,Ut.AudioDecoderThread=null),Ut.AudioRenderThread&&(await Ut.AudioRenderThread.clear(),(0,T.nE)(Ut.AudioRenderThread)),Ut.AudioDecoderThread&&(await Ut.AudioDecoderThread.clear(),(0,T.nE)(Ut.AudioDecoderThread)),Ut.IODemuxProxy&&(await Ut.DemuxerThread.clear(),await Ut.IOThread.clear(),await Ut.IODemuxProxy.destroy(),Ut.DemuxerThread=null,Ut.IOThread=null),Ut.DemuxerThread&&(await Ut.DemuxerThread.clear(),(0,T.nE)(Ut.DemuxerThread)),Ut.IOThread&&(await Ut.IOThread.clear(),(0,T.nE)(Ut.IOThread)),Ut.MSEPipelineProxy&&(await Ut.MSEThread.clear(),Ut.MSEPipelineProxy.destroy(),Ut.MSEThread=null),Ut.MSEThread&&(await Ut.MSEThread.clear(),(0,T.nE)(Ut.MSEThread)),Ut.AudioPipelineProxy=null,Ut.AudioDecoderThread=null,Ut.IODemuxProxy=null,Ut.DemuxerThread=null,Ut.IOThread=null,Ut.audioContext=null,Ut.MSEThread=null,V.pq("AVPlayer pipelines stopped",Bt,3461)}static setLogLevel(t){Ut.level=t,V.V$(t),Ut.IOThread&&Ut.IOThread.setLogLevel(t),Ut.DemuxerThread&&Ut.DemuxerThread.setLogLevel(t),Ut.AudioDecoderThread&&Ut.AudioDecoderThread.setLogLevel(t),Ut.AudioRenderThread&&Ut.AudioRenderThread.setLogLevel(t),Ut.VideoRenderThread&&Ut.VideoRenderThread.setLogLevel(t),Ut.MSEThread&&Ut.MSEThread.setLogLevel(t),V.pq(`set log level: ${t}`,Bt,3493)}on(t,e,i={}){return super.on(t,P.X$({fn:e},i)),this}one(t,e,i={}){return super.on(t,P.X$({fn:e,max:1},i)),this}}(0,r.A)(Ut,"Util",{compile:C.A,browser:H.A,os:gt.A}),(0,r.A)(Ut,"IOLoader",{CustomIOLoader:xt.A,FetchIOLoader:At.A,FileIOLoader:bt.A,WebSocketIOLoader:Pt.A,SocketIOLoader:Ct.A,WebTransportIOLoader:Mt.A}),(0,r.A)(Ut,"level",V.rD),(0,r.A)(Ut,"DemuxThreadReady",void 0),(0,r.A)(Ut,"AudioThreadReady",void 0),(0,r.A)(Ut,"VideoThreadReady",void 0),(0,r.A)(Ut,"MSEThreadReady",void 0),(0,r.A)(Ut,"IODemuxProxy",void 0),(0,r.A)(Ut,"AudioPipelineProxy",void 0),(0,r.A)(Ut,"MSEPipelineProxy",void 0),(0,r.A)(Ut,"IOThread",void 0),(0,r.A)(Ut,"DemuxerThread",void 0),(0,r.A)(Ut,"AudioDecoderThread",void 0),(0,r.A)(Ut,"AudioRenderThread",void 0),(0,r.A)(Ut,"VideoRenderThread",void 0),(0,r.A)(Ut,"MSEThread",void 0),(0,r.A)(Ut,"audioContext",void 0),(0,r.A)(Ut,"Resource",new(u()))},11628:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var r=i(134),s=i(84149),a=i(67593);class n{constructor(t,e){(0,r.A)(this,"videoRenderControlChannel",void 0),(0,r.A)(this,"audioRenderControlChannel",void 0),(0,r.A)(this,"muxerControlChannel",void 0),(0,r.A)(this,"demuxerControlChannel",void 0),(0,r.A)(this,"videoRenderControlIPCPort",void 0),(0,r.A)(this,"audioRenderControlIPCPort",void 0),(0,r.A)(this,"muxerControlIPCPort",void 0),(0,r.A)(this,"demuxerControlIPCPort",void 0),(0,r.A)(this,"observer",void 0),(0,r.A)(this,"visibilityHidden",void 0),(0,r.A)(this,"onVisibilityChange",void 0),(0,r.A)(this,"timeUpdateListenType",void 0),(0,r.A)(this,"enableAudioVideoSync",void 0),this.observer=t,this.videoRenderControlChannel=(0,a.A)(e),this.audioRenderControlChannel=(0,a.A)(e),this.muxerControlChannel=(0,a.A)(e),this.demuxerControlChannel=(0,a.A)(e),this.videoRenderControlIPCPort=new s.Ay(this.videoRenderControlChannel.port2),this.audioRenderControlIPCPort=new s.Ay(this.audioRenderControlChannel.port2),this.muxerControlIPCPort=new s.Ay(this.muxerControlChannel.port2),this.demuxerControlIPCPort=new s.Ay(this.demuxerControlChannel.port2),this.enableAudioVideoSync=!0,this.videoRenderControlIPCPort.on(s.Wo,(t=>{switch(t.method){case"ended":this.observer.onVideoEnded();break;case"updateCanvas":this.observer.onCanvasUpdated();break;case"firstRendered":this.observer.onFirstVideoRendered();break;case"firstRenderedAfterUpdateCanvas":this.observer.onFirstVideoRenderedAfterUpdateCanvas();break;case"syncPts":0===this.timeUpdateListenType&&this.observer.onTimeUpdate(t.params.pts)}})),this.audioRenderControlIPCPort.on(s.Wo,(t=>{switch(t.method){case"syncPts":this.enableAudioVideoSync&&this.videoRenderControlIPCPort.notify("syncPts",t.params),1===this.timeUpdateListenType&&this.observer.onTimeUpdate(t.params.pts);break;case"ended":this.observer.onAudioEnded()}})),this.muxerControlIPCPort.on(s.Wo,(t=>{"seek"===t.method&&this.observer.onMSESeek(t.params.time)})),this.demuxerControlIPCPort.on(s.S3,(async t=>{"getDecoderResource"===t.method&&this.demuxerControlIPCPort.reply(t,await this.observer.onGetDecoderResource(t.params.mediaType,t.params.codecId))})),this.onVisibilityChange=t=>{this.visibilityHidden="hidden"===document.visibilityState&&!this.observer.isPictureInPicture(),this.videoRenderControlIPCPort.notify("skipRender",{skipRender:this.visibilityHidden})},this.visibilityHidden="hidden"===document.visibilityState&&!this.observer.isPictureInPicture(),document.addEventListener("visibilitychange",this.onVisibilityChange)}getVideoRenderControlPort(){return this.videoRenderControlChannel.port1}getAudioRenderControlPort(){return this.audioRenderControlChannel.port1}getMuxerControlPort(){return this.muxerControlChannel.port1}getDemuxerControlPort(){return this.demuxerControlChannel.port1}setTimeUpdateListenType(t){this.timeUpdateListenType=t}setEnableAudioVideoSync(t){this.enableAudioVideoSync=t}destroy(){this.videoRenderControlIPCPort&&this.videoRenderControlIPCPort.destroy(),this.audioRenderControlIPCPort&&this.audioRenderControlIPCPort.destroy(),this.muxerControlIPCPort&&this.muxerControlIPCPort.destroy(),this.demuxerControlIPCPort&&this.demuxerControlIPCPort.destroy(),this.onVisibilityChange&&(document.removeEventListener("visibilitychange",this.onVisibilityChange),this.onVisibilityChange=null),this.videoRenderControlIPCPort=this.audioRenderControlIPCPort=this.muxerControlIPCPort=this.videoRenderControlChannel=this.audioRenderControlChannel=this.demuxerControlChannel=this.muxerControlChannel=null}}},2368:(t,e,i)=>{"use strict";i.d(e,{A:()=>c});var r=i(134),s=i(63939),a=i(50932),n=i(54058),o=i(38724);const l=500;class c{constructor(t){(0,r.A)(this,"timer",void 0),(0,r.A)(this,"interval",void 0),(0,r.A)(this,"data",void 0),(0,r.A)(this,"lastIncomingPacketCount",void 0),(0,r.A)(this,"shutterCount",void 0),(0,r.A)(this,"lastShutterCount",void 0),(0,r.A)(this,"isFirst",void 0),(0,r.A)(this,"max",void 0),(0,r.A)(this,"min",void 0),(0,r.A)(this,"targetPlaybackRate",void 0),(0,r.A)(this,"currentPlaybackRate",void 0),(0,r.A)(this,"playbackRateTimer",void 0),(0,r.A)(this,"options",void 0),this.options=t,this.interval=1e3,this.isFirst=!0,this.data=[],this.lastIncomingPacketCount=BigInt(0),this.shutterCount=0,this.lastShutterCount=0,this.max=1e3*t.max>>>0,this.min=1e3*t.min>>>0,a.M[15](this.options.jitterBuffer,this.min),a.M[15](this.options.jitterBuffer+4,this.max),t.lowLatencyStart&&a.M[15](this.options.jitterBuffer+4,this.min+l),this.targetPlaybackRate=1,this.currentPlaybackRate=1,this.playbackRateTimer=new n.A((()=>{if(this.currentPlaybackRate>this.targetPlaybackRate){const t=Math.max(this.targetPlaybackRate,this.currentPlaybackRate-.01);this.options.observer.onSetPlayRate(t),this.currentPlaybackRate=t}else if(this.currentPlaybackRate>1&&t<2e3?this.setPlayRate(.9):ts.f[15](this.options.jitterBuffer+4)+l?this.setPlayRate(1.05):(this.currentPlaybackRate<1&&t>=e||this.currentPlaybackRate>1&&t<=e)&&this.setPlayRate(1),t>2e3&&this.max>2e3&&t>this.max<<1&&this.options.observer.onCroppingBuffer(s.f[15](this.options.jitterBuffer+4))}process(){const t=this.data.reduce(((t,e,i)=>t+e*(i+1)),0)/55,e=this.data.reduce(((e,i)=>e+Math.pow(i-t,2)),0)/this.data.length,i=Math.sqrt(e);if(this.options.lowLatency){const e=Math.round(t/(this.interval/1e3)),r=s.f[15](this.options.stats+232)+s.f[15](this.options.stats+244);e>1||this.shutterCount>3?(a.M[15](this.options.jitterBuffer,Math.min(2*s.f[15](this.options.jitterBuffer),this.max-l)),a.M[15](this.options.jitterBuffer+4,Math.min(2*s.f[15](this.options.jitterBuffer+4),this.max))):e>=r&&i<50?(a.M[15](this.options.jitterBuffer,Math.max(s.f[15](this.options.jitterBuffer)-l,this.min)),a.M[15](this.options.jitterBuffer+4,Math.max(s.f[15](this.options.jitterBuffer+4)-l,this.min+l))):i>100?(a.M[15](this.options.jitterBuffer,Math.min(s.f[15](this.options.jitterBuffer)+l,this.max-l)),a.M[15](this.options.jitterBuffer+4,Math.min(s.f[15](this.options.jitterBuffer+4)+l,this.max))):i<20?s.f[15](this.options.jitterBuffer)===this.min?a.M[15](this.options.jitterBuffer+4,Math.max(s.f[15](this.options.jitterBuffer+4)-l,this.min+l)):a.M[15](this.options.jitterBuffer,Math.max(s.f[15](this.options.jitterBuffer)-l,this.min)):s.f[15](this.options.jitterBuffer+4)===this.max?a.M[15](this.options.jitterBuffer,Math.min(s.f[15](this.options.jitterBuffer)+l,this.max-l)):a.M[15](this.options.jitterBuffer+4,Math.min(s.f[15](this.options.jitterBuffer+4)+l,this.max))}this.computePlayRate(),a.M[19](this.options.stats+272,i)}onTimer(){const t=s.f[17](this.options.stats+24)+s.f[17](this.options.stats+112);this.isFirst?this.isFirst=!1:this.data.push(Number(BigInt.asIntN(32,t-this.lastIncomingPacketCount))),this.lastIncomingPacketCount=t,s.f[15](this.options.stats+292)+s.f[15](this.options.stats+288)>this.lastShutterCount?this.shutterCount++:this.shutterCount=0,this.lastShutterCount=s.f[15](this.options.stats+292)+s.f[15](this.options.stats+288),this.data.length>10&&this.data.shift(),10===this.data.length&&this.process()}}},78201:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var r=i(134),s=i(63939),a=i(50932),n=i(54058);class o{constructor(t,e,i){(0,r.A)(this,"stats",void 0),(0,r.A)(this,"timer",void 0),(0,r.A)(this,"videoFrameRenderCount",void 0),(0,r.A)(this,"videoFrameDecodeCount",void 0),(0,r.A)(this,"audioFrameRenderCount",void 0),(0,r.A)(this,"audioFrameDecodeCount",void 0),(0,r.A)(this,"videoPacketBytes",void 0),(0,r.A)(this,"audioPacketBytes",void 0),(0,r.A)(this,"bufferReceiveBytes",void 0),(0,r.A)(this,"observer",void 0),(0,r.A)(this,"isWorkerMain",void 0),this.stats=t,this.observer=i,this.isWorkerMain=e,this.timer=new n.A(this.onTimer.bind(this),1e3,1e3)}reset(){this.videoFrameRenderCount=s.f[17](this.stats+160),this.videoFrameDecodeCount=s.f[17](this.stats+144),this.audioFrameRenderCount=s.f[17](this.stats+72),this.audioFrameDecodeCount=s.f[17](this.stats+56),this.videoPacketBytes=s.f[17](this.stats+104),this.audioPacketBytes=s.f[17](this.stats+16),this.bufferReceiveBytes=s.f[17](this.stats+192)}start(){this.reset(),this.timer.start()}stop(){this.timer.stop()}onTimer(){this.isWorkerMain||(a.M[15](this.stats+248,0),a.M[15](this.stats+252,0),a.M[15](this.stats+256,0),a.M[15](this.stats+260,0)),a.M[15](this.stats+228,Number(BigInt.asIntN(32,s.f[17](this.stats+160)-this.videoFrameRenderCount))),a.M[15](this.stats+224,Number(BigInt.asIntN(32,s.f[17](this.stats+144)-this.videoFrameDecodeCount))),a.M[15](this.stats+240,Number(BigInt.asIntN(32,s.f[17](this.stats+72)-this.audioFrameRenderCount))),a.M[15](this.stats+236,Number(BigInt.asIntN(32,s.f[17](this.stats+56)-this.audioFrameDecodeCount))),a.M[15](this.stats+220,Number(BigInt.asIntN(32,s.f[17](this.stats+104)-this.videoPacketBytes))),a.M[15](this.stats+216,Number(BigInt.asIntN(32,s.f[17](this.stats+16)-this.audioPacketBytes))),a.M[15](this.stats+264,Number(BigInt.asIntN(32,s.f[17](this.stats+192)-this.bufferReceiveBytes))),"visible"===document.visibilityState&&(s.f[15](this.stats+228)<.5*s.f[15](this.stats+232)||s.f[15](this.stats+260)>6e3/s.f[15](this.stats+232))&&this.observer.onVideoStutter(),this.reset()}}},28090:(t,e,i)=>{"use strict";i.d(e,{CN:()=>n,E9:()=>p,F5:()=>r,Gd:()=>A,IY:()=>m,NN:()=>o,NX:()=>v,Nz:()=>h,Rj:()=>f,S2:()=>s,Sw:()=>g,W1:()=>x,Wt:()=>d,Wu:()=>b,d6:()=>a,hV:()=>c,mQ:()=>u,xv:()=>y,yd:()=>l});const r="loading",s="loaded",a="playing",n="played",o="paused",l="stopped",c="ended",h="seeking",u="seeked",d="changing",f="changed",p="time",m="resume",g="firstAudioRendered",v="firstVideoRendered",y="streamUpdate",A="progress",b="volumeChange",x="subtitle_delay_change"},67593:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var r=i(26429),s=i(42577),a=i(95797);function n(t){return r.USE_THREADS||a.A.worker&&t?new MessageChannel:new s.A}},76750:(t,e,i)=>{"use strict";function r(){if("function"==typeof MediaSource)return MediaSource;if("function"==typeof ManagedMediaSource)return ManagedMediaSource;throw new Error("not support mse")}i.d(e,{A:()=>r})},47595:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var r=i(95797),s=i(44690),a=i(86834);function n(){let t=r.A.offscreenCanvas;return s.A.mac&&a.A.safari&&(s.A.version<"12"||a.A.version<"17")&&(t=!1),t}},25115:(t,e,i)=>{"use strict";i.d(e,{A:()=>q});var r=i(54001),s=i.n(r),a=i(14686),n=i(61499),o=i(63939),l=i(9599),c=i(29170),h=i(50932),u=i(12264),d=i(44315),f=i(44527),p=i(9705),m=i(84149),g=i(4624),v=i(35336),y=i(92174),A=i(69765),b=(i(77162),i(71766)),x=i(39148),w=i(60120),k=i(84290),T=i(77231),_=i(44328),I=i(86932),S=i(85224),P=i(10333),C=i(22343),M=i(71517),B=i(37837),E=i(86834),D=i(85103),R=i(13724),U=i(43607),L=i(65977),F=i(76750),O=i(39381),$=i(62815),N=i(67659),z=i(71762),V=i(72703),W=i(67672),G=i(44690);const j="src/avplayer/mse/MSEPipeline.ts";function H(t,e,i,r){if(e!==r)return!0;let s=!1;for(let r=0;r0&&t.avpacketPool.release(t.audio.backPacket),t.audio.backPacket=await this.pullAVPacket(t.audio,t),t.audio.backPacket<0){t.audio.packetEnded=!0,t.audio.backPacket=0;break}if((0,_.k)(o.f[17](t.audio.backPacket+8),(0,c.A)(t.audio.backPacket+72,l.P),T.i0)>(0,_.k)(o.f[17](t.video.backPacket+8),(0,c.A)(t.video.backPacket+72,l.P),T.i0))break}if(1&o.f[15](t.video.backPacket+36))break;e=!1,t.avpacketPool.release(t.video.backPacket)}return e}getSourceOpenHandler(t){return async()=>{await this.syncToKeyframe(t);const e=[];t.audio&&(t.audio.track.setSourceBuffer(this.createSourceBuffer(t.mediaSource,t.audio.oformatContext.streams[0].codecpar[n.o9])),t.audio.enableRawMpeg||(y.ho(t.audio.oformatContext,{paddingZero:!1}),y.bx(t.audio.oformatContext)),e.push(this.startMux(t.audio,t))),t.video&&(t.video.track.setSourceBuffer(this.createSourceBuffer(t.mediaSource,t.video.oformatContext.streams[0].codecpar[n.o9])),t.video.enableRawMpeg||(y.ho(t.video.oformatContext,{paddingZero:!1}),y.bx(t.video.oformatContext)),e.push(this.startMux(t.video,t))),await s().all(e);let i=!1,r=!1;t.audio&&(t.audio.backPacket=await this.pullAVPacket(t.audio,t),t.audio.backPacket>0?(i=!0,t.audio.frontPacket=await this.pullAVPacket(t.audio,t),t.audio.frontPacket>0?t.audio.frontBuffered=!0:(t.audio.frontPacket=0,t.audio.packetEnded=!0)):t.audio.packetEnded=!0,t.audio.enableRawMpeg||t.audio.oformatContext.ioWriter.flush(),t.audio.track.addBuffer(t.audio.bufferQueue.flush())),t.video&&(t.video.backPacket=await this.pullAVPacket(t.video,t),t.video.backPacket>0?(r=!0,t.video.frontPacket=await this.pullAVPacket(t.video,t),t.video.frontPacket>0?t.video.frontBuffered=!0:(t.video.frontPacket=0,t.video.packetEnded=!0)):t.video.packetEnded=!0,t.video.enableRawMpeg||t.video.oformatContext.ioWriter.flush(),t.video.track.addBuffer(t.video.bufferQueue.flush())),t.audio&&(i?(this.createLoop(t.audio,t),t.audio.loop.start()):t.audio.track.end()),t.video&&(r?(this.createLoop(t.video,t),t.video.loop.start()):t.video.track.end()),await new R.A(.1);let a=0;t.audio?a=t.video?Math.max(t.audio.track.getBufferedStart(),t.video.track.getBufferedStart()):t.audio.track.getBufferedStart():t.video&&(a=t.video.track.getBufferedStart()),(E.A.safari||G.A.ios||a>.1)&&t.controlIPCPort.notify("seek",{time:a})}}getMimeType(t){let e="";return 1===o.f[15](t)?e=(0,S.A)(t):0===o.f[15](t)&&(e=(0,P.A)(t)),e||g.h2("invalid stream",j,345),e}createSourceBuffer(t,e){return t.addSourceBuffer(this.getMimeType(e))}mixExtradata(t,e,i,r){e.oformatContext.streams[0].codecpar.codecId;const s=e.oformatContext.streams[0].codecpar;s.extradata&&(0,B.Eb)(s.extradata),s.extradata=(0,B.sY)(r),(0,a.Mr)(s.extradata,i,r),s.extradataSize=r}async pullAVPacketInternal(t,e){const i=await e.request("pull");if(W.ai(i))return i;{const e=t.avpacketPool.alloc();return(0,z.r0)(i,e),e}}async pullAVPacket(t,e){const i=t.pullQueue;if(i.ended&&!i.queue.length)return-1048576;const r=i.queue.length?i.queue.shift():await this.pullAVPacketInternal(e,t.pullIPC);if(r<0)return i.ended=!0,-1048576;if(o.f[17](r+16)0)h.M[17](r+8,o.f[17](r+16));else if("video"===t.type&&!e.isLive)if(1&o.f[15](r+36)&&(27===o.f[15](e.video.codecpar+4)&&$.KD(r,o.f[20](e.video.codecpar+12)?4&O.r8(o.f[20](e.video.codecpar+12)+4):4)||173===o.f[15](e.video.codecpar+4)&&N.KD(r,o.f[20](e.video.codecpar+12)?4&O.r8(o.f[20](e.video.codecpar+12)+21):4)))if(o.f[17](r+8)n)break;a=U.jk(a,o.f[17](r+8))}ai.lastPTS&&(i.lastPTS=o.f[17](r+8)),i.lastDTS=o.f[17](r+16),"audio"===t.type&&i.useSampleRateTimeBase&&(i.frameCount===T.Dh?(i.frameCount=(0,_.k)(o.f[17](r+16),(0,c.A)(r+72,l.P),t.oformatContext.streams[0].timeBase),h.M[17](r+16,i.frameCount),h.M[17](r+8,i.frameCount)):(i.frameCount=i.frameCount+BigInt(0|o.f[15](t.codecpar+144)),h.M[17](r+16,i.frameCount),h.M[17](r+8,i.frameCount)),(0,a.Mr)(r+72,t.oformatContext.streams[0].timeBase[n.o9],8)),r}writeAVPacket(t,e,i=!1){if(e.enableRawMpeg){if(!e.timestampOffsetUpdated){const i=(0,_.k)(o.f[17](t+8),(0,c.A)(t+72,l.P),T.i0);e.track.updateTimestampOffset(Number(BigInt.asIntN(32,i))/1e3),e.timestampOffsetUpdated=!0}e.bufferQueue.write((0,a.s3)(o.f[20](t+24),o.f[15](t+28)).slice())}else y.XA(e.oformatContext,t),i&&e.oformatContext.ioWriter.flush()}swap(t,e){if(t.backPacket&&e.avpacketPool.release(t.backPacket),t.backPacket=0,!t.frontBuffered)return!1;t.backPacket=t.frontPacket,t.frontPacket=0,t.frontBuffered=!1;const i=(0,I.A)();return this.pullAVPacket(t,e).then((r=>{if(r<0)return t.packetEnded=!0,void(t.frontPacket=0);const s=(0,I.A)()-i;s>5&&(t.startTimestamp+=BigInt(Math.floor(s))),t.frontPacket=r,t.frontBuffered=!0,t.seekSync&&(t.seekSync(),t.seekSync=null),t.backPacket||this.swap(t,e)})),!0}createLoop(t,e){t.loop=new x.A((()=>{const i=t.track.getBufferedEnd()-(e.currentTime+((0,I.A)()-e.currentTimeNTP)/1e3);if(i>1*(e.playRate>BigInt(100)?Number(e.playRate)/100:1))return void t.loop.emptyTask();if(!t.backPacket)return void(t.packetEnded&&!t.frontPacket?(t.ended=!0,t.loop.stop(),t.enableRawMpeg||(y.dJ(t.oformatContext),y.bX(t.oformatContext)),t.bufferQueue.size&&t.track.addBuffer(t.bufferQueue.flush()),t.track.end()):t.loop.emptyTask());let r=t.backPacket;const s=(0,_.k)(o.f[17](r+16),(0,c.A)(r+72,l.P),T.i0);if(e.enableJitterBuffer&&(o.f[15](e.stats+244)?o.f[15](e.stats+32)/o.f[15](e.stats+244)*1e3:o.f[15](e.stats+232)?o.f[15](e.stats+120)/o.f[15](e.stats+232)*1e3:0)<=o.f[15](e.stats+280)&&this.setPlayRate(e.taskId,1),s*BigInt(100)/e.playRate+t.startTimestamp-BigInt(Math.floor((0,I.A)()))<=0||i<.5*(e.playRate>BigInt(100)?Number(e.playRate)/100:1)){t.track.isPaused()&&t.track.enqueue(),h.M[15](r+32,t.oformatContext.streams[0].index);const i=(0,M.rU)(r,1);i&&H(t.oformatContext.streams[0].codecpar.extradata,t.oformatContext.streams[0].codecpar.extradataSize,o.f[20](i),o.f[15](i+4))&&this.mixExtradata(r,t,o.f[20](i),o.f[15](i+4)),this.writeAVPacket(r,t,!0),t.track.addBuffer(t.bufferQueue.flush());const a=t.oformatContext.streams[0].codecpar.codecType;if(0===a?(h.M[17](e.stats+144,o.f[17](e.stats+144)+BigInt(1)),h.M[17](e.stats+160,o.f[17](e.stats+160)+BigInt(1))):1===a&&(h.M[17](e.stats+56,o.f[17](e.stats+56)+BigInt(1)),h.M[17](e.stats+72,o.f[17](e.stats+72)+BigInt(1))),e.playRate!==e.targetRate&&(t.startTimestamp=BigInt(Math.floor((0,I.A)()))-s*BigInt(100)/e.targetRate,e.playRate=e.targetRate),t.packetEnded&&!t.frontPacket)return t.ended=!0,t.loop.stop(),t.enableRawMpeg||(y.dJ(t.oformatContext),y.bX(t.oformatContext)),t.bufferQueue.size&&t.track.addBuffer(t.bufferQueue.flush()),void t.track.end();this.swap(t,e)}else t.loop.emptyTask()}),0,0)}async startMux(t,e){let i,r=T.Dh,s=T.Dh,a=BigInt(0);const n=t.oformatContext.streams[0].timeBase;for(t.backPacket>0&&(r=o.f[17](t.backPacket+16),s=o.f[17](t.backPacket+8),h.M[15](t.backPacket+32,t.oformatContext.streams[0].index),this.writeAVPacket(t.backPacket,t),e.avpacketPool.release(t.backPacket),t.backPacket=0);r{t.startTimestamp-=BigInt(100)},r.onEnded=()=>{e.audio&&!e.audio.ended||e.video&&!e.video.ended||(e.mediaSource.endOfStream(),g.pq(`muxer ended, taskId: ${e.taskId}`,j,755))},t.track=r,t.packetEnded=!1,t.ended=!1,t.startTimestamp=BigInt(0),t.frontBuffered=!1,t.seekSync=null,t.loop&&(t.loop.destroy(),t.loop=null),t.frontPacket&&(e.avpacketPool.release(t.frontPacket),t.frontPacket=0),t.backPacket&&(e.avpacketPool.release(t.backPacket),t.backPacket=0),t.pullQueue.ended=!1,t.pullQueue.index=0,t.pullQueue.frameCount=T.Dh,t.pullQueue.lastPTS=BigInt(0),t.pullQueue.lastDTS=BigInt(0),t.pullQueue.diff=BigInt(0)}async addStream(t,e,i,r,s,a){const l=this.tasks.get(t);if(l){const t=(0,B.Gy)(168);(0,V.A)(i)?(0,b.Yi)(t,i):(0,z.T8)(i,t);const c=new v.A(1048576),u=(0,d.fG)(),f=new A.A({fragmentMode:1,fragment:!0,fastOpen:!0,movMode:0,defaultBaseIsMoof:!0}),y=new C.A;c.onFlush=t=>(y.write(t.slice()),0),c.onSeek=t=>y.seek(t)?0:p.lh;const x=u.createStream();(0,b.Yi)(x.codecpar[n.o9],t),86017===o.f[15](t+4)&&(x.codecpar.codecTag=(0,L.A)(".mp3"));const k=1===o.f[15](t)&&o.f[15](t+144)&&!l.isLive&&(0,_.lb)(r)>(0,_.lb)({num:1,den:o.f[15](t+136)});k?(x.timeBase.den=o.f[15](t+136),x.timeBase.num=1):(x.timeBase.den=r.den,x.timeBase.num=r.num),u.oformat=f,u.ioWriter=c;const I=new w.A,S={type:"audio",codecpar:t,ioWriter:c,oformatContext:u,oformat:f,track:I,bufferQueue:y,streamIndex:e,pullIPC:new m.Ay(a),loop:null,frontPacket:0,backPacket:0,frontBuffered:!1,startTimestamp:BigInt(0),packetEnded:!1,ended:!1,seekSync:null,startPTS:s,pullQueue:{queue:[],index:0,frameCount:T.Dh,diff:BigInt(0),lastPTS:BigInt(0),lastDTS:BigInt(0),ended:!1,useSampleRateTimeBase:k},enableRawMpeg:86017===o.f[15](t+4)&&!E.A.firefox,timestampOffsetUpdated:!1};I.onQuotaExceededError=()=>{S.startTimestamp-=BigInt(100)},I.onEnded=()=>{l.audio&&!l.audio.ended||l.video&&!l.video.ended||(l.mediaSource.endOfStream(),g.pq(`muxer ended, taskId: ${l.taskId}`,j,896))},1===o.f[15](t)?(l.audio=S,h.M[15](l.stats+4,o.f[15](t+136)),h.M[15](l.stats,o.f[15](t+116))):0===o.f[15](t)&&(S.type="video",l.video=S,h.M[15](l.stats+84,o.f[15](t+56)),h.M[15](l.stats+88,o.f[15](t+60)),o.f[15](l.stats+84)*o.f[15](l.stats+88)>8294400&&(E.A.safari||G.A.ios)&&(l.cacheDuration=U.T9(BigInt(3e3),l.cacheDuration)))}else g.h2("task not found",j,917)}async reAddStream(t,e,i,r,a){const l=this.tasks.get(t);if(l){const t=(0,B.Gy)(168);(0,V.A)(i)?(0,b.Yi)(t,i):(0,z.T8)(i,t);const c=1===o.f[15](t)?l.audio:l.video;if(c){c.bufferQueue.flush(),await new(s())((t=>{c.track.removeAllBuffer((()=>{t()}))})),c.track.reset();const i=new A.A({fragmentMode:1,fragment:!0,fastOpen:!0,movMode:0,defaultBaseIsMoof:!0});c.oformatContext.oformat=i,c.codecpar&&(0,b.dn)(c.codecpar),c.codecpar=t,c.streamIndex=e,c.startPTS=a;const h=c.oformatContext.streams[0];(0,b.Yi)(h.codecpar[n.o9],t),86017===o.f[15](t+4)&&(h.codecpar.codecTag=(0,L.A)(".mp3")),1===o.f[15](t)&&o.f[15](t+144)&&!l.isLive&&(0,_.lb)(r)>(0,_.lb)({num:1,den:o.f[15](t+136)})?(h.timeBase.den=o.f[15](t+136),h.timeBase.num=1):(h.timeBase.den=r.den,h.timeBase.num=r.num),c.track.changeMimeType(this.getMimeType(h.codecpar[n.o9])),c.enableRawMpeg||(y.ho(c.oformatContext,{paddingZero:!1}),y.bx(c.oformatContext))}else(0,b.dn)(t)}else g.h2("task not found",j,1005)}async pause(t){const e=this.tasks.get(t);var i,r,s,a;e?(null!==(i=e.audio)&&void 0!==i&&i.loop||null!==(r=e.video)&&void 0!==r&&r.loop||g.h2("task has not played",j,1013),e.pausing=!0,e.pauseTimestamp=(0,I.A)(),null===(s=e.audio)||void 0===s||s.loop.stop(),null===(a=e.video)||void 0===a||a.loop.stop()):g.h2("task not found",j,1021)}async unpause(t){const e=this.tasks.get(t);var i,r;e?(null!==(i=e.audio)&&void 0!==i&&i.loop||null!==(r=e.video)&&void 0!==r&&r.loop||g.h2("task has not played",j,1029),e.pausing=!1,e.seeking||(e.audio&&(e.audio.startTimestamp+=BigInt(Math.floor((0,I.A)()-e.pauseTimestamp)),e.audio.loop.start()),e.video&&(e.video.startTimestamp+=BigInt(Math.floor((0,I.A)()-e.pauseTimestamp)),e.video.loop.start()))):g.h2("task not found",j,1046)}async beforeSeek(t){const e=this.tasks.get(t);if(e){var i,r;const t=[];e.audio&&(e.audio.ended||e.audio.frontBuffered||t.push(new(s())((t=>{e.audio.seekSync=t})))),e.video&&(e.video.ended||e.video.frontBuffered||t.push(new(s())((t=>{e.video.seekSync=t})))),await s().all(t),e.seeking=!0,null===(i=e.audio)||void 0===i||i.loop.stop(),null===(r=e.video)||void 0===r||r.loop.stop(),e.audio&&(e.audio.enableRawMpeg||y.bX(e.audio.oformatContext),e.audio.bufferQueue.flush(),(E.A.safari||G.A.ios)&&await new(s())((t=>{e.audio.track.removeAllBuffer((()=>{t()}))})),e.audio.track.reset(),e.audio.packetEnded=!1,e.audio.timestampOffsetUpdated=!1,e.audio.backPacket&&(e.avpacketPool.release(e.audio.backPacket),e.audio.backPacket=0),e.audio.frontPacket&&(e.avpacketPool.release(e.audio.frontPacket),e.audio.frontPacket=0),e.audio.pullQueue.queue.length&&e.audio.pullQueue.queue.forEach((t=>{e.avpacketPool.release(t)})),e.audio.pullQueue.queue.length=0,e.audio.pullQueue.ended=!1,e.audio.pullQueue.index=0,e.audio.pullQueue.lastPTS=BigInt(0),e.audio.pullQueue.lastDTS=BigInt(0),e.audio.pullQueue.diff=BigInt(0),e.audio.pullQueue.frameCount=T.Dh),e.video&&(e.video.enableRawMpeg||y.bX(e.video.oformatContext),e.video.bufferQueue.flush(),(E.A.safari||G.A.ios)&&await new(s())((t=>{e.video.track.removeAllBuffer((()=>{t()}))})),e.video.track.reset(),e.video.packetEnded=!1,e.video.timestampOffsetUpdated=!1,e.video.backPacket&&(e.avpacketPool.release(e.video.backPacket),e.video.backPacket=0),e.video.frontPacket&&(e.avpacketPool.release(e.video.frontPacket),e.video.frontPacket=0),e.video.pullQueue.queue.length&&e.video.pullQueue.queue.forEach((t=>{e.avpacketPool.release(t)})),e.video.pullQueue.queue.length=0,e.video.pullQueue.ended=!1,e.video.pullQueue.index=0,e.video.pullQueue.diff=BigInt(0),e.video.pullQueue.lastPTS=BigInt(0),e.video.pullQueue.lastDTS=BigInt(0))}}async afterSeek(t,e){const i=this.tasks.get(t);if(i){let t=e,r=e,a=await this.syncToKeyframe(i);i.audio&&i.audio.backPacket>0&&((!a||e0&&((!a||e{i.audio.track.addBuffer(i.audio.bufferQueue.flush(),(()=>{t()}))})))),i.video&&(i.video.enableRawMpeg||y.bX(i.video.oformatContext),u.push(new(s())((t=>{i.video.track.addBuffer(i.video.bufferQueue.flush(),(()=>{t()}))})))),await s().all(u),i.audio&&!i.audio.packetEnded&&(i.audio.backPacket<=0&&(i.audio.backPacket=await this.pullAVPacket(i.audio,i),i.audio.backPacket<0&&(i.audio.packetEnded=!0,i.audio.backPacket=0)),i.audio.packetEnded||(i.audio.frontPacket=await this.pullAVPacket(i.audio,i),i.audio.frontPacket<0?(i.audio.frontPacket=0,i.audio.packetEnded=!0,i.audio.frontBuffered=!1):(i.audio.packetEnded=!1,i.audio.frontBuffered=!0),i.audio.startTimestamp=BigInt(Math.floor((0,I.A)()))-(t+i.cacheDuration+(0,_.k)(i.audio.startPTS,i.audio.oformatContext.streams[0].timeBase,T.i0))*BigInt(100)/i.playRate,i.pausing?i.pauseTimestamp=(0,I.A)():i.audio.loop.start())),i.video&&!i.video.packetEnded&&(i.video.backPacket<=0&&(i.video.backPacket=await this.pullAVPacket(i.video,i),i.video.backPacket<0&&(i.video.packetEnded=!0,i.video.backPacket=0)),i.video.packetEnded||(i.video.frontPacket=await this.pullAVPacket(i.video,i),i.video.frontPacket<0?(i.video.packetEnded=!0,i.video.frontBuffered=!1,i.video.frontPacket=0):(i.video.packetEnded=!1,i.video.frontBuffered=!0),i.video.startTimestamp=BigInt(Math.floor((0,I.A)()))-(r+i.cacheDuration+(0,_.k)(i.video.startPTS,i.video.oformatContext.streams[0].timeBase,T.i0))*BigInt(100)/i.playRate,i.pausing?i.pauseTimestamp=(0,I.A)():i.video.loop.start())),a||await new R.A(.5);let d=0,f=0;i.audio?i.video?(d=Math.max(i.audio.track.getBufferedStart(),i.video.track.getBufferedStart()),f=Math.min(i.audio.track.getBufferedEnd(),i.video.track.getBufferedEnd())):(d=i.audio.track.getBufferedStart(),f=i.audio.track.getBufferedEnd()):i.video&&(d=i.video.track.getBufferedStart(),f=i.video.track.getBufferedEnd());let p=(0,D.yw)(n);return p>=d&&p<=f||(p=Math.abs(p-d)>Math.abs(p-f)?f:d),i.currentTimeNTP=(0,I.A)(),i.currentTime=p,i.seeking=!1,p}return 0}async setPlayRate(t,e){const i=this.tasks.get(t);if(i){if(i.enableJitterBuffer){let t=o.f[15](i.stats+244)?o.f[15](i.stats+32)/o.f[15](i.stats+244)*1e3:o.f[15](i.stats+232)?o.f[15](i.stats+120)/o.f[15](i.stats+232)*1e3:0;t&&t<=o.f[15](i.stats+280)&&(e=1)}i.targetRate=BigInt(Math.floor(Math.floor(100*e))),i.enableJitterBuffer||(i.audio&&i.audio.loop&&i.audio.loop.resetInterval(),i.video&&i.video.loop&&i.video.loop.resetInterval())}}async restart(t){const e=this.tasks.get(t);if(e){e.audio&&this.resetResource(e.audio,e),e.video&&this.resetResource(e.video,e);const t=new((0,F.A)());t.onsourceopen=this.getSourceOpenHandler(e),e.mediaSource=t}}async setCurrentTime(t,e){const i=this.tasks.get(t);i?(i.audio&&i.audio.track.removeBuffer(e),i.video&&o.f[15](i.stats+92)>0&&(i.video.track.setMediaBufferMax(Math.max(i.video.track.getMediaBufferMax(),Math.ceil(o.f[15](i.stats+92)/1e3*1.5),10)),i.video.track.removeBuffer(e)),i.currentTime=e,i.currentTimeNTP=(0,I.A)()):g.h2("task not found",j,1446)}async getMediaSource(t){const e=this.tasks.get(t);if(e)return e.mediaSource.handle?(this.getMediaSource.transfer.push(e.mediaSource.handle),e.mediaSource.handle):e.mediaSource;g.h2("task not found",j,1463)}createTask(t){const e=new m.Ay(t.controlPort),i=new((0,F.A)()),r={...t,mediaSource:i,audio:null,video:null,playRate:BigInt(100),targetRate:BigInt(100),pauseTimestamp:0,seeking:!1,pausing:!1,controlIPCPort:e,currentTime:0,currentTimeNTP:0,cacheDuration:BigInt(Math.floor(500)),avpacketPool:new k.A((0,c.A)(t.avpacketList,u.A),t.avpacketListMutex)};return this.tasks.set(t.taskId,r),i.onsourceopen=this.getSourceOpenHandler(r),0}async registerTask(t){return this.tasks.has(t.taskId)?p.lh:this.createTask(t)}async unregisterTask(t){const e=this.tasks.get(t);e&&(e.audio&&(e.audio.loop&&(await e.audio.oformatContext.destroy(),e.audio.loop.destroy()),e.audio.pullIPC&&e.audio.pullIPC.destroy(),e.audio.pullQueue.queue.length&&(e.audio.pullQueue.queue.forEach((t=>{e.avpacketPool.release(t)})),e.audio.pullQueue.queue.length=0),e.audio.codecpar&&(0,b.dn)(e.audio.codecpar)),e.video&&(e.video.loop&&(await e.video.oformatContext.destroy(),e.video.loop.destroy()),e.video.pullIPC&&e.video.pullIPC.destroy(),e.video.pullQueue.queue.length&&(e.video.pullQueue.queue.forEach((t=>{e.avpacketPool.release(t)})),e.video.pullQueue.queue.length=0),e.video.codecpar&&(0,b.dn)(e.video.codecpar)),e.controlIPCPort&&e.controlIPCPort.destroy(),this.tasks.delete(t))}}},52277:(t,e,i)=>{"use strict";i.d(e,{M:()=>f});var r,s,a=i(134),n=i(80662),o=i.n(n),l=i(61499),c=i(12085),h=i(12264),u=i(73783),d=i(30128);class f{constructor(){(0,a.A)(this,"avpacketList",void 0),(0,a.A)(this,"avframeList",void 0),(0,a.A)(this,"avpacketListMutex",void 0),(0,a.A)(this,"avframeListMutex",void 0),(0,a.A)(this,"stats",void 0)}}r=f.prototype,(s=new(o())).set("avpacketList",{0:h.A,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}),s.set("avframeList",{0:h.A,1:0,2:0,3:0,4:0,5:0,6:0,7:12,8:0}),s.set("avpacketListMutex",{0:u.eu,1:0,2:0,3:0,4:0,5:0,6:0,7:24,8:0}),s.set("avframeListMutex",{0:u.eu,1:0,2:0,3:0,4:0,5:0,6:0,7:28,8:0}),s.set("stats",{0:d.A,1:0,2:0,3:0,4:0,5:0,6:0,7:32,8:0}),(0,c.A)(r,l.Og,!0),(0,c.A)(r,l.dc,8),(0,c.A)(r,l.g7,376),(0,c.A)(r,l.JY,s)},57038:(t,e,i)=>{"use strict";i.d(e,{A:()=>g});var r=i(134),s=i(23873),a=i(77658),n=i(21194),o=i(77334),l=i(8284),c=i(65749),h=i(49963),u=i(78040),d=i(47924),f=i(95335);const p='.ASS-box{font-family:Arial;overflow:hidden;pointer-events:none;position:absolute}.ASS-dialogue{font-size:0;position:absolute;z-index:0}.ASS-dialogue span{display:inline-block}.ASS-dialogue [data-text]{display:inline-block;color:var(--ass-fill-color);font-size:calc(var(--ass-scale)*var(--ass-real-fs)*1px);line-height:calc(var(--ass-scale)*var(--ass-tag-fs)*1px);letter-spacing:calc(var(--ass-scale)*var(--ass-tag-fsp)*1px)}.ASS-dialogue [data-wrap-style="0"],.ASS-dialogue [data-wrap-style="3"]{text-wrap:balance}.ASS-dialogue [data-wrap-style="1"]{word-break:break-word;white-space:normal}.ASS-dialogue [data-wrap-style="2"]{word-break:normal;white-space:nowrap}.ASS-dialogue [data-border-style="1"]{position:relative}.ASS-dialogue [data-border-style="1"]::after,.ASS-dialogue [data-border-style="1"]::before{content:attr(data-text);position:absolute;top:0;left:0;z-index:-1;filter:blur(calc(var(--ass-tag-blur)*1px))}.ASS-dialogue [data-border-style="1"]::before{color:var(--ass-shadow-color);transform:translate(calc(var(--ass-scale-stroke)*var(--ass-tag-xshad)*1px),calc(var(--ass-scale-stroke)*var(--ass-tag-yshad)*1px));-webkit-text-stroke:var(--ass-border-width) var(--ass-shadow-color);text-shadow:var(--ass-shadow-delta);opacity:var(--ass-shadow-opacity)}.ASS-dialogue [data-border-style="1"]::after{color:transparent;-webkit-text-stroke:var(--ass-border-width) var(--ass-border-color);text-shadow:var(--ass-border-delta);opacity:var(--ass-border-opacity)}.ASS-dialogue [data-border-style="3"]{padding:calc(var(--ass-scale-stroke)*var(--ass-tag-xbord)*1px) calc(var(--ass-scale-stroke)*var(--ass-tag-ybord)*1px);position:relative;filter:blur(calc(var(--ass-tag-blur)*1px))}.ASS-dialogue [data-border-style="3"]::after,.ASS-dialogue [data-border-style="3"]::before{content:"";width:100%;height:100%;position:absolute;z-index:-1}.ASS-dialogue [data-border-style="3"]::before{background-color:var(--ass-shadow-color);left:calc(var(--ass-scale-stroke)*var(--ass-tag-xshad)*1px);top:calc(var(--ass-scale-stroke)*var(--ass-tag-yshad)*1px)}.ASS-dialogue [data-border-style="3"]::after{background-color:var(--ass-border-color);left:0;top:0}@container style(--ass-tag-xbord: 0) and style(--ass-tag-ybord: 0){.ASS-dialogue [data-border-style="3"]::after{background-color:transparent}}@container style(--ass-tag-xshad: 0) and style(--ass-tag-yshad: 0){.ASS-dialogue [data-border-style="3"]::before{background-color:transparent}}.ASS-dialogue [data-rotate]{transform:perspective(312.5px) rotateY(calc(var(--ass-tag-fry)*1deg)) rotateX(calc(var(--ass-tag-frx)*1deg)) rotateZ(calc(var(--ass-tag-frz)*-1deg))}.ASS-dialogue [data-text][data-rotate]{transform-style:preserve-3d;word-break:normal;white-space:nowrap}.ASS-dialogue [data-scale],.ASS-dialogue [data-skew]{display:inline-block;transform:scale(var(--ass-tag-fscx),var(--ass-tag-fscy)) skew(calc(var(--ass-tag-fax)*1rad),calc(var(--ass-tag-fay)*1rad));transform-origin:var(--ass-align-h) var(--ass-align-v)}.ASS-fix-font-size{font-size:2048px;font-family:Arial;line-height:normal;width:0;height:0;position:absolute;visibility:hidden;overflow:hidden}.ASS-clip-area,.ASS-fix-font-size span{position:absolute}.ASS-clip-area{width:100%;height:100%;top:0;left:0}.ASS-scroll-area{position:absolute;width:100%;overflow:hidden}',m={Name:"Default",Fontname:"Arial",Fontsize:"16",PrimaryColour:"&Hffffff",SecondaryColour:"&Hffffff",OutlineColour:"&H0",BackColour:"&H0",Bold:"0",Italic:"0",Underline:"0",StrikeOut:"0",ScaleX:"100",ScaleY:"100",Spacing:"0",Angle:"0",BorderStyle:"1",Outline:"1",Shadow:"0",Alignment:"2",MarginL:"10",MarginR:"10",MarginV:"10",Encoding:"0"};class g{constructor(t,e={container:t.parentNode}){if((0,r.A)(this,"store",void 0),(0,r.A)(this,"resampling_","video_height"),(0,r.A)(this,"resize_",void 0),(0,r.A)(this,"options",void 0),this.options=f.X$({},e),this.store={video:t,box:document.createElement("div"),svg:(0,o.An)("svg"),defs:(0,o.An)("defs"),observer:null,scale:1,width:0,height:0,scriptRes:{width:e.videoWidth||t.clientWidth,height:e.videoHeight||t.clientHeight},layoutRes:{width:e.videoWidth||t.clientWidth,height:e.videoHeight||t.clientHeight},resampledRes:{width:0,height:0},sbas:!0,styles:null,space:[],actives:[],delay:0,index:0,dialogues:[]},null==e.videoWidth&&(t.videoWidth=e.videoWidth),null==e.videoHeight&&(t.videoHeight=e.videoHeight),!e.container)throw new Error("Missing container.");this.resize_=(0,n.By)(this,this.store),this.updateHeader(e.header),e.container.append(a.Y);const{svg:i,defs:s,scriptRes:l,box:c}=this.store;i.setAttributeNS(null,"viewBox",`0 0 ${l.width} ${l.height}`),i.append(s),e.container.append(i),c.className="ASS-box",e.container.append(c),function(t){const e=t.getRootNode()||document;let i=e instanceof Document;!i&&"object"==typeof documentPictureInPicture&&documentPictureInPicture.window&&(i=e===documentPictureInPicture.window.document);const r=i?e.head:e;let s=r.querySelector("#ASS-global-style");s||(s=document.createElement("style"),s.type="text/css",s.id="ASS-global-style",s.append(document.createTextNode(p)),r.append(s)),document.head.querySelector("#ASS-global-style")||(s=document.createElement("style"),s.type="text/css",s.id="ASS-global-style",s.append(document.createTextNode(p)),document.head.append(s))}(e.container),this.resampling_=e.resampling||"video_height";const h=new ResizeObserver(this.resize.bind(this));return h.observe(t),this.store.observer=h,this}framing(t){const e=(0,d.U)(t,this.store);(0,o.MA)(e,"play"),e.__dialogue=t,this.store.actives.push(e)}updateHeader(t){if(t){const{info:e,width:i,height:r,styles:s}=(0,c.wE)(t,{defaultStyle:m});this.store.sbas=/yes/i.test(e.ScaledBorderAndShadow),this.store.layoutRes={width:+e.LayoutResX||this.options.videoWidth||this.store.video.clientWidth,height:+e.LayoutResY||this.options.videoHeight||this.store.video.clientHeight},this.store.scriptRes={width:i||this.store.layoutRes.width,height:r||this.store.layoutRes.height},this.store.styles=s}else this.store.styles=(0,u.W)({info:{WrapStyle:""},style:[],defaultStyle:m}),this.store.scriptRes={width:384,height:288};this.resize_(),this.options.header=t}updateVideoResolution(t,e){if(this.options.header){const{info:i,width:r,height:s}=(0,c.wE)(this.options.header,{defaultStyle:m});this.store.layoutRes={width:+i.LayoutResX||t||this.store.video.clientWidth,height:+i.LayoutResY||e||this.store.video.clientHeight},this.store.scriptRes={width:r||this.store.layoutRes.width,height:s||this.store.layoutRes.height}}else this.store.layoutRes={width:t,height:e}}render(t){if(1===t.type){t.Start=Number(t.Start)/1e3,t.End=Number(t.End)/1e3;const e=(0,h.b)({styles:this.store.styles,dialogues:[t]})[0];f.X$(e,{d:`ASS-${(0,l.A)()}`,align:{h:(e.alignment+2)%3,v:Math.trunc((e.alignment-1)/3)}}),(0,s.w7)(e,this.store),this.framing(e)}}clear(t){const e=Number(BigInt.asIntN(32,t))/1e3;for(let t=this.store.actives.length-1;t>=0;t-=1){const i=this.store.actives[t],{end:r}=i;r=0;t-=1)this.store.actives[t].$div.remove();this.store.actives.length=0,this.store.space.length=0}resize(){const t=this.store.actives.slice();this.resize_();for(let e=0;e{"use strict";i.d(e,{A:()=>I});var r=i(134),s=i(80662),a=i.n(s),n=i(12264),o=i(29170),l=i(63939),c=i(9599),h=i(50932),u=i(53616),d=i(84149),f=i(39148),p=i(4624),m=i(57038),g=i(50011),v=i(14686),y=i(51785),A=i(84290),b=i(44328),x=i(77231),w=i(95335),k=i(71517);const T="src/avplayer/subtitle/SubtitleRender.ts",_=[{reg://g,value:"{\\i1}"},{reg:/<\/i>/g,value:"{\\i0}"},{reg://g,value:"{\\b1}"},{reg:/<\/b>/g,value:"{\\b0}"},{reg://g,value:"{\\u1}"},{reg:/<\/u>/g,value:"{\\u0}"},{reg:/{/g,value:"\\{"},{reg:/}/g,value:"\\}"},{reg:/>/g,value:">"},{reg:/</g,value:"<"},{reg:/‎/g,value:""},{reg:/‏/g,value:""},{reg:/&/g,value:"&"},{reg:/ /g,value:"\\h"},{reg:/()|\n>/g,value:"\\N"}];class I{constructor(t){(0,r.A)(this,"decoder",void 0),(0,r.A)(this,"loop",void 0),(0,r.A)(this,"demuxer2SubtitleRenderChannels",void 0),(0,r.A)(this,"leftPorts",void 0),(0,r.A)(this,"currentPort",void 0),(0,r.A)(this,"render",void 0),(0,r.A)(this,"queue",void 0),(0,r.A)(this,"ended",void 0),(0,r.A)(this,"options",void 0),(0,r.A)(this,"pulling",void 0),(0,r.A)(this,"formats",void 0),(0,r.A)(this,"avpacketPool",void 0),(0,r.A)(this,"delay",void 0),(0,r.A)(this,"enable",void 0),this.options=w.X$({},t),this.ended=!1,this.pulling=!1,this.queue=[],this.delay=BigInt(0),this.demuxer2SubtitleRenderChannels=new(a()),this.leftPorts=new(a()),t.avpacketList&&(this.avpacketPool=new A.A((0,o.A)(t.avpacketList,n.A),t.avpacketListMutex)),this.createDecoder(),this.render=new m.A(this.options.dom,{header:this.getAssHeader(this.options.codecpar),container:this.options.container,videoWidth:this.options.videoWidth,videoHeight:this.options.videoHeight}),this.loop=new f.A((()=>{!this.queue.length&&this.ended&&this.loop.stop(),this.queue.length<6&&!this.ended&&this.pull();const t=this.options.getCurrentTime()-this.delay;for(this.render.clear(t);this.queue.length;){const e=this.queue[0];if(e.Start>t)break;e.End>t&&this.render.render(e),this.queue.shift()}}),0,50,!1)}getAssHeader(t){let e="";if(94230===l.f[15](t+4)&&l.f[15](t+16)){e=g.decode((0,v.s3)(l.f[20](t+12),l.f[15](t+16)));const i=e.split(/\r?\n/);let r=!1;for(let t=0;t{for(let e=0;e{"use strict";i.d(e,{A:()=>x});var r=i(134),s=i(80662),a=i.n(s),n=i(61499),o=i(52277),l=i(74503),c=i(94300),h=i(67672),u=i(4624),d=i(18667),f=i(59377),p=i(56024),m=i(71517),g=i(73783),v=i(84149),y=i(54058),A=i(95335);const b="src/avplayer/worker/AudioPipeline.ts";class x{constructor(){(0,r.A)(this,"decoder",void 0),(0,r.A)(this,"render",void 0),(0,r.A)(this,"globalDataMap",void 0),(0,r.A)(this,"controlPort",void 0),(0,r.A)(this,"timer",void 0),this.decoder=new d.A,this.render=new f.A,this.globalDataMap=new(a())}createGlobalData(t){const e=(0,l.A)(o.M);return g.Ts(e[n.o9]+24),g.Ts(e[n.o9]+28),this.globalDataMap.set(t,e),e}releaseGlobalData(t){t.avframeList.clear((t=>{(0,p.to)(t)}),20),t.avpacketList.clear((t=>{(0,m.Up)(t)}),20),g.zr(t[n.o9]+24),g.zr(t[n.o9]+28),(0,c.A)(t)}async init(t){this.controlPort=new v.Ay(t);let e=0;this.timer=new y.A((()=>{e++;const t=[];this.globalDataMap.forEach(((i,r)=>{const s=i.stats;t.push({taskId:r,stats:{audioFrameDecodeCount:s.audioFrameDecodeCount,audioFrameDecodeIntervalMax:s.audioFrameDecodeIntervalMax,audioDecodeErrorPacketCount:s.audioDecodeErrorPacketCount,audioFrameRenderCount:s.audioFrameRenderCount,audioFrameRenderIntervalMax:s.audioFrameRenderIntervalMax,sampleRate:s.sampleRate,channels:s.channels,audioFrameSize:s.audioFrameSize,audioCurrentTime:s.audioCurrentTime}}),2===e&&(s.audioFrameDecodeIntervalMax=0,s.audioFrameRenderIntervalMax=0)})),this.controlPort.notify("stats",{data:t}),2===e&&(e=0)}),0,500),this.controlPort.on(v.Wo,(t=>{if("stats"===t.method){const e=t.params.data;for(let t=0;t{i[e]=t})),i.jitterBuffer.min=e[t].jitterBuffer.min,i.jitterBuffer.max=e[t].jitterBuffer.max)}}})),this.timer.start()}async invoke(t,e,i){const r=this;function s(t,e,i){if("unregisterTask"===t){const t=r.globalDataMap.get(e[0]);t&&(r.releaseGlobalData(t),r.globalDataMap.delete(e[0]))}else if("clear"===t)r.globalDataMap.forEach((t=>{r.releaseGlobalData(t)})),r.globalDataMap.clear();else if("syncSeekTime"===t){const t=r.globalDataMap.get(e[0]);if(t)return t.stats.audioCurrentTime}return i}if("decoder"===t){if("registerTask"===e){const t=this.globalDataMap.get(i[0].taskId)||this.createGlobalData(i[0].taskId);i[0].stats=t[n.o9]+32,i[0].avpacketList=t[n.o9],i[0].avpacketListMutex=t[n.o9]+24,i[0].avframeList=t[n.o9]+12,i[0].avframeListMutex=t[n.o9]+28}if(h.Pc(this.decoder[e]))return this.decoder[e](...i).then((t=>s(e,i,t)));u.h2(`method ${e} not found`,b,179)}else{if("registerTask"===e){const t=this.globalDataMap.get(i[0].taskId)||this.createGlobalData(i[0].taskId);i[0].stats=t[n.o9]+32,i[0].avframeList=t[n.o9]+12,i[0].avframeListMutex=t[n.o9]+28}if(h.Pc(this.render[e]))return this.render[e](...i).then((t=>s(e,i,t)));u.h2(`method ${e} not found`,b,197)}}async setLogLevel(t){u.V$(t)}}},40097:(t,e,i)=>{"use strict";i.d(e,{A:()=>d});var r=i(134),s=i(80662),a=i.n(s),n=i(30128),o=i(29170),l=i(88506),c=i(27089),h=i(84149),u=i(95335);class d{constructor(){(0,r.A)(this,"thread",void 0),(0,r.A)(this,"controlMessageChannel",void 0),(0,r.A)(this,"controlPort",void 0),(0,r.A)(this,"statsMap",void 0),this.statsMap=new(a())}async run(){this.thread=await(0,l.pt)(c.A,{name:"AudioPipeline",dispatchToWorker:!0},27089).run(),this.controlMessageChannel=new MessageChannel,this.controlPort=new h.Ay(this.controlMessageChannel.port1),this.controlPort.on(h.Wo,(t=>{if("stats"===t.method){const e=t.params.data,i=[];for(let t=0;t{r[e]=t})),i.push({taskId:e[t].taskId,stats:{audioPacketQueueLength:r.audioPacketQueueLength,audioEncodeFramerate:r.audioEncodeFramerate,videoPacketQueueLength:r.videoPacketQueueLength},jitterBuffer:{min:r.jitterBuffer.min,max:r.jitterBuffer.max}}))}this.controlPort.notify("stats",{data:{stats:i}})}})),await this.thread.init.transfer(this.controlMessageChannel.port2).invoke(this.controlMessageChannel.port2)}async destroy(){await(0,l.nx)(this.thread),this.thread=null}setLogLevel(t){this.thread.setLogLevel(t)}transformResult(t,e,i){if("unregisterTask"===t)this.statsMap.delete(e[0]);else if("clear"===t)this.statsMap.clear();else if("registerTask"===t)this.statsMap.set(e[0].taskId,(0,o.A)(e[0].stats,n.A));else if("syncSeekTime"===t){const t=this.statsMap.get(e[0]);if(t)return void(t.audioCurrentTime=i)}return i}get AudioDecodePipeline(){const t=this;return new Proxy({},{get(e,i,r){if(e[i])return e[i];const s=async function(...e){return t.thread.invoke("decoder",i,e).then((r=>t.transformResult(i,e,r)))};return s.transfer=function(...e){return{invoke:async function(...r){return t.thread.invoke.transfer(...e).invoke("decoder",i,r).then((e=>t.transformResult(i,r,e)))}}},e[i]=s,e[i]}})}get AudioRenderPipeline(){const t=this;return new Proxy({},{get(e,i,r){if(e[i])return e[i];const s=async function(...e){return t.thread.invoke("render",i,e).then((r=>t.transformResult(i,e,r)))};return s.transfer=function(...e){return{invoke:async function(...r){return t.thread.invoke.transfer(...e).invoke("render",i,r).then((e=>t.transformResult(i,r,e)))}}},e[i]=s,e[i]}})}}},59016:(t,e,i)=>{"use strict";i.d(e,{A:()=>x});var r=i(134),s=i(80662),a=i.n(s),n=i(61499),o=i(52277),l=i(74503),c=i(94300),h=i(87243),u=i(72480),d=i(67672),f=i(4624),p=i(71762),m=i(56024),g=i(71517),v=i(73783),y=i(84149),A=i(54058);const b="src/avplayer/worker/IODemuxPipeline.ts";class x{constructor(){(0,r.A)(this,"ioThread",void 0),(0,r.A)(this,"demuxPipeline",void 0),(0,r.A)(this,"globalDataMap",void 0),(0,r.A)(this,"controlPort",void 0),(0,r.A)(this,"timer",void 0),this.ioThread=new h.A,this.demuxPipeline=new u.A,this.globalDataMap=new(a())}createGlobalData(t){const e=(0,l.A)(o.M);return v.Ts(e[n.o9]+24),v.Ts(e[n.o9]+28),this.globalDataMap.set(t,e),e}releaseGlobalData(t){t.avframeList.clear((t=>{(0,m.to)(t)}),20),t.avpacketList.clear((t=>{(0,g.Up)(t)}),20),v.zr(t[n.o9]+24),v.zr(t[n.o9]+28),(0,c.A)(t)}async init(t){this.controlPort=new y.Ay(t),this.timer=new A.A((()=>{const t=[];this.globalDataMap.forEach(((e,i)=>{const r=e.stats;t.push({taskId:i,stats:{bufferReceiveBytes:r.bufferReceiveBytes,audioPacketQueueLength:r.audioPacketQueueLength,videoPacketQueueLength:r.videoPacketQueueLength,audioPacketCount:r.audioPacketCount,audioPacketBytes:r.audioPacketBytes,audioEncodeFramerate:r.audioEncodeFramerate,videoPacketCount:r.videoPacketCount,videoPacketBytes:r.videoPacketBytes,keyFrameCount:r.keyFrameCount,gop:r.gop,keyFrameInterval:r.keyFrameInterval,videoEncodeFramerate:r.videoEncodeFramerate}})})),this.controlPort.notify("stats",{data:t})}),0,500),this.timer.start()}async invoke(t,e,i){const r=this;function s(t,e,i){if("unregisterTask"===t){const t=r.globalDataMap.get(e[0]);t&&(r.releaseGlobalData(t),r.globalDataMap.delete(e[0]))}else"clear"===t?(r.globalDataMap.forEach((t=>{r.releaseGlobalData(t)})),r.globalDataMap.clear()):"analyzeStreams"!==t||d.ai(i)||i.streams.forEach((t=>{t.codecpar=(0,p.Wu)(t.codecpar)}))}if("io"===t){if("registerTask"===e){const t=this.globalDataMap.get(i[0].taskId)||this.createGlobalData(i[0].taskId);i[0].stats=t[n.o9]+32}if(d.Pc(this.ioThread[e]))return this.ioThread[e](...i).then((t=>(s(e,i,t),t)));f.h2(`method ${e} not found`,b,150)}else{if("registerTask"===e){const t=this.globalDataMap.get(i[0].taskId)||this.createGlobalData(i[0].taskId);i[0].stats=t[n.o9]+32,i[0].avpacketList=t[n.o9],i[0].avpacketListMutex=t[n.o9]+24}if(d.Pc(this.demuxPipeline[e]))return this.demuxPipeline[e](...i).then((t=>(s(e,i,t),t)));f.h2(`method ${e} not found`,b,168)}}async setLogLevel(t){f.V$(t)}}},29998:(t,e,i)=>{"use strict";i.d(e,{A:()=>g});var r=i(134),s=i(80662),a=i.n(s),n=i(30128),o=i(29170),l=i(88506),c=i(59016),h=i(71762),u=i(67672),d=i(72703),f=i(71766),p=i(84149),m=i(95335);class g{constructor(){(0,r.A)(this,"thread",void 0),(0,r.A)(this,"codecparMap",void 0),(0,r.A)(this,"controlMessageChannel",void 0),(0,r.A)(this,"controlPort",void 0),(0,r.A)(this,"statsMap",void 0),this.codecparMap=new(a()),this.statsMap=new(a())}async run(){this.thread=await(0,l.pt)(c.A,{name:"IODemuxPipeline",dispatchToWorker:!0},59016).run(),this.controlMessageChannel=new MessageChannel,this.controlPort=new p.Ay(this.controlMessageChannel.port1),this.controlPort.on(p.Wo,(t=>{if("stats"===t.method){const e=t.params.data;for(let t=0;t{i[e]=t}))}}})),await this.thread.init.transfer(this.controlMessageChannel.port2).invoke(this.controlMessageChannel.port2)}setLogLevel(t){this.thread.setLogLevel(t)}async destroy(){await(0,l.nx)(this.thread),this.thread=null}get IOPipeline(){const t=this;return new Proxy({},{get(e,i,r){if(e[i])return e[i];const s=async function(...e){return t.thread.invoke("io",i,e)};return s.transfer=function(...e){return{invoke:async function(...r){return t.thread.invoke.transfer(...e).invoke("io",i,r)}}},e[i]=s,e[i]}})}get DemuxPipeline(){const t=this;function e(e,i,r){if("analyzeStreams"!==e||u.ai(r))if("unregisterTask"===e){const e=t.codecparMap.get(i[0]);e&&(e.forEach((t=>{(0,f.dn)(t)})),t.codecparMap.delete(i[0])),t.statsMap.delete(i[0])}else"clear"===e?(t.codecparMap.forEach((t=>{t.forEach((t=>{(0,f.dn)(t)}))})),t.codecparMap.clear(),t.statsMap.clear()):"registerTask"===e&&t.statsMap.set(i[0].taskId,(0,o.A)(i[0].stats,n.A));else{const e=[];r.streams.forEach((r=>{(0,d.A)(r.codecpar)||(r.codecpar=(0,h.T8)(r.codecpar),e.push(r.codecpar)),t.codecparMap.set(i[0],e)}))}}return new Proxy({},{get(i,r,s){if(i[r])return i[r];const a=async function(...i){return t.thread.invoke("demux",r,i).then((t=>(e(r,i,t),t)))};return a.transfer=function(...i){return{invoke:async function(...s){return t.thread.invoke.transfer(...i).invoke("demux",r,s).then((t=>(e(r,s,t),t)))}}},i[r]=a,i[r]}})}}},75392:(t,e,i)=>{"use strict";i.d(e,{A:()=>A});var r=i(134),s=i(80662),a=i.n(s),n=i(61499),o=i(52277),l=i(74503),c=i(94300),h=i(67672),u=i(4624),d=i(56024),f=i(71517),p=i(73783),m=i(84149),g=i(54058),v=i(95335),y=i(25115);class A{constructor(){(0,r.A)(this,"mse",void 0),(0,r.A)(this,"globalDataMap",void 0),(0,r.A)(this,"controlPort",void 0),(0,r.A)(this,"timer",void 0),this.mse=new y.A,this.globalDataMap=new(a())}createGlobalData(t){const e=(0,l.A)(o.M);return p.Ts(e[n.o9]+24),p.Ts(e[n.o9]+28),this.globalDataMap.set(t,e),e}releaseGlobalData(t){t.avframeList.clear((t=>{(0,d.to)(t)}),20),t.avpacketList.clear((t=>{(0,f.Up)(t)}),20),p.zr(t[n.o9]+24),p.zr(t[n.o9]+28),(0,c.A)(t)}async init(t){this.controlPort=new m.Ay(t),this.timer=new g.A((()=>{const t=[];this.globalDataMap.forEach(((e,i)=>{const r=e.stats;t.push({taskId:i,stats:{audioFrameDecodeCount:r.audioFrameDecodeCount,audioFrameRenderCount:r.audioFrameRenderCount,sampleRate:r.sampleRate,channels:r.channels,videoFrameDecodeCount:r.videoFrameDecodeCount,videoFrameRenderCount:r.videoFrameRenderCount,width:r.width,height:r.height}})})),this.controlPort.notify("stats",{data:t})}),0,500),this.controlPort.on(m.Wo,(t=>{if("stats"===t.method){const e=t.params.data;for(let t=0;t{i[e]=t})),i.jitterBuffer.min=e[t].jitterBuffer.min,i.jitterBuffer.max=e[t].jitterBuffer.max)}}})),this.timer.start()}async invoke(t,e){const i=this;if("registerTask"===t){const t=this.globalDataMap.get(e[0].taskId)||this.createGlobalData(e[0].taskId);e[0].stats=t[n.o9]+32,e[0].avpacketList=t[n.o9],e[0].avpacketListMutex=t[n.o9]+24}if(h.Pc(this.mse[t]))return this.mse[t].transfer||(this.mse[t].transfer=[]),this.mse[t](...e).then((r=>(this.mse[t].transfer.length&&(this.invoke.transfer=this.mse[t].transfer),r=function(t,e,r){if("unregisterTask"===t){const t=i.globalDataMap.get(e[0]);t&&(i.releaseGlobalData(t),i.globalDataMap.delete(e[0]))}else"clear"===t&&(i.globalDataMap.forEach((t=>{i.releaseGlobalData(t)})),i.globalDataMap.clear());return r}(t,e,r),r)));u.h2(`method ${t} not found`,"src/avplayer/worker/MSEPipeline.ts",162)}async setLogLevel(t){u.V$(t)}}},21862:(t,e,i)=>{"use strict";i.d(e,{A:()=>d});var r=i(134),s=i(80662),a=i.n(s),n=i(30128),o=i(29170),l=i(88506),c=i(84149),h=i(95335),u=i(75392);class d{constructor(){(0,r.A)(this,"thread",void 0),(0,r.A)(this,"controlMessageChannel",void 0),(0,r.A)(this,"controlPort",void 0),(0,r.A)(this,"statsMap",void 0),this.statsMap=new(a())}async run(){this.thread=await(0,l.pt)(u.A,{name:"MSEPipeline",dispatchToWorker:!0},75392).run(),this.controlMessageChannel=new MessageChannel,this.controlPort=new c.Ay(this.controlMessageChannel.port1),this.controlPort.on(c.Wo,(t=>{if("stats"===t.method){const e=t.params.data,i=[];for(let t=0;t{r[e]=t})),i.push({taskId:e[t].taskId,stats:{videoEncodeFramerate:r.videoEncodeFramerate,videoPacketQueueLength:r.videoPacketQueueLength,audioPacketQueueLength:r.audioPacketQueueLength,audioEncodeFramerate:r.audioEncodeFramerate},jitterBuffer:{min:r.jitterBuffer.min,max:r.jitterBuffer.max}}))}this.controlPort.notify("stats",{data:{stats:i}})}})),await this.thread.init.transfer(this.controlMessageChannel.port2).invoke(this.controlMessageChannel.port2)}setLogLevel(t){this.thread.setLogLevel(t)}async destroy(){await(0,l.nx)(this.thread),this.thread=null}transformResult(t,e,i){return"unregisterTask"===t?this.statsMap.delete(e[0]):"clear"===t?this.statsMap.clear():"registerTask"===t&&this.statsMap.set(e[0].taskId,(0,o.A)(e[0].stats,n.A)),i}get MSEPipeline(){const t=this;return new Proxy({},{get(e,i,r){if(e[i])return e[i];const s=async function(...e){return t.thread.invoke(i,e).then((r=>t.transformResult(i,e,r)))};return s.transfer=function(...e){return{invoke:async function(...r){return t.thread.invoke.transfer(...e).invoke(i,r).then((e=>t.transformResult(i,r,e)))}}},e[i]=s,e[i]}})}}},71272:(t,e,i)=>{"use strict";i.d(e,{A:()=>x});var r=i(134),s=i(80662),a=i.n(s),n=i(61499),o=i(52277),l=i(74503),c=i(94300),h=i(67672),u=i(4624),d=i(31138),f=i(33968),p=i(56024),m=i(71517),g=i(73783),v=i(84149),y=i(54058),A=i(95335);const b="src/avplayer/worker/VideoPipeline.ts";class x{constructor(){(0,r.A)(this,"decoder",void 0),(0,r.A)(this,"render",void 0),(0,r.A)(this,"globalDataMap",void 0),(0,r.A)(this,"controlPort",void 0),(0,r.A)(this,"timer",void 0),this.decoder=new d.A,this.render=new f.A,this.globalDataMap=new(a())}createGlobalData(t){const e=(0,l.A)(o.M);return g.Ts(e[n.o9]+24),g.Ts(e[n.o9]+28),this.globalDataMap.set(t,e),e}releaseGlobalData(t){t.avframeList.clear((t=>{(0,p.to)(t)}),20),t.avpacketList.clear((t=>{(0,m.Up)(t)}),20),g.zr(t[n.o9]+24),g.zr(t[n.o9]+28),(0,c.A)(t)}async init(t){this.controlPort=new v.Ay(t);let e=0;this.timer=new y.A((()=>{e++;const t=[];this.globalDataMap.forEach(((i,r)=>{const s=i.stats;t.push({taskId:r,stats:{videoFrameDecodeCount:s.videoFrameDecodeCount,videoFrameDecodeIntervalMax:s.videoFrameDecodeIntervalMax,videoDecodeErrorPacketCount:s.videoDecodeErrorPacketCount,videoCurrentTime:s.videoCurrentTime,videoFrameRenderCount:s.videoFrameRenderCount,videoFrameRenderIntervalMax:s.videoFrameRenderIntervalMax,videoFrameDropCount:s.videoFrameDropCount,width:s.width,height:s.height}}),2===e&&(s.videoFrameDecodeIntervalMax=0,s.videoFrameRenderIntervalMax=0)})),this.controlPort.notify("stats",{data:t}),2===e&&(e=0)}),0,500),this.controlPort.on(v.Wo,(t=>{if("stats"===t.method){const e=t.params.data;for(let t=0;t{i[e]=t})),i.jitterBuffer.min=e[t].jitterBuffer.min,i.jitterBuffer.max=e[t].jitterBuffer.max)}}})),this.timer.start()}async invoke(t,e,i){const r=this;function s(t,e,i){if("unregisterTask"===t){const t=r.globalDataMap.get(e[0]);t&&(r.releaseGlobalData(t),r.globalDataMap.delete(e[0]))}else if("clear"===t)r.globalDataMap.forEach((t=>{r.releaseGlobalData(t)})),r.globalDataMap.clear();else if("syncSeekTime"===t){const t=r.globalDataMap.get(e[0]);if(t)return t.stats.videoCurrentTime}return i}if("decoder"===t){if("registerTask"===e){const t=this.globalDataMap.get(i[0].taskId)||this.createGlobalData(i[0].taskId);i[0].stats=t[n.o9]+32,i[0].avpacketList=t[n.o9],i[0].avpacketListMutex=t[n.o9]+24,i[0].avframeList=t[n.o9]+12,i[0].avframeListMutex=t[n.o9]+28}if(h.Pc(this.decoder[e]))return this.decoder[e](...i).then((t=>s(e,i,t)));u.h2(`method ${e} not found`,b,179)}else{if("registerTask"===e){const t=this.globalDataMap.get(i[0].taskId)||this.createGlobalData(i[0].taskId);i[0].stats=t[n.o9]+32,i[0].avframeList=t[n.o9]+12,i[0].avframeListMutex=t[n.o9]+28}if(h.Pc(this.render[e]))return this.render[e](...i).then((t=>s(e,i,t)));u.h2(`method ${e} not found`,b,197)}}async setLogLevel(t){u.V$(t)}}},21678:(t,e,i)=>{"use strict";i.d(e,{A:()=>d});var r=i(134),s=i(80662),a=i.n(s),n=i(30128),o=i(29170),l=i(88506),c=i(71272),h=i(84149),u=i(95335);class d{constructor(){(0,r.A)(this,"thread",void 0),(0,r.A)(this,"controlMessageChannel",void 0),(0,r.A)(this,"controlPort",void 0),(0,r.A)(this,"statsMap",void 0),this.statsMap=new(a())}async run(){this.thread=await(0,l.pt)(c.A,{name:"VideoPipeline",dispatchToWorker:!0},71272).run(),this.controlMessageChannel=new MessageChannel,this.controlPort=new h.Ay(this.controlMessageChannel.port1),this.controlPort.on(h.Wo,(t=>{if("stats"===t.method){const e=t.params.data,i=[];for(let t=0;t{r[e]=t})),i.push({taskId:e[t].taskId,stats:{videoEncodeFramerate:r.videoEncodeFramerate,videoPacketQueueLength:r.videoPacketQueueLength},jitterBuffer:{min:r.jitterBuffer.min,max:r.jitterBuffer.max}}))}this.controlPort.notify("stats",{data:{stats:i}})}})),await this.thread.init.transfer(this.controlMessageChannel.port2).invoke(this.controlMessageChannel.port2)}setLogLevel(t){this.thread.setLogLevel(t)}async destroy(){await(0,l.nx)(this.thread),this.thread=null}transformResult(t,e,i){if("unregisterTask"===t)this.statsMap.delete(e[0]);else if("clear"===t)this.statsMap.clear();else if("registerTask"===t)this.statsMap.set(e[0].taskId,(0,o.A)(e[0].stats,n.A));else if("syncSeekTime"===t){const t=this.statsMap.get(e[0]);if(t)return void(t.videoCurrentTime=i)}return i}get VideoDecodePipeline(){const t=this;return new Proxy({},{get(e,i,r){if(e[i])return e[i];const s=async function(...e){return t.thread.invoke("decoder",i,e).then((r=>t.transformResult(i,e,r)))};return s.transfer=function(...e){return{invoke:async function(...r){return t.thread.invoke.transfer(...e).invoke("decoder",i,r).then((e=>t.transformResult(i,r,e)))}}},e[i]=s,e[i]}})}get VideoRenderPipeline(){const t=this;return new Proxy({},{get(e,i,r){if(e[i])return e[i];const s=async function(...e){return t.thread.invoke("render",i,e).then((r=>t.transformResult(i,e,r)))};return s.transfer=function(...e){return{invoke:async function(...r){return t.thread.invoke.transfer(...e).invoke("render",i,r).then((e=>t.transformResult(i,r,e)))}}},e[i]=s,e[i]}})}}},88103:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(134),s=i(43356);class a extends s.A{constructor(t,e){super(t,e),(0,r.A)(this,"context",void 0),(0,r.A)(this,"paddingLeft",void 0),(0,r.A)(this,"paddingTop",void 0),(0,r.A)(this,"flipX",void 0),(0,r.A)(this,"flipY",void 0),this.paddingLeft=0,this.paddingTop=0,this.flipX=1,this.flipY=1}async init(){this.context=this.canvas.getContext("2d")}clear(){const t=this.canvas.width>>1,e=this.canvas.height>>1;this.rotate&&(this.context.translate(t,e),this.context.rotate(-this.rotate*Math.PI/180),this.context.translate(-t,-e)),this.context.clearRect(0,0,this.canvasWidth*this.options.devicePixelRatio,this.canvasHeight*this.options.devicePixelRatio),this.rotate&&(this.context.translate(t,e),this.context.rotate(this.rotate*Math.PI/180),this.context.translate(-t,-e))}checkFrame(t){t.codedWidth===this.textureWidth&&t.codedHeight===this.videoHeight&&t.codedWidth===this.videoWidth||(this.videoWidth=t.codedWidth,this.videoHeight=t.codedHeight,this.textureWidth=t.codedWidth,this.layout())}render(t){this.lost||(this.checkFrame(t),this.context.drawImage(t,this.paddingLeft,this.paddingTop,this.canvasWidth*this.options.devicePixelRatio-2*this.paddingLeft,this.canvasHeight*this.options.devicePixelRatio-2*this.paddingTop))}layout(){let t=this.videoWidth,e=this.videoHeight,i=this.canvasWidth,r=this.canvasHeight,s=0,a=0;90!==this.rotate&&270!==this.rotate||(a=Math.floor((r-i)/2),s=Math.floor((i-r)/2),i=this.canvasHeight,r=this.canvasWidth);const n=t/i,o=e/r;let l;if(l=n>1?!(no,1===this.renderMode&&(l=!l),l){const n=(r-e*i/t)/r;this.paddingTop=(Math.floor(n/2*r)+a)*this.options.devicePixelRatio,this.paddingLeft=s*this.options.devicePixelRatio}else{const n=(i-t*r/e)/i;this.paddingLeft=(Math.floor(n/2*i)+s)*this.options.devicePixelRatio,this.paddingTop=a*this.options.devicePixelRatio}if(this.context){let t=1,e=1;this.flipHorizontal&&(t=-1),this.flipVertical&&(e=-1);const i=this.canvas.width>>1,r=this.canvas.height>>1;this.context.translate(i,r),t!==this.flipX&&this.context.scale(-1,1),e!==this.flipY&&this.context.scale(1,-1),this.context.translate(-i,-r),this.flipX=t,this.flipY=e}}setRotate(t,e=!0){if((t%=360)===this.rotate)return;const i=this.canvas.width>>1,r=this.canvas.height>>1;this.rotate&&(this.context.translate(i,r),this.context.rotate(-this.rotate*Math.PI/180),this.context.translate(-i,-r)),e&&this.clear(),this.rotate=t,this.context&&(this.context.translate(i,r),this.context.rotate(this.rotate*Math.PI/180),this.context.translate(-i,-r)),this.layout()}destroy(){this.context=null,super.destroy()}static isSupport(t){return t instanceof VideoFrame||t instanceof ImageBitmap}}},43356:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(134),s=i(6110);class a{constructor(t,e){(0,r.A)(this,"canvas",void 0),(0,r.A)(this,"options",void 0),(0,r.A)(this,"textureWidth",void 0),(0,r.A)(this,"videoWidth",void 0),(0,r.A)(this,"videoHeight",void 0),(0,r.A)(this,"canvasWidth",void 0),(0,r.A)(this,"canvasHeight",void 0),(0,r.A)(this,"rotate",void 0),(0,r.A)(this,"renderMode",void 0),(0,r.A)(this,"format",void 0),(0,r.A)(this,"lost",void 0),(0,r.A)(this,"destroyed",void 0),(0,r.A)(this,"srcColorSpace",void 0),(0,r.A)(this,"dstColorSpace",void 0),(0,r.A)(this,"flipHorizontal",void 0),(0,r.A)(this,"flipVertical",void 0),this.canvas=t,this.options=e,this.canvasWidth=t.width,this.canvasHeight=t.height,this.videoWidth=0,this.videoHeight=0,this.textureWidth=0,this.rotate=0,this.renderMode=e.renderMode,this.flipHorizontal=!1,this.flipVertical=!1,this.lost=!1,this.destroyed=!1,e.dstColorSpace?this.dstColorSpace=e.dstColorSpace:this.dstColorSpace=new s.A(1,1,1,1)}getRotateMatrix(t){t=Math.PI*t/180;const e=Math.sin(t),i=Math.cos(t);return[i,-e,0,0,e,i,0,0,0,0,1,0,0,0,0,1]}setRenderMode(t){this.renderMode!==t&&(this.renderMode=t,this.layout(),this.clear())}enableHorizontalFlip(t){this.flipHorizontal!==t&&(this.flipHorizontal=t,this.layout(),this.clear())}enableVerticalFlip(t){this.flipVertical!==t&&(this.flipVertical=t,this.layout(),this.clear())}viewport(t,e){if(this.canvasWidth!==t||this.canvasHeight!==e){const i=this.options.devicePixelRatio;this.canvasWidth=t,this.canvasHeight=e,this.canvas.width=t*i,this.canvas.height=e*i,this.videoWidth&&this.videoHeight&&this.layout()}}getVideoWidth(){return this.videoWidth}getVideoHeight(){return this.videoHeight}destroy(){this.canvas=null,this.destroyed=!0}setDstColorSpace(t){this.dstColorSpace=t}static isSupport(t){return!1}}},43813:(t,e,i)=>{"use strict";i.d(e,{A:()=>u});var r=i(63939),s=i(14686),a=i(97317),n=i(25669),o=i(6110),l=i(37653),c=i(32903),h=i(72703);class u extends l.A{constructor(t,e){super(t,e)}generateFragmentSource(t,e){const i=(0,n.A)(this.srcColorSpace,this.dstColorSpace,{bitDepth:8,type:0,outputRGB:!0}),r=["r","g","b","a"];let s=`texture2D(rgb_Sampler, v_color.xy).${r[e.comp[0].offset]}`,a=`texture2D(rgb_Sampler, v_color.xy).${r[e.comp[1].offset]}`,o=`texture2D(rgb_Sampler, v_color.xy).${r[e.comp[2].offset]}`,l="1.0";128&e.flags&&4===e.nbComponents&&(l=`texture2D(rgb_Sampler, v_color.xy).${r[e.comp[3].offset]}`),this.fragmentSource=`\n precision highp float;\n varying vec4 v_color;\n uniform sampler2D rgb_Sampler;\n void main () {\n float r = ${s};\n float g = ${a};\n float b = ${o};\n float alpha = ${l};\n vec4 color = vec4(r, g, b, alpha);\n ${i.reduce(((t,e)=>t+e),"")}\n gl_FragColor = color;\n }\n `}checkFrame(t){const e=a.g[r.f[15](t+80)];e&&(r.f[15](t+32)===this.textureWidth&&r.f[15](t+72)===this.videoHeight&&r.f[15](t+68)===this.videoWidth||(this.srcColorSpace=new o.A(r.f[15](t+220),r.f[15](t+212),r.f[15](t+216),r.f[15](t+208)),this.generateFragmentSource(r.f[15](t+80),e),this.program=new c.A(this.fragmentSource),this.useProgram(),4===e.nbComponents&&(this.rgbTexture.setFormat(this.gl.RGBA),this.rgbTexture.setInternalformat(this.gl.RGBA)),this.rgbTexture.setSize(r.f[15](t+32),r.f[15](t+72)),this.videoWidth=r.f[15](t+68),this.videoHeight=r.f[15](t+72),this.textureWidth=r.f[15](t+32),this.format=r.f[15](t+80),this.layout()))}render(t){this.lost||(this.checkFrame(t),this.rgbTexture.fill((0,s.s3)(r.f[20](t),this.rgbTexture.width*this.rgbTexture.height)),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4))}static isSupport(t){if((0,h.A)(t)){const e=a.g[r.f[15](t+80)];if(e)return 32&e.flags&&e.comp[0].depth+7>>>3==1}return!1}}},37653:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var r=i(134),s=i(94012),a=i(17397);class n extends s.A{constructor(t,e){super(t,e),(0,r.A)(this,"rgbTexture",void 0)}useProgram(){super.useProgram(),this.rgbTexture=new a.A(this.gl),this.rgbTexture.bind(0),this.rgbTexture.init(),this.program.bindRGBTexture(0)}destroy(){this.rgbTexture&&(this.rgbTexture.destroy(),this.rgbTexture=null),super.destroy()}}},94012:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var r=i(134),s=i(4624),a=i(43356),n=i(38469);const o="src/avrender/image/WebGLRender.ts";class l extends a.A{constructor(t,e){super(t,e),(0,r.A)(this,"gl",void 0),(0,r.A)(this,"VAO",void 0),(0,r.A)(this,"program",void 0),(0,r.A)(this,"vertex",void 0),(0,r.A)(this,"webglContextLostTimer",void 0),(0,r.A)(this,"onWebglContextLost",void 0),(0,r.A)(this,"onWebglContextRestored",void 0),(0,r.A)(this,"fragmentSource",void 0),(0,r.A)(this,"vertexSource",void 0)}async init(){this.gl=this.canvas.getContext("webgl2",{alpha:!1,antialias:!1,preserveDrawingBuffer:this.options.preserveDrawingBuffer}),this.gl||(this.gl=this.canvas.getContext("webgl",{alpha:!1,antialias:!1,preserveDrawingBuffer:this.options.preserveDrawingBuffer})),this.gl||(this.gl=this.canvas.getContext("experimental-webgl",{alpha:!1,antialias:!1,preserveDrawingBuffer:this.options.preserveDrawingBuffer})),this.gl||s.h2("can not support webgl, got WebGLRenderingContext failed",o,96),this.VAO=this.gl.createBuffer(),this.VAO||s.h2("create vao buffer failed",o,101),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.VAO),this.gl.enable(this.gl.BLEND),this.gl.clearColor(0,0,0,0),this.gl.clearDepth(1),this.viewport(this.canvasWidth||this.canvas.width,this.canvasHeight||this.canvas.height),this.onWebglContextLost=t=>{this.destroyed||(this.webglContextLostTimer=setTimeout((()=>{this.lost=!0,this.webglContextLostTimer=null,s.z3("webgl context lost",o,118),this.options.onRenderContextLost&&this.options.onRenderContextLost()}),3e3))},this.onWebglContextRestored=t=>{this.webglContextLostTimer&&(clearTimeout(this.webglContextLostTimer),this.webglContextLostTimer=null)},this.canvas.addEventListener("webglcontextlost",this.onWebglContextLost),this.canvas.addEventListener("webglcontextrestored",this.onWebglContextRestored)}viewport(t,e){this.gl.viewport(0,0,t*this.options.devicePixelRatio,e*this.options.devicePixelRatio),super.viewport(t,e)}useProgram(){this.program.link(this.gl),this.program.bind(),this.program.setRotateMatrix(this.getRotateMatrix(this.rotate))}clear(){this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT)}layout(){let t=this.videoWidth,e=this.videoHeight,i=this.canvasWidth,r=this.canvasHeight;90!==this.rotate&&270!==this.rotate||(i=this.canvasHeight,r=this.canvasWidth);const s=t/i,a=e/r;let o;o=s>1?!(sa,1===this.renderMode&&(o=!o);let l=0;if(this.textureWidth!==this.videoWidth&&(l=(this.textureWidth-this.videoWidth)/this.textureWidth),o){const s=(r-e*i/t)/r;this.vertex=[-1,1-s,0,0,0,0,0,-1,-1+s,0,0,1,0,0,1,1-s,0,1-l,0,0,0,1,-1+s,0,1-l,1,0,0]}else{const s=(i-t*r/e)/i;this.vertex=[-1+s,1,0,0,0,0,0,-1+s,-1,0,0,1,0,0,1-s,1,0,1-l,0,0,0,1-s,-1,0,1-l,1,0,0]}(0,n.A)(this.vertex,this.flipHorizontal,this.flipVertical),this.gl&&this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array(this.vertex),this.gl.STATIC_DRAW)}setRotate(t,e=!0){(t%=360)!==this.rotate&&(this.rotate=t,this.gl&&this.program.setRotateMatrix(this.getRotateMatrix(this.rotate)),this.layout(),e&&this.clear())}destroy(){this.program&&this.program.stop(),this.gl=null,this.VAO=null,this.vertex=null,this.onWebglContextLost&&(this.canvas.removeEventListener("webglcontextlost",this.onWebglContextLost),this.onWebglContextLost=null),this.onWebglContextRestored&&(this.canvas.removeEventListener("webglcontextrestored",this.onWebglContextRestored),this.onWebglContextRestored=null),super.destroy()}}},99293:(t,e,i)=>{"use strict";i.d(e,{A:()=>v});var r=i(134),s=i(20088),a=i(74503),n=i(63939),o=i(94300),l=i(14686),c=i(97317),h=i(22594),u=i(25669),d=i(57517),f=i(6110),p=i(56024),m=i(73039),g=i(72703);class v extends h.A{constructor(t,e){super(t,e),(0,r.A)(this,"hdrMetadata",void 0),(0,r.A)(this,"ext",void 0),this.hdrMetadata=(0,a.A)(s.A),this.hdrMetadata.multiplier=1}async init(){if(await super.init(),this.ext=this.gl.getExtension("EXT_texture_norm16"),!this.ext)throw Error("not support")}generateFragmentSource(t,e,i){i.outputRGB=!0;const r=(0,u.A)(this.srcColorSpace,this.dstColorSpace,i);let s="texture2D(u_Sampler, v_color.xy).x",a="texture2D(v_Sampler, v_color.xy).x",n="1.0";23===t||189===t?(s="texture2D(u_Sampler, v_color.xy).x",a="texture2D(u_Sampler, v_color.xy).y"):24!==t&&190!==t||(s="texture2D(u_Sampler, v_color.xy).y",a="texture2D(u_Sampler, v_color.xy).x"),128&e.flags&&4===e.nbComponents&&(n="texture2D(a_Sampler, v_color.xy).x"),this.fragmentSource=`\n precision highp float;\n\n varying vec4 v_color;\n uniform sampler2D y_Sampler;\n uniform sampler2D u_Sampler;\n uniform sampler2D v_Sampler;\n \n uniform float v_max;\n\n uniform float offset;\n uniform float multiplier;\n uniform float pq_tonemap_a;\n uniform float pq_tonemap_b;\n uniform float hlg_ootf_gamma_minus_one;\n uniform float hlg_dst_max_luminance_relative;\n uniform float nits_to_sdr_relative_factor;\n uniform float sdr_relative_to_nits_factor;\n\n ${1&e.flags?"\n float swap(float x) {\n int value = int(x * 65535.0);\n int low = value & 0xff;\n int high = (value >> 8) & 0xff;\n value = (low << 8) | high;\n return float(value) / v_max;\n }\n ":""}\n \n void main () {\n \n float y = texture2D(y_Sampler, v_color.xy).x;\n float u = ${s};\n float v = ${a};\n float alpha = ${n};\n \n ${1&e.flags?"\n y = swap(y);\n u = swap(u);\n v = swap(v);\n ":"\n y = y * 65535.0 / v_max;\n u = u * 65535.0 / v_max;\n v = v * 65535.0 / v_max;\n "}\n \n vec4 color = vec4(y, u, v, alpha);\n\n if (color.a > 0.0) {\n color.r /= color.a;\n color.g /= color.a;\n color.b /= color.a;\n }\n color.r -= offset;\n color.g -= offset;\n color.b -= offset;\n\n color.r *= multiplier;\n color.g *= multiplier;\n color.b *= multiplier;\n \n ${r.reduce(((t,e)=>t+e),"")}\n\n color.r *= color.a;\n color.g *= color.a;\n color.b *= color.a;\n\n gl_FragColor = color;\n }\n `}checkFrame(t){const e=c.g[n.f[15](t+80)];if(!e)return;const i=e.comp[0].depth+7>>>3;if(n.f[15](t+32)/i!==this.textureWidth||n.f[15](t+72)!==this.videoHeight||n.f[15](t+68)!==this.videoWidth||n.f[15](t+80)!==this.format){this.srcColorSpace=new f.A(n.f[15](t+220),n.f[15](t+212),n.f[15](t+216),n.f[15](t+208));const i={type:0,bitDepth:e.comp[0].depth,toneMapPQAndHlgToDst:!0,metadata:this.hdrMetadata,dstSdrMaxLuminanceNits:d.kH,dstMaxLuminanceRelative:1},r=(0,p.aH)(t,14);if(r){const t=n.f[20](r+4);n.f[8](t)>0&&(i.maxContentLightLevel=n.f[8](t))}this.generateFragmentSource(n.f[15](t+80),e,i),this.program=new m.A(this.fragmentSource),this.useProgram(),this.program.setMetaData(this.hdrMetadata),this.yTexture.setFormat(this.gl.RED),this.yTexture.setInternalformat(this.ext.R16_EXT),this.yTexture.setDataType(this.gl.UNSIGNED_SHORT),this.uTexture.setFormat(this.gl.RED),this.uTexture.setInternalformat(this.ext.R16_EXT),this.uTexture.setDataType(this.gl.UNSIGNED_SHORT),this.vTexture.setFormat(this.gl.RED),this.vTexture.setInternalformat(this.ext.R16_EXT),this.vTexture.setDataType(this.gl.UNSIGNED_SHORT),this.aTexture.setFormat(this.gl.RED),this.aTexture.setInternalformat(this.ext.R16_EXT),this.aTexture.setDataType(this.gl.UNSIGNED_SHORT),this.yTexture.setSize(n.f[15](t+32)>>>1,n.f[15](t+72)),this.uTexture.setSize(n.f[15](t+32+4)>>>1,n.f[15](t+72)>>>c.g[n.f[15](t+80)].log2ChromaH),e.comp[1].plane!==e.comp[2].plane&&this.vTexture.setSize(n.f[15](t+32+8)>>>1,n.f[15](t+72)>>>c.g[n.f[15](t+80)].log2ChromaH),4===e.nbComponents&&this.aTexture.setSize(n.f[15](t+32+12)>>>1,n.f[15](t+72)),this.program.setMax((1<>>1,this.format=n.f[15](t+80),this.layout()}}render(t){if(this.lost)return;this.checkFrame(t);const e=c.g[n.f[15](t+80)];e&&(this.yTexture.fill((0,l.bg)(n.f[20](t),this.yTexture.width*this.yTexture.height)),this.uTexture.fill((0,l.bg)(n.f[20](t+4),this.uTexture.width*this.uTexture.height)),e.comp[1].plane!==e.comp[2].plane&&this.vTexture.fill((0,l.bg)(n.f[20](t+8),this.vTexture.width*this.vTexture.height)),4===e.nbComponents&&this.aTexture.fill((0,l.bg)(n.f[20](t+12),this.aTexture.width*this.aTexture.height)),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4))}destroy(){this.hdrMetadata&&((0,o.A)(this.hdrMetadata),this.hdrMetadata=null),super.destroy()}static isSupport(t){if((0,g.A)(t)){const e=c.g[n.f[15](t+80)];if(e)return!(32&e.flags)&&16&e.flags&&e.comp[0].depth+7>>>3==2}return!1}}},55196:(t,e,i)=>{"use strict";i.d(e,{A:()=>u});var r=i(63939),s=i(14686),a=i(97317),n=i(22594),o=i(91848),l=i(25669),c=i(6110),h=i(72703);class u extends n.A{constructor(t,e){super(t,e)}generateFragmentSource(t,e){const i=(0,l.A)(this.srcColorSpace,this.dstColorSpace,{bitDepth:8,type:0,outputRGB:!0});let r="texture2D(u_Sampler, v_color.xy).x",s="texture2D(v_Sampler, v_color.xy).x",a="1.0";23===t||189===t?(r="texture2D(u_Sampler, v_color.xy).x",s="texture2D(u_Sampler, v_color.xy).y"):24!==t&&190!==t||(r="texture2D(u_Sampler, v_color.xy).y",s="texture2D(u_Sampler, v_color.xy).x"),128&e.flags&&4===e.nbComponents&&(a="texture2D(a_Sampler, v_color.xy).x"),this.fragmentSource=`\n precision highp float;\n varying vec4 v_color;\n uniform sampler2D y_Sampler;\n uniform sampler2D u_Sampler;\n uniform sampler2D v_Sampler;\n uniform sampler2D a_Sampler;\n void main () {\n float y = texture2D(y_Sampler, v_color.xy).x;\n float u = ${r};\n float v = ${s};\n float alpha = ${a};\n vec4 color = vec4(y, u, v, alpha);\n ${i.reduce(((t,e)=>t+e),"")}\n gl_FragColor = color;\n }\n `}checkFrame(t){const e=a.g[r.f[15](t+80)];e&&(r.f[15](t+32)===this.textureWidth&&r.f[15](t+72)===this.videoHeight&&r.f[15](t+68)===this.videoWidth||(this.srcColorSpace=new c.A(r.f[15](t+220),r.f[15](t+212),r.f[15](t+216),r.f[15](t+208)),this.generateFragmentSource(r.f[15](t+80),e),this.program=new o.A(this.fragmentSource),this.useProgram(),this.yTexture.setSize(r.f[15](t+32),r.f[15](t+72)),this.uTexture.setSize(r.f[15](t+32+4),r.f[15](t+72)>>>a.g[r.f[15](t+80)].log2ChromaH),e.comp[1].plane!==e.comp[2].plane&&this.vTexture.setSize(r.f[15](t+32+8),r.f[15](t+72)>>>a.g[r.f[15](t+80)].log2ChromaH),4===e.nbComponents&&this.aTexture.setSize(r.f[15](t+32+12),r.f[15](t+72)),this.videoWidth=r.f[15](t+68),this.videoHeight=r.f[15](t+72),this.textureWidth=r.f[15](t+32),this.format=r.f[15](t+80),this.layout()))}render(t){if(this.lost)return;this.checkFrame(t);const e=a.g[r.f[15](t+80)];e&&(this.yTexture.fill((0,s.s3)(r.f[20](t),this.yTexture.width*this.yTexture.height)),this.uTexture.fill((0,s.s3)(r.f[20](t+4),this.uTexture.width*this.uTexture.height)),e.comp[1].plane!==e.comp[2].plane&&this.vTexture.fill((0,s.s3)(r.f[20](t+8),this.vTexture.width*this.vTexture.height)),4===e.nbComponents&&this.aTexture.fill((0,s.s3)(r.f[20](t+12),this.aTexture.width*this.aTexture.height)),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4))}static isSupport(t){if((0,h.A)(t)){const e=a.g[r.f[15](t+80)];if(e)return!(32&e.flags)&&16&e.flags&&e.comp[0].depth+7>>>3==1}return!1}}},22594:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var r=i(134),s=i(48280),a=i(94012);class n extends a.A{constructor(t,e){super(t,e),(0,r.A)(this,"yTexture",void 0),(0,r.A)(this,"uTexture",void 0),(0,r.A)(this,"vTexture",void 0),(0,r.A)(this,"aTexture",void 0)}useProgram(){super.useProgram(),this.yTexture=new s.A(this.gl),this.yTexture.bind(0),this.yTexture.init(),this.program.bindYTexture(0),this.uTexture=new s.A(this.gl),this.uTexture.bind(1),this.uTexture.init(),this.program.bindUTexture(1),this.vTexture=new s.A(this.gl),this.vTexture.bind(2),this.vTexture.init(),this.program.bindVTexture(2),this.aTexture=new s.A(this.gl),this.aTexture.bind(3),this.aTexture.init(),this.program.bindATexture(3)}destroy(){this.yTexture&&(this.yTexture.destroy(),this.yTexture=null),this.uTexture&&(this.uTexture.destroy(),this.uTexture=null),this.vTexture&&(this.vTexture.destroy(),this.vTexture=null),this.aTexture&&(this.aTexture.destroy(),this.aTexture=null),super.destroy()}}},54750:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var r=i(54895),s=i(23195),a=i(15045);class n extends a.A{constructor(t,e){super(t,e),this.vertexSource=r.A,this.fragmentSource=s.A}checkFrame(t){t.codedWidth===this.textureWidth&&t.codedHeight===this.videoHeight&&t.codedWidth===this.videoWidth||(this.videoWidth=t.codedWidth,this.videoHeight=t.codedHeight,this.textureWidth=t.codedWidth,this.layout(),this.generatePipeline())}generateBindGroup(){this.bindGroupLayout=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.VERTEX,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,externalTexture:{}},{binding:2,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}}]})}render(t){if(this.lost)return;this.checkFrame(t);const e=this.device.createBindGroup({layout:this.renderPipeline.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:this.rotateMatrixBuffer,size:16*Float32Array.BYTES_PER_ELEMENT}},{binding:1,resource:this.device.importExternalTexture({source:t})},{binding:2,resource:this.sampler}]}),i=this.device.createCommandEncoder(),r={colorAttachments:[{view:this.context.getCurrentTexture().createView(),clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}]},s=i.beginRenderPass(r);s.setPipeline(this.renderPipeline),s.setBindGroup(0,e),s.setVertexBuffer(0,this.vbo),s.draw(4,4,0,0),s.end(),this.device.queue.submit([i.finish()])}destroy(){super.destroy()}static isSupport(t){return t instanceof VideoFrame}}},1052:(t,e,i)=>{"use strict";i.d(e,{A:()=>h});var r=i(63939),s=i(97317),a=i(14686),n=i(6110),o=i(25669),l=i(56066),c=i(72703);class h extends l.A{constructor(t,e){super(t,e)}generateFragmentSource(t,e){const i=(0,o.A)(this.srcColorSpace,this.dstColorSpace,{bitDepth:8,type:1,outputRGB:!0}),r=["r","g","b","a"];let s=`textureSample(rgbTexture, in_texcoord.xy).${r[e.comp[0].offset]}`,a=`textureSample(rgbTexture, in_texcoord.xy).${r[e.comp[1].offset]}`,n=`textureSample(rgbTexture, in_texcoord.xy).${r[e.comp[2].offset]}`,l="1.0";128&e.flags&&4===e.nbComponents&&(l=`textureSample(rgbTexture, in_texcoord.xy).${r[e.comp[3].offset]}`),this.fragmentSource=`\n @group(0) @binding(1) var s: sampler;\n @group(0) @binding(2) var rgbTexture: texture_2d;\n \n @fragment\n fn main(@location(0) in_texcoord: vec4) -> @location(0) vec4 {\n let r = ${s};\n let g = ${a};\n let b = ${n};\n let alpha = ${l};\n var color = vec4(r, g, b, alpha);\n ${i.reduce(((t,e)=>t+e),"")}\n return color;\n }\n `}checkFrame(t){const e=s.g[r.f[15](t+80)];e&&(r.f[15](t+32)===this.textureWidth&&r.f[15](t+72)===this.videoHeight&&r.f[15](t+68)===this.videoWidth||(this.rgbTexture&&this.rgbTexture.destroy(),this.rgbTexture=this.device.createTexture({size:[r.f[15](t+32),r.f[15](t+72)],usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT,format:"r8unorm"}),this.srcColorSpace=new n.A(r.f[15](t+220),r.f[15](t+212),r.f[15](t+216),r.f[15](t+208)),this.generateFragmentSource(r.f[15](t+80),e),this.videoWidth=r.f[15](t+68),this.videoHeight=r.f[15](t+72),this.textureWidth=r.f[15](t+32),this.format=r.f[15](t+80),this.layout(),this.generatePipeline(),this.generateRenderBundleEncoder()))}render(t){if(this.lost)return;this.checkFrame(t),this.device.queue.writeTexture({texture:this.rgbTexture},(0,a.s3)(r.f[20](t),this.rgbTexture.width*this.rgbTexture.height),{offset:0,bytesPerRow:this.rgbTexture.width,rowsPerImage:this.rgbTexture.height},{width:this.rgbTexture.width,height:this.rgbTexture.height,depthOrArrayLayers:1});const e=this.device.createCommandEncoder(),i=e.beginRenderPass({colorAttachments:[{view:this.context.getCurrentTexture().createView(),clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}]});i.executeBundles([this.renderBundle]),i.end(),this.device.queue.submit([e.finish()])}static isSupport(t){if((0,c.A)(t)){const e=s.g[r.f[15](t+80)];if(e)return 32&e.flags&&e.comp[0].depth+7>>>3==1}return!1}}},56066:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var r=i(134),s=i(54895),a=i(15045);class n extends a.A{constructor(t,e){super(t,e),(0,r.A)(this,"rgbTexture",void 0),this.vertexSource=s.A}generateBindGroup(){if(!this.rgbTexture)return;const t=[{binding:0,visibility:GPUShaderStage.VERTEX,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}}];this.bindGroupLayout=this.device.createBindGroupLayout({entries:t});const e=[{binding:0,resource:{buffer:this.rotateMatrixBuffer,size:16*Float32Array.BYTES_PER_ELEMENT}},{binding:1,resource:this.sampler},{binding:2,resource:this.rgbTexture.createView()}];this.bindGroup=this.device.createBindGroup({layout:this.bindGroupLayout,entries:e})}destroy(){this.rgbTexture&&this.rgbTexture.destroy(),super.destroy()}}},15045:(t,e,i)=>{"use strict";i.d(e,{A:()=>c});var r=i(134),s=i(4624),a=i(43356),n=i(72739),o=i(38469);const l="src/avrender/image/WebGPURender.ts";class c extends a.A{constructor(t,e){super(t,e),(0,r.A)(this,"adapter",void 0),(0,r.A)(this,"device",void 0),(0,r.A)(this,"context",void 0),(0,r.A)(this,"vsModule",void 0),(0,r.A)(this,"fsModule",void 0),(0,r.A)(this,"rotateMatrixBuffer",void 0),(0,r.A)(this,"renderPipeline",void 0),(0,r.A)(this,"rotateMatrix",void 0),(0,r.A)(this,"vbo",void 0),(0,r.A)(this,"sampler",void 0),(0,r.A)(this,"vertex",void 0),(0,r.A)(this,"fragmentSource",void 0),(0,r.A)(this,"vertexSource",void 0),(0,r.A)(this,"renderBundleEncoder",void 0),(0,r.A)(this,"renderBundle",void 0),(0,r.A)(this,"bindGroupLayout",void 0),(0,r.A)(this,"bindGroup",void 0),(0,r.A)(this,"pipelineLayout",void 0)}async init(t){var e;this.adapter=await navigator.gpu.requestAdapter({powerPreference:null!==(e=this.options.powerPreference)&&void 0!==e?e:"high-performance"}),this.adapter||s.h2("not support webgpu render",l,86);const i=[];n.__(t,(t=>{this.adapter.features.has(t)&&i.push(t)})),this.device=await this.adapter.requestDevice({requiredFeatures:i.length?i:void 0}),this.device.lost.then((()=>{var t;this.destroyed||(this.lost=!0,s.z3("gpu device lost",l,105),null!==(t=this.options)&&void 0!==t&&t.onRenderContextLost&&this.options.onRenderContextLost())})),this.context=this.canvas.getContext("webgpu"),this.context||s.h2("can not support webgpu, got GPUCanvasContext failed",l,114),this.context.configure({device:this.device,format:navigator.gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),this.sampler=this.device.createSampler({magFilter:"linear",minFilter:"linear"}),this.vbo=this.device.createBuffer({size:28*Float32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST}),this.rotateMatrixBuffer=this.device.createBuffer({size:16*Float32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.setRotateMatrix(this.getRotateMatrix(0))}generatePipeline(){this.generateBindGroup(),this.pipelineLayout=this.device.createPipelineLayout({bindGroupLayouts:[this.bindGroupLayout]}),this.vsModule=this.device.createShaderModule({code:this.vertexSource}),this.fsModule=this.device.createShaderModule({code:this.fragmentSource}),this.renderPipeline=this.device.createRenderPipeline({layout:this.pipelineLayout,vertex:{module:this.vsModule,entryPoint:"main",buffers:[{arrayStride:28,attributes:[{shaderLocation:0,offset:0,format:"float32x3"},{shaderLocation:1,offset:12,format:"float32x4"}]}]},fragment:{module:this.fsModule,entryPoint:"main",targets:[{format:navigator.gpu.getPreferredCanvasFormat()}]},primitive:{topology:"triangle-strip"}})}generateRenderBundleEncoder(){this.renderPipeline&&(this.renderBundleEncoder=this.device.createRenderBundleEncoder({colorFormats:[navigator.gpu.getPreferredCanvasFormat()]}),this.renderBundleEncoder.setPipeline(this.renderPipeline),this.renderBundleEncoder.setBindGroup(0,this.bindGroup),this.renderBundleEncoder.setVertexBuffer(0,this.vbo),this.renderBundleEncoder.draw(4,4,0,0),this.renderBundle=this.renderBundleEncoder.finish())}setRotateMatrix(t){this.rotateMatrix=t;const e=new Float32Array(this.rotateMatrix);this.device.queue.writeBuffer(this.rotateMatrixBuffer,0,e.buffer,e.byteOffset,e.byteLength)}setVertices(){const t=new Float32Array(this.vertex);this.device.queue.writeBuffer(this.vbo,0,t.buffer,t.byteOffset,t.byteLength)}clear(){this.context.getCurrentTexture().destroy()}layout(){let t=this.videoWidth,e=this.videoHeight,i=this.canvasWidth,r=this.canvasHeight;90!==this.rotate&&270!==this.rotate||(i=this.canvasHeight,r=this.canvasWidth);const s=t/i,a=e/r;let n;n=s>1?!(sa,1===this.renderMode&&(n=!n);let l=0;if(this.textureWidth!==this.videoWidth&&(l=(this.textureWidth-this.videoWidth)/this.textureWidth),n){const s=(r-e*i/t)/r;this.vertex=[-1,1-s,0,0,0,0,0,-1,-1+s,0,0,1,0,0,1,1-s,0,1-l,0,0,0,1,-1+s,0,1-l,1,0,0]}else{const s=(i-t*r/e)/i;this.vertex=[-1+s,1,0,0,0,0,0,-1+s,-1,0,0,1,0,0,1-s,1,0,1-l,0,0,0,1-s,-1,0,1-l,1,0,0]}(0,o.A)(this.vertex,this.flipHorizontal,this.flipVertical),this.setVertices()}viewport(t,e){super.viewport(t,e)}setRotate(t,e=!0){(t%=360)!==this.rotate&&(this.rotate=t,this.setRotateMatrix(this.getRotateMatrix(t)),this.layout(),e&&this.clear())}destroy(){this.sampler=null,this.vbo&&this.vbo.destroy(),this.rotateMatrixBuffer&&this.rotateMatrixBuffer.destroy(),this.bindGroupLayout=null,this.bindGroup=null,this.pipelineLayout=null,this.renderBundle=null,this.renderBundleEncoder=null,this.fsModule=null,this.vsModule=null,this.renderPipeline=null,this.rotateMatrix=null,this.vertex=null,this.context=null,this.options=null,this.destroyed=!0,this.device&&(this.device.destroy(),this.device=null),this.adapter&&(this.adapter=null),super.destroy()}}},90058:(t,e,i)=>{"use strict";i.d(e,{A:()=>A});var r=i(134),s=i(61499),a=i(20088),n=i(74503),o=i(63939),l=i(94300),c=i(49393),h=i(97317),u=i(14686),d=i(6110),f=i(62496),p=i(57914),m=i(57517),g=i(25669),v=i(56024),y=i(72703);class A extends c.A{constructor(t,e){super(t,e),(0,r.A)(this,"metaYBuffer",void 0),(0,r.A)(this,"metaUBuffer",void 0),(0,r.A)(this,"metaVBuffer",void 0),(0,r.A)(this,"metaABuffer",void 0),(0,r.A)(this,"computeBindGroupLayout",void 0),(0,r.A)(this,"computeBindGroupY",void 0),(0,r.A)(this,"computeBindGroupU",void 0),(0,r.A)(this,"computeBindGroupV",void 0),(0,r.A)(this,"computeBindGroupA",void 0),(0,r.A)(this,"computePipelineLayout",void 0),(0,r.A)(this,"computePipeline",void 0),(0,r.A)(this,"inputYTexture",void 0),(0,r.A)(this,"inputUTexture",void 0),(0,r.A)(this,"inputVTexture",void 0),(0,r.A)(this,"inputATexture",void 0),(0,r.A)(this,"computeModule",void 0),(0,r.A)(this,"uint2Float",void 0),(0,r.A)(this,"hdrMetadata",void 0),(0,r.A)(this,"hdrMetadataBuffer",void 0),this.hdrMetadata=(0,n.A)(a.A),this.hdrMetadata.multiplier=1}generateFragmentSource(t,e,i){i.outputRGB=!0;const r=(0,g.A)(this.srcColorSpace,this.dstColorSpace,i);let s="textureSample(uTexture, s, in_texcoord.xy).x",a="textureSample(vTexture, s, in_texcoord.xy).x",n="1.0";23===t||189===t?(s="textureSample(uTexture, s, in_texcoord.xy).x",a="textureSample(uTexture, s, in_texcoord.xy).y"):24!==t&&190!==t||(s="textureSample(uTexture, s, in_texcoord.xy).y",a="textureSample(uTexture, s, in_texcoord.xy).x"),128&e.flags&&4===e.nbComponents&&(n="textureSample(aTexture, s, in_texcoord.xy).x"),this.fragmentSource=`\n struct HdrMetadata {\n offset: f32,\n multiplier: f32,\n pqTonemapA: f32,\n pqTonemapB: f32,\n hlgOOTFGammaMinusOne: f32,\n hlgDstMaxLuminanceRelative: f32,\n nitsToSdrRelativeFactor: f32,\n sdrRelativeToNitsFactor: f32\n };\n\n @group(0) @binding(1) var s: sampler;\n @group(0) @binding(2) var hdrMetadata: HdrMetadata;\n @group(0) @binding(3) var yTexture: texture_2d;\n @group(0) @binding(4) var uTexture: texture_2d;\n\n ${this.vTexture?"@group(0) @binding(5) var vTexture: texture_2d;":""}\n ${this.aTexture?"@group(0) @binding(6) var aTexture: texture_2d;":""}\n\n @fragment\n fn main(@location(0) in_texcoord: vec4) -> @location(0) vec4 {\n\n let offset = hdrMetadata.offset;\n let multiplier = hdrMetadata.multiplier;\n let pq_tonemap_a = hdrMetadata.pqTonemapA;\n let pq_tonemap_b = hdrMetadata.pqTonemapB;\n let hlg_ootf_gamma_minus_one = hdrMetadata.hlgOOTFGammaMinusOne;\n let hlg_dst_max_luminance_relative = hdrMetadata.hlgDstMaxLuminanceRelative;\n let nits_to_sdr_relative_factor = hdrMetadata.nitsToSdrRelativeFactor;\n let sdr_relative_to_nits_factor = hdrMetadata.sdrRelativeToNitsFactor;\n\n let y = textureSample(yTexture, s, in_texcoord.xy).x;\n let u = ${s};\n let v = ${a};\n let alpha = ${n};\n var color = vec4(y, u, v, alpha);\n\n if (color.a > 0) {\n color.r /= color.a;\n color.g /= color.a;\n color.b /= color.a;\n }\n color.r -= offset;\n color.g -= offset;\n color.b -= offset;\n\n color.r *= multiplier;\n color.g *= multiplier;\n color.b *= multiplier;\n \n ${r.reduce(((t,e)=>t+e),"")}\n\n color.r *= color.a;\n color.g *= color.a;\n color.b *= color.a;\n\n return color;\n }\n `}async init(){await super.init(["float32-filterable"]),this.metaYBuffer=this.device.createBuffer({size:4*Uint32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.metaUBuffer=this.device.createBuffer({size:4*Uint32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.metaVBuffer=this.device.createBuffer({size:4*Uint32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.metaABuffer=this.device.createBuffer({size:4*Uint32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.hdrMetadataBuffer=this.device.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})}generateComputeBindGroup(){this.computeBindGroupLayout=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.COMPUTE,texture:{sampleType:"uint"}},{binding:2,visibility:GPUShaderStage.COMPUTE,storageTexture:{format:"r32float"}}]}),this.computeBindGroupY=this.device.createBindGroup({layout:this.computeBindGroupLayout,entries:[{binding:0,resource:{buffer:this.metaYBuffer,size:4*Uint32Array.BYTES_PER_ELEMENT}},{binding:1,resource:this.inputYTexture.createView()},{binding:2,resource:this.yTexture.createView()}]}),this.computeBindGroupU=this.device.createBindGroup({layout:this.computeBindGroupLayout,entries:[{binding:0,resource:{buffer:this.metaUBuffer,size:4*Uint32Array.BYTES_PER_ELEMENT}},{binding:1,resource:this.inputUTexture.createView()},{binding:2,resource:this.uTexture.createView()}]}),this.vTexture&&(this.computeBindGroupV=this.device.createBindGroup({layout:this.computeBindGroupLayout,entries:[{binding:0,resource:{buffer:this.metaVBuffer,size:4*Uint32Array.BYTES_PER_ELEMENT}},{binding:1,resource:this.inputVTexture.createView()},{binding:2,resource:this.vTexture.createView()}]})),this.aTexture&&(this.computeBindGroupA=this.device.createBindGroup({layout:this.computeBindGroupLayout,entries:[{binding:0,resource:{buffer:this.metaABuffer,size:4*Uint32Array.BYTES_PER_ELEMENT}},{binding:1,resource:this.inputATexture.createView()},{binding:2,resource:this.aTexture.createView()}]}))}generateComputePipeline(){this.generateComputeBindGroup(),this.computePipelineLayout=this.device.createPipelineLayout({bindGroupLayouts:[this.computeBindGroupLayout]}),this.computeModule=this.device.createShaderModule({code:this.uint2Float}),this.computePipeline=this.device.createComputePipeline({layout:this.computePipelineLayout,compute:{module:this.computeModule,entryPoint:"main"}})}generateBindGroup(){if(!this.yTexture)return;const t=[{binding:0,visibility:GPUShaderStage.VERTEX,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}},{binding:2,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:3,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}},{binding:4,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}}];this.vTexture&&t.push({binding:5,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}}),this.aTexture&&t.push({binding:6,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}}),this.bindGroupLayout=this.device.createBindGroupLayout({entries:t});const e=[{binding:0,resource:{buffer:this.rotateMatrixBuffer,size:16*Float32Array.BYTES_PER_ELEMENT}},{binding:1,resource:this.sampler},{binding:2,resource:{buffer:this.hdrMetadataBuffer,size:this.hdrMetadataBuffer.size}},{binding:3,resource:this.yTexture.createView()},{binding:4,resource:this.uTexture.createView()}];this.vTexture&&e.push({binding:5,resource:this.vTexture.createView()}),this.aTexture&&e.push({binding:6,resource:this.aTexture.createView()}),this.bindGroup=this.device.createBindGroup({layout:this.bindGroupLayout,entries:e})}checkFrame(t){const e=h.g[o.f[15](t+80)];if(e&&(o.f[15](t+32)>>>1!==this.textureWidth||o.f[15](t+72)!==this.videoHeight||o.f[15](t+68)!==this.videoWidth||o.f[15](t+80)!==this.format)){this.yTexture&&(this.yTexture.destroy(),this.yTexture=null),this.uTexture&&(this.uTexture.destroy(),this.uTexture=null),this.vTexture&&(this.vTexture.destroy(),this.vTexture=null),this.aTexture&&(this.aTexture.destroy(),this.aTexture=null),this.inputYTexture&&(this.inputYTexture.destroy(),this.inputYTexture=null),this.inputUTexture&&(this.inputUTexture.destroy(),this.inputUTexture=null),this.inputVTexture&&(this.inputVTexture.destroy(),this.inputVTexture=null),this.inputATexture&&(this.inputATexture.destroy(),this.inputATexture=null),this.yTexture=this.device.createTexture({size:[o.f[15](t+32)>>>1,o.f[15](t+72)],usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.STORAGE_BINDING,format:"r32float"}),this.uTexture=this.device.createTexture({size:[o.f[15](t+32+4)>>>1,o.f[15](t+72)>>>e.log2ChromaH],usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.STORAGE_BINDING,format:"r32float"}),e.comp[1].plane!==e.comp[2].plane&&(this.vTexture=this.device.createTexture({size:[o.f[15](t+32+8)>>>1,o.f[15](t+72)>>>e.log2ChromaH],usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.STORAGE_BINDING,format:"r32float"})),4===e.nbComponents&&(this.aTexture=this.device.createTexture({size:[o.f[15](t+32+12)>>>1,o.f[15](t+72)],usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.STORAGE_BINDING,format:"r32float"})),this.inputYTexture=this.device.createTexture({size:[this.yTexture.width,this.yTexture.height],usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,format:"r16uint"}),this.inputUTexture=this.device.createTexture({size:[this.uTexture.width,this.uTexture.height],usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,format:"r16uint"}),e.comp[1].plane!==e.comp[2].plane&&(this.inputVTexture=this.device.createTexture({size:[this.vTexture.width,this.vTexture.height],usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,format:"r16uint"})),4===e.nbComponents&&(this.inputATexture=this.device.createTexture({size:[this.aTexture.width,this.aTexture.height],usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,format:"r16uint"}));const i=new Uint32Array([(1<>>1,this.format=o.f[15](t+80);const a={type:1,bitDepth:e.comp[0].depth,toneMapPQAndHlgToDst:!0,metadata:this.hdrMetadata,dstSdrMaxLuminanceNits:m.kH,dstMaxLuminanceRelative:1},n=(0,v.aH)(t,14);if(n){const t=o.f[20](n+4);o.f[8](t)>0&&(a.maxContentLightLevel=o.f[8](t))}this.generateFragmentSource(o.f[15](t+80),e,a),this.uint2Float=1&e.flags?p.A:f.A,this.layout(),this.generatePipeline(),this.generateRenderBundleEncoder(),this.generateComputePipeline();const l=(0,u.s3)(this.hdrMetadata[s.o9],32).slice();this.device.queue.writeBuffer(this.hdrMetadataBuffer,0,l.buffer,l.byteOffset,l.byteLength)}}render(t){if(this.lost)return;this.checkFrame(t);const e=this.device.createCommandEncoder(),i=e.beginComputePass({});i.setPipeline(this.computePipeline),i.setBindGroup(0,this.computeBindGroupY),this.device.queue.writeTexture({texture:this.inputYTexture},(0,u.s3)(o.f[20](t),this.inputYTexture.width*this.inputYTexture.height<<1),{offset:0,bytesPerRow:this.inputYTexture.width<<1,rowsPerImage:this.inputYTexture.height},{width:this.inputYTexture.width,height:this.inputYTexture.height,depthOrArrayLayers:1}),i.dispatchWorkgroups(this.inputYTexture.width+7>>>3,this.inputYTexture.height+7>>>3),i.setBindGroup(0,this.computeBindGroupU),this.device.queue.writeTexture({texture:this.inputUTexture},(0,u.s3)(o.f[20](t+4),this.inputUTexture.width*this.inputUTexture.height<<1),{offset:0,bytesPerRow:this.inputUTexture.width<<1,rowsPerImage:this.inputUTexture.height},{width:this.inputUTexture.width,height:this.inputUTexture.height,depthOrArrayLayers:1}),i.dispatchWorkgroups(this.inputUTexture.width+7>>>3,this.inputUTexture.height+7>>>3),this.inputVTexture&&(i.setBindGroup(0,this.computeBindGroupV),this.device.queue.writeTexture({texture:this.inputVTexture},(0,u.s3)(o.f[20](t+8),this.inputVTexture.width*this.inputVTexture.height<<1),{offset:0,bytesPerRow:this.inputVTexture.width<<1,rowsPerImage:this.inputVTexture.height},{width:this.inputVTexture.width,height:this.inputVTexture.height,depthOrArrayLayers:1}),i.dispatchWorkgroups(this.inputVTexture.width+7>>>3,this.inputVTexture.height+7>>>3)),this.inputATexture&&(i.setBindGroup(0,this.computeBindGroupA),this.device.queue.writeTexture({texture:this.inputATexture},(0,u.s3)(o.f[20](t+12),this.inputATexture.width*this.inputATexture.height<<1),{offset:0,bytesPerRow:this.inputATexture.width<<1,rowsPerImage:this.inputATexture.height},{width:this.inputATexture.width,height:this.inputATexture.height,depthOrArrayLayers:1}),i.dispatchWorkgroups(this.inputATexture.width+7>>>3,this.inputATexture.height+7>>>3)),i.end();const r=e.beginRenderPass({colorAttachments:[{view:this.context.getCurrentTexture().createView(),clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}]});r.executeBundles([this.renderBundle]),r.end(),this.device.queue.submit([e.finish()])}destroy(){this.inputYTexture&&(this.inputYTexture.destroy(),this.inputYTexture=null),this.inputUTexture&&(this.inputUTexture.destroy(),this.inputUTexture=null),this.inputVTexture&&(this.inputVTexture.destroy(),this.inputVTexture=null),this.metaYBuffer&&(this.metaYBuffer.destroy(),this.metaYBuffer=null),this.metaUBuffer&&(this.metaUBuffer.destroy(),this.metaUBuffer=null),this.metaVBuffer&&(this.metaVBuffer.destroy(),this.metaVBuffer=null),this.hdrMetadata&&((0,l.A)(this.hdrMetadata),this.hdrMetadata=null),this.computeModule=null,this.computeBindGroupY=null,this.computeBindGroupU=null,this.computeBindGroupV=null,this.computeBindGroupLayout=null,this.computePipelineLayout=null,this.computePipeline=null,super.destroy()}static isSupport(t){if((0,y.A)(t)){const e=h.g[o.f[15](t+80)];if(e)return!(32&e.flags)&&16&e.flags&&e.comp[0].depth+7>>>3==2}return!1}}},37977:(t,e,i)=>{"use strict";i.d(e,{A:()=>h});var r=i(63939),s=i(49393),a=i(97317),n=i(14686),o=i(6110),l=i(25669),c=i(72703);class h extends s.A{constructor(t,e){super(t,e)}generateFragmentSource(t,e){const i=(0,l.A)(this.srcColorSpace,this.dstColorSpace,{bitDepth:8,type:1,outputRGB:!0});let r="textureSample(uTexture, s, in_texcoord.xy).x",s="textureSample(vTexture, s, in_texcoord.xy).x",a="1.0";23===t||189===t?(r="textureSample(uTexture, s, in_texcoord.xy).x",s="textureSample(uTexture, s, in_texcoord.xy).y"):24!==t&&190!==t||(r="textureSample(uTexture, s, in_texcoord.xy).y",s="textureSample(uTexture, s, in_texcoord.xy).x"),128&e.flags&&4===e.nbComponents&&(a="textureSample(aTexture, s, in_texcoord.xy).x"),this.fragmentSource=`\n @group(0) @binding(1) var s: sampler;\n @group(0) @binding(2) var yTexture: texture_2d;\n @group(0) @binding(3) var uTexture: texture_2d;\n ${this.vTexture?"@group(0) @binding(4) var vTexture: texture_2d;":""}\n ${this.aTexture?"@group(0) @binding(5) var aTexture: texture_2d;":""}\n \n @fragment\n fn main(@location(0) in_texcoord: vec4) -> @location(0) vec4 {\n let y = textureSample(yTexture, s, in_texcoord.xy).x;\n let u = ${r};\n let v = ${s};\n let alpha = ${a};\n var color = vec4(y, u, v, alpha);\n ${i.reduce(((t,e)=>t+e),"")}\n return color;\n }\n `}checkFrame(t){const e=a.g[r.f[15](t+80)];e&&(r.f[15](t+32)===this.textureWidth&&r.f[15](t+72)===this.videoHeight&&r.f[15](t+68)===this.videoWidth||(this.yTexture&&(this.yTexture.destroy(),this.yTexture=null),this.uTexture&&(this.uTexture.destroy(),this.uTexture=null),this.vTexture&&(this.vTexture.destroy(),this.vTexture=null),this.aTexture&&(this.aTexture.destroy(),this.aTexture=null),this.yTexture=this.device.createTexture({size:[r.f[15](t+32),r.f[15](t+72)],usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT,format:"r8unorm"}),this.uTexture=this.device.createTexture({size:[r.f[15](t+32+4),r.f[15](t+72)>>>a.g[r.f[15](t+80)].log2ChromaH],usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT,format:"r8unorm"}),e.comp[1].plane!==e.comp[2].plane&&(this.vTexture=this.device.createTexture({size:[r.f[15](t+32+8),r.f[15](t+72)>>>a.g[r.f[15](t+80)].log2ChromaH],usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT,format:"r8unorm"})),4===e.nbComponents&&(this.aTexture=this.device.createTexture({size:[r.f[15](t+32+12),r.f[15](t+72)],usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT,format:"r8unorm"})),this.srcColorSpace=new o.A(r.f[15](t+220),r.f[15](t+212),r.f[15](t+216),r.f[15](t+208)),this.generateFragmentSource(r.f[15](t+80),e),this.videoWidth=r.f[15](t+68),this.videoHeight=r.f[15](t+72),this.textureWidth=r.f[15](t+32),this.format=r.f[15](t+80),this.layout(),this.generatePipeline(),this.generateRenderBundleEncoder()))}render(t){if(this.lost)return;this.checkFrame(t),this.device.queue.writeTexture({texture:this.yTexture},(0,n.s3)(r.f[20](t),this.yTexture.width*this.yTexture.height),{offset:0,bytesPerRow:this.yTexture.width,rowsPerImage:this.yTexture.height},{width:this.yTexture.width,height:this.yTexture.height,depthOrArrayLayers:1}),this.device.queue.writeTexture({texture:this.uTexture},(0,n.s3)(r.f[20](t+4),this.uTexture.width*this.uTexture.height),{offset:0,bytesPerRow:this.uTexture.width,rowsPerImage:this.uTexture.height},{width:this.uTexture.width,height:this.uTexture.height,depthOrArrayLayers:1}),this.vTexture&&this.device.queue.writeTexture({texture:this.vTexture},(0,n.s3)(r.f[20](t+8),this.vTexture.width*this.vTexture.height),{offset:0,bytesPerRow:this.vTexture.width,rowsPerImage:this.vTexture.height},{width:this.vTexture.width,height:this.vTexture.height,depthOrArrayLayers:1}),this.aTexture&&this.device.queue.writeTexture({texture:this.aTexture},(0,n.s3)(r.f[20](t+12),this.aTexture.width*this.aTexture.height),{offset:0,bytesPerRow:this.aTexture.width,rowsPerImage:this.aTexture.height},{width:this.aTexture.width,height:this.aTexture.height,depthOrArrayLayers:1});const e=this.device.createCommandEncoder(),i=e.beginRenderPass({colorAttachments:[{view:this.context.getCurrentTexture().createView(),clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}]});i.executeBundles([this.renderBundle]),i.end(),this.device.queue.submit([e.finish()])}static isSupport(t){if((0,c.A)(t)){const e=a.g[r.f[15](t+80)];if(e)return!(32&e.flags)&&16&e.flags&&e.comp[0].depth+7>>>3==1}return!1}}},49393:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var r=i(134),s=i(54895),a=i(15045);class n extends a.A{constructor(t,e){super(t,e),(0,r.A)(this,"yTexture",void 0),(0,r.A)(this,"uTexture",void 0),(0,r.A)(this,"vTexture",void 0),(0,r.A)(this,"aTexture",void 0),this.vertexSource=s.A}generateBindGroup(){if(!this.yTexture)return;const t=[{binding:0,visibility:GPUShaderStage.VERTEX,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}},{binding:3,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}}];this.vTexture&&t.push({binding:4,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}}),this.aTexture&&t.push({binding:5,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}}),this.bindGroupLayout=this.device.createBindGroupLayout({entries:t});const e=[{binding:0,resource:{buffer:this.rotateMatrixBuffer,size:16*Float32Array.BYTES_PER_ELEMENT}},{binding:1,resource:this.sampler},{binding:2,resource:this.yTexture.createView()},{binding:3,resource:this.uTexture.createView()}];this.vTexture&&e.push({binding:4,resource:this.vTexture.createView()}),this.aTexture&&e.push({binding:5,resource:this.aTexture.createView()}),this.bindGroup=this.device.createBindGroup({layout:this.bindGroupLayout,entries:e})}destroy(){this.yTexture&&this.yTexture.destroy(),this.uTexture&&this.uTexture.destroy(),this.vTexture&&this.vTexture.destroy(),this.aTexture&&this.aTexture.destroy(),super.destroy()}}},6110:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var r=i(134),s=i(12535),a=i(1064),n=i(86141),o=i(91131);class l{constructor(t,e,i,s){(0,r.A)(this,"matrixId",void 0),(0,r.A)(this,"primaryId",void 0),(0,r.A)(this,"transferId",void 0),(0,r.A)(this,"rangeId",void 0),this.matrixId=t,this.primaryId=e,this.transferId=i,this.rangeId=s}getMatrixId(){return this.matrixId}getPrimaryId(){return this.primaryId}getTransferId(){return this.transferId}getRangeId(){return this.rangeId}isWide(){return 9===this.primaryId||11===this.primaryId||12===this.primaryId}isHDR(){return 18===this.transferId||16===this.transferId}isToneMappedByDefault(){return 18===this.transferId||16===this.transferId}isAffectedBySDRWhiteLevel(){return 18===this.transferId||16===this.transferId}fullRangeEncodedValues(){return 12===this.transferId||11===this.transferId}getTransferMatrix(t){const e=(1<0&&e.g>0){const i=Math.pow(e.a,e.g);t.a=1/i,t.b=-e.e/i,t.g=1/e.g}return t.d=e.c*e.d+e.f,t.e=-e.b/e.a,0!=e.c&&(t.c=1/e.c,t.f=-e.f/e.c),t}}hasExtendedSkTransferFn(){return 0===this.matrixId}isValid(){return 2!==this.matrixId&&2!==this.primaryId&&2!==this.transferId&&0!==this.rangeId}getColorSpacePrimaries(){const t=o.WO;switch(this.primaryId){case 1:return o.P5;case 4:return o.Wc;case 5:return o.cA;case 7:return o.vi;case 8:return o.cp;case 9:return o.Je;case 10:return o.lf;case 11:return o.Rk;case 12:return o.tR}return t}getPrimaryMatrix(){const t=this.getColorSpacePrimaries(),e=o._O(t);return s.A.RowMajor([e.rc(0,0),e.rc(0,1),e.rc(0,2),0,e.rc(1,0),e.rc(1,1),e.rc(1,2),0,e.rc(2,0),e.rc(2,1),e.rc(2,2),0,0,0,0,1])}}},91131:(t,e,i)=>{"use strict";i.d(e,{Je:()=>d,P5:()=>o,Rk:()=>p,WO:()=>g,Wc:()=>l,_O:()=>v,cA:()=>c,cp:()=>u,lf:()=>f,tR:()=>m,vi:()=>h});var r=i(45726),s=i(1064),a=i(66551),n=i(60153);const o=[.64,.33,.3,.6,.15,.06,.3127,.329],l=[.67,.33,.21,.71,.14,.08,.31,.316],c=[.64,.33,.29,.6,.15,.06,.3127,.329],h=[.63,.34,.31,.595,.155,.07,.3127,.329],u=[.681,.319,.243,.692,.145,.049,.31,.316],d=[.708,.292,.17,.797,.131,.046,.3127,.329],f=[1,0,0,1,0,0,.3333333333333333,.3333333333333333],p=[.68,.32,.265,.69,.15,.06,.314,.351],m=[.68,.32,.265,.69,.15,.06,.3127,.329],g=[0,0,0,0,0,0,0,0];function v(t){const e=r.A.RowMajor([t[0],t[2],t[4],t[1],t[3],t[5],1-t[0]-t[1],1-t[2]-t[3],1-t[4]-t[5]]),i=e.copy().invert(),o=new s.P([t[6]/t[7],1,(1-t[6]-t[7])/t[7]]),l=(0,n.Y3)(i,o);let c=new r.A([l.x,0,0,0,l.y,0,0,0,l.z]);c=(0,a.B)(e,c);const h=function(t,e){const i=new s.P([t/e,1,(1-t-e)/e]),o=new s.P([.96422,1,.82521]),l=r.A.RowMajor([.8951,.2664,-.1614,-.7502,1.7135,.0367,.0389,-.0685,1.0296]),c=r.A.RowMajor([.9869929,-.1470543,.1599627,.4323053,.5183603,.0492912,-.0085287,.0400428,.9684867]),h=(0,n.Y3)(l,i),u=(0,n.Y3)(l,o);let d=new r.A([u.x/h.x,0,0,0,u.y/h.y,0,0,0,u.z/h.z]);return d=(0,a.B)(d,l),d=(0,a.B)(c,d),d}(t[6],t[7]);return(0,a.B)(h,c)}},86141:(t,e,i)=>{"use strict";i.d(e,{$_:()=>r,Cr:()=>l,Hi:()=>n,J7:()=>s,aP:()=>o,q:()=>a});const r={g:2.2,a:1,b:0,c:0,d:0,e:0,f:0},s={g:2.8,a:1,b:0,c:0,d:0,e:0,f:0},a={g:2.222222222222,a:.899626676224,b:.100373323776,c:.25,d:.091286342118,e:0,f:0},n={g:1,a:1,b:0,c:0,d:0,e:0,f:0},o={g:2.4,a:.9478672985781991,b:.05213270142180095,c:.07739938080495357,d:.04045,e:0,f:0},l={g:2.6,a:1.034080527699,b:0,c:0,d:0,e:0,f:0}},89401:(t,e,i)=>{"use strict";i.d(e,{A:()=>l,U:()=>o});var r=i(57517);const s=.2627,a=.678,n=.0593;function o(t){t.metadata.hlgDstMaxLuminanceRelative=t.dstMaxLuminanceRelative;const e=t.dstSdrMaxLuminanceNits*t.dstMaxLuminanceRelative;t.metadata.hlgOOTFGammaMinusOne=1.2+.42*Math.log10(e/r.hD)/Math.log10(10)-1}function l(t){return 0===t.type?`\n {\n vec4 luma_vec = vec4(${s}, ${a}, ${n}, 0.0);\n float L = dot(color, luma_vec);\n if (L > 0.0) {\n color.r *= pow(L, hlg_ootf_gamma_minus_one);\n color.g *= pow(L, hlg_ootf_gamma_minus_one);\n color.b *= pow(L, hlg_ootf_gamma_minus_one);\n color.r *= hlg_dst_max_luminance_relative;\n color.g *= hlg_dst_max_luminance_relative;\n color.b *= hlg_dst_max_luminance_relative;\n }\n }\n `:1===t.type?`\n {\n let luma_vec: vec4 = vec4(${s}, ${a}, ${n}, 0.0);\n let L: f32 = dot(color, luma_vec);\n if (L > 0.0) {\n color.r *= pow(L, hlg_ootf_gamma_minus_one);\n color.g *= pow(L, hlg_ootf_gamma_minus_one);\n color.b *= pow(L, hlg_ootf_gamma_minus_one);\n color.r *= hlg_dst_max_luminance_relative;\n color.g *= hlg_dst_max_luminance_relative;\n color.b *= hlg_dst_max_luminance_relative;\n }\n }\n `:""}},7511:(t,e,i)=>{"use strict";function r(t,e){let i="",r="";if(0===e.type?(i="mat4",r="vec4"):1===e.type&&(i="mat4x4",r="vec4"),!i||!r)return"";let s=`\n color = ${i}(\n ${t.rc(0,0)}, ${t.rc(1,0)}, ${t.rc(2,0)}, 0,\n ${t.rc(0,1)}, ${t.rc(1,1)}, ${t.rc(2,1)}, 0,\n ${t.rc(0,2)}, ${t.rc(1,2)}, ${t.rc(2,2)}, 0,\n 0, 0, 0, 1\n ) * color;\n `;return 0===t.rc(0,3)&&0===t.rc(1,3)&&0===t.rc(2,3)||(s+=`\n color += ${r}(${t.rc(0,3)}, ${t.rc(1,3)}, ${t.rc(2,3)}, 0);\n `),s}i.d(e,{A:()=>r})},79955:(t,e,i)=>{"use strict";function r(t,e){e.metadata.sdrRelativeToNitsFactor=e.dstSdrMaxLuminanceNits/t}function s(t){return"\n color.r *= sdr_relative_to_nits_factor;\n color.g *= sdr_relative_to_nits_factor;\n color.b *= sdr_relative_to_nits_factor;\n "}i.d(e,{A:()=>s,j:()=>r})},64748:(t,e,i)=>{"use strict";i.d(e,{A:()=>a,n:()=>s});var r=i(57517);function s(t,e,i){let s=i.dstSdrMaxLuminanceNits;e&&(s=r.kH,i.ndwl&&(s=i.ndwl)),i.metadata.nitsToSdrRelativeFactor=t/s}function a(t){return"\n color.r *= nits_to_sdr_relative_factor;\n color.g *= nits_to_sdr_relative_factor;\n color.b *= nits_to_sdr_relative_factor;\n "}},70194:(t,e,i)=>{"use strict";i.d(e,{A:()=>a,J:()=>s});var r=i(57517);function s(t,e){const i=function(t,e){let i=r.hD;return 18!==t.getTransferId()&&e.maxContentLightLevel>0&&(i=e.maxContentLightLevel),i/e.dstSdrMaxLuminanceNits}(t,e);i>e.dstMaxLuminanceRelative?(e.metadata.pqTonemapA=e.dstMaxLuminanceRelative/(i*i),e.metadata.pqTonemapB=1/e.dstMaxLuminanceRelative):(e.metadata.pqTonemapA=0,e.metadata.pqTonemapB=0)}function a(t){return`\n {\n ${1===t.type?"let maximum: f32":"float maximum"} = max(color.r, max(color.g, color.b));\n if (maximum > 0.0) {\n color.r *= (1.0 + pq_tonemap_a * maximum) / (1.0 + pq_tonemap_b * maximum);\n color.g *= (1.0 + pq_tonemap_a * maximum) / (1.0 + pq_tonemap_b * maximum);\n color.b *= (1.0 + pq_tonemap_a * maximum) / (1.0 + pq_tonemap_b * maximum);\n }\n }\n `}},15380:(t,e,i)=>{"use strict";function r(t){return t===t>>>0?`${t}.0`:t.toString()}i.d(e,{A:()=>r})},25669:(t,e,i)=>{"use strict";i.d(e,{A:()=>v});var r=i(6110),s=i(57517),a=i(7511),n=i(5361),o=i(63921),l=i(55168),c=i(16307),h=i(89401),u=i(64748),d=i(70194),f=i(79955),p=i(84272),m=i(51025),g=i(40326);function v(t,e,i){const v=[],y=8===t.getMatrixId(),A=(0,a.A)(t.getRangeAdjustMatrix(i.bitDepth),i);if(y||v.push(A),10===t.getMatrixId()||v.push((0,a.A)(t.getTransferMatrix(i.bitDepth).invert(),i)),y&&v.push(A),e.isValid()){if(t.isHDR()){switch(t.getTransferId()){case 18:v.push((0,n.A)(i));break;case 16:v.push((0,o.A)(i));break;default:const e=t.getTransferFunction();e?v.push((0,l.A)(e,t.hasExtendedSkTransferFn(),i)):v.push((0,c.A)(t.getTransferId(),i))}10===t.getMatrixId()&&v.push((0,a.A)(t.getTransferMatrix(i.bitDepth).invert(),i)),v.push((0,a.A)(t.getPrimaryMatrix(),i));const y=new r.A(0,9,8,2);switch(t.getTransferId()){case 18:i.toneMapPQAndHlgToDst?((0,h.U)(i),v.push((0,h.A)(i))):((0,u.n)(12/s.kH,!1,i),v.push((0,u.A)(i)));break;case 16:(0,u.n)(s.th,!0,i),v.push((0,u.A)(i)),i.toneMapPQAndHlgToDst&&(v.push((0,a.A)(y.getPrimaryMatrix().invert(),i)),(0,d.J)(t,i),v.push((0,d.A)(i)),v.push((0,a.A)(y.getPrimaryMatrix(),i)))}switch(v.push((0,a.A)(e.getPrimaryMatrix().invert(),i)),10===e.getMatrixId()&&v.push((0,a.A)(e.getTransferMatrix(i.bitDepth),i)),e.getTransferId()){case 18:(0,f.j)(s.kH,i),v.push((0,f.A)(i)),v.push((0,p.A)(i));break;case 16:(0,f.j)(s.th,i),v.push((0,f.A)(i)),v.push((0,m.A)(i));default:const r=e.getInverseTransferFunction();r?v.push((0,l.A)(r,t.hasExtendedSkTransferFn(),i)):v.push((0,g.A)(t.getTransferId(),i))}}if(!i.outputRGB){const t=8===e.getMatrixId(),r=(0,a.A)(e.getRangeAdjustMatrix(i.bitDepth).invert(),i);t&&v.push(r),10===e.getMatrixId()||v.push((0,a.A)(e.getTransferMatrix(i.bitDepth),i)),t||v.push(r)}}return v}},57517:(t,e,i)=>{"use strict";i.d(e,{hD:()=>s,kH:()=>r,th:()=>a});const r=203,s=1e3,a=1e4},71323:(t,e,i)=>{"use strict";function r(t,e,i){return e?`\n {\n ${1===i.type?"var v: f32":"float v"} = abs(color.r);\n ${t()}\n color.r = sign(color.r) * v;\n }\n {\n ${1===i.type?"var v: f32":"float v"} = abs(color.g);\n ${t()}\n color.g = sign(color.g) * v;\n }\n {\n ${1===i.type?"var v: f32":"float v"} = abs(color.b);\n ${t()}\n color.b = sign(color.b) * v;\n }\n `:`\n {\n ${1===i.type?"var v: f32":"float v"} = color.r;\n ${t()}\n color.r = v;\n }\n {\n ${1===i.type?"var v: f32":"float v"} = color.g;\n ${t()}\n color.g = v;\n }\n {\n ${1===i.type?"var v: f32":"float v"} = color.b;\n ${t()}\n color.b = v;\n }\n `}i.d(e,{A:()=>r})},40326:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(71323);function s(t,e){return(0,r.A)((function(){switch(t){case 9:return"\n if (v < 0.0) {\n v = 0.0;\n }\n else {\n v = 1.0 + log(v) / log(10.0) / 2.0;\n }\n ";case 10:return"\n if (v < sqrt(10.0) / 1000.0)\n v = 0.0;\n }\n else {\n v = 1.0 + log(v) / log(10.0) / 2.5;\n }\n ";case 11:return`\n ${1===e.type?"let a: f32":"float a"} = 1.099296826809442;\n ${1===e.type?"let b: f32":"float b"}= 0.018053968510807;\n if (v < -b) {\n v = -a * pow(-v, 0.45) + (a - 1.0);\n }\n else if (v <= b) {\n v = 4.5 * v;\n }\n else {\n v = a * pow(v, 0.45) - (a - 1.0);\n }\n `;case 12:return`\n ${1===e.type?"let a: f32":"float a"} = 1.099;\n ${1===e.type?"let b: f32":"float b"} = 0.018;\n ${1===e.type?"let l: f32":"float l"} = 0.0045;\n\n if (v < -l) {\n v = -(a * pow(-4.0 * v, 0.45) + (a - 1.0)) / 4.0;\n }\n else if (v <= b) {\n v = 4.5 * v;\n }\n else {\n v = a * pow(v, 0.45) - (a - 1.0);\n }\n `;default:return""}}),!1,e)}},5361:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(71323);function s(t){return(0,r.A)((function(){return`\n v = max(0.0, v);\n ${1===t.type?"let a: f32":"float a"} = 0.17883277f;\n ${1===t.type?"let b: f32":"float b"} = 0.28466892f;\n ${1===t.type?"let c: f32":"float c"} = 0.55991073f;\n if (v <= 0.5) {\n v = v * v + 4.0;\n }\n else {\n v = exp((v - c) / a) + b;\n }\n v = v / 12.0;\n `}),!1,t)}},84272:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(71323);function s(t){return(0,r.A)((function(){return`\n v = max(0.0, v);\n ${1===t.type?"let a: f32":"float a"} = 0.17883277f;\n ${1===t.type?"let b: f32":"float b"} = 0.28466892f;\n ${1===t.type?"let c: f32":"float c"} = 0.55991073f;\n if (v <= 1.0) {\n v = 0.5 * sqrt(v);\n }\n else {\n v = a * log(v - b) + c;\n }\n `}),!1,t)}},63921:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(71323);function s(t){return(0,r.A)((function(){return`\n v = max(0.0, v);\n ${1===t.type?"let m1: f32":"float m1"} = (2610.0 / 4096.0) / 4.0;\n ${1===t.type?"let m2: f32":"float m2"} = (2523.0 / 4096.0) * 128.0;\n ${1===t.type?"let c1: f32":"float c1"} = 3424.0 / 4096.0;\n ${1===t.type?"let c2: f32":"float c2"} = (2413.0 / 4096.0) * 32.0;\n ${1===t.type?"let c3: f32":"float c3"} = (2392.0 / 4096.0) * 32.0;\n \n ${0===t.type?"\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n highp float v2 = v;\n #else\n float v2 = v;\n #endif\n ":"var v2: f32 = v;"}\n \n v2 = pow(max(pow(v2, 1.0 / m2) - c1, 0.0) / (c2 - c3 * pow(v2, 1.0 / m2)), 1.0 / m1);\n v = v2;\n `}),!1,t)}},51025:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(71323);function s(t){return(0,r.A)((function(){return`\n v = max(0.0, v);\n ${1===t.type?"let m1: f32":"float m1"} = (2610.0 / 4096.0) / 4.0;\n ${1===t.type?"let m2: f32":"float m2"} = (2523.0 / 4096.0) * 128.0;\n ${1===t.type?"let c1: f32":"float c1"} = 3424.0 / 4096.0;\n ${1===t.type?"let c2: f32":"float c2"} = (2413.0 / 4096.0) * 32.0;\n ${1===t.type?"let c3: f32":"float c3"} = (2392.0 / 4096.0) * 32.0;\n v = pow((c1 + c2 * pow(v, m1)) / (1.0 + c3 * pow(v, m1)), m2);\n `}),!1,t)}},16307:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(71323);function s(t,e){return(0,r.A)((function(){switch(t){case 9:return"\n if (v < 0.0) {\n v = 0.0;\n }\n else {\n v = pow(10.0, (v - 1.0) * 2.0);\n }\n ";case 10:return"\n if (v < 0.0) {\n v = 0.0;\n }\n else {\n v = pow(10.0, (v - 1.0) * 2.5);\n }\n ";case 11:return`\n ${1===e.type?"let a: f32":"float a"} = 1.099296826809442;\n ${1===e.type?"let from_linear_neg_a: f32":"float from_linear_neg_a"} = -1.047844;\n ${1===e.type?"let from_linear_b: f32":"float from_linear_b"} = 0.081243;\n if (v < from_linear_neg_a) {\n v = -pow((a - 1.0 - v) / a, 1.0 / 0.45);\n }\n else if (v <= from_linear_b) {\n v = v / 4.5;\n }\n else {\n v = pow((v + a - 1.0) / a, 1.0 / 0.45);\n }\n `;case 12:return`\n ${1===e.type?"let a: f32":"float a"} = 1.099;\n ${1===e.type?"let from_linear_neg_l: f32":"float from_linear_neg_l"} = -0.020250;\n ${1===e.type?"let from_linear_b: f32":"float from_linear_b"} = 0.081000;\n if (v < from_linear_neg_l) {\n v = -pow((1.0 - a - v * 4.0) / a, 1.0 / 0.45) / 4.0;\n }\n else if (v <= from_linear_b) {\n v = v / 4.5;\n }\n else {\n v = pow((v + a - 1.0) / a, 1.0 / 0.45);\n }\n `;default:return""}}),!1,e)}},55168:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(71323),s=i(15380);function a(t,e,i){return(0,r.A)((function(){let e=.0009765625,i="v";Math.abs(t.c-1)>e&&(i=`${(0,s.A)(t.c)} * ${i}`),Math.abs(t.f)>e&&(i=`${i} + ${(0,s.A)(t.f)}`);let r="v";return Math.abs(t.a=1)>e&&(r=`${(0,s.A)(t.a)} * ${r}`),Math.abs(t.b)>e&&(r=`${r} + ${(0,s.A)(t.b)}`),Math.abs(t.g-1)>e&&(r=`pow(${r}, ${(0,s.A)(t.g)})`),Math.abs(t.e)>e&&(r=`${r} + ${(0,s.A)(t.e)}`),`\n if (v < ${(0,s.A)(t.d)}) {\n v = ${i};\n }\n else {\n v = ${r};\n }\n `}),!1,i)}},38469:(t,e,i)=>{"use strict";function r(t,e,i){if(e){let e=t[3],i=t[4];t[3]=t[17],t[4]=t[18],t[17]=e,t[18]=i,e=t[10],i=t[11],t[10]=t[24],t[11]=t[25],t[24]=e,t[25]=i}if(i){let e=t[3],i=t[4];t[3]=t[10],t[4]=t[11],t[10]=e,t[11]=i,e=t[17],i=t[18],t[17]=t[24],t[18]=t[25],t[24]=e,t[25]=i}}i.d(e,{A:()=>r})},20088:(t,e,i)=>{"use strict";i.d(e,{A:()=>h});var r,s,a=i(134),n=i(80662),o=i.n(n),l=i(61499),c=i(12085);class h{constructor(){(0,a.A)(this,"offset",void 0),(0,a.A)(this,"multiplier",void 0),(0,a.A)(this,"pqTonemapA",void 0),(0,a.A)(this,"pqTonemapB",void 0),(0,a.A)(this,"hlgOOTFGammaMinusOne",void 0),(0,a.A)(this,"hlgDstMaxLuminanceRelative",void 0),(0,a.A)(this,"nitsToSdrRelativeFactor",void 0),(0,a.A)(this,"sdrRelativeToNitsFactor",void 0)}}r=h.prototype,(s=new(o())).set("offset",{0:18,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}),s.set("multiplier",{0:18,1:0,2:0,3:0,4:0,5:0,6:0,7:4,8:0}),s.set("pqTonemapA",{0:18,1:0,2:0,3:0,4:0,5:0,6:0,7:8,8:0}),s.set("pqTonemapB",{0:18,1:0,2:0,3:0,4:0,5:0,6:0,7:12,8:0}),s.set("hlgOOTFGammaMinusOne",{0:18,1:0,2:0,3:0,4:0,5:0,6:0,7:16,8:0}),s.set("hlgDstMaxLuminanceRelative",{0:18,1:0,2:0,3:0,4:0,5:0,6:0,7:20,8:0}),s.set("nitsToSdrRelativeFactor",{0:18,1:0,2:0,3:0,4:0,5:0,6:0,7:24,8:0}),s.set("sdrRelativeToNitsFactor",{0:18,1:0,2:0,3:0,4:0,5:0,6:0,7:28,8:0}),(0,c.A)(r,l.Og,!0),(0,c.A)(r,l.dc,4),(0,c.A)(r,l.g7,32),(0,c.A)(r,l.JY,s)},36719:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(134),s=i(9188);class a extends s.A{constructor(t,e,i=!0){super(t,e),(0,r.A)(this,"enableColor",void 0),(0,r.A)(this,"aPoint",void 0),(0,r.A)(this,"aColor",void 0),this.enableColor=i}link(t){super.link(t),this.aPoint=this.gl.getAttribLocation(this.program,"point"),this.aColor=this.gl.getAttribLocation(this.program,"color"),this.enableColor?(this.gl.enableVertexAttribArray(this.aPoint),this.gl.enableVertexAttribArray(this.aColor)):this.gl.enableVertexAttribArray(this.aPoint)}bind(){super.bind(),this.enableColor?(this.gl.vertexAttribPointer(this.aPoint,3,this.gl.FLOAT,!1,7*Float32Array.BYTES_PER_ELEMENT,0),this.gl.vertexAttribPointer(this.aColor,4,this.gl.FLOAT,!1,7*Float32Array.BYTES_PER_ELEMENT,3*Float32Array.BYTES_PER_ELEMENT)):this.gl.vertexAttribPointer(this.aPoint,3,this.gl.FLOAT,!1,7*Float32Array.BYTES_PER_ELEMENT,0)}}},9188:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(134);i(4624);class s{constructor(t,e){(0,r.A)(this,"gl",void 0),(0,r.A)(this,"_program",void 0),(0,r.A)(this,"vertexShader",void 0),(0,r.A)(this,"fragmentShader",void 0),this.vertexShader=t,this.fragmentShader=e}link(t){this.gl=t,this.vertexShader&&this.vertexShader.compile(this.gl),this.fragmentShader&&this.fragmentShader.compile(this.gl),this._program=this.gl.createProgram(),this.gl.attachShader(this._program,this.vertexShader.shader),this.gl.attachShader(this._program,this.fragmentShader.shader),this.gl.linkProgram(this._program)}stop(){this.vertexShader.stop(this.gl),this.fragmentShader.stop(this.gl),this.gl.deleteProgram(this._program),this.vertexShader=null,this.fragmentShader=null,this._program=null}bind(){this.gl.useProgram(this._program)}get program(){return this._program}}},32903:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(48091);class s extends r.A{constructor(t){super(t)}}},48091:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(134),s=i(24399);class a extends s.A{constructor(t){super(t),(0,r.A)(this,"rgbSamplerLocation",void 0)}link(t){super.link(t),this.rgbSamplerLocation=this.gl.getUniformLocation(this.program,"rgb_Sampler")}bindRGBTexture(t=0){this.gl.uniform1i(this.rgbSamplerLocation,t)}}},24399:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var r=i(134),s=i(36719),a=i(37022),n=i(36200),o=i(84209);class l extends s.A{constructor(t){super(new a.A(o.A),new n.A(t)),(0,r.A)(this,"rotateMatrixLocation",void 0)}link(t){super.link(t),this.rotateMatrixLocation=this.gl.getUniformLocation(this.program,"rotateMatrix")}setRotateMatrix(t){this.gl.uniformMatrix4fv(this.rotateMatrixLocation,!1,new Float32Array(t))}}},73039:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(134),s=i(1706);class a extends s.A{constructor(t){super(t),(0,r.A)(this,"maxUniformLocation",void 0),(0,r.A)(this,"offsetLocation",void 0),(0,r.A)(this,"multiplierLocation",void 0),(0,r.A)(this,"pqTonemapALocation",void 0),(0,r.A)(this,"pqTonemapBLocation",void 0),(0,r.A)(this,"hlgOOTFGammaMinusOneLocation",void 0),(0,r.A)(this,"hlgDstMaxLuminanceRelativeLocation",void 0),(0,r.A)(this,"nitsToSdrRelativeFactorLocation",void 0),(0,r.A)(this,"sdrRelativeToNitsFactorLocation",void 0)}link(t){super.link(t),this.maxUniformLocation=this.gl.getUniformLocation(this.program,"v_max"),this.offsetLocation=this.gl.getUniformLocation(this.program,"offset"),this.multiplierLocation=this.gl.getUniformLocation(this.program,"multiplier"),this.pqTonemapALocation=this.gl.getUniformLocation(this.program,"pq_tonemap_a"),this.pqTonemapBLocation=this.gl.getUniformLocation(this.program,"pq_tonemap_b"),this.hlgOOTFGammaMinusOneLocation=this.gl.getUniformLocation(this.program,"hlg_ootf_gamma_minus_one"),this.hlgDstMaxLuminanceRelativeLocation=this.gl.getUniformLocation(this.program,"hlg_dst_max_luminance_relative"),this.nitsToSdrRelativeFactorLocation=this.gl.getUniformLocation(this.program,"nits_to_sdr_relative_factor"),this.sdrRelativeToNitsFactorLocation=this.gl.getUniformLocation(this.program,"sdr_relative_to_nits_factor")}setMax(t){this.gl.uniform1f(this.maxUniformLocation,t)}setMetaData(t){this.gl.uniform1f(this.offsetLocation,t.offset),this.gl.uniform1f(this.multiplierLocation,t.multiplier),this.gl.uniform1f(this.pqTonemapALocation,t.pqTonemapA),this.gl.uniform1f(this.pqTonemapBLocation,t.pqTonemapB),this.gl.uniform1f(this.hlgOOTFGammaMinusOneLocation,t.hlgOOTFGammaMinusOne),this.gl.uniform1f(this.hlgDstMaxLuminanceRelativeLocation,t.hlgDstMaxLuminanceRelative),this.gl.uniform1f(this.nitsToSdrRelativeFactorLocation,t.nitsToSdrRelativeFactor),this.gl.uniform1f(this.sdrRelativeToNitsFactorLocation,t.sdrRelativeToNitsFactor)}}},91848:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(1706);class s extends r.A{constructor(t){super(t)}}},1706:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(134),s=i(24399);class a extends s.A{constructor(t){super(t),(0,r.A)(this,"ySamplerLocation",void 0),(0,r.A)(this,"uSamplerLocation",void 0),(0,r.A)(this,"vSamplerLocation",void 0),(0,r.A)(this,"aSamplerLocation",void 0)}link(t){super.link(t),this.ySamplerLocation=this.gl.getUniformLocation(this.program,"y_Sampler"),this.uSamplerLocation=this.gl.getUniformLocation(this.program,"u_Sampler"),this.vSamplerLocation=this.gl.getUniformLocation(this.program,"v_Sampler"),this.aSamplerLocation=this.gl.getUniformLocation(this.program,"a_Sampler")}bindYTexture(t=0){this.gl.uniform1i(this.ySamplerLocation,t)}bindUTexture(t=0){this.gl.uniform1i(this.uSamplerLocation,t)}bindVTexture(t=0){this.gl.uniform1i(this.vSamplerLocation,t)}bindATexture(t=0){this.gl.uniform1i(this.aSamplerLocation,t)}}},36200:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(27976);class s extends r.A{constructor(t){super(1,t)}}},27976:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(134);i(4624);class s{constructor(t,e){(0,r.A)(this,"type",void 0),(0,r.A)(this,"_shader",void 0),(0,r.A)(this,"_source",void 0),(0,r.A)(this,"compiled",void 0),this.type=t,this._shader=null,this._source=e,this.compiled=!1}compile(t){this.compiled||(this._shader=t.createShader(0===this.type?t.VERTEX_SHADER:t.FRAGMENT_SHADER),t.shaderSource(this._shader,this._source),t.compileShader(this._shader),this.compiled=!0)}stop(t){t.deleteShader(this._shader),this._shader=null}get shader(){return this._shader}}},37022:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(27976);class s extends r.A{constructor(t){super(0,t)}}},17397:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(134),s=i(22684);class a extends s.A{constructor(t,e,i){super(t,e,i),(0,r.A)(this,"filter",void 0),(0,r.A)(this,"format",void 0),(0,r.A)(this,"internalformat",void 0),(0,r.A)(this,"dataType",void 0),this.format=this.gl.RGB,this.filter=this.gl.LINEAR,this.internalformat=this.gl.RGB,this.dataType=this.gl.UNSIGNED_BYTE}init(){this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.filter),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.filter),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)}setFormat(t){this.format=t}setInternalformat(t){this.internalformat=t}setDataType(t){this.dataType=t}setFilter(t){this.filter=t}fill(t){this.gl.bindTexture(this.gl.TEXTURE_2D,this.texture),this.setUnpackAlignment(),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.internalformat,this.width,this.height,0,this.format,this.dataType,t)}}},22684:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(134),s=i(67672);class a{constructor(t,e,i){(0,r.A)(this,"gl",void 0),(0,r.A)(this,"width",void 0),(0,r.A)(this,"height",void 0),(0,r.A)(this,"texture",void 0),this.gl=t,this.width=e,this.height=i,this.texture=this.gl.createTexture()}getTexture(){return this.texture}bind(t){s.ai(t)&&this.gl.activeTexture(this.gl.TEXTURE0+t),this.gl.bindTexture(this.gl.TEXTURE_2D,this.texture)}setSize(t,e){this.width=t,this.height=e}setUnpackAlignment(){this.width%8==0?this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,8):this.width%4==0?this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,4):this.width%2==0?this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,2):this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,1)}destroy(){this.texture&&(this.gl.deleteTexture(this.texture),this.texture=null)}}},48280:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(134),s=i(22684);class a extends s.A{constructor(t,e,i){super(t,e,i),(0,r.A)(this,"filter",void 0),(0,r.A)(this,"format",void 0),(0,r.A)(this,"internalformat",void 0),(0,r.A)(this,"dataType",void 0),this.format=this.gl.LUMINANCE,this.filter=this.gl.LINEAR,this.internalformat=this.gl.LUMINANCE,this.dataType=this.gl.UNSIGNED_BYTE}init(){this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.filter),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.filter),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)}setFormat(t){this.format=t}setInternalformat(t){this.internalformat=t}setDataType(t){this.dataType=t}setFilter(t){this.filter=t}fill(t){this.gl.bindTexture(this.gl.TEXTURE_2D,this.texture),this.setUnpackAlignment(),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.internalformat,this.width,this.height,0,this.format,this.dataType,t)}}},48641:(t,e,i)=>{"use strict";i.d(e,{A:()=>m});var r=i(134),s=i(63939),a=i(50932),n=(i(10278),i(37837)),o=i(11473),l=i(84149),c=i(4624),h=i(26429),u=i(44690),d=i(67672),f=i(14686);const p=u.A.windows||u.A.mac||u.A.linux?20:30;class m{constructor(t,e,i={}){(0,r.A)(this,"context",void 0),(0,r.A)(this,"observer",void 0),(0,r.A)(this,"options",void 0),(0,r.A)(this,"pullIPC",void 0),(0,r.A)(this,"buffer",void 0),(0,r.A)(this,"channels",void 0),(0,r.A)(this,"ended",void 0),(0,r.A)(this,"float32",void 0),(0,r.A)(this,"buffered",void 0),(0,r.A)(this,"pause",void 0),(0,r.A)(this,"startTime",void 0),(0,r.A)(this,"dest",void 0),(0,r.A)(this,"queue",void 0),(0,r.A)(this,"firstRendered",void 0),this.context=t,this.observer=e,this.options=i}async request(t,e,i){switch(t){case"init":break;case"start":{const{port:t,channels:i}=e;this.channels=i,this.pullIPC=new l.Ay(t),this.buffer=this.allocBuffer(),this.float32=new Float32Array((0,o.eq)().buffer),this.queue=[],this.startTime=0,this.ended=!1,this.pause=!1,this.firstRendered=!1,await this.pullInterval(),this.buffering(),await this.pullInterval(),this.buffered=!0,this.process();break}case"restart":if(!this.ended)return;this.buffer=this.allocBuffer(),this.queue=[],this.startTime=0,this.ended=!1,this.pause=!1,this.firstRendered=!1,await this.pullIPC.request("pull",{buffer:this.buffer}),this.buffering(),await this.pullIPC.request("pull",{buffer:this.buffer}),this.buffered=!0,this.process();break;case"stop":this.freeBuffer(this.buffer),this.buffer=null,this.ended=!0,this.pullIPC.destroy();break;case"clear":this.queue.forEach((t=>{t.disconnect()})),this.queue.length=0;break;case"pause":this.pause=!0;break;case"unpause":this.pause=!1,this.queue.length||this.process()}}allocBuffer(){const t=(0,n.Gy)(40);a.M[20](t,(0,n.Gy)(4*this.channels));const e=(0,n.Gy)(512*p*this.channels);for(let i=0;i>>2;t.copyToChannel&&!h.USE_THREADS?t.copyToChannel(this.float32.subarray(i,i+128*p),e,0):t.getChannelData(e).set(this.float32.subarray(i,i+128*p),0)}const e=this.context.createBufferSource();e.buffer=t,e.onended=()=>{if(this.queue.shift(),this.ended&&!this.queue.length)return this.freeBuffer(this.buffer),c.pq("audio source ended","src/avrender/pcm/AudioSourceBufferNode.ts",252),void this.observer.onEnded();this.process(),this.queue.length||this.observer.onStutter(),this.firstRendered||(this.firstRendered=!0,this.observer.onFirstRendered())},0===this.startTime&&(this.startTime=this.context.currentTime),e.start(this.startTime),this.dest&&e.connect(this.dest),this.startTime+=e.buffer.duration,this.queue.push(e)}connect(t){this.dest=t}disconnect(){for(let t=0;t{"use strict";i.d(e,{A:()=>s});var r=i(6534);class s extends r.A{constructor(t,e,i={}){super(t,e,"audio-source-processor",i)}}},6534:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var r=i(134),s=i(84149),a=i(67672);class n{constructor(t,e,i,a={}){(0,r.A)(this,"audioWorkletNode",void 0),(0,r.A)(this,"ipcPort",void 0),(0,r.A)(this,"observer",void 0),this.observer=e,this.audioWorkletNode=new AudioWorkletNode(t,i,a),this.ipcPort=new s.Ay(this.audioWorkletNode.port),this.ipcPort.on(s.Wo,(t=>{switch(t.method){case"ended":this.observer.onEnded();break;case"firstRendered":this.observer.onFirstRendered();break;case"stutter":this.observer.onStutter()}}))}async request(t,e,i){return this.ipcPort.request(t,e,i)}connect(t){this.audioWorkletNode.connect(t)}getNode(){return this.audioWorkletNode}disconnect(){this.audioWorkletNode.disconnect()}getParameters(t){const e=this.audioWorkletNode.parameters;if(a.Pc(e.get))return e.get(t);e.forEach(((e,i)=>{if(i===t)return e}))}}},41324:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(61837);async function s(t,e){const i=(0,r.A)(e,{varName:"processor"}),s=new Blob([i],{type:"text/javascript"}),a=URL.createObjectURL(s);await t.audioWorklet.addModule(a)}},60120:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var r,s=i(134),a=i(95335),n=i(4624);!function(t){t[t.ADD=0]="ADD",t[t.REMOVE=1]="REMOVE",t[t.UPDATE_TIMESTAMP_OFFSET=2]="UPDATE_TIMESTAMP_OFFSET"}(r||(r={}));const o={mediaBufferMax:10};class l{constructor(t={}){(0,s.A)(this,"sourceBuffer",void 0),(0,s.A)(this,"operatorQueue",void 0),(0,s.A)(this,"updating",void 0),(0,s.A)(this,"lastRemoveTime",void 0),(0,s.A)(this,"paddingCallback",void 0),(0,s.A)(this,"options",void 0),(0,s.A)(this,"ending",void 0),(0,s.A)(this,"onQuotaExceededError",void 0),(0,s.A)(this,"onEnded",void 0),this.options=a.X$({},o,t),this.operatorQueue=[],this.updating=!1,this.lastRemoveTime=0,this.ending=!1}setSourceBuffer(t){this.sourceBuffer=t,this.sourceBuffer.onupdateend=()=>{this.paddingCallback&&(this.paddingCallback(),this.paddingCallback=null),this.operatorQueue&&this.operatorQueue.length?this.enqueue():(this.updating=!1,this.ending&&this.onEnded&&this.onEnded())},this.sourceBuffer.onerror=t=>{n.z3(`track update buffer error: ${t}`,"src/avrender/track/Track.ts",102)}}changeMimeType(t){this.sourceBuffer&&this.sourceBuffer.changeType(t)}enqueue(){if(this.operatorQueue.length){const t=this.operatorQueue.shift();if(t.operator===r.ADD)try{this.sourceBuffer.appendBuffer(t.buffer),this.updating=!0,t.callback&&(this.paddingCallback=t.callback)}catch(e){if(!(e instanceof DOMException&&"QuotaExceededError"===e.name))throw e;this.operatorQueue.unshift(t),this.onQuotaExceededError&&this.onQuotaExceededError(),this.updating=!1}else t.operator===r.REMOVE?(this.sourceBuffer.remove(t.start,t.end),this.updating=!0,t.callback&&(this.paddingCallback=t.callback)):t.operator===r.UPDATE_TIMESTAMP_OFFSET&&(this.sourceBuffer.timestampOffset=t.timestampOffset,t.callback&&t.callback(),this.enqueue())}}addBuffer(t,e){t?(this.operatorQueue.push({operator:r.ADD,buffer:t,callback:e}),this.updating||this.enqueue()):e&&e()}updateTimestampOffset(t,e){this.operatorQueue.push({operator:r.UPDATE_TIMESTAMP_OFFSET,timestampOffset:t,callback:e}),this.updating||this.enqueue()}removeBuffer(t,e){this.ending||(t=Math.floor(t))-this.lastRemoveTime{"use strict";i.d(e,{A:()=>n});var r=i(63939),s=i(79756),a=i(86834);function n(t){let e="";return e=86017!==r.f[15](t+4)||a.A.firefox?`audio/mp4; codecs="${(0,s.A)(t)}"`:"audio/mpeg",e}},10333:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(28875);function s(t){return`video/mp4; codecs="${(0,r.A)(t)}"`}},68960:(t,e,i)=>{"use strict";i.d(e,{A:()=>u});var r=i(134),s=i(80662),a=i.n(s),n=i(77162),o=i(74503),l=i(9599),c=i(94300),h=i(77231);class u{constructor(){(0,r.A)(this,"index",h.N_),(0,r.A)(this,"id",h.N_),(0,r.A)(this,"privData",null),(0,r.A)(this,"codecpar",(0,o.A)(new n.A,n.A)),(0,r.A)(this,"sideData",{}),(0,r.A)(this,"nbFrames",BigInt(0)),(0,r.A)(this,"metadata",{}),(0,r.A)(this,"duration",h.Dh),(0,r.A)(this,"startTime",h.Dh),(0,r.A)(this,"firstDTS",h.Dh),(0,r.A)(this,"disposition",0),(0,r.A)(this,"timeBase",(0,o.A)(l.P)),(0,r.A)(this,"sampleIndexes",[]),(0,r.A)(this,"sampleIndexesPosMap",new(a()))}destroy(){this.codecpar&&(this.codecpar.destroy(),(0,c.A)(this.codecpar),this.codecpar=null),this.timeBase&&((0,c.A)(this.timeBase),this.timeBase=null),this.sampleIndexes.length=0,this.sampleIndexesPosMap.clear()}}},95832:(t,e,i)=>{"use strict";i.d(e,{Bq:()=>u,Ij:()=>h,XC:()=>c,f7:()=>d,uF:()=>a});var r=i(77231),s=i(37246);const a={1:"Main",2:"LC",3:"LC",4:"LC",5:"HE",6:"HE"},n={96e3:0,88200:1,64e3:2,48e3:3,44100:4,32e3:5,24e3:6,22050:7,16e3:8,12e3:9,11025:10,8e3:11,7350:12},o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,r.N_,r.N_,r.N_],l=[r.N_,1,2,3,4,5,6,7];function c(t,e){if(!e&&t.sideData[1]&&(e=t.sideData[1]),e){const{profile:i,sampleRate:s,channels:a}=function(t){let e=r.N_,i=r.N_,s=r.N_;var a,n;return t.length>=2&&(e=t[0]>>3&31,i=null!==(a=o[(7&t[0])<<1|t[1]>>7])&&void 0!==a?a:48e3,s=null!==(n=l[t[1]>>3&15])&&void 0!==n?n:2),{profile:e,sampleRate:i,channels:s}}(e);t.codecpar.profile=i,t.codecpar.sampleRate=s,t.codecpar.chLayout.nbChannels=a}}function h(t){const e=n[t.sampleRate],i=t.chLayout.nbChannels,s=t.profile===r.N_?2:t.profile,a=new Uint8Array(2);return a[0]=(31&s)<<3|(14&e)>>1,a[1]=(1&e)<<7|(15&i)<<3,a}function u(t){if(t.length<7)return-1;const e=t[0]<<4|t[1]>>4;if(4095!==e)return-1;const i=1&t[1],r=(192&t[2])>>>6,s=(60&t[2])>>>2,a=(1&t[2])<<2|(192&t[3])>>>6,n=(3&t[3])<<11|t[4]<<3|(224&t[5])>>>5,c=3&t[6];let h=1===i?7:9,u=n-h;return{syncWord:e,profile:r+1,sampleRate:o[s],channels:l[a],aacFrameLength:n,numberOfRawDataBlocksInFrame:c,headerLength:h,framePayloadLength:u}}function d(t,e){function i(){const t=e.readU(2);let i=0;for(let r=0;r<=t;r++)i<<=8,i|=e.readU(8);return i}e||(e=new s.A).appendBuffer(t);const r=e.getPointer(),a={syncWord:0,profile:0,sampleRate:0,channels:0,useSameStreamMux:!1,headerLength:0,framePayloadLength:0,muxLengthBytes:0},n=e.readU(11);if(695!==n)return-1;a.syncWord=n,a.muxLengthBytes=e.readU(13);const c=1===e.readU1();if(a.useSameStreamMux=c,!c){const t=1===e.readU1();if(t&&1===e.readU1())return-1;if(t&&i(),1!==e.readU1())return-1;if(0!==e.readU(6))return-1;if(0!==e.readU(4))return-1;if(0!==e.readU(3))return-1;let r=t?i():0;const s=e.readU(5);r-=5;const n=e.readU(4);r-=4;const c=e.readU(4);if(r-=4,e.readU(3),r-=3,r>0&&e.readU(r),0!==e.readU(3))return-1;if(e.readU(8),1===e.readU1())if(t)i();else{let t=0;for(;;){t<<=8;const i=1===e.readU1();if(t+=e.readU(8),!i)break}}1===e.readU1()&&e.readU(8),a.profile=s+1,a.sampleRate=o[n],a.channels=l[c]}let h=0;for(;;){const t=e.readU(8);if(h+=t,255!==t)break}return a.framePayloadLength=h,a.headerLength=e.getPointer()-r+(8===e.getBitLeft()?0:1),a}},87518:(t,e,i)=>{"use strict";i.d(e,{R:()=>f,j:()=>s});var r=i(37246);const s=[3,4,3,7,259,263,1539,1543],a=[[64,69,96],[64,70,96],[80,87,120],[80,88,120],[96,104,144],[96,105,144],[112,121,168],[112,122,168],[128,139,192],[128,140,192],[160,174,240],[160,175,240],[192,208,288],[192,209,288],[224,243,336],[224,244,336],[256,278,384],[256,279,384],[320,348,480],[320,349,480],[384,417,576],[384,418,576],[448,487,672],[448,488,672],[512,557,768],[512,558,768],[640,696,960],[640,697,960],[768,835,1152],[768,836,1152],[896,975,1344],[896,976,1344],[1024,1114,1536],[1024,1115,1536],[1152,1253,1728],[1152,1254,1728],[1280,1393,1920],[1280,1394,1920]],n=[4,5,6,5],o=[4,6,7,6],l=[48e3,44100,32e3,0],c=[32,40,48,56,64,80,96,112,128,160,192,224,256,320,384,448,512,576,640],h=[2,1,2,3,3,4,4,5],u=[1,2,3,6],d=7;function f(t){const e=new r.A(t.length);e.appendBuffer(t);const i={syncWord:0,crc1:0,srCode:0,bitstreamId:0,bitstreamMode:0,channelMode:0,lfeOn:0,frameType:0,substreamId:0,centerMixLevel:0,surroundMixLevel:0,channelMap:0,numBlocks:0,dolbySurroundMode:0,srShift:0,sampleRate:0,bitrate:0,channels:0,frameSize:0,channelLayout:BigInt(0),ac3BitrateCode:0};if(i.syncWord=e.readU(16),2935!==i.syncWord)return-1;if(i.bitstreamId=31&e.peekU(29),i.bitstreamId>16)return-2;if(i.numBlocks=6,i.ac3BitrateCode=-1,i.centerMixLevel=5,i.surroundMixLevel=6,i.dolbySurroundMode=0,i.bitstreamId<=10){if(i.crc1=e.readU(16),i.srCode=e.readU(2),3===i.srCode)return-3;const t=e.readU(6);if(t>37)return-4;i.ac3BitrateCode=t>>1,e.readU(5),i.bitstreamMode=e.readU(3),i.channelMode=e.readU(3),2==i.channelMode?i.dolbySurroundMode=e.readU(2):(1&i.channelMode&&1!=i.channelMode&&(i.centerMixLevel=n[e.readU(2)]),4&i.channelMode&&(i.surroundMixLevel=o[e.readU(2)])),i.lfeOn=e.readU(1),i.srShift=Math.max(i.bitstreamId,8)-8,i.sampleRate=l[i.srCode]>>i.srShift,i.bitrate=1e3*c[i.ac3BitrateCode]>>i.srShift,i.channels=h[i.channelMode]+i.lfeOn,i.frameSize=2*a[t][i.srCode],i.frameType=2,i.substreamId=0}else{if(i.crc1=0,i.frameType=e.readU(2),3==i.frameType)return-5;if(i.substreamId=e.readU(3),i.frameSize=e.readU(11)+1<<1,i.frameSize{"use strict";i.d(e,{Ui:()=>n,XC:()=>a,zk:()=>s});var r=i(37246);i(83314),i(97317);const s={0:"Main",1:"High",2:"Professional"};function a(t,e){if(!e&&t.sideData[1]&&(e=t.sideData[1]),e&&e.length>=4){const i=n(e);t.codecpar.profile=i.profile,t.codecpar.level=i.level}}function n(t){const e=new r.A(t.length);e.appendBuffer(t),e.readU1(),e.readU(7);const i=e.readU(3),s=e.readU(5),a=e.readU1();let n=e.readU1()?10:8;return e.readU1()&&(n=12),{profile:i,level:s,tier:a,bitDepth:n,monochrome:e.readU1(),chromaSubsamplingX:e.readU1(),chromaSubsamplingY:e.readU1(),chromaSamplePosition:e.readU(2)}}},62815:(t,e,i)=>{"use strict";i.d(e,{Jk:()=>k,KD:()=>I,MB:()=>A,S1:()=>x,XC:()=>_,ci:()=>T,oT:()=>w,tZ:()=>y,wf:()=>S});var r=i(63939),s=i(50932),a=i(72739),n=i(729),o=i(31865),l=i(37246),c=i(4624),h=i(14686),u=i(71517),d=i(60264),f=i(37837),p=i(23991),m=i(39381);const g="src/avutil/codecs/h264.ts",v=3,y={66:"Constrained Baseline",77:"Main",100:"High",110:"High10",122:"High422",244:"High444"};function A(t){const e=new o.A(t);e.skip(5);const i=[],r=[],s=[],a=31&e.readUint8();for(let t=0;t4){e.skip(3);const t=e.readUint8();if(t>0)for(let i=0;i32&&(c.R8(`h264 metadata's sps max length is 32, but get ${t.length}`,g,210),t=t.slice(0,32)),t.length>256&&(c.R8(`h264 metadata's pps max length is 256, but get ${t.length}`,g,214),t=t.slice(0,256));let r=7;r=t.reduce(((t,e)=>t+2+e.length),r),r=e.reduce(((t,e)=>t+2+e.length),r);const s=t[0],o=S(s);66!==o.profile&&77!==o.profile&&88!==o.profile&&(r+=4,i.length&&(r=i.reduce(((t,e)=>t+2+e.length),r)));const l=new Uint8Array(r),h=new n.A(l);return h.writeUint8(1),h.writeUint8(s[1]),h.writeUint8(s[2]),h.writeUint8(s[3]),h.writeUint8(252|v),h.writeUint8(224|31&t.length),a.__(t,(t=>{h.writeUint16(t.length),h.writeBuffer(t)})),h.writeUint8(e.length),a.__(e,(t=>{h.writeUint16(t.length),h.writeBuffer(t)})),66!==o.profile&&77!==o.profile&&88!==o.profile&&(h.writeUint8(252|o.chromaFormatIdc),h.writeUint8(248|o.bitDepthLumaMinus8),h.writeUint8(248|o.bitDepthChromaMinus8),i.length&&a.__(i,(t=>{h.writeUint16(t.length),h.writeBuffer(t)}))),l}function x(t){let e=(0,d.py)(t);if(e.length>1){const t=[],i=[],r=[];if(e.forEach((e=>{const s=31&e[0];7===s?t.push(e):8===s?i.push(e):13===s&&r.push(e)})),t.length&&i.length)return b(t,i,r)}}function w(t){let e,i=(0,d.py)(t),r=!1;if(i.length>1){const t=[],r=[],s=[];i.forEach((e=>{const i=31&e[0];7===i?t.push(e):8===i?r.push(e):13===i&&s.push(e)})),t.length&&r.length&&(e=b(t,r,s)),i=i.filter((t=>{const e=31&t[0];return 9!==e&&8!==e&&7!==e&&13!==e}))}const s=i.reduce(((t,e)=>t+v+1+e.length),0),o=(0,f.sY)(s),l=(0,h.s3)(o,s),c=new n.A(l);return a.__(i,(t=>{3===v?c.writeUint32(t.length):2===v?c.writeUint24(t.length):1===v?c.writeUint16(t.length):c.writeUint8(t.length),c.writeBuffer(t.subarray(0)),5==(31&t[0])&&(r=!0)})),{bufferPointer:o,length:s,key:r,extradata:e}}function k(t,e){var i;if(!(1&r.f[15](t+36)))return;const s=(0,u.iI)(t);if((0,d.Bs)(s))return;const a=null!==(i=e.metadata.naluLengthSizeMinusOne)&&void 0!==i?i:v;let n=[],l=[],c=[],p=[];const m=new o.A(s);for(;m.remainingSize()>0;){let t=0;t=3===a?m.readUint32():2===a?m.readUint24():1===a?m.readUint16():m.readUint8();const e=s.subarray(Number(BigInt.asIntN(32,m.getPos())),Number(BigInt.asIntN(32,m.getPos()))+t);m.skip(t);const i=31&e[0];7===i?n.push(e):8===i?l.push(e):13===i?c.push(e):p.push(e)}if(n.length||l.length){const e=b(n,l,c),i=(0,f.sY)(e.length);(0,h.lW)(i,e.length,e),(0,u.Ow)(t,1,i,e.length)}}function T(t,e=!1){if(!(1&r.f[15](t+36)||e))return;const i=(0,u.iI)(t);if(!(0,d.Bs)(i))return;let a=(0,d.py)(i);if(a.length>1){const e=[],i=[],n=[];if(a.forEach((t=>{const r=31&t[0];7===r?e.push(t):8===r?i.push(t):13===r&&n.push(t)})),e.length&&i.length){const a=b(e,i,n),o=(0,f.sY)(a.length);(0,h.lW)(o,a.length,a),(0,u.Ow)(t,1,o,a.length),s.M[15](t+36,1|r.f[15](t+36))}}}function _(t,e){if(!e&&t.sideData[1]&&(e=t.sideData[1]),e&&e.length>=6){t.metadata.naluLengthSizeMinusOne=3&e[4];const{spss:i}=A(e);if(i.length){const{profile:e,level:r,width:s,height:a}=S(i[0]);t.codecpar.profile=e,t.codecpar.level=r,t.codecpar.width=s,t.codecpar.height=a}}}function I(t,e=4){if(2===r.f[15](t+80))return(0,d.py)((0,h.s3)(r.f[20](t+24),r.f[15](t+28))).some((t=>5==(31&t[0])));{const i=r.f[15](t+28);let s=0;for(;s{"use strict";i.d(e,{HL:()=>v,Jk:()=>x,KD:()=>T,S1:()=>A,XC:()=>k,ZU:()=>I,ci:()=>w,dT:()=>m,oT:()=>b,wf:()=>_});var r=i(63939),s=i(50932),a=i(72739),n=i(729),o=i(31865),l=i(37246),c=i(14686),h=i(60264),u=i(71517),d=i(37837),f=i(23991),p=i(39381);const m={1:"Main",2:"Main10",3:"MainStillPicture",4:"Main444"},g=3;function v(t){const e=new o.A(t,!0);e.skip(22);let i=[],r=[],s=[];const a=e.readUint8();for(let t=0;tt+2+e.length),s)),e.length&&(s+=3,s=e.reduce(((t,e)=>t+2+e.length),s)),i.length&&(s+=3,s=i.reduce(((t,e)=>t+2+e.length),s));const o=new Uint8Array(s),l=new n.A(o,!0),c=_(r);l.writeUint8(1),l.writeUint8(r[1]),l.writeUint8(r[2]),l.writeUint8(r[3]),l.writeUint8(r[4]),l.writeUint8(r[5]),l.writeUint8(r[6]),l.writeUint8(r[7]),l.writeUint8(r[8]),l.writeUint8(r[9]),l.writeUint8(r[10]),l.writeUint8(r[11]),l.writeUint8(c.level),l.writeUint8(1020),l.writeUint8(0),l.writeUint8(16320),l.writeUint8(16320|c.chroma_format_idc),l.writeUint8(8160|c.bit_depth_luma_minus8),l.writeUint8(8160|c.bit_depth_chroma_minus8),l.writeUint16(0),l.writeUint8(8|(1&r[0])<<2|g);let h=0;return t.length&&h++,e.length&&h++,i.length&&h++,l.writeUint8(h),t.length&&(l.writeUint8(160),l.writeUint16(t.length),a.__(t,(t=>{l.writeUint16(t.length),l.writeBuffer(t)}))),e.length&&(l.writeUint8(161),l.writeUint16(e.length),a.__(e,(t=>{l.writeUint16(t.length),l.writeBuffer(t)}))),i.length&&(l.writeUint8(162),l.writeUint16(i.length),a.__(i,(t=>{l.writeUint16(t.length),l.writeBuffer(t)}))),o}function A(t){let e=(0,h.py)(t);if(e.length>=2){const t=[],i=[],r=[];if(e.forEach((e=>{const s=e[0]>>>1&63;32===s?t.push(e):33===s?i.push(e):34===s&&r.push(e)})),i.length&&r.length)return y(t,i,r)}}function b(t){let e,i=!1,r=(0,h.py)(t);if(r.length>=2){const t=[],i=[],s=[];r.forEach((e=>{const r=e[0]>>>1&63;32===r?t.push(e):33===r?i.push(e):34===r&&s.push(e)})),i.length&&s.length&&(e=y(t,i,s),r=r.filter((t=>{const e=t[0]>>>1&63;return 32!==e&&33!==e&&34!==e&&35!==e})))}const s=r.reduce(((t,e)=>t+g+1+e.length),0),o=(0,d.sY)(s),l=(0,c.s3)(o,s),u=new n.A(l);return a.__(r,(t=>{3===g?u.writeUint32(t.length):2===g?u.writeUint24(t.length):1===g?u.writeUint16(t.length):u.writeUint8(t.length),u.writeBuffer(t.subarray(0));const e=t[0]>>>1&63;19!==e&&20!==e&&21!==e||(i=!0)})),{bufferPointer:o,length:s,extradata:e,key:i}}function x(t,e){var i;if(!(1&r.f[15](t+36)))return;const s=(0,u.iI)(t);if((0,h.Bs)(s))return;const a=null!==(i=e.metadata.naluLengthSizeMinusOne)&&void 0!==i?i:g;let n=[],l=[],f=[];const p=new o.A(s);for(;p.remainingSize()>0;){let t=0;t=3===a?p.readUint32():2===a?p.readUint24():1===a?p.readUint16():p.readUint8();const e=s.subarray(Number(BigInt.asIntN(32,p.getPos())),Number(BigInt.asIntN(32,p.getPos()))+t);p.skip(t);const i=e[0]>>>1&63;33===i?l.push(e):34===i?f.push(e):32===i&&n.push(e)}if(l.length||f.length||n.length){const e=y(n,l,f),i=(0,d.sY)(e.length);(0,c.lW)(i,e.length,e),(0,u.Ow)(t,1,i,e.length)}}function w(t,e=!1){if(!(1&r.f[15](t+36)||e))return;const i=(0,u.iI)(t);if(!(0,h.Bs)(i))return;let a=(0,h.py)(i);if(a.length>2){const e=[],i=[],n=[];if(a.forEach((t=>{const r=t[0]>>>1&63;32===r?e.push(t):33===r?i.push(t):34===r&&n.push(t)})),e.length&&i.length&&n.length){const a=y(e,i,n),o=(0,d.sY)(a.length);(0,c.lW)(o,a.length,a),(0,u.Ow)(t,1,o,a.length),s.M[15](t+36,1|r.f[15](t+36))}}}function k(t,e){if(!e&&t.sideData[1]&&(e=t.sideData[1]),e&&e.length>=6){t.metadata.naluLengthSizeMinusOne=3&e[21];const{spss:i}=v(e);if(i.length){const{profile:e,level:r,width:s,height:a}=_(i[0]);t.codecpar.profile=e,t.codecpar.level=r,t.codecpar.width=s,t.codecpar.height=a}}}function T(t,e=4){if(2===r.f[15](t+80))return(0,h.py)((0,c.s3)(r.f[20](t+24),r.f[15](t+28))).some((t=>{const e=t[0]>>>1&63;return 20===e||19===e}));{const i=r.f[15](t+28);let s=0;for(;s>>1&63;if(20===i||19===i)return!0;s+=4===e?p.Sg(r.f[20](t+24)+s):3===e?p.ht(r.f[20](t+24)+s):2===e?p.yd(r.f[20](t+24)+s):p.r8(r.f[20](t+24)+s),s+=e}return!1}}function _(t){if(!t||t.length<3)return;let e=0;0===t[0]&&0===t[1]&&0===t[2]&&1===t[3]&&(e=4);let i=0,r=0,s=0,a=0,n=0,o=0,c=1,u=0,d=0,p=0,m=0;const g=(0,h.BN)(t.subarray(e)),v=new l.A(g.length);v.appendBuffer(g),v.readU1(),v.readU(6),v.readU(6),v.readU(3),v.readU(4);const y=v.readU(3);v.readU1();let A=0;if(y<=6){u=v.readU(2),d=v.readU1(),i=v.readU(5),p=v.readU(32),m=v.readU(48),r=v.readU(8);const t=new Array(6),e=new Array(6);for(let i=0;i0)for(let t=y;t<8;t++)v.readU(2);for(let i=0;i>_,P=a+(1<<_)-1>>_;return{profile:i,level:r,width:s,height:a,chroma_format_idc:c,bit_depth_luma_minus8:n,bit_depth_chroma_minus8:o,general_profile_space:u,general_tier_flag:d,general_profile_compatibility_flags:p,constraint_flags:m,separate_colour_plane_flag:A,log2_min_cb_size:x,log2_diff_max_min_coding_block_size:w,log2_min_tb_size:k,log2_diff_max_min_transform_block_size:T,log2_max_trafo_size:T+k,log2_ctb_size:_,log2_min_pu_size:I,ctb_width:S,ctb_height:P,ctb_size:S*P,min_cb_width:s>>x,min_cb_height:a>>x,min_tb_width:s>>k,min_tb_height:a>>k,min_pu_width:s>>I,min_pu_height:a>>I,log2_max_poc_lsb:b}}function I(t){if(!t||t.length<3)return;let e=0;0===t[0]&&0===t[1]&&0===t[2]&&1===t[3]&&(e=4);const i=(0,h.BN)(t.subarray(e)),r=new l.A(i.length);return r.appendBuffer(i),{pps_pic_parameter_set_id:f.xb(r),pps_seq_parameter_set_id:f.xb(r),dependent_slice_segment_flag:r.readU1(),output_flag_present_flag:r.readU1(),num_extra_slice_header_bits:r.readU(3)}}},64093:(t,e,i)=>{"use strict";i.d(e,{Au:()=>y,He:()=>A,XC:()=>b,Y2:()=>m,hG:()=>g,oz:()=>v});var r=i(77231);const s=[44100,48e3,32e3,0],a=[22050,24e3,16e3,0],n=[11025,12e3,8e3,0],o=[0,1152,1152,384],l=[0,576,1152,384],c=[0,576,1152,384],h=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],u=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],d=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],f=[0,32,48,56,64,80,96,112,128,144,160,176,192,224,256,-1],p=[0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,-1];function m(t,e){switch(t){case 0:return n[e];case 2:return a[e];case 3:return s[e]}return r.N_}function g(t,e){switch(t){case 0:return c[e];case 2:return l[e];case 3:return o[e]}return r.N_}function v(t,e,i){switch(e){case 1:switch(t){case 0:case 2:return p[i];case 3:return d[i]}break;case 2:switch(t){case 0:case 2:return p[i];case 3:return u[i]}case 3:switch(t){case 0:case 2:return f[i];case 3:return h[i]}}return r.N_}function y(t){switch(t){case 1:return 34;case 2:return 33;case 3:return 32}return r.N_}const A={32:"Layer1",33:"Layer2",34:"Layer3"};function b(t,e){if(e&&e.length>=4){const i=e[1]>>>3&3,r=(6&e[1])>>1,s=(12&e[2])>>>2,a=3&~(e[3]>>>6)?2:1,n=y(r),o=m(i,s);t.codecpar.profile=n,t.codecpar.sampleRate=o,t.codecpar.chLayout.nbChannels=a}}},97077:(t,e,i)=>{"use strict";i.d(e,{Ui:()=>a,XC:()=>s});var r=i(37246);function s(t,e){if(!e&&t.sideData[1]&&(e=t.sideData[1]),e&&e.length>=6){const i=a(e);t.codecpar.profile=i.profile,t.codecpar.level=i.level}}function a(t){const e=new r.A(t.length);return e.appendBuffer(t.subarray(4)),{profile:e.readU(8),level:e.readU(8),bitDepth:e.readU(4),chromaSubsampling:e.readU(3),fullRangeFlag:e.readU1(),colorPrimaries:e.readU(8),colorTrc:e.readU(8),colorSpace:e.readU(8)}}},82014:(t,e,i)=>{"use strict";i.d(e,{Ui:()=>n,XC:()=>a,wN:()=>s}),i(9599);var r=i(37246);i(77231),i(97317),i(729);const s={0:"Profile0",1:"Profile1",2:"Profile2",3:"Profile3"};function a(t,e){if(!e&&t.sideData[1]&&(e=t.sideData[1]),e&&e.length>=6){const i=n(e);t.codecpar.profile=i.profile,t.codecpar.level=i.level}}function n(t){const e=new r.A(t.length);return e.appendBuffer(t),{profile:e.readU(8),level:e.readU(8),bitDepth:e.readU(4),chromaSubsampling:e.readU(3),fullRangeFlag:e.readU1(),colorPrimaries:e.readU(8),colorTrc:e.readU(8),colorSpace:e.readU(8)}}},59166:(t,e,i)=>{"use strict";i.d(e,{Jk:()=>x,KD:()=>_,QA:()=>k,S1:()=>A,Ui:()=>S,XC:()=>T,ci:()=>w,oT:()=>b,wf:()=>I});var r=i(63939),s=i(50932),a=i(72739),n=i(729),o=i(31865),l=i(37246),c=i(14686),h=i(60264),u=i(71517),d=i(37837),f=i(23991),p=i(83314),m=i(39381);const g=3;function v(t){const e=t.readU(9),i=t.readU(3),r=t.readU(2),s=t.readU(2),a=t.readU(3);t.readU(5),t.readU(2);const n=t.readU(6),o=t.readU(7),l=t.readU(1),c=t.readU(8),h=t.readU(1),u=t.readU(1),d=[],f=[];if(n){for(let e=0;e1){let e=0;for(let r=i-2;r>=0;--r)e|=t.readU(1)<1;++e)t.readU(1);for(let r=i-2;r>=0;--r)e&1<1){let e=0;for(let i=t.spsMaxSublayersMinus1-1;i>=0;i--)e=e<<1|t.ptlSublayerLevelPresentFlag[i];i.writeU(t.spsMaxSublayersMinus1,e);for(let e=t.spsMaxSublayersMinus1+1;e<=8&&t.spsMaxSublayersMinus1>0;++e)i.writeU1(0);for(let e=t.spsMaxSublayersMinus1-1;e>=0;e--)t.ptlSublayerLevelPresentFlag[e]&&i.writeU(8,t.sublayerLevelIdc[e])}i.writeU(8,t.generalSubProfileIdc.length);for(let e=0;et+2+e.length),o)),e.length&&(o+=3,o=e.reduce(((t,e)=>t+2+e.length),o)),i.length&&(o+=3,o=i.reduce(((t,e)=>t+2+e.length),o));const l=new Uint8Array(o),c=new n.A(l,!0);c.writeUint8(g<<1|(s?1:0)|248),s&&c.writeBuffer(s);let h=0;return t.length&&h++,e.length&&h++,i.length&&h++,c.writeUint8(h),t.length&&(c.writeUint8(142),c.writeUint16(t.length),a.__(t,(t=>{c.writeUint16(t.length),c.writeBuffer(t)}))),e.length&&(c.writeUint8(143),c.writeUint16(e.length),a.__(e,(t=>{c.writeUint16(t.length),c.writeBuffer(t)}))),i.length&&(c.writeUint8(144),c.writeUint16(i.length),a.__(i,(t=>{c.writeUint16(t.length),c.writeBuffer(t)}))),l}function A(t){let e=(0,h.py)(t);if(e.length>=2){const t=[],i=[],r=[];if(e.forEach((e=>{const s=e[1]>>>3&31;14===s?t.push(e):15===s?i.push(e):16===s&&r.push(e)})),i.length&&r.length)return y(t,i,r)}}function b(t){let e,i=!1,r=(0,h.py)(t);if(r.length>=2){const t=[],i=[],s=[];r.forEach((e=>{const r=e[1]>>>3&31;14===r?t.push(e):15===r?i.push(e):16===r&&s.push(e)})),i.length&&s.length&&(e=y(t,i,s),r=r.filter((t=>{const e=t[1]>>>3&31;return 14!==e&&15!==e&&16!==e&&20!==e})))}const s=r.reduce(((t,e)=>t+g+1+e.length),0),o=(0,d.sY)(s),l=(0,c.s3)(o,s),u=new n.A(l);return a.__(r,(t=>{3===g?u.writeUint32(t.length):2===g?u.writeUint24(t.length):1===g?u.writeUint16(t.length):u.writeUint8(t.length),u.writeBuffer(t.subarray(0));const e=t[1]>>>3&31;8!==e&&7!==e&&9!==e&&10!==e||(i=!0)})),{bufferPointer:o,length:s,extradata:e,key:i}}function x(t,e){var i;if(!(1&r.f[15](t+36)))return;const s=(0,u.iI)(t);if((0,h.Bs)(s))return;const a=null!==(i=e.metadata.naluLengthSizeMinusOne)&&void 0!==i?i:g;let n=[],l=[],f=[];const p=new o.A(s);for(;p.remainingSize()>0;){let t=0;t=3===a?p.readUint32():2===a?p.readUint24():1===a?p.readUint16():p.readUint8();const e=s.subarray(Number(BigInt.asIntN(32,p.getPos())),Number(BigInt.asIntN(32,p.getPos()))+t);p.skip(t);const i=e[1]>>>3&31;15===i?l.push(e):16===i?f.push(e):14===i&&n.push(e)}if(l.length||f.length||n.length){const e=y(n,l,f),i=(0,d.sY)(e.length);(0,c.lW)(i,e.length,e),(0,u.Ow)(t,1,i,e.length)}}function w(t,e=!1){if(!(1&r.f[15](t+36)||e))return;const i=(0,u.iI)(t);if(!(0,h.Bs)(i))return;let a=(0,h.py)(i);if(a.length>2){const e=[],i=[],n=[];if(a.forEach((t=>{const r=t[1]>>>3&31;14===r?e.push(t):15===r?i.push(t):16===r&&n.push(t)})),e.length&&i.length&&n.length){const a=y(e,i,n),o=(0,d.sY)(a.length);(0,c.lW)(o,a.length,a),(0,u.Ow)(t,1,o,a.length),s.M[15](t+36,1|r.f[15](t+36))}}}function k(t,e){const{profile:i,level:r,width:s,height:a}=I(e);t.codecpar.profile=i,t.codecpar.level=r,t.codecpar.width=s,t.codecpar.height=a}function T(t,e){if(!e&&t.sideData[1]&&(e=t.sideData[1]),e&&e.length>=6){t.metadata.naluLengthSizeMinusOne=e[0]>>>1&3;const{spss:i}=function(t){const e=new o.A(t,!0);if(1&e.readUint8()){const i=new l.A;i.appendBuffer(t.subarray(1)),v(i),e.skip(i.getPointer())}let i=[],r=[],s=[];const a=e.readUint8();for(let t=0;t{const e=t[1]>>>3&31;return 8===e||7===e}));{const i=r.f[15](t+28);let s=0;for(;s>>3&31;if(8===i||7===i)return!0;s+=4===e?m.Sg(r.f[20](t+24)+s):3===e?m.ht(r.f[20](t+24)+s):2===e?m.yd(r.f[20](t+24)+s):m.r8(r.f[20](t+24)+s),s+=e}return!1}}function I(t){if(!t||t.length<3)return;let e=0;0===t[0]&&0===t[1]&&0===t[2]&&1===t[3]&&(e=4);let i=0,r=0,s=0,a=0,n=0,o=1,c=0,u=0,d=0;const p=[],m=[],g=[],v=[],y=(0,h.BN)(t.subarray(e)),A=new l.A(y.length);A.appendBuffer(y),A.readU1(),A.readU1(),A.readU(6),A.readU(5),A.readU(3),A.readU(8);const b=A.readU(3);o=A.readU(2);const x=A.readU(2);if(A.readU(1)){if(i=A.readU(7),c=A.readU(1),r=A.readU(8),u=A.readU(1),d=A.readU(1),A.readU(1)){for(let t=0;t<8;t++)p[t]=A.readU(8);p[8]=A.readU(7);const t=A.readU(8);A.readU(t)}A.skipPadding();for(let t=b-1;t>=0;t--)m[t]=A.readU(1);A.skipPadding();for(let t=b-1;t>=0;t--)m[t]&&(g[t]=A.readU(8));const t=A.readU(8);if(t)for(let e=0;e0&&(c=A.readU1(),l=A.readU1());for(let e=0;t>0&&e<=t;e++)l&&0!=e||(e>0&&w>i&&A.readU(a),e>0&&k>i&&A.readU(n),ei&&A.readU(a),ei&&A.readU(n)),c||A.readU(2);if(o=f.xb(A)+1,A.readU(1)&&A.readU(1))for(let e=0;e<=t;e++)A.readU(o)}n=f.xb(A),A.readU(1),A.readU(1);const T=A.readU(4),_=A.readU(1);let I=0;_&&(I=f.xb(A));const S=[],P=A.readU(2);for(let t=0;t<8*P;t++)S[t]=A.readU(1);return{profile:i,level:r,width:s,height:a,chromaFormatIdc:o,bitDepthMinus8:n,generalProfileSpace:0,tierFlag:c,generalConstraintInfo:p,generalSubProfileIdc:v,ptlFrameOnlyConstraintFlag:u,ptlMultilayerEnabledFlag:d,spsMaxSublayersMinus1:b,ptlSublayerLevelPresentFlag:m,sublayerLevelIdc:g,sps_log2_max_pic_order_cnt_lsb_minus4:T,sps_poc_msb_cycle_flag:_,sps_poc_msb_cycle_len_minus1:I,sps_num_extra_ph_bytes:P,sps_extra_ph_bit_present_flag:S}}function S(t){0===t[0]&&0===t[1]&&0===t[2]&&1===t[3]&&(t=A(t));const e=new l.A;return e.appendBuffer(t),1&e.readU(8)?v(e):{}}},77231:(t,e,i)=>{"use strict";i.d(e,{Dh:()=>s,KR:()=>c,N_:()=>a,SF:()=>n,WT:()=>l,f7:()=>f,go:()=>u,i0:()=>h,qs:()=>o,zg:()=>d});var r=i(9599);const s=-BigInt(1),a=-1,n=1e6,o=1e3,l=BigInt(2208988800)*BigInt(1e6),c=new r.P({den:n,num:1}),h=new r.P({den:o,num:1}),u=(new r.P({den:1,num:1}),2147483647),d=65535,f=4294967295},9705:(t,e,i)=>{"use strict";i.d(e,{E$:()=>r,LR:()=>s,LT:()=>c,NU:()=>u,OY:()=>l,UY:()=>a,gR:()=>n,lh:()=>o,r8:()=>h});const r=-1,s=-2,a=-3,n=-4,o=-5,l=-6,c=-7,h=-8,u=-9},49032:(t,e,i)=>{"use strict";async function r(t,e=-1){let i=await t.peekString(8);if(/^FLV/.test(i))return 0;if(/^DKIF/.test(i))return 5;if(/^ftyp/.test(i.slice(4,8)))return 1;if(/^OggS/.test(i))return 4;if(/^ID3/.test(i))return 14;if(/^fLaC/.test(i))return 17;if(/^RIFF/.test(i)){const e=(await t.peekString(12)).slice(8);if(/^WAVE/.test(e))return 16}else{if(/^ADIF/.test(i))return 15;if(440786851===await t.peekUint32())return 8;{const e=await t.peekBuffer(2);switch(e[0]){case 86:if(!(224&~e[1]))return 15;break;case 255:if(240==(246&e[1]))return 15;if([242,244,246,250,252].includes(254&e[1]))return 14}}}return e}i.d(e,{A:()=>r})},364:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var r=i(62751),s=i(92647),a=i(95335),n=i(50011),o=i(8507);async function l(t,e="",i={}){let l,c="",h={url:t};if(/^rtsp/.test(t)||/^rtmp/.test(t)){/^rtsp/.test(t)?c="rtsp":/^rtmp/.test(t)&&(c="rtmp"),l=2;const e=o.qg(t).protocol.split("+")[1]||"wss";"wss"===e||"ws"===e?l=2:"webtransport"===e&&(l=3),h.url=h.url.replace(/^\S+:\/\//,e+"://"),"rtmp"===c&&(h.subProtocol=l,l=6)}else{var u;c=e||o.qg(t).file.split(".").pop(),c||(c=await async function(t,e={}){const i={method:"GET",headers:{},mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};let r;e.headers&&a.__(e.headers,((t,e)=>{i.headers[e]=t})),e.credentials&&(i.credentials=e.credentials),e.referrerPolicy&&(i.referrerPolicy=e.referrerPolicy),"function"==typeof AbortController&&(r=new AbortController,i.signal=r.signal);const o=await fetch(t,i);if(o.ok&&o.status>=200&&o.status<=299){const t=o.body.getReader(),e=[];let i=0;for(;;){let r=await t.read();if(r.done)break;if(i+=r.value.length,e.push(r.value),i>=100)break}if(r&&r.abort(),e.length){const t=e.length>1?(0,s.A)(Uint8Array,e):e[0];if(t.length){const e=n.decode(t.subarray(0,100));if(/<\?xml/.test(e)){if(e.indexOf("-1)return"mpd"}else if(/#EXTM3U/.test(e))return"m3u8"}}}return""}(t,i)),l=null!==(u=r.$$[c])&&void 0!==u?u:0}return{type:l,ext:c,info:h}}},36204:(t,e,i)=>{"use strict";i.d(e,{t:()=>l});var r=i(63939),s=i(50932),a=i(56024),n=i(66788),o=i(14686);function l(t,e=0){0===e&&(e=(0,a.FP)()),s.M[15](e+152,t.sampleRate),s.M[15](e+76,t.numberOfFrames),s.M[15](e+292,t.numberOfChannels),s.M[15](e+80,function(t){switch(t){case"u8":return 0;case"s16":return 1;case"s32":return 2;case"f32":return 3;case"u8-planar":return 5;case"s16-planar":return 6;case"s32-planar":return 7;case"f32-planar":return 8;default:throw new Error("not support")}}(t.format)),s.M[17](e+104,BigInt(Math.floor(t.timestamp))),(0,a.rh)(e);const i=(0,n.K0)(r.f[15](e+80))?r.f[15](e+292):1;for(let s=0;s{"use strict";i.d(e,{A:()=>a});var r=i(63939),s=i(14686);function a(t,e){const i=Number(null!=e?e:r.f[17](t+8)),a=1&r.f[15](t+36);return new EncodedAudioChunk({type:a?"key":"delta",timestamp:i,data:(0,s.s3)(r.f[20](t+24),r.f[15](t+28))})}},28917:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(63939),s=i(14686);function a(t,e){const i=Number(null!=e?e:r.f[17](t+8)),a=1&r.f[15](t+36);return new EncodedVideoChunk({type:a?"key":"delta",timestamp:i,data:(0,s.s3)(r.f[20](t+24),r.f[15](t+28))})}},94561:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var r=i(26429),s=i(76045),a=i(67672),n=i(86834);async function o(t,e=!1){let i;return a.Yj(t)||a.sv(t)?(i=await(0,s.A)({source:t}),r.USE_THREADS&&e&&(i.threadModule=await(0,s.A)({source:n.A.firefox?t:i.buffer},{child:!0})),delete i.buffer):i=t,i}},79756:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(63939),s=i(62751);function a(t){const e=r.f[15](t+4);let i=r.f[15](t+48),a=s.os[e];return 86018===e&&(a=`${a}.${i}`),a||"unknown"}},39365:(t,e,i)=>{"use strict";i.d(e,{C:()=>s});var r=i(86834);function s(t){return t?!r.A.chrome||r.A.checkVersion(r.A.majorVersion,"94",!0)?"prefer-hardware":"allow":!r.A.chrome||r.A.checkVersion(r.A.majorVersion,"94",!0)?"prefer-software":"deny"}},28875:(t,e,i)=>{"use strict";i.d(e,{A:()=>f});var r=i(63939),s=i(62751),a=i(21477),n=i(97077),o=i(82014),l=i(59166),c=i(20525),h=i(77231),u=i(14686),d=i(90932);function f(t,e){const i=r.f[15](t+4);let f=r.f[15](t+48),p=r.f[15](t+52);!e&&0!==r.f[20](t+12)&&r.f[15](t+16)&&(e=(0,u.s3)(r.f[20](t+12),r.f[15](t+16)));let m=s.os[i],g="";if(27===i)110===f&&(f=100),g=c.GP("%s.%02x00%02x",m,255&f,255&p);else if(173===i){var v;let t=0,i=0,r=0,s=0;(null===(v=e)||void 0===v?void 0:v.length)>13&&(t=e[1]>>>6&3,r=e[1]>>>5&1,i=e[2]|e[3]<<8|e[4]<<16|e[5]<<24,s=240&e[6]);const a={0:"",1:"A",2:"B",3:"C"};g=c.GP("%s.%s%d.%x.%s%d.%x",m,a[t],f,i,0===r?"L":"H",p,s)}else if(196===i){var y;let t=0;if((null===(y=e)||void 0===y?void 0:y.length)>13&&(t=1&e[5]),g=c.GP("%s.%d.%s%d",m,f,0===t?"L":"H",p),e){const t=l.Ui(e);if(t.generalConstraintInfo.length){let e=t.generalConstraintInfo.length-1;for(;e>0&&0===t.generalConstraintInfo[e];)e--;const i=t.generalConstraintInfo.slice(0,e+1);i.length&&(g+=`.C${d.l(new Uint8Array(i),!1)}`)}t.generalSubProfileIdc.length&&(g+=`.S${t.generalSubProfileIdc.map((t=>t.toString(16))).join("+")}`),g+=`.O${t.olsIdx}+${t.numSublayers}`}}else if(225===i)if(e){const t=a.Ui(e);g=c.GP("%s.%d.%02d%s.%02d.%d.%d%d%d",m,t.profile,t.level,t.tier?"H":"M",t.bitDepth,t.monochrome,t.chromaSubsamplingX,t.chromaSubsamplingY,t.chromaSamplePosition)}else g=c.GP("%s.%d.%02dM.08",m,f,p);else if(139===i)if(e){const t=n.Ui(e);g=c.GP("%s.%02d.%02d.%02d",m,t.profile,t.level,t.bitDepth)}else g=f!==h.N_&&p!==h.N_?c.GP("%s.%02d.%02d.08",m,f,p):m;else if(167===i)if(e){const t=o.Ui(e);g=c.GP("%s.%02d.%02d.%02d.%02d.%02d.%02d.%02d.%02d",m,t.profile,t.level,t.bitDepth,t.chromaSubsampling,t.colorPrimaries,t.colorTrc,t.colorSpace,t.fullRangeFlag)}else g=f!==h.N_&&p!==h.N_?c.GP("%s.%02d.%02d.08.00",m,f,p):c.GP("%s.%02d.%02d.08.00",m,0,40);else g=m||"unknown";return g}},93147:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(63939),s=i(97317);function a(t){if(0!==r.f[15](t))return!1;const e=s.g[r.f[15](t+28)];return e&&128&e.flags}},24310:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(63939),s=i(97317);function a(t){if(0!==r.f[15](t))return!1;const e=s.g[r.f[15](t+28)];return!(!e||e.comp[0].depth<=8||18!==r.f[15](t+92)&&16!==r.f[15](t+92))}},16041:(t,e,i)=>{"use strict";i.d(e,{A:()=>c});var r=i(134),s=i(50932),a=(i(55833),i(40046)),n=i(73783),o=i(37837),l=i(56024);class c{constructor(t,e){(0,r.A)(this,"list",void 0),(0,r.A)(this,"mutex",void 0),this.list=t,this.mutex=e}alloc(){let t=this.list.find((t=>-1===a.p_(t+320,-1,1,16,2)),20);return t||(t=(0,o.Gy)(328),(0,l._h)(t),s.M[16](t+320,1),n.s2(this.mutex),this.list.push(t,20),n.Tl(this.mutex)),t}release(t){a.Hh(t+320,16,2)<=0||1===a.jb(t+320,1,16,2)&&((0,l.to)(t),a.M_(t+320,-1,16,2))}}},47442:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var r=i(134),s=i(50932),a=(i(10278),i(40046)),n=i(73783),o=i(37837);class l{constructor(t,e){(0,r.A)(this,"list",void 0),(0,r.A)(this,"mutex",void 0),this.list=t,this.mutex=e}alloc(){let t=this.list.find((t=>-1===a.p_(t+40,-1,1,16,2)),20);return t||(t=(0,o.Gy)(48),s.M[16](t+40,1),n.s2(this.mutex),this.list.push(t,20),n.Tl(this.mutex)),t}release(t){a.Hh(t+40,16,2)<=0||1===a.jb(t+40,1,16,2)&&a.M_(t+40,-1,16,2)}}},84290:(t,e,i)=>{"use strict";i.d(e,{A:()=>c});var r=i(134),s=i(50932),a=i(40046),n=i(73783),o=i(37837),l=(i(47958),i(71517));class c{constructor(t,e){(0,r.A)(this,"list",void 0),(0,r.A)(this,"mutex",void 0),this.list=t,this.mutex=e}alloc(){let t=this.list.find((t=>-1===a.p_(t+88,-1,1,16,2)),20);return t||(t=(0,o.Gy)(96),(0,l.Pd)(t),s.M[16](t+88,1),n.s2(this.mutex),this.list.push(t,20),n.Tl(this.mutex)),t}release(t){a.Hh(t+88,16,2)<=0||1===a.jb(t+88,1,16,2)&&((0,l.Up)(t),a.M_(t+88,-1,16,2))}}},97317:(t,e,i)=>{"use strict";i.d(e,{g:()=>r});const r={0:{nbComponents:3,log2ChromaW:1,log2ChromaH:1,flags:16,comp:[{plane:0,step:1,offset:0,shift:0,depth:8},{plane:1,step:1,offset:0,shift:0,depth:8},{plane:2,step:1,offset:0,shift:0,depth:8}]},12:{nbComponents:3,log2ChromaW:1,log2ChromaH:1,flags:16,comp:[{plane:0,step:1,offset:0,shift:0,depth:8},{plane:1,step:1,offset:0,shift:0,depth:8},{plane:2,step:1,offset:0,shift:0,depth:8}]},4:{nbComponents:3,log2ChromaW:1,log2ChromaH:0,flags:16,comp:[{plane:0,step:1,offset:0,shift:0,depth:8},{plane:1,step:1,offset:0,shift:0,depth:8},{plane:2,step:1,offset:0,shift:0,depth:8}]},13:{nbComponents:3,log2ChromaW:1,log2ChromaH:0,flags:16,comp:[{plane:0,step:1,offset:0,shift:0,depth:8},{plane:1,step:1,offset:0,shift:0,depth:8},{plane:2,step:1,offset:0,shift:0,depth:8}]},5:{nbComponents:3,log2ChromaW:0,log2ChromaH:0,flags:16,comp:[{plane:0,step:1,offset:0,shift:0,depth:8},{plane:1,step:1,offset:0,shift:0,depth:8},{plane:2,step:1,offset:0,shift:0,depth:8}]},14:{nbComponents:3,log2ChromaW:0,log2ChromaH:0,flags:16,comp:[{plane:0,step:1,offset:0,shift:0,depth:8},{plane:1,step:1,offset:0,shift:0,depth:8},{plane:2,step:1,offset:0,shift:0,depth:8}]},23:{nbComponents:3,log2ChromaW:1,log2ChromaH:1,flags:16,comp:[{plane:0,step:1,offset:0,shift:0,depth:8},{plane:1,step:2,offset:0,shift:0,depth:8},{plane:1,step:2,offset:1,shift:0,depth:8}]},59:{nbComponents:3,log2ChromaW:1,log2ChromaH:1,flags:17,comp:[{plane:0,step:1,offset:0,shift:0,depth:9},{plane:1,step:1,offset:0,shift:0,depth:9},{plane:2,step:1,offset:0,shift:0,depth:9}]},60:{nbComponents:3,log2ChromaW:1,log2ChromaH:1,flags:16,comp:[{plane:0,step:1,offset:0,shift:0,depth:9},{plane:1,step:1,offset:0,shift:0,depth:9},{plane:2,step:1,offset:0,shift:0,depth:9}]},61:{nbComponents:3,log2ChromaW:1,log2ChromaH:1,flags:17,comp:[{plane:0,step:1,offset:0,shift:0,depth:10},{plane:1,step:1,offset:0,shift:0,depth:10},{plane:2,step:1,offset:0,shift:0,depth:10}]},62:{nbComponents:3,log2ChromaW:1,log2ChromaH:1,flags:16,comp:[{plane:0,step:1,offset:0,shift:0,depth:10},{plane:1,step:1,offset:0,shift:0,depth:10},{plane:2,step:1,offset:0,shift:0,depth:10}]},122:{nbComponents:3,log2ChromaW:1,log2ChromaH:1,flags:17,comp:[{plane:0,step:1,offset:0,shift:0,depth:12},{plane:1,step:1,offset:0,shift:0,depth:12},{plane:2,step:1,offset:0,shift:0,depth:12}]},123:{nbComponents:3,log2ChromaW:1,log2ChromaH:1,flags:16,comp:[{plane:0,step:1,offset:0,shift:0,depth:12},{plane:1,step:1,offset:0,shift:0,depth:12},{plane:2,step:1,offset:0,shift:0,depth:12}]},124:{nbComponents:3,log2ChromaW:1,log2ChromaH:1,flags:17,comp:[{plane:0,step:1,offset:0,shift:0,depth:14},{plane:1,step:1,offset:0,shift:0,depth:14},{plane:2,step:1,offset:0,shift:0,depth:14}]},125:{nbComponents:3,log2ChromaW:1,log2ChromaH:1,flags:16,comp:[{plane:0,step:1,offset:0,shift:0,depth:14},{plane:1,step:1,offset:0,shift:0,depth:14},{plane:2,step:1,offset:0,shift:0,depth:14}]},46:{nbComponents:3,log2ChromaW:1,log2ChromaH:1,flags:17,comp:[{plane:0,step:1,offset:0,shift:0,depth:16},{plane:1,step:1,offset:0,shift:0,depth:16},{plane:2,step:1,offset:0,shift:0,depth:16}]},45:{nbComponents:3,log2ChromaW:1,log2ChromaH:1,flags:16,comp:[{plane:0,step:1,offset:0,shift:0,depth:16},{plane:1,step:1,offset:0,shift:0,depth:16},{plane:2,step:1,offset:0,shift:0,depth:16}]},69:{nbComponents:3,log2ChromaW:1,log2ChromaH:0,flags:17,comp:[{plane:0,step:1,offset:0,shift:0,depth:9},{plane:1,step:1,offset:0,shift:0,depth:9},{plane:2,step:1,offset:0,shift:0,depth:9}]},70:{nbComponents:3,log2ChromaW:1,log2ChromaH:0,flags:16,comp:[{plane:0,step:1,offset:0,shift:0,depth:9},{plane:1,step:1,offset:0,shift:0,depth:9},{plane:2,step:1,offset:0,shift:0,depth:9}]},63:{nbComponents:3,log2ChromaW:1,log2ChromaH:0,flags:17,comp:[{plane:0,step:1,offset:0,shift:0,depth:10},{plane:1,step:1,offset:0,shift:0,depth:10},{plane:2,step:1,offset:0,shift:0,depth:10}]},64:{nbComponents:3,log2ChromaW:1,log2ChromaH:0,flags:16,comp:[{plane:0,step:1,offset:0,shift:0,depth:10},{plane:1,step:1,offset:0,shift:0,depth:10},{plane:2,step:1,offset:0,shift:0,depth:10}]},126:{nbComponents:3,log2ChromaW:1,log2ChromaH:0,flags:17,comp:[{plane:0,step:1,offset:0,shift:0,depth:12},{plane:1,step:1,offset:0,shift:0,depth:12},{plane:2,step:1,offset:0,shift:0,depth:12}]},127:{nbComponents:3,log2ChromaW:1,log2ChromaH:0,flags:16,comp:[{plane:0,step:1,offset:0,shift:0,depth:12},{plane:1,step:1,offset:0,shift:0,depth:12},{plane:2,step:1,offset:0,shift:0,depth:12}]},128:{nbComponents:3,log2ChromaW:1,log2ChromaH:0,flags:17,comp:[{plane:0,step:1,offset:0,shift:0,depth:14},{plane:1,step:1,offset:0,shift:0,depth:14},{plane:2,step:1,offset:0,shift:0,depth:14}]},129:{nbComponents:3,log2ChromaW:1,log2ChromaH:0,flags:16,comp:[{plane:0,step:1,offset:0,shift:0,depth:14},{plane:1,step:1,offset:0,shift:0,depth:14},{plane:2,step:1,offset:0,shift:0,depth:14}]},48:{nbComponents:3,log2ChromaW:1,log2ChromaH:0,flags:17,comp:[{plane:0,step:1,offset:0,shift:0,depth:16},{plane:1,step:1,offset:0,shift:0,depth:16},{plane:2,step:1,offset:0,shift:0,depth:16}]},47:{nbComponents:3,log2ChromaW:1,log2ChromaH:0,flags:16,comp:[{plane:0,step:1,offset:0,shift:0,depth:16},{plane:1,step:1,offset:0,shift:0,depth:16},{plane:2,step:1,offset:0,shift:0,depth:16}]},65:{nbComponents:3,log2ChromaW:0,log2ChromaH:0,flags:17,comp:[{plane:0,step:1,offset:0,shift:0,depth:9},{plane:1,step:1,offset:0,shift:0,depth:9},{plane:2,step:1,offset:0,shift:0,depth:9}]},66:{nbComponents:3,log2ChromaW:0,log2ChromaH:0,flags:16,comp:[{plane:0,step:1,offset:0,shift:0,depth:9},{plane:1,step:1,offset:0,shift:0,depth:9},{plane:2,step:1,offset:0,shift:0,depth:9}]},67:{nbComponents:3,log2ChromaW:0,log2ChromaH:0,flags:17,comp:[{plane:0,step:1,offset:0,shift:0,depth:10},{plane:1,step:1,offset:0,shift:0,depth:10},{plane:2,step:1,offset:0,shift:0,depth:10}]},68:{nbComponents:3,log2ChromaW:0,log2ChromaH:0,flags:16,comp:[{plane:0,step:1,offset:0,shift:0,depth:10},{plane:1,step:1,offset:0,shift:0,depth:10},{plane:2,step:1,offset:0,shift:0,depth:10}]},130:{nbComponents:3,log2ChromaW:0,log2ChromaH:0,flags:17,comp:[{plane:0,step:1,offset:0,shift:0,depth:12},{plane:1,step:1,offset:0,shift:0,depth:12},{plane:2,step:1,offset:0,shift:0,depth:12}]},131:{nbComponents:3,log2ChromaW:0,log2ChromaH:0,flags:16,comp:[{plane:0,step:1,offset:0,shift:0,depth:12},{plane:1,step:1,offset:0,shift:0,depth:12},{plane:2,step:1,offset:0,shift:0,depth:12}]},132:{nbComponents:3,log2ChromaW:0,log2ChromaH:0,flags:17,comp:[{plane:0,step:1,offset:0,shift:0,depth:14},{plane:1,step:1,offset:0,shift:0,depth:14},{plane:2,step:1,offset:0,shift:0,depth:14}]},133:{nbComponents:3,log2ChromaW:0,log2ChromaH:0,flags:16,comp:[{plane:0,step:1,offset:0,shift:0,depth:14},{plane:1,step:1,offset:0,shift:0,depth:14},{plane:2,step:1,offset:0,shift:0,depth:14}]},50:{nbComponents:3,log2ChromaW:0,log2ChromaH:0,flags:17,comp:[{plane:0,step:1,offset:0,shift:0,depth:16},{plane:1,step:1,offset:0,shift:0,depth:16},{plane:2,step:1,offset:0,shift:0,depth:16}]},49:{nbComponents:3,log2ChromaW:0,log2ChromaH:0,flags:16,comp:[{plane:0,step:1,offset:0,shift:0,depth:16},{plane:1,step:1,offset:0,shift:0,depth:16},{plane:2,step:1,offset:0,shift:0,depth:16}]},26:{nbComponents:4,log2ChromaW:0,log2ChromaH:0,flags:160,comp:[{plane:0,step:4,offset:0,shift:0,depth:8},{plane:0,step:4,offset:1,shift:0,depth:8},{plane:0,step:4,offset:2,shift:0,depth:8},{plane:0,step:4,offset:3,shift:0,depth:8}]},119:{nbComponents:3,log2ChromaW:0,log2ChromaH:0,flags:32,comp:[{plane:0,step:4,offset:0,shift:0,depth:8},{plane:0,step:4,offset:1,shift:0,depth:8},{plane:0,step:4,offset:2,shift:0,depth:8}]},28:{nbComponents:4,log2ChromaW:0,log2ChromaH:0,flags:160,comp:[{plane:0,step:4,offset:2,shift:0,depth:8},{plane:0,step:4,offset:1,shift:0,depth:8},{plane:0,step:4,offset:0,shift:0,depth:8},{plane:0,step:4,offset:3,shift:0,depth:8}]},121:{nbComponents:3,log2ChromaW:0,log2ChromaH:0,flags:32,comp:[{plane:0,step:4,offset:2,shift:0,depth:8},{plane:0,step:4,offset:1,shift:0,depth:8},{plane:0,step:4,offset:0,shift:0,depth:8}]},33:{nbComponents:4,log2ChromaW:1,log2ChromaH:1,flags:144,comp:[{plane:0,step:1,offset:0,shift:0,depth:8},{plane:1,step:1,offset:0,shift:0,depth:8},{plane:2,step:1,offset:0,shift:0,depth:8},{plane:3,step:1,offset:0,shift:0,depth:8}]}}},58055:(t,e,i)=>{"use strict";i.d(e,{J:()=>r});const r={0:{bits:8,planar:!1},1:{bits:16,planar:!1},2:{bits:32,planar:!1},10:{bits:64,planar:!1},3:{bits:32,planar:!1},4:{bits:64,planar:!1},5:{bits:8,planar:!0},6:{bits:16,planar:!0},7:{bits:32,planar:!0},11:{bits:64,planar:!0},8:{bits:32,planar:!0},9:{bits:64,planar:!0}}},62751:(t,e,i)=>{"use strict";i.d(e,{$$:()=>a,HR:()=>s,Ki:()=>m,Mb:()=>p,Sz:()=>h,Xp:()=>l,_R:()=>n,_m:()=>f,iW:()=>u,mX:()=>d,n1:()=>o,os:()=>r,qO:()=>c});const r={86017:"mp3",86018:"mp4a.40",86021:"vorbis",86028:"flac",86076:"opus",65542:"ulaw",65543:"alaw",225:"av01",27:"avc1",173:"hev1",196:"vvc1",139:"vp8",167:"vp09",12:"mp4v"},s={flv:0,mp4:1,mov:1,ts:2,ivf:5,opus:4,oggs:4,ogg:4,m3u8:2,m3u:2,mpd:1,mp3:14,mkv:8,mka:8,webm:9,aac:15,flac:17,wav:16,srt:19,vtt:18,ssa:20,ass:20,xml:21,ttml:21,h264:11,264:11,avc:11,h265:12,265:12,hevc:12,h266:13,266:13,vvc:13,mpeg:3,mpg:3,rtsp:6,rtmp:7},a={m3u8:4,m3u:4,mpd:5},n={copy:0,h264:27,avc:27,hevc:173,h265:173,vvc:196,h266:196,av1:225,vp9:167,vp8:139,mpeg4:12,theora:30,mpeg2video:2},o={copy:0,aac:86018,ac3:86019,eac3:86056,dca:86020,mp3:86017,opus:86076,flac:86028,speex:86051,vorbis:86021,pcm_alaw:65543,pcm_mulaw:65542},l={webvtt:94226,subrip:94225,ass:94230,ttml:94232,mov_text:94213,hdmv_pgs:94214,hdmv_text:94231,dvd:94208,dvb:94209,eia_608:94218},c={yuv420p:0,yuv422p:4,yuv444p:5,yuva420p:33,yuva422p:78,yuva444p:79,yuv420p10le:62,yuv422p10le:64,yuv444p10le:68,yuva420p10le:87,yuva422p10le:89,yuva444p10le:91,yuv420p10be:61,yuv422p10be:63,yuv444p10be:67,yuva420p10be:86,yuva422p10be:88,yuva444p10be:90},h={u8:0,"u8-planar":5,s16:1,"s16-planar":6,s32:2,"s32-planar":7,s64:10,"s64-planar":11,float:3,"float-planar":8,double:4,"double-planar":9},u={flv:0,mp4:1,mov:1,ts:2,mpegts:2,mpeg:3,ivf:5,ogg:4,opus:4,m3u8:2,m3u:2,mpd:1,mp3:14,mkv:8,matroska:8,mka:8,webm:9,aac:15,flac:17,wav:16,raw_h264:11,raw_h265:12,raw_vvc:13,rtsp:6,rtmp:7},d={tv:1,pc:2},f={bt709:1,fcc:4,bt470bg:5,smpte170m:6,smpte240m:7,ycgco:8,gbr:0,bt2020ncl:9},p={Audio:1,Video:0,Subtitle:3,Attachment:4,Data:2},m={default:1,dub:2,original:4,comment:8,lyrics:16,karaoke:32,forced:64,"hearing impaired":128,"visual impaired":256,"clean effects":512,"attached pic":1024,"timed thumbnails":2048,captions:65536,descriptions:131072,metadata:262144,dependent:524288,"still image":1048576}},36981:(t,e,i)=>{"use strict";i.d(e,{r:()=>u});var r,s,a=i(134),n=i(80662),o=i.n(n),l=i(61499),c=i(12085);class h{constructor(){(0,a.A)(this,"id",void 0),(0,a.A)(this,"name",void 0),(0,a.A)(this,"opaque",void 0)}}r=h.prototype,(s=new(o())).set("id",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}),s.set("name",{0:4,1:0,2:0,3:1,4:16,5:0,6:0,7:4,8:0}),s.set("opaque",{0:1,1:1,2:1,3:0,4:0,5:0,6:0,7:20,8:0}),(0,c.A)(r,l.Og,!0),(0,c.A)(r,l.dc,4),(0,c.A)(r,l.g7,24),(0,c.A)(r,l.JY,s);class u{constructor(){(0,a.A)(this,"order",void 0),(0,a.A)(this,"nbChannels",void 0),(0,a.A)(this,"u",void 0),(0,a.A)(this,"opaque",void 0)}}!function(t){var e=new(o());e.set("order",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}),e.set("nbChannels",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:4,8:0}),e.set("u",{0:function(t){var e=new(o());return e.set("mask",{0:10,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}),e.set("map",{0:h,1:1,2:1,3:0,4:0,5:0,6:0,7:0,8:0}),(0,c.A)(t,l.Og,!0),(0,c.A)(t,l.dc,8),(0,c.A)(t,l.g7,8),(0,c.A)(t,l.JY,e),t}({}),1:0,2:0,3:0,4:0,5:0,6:0,7:8,8:0}),e.set("opaque",{0:1,1:1,2:1,3:0,4:0,5:0,6:0,7:16,8:0}),(0,c.A)(t,l.Og,!0),(0,c.A)(t,l.dc,8),(0,c.A)(t,l.g7,24),(0,c.A)(t,l.JY,e)}(u.prototype)},50288:(t,e,i)=>{"use strict";i.d(e,{BU:()=>d});var r,s,a=i(134),n=i(80662),o=i.n(n),l=i(61499),c=i(12085),h=i(73783);i(37837);class u{constructor(){(0,a.A)(this,"data",0),(0,a.A)(this,"size",0),(0,a.A)(this,"refcount",0),(0,a.A)(this,"free",0),(0,a.A)(this,"opaque",0),(0,a.A)(this,"flags",0),(0,a.A)(this,"flagsInternal",0)}}r=u.prototype,(s=new(o())).set("data",{0:2,1:1,2:1,3:0,4:0,5:0,6:0,7:0,8:0}),s.set("size",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:4,8:0}),s.set("refcount",{0:9,1:0,2:0,3:0,4:0,5:0,6:0,7:8,8:0}),s.set("free",{0:1,1:1,2:1,3:0,4:0,5:0,6:0,7:12,8:0}),s.set("opaque",{0:1,1:1,2:1,3:0,4:0,5:0,6:0,7:16,8:0}),s.set("flags",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:20,8:0}),s.set("flagsInternal",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:24,8:0}),(0,c.A)(r,l.Og,!0),(0,c.A)(r,l.dc,4),(0,c.A)(r,l.g7,28),(0,c.A)(r,l.JY,s);class d{constructor(){(0,a.A)(this,"buffer",0),(0,a.A)(this,"data",0),(0,a.A)(this,"size",0)}}!function(t){var e=new(o());e.set("buffer",{0:u,1:1,2:1,3:0,4:0,5:0,6:0,7:0,8:0}),e.set("data",{0:2,1:1,2:1,3:0,4:0,5:0,6:0,7:4,8:0}),e.set("size",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:8,8:0}),(0,c.A)(t,l.Og,!0),(0,c.A)(t,l.dc,4),(0,c.A)(t,l.g7,12),(0,c.A)(t,l.JY,e)}(d.prototype);class f{constructor(){(0,a.A)(this,"mutex",void 0),(0,a.A)(this,"pool",0),(0,a.A)(this,"refcount",0),(0,a.A)(this,"size",0),(0,a.A)(this,"opaque",0),(0,a.A)(this,"alloc",0),(0,a.A)(this,"alloc2",0),(0,a.A)(this,"poolFree",0)}}!function(t){var e=new(o());e.set("mutex",{0:h.eu,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}),e.set("pool",{get 0(){return p},1:1,2:1,3:0,4:0,5:0,6:0,7:4,8:0}),e.set("refcount",{0:9,1:0,2:0,3:0,4:0,5:0,6:0,7:8,8:0}),e.set("size",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:12,8:0}),e.set("opaque",{0:1,1:1,2:1,3:0,4:0,5:0,6:0,7:16,8:0}),e.set("alloc",{0:1,1:1,2:1,3:0,4:0,5:0,6:0,7:20,8:0}),e.set("alloc2",{0:1,1:1,2:1,3:0,4:0,5:0,6:0,7:24,8:0}),e.set("poolFree",{0:1,1:1,2:1,3:0,4:0,5:0,6:0,7:28,8:0}),(0,c.A)(t,l.Og,!0),(0,c.A)(t,l.dc,4),(0,c.A)(t,l.g7,32),(0,c.A)(t,l.JY,e)}(f.prototype);class p{constructor(){(0,a.A)(this,"data",0),(0,a.A)(this,"opaque",0),(0,a.A)(this,"free",0),(0,a.A)(this,"pool",0),(0,a.A)(this,"next",0),(0,a.A)(this,"buffer",void 0)}}!function(t){var e=new(o());e.set("data",{0:2,1:1,2:1,3:0,4:0,5:0,6:0,7:0,8:0}),e.set("opaque",{0:1,1:1,2:1,3:0,4:0,5:0,6:0,7:4,8:0}),e.set("free",{0:1,1:1,2:1,3:0,4:0,5:0,6:0,7:8,8:0}),e.set("pool",{0:f,1:1,2:1,3:0,4:0,5:0,6:0,7:12,8:0}),e.set("next",{0:p,1:1,2:1,3:0,4:0,5:0,6:0,7:16,8:0}),e.set("buffer",{0:u,1:0,2:0,3:0,4:0,5:0,6:0,7:20,8:0}),(0,c.A)(t,l.Og,!0),(0,c.A)(t,l.dc,4),(0,c.A)(t,l.g7,48),(0,c.A)(t,l.JY,e)}(p.prototype)},77162:(t,e,i)=>{"use strict";i.d(e,{A:()=>m});var r,s,a=i(134),n=i(80662),o=i.n(n),l=i(61499),c=i(12085),h=i(47958),u=i(9599),d=i(36981),f=i(77231),p=i(71766);class m{constructor(){(0,a.A)(this,"codecType",-1),(0,a.A)(this,"codecId",0),(0,a.A)(this,"codecTag",0),(0,a.A)(this,"extradata",0),(0,a.A)(this,"extradataSize",0),(0,a.A)(this,"codedSideData",0),(0,a.A)(this,"nbCodedSideData",0),(0,a.A)(this,"format",f.N_),(0,a.A)(this,"bitrate",BigInt(0)),(0,a.A)(this,"bitsPerCodedSample",0),(0,a.A)(this,"bitsPerRawSample",0),(0,a.A)(this,"profile",f.N_),(0,a.A)(this,"level",f.N_),(0,a.A)(this,"width",0),(0,a.A)(this,"height",0),(0,a.A)(this,"sampleAspectRatio",new u.P({den:1,num:1})),(0,a.A)(this,"framerate",new u.P({den:1,num:0})),(0,a.A)(this,"fieldOrder",0),(0,a.A)(this,"colorRange",0),(0,a.A)(this,"colorPrimaries",2),(0,a.A)(this,"colorTrc",2),(0,a.A)(this,"colorSpace",2),(0,a.A)(this,"chromaLocation",0),(0,a.A)(this,"videoDelay",0),(0,a.A)(this,"chLayout",void 0),(0,a.A)(this,"sampleRate",f.N_),(0,a.A)(this,"blockAlign",0),(0,a.A)(this,"frameSize",0),(0,a.A)(this,"initialPadding",0),(0,a.A)(this,"trailingPadding",0),(0,a.A)(this,"seekPreroll",0),(0,a.A)(this,"bitFormat",0)}destroy(){(0,p.dn)(this[l.o9]),this[l.o9]=0}}r=m.prototype,(s=new(o())).set("codecType",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}),s.set("codecId",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:4,8:0}),s.set("codecTag",{0:8,1:0,2:0,3:0,4:0,5:0,6:0,7:8,8:0}),s.set("extradata",{0:2,1:1,2:1,3:0,4:0,5:0,6:0,7:12,8:0}),s.set("extradataSize",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:16,8:0}),s.set("codedSideData",{0:h.lg,1:1,2:1,3:0,4:0,5:0,6:0,7:20,8:0}),s.set("nbCodedSideData",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:24,8:0}),s.set("format",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:28,8:0}),s.set("bitrate",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:32,8:0}),s.set("bitsPerCodedSample",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:40,8:0}),s.set("bitsPerRawSample",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:44,8:0}),s.set("profile",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:48,8:0}),s.set("level",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:52,8:0}),s.set("width",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:56,8:0}),s.set("height",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:60,8:0}),s.set("sampleAspectRatio",{0:u.P,1:0,2:0,3:0,4:0,5:0,6:0,7:64,8:0}),s.set("framerate",{0:u.P,1:0,2:0,3:0,4:0,5:0,6:0,7:72,8:0}),s.set("fieldOrder",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:80,8:0}),s.set("colorRange",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:84,8:0}),s.set("colorPrimaries",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:88,8:0}),s.set("colorTrc",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:92,8:0}),s.set("colorSpace",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:96,8:0}),s.set("chromaLocation",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:100,8:0}),s.set("videoDelay",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:104,8:0}),s.set("chLayout",{0:d.r,1:0,2:0,3:0,4:0,5:0,6:0,7:112,8:0}),s.set("sampleRate",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:136,8:0}),s.set("blockAlign",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:140,8:0}),s.set("frameSize",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:144,8:0}),s.set("initialPadding",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:148,8:0}),s.set("trailingPadding",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:152,8:0}),s.set("seekPreroll",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:156,8:0}),s.set("bitFormat",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:160,8:0}),(0,c.A)(r,l.Og,!0),(0,c.A)(r,l.dc,8),(0,c.A)(r,l.g7,168),(0,c.A)(r,l.JY,s)},56490:(t,e,i)=>{"use strict";i.d(e,{A:()=>u});var r,s,a=i(134),n=i(80662),o=i.n(n),l=i(61499),c=i(12085);class h{constructor(){(0,a.A)(this,"key",0),(0,a.A)(this,"value",0)}}r=h.prototype,(s=new(o())).set("key",{0:1,1:1,2:1,3:0,4:0,5:0,6:0,7:0,8:0}),s.set("value",{0:1,1:1,2:1,3:0,4:0,5:0,6:0,7:4,8:0}),(0,c.A)(r,l.Og,!0),(0,c.A)(r,l.dc,4),(0,c.A)(r,l.g7,8),(0,c.A)(r,l.JY,s);class u{constructor(){(0,a.A)(this,"count",0),(0,a.A)(this,"elems",0)}}!function(t){var e=new(o());e.set("count",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}),e.set("elems",{0:h,1:1,2:1,3:0,4:0,5:0,6:0,7:4,8:0}),(0,c.A)(t,l.Og,!0),(0,c.A)(t,l.dc,4),(0,c.A)(t,l.g7,8),(0,c.A)(t,l.JY,e)}(u.prototype)},55833:(t,e,i)=>{"use strict";i.d(e,{pu:()=>m});var r=i(134),s=i(80662),a=i.n(s),n=i(61499),o=i(12085),l=i(56490),c=i(50288),h=i(9599),u=i(94300),d=i(36981),f=i(77231),p=i(56024);const m=8;class g{constructor(){(0,r.A)(this,"type",0),(0,r.A)(this,"data",0),(0,r.A)(this,"size",0),(0,r.A)(this,"metadata",0),(0,r.A)(this,"buf",0)}}var v,y;v=g.prototype,(y=new(a())).set("type",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}),y.set("data",{0:2,1:1,2:1,3:0,4:0,5:0,6:0,7:4,8:0}),y.set("size",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:8,8:0}),y.set("metadata",{0:l.A,1:1,2:1,3:0,4:0,5:0,6:0,7:12,8:0}),y.set("buf",{0:c.BU,1:1,2:1,3:0,4:0,5:0,6:0,7:16,8:0}),(0,o.A)(v,n.Og,!0),(0,o.A)(v,n.dc,4),(0,o.A)(v,n.g7,20),(0,o.A)(v,n.JY,y),function(t){var e=new(a());e.set("displayPrimaries",{0:h.P,1:0,2:0,3:1,4:6,5:0,6:0,7:0,8:0}),e.set("whitePoint",{0:h.P,1:0,2:0,3:1,4:2,5:0,6:0,7:48,8:0}),e.set("minLuminance",{0:h.P,1:0,2:0,3:0,4:0,5:0,6:0,7:64,8:0}),e.set("maxLuminance",{0:h.P,1:0,2:0,3:0,4:0,5:0,6:0,7:72,8:0}),e.set("hasPrimaries",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:80,8:0}),e.set("hasLuminance",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:84,8:0}),(0,o.A)(t,n.Og,!0),(0,o.A)(t,n.dc,4),(0,o.A)(t,n.g7,88),(0,o.A)(t,n.JY,e)}(class{constructor(){(0,r.A)(this,"displayPrimaries",void 0),(0,r.A)(this,"whitePoint",void 0),(0,r.A)(this,"minLuminance",void 0),(0,r.A)(this,"maxLuminance",void 0),(0,r.A)(this,"hasPrimaries",void 0),(0,r.A)(this,"hasLuminance",void 0)}}.prototype),function(t){var e=new(a());e.set("maxCLL",{0:8,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}),e.set("maxFALL",{0:8,1:0,2:0,3:0,4:0,5:0,6:0,7:4,8:0}),(0,o.A)(t,n.Og,!0),(0,o.A)(t,n.dc,4),(0,o.A)(t,n.g7,8),(0,o.A)(t,n.JY,e)}(class{constructor(){(0,r.A)(this,"maxCLL",void 0),(0,r.A)(this,"maxFALL",void 0)}}.prototype);class A{constructor(){(0,r.A)(this,"data",new Array(m).fill(0,0,m)),(0,r.A)(this,"linesize",new Array(m).fill(0,0,m)),(0,r.A)(this,"extendedData",0),(0,r.A)(this,"width",f.N_),(0,r.A)(this,"height",f.N_),(0,r.A)(this,"nbSamples",f.N_),(0,r.A)(this,"format",f.N_),(0,r.A)(this,"keyFrame",0),(0,r.A)(this,"pictType",0),(0,r.A)(this,"sampleAspectRatio",new h.P({den:1,num:0})),(0,r.A)(this,"pts",f.Dh),(0,r.A)(this,"pktDts",f.Dh),(0,r.A)(this,"timeBase",void 0),(0,r.A)(this,"quality",f.N_),(0,r.A)(this,"opaque",0),(0,r.A)(this,"repeatPict",f.N_),(0,r.A)(this,"interlacedFrame",f.N_),(0,r.A)(this,"topFieldFirst",f.N_),(0,r.A)(this,"paletteHasChanged",f.N_),(0,r.A)(this,"sampleRate",f.N_),(0,r.A)(this,"buf",new Array(m).fill(0,0,m)),(0,r.A)(this,"extendedBuf",0),(0,r.A)(this,"nbExtendedBuf",0),(0,r.A)(this,"sideData",0),(0,r.A)(this,"nbSideData",0),(0,r.A)(this,"flags",0),(0,r.A)(this,"colorRange",0),(0,r.A)(this,"colorPrimaries",2),(0,r.A)(this,"colorTrc",2),(0,r.A)(this,"colorSpace",2),(0,r.A)(this,"chromaLocation",0),(0,r.A)(this,"bestEffortTimestamp",f.Dh),(0,r.A)(this,"pktPos",f.Dh),(0,r.A)(this,"metadata",0),(0,r.A)(this,"decodeErrorFlags",0),(0,r.A)(this,"pktSize",f.N_),(0,r.A)(this,"hwFramesCtx",0),(0,r.A)(this,"opaqueRef",0),(0,r.A)(this,"cropTop",0),(0,r.A)(this,"cropBottom",0),(0,r.A)(this,"cropLeft",0),(0,r.A)(this,"cropRight",0),(0,r.A)(this,"privateRef",0),(0,r.A)(this,"chLayout",void 0),(0,r.A)(this,"duration",BigInt(0))}close(){(0,p.to)(this[n.o9]),(0,u.A)(this)}}!function(t){var e=new(a());e.set("data",{0:2,1:1,2:1,3:1,4:8,5:0,6:0,7:0,8:0}),e.set("linesize",{0:15,1:0,2:0,3:1,4:8,5:0,6:0,7:32,8:0}),e.set("extendedData",{0:2,1:1,2:2,3:0,4:0,5:0,6:0,7:64,8:0}),e.set("width",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:68,8:0}),e.set("height",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:72,8:0}),e.set("nbSamples",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:76,8:0}),e.set("format",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:80,8:0}),e.set("keyFrame",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:84,8:0}),e.set("pictType",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:88,8:0}),e.set("sampleAspectRatio",{0:h.P,1:0,2:0,3:0,4:0,5:0,6:0,7:92,8:0}),e.set("pts",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:104,8:0}),e.set("pktDts",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:112,8:0}),e.set("timeBase",{0:h.P,1:0,2:0,3:0,4:0,5:0,6:0,7:120,8:0}),e.set("quality",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:128,8:0}),e.set("opaque",{0:1,1:1,2:1,3:0,4:0,5:0,6:0,7:132,8:0}),e.set("repeatPict",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:136,8:0}),e.set("interlacedFrame",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:140,8:0}),e.set("topFieldFirst",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:144,8:0}),e.set("paletteHasChanged",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:148,8:0}),e.set("sampleRate",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:152,8:0}),e.set("buf",{0:c.BU,1:1,2:1,3:1,4:8,5:0,6:0,7:156,8:0}),e.set("extendedBuf",{0:c.BU,1:1,2:2,3:0,4:0,5:0,6:0,7:188,8:0}),e.set("nbExtendedBuf",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:192,8:0}),e.set("sideData",{0:g,1:1,2:2,3:0,4:0,5:0,6:0,7:196,8:0}),e.set("nbSideData",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:200,8:0}),e.set("flags",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:204,8:0}),e.set("colorRange",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:208,8:0}),e.set("colorPrimaries",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:212,8:0}),e.set("colorTrc",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:216,8:0}),e.set("colorSpace",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:220,8:0}),e.set("chromaLocation",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:224,8:0}),e.set("bestEffortTimestamp",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:232,8:0}),e.set("pktPos",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:240,8:0}),e.set("metadata",{0:l.A,1:1,2:1,3:0,4:0,5:0,6:0,7:248,8:0}),e.set("decodeErrorFlags",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:252,8:0}),e.set("pktSize",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:256,8:0}),e.set("hwFramesCtx",{0:c.BU,1:1,2:1,3:0,4:0,5:0,6:0,7:260,8:0}),e.set("opaqueRef",{0:c.BU,1:1,2:1,3:0,4:0,5:0,6:0,7:264,8:0}),e.set("cropTop",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:268,8:0}),e.set("cropBottom",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:272,8:0}),e.set("cropLeft",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:276,8:0}),e.set("cropRight",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:280,8:0}),e.set("privateRef",{0:c.BU,1:1,2:1,3:0,4:0,5:0,6:0,7:284,8:0}),e.set("chLayout",{0:d.r,1:0,2:0,3:0,4:0,5:0,6:0,7:288,8:0}),e.set("duration",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:312,8:0}),(0,o.A)(t,n.Og,!0),(0,o.A)(t,n.dc,8),(0,o.A)(t,n.g7,320),(0,o.A)(t,n.JY,e)}(A.prototype),function(t){var e=new(a());e.set("refCount",{0:16,1:0,2:0,3:0,4:0,5:0,6:0,7:320,8:0}),(0,o.A)(t,n.Og,!0),(0,o.A)(t,n.dc,8),(0,o.A)(t,n.g7,328),(0,o.A)(t,n.JY,e)}(class extends A{constructor(...t){super(...t),(0,r.A)(this,"refCount",void 0)}}.prototype)},47958:(t,e,i)=>{"use strict";i.d(e,{lg:()=>f});var r,s,a=i(134),n=i(80662),o=i.n(n),l=i(61499),c=i(12085),h=i(50288),u=i(9599),d=i(77231);class f{constructor(){(0,a.A)(this,"data",0),(0,a.A)(this,"size",d.N_),(0,a.A)(this,"type",-1)}}r=f.prototype,(s=new(o())).set("data",{0:2,1:1,2:1,3:0,4:0,5:0,6:0,7:0,8:0}),s.set("size",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:4,8:0}),s.set("type",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:8,8:0}),(0,c.A)(r,l.Og,!0),(0,c.A)(r,l.dc,4),(0,c.A)(r,l.g7,12),(0,c.A)(r,l.JY,s),function(t){var e=new(o());e.set("wallclock",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}),e.set("flags",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:8,8:0}),(0,c.A)(t,l.Og,!0),(0,c.A)(t,l.dc,8),(0,c.A)(t,l.g7,16),(0,c.A)(t,l.JY,e)}(class{constructor(){(0,a.A)(this,"wallclock",void 0),(0,a.A)(this,"flags",void 0)}}.prototype);class p{constructor(){(0,a.A)(this,"buf",0),(0,a.A)(this,"pts",d.Dh),(0,a.A)(this,"dts",d.Dh),(0,a.A)(this,"data",0),(0,a.A)(this,"size",0),(0,a.A)(this,"streamIndex",d.N_),(0,a.A)(this,"flags",0),(0,a.A)(this,"sideData",0),(0,a.A)(this,"sideDataElems",0),(0,a.A)(this,"duration",d.Dh),(0,a.A)(this,"pos",d.Dh),(0,a.A)(this,"opaque",0),(0,a.A)(this,"opaqueRef",0),(0,a.A)(this,"timeBase",new u.P({den:d.SF,num:1})),(0,a.A)(this,"bitFormat",0)}}!function(t){var e=new(o());e.set("buf",{0:h.BU,1:1,2:1,3:0,4:0,5:0,6:0,7:0,8:0}),e.set("pts",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:8,8:0}),e.set("dts",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:16,8:0}),e.set("data",{0:2,1:1,2:1,3:0,4:0,5:0,6:0,7:24,8:0}),e.set("size",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:28,8:0}),e.set("streamIndex",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:32,8:0}),e.set("flags",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:36,8:0}),e.set("sideData",{0:f,1:1,2:1,3:0,4:0,5:0,6:0,7:40,8:0}),e.set("sideDataElems",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:44,8:0}),e.set("duration",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:48,8:0}),e.set("pos",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:56,8:0}),e.set("opaque",{0:1,1:1,2:1,3:0,4:0,5:0,6:0,7:64,8:0}),e.set("opaqueRef",{0:h.BU,1:1,2:1,3:0,4:0,5:0,6:0,7:68,8:0}),e.set("timeBase",{0:u.P,1:0,2:0,3:0,4:0,5:0,6:0,7:72,8:0}),e.set("bitFormat",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:80,8:0}),(0,c.A)(t,l.Og,!0),(0,c.A)(t,l.dc,8),(0,c.A)(t,l.g7,88),(0,c.A)(t,l.JY,e)}(p.prototype),function(t){var e=new(o());e.set("refCount",{0:16,1:0,2:0,3:0,4:0,5:0,6:0,7:88,8:0}),(0,c.A)(t,l.Og,!0),(0,c.A)(t,l.dc,8),(0,c.A)(t,l.g7,96),(0,c.A)(t,l.JY,e)}(class extends p{constructor(...t){super(...t),(0,a.A)(this,"refCount",void 0)}}.prototype)},10278:(t,e,i)=>{"use strict";i.d(e,{A:()=>h});var r,s,a=i(134),n=i(80662),o=i.n(n),l=i(61499),c=i(12085);class h{constructor(){(0,a.A)(this,"data",void 0),(0,a.A)(this,"linesize",void 0),(0,a.A)(this,"nbSamples",void 0),(0,a.A)(this,"maxnbSamples",void 0),(0,a.A)(this,"channels",void 0),(0,a.A)(this,"sampleRate",void 0),(0,a.A)(this,"timestamp",void 0),(0,a.A)(this,"duration",void 0)}}r=h.prototype,(s=new(o())).set("data",{0:2,1:1,2:2,3:0,4:0,5:0,6:0,7:0,8:0}),s.set("linesize",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:4,8:0}),s.set("nbSamples",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:8,8:0}),s.set("maxnbSamples",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:12,8:0}),s.set("channels",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:16,8:0}),s.set("sampleRate",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:20,8:0}),s.set("timestamp",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:24,8:0}),s.set("duration",{0:19,1:0,2:0,3:0,4:0,5:0,6:0,7:32,8:0}),(0,c.A)(r,l.Og,!0),(0,c.A)(r,l.dc,8),(0,c.A)(r,l.g7,40),(0,c.A)(r,l.JY,s),function(t){var e=new(o());e.set("refCount",{0:16,1:0,2:0,3:0,4:0,5:0,6:0,7:40,8:0}),(0,c.A)(t,l.Og,!0),(0,c.A)(t,l.dc,8),(0,c.A)(t,l.g7,48),(0,c.A)(t,l.JY,e)}(class extends h{constructor(...t){super(...t),(0,a.A)(this,"refCount",void 0)}}.prototype)},9599:(t,e,i)=>{"use strict";i.d(e,{P:()=>h});var r,s,a=i(134),n=i(80662),o=i.n(n),l=i(61499),c=i(12085);class h{constructor(t){(0,a.A)(this,"num",1),(0,a.A)(this,"den",1),t&&(this.den=t.den,this.num=t.num)}}r=h.prototype,(s=new(o())).set("num",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}),s.set("den",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:4,8:0}),(0,c.A)(r,l.Og,!0),(0,c.A)(r,l.dc,4),(0,c.A)(r,l.g7,8),(0,c.A)(r,l.JY,s)},37815:(t,e,i)=>{"use strict";i.d(e,{A6:()=>v,D$:()=>d,Q7:()=>m,VG:()=>f,aw:()=>u,us:()=>g});var r=i(14686),s=i(63939),a=i(50932),n=i(37837),o=i(40046),l=(i(50288),i(73783)),c=i(52699);const h=1;function u(t,e,i=0,r=0,s=0){const l=(0,n.Gy)(28);if(!l)return 0;const c=function(t,e,i,r=0,s=0,l=0){a.M[20](t,e),a.M[15](t+4,i),a.M[20](t+12,r),a.M[20](t+16,s),o.M_(t+8,1,9,2),a.M[15](t+20,l);const c=(0,n.Gy)(12);return c?(a.M[20](c,t),a.M[20](c+4,e),a.M[15](c+8,i),c):0}(l,t,e,i,r,s);return c||((0,n.Eb)(l),0)}function d(t){return u((0,n.sY)(t),t)}function f(t){const e=(0,n.Gy)(12);return(0,r.Mr)(e,t,12),o.WQ(s.f[20](t)+8,1,9,2),e}function p(t,e){const i=s.f[20](s.f[20](t));if(e?((0,r.Mr)(s.f[20](t),s.f[20](e),12),(0,n.aI)(e)):(0,n.aI)(t),1===o.jb(i+8,1,9,2)){const t=!(2&s.f[15](i+24));s.f[20](i+16)?y(s.f[20](i+16),s.f[20](i)):(0,n.Eb)(s.f[20](i)),t&&(0,n.Eb)(i)}}function m(t){t&&s.f[20](t)&&p(t,0)}function g(t,e){const i=s.f[20](t);if(!e)return m(t),0;if(i&&s.f[20](i+4)===s.f[20](e+4))return a.M[20](i+4,s.f[20](e+4)),a.M[15](i+8,s.f[15](e+8)),0;const r=f(e);return m(t),a.M[20](t,r),0}function v(t,e){if(!s.f[20](t)){const i=u((0,n.cz)(0,e),e);return a.M[20](t,i),a.M[15](s.f[20](i)+24,s.f[15](s.f[20](i)+24)|h),0}const i=s.f[20](t),l=s.f[20](i);if(s.f[15](i+8)===e)return 0;if(!(s.f[15](l+24)&h&&function(t){return 1&s.f[15](s.f[20](t)+20)?0:1===o.Hh(s.f[20](t)+8,9,2)?1:0}(i)&&s.f[20](i+4)===s.f[20](l))){let i=c.z(4);a.M[20](i,0);const n=v(i,e);return n<0?(c.t(4),n):((0,r.Mr)(s.f[20](s.f[20](i)+4),s.f[20](l),Math.min(e,s.f[15](l+4))),p(t,i),c.t(4),0)}const d=(0,n.cz)(s.f[20](l),e);return a.M[20](i+4,d),a.M[20](l,d),a.M[15](i+8,e),a.M[15](l+4,e),0}function y(t,e){const i=t,r=s.f[20](i+12);l.s2(r),a.M[20](i+16,s.f[20](r+4)),a.M[20](r+4,i),l.Tl(r),1===o.jb(r+8,1,9,2)&&function(t){!function(t){for(;s.f[20](t+4);){const e=s.f[20](t+4);a.M[20](t+4,s.f[20](e+16)),s.f[20](e+4)?y(s.f[20](e+4),s.f[20](e)):(0,n.Eb)(s.f[20](e)),(0,n.Eb)(e)}}(t),l.zr(t),(0,n.Eb)(t)}(r)}},73749:(t,e,i)=>{"use strict";i.d(e,{AO:()=>c,IH:()=>l,a5:()=>u});var r=i(63939),s=i(50932),a=(i(56490),i(11473)),n=i(14686),o=i(37837);function l(t){c(r.f[20](t)),(0,o.aI)(t)}function c(t){if(t){for(;s.M[15](t,r.f[15](t)-1),r.f[15](t)+1;)(0,o.aI)(r.f[20](t+4)+8*r.f[15](t)),(0,o.aI)(r.f[20](t+4)+8*r.f[15](t)+4);(0,o.aI)(t+4)}}function h(t,e){let i=0;return t?(e&&(i=1+(e-r.f[20](t+4)>>>3)),i>=r.f[15](t)?0:r.f[20](t+4)+8*i):0}function u(t,e,i,o=0){if(!t)throw new Error("m is nullptr");let l=0;if(64&o&&(l=function(t,e,i=0,s=0){if(!t)return 0;let a=i;if(!e)return 0;for(;a=h(t,a);){let t=(0,n.lH)(r.f[20](a));if(1&s&&(t.toLocaleLowerCase(),e.toLocaleLowerCase()),t===e||2&s&&0===t.indexOf(e))return a}}(t,e,0,o)),l){if(16&o)return 0;32&o&&(i=`${(0,n.lH)(r.f[20](l+4))},${i}`),a.s_.free(r.f[20](l+4)),s.M[20](l+4,a.s_.malloc(i.length+1)),(0,n.qW)(r.f[20](l+4),i,i.length)}else{let o=a.s_.realloc(r.f[20](t+4),8*(r.f[15](t)+1));s.M[20](t+4,o),s.M[20](r.f[20](t+4)+8*r.f[15](t),a.s_.malloc(e.length+1)),s.M[20](r.f[20](t+4)+8*r.f[15](t)+4,a.s_.malloc(i.length+1)),(0,n.qW)(r.f[20](r.f[20](t+4)+8*r.f[15](t)),e,e.length),(0,n.qW)(r.f[20](r.f[20](t+4)+8*r.f[15](t)+4),i,i.length),s.M[15](t,r.f[15](t)+1)}return 0}},56024:(t,e,i)=>{"use strict";i.d(e,{FP:()=>f,_h:()=>v,aH:()=>g,rh:()=>y,to:()=>A,xj:()=>p});var r=i(63939),s=i(50932),a=(i(36981),i(9599),i(55833)),n=i(37837),o=i(14686),l=i(77231),c=i(37815),h=i(73749),u=(i(99991),i(66788)),d=i(9705);function f(){const t=(0,n.Gy)(320);return v(t),t}function p(t){A(t),(0,n.Eb)(t)}function m(t){const e=r.f[20](t);(0,c.Q7)(e+16),(0,h.IH)(e+12),(0,n.aI)(t)}function g(t,e){for(let i=0;ia.pu){if(s.M[20](t+64,(0,n.sY)(4*l)),s.M[20](t+188,(0,n.sY)(4*l)),!r.f[20](t+188)||!r.f[20](t+64))return(0,n.aI)(t+64),(0,n.aI)(t+188),d.gR;s.M[15](t+192,l-a.pu)}else s.M[20](t+64,t);for(let e=0;e{"use strict";i.d(e,{$W:()=>f,E4:()=>p,Is:()=>g,NX:()=>I,NZ:()=>A,Ow:()=>m,Pd:()=>b,Qe:()=>y,Up:()=>T,Zx:()=>_,_5:()=>v,fQ:()=>d,iI:()=>h,rN:()=>k,rU:()=>u,zu:()=>x});var r=i(14686),s=i(63939),a=i(50932),n=(i(47958),i(37837)),o=i(77231),l=i(37815);const c=64;function h(t,e){return e?(0,r.JW)(s.f[20](t+24),s.f[15](t+28)):(0,r.s3)(s.f[20](t+24),s.f[15](t+28))}function u(t,e){for(let i=0;i-1)if(1===s.f[15](t+44))(0,n.Eb)(s.f[20](s.f[20](t+40))),(0,n.Eb)(s.f[20](t+40)),a.M[20](t+40,0),a.M[15](t+44,0);else{const e=12*(s.f[15](t+44)-1),o=(0,n.Gy)(e);for(let e=0;e{"use strict";i.d(e,{ML:()=>h,bl:()=>c});var r=i(63939),s=i(50932),a=i(85103),n=i(37837),o=i(14686),l=i(9705);function c(t){2==r.f[15](t)&&(0,n.aI)(t+8),(0,o.sO)(t,0,24)}function h(t,e){return e?(s.M[15](t,1),s.M[15](t+4,(0,a.Xb)(BigInt(e>>>0))),s.M[10](t+8,BigInt(e>>>0)),0):l.UY}},71766:(t,e,i)=>{"use strict";i.d(e,{Yi:()=>h,dn:()=>u});var r=i(14686),s=i(63939),a=i(50932),n=(i(36981),i(9599),i(37837)),o=i(99991),l=i(71517),c=i(77231);function h(t,e){a.M[15](t,s.f[15](e)),a.M[15](t+4,s.f[15](e+4)),a.M[8](t+8,s.f[8](e+8)),a.M[15](t+28,s.f[15](e+28)),a.M[17](t+32,s.f[17](e+32)),a.M[15](t+40,s.f[15](e+40)),a.M[15](t+44,s.f[15](e+44)),a.M[15](t+48,s.f[15](e+48)),a.M[15](t+52,s.f[15](e+52)),a.M[15](t+56,s.f[15](e+56)),a.M[15](t+60,s.f[15](e+60)),a.M[15](t+68,s.f[15](e+68)),a.M[15](t+64,s.f[15](e+64)),a.M[15](t+80,s.f[15](e+80)),a.M[15](t+84,s.f[15](e+84)),a.M[15](t+88,s.f[15](e+88)),a.M[15](t+92,s.f[15](e+92)),a.M[15](t+96,s.f[15](e+96)),a.M[15](t+100,s.f[15](e+100)),a.M[15](t+104,s.f[15](e+104)),(0,r.Mr)(t+112,e+112,24),a.M[15](t+136,s.f[15](e+136)),a.M[15](t+140,s.f[15](e+140)),a.M[15](t+144,s.f[15](e+144)),a.M[15](t+148,s.f[15](e+148)),a.M[15](t+152,s.f[15](e+152)),a.M[15](t+156,s.f[15](e+156)),(0,r.Mr)(t+72,e+72,8),s.f[20](e+12)&&(s.f[20](t+12)&&(0,n.Eb)(s.f[20](t+12)),a.M[20](t+12,(0,n.sY)(s.f[15](e+16))),a.M[15](t+16,s.f[15](e+16)),(0,r.Mr)(s.f[20](t+12),s.f[20](e+12),s.f[15](e+16))),s.f[20](e+20)&&function(t,e,i,o){if(!i)return;const l=(0,n.Gy)(12*o);for(let t=0;t{"use strict";function r(t){return t=(t=(858993459&(t-=t>>1&1431655765))+(t>>2&858993459))+(t>>4)&252645135,(t+=t>>8)+(t>>16)&63}function s(t){return r(Number(BigInt.asUintN(32,t)))+r(Number(BigInt.asUintN(32,t>>BigInt(32))))}function a(t){const e=t/BigInt(1e3),i=t-e*BigInt(1e3);return Number(e)+Number(i)/1e3}i.d(e,{Xb:()=>s,yw:()=>a})},23991:(t,e,i)=>{"use strict";function r(t){let e=0,i=0;for(;i<32&&0===t.readU1();)i++;return e=t.readU(i),e+=(1<s,xb:()=>r})},39381:(t,e,i)=>{"use strict";i.d(e,{E3:()=>a,Sg:()=>c,Y0:()=>l,ht:()=>o,r8:()=>s,yd:()=>n});var r=i(63939);function s(t){return r.f[2](t)}function a(t){return s(t+1)<<8|s(t)}function n(t){return s(t)<<8|s(t+1)}function o(t){return s(t)<<16|s(t+1)<<8|s(t+2)}function l(t){return a(t+2)<<16|a(t)}function c(t){return n(t)<<16|n(t+2)}},37837:(t,e,i)=>{"use strict";i.d(e,{Eb:()=>u,Gy:()=>h,aI:()=>d,cz:()=>f,sY:()=>c});var r=i(11473),s=i(63939),a=i(50932),n=i(14686),o=i(4624);const l="src/avutil/util/mem.ts";function c(t){const e=r.s_.malloc(t);return e||o.h2("can not alloc buffer",l,32),e}function h(t){const e=r.s_.malloc(t);return e||o.h2("can not alloc buffer",l,40),(0,n.sO)(e,0,t),e}function u(t){r.s_.free(t)}function d(t){r.s_.free(s.f[20](t)),a.M[20](t,0)}function f(t,e){return r.s_.realloc(t,e)}},60264:(t,e,i)=>{"use strict";i.d(e,{BN:()=>c,Bs:()=>a,Ky:()=>n,nW:()=>l,py:()=>o}),i(31865);var r=i(729),s=i(72739);function a(t){return t.length>4&&0===t[0]&&0===t[1]&&(1===t[2]||0===t[2]&&1===t[3])}function n(t,e){let i=0;for(let r=e;r=2)return{offset:r-Math.min(i,3),startCode:Math.min(i+1,4)};i=0;break;default:i=0}return{offset:-1,startCode:0}}function o(t){const e=[];let i=n(t,0),r={offset:-1,startCode:0};for(;r=n(t,i.offset+i.startCode),r.offset>-1;)e.push(t.subarray(i.offset+i.startCode,r.offset,!0)),i=r;return e.push(t.subarray(i.offset+i.startCode,void 0,!0)),e}function l(t,e,i=!1){if(!e){let r=t.reduce(((t,e,r)=>t+(r||i?3:4)+e.length),0);e=new Uint8Array(r)}const a=new r.A(e);return s.__(t,((t,e)=>{a.writeUint8(0),a.writeUint8(0),e||i||a.writeUint8(0),a.writeUint8(1),a.writeBuffer(t)})),e}function c(t,e=0,i){i||(i=t.length);const r=new Uint8Array(t.length);let s=0,a=0;for(let n=0;n=e&&n{"use strict";i(97317),i(77231),i(37837)},44328:(t,e,i)=>{"use strict";i.d(e,{iU:()=>n,k:()=>s,lb:()=>a});var r=i(31658);function s(t,e,i){return t*BigInt(0|e.num)*BigInt(0|i.den)/(BigInt(0|e.den)*BigInt(0|i.num))}function a(t){return t.num/t.den}function n(t){const e=(0,r.A)(t.num,t.den);e<=1||(t.den/=e,t.num/=e)}},66788:(t,e,i)=>{"use strict";i.d(e,{K0:()=>n,f8:()=>o});var r=i(77231),s=i(95073),a=(i(37837),i(58055));function n(t){return!(t<0||t>=12)&&a.J[t].planar}function o(t,e,i,o){const l=function(t){return t<0||t>=12?0:a.J[t].bits>>3}(t),c=n(t);return!l||i<=0||e<=0?-1:(o||(o=1,i=(0,s.A)(i,32)),e>r.go/o||e*i>(r.go-o*e)/l?-1:c?(0,s.A)(i*l,o):(0,s.A)(i*l*e,o))}},71762:(t,e,i)=>{"use strict";i.d(e,{T8:()=>u,Wu:()=>h,r0:()=>c,wm:()=>l});var r=i(63939),s=i(50932),a=i(14686),n=i(71517),o=i(37837);function l(t){const e={pts:r.f[17](t+8),dts:r.f[17](t+16),data:(0,n.iI)(t).slice(),streamIndex:r.f[15](t+32),flags:r.f[15](t+36),sideData:[],duration:r.f[17](t+48),pos:r.f[17](t+56),timeBase:{den:r.f[15](t+76),num:r.f[15](t+72)},bitFormat:r.f[15](t+80)};for(let i=0;i{"use strict";i.d(e,{A:()=>f});var r=i(134),s=i(95335),a=i(72739),n=i(73783),o=i(7417),l=i(4624);const c="src/cheap/allocator/AllocatorJS.ts",h=v(16),u=32,d=68;class f{constructor(t,e=!0){var i,a,n,o;(0,r.A)(this,"buffer",void 0),(0,r.A)(this,"byteOffset",void 0),(0,r.A)(this,"heapOffset",void 0),(0,r.A)(this,"heapLength",void 0),(0,r.A)(this,"int32Array",void 0),(0,r.A)(this,"updates",void 0),(0,r.A)(this,"options",void 0),(0,r.A)(this,"shared",void 0),(0,r.A)(this,"handles",void 0),this.options=s.X$({growSize:1048576,maxHeapSize:2097152e3},t),this.handles=[],this.buffer=t.buffer,this.shared=!1,this.options.memory||this.buffer instanceof ArrayBuffer||this.buffer instanceof SharedArrayBuffer?(this.byteOffset=null!==(i=t.byteOffset)&&void 0!==i?i:0,this.heapOffset=A(this.byteOffset+g(u),null!==(a=t.byteLength)&&void 0!==a?a:this.buffer.byteLength),this.heapLength=b((null!==(n=t.byteLength)&&void 0!==n?n:this.buffer.byteLength)-this.heapOffset),this.int32Array=new Int32Array(this.buffer,this.heapOffset,v(this.heapLength)),this.updates=new Int32Array(this.buffer,this.byteOffset,u),"function"==typeof SharedArrayBuffer&&this.buffer instanceof SharedArrayBuffer&&(this.shared=!0)):l.h2("Expected buffer to be an instance of Buffer or ArrayBuffer",c,109),e&&(this.updates.fill(1),function(t){return 65===t[0]&&65===t[66]}(o=this.int32Array)||function(t){const e=t.length-69;k(t,65,1),t[1]=1,t[3]=68;for(let e=1;e=t.length-d?l.h2(`Got invalid sized chunk at ${g(e)} (${g(i)} bytes).`,c,568):I(t,e)?p(t,e,i):m(t,e,i),e+=i+2}}(this.int32Array))}addUpdateHandle(t){a.zy(this.handles,t)||this.handles.push(t)}removeUpdateHandle(t){a.TF(this.handles,t)}malloc_(t){(t=y(t,7))<16&&(t=16);const e=v(t),i=this.findFreeBlock(this.int32Array,e);if(i<=1)return 0;const r=w(this.int32Array,i);return r-(e+2)>=h?function(t,e,i,r,s){const a=e+i+2,n=r-(a-e);_(t,e,r,s),t[e-1]=-i,t[e+i]=-i,t[a-1]=-n,t[a+n]=-n,C(t,a,n,s)}(this.int32Array,i,e,r,this.updates):_(this.int32Array,i,r,this.updates),g(i)+this.heapOffset}malloc(t){this.shared&&((0,n.s2)(o.II,!0),this.checkBuffer());const e=this.malloc_(t);return this.shared&&(0,n.Tl)(o.II),e}calloc_(t,e){let i=t*e;i=i<16?16:y(i,7);const r=this.malloc_(i);if(0===r)return 0;const s=v(r-this.heapOffset);return this.int32Array.subarray(s,s+v(i)).fill(0),r}calloc(t,e){this.shared&&((0,n.s2)(o.II,!0),this.checkBuffer());const i=this.calloc_(t,e);return this.shared&&(0,n.Tl)(o.II),i}realloc_(t,e){if(0===t)return this.malloc_(e);const i=t;if(0===e)return this.free_(i),0;let r=v(t-=this.heapOffset),s=r,a=0;S(this.int32Array,r)&&(s=this.int32Array[r-1],a=r-s);const n=w(this.int32Array,s)-a;if(n>=v(y(e,7)))return i;{const t=this.malloc_(e);return 0===t?(this.free_(i),0):(this.int32Array.set(this.int32Array.subarray(r,r+n),v(t-this.heapOffset)),this.free_(i),t)}}realloc(t,e){return this.shared&&((0,n.s2)(o.II,!0),this.checkBuffer()),t=this.realloc_(t,e),this.shared&&(0,n.Tl)(o.II),t}alignedAlloc_(t,e){if(t<=8)return this.malloc_(e);const i=this.malloc_(e+t-1+4);if(0===i)return 0;const r=i+t-1+4&~(t-1);return this.int32Array[v(r-this.heapOffset)-1]=v(i-this.heapOffset),r}alignedAlloc(t,e){this.shared&&((0,n.s2)(o.II,!0),this.checkBuffer());const i=this.alignedAlloc_(t,e);return this.shared&&(0,n.Tl)(o.II),i}free_(t){if(0===t)return;let e=v(t-=this.heapOffset);if(S(this.int32Array,e)&&(e=this.int32Array[e-1]),I(this.int32Array,e))return;const i=w(this.int32Array,e),r=P(this.int32Array,e),s=function(t,e){const i=w(t,e);if(e+i+2>=t.length-2)return 0;const r=e+i+2;return t[r-1]<2?0:r}(this.int32Array,e);0!==r?0!==s?function(t,e,i,r,s,a){const n=w(t,e),o=w(t,s),l=s-e+o;_(t,e,n,a),_(t,s,o,a),t[e-1]=-l,t[s+o]=-l,C(t,e,l,a)}(this.int32Array,r,0,0,s,this.updates):M(this.int32Array,r,e,i,this.updates):0!==s?function(t,e,i,r,s){const a=w(t,e);_(t,e,a,s);const n=r+a+2;t[i-1]=-n,t[e+a]=-n,C(t,i,n,s)}(this.int32Array,s,e,i,this.updates):C(this.int32Array,e,i,this.updates)}free(t){this.shared&&((0,n.s2)(o.II,!0),this.checkBuffer()),this.free_(t),this.shared&&(0,n.Tl)(o.II)}sizeof(t){if(0===t)return 0;let e=v(t-=this.heapOffset);return S(this.int32Array,e)&&(e=this.int32Array[e-1]),g(w(this.int32Array,e))}inspect(){return this.checkBuffer(),function(t,e){const i=[],r=x(t,1,e);let s=d,a=0;for(;s=t.length)&&l.h2(`Got invalid sized chunk at ${g(s)} (${g(r)})`,c,624),I(t,s)?i.push(x(t,s,e)):(a+=g(r),i.push({type:"used",block:s,offset:g(s)+e,size:g(r)})),s+=r+2}return{header:r,blocks:i,total:g(t.length),used:a}}(this.int32Array,this.heapOffset)}findFreeBlock(t,e){let i=function(t,e){let i=1;for(let r=t[1];r>0;r--){let s=t[i+2+(r-1)];for(;1!==s&&t[s-1]{t(this.buffer)})),this.findFreeBlock(this.int32Array,e)}return i}return i}getBuffer(){return this.buffer}isAlloc(t){this.shared&&((0,n.s2)(o.II,!0),this.checkBuffer());const e=v(t-this.heapOffset);let i=this.int32Array[3];for(;i&&1!==i;){if(e>=i&&eu)&&l.h2(`Block ${g(e)} height must be between 1 and 32, got ${r}.`,c,589);for(let i=0;i=d&&!I(t,r)&&l.h2(`Block ${g(e)} has a pointer to a non-free block (${g(r)}).`,c,595)}return!0}function m(t,e,i){if(t[e-1]===t[e+i])return!0;l.h2(`Block length header does not match footer (${g(t[e-1])} vs ${g(t[e+i])}).`,c,604)}function g(t){return t<<2>>>0}function v(t){return t>>>2}function y(t,e){return(t+e&~e)>>>0}function A(t,e){const i=e-t;return t+(y(i,7)===i?0:i-y(i,7)+8)}function b(t){return t-4}function x(t,e,i){const r=t[e+0],s=[];for(let i=0;i>31;return i+r^r}function k(t,e,i){t[i-1]=e,t[i+e]=e}function T(t,e,i){let r=1;for(let s=t[1];s>0;s--){let a=r+2+(s-1);for(;t[a]>=d&&t[t[a]-1]=0;i--)t[s+2+i]===e&&(r[i]=s);s=t[s+2]}let a=t[1];for(let i=0;i0&&1===t[a-1+3];)a--,t[1]=a;t[e-1]=-i,t[e+i]=-i}function I(t,e){return!(e<65)&&!(t[e-1]<0)}function S(t,e){return!(e<65)&&!(t[e-1]<0)}function P(t,e){if(e<=d)return 0;const i=t[e-2];return i<2?0:e-(2+i)}function C(t,e,i,r){T(t,i,r);const s=function(t,e,i,r){const s=t[1];let a=function(){let t=1;for(;Math.random()<.5&&ts){const i=s+1;return t[1]=i,t[i-1+3]=1,r[i]=1,t[e+0]=i,i}return t[e+0]=a,a}(t,e,i,r);for(let i=1;i<=s;i++){const s=r[i-1]+2+(i-1);t[e+2+(i-1)]=t[s],t[s]=e,r[i-1]=1}return t[e-1]=i,t[e+i]=i,i}function M(t,e,i,r,s){const a=i-e+r;return _(t,e,i-e-2,s),t[e-1]=-a,t[i+r]=-a,C(t,e,a,s),r}},94321:(t,e,i)=>{"use strict";i.d(e,{z:()=>s});var r=i(134);class s{constructor(){(0,r.A)(this,"table",void 0),(0,r.A)(this,"pointer",void 0),(0,r.A)(this,"nodes",void 0),this.table=new WebAssembly.Table({initial:16,element:"anyfunc"}),this.pointer=6,this.nodes=[{pointer:this.pointer,length:10,free:!0}]}getPointer(){return this.pointer}alloc(t){let e=this.findFree(t);if(e<0){const i=this.nodes[this.nodes.length-1],r=t-(i.free?i.length:0);this.table.grow(r),i.free?i.length=i.length+r:this.nodes.push({pointer:i.pointer+i.length,length:r,free:!0}),e=this.findFree(t)}const i=this.nodes[e];return i.length>t&&(this.nodes.splice(e+1,0,{pointer:i.pointer+t,length:i.length-t,free:!0}),i.length=t),i.free=!1,i.pointer}free(t){let e=this.findNode(t);const i=this.nodes[e];if(i&&!i.free){const t=this.nodes[e-1],r=this.nodes[e+1];t&&t.free?r&&r.free?(t.length+=i.length+r.length,this.nodes.splice(e,2)):(t.length+=i.length,this.nodes.splice(e,1)):r&&r.free?(i.length+=r.length,this.nodes.splice(e+1,1),i.free=!0):i.free=!0}if(1===this.nodes.length&&this.nodes[0].free){const t=new WebAssembly.Table({initial:16,element:"anyfunc"});this.pointer=6,this.nodes=[{pointer:this.pointer,length:10,free:!0}];for(let e=1;e=this.pointer)throw new RangeError("index out of bound");this.table.set(t,e)}inspect(){return this.nodes}findFree(t){let e=-1;for(let i=0;i=t&&this.nodes[i].free){e=i;break}return e}findNode(t){let e=-1;for(let i=0;i{"use strict";i.d(e,{Ay:()=>d});var r=i(4919),s=i(4624),a=i(63939),n=i(50932),o=i(88096),l=i(5679),c=i.n(l);const h="src/cheap/asm/memory.ts";let u;async function d(t,e,i){try{const s=o.bx((0,r.E_)(c()),{shared:"function"==typeof SharedArrayBuffer&&t.buffer instanceof SharedArrayBuffer,initial:e,maximum:i});u=(await WebAssembly.instantiate(s,{env:{memory:t}})).instance,(0,a.$)({4:u.exports.readU8,5:u.exports.readU8,2:u.exports.readU8,3:u.exports.readU8,6:u.exports.readU16,7:u.exports.readU16,8:t=>u.exports.read32(t)>>>0,9:t=>u.exports.read32(t)>>>0,10:t=>BigInt.asUintN(64,u.exports.read64(t)),22:t=>BigInt.asUintN(64,u.exports.read64(t)),11:u.exports.read8,12:u.exports.read8,13:u.exports.read16,14:u.exports.read16,15:u.exports.read32,16:u.exports.read32,17:u.exports.read64,21:u.exports.read64,18:u.exports.readf32,19:u.exports.readf64,20:t=>u.exports.read32(t)>>>0}),(0,n.$)({4:u.exports.write8,5:u.exports.write8,2:u.exports.write8,3:u.exports.write8,6:u.exports.write16,7:u.exports.write16,8:u.exports.write32,9:u.exports.write32,10:u.exports.write64,22:u.exports.write64,11:u.exports.write8,12:u.exports.write8,13:u.exports.write16,14:u.exports.write16,15:u.exports.write32,16:u.exports.write32,17:u.exports.write64,21:u.exports.write64,18:u.exports.writef32,19:u.exports.writef64,20:u.exports.write32})}catch(t){s.R8("memory asm not support, cannot use asm memory function",h,102)}}},26429:(t,e,i)=>{"use strict";i.r(e),i.d(e,{HEAP_INITIAL:()=>f,HEAP_MAXIMUM:()=>p,HEAP_OFFSET:()=>d,STACK_ALIGNMENT:()=>h,STACK_SIZE:()=>u,USE_THREADS:()=>c});var r,s,a=i(95797),n=i(10576),o=i(86834),l=i(44690);const c=!!a.A.thread&&!0!==n.TK.CHEAP_DISABLE_THREAD;let h=16,u=1048576;const d=1024,f=null!==(r=n.TK.CHEAP_HEAP_INITIAL)&&void 0!==r?r:265,p=null!==(s=n.TK.CHEAP_HEAP_MAXIMUM)&&void 0!==s?s:c&&l.A.ios&&!o.A.checkVersion(l.A.version,"17",!0)?8192:65536},73281:(t,e,i)=>{"use strict";i.d(e,{A:()=>B});var r=i(59135),s=i(63939),a=i(50932);let n,o;const l=(0,r.A)();function c(t,e){o().setUint8(t,e)}function h(t){return o().getUint8(t)}function u(t,e){o().setUint16(t,e,l)}function d(t){return o().getUint16(t,l)}function f(t,e){o().setUint32(t,e,l)}function p(t){return o().getUint32(t,l)}function m(t,e){o().setBigUint64(t,e,l)}function g(t){return o().getBigUint64(t,l)}function v(t,e){o().setInt8(t,e)}function y(t){return o().getInt8(t)}function A(t,e){o().setInt16(t,e,l)}function b(t){return o().getInt16(t,l)}function x(t,e){o().setInt32(t,e,l)}function w(t){return o().getInt32(t,l)}function k(t,e){o().setBigInt64(t,e,l)}function T(t){return o().getBigInt64(t,l)}function _(t,e){o().setFloat32(t,e,l)}function I(t){return o().getFloat32(t,l)}function S(t,e){o().setFloat64(t,e,l)}function P(t){return o().getFloat64(t,l)}function C(t){return o().getUint32(t,l)}function M(t,e){return o().setUint32(t,e,l)}function B(t,e){n=t,o=e,(0,s.$)({4:h,5:h,2:h,3:h,6:d,7:d,8:p,9:p,10:g,11:y,12:y,13:b,14:b,15:w,16:w,17:T,18:I,19:P,20:C,23:t=>!!y(t),24:t=>!!y(t)}),(0,a.$)({4:c,5:c,2:c,3:c,6:u,7:u,8:f,9:f,10:m,11:v,12:v,13:A,14:A,15:x,16:x,17:k,18:_,19:S,20:M,23:(t,e)=>{v(t,e?1:0)},24:(t,e)=>{v(t,e?1:0)}})}},63939:(t,e,i)=>{"use strict";i.d(e,{$:()=>a,f:()=>s});var r=i(95335);const s={4:function(t){throw new Error("unimplemented")},5:function(t){throw new Error("unimplemented")},2:function(t){throw new Error("unimplemented")},3:function(t){throw new Error("unimplemented")},6:function(t){throw new Error("unimplemented")},7:function(t){throw new Error("unimplemented")},8:function(t){throw new Error("unimplemented")},9:function(t){throw new Error("unimplemented")},10:function(t){throw new Error("unimplemented")},11:function(t){throw new Error("unimplemented")},12:function(t){throw new Error("unimplemented")},13:function(t){throw new Error("unimplemented")},14:function(t){throw new Error("unimplemented")},15:function(t){throw new Error("unimplemented")},16:function(t){throw new Error("unimplemented")},17:function(t){throw new Error("unimplemented")},18:function(t){throw new Error("unimplemented")},19:function(t){throw new Error("unimplemented")},20:function(t){throw new Error("unimplemented")},0:function(t){throw new Error("invalid operate")},1:function(t){throw new Error("invalid operate")},22:function(t){throw new Error("invalid operate")},21:function(t){throw new Error("invalid operate")},23:function(t){throw new Error("invalid operate")},24:function(t){throw new Error("invalid operate")}};function a(t){r.X$(s,t)}},50932:(t,e,i)=>{"use strict";i.d(e,{$:()=>a,M:()=>s});var r=i(95335);const s={4:function(t,e){throw new Error("unimplemented")},5:function(t,e){throw new Error("unimplemented")},2:function(t,e){throw new Error("unimplemented")},3:function(t,e){throw new Error("unimplemented")},6:function(t,e){throw new Error("unimplemented")},7:function(t,e){throw new Error("unimplemented")},8:function(t,e){throw new Error("unimplemented")},9:function(t,e){throw new Error("unimplemented")},10:function(t,e){throw new Error("unimplemented")},11:function(t,e){throw new Error("unimplemented")},12:function(t,e){throw new Error("unimplemented")},13:function(t,e){throw new Error("unimplemented")},14:function(t,e){throw new Error("unimplemented")},15:function(t,e){throw new Error("unimplemented")},16:function(t,e){throw new Error("unimplemented")},17:function(t,e){throw new Error("unimplemented")},18:function(t,e){throw new Error("unimplemented")},19:function(t,e){throw new Error("unimplemented")},20:function(t,e){throw new Error("unimplemented")},0:function(t,e){throw new Error("invalid operate")},1:function(t,e){throw new Error("invalid operate")},22:function(t,e){throw new Error("invalid operate")},21:function(t,e){throw new Error("invalid operate")},23:function(t,e){throw new Error("invalid operate")},24:function(t,e){throw new Error("invalid operate")}};function a(t){r.X$(s,t)}},25323:(t,e,i)=>{"use strict";i.d(e,{X:()=>B,l:()=>M});var r=i(66681),s=i.n(r),a=i(11919),n=i.n(a),o=i(75019),l=i.n(o),c=i(99921),h=i(63939),u=i(50932),d=i(61499),f=i(6704),p=i(67672),m=i(95335),g=i(62100),v=i(72739);function y(t,e,i,r){s()(t,e,{get:i,set:r,configurable:!0,enumerable:!0})}function A(t){return function(){return h.f[20](t())}}function b(t,e,i,r){return function(){return t[`__$__${e}`]||(t[`__$__${e}`]=M(i(),r))}}function x(t,e){return function(){return h.f[e](t())}}function w(t,e,i,r){const s=8*f.i[e]-r-i,a=Math.pow(2,i)-1;return function(){return h.f[e](t())>>>s&a}}function k(t){return function(e){u.M[20](t(),e)}}function T(t,e,i,r){const s=`__$__${e}`;return function(e){const a=t[s]||(t[s]=M(i(),r));m.__(e,((t,e)=>{a[e]=t})),t[s]=a}}function _(t,e){return function(i){u.M[e](t(),i)}}function I(t,e,i,r){let s=0,a=8*f.i[e];for(let t=0;tt()+s*a),i),T(r,e,(()=>t()+s*a),i))}return r}(i,r,s);n[d.o9]=i(),v.__(e,((t,e)=>{n[e]=t})),t[a]=n}}function C(t,e,i,r,s){const a=`__$__${e}`;return function(e){let n=t[a]||function(t,e,i){const r={};let s=(0,c.A)(i);for(let a=0;at()+s*a),i),_((()=>t()+s*a),i));return r}(i,r,s);n[d.o9]=i(),v.__(e,((t,e)=>{n[e]=t})),t[a]=n}}function M(t,e){let i=p.Pc(e)?e.prototype:e;const r={};for(r[d.o9]=t,n()(r,i);;){let t=i[d.JY];if(t&&t.forEach(((t,e)=>{t[3]?t[1]?y(r,e,S((()=>r[d.o9]+t[7]),r,e),C(r,e,(()=>r[d.o9]+t[7]),t[4],20)):p.Pc(t[0])||p.Ik(t[0])?y(r,e,S((()=>r[d.o9]+t[7]),r,e),P(r,e,(()=>r[d.o9]+t[7]),t[4],t[0])):y(r,e,S((()=>r[d.o9]+t[7]),r,e),C(r,e,(()=>r[d.o9]+t[7]),t[4],t[0])):t[1]?y(r,e,A((()=>r[d.o9]+t[7])),k((()=>r[d.o9]+t[7]))):p.Pc(t[0])||p.Ik(t[0])?y(r,e,b(r,e,(()=>r[d.o9]+t[7]),t[0]),T(r,e,(()=>r[d.o9]+t[7]),t[0])):t[5]?y(r,e,w((()=>r[d.o9]+t[7]),t[0],t[6],t[8]),I((()=>r[d.o9]+t[7]),t[0],t[6],t[8])):y(r,e,x((()=>r[d.o9]+t[7]),t[0]),_((()=>r[d.o9]+t[7]),t[0]))})),i=l()(i),!i)break}return r}function B(t){let e=l()(t);for(;;){let i=e[d.JY];if(i&&i.forEach(((e,i)=>{delete t[i]})),e=l()(e),!e)break}}},12085:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(66681),s=i.n(r);function a(t,e,i){s()(t,e,{value:i,writable:!1,enumerable:!1,configurable:!1})}},11473:(t,e,i)=>{"use strict";i.d(e,{GE:()=>A,KZ:()=>N,Tg:()=>G,XI:()=>w,ce:()=>T,eq:()=>O,hZ:()=>$,pv:()=>W,s_:()=>k,wE:()=>b});var r=i(39638),s=i(95007),a=i(94321),n=i(10576),o=i(26429),l=i(7417),c=i(33856),h=i(98564),u=i(82854),d=i(73281),f=i(54568),p=i(86834),m=i(44690);let g=-1,v=!0,y="",A=null,b=null,x=0,w=null,k=null,T=null,_=null,I=null,S=null,P=null,C=null,M=null,B=null,E=null,D=null,R=null,U=null,L={5:C,3:C,7:M,9:B,22:E,12:_,14:I,16:S,21:P};function F(){return!(!T||T.buffer===C.buffer)}function O(){return F()&&V(T.buffer),C}function $(){return F()&&V(T.buffer),M}function N(){return F()&&V(T.buffer),U}function z(t){return F()&&V(T.buffer),L[t]}function V(t){_=new Int8Array(t),I=new Int16Array(t),S=new Int32Array(t),P=new BigInt64Array(t),C=new Uint8Array(t),M=new Uint16Array(t),B=new Uint32Array(t),E=new BigUint64Array(t),D=new Float32Array(t),R=new Float64Array(t),U=new DataView(t),L={5:C,3:C,7:M,9:B,22:E,12:_,14:I,16:S,21:P}}function W(){return Atomics.add(B,l.hb>>>2,1)}async function G(t){var e;(0,d.A)((()=>k),N),(0,c.A)(z),T=t.memory;var i;i=new s.A({buffer:T.buffer,memory:T,byteOffset:o.HEAP_OFFSET,maxHeapSize:64*o.HEAP_MAXIMUM*1024,growAllowed:!0,onResize:(t,e)=>(T.grow(e-t.byteLength>>>16),{buffer:T.buffer,byteOffset:o.HEAP_OFFSET})},!1),k&&k.removeUpdateHandle(V),k=i,n.TK.CHeap&&(n.TK.CHeap.Allocator=k),k.addUpdateHandle(V),V(k.getBuffer()),t.stackPointer&&(x=t.stackSize,b=t.stackPointer,A=new WebAssembly.Global({value:"i32",mutable:!0},b+x),w=new a.z),g="number"==typeof t.id?t.id:Atomics.add(B,l.hb>>>2,1),y=null!==(e=t.name)&&void 0!==e?e:"anonymous",n.TK.CHeap={initThread:G,Allocator:k,Table:w,ThreadId:g,ThreadName:y,Memory:T,Config:o,StackSize:x,StackTop:b,StackPointer:A,isMainThread:!1},v=!1,t.disableAsm||("function"==typeof BigInt&&BigInt!==Number&&(p.A.chrome&&p.A.checkVersion(p.A.majorVersion,"85",!0)||p.A.firefox&&p.A.checkVersion(p.A.majorVersion,"78",!0)||p.A.safari&&p.A.checkVersion(p.A.majorVersion,"15",!0)||m.A.ios&&p.A.checkVersion(m.A.version,"15",!0)||p.A.newEdge)&&await(0,h.Ay)(T,o.HEAP_INITIAL,o.HEAP_MAXIMUM),o.USE_THREADS&&(p.A.chrome&&p.A.checkVersion(p.A.majorVersion,"85",!0)||p.A.firefox&&p.A.checkVersion(p.A.majorVersion,"78",!0)||p.A.safari&&p.A.checkVersion(p.A.majorVersion,"15",!0)||m.A.ios&&p.A.checkVersion(m.A.version,"15",!0)||p.A.newEdge)&&await(0,u.Ay)(T,o.HEAP_INITIAL,o.HEAP_MAXIMUM))}!(0,r.A)()&&!(0,f.A)()||(0,r.A)()&&!o.USE_THREADS?function(){var t,e,i,r,f,_,I,P;if((0,d.A)((()=>k),N),(0,c.A)(z),T=null!==(t=n.TK.CHeap)&&void 0!==t&&t.Memory?n.TK.CHeap.Memory:new WebAssembly.Memory({initial:o.HEAP_INITIAL,maximum:o.HEAP_MAXIMUM,shared:o.USE_THREADS}),k=null!==(e=n.TK.CHeap)&&void 0!==e&&e.Allocator?n.TK.CHeap.Allocator:new s.A({buffer:T.buffer,memory:T,byteOffset:o.HEAP_OFFSET,maxHeapSize:64*o.HEAP_MAXIMUM*1024,growAllowed:!0,onResize:(t,e)=>(T.grow(e-t.byteLength>>>16),{buffer:T.buffer,byteOffset:o.HEAP_OFFSET})}),k.addUpdateHandle(V),V(k.getBuffer()),x=null!==(i=n.TK.CHeap)&&void 0!==i&&i.StackSize?n.TK.CHeap.StackSize:o.STACK_SIZE,b=null!==(r=n.TK.CHeap)&&void 0!==r&&r.StackTop?n.TK.CHeap.StackTop:k.malloc(x),A=null!==(f=n.TK.CHeap)&&void 0!==f&&f.StackPointer?n.TK.CHeap.StackPointer:new WebAssembly.Global({value:"i32",mutable:!0},b+x),w=null!==(_=n.TK.CHeap)&&void 0!==_&&_.Table?n.TK.CHeap.Table:new a.z,g=null!==(I=n.TK.CHeap)&&void 0!==I&&I.ThreadId?n.TK.CHeap.ThreadId:0,y=null!==(P=n.TK.CHeap)&&void 0!==P&&P.ThreadName?n.TK.CHeap.ThreadName:"main",!n.TK.CHeap)if(o.USE_THREADS)Atomics.store(B,l.hb>>>2,g+1),Atomics.store(S,l.II>>>2,0);else{B[l.hb>>>2]=g+1;let t=l.II>>>2;S[t]=0}"function"==typeof BigInt&&BigInt!==Number&&(p.A.chrome&&p.A.checkVersion(p.A.majorVersion,"85",!0)||p.A.firefox&&p.A.checkVersion(p.A.majorVersion,"78",!0)||p.A.safari&&p.A.checkVersion(p.A.majorVersion,"15",!0)||m.A.ios&&p.A.checkVersion(m.A.version,"15",!0)||p.A.newEdge)&&(0,h.Ay)(T,o.HEAP_INITIAL,o.HEAP_MAXIMUM),o.USE_THREADS&&(p.A.chrome&&p.A.checkVersion(p.A.majorVersion,"85",!0)||p.A.firefox&&p.A.checkVersion(p.A.majorVersion,"78",!0)||p.A.safari&&p.A.checkVersion(p.A.majorVersion,"15",!0)||m.A.ios&&p.A.checkVersion(m.A.version,"15",!0)||p.A.newEdge)&&(0,u.Ay)(T,o.HEAP_INITIAL,o.HEAP_MAXIMUM),n.TK.CHeap||(n.TK.CHeap={Allocator:k,Table:w,ThreadId:g,ThreadName:y,Memory:T,Config:o,StackSize:x,StackTop:b,StackPointer:A,isMainThread:!0,threadCounter:l.hb,heapMutex:l.II}),v=!0}():(n.TK.CHeap={initThread:G,isMainThread:!1,Config:o},v=!1)},80098:(t,e,i)=>{"use strict";i.d(e,{I_:()=>y,SQ:()=>A});var r=i(75019),s=i.n(r),a=i(11919),n=i.n(a),o=i(99921),l=i(63939),c=i(50932),h=i(61499),u=i(6704),d=i(67672),f=i(95335),p=i(72739),m=i(2148);const g=s()({});function v(t,e){for(;;){let i=t[h.JY];if(i){const t=i.get(e);if(t)return t}if(!(t=s()(t))||t===g)return null}}function y(t,e){const i=d.Pc(e)?e.prototype:e,r={};r[h.o9]=t,n()(r,i);const{proxy:s,revoke:a}=Proxy.revocable(r,{get(t,e,r){if(d.Yj(e)){const r=v(i,e.replace(/^\$+/,""));if(r){const i=t[h.o9]+r[7];if(r[3]){const r=t[e];return r[h.o9]=i,r}if(r[1])return l.f[20](i);if(d.Pc(r[0])||d.Ik(r[0]))return t[e]||(t[e]=y(i,r[0]));{let t=l.f[r[0]](i);return r[5]&&(t=t>>>8*u.i[r[0]]-r[8]-r[6]&Math.pow(2,r[6])-1),t}}return t[e]}return t[e]},set(t,e,r,s){if(d.Yj(e)){const s=v(i,e.replace(/^\$+/,""));if(s){const i=t[h.o9]+s[7];if(s[3]){const a=t[e]||function(t,e,i,r){const s={};s[h.o9]=t;let a=(0,o.A)(r?20:i);return new Proxy(s,{get(t,e,s){if(e===h.o9)return t[h.o9];const n=(0,m.A)(e);return r?l.f[20](t[h.o9]+n*a):d.Pc(i)?t[e]:l.f[i](t[h.o9]+n*a)},set(t,e,s,n){if(e===h.o9)return t[h.o9]=s,!0;const o=(0,m.A)(e);if(r)c.M[20](t[h.o9]+o*a,s),t[e]=s;else if(d.Pc(i)){const r=t[e]||(t[e]=y(t[h.o9]+o*a,i));f.__(s,((t,e)=>{r[e]=t})),t[e]=r}else c.M[i](t[h.o9]+o*a,s),t[e]=s;return!0}})}(i,s[4],s[0],s[1]);p.__(r,((t,e)=>{a[e]=t})),t[e]=a}else if(s[1])c.M[20](i,r),t[e]=r;else if(d.Pc(s[0])||d.Ik(s[0])){const a=t[e]||(t[e]=y(i,s[0]));f.__(r,((t,e)=>{a[e]=t})),t[e]=a}else{if(s[5]){let t=0,e=8*u.i[s[0]];for(let i=0;i{"use strict";i.d(e,{t:()=>a,z:()=>s});var r=i(11473);function s(t){return r.GE.value-=t,r.GE.value}function a(t){r.GE.value+=t}},7417:(t,e,i)=>{"use strict";i.d(e,{II:()=>c,hb:()=>l,z1:()=>o});var r,s,a=i(10576);let n=1;function o(t,e=1){let i=n;for(;i%e;)i+=1;return n=i+t,i}const l=null!==(r=a.TK.CHeap)&&void 0!==r&&r.threadCounter?a.TK.CHeap.threadCounter:o(4,4),c=null!==(s=a.TK.CHeap)&&void 0!==s&&s.heapMutex?a.TK.CHeap.heapMutex:o(4,4)},79630:(t,e,i)=>{"use strict";i.d(e,{A:()=>c});var r=i(134),s=i(63939),a=i(50932),n=i(11473),o=i(61403);class l{constructor(t,e){(0,r.A)(this,"pointer",void 0),(0,r.A)(this,"len",void 0),this.pointer=t,this.len=e}get byteLength(){return this.len}get buffer(){return(0,n.eq)().buffer}get byteOffset(){return this.pointer}getFloat32(t,e){return(0,n.KZ)().getFloat32(this.pointer+t,e)}getFloat64(t,e){return(0,n.KZ)().getFloat64(this.pointer+t,e)}getInt8(t){return(0,n.KZ)().getInt8(this.pointer+t)}getInt16(t,e){return(0,n.KZ)().getInt16(this.pointer+t,e)}getInt32(t,e){return(0,n.KZ)().getInt32(this.pointer+t,e)}getUint8(t){return(0,n.KZ)().getUint8(this.pointer+t)}getUint16(t,e){return(0,n.KZ)().getUint16(this.pointer+t,e)}getUint32(t,e){return(0,n.KZ)().getUint32(this.pointer+t,e)}setFloat32(t,e,i){(0,n.KZ)().setFloat32(this.pointer+t,e,i)}setFloat64(t,e,i){(0,n.KZ)().setFloat64(this.pointer+t,e,i)}setInt8(t,e){(0,n.KZ)().setInt8(this.pointer+t,e)}setInt16(t,e,i){(0,n.KZ)().setInt16(this.pointer+t,e,i)}setInt32(t,e,i){(0,n.KZ)().setInt32(this.pointer+t,e,i)}setUint8(t,e){(0,n.KZ)().setUint8(this.pointer+t,e)}setUint16(t,e,i){(0,n.KZ)().setUint16(this.pointer+t,e,i)}setUint32(t,e,i){(0,n.KZ)().setUint32(this.pointer+t,e,i)}getBigInt64(t,e){return(0,n.KZ)().getBigInt64(this.pointer+t,e)}getBigUint64(t,e){return(0,n.KZ)().getBigUint64(this.pointer+t,e)}setBigInt64(t,e,i){(0,n.KZ)().setBigInt64(this.pointer+t,e,i)}setBigUint64(t,e,i){(0,n.KZ)().setBigUint64(this.pointer+t,e,i)}}class c extends o.A{constructor(t,e){return super(),(0,r.A)(this,"pointer",void 0),(0,r.A)(this,"len",void 0),this.pointer=t,this.len=e,this.proxy}getIndexValue(t){return s.f[2](this.pointer+t)}setIndexValue(t,e){a.M[2](this.pointer+t,e)}set(t,e=0){(0,n.eq)().set(t,this.pointer+e)}subarray(t=0,e,i){return i?new c(this.pointer+t,(e||this.len)-t):(0,n.eq)().subarray(this.pointer+t,this.pointer+(null!=e?e:this.len))}slice(t=0,e){return(0,n.eq)().slice(this.pointer+t,this.pointer+(null!=e?e:this.len))}get length(){return this.len}get byteLength(){return this.len}get buffer(){return(0,n.eq)().buffer}get byteOffset(){return this.pointer}get view(){return new l(this.pointer,this.len)}}},12264:(t,e,i)=>{"use strict";i.d(e,{A:()=>y});var r,s,a=i(134),n=i(80662),o=i.n(n),l=i(61499),c=i(12085),h=i(11473),u=i(63939),d=i(50932),f=i(99921),p=i(14686),m=i(67672),g=i(29170);class v{constructor(){(0,a.A)(this,"prev",void 0),(0,a.A)(this,"next",void 0),(0,a.A)(this,"data",void 0)}}r=v.prototype,(s=new(o())).set("prev",{0:v,1:1,2:1,3:0,4:0,5:0,6:0,7:0,8:0}),s.set("next",{0:v,1:1,2:1,3:0,4:0,5:0,6:0,7:4,8:0}),s.set("data",{0:1,1:1,2:1,3:0,4:0,5:0,6:0,7:8,8:0}),(0,c.A)(r,l.Og,!0),(0,c.A)(r,l.dc,4),(0,c.A)(r,l.g7,12),(0,c.A)(r,l.JY,s);class y{constructor(){(0,a.A)(this,"length",0),(0,a.A)(this,"head",0),(0,a.A)(this,"tail",0)}createNode(t,e,i=!1){const r=h.s_.malloc(12);if(d.M[20](r+4,0),d.M[20](r,0),m.ai(e))if(20===e)d.M[20](r+8,t);else{const i=h.s_.malloc((0,f.A)(e));d.M[e](i,t),d.M[20](r+8,i)}else if(i)d.M[20](r+8,t);else{const i=h.s_.malloc((0,f.A)(e));(0,p.Mr)(i,t[l.o9],(0,f.A)(e)),d.M[20](r+8,i)}return r}getItem(t,e){let i;return i=m.ai(e)?20===e?t:u.f[e](t):(0,g.A)(t,e),i}push(t,e,i=!1){const r=this.createNode(t,e,i);this.tail?(d.M[20](this.tail+4,r),d.M[20](r,this.tail),this.tail=r):(this.head=r,this.tail=r),this.length++}pop(t){const e=this.tail;let i=this.getItem(u.f[20](e+8),t);return this.length>1?(d.M[20](u.f[20](e)+4,0),this.tail=u.f[20](e)):(this.head=0,this.tail=0),this.length--,h.s_.free(u.f[20](e+8)),h.s_.free(e),i}shift(t){const e=this.head;let i=this.getItem(u.f[20](e+8),t);return this.length>1?(d.M[20](u.f[20](e+4),0),this.head=u.f[20](e+4)):(this.head=0,this.tail=0),this.length--,h.s_.free(u.f[20](e+8)),h.s_.free(e),i}unshift(t,e,i=!1){const r=this.createNode(t,e,i);this.head?(d.M[20](this.head,r),d.M[20](r+4,this.head),this.head=r):(this.head=r,this.tail=r),this.length++}forEach(t,e){if(!this.length)return;let i=this.head,r=0;for(;0!==i&&!1!==t(this.getItem(u.f[20](i+8),e),r);)i=u.f[20](i+4),r++}find(t,e){if(!this.length)return 0;let i=this.head,r=0;for(;0!==i;){const s=this.getItem(u.f[20](i+8),e);if(!0===t(s,r))return s;i=u.f[20](i+4),r++}return 0}indexOf(t,e){if(!this.length)return 0;let i=this.head,r=0;for(;0!==i;){if(r===t)return this.getItem(u.f[20](i+8),e);i=u.f[20](i+4),r++}return 0}clear(t,e){if(this.length){let i=this.head;for(;0!==i;){t&&t(this.getItem(u.f[20](i+8),e)),h.s_.free(u.f[20](i+8));const r=u.f[20](i+4);h.s_.free(i),i=r}}this.head=0,this.tail=0,this.length=0}}!function(t){var e=new(o());e.set("length",{0:8,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}),e.set("head",{0:v,1:1,2:1,3:0,4:0,5:0,6:0,7:4,8:0}),e.set("tail",{0:v,1:1,2:1,3:0,4:0,5:0,6:0,7:8,8:0}),(0,c.A)(t,l.Og,!0),(0,c.A)(t,l.dc,4),(0,c.A)(t,l.g7,12),(0,c.A)(t,l.JY,e)}(y.prototype)},72703:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(67672);function s(t){return r.ai(t)&&t>=0}},74503:(t,e,i)=>{"use strict";i.d(e,{A:()=>c});var r=i(99921),s=i(11473),a=i(14686),n=i(95335),o=i(34677),l=i(29170);function c(t,e){(0,o.A)(e)||(e=t,t=null);const i=(0,r.A)(e),c=s.s_.malloc(i);if(!c)throw new TypeError("cannot alloc memory for struct");(0,a.sO)(c,0,i);const h=(0,l.A)(c,e),u=new e;return t&&n.X$(u,t),n.__(u,((t,e)=>{(0,o.A)(t)&&(h[e]=t)})),h}},14686:(t,e,i)=>{"use strict";i.d(e,{JW:()=>d,Mr:()=>c,bg:()=>p,lH:()=>m,lW:()=>h,qW:()=>g,s3:()=>f,sO:()=>u});var r=i(11473),s=i(50011),a=i(50932),n=i(79630),o=i(26429),l=i(63939);function c(t,e,i){(0,r.eq)().set((0,r.eq)().subarray(e,e+i),t)}function h(t,e,i){(0,r.eq)().set(i.subarray(0,e),t)}function u(t,e,i){(0,r.eq)().subarray(t,t+i).fill(e)}function d(t,e){return o.USE_THREADS?f(t,e):new n.A(t,e)}function f(t,e){return(0,r.eq)().subarray(t,t+e)}function p(t,e){return(0,r.hZ)().subarray(t>>>1,(t>>>1)+e)}function m(t,e){let i=0;for(;l.f[4]((t+=1)-1);)i++;const r=Math.min(i,null!=e?e:i);return s.decode(f(t,r))}function g(t,e,i,r=!0){const n=s.encode(e);let o=n.length,l=r?1:0;i&&o-l>i&&(o=i-l),h(t,o,n),r&&a.M[11](t+o,0)}},99921:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var r=i(61499),s=i(67672),a=i(6704);function n(t){return s.ai(t)?a.i[t]||0:s.Pc(t)&&t.prototype[r.Og]?t.prototype[r.g7]:0}},29170:(t,e,i)=>{"use strict";i.d(e,{A:()=>c});var r=i(61499),s=i(80098),a=i(25323),n=i(95797),o=i(67672),l=i(10534);function c(t,e){return arguments[2]&&o.Yj(arguments[2])&&(e=e.prototype,l.__(arguments[2],(t=>{const i=e[r.JY];e=i.get(t)[0]}))),n.A.proxy?(0,s.I_)(t,e):(0,a.l)(t,e)}},94300:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var r=i(11473),s=i(61499),a=i(80098),n=i(25323),o=i(95797);function l(t){const e=t[s.o9];e&&(r.s_.free(e),t[s.o9]=0,o.A.proxy?(0,a.SQ)(t):(0,n.X)(t))}},61499:(t,e,i)=>{"use strict";i.d(e,{JY:()=>c,Og:()=>a,dc:()=>o,g7:()=>n,kE:()=>h,o9:()=>l});var r=i(75062),s=i.n(r);const a=s()("Struct"),n=s()("StructLength"),o=s()("StructMaxBaseTypeByteLength"),l=s()("StructAddress"),c=(s()("StructKeysQueue"),s()("StructKeysMeta")),h=(s()("StructKeysInstance"),s()("StructProxyRevoke"))},82854:(t,e,i)=>{"use strict";i.d(e,{Ay:()=>d,KJ:()=>h,Ko:()=>u});var r=i(4919),s=i(4624),a=i(88096),n=i(19985),o=i.n(n),l=i(40046);const c="src/cheap/thread/asm/atomics.ts";let h;function u(){return!!h}async function d(t,e,i){try{if(!("function"==typeof SharedArrayBuffer&&t.buffer instanceof SharedArrayBuffer))return;{const s=a.bx((0,r.E_)(o()),{shared:!0,initial:e,maximum:i});h=(await WebAssembly.instantiate(s,{env:{memory:t}})).instance}(0,l.$Z)({add:function(t,e,i){switch(i){case 5:case 3:return 255&h.exports.add8(t,e);case 12:return h.exports.add8(t,e);case 14:return h.exports.add16(t,e);case 7:return 65535&h.exports.add16(t,e);case 16:return h.exports.add32(t,e);case 9:return 4294967295&h.exports.add32(t,e);case 21:return h.exports.add64(t,e);case 22:return BigInt.asUintN(64,h.exports.add64(t,e))}},sub:function(t,e,i){switch(i){case 5:case 3:return 255&h.exports.sub8(t,e);case 12:return h.exports.sub8(t,e);case 14:return h.exports.sub16(t,e);case 7:return 65535&h.exports.sub16(t,e);case 16:return h.exports.sub32(t,e);case 9:return 4294967295&h.exports.sub32(t,e);case 21:return h.exports.sub64(t,e);case 22:return BigInt.asUintN(64,h.exports.sub64(t,e))}},and:function(t,e,i){switch(i){case 5:case 3:return 255&h.exports.and8(t,e);case 12:return h.exports.and8(t,e);case 14:return h.exports.and16(t,e);case 7:return 65535&h.exports.and16(t,e);case 16:return h.exports.and32(t,e);case 9:return 4294967295&h.exports.and32(t,e);case 21:return h.exports.and64(t,e);case 22:return BigInt.asUintN(64,h.exports.and64(t,e))}},or:function(t,e,i){switch(i){case 5:case 3:return 255&h.exports.or8(t,e);case 12:return h.exports.or8(t,e);case 14:return h.exports.or16(t,e);case 7:return 65535&h.exports.or16(t,e);case 16:case 9:return h.exports.or32(t,e);case 21:return h.exports.or64(t,e);case 22:return BigInt.asUintN(64,h.exports.or64(t,e))}},xor:function(t,e,i){switch(i){case 5:case 3:return 255&h.exports.xor8(t,e);case 12:return h.exports.xor8(t,e);case 14:return h.exports.xor16(t,e);case 7:return 65535&h.exports.xor16(t,e);case 16:case 9:return h.exports.xor32(t,e);case 21:return h.exports.xor64(t,e);case 22:return BigInt.asUintN(64,h.exports.xor64(t,e))}},store:function(t,e,i){switch(i){case 5:case 12:case 3:return h.exports.store8(t,e);case 14:case 7:return h.exports.store16(t,e);case 16:case 9:return h.exports.store32(t,e);case 21:case 22:return h.exports.store64(t,e)}},load:function(t,e){switch(e){case 5:case 3:return 255&h.exports.load8(t);case 12:return h.exports.load8(t);case 14:case 7:return h.exports.load16(t);case 16:return h.exports.load32(t);case 9:return 4294967295&h.exports.load32(t);case 21:return h.exports.load64(t);case 22:return BigInt.asUintN(64,h.exports.load64(t))}},compareExchange:function(t,e,i,r){switch(r){case 5:case 3:return 255&h.exports.compare_exchange8(t,e,i);case 12:return h.exports.compare_exchange8(t,e,i);case 14:return h.exports.compare_exchange16(t,e,i);case 7:return 65535&h.exports.compare_exchange16(t,e,i);case 16:return h.exports.compare_exchange32(t,e,i);case 9:return 4294967295&h.exports.compare_exchange32(t,e,i);case 21:return h.exports.compare_exchange64(t,e,i);case 22:return BigInt.asUintN(64,h.exports.compare_exchange64(t,e,i))}},exchange:function(t,e,i){switch(i){case 5:case 3:return 255&h.exports.exchange8(t,e);case 12:return h.exports.exchange8(t,e);case 14:return h.exports.exchange16(t,e);case 7:return 65535&h.exports.exchange16(t,e);case 16:return h.exports.exchange32(t,e);case 9:return 4294967295&h.exports.exchange32(t,e);case 21:return h.exports.exchange64(t,e);case 22:return BigInt.asUintN(64,h.exports.exchange64(t,e))}},notify:function(t,e){return h.exports.notify(t,e)},wait:function(t,e){return h.exports.wait(t,e)},waitTimeout:function(t,e,i){return h.exports.waitTimeout(t,e,BigInt(0|i))}})}catch(t){s.R8("atomics asm not support, cannot use asm atomics function",c,289)}}},40046:(t,e,i)=>{"use strict";let r,s,a,n,o,l,c,h,u,d,f,p,m,g;function v(t){t.add&&(r=t.add),t.sub&&(s=t.sub),t.and&&(a=t.and),t.or&&(n=t.or),t.xor&&(o=t.xor),t.store&&(l=t.store),t.load&&(c=t.load),t.compareExchange&&(h=t.compareExchange),t.exchange&&(u=t.exchange),t.notify&&(d=t.notify),t.wait&&(f=t.wait),t.waitTimeout&&(p=t.waitTimeout),t.waitAsync&&(m=t.waitAsync),t.waitTimeoutAsync&&(g=t.waitTimeoutAsync)}i.d(e,{$Z:()=>v,Hh:()=>c,I8:()=>o,M_:()=>l,Uo:()=>a,WQ:()=>r,cv:()=>u,j4:()=>p,jb:()=>s,me:()=>d,or:()=>n,p_:()=>h,uk:()=>f})},33856:(t,e,i)=>{"use strict";i.d(e,{A:()=>P});var r=i(54001),s=i.n(r),a=i(86932),n=i(7972),o=i(40046),l=i(26429),c=i(86834),h=i(95797);let u;const d=l.USE_THREADS||!c.A.chrome&&h.A.atomics||c.A.checkVersion(c.A.majorVersion,"94",!0);function f(t,e,i,r){if(d)return Atomics.add(u(i),t>>>r,e);{const s=u(i),a=t>>>r,n=s[a];return s[a]+=e,n}}function p(t,e,i,r){if(d)return Atomics.sub(u(i),t>>>r,e);{const s=u(i),a=t>>>r,n=s[a];return s[a]-=e,n}}function m(t,e,i,r){if(d)return Atomics.and(u(i),t>>>r,e);{const s=u(i),a=t>>>r,n=s[a];return s[a]&=e,n}}function g(t,e,i,r){if(d)return Atomics.or(u(i),t>>>r,e);{const s=u(i),a=t>>>r,n=s[a];return s[a]|=e,n}}function v(t,e,i,r){if(d)return Atomics.xor(u(i),t>>>r,e);{const s=u(i),a=t>>>r,n=s[a];return s[a]^=e,n}}function y(t,e,i,r){if(d)return Atomics.store(u(i),t>>>r,e);{const s=u(i),a=t>>>r,n=s[a];return s[a]=e,n}}function A(t,e,i){return d?Atomics.load(u(e),t>>>i):u(e)[t>>>i]}function b(t,e,i,r,s){if(d)return Atomics.compareExchange(u(r),t>>>s,e,i);{const a=u(r),n=t>>>s,o=a[n];return o===e&&(a[n]=i),o}}function x(t,e,i,r){if(d)return Atomics.exchange(u(i),t>>>r,e);{const s=u(i),a=t>>>r,n=s[a];return s[a]=e,n}}function w(t,e){return d?Atomics.notify(u(16),t>>>2,e):void 0}const k={ok:0,"not-equal":1,"timed-out":2};function T(t,e){return k[Atomics.wait(u(16),t>>>2,e)]}function _(t,e,i){return k[Atomics.wait(u(16),t>>>2,e,i)]}async function I(t,e){if(Atomics.waitAsync){const i=Atomics.waitAsync(u(16),t>>>2,e);return i.async?k[await i.value]:k[i.value]}if(A(t)!==e)return 1;for(;A(t)===e;)await new(s())((t=>{(0,n.A)((()=>{t()}))}));return 0}async function S(t,e,i){if(Atomics.waitAsync){const r=Atomics.waitAsync(u(16),t>>>2,e,i);return r.async?k[await r.value]:k[r.value]}if(A(t)!==e)return 1;{const r=(0,a.A)();for(;A(t)===e&&(0,a.A)()-r{(0,n.A)((()=>{t()}))}));return A(t)!==e?0:2}}function P(t){u=t,(0,o.$Z)({add:f,sub:p,and:m,or:g,xor:v,store:y,load:A,compareExchange:b,exchange:x,notify:w,wait:T,waitTimeout:_,waitAsync:I,waitTimeoutAsync:S})}},42518:(t,e,i)=>{"use strict";i.d(e,{Ts:()=>d,XR:()=>v,mq:()=>m,uk:()=>g,vP:()=>p,zr:()=>f});var r,s,a=i(134),n=i(80662),o=i.n(n),l=i(61499),c=i(12085),h=i(73783),u=i(40046);function d(t,e){return u.M_(t,0,16,2),0}function f(t){return u.M_(t,0,16,2),0}function p(t){return u.WQ(t,1,16,2),u.me(t,1),0}function m(t){return u.WQ(t,1,16,2),u.me(t,1073741824),0}function g(t,e){let i=u.Hh(t,16,2);return h.Tl(e),u.uk(t,i),h.s2(e),0}function v(t,e,i){let r=u.Hh(t,16,2);h.Tl(e);let s=u.j4(t,r,i);return h.s2(e),2===s?110:0}r=class{constructor(){(0,a.A)(this,"atomic",void 0)}}.prototype,(s=new(o())).set("atomic",{0:16,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}),(0,c.A)(r,l.Og,!0),(0,c.A)(r,l.dc,4),(0,c.A)(r,l.g7,4),(0,c.A)(r,l.JY,s)},81574:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>o});var r=i(84149),s=(i(55013),i(10576)),a=i(67672);let n=s.TK;function o(t){let e,i;n.onmessage=o=>{const l=o.data,c=l.type,h=l.data;switch(c){case"init":if(s.TK.CHeap&&s.TK.CHeap.initThread&&s.TK.CHeap.Config.USE_THREADS)return void s.TK.CHeap.initThread(h).then((()=>{n.postMessage({type:"ready"})}));n.postMessage({type:"ready"});break;case"run":n.postMessage({type:"running"}),i=t(h.params),u=h.port,e=new r.Ay(u),e.on(r.S3,(async t=>{const r=t.method,s=t.params;if(a.Pc(i[r]))try{i[r].transfer||(i[r].transfer=[]);const a=await i[r](...s.params);e.reply(t,a,null,i[r].transfer),i[r].transfer.length=0}catch(i){e.reply(t,-2097152,{message:i.message})}}));break;case"stop":e&&e.destroy(),s.TK.__freeSmartPtr__&&s.TK.__freeSmartPtr__(),n.postMessage({type:"stopped"})}var u}}},26848:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>a});var r=i(10576);let s=r.TK;function a(t){let e;s.onmessage=i=>{const a=i.data,n=a.type,o=a.data;switch(n){case"init":if(r.TK.CHeap&&r.TK.CHeap.initThread&&r.TK.CHeap.Config.USE_THREADS)return void r.TK.CHeap.initThread(o).then((()=>{s.postMessage({type:"ready"})}));s.postMessage({type:"ready"});break;case"run":e=t(o.params);break;case"stop":e&&e.then?e.then((t=>{r.TK.__freeSmartPtr__&&r.TK.__freeSmartPtr__(),s.postMessage({type:"stopped",data:t})})):(r.TK.__freeSmartPtr__&&r.TK.__freeSmartPtr__(),s.postMessage({type:"stopped",data:e}))}}}},67524:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>o});var r=i(84149),s=(i(55013),i(10576)),a=i(67672);let n=s.TK;function o(t){let e;n.onmessage=i=>{const o=i.data,l=o.type,c=o.data;switch(l){case"init":if(s.TK.CHeap&&s.TK.CHeap.initThread&&s.TK.CHeap.Config.USE_THREADS)return void s.TK.CHeap.initThread(c).then((()=>{n.postMessage({type:"ready"})}));n.postMessage({type:"ready"});break;case"run":n.postMessage({type:"running"}),h=c.port,e=new r.Ay(h),e.on(r.S3,(async i=>{const r=i.method,s=i.params;if(a.Pc(t[r]))try{t[r].transfer||(t[r].transfer=[]);const a=await t[r](...s.params);e.reply(i,a,null,t[r].transfer),t[r].transfer.length=0}catch(t){e.reply(i,-2097152,{message:t.message})}}));break;case"stop":e&&e.destroy(),s.TK.__freeSmartPtr__&&s.TK.__freeSmartPtr__(),n.postMessage({type:"stopped"})}var h}}},73783:(t,e,i)=>{"use strict";i.d(e,{Tl:()=>g,Ts:()=>f,bh:()=>m,eu:()=>d,s2:()=>p,zr:()=>v});var r,s,a=i(134),n=i(80662),o=i.n(n),l=i(61499),c=i(12085),h=i(40046),u=i(39638);class d{constructor(){(0,a.A)(this,"atomic",void 0)}}function f(t){return h.M_(t,0,16,2),0}function p(t,e=!1){let i;if(0!==(i=h.p_(t,0,1,16,2)))do{2!=i&&0===h.p_(t,1,2,16,2)||!e&&(0,u.A)()&&h.uk(t,2)}while(0!==(i=h.p_(t,0,2,16,2)));return 0}function m(t){return 0===h.p_(t,0,1,16,2)?0:16}function g(t){return 1!==h.jb(t,1,16,2)&&(h.M_(t,0,16,2),h.me(t,1)),0}function v(t){return h.M_(t,0,16,2),0}r=d.prototype,(s=new(o())).set("atomic",{0:16,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}),(0,c.A)(r,l.Og,!0),(0,c.A)(r,l.dc,4),(0,c.A)(r,l.g7,4),(0,c.A)(r,l.JY,s)},79490:(t,e,i)=>{"use strict";i.d(e,{Ts:()=>p,XR:()=>A,Zr:()=>y,bE:()=>g,uk:()=>v,zr:()=>m});var r,s,a=i(134),n=i(80662),o=i.n(n),l=i(61499),c=i(12085),h=i(73783),u=i(63939),d=i(50932),f=i(40046);function p(t,e){return f.M_(t,0|e,16,2),h.Ts(t+4),0}function m(t){return h.zr(t+4),0}function g(t){return f.WQ(t,1,16,2),f.me(t,1),0}function v(t){for(;f.uk(t,0),f.jb(t,1,16,2)<=0;)f.WQ(t,1,16,2);return 0}function y(t){return h.s2(t+4),u.f[16](t)>0?(d.M[16](t,u.f[16](t)-1),h.Tl(t+4),0):(h.Tl(t+4),11)}function A(t,e){return 2!==f.j4(t,0,e)&&f.jb(t,1,16,2)<=0?(f.WQ(t,1,16,2),110):0}r=class{constructor(){(0,a.A)(this,"atomic",void 0),(0,a.A)(this,"mutex",void 0)}}.prototype,(s=new(o())).set("atomic",{0:16,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}),s.set("mutex",{0:h.eu,1:0,2:0,3:0,4:0,5:0,6:0,7:4,8:0}),(0,c.A)(r,l.Og,!0),(0,c.A)(r,l.dc,4),(0,c.A)(r,l.g7,8),(0,c.A)(r,l.JY,s)},88506:(t,e,i)=>{"use strict";i.d(e,{nE:()=>T,nx:()=>_,pt:()=>k});var r=i(75062),s=i.n(r),a=i(80662),n=i.n(a),o=i(54001),l=i.n(o),c=i(11473),h=i(84149),u=(i(55013),i(61837)),d=i(26429),f=i(67672),p=i(10576),m=i(62100),g=i(95073);let v=p.TK.Worker,y=p.TK.MessageChannel;i(81574),i(26848),i(67524);const A=(0,u.A)(81574,{varName:"init"}),b=((0,u.A)(26848,{varName:"init"}),(0,u.A)(67524,{varName:"init"}),s()("revoke")),x=new(n());function w(t,e){return`${t}_${e}`}function k(t,e,i){e=e||{},f.Pc(e)&&(i=e,e={});let r,s=[];function a(...e){const r=new t(...e);return new(l())((e=>{const s={$worker:null,$ipc:null,$channel:null,$moduleId:(0,m.A)(i),$stackPointer:0,$instance:r,$type:"class"},{proxy:a,revoke:n}=Proxy.revocable(s,{get(e,i,a){if(e[i])return s[i];if(i in t.prototype&&"function"==typeof t.prototype[i]){const t=function(...t){return r[i](...t)};t.transfer=function(...t){return{invoke:function(...t){return r[i](...t)}}},e[i]=t}return e[i]}});s[b]=n,e(a)}))}return r=(...r)=>{let a;if(f.Pc(i))a=i();else{let e;const r=w(i,"class");if(x.has(r))e=x.get(r).url,x.get(r).refCount++;else{const s=(0,u.A)(i,{varName:`__module_${t.name}__`,exportName:`__${t.name}__`,pointName:t.name,exportIsClass:!0}),a=`\n self.CHEAP_DISABLE_THREAD = ${p.TK.CHEAP_DISABLE_THREAD}\n self.CHEAP_HEAP_INITIAL = ${p.TK.CHEAP_HEAP_INITIAL}\n self.CHEAP_HEAP_MAXIMUM = ${p.TK.CHEAP_HEAP_MAXIMUM}\n ${p.TK.CHEAP_POLYFILL_URL?`self.CHEAP_POLYFILL_URL = '${p.TK.CHEAP_POLYFILL_URL}'`:""}\n ${p.TK.CHEAP_POLYFILL_URL?`importScripts('${p.TK.CHEAP_POLYFILL_URL}');`:""}\n ${s}\n function run(params) {\n params.unshift(null)\n return new (Function.prototype.bind.apply(__module_${t.name}__.__${t.name}__, params))()\n }\n ${A}\n init.default(run);\n `;{const t=new Blob([a],{type:"text/javascript"});e=URL.createObjectURL(t)}x.set(r,{url:e,refCount:1})}a=new v(e)}const n=new y;return new(l())(((o,l)=>{var u;const f=d.USE_THREADS?c.s_.alignedAlloc(d.STACK_ALIGNMENT,e.stackSize?(0,g.A)(e.stackSize,d.STACK_ALIGNMENT):d.STACK_SIZE):0,p=e=>{const l=e.data,c=l.type;switch(l.data,c){case"ready":a.postMessage({type:"run",data:{port:n.port2,params:r}},[n.port2,...s]);break;case"running":!function(){const e=new h.Ay(n.port1),r={$worker:a,$ipc:e,$channel:n,$moduleId:(0,m.A)(i),$stackPointer:f,$type:"class"},{proxy:s,revoke:l}=Proxy.revocable(r,{get(i,s,a){if(i[s])return r[s];if(s in t.prototype&&"function"==typeof t.prototype[s]){const t=async function(...t){return e.request(s,{params:t})};t.transfer=function(...t){return{invoke:async function(...i){return e.request(s,{params:i},t)}}},i[s]=t}return i[s]}});r[b]=l,o(s)}()}};a.onmessage=p,a.onmessage=p,a.postMessage({type:"init",data:{memory:d.USE_THREADS?c.ce:null,name:e.name||t.name,stackPointer:f,stackSize:null!==(u=e.stackSize)&&void 0!==u?u:d.STACK_SIZE}})}))},{run:!d.USE_THREADS&&!e.dispatchToWorker||e.disableWorker?a:r,transfer:function(...t){return s=t,{run:!d.USE_THREADS&&!e.dispatchToWorker||e.disableWorker?a:r}}}}function T(t){if(t.$worker&&(t.$worker.terminate(),t.$worker=null),t.$moduleId){if(f.Yj(t.$moduleId)){const e=w(t.$moduleId,t.$type);x.has(e)&&(x.get(e).refCount--,0===x.get(e).refCount&&(URL.revokeObjectURL(x.get(e).url),x.delete(e)))}t.$moduleId=null}if(t.$ipc&&(t.$ipc.destroy(),t.$ipc=null),t.$stackPointer&&(c.s_.free(t.$stackPointer),t.$stackPointer=0),t.$channel=null,t.$instance=null,t[b]){const e=t[b];t[b]=null,e()}}async function _(t){return t.$worker?new(l())((e=>{t.$worker.onmessage=function(i){const r=i.data,s=r.type,a=r.data;"stopped"===s&&(T(t),e(a))},t.$worker.postMessage({type:"stop"})})):t.$retval?t.$retval:void 0}},6704:(t,e,i)=>{"use strict";i.d(e,{_:()=>s,i:()=>r});const r={2:1,3:1,4:1,5:1,6:2,7:2,8:4,9:4,10:8,11:1,12:1,13:2,14:2,15:4,16:4,17:8,18:4,19:8,20:4,0:4,1:4,22:8,21:8,23:1,24:1},s={2:0,3:0,4:0,5:0,6:1,7:1,8:2,9:2,10:4,11:0,12:0,13:1,14:1,15:2,16:2,17:4,18:2,19:4,20:2,1:2,0:2,22:4,21:4,23:0,24:0}},19094:(t,e,i)=>{"use strict";i.d(e,{A:()=>p});var r=i(134),s=i(54001),a=i.n(s),n=i(11473),o=i(63939),l=i(50932),c=i(26429),h=i(14686),u=i(42518),d=i(73783),f=i(40046);class p{constructor(t,e){(0,r.A)(this,"count",void 0),(0,r.A)(this,"url",void 0),(0,r.A)(this,"childThreads",void 0),this.count=t,this.url=e,this.childThreads=[]}async createTheadPoolEntry(t){return new(a())(((e,i)=>{const r=new Worker(this.url),s=n.s_.alignedAlloc(c.STACK_ALIGNMENT,c.STACK_SIZE),a=n.s_.malloc(8);(0,h.sO)(a,0,8),l.M[15](a+4,0),l.M[15](a,2|o.f[15](a));const f=(0,n.pv)();r.onmessage=t=>{if("ready"===t.data.type){const t=s;(0,h.sO)(t,0,20),d.Ts(t+16),u.Ts(t+12),r.postMessage({type:"wait"}),e({id:f,thread:{thread:0,worker:r,stackPointer:s,threadDescriptor:a},threadWait:t})}},r.postMessage({type:"ready",data:{cheap:{memory:n.ce,stackPointer:s,stackSize:c.STACK_SIZE,id:f},runner:{resource:{tableSize:t.tableSize,module:t.module,initFuncs:t.initFuncs},options:{memoryBase:t.memoryBase,tableBase:t.tableBase,threadDescriptor:a,childImports:t.childImports},imports:t.childImports}}})}))}async ready(t){this.childThreads=await a().all(new Array(this.count).fill(0).map((()=>this.createTheadPoolEntry(t))))}hasFree(){for(let t=0;t{"use strict";i.d(e,{A:()=>L});var r=i(134),s=i(80662),a=i.n(s),n=i(54001),o=i.n(n),l=i(63939),c=i(50932),h=i(11473),u=i(95335),d=i(72739),f=i(4624),p=i(67672),m=i(14686),g=i(14621),v=i(1708),y=i(20357),A=i(77775),b=i(26429),x=i(40046),w=i(82854),k=i(80905),T=i(24565),_=i(39638),I=i(19094),S=i(42518),P=i(73783),C=i(95797),M=(i(81999),i(10576)),B=i(61837);const E="src/cheap/webassembly/WebAssemblyRunner.ts";let D=M.TK.Worker;function R(){}let U=!1;class L{static getTable(){return h.XI}static mutexLock(t){P.s2(t)}static mutexUnlock(t){P.Tl(t)}static condWait(t,e){S.uk(t,e)}static readPointer(t){return l.f[20](t)}static writePointer(t,e){c.M[20](t,e)}constructor(t,e={}){var i;(0,r.A)(this,"resource",void 0),(0,r.A)(this,"instance",void 0),(0,r.A)(this,"options",void 0),(0,r.A)(this,"builtinMalloc",void 0),(0,r.A)(this,"memoryBase",void 0),(0,r.A)(this,"tableBase",void 0),(0,r.A)(this,"childImports",void 0),(0,r.A)(this,"childUrl",void 0),(0,r.A)(this,"childBlob",void 0),(0,r.A)(this,"childThreads",void 0),(0,r.A)(this,"imports",void 0),(0,r.A)(this,"childReadyPromises",void 0),(0,r.A)(this,"threadPool",void 0),(0,r.A)(this,"initCalling",void 0),(0,r.A)(this,"promisingMap",void 0),this.resource=t,this.builtinMalloc=[],this.initCalling=!1,this.childThreads=new(a()),this.childReadyPromises=[],this.promisingMap=new(a()),p.Yj(e.childImports)?this.childImports=e.childImports:p.Ik(e.childImports)&&e.childImports instanceof Blob&&(this.childImports=URL.createObjectURL(e.childImports)),this.memoryBase=t.dataSize?h.s_.malloc(t.dataSize):0,e.thread&&e.tableBase&&h.XI.getPointer()!==e.tableBase&&h.XI.alloc(e.tableBase-h.XI.getPointer()),this.tableBase=t.tableSize?h.XI.alloc(t.tableSize):0,this.options=e,this.imports={env:{memory:h.ce,__stack_pointer:h.GE,__indirect_function_table:h.XI.table,clock_time_get:g.WU,clock_res_get:g.Lq,random_get:g.Pp,abort:g.h2,proc_exit:function(t){f.z3(`wasm module exit, code: ${t}`,E,157)},__syscall_renameat:R,__syscall_unlinkat:R,environ_get:g.B,environ_sizes_get:g.CK,fd_close:R,fd_fdstat_get:g.LS,fd_read:R,fd_seek:R,fd_write:g.nK,emscripten_builtin_malloc:t=>{const e=h.s_.malloc(t);return this.builtinMalloc.push(e),e},emscripten_builtin_free:t=>{h.s_.free(t)},emscripten_builtin_memalign:(t,e,i)=>{const r=h.s_.alignedAlloc(e,i);return 0!==r?(c.M[20](t,r),this.builtinMalloc.push(r),0):-1},emscripten_memcpy_big:function(t,e,i){(0,m.Mr)(t,e,i)},__libc_malloc:function(t){return h.s_.malloc(t)},__libc_free:t=>{h.s_.free(t)},malloc:t=>{if(!0===this.initCalling){const e=h.s_.malloc(t);return this.builtinMalloc.push(e),e}return h.s_.malloc(t)},calloc:function(t,e){return h.s_.calloc(t,e)},realloc:function(t,e){return h.s_.realloc(t,e)},aligned_alloc:(t,e)=>h.s_.alignedAlloc(t,e),free:function(t){h.s_.free(t)},posix_memalign:function(t,e,i){const r=h.s_.alignedAlloc(e,i);return 0!==r?(c.M[20](t,r),0):-1},memalign:function(t,e){return h.s_.alignedAlloc(t,e)}},"GOT.func":{malloc:new WebAssembly.Global({mutable:!0,value:"i32"},2),calloc:new WebAssembly.Global({mutable:!0,value:"i32"},3),realloc:new WebAssembly.Global({mutable:!0,value:"i32"},4),aligned_alloc:new WebAssembly.Global({mutable:!0,value:"i32"},5),free:new WebAssembly.Global({mutable:!0,value:"i32"},1)}};{const t=(t,e,i,r)=>{if(this.threadPool&&this.threadPool.hasFree())return this.threadPool.createThread(t,e,i,r),0;this.childUrl||this.createChildUrl();const s=new D(this.childUrl);c.M[15](t,(0,h.pv)()),c.M[16](t+12,1),c.M[15](t+8,0),c.M[20](t+4,0);const a=h.s_.alignedAlloc(b.STACK_ALIGNMENT,b.STACK_SIZE),n=h.s_.malloc(8);let u;(0,m.sO)(n,0,8),this.childThreads.set(l.f[15](t),{thread:t,worker:s,stackPointer:a,threadDescriptor:n});const d=new(o())((t=>{u=t}));C.A.jspi||this.childReadyPromises.push(d);return s.onmessage=t=>{const e=t.data,i=e.type;e.data,"run"===i&&u(0)},s.postMessage({type:"run",data:{cheap:{memory:h.ce,stackPointer:a,stackSize:b.STACK_SIZE,id:l.f[15](t)},runner:{resource:{tableSize:this.resource.tableSize,module:this.resource.threadModule.module,initFuncs:this.resource.threadModule.initFuncs},options:{memoryBase:this.options.memoryBase||this.memoryBase,tableBase:this.tableBase,thread:t,threadDescriptor:n,childImports:this.childImports},func:i,args:r,imports:this.childImports,thread:t}}}),C.A.jspi?d:0};u.X$(this.imports.env,{wasm_pthread_create:C.A.jspi?new WebAssembly.Suspending(t):t,wasm_pthread_join2:(t,e)=>{if(this.threadPool&&this.threadPool.isPoolThread(t))return this.threadPool.joinThread(t,e),0;if(1&l.f[15](t+8))return this.childThreads.delete(l.f[15](t)),0;x.uk(t+12,1),0!==e&&c.M[20](e,l.f[20](t+4));const i=this.childThreads.get(l.f[15](t));return h.s_.free(i.stackPointer),h.s_.free(i.threadDescriptor),i.worker.terminate(),this.childThreads.delete(l.f[15](t)),(0,m.sO)(t,0,16),0},wasm_pthread_detach2:t=>{if(this.threadPool&&this.threadPool.isPoolThread(t))return this.threadPool.detachThread(t),0;const e=this.childThreads.get(l.f[15](t));c.M[15](e.threadDescriptor,1|l.f[15](e.threadDescriptor)),c.M[15](t+8,1|l.f[15](t+8))}}),u.X$(this.imports.env,v),u.X$(this.imports.env,y),u.X$(this.imports.env,A)}if(this.memoryBase?u.X$(this.imports.env,{__memory_base:this.memoryBase}):e.memoryBase&&u.X$(this.imports.env,{__memory_base:e.memoryBase}),this.tableBase&&u.X$(this.imports.env,{__table_base:this.tableBase}),null!==(i=e.imports)&&void 0!==i&&i.env&&(u.X$(this.imports.env,e.imports.env),e.envKey&&e.importMap)){const t={};u.__(this.imports.env,((i,r)=>{e.importMap[r]&&(t[e.importMap[r]]=i)})),this.imports[e.envKey]=t}this.imports.wasi_snapshot_preview1=this.imports.env}createChildUrl(){{let t="";{i(81999);const e=(0,B.A)(16030,{varName:"__WebAssemblyRunner__",exportName:"__WebAssemblyRunner__",pointName:L.name,exportIsClass:!0}),r=(0,B.A)(81999,{varName:"runThread"});let s="",a="";this.childImports&&(s=`importScripts('${this.childImports}');`),M.TK.CHEAP_POLYFILL_URL&&(a=`importScripts('${M.TK.CHEAP_POLYFILL_URL}');`),t=`\n ${e}\n ${r}\n self.imports = {env:{}};\n ${a}\n ${s}\n runThread.default();\n `}this.childBlob=new Blob([t],{type:"text/javascript"}),this.childUrl=URL.createObjectURL(this.childBlob)}}overrideAtomic(){v.override({atomic_add_i8:w.KJ.exports.add8,atomic_sub_i8:w.KJ.exports.sub8,atomic_and_i8:w.KJ.exports.and8,atomic_or_i8:w.KJ.exports.or8,atomic_xor_i8:w.KJ.exports.xor8,atomic_store_i8:w.KJ.exports.store8,atomic_load_i8:w.KJ.exports.load8,atomic_compare_exchange_i8:w.KJ.exports.compare_exchange8,atomic_exchange_i8:w.KJ.exports.exchange8,atomic_add_i16:w.KJ.exports.add16,atomic_sub_i16:w.KJ.exports.sub16,atomic_and_i16:w.KJ.exports.and16,atomic_or_i16:w.KJ.exports.or16,atomic_xor_i16:w.KJ.exports.xor16,atomic_store_i16:w.KJ.exports.store16,atomic_load_i16:w.KJ.exports.load16,atomic_compare_exchange_i16:w.KJ.exports.compare_exchange16,atomic_exchange_i16:w.KJ.exports.exchange16,atomic_add_i32:w.KJ.exports.add32,atomic_sub_i32:w.KJ.exports.sub32,atomic_and_i32:w.KJ.exports.and32,atomic_or_i32:w.KJ.exports.or32,atomic_xor_i32:w.KJ.exports.xor32,atomic_store_i32:w.KJ.exports.store32,atomic_load_i32:w.KJ.exports.load32,atomic_compare_exchange_i32:w.KJ.exports.compare_exchange32,atomic_exchange_i32:w.KJ.exports.exchange32,atomic_add_i64:w.KJ.exports.add64,atomic_sub_i64:w.KJ.exports.sub64,atomic_and_i64:w.KJ.exports.and64,atomic_or_i64:w.KJ.exports.or64,atomic_xor_i64:w.KJ.exports.xor64,atomic_store_i64:w.KJ.exports.store64,atomic_load_i64:w.KJ.exports.load64,atomic_compare_exchange_i64:w.KJ.exports.compare_exchange64,atomic_exchange_i64:w.KJ.exports.exchange64,atomics_notify:w.KJ.exports.notify,atomics_wait:w.KJ.exports.wait}),u.X$(this.imports.env,v)}async run(t,e){if(p.Ik(t)&&u.X$(this.options.imports,t),(0,_.A)()&&!T.LK&&T.Ko()&&this.resource.threadModule&&(await T.Ts(h.ce,b.HEAP_INITIAL,b.HEAP_MAXIMUM,y.override),u.X$(this.imports.env,y)),!k.LK&&k.Ko()&&await k.Ts(h.ce,b.HEAP_INITIAL,b.HEAP_MAXIMUM),!U&&w.Ko()&&(U=!0,this.overrideAtomic()),this.instance=await WebAssembly.instantiate(this.resource.module,this.imports),this.initRunTime(),this.resource.threadModule&&this.resource.enableThreadPool&&e>0&&!C.A.jspi){this.childUrl||this.createChildUrl();let t=e;this.resource.enableThreadCountRate&&(t*=this.resource.enableThreadCountRate),this.threadPool=new I.A(t,this.childUrl),await this.threadPool.ready({tableSize:this.resource.tableSize,module:this.resource.threadModule.module,initFuncs:this.resource.threadModule.initFuncs,memoryBase:this.options.memoryBase||this.memoryBase,tableBase:this.tableBase,childImports:this.childImports})}}async runAsChild(t){p.Ik(t)&&u.X$(this.options.imports,t),!T.LK&&T.Ko()&&(await T.Ts(h.ce,b.HEAP_INITIAL,b.HEAP_MAXIMUM,y.override),u.X$(this.imports.env,y)),!U&&w.Ko()&&(U=!0,this.overrideAtomic()),this.instance=new WebAssembly.Instance(this.resource.module,this.imports),this.initRunTime()}async childThreadsReady(){if(!this.childReadyPromises.length)return;const t=this.childReadyPromises;this.childReadyPromises=[],await o().all(t)}initRunTime(){this.builtinMalloc=[],this.initCalling=!0,p.YO(this.resource.initFuncs)&&d.__(this.resource.initFuncs,(t=>{let e;if(this.asm[t]&&(e=this.asm[t]),e)return e()})),this.initCalling=!1}call(t,...e){if(!this.asm)return-1;let i;if(this.asm[t]?i=this.asm[t]:this.options.exportMap&&this.options.exportMap[t]&&this.asm[this.options.exportMap[t]]&&(i=this.asm[this.options.exportMap[t]]),i)return i.apply(null,e);f.z3(`the wasm module has not function ${t} to call`,E,674)}async callAsync(t,...e){if(!this.asm)return-1;if(!C.A.jspi)return this.call(t,...e);let i;if(this.promisingMap.has(t)?i=this.promisingMap.get(t):(this.asm[t]?i=this.asm[t]:this.options.exportMap&&this.options.exportMap[t]&&this.asm[this.options.exportMap[t]]&&(i=this.asm[this.options.exportMap[t]]),i=WebAssembly.promising(i),this.promisingMap.set(t,i)),i)return i.apply(null,e);f.z3(`the wasm module has not function ${t} to call`,E,716)}get asm(){return this.instance&&this.instance.exports}getInstance(){return this.instance}destroy(){var t;null!==(t=this.builtinMalloc)&&void 0!==t&&t.length&&(d.__(this.builtinMalloc,(t=>{h.s_.free(t)})),this.builtinMalloc.length=0),this.memoryBase&&(h.s_.free(this.memoryBase),this.memoryBase=null),this.tableBase&&(h.XI.free(this.tableBase),this.tableBase=null),this.childImports&&(URL.revokeObjectURL(this.childImports),this.childImports=null),this.childUrl&&(URL.revokeObjectURL(this.childUrl),this.childUrl=null),this.childBlob=null,this.childReadyPromises.length=0,this.childThreads.size&&this.childThreads.forEach(((t,e)=>{1&l.f[15](t.threadDescriptor)||(f.R8("has child thread running, maybe resource leakage",E,767),t.worker.terminate(),c.M[16](t.thread+12,0),t.stackPointer&&h.s_.free(t.stackPointer),h.s_.free(t.threadDescriptor),this.childThreads.delete(e))})),this.builtinMalloc=null,this.instance=null,this.options.thread&&(this.options.threadDescriptor&&c.M[15](this.options.threadDescriptor+4,0),this.options.threadDescriptor&&(1&l.f[15](this.options.threadDescriptor)||4&l.f[15](this.options.thread+8))?2&l.f[15](this.options.threadDescriptor)||(h.wE&&h.s_.free(h.wE),h.s_.free(this.options.threadDescriptor),(0,m.sO)(this.options.thread,0,16),self.close()):(c.M[16](this.options.thread+12,0),x.me(this.options.thread+12,1))),this.threadPool&&this.threadPool.destroy(),this.threadPool=null,this.promisingMap&&(this.promisingMap.clear(),this.promisingMap=null)}}},76045:(t,e,i)=>{"use strict";i.d(e,{A:()=>m});var r=i(54001),s=i.n(r),a=i(67672),n=i(24175),o=i(34531),l=i(88096),c=i(92647),h=i(95335),u=i(26429),d=i(86834),f=i(44690),p=i(729);async function m(t,e={}){let i,r,m,g;if(e=h.X$({enableThread:u.USE_THREADS,initFuncs:e.child?[]:["__wasm_apply_data_relocs","_initialize"]},e),a.ai(t.dataSize)&&a.ai(t.tableSize))if(r=t.dataSize,m=t.dataSize,a.Yj(t.source)){const e={method:"GET",headers:{},mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if(a.Pc(WebAssembly.compileStreaming))i=await WebAssembly.compileStreaming(fetch(t.source,e));else{const r=await fetch(t.source,e);g=await r.arrayBuffer(),i=await WebAssembly.compile(g)}}else i=await WebAssembly.compile(t.source),g=a.sv(t.source)?t.source:t.source.buffer;else{const h={ioReader:new n.A(1048576),ioWriter:new o.A(1048576),bufferEnded:!1,compileStopped:!1,error:"",abortController:null,pullResolve:null,bufferResolve:null,buffers:[],data:{},options:e},v=new Response(new ReadableStream({async start(e){if(a.Yj(t.source)){var i;"function"==typeof AbortController&&(h.abortController=new AbortController);const r={method:"GET",headers:{},mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade",signal:null===(i=h.abortController)||void 0===i?void 0:i.signal},s=await fetch(t.source,r);let a;s.ok&&s.status>=200&&s.status<=299?a=s.body.getReader():e.error(`Http code invalid, ${s.status} ${s.statusText}`);const n=[];h.ioReader.onFlush=async t=>{let e=0;for(;n.length&&et.length-e?(t.set(i.subarray(0,t.length-e),e),n.unshift(i.subarray(t.length-e)),e=t.length):(t.set(i,e),e+=i.length)}if(e>=t.length)return t.length;const{value:i,done:r}=await a.read();return r?e>0?e:-1048576:(h.buffers.push(i),i.length>t.length-e?(t.set(i.subarray(0,t.length-e),e),n.push(i.subarray(t.length-e)),t.length):(t.set(i,e),e+=i.length,e))}}else{let e=0,i=t.source.byteLength;const r=a.sv(t.source)?new Uint8Array(t.source):t.source;h.ioReader.onFlush=async t=>{if(e>=i)return-1048576;const s=Math.min(t.length,i-e);return t.set(r.subarray(e,e+s),0),e+=s,s}}h.ioWriter.onFlush=async t=>h.pullResolve?(h.pullResolve(t.slice()),h.pullResolve=null,0):((await new(s())(((t,e)=>{h.bufferResolve=t}))).enqueue(t.slice()),0),async function(t){try{for(await t.ioWriter.writeUint32(await t.ioReader.readUint32()),await t.ioWriter.writeUint32(await t.ioReader.readUint32());;){if(t.compileStopped){t.abortController&&t.abortController.abort();break}const e=await t.ioReader.readUint8();if(t.options.child&&11===e){await t.ioWriter.writeUint8(e),await(0,l.$z)(t.ioWriter,7),await(0,l.$z)(t.ioWriter,1),await(0,l.$z)(t.ioWriter,0),await t.ioWriter.writeUint8(65),await t.ioWriter.writeUint8(0),await t.ioWriter.writeUint8(11),await(0,l.$z)(t.ioWriter,1),await t.ioWriter.writeUint8(0);const i=await(0,l.GW)(t.ioReader);await t.ioReader.skip(i);continue}await t.ioWriter.writeUint8(e);const i=await(0,l.GW)(t.ioReader),r=t.ioReader.getPos();if(11===e){await(0,l.$z)(t.ioWriter,i);const e=await(0,l.GW)(t.ioReader);if(await(0,l.$z)(t.ioWriter,e),e){for(await(0,l.$z)(t.ioWriter,await(0,l.GW)(t.ioReader));;){const e=await t.ioReader.readUint8();if(await t.ioWriter.writeUint8(e),11===e)break}t.data.dataSize=await(0,l.GW)(t.ioReader),await(0,l.$z)(t.ioWriter,t.data.dataSize)}}else if(2===e){const e=new p.A(new Uint8Array(i+100));let s=await(0,l.GW)(t.ioReader);(0,l.tt)(e,s);let a=0;for(;s--;){const i=await(0,l.GW)(t.ioReader);(0,l.tt)(e,i),e.writeBuffer(await t.ioReader.readBuffer(i));const r=await(0,l.GW)(t.ioReader);(0,l.tt)(e,r),e.writeBuffer(await t.ioReader.readBuffer(r));const s=await t.ioReader.readUint8();switch(e.writeUint8(s),s){case 0:(0,l.tt)(e,await(0,l.GW)(t.ioReader));break;case 3:(0,l.p2)(e,await(0,l.WP)(t.ioReader)),(0,l.tt)(e,await(0,l.GW)(t.ioReader));break;case 2:{let i=await(0,l.GW)(t.ioReader);t.options.enableThread?i|=2:i&=-3,(0,l.tt)(e,i);const r=await(0,l.GW)(t.ioReader);if((0,l.tt)(e,u.HEAP_INITIAL||r),1&i){let i=await(0,l.GW)(t.ioReader);f.A.ios&&!d.A.checkVersion(f.A.version,"17",!0)&&t.options.enableThread||(i=u.HEAP_MAXIMUM),(0,l.tt)(e,i)}a++;break}case 1:{(0,l.p2)(e,await(0,l.WP)(t.ioReader));const i=await(0,l.GW)(t.ioReader);(0,l.tt)(e,i);const r=await(0,l.GW)(t.ioReader);(0,l.tt)(e,r),t.data.tableSize=r,1&i&&(0,l.tt)(e,await(0,l.GW)(t.ioReader)),a++;break}}if(2===a)break}const n=e.getWroteBuffer(),o=i-Number(t.ioReader.getPos()-r);await(0,l.$z)(t.ioWriter,n.length+o),await t.ioWriter.writeBuffer(n)}else await(0,l.$z)(t.ioWriter,i);i-Number(t.ioReader.getPos()-r)&&await t.ioReader.pipe(t.ioWriter,i-Number(t.ioReader.getPos()-r))}}catch(e){-1048576===t.ioReader.error?t.bufferEnded=!0:t.error=e,t.ioReader.remainingLength()&&await t.ioWriter.writeBuffer(await t.ioReader.readBuffer(t.ioReader.remainingLength())),await t.ioWriter.flush()}}(h)},async pull(t){if(h.error)t.close();else{if(h.bufferResolve)return h.bufferResolve(t),void(h.bufferResolve=null);t.enqueue(await new(s())(((t,e)=>{h.pullResolve=t}))),h.bufferEnded?t.close():h.error&&t.error(h.error)}},cancel(t){h.compileStopped=!0}}),{headers:{"Content-Type":"application/wasm"}});i=a.Pc(WebAssembly.compileStreaming)?await WebAssembly.compileStreaming(v):await WebAssembly.compile(await v.arrayBuffer()),g=a.Yj(t.source)?(0,c.A)(Uint8Array,h.buffers).buffer:a.sv(t.source)?t.source:t.source.buffer,r=h.data.tableSize,m=h.data.dataSize}return e.child?{module:i,initFuncs:e.initFuncs||[]}:{module:i,tableSize:r,dataSize:m,initFuncs:e.initFuncs||[],buffer:g}}},81999:(t,e,i)=>{"use strict";function r(){let t;t=__WebAssemblyRunner__?__WebAssemblyRunner__.__WebAssemblyRunner__:__CHeap_WebAssemblyRunner__.default;let e,i,r=self,s=0;r.onmessage=a=>{const n=a.data,o=n.type,l=n.data;switch(o){case"run":r.postMessage({type:"run"}),self.CHeap&&self.CHeap.initThread&&self.CHeap.initThread(l.cheap).then((()=>{self.__SELF_THREAD__=l.runner.thread,l.runner.options.imports=self.imports,e=new t(l.runner.resource,l.runner.options),e.runAsChild().then((()=>{t.getTable().get(l.runner.func)(l.runner.args),e.destroy()}))}));break;case"ready":i=l.runner,s=l.cheap.stackPointer,self.CHeap&&self.CHeap.initThread&&self.CHeap.initThread(l.cheap).then((()=>{r.postMessage({type:"ready"})}));break;case"wait":{async function c(){for(;;){for(t.mutexLock(s+16);0===t.readPointer(s);)t.condWait(s+12,s+16);self.__SELF_THREAD__=t.readPointer(s),i.options.thread=t.readPointer(s),i.thread=t.readPointer(s),i.func=t.readPointer(s+4),i.args=t.readPointer(s+8),e=new t(i.resource,i.options),await e.runAsChild(),t.getTable().get(i.func)(i.args),e.destroy(),t.writePointer(s,0),t.mutexUnlock(s+16)}}i.options.imports=self.imports,c();break}}}}i.r(e),i.d(e,{default:()=>r})},80905:(t,e,i)=>{"use strict";i.d(e,{Ko:()=>d,LK:()=>h,Ts:()=>f});var r=i(11473),s=i(4919),a=i(4624),n=i(35112),o=i.n(n),l=i(88096);const c="src/cheap/webassembly/runtime/asm/libc.ts";let h,u=!0;function d(){return u}async function f(t,e,i){try{const a=l.bx((0,s.E_)(o()),{shared:"function"==typeof SharedArrayBuffer&&t.buffer instanceof SharedArrayBuffer,initial:e,maximum:i});h=(await WebAssembly.instantiate(a,{env:{memory:t,malloc:function(t){return r.s_.malloc(t)},calloc:function(t,e){return r.s_.calloc(t,e)},realloc:function(t,e){return r.s_.realloc(t,e)},aligned_alloc:(t,e)=>r.s_.alignedAlloc(t,e),free:function(t){r.s_.free(t)}}})).instance,r.XI.set(2,h.exports.malloc),r.XI.set(1,h.exports.free),r.XI.set(3,h.exports.calloc),r.XI.set(4,h.exports.realloc),r.XI.set(5,h.exports.alignedAlloc)}catch(t){u=!1,a.R8("thread asm not support, cannot use asm thread function",c,58)}}},24565:(t,e,i)=>{"use strict";i.d(e,{Ko:()=>u,LK:()=>c,Ts:()=>d});var r=i(4919),s=i(4624),a=i(47844),n=i.n(a),o=i(88096);const l="src/cheap/webassembly/runtime/asm/thread.ts";let c,h=!0;function u(){return h}async function d(t,e,i,a){try{if(!("function"==typeof SharedArrayBuffer&&t.buffer instanceof SharedArrayBuffer))return void(h=!1);{const s=o.bx((0,r.E_)(n()),{shared:!0,initial:e,maximum:i});c=(await WebAssembly.instantiate(s,{env:{memory:t}})).instance}a({wasm_pthread_mutex_lock:c.exports.lock,wasm_pthread_mutex_trylock:c.exports.trylock,wasm_pthread_mutex_unlock:c.exports.unlock,wasm_pthread_cond_wait:c.exports.wait,wasm_pthread_cond_timedwait:c.exports.timedwait,wasm_pthread_cond_signal:c.exports.signal,wasm_pthread_cond_broadcast:c.exports.broadcast})}catch(t){h=!1,s.R8("thread asm not support, cannot use asm thread function",l,68)}}},1708:(t,e,i)=>{"use strict";i.r(e),i.d(e,{atomic_add_i16:()=>p,atomic_add_i32:()=>k,atomic_add_i64:()=>E,atomic_add_i8:()=>a,atomic_and_i16:()=>g,atomic_and_i32:()=>_,atomic_and_i64:()=>R,atomic_and_i8:()=>o,atomic_compare_exchange_i16:()=>x,atomic_compare_exchange_i32:()=>M,atomic_compare_exchange_i64:()=>$,atomic_compare_exchange_i8:()=>d,atomic_exchange_i16:()=>w,atomic_exchange_i32:()=>B,atomic_exchange_i64:()=>N,atomic_exchange_i8:()=>f,atomic_load_i16:()=>b,atomic_load_i32:()=>C,atomic_load_i64:()=>O,atomic_load_i8:()=>u,atomic_or_i16:()=>v,atomic_or_i32:()=>I,atomic_or_i64:()=>U,atomic_or_i8:()=>l,atomic_store_i16:()=>A,atomic_store_i32:()=>P,atomic_store_i64:()=>F,atomic_store_i8:()=>h,atomic_sub_i16:()=>m,atomic_sub_i32:()=>T,atomic_sub_i64:()=>D,atomic_sub_i8:()=>n,atomic_xor_i16:()=>y,atomic_xor_i32:()=>S,atomic_xor_i64:()=>L,atomic_xor_i8:()=>c,atomics_notify:()=>z,atomics_wait:()=>V,atomics_wait_timeout:()=>W,override:()=>G});var r=i(40046),s=i(6704);let a=function(t,e){return r.WQ(t,e,12,s._[12])},n=function(t,e){return r.jb(t,e,12,s._[12])},o=function(t,e){return r.Uo(t,e,12,s._[12])},l=function(t,e){return r.or(t,e,12,s._[12])},c=function(t,e){return r.I8(t,e,12,s._[12])},h=function(t,e){return r.M_(t,e,12,s._[12])},u=function(t){return r.Hh(t,12,s._[12])},d=function(t,e,i){return r.p_(t,e,i,12,s._[12])},f=function(t,e){return r.cv(t,e,12,s._[12])},p=function(t,e){return r.WQ(t,e,14,s._[14])},m=function(t,e){return r.jb(t,e,14,s._[14])},g=function(t,e){return r.Uo(t,e,14,s._[14])},v=function(t,e){return r.or(t,e,14,s._[14])},y=function(t,e){return r.I8(t,e,14,s._[14])},A=function(t,e){return r.M_(t,e,14,s._[14])},b=function(t){return r.Hh(t,14,s._[14])},x=function(t,e,i){return r.p_(t,e,i,14,s._[14])},w=function(t,e){return r.cv(t,e,14,s._[14])},k=function(t,e){return r.WQ(t,e,16,s._[16])},T=function(t,e){return r.jb(t,e,16,s._[16])},_=function(t,e){return r.Uo(t,e,16,s._[16])},I=function(t,e){return r.or(t,e,16,s._[16])},S=function(t,e){return r.I8(t,e,16,s._[16])},P=function(t,e){return r.M_(t,e,16,s._[16])},C=function(t){return r.Hh(t,16,s._[16])},M=function(t,e,i){return r.p_(t,e,i,16,s._[16])},B=function(t,e){return r.cv(t,e,16,s._[16])},E=function(t,e){return r.WQ(t,e,21,s._[21])},D=function(t,e){return r.jb(t,e,21,s._[21])},R=function(t,e){return r.Uo(t,e,21,s._[21])},U=function(t,e){return r.or(t,e,21,s._[21])},L=function(t,e){return r.I8(t,e,21,s._[21])},F=function(t,e){return r.M_(t,e,21,s._[21])},O=function(t){return r.Hh(t,21,s._[21])},$=function(t,e,i){return r.p_(t,e,i,21,s._[21])},N=function(t,e){return r.cv(t,e,21,s._[21])},z=function(t,e){return r.me(t,e)},V=function(t,e){return r.uk(t,e)},W=function(t,e,i){return r.j4(t,e,Number(BigInt.asIntN(32,i)))};function G(t){t.atomic_add_i8&&(a=t.atomic_add_i8),t.atomic_sub_i8&&(n=t.atomic_sub_i8),t.atomic_and_i8&&(o=t.atomic_and_i8),t.atomic_or_i8&&(l=t.atomic_or_i8),t.atomic_xor_i8&&(c=t.atomic_xor_i8),t.atomic_store_i8&&(h=t.atomic_store_i8),t.atomic_load_i8&&(u=t.atomic_load_i8),t.atomic_compare_exchange_i8&&(d=t.atomic_compare_exchange_i8),t.atomic_exchange_i8&&(f=t.atomic_exchange_i8),t.atomic_add_i16&&(p=t.atomic_add_i16),t.atomic_sub_i16&&(m=t.atomic_sub_i16),t.atomic_and_i16&&(g=t.atomic_and_i16),t.atomic_or_i16&&(v=t.atomic_or_i16),t.atomic_xor_i16&&(y=t.atomic_xor_i16),t.atomic_store_i16&&(A=t.atomic_store_i16),t.atomic_load_i16&&(b=t.atomic_load_i16),t.atomic_compare_exchange_i16&&(x=t.atomic_compare_exchange_i16),t.atomic_exchange_i16&&(w=t.atomic_exchange_i16),t.atomic_add_i32&&(k=t.atomic_add_i32),t.atomic_sub_i32&&(T=t.atomic_sub_i32),t.atomic_and_i32&&(_=t.atomic_and_i32),t.atomic_or_i32&&(I=t.atomic_or_i32),t.atomic_xor_i32&&(S=t.atomic_xor_i32),t.atomic_store_i32&&(P=t.atomic_store_i32),t.atomic_load_i32&&(C=t.atomic_load_i32),t.atomic_compare_exchange_i32&&(M=t.atomic_compare_exchange_i32),t.atomic_exchange_i32&&(B=t.atomic_exchange_i32),t.atomic_add_i64&&(E=t.atomic_add_i64),t.atomic_sub_i64&&(D=t.atomic_sub_i64),t.atomic_and_i64&&(R=t.atomic_and_i64),t.atomic_or_i64&&(U=t.atomic_or_i64),t.atomic_xor_i64&&(L=t.atomic_xor_i64),t.atomic_store_i64&&(F=t.atomic_store_i64),t.atomic_load_i64&&(O=t.atomic_load_i64),t.atomic_compare_exchange_i64&&($=t.atomic_compare_exchange_i64),t.atomic_exchange_i64&&(N=t.atomic_exchange_i64),t.atomics_notify&&(z=t.atomics_notify),t.atomics_wait&&(V=t.atomics_wait),t.atomics_wait_timeout&&(W=t.atomics_wait_timeout)}},14621:(t,e,i)=>{"use strict";i.d(e,{B:()=>m,CK:()=>g,LS:()=>v,Lq:()=>x,Pp:()=>w,WU:()=>b,h2:()=>A,nK:()=>y});var r=i(50932),s=i(63939),a=i(14686),n=i(50011);const o=[null,[],[]],l=0,c=28;function h(t,e){const i=o[t];0===e||10===e?(console.log.bind(console)(n.decode(i)),i.length=0):i.push(e)}const u={};let d,f="./this.program";function p(){if(!d){const t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:f||"./this.program"};for(let e in u)t[e]=u[e];const e=[];for(let i in t)e.push(i+"="+t[i]);d=e}return d}function m(t,e){let i=0;return p().forEach((function(s,a){const n=e+i;r.M[8](t+4*a,n),function(t,e){for(let i=0;i>>0);let s=0;return i.forEach((function(t){s+=t.length+1})),r.M[8](e,(0|s)>>>0),0}function v(t,e){let i=0;return 0==t?i=2:1!=t&&2!=t||(i=64),r.M[11](e,2),r.M[13](e+2,1),r.M[15](e+8,0|i),r.M[15](e+12,0),r.M[17](e+16,BigInt(0)),l}function y(t,e,i,a){let n=0;for(let r=0;r>>0),l}function A(t){throw t=`abort(${t+=""}). Build with -s ASSERTIONS=1 for more info.`,new WebAssembly.RuntimeError(t)}function b(t,e,i){if(0!==t)return c;const s=(new Date).getTime();return r.M[10](i,BigInt(s)*BigInt(1e6)),l}function x(t,e){return 0!==t?c:(r.M[10](e,BigInt(1e6)),l)}function w(t,e){const i=(0,a.s3)(t,e);return crypto.getRandomValues(i),l}},20357:(t,e,i)=>{"use strict";i.r(e),i.d(e,{override:()=>M,wasm_cpu_core_count:()=>P,wasm_pthread_cond_broadcast:()=>w,wasm_pthread_cond_destroy:()=>y,wasm_pthread_cond_init:()=>v,wasm_pthread_cond_signal:()=>x,wasm_pthread_cond_timedwait:()=>b,wasm_pthread_cond_wait:()=>A,wasm_pthread_equal2:()=>I,wasm_pthread_exit:()=>_,wasm_pthread_mutex_destroy:()=>f,wasm_pthread_mutex_init:()=>d,wasm_pthread_mutex_lock:()=>p,wasm_pthread_mutex_trylock:()=>m,wasm_pthread_mutex_unlock:()=>g,wasm_pthread_once:()=>k,wasm_pthread_self2:()=>T,wasm_pthread_support:()=>S,wasm_threw_error:()=>C});var r=i(63939),s=i(50932),a=i(73783),n=i(42518),o=i(26429),l=i(11473),c=i(40046),h=i(10576),u=i(14686);let d,f,p,m,g,v,y,A,b,x,w,k;function T(){return h.TK.__SELF_THREAD__}function _(t){const e=h.TK.__SELF_THREAD__;s.M[20](e+4,t),s.M[15](e+8,4|r.f[15](e+8))}function I(t,e){return r.f[15](t)===r.f[15](e)?1:0}function S(){return o.USE_THREADS?1:0}function P(){return navigator.hardwareConcurrency}function C(t,e){throw new Error((0,u.lH)(e))}function M(t){t.wasm_pthread_mutex_lock&&(p=t.wasm_pthread_mutex_lock),t.wasm_pthread_mutex_trylock&&(m=t.wasm_pthread_mutex_trylock),t.wasm_pthread_mutex_unlock&&(g=t.wasm_pthread_mutex_unlock),t.wasm_pthread_cond_wait&&(A=t.wasm_pthread_cond_wait),t.wasm_pthread_cond_timedwait&&(b=t.wasm_pthread_cond_timedwait),t.wasm_pthread_cond_signal&&(x=t.wasm_pthread_cond_signal),t.wasm_pthread_cond_broadcast&&(w=t.wasm_pthread_cond_broadcast)}d=function(t,e){return a.Ts(t)},f=function(t){return a.zr(t)},p=function(t){return a.s2(t)},m=function(t){return a.bh(t)},g=function(t){return a.Tl(t)},v=function(t,e){return n.Ts(t,e)},y=function(t){return n.zr(t)},A=function(t,e){return n.uk(t,e)},b=function(t,e,i){let s=1e3*Number(r.f[17](i))+r.f[15](i+8)/1e6;return n.XR(t,e,s)},x=function(t){return n.vP(t)},w=function(t){return n.mq(t)},k=function(t,e){return 0===c.WQ(t,1,16,2)&&l.XI.get(e)(),0}},77775:(t,e,i)=>{"use strict";i.r(e),i.d(e,{Timespec:()=>d,wasm_sem_destroy:()=>p,wasm_sem_init:()=>f,wasm_sem_post:()=>y,wasm_sem_timedwait:()=>v,wasm_sem_trywait:()=>g,wasm_sem_wait:()=>m});var r,s,a=i(134),n=i(80662),o=i.n(n),l=i(61499),c=i(12085),h=i(63939),u=i(79490);class d{constructor(){(0,a.A)(this,"tvSec",void 0),(0,a.A)(this,"tvNSec",void 0)}}function f(t,e,i){return u.Ts(t,i)}function p(t){return u.zr(t)}function m(t){return u.uk(t)}function g(t){return u.Zr(t)}function v(t,e){let i=1e3*Number(h.f[17](e))+h.f[15](e+8)/1e6;return u.XR(t,i)}function y(t){return u.bE(t)}r=d.prototype,(s=new(o())).set("tvSec",{0:17,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}),s.set("tvNSec",{0:15,1:0,2:0,3:0,4:0,5:0,6:0,7:8,8:0}),(0,c.A)(r,l.Og,!0),(0,c.A)(r,l.dc,8),(0,c.A)(r,l.g7,16),(0,c.A)(r,l.JY,s)},6331:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(134),s=i(10576);class a{constructor(t,e){(0,r.A)(this,"type",void 0),(0,r.A)(this,"phase",void 0),(0,r.A)(this,"ns",void 0),(0,r.A)(this,"target",void 0),(0,r.A)(this,"originalEvent",void 0),(0,r.A)(this,"isPrevented",void 0),(0,r.A)(this,"isStopped",void 0),(0,r.A)(this,"listener",void 0),this.type=t,this.phase=a.PHASE_CURRENT,e&&(this.originalEvent=e)}preventDefault(){const t=this;if(!t.isPrevented){const{originalEvent:e}=t;e&&e.preventDefault(),t.isPrevented=s.rT}return t}stopPropagation(){const t=this;if(!t.isStopped){const{originalEvent:e}=t;e&&e.stopPropagation(),t.isStopped=s.rT}return t}prevent(){return this.preventDefault()}stop(){return this.stopPropagation()}}(0,r.A)(a,"PHASE_CURRENT",0),(0,r.A)(a,"PHASE_UPWARD",1),(0,r.A)(a,"PHASE_DOWNWARD",s.Cy)},96172:(t,e,i)=>{"use strict";i.d(e,{A:()=>u});var r=i(134),s=i(67672),a=i(72739),n=i(6331),o=i(95335),l=i(20525),c=(i(4624),i(56401)),h=i(10576);class u{constructor(t){(0,r.A)(this,"ns",void 0),(0,r.A)(this,"listeners",void 0),(0,r.A)(this,"nativeListeners",void 0),this.ns=t||h.W8,this.listeners={}}fire(t,e,i){let r=this,l=s.Yj(t)?r.parse(t):t,u=r.listeners[l.type],d=h.rT;if(u){u=o.C(u);const t=e&&e[0]instanceof n.A?e[0]:h.ZH;a.__(u,(function(s){if(!p(l.ns,s,h.rT)||!a.zy(u,s)||i&&!i(l,e,s))return;t&&(t.listener=s.fn);let n=(0,c.A)(s.fn,s.ctx,e);return t&&(t.listener=h.ZH),s.num=s.num?s.num+1:1,s.num===s.max&&r.off(l,s.fn),t&&(n===h.W8?t.prevent().stop():t.isStopped&&(n=h.W8)),n===h.W8?d=h.W8:void 0}))}return d}on(t,e){const i=this,r=i.listeners,n=s.Pc(e)?{fn:e}:e;if(s.Ik(n)&&s.Pc(n.fn)){const e=s.Yj(t)?i.parse(t):t;n.ns=e.ns,a.VC(r[e.type]||(r[e.type]=[]),n)}return this}one(t,e){return s.Pc(e)?e={fn:e,max:1}:e.max=1,this.on(t,e)}off(t,e){const i=this,r=i.listeners;if(t){const n=s.Yj(t)?i.parse(t):t,l=n.type,c=n.ns,u=f(e),d=function(t,e){a.__(t,(function(e,i){u(e)&&t.splice(i,1)}),h.rT),t.length||delete r[e]},m=function(t,e){a.__(t,(function(e,i){p(c,e)&&t.splice(i,1)}),h.rT),t.length||delete r[e]};l?r[l]&&d(r[l],l):c&&o.__(r,m)}else i.listeners={}}has(t,e){let i=this.listeners,r=s.Yj(t)?this.parse(t):t,n=r.type,l=r.ns,c=h.rT,u=f(e);var d;return n?i[n]&&(d=i[n],a.__(d,(function(t){if(u(t))return c=h.W8}))):l&&o.__(i,(function(t){return a.__(t,(function(t){if(p(l,t))return c=h.W8})),c})),!c}parse(t){const e={type:t,ns:h.u1};if(this.ns){const i=l.qh(t,h.ZG);i>=0&&(e.type=l.di(t,0,i),e.ns=l.di(t,i+1))}return e}}function d(){return h.rT}function f(t){return s.Pc(t)?function(e){return t===e.fn}:d}function p(t,e,i){const{ns:r}=e;return r&&t?r===t:i?h.rT:h.W8}},84504:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(2148);function s(t,e,i=!1){const s=e.split("."),a=t.split(".");for(let t=0;t=(0,r.A)(s[t]))return a.length>=s.length;if((0,r.A)(a[t])>(0,r.A)(s[t]))return!0;if((0,r.A)(a[t])<(0,r.A)(s[t]))return!1;if(t===s.length-1&&t===a.length-1)return i;if(t===s.length-1)return!0;if(t===a.length-1)return!1}return!0}},92647:(t,e,i)=>{"use strict";function r(t,e){if(!e.length)return null;if(1===e.length)return e[0];let i,r=0;for(i of e)r+=i.length;let s=new t(r),a=0;for(i of e)s.set(i,a),a+=i.length;return s}i.d(e,{A:()=>r})},78995:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var r=i(56401),s=i(72739),a=i(10576);function n(t,e,i,n=!1){let o,l;return function(){let c=this;n&&(l=s.$r(arguments)),o||(n||(l=s.$r(arguments)),i&&(0,r.A)(t,c,l),o=setTimeout((function(){o=a.ZH,i||(0,r.A)(t,c,l)}),e))}}},56401:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(67672),s=i(10576);function a(t,e,i){if(r.Pc(t))return r.YO(i)?t.apply(e,i):e!==s.ZH?t.call(e,i):i!==s.ZH?t(i):t()}},8284:(t,e,i)=>{"use strict";function r(){let t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){let i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?i:3&i|8).toString(16)}))}i.d(e,{A:()=>r})},86932:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(45249),s=i.n(r);function a(){return s()()}},54568:(t,e,i)=>{"use strict";function r(){return"function"==typeof registerProcessor&&"number"==typeof sampleRate&&"number"==typeof currentFrame&&"number"==typeof currentTime}i.d(e,{A:()=>r})},34677:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(10576);function s(t){return t!==r.ZH}},59135:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(34677);let s;function a(){if((0,r.A)(s))return s;const t=new ArrayBuffer(2);return new DataView(t).setInt16(0,256,!0),s=256===new Int16Array(t)[0],s}},20491:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var r=i(67672),s=i(62100),a=i(20525);function n(t){return r.Pc(t)&&a.zy((0,s.A)(t),"[native code]")}},39638:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(34677),s=i(54568);function a(){return!("object"==typeof window&&(0,r.A)(window.document)||(0,s.A)())}},7972:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var r=i(64236),s=i.n(r),a=i(20491),n=i(10576);let o;typeof s()===n.s0&&(0,a.A)(s())&&(o=s()),o=typeof MessageChannel===n.s0&&(0,a.A)(MessageChannel)?function(t){const e=new MessageChannel;e.port1.onmessage=t,e.port2.postMessage(1)}:"function"==typeof setTimeout?setTimeout:function(t){setTimeout(t)};const l=o},36:(t,e,i)=>{"use strict";function r(t,e,i){return ti&&(t=i),t}i.d(e,{A:()=>r})},61837:(t,e,i)=>{"use strict";i.d(e,{A:()=>f});var r=i(69736),s=i.n(r),a=i(73146),n=i.n(a);const o='\nfunction webpackBootstrapFunc (modules) {\n var installedModules = {};\n function __webpack_require__(moduleId) {\n if(installedModules[moduleId])\n return installedModules[moduleId].exports;\n var module = installedModules[moduleId] = {\n i: moduleId,\n l: false,\n exports: {}\n };\n if (!modules[moduleId]) {\n console.error(\'can not found module:\', moduleId)\n }\n modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n module.l = true;\n return module.exports;\n }\n __webpack_require__.m = modules;\n __webpack_require__.c = installedModules;\n __webpack_require__.i = function(value) { return value; };\n __webpack_require__.d = function(exports, definition, getter) {\n if (typeof definition === \'string\') {\n if(!__webpack_require__.o(exports, definition)) {\n Object.defineProperty(exports, definition, {\n enumerable: true,\n get: getter\n });\n }\n }\n else {\n for(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: definition[key]\n });\n }\n }\n }\n };\n __webpack_require__.r = function(exports) {\n if(typeof Symbol !== \'undefined\' && Symbol.toStringTag) {\n \tObject.defineProperty(exports, Symbol.toStringTag, { value: \'Module\' });\n }\n Object.defineProperty(exports, \'__esModule\', { value: true });\n };\n __webpack_require__.f = {};\n __webpack_require__.e = function(chunkId) {\n return Promise.all(Object.keys(__webpack_require__.f).reduce(function (promises, key) {\n __webpack_require__.f[key](chunkId, promises);\n return promises;\n \t}, []));\n\t};\n __webpack_require__.u = function(chunkId) {\n return chunkId + "LIB_NAME";\n };\n __webpack_require__.n = function(module) {\n var getter = module && module.__esModule ?\n function getDefault() { return module[\'default\']; } :\n function getModuleExports() { return module; };\n __webpack_require__.d(getter, \'a\', getter);\n return getter;\n };\n (function() {\n var installedChunks = {\n "main": 0\n };\n __webpack_require__.f.j = function(chunkId, promises) {\n var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;\n if (installedChunkData !== 0) {\n if(installedChunkData) {\n promises.push(installedChunkData[2]);\n } else {\n if (true) {\n var promise = new Promise(function(resolve, reject){installedChunkData = installedChunks[chunkId] = [resolve, reject]});\n promises.push(installedChunkData[2] = promise);\n var url = __webpack_require__.p + __webpack_require__.u(chunkId);\n var error = new Error();\n var loadingEnded = function(event) {\n if(__webpack_require__.o(installedChunks, chunkId)) {\n installedChunkData = installedChunks[chunkId];\n if(installedChunkData !== 0) installedChunks[chunkId] = undefined;\n if(installedChunkData) {\n var errorType = event && (event.type === \'load\' ? \'missing\' : event.type);\n var realSrc = url;\n error.message = "Loading chunk " + chunkId + " failed.\\n(" + errorType + ": " + realSrc + ")";\n error.name = "ChunkLoadError";\n error.type = errorType;\n error.request = realSrc;\n installedChunkData[1](error);\n }\n }\n };\n __webpack_require__.l(url, loadingEnded);\n }\n }\n }\n };\n var webpackJsonpCallback = function(parentChunkLoadingFunction, data) {\n var [chunkIds, moreModules, runtime] = data;\n var moduleId, chunkId, i = 0;\n if (chunkIds.some(function(id){return installedChunks[id] !== 0})) {\n for(moduleId in moreModules) {\n if(__webpack_require__.o(moreModules, moduleId)) {\n __webpack_require__.m[moduleId] = moreModules[moduleId];\n }\n }\n if(runtime) runtime(__webpack_require__);\n }\n if (parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n for (;i < chunkIds.length; i++) {\n chunkId = chunkIds[i];\n if (__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n installedChunks[chunkId][0]();\n }\n installedChunks[chunkId] = 0;\n }\n }\n var self = typeof globalThis !== undefined ? globalThis : self\n var exportName = \'LIBRARY_EXPORT_NAME\'\n var chunkLoadingGlobal = self["webpackChunk" + exportName] = self["webpackChunk" + exportName] || [];\n chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\n chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));\n })();\n (function() {\n var inProgress = {};\n __webpack_require__.l = function(url, done) {\n if (inProgress[url]) { inProgress[url].push(done); return; }\n inProgress[url] = [done];\n var onComplete = function(event) {\n clearTimeout(timeout);\n var doneFns = inProgress[url];\n delete inProgress[url];\n doneFns && doneFns.forEach(function(fn){fn(event)});\n }\n var timeout = setTimeout(onComplete.bind(null, undefined, { type: "timeout" }), 120000);\n try {\n importScripts(url);\n onComplete({\n type: "load"\n });\n }\n catch(e) {\n onComplete({\n type: "missing"\n });\n }\n };\n })();\n __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n __webpack_require__.p = "ROOT_URL";\n __webpack_require__.oe = function(err) { console.error(err); throw err; };\n var f = __webpack_require__(__webpack_require__.s = ENTRY_MODULE);\n return f;\n}\n',l="[\\.|\\-|\\+|\\w|/|@|!]+",c="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+l+").*?\\)";function h(t){return(t+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function u(t,e,r,a){const n={};n[r]=[];let o=e.toString();const u=o.match(/^(function)?\s?\w*\(\w+,\s*(\w+),\s*(\w+)\)/);if(!u)return n;const d=u[3];a.__webpack_exports_process__||(a.__webpack_require__=d,a.__webpack_exports__=u[2],a.__webpack_exports_process__=!0);let f,p=new RegExp("(\\\\n|\\W)"+h(d)+c,"g");for(;f=p.exec(o);)"dll-reference"!==f[3]&&n[r].push(f[3]);for(p=new RegExp("\\("+h(d)+'\\("(dll-reference\\s('+l+'))"\\)\\)'+c,"g");f=p.exec(o);)t[f[2]]||(n[r].push(f[1]),t[f[2]]=i(f[1]).m),n[f[2]]=n[f[2]]||[],n[f[2]].push(f[4]);const m=s()(n);for(let t=0;t0}),!1)}function f(t,e){const r={main:i.m},a=function(t,e){const i={main:[e]},r={main:[],__webpack_exports__:"__webpack_exports__",__webpack_require__:"__webpack_require__",__webpack_exports_process__:!1},a={main:{}};for(;d(i);){const e=s()(i);for(let n=0;n{"use strict";i.d(e,{A:()=>a});var r=i(67672),s=i(72739);function a(t,e){const i=[];return r.ai(t)&&(t+=""),t&&r.Yj(t)&&s.__(t.split(e),((t,e)=>{(t=t.trim())&&i.push(t)})),i}},2148:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(67672),s=i(10576);function a(t,e){return r.sH(t)?+t:e!==s.ZH?e:0}},62100:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(10576);function s(t,e){return t!=r.Cq&&t.toString?t.toString():e!==r.ZH?e:r.u1}},65196:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var r=i(134),s=i(54001),a=i.n(s),n=i(67672),o=i(72739);class l{constructor(){(0,r.A)(this,"queue",void 0),this.queue=[]}async execute(t){try{const e=await t.task();t.resolve(e)}catch(e){t.reject(e)}}async next(){if(this.queue.length){const t=this.queue[0];t.error?t.reject(t.error):await this.execute(t),this.queue.shift(),this.queue.length&&this.next()}}async push(t){if(!n.Pc(t))throw new TypeError("task must be a function");return new(a())(((e,i)=>{const r={task:t,resolve:e,reject:i};this.queue.push(r),1===this.queue.length&&this.next()}))}clear(t){o.__(this.queue,(e=>{e.error=t||new Error("command queue clear")}))}clearPadding(){this.queue.length=0}get length(){return this.queue.length}}},68391:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var r=i(134),s=i(67672),a=i(54058),n=i(86932);class o{constructor(t,e=0){(0,r.A)(this,"queue",void 0),(0,r.A)(this,"timer",void 0),(0,r.A)(this,"ended",void 0),(0,r.A)(this,"onEnd",void 0),(0,r.A)(this,"lastTime",void 0),(0,r.A)(this,"interval",void 0),this.queue=[],this.interval=t,this.timer=new a.A((()=>{this.queue.length?this.queue.shift()():this.ended?(this.onEnd&&this.onEnd(),this.timer.stop()):this.lastTime=(0,n.A)()}),e,t)}push(t){if(!s.Pc(t))throw new TypeError("task must be a function");this.ended=!1;const e=(0,n.A)();this.timer.isStarted()&&!this.queue.length&&e-this.lastTime>this.interval?(t(),this.lastTime=e):(this.queue.push(t),1!==this.queue.length||this.timer.isStarted()||this.timer.start())}end(){this.ended=!0}reset(){this.timer.stop(),this.queue.length=0}}},61403:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(134),s=i(67672);class a{constructor(){(0,r.A)(this,"proxy",void 0),this.proxy=new Proxy(this,{get:(t,e,i)=>s.sH(e)?t.getIndexValue(+e):t[e],set:(t,e,i,r)=>(s.sH(e)?t.setIndexValue(+e,i):t[e]=i,!0)})}}},37246:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(134),s=i(4624);class a{constructor(t=1048576){(0,r.A)(this,"buffer",void 0),(0,r.A)(this,"pointer",void 0),(0,r.A)(this,"bitsLeft",void 0),(0,r.A)(this,"size",void 0),(0,r.A)(this,"endPointer",void 0),(0,r.A)(this,"pos",void 0),(0,r.A)(this,"error",void 0),(0,r.A)(this,"onFlush",void 0),this.pointer=0,this.bitsLeft=8,this.pos=BigInt(0),this.size=t,this.endPointer=0,this.error=0,this.buffer=new Uint8Array(this.size)}peekU1(){let t=0;(this.remainingLength()<1||1===this.remainingLength()&&0===this.bitsLeft)&&this.flush();let e=this.pointer,i=this.bitsLeft;return 0===i&&(e++,i=8),t=this.buffer[e]>>i-1&1,t}readU1(){let t=0;return(this.remainingLength()<1||1===this.remainingLength()&&0===this.bitsLeft)&&this.flush(),this.bitsLeft--,t=this.buffer[this.pointer]>>this.bitsLeft&1,0===this.bitsLeft&&(this.pointer++,this.bitsLeft=8,this.pos++),t}readU(t){let e=0;for(let i=0;i=t.length)this.buffer.set(t,this.endPointer),this.endPointer+=t.length;else if(this.buffer.set(this.buffer.subarray(this.pointer,this.endPointer),0),this.endPointer=this.endPointer-this.pointer,this.pointer=0,this.size-this.endPointer>=t.length)this.buffer.set(t,this.endPointer),this.endPointer+=t.length;else{const e=Math.min(this.size-this.endPointer,t.length);this.buffer.set(t.subarray(0,e),this.endPointer),this.endPointer+=e,s.R8("BSReader, call appendBuffer but the buffer's size is lagger then the remaining size","src/common/io/BitReader.ts",257)}}reset(){this.pointer=this.endPointer=0,this.bitsLeft=8,this.error=0,this.pos=BigInt(0)}skipPadding(){this.bitsLeft<8&&(this.bitsLeft=8,this.pointer++,this.pos++)}}},83314:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(134);class s{constructor(t=1048576){(0,r.A)(this,"buffer",void 0),(0,r.A)(this,"pointer",void 0),(0,r.A)(this,"pos",void 0),(0,r.A)(this,"bitPointer",void 0),(0,r.A)(this,"size",void 0),(0,r.A)(this,"error",void 0),(0,r.A)(this,"onFlush",void 0),this.pointer=0,this.bitPointer=0,this.size=t,this.error=0,this.pos=BigInt(0),this.buffer=new Uint8Array(this.size)}writeU1(t){(this.remainingLength()<1||1===this.remainingLength()&&this.bitPointer>=8)&&this.flush(),1&t?this.buffer[this.pointer]|=1<<7-this.bitPointer:this.buffer[this.pointer]&=~(1<<7-this.bitPointer),this.bitPointer++,8===this.bitPointer&&(this.pointer++,this.pos++,this.bitPointer=0)}writeU(t,e){for(let i=0;i>t-i-1&1)}remainingLength(){return this.size-this.pointer}flush(){if(!this.onFlush)throw this.error=-1048574,Error("BSWriter error, flush failed because of no flush callback");if(this.pointer)if(this.bitPointer&&this.pointer>1){const t=this.onFlush(this.buffer.subarray(0,this.pointer-1));if(0!==t)throw this.error=t,Error("BSWriter error, flush failed");this.buffer[0]=this.buffer[this.pointer]}else if(0===this.bitPointer){const t=this.onFlush(this.buffer.subarray(0,this.pointer));if(0!==t)throw this.error=t,Error("BSWriter error, flush failed")}this.pointer=0}padding(){for(;0!==this.bitPointer;)this.writeU1(0)}reset(){this.pointer=0,this.bitPointer=0,this.error=0,this.pos=BigInt(0)}getBuffer(){return this.buffer}getPointer(){return this.pointer}getPos(){return this.pos}}},31865:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var r=i(134),s=i(92647),a=i(50011);class n{constructor(t,e=!0){(0,r.A)(this,"data",void 0),(0,r.A)(this,"buffer",void 0),(0,r.A)(this,"byteStart",void 0),(0,r.A)(this,"pos",void 0),(0,r.A)(this,"size",void 0),(0,r.A)(this,"littleEndian",void 0),this.buffer=t,this.data=t instanceof Uint8Array?new DataView(t.buffer):t.view,this.byteStart=t instanceof Uint8Array?t.byteOffset:0,this.pos=0,this.size=t.byteLength,this.littleEndian=!e}readUint8(){return this.data.getUint8(this.pos+++this.byteStart)}peekUint8(){return this.data.getUint8(this.pos+this.byteStart)}readUint16(){const t=this.data.getUint16(this.pos+this.byteStart,this.littleEndian);return this.pos+=2,t}peekUint16(){return this.data.getUint16(this.pos+this.byteStart,this.littleEndian)}readUint24(){const t=this.readUint16(),e=this.readUint8();return this.littleEndian?e<<16|t:t<<8|e}peekUint24(){const t=this.readUint16(),e=this.readUint8();return this.pos-=3,this.littleEndian?e<<16|t:t<<8|e}readUint32(){const t=this.data.getUint32(this.pos+this.byteStart,this.littleEndian);return this.pos+=4,t}peekUint32(){return this.data.getUint32(this.pos+this.byteStart,this.littleEndian)}readUint64(){const t=BigInt(this.readUint32()),e=BigInt(this.readUint32());return this.littleEndian?e<this.size&&(t=this.size),this.pos=Math.max(0,t)}skip(t){this.seek(this.pos+t)}back(t){this.seek(this.pos-t)}remainingSize(){return this.size-this.pos}readBuffer(t){t=Math.min(t,this.remainingSize());const e=this.buffer.slice(this.pos,this.pos+t);return this.pos+=t,e}appendBuffer(t){this.buffer=(0,s.A)(Uint8Array,[this.buffer.slice(),t.slice()]),this.data=new DataView(this.buffer.buffer),this.size+=t.byteLength,this.byteStart=0}resetBuffer(t,e=!0){this.buffer=t,this.data=t instanceof Uint8Array?new DataView(t.buffer):t.view,this.byteStart=t instanceof Uint8Array?t.byteOffset:0,this.pos=0,this.size=t.byteLength,this.littleEndian=!e}}},729:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var r=i(134),s=i(4624),a=i(50011);class n{constructor(t,e=!0){(0,r.A)(this,"data",void 0),(0,r.A)(this,"buffer",void 0),(0,r.A)(this,"byteStart",void 0),(0,r.A)(this,"pos",void 0),(0,r.A)(this,"size",void 0),(0,r.A)(this,"littleEndian",void 0),this.buffer=t,this.data=t instanceof Uint8Array?new DataView(t.buffer):t.view,this.byteStart=t instanceof Uint8Array?t.byteOffset:0,this.pos=0,this.size=t.byteLength,this.littleEndian=!e}writeUint8(t){this.data.setUint8(this.pos+++this.byteStart,t)}writeUint16(t){this.data.setUint16(this.pos+this.byteStart,t,this.littleEndian),this.pos+=2}writeUint24(t){const e=3840&t,i=240&t,r=15&t;this.littleEndian?(this.writeUint8(r),this.writeUint8(i),this.writeUint8(e)):(this.writeUint8(e),this.writeUint8(i),this.writeUint8(r))}writeUint32(t){this.data.setUint32(this.pos+this.byteStart,t,this.littleEndian),this.pos+=4}writeUint64(t){const e=t&BigInt(4294967295),i=(t&BigInt(4294967295)<>BigInt(32);this.littleEndian?(this.writeUint32(Number(e)),this.writeUint32(Number(i))):(this.writeUint32(Number(i)),this.writeUint32(Number(e)))}writeInt8(t){this.data.setInt8(this.pos+++this.byteStart,t)}writeInt16(t){this.data.setInt16(this.pos+this.byteStart,t,this.littleEndian),this.pos+=2}writeInt24(t){this.writeUint24(t<0?t+16777216:t)}writeInt32(t){this.data.setInt32(this.pos+this.byteStart,t,this.littleEndian),this.pos+=4}writeInt64(t){const e=t&BigInt(4294967295),i=(t&BigInt(4294967295)<>BigInt(32);this.littleEndian?(this.writeInt32(Number(e)),this.writeInt32(Number(i))):(this.writeInt32(Number(i)),this.writeInt32(Number(e)))}writeFloat(t){this.data.setFloat32(this.pos+this.byteStart,t,this.littleEndian),this.pos+=4}writeDouble(t){this.data.setFloat64(this.pos+this.byteStart,t,this.littleEndian),this.pos+=8}getPos(){return this.pos}seek(t){t>this.size&&(t=this.size),this.pos=Math.max(0,t)}skip(t){this.seek(this.pos+t)}back(t){this.seek(this.pos-t)}remainingSize(){return this.size-this.pos}writeBuffer(t){let e=t.length;this.remainingSize(){"use strict";i.d(e,{A:()=>l});var r=i(134),s=i(4624),a=i(50011),n=i(13724);const o="src/common/io/IOReader.ts";class l{constructor(t=1048576,e=!0,i){if((0,r.A)(this,"data",void 0),(0,r.A)(this,"buffer",void 0),(0,r.A)(this,"pointer",void 0),(0,r.A)(this,"endPointer",void 0),(0,r.A)(this,"pos",void 0),(0,r.A)(this,"size",void 0),(0,r.A)(this,"littleEndian",void 0),(0,r.A)(this,"fileSize_",void 0),(0,r.A)(this,"error",void 0),(0,r.A)(this,"onFlush",void 0),(0,r.A)(this,"onSeek",void 0),(0,r.A)(this,"onSize",void 0),(0,r.A)(this,"flags",void 0),this.pos=BigInt(0),this.pointer=0,this.error=0,this.endPointer=0,this.littleEndian=!e,this.flags=0,i&&i.view)this.size=i.length,this.buffer=i,this.data=i.view;else if(i&&!i.byteOffset)this.size=i.length,this.buffer=i,this.data=new DataView(this.buffer.buffer);else{if(i)throw new Error("not support subarray of ArrayBuffer");this.size=Math.max(t,102400),this.buffer=new Uint8Array(this.size),this.data=new DataView(this.buffer.buffer)}}async readUint8(){this.remainingLength()<1&&await this.flush(1);const t=this.data.getUint8(this.pointer);return this.pointer++,this.pos++,t}async peekUint8(){return this.remainingLength()<1&&await this.flush(1),this.data.getUint8(this.pointer)}async readUint16(){this.remainingLength()<2&&await this.flush(2);const t=this.data.getUint16(this.pointer,this.littleEndian);return this.pointer+=2,this.pos+=BigInt(2),t}async peekUint16(){return this.remainingLength()<2&&await this.flush(2),this.data.getUint16(this.pointer,this.littleEndian)}async readUint24(){this.remainingLength()<3&&await this.flush(3);const t=await this.readUint16(),e=await this.readUint8();return this.littleEndian?e<<16|t:t<<8|e}async peekUint24(){this.remainingLength()<3&&await this.flush(3);const t=this.pointer,e=this.pos,i=await this.readUint16(),r=await this.readUint8(),s=this.littleEndian?r<<16|i:i<<8|r;return this.pointer=t,this.pos=e,s}async readUint32(){this.remainingLength()<4&&await this.flush(4);const t=this.data.getUint32(this.pointer,this.littleEndian);return this.pointer+=4,this.pos+=BigInt(4),t}async peekUint32(){return this.remainingLength()<4&&await this.flush(4),this.data.getUint32(this.pointer,this.littleEndian)}async readUint64(){this.remainingLength()<8&&await this.flush(8);const t=this.data.getBigUint64(this.pointer,this.littleEndian);return this.pointer+=8,this.pos+=BigInt(8),t}async peekUint64(){return this.remainingLength()<8&&await this.flush(8),this.data.getBigUint64(this.pointer,this.littleEndian)}async readInt8(){this.remainingLength()<1&&await this.flush(1);const t=this.data.getInt8(this.pointer);return this.pointer++,this.pos++,t}async peekInt8(){return this.remainingLength()<1&&await this.flush(1),this.data.getInt8(this.pointer)}async readInt16(){this.remainingLength()<2&&await this.flush(2);const t=this.data.getInt16(this.pointer,this.littleEndian);return this.pointer+=2,this.pos+=BigInt(2),t}async peekInt16(){return this.remainingLength()<2&&await this.flush(2),this.data.getInt16(this.pointer,this.littleEndian)}async readInt24(){const t=await this.readUint24();return 8388608&t?t-16777216:t}async peekInt24(){const t=await this.peekUint24();return 8388608&t?t-16777216:t}async readInt32(){this.remainingLength()<4&&await this.flush(4);const t=this.data.getInt32(this.pointer,this.littleEndian);return this.pointer+=4,this.pos+=BigInt(4),t}async peekInt32(){return this.remainingLength()<4&&await this.flush(4),this.data.getInt32(this.pointer,this.littleEndian)}async readInt64(){this.remainingLength()<8&&await this.flush(8);const t=this.data.getBigInt64(this.pointer,this.littleEndian);return this.pointer+=8,this.pos+=BigInt(8),t}async peekInt64(){return this.remainingLength()<8&&await this.flush(8),this.data.getBigInt64(this.pointer,this.littleEndian)}async readFloat(){this.remainingLength()<4&&await this.flush(4);const t=this.data.getFloat32(this.pointer,this.littleEndian);return this.pointer+=4,this.pos+=BigInt(4),t}async peekFloat(){return this.remainingLength()<4&&await this.flush(4),this.data.getFloat32(this.pointer,this.littleEndian)}async readDouble(){this.remainingLength()<8&&await this.flush(8);const t=this.data.getFloat64(this.pointer,this.littleEndian);return this.pointer+=8,this.pos+=BigInt(8),t}async peekDouble(){return this.remainingLength()<8&&await this.flush(8),this.data.getFloat64(this.pointer,this.littleEndian)}async readHex(t=1){let e="";for(let i=0;ithis.size&&(this.error=-1048574,s.h2("peekHex, length too large",o,414)),this.remainingLength()0){const r=this.remainingLength();e.set(this.buffer.subarray(this.pointer,this.pointer+r),i),i+=r,this.pointer+=r,this.pos+=BigInt(r),t-=r}for(;t>0;){await this.flush();const r=Math.min(this.endPointer-this.pointer,t);e.set(this.buffer.subarray(this.pointer,this.pointer+r),i),i+=r,this.pointer+=r,this.pos+=BigInt(r),t-=r}}else e.set(this.buffer.subarray(this.pointer,this.pointer+t),0),this.pointer+=t,this.pos+=BigInt(t);return e}async peekBuffer(t,e){return t>this.size&&(this.error=-1048574,s.h2("peekBuffer, length too large",o,499)),this.remainingLength()0){const r=this.remainingLength();e.set(this.buffer.subarray(this.pointer,this.pointer+r),i),i+=r,this.pointer+=r,this.pos+=BigInt(r),t-=r}for(;t>0;){try{await this.flush()}catch(t){if(-1048576===this.error&&i)return i;throw t}const r=Math.min(this.endPointer-this.pointer,t);e.set(this.buffer.subarray(this.pointer,this.pointer+r),i),i+=r,this.pointer+=r,this.pos+=BigInt(r),t-=r}return i}return e.set(this.buffer.subarray(this.pointer,this.pointer+t),0),this.pointer+=t,this.pos+=BigInt(t),t}async readString(t=1){const e=await this.readBuffer(t);return a.decode(e)}async peekString(t=1){const e=await this.peekBuffer(t);return a.decode(e)}async readLine(){let t="";for(;;){let e=!1;for(let i=this.pointer;i=t&&(this.pointer+=t),this.pos+=BigInt(e)}remainingLength(){return this.endPointer-this.pointer}async flush_(t){for(;;){const e=await this.onFlush(t);if(-1048575!==e)return e;await new n.A(0)}}async flush(t=0){if(this.onFlush||(this.error=-1048574,s.h2("IOReader error, flush failed because of no flush callback",o,731)),!(this.size-this.remainingLength()<=0)){if(t=Math.min(t,this.size),this.pointer0&&this.pointer+e=t.length)this.buffer.set(t,this.endPointer),this.endPointer+=t.length;else if(this.buffer.set(this.buffer.subarray(this.pointer,this.endPointer),0),this.endPointer=this.endPointer-this.pointer,this.pointer=0,this.size-this.endPointer>=t.length)this.buffer.set(t,this.endPointer),this.endPointer+=t.length;else{const e=Math.min(this.size-this.endPointer,t.length);this.buffer.set(t.subarray(0,e),this.endPointer),this.endPointer+=e,s.R8("IOReader, call appendBuffer but the buffer's size is lagger then the remaining size",o,849)}}reset(){this.pointer=this.endPointer=0,this.pos=BigInt(0),this.error=0}setEndian(t){this.littleEndian=!t}async fileSize(){if(this.fileSize_)return this.fileSize_;if(!this.onSize)return s.R8("IOReader error, fileSize failed because of no onSize callback",o,882),BigInt(0);try{this.fileSize_=await this.onSize()}catch(t){s.R8(`IOReader error, call fileSize failed: ${t}`,o,889),this.fileSize_=BigInt(0)}return this.fileSize_}getBufferSize(){return this.size}async pipe(t,e){if(e)if(this.remainingLength()0){const i=this.remainingLength();await t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+i)),this.pointer+=i,this.pos+=BigInt(i),e-=i}for(;e>0;){await this.flush();const i=Math.min(this.remainingLength(),e);await t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+i)),this.pointer+=i,this.pos+=BigInt(i),e-=i}}else await t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+e)),this.pointer+=e,this.pos+=BigInt(e);else{if(this.remainingLength()>0){const e=this.remainingLength();await t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+e)),this.pointer+=e,this.pos+=BigInt(e)}for(;await this.flush_(this.buffer.subarray(0))>0;){const e=this.remainingLength();await t.writeBuffer(this.buffer.subarray(this.pointer,this.pointer+e)),this.pointer+=e,this.pos+=BigInt(e)}}}}},34531:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(134),s=i(50011);class a{constructor(t=1048576,e=!0,i){if((0,r.A)(this,"data",void 0),(0,r.A)(this,"buffer",void 0),(0,r.A)(this,"pointer",void 0),(0,r.A)(this,"pos",void 0),(0,r.A)(this,"size",void 0),(0,r.A)(this,"littleEndian",void 0),(0,r.A)(this,"error",void 0),(0,r.A)(this,"onFlush",void 0),(0,r.A)(this,"onSeek",void 0),this.pointer=0,this.pos=BigInt(0),this.size=t,this.littleEndian=!e,this.error=0,i&&i.view)this.size=i.length,this.buffer=i,this.data=i.view;else if(i&&!i.byteOffset)this.size=i.length,this.buffer=i,this.data=new DataView(this.buffer.buffer);else{if(i)throw new Error("not support subarray of ArrayBuffer");this.buffer=new Uint8Array(this.size),this.data=new DataView(this.buffer.buffer)}}async writeUint8(t){this.remainingLength()<1&&await this.flush(),this.data.setUint8(this.pointer,t),this.pointer++,this.pos++}async writeUint16(t){this.remainingLength()<2&&await this.flush(),this.data.setUint16(this.pointer,t,this.littleEndian),this.pointer+=2,this.pos+=BigInt(2)}async writeUint24(t){this.remainingLength()<3&&await this.flush();const e=(16711680&t)>>16,i=(65280&t)>>8,r=255&t;this.littleEndian?(await this.writeUint8(r),await this.writeUint8(i),await this.writeUint8(e)):(await this.writeUint8(e),await this.writeUint8(i),await this.writeUint8(r))}async writeUint32(t){this.remainingLength()<4&&await this.flush(),this.data.setUint32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}async writeUint64(t){this.remainingLength()<8&&await this.flush(),this.data.setBigUint64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}async writeInt8(t){this.remainingLength()<1&&await this.flush(),this.data.setInt8(this.pointer,t),this.pointer++,this.pos++}async writeInt16(t){this.remainingLength()<2&&await this.flush(),this.data.setInt16(this.pointer,t,this.littleEndian),this.pointer+=2,this.pos+=BigInt(2)}async writeInt24(t){await this.writeUint24(t<0?t+16777216:t)}async writeInt32(t){this.remainingLength()<4&&await this.flush(),this.data.setInt32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}async writeInt64(t){this.remainingLength()<8&&await this.flush(),this.data.setBigInt64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}async writeFloat(t){this.remainingLength()<4&&await this.flush(),this.data.setFloat32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}async writeDouble(t){this.remainingLength()<8&&await this.flush(),this.data.setFloat64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}getPointer(){return this.pointer}getPos(){return this.pos}remainingLength(){return this.size-this.pointer}async writeBuffer(t){if(!t.length)return;let e=t.length;if(this.remainingLength()0;){await this.flush();const r=Math.min(this.size,e);this.buffer.set(t.subarray(i,i+r),this.pointer),this.pointer+=r,this.pos+=BigInt(r),i+=r,e-=r}}else this.buffer.set(t,this.pointer),this.pointer+=e,this.pos+=BigInt(e)}async writeString(t){const e=s.encode(t);return await this.writeBuffer(e),e.length}async flush(){if(!this.onFlush)throw this.error=-1048574,Error("IOWriter error, flush failed because of no flush callback");if(this.pointer){const t=await this.onFlush(this.buffer.subarray(0,this.pointer));if(0!==t)throw this.error=t,Error("IOWriter error, flush failed")}this.pointer=0}async flushToPos(t){if(!this.onFlush)throw this.error=-1048574,Error("IOWriter error, flush failed because of no flush callback");if(this.pointer){const e=await this.onFlush(this.buffer.subarray(0,this.pointer),t);if(0!==e)throw this.error=e,Error("IOWriter error, flush failed")}this.pointer=0}async seek(t){if(!this.onSeek)throw this.error=-1048574,Error("IOWriter error, seek failed because of no seek callback");await this.flush();const e=await this.onSeek(t);if(0!==e)throw this.error=e,Error("IOWriter error, seek failed");this.pos=t}seekInline(t){const e=this.pointer;this.pointer=Math.max(0,Math.min(this.size,t)),this.pos+=BigInt(this.pointer-e)}skip(t){const e=this.pointer;this.pointer=Math.min(this.size,this.pointer+t),this.pos+=BigInt(this.pointer-e)}back(t){const e=this.pointer;this.pointer=Math.max(0,this.pointer-t),this.pos+=BigInt(this.pointer-e)}getBuffer(){return this.buffer.subarray(0,this.pointer)}setEndian(t){this.littleEndian=!t}reset(){this.pointer=0,this.pos=BigInt(0),this.error=0}getBufferSize(){return this.size}}},35336:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(134),s=i(50011);class a{constructor(t=1048576,e=!0,i){if((0,r.A)(this,"data",void 0),(0,r.A)(this,"buffer",void 0),(0,r.A)(this,"pointer",void 0),(0,r.A)(this,"pos",void 0),(0,r.A)(this,"size",void 0),(0,r.A)(this,"littleEndian",void 0),(0,r.A)(this,"error",void 0),(0,r.A)(this,"onFlush",void 0),(0,r.A)(this,"onSeek",void 0),this.pointer=0,this.pos=BigInt(0),this.size=t,this.littleEndian=!e,this.error=0,i&&i.view)this.size=i.length,this.buffer=i,this.data=i.view;else if(i&&!i.byteOffset)this.size=i.length,this.buffer=i,this.data=new DataView(this.buffer.buffer);else{if(i)throw new Error("not support subarray of ArrayBuffer");this.buffer=new Uint8Array(this.size),this.data=new DataView(this.buffer.buffer)}}writeUint8(t){this.remainingLength()<1&&this.flush(),this.data.setUint8(this.pointer,t),this.pointer++,this.pos++}writeUint16(t){this.remainingLength()<2&&this.flush(),this.data.setUint16(this.pointer,t,this.littleEndian),this.pointer+=2,this.pos+=BigInt(2)}writeUint24(t){this.remainingLength()<3&&this.flush();const e=(16711680&t)>>16,i=(65280&t)>>8,r=255&t;this.littleEndian?(this.writeUint8(r),this.writeUint8(i),this.writeUint8(e)):(this.writeUint8(e),this.writeUint8(i),this.writeUint8(r))}writeUint32(t){this.remainingLength()<4&&this.flush(),this.data.setUint32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}writeUint64(t){this.remainingLength()<8&&this.flush(),this.data.setBigUint64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}writeInt8(t){this.remainingLength()<1&&this.flush(),this.data.setInt8(this.pointer,t),this.pointer++,this.pos++}writeInt16(t){this.remainingLength()<2&&this.flush(),this.data.setInt16(this.pointer,t,this.littleEndian),this.pointer+=2,this.pos+=BigInt(2)}writeInt24(t){this.writeUint24(t<0?t+16777216:t)}writeInt32(t){this.remainingLength()<4&&this.flush(),this.data.setInt32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}writeInt64(t){this.remainingLength()<8&&this.flush(),this.data.setBigInt64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}writeFloat(t){this.remainingLength()<4&&this.flush(),this.data.setFloat32(this.pointer,t,this.littleEndian),this.pointer+=4,this.pos+=BigInt(4)}writeDouble(t){this.remainingLength()<8&&this.flush(),this.data.setFloat64(this.pointer,t,this.littleEndian),this.pointer+=8,this.pos+=BigInt(8)}getPointer(){return this.pointer}getPos(){return this.pos}remainingLength(){return this.size-this.pointer}writeBuffer(t){if(!t.length)return;let e=t.length;if(this.remainingLength()0;){this.flush();const r=Math.min(this.size,e);this.buffer.set(t.subarray(i,i+r),this.pointer),this.pointer+=r,this.pos+=BigInt(r),i+=r,e-=r}}else this.buffer.set(t,this.pointer),this.pointer+=e,this.pos+=BigInt(e)}writeString(t){const e=s.encode(t);return this.writeBuffer(e),e.length}flush(){if(!this.onFlush)throw this.error=-1048574,Error("IOWriter error, flush failed because of no flush callback");if(this.pointer){const t=this.onFlush(this.buffer.subarray(0,this.pointer));if(0!==t)throw this.error=t,Error("IOWriter error, flush failed")}this.pointer=0}flushToPos(t){if(!this.onFlush)throw this.error=-1048574,Error("IOWriter error, flush failed because of no flush callback");if(this.pointer){const e=this.onFlush(this.buffer.subarray(0,this.pointer),t);if(0!==e)throw this.error=e,Error("IOWriter error, flush failed")}this.pointer=0}seek(t){if(!this.onSeek)throw this.error=-1048574,Error("IOWriter error, seek failed because of no seek callback");this.flush();const e=this.onSeek(t);if(0!==e)throw this.error=e,Error("IOWriter error, seek failed");this.pos=t}seekInline(t){const e=this.pointer;this.pointer=Math.max(0,Math.min(this.size,t)),this.pos+=BigInt(this.pointer-e)}skip(t){const e=this.pointer;this.pointer=Math.min(this.size,this.pointer+t),this.pos+=BigInt(this.pointer-e)}back(t){const e=this.pointer;this.pointer=Math.max(0,this.pointer-t),this.pos+=BigInt(this.pointer-e)}getBuffer(){return this.buffer.subarray(0,this.pointer)}setEndian(t){this.littleEndian=!t}reset(){this.pointer=0,this.pos=BigInt(0),this.error=0}getBufferSize(){return this.size}}},22343:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(134),s=i(92647);class a{constructor(){(0,r.A)(this,"queue",void 0),(0,r.A)(this,"pos",void 0),(0,r.A)(this,"startPos",void 0),(0,r.A)(this,"endPos",void 0),(0,r.A)(this,"index",void 0),(0,r.A)(this,"offset",void 0),this.queue=[],this.startPos=BigInt(0),this.endPos=BigInt(0),this.pos=BigInt(0)}write(t){if(this.pos===this.endPos)this.queue.push(t),this.endPos+=BigInt(t.length),this.pos+=BigInt(t.length);else if(t.lengththis.endPos)return!1;this.pos=t,this.index=-1,this.offset=-1;let e=this.startPos;for(let i=0;i{"use strict";i.d(e,{A:()=>o});var r=i(134),s=i(72739),a=i(4624);const n="src/common/math/Matrix3.ts";class o{static RowMajor(t){return new o([t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]])}static ColMajor(t){return new o(t)}constructor(t){(0,r.A)(this,"element",void 0),t?(this.element=new Float32Array(9),this.set(t)):this.element=new Float32Array([1,0,0,0,1,0,0,0,1])}rc(t,e){return this.getValue(3*e+t)}setRC(t,e,i){this.setValue(3*e+t,i)}getValue(t){if(t>=0&&t<9)return this.element[t];a.z3("index out of Matrix4's rang [0 - 9]",n,47)}setValue(t,e){t>=0&&t<9?this.element[t]=e:a.z3("index out of Matrix4's rang [0 - 9]",n,56)}setIdentity(){return this.element=new Float32Array([1,0,0,0,1,0,0,0,1]),this}set(t){return s.__(t,((t,e)=>{this.element[e]=t})),this}invert(){const t=this.element,e=t[0],i=t[1],r=t[2],s=t[3],a=t[4],n=t[5],o=t[6],l=t[7],c=t[8],h=c*a-n*l,u=n*o-c*s,d=l*s-a*o,f=e*h+i*u+r*d;if(0===f)return this.set([0,0,0,0,0,0,0,0,0]);const p=1/f;return t[0]=h*p,t[1]=(r*l-c*i)*p,t[2]=(n*i-r*a)*p,t[3]=u*p,t[4]=(c*e-r*o)*p,t[5]=(r*s-n*e)*p,t[6]=d*p,t[7]=(i*o-l*e)*p,t[8]=(a*e-i*s)*p,this}toArray(){let t=[];for(let e=0;e<9;e++)t[e]=this.element[e];return t}copy(){return(new o).set(this.toArray())}}},12535:(t,e,i)=>{"use strict";i.d(e,{A:()=>c});var r=i(134),s=i(72739),a=i(4624),n=i(1064);const o="src/common/math/Matrix4.ts";let l;class c{static shared(){return l||(l=new c)}static RowMajor(t){return new c([t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]])}static ColMajor(t){return new c(t)}constructor(t){(0,r.A)(this,"element",void 0),t?(this.element=new Float32Array(16),this.set(t)):this.element=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}rc(t,e){return this.getValue(4*e+t)}setRC(t,e,i){this.setValue(4*e+t,i)}getValue(t){if(t>=0&&t<=15)return this.element[t];a.z3("index out of Matrix4's rang [0 - 15]",o,58)}setValue(t,e){t>=0&&t<=15?this.element[t]=e:a.z3("index out of Matrix4's rang [0 - 15]",o,67)}setIdentity(){return this.element=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this}set(t){return s.__(t,((t,e)=>{this.element[e]=t})),this}multiply(t){let e,i,r,s,a,n,o,l;if(s=i=this.element,r=t.element,s===r)for(r=new Float32Array(16),e=0;e<16;e++)r[e]=s[e];for(e=0;e<4;e++)a=i[e],n=i[e+4],o=i[e+8],l=i[e+12],s[e]=a*r[0]+n*r[1]+o*r[2]+l*r[3],s[e+4]=a*r[4]+n*r[5]+o*r[6]+l*r[7],s[e+8]=a*r[8]+n*r[9]+o*r[10]+l*r[11],s[e+12]=a*r[12]+n*r[13]+o*r[14]+l*r[15];return this}multiplyVector3(t){let e=this.element,i=t.element;return new n.P([i[0]*e[0]+i[1]*e[4]+i[2]*e[8]+e[12],i[0]*e[1]+i[1]*e[5]+i[2]*e[9]+e[13],i[0]*e[2]+i[1]*e[6]+i[2]*e[10]+e[14]])}multiplyVector4(t){let e=this.element,i=t.element;return new n.I([i[0]*e[0]+i[1]*e[4]+i[2]*e[8]+i[3]*e[12],i[0]*e[1]+i[1]*e[5]+i[2]*e[9]+i[3]*e[13],i[0]*e[2]+i[1]*e[6]+i[2]*e[10]+i[3]*e[14],i[0]*e[3]+i[1]*e[7]+i[2]*e[11]+i[3]*e[15]])}transpose(){let t,e;return t=this.element,e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setInverseOf(t){let e,i,r,s,a;if(i=t.element,r=this.element,s=new Float32Array(16),s[0]=i[5]*i[10]*i[15]-i[5]*i[11]*i[14]-i[9]*i[6]*i[15]+i[9]*i[7]*i[14]+i[13]*i[6]*i[11]-i[13]*i[7]*i[10],s[1]=-i[1]*i[10]*i[15]+i[1]*i[11]*i[14]+i[9]*i[2]*i[15]-i[9]*i[3]*i[14]-i[13]*i[2]*i[11]+i[13]*i[3]*i[10],s[2]=i[1]*i[6]*i[15]-i[1]*i[7]*i[14]-i[5]*i[2]*i[15]+i[5]*i[3]*i[14]+i[13]*i[2]*i[7]-i[13]*i[3]*i[6],s[3]=-i[1]*i[6]*i[11]+i[1]*i[7]*i[10]+i[5]*i[2]*i[11]-i[5]*i[3]*i[10]-i[9]*i[2]*i[7]+i[9]*i[3]*i[6],s[4]=-i[4]*i[10]*i[15]+i[4]*i[11]*i[14]+i[8]*i[6]*i[15]-i[8]*i[7]*i[14]-i[12]*i[6]*i[11]+i[12]*i[7]*i[10],s[5]=i[0]*i[10]*i[15]-i[0]*i[11]*i[14]-i[8]*i[2]*i[15]+i[8]*i[3]*i[14]+i[12]*i[2]*i[11]-i[12]*i[3]*i[10],s[6]=-i[0]*i[6]*i[15]+i[0]*i[7]*i[14]+i[4]*i[2]*i[15]-i[4]*i[3]*i[14]-i[12]*i[2]*i[7]+i[12]*i[3]*i[6],s[7]=i[0]*i[6]*i[11]-i[0]*i[7]*i[10]-i[4]*i[2]*i[11]+i[4]*i[3]*i[10]+i[8]*i[2]*i[7]-i[8]*i[3]*i[6],s[8]=i[4]*i[9]*i[15]-i[4]*i[11]*i[13]-i[8]*i[5]*i[15]+i[8]*i[7]*i[13]+i[12]*i[5]*i[11]-i[12]*i[7]*i[9],s[9]=-i[0]*i[9]*i[15]+i[0]*i[11]*i[13]+i[8]*i[1]*i[15]-i[8]*i[3]*i[13]-i[12]*i[1]*i[11]+i[12]*i[3]*i[9],s[10]=i[0]*i[5]*i[15]-i[0]*i[7]*i[13]-i[4]*i[1]*i[15]+i[4]*i[3]*i[13]+i[12]*i[1]*i[7]-i[12]*i[3]*i[5],s[11]=-i[0]*i[5]*i[11]+i[0]*i[7]*i[9]+i[4]*i[1]*i[11]-i[4]*i[3]*i[9]-i[8]*i[1]*i[7]+i[8]*i[3]*i[5],s[12]=-i[4]*i[9]*i[14]+i[4]*i[10]*i[13]+i[8]*i[5]*i[14]-i[8]*i[6]*i[13]-i[12]*i[5]*i[10]+i[12]*i[6]*i[9],s[13]=i[0]*i[9]*i[14]-i[0]*i[10]*i[13]-i[8]*i[1]*i[14]+i[8]*i[2]*i[13]+i[12]*i[1]*i[10]-i[12]*i[2]*i[9],s[14]=-i[0]*i[5]*i[14]+i[0]*i[6]*i[13]+i[4]*i[1]*i[14]-i[4]*i[2]*i[13]-i[12]*i[1]*i[6]+i[12]*i[2]*i[5],s[15]=i[0]*i[5]*i[10]-i[0]*i[6]*i[9]-i[4]*i[1]*i[10]+i[4]*i[2]*i[9]+i[8]*i[1]*i[6]-i[8]*i[2]*i[5],a=i[0]*s[0]+i[1]*s[4]+i[2]*s[8]+i[3]*s[12],0===a)return this;for(a=1/a,e=0;e<16;e++)r[e]=s[e]*a;return this}invert(){return this.setInverseOf(this),this}setOrtho(t,e,i,r,s,n){let l,c,h;return t!==e&&i!==r&&s!==n||a.h2("null frustum",o,240),l=1/(e-t),c=1/(r-i),h=1/(n-s),this.set([2*l,0,0,0,0,2*c,0,0,0,0,-2*h,0,-(e+t)*l,-(r+i)*c,-(n+s)*h,1]),this}ortho(t,e,i,r,s,a){return this.multiply((new c).setOrtho(t,e,i,r,s,a))}setFrustum(t,e,i,r,s,n){let l,c,h;return t!==e&&i!==r&&s!==n||a.z3("null frustum",o,281),s<=0&&a.h2("near <= 0",o,284),n<=0&&a.h2("far <= 0",o,287),l=1/(e-t),c=1/(r-i),h=1/(n-s),this.set([2*s*l,0,0,0,0,2*s*c,0,0,(e+t)*l,(r+i)*c,-(n+s)*h,-1,0,0,-2*s*n*h,0]),this}frustum(t,e,i,r,s,a){return this.multiply((new c).setOrtho(t,e,i,r,s,a))}setPerspective(t,e,i,r){let s,n,l;return i!==r&&0!==e||a.h2("null frustum",o,328),i<=0&&a.h2("near <= 0",o,331),r<=0&&a.h2("far <= 0",o,334),t=Math.PI*t/180/2,n=Math.sin(t),0===n&&a.h2("null frustum",o,342),s=1/(r-i),l=Math.cos(t)/n,this.set([l/e,0,0,0,0,l,0,0,0,0,-(r+i)*s,-1,0,0,-2*i*r*s,0]),this}perspective(t,e,i,r){return this.multiply((new c).setPerspective(t,e,i,r))}setScale(t){return this.set([t.x,0,0,0,0,t.y,0,0,0,0,t.z,0,0,0,0,1]),this}scale(t){let e=this.element;return e[0]*=t.x,e[1]*=t.x,e[2]*=t.x,e[3]*=t.x,e[4]*=t.y,e[5]*=t.y,e[6]*=t.y,e[7]*=t.y,e[8]*=t.z,e[9]*=t.z,e[10]*=t.z,e[11]*=t.z,this}setTranslate(t){return this.set([1,0,0,0,0,1,0,0,0,0,1,0,t.x,t.y,t.z,1]),this}preTranslate(t){let e=this.element;return e[12]+=e[0]*t.x+e[4]*t.y+e[8]*t.z,e[13]+=e[1]*t.x+e[5]*t.y+e[9]*t.z,e[14]+=e[2]*t.x+e[6]*t.y+e[10]*t.z,e[15]+=e[3]*t.x+e[7]*t.y+e[11]*t.z,this}postTranslate(t){let e=this.element;return e[0]+=t.x*e[3],e[1]+=t.y*e[3],e[2]+=t.z*e[3],e[4]+=t.x*e[7],e[5]+=t.y*e[7],e[6]+=t.z*e[7],e[8]+=t.x*e[11],e[9]+=t.y*e[11],e[10]+=t.z*e[11],e[12]+=t.x*e[15],e[13]+=t.y*e[15],e[14]+=t.z*e[15],this}setRotate(t,e){let i,r,s,a,n,o,l,c,h,u,d,f,p,m;return t=Math.PI*t/180,i=e.x,r=e.y,s=e.z,a=Math.sin(t),n=Math.cos(t),0!==e.x&&0===e.y&&0===e.z?(e.x<0&&(a=-a),this.set([1,0,0,0,0,n,-a,0,0,a,n,0,0,0,0,1])):0===e.x&&0!==e.y&&0===e.z?(e.y<0&&(a=-a),this.set([n,0,a,0,0,1,0,0,-a,0,n,0,0,0,0,1])):0===e.x&&0===e.y&&0!==e.z?(e.z<0&&(a=-a),this.set([n,-a,0,0,a,n,0,0,0,0,1,0,0,0,0,1])):(o=e.magnitude,1!==o&&(l=1/o,i*=l,r*=l,s*=l),c=1-n,h=i*r,u=r*s,d=s*i,f=i*a,p=r*a,m=s*a,this.set([i*i*c+n,h*c+m,d*c-p,0,h*c-m,r*r*c+n,u*c+f,0,d*c+p,u*c-f,s*s*c+n,0,0,0,0,1])),this}rotate(t,e){return this.multiply((new c).setRotate(t,e)),this}setLookAt(t,e,i){let r,s,a,o,l,c,h,u,d,f,p;return r=e.x-t.x,s=e.y-t.y,a=e.z-t.z,o=1/Math.sqrt(r*r+s*s+a*a),r*=o,s*=o,a*=o,l=s*i.z-a*i.y,c=a*i.x-r*i.z,h=r*i.y-s*i.x,u=1/Math.sqrt(l*l+c*c+h*h),l*=u,c*=u,h*=u,d=c*a-h*s,f=h*r-l*a,p=l*s-c*r,this.set([l,d,-r,0,c,f,-s,0,h,p,-a,0,0,0,0,1]),this.preTranslate(new n.P([-t.x,-t.y,-t.z]))}lookAt(t,e,i){return this.multiply((new c).setLookAt(t,e,i))}toArray(){let t=[];for(let e=0;e<16;e++)t[e]=this.element[e];return t}copy(){return(new c).set(this.toArray())}}},1064:(t,e,i)=>{"use strict";i.d(e,{I:()=>a,P:()=>s});var r=i(134);class s{constructor(t){(0,r.A)(this,"element",void 0),this.element=new Float32Array(3),t&&(this.element[0]=t[0],this.element[1]=t[1],this.element[2]=t[2])}normalize(){let t=this.x,e=this.y,i=this.z,r=this.magnitude;return r?(1===r||(r=1/r,this.x=t*r,this.y=e*r,this.z=i*r),this):(this.x=this.y=this.z=0,this)}toArray(){return[this.x,this.y,this.z]}get magnitude(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}get sqrMagnitude(){return this.x*this.x+this.y*this.y+this.z*this.z}get x(){return this.element[0]}set x(t){this.element[0]=t}get y(){return this.element[1]}set y(t){this.element[1]=t}get z(){return this.element[2]}set z(t){this.element[2]=t}}class a{constructor(t){(0,r.A)(this,"element",void 0),this.element=new Float32Array(4),t&&(this.element[0]=t[0],this.element[1]=t[1],this.element[2]=t[2],this.element[4]=t[3])}}},95073:(t,e,i)=>{"use strict";function r(t,e){return t+(e-1)&~(e-1)}i.d(e,{A:()=>r})},31658:(t,e,i)=>{"use strict";function r(t,e){for(;0!==e;)[t,e]=[e,t%e];return t}i.d(e,{A:()=>r})},66551:(t,e,i)=>{"use strict";i.d(e,{B:()=>s});var r=i(45726);function s(t,e){const i=new r.A([0,0,0,0,0,0,0,0,0]);for(let r=0;r<3;r++)for(let s=0;s<3;s++){let a=t.rc(r,0)*e.rc(0,s)+t.rc(r,1)*e.rc(1,s)+t.rc(r,2)*e.rc(2,s);i.setRC(r,s,a)}return i}i(12535)},60153:(t,e,i)=>{"use strict";i.d(e,{Y3:()=>s}),i(12535);var r=i(1064);function s(t,e){const i=new r.P([0,0,0]);for(let r=0;r<3;r++)i.element[r]=t.rc(r,0)*e.x+t.rc(r,1)*e.y+t.rc(r,2)*e.z;return i}},42577:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(134);class s extends EventTarget{constructor(...t){super(...t),(0,r.A)(this,"peer",void 0),(0,r.A)(this,"onmessage",void 0),(0,r.A)(this,"onmessageerror",void 0)}postMessage(t,e){var i;null!==(i=this.peer)&&void 0!==i&&i.onmessage&&this.peer.onmessage({data:t})}close(){this.peer=null}start(){}}class a{constructor(){(0,r.A)(this,"port1",void 0),(0,r.A)(this,"port2",void 0),this.port1=new s,this.port2=new s,this.port1.peer=this.port2,this.port2.peer=this.port1}}},84149:(t,e,i)=>{"use strict";i.d(e,{Ay:()=>d,S3:()=>u,Wo:()=>h});var r=i(134),s=i(80662),a=i.n(s),n=i(54001),o=i.n(n),l=i(96172),c=i(34677);const h="notify",u="request";class d extends l.A{constructor(t){super(!0),(0,r.A)(this,"port",void 0),(0,r.A)(this,"requestMap",void 0),(0,r.A)(this,"seq",void 0),(0,r.A)(this,"closed",void 0),this.port=t,this.port.onmessage=this.handle.bind(this),this.seq=0,this.requestMap=new(a()),this.port.start(),this.closed=!1}handle(t){const e=t.data,i=e.type,r=e.data;if("notify"===i)this.fire(h,r);else if("reply"===i){const t=this.requestMap.get(r.seq);t&&((0,c.A)(r.result)?t.resolve(r.result):r.error?t.reject(r.error):t.resolve(void 0),this.requestMap.delete(r.seq))}else"request"===i&&this.fire(u,r)}notify(t,e={},i=[]){this.port.postMessage({type:"notify",data:{method:t,params:e}},i)}async request(t,e={},i=[]){return new(o())(((r,s)=>{const a=this.seq++;this.requestMap.set(a,{resolve:r,reject:s}),this.port.postMessage({type:"request",data:{seq:a,method:t,params:e}},i)}))}reply(t,e,i,r=[]){const s={seq:t.seq};(0,c.A)(e)?s.result=e:i&&(s.error=i),null!=r&&r.length?this.port.postMessage({type:"reply",data:s},r):this.port.postMessage({type:"reply",data:s})}getPort(){return this.port}destroy(){this.requestMap.size&&(this.requestMap.forEach((t=>{t.reject("ipc port close")})),this.requestMap.clear()),this.port&&(this.port.close(),this.port=null),this.closed=!0}}},55013:(t,e,i)=>{"use strict";i(84149).Ay},6253:(t,e,i)=>{"use strict";i.d(e,{A:()=>d});var r=i(134),s=i(39638),a=i(86932),n=i(47222),o=i(78995);let l,c=0;function h(){return l?(c++,l):(l=new n.A,c=1,l)}function u(){0!==c&&(c--,0===c&&(l.destroy(),l=null))}class d{constructor(t,e=!0){(0,r.A)(this,"messageChannel",void 0),(0,r.A)(this,"interval",void 0),(0,r.A)(this,"started",void 0),(0,r.A)(this,"timer",void 0),(0,r.A)(this,"workerTimer",void 0),(0,r.A)(this,"workerSetTimeout",void 0),(0,r.A)(this,"onClock",void 0),(0,r.A)(this,"nextTick",void 0),(0,r.A)(this,"a",void 0),(0,r.A)(this,"b",void 0),(0,r.A)(this,"beta",void 0),(0,r.A)(this,"alpha",void 0),(0,r.A)(this,"count",void 0),(0,r.A)(this,"equivalent",void 0),(0,r.A)(this,"timestamp",void 0),(0,r.A)(this,"onVisibilityChange",void 0),(0,r.A)(this,"timeoutNext",void 0),(0,r.A)(this,"running",void 0),(0,r.A)(this,"highPerformance",void 0),this.started=!1,this.interval=t,this.highPerformance=e,this.a=.2,this.b=4,this.equivalent=50,this.timestamp=0,this.nextTick=()=>{if(this.started&&!this.running)if(this.running=!0,this.interval>=4||!this.highPerformance)this.timeoutTick();else if(this.interval<=0)this.messageChannel.port1.postMessage(null);else{const t=(0,a.A)();t-this.timestamp>this.equivalent&&(this.count=0,this.timestamp=t),this.count{t?this.workerTimer=null:this.timer=null,this.running=!1,this.count++,this.onClock?this.onClock(this.nextTick):this.nextTick()},(0,s.A)()||"hidden"!==document.visibilityState||(this.workerSetTimeout=h()),this.running=!1}compute(t=!0){this.interval>0&&(this.beta=Math.ceil(this.equivalent*(1-this.b/this.interval)/(this.a-this.b)),this.alpha=Math.floor(this.equivalent/this.interval-this.beta),t&&(this.count=0))}timeoutTick(){this.workerSetTimeout&&"hidden"===document.visibilityState&&this.interval<1e3?this.workerTimer=this.workerSetTimeout.setTimeout(this.timeoutNext,this.interval):this.timer=setTimeout(this.timeoutNext,this.interval)}start(){this.started||(this.started=!0,this.timestamp=(0,a.A)(),this.nextTick())}stop(){this.started=!1,this.timer&&(clearTimeout(this.timer),this.timer=null),this.workerTimer&&this.workerSetTimeout&&this.workerSetTimeout.clearTimeout(this.workerTimer),this.running=!1}isStarted(){return this.started}setInterval(t){this.interval=Math.max(t,0),this.compute()}getInterval(){return this.interval}isZeroTimeout(){return this.interval<4}destroy(){this.stop(),this.workerSetTimeout&&(u(),this.workerSetTimeout=null),this.onVisibilityChange&&(document.removeEventListener("visibilitychange",this.onVisibilityChange),this.onVisibilityChange=null)}handleEvent(){this.messageChannel.port2.onmessage=()=>{this.started&&(this.running=!1,this.count++,this.onClock?this.onClock(this.nextTick):this.nextTick())},(0,s.A)()||(this.onVisibilityChange=(0,o.A)((t=>{"hidden"===document.visibilityState?(this.workerSetTimeout=h(),this.timer&&(clearTimeout(this.timer),this.timer=null,this.running=!1),this.nextTick()):(this.workerTimer&&(this.workerSetTimeout.clearTimeout(this.workerTimer),this.workerTimer=null,this.running=!1),this.timer&&(clearTimeout(this.timer),this.timer=null,this.running=!1),u(),this.workerSetTimeout=null,this.nextTick())}),20),document.addEventListener("visibilitychange",this.onVisibilityChange))}}},39148:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var r=i(134),s=i(54001),a=i.n(s),n=i(6253),o=i(86932);class l{constructor(t,e=0,i=0,s=!0,a=!0){(0,r.A)(this,"task",void 0),(0,r.A)(this,"count",void 0),(0,r.A)(this,"emptyCount",void 0),(0,r.A)(this,"started",void 0),(0,r.A)(this,"clock",void 0),(0,r.A)(this,"timestamp",void 0),(0,r.A)(this,"timeout",void 0),(0,r.A)(this,"interval",void 0),(0,r.A)(this,"startTimer",void 0),(0,r.A)(this,"autoInterval",void 0),(0,r.A)(this,"sync",void 0),(0,r.A)(this,"tickAfter",void 0),(0,r.A)(this,"processing",void 0),this.task=t,this.timeout=e,this.interval=i,this.autoInterval=s,this.sync=a,this.count=0,this.emptyCount=0,this.timestamp=0,this.started=!1,this.processing=!1,this.clock=new n.A(this.interval),this.clock.onClock=t=>{if(this.started)if(this.count++,this.sync)this.tickAfter&&(this.tickAfter(),this.tickAfter=null),!1===this.task()?this.stop():this.next(t);else{if(this.processing)return;this.processing=!0,this.task().then((e=>{this.processing=!1,this.tickAfter&&(this.tickAfter(),this.tickAfter=null),!1===e?this.stop():this.next(t)}))}}}next(t){if(!this.started)return;const e=(0,o.A)();if(this.autoInterval&&e-this.timestamp>50){const t=this.emptyCount/this.count;0===this.emptyCount?this.clock.setInterval(Math.max(this.clock.getInterval()>>1,this.interval)):t<.1?this.clock.setInterval(this.clock.getInterval()-1):t>.2?this.clock.setInterval(Math.min(this.clock.getInterval()+1,20)):t>.5&&this.clock.setInterval(this.clock.getInterval()<<1),this.count=0,this.emptyCount=0,this.timestamp=e}t()}start(){this.started=!0,this.timeout?this.startTimer=setTimeout((()=>{this.count=0,this.emptyCount=0,this.timestamp=(0,o.A)(),this.clock.start(),this.startTimer=null}),this.timeout):(this.count=0,this.emptyCount=0,this.timestamp=(0,o.A)(),this.clock.start())}stop(){this.started=!1,this.processing=!1,this.startTimer&&(clearTimeout(this.startTimer),this.startTimer=null),this.clock.stop()}async stopBeforeNextTick(){if(this.startTimer&&(clearTimeout(this.startTimer),this.startTimer=null),this.clock.isStarted())return this.sync?(this.started=!1,this.processing=!1,void this.clock.stop()):new(a())((t=>{this.tickAfter=()=>{this.started=!1,this.processing=!1,this.clock.stop(),t()}}))}isStarted(){return this.started}emptyTask(){this.emptyCount++}isZeroTimeout(){var t;return null===(t=this.clock)||void 0===t?void 0:t.isZeroTimeout()}restart(){this.clock&&(this.stop(),this.clock.setInterval(this.interval),this.start())}resetInterval(){this.clock.setInterval(Math.max(this.clock.getInterval()>>1,this.interval)),this.emptyCount=0,this.count=0,this.timestamp=(0,o.A)()}destroy(){this.stop(),this.task=null,this.timeout=null,this.interval=null}}},13724:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var r=i(134),s=i(45249),a=i.n(s);class n{constructor(t){(0,r.A)(this,"timeout",void 0),(0,r.A)(this,"timer",void 0),(0,r.A)(this,"resolve",void 0),(0,r.A)(this,"reject",void 0),(0,r.A)(this,"startTime",void 0),this.timeout=t}then(t,e){this.resolve=t,this.reject=e,this.startTime=a()(),this.timer=setTimeout((()=>{this.resolve(a()()-this.startTime),this.timer=null}),1e3*this.timeout)}stop(t=!0){this.timer&&(clearTimeout(this.timer),this.timer=null,this.resolve&&t?this.resolve(a()()-this.startTime):this.reject&&!t&&this.reject(a()()-this.startTime))}reset(t){t&&(this.timeout=t),this.timer&&(clearTimeout(this.timer),this.timer=setTimeout((()=>{this.resolve(a()()-this.startTime),this.timer=null}),1e3*this.timeout))}}},54058:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(134);class s{constructor(t,e,i){(0,r.A)(this,"task",void 0),(0,r.A)(this,"timeout",void 0),(0,r.A)(this,"interval",void 0),(0,r.A)(this,"timer",void 0),this.task=t,this.timeout=e,this.interval=i}start(){const t=this;t.stop();let e=t.timeout;const i=t.interval,r=function(){!1!==t.task()&&t.timer?t.timer=setTimeout(r,t.interval):t.stop()};null==e&&(e=i),t.timer=setTimeout(r,e)}stop(){this.timer&&(clearTimeout(this.timer),this.timer=null)}updateInterval(t){this.interval=t}isStarted(){return!!this.timer}destroy(){this.stop(),this.task=this.timeout=this.interval=null}}},47222:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var r=i(134),s=i(80662),a=i.n(s);function n(t){t.addEventListener("message",(e=>{var i;let r=e.data.data;setTimeout((()=>{t.postMessage({type:"pong",id:r.id})}),Math.max(null!==(i=r.timeout)&&void 0!==i?i:0,4))}))}class o{constructor(){(0,r.A)(this,"worker",void 0),(0,r.A)(this,"workerUrl",void 0),(0,r.A)(this,"taskMap",void 0),(0,r.A)(this,"id",void 0),this.id=0,this.taskMap=new(a());const t=`\n ${n.toString()}\n ${n.name}(self)\n `,e=new Blob([t],{type:"text/javascript"});this.workerUrl=URL.createObjectURL(e),this.worker=new Worker(this.workerUrl),this.worker.addEventListener("message",(t=>{const e=t.data,i=e.type,r=e.id;if("pong"===i){const t=this.taskMap.get(r);t&&t(!0)}}))}setTimeout(t,e=0){const i=this.id++;return this.taskMap.set(i,t),this.worker.postMessage({type:"ping",data:{timeout:e,id:i}}),i}clearTimeout(t){this.taskMap.delete(t)}destroy(){this.worker&&(this.worker.terminate(),this.worker=null),this.workerUrl&&(URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.taskMap&&(this.taskMap.clear(),this.taskMap=null)}}},38724:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(134),s=i(6253);class a{constructor(t,e,i){(0,r.A)(this,"task",void 0),(0,r.A)(this,"timeout",void 0),(0,r.A)(this,"interval",void 0),(0,r.A)(this,"clock",void 0),(0,r.A)(this,"started",void 0),(0,r.A)(this,"timer",void 0),this.task=t,this.timeout=e,this.interval=i,this.started=!1,this.clock=new s.A(this.interval,!1),this.clock.onClock=t=>{this.started&&!1===this.task()?this.stop():t()}}start(){this.started=!0,this.timeout>0?this.timer=setTimeout((()=>{this.timer=null,this.clock.start()}),this.timeout):this.clock.start()}stop(){this.started=!1,this.clock.stop(),this.timer&&(clearTimeout(this.timer),this.timer=null)}isStarted(){return this.started}updateInterval(t){this.interval=t,this.clock.setInterval(t)}destroy(){this.clock&&(this.stop(),this.clock.destroy(),this.clock=null),this.started=!1,this.task=this.timeout=this.interval=null}}},72739:(t,e,i)=>{"use strict";i.d(e,{$r:()=>d,El:()=>f,TF:()=>h,VC:()=>l,_:()=>p,__:()=>n,qh:()=>c,zy:()=>u});var r=i(67672),s=i(10576),a=i(56401);function n(t,e,i){if(!t)return;const{length:r}=t;if(r)if(i)for(let i=r-1;i>=0&&e(t[i],i)!==s.W8;i--);else for(let i=0;i=0}function d(t){return r.YO(t)?t:(0,a.A)(s.Ml.slice,t)}function f(t,e){let i=0,r=t.length-1,s=-1;for(;i<=r;){let a=(i+r)/2>>>0;const n=e(t[a]);if(0===n){s=a;break}1===n?i=a+1:(r=a-1,s=a)}return s}function p(t,e,i){const r=f(t,i);r>-1?t.splice(r,0,e):t.push(e)}},90932:(t,e,i)=>{"use strict";i.d(e,{l:()=>s});const r="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";function s(t,e=!0){const i=t.length;let s=0,a=0,n="";for(let e=0;e=5;)n+=r[a>>>s-5&31],s-=5;if(s>0&&(n+=r[a<<5-s&31]),e)for(;n.length%8!=0;)n+="=";return n}},4919:(t,e,i)=>{"use strict";i.d(e,{E_:()=>a});var r=i(72739);const s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function a(t){const e="function"==typeof atob?atob(t):function(t){function e(t){const e=s.indexOf(t);return-1===e?0:e}let i="";for(let r=0;r>4,c=(15&a)<<4|n>>2,h=(3&n)<<6|o;i+=String.fromCharCode(l),64!==n&&(i+=String.fromCharCode(c)),64!==o&&(i+=String.fromCharCode(h))}return i}(t),i=new Uint8Array(e.length);for(let t=0;t{n[t]=e}))},43607:(t,e,i)=>{"use strict";function r(t){return t>0?t:-t}function s(t,e){return t>e?t:e}function a(t,e){return t>e?e:t}i.d(e,{T9:()=>s,jk:()=>a,tn:()=>r})},86834:(t,e,i)=>{"use strict";i.d(e,{A:()=>p});var r=i(29967),s=i.n(r),a=i(72739),n=i(67672),o=i(84504),l=i(44690);function c(t){return n.Yj(t)&&t.split(".").shift()||""}const h=[["alipay",/alipay/],["wechat",/micromessenger/],["dingtalk",/dingtalk[ \/]([\d_.]+)/],["baiduApp",/baiduboxapp/],["baidu",/baidubrowser/],["baidu",/bdbrowser/],["uc",/ucbrowser/],["uc",/ucweb/],["qq",/qqbrowser/],["qqApp",/qq/],["ie",/iemobile[ \/]([\d_.]+)/],["ie",/msie[ \/]([\d_.]+)/],["ie",/trident[ \/]([\d_.]+)/,4],["edge",/edge[ \/]([\d_.]+)/],["newEdge",/edg[ \/]([\d_.]+)/],["chrome",/chrome[ \/]([\d_.]+)/],["firefox",/firefox[ \/]([\d_.]+)/],["opera",/opera(?:.*version)?[ \/]([\d_.]+)/],["safari",/version[ \/]([\d_.]+) safari/],["safari",/version[ \/]([\d_.]+) \S* safari/],["safari",/safari/]],u={},d={},f=function(t){let e,i;return(0,a.__)(h,(r=>{let a=r[1].exec(t);if(a)return e=r[0],i=a[1],i&&(i=i.replace(/_/g,"."),r[2]&&(i=s()(i,10)+r[2]+".0")),!1})),"safari"!==e||i||(i=l.A.version),{name:e||"",version:i||"",majorVersion:(u[e]||c)(i),checkVersion:d[e]||o.A}}(("object"==typeof navigator&&navigator.userAgent||"").toLowerCase());f.name&&(f[f.name]=!0);const p=f},10576:(t,e,i)=>{"use strict";i.d(e,{Cq:()=>o,Cy:()=>c,M_:()=>p,Ml:()=>v,TK:()=>m,W8:()=>n,ZG:()=>d,ZH:()=>l,aV:()=>h,jf:()=>f,rT:()=>a,s0:()=>u,u1:()=>y,x7:()=>g});var r=i(7403),s=i.n(r);const a=!0,n=!1,o=null,l=void 0,c=-1,h="undefined",u="function",d=".",f=typeof window!==h?window:l,p=(typeof document!==h&&document,typeof globalThis!==h?globalThis:typeof i.g!==h?i.g:f),m=typeof self!==h?self:p,g=function(){},v=(s()({}),s()([])),y=""},67672:(t,e,i)=>{"use strict";i.d(e,{Ik:()=>h,Pc:()=>l,YO:()=>c,Yj:()=>u,ai:()=>d,o:()=>f,sH:()=>m,sv:()=>g,zM:()=>p});var r=i(68632),s=i.n(r),a=i(88032),n=i.n(a),o=i(10576);function l(t){return typeof t===o.s0}function c(t){return s()(t)}function h(t){return t!==o.Cq&&"object"==typeof t}function u(t){return"string"==typeof t}function d(t){return"number"==typeof t&&!isNaN(t)}function f(t){return"bigint"==typeof t}function p(t){return"boolean"==typeof t}function m(t){return d(t)||u(t)&&!isNaN(n()(t))&&isFinite(+t)}function g(t){return t instanceof ArrayBuffer}},80198:(t,e,i)=>{"use strict";i.d(e,{ZV:()=>n,ay:()=>a,wb:()=>s});var r=i(95335);const s={a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,"`":192,"+":187,"-":189,"=":61,"[":219,"]":221,"\\":220,";":59,"'":222,",":188,".":190,"/":191,$0:96,$1:97,$2:98,$3:99,$4:100,$5:101,$6:102,$7:103,$8:104,$9:105,"$.":110,"$+":107,"$-":109,"$*":106,"$/":111,space:32,tab:9},a={f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,enter:13,esc:27,capslock:20,insert:45,home:36,end:35,pageup:33,pagedown:34,left:37,right:39,up:38,down:40},n={shift:16,ctrl:17,meta:91,alt:18};(0,r.BE)(s),(0,r.BE)({backspace:8,delete:46}),(0,r.BE)(a),(0,r.BE)(n)},10534:(t,e,i)=>{"use strict";i.d(e,{__:()=>a}),i(20525);var r=i(10576);const s={};function a(t,e){const i=s.hasOwnProperty(t)?s[t]:s[t]=t.split(r.ZG);for(let t=0,s=i.length-1;t<=s&&e(i[t],t===s)!==r.W8;t++);}},4624:(t,e,i)=>{"use strict";i.d(e,{R8:()=>b,V$:()=>g,Yz:()=>y,h2:()=>w,pq:()=>A,rD:()=>o,z3:()=>x});var r=i(10576),s=i(62100);const a=0,n=1,o=2,l=3,c=4,h=5,u=typeof console!==r.aV?console:r.Cq,d=/common/.test((0,s.A)(r.x7))?o:l,f=(r.jf&&/edge|msie|trident/i.test(r.jf.navigator.userAgent),r.u1),p=u?f?function(t,e,i){u.log(f+t,i,e)}:function(t,e){u.log(t,e)}:r.x7;function m(){if(r.M_){const t=r.TK.COMMON_LOG_LEVEL;if(t>=a&&t<=h)return t}return d}function g(t){r.TK.COMMON_LOG_LEVEL=t}function v(t){return`background-color:${t};border-radius:12px;color:#fff;font-size:10px;padding:3px 6px;`}function y(t,e,i){m()<=n&&p(`[${arguments[1]}][line ${arguments[2]}] [debug]`,t,v("#999"))}function A(t,e,i){m()<=o&&p(`[${arguments[1]}][line ${arguments[2]}] [info]`,t,v("#2db7f5"))}function b(t,e,i){m()<=l&&p(`[${arguments[1]}][line ${arguments[2]}] [warn]`,t,v("#f90"))}function x(t,e,i){m()<=c&&p(`[${arguments[1]}][line ${arguments[2]}] [error]`,t,v("#ed4014"))}function w(t,e,i){if(m()<=h)throw x(t,e,i),new Error(`[${arguments[1]}][line ${arguments[2]}] [fatal]: ${t}`)}},95335:(t,e,i)=>{"use strict";i.d(e,{BE:()=>p,C:()=>f,HP:()=>c,X$:()=>d,__:()=>h});var r=i(69736),s=i.n(r),a=i(67672),n=i(72739),o=i(10576),l=(i(10534),i(34677));function c(t){return(0,l.A)(t)?s()(t):[]}function h(t,e){for(let i in t)if(e(t[i],i)===o.W8)break}function u(t,e){return a.Ik(t)?a.Ik(e)?(h(e,(function(e,i){t[i]=e})),t):t:e}function d(t,e,i){return u(u(t,e),i)}function f(t,e){let i=t;return a.YO(t)?e?(i=[],n.__(t,(function(t,r){i[r]=f(t,e)}))):i=t.slice():a.Ik(t)&&(i={},h(t,(function(t,r){i[r]=e?f(t,e):t}))),i}function p(t){const e={};return h(t,((t,i)=>{e[t]=i})),e}},44690:(t,e,i)=>{"use strict";i.d(e,{A:()=>n});var r=i(72739);const s=[["harmony",/harmonyos ([\d_.]+)/],["harmony",/openharmony ([\d_.]+)/],["iphone",/iphone os ([\d_.]+)/],["ipad",/ipad; cpu os ([\d_.]+)/],["itouch",/itouch; cpu os ([\d_.]+)/],["android",/android ([\d_.]+)/],["wp",/windows phone ([\d_.]+)/],["windows",/windows nt ([\d_.]+)/],["linux",/linux/],["mac",/mac os x ([\d_.]+)/]],a=function(t){let e,i;return(0,r.__)(s,(r=>{let s=r[1].exec(t);if(s)return e=r[0],i=s[1],i&&(i=i.replace(/_/g,".")),!1})),{name:e||"",version:i||"",mobile:t.indexOf("mobile")>-1}}(("object"==typeof navigator&&navigator.userAgent||"").toLowerCase());a.name&&(a[a.name]=!0,{iphone:1,ipad:1,itouch:1}[a.name]&&(a.ios=!0));const n=a},20525:(t,e,i)=>{"use strict";i.d(e,{GP:()=>u,di:()=>l,qh:()=>c,zy:()=>h});var r=i(29967),s=i.n(r),a=i(67672),n=i(10576),o=i(62100);function l(t,e,i){return a.ai(i)?e===i?n.u1:t.slice(e,i):t.slice(e)}function c(t,e,i){return t.indexOf(e,i!==n.ZH?i:0)}function h(t,e){return c(t,e)>=0}function u(t,...e){let i=0;const r=e.length;return t.replace(/(%[sdvx%])|(%0(\d)+[dx])/g,(t=>{if(i>=r)return t;const a=e[i++];if(/%0(\d)+[dx]/g.test(t)){const e=s()(t.substring(1));let i="d"===t[t.length-1]?(0,o.A)(Number(a)):Number(a).toString(16);return e>i.length&&(i=new Array(e-i.length).fill("0").join("")+i),i}switch(t){case"%%":return"%";case"%s":return String(a);case"%d":return(0,o.A)(Number(a));case"%v":return"";case"%x":return Number(a).toString(16)}return t}))}},95797:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var r=i(20149),s=i.n(r),a=i(39638),n=i(86834),o=i(44690);const l=function(){let t="function"==typeof Blob,e="object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate,i="function"==typeof fetch,r="object"==typeof document&&document.createElement("canvas"),l=r&&!!r.getContext("webgl"),c="function"==typeof OffscreenCanvas,h="function"==typeof Worker,u="function"==typeof ArrayBuffer,d="object"==typeof Atomics&&"Atomics"===Atomics[s()],f="function"==typeof AudioContext||"function"==typeof webkitAudioContext,p="function"==typeof AudioWorklet,m="function"==typeof VideoDecoder,g="function"==typeof VideoEncoder,v="function"==typeof AudioDecoder,y="function"==typeof AudioEncoder,A="function"==typeof SharedArrayBuffer,b="function"==typeof MediaSource||"function"==typeof ManagedMediaSource,x="function"==typeof Proxy,w=(h||(0,a.A)())&&A&&d&&x,k="function"==typeof WebAssembly.Suspending&&"function"==typeof WebAssembly.promising;(n.A.safari&&!n.A.checkVersion(n.A.majorVersion,"11",!0)||o.A.ios&&!n.A.checkVersion(o.A.version,"11",!0))&&(e=!1),n.A.chrome&&!n.A.checkVersion(n.A.majorVersion,"94",!0)&&(m=!1,v=!1),(n.A.safari&&!n.A.checkVersion(n.A.majorVersion,"17",!0)||o.A.ios&&!n.A.checkVersion(o.A.version,"17",!0))&&(m=!1);let T="object"==typeof navigator&&"object"==typeof navigator.gpu,_="function"==typeof MediaSourceHandle,I=e&&"function"==typeof WebAssembly.Global;return{browser:n.A,blob:t,wasm:e,fetch:i,webgl:l,worker:h,mse:b,arrayBuffer:u,audioContext:f,audioWorklet:p,videoDecoder:m,videoEncoder:g,audioDecoder:v,audioEncoder:y,atomics:d,shareArrayBuffer:A,thread:w,webgpu:T,offscreenCanvas:c,workerMSE:_,webAssemblyGlobal:I,jspi:k,proxy:x,simd:(n.A.chrome||n.A.newEdge)&&n.A.checkVersion(n.A.majorVersion,"91",!0)||n.A.firefox&&n.A.checkVersion(n.A.majorVersion,"89",!0)||n.A.safari&&n.A.checkVersion(n.A.version,"16.4",!0)||o.A.ios&&n.A.checkVersion(o.A.version,"16.4",!0),wasmPlayerSupported:i&&e&&l&&f&&u&&I,wasmBaseSupported:e&&I&&u}}()},50011:(t,e,i)=>{"use strict";i.r(e),i.d(e,{decode:()=>o,encode:()=>a});const r="function"==typeof TextEncoder?new TextEncoder:null,s="function"==typeof TextDecoder?new TextDecoder:null;function a(t){if(r)return r.encode(t);const e=[];for(let i=0;i=55296&&r<=57343&&(r=65536+((1023&r)<<10)|1023&t.charCodeAt(++i)),r<=127?e.push(r):r<=2047?(e.push(192|r>>6),e.push(128|63&r)):r<=65535?(e.push(224|r>>12),e.push(128|r>>6&63),e.push(128|63&r)):(e.push(240|r>>18),e.push(128|r>>12&63),e.push(128|r>>6&63),e.push(128|63&r))}return new Uint8Array(e)}function n(t){let e="";for(let i=0;i>>0];if(!(128&r)){e+=String.fromCharCode(r);continue}let s=63&t[i++>>>0];if(192==(224&r)){e+=String.fromCharCode((31&r)<<6|s);continue}let a=63&t[i++>>>0];if(r=224==(240&r)?(15&r)<<12|s<<6|a:(7&r)<<18|s<<12|a<<6|63&t[i++>>>0],r<65536)e+=String.fromCharCode(r);else{let t=r-65536;e+=String.fromCharCode(55296|t>>10,56320|1023&t)}}return e}function o(t){if(t instanceof Uint8Array&&s&&!("function"==typeof SharedArrayBuffer&&t.buffer instanceof SharedArrayBuffer))try{return s.decode(t)}catch(e){return n(t)}return n(t)}},54825:(t,e,i)=>{"use strict";function r(t){if(!(t=t.trim()))return-BigInt(1);let e=t.split(":"),i=BigInt(0);return 3===e.length&&(i+=BigInt(+e.shift().trim())*BigInt(36e5)),i+=BigInt(+e.shift().trim())*BigInt(6e4),e=e.shift().trim().split("."),i+=BigInt(+e.shift().trim())*BigInt(1e3),i+=BigInt(+e.shift().trim()),i}function s(t){if(!(t=t.trim()))return-BigInt(1);let e=t.split(":"),i=BigInt(0);return 3===e.length&&(i+=BigInt(+e.shift().trim())*BigInt(36e5)),i+=BigInt(+e.shift().trim())*BigInt(6e4),e=e.shift().trim().split(","),i+=BigInt(+e.shift().trim())*BigInt(1e3),i+=BigInt(+e.shift().trim()),i}i.d(e,{j:()=>r,t:()=>s})},8507:(t,e,i)=>{"use strict";i.d(e,{ll:()=>m,mA:()=>n,qg:()=>o}),i(73146);var r=i(67672),s=i(6498),a=i(72739);function n(t,e="&"){const i={};if(r.Yj(t)&&t.indexOf("=")>=0){let r=t.charAt(0),n="?"===r||"#"===r?1:0;n>0&&(t=t.substr(n)),a.__((0,s.A)(t,e),(t=>{let e=t.split("=");if(2===e.length){var r;let t=null===(r=e[0])||void 0===r?void 0:r.trim();t&&(i[t]=decodeURIComponent(e[1]))}}))}return i}function o(t){const e=t,i=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],r=/:\/\/([^\/@]*@?)\[(\S+)\]/;let s="";r.test(t)&&(t=t.replace(r,((t,e,i)=>(s=i,`://${e||""}a.b`))));const a={},n=/^(?:(?![^:@\/]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*)(?::([^:@\/]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(t);let o=14;for(;o--;){var l;a[i[o]]=null!==(l=n[o])&&void 0!==l?l:""}return s&&(a.host=s,a.source=e,a.authority=s+(a.port?":"+a.port:"")),{protocol:a.protocol,file:a.file,host:a.host,port:a.port,user:a.user,password:a.password,origin:`${a.protocol}://${a.authority}`,pathname:a.path,search:`?${a.query}`,hash:a.anchor?`#${a.anchor}`:""}}i(95335);const l=/(?:\/|^)\.(?=\/)/g,c=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,h=/^(?=([^\/?#]*))\1([^]*)$/,u=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/;function d(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}function f(t){const e=u.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null}function p(t){for(t=t.split("").reverse().join("").replace(l,"");t.length!==(t=t.replace(c,"")).length;);return t.split("").reverse().join("")}function m(t,e,i){if(i=i||{},t=t.trim(),!(e=e.trim())){if(!i.alwaysNormalize)return t;let e=f(t);if(!e)throw new Error("Error trying to parse base URL.");return e.path=p(e.path),d(e)}let r=f(e);if(!r)throw new Error("Error trying to parse relative URL.");if(r.scheme)return i.alwaysNormalize?(r.path=p(r.path),d(r)):e;let s=f(t);if(!s)throw new Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&"/"!==s.path[0]){let t=h.exec(s.path);s.netLoc=t[1],s.path=t[2]}s.netLoc&&!s.path&&(s.path="/");const a={scheme:s.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment};if(!r.netLoc&&(a.netLoc=s.netLoc,"/"!==r.path[0]))if(r.path){let t=s.path,e=t.substring(0,t.lastIndexOf("/")+1)+r.path;a.path=p(e)}else a.path=s.path,r.params||(a.params=s.params,r.query||(a.query=s.query));return null===a.path&&(a.path=i.alwaysNormalize?p(r.path):r.path),d(a)}},88096:(t,e,i)=>{"use strict";i.d(e,{$z:()=>f,GW:()=>l,WP:()=>h,bx:()=>p,p2:()=>u,tt:()=>d});var r=i(729),s=i(31865),a=i(86834),n=i(44690);function o(t){let e=0,i=0;for(;;){const r=t.readUint8();if(e|=(127&r)<>=7)&&!(64&r)||-1===e&&64&r?i=!1:r|=128,t.writeUint8(r)}}function d(t,e){do{let i=127&e;0!=(e>>=7)&&(i|=128),t.writeUint8(i)}while(0!==e)}async function f(t,e){do{let i=127&e;0!=(e>>=7)&&(i|=128),await t.writeUint8(i)}while(0!==e)}function p(t,e){const i=new s.A(t,!0),l=new r.A(new Uint8Array(t.length+100),!0);for(l.writeBuffer(i.readBuffer(8));i.remainingSize();){const t=i.readUint8();l.writeUint8(t);const s=o(i);if(2===t){const t=new r.A(new Uint8Array(s+100));let h=o(i);for(d(t,h);h--;){const r=o(i);d(t,r),t.writeBuffer(i.readBuffer(r));const s=o(i);d(t,s),t.writeBuffer(i.readBuffer(s));const l=i.readUint8();switch(t.writeUint8(l),l){case 0:d(t,o(i));break;case 3:u(t,c(i)),d(t,o(i));break;case 2:{let r=o(i);e.shared?d(t,2|r):d(t,-3&r);const s=o(i);if(d(t,e.initial||s),1&r){let r=o(i);!e.maximum||n.A.ios&&!a.A.checkVersion(n.A.version,"17",!0)&&e.shared||(r=e.maximum),d(t,r)}break}case 1:{u(t,c(i));const e=o(i);d(t,e),d(t,o(i)),1&e&&d(t,o(i));break}}}const f=t.getWroteBuffer();d(l,f.length),l.writeBuffer(f)}else d(l,s),l.writeBuffer(i.readBuffer(s))}return l.getWroteBuffer()}},79331:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var r=i(68632),s=i.n(r),a=i(72739);const n={aloneValueName:"_@attribute"},o=[" ","/",'"',"'","<",">"];function l(t,e=n){t=(t=(t=(t=t.replace(//g,"")).replace(/[\n\t\r]/g,"")).replace(/>[ \t]+<")).replace(/<\?[^>]*\?>/g,"");const i=[];let r=0;function l(t,r){const a=i[i.length-1];a&&(t===e.aloneValueName||null==a.obj[e.aloneValueName]?null==a.obj[t]?a.obj[t]=r:s()(a.obj[t])?a.obj[t].push(r):a.obj[t]=[a.obj[t],r]:a.obj[e.aloneValueName]=[a.obj[e.aloneValueName],{tagName:t,...r}])}function c(e){for(;r=t.length)return!0;u();let e=d;'"'!==t[r]&&"'"!=t[r]||(e='"'===t[r]?p:f,r++);let i="";for(;r1){const t=i.pop();l(t.tag,t.obj)}c(">"),r++,u()}else i.pop(),c(">"),r++,u()}}return function s(){if(r>=t.length)return;let a=r;if(u(),"<"!==t[r])return r=a,l(e.aloneValueName,g()),v(),s();let n=c("<");if(!n)return;a=r,r++;const o=h();if(i.push({obj:{},tag:o,start:a}),function(){for(;u(),">"!==t[r]&&"/"!==t[r];){let t=h();if(!t)break;"="===t[t.length-1]?t=t.substring(0,t.length-1):(c("="),r++),l(t,m())}}(),u(),"/"===t[r]){if(r++,i.length>1){const t=i.pop();l(t.tag,t.obj)}return c(">"),r++,v(),s()}n=c(">"),n&&(r++,u(),"<"!==t[r]&&(l(e.aloneValueName,g()),u()),v(),s())}(),{[i[0].tag]:i[0].obj}}},72631:(t,e,i)=>{"use strict";i.d(e,{default:()=>z});var r=i(134),s=i(63939),a=i(61634),n=i(47451),o=i.n(n),l=i(95335),c=i(28090),h=i(67672),u=i(72739),d=i(8507),f=i(44690),p=i(23601),m=i(76793),g=i(92053),v=i(37463),y=i(13203),A=i(30019),b=i(7233),x=i(64147),w=i(40777),k=i(59715),T=i(86213),_=i(91011),I=i(14667),S=i(45553),P=i(30499),C=i(65893),M=i(53891),B=i(44341),E=i(83327),D=i.n(E),R=i(89739),U=i.n(R),L=i(6204),F=i(78995),O=i(93108),$=i(64804);const N={name:"AVPlayer",template:D(),propTypes:{player:{type:"object",required:!0},indicatorUrl:{type:"string"},pauseStateUrl:{type:"string"},errorStateUrl:{type:"string"},fullscreenDom:{type:"object"},hasFolder:{type:"boolean",value:!0},hasHeader:{type:"boolean",value:!0}},data:function(){const t=(0,L.A)(),e=[{name:t.MENU_STATS,action:0}];return{style:U(),title:"",error:"",showBar:!0,played:!1,folded:!1,loading:!1,language:t,streams:[],videoList:[],audioList:[],subtitleList:[],isLive:!1,menu:e,showMenu:!1,menuTop:0,menuLeft:0,showInfo:!1,showSettings:!1}},events:{error:function(t,e){console.log("error",e.message),this.set("error",e.message)},closeInfo:function(){this.set("showInfo",!1)},openSettings:function(){this.set("showSettings",!0)},closeSettings:function(){this.set("showSettings",!1)}},watchers:{played:function(t){t&&(this.showBarTimer&&clearTimeout(this.showBarTimer),this.get("folded")&&(this.showBarTimer=setTimeout((()=>{this.set("showBar",!1),this.showBarTimer=null}),5e3)))},folded:function(t){t&&(this.showBarTimer&&clearTimeout(this.showBarTimer),this.showBarTimer=setTimeout((()=>{this.set("showBar",!1),this.showBarTimer=null}),5e3))}},computed:{hasVideoTrack:function(){const t=this.get("streams"),e=this.get("videoList");return t.filter((t=>0===s.f[15](t.codecpar))).filter((t=>u.zy(a.K,s.f[15](t.codecpar+4)))).length>1||e.length>1},hasAudioTrack:function(){const t=this.get("streams"),e=this.get("audioList");return t.filter((t=>1===s.f[15](t.codecpar))).filter((t=>u.zy(a.K,s.f[15](t.codecpar+4)))).length>1||e.length>1},hasSubtitleTrack:function(){const t=this.get("streams"),e=this.get("subtitleList");return!this.get("isLive")&&t.filter((t=>0===s.f[15](t.codecpar))).filter((t=>u.zy(a.K,s.f[15](t.codecpar+4)))).length>0&&e.length>1},hasPip:function(){return this.get("streams").filter((t=>0===s.f[15](t.codecpar))).filter((t=>u.zy(a.K,s.f[15](t.codecpar+4)))).length>0},hasPcmVisualization:function(){const t=this.get("streams");return t.filter((t=>1===s.f[15](t.codecpar))).filter((t=>u.zy(a.K,s.f[15](t.codecpar+4)))).length>0&&0===t.filter((t=>0===s.f[15](t.codecpar))).filter((t=>u.zy(a.K,s.f[15](t.codecpar+4)))).length}},methods:{init(t){const e=t.getSource();h.Yj(e)?this.set("title",d.qg(decodeURI(e)).file):this.set("title",e.name),this.set("streams",t.getStreams()),this.set("isLive",t.isLive()),t.getVideoList().then((t=>{this.set("videoList",t.list)})),t.getAudioList().then((t=>{this.set("audioList",t.list)})),t.getSubtitleList().then((t=>{this.set("subtitleList",t.list)}))},mousemove(){setTimeout((()=>{this.set("showBar",!0),this.showBarTimer&&clearTimeout(this.showBarTimer),this.get("played")&&this.get("folded")&&(this.showBarTimer=setTimeout((()=>{this.set("showBar",!1),this.showBarTimer=null}),5e3))}))},playClick(t){f.A.ios||f.A.android||f.A.harmony&&f.A.mobile||this.$refs.play&&(!this.get("showMenu")&&this.get("showBar")||!t)&&this.$refs.play.playClick()},toggleFold(){this.set("folded",!this.get("folded"))},fold(){this.set("folded",!0)},unfold(){this.set("folded",!1)},menuAction(t){0===t&&this.set("showInfo",!0),this.set("showMenu",!1)},menuOutside(){this.set("showMenu",!1)}},afterMount(){this.namespace=".avplayer"+Math.random();const t=this.get("player"),e=this.$el.querySelectorAll(".avplayer-ui-player")[0];t.options.container=e,t.on(c.F5+this.namespace,(()=>{this.set("loading",!0),this.set("error","")})),t.on(c.S2+this.namespace,(()=>{this.init(t)})),t.on(c.CN+this.namespace,(()=>{this.set("loading",!1)})),t.on(c.yd+this.namespace,(()=>{this.set("title",""),this.set("streams",[])})),t.getStatus()>=4&&this.init(t),this.onresize=(0,F.A)((()=>{t.resize(e.offsetWidth,e.offsetHeight)}),500),window.addEventListener("resize",this.onresize),this.oncontextmenu=t=>{this.$refs.playerContainer.contains(t.target)&&(this.set("showMenu",!0),this.set("menuTop",t.clientY),this.set("menuLeft",t.clientX),t.preventDefault())},window.addEventListener("contextmenu",this.oncontextmenu)},beforeDestroy(){const t=this.get("player");this.namespace&&t.off(this.namespace),window.removeEventListener("resize",this.onresize),window.removeEventListener("contextmenu",this.oncontextmenu)},components:{Progress:p.A,Play:m.A,Volume:g.A,Timer:v.A,Setting:y.A,Fullscreen:A.A,Playrate:b.A,AudioTrack:x.A,VideoTrack:w.A,SubtitleTrack:k.A,Loop:T.A,Pip:_.A,Folder:I.A,Loading:S.A,PcmVisualization:P.A,LoadingTip:C.A,Info:M.A,Settings:B.A}};class z extends a.A{constructor(t){var e,i;super(l.X$({},t,{container:null})),(0,r.A)(this,"ui",void 0),(0,r.A)(this,"keyboard",void 0),o().dom.addSpecialEvent("outside",$.A),this.ui=new(o())(l.X$({el:t.container,replace:!1,props:{player:this,indicatorUrl:t.indicatorUrl,pauseStateUrl:t.pauseStateUrl,errorStateUrl:t.errorStateUrl,fullscreenDom:t.fullscreenDom,hasFolder:null===(e=t.ui)||void 0===e?void 0:e.hasFolder,hasHeader:null===(i=t.ui)||void 0===i?void 0:i.hasHeader}},N)),this.keyboard=new O.A(this)}foldFolder(){this.ui.fold()}unfoldFolder(){this.ui.unfold()}async destroy(){await super.destroy(),this.keyboard.destroy(),this.ui.destroy()}}},93108:(t,e,i)=>{"use strict";i.d(e,{A:()=>f});var r=i(134),s=i(80662),a=i.n(s),n=i(80198),o=i(95335),l=i(72739),c=i(65196),h=i(43607),u=i(67672);const d={16:[{keyCode:n.wb["+"],with:[n.ZV.ctrl],action:"up",playerStatus:[6,7]},{keyCode:n.wb["+"],with:[n.ZV.ctrl,n.ZV.shift],action:"up",playerStatus:[6,7]}],17:[{keyCode:n.wb["-"],with:[n.ZV.ctrl],action:"up",playerStatus:[6,7]},{keyCode:n.wb["-"],with:[n.ZV.ctrl,n.ZV.shift],action:"up",playerStatus:[6,7]}],1:{keyCode:n.wb.space,with:[],action:"up",playerStatus:[6,7]},3:{keyCode:n.ay.right,with:[],action:"up",playerStatus:[6]},2:{keyCode:n.ay.left,with:[],action:"up",playerStatus:[6,7]},4:{keyCode:n.ay.right,with:[],action:"longDown",playerStatus:[6]},5:{keyCode:n.ay.right,with:[],action:"up",playerStatus:[6],longDownBefore:!0},6:{keyCode:n.wb.n,with:[n.ZV.ctrl],action:"up"},7:{keyCode:n.wb.p,with:[n.ZV.ctrl],action:"up"},8:{keyCode:n.ay.right,with:[],action:"up",playerStatus:[7]},9:{keyCode:n.wb.p,with:[n.ZV.ctrl,n.ZV.shift],action:"up",playerStatus:[7,6]},10:{keyCode:n.wb.s,with:[n.ZV.ctrl],action:"up",playerStatus:[7,6]},12:{keyCode:n.ay.down,with:[],action:"up"},11:{keyCode:n.ay.up,with:[],action:"up"},13:{keyCode:n.ay.esc,with:[],action:"up"},14:{keyCode:n.wb.f,with:[n.ZV.ctrl],action:"up"},15:{keyCode:n.wb.u,with:[n.ZV.ctrl],action:"up"}};class f{constructor(t){(0,r.A)(this,"onKeyDown_",void 0),(0,r.A)(this,"onKeyUp_",void 0),(0,r.A)(this,"player",void 0),(0,r.A)(this,"seekQueue",void 0),(0,r.A)(this,"lastPlayrate",void 0),(0,r.A)(this,"longDownTimer",void 0),(0,r.A)(this,"longDownRunning",void 0),this.player=t,this.longDownTimer=new(a()),this.longDownRunning=new(a()),this.seekQueue=new c.A,this.onKeyDown_=t=>{this.onKeyDown(t)},this.onKeyUp_=t=>{this.onKeyUp(t)},document.addEventListener("keydown",this.onKeyDown_),document.addEventListener("keyup",this.onKeyUp_)}actionPlayOrPause(){7===this.player.getStatus()?this.player.play():this.player.pause()}actionSeekForward(){this.seekQueue.clearPadding(),this.seekQueue.push((async()=>this.player.seek(h.jk(this.player.currentTime+BigInt(1e4),this.player.getDuration()-BigInt(1e4)))))}actionSeekBack(){this.seekQueue.clearPadding(),this.seekQueue.push((async()=>this.player.seek(h.T9(this.player.currentTime-BigInt(1e4),BigInt(0)))))}actionUpperPlayrate(){this.lastPlayrate=this.player.getPlaybackRate(),this.player.setPlaybackRate(2)}actionStopUpperPlayrate(){this.player.setPlaybackRate(this.lastPlayrate)}actionNextFile(){}actionPrevFile(){}actionNextFrame(){this.player.playNextFrame()}actionSnapshot(){if(!this.player.hasVideo())return;const t=this.player.snapshot("png"),e=atob(t.replace(/^data:image\/(png|jpeg|jpg);base64,/,"")),i=t.split(",")[0].split(":")[1].split(";")[0],r=new ArrayBuffer(e.length),s=new Uint8Array(r);for(let t=0;t{this.longDownTimer.delete(e.keyCode),this.runAction(t),this.longDownRunning.set(e.keyCode,t)}),1e3))}getActionKeys(t,e,i=!1){let r,s;if(o.__(d,((a,o)=>{const c=a=>{if(a.keyCode===t.keyCode&&e===a.action&&(!a.playerStatus||l.zy(a.playerStatus,this.player.getStatus()))&&(!i||a.longDownBefore)){const e=[];if(t.shiftKey&&e.push(n.ZV.shift),t.ctrlKey&&e.push(n.ZV.ctrl),t.metaKey&&e.push(n.ZV.meta),t.altKey&&e.push(n.ZV.alt),e.length===a.with.length){let t=!0;for(let i=0;i{if(c(e))return t=!0,!1})),t)return!1}})),s)return{key:r,action:s}}onKeyDown(t){let e=this.getActionKeys(t,"down");e?this.runAction(e.key):(e=this.getActionKeys(t,"longDown"),e&&!this.longDownRunning.has(e.action.keyCode)&&this.longDownAction(e.key,e.action))}onKeyUp(t){this.longDownTimer.has(t.keyCode)&&(clearTimeout(this.longDownTimer.get(t.keyCode)),this.longDownTimer.delete(t.keyCode));let e=this.getActionKeys(t,"up",this.longDownRunning.has(t.keyCode));e&&(e.action.longDownBefore&&!this.longDownRunning.has(t.keyCode)||this.runAction(e.key)),this.longDownRunning.delete(t.keyCode)}destroy(){document.removeEventListener("keydown",this.onKeyDown_),document.removeEventListener("keyup",this.onKeyUp_)}}},64147:(t,e,i)=>{"use strict";i.d(e,{A:()=>c});var r=i(63939),s=i(28090),a=i(82723),n=i.n(a),o=i(42567),l=i.n(o);const c={name:"AudioTrack",template:n(),propTypes:{player:{type:"object",required:!0},language:{type:"object",required:!0}},data:function(){return{streams:[],audioInfo:null,selectIndex:0,style:l()}},computed:{list:function(){const t=this.get("player"),e=this.get("streams"),i=this.get("audioInfo");return i?i.list.length?i.list.map(((t,e)=>({value:e,name:t.lang,codecs:t.codecs}))):[]:e.map(((e,i)=>(e.id===t.getSelectedAudioStreamId()&&this.set("selectIndex",i),{value:e.id,name:e.metadata.title||e.metadata.languageString||e.metadata.language||e.metadata.name||"default"})))}},methods:{change:function(t){this.get("selectIndex")!==t&&this.get("player").selectAudio(this.get("list")[t].value).then((()=>{this.set("selectIndex",t)}))},init:function(t){t.isDash()||t.isHls()?t.getAudioList().then((t=>{this.set("audioInfo",t),this.set("selectIndex",t.selectedIndex)})):this.set("streams",t.getStreams().filter((t=>1===r.f[15](t.codecpar))))}},afterMount(){this.namespace=".component_control_audio_track"+Math.random();const t=this.get("player");t.on(s.S2+this.namespace,(()=>{this.init(t)})),t.on(s.xv+this.namespace,(()=>{this.init(t)})),t.getStatus()>=4&&this.init(t)},beforeDestroy(){const t=this.get("player");this.namespace&&t.off(this.namespace)}}},30019:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var r=i(22179),s=i.n(r),a=i(9371),n=i.n(a);const o={name:"Fullscreen",template:s(),propTypes:{player:{type:"object",required:!0},language:{type:"object",required:!0},dom:{type:"object"}},data:function(){return{style:n(),fullscreen:!1}},methods:{init(t){},fullscreenClick(){const t=this.get("player");if(this.get("fullscreen"))document.exitFullscreen?document.exitFullscreen():document.mozExitFullScreen?document.mozExitFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen();else{const e=this.get("dom")||t.getOptions().container.parentElement;e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.msRequestFullscreen&&e.msRequestFullscreen()}}},afterMount(){this.namespace=".component_control_fullscreen"+Math.random();const t=this.get("player");this.onfullscreenchange=()=>{if(null==document.fullscreenElement){const e=t.getOptions().container;t.resize(e.offsetWidth,e.offsetHeight),this.set("fullscreen",!1)}else t.resize(screen.width,screen.height),this.set("fullscreen",!0)},document.addEventListener("fullscreenchange",this.onfullscreenchange)},beforeDestroy(){const t=this.get("player");this.namespace&&t.off(this.namespace),document.removeEventListener("fullscreenchange",this.onfullscreenchange)}}},86213:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var r=i(11302),s=i(82237),a=i.n(s),n=i(85885),o=i.n(n);const l={name:"Loop",template:a(),propTypes:{player:{type:"object",required:!0},language:{type:"object",required:!0}},data:function(){return{style:o(),loop:!!+r.Jt(r.vd,0)}},watchers:{loop:function(t){this.get("player").setLoop(t),r.hZ(r.vd,t?1:0)}},methods:{init(t){},change(){this.set("loop",!this.get("loop"))}},afterMount(){this.namespace=".component_control_loop"+Math.random(),this.get("player").setLoop(this.get("loop"))},beforeDestroy(){const t=this.get("player");this.namespace&&t.off(this.namespace)}}},91011:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var r=i(16979),s=i.n(r),a=i(6187),n=i.n(a);const o={name:"Pip",template:s(),propTypes:{player:{type:"object",required:!0},language:{type:"object",required:!0}},data:function(){return{style:n(),pip:!1}},methods:{init(t){},async pipClick(){const t=this.get("player");if(this.get("pip"))if(this.set("pip",!1),t.isMSE())document.exitPictureInPicture();else{const e=this.pipWindow.document.body.children[0];e&&(this.playerContainer.prepend(e),t.resize(e.offsetWidth,e.offsetHeight)),this.pipWindow.close()}else t.isMSE()?t.video.requestPictureInPicture():(this.playerContainer=t.getOptions().container.parentElement,this.pipWindow=await documentPictureInPicture.requestWindow({disallowReturnToOpener:!0,width:320,height:180}),this.pipWindow.addEventListener("pagehide",(e=>{if(this.get("pip")){const i=e.target.body.children[0];i&&(this.playerContainer.prepend(i),t.resize(i.offsetWidth,i.offsetHeight)),this.set("pip",!1)}})),this.pipWindow.addEventListener("resize",(e=>{if(this.pipWindow.document){const e=this.pipWindow.document.children[0];t.resize(e.offsetWidth,e.offsetHeight)}})),[...document.styleSheets].forEach((t=>{try{const e=[...t.cssRules].map((t=>t.cssText)).join(""),i=document.createElement("style");i.textContent=e,this.pipWindow.document.head.appendChild(i)}catch(e){const i=document.createElement("link");i.rel="stylesheet",i.type=t.type,i.media=t.media,i.href=t.href,this.pipWindow.document.head.appendChild(i)}})),this.pipWindow.document.body.append(t.getOptions().container))}},afterMount(){this.namespace=".component_control_pip"+Math.random(),this.onenter=t=>{this.pipWindow=t.window,this.set("pip",!0)},"object"==typeof documentPictureInPicture&&documentPictureInPicture.addEventListener("enter",this.onenter)},beforeDestroy(){const t=this.get("player");"object"==typeof documentPictureInPicture&&documentPictureInPicture.removeEventListener("enter",this.onenter),this.namespace&&t.off(this.namespace)}}},76793:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var r=i(28090),s=i(1449),a=i.n(s),n=i(70409),o=i.n(n);const l={name:"Play",model:"played",template:a(),propTypes:{player:{type:"object",required:!0},language:{type:"object",required:!0},played:{type:"boolean",required:!0}},data:function(){return{style:o()}},methods:{playClick(){const t=this.get("player");if(t.getSource()){if(this.get("played")){if(t.isLive())return;t.pause()}else 0===t.getStatus()?t.load(t.getSource(),{externalSubtitles:t.getExternalSubtitle()}).then((()=>{t.play()})):t.play();this.set("played",!this.get("played"))}},init(t){this.set("played",6===t.getStatus())}},afterMount(){this.namespace=".component_control_play"+Math.random();const t=this.get("player");t.on(r.yd+this.namespace,(()=>{this.set("played",!1)})),t.on(r.NN+this.namespace,(()=>{this.set("played",!1)})),t.on(r.CN+this.namespace,(()=>{this.set("played",!0)})),t.on(r.S2+this.namespace,(()=>{this.init(t)})),t.getStatus()>=4&&this.init(t)},beforeDestroy(){const t=this.get("player");this.namespace&&t.off(this.namespace)}}},7233:(t,e,i)=>{"use strict";i.d(e,{A:()=>c});var r=i(72739),s=i(11302),a=i(8809),n=i.n(a),o=i(63197),l=i.n(o);const c={name:"Playrate",template:n(),propTypes:{player:{type:"object",required:!0},language:{type:"object",required:!0}},data:function(){const t=[2,1.5,1.25,1,.75,.5];let e=r.qh(t,+s.Jt(s.Yt,1));return e<0&&(e=3),{list:t,index:e,style:l()}},watchers:{index:function(t){s.hZ(s.Yt,this.get("list")[t]),this.get("player").setPlaybackRate(this.get("list")[t])}},methods:{change:function(t){this.set("index",t)}},afterMount(){this.namespace=".component_control_play_rate"+Math.random(),this.get("player").setPlaybackRate(this.get("list")[this.get("index")])},beforeDestroy(){const t=this.get("player");this.namespace&&t.off(this.namespace)}}},13203:(t,e,i)=>{"use strict";i.d(e,{A:()=>o});var r=i(78675),s=i.n(r),a=i(51819),n=i.n(a);const o={name:"Setting",template:s(),propTypes:{player:{type:"object",required:!0},language:{type:"object",required:!0}},data:function(){return{style:n()}},methods:{init(t){},click(){this.fire("openSettings")}},afterMount(){this.namespace=".component_control_setting"+Math.random(),this.get("player")},beforeDestroy(){const t=this.get("player");this.namespace&&t.off(this.namespace)}}},59715:(t,e,i)=>{"use strict";i.d(e,{A:()=>h});var r=i(63939),s=i(28090),a=i(95683),n=i.n(a),o=i(35995),l=i.n(o),c=i(9391);const h={name:"SubtitleTrack",template:n(),propTypes:{player:{type:"object",required:!0},language:{type:"object",required:!0}},data:function(){return{streams:[],subtitleInfo:null,selectIndex:0,style:l(),accept:c._Y.map((t=>"."+t)).join(", "),canUseFilePicker:"function"==typeof showOpenFilePicker}},computed:{list:function(){const t=this.get("player"),e=this.get("streams"),i=this.get("subtitleInfo");return i?i.list.length?i.list.map(((t,e)=>({value:e,name:t.lang,codecs:t.codecs}))):[]:e.map(((e,i)=>(e.id===t.getSelectedSubtitleStreamId()&&this.set("selectIndex",i),{value:e.id,name:e.metadata.title||e.metadata.languageString||e.metadata.language||e.metadata.name||"default"})))}},methods:{change:function(t){this.get("selectIndex")!==t&&this.get("player").selectSubtitle(this.get("list")[t].value).then((()=>{this.set("selectIndex",t)}))},openFile(){const t={startIn:"videos",types:[{description:"Subtitles",accept:{"application/octet-stream":c._Y.map((t=>"."+t))}}],excludeAcceptAllOption:!0,multiple:!0},e=this.get("player");showOpenFilePicker(t).then((async t=>{for(let i=0;i{this.set("subtitleInfo",t),this.set("selectIndex",t.selectedIndex)})):this.set("streams",t.getStreams().filter((t=>3===r.f[15](t.codecpar))))}},afterMount(){this.namespace=".component_control_subtitle_track"+Math.random();const t=this.get("player");t.on(s.S2+this.namespace,(()=>{this.init(t)})),t.on(s.xv+this.namespace,(()=>{this.init(t)})),t.getStatus()>=4&&this.init(t)},beforeDestroy(){const t=this.get("player");this.namespace&&t.off(this.namespace)}}},37463:(t,e,i)=>{"use strict";i.d(e,{A:()=>c});var r=i(28090),s=i(20525),a=i(9127),n=i.n(a),o=i(27983),l=i.n(o);const c={name:"Time",template:n(),propTypes:{player:{type:"object",required:!0},language:{type:"object",required:!0}},data:function(){return{totalTime:BigInt(0),currentTime:BigInt(0),style:l()}},filters:{formatTime(t){t<0&&(t=BigInt(0));const e=Number(BigInt.asIntN(32,t/BigInt(1e3)%BigInt(60))),i=Number(BigInt.asIntN(32,t/BigInt(1e3)/BigInt(60)%BigInt(60))),r=Number(BigInt.asIntN(32,t/BigInt(1e3)/BigInt(3600)));return s.GP("%02d:%02d:%02d",r,i,e)}},methods:{init(t){this.set("currentTime",t.currentTime),this.set("totalTime",t.getDuration())}},afterMount(){this.namespace=".component_control_timer"+Math.random();const t=this.get("player");t.on(r.S2+this.namespace,(()=>{this.init(t)})),t.on(r.E9+this.namespace,(t=>{this.set("currentTime",t)})),t.getStatus()>=4&&this.init(t)},beforeDestroy(){const t=this.get("player");this.namespace&&t.off(this.namespace)}}},40777:(t,e,i)=>{"use strict";i.d(e,{A:()=>c});var r=i(63939),s=i(28090),a=i(43145),n=i.n(a),o=i(27189),l=i.n(o);const c={name:"VideoTrack",template:n(),propTypes:{player:{type:"object",required:!0},language:{type:"object",required:!0}},data:function(){return{streams:[],videoInfo:null,selectIndex:0,style:l()}},computed:{list:function(){const t=this.get("player"),e=this.get("streams"),i=this.get("videoInfo");if(!i)return e.map(((e,i)=>(e.id===t.getSelectedVideoStreamId()&&this.set("selectIndex",i),{value:e.id,name:e.metadata.title||e.metadata.languageString||e.metadata.language||e.metadata.name||"default"})));if(i.list.length){const t=i.list[i.selectedIndex].codecs;return i.list.map(((t,e)=>({value:e,name:`${t.width}*${t.height}${t.frameRate?`@${t.frameRate}`:""}`,codecs:t.codecs}))).filter((e=>e.codecs.split(".")[0]===t.split(".")[0]))}return[]}},methods:{change:function(t){this.get("selectIndex")!==t&&this.get("player").selectVideo(this.get("list")[t].value).then((()=>{this.set("selectIndex",t)}))},init:function(t){t.isDash()||t.isHls()?t.getVideoList().then((t=>{this.set("videoInfo",t),this.set("selectIndex",t.selectedIndex)})):this.set("streams",t.getStreams().filter((t=>0===r.f[15](t.codecpar))))}},afterMount(){this.namespace=".component_control_video_track"+Math.random();const t=this.get("player");t.on(s.S2+this.namespace,(()=>{this.init(t)})),t.on(s.xv+this.namespace,(()=>{this.init(t)})),t.getStatus()>=4&&this.init(t)},beforeDestroy(){const t=this.get("player");this.namespace&&t.off(this.namespace)}}},92053:(t,e,i)=>{"use strict";i.d(e,{A:()=>h});var r=i(11302),s=i(53924),a=i(28090),n=i(93069),o=i.n(n),l=i(80253),c=i.n(l);const h={name:"Volume",template:o(),propTypes:{player:{type:"object",required:!0},language:{type:"object",required:!0}},data:function(){return{lastVolume:50,volume:+r.Jt(r.xc,50),style:c()}},watchers:{volume:function(t){r.hZ(r.xc,t),this.get("player").setVolume(t/100)}},methods:{volumeClick(){this.get("volume")?(this.set("lastVolume",this.get("volume")),this.set("volume",0)):this.set("volume",this.get("lastVolume"))}},afterMount(){this.namespace=".component_control_volume"+Math.random();const t=this.get("player");t.on(a.Wu+this.namespace,(t=>{this.set("volume",Math.floor(100*t))})),t.setVolume(this.get("volume")/100)},beforeDestroy(){const t=this.get("player");this.namespace&&t.off(this.namespace)},components:{Slider:s.A}}},14667:(t,e,i)=>{"use strict";i.d(e,{A:()=>m});var r=i(28090),s=i(94907),a=i.n(s),n=i(50055),o=i.n(n),l=i(9391),c=i(72739),h=i(66521),u=i(8284),d=i(4624),f=i(8507),p=i(67672);const m={name:"Folder",template:a(),propTypes:{player:{type:"object",required:!0},language:{type:"object",required:!0}},data:function(){return{style:o(),canOpenFolder:"function"==typeof showDirectoryPicker,canUseFilePicker:"function"==typeof showOpenFilePicker,tip:"",tipTop:0,tipShow:!1,root:[],accept:l.z_.concat(l.KQ).map((t=>"."+t)).join(", ")}},methods:{init(t){},async addDir(t){let e=0;const i=[];async function r(t){const r=await t.getFile(),s=r.name.split(".").pop();if(c.zy(l.KQ,s)||c.zy(l.z_,s)){const s={id:(0,u.A)(),type:"file",name:r.name,depth:e,source:r,handle:t,played:!1,parent:i.length?i[i.length-1]:null};i[i.length-1].children.push(s)}}await async function t(s){const a={id:(0,u.A)(),type:"folder",name:s.name,depth:e,children:[],opened:!1,handle:s,played:!1,parent:i.length?i[i.length-1]:null};i.length&&i[i.length-1].children.push(a),i.push(a),e++;for await(const a of s.values())"file"===a.kind?await r(a):"directory"===a.kind&&(await t(a),i.pop(),e--)}(t),this.append("root",i.pop())},async addFile(t){const e=await t.getFile();this.append("root",{id:(0,u.A)(),type:"file",name:e.name,depth:0,source:e,handle:t})},addUrl(t,e){const i=f.qg(t);this.append("root",{id:(0,u.A)(),type:"file",name:i.file||t,depth:0,source:t,isLive:e})},openDir(){showDirectoryPicker({mode:"read",startIn:"videos"}).then((async t=>{this.addDir(t),this.root.push(t),h.M_(h.qd,this.root)}))},openFile(){const t={startIn:"videos",types:[{description:"Audios & Videos",accept:{"application/octet-stream":l.z_.map((t=>"."+t)).concat(l.KQ.map((t=>"."+t)))}}],excludeAcceptAllOption:!0,multiple:!0};showOpenFilePicker(t).then((async t=>{for(let e=0;e`${e?"libmediaLive:":""}${t}`,openUrl(){const t=this.$refs.url.value;if(!t)return;const e=this.$refs.live.checked;this.addUrl(t,e),this.root.push(this.generateStoreUrl(t,e)),h.M_(h.qd,this.root),this.$refs.url.value="",this.$refs.live.checked=!1},fileChange(t){const e=t.originalEvent.target.files[0];this.append("root",{id:(0,u.A)(),type:"file",name:e.name,depth:0,source:e})},findNodeById(t,e){for(let i=0;i{t.loadExternalSubtitle(e)}))}}},preventDefault(t){t.preventDefault()}},events:{play(t,e){const i=this.get("player");if(e.get("node.id")===this.playNodeId)return void(6===i.getStatus()?(i.pause(),e.set("node.paused",!0)):7===i.getStatus()&&(i.play(),e.set("node.paused",!1)));if(this.playNodeId){let t=this.findNodeById(this.playNodeId,this.get("root"));for(;t;)t.ref?t.ref.set("node.played",!1):t.played=!1,t=t.parent;this.playNodeId=null}let r=e;for(;r!==this;)r.set("node.played",!0),r=r.$parent;1!==i.getStatus()&&2!==i.getStatus()&&(0===i.getStatus()?(i.setIsLive(!!e.get("node.isLive")),i.load(e.get("node.source")).then((()=>{i.play().catch((t=>{this.fire("error",{message:`${t}`})})),e.set("node.paused",!1),this.findSubtitle(e.get("node"))})).catch((t=>{this.fire("error",{message:`${t}`})})),this.playNodeId=e.get("node.id"),this.fire("playNode",e.get("node"))):i.stop().then((()=>{i.setIsLive(!!e.get("node.isLive")),i.load(e.get("node.source")).then((()=>{i.play().catch((t=>{this.fire("error",{message:`${t}`})})),e.set("node.paused",!1),this.findSubtitle(e.get("node"))})).catch((t=>{this.fire("error",{message:`${t}`})})),this.playNodeId=e.get("node.id"),this.fire("playNode",e.get("node"))})))},delete(t,e){let i=-1;const r=this.get("root");for(let t=0;t-1&&this.removeAt("root",i),c.TF(this.root,e.handle||this.generateStoreUrl(e.source,e.isLive)),h.M_(h.qd,this.root)},tip(t,e){e?(this.set("tipShow",!0),this.set("tip",e.text),this.set("tipTop",e.top-this.$refs.scroll.scrollTop+90)):this.set("tipShow",!1)}},afterMount(){this.namespace=".component_folder"+Math.random(),(this.get("canOpenFolder")||this.get("canUseFilePicker"))&&h.Hh(h.qd).then((async t=>{this.root=t||[];const e=[];for(let t=0;t{if(this.playNodeId){let t=this.findNodeById(this.playNodeId,this.get("root"));if(t){t.ref?t.ref.set("node.paused",!0):t.paused=!0;let e=t;for(;e;)e.ref?e.ref.set("node.played",!1):e.played=!1,e=e.parent}}})),t.on(r.NN+this.namespace,(()=>{if(this.playNodeId){let t=this.findNodeById(this.playNodeId,this.get("root"));t&&(t.ref?t.ref.set("node.paused",!0):t.paused=!0)}})),t.on(r.CN+this.namespace,(()=>{if(this.playNodeId){let t=this.findNodeById(this.playNodeId,this.get("root"));t&&(t.ref?t.ref.set("node.paused",!1):t.paused=!1)}}))},beforeDestroy(){const t=this.get("player");this.namespace&&t.off(this.namespace)},components:{FolderNode:l.Ay}}},9391:(t,e,i)=>{"use strict";i.d(e,{Ay:()=>h,KQ:()=>o,_Y:()=>l,z_:()=>n});var r=i(67672),s=i(72739),a=i(81747);const n=["mp3","aac","flac","ogg","ogg","wav","m4a","mka","opus"],o=["mp4","webm","mkv","flv","ts","mov","m4s","h264","264","avc","h265","265","hevc","h266","266","vvc","ivf","mpeg"],l=["ass","ssa","vvt","srt","xml","ttml"],c={name:"Node",template:i.n(a)(),propTypes:{node:{type:"object"},language:{type:"object",required:!0}},data:function(){return{}},filters:{isFolder:function(t){return"folder"===t.type},paddingStart:function(t){return 24*t.depth},isUrl:function(t){return r.Yj(t.source)},isMusic:function(t){const e=t.source.name.split(".").pop();return s.zy(n,e)}},methods:{toggle(){this.set("node.opened",!this.get("node.opened"))},play(){this.fire("play",this)},delete(){this.fire("delete",this.get("node"))},mouseenter(){this.$refs.name.scrollWidth>this.$refs.name.clientWidth&&this.fire("tip",{top:this.$el.offsetTop,text:r.Yj(this.get("node.source"))?this.get("node.source"):this.get("node.name")})},mouseleave(){this.fire("tip","")}},afterMount(){this.get("node").ref=this},beforeDestroy(){this.get("node").ref=null},components:{}};c.components.FolderNode=c;const h=c},53891:(t,e,i)=>{"use strict";i.d(e,{A:()=>f});var r=i(28090),s=i(67672),a=i(15491),n=i.n(a),o=i(90615),l=i.n(o),c=i(548);const h=["jitter","bandwidth"],u=["audioStutter","audioBitrate","audioEncodeFramerate","audioDecodeFramerate","audioRenderFramerate","audioFrameDecodeIntervalMax","audioFrameRenderIntervalMax"],d=["videoStutter","videoBitrate","videoEncodeFramerate","videoDecodeFramerate","videoRenderFramerate","keyFrameInterval","videoFrameDecodeIntervalMax","videoFrameRenderIntervalMax"],f={name:"Info",template:n(),propTypes:{player:{type:"object",required:!0},language:{type:"object",required:!0}},data:function(){return{style:l(),info:"",list:[]}},methods:{getStats:function(t){const e=t.getStats();this.set("list",[]);let i=h;t.hasVideo()&&(i=i.concat(d)),t.hasAudio()&&(i=i.concat(u)),i.forEach((t=>{let i=e[t];"audioBitrate"!==t&&"videoBitrate"!==t&&"bandwidth"!==t||(i=8*i/1e3+" kbps"),this.append("list",{key:t.replace(/([A-Z])/g," $1").replace(/^[a-z]/,(t=>t.toUpperCase())),value:i})}))},init(t){const e=t.getSource(),i=(0,c.Ay)([t.getFormatContext()],[{from:s.Yj(e)?e:e.name,tag:"Input"}]);this.set("info",i.replace(/\n/g,"
").replace(/\s/g," ")),this.set("list",[]),this.getStats(t),this.timer||(this.timer=setInterval((()=>{this.getStats(t)}),1e3))},close(){return this.fire("closeInfo"),!1},preventDefault(t){t.preventDefault()}},afterMount(){this.namespace=".component_info"+Math.random();const t=this.get("player");t.on(r.S2+this.namespace,(()=>{this.init(t)})),t.getStatus()>=4&&this.init(t)},beforeDestroy(){const t=this.get("player");this.namespace&&t.off(this.namespace),this.timer&&(clearInterval(this.timer),this.timer=null)}}},45553:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var r=i(28090),s=i(32849),a=i.n(s),n=i(57817),o=i.n(n);const l={name:"Loading",template:a(),propTypes:{player:{type:"object",required:!0},language:{type:"object",required:!0}},data:function(){return{style:o(),loading:!1}},methods:{},afterMount(){this.namespace=".component_loading"+Math.random();const t=this.get("player");t.on(r.CN+this.namespace,(()=>{this.timer&&(clearTimeout(this.timer),this.timer=null),this.set("loading",!1)})),t.on(r.F5+this.namespace,(()=>{this.timer&&clearTimeout(this.timer),this.timer=setTimeout((()=>{this.set("loading",!0),this.timer=null}),500)})),this.set("loading",3===t.getStatus())},beforeDestroy(){const t=this.get("player");this.namespace&&t.off(this.namespace)}}},65893:(t,e,i)=>{"use strict";i.d(e,{A:()=>d});var r=i(63939),s=i(28090),a=i(23077),n=i.n(a),o=i(6453),l=i.n(o),c=i(548),h=i(68391);const u={0:"LOADING_MESSAGE_OPEN_FILE",1:"LOADING_MESSAGE_ANALYZE_FILE",2:"LOADING_MESSAGE_LOAD_AUDIO_DECODER",3:"LOADING_MESSAGE_LOAD_VIDEO_DECODER"},d={name:"LoadingTip",template:n(),propTypes:{player:{type:"object",required:!0},language:{type:"object",required:!0},error:{type:"string"}},data:function(){return{style:l(),messages:[],showMessage:!1}},watchers:{error:function(){this.queue.push((()=>{this.append("message",this.get("language.LOADING_MESSAGE_LOAD_FAILED"))}))}},methods:{},afterMount(){this.namespace=".component_loading"+Math.random();const t=this.get("player");this.queue=new h.A(100),this.queue.onEnd=()=>{this.showTimer&&clearTimeout(this.showTimer),this.showTimer=setTimeout((()=>{this.set("showMessage",!1),this.showTimer=null}),2e3)},t.on(s.CN+this.namespace,(()=>{this.queue.push((()=>{this.append("message",this.get("language.LOADING_MESSAGE_LOAD_END"))})),this.queue.end()})),t.on(s.F5+this.namespace,(()=>{this.showTimer&&(clearTimeout(this.showTimer),this.showTimer=null),this.queue.reset(),this.set("message",[]),this.set("showMessage",!0)})),t.on(s.Gd+this.namespace,((t,e)=>{let i=this.get("language."+u[t]);switch(t){case 1:i=i.replace("${mux}",e);break;case 2:case 3:i=i.replace("${decoder}",(0,c.eG)(r.f[15](e.codecpar),r.f[15](e.codecpar+4)))}this.queue.push((()=>{this.append("message",i)}))}))},beforeDestroy(){const t=this.get("player");this.namespace&&t.off(this.namespace)}}},30499:(t,e,i)=>{"use strict";i.d(e,{A:()=>m});var r=i(134),s=i(61634),a=i(28090),n=i(65051),o=i.n(n),l=i(9067),c=i.n(l),h=i(78995),u=i(86932);function d(t,e,i){let r,s,a;if(0==e)r=s=a=i;else{const n=function(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<.16666666666666666?t+6*(e-t)*i:i<.3333333333333333?e:i<.5?t+(e-t)*(.6666666666666666-i)*6:t},o=i<.5?i*(1+e):i+e-i*e,l=2*i-o;r=n(l,o,.3333333333333333+(t/=360)),s=n(l,o,t),a=n(l,o,t-.3333333333333333)}return[Math.round(255*r),Math.round(255*s),Math.round(255*a)]}function f(t,e){let i=(t+e)%360;return i<0&&(i+=360),i}class p{constructor(){(0,r.A)(this,"OUTER_MAX_HEIGHT",.4),(0,r.A)(this,"MIDDLE_MAX_HEIGHT",.3),(0,r.A)(this,"INNER_MAX_HEIGHT",.2),(0,r.A)(this,"MAX_LENGTH",100),(0,r.A)(this,"MAX_FRAMERATE",30),(0,r.A)(this,"timeDelta",Math.floor(1e3/this.MAX_FRAMERATE)),(0,r.A)(this,"lastTimestamp",(0,u.A)())}draw(t,e){const i=(0,u.A)();if(i-this.lastTimestamp.5?a/(2-t-e):a/(t+e),t){case 1:i=0/a+0;break;case 0:i=-1/a+2;break;case 0:i=1/a+4}i/=6}return[360*i,r,s]}();for(let e=0;e{this.playing&&this.draw()}))},init(t){t.hasVideo()?(this.playing=!1,this.context.clearRect(0,0,this.context.canvas.width,this.context.canvas.height)):t.hasAudio()&&(this.playing=!0,this.analyser||(this.analyser=s.A.audioContext.createAnalyser(),this.buffer=new Uint8Array(this.analyser.frequencyBinCount)),t.getAudioOutputNode().connect(this.analyser),this.draw())}},afterMount(){this.namespace=".component_pcm_visualization"+Math.random(),this.$refs.canvas.width=this.$el.offsetWidth*devicePixelRatio,this.$refs.canvas.height=this.$el.offsetHeight*devicePixelRatio,this.context=this.$refs.canvas.getContext("2d"),this.drawer=new p;const t=this.get("player");t.on(a.CN+this.namespace,(()=>{this.init(t)})),6===t.getStatus()&&this.init(t),this.onresize=(0,h.A)((()=>{this.$refs.canvas.width=this.$el.offsetWidth*devicePixelRatio,this.$refs.canvas.height=this.$el.offsetHeight*devicePixelRatio}),500),window.addEventListener("resize",this.onresize)},beforeDestroy(){const t=this.get("player");this.namespace&&t.off(this.namespace),this.playing=!1,window.removeEventListener("resize",this.onresize)}}},23601:(t,e,i)=>{"use strict";i.d(e,{A:()=>g});var r=i(29967),s=i.n(r),a=i(9599),n=i(29170),o=i(90577),l=i.n(o),c=i(57165),h=i.n(c),u=i(28090),d=i(44328),f=i(20525),p=i(67672),m=i(77231);const g={name:"Progress",template:l(),propTypes:{player:{type:"object",required:!0},indicatorUrl:{type:"string"}},data:function(){return{style:h(),startX:0,start:!1,seekTime:0,currentTime:0,totalTime:0,loadedTime:0,hoverX:0,indicatorSize:0,showTip:!1,isFileSource:!1,chapters:[],hoverChapter:""}},computed:{playedWidth:function(){const t=this.get("seekTime"),e=this.get("currentTime"),i=this.get("totalTime");return this.get("start")?t/i*100:e/i*100},loadedWidth:function(){return this.get("isFileSource")?0:(this.get("currentTime")+this.get("loadedTime"))/this.get("totalTime")*100},hoverWidth:function(){const t=this.get("hoverX");if(this.$refs&&this.$refs.slider){let e=t-this.$refs.slider.getBoundingClientRect().left;return e<0&&(e=0),e>this.$refs.slider.offsetWidth&&(e=this.$refs.slider.offsetWidth),e/this.$refs.slider.offsetWidth*100}return 0},hoverTime:function(){const t=this.get("hoverWidth");return Math.round(t/100*this.get("totalTime"))}},filters:{formatTime(t){t<0&&(t=0);const e=t/1e3%60|0,i=t/1e3/60%60|0,r=t/1e3/3600|0;return r?f.GP("%02d:%02d:%02d",r,i,e):f.GP("%02d:%02d",i,e)}},methods:{mousemove:function(t){if(!this.get("start"))return;const e=this.get("startX"),i=this.$refs.slider.offsetWidth;let r=0;r=(t.screenX-e)/i*this.get("totalTime");let s=this.get("seekTime")+r;s<0&&(s=0),s>this.get("totalTime")&&(s=this.get("totalTime")),this.set("seekTime",s),this.set("startX",t.screenX)},mouseup:function(){if(this.get("start")){this.set("start",!1);const t=this.get("player");this.seeking=!0,t.seek(BigInt(Math.floor(this.get("seekTime")))).then((()=>{this.seeking=!1})),this.set("currentTime",this.get("seekTime"))}},hoverEnter:function(t){this.set("hoverX",t.originalEvent.clientX),this.set("showTip",!0)},hoverMove:function(t){this.set("hoverX",t.originalEvent.clientX)},hoverLeave:function(t){this.set("hoverX",this.$refs.slider.offsetLeft),this.set("showTip",!1)},hoverClick:function(t){const e=this.get("player"),i=e.getStatus();6!==i&&7!==i||(this.seeking=!0,e.seek(BigInt(Math.floor(this.get("hoverTime")))).then((()=>{this.seeking=!1})),this.set("currentTime",this.get("hoverTime")))},indicatorDown:function(t){this.set("startX",t.originalEvent.screenX),this.set("start",!0),this.set("seekTime",this.get("currentTime"))},chapterEnter(t){this.set("hoverChapter",t.text),this.set("showTip",!0)},chapterLeave(t){this.set("hoverChapter",""),this.set("showTip",!0)},chapterClick(t){const e=this.get("player");this.seeking=!0,e.seek(t.start).then((()=>{this.seeking=!1})),this.set("currentTime",Number(t.start))},init(t){this.set("currentTime",Number(t.currentTime)),this.set("totalTime",Number(t.getDuration())),this.set("isFileSource",!p.Yj(t.getSource())),this.set("chapters",t.getChapters().map((t=>{const e=(0,d.k)(t.start,t.timeBase,m.i0);return{text:t.metadata.title,start:e,left:Number(e)/this.get("totalTime")*100}})))}},afterMount(){this.onmouseup=t=>{this.mouseup()},this.onmousemove=t=>{this.mousemove(t)},document.addEventListener("mouseup",this.onmouseup),document.addEventListener("mousemove",this.onmousemove),this.namespace=".Progress"+Math.random();const t=this.get("player");t.on(u.S2+this.namespace,(()=>{this.init(t)})),t.on(u.yd+this.namespace,(()=>{this.set("currentTime",0),this.set("loadedTime",0)})),t.on(u.mQ+this.namespace,(()=>{this.set("currentTime",Number(t.currentTime))})),t.on(u.E9+this.namespace,(e=>{if(this.seeking)return;this.set("currentTime",Number(e));const i=t.getStats(),r=t.getStreams();if(t.hasAudio()){const e=r.find((e=>e.id===t.getSelectedAudioStreamId()));e&&this.set("loadedTime",i.audioPacketQueueLength/(0,d.lb)((0,n.A)(e.codecpar+72,a.P))*1e3)}else if(t.hasVideo()){const e=r.find((e=>e.id===t.getSelectedVideoStreamId()));e&&this.set("loadedTime",i.videoPacketQueueLength/(0,d.lb)((0,n.A)(e.codecpar+72,a.P))*1e3)}})),t.getStatus()>=4&&this.init(t);const e=document.querySelector("#avplayer-ui-container"),i=getComputedStyle(e).getPropertyValue("--libmedia-ui-indicator-size").trim();this.set("indicatorSize",s()(i))},beforeDestroy(){document.removeEventListener("mouseup",this.onmouseup),document.removeEventListener("mousemove",this.onmousemove),this.get("player").off(this.namespace)}}},44341:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var r,s=i(42461),a=i.n(s),n=i(9217),o=i.n(n);!function(t){t[t.DECODER=0]="DECODER",t[t.PLAY=1]="PLAY",t[t.SUBTITLE=2]="SUBTITLE",t[t.VIDEO=3]="VIDEO",t[t.AUDIO=4]="AUDIO",t[t.FILTER=5]="FILTER",t[t.KEYBOARD=6]="KEYBOARD",t[t.LANGUAGE=7]="LANGUAGE",t[t.SKIN=8]="SKIN"}(r||(r={}));const l={name:"Settings",template:a(),propTypes:{player:{type:"object",required:!0},language:{type:"object",required:!0}},data:function(){const t=this.get("language"),e=[{id:r.DECODER,name:t.SETTING_TAB_DECODER},{id:r.PLAY,name:t.SETTING_TAB_PLAY},{id:r.SUBTITLE,name:t.SETTING_TAB_SUBTITLE},{id:r.VIDEO,name:t.SETTING_TAB_VIDEO},{id:r.AUDIO,name:t.SETTING_TAB_AUDIO},{id:r.FILTER,name:t.SETTING_TAB_FILTER},{id:r.KEYBOARD,name:t.SETTING_TAB_KEYBOARD},{id:r.LANGUAGE,name:t.SETTING_TAB_LANGUAGE},{id:r.SKIN,name:t.SETTING_TAB_SKIN}];return{style:o(),tab:r.DECODER,list:e}},methods:{close:function(){this.fire("closeSettings")}},afterMount(){this.namespace=".component_settings"+Math.random()},beforeDestroy(){const t=this.get("player");this.namespace&&t.off(this.namespace)}}},93269:(t,e,i)=>{"use strict";i.r(e),i.d(e,{BUTTON_ADD:()=>w,CHECKBOX_LIVE:()=>k,CONTROL_AUDIO_TRACK:()=>m,CONTROL_PLAYRATE:()=>p,CONTROL_SUBTITLE_TRACK:()=>v,CONTROL_SUBTITLE_TRACK_ADD:()=>y,CONTROL_VIDEO_TRACK:()=>g,FOLDER_OPEN_DIR:()=>A,FOLDER_OPEN_FILE:()=>b,FOLDER_OPEN_URL_PLACEHOLDER:()=>x,INFO_TITLE:()=>M,LOADING_MESSAGE_ANALYZE_FILE:()=>_,LOADING_MESSAGE_LOAD_AUDIO_DECODER:()=>I,LOADING_MESSAGE_LOAD_END:()=>P,LOADING_MESSAGE_LOAD_FAILED:()=>C,LOADING_MESSAGE_LOAD_VIDEO_DECODER:()=>S,LOADING_MESSAGE_OPEN_FILE:()=>T,MENU_STATS:()=>B,SETTINGS_TITLE:()=>E,SETTING_TAB_AUDIO:()=>F,SETTING_TAB_DECODER:()=>D,SETTING_TAB_FILTER:()=>O,SETTING_TAB_KEYBOARD:()=>$,SETTING_TAB_LANGUAGE:()=>N,SETTING_TAB_PLAY:()=>R,SETTING_TAB_SKIN:()=>z,SETTING_TAB_SUBTITLE:()=>U,SETTING_TAB_VIDEO:()=>L,TIP_DELETE:()=>f,TIP_FOLD:()=>u,TIP_FULLSCREEN:()=>n,TIP_LOOP_START:()=>o,TIP_LOOP_STOP:()=>l,TIP_PAUSE:()=>s,TIP_PIP_START:()=>c,TIP_PIP_STOP:()=>h,TIP_PLAY:()=>r,TIP_SETTING:()=>a,TIP_UNFOLD:()=>d});const r="播放",s="暂停",a="设置",n="全屏",o="开启循环播放",l="关闭循环播放",c="开启画中画",h="关闭画中画",u="折叠",d="展开",f="删除",p="倍速",m="音频",g="视频",v="字幕",y="添加字幕",A="打开文件夹",b="打开文件",x="输入网络地址",w="添加",k="直播",T="正在打开源...",_="正在分析源(${mux})...",I="正在加载音频解码器(${decoder})...",S="正在加载视频解码器(${decoder})...",P="已就绪 (`・ω・´)ゞ",C="加载失败 (∩︵∩)",M="统计信息",B="源统计信息",E="设置",D="解码器",R="播放",U="字幕",L="画面",F="声音",O="滤镜",$="快捷键",N="语言",z="皮肤"},69094:(t,e,i)=>{"use strict";i.r(e),i.d(e,{BUTTON_ADD:()=>x,CHECKBOX_LIVE:()=>w,CONTROL_AUDIO_TRACK:()=>p,CONTROL_PLAYRATE:()=>f,CONTROL_SUBTITLE_TRACK:()=>g,CONTROL_SUBTITLE_TRACK_ADD:()=>v,CONTROL_VIDEO_TRACK:()=>m,FOLDER_OPEN_DIR:()=>y,FOLDER_OPEN_FILE:()=>A,FOLDER_OPEN_URL_PLACEHOLDER:()=>b,INFO_TITLE:()=>C,LOADING_MESSAGE_ANALYZE_FILE:()=>T,LOADING_MESSAGE_LOAD_AUDIO_DECODER:()=>_,LOADING_MESSAGE_LOAD_END:()=>S,LOADING_MESSAGE_LOAD_FAILED:()=>P,LOADING_MESSAGE_LOAD_VIDEO_DECODER:()=>I,LOADING_MESSAGE_OPEN_FILE:()=>k,MENU_STATS:()=>M,SETTINGS_TITLE:()=>B,SETTING_TAB_AUDIO:()=>L,SETTING_TAB_DECODER:()=>E,SETTING_TAB_FILTER:()=>F,SETTING_TAB_KEYBOARD:()=>O,SETTING_TAB_LANGUAGE:()=>$,SETTING_TAB_PLAY:()=>D,SETTING_TAB_SKIN:()=>N,SETTING_TAB_SUBTITLE:()=>R,SETTING_TAB_VIDEO:()=>U,TIP_DELETE:()=>d,TIP_FOLD:()=>h,TIP_FULLSCREEN:()=>n,TIP_LOOP_START:()=>o,TIP_LOOP_STOP:()=>l,TIP_PAUSE:()=>s,TIP_PIP:()=>c,TIP_PLAY:()=>r,TIP_SETTING:()=>a,TIP_UNFOLD:()=>u});const r="Play",s="Pause",a="Settings",n="Fullscreen",o="Open Loop",l="Close Loop",c="Picture In Picture",h="Fold",u="Unfold",d="Delete",f="Speed",p="Audio",m="Video",g="Subtitle",v="Add",y="Open Fold",A="Open File",b="Input Url",x="Add",w="Live",k="opening source...",T="analyzing source(${mux})...",_="loading audio decoder(${decoder})...",I="loading video decoder(${decoder})...",S="readied (`・ω・´)ゞ",P="failed (∩︵∩)",C="Stats Info",M="Source Stats Info",B="Settings",E="Decoder",D="Play",R="Subtitle",U="Picture",L="Sound",F="Filter",O="Shortcut",$="Language",N="Skin"},6204:(t,e,i)=>{"use strict";i.d(e,{A:()=>l});var r=i(93269),s=i(69094),a=i(8507),n=i(11302);const o={chinese:1,chinese_traditional:1,english:1};function l(){let t=a.mA(location.search).language;switch(o[t]||(t=n.Jt(n.f7),t||(t=(navigator.systemLanguage||navigator.browserLanguage||navigator.userLanguage||navigator.language).toLowerCase(),t=t.indexOf("en")>-1?"english":t.indexOf("zh-hk")>-1||t.indexOf("zh-tw")>-1?"chinese_traditional":(t.indexOf("zh"),"chinese")),n.hZ(n.f7,t)),t){case"chinese":default:return r;case"english":return s}}},53924:(t,e,i)=>{"use strict";i.d(e,{A:()=>s});var r=i(82042);const s={name:"slider",model:"value",template:i.n(r)(),propTypes:{value:{type:"number",required:!0},max:{type:"number",value:100},min:{type:"number",value:0},step:{type:"number",value:1},direction:{type:"string",value:"vertical"}},data:function(){return{startX:0,startY:0,start:!1}},computed:{offset:function(){return"vertical"===this.get("direction")?`top: ${100*(1-this.get("value")/this.get("max"))}%`:`right: ${100*(1-this.get("value")/this.get("max"))}%`}},methods:{mousedown:function(t){this.set("startX",t.originalEvent.screenX),this.set("startY",t.originalEvent.screenY),this.set("start",!0)},mousemove:function(t){if(!this.get("start"))return;const e=this.get("startX"),i=this.get("startY");let r=0;const s=this.get("direction"),a=this.get("step");if("vertical"===s){const e=this.$refs.slider.offsetHeight;r=-(t.screenY-i)/e*this.get("max")*a}else if("horizontal"===s){const i=this.$refs.slider.offsetWidth;r=(t.screenX-e)/i*this.get("max")*a}let n=this.get("value")+r;nthis.get("max")&&(n=this.get("max")),this.set("value",Math.round(n)),this.set("startX",t.screenX),this.set("startY",t.screenY)},mouseup:function(){this.get("start")&&this.set("start",!1)}},afterMount(){this.onmouseup=t=>{this.mouseup()},this.onmousemove=t=>{this.mousemove(t)},document.addEventListener("mouseup",this.onmouseup),document.addEventListener("mousemove",this.onmousemove)},beforeDestroy(){document.removeEventListener("mouseup",this.onmouseup),document.removeEventListener("mousemove",this.onmousemove)}}},66521:(t,e,i)=>{"use strict";i.d(e,{Hh:()=>u,M_:()=>d,qd:()=>a});var r=i(54001),s=i.n(r);const a="libmedia_folder_root",n="libmedia_db",o="store";let l,c;async function h(){return c=new(s())(((t,e)=>{const i=indexedDB.open(n,1);i.onupgradeneeded=function(t){l=t.target.result,l.objectStoreNames.contains(o)||l.createObjectStore(o,{keyPath:"id",autoIncrement:!0}).createIndex("name","name",{unique:!1})},i.onsuccess=function(e){l=e.target.result,t()},i.onerror=function(t){e(t)}})),c}async function u(t){return l||(c?await c:await h()),new(s())(((e,i)=>{const r=l.transaction([o],"readwrite").objectStore(o).index("name").get(t);r.onsuccess=function(t){var i;e(null===(i=t.target.result)||void 0===i?void 0:i.data)},r.onerror=function(t){i(t)}}))}async function d(t,e){return l||(c?await c:await h()),new(s())(((i,r)=>{const s=l.transaction([o],"readwrite").objectStore(o),a=s.index("name").get(t);a.onsuccess=function(a){if(a.target.result){const n=s.put({id:a.target.result.id,name:t,data:e});n.onsuccess=function(){i()},n.onerror=function(t){r(t)}}else{const a=s.put({name:t,data:e});a.onsuccess=function(){i()},a.onerror=function(t){r(t)}}},a.onerror=function(t){r(t)}}))}},64804:(t,e,i)=>{"use strict";i.d(e,{A:()=>r});const r={on:function(t,e,i){setTimeout((function(){document.addEventListener("click",e.onOutside=function(i){let r=i.target;r.parentNode&&!t.contains(r)&&e(i)})}),0)},off:function(t,e,i){e.onOutside&&(document.removeEventListener("click",e.onOutside),e.onOutside=null)}}},11302:(t,e,i)=>{"use strict";i.d(e,{Jt:()=>l,Yt:()=>a,f7:()=>s,hZ:()=>o,vd:()=>n,xc:()=>r});const r="libmedia_volume",s="libmedia_system_language",a="libmedia_play_rate",n="libmedia_play_loop";function o(t,e){localStorage.setItem(t,e)}function l(t,e){const i=localStorage.getItem(t);return null==i?e:i}},34268:(t,e,i)=>{"use strict";var r=i(134),s=i(54001),a=i.n(s),n=i(84149),o=i(87503),l=i(67672),c=i(4624),h=i(44690);const u=h.A.windows||h.A.mac||h.A.linux?10:20;class d extends o.A{constructor(){super(),(0,r.A)(this,"pullIPC",void 0),(0,r.A)(this,"frontBuffer",void 0),(0,r.A)(this,"backBuffer",void 0),(0,r.A)(this,"channels",void 0),(0,r.A)(this,"backBufferOffset",void 0),(0,r.A)(this,"ended",void 0),(0,r.A)(this,"frontBuffered",void 0),(0,r.A)(this,"pause",void 0),(0,r.A)(this,"firstRendered",void 0),(0,r.A)(this,"stopped",void 0),(0,r.A)(this,"afterPullResolve",void 0),this.ended=!1,this.pause=!0,this.ipcPort.on(n.S3,(async t=>{switch(t.method){case"init":this.ipcPort.reply(t);break;case"start":{const{port:e,channels:i}=t.params;this.channels=i,this.pullIPC=new n.Ay(e);const r=[],s=[];await this.pull(r),await this.pull(s),this.frontBuffer=s,this.backBuffer=r,this.backBufferOffset=0,this.ended=!1,this.frontBuffered=!0,this.pause=!1,this.firstRendered=!1,this.stopped=!1,this.ipcPort.reply(t);break}case"restart":{if(!this.ended)return void this.ipcPort.reply(t);const e=[],i=[];await this.pull(e),await this.pull(i),this.frontBuffer=i,this.backBuffer=e,this.backBufferOffset=0,this.ended=!1,this.frontBuffered=!0,this.pause=!1,this.firstRendered=!1,this.stopped=!1,this.ipcPort.reply(t);break}case"clear":this.backBufferOffset=u,this.ipcPort.reply(t);break;case"stop":this.ended||this.pause||this.frontBuffered||await new(a())((t=>{this.afterPullResolve=t})),this.stopped=!0,this.pullIPC.destroy(),this.ipcPort.reply(t);break;case"pause":this.pause=!0,this.ipcPort.reply(t);break;case"unpause":this.pause=!1,this.ipcPort.reply(t)}}))}async pull(t){const e=await this.pullIPC.request("pullBuffer",{nbSamples:128*u});if(l.ai(e))this.ended=!0;else{const i=new Float32Array(e);for(let e=0;e{this.frontBuffered=!0})),!0)}process(t,e,i){if(this.stopped)return!1;if(this.backBuffer&&!this.pause){if(this.backBufferOffset===u){if(this.ended)return this.backBuffer=null,this.frontBuffer=null,c.pq("audio source ended","src/avrender/pcm/AudioSourceWorkletProcessor.ts",199),this.ipcPort.notify("ended"),!0;if(!this.swapBuffer())return this.ipcPort.notify("stutter"),!0}const t=e[0];for(let e=0;e{"use strict";var r=i(134),s=i(54001),a=i.n(s),n=i(63939),o=i(50932),l=i(84149),c=i(87503),h=i(11473),u=(i(10278),i(37837)),d=i(4624),f=i(44690);const p=f.A.windows||f.A.mac||f.A.linux?10:20;class m extends c.A{constructor(){super(),(0,r.A)(this,"pullIPC",void 0),(0,r.A)(this,"frontBuffer",void 0),(0,r.A)(this,"backBuffer",void 0),(0,r.A)(this,"channels",void 0),(0,r.A)(this,"backBufferOffset",void 0),(0,r.A)(this,"ended",void 0),(0,r.A)(this,"frontBuffered",void 0),(0,r.A)(this,"firstRendered",void 0),(0,r.A)(this,"float32",void 0),(0,r.A)(this,"pause",void 0),(0,r.A)(this,"stopped",void 0),(0,r.A)(this,"afterPullResolve",void 0),this.ended=!1,this.pause=!0,this.ipcPort.on(l.S3,(async t=>{switch(t.method){case"init":{const{memory:e}=t.params;await(0,h.Tg)({memory:e,disableAsm:!0}),this.ipcPort.reply(t);break}case"start":{const{port:e,channels:i}=t.params;this.channels=i,this.pullIPC=new l.Ay(e);const r=this.allocBuffer(),s=this.allocBuffer();await this.pullIPC.request("pull",{buffer:s}),await this.pullIPC.request("pull",{buffer:r}),this.frontBuffer=r,this.backBuffer=s,this.backBufferOffset=0,this.ended=!1,this.pause=!1,this.frontBuffered=!0,this.firstRendered=!1,this.stopped=!1,this.float32=new Float32Array((0,h.eq)().buffer),this.ipcPort.reply(t);break}case"restart":{if(!this.ended)return void this.ipcPort.reply(t);const e=this.allocBuffer(),i=this.allocBuffer();await this.pullIPC.request("pull",{buffer:i}),await this.pullIPC.request("pull",{buffer:e}),this.frontBuffer=e,this.backBuffer=i,this.backBufferOffset=0,this.ended=!1,this.pause=!1,this.frontBuffered=!0,this.firstRendered=!1,this.stopped=!1,this.float32=new Float32Array((0,h.eq)().buffer),this.ipcPort.reply(t);break}case"stop":this.ended||this.pause||this.frontBuffered||await new(a())((t=>{this.afterPullResolve=t})),this.freeBuffer(this.backBuffer),this.freeBuffer(this.frontBuffer),this.backBuffer=0,this.frontBuffer=0,this.stopped=!0,this.pullIPC.destroy(),this.ipcPort.reply(t);break;case"clear":this.backBufferOffset=p,this.ipcPort.reply(t);break;case"pause":this.pause=!0,this.ipcPort.reply(t);break;case"unpause":this.pause=!1,this.ipcPort.reply(t)}}))}allocBuffer(){const t=(0,u.Gy)(40);o.M[20](t,(0,u.Gy)(4*this.channels));const e=(0,u.Gy)(512*p*this.channels);for(let i=0;i{this.frontBuffered=!0})),!0}process(t,e,i){if(this.stopped)return!1;if(this.backBuffer&&!this.pause){if(this.backBufferOffset===p){if(this.ended)return this.freeBuffer(this.backBuffer),this.freeBuffer(this.frontBuffer),this.backBuffer=0,this.frontBuffer=0,d.pq("audio source ended","src/avrender/pcm/AudioSourceWorkletProcessor2.ts",239),this.ipcPort.notify("ended"),!0;if(!this.swapBuffer())return this.ipcPort.notify("stutter"),!0}const t=e[0];for(let e=0;e>>2)+128*this.backBufferOffset,(n.f[20](n.f[20](this.backBuffer)+4*e)>>>2)+128*(this.backBufferOffset+1)),0);this.backBufferOffset++,this.firstRendered||(this.firstRendered=!0,this.ipcPort.notify("firstRendered"))}return!0}}registerProcessor("audio-source-processor",m)},87503:(t,e,i)=>{"use strict";i.d(e,{A:()=>a});var r=i(134),s=i(84149);class a extends AudioWorkletProcessor{constructor(){super(),(0,r.A)(this,"ipcPort",void 0),this.ipcPort=new s.Ay(this.port)}async request(t,e,i){return this.ipcPort.request(t,e,i)}notify(t,e,i){this.ipcPort.notify(t,e,i)}}},37149:(t,e,i)=>{i(18355),t.exports=i(46438).Array.isArray},87172:(t,e,i)=>{i(23204),t.exports=i(46438).Date.now},85079:(t,e,i)=>{var r=i(46438),s=r.JSON||(r.JSON={stringify:JSON.stringify});t.exports=function(t){return s.stringify.apply(s,arguments)}},92861:(t,e,i)=>{i(78978),i(97863),i(7914),i(96050),i(28337),i(74674),i(62223),t.exports=i(46438).Map},11837:(t,e,i)=>{i(21489),t.exports=i(46438).Number.isNaN},92696:(t,e,i)=>{i(74712);var r=i(46438).Object;t.exports=function(t,e,i){return r.defineProperty(t,e,i)}},22948:(t,e,i)=>{i(51780),t.exports=i(46438).Object.freeze},62160:(t,e,i)=>{i(18128),t.exports=i(46438).Object.getPrototypeOf},47567:(t,e,i)=>{i(96847),t.exports=i(46438).Object.keys},21724:(t,e,i)=>{i(4284),t.exports=i(46438).Object.setPrototypeOf},27279:(t,e,i)=>{i(95828),t.exports=i(46438).parseFloat},25216:(t,e,i)=>{i(65331),t.exports=i(46438).parseInt},34750:(t,e,i)=>{i(78978),i(97863),i(7914),i(91229),i(2639),i(46121),t.exports=i(46438).Promise},31707:(t,e,i)=>{i(66801),t.exports=i(46438).setImmediate},16560:(t,e,i)=>{i(19626),i(78978),i(42860),i(60716),t.exports=i(46438).Symbol},54220:(t,e,i)=>{i(97863),i(7914),t.exports=i(84336).f("iterator")},39967:(t,e,i)=>{t.exports=i(84336).f("toPrimitive")},48652:(t,e,i)=>{i(78978),t.exports=i(84336).f("toStringTag")},25219:t=>{t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},12560:t=>{t.exports=function(){}},2832:t=>{t.exports=function(t,e,i,r){if(!(t instanceof e)||void 0!==r&&r in t)throw TypeError(i+": incorrect invocation!");return t}},80812:(t,e,i)=>{var r=i(24401);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},77076:(t,e,i)=>{var r=i(95838);t.exports=function(t,e){var i=[];return r(t,!1,i.push,i,e),i}},84448:(t,e,i)=>{var r=i(65133),s=i(70181),a=i(72917);t.exports=function(t){return function(e,i,n){var o,l=r(e),c=s(l.length),h=a(n,c);if(t&&i!=i){for(;c>h;)if((o=l[h++])!=o)return!0}else for(;c>h;h++)if((t||h in l)&&l[h]===i)return t||h||0;return!t&&-1}}},48219:(t,e,i)=>{var r=i(58852),s=i(7001),a=i(66310),n=i(70181),o=i(99244);t.exports=function(t,e){var i=1==t,l=2==t,c=3==t,h=4==t,u=6==t,d=5==t||u,f=e||o;return function(e,o,p){for(var m,g,v=a(e),y=s(v),A=r(o,p,3),b=n(y.length),x=0,w=i?f(e,b):l?f(e,0):void 0;b>x;x++)if((d||x in y)&&(g=A(m=y[x],x,v),t))if(i)w[x]=g;else if(g)switch(t){case 3:return!0;case 5:return m;case 6:return x;case 2:w.push(m)}else if(h)return!1;return u?-1:c||h?h:w}}},49742:(t,e,i)=>{var r=i(24401),s=i(15461),a=i(30254)("species");t.exports=function(t){var e;return s(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!s(e.prototype)||(e=void 0),r(e)&&null===(e=e[a])&&(e=void 0)),void 0===e?Array:e}},99244:(t,e,i)=>{var r=i(49742);t.exports=function(t,e){return new(r(t))(e)}},44968:(t,e,i)=>{var r=i(93417),s=i(30254)("toStringTag"),a="Arguments"==r(function(){return arguments}());t.exports=function(t){var e,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),s))?i:a?r(e):"Object"==(n=r(e))&&"function"==typeof e.callee?"Arguments":n}},93417:t=>{var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},95933:(t,e,i)=>{"use strict";var r=i(78423).f,s=i(22087),a=i(30953),n=i(58852),o=i(2832),l=i(95838),c=i(88839),h=i(20322),u=i(45274),d=i(58219),f=i(75172).fastKey,p=i(6096),m=d?"_s":"size",g=function(t,e){var i,r=f(e);if("F"!==r)return t._i[r];for(i=t._f;i;i=i.n)if(i.k==e)return i};t.exports={getConstructor:function(t,e,i,c){var h=t((function(t,r){o(t,h,e,"_i"),t._t=e,t._i=s(null),t._f=void 0,t._l=void 0,t[m]=0,null!=r&&l(r,i,t[c],t)}));return a(h.prototype,{clear:function(){for(var t=p(this,e),i=t._i,r=t._f;r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete i[r.i];t._f=t._l=void 0,t[m]=0},delete:function(t){var i=p(this,e),r=g(i,t);if(r){var s=r.n,a=r.p;delete i._i[r.i],r.r=!0,a&&(a.n=s),s&&(s.p=a),i._f==r&&(i._f=s),i._l==r&&(i._l=a),i[m]--}return!!r},forEach:function(t){p(this,e);for(var i,r=n(t,arguments.length>1?arguments[1]:void 0,3);i=i?i.n:this._f;)for(r(i.v,i.k,this);i&&i.r;)i=i.p},has:function(t){return!!g(p(this,e),t)}}),d&&r(h.prototype,"size",{get:function(){return p(this,e)[m]}}),h},def:function(t,e,i){var r,s,a=g(t,e);return a?a.v=i:(t._l=a={i:s=f(e,!0),k:e,v:i,p:r=t._l,n:void 0,r:!1},t._f||(t._f=a),r&&(r.n=a),t[m]++,"F"!==s&&(t._i[s]=a)),t},getEntry:g,setStrong:function(t,e,i){c(t,e,(function(t,i){this._t=p(t,e),this._k=i,this._l=void 0}),(function(){for(var t=this,e=t._k,i=t._l;i&&i.r;)i=i.p;return t._t&&(t._l=i=i?i.n:t._t._f)?h(0,"keys"==e?i.k:"values"==e?i.v:[i.k,i.v]):(t._t=void 0,h(1))}),i?"entries":"values",!i,!0),u(e)}}},5874:(t,e,i)=>{var r=i(44968),s=i(77076);t.exports=function(t){return function(){if(r(this)!=t)throw TypeError(t+"#toJSON isn't generic");return s(this)}}},99373:(t,e,i)=>{"use strict";var r=i(66670),s=i(88535),a=i(75172),n=i(81984),o=i(2677),l=i(30953),c=i(95838),h=i(2832),u=i(24401),d=i(1356),f=i(78423).f,p=i(48219)(0),m=i(58219);t.exports=function(t,e,i,g,v,y){var A=r[t],b=A,x=v?"set":"add",w=b&&b.prototype,k={};return m&&"function"==typeof b&&(y||w.forEach&&!n((function(){(new b).entries().next()})))?(b=e((function(e,i){h(e,b,t,"_c"),e._c=new A,null!=i&&c(i,v,e[x],e)})),p("add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON".split(","),(function(t){var e="add"==t||"set"==t;!(t in w)||y&&"clear"==t||o(b.prototype,t,(function(i,r){if(h(this,b,t),!e&&y&&!u(i))return"get"==t&&void 0;var s=this._c[t](0===i?0:i,r);return e?this:s}))})),y||f(b.prototype,"size",{get:function(){return this._c.size}})):(b=g.getConstructor(e,t,v,x),l(b.prototype,i),a.NEED=!0),d(b,t),k[t]=b,s(s.G+s.W+s.F,k),y||g.setStrong(b,t,v),b}},46438:t=>{var e=t.exports={version:"2.6.12"};"number"==typeof __e&&(__e=e)},58852:(t,e,i)=>{var r=i(25219);t.exports=function(t,e,i){if(r(t),void 0===e)return t;switch(i){case 1:return function(i){return t.call(e,i)};case 2:return function(i,r){return t.call(e,i,r)};case 3:return function(i,r,s){return t.call(e,i,r,s)}}return function(){return t.apply(e,arguments)}}},87608:t=>{t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},58219:(t,e,i)=>{t.exports=!i(81984)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},3802:(t,e,i)=>{var r=i(24401),s=i(66670).document,a=r(s)&&r(s.createElement);t.exports=function(t){return a?s.createElement(t):{}}},77956:t=>{t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},36473:(t,e,i)=>{var r=i(54311),s=i(59820),a=i(36569);t.exports=function(t){var e=r(t),i=s.f;if(i)for(var n,o=i(t),l=a.f,c=0;o.length>c;)l.call(t,n=o[c++])&&e.push(n);return e}},88535:(t,e,i)=>{var r=i(66670),s=i(46438),a=i(58852),n=i(2677),o=i(75509),l="prototype",c=function(t,e,i){var h,u,d,f=t&c.F,p=t&c.G,m=t&c.S,g=t&c.P,v=t&c.B,y=t&c.W,A=p?s:s[e]||(s[e]={}),b=A[l],x=p?r:m?r[e]:(r[e]||{})[l];for(h in p&&(i=e),i)(u=!f&&x&&void 0!==x[h])&&o(A,h)||(d=u?x[h]:i[h],A[h]=p&&"function"!=typeof x[h]?i[h]:v&&u?a(d,r):y&&x[h]==d?function(t){var e=function(e,i,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,i)}return new t(e,i,r)}return t.apply(this,arguments)};return e[l]=t[l],e}(d):g&&"function"==typeof d?a(Function.call,d):d,g&&((A.virtual||(A.virtual={}))[h]=d,t&c.R&&b&&!b[h]&&n(b,h,d)))};c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,t.exports=c},81984:t=>{t.exports=function(t){try{return!!t()}catch(t){return!0}}},95838:(t,e,i)=>{var r=i(58852),s=i(27904),a=i(12828),n=i(80812),o=i(70181),l=i(55298),c={},h={},u=t.exports=function(t,e,i,u,d){var f,p,m,g,v=d?function(){return t}:l(t),y=r(i,u,e?2:1),A=0;if("function"!=typeof v)throw TypeError(t+" is not iterable!");if(a(v)){for(f=o(t.length);f>A;A++)if((g=e?y(n(p=t[A])[0],p[1]):y(t[A]))===c||g===h)return g}else for(m=v.call(t);!(p=m.next()).done;)if((g=s(m,y,p.value,e))===c||g===h)return g};u.BREAK=c,u.RETURN=h},66670:t=>{var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},75509:t=>{var e={}.hasOwnProperty;t.exports=function(t,i){return e.call(t,i)}},2677:(t,e,i)=>{var r=i(78423),s=i(86260);t.exports=i(58219)?function(t,e,i){return r.f(t,e,s(1,i))}:function(t,e,i){return t[e]=i,t}},76260:(t,e,i)=>{var r=i(66670).document;t.exports=r&&r.documentElement},32484:(t,e,i)=>{t.exports=!i(58219)&&!i(81984)((function(){return 7!=Object.defineProperty(i(3802)("div"),"a",{get:function(){return 7}}).a}))},20709:t=>{t.exports=function(t,e,i){var r=void 0===i;switch(e.length){case 0:return r?t():t.call(i);case 1:return r?t(e[0]):t.call(i,e[0]);case 2:return r?t(e[0],e[1]):t.call(i,e[0],e[1]);case 3:return r?t(e[0],e[1],e[2]):t.call(i,e[0],e[1],e[2]);case 4:return r?t(e[0],e[1],e[2],e[3]):t.call(i,e[0],e[1],e[2],e[3])}return t.apply(i,e)}},7001:(t,e,i)=>{var r=i(93417);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},12828:(t,e,i)=>{var r=i(20210),s=i(30254)("iterator"),a=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||a[s]===t)}},15461:(t,e,i)=>{var r=i(93417);t.exports=Array.isArray||function(t){return"Array"==r(t)}},24401:t=>{t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},27904:(t,e,i)=>{var r=i(80812);t.exports=function(t,e,i,s){try{return s?e(r(i)[0],i[1]):e(i)}catch(e){var a=t.return;throw void 0!==a&&r(a.call(t)),e}}},48248:(t,e,i)=>{"use strict";var r=i(22087),s=i(86260),a=i(1356),n={};i(2677)(n,i(30254)("iterator"),(function(){return this})),t.exports=function(t,e,i){t.prototype=r(n,{next:s(1,i)}),a(t,e+" Iterator")}},88839:(t,e,i)=>{"use strict";var r=i(74742),s=i(88535),a=i(61331),n=i(2677),o=i(20210),l=i(48248),c=i(1356),h=i(66123),u=i(30254)("iterator"),d=!([].keys&&"next"in[].keys()),f="keys",p="values",m=function(){return this};t.exports=function(t,e,i,g,v,y,A){l(i,e,g);var b,x,w,k=function(t){if(!d&&t in S)return S[t];switch(t){case f:case p:return function(){return new i(this,t)}}return function(){return new i(this,t)}},T=e+" Iterator",_=v==p,I=!1,S=t.prototype,P=S[u]||S["@@iterator"]||v&&S[v],C=P||k(v),M=v?_?k("entries"):C:void 0,B="Array"==e&&S.entries||P;if(B&&(w=h(B.call(new t)))!==Object.prototype&&w.next&&(c(w,T,!0),r||"function"==typeof w[u]||n(w,u,m)),_&&P&&P.name!==p&&(I=!0,C=function(){return P.call(this)}),r&&!A||!d&&!I&&S[u]||n(S,u,C),o[e]=C,o[T]=m,v)if(b={values:_?C:k(p),keys:y?C:k(f),entries:M},A)for(x in b)x in S||a(S,x,b[x]);else s(s.P+s.F*(d||I),e,b);return b}},27899:(t,e,i)=>{var r=i(30254)("iterator"),s=!1;try{var a=[7][r]();a.return=function(){s=!0},Array.from(a,(function(){throw 2}))}catch(t){}t.exports=function(t,e){if(!e&&!s)return!1;var i=!1;try{var a=[7],n=a[r]();n.next=function(){return{done:i=!0}},a[r]=function(){return n},t(a)}catch(t){}return i}},20322:t=>{t.exports=function(t,e){return{value:e,done:!!t}}},20210:t=>{t.exports={}},74742:t=>{t.exports=!0},75172:(t,e,i)=>{var r=i(19191)("meta"),s=i(24401),a=i(75509),n=i(78423).f,o=0,l=Object.isExtensible||function(){return!0},c=!i(81984)((function(){return l(Object.preventExtensions({}))})),h=function(t){n(t,r,{value:{i:"O"+ ++o,w:{}}})},u=t.exports={KEY:r,NEED:!1,fastKey:function(t,e){if(!s(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!a(t,r)){if(!l(t))return"F";if(!e)return"E";h(t)}return t[r].i},getWeak:function(t,e){if(!a(t,r)){if(!l(t))return!0;if(!e)return!1;h(t)}return t[r].w},onFreeze:function(t){return c&&u.NEED&&l(t)&&!a(t,r)&&h(t),t}}},53792:(t,e,i)=>{var r=i(66670),s=i(8036).set,a=r.MutationObserver||r.WebKitMutationObserver,n=r.process,o=r.Promise,l="process"==i(93417)(n);t.exports=function(){var t,e,i,c=function(){var r,s;for(l&&(r=n.domain)&&r.exit();t;){s=t.fn,t=t.next;try{s()}catch(r){throw t?i():e=void 0,r}}e=void 0,r&&r.enter()};if(l)i=function(){n.nextTick(c)};else if(!a||r.navigator&&r.navigator.standalone)if(o&&o.resolve){var h=o.resolve(void 0);i=function(){h.then(c)}}else i=function(){s.call(r,c)};else{var u=!0,d=document.createTextNode("");new a(c).observe(d,{characterData:!0}),i=function(){d.data=u=!u}}return function(r){var s={fn:r,next:void 0};e&&(e.next=s),t||(t=s,i()),e=s}}},11642:(t,e,i)=>{"use strict";var r=i(25219);function s(t){var e,i;this.promise=new t((function(t,r){if(void 0!==e||void 0!==i)throw TypeError("Bad Promise constructor");e=t,i=r})),this.resolve=r(e),this.reject=r(i)}t.exports.f=function(t){return new s(t)}},22087:(t,e,i)=>{var r=i(80812),s=i(90082),a=i(77956),n=i(4566)("IE_PROTO"),o=function(){},l="prototype",c=function(){var t,e=i(3802)("iframe"),r=a.length;for(e.style.display="none",i(76260).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("