pgs.js
Version:
PGS (Presentation Graphic Stream) Subtitle For HTML5 Media Playback
2 lines (1 loc) • 34.5 kB
JavaScript
(function(c,h){typeof exports=="object"&&typeof module<"u"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(c=typeof globalThis<"u"?globalThis:c||self,h(c.index={}))})(this,function(c){"use strict";var pt=Object.defineProperty;var bt=(c,h,G)=>h in c?pt(c,h,{enumerable:!0,configurable:!0,writable:!0,value:G}):c[h]=G;var a=(c,h,G)=>bt(c,typeof h!="symbol"?h+"":h,G);class h extends Error{constructor(t,e){super(t,e),this.name=this.constructor.name}}class G{constructor(t){a(this,"actual",null);a(this,"compare");this.compare=t}get parent(){return null}get balanced(){var t;return((t=this.actual)==null?void 0:t.balanced)??!0}get bias(){var t;return((t=this.actual)==null?void 0:t.bias)??0}toString(){return`${this.actual}`}refresh(){}rotate(){}has(t){var e;return((e=this.actual)==null?void 0:e.has(t))??!1}get(t){var e;return((e=this.actual)==null?void 0:e.get(t))??void 0}floor(t){var e;return((e=this.actual)==null?void 0:e.floor(t))??void 0}ceil(t){var e;return((e=this.actual)==null?void 0:e.ceil(t))??void 0}*range(t,e){var i;yield*((i=this.actual)==null?void 0:i.range(t,e))??[]}insert(t,e){this.actual==null?this.actual=new P(t,e,this,this.compare):this.actual.insert(t,e)}delete(t){var e;(e=this.actual)==null||e.delete(t)}replace(t,e){t!=null&&this.actual===t&&(t.parent=null,this.actual=e,e!=null&&(e.parent=this))}}class P{constructor(t,e,i,s){a(this,"key");a(this,"value");a(this,"parent");a(this,"left",null);a(this,"right",null);a(this,"depth",1);a(this,"compare");this.key=t,this.value=e,this.parent=i,this.compare=s}refresh(){var t,e;this.depth=Math.max(((t=this.left)==null?void 0:t.depth)??0,((e=this.right)==null?void 0:e.depth)??0)+1}get balanced(){var i,s,r,o;const t=Math.min(((i=this.left)==null?void 0:i.depth)??0,((s=this.right)==null?void 0:s.depth)??0);return Math.max(((r=this.left)==null?void 0:r.depth)??0,((o=this.right)==null?void 0:o.depth)??0)-t<=1}get bias(){var t,e;return(((t=this.left)==null?void 0:t.depth)??0)-(((e=this.right)==null?void 0:e.depth)??0)}toString(){return this.left&&console.log(this.left.parent===this?"OK":"NG"),this.right&&console.log(this.right.parent===this?"OK":"NG"),`[${JSON.stringify(this.key)}:${JSON.stringify(this.value)}, [${this.left}, ${this.right}]]`}leftmost(){return this.left==null?this:this.left.leftmost()}rightmost(){return this.right==null?this:this.right.rightmost()}rotateL(){var e,i;if(this.right==null)return;const t=this.right;this.replace(t,t.left),t.left=this,(e=this.parent)==null||e.replace(this,t),this.parent=t,this.refresh(),(i=this.parent)==null||i.refresh()}rotateR(){var e,i;if(this.left==null)return;const t=this.left;this.replace(t,t.right),t.right=this,(e=this.parent)==null||e.replace(this,t),this.parent=t,this.refresh(),(i=this.parent)==null||i.refresh()}rotateLR(){this.left!=null&&(this.left.rotateL(),this.rotateR())}rotateRL(){this.right!=null&&(this.right.rotateR(),this.rotateL())}rotate(){var t,e;this.bias===2?(((t=this.left)==null?void 0:t.bias)??0)>=0?this.rotateR():this.rotateLR():this.bias===-2&&((((e=this.right)==null?void 0:e.bias)??0)<=0?this.rotateL():this.rotateRL())}find(t,e="exact"){let i=this;t:for(;;){const s=this.compare(t,i.key);switch(s){case 0:return i;case-1:if(i.left!=null){i=i.left;continue t}else if(e==="ceil")return i;return null;case 1:if(i.right!=null){i=i.right;continue t}else if(e==="floor")return i;return null;default:const r=s;throw new Error(`Exhaustive check: ${r} reached!`)}}}has(t){return this.find(t,"exact")!=null}get(t){var e;return((e=this.find(t,"exact"))==null?void 0:e.value)??void 0}floor(t){var e;return((e=this.find(t,"floor"))==null?void 0:e.value)??void 0}ceil(t){var e;return((e=this.find(t,"ceil"))==null?void 0:e.value)??void 0}*range(t,e){var r,o;const i=this.compare(t,this.key),s=this.compare(e,this.key);i<=0&&(yield*((r=this.left)==null?void 0:r.range(t,e))??[]),i<=0&&s>0&&(yield this.value),s>0&&(yield*((o=this.right)==null?void 0:o.range(t,e))??[])}insert(t,e){let i=this;t:for(;;){const s=this.compare(t,i.key);switch(s){case 0:i.value=e;return;case-1:if(i.left!=null){i=i.left;continue t}i.left=new P(t,e,i,this.compare),i=i.left;break t;case 1:if(i.right!=null){i=i.right;continue t}i.right=new P(t,e,i,this.compare),i=i.right;break t;default:const r=s;throw new Error(`Exhaustive check: ${r} reached!`)}}for(let s=i;s!=null;s=s.parent)s.rotate(),s.refresh()}delete(t){var r,o,d,f,u,p,X;let e=this.find(t);if(e==null)return;const i=(r=e.left)==null?void 0:r.rightmost(),s=(o=e.right)==null?void 0:o.leftmost();i?((d=i.parent)==null||d.replace(i,null),(f=e.parent)==null||f.replace(e,i),i.right=e.right,e.right!=null&&(e.right.parent=i),i!==e.left&&(i.left=e.left,e.left!=null&&(e.left.parent=i))):s?((u=s.parent)==null||u.replace(s,null),(p=e.parent)==null||p.replace(e,s),s.left=e.left,e.left!=null&&(e.left.parent=s),s!==e.right&&(s.right=e.right,e.right!=null&&(e.right.parent=s))):(X=e.parent)==null||X.replace(e,null);for(let g=e;g!=null;g=g.parent)g.rotate(),g.refresh()}replace(t,e){this.left===t&&(t.parent===this.left&&(t.parent=null),e!=null&&(e.parent=this),this.left=e),this.right===t&&(t.parent===this.right&&(t.parent=null),e!=null&&(e.parent=this),this.right=e)}}class T{constructor(t){a(this,"root");a(this,"compare");this.compare=t,this.root=new G(this.compare)}clear(){this.root=new G(this.compare)}has(t){return this.root.has(t)}get(t){return this.root.get(t)}floor(t){return this.root.floor(t)}ceil(t){return this.root.ceil(t)}*range(t,e){yield*this.root.range(t,e)}insert(t,e){this.root.insert(t,e)}delete(t){this.root.delete(t)}toString(){return`${this.root}`}}const x=(...n)=>{if(!n)return new ArrayBuffer(0);const t=n.reduce((i,s)=>i+s.byteLength,0),e=new Uint8Array(t);for(let i=0,s=0;i<n.length;s+=n[i].byteLength,i++)e.set(new Uint8Array(n[i]),s);return e.buffer};class b{constructor(t){a(this,"view");a(this,"offset");this.view=new DataView(t),this.offset=0}exists(t){return this.offset+t<=this.view.byteLength}isEmpty(){return this.offset===this.view.byteLength}read(t){if(!this.exists(t))throw new h("Detected EOF!");const e=this.view.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}readU8(){if(!this.exists(1))throw new h("Detected EOF!");const t=this.view.getUint8(this.offset);return this.offset+=1,t}readU16(){if(!this.exists(2))throw new h("Detected EOF!");const t=this.view.getUint16(this.offset,!1);return this.offset+=2,t}readU24(){if(!this.exists(3))throw new h("Detected EOF!");const t=this.view.getUint16(this.offset,!1)*2**8+this.view.getUint8(this.offset+2);return this.offset+=3,t}readU32(){if(!this.exists(4))throw new h("Detected EOF!");const t=this.view.getUint32(this.offset,!1);return this.offset+=4,t}readAll(){const t=this.view.buffer.slice(this.offset,this.view.byteLength);return this.offset=this.view.byteLength,t}}class E{constructor(t){a(this,"reader");a(this,"done",!1);a(this,"buffer",new ArrayBuffer(0));a(this,"view",new DataView(this.buffer));a(this,"offset",0);this.reader=t.getReader()}async pump(t){if(this.buffer.byteLength-this.offset>=t)return!0;if(this.done)return!1;const{value:e,done:i}=await this.reader.read();return i?(this.done=i,this.buffer.byteLength-this.offset>=t):(this.buffer=x(this.buffer.slice(this.offset),e instanceof ArrayBuffer?e:e.buffer),this.view=new DataView(this.buffer),this.offset=0,this.buffer.byteLength-this.offset>=t?!0:this.pump(t))}async exists(t){return await this.pump(t)}async read(t){if(!await this.exists(t))throw new h("Detected EOF!");const e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}async readU8(){if(!await this.exists(1))throw new h("Detected EOF!");const t=this.view.getUint8(this.offset);return this.offset+=1,t}async readU16(){if(!await this.exists(2))throw new h("Detected EOF!");const t=this.view.getUint16(this.offset,!1);return this.offset+=2,t}async readU24(){if(!await this.exists(3))throw new h("Detected EOF!");const t=this.view.getUint16(this.offset,!1)*2**8+this.view.getUint8(this.offset+2);return this.offset+=3,t}async readU32(){if(!await this.exists(4))throw new h("Detected EOF!");const t=this.view.getUint32(this.offset,!1);return this.offset+=4,t}}const _=(n,t,e)=>{const i=n+0*(t-128)+1.371*(e-128),s=n-.336*(t-128)-.698*(e-128),r=n+1.732*(t-128)+0*(e-128);return[i,s,r]};class w extends Error{constructor(t,e){super(t,e),this.name=this.constructor.name}}const l={PDS:20,ODS:21,PCS:22,WDS:23,END:128},K={from(n){const t=n.readU16(),e=n.readU8(),i=n.readU8()!==0,s=n.readU16(),r=n.readU16();if(!i)return{objectId:t,windowId:e,objectCroppedFlag:i,objectHorizontalPosition:s,objectVerticalPosition:r};const o=n.readU16(),d=n.readU16(),f=n.readU16(),u=n.readU16();return{objectId:t,windowId:e,objectCroppedFlag:i,objectHorizontalPosition:s,objectVerticalPosition:r,objectCroppingHorizontalPosition:o,objectCroppingVerticalPosition:d,objectCroppingWidth:f,objectCroppingHeight:u}}},W={Normal:0,AcquisitionPoint:64,EpochStart:128},j={from(n){const t=n.readU16(),e=n.readU16(),i=n.readU8(),s=n.readU16(),r=n.readU8();if(r!==W.Normal&&r!==W.AcquisitionPoint&&r!==W.EpochStart)throw new w("Invalid compositionState");const o=n.readU8()===128,d=n.readU8(),f=n.readU8(),u=[];for(let p=0;p<f;p++)u.push(K.from(n));return{width:t,height:e,frameRate:i,compositionNumber:s,compositionState:r,paletteUpdateFlag:o,paletteId:d,numberOfCompositionObject:f,compositionObjects:u}}},H={from(n){const t=n.readU8(),e=n.readU16(),i=n.readU16(),s=n.readU16(),r=n.readU16();return{windowId:t,windowHorizontalPosition:e,windowVerticalPosition:i,windowWidth:s,windowHeight:r}}},L={from(n){const t=n.readU8(),e=[];for(let i=0;i<t;i++)e.push(H.from(n));return{numberOfWindow:t,windows:e}},valueOf(n){const t=new Map;for(const e of(n==null?void 0:n.flatMap(i=>i.windows))??[])t.set(e.windowId,e);return t}},M={from(n){const t=n.readU8(),e=n.readU8(),i=n.readU8(),s=n.readU8(),r=n.readU8();return{paletteEntryID:t,luminance:e,colorDifferenceRed:i,colorDifferenceBlue:s,transparency:r}}},N={from(n){const t=n.readU8(),e=n.readU8(),i=[];for(;!n.isEmpty();)i.push(M.from(n));return{paletteID:t,paletteVersionNumber:e,paletteEntries:i}}},v={LastInSequence:64,FirstInSequence:128,FirstAndLastInSequence:192,IntermediateSequence:0},V={from(n){const t=n.readU16(),e=n.readU8(),i=n.readU8();if(i===v.FirstInSequence||i===v.FirstAndLastInSequence){const s=n.readU24(),r=n.readU16(),o=n.readU16(),d=n.readAll();return{objectId:t,objectVersionNumber:e,lastInSequenceFlag:i,objectDataLength:s,width:r,height:o,objectData:d}}else if(i===v.LastInSequence||i===v.IntermediateSequence){const s=n.readAll();return{objectId:t,objectVersionNumber:e,lastInSequenceFlag:i,objectData:s}}else throw new w("lastInSequenceFlag Invalid")},valueOf(n){const t=new Map;for(const e of n??[])t.has(e.objectId)||t.set(e.objectId,[]),t.get(e.objectId).push(e);return t},isFirstInSequence(n){return n.lastInSequenceFlag===v.FirstInSequence||n.lastInSequenceFlag===v.FirstAndLastInSequence}},U={from(n,t){const e=t.find(d=>V.isFirstInSequence(d));if(e==null)return null;const{width:i,height:s}=e,r=new Uint8ClampedArray(i*s*4),o=new b(x(...t.map(d=>d.objectData)));{let d=0;for(;!o.isEmpty();){const f=o.readU8();let u=null,p=1;if(f!==0)u=n.paletteEntries[f];else{const y=o.readU8();if(y===0)continue;const O=(y&128)!==0;p=(y&64)!==0?(y&63)*2**8+o.readU8():y&63,u=O?n.paletteEntries[o.readU8()]:n.paletteEntries[0]}if(u==null){d+=p;continue}const[X,g,D]=_(u.luminance,u.colorDifferenceBlue,u.colorDifferenceRed);for(let y=0;y<p;y++)r[d*4+0]=X,r[d*4+1]=g,r[d*4+2]=D,r[d*4+3]=u.transparency,d+=1}}return{objectId:e.objectId,objectVersionNumber:e.objectVersionNumber,objectDataLength:e.objectDataLength,width:i,height:s,rgba:r}},valueOf(n,t){const e=new Map;for(const i of V.valueOf(t).values()){const s=U.from(n,i);s!=null&&e.set(s.objectId,s)}return e}},R={from(n){const t=n.readU8(),e=n.readU16();switch(t){case l.PDS:return{type:l.PDS,segment:N.from(new b(n.read(e)))};case l.ODS:return{type:l.ODS,segment:V.from(new b(n.read(e)))};case l.PCS:return{type:l.PCS,segment:j.from(new b(n.read(e)))};case l.WDS:return{type:l.WDS,segment:L.from(new b(n.read(e)))};case l.END:return{type:l.END};default:throw new w(`Unrecognized SegmentType: ${t}`)}},async fromAsync(n){const t=await n.readU8(),e=await n.readU16();if(!await n.exists(e))throw new h("Insufficient SegmentLength!");switch(t){case l.PDS:return{type:l.PDS,segment:N.from(new b(await n.read(e)))};case l.ODS:return{type:l.ODS,segment:V.from(new b(await n.read(e)))};case l.PCS:return{type:l.PCS,segment:j.from(new b(await n.read(e)))};case l.WDS:return{type:l.WDS,segment:L.from(new b(await n.read(e)))};case l.END:return{type:l.END};default:throw new w(`Unrecognized SegmentType: ${t}`)}}},k={SUP:13,MPEGTS:5},Y={fromSUPFormat(n){if(n.readU16()!==20551)throw new w("Magic Number not Found!");const e=n.readU32(),i=n.readU32();return{...R.from(n),pts:e,dts:i,timescale:9e4}},async fromSUPFormatAsync(n){if(await n.readU16()!==20551)throw new w("Magic Number not Found!");const e=await n.readU32(),i=await n.readU32();return{...await R.fromAsync(n),pts:e,dts:i,timescale:9e4}},fromMpegTSFormat(n,t,e,i=9e4){return{...R.from(n),pts:t,dts:e,timescale:i}},async fromMpegTSFormatAsync(n,t,e,i=9e4){return{...await R.fromAsync(n),pts:t,dts:e,timescale:i}},*iterateSupFormat(n){const t=new b(n);for(;!t.isEmpty();)yield this.fromSUPFormat(t)},async*iterateSupFormatAsync(n){const t=new E(n);for(;await t.exists(k.SUP);)yield this.fromSUPFormatAsync(t)},*iterateMpegTSFormat(n,t,e,i=9e4){const s=new b(n);for(;!s.isEmpty();)yield this.fromMpegTSFormat(s,t,e,i)},async*iterateMpegTSFormatAsync(n,t,e,i=9e4){const s=new E(n);for(;await s.exists(k.MPEGTS);)yield this.fromMpegTSFormatAsync(s,t,e,i)}},Z={isAcquisitionPoint(n){return n.compositionState===W.EpochStart||n.compositionState===W.AcquisitionPoint},from(n){const t=n.filter(o=>o.type===l.PCS);if(t.length===0)throw new w("PCS not Found!");if(t.length>=2)throw new w("Duplicated PCS in DisplaySet!");const e=t[0],i=n.filter(o=>o.type===l.PDS).find(o=>o.segment.paletteID===e.segment.paletteId),s=n.filter(o=>o.type===l.WDS)[0],r=n.filter(o=>o.type===l.ODS);if(e.segment.compositionState==W.Normal)return{pts:e.pts,timescale:e.timescale,compositionState:e.segment.compositionState,PCS:e.segment,PDS:i==null?void 0:i.segment,WDS:s==null?void 0:s.segment,ODS:r.map(o=>o.segment)};if(i==null)throw new w("PDS not Found!");return{pts:e.pts,timescale:e.timescale,compositionState:e.segment.compositionState,PCS:e.segment,PDS:i.segment,WDS:s.segment,ODS:r.map(o=>o.segment)}},merge(n,t){return{pts:t.pts,timescale:t.timescale,compositionState:n.compositionState,PCS:t.PCS,PDS:t.PDS??n.PDS,WDS:t.WDS??n.WDS,ODS:t.ODS??n.ODS}},*aggregate(n){let t=null;for(const e of n)e.type===l.PCS&&(t=[]),t!=null&&(e.type!==l.END?t.push(e):(yield this.from(t),t=null));t!=null&&(yield this.from(t))},async*aggregateAsync(n){let t=null;for await(const e of n)e.type===l.PCS&&(t=[]),t!=null&&(e.type!==l.END?t.push(e):(yield this.from(t),t=null));t!=null&&(yield this.from(t))}},m={from(n,t=!1){const e=n.PCS,i=n.PDS;if(e.compositionObjects.length===0)return{pts:n.pts,timescale:n.timescale,compositionState:n.compositionState,composition:e,palette:i,windows:new Map,objects:new Map};const s=L.valueOf([n.WDS]),r=t?U.valueOf(i,n.ODS):V.valueOf(n.ODS);return{pts:n.pts,timescale:n.timescale,compositionState:n.compositionState,composition:e,palette:i,windows:s,objects:r}},*iterate(n,t=!1){let e=null;for(const i of n)Z.isAcquisitionPoint(i)&&(e=i),e!=null&&(yield m.from(Z.merge(e,i),t))},async*iterateAsync(n,t=!1){let e=null;for await(const i of n)Z.isAcquisitionPoint(i)&&(e=i),e!=null&&(yield m.from(Z.merge(e,i),t))}},tt=(n,t)=>{if(t==null)return null;if(!Array.isArray(t))return new ImageData(t.rgba,t.width,t.height);const e=U.from(n,t);return e==null?null:new ImageData(e.rgba,e.width,e.height)},I=(n,t)=>{if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(n,t);if(typeof document<"u"){const e=document.createElement("canvas");return e.width=n,e.height=t,e}return null},et=(n,t)=>{if(typeof document<"u"){const e=document.createElement("canvas");return e.width=n,e.height=t,e}return typeof OffscreenCanvas<"u"?new OffscreenCanvas(n,t):null},z=(n,t)=>{const{composition:e,palette:i,objects:s,windows:r}=n;for(const o of e.compositionObjects){const d=s.get(o.objectId),f=r.get(o.windowId);if(d==null||f==null)continue;const u=tt(i,d);if(u==null)continue;t.save();const p=new Path2D;p.rect(f.windowHorizontalPosition,f.windowVerticalPosition,f.windowWidth,f.windowHeight),t.clip(p);const X=o.objectHorizontalPosition,g=o.objectVerticalPosition;if(o.objectCroppedFlag){const D=o.objectCroppingHorizontalPosition,y=o.objectCroppingVerticalPosition,O=o.objectCroppingWidth,$=o.objectCroppingHeight;t.putImageData(u,X,g,D,y,O,$)}else t.putImageData(u,X,g);t.restore()}},S={from(n){return{type:"none",...n}},*iterate(n){for(const t of n){const e=S.from(t);if(e==null)return;yield e}},async*iterateAsync(n){for await(const t of n){const e=S.from(t);if(e==null)return;yield e}}},C={from(n){const{composition:t}=n,{width:e,height:i}=t;if(typeof OffscreenCanvas>"u")return null;const s=new OffscreenCanvas(e,i);if(!s)return null;const r=s.getContext("2d");return r?(z(n,r),{type:"bitmap",pts:n.pts,timescale:n.timescale,bitmap:s.transferToImageBitmap()}):null},async fromAsync(n,t=I){const{composition:e}=n,{width:i,height:s}=e,r=t(i,s);if(!r)return null;const o=r.getContext("2d");return o?(z(n,o),{type:"bitmap",pts:n.pts,timescale:n.timescale,bitmap:await createImageBitmap(r)}):null},*iterate(n){for(const t of n){const e=C.from(t);if(e==null)return;yield e}},async*iterateAsync(n,t=I){for await(const e of n){const i=await C.fromAsync(e,t);if(i==null)return;yield i}}},nt={from(n,t=I){const{composition:e}=n,{width:i,height:s}=e,r=t(i,s);if(!r)return null;const o=r.getContext("2d");return o?(z(n,o),{type:"canvas",pts:n.pts,timescale:n.timescale,canvas:r}):null}};let it=class{constructor(t,e){a(this,"option");a(this,"acquisitions");this.option={preload:"none",timeshift:0,...e};const i=Z.aggregate(Y.iterateSupFormat(t));switch(this.option.preload){case"decode":this.acquisitions=Array.from(S.iterate(m.iterate(i,!0)));break;case"render":this.acquisitions=Array.from(C.iterate(m.iterate(i,!0)));break;case"none":default:this.acquisitions=Array.from(S.iterate(m.iterate(i,!1)));break}}content(t){t-=this.option.timeshift;{const s=this.acquisitions[0];if(!s)return null;const r=s.pts/s.timescale;if(t<r)return null}let e=0,i=this.acquisitions.length;for(;e+1<i;){const s=Math.floor((e+i)/2),r=this.acquisitions[s];r.pts/r.timescale<=t?e=s:i=s}return this.acquisitions[e]??null}onattach(){}ondetach(){}onseek(){}};class st{constructor(t,e){a(this,"option");a(this,"acquisitions",[]);a(this,"donePromise");this.option={preload:"none",timeshift:0,...e},this.donePromise=new Promise(i=>{this.prepare(t,i)})}async prepare(t,e){const i=Z.aggregateAsync(Y.iterateSupFormatAsync(t));switch(this.option.preload){case"decode":for await(const s of S.iterateAsync(m.iterateAsync(i,!0)))this.acquisitions.push(s);break;case"render":for await(const s of C.iterateAsync(m.iterateAsync(i,!0)))this.acquisitions.push(s);break;case"none":default:for await(const s of S.iterateAsync(m.iterateAsync(i,!1)))this.acquisitions.push(s);break}e==null||e(!0)}get done(){return this.donePromise}content(t){t-=this.option.timeshift;{const s=this.acquisitions[0];if(!s)return null;const r=s.pts/s.timescale;if(t<r)return null}let e=0,i=this.acquisitions.length;for(;e+1<i;){const s=Math.floor((e+i)/2),r=this.acquisitions[s];r.pts/r.timescale<=t?e=s:i=s}return this.acquisitions[e]??null}onattach(){}ondetach(){}onseek(){}}const rt=new Map([[l.PCS,0],[l.PDS,1],[l.ODS,2],[l.WDS,3],[l.END,4]]),F=(n,t)=>Math.sign(n-t),ot=(n,t)=>F(n.dts,t.dts)!==0?F(n.dts,t.dts):F(n.order??-1,t.order??-1);class at{constructor(t){a(this,"option");a(this,"priviousTime",null);a(this,"decode",new T(ot));a(this,"decodeBuffer",[]);a(this,"decodingPromise");a(this,"decodingNotify",Promise.resolve);a(this,"abortController",new AbortController);a(this,"present",new T(F));a(this,"isDestroyed",!1);this.option={preload:"none",timeshift:0,...t},this.decodingPromise=new Promise(e=>{this.decodingNotify=e}),this.pump()}notify(t){var e;t!=null?this.decodeBuffer.push(t):(this.abortController.abort(),this.abortController=new AbortController),(e=this.decodingNotify)==null||e.call(this)}async*generator(t){for(;;){if(await this.decodingPromise,this.decodingPromise=new Promise(i=>{this.decodingNotify=i}),t.aborted){this.decodeBuffer=[];return}const e=[...this.decodeBuffer];this.decodeBuffer=[],yield*e}}async pump(){for(;!this.isDestroyed;){const t=Z.aggregateAsync(this.generator(this.abortController.signal));switch(this.option.preload){case"decode":for await(const e of S.iterateAsync(m.iterateAsync(t,!0)))this.present.insert(e.pts/e.timescale,e);break;case"render":for await(const e of C.iterateAsync(m.iterateAsync(t,!0)))this.present.insert(e.pts/e.timescale,e);break;case"none":default:for await(const e of S.iterateAsync(m.iterateAsync(t,!1)))this.present.insert(e.pts/e.timescale,e);break}}}feed(t,e,i,s){for(const r of Y.iterateMpegTSFormat(t,e,i,s))this.decode.insert({dts:r.dts/r.timescale,order:rt.get(r.type)},r)}content(t){if(this.priviousTime!=null)for(const e of this.decode.range({dts:this.priviousTime},{dts:t}))this.notify(e);return this.priviousTime=t,t-=this.option.timeshift,this.present.floor(t)??null}clear(){this.present.clear(),this.priviousTime=null,this.notify(null)}onattach(){this.clear()}ondetach(){this.clear()}onseek(){this.clear()}destroy(){this.isDestroyed=!0,this.clear()}}const J={from(n){return{preferHTMLCanvasElement:!1,webWorker:!1,...n}}};class B{constructor(t){a(this,"option");a(this,"canvas",null);this.option=J.from(t)}attach(t){this.canvas=t}snapshot(){return this.canvas}register(t){this.canvas!=null&&this.canvas instanceof HTMLCanvasElement&&t.appendChild(this.canvas)}unregister(){this.canvas!=null&&this.canvas instanceof HTMLCanvasElement&&this.canvas.remove()}detach(){this.canvas=null}resize(t,e){this.canvas!=null&&(this.canvas.width=t,this.canvas.height=e)}getContext2D(){return this.canvas==null?null:this.canvas.getContext("2d")}clear(){if(this.canvas==null)return;const t=this.getContext2D();t&&t.clearRect(0,0,this.canvas.width,this.canvas.height)}destroy(){this.unregister(),this.resize(0,0),this.detach()}}class A extends B{constructor(t){super(t)}draw(t){if(this.canvas==null)return;const e=this.getContext2D();e&&((this.canvas.width!==t.width||this.canvas.height!==t.width)&&(this.canvas.width=t.width,this.canvas.height=t.height),this.clear(),e.drawImage(t,0,0,this.canvas.width,this.canvas.height))}render(t){switch(t.type){case"none":{const e=nt.from(t,this.option.preferHTMLCanvasElement?et:I);e&&(this.draw(e.canvas),e.canvas.width=e.canvas.height=0);break}case"bitmap":this.draw(t.bitmap);break;case"canvas":this.draw(t.canvas);break;default:{const e=t;throw new Error(`Exhaustive check: ${e} reached!`)}}}}const ct={from(n){return{type:"render",pgs:n}}},Q="dmFyIEw9T2JqZWN0LmRlZmluZVByb3BlcnR5O3ZhciBDPShkLGEsaCk9PmEgaW4gZD9MKGQsYSx7ZW51bWVyYWJsZTohMCxjb25maWd1cmFibGU6ITAsd3JpdGFibGU6ITAsdmFsdWU6aH0pOmRbYV09aDt2YXIgdj0oZCxhLGgpPT5DKGQsdHlwZW9mIGEhPSJzeW1ib2wiP2ErIiI6YSxoKTsoZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7dmFyIGQ9KC4uLnQpPT57aWYoIXQpcmV0dXJuIG5ldyBBcnJheUJ1ZmZlcigwKTtjb25zdCBlPXQucmVkdWNlKChzLHIpPT5zK3IuYnl0ZUxlbmd0aCwwKSxuPW5ldyBVaW50OEFycmF5KGUpO2ZvcihsZXQgcz0wLHI9MDtzPHQub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W5kZXIiOntjb25zdHtwZ3M6ZX09dC5kYXRhLG49Yi5mcm9tKGUpO2lmKCFuKXtzZWxmLnBvc3RNZXNzYWdlKFMuZnJvbSgpKTtyZXR1cm59Y29uc3R7Yml0bWFwOnN9PW47c2VsZi5wb3N0TWVzc2FnZShTLmZyb20ocyksW3NdKTticmVha31kZWZhdWx0Ontjb25zdCBlPXQuZGF0YS50eXBlO3Rocm93IG5ldyBFcnJvcihgRXhoYXVzdGl2ZSBjaGVjazogJHtlfSByZWFjaGVkIWApfX19KX0pKCk7Cg==",lt=n=>Uint8Array.from(atob(n),t=>t.charCodeAt(0)),q=typeof self<"u"&&self.Blob&&new Blob([lt(Q)],{type:"text/javascript;charset=utf-8"});function ht(n){let t;try{if(t=q&&(self.URL||self.webkitURL).createObjectURL(q),!t)throw"";const e=new Worker(t,{name:n==null?void 0:n.name});return e.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),e}catch{return new Worker("data:text/javascript;base64,"+Q,{name:n==null?void 0:n.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}class dt extends B{constructor(e){super(e);a(this,"worker");a(this,"renderedHandler",this.rendered.bind(this));this.worker=new ht,this.worker.addEventListener("message",this.renderedHandler)}render(e){switch(e.type){case"none":this.worker.postMessage(ct.from(e));break;case"bitmap":this.draw(e.bitmap);break;case"canvas":this.draw(e.canvas);break;default:{const i=e;throw new Error(`Exhaustive check: ${i} reached!`)}}}draw(e){if(this.canvas==null)return;const i=this.getContext2D();i&&((this.canvas.width!==e.width||this.canvas.height!==e.width)&&(this.canvas.width=e.width,this.canvas.height=e.height),this.clear(),i.drawImage(e,0,0,this.canvas.width,this.canvas.height))}rendered(e){switch(e.data.type){case"rendered":{const{bitmap:i}=e.data;if(i==null){this.clear();return}this.draw(i),i.close();break}default:{const i=e.data.type;throw new Error(`Exhaustive check: ${i} reached!`)}}}destroy(){super.destroy(),this.worker.terminate()}}const ut=n=>n.webWorker?new dt(n):new A(n);class ft{constructor(t){a(this,"option");a(this,"media",null);a(this,"container",null);a(this,"onTimeupdateHandler",this.onTimeupdate.bind(this));a(this,"timer",null);a(this,"onSeekingHandler",this.onSeeking.bind(this));a(this,"onSeekedHandler",this.onSeeked.bind(this));a(this,"renderer",null);a(this,"priviousPts",null);a(this,"feeder",null);a(this,"isShowing",!0);this.option={...t,renderOption:J.from(t==null?void 0:t.renderOption)}}attachMedia(t,e){this.media=t,this.container=e??t.parentElement,this.setup()}detachMedia(){this.cleanup(),this.media=this.container=null}setup(){if(!this.media||!this.container)return;this.media.addEventListener("seeking",this.onSeekingHandler),this.media.addEventListener("seeked",this.onSeekedHandler);const t=document.createElement("canvas");t.style.position="absolute",t.style.top=t.style.left="0",t.style.pointerEvents="none",t.style.width="100%",t.style.height="100%",t.style.objectFit="contain",this.renderer=ut(this.option.renderOption),this.renderer.attach(t),this.renderer.register(this.container),this.onTimeupdate()}cleanup(){var t;this.media&&(this.media.removeEventListener("seeking",this.onSeekingHandler),this.media.removeEventListener("seeked",this.onSeekedHandler)),(t=this.renderer)==null||t.destroy()}clear(){var t;(t=this.renderer)==null||t.clear(),this.priviousPts=null}attachFeeder(t){this.feeder=t,this.feeder.onattach(),this.clear()}detachFeeder(){var t;(t=this.feeder)==null||t.ondetach(),this.feeder=null,this.clear()}onSeeking(){var t;(t=this.feeder)==null||t.onseek(),this.clear()}onSeeked(){this.clear()}onTimeupdate(){var i;if(!this.isShowing||(this.timer=requestAnimationFrame(this.onTimeupdateHandler),this.media==null||this.feeder==null))return;const t=this.media.currentTime,e=this.feeder.content(t)??null;e!=null&&this.priviousPts!==e.pts&&((i=this.renderer)==null||i.render(e),this.priviousPts=e.pts)}show(){this.isShowing=!0,this.timer==null&&(this.timer=requestAnimationFrame(this.onTimeupdateHandler)),this.onTimeupdate()}hide(){this.isShowing=!1,this.timer!=null&&(cancelAnimationFrame(this.timer),this.timer=null),this.clear()}showing(){return this.isShowing}snapshot(){var t;return((t=this.renderer)==null?void 0:t.snapshot())??null}}const mt=(n,t=!1)=>Array.from(m.iterate(Z.aggregate(Y.iterateSupFormat(n)),t));c.AVLTree=T,c.AcquisitionPoint=m,c.CompositionObject=K,c.CompositionState=W,c.DecodedObjectDefinitionSegment=U,c.DisplaySet=Z,c.EOFError=h,c.HeaderLengthByFormat=k,c.ObjectDefinitionSegment=V,c.PGSAsyncSupFeeder=st,c.PGSController=ft,c.PGSMainThreadRenderer=A,c.PGSMpegTSFeeder=at,c.PGSSupFeeder=it,c.PaletteDefinitionSegment=N,c.PaletteEntry=M,c.PresentationCompositionSegment=j,c.Segment=R,c.SegmentType=l,c.SequenceFlag=v,c.TimestampedSegment=Y,c.WindowDefinition=H,c.WindowDefinitionSegment=L,c.readSup=mt,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});