@castlabs/prestoplay 6.4.0 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +57 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +6 -6
- package/cjs/cl.cast.js +110 -110
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +421 -402
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +72 -72
- package/cjs/cl.externs.js +54 -133
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +47 -49
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +31 -32
- package/cjs/cl.ima.js +22 -22
- package/cjs/cl.mse.js +258 -255
- package/cjs/cl.muxdata.js +12 -12
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.smooth.js +69 -69
- package/cjs/cl.thumbnails.js +24 -24
- package/cjs/cl.tizen.js +71 -71
- package/cjs/cl.ttml.js +27 -27
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +19 -18
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +20 -20
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +88 -88
- package/cl.conviva.js +27 -27
- package/cl.core.js +363 -351
- package/cl.crypto.js +8 -8
- package/cl.dash.js +67 -67
- package/cl.externs.js +49 -132
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +40 -40
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +25 -25
- package/cl.ima.js +16 -16
- package/cl.mse.js +230 -231
- package/cl.muxdata.js +8 -8
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +9 -9
- package/cl.playlist.js +5 -5
- package/cl.smooth.js +58 -58
- package/cl.thumbnails.js +17 -17
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +15 -14
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +15 -16
- package/package.json +8 -2
package/cl.freewheel.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
if(b.length)throw new _.
|
|
3
|
-
tv.freewheel.SDK.EVENT_SLOT_ENDED,a.
|
|
4
|
-
a.l.isMuted()?a.setVolume(0):a.setVolume(a.l.getVolume()||1))},
|
|
5
|
-
!0),a.getSurface().hide(this.a);else a.onError(new _.
|
|
6
|
-
0}getSkipTimeOffset(){return 0}
|
|
7
|
-
case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;default:return 1}}getPodIndex(){switch(this.
|
|
8
|
-
W.prototype.getWrapperCreativeIds=W.prototype.getWrapperCreativeIds;W.prototype.getWrapperAdSystems=W.prototype.getWrapperAdSystems;W.prototype.getWrapperAdIds=W.prototype.getWrapperAdIds;W.prototype.getSequenceLength=W.prototype.
|
|
9
|
-
W.prototype.getMediaWidth=W.prototype.
|
|
10
|
-
W.prototype.getCreativeId=W.prototype.getCreativeId;W.prototype.getId=W.prototype.getId;W.prototype.getTechnology=W.prototype.
|
|
11
|
-
|
|
12
|
-
_.p||a.a.setSiteSection(b.siteSectionId);const c=yield
|
|
13
|
-
if(Array.isArray(b.parameters))for(const d of b.parameters)a.a.setParameter(d.name,d.value,d.level);
|
|
14
|
-
a.h&&(a.h.stop(),a.h=null);
|
|
15
|
-
9,10003,{errorType:0},void 0));this.j.resolve()}
|
|
16
|
-
_.
|
|
17
|
-
_.
|
|
18
|
-
.5>Math.abs(a-b.getTimePosition()))||null){const b=this.m.findIndex(c=>c===this.f);this.m.splice(b,1);this.l.pause();
|
|
19
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var xI="clpp-freewheel",yI="clpp.freewheel.AdsManagerFactory",zI="freewheel",AI=function(a){switch(a){case 0:return tv.freewheel.SDK.ADUNIT_PREROLL;case 1:return tv.freewheel.SDK.ADUNIT_MIDROLL;case 2:return tv.freewheel.SDK.ADUNIT_POSTROLL;default:return""}},BI=function(a){const b=[];typeof a.networkId!==_.p&&b.push("networkId");typeof a.serverUrl!==_.me&&b.push("serverUrl");typeof a.profileId!==_.me&&b.push("profileId");typeof a.videoAssetId!==_.me&&typeof a.videoAssetId!==_.p&&b.push("videoAssetId");
|
|
2
|
+
if(b.length)throw new _.H(1,9,12001,{missingKeys:b.join(", ")});},CI=function(){return _.w(function*(){var a=new _.Xp;let b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE;const c=yield a.canPlay(!1);a=yield a.canPlay(!0);c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:a&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return b})},DI=function(a){a.g.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.I.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.K.bind(a));a.g.on(a.a,
|
|
3
|
+
tv.freewheel.SDK.EVENT_SLOT_ENDED,a.J.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_AD,a.G.bind(a));a.g.on(a.l,_.ue,a.F.bind(a));a.g.on(a.l,_.je,a.C.bind(a))},GI=function(a){return _.w(function*(){a.A.length?(EI(a),a.f=a.A.shift(),a.f.play()):(FI(a),yield a.l.a.play())})},FI=function(a){const b=a.l.Vb(zI).nc();b&&a.l.getSurface().hide(b);a.l.getSurface().showMediaElement()},EI=function(a){const b=a.l.Vb(zI).nc();b&&(a.l.getSurface().show(b),a.l.getSurface().hideMediaElement(),a.a.registerVideoDisplayBase(xI),
|
|
4
|
+
a.l.isMuted()?a.setVolume(0):a.setVolume(a.l.getVolume()||1))},HI=function(a){a.w.length?(EI(a),a.f=a.w.shift(),a.f.play()):FI(a)},II=function(a,b,c){var d=null;a.a&&c&&(c.adInstance||c.slot)&&(c=(d=c.adInstance||null)?d.getSlot():c.slot,d={ad:new W(a.a,c,d)});a.l.trigger(new _.C(b,d))},JI=class extends _.bq{constructor(){super();this.f=this.a=null}onPlayerCreated(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.gm(_.Nc,{id:xI}),this.f=_.gm(_.v,{"class":_.vc}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,
|
|
5
|
+
!0),a.getSurface().hide(this.a);else a.onError(new _.H(1,9,12E3))}onPlayerWillDestroy(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)}id(){return zI}nc(){return this.a}qf(){return this.f}};_.x("clpp.freewheel.FreeWheelPlugin",JI);JI.prototype.getAdVideo=JI.prototype.qf;JI.prototype.getAdContainer=JI.prototype.nc;JI.Id=zI;JI.AD_CONTAINER_ID=xI;_.Nm(new class{create(){return new JI}});var W=class{constructor(a,b,c){this.g=a;this.f=b;this.a=c}nb(){return"FreeWheel AdManager SDK"}ob(){return tv.freewheel.SDK.version}tb(){return 0}getId(){return this.a?this.a.getAdId():""}getCreativeId(){const a=(this.a||{})._creativeId;return typeof a===_.me?a:""}getApiFramework(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return""}getDuration(){return this.a?this.a.getActiveCreativeRendition().getDuration():
|
|
6
|
+
0}getSkipTimeOffset(){return 0}Zb(){return!1}Eb(){return this.a&&this.a.getEventCallbackUrls(tv.freewheel.SDK.EVENT_AD_CLICK,tv.freewheel.SDK.EVENT_TYPE_CLICK)[0]||""}getMediaUrl(){return this.a?this.a.getActiveCreativeRendition().getPrimaryCreativeRenditionAsset().getUrl():""}qb(){return this.a?this.a.getActiveCreativeRendition().getWidth():0}pb(){return this.a?this.a.getActiveCreativeRendition().getHeight():0}eb(){return 0}Pa(){switch(this.f.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;
|
|
7
|
+
case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;default:return 1}}getPodIndex(){switch(this.Pa()){case 0:return 0;case 2:return-1}return this.g.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1}Fb(){switch(this.Pa()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}}Gb(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1}sb(){return this.f.getAdCount()}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};
|
|
8
|
+
W.prototype.getWrapperCreativeIds=W.prototype.getWrapperCreativeIds;W.prototype.getWrapperAdSystems=W.prototype.getWrapperAdSystems;W.prototype.getWrapperAdIds=W.prototype.getWrapperAdIds;W.prototype.getSequenceLength=W.prototype.sb;W.prototype.getPositionInSequence=W.prototype.Gb;W.prototype.getPodTimeOffset=W.prototype.Fb;W.prototype.getPodIndex=W.prototype.getPodIndex;W.prototype.getPodType=W.prototype.Pa;W.prototype.getMediaBitrate=W.prototype.eb;W.prototype.getMediaHeight=W.prototype.pb;
|
|
9
|
+
W.prototype.getMediaWidth=W.prototype.qb;W.prototype.getMediaUrl=W.prototype.getMediaUrl;W.prototype.getClickThroughUrl=W.prototype.Eb;W.prototype.isBumper=W.prototype.Zb;W.prototype.getSkipTimeOffset=W.prototype.getSkipTimeOffset;W.prototype.getDuration=W.prototype.getDuration;W.prototype.getTitle=W.prototype.getTitle;W.prototype.getAdvertiserName=W.prototype.getAdvertiserName;W.prototype.getAdSystem=W.prototype.getAdSystem;W.prototype.getApiFramework=W.prototype.getApiFramework;
|
|
10
|
+
W.prototype.getCreativeId=W.prototype.getCreativeId;W.prototype.getId=W.prototype.getId;W.prototype.getTechnology=W.prototype.tb;W.prototype.getAdManagerVersion=W.prototype.ob;W.prototype.getAdManagerName=W.prototype.nb;var KI=class{constructor(a){this.a=a}getCuePoints(){return this.a.getTemporalSlots().map(a=>{switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return-1;default:return a.getTimePosition()}})}Hb(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length}fb(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length}};
|
|
11
|
+
KI.prototype.hasPostroll=KI.prototype.fb;KI.prototype.hasPreroll=KI.prototype.Hb;KI.prototype.getCuePoints=KI.prototype.getCuePoints;var LI=class{constructor(a){this.B=new _.O("clpp.freewheel.AdsManager");this.l=a;this.g=new _.po;this.o=new tv.freewheel.SDK.AdManager;this.f=this.a=null;this.A=[];this.m=[];this.w=[];this.j=new _.Sk;this.h=null}load(){const a=this;return _.w(function*(){const b=a.l.getConfiguration().freewheel||{};try{BI(b)}catch(d){return a.l.onError(d),a.j.resolve(),a.j}a.o.setNetwork(b.networkId);a.o.setServer(b.serverUrl);a.a=a.o.newContext();a.a.setProfile(b.profileId);typeof b.siteSectionId!==_.me&&typeof b.siteSectionId!==
|
|
12
|
+
_.p||a.a.setSiteSection(b.siteSectionId);const c=yield CI();a.a.setVideoAsset(b.videoAssetId,a.l.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(const d of b.pods)a.a.addTemporalSlot(d.id,AI(d.type),d.position,d.slotProfile,d.cuepointSequence,d.maxDuration,d.minDuration,d.acceptContentType);b.keyValues&&typeof b.keyValues===_.Bd&&Object.keys(b.keyValues).forEach(d=>a.a.addKeyValue(d,b.keyValues[d]));a.a.setParameter(tv.freewheel.SDK.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED,!1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);
|
|
13
|
+
if(Array.isArray(b.parameters))for(const d of b.parameters)a.a.setParameter(d.name,d.value,d.level);DI(a);a.a.submitRequest();return a.j})}start(){const a=this;return _.w(function*(){yield GI(a)})}resume(){this.f&&this.f.resume()}pause(){this.f&&this.f.pause()}skip(){this.f&&this.f.skipCurrentAd()}getVolume(){return this.a?this.a.getAdVolume():1}setVolume(a){this.a&&this.a.setAdVolume(a)}getPosition(){return this.f?this.f.getPlayheadTime():-1}dispose(){const a=this;return _.w(function*(){a.g.release();
|
|
14
|
+
a.h&&(a.h.stop(),a.h=null);FI(a);a.a&&(a.a.dispose(),a.a=null)})}I(a){if(a.success)this.A=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL),this.m=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.w=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.l.trigger(new _.C(_.Lb,{adsTimeline:new KI(this.a)})),this.h=new _.Vp(this.l.getSurface(),(b,c)=>this.a.resize(b,c),this.l.Vb(zI).f);else this.l.onError(new _.H(1,
|
|
15
|
+
9,10003,{errorType:0},void 0));this.j.resolve()}K(a){II(this,_.ub,a);this.h.start()}J(a){this.f=null;a=a.slot;II(this,_.vb);this.h.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:GI(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:FI(this);this.l.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:HI(this)}}G(a){const b=a.subType;this.B.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:II(this,_.Hb,a);II(this,
|
|
16
|
+
_.Ab,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:II(this,_.Ib,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:II(this,_.zb,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:II(this,_.Cb,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:II(this,_.Jb,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:II(this,_.yb,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:II(this,_.xb,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:II(this,_.Db,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:II(this,
|
|
17
|
+
_.Fb,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:II(this,_.Gb,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:II(this,_.wb,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:II(this,_.Eb,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.l.onError(new _.H(1,9,10003,{errorType:1},{fwCode:a[tv.freewheel.SDK.INFO_KEY_ERROR_CODE],fwInfo:a[tv.freewheel.SDK.INFO_KEY_ERROR_INFO],fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}}F(){if(!this.f){var a=this.l.getPosition();if(this.f=this.m.find(b=>
|
|
18
|
+
.5>Math.abs(a-b.getTimePosition()))||null){const b=this.m.findIndex(c=>c===this.f);this.m.splice(b,1);this.l.pause();EI(this);this.f.play()}}}C(a){if((a=a.detail)&&this.a)switch(a.currentState){case _.Nl:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case _.Ml:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case _.Cl:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);HI(this);break;case _.Kl:case _.Jl:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}}};
|
|
19
|
+
LI.prototype.getPosition=LI.prototype.getPosition;LI.prototype.setVolume=LI.prototype.setVolume;LI.prototype.getVolume=LI.prototype.getVolume;LI.prototype.skip=LI.prototype.skip;LI.prototype.pause=LI.prototype.pause;LI.prototype.resume=LI.prototype.resume;LI.prototype.start=LI.prototype.start;var MI=class{constructor(){this.a=new _.O(yI)}name(){return yI}ba(a,b){return a.namespace()===_.xc?!1:window.tv&&tv.freewheel&&tv.freewheel.SDK?!(!b||!b.freewheel):(this.a.warn("FreeWheel SDK is not loaded."),!1)}create(a){return new LI(a)}};MI.prototype.create=MI.prototype.create;MI.prototype.isSupported=MI.prototype.ba;MI.prototype.name=MI.prototype.name;_.dm(new MI);};f.call(g, window);
|
package/cl.hls.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
b.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
d
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Ez="CLOSED-CAPTIONS",Fz="EXT-X-BYTERANGE",Gz="EXT-X-DISCONTINUITY",Hz="EXT-X-DISCONTINUITY-SEQUENCE",Iz="EXT-X-ENDLIST",Jz="EXT-X-MEDIA-SEQUENCE",Kz="EXT-X-PART-INF",Lz="EXT-X-PLAYLIST-TYPE",Mz="EXT-X-PRELOAD-HINT",Nz="EXT-X-SERVER-CONTROL",Oz="EXT-X-STREAM-INF",Pz="EXT-X-TARGETDURATION",Qz="EXTINF",Rz="GROUP-ID",Sz="Guessing audio-only",Tz="SAMPLE-AES-CTR",Uz="SUBTITLES",Vz="application/vnd.apple.mpegurl",Wz=function(a,b){a=a.getAttribute(b);if(!a)throw new _.H(_.F,4,4023,b);return a.value},
|
|
2
|
+
Xz=function(a){if(1>a.a)throw _.sj();--a.a},Yz=function(a,b){return a.filter(c=>c.name==b)},Zz=function(a,b){return a.filter(c=>Wz(c,"TYPE")===b)},$z=function(a,b){a=Yz(a,b);return a.length?a[0]:null},aA=function(a,b){return _.ou([a],[b])[0]},bA=function(a,b){return _.Tg(a.a++,b)},fA=function(a,b,c,d){const e=[];let f=[],g=[];c.forEach(h=>{/^(#EXT)/.test(h)?(h=bA(a,h),cA.includes(h.name)?d.push(h):dA.includes(h.name)?"EXT-X-PART"===h.name?g.push(h):h.name===Mz&&"PART"===_.ng(h,"TYPE")&&g.push(h):
|
|
3
|
+
f.push(h)):/^#(?!EXT)/m.test(h)||(h=aA(b,h.trim()),e.push(new eA(h,f,g)),f=[],g=[])});g.length&&e.push(new eA(null,f,g));return e},iA=function(a,b,c){b=_.Ag(b);b=b.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n").trim();const d=b.split(/\n+/m);if(!/^#EXTM3U($|[ \t\n])/m.test(d[0]))throw new _.H(_.F,4,4015);b=0;let e=!0;for(var f of d)if(f=f.trim(),!f.length||/^#(?!EXT)/m.test(f)||e)e=!1;else{var g=bA(a,f);--a.a;if(cA.includes(g.name)){b=1;break}else g.name==Oz&&(e=!0)}f=[];e=!0;for(var h of _.qu(d)){let {Wc:k,
|
|
4
|
+
item:l,next:m}=h;l=l.trim();if(!l.length||/^#(?!EXT)/m.test(l)||e)e=!1;else{g=bA(a,l);if(gA.includes(g.name)){if(1!=b)throw new _.H(_.F,4,4017);h=d.splice(k,d.length-k);a=fA(a,c,h,f);return new hA(c,b,f,a)}f.push(g);g.name==Oz&&(g.attributes.push(new _.Pg(_.lb,m)),e=!0)}}return new hA(c,b,f)},jA=function(a,b=0){return b+10<=a.length&&73===a[b]&&68===a[b+1]&&51===a[b+2]&&255>a[b+3]&&255>a[b+4]&&128>a[b+6]&&128>a[b+7]&&128>a[b+8]&&128>a[b+9]?!0:!1},kA=function(a){var b=Wz(a,"METHOD");const c=["SAMPLE-AES",
|
|
5
|
+
Tz];if(!c.includes(b))return _.Jf("PlayReady in HLS is only supported with [",c.join(", "),"], not",b),null;a=Wz(a,_.lb);b=_.ao(a);a=null;b=_.G(b.data);try{a=_.fu(_.xk(b))}catch(d){a=b}return _.pu(_.Gc,[{initDataType:_.qc,initData:a}],"")},mA=function(a,b){b=_.Yg([b],a.g.attemptParameters);b.type=1;return lA(a,b)},sA=function(a,b){return _.w(function*(){var c=iA(a.M,b,a.A);if(1===c.type){a.G.set(a.A,c);c=(new _.ag(c.a[0].a)).pa.split(".").pop();var d=nA.audio[c],e="";nA.video[c]?e="avc1.42E01E":d&&
|
|
6
|
+
(e="mp4a.40.2");{c=a.M;d=a.A;e=a.g.hlsDefaultCodecs||e;var f=[];const h=[];h.push(new _.Pg(_.ja,"0"));h.push(new _.Pg(_.lb,d));e.length&&h.push(new _.Pg(_.la,e));f.push(new _.Sg(c.a++,Oz,h));c=new hA(d,0,f)}}c=yield oA(a,c.ta);if(!a.D)throw new _.H(_.F,7,7001);a.D.filterAllPeriods([c]);e=Infinity;d=0;f=Infinity;for(var g of a.f.values())e=Math.min(e,g.Fd),d=Math.max(d,g.Fd),g.stream.type!=_.r&&(f=Math.min(f,g.duration));a.j!=pA?(a.h=new _.tz(0,a.T,!1),_.Mu(a.h,1)):a.h=new _.tz(null,0,!0);qA(a);if(a.j!=
|
|
7
|
+
pA){a.W=a.F;a.j===rA&&(g=Math.max(f,a.h.Od),isNaN(a.g.availabilityWindowOverride)||(g=a.g.availabilityWindowOverride),a.h.ac=g);for(g=0;95443.7176888889<=d;)g+=95443.7176888889,d-=95443.7176888889;if(g){a.a.debug("Offsetting live streams by",g,"to compensate for rollover");for(const h of a.f.values())95443.7176888889>h.Fd?(a.a.debug("Offset applied to",h.stream.type),h.segmentIndex.offset(g)):a.a.debug("Offset NOT applied to",h.stream.type)}}else{a.h.Mb(f);a.h.offset(-e);for(const h of a.f.values())h.segmentIndex.offset(-e),
|
|
8
|
+
_.Zu(h.segmentIndex,f)}a.J={presentationTimeline:a.h,periods:[c],offlineSessionIds:[],minBufferTime:0}})},vA=function(a,b){return _.w(function*(){var c=new _.ag(b.Ve);if(a.g.hlsLowLatency){var d=c.a;if(b.af){var e=b.segmentIndex;if(e=e.a[e.a.length-1]){const h=e.a,k=h.length-1;e={Df:e.position,Jf:h&&0<h.length?k:null}}else e=null;const {Df:f,Jf:g}=e;null!==f&&(d.add("_HLS_msn",f),null!==g&&d.add("_HLS_part",g))}e=d;_.lg(e);e.g&&_.dg(c,d)}c=yield mA(a,c.toString());c=iA(a.M,c.data,c.uri);if(1!=c.type)throw new _.H(_.F,
|
|
9
|
+
4,4017);d=b.stream;d=yield tA(a,b.cd,c,d.type,d.mimeType,d.codecs,d.keyInfo||null,b.ff);b.segmentIndex.replace(d);d=d[d.length-1];$z(c.ta,Iz)&&(uA(a,pA),a.h.Mb(d.endTime))})},tA=function(a,b,c,d,e,f,g,h){return _.w(function*(){var k=c.a;const l=wA(c,g);var m=(m=$z(c.ta,Jz))?Number(m.value):0;null===a.O&&(a.O=yield xA(a,b,l,k[0],m,g,e,f,d));const n=a.O;a.a.debug("First segment",k[0].a.split("/").pop(),"starts at",n);var q=$z(c.ta,Hz);let t=q?Number(q.value):0;h.has(t)||h.set(t,m);if(!q)for(;h.has(t+
|
|
10
|
+
1)&&h.get(t+1)<m;)t++;q=a.K.get(t)||0;const u=[];for(const E of _.qu(k)){var y=E.Wc;k=E.item;{var A=u[u.length-1];const D=0==y?n:A.endTime;y=m+y;$z(k.ta,Gz)&&(t++,h.set(t,y),q=yield yA(a,t,b,l,k,y,g,e,f,D,d));A=zA(a,A,k,y,D,q,g,d,c.f);k=$z(k.ta,Qz);A&&(a.g.hlsLowLatency||k)&&u.push(A)}}a.V.push(u);qA(a);return u})},uA=function(a,b){a.j=b;if(a.h){b=a.h;var c=a.j==pA;b.j=c;b.m=c}a.j!=pA||a.w.stop()},oA=function(a,b){return _.w(function*(){var c=Yz(b,"EXT-X-MEDIA"),d=Yz(b,Oz),e=Yz(b,"EXT-X-IMAGE-STREAM-INF");
|
|
11
|
+
for(var f of d){var g=_.ng(f,"AUDIO"),h=_.ng(f,"VIDEO"),k=_.ng(f,Uz);const l=AA(a,f);if(k){const m=_.Ch(_.r,l);a.m.set(k,m);k=l.indexOf(m);-1<k&&l.splice(k,1)}g&&(k=BA(_.Yb,l),a.m.set(g,k));h&&(g=BA(_.v,l),a.m.set(h,g))}yield CA(a,c);f=Zz(c,Ez);for(const l of f)f=DA(l),h=Wz(l,Rz),g=Wz(l,"INSTREAM-ID"),a.L.get(h)||a.L.set(h,new Map),a.L.get(h).set(g,f);d=yield EA(a,d);c=yield FA(a,c);e=yield GA(a,e);return{startTime:0,variants:d,textStreams:c,thumbStreams:e}})},CA=function(a,b){return _.w(function*(){b=
|
|
12
|
+
b.filter(d=>{const e=_.ng(d,_.lb)||"";return _.ng(d,"TYPE")!==Uz&&""!==e});b.length&&(yield HA(a,b[0]));const c=b.slice(1).map(d=>HA(a,d));yield Promise.all(c)})},EA=function(a,b){return _.w(function*(){var c=f=>_.w(function*(){const g=_.ng(f,"FRAME-RATE"),h=Number(Wz(f,_.ja));var k=_.ng(f,_.Za);const [l,m]=k?k.split("x"):[null,null];return(k=yield IA(a,f,k,g))?JA(a,k.audio,k.video,h,l,m,g):[]});let d=0;var e=Infinity;for(let f=0;f<b.length;++f){const g=Number(Wz(b[f],_.ja));g<e&&(e=g,d=f)}e=b.splice(d,
|
|
13
|
+
1).pop();e=yield c(e);c=b.map(c);c=yield Promise.all(c);c.splice(d,0,e);return c.reduce(_.mu,[]).filter(_.$f)})},FA=function(a,b){return _.w(function*(){var c=Zz(b,Uz),d=c.map(f=>_.w(function*(){try{return(yield HA(a,f)).stream}catch(g){throw g;}}));d=yield Promise.all(d);for(const f of c){var e=Wz(f,Rz);if(c=a.m.get(e))if(e=a.o.get(e))for(const g of e)g.stream.codecs=c}return d.filter(f=>f)})},GA=function(a,b){return _.w(function*(){const c=b.map(d=>_.w(function*(){return(yield KA(a,d)).stream}));
|
|
14
|
+
return(yield Promise.all(c)).filter(d=>d)})},AA=function(a,b){var c=_.ng(b,_.la,a.g.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/);b=new Set;const d=[];for(const e of c)c=_.xu(e)[0],b.has(c)?a.a.debug("Ignoring duplicate codec"):(d.push(e),b.add(c));return d},BA=function(a,b){if(1==b.length)return b[0];a=_.Ch(a,b);if(null!=a)return a;throw new _.H(_.F,4,4025,{codecList:b});},HA=function(a,b){return _.w(function*(){const c=Wz(b,Rz);var d="";let e=Wz(b,"TYPE").toLowerCase();e==_.Zt&&(e=
|
|
15
|
+
_.r);e!==_.r&&c&&a.m.has(c)&&(d=a.m.get(c));const f=Wz(b,_.lb);if(a.f.has(f))return a.f.get(f);const g=DA(b),h=_.ng(b,"NAME"),k=b.getAttribute("DEFAULT"),l=b.getAttribute("AUTOSELECT"),m=_.ng(b,"CHANNELS");d=yield LA(a,f,d,e,g,!!k&&!!l,h,e==_.Yb?m?parseInt(m.split("/")[0],10):null:null,null);if(null==d)return null;a.o.has(c)?a.o.get(c).push(d):a.o.set(c,[d]);if(a.f.has(f))return a.f.get(f);a.f.set(f,d);return d})},KA=function(a,b){return _.w(function*(){const c=Wz(b,_.lb);if(a.f.has(c))return a.f.get(c);
|
|
16
|
+
var d=_.ng(b,_.la)||"jpg",e=DA(b);const f=_.ng(b,"NAME");d=yield LA(a,c,d,_.bd,e,!1,f,null,null);if(null===d)return null;if(a.f.has(c))return a.f.get(c);if(e=_.ng(b,_.ja))d.stream.bandwidth=Number(e);a.f.set(c,d);return d})},IA=function(a,b,c,d){return _.w(function*(){let e=AA(a,b);var f=_.ng(b,"AUDIO"),g=_.ng(b,"VIDEO"),h=f||g;h=h&&a.o.has(h)?a.o.get(h):[];f={audio:f?h:[],video:g?h:[]};a.a.debug("Guessing stream type for",b.toString());g=!1;const k=Wz(b,_.lb),l=f.audio.find(q=>q.cd===k);var m=_.Ch(_.v,
|
|
17
|
+
e);m=c||d||m;1!==e.length||m?!h.length&&1<e.length?(a.a.debug("Guessing multiplexed audio+video"),h=_.v,e=[e.join(",")]):f.audio.length&&l?(a.a.debug(Sz),h=_.Yb,g=!0):f.video.length?(a.a.debug(Sz),h=_.Yb):(a.a.debug("Guessing video-only"),h=_.v):(h=_.Yb,a.a.debug(Sz));let n;g||(n=yield MA(a,b,e,h));if(n)f[n.stream.type]=[n];else if(null===n)return a.a.debug("streamInfo is null"),null;NA(f);return f})},JA=function(a,b,c,d,e,f,g){c.forEach(l=>{if(l=l.stream)l.width=Number(e)||void 0,l.height=Number(f)||
|
|
18
|
+
void 0,l.frameRate=Number(g)||void 0});b.length||(b=[null]);c.length||(c=[null]);const h=[];for(const l of b)for(const m of c){var k=l?l.stream:null;const n=m?m.stream:null,q=l?l.drmInfos:null,t=m?m.drmInfos:null;b=(m?m.cd:"")+" - "+(l?l.cd:"");let u;if(k&&n)if(q.length&&t.length?0<_.zu(q,t).length:1)u=_.zu(q,t);else{a.a.warn("Incompatible DRM info in HLS variant. Skipping.");continue}else k?u=q:n&&(u=t);a.X.has(b)?a.a.debug("Skipping variant which only differs in text streams."):(k=OA(a,k,n,d,u),
|
|
19
|
+
h.push(k),a.X.add(b))}return h},MA=function(a,b,c,d){return _.w(function*(){const e=Wz(b,_.lb);if(a.f.has(e))return a.f.get(e);var f=_.ng(b,Ez),g=null;d==_.v&&f&&"NONE"!=f&&(g=a.L.get(f));f=BA(d,c);g=yield LA(a,e,f,d,_.xe,!1,null,null,g);if(null==g)return null;if(a.f.has(e))return a.f.get(e);a.f.set(e,g);return g})},NA=function(a){for(const b of a.audio.concat(a.video))a=b.stream.codecs.split(","),a=a.filter(c=>"mp4a.40.34"!=c),b.stream.codecs=a.join(",")},OA=function(a,b,c,d,e){return{id:a.$++,language:b?
|
|
20
|
+
b.language:_.xe,primary:!!b&&b.primary||!!c&&c.primary,audio:b,video:c,bandwidth:d,drmInfos:e,allowedByApplication:!0,allowedByKeySystem:!0}},DA=function(a){a=_.ng(a,"LANGUAGE")||_.xe;return _.Kh(a)},LA=function(a,b,c,d,e,f,g,h,k){return _.w(function*(){let l=aA(a.A,b);var m=null;if(a.j==pA&&a.G.has(l)){var n=a.G.get(l);a.G.delete(l)}else{var q=yield mA(a,l);l=q.uri;n=iA(a.M,q.data,l)}if(1!=n.type)throw new _.H(_.F,4,4017);PA(a,n);q=yield QA(a,d,c,n);const t=[];n.a.forEach(fd=>{fd=Yz(fd.ta,"EXT-X-KEY");
|
|
21
|
+
t.push.apply(t,fd)});let u=!1;const y=[];let A=null;for(var E of t){var D=Wz(E,"METHOD"),ma=_.ng(E,"KEYFORMAT","identity");"NONE"!=D&&("AES-128"==D?(m=_.ng(E,"IV",""),m={method:"AES-128",url:aA(a.A,Wz(E,_.lb)),iv:m?_.bj((m||"0x").slice(2)):null},a.I=!0):(u=!0,(D=(D=RA[ma])?D(E,q):null)?(D.keyIds.length&&(A=D.keyIds[0]),y.push(D)):a.a.warn("Unsupported HLS KEYFORMAT",ma)))}if(u&&!y.length&&!a.I)throw new _.H(_.F,4,4026);E=new Map;var na=yield tA(a,b,n,d,q,c,m,E);ma=na[0].startTime;D=na[na.length-1].endTime;
|
|
22
|
+
const uf=D-ma;na=new _.uz(na);const vf=a.g.hlsLowLatency?_.rx:_.Qt,wf=wA(n,m);let Ra=void 0;d==_.r&&(Ra=_.Yt);n=(n=$z(n.ta,Nz))?"YES"===_.ng(n,"CAN-BLOCK-RELOAD"):!1;return{stream:{id:a.$++,originalId:g,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:na.f.bind(na),getSegmentReference:na.get.bind(na),adjustSegmentDurations:na.g.bind(na),getDuration:na.getDuration.bind(na),segmentIndex:na,segmentLookupStrategy:vf,initSegmentReference:wf,mimeType:q,codecs:c,kind:Ra,encrypted:u,keyId:A,
|
|
23
|
+
language:e,label:g,type:d,primary:f,trickModeVideo:null,emsgSchemeIdUris:null,frameRate:void 0,width:void 0,height:void 0,bandwidth:void 0,roles:[],channelsCount:h,closedCaptions:k,keyInfo:m},segmentIndex:na,drmInfos:y,cd:b,Ve:l,Fd:ma,qg:D,duration:uf,ff:E,af:n}})},PA=function(a,b){var c=$z(b.ta,Lz),d=$z(b.ta,Iz);d=c&&"VOD"==c.value||d;c=c&&"EVENT"==c.value&&!d;c=!d&&!c;if(d)uA(a,pA);else{c?uA(a,rA):uA(a,SA);d=$z(b.ta,Pz);if(!d)throw new _.H(_.F,4,4024,{missingTag:Pz});d=Number(d.value);c=$z(b.ta,
|
|
24
|
+
Kz);a.g.hlsLowLatency&&c?(d=Number(Wz(c,"PART-TARGET")),a.F=Math.min(d,a.F),a.C=Math.max(d,a.C),b=$z(b.ta,Nz),a.T=b?Number(Wz(b,"PART-HOLD-BACK")):0):(a.C=Math.max(d,a.C),a.F=Math.min(d,a.F),a.T=3*a.C)}},QA=function(a,b,c,d){return _.w(function*(){var e=d.a[0].a;const f=(new _.ag(e)).pa.split(".").pop(),g=nA[b][f];if(g)return g;if(b==_.r)return c&&"vtt"!=c?_.Sb:_.se;e=_.Yg([e],a.g.attemptParameters);e.method="HEAD";e.type=2;e=(yield lA(a,e)).headers["content-type"];if(!e)throw new _.H(_.F,4,4021,
|
|
25
|
+
f);return e.split(";")[0]})},wA=function(a,b){var c=Yz(a.ta,"EXT-X-MAP");if(!c.length)return null;if(1<c.length)throw new _.H(_.F,4,4020);c=c[0];var d=Wz(c,_.lb);const e=aA(a.f,d);a=0;d=null;if(c=_.ng(c,"BYTERANGE"))a=c.split("@"),c=Number(a[0]),a=Number(a[1]),d=a+c-1;return new _.sz(()=>[e],a,d,b)},qA=function(a){a.h&&(a.V.forEach(b=>{_.Lu(a.h,b,0)}),a.V=[])},TA=function(a,b){var c=0;let d=null;b&&(c=b.split("@"),b=Number(c[0]),c=c[1]?Number(c[1]):a.Ba+1,d=c+b-1);return[c,d]},UA=function(a,b,c,d,
|
|
26
|
+
e,f,g){const h=[];for(const n of _.qu(b.f)){b=n.Wc;const q=n.item;{var k=0==b?a:h[h.length-1],l=0==b?d:k.endTime,m=Number(_.ng(q,"DURATION"));m=l+m;const t=_.ng(q,"BYTERANGE"),[u,y]=TA(k,t);k=_.ng(q,_.lb);const A=(k=aA(g,k))?[k]:[];l=new _.Uu(c,l,m,()=>A,u,y,e,f,!1,null,null,null,null);if("YES"===_.ng(q,"INDEPENDENT")||0===b)l.g=!0;h.push(l)}}return h},zA=function(a,b,c,d,e,f,g,h,k){var l=c.ta,m=c.a;const n=m?[m]:[];m=$z(l,Qz);(g=g?Object.assign({},g):null)&&!g.iv&&(g.iv=_.ej(new Uint8Array(12),new Uint8Array([d>>
|
|
27
|
+
24&255,d>>16&255,d>>8&255,d&255])));var q=null,t=null,u=null;h===_.bd&&(t=$z(l,"EXT-X-TILES"),q="1x1",t&&(q=_.ng(t,"LAYOUT")||"1x1",u=(u=_.ng(t,"DURATION"))?Number(u):null),[q,t]=q.split("x").map(y=>parseInt(y,10)));if(0===c.f.length&&!m)throw new _.H(_.F,4,4024,{missingTag:Qz});h=null;if(0<c.f.length)if(a.g.hlsLowLatency)h=UA(b,c,d,e,f,g,k);else return null;c=a=0;k=null;m?(a=e+Number(m.value.split(",")[0]),l=$z(l,Fz),[c,k]=TA(b,l?l.value:null)):a=h[h.length-1].endTime;return new _.Uu(d,e,a,()=>n,
|
|
28
|
+
c,k,f,g,!1,null,q,t,u,h)},xA=function(a,b,c,d,e,f,g,h,k,l){return _.w(function*(){var m=zA(a,null,d,e,0,0,f,k,"");if(!m)return 0;if(a.J&&!l){var n=a.f.get(b).segmentIndex.get(m.position);if(n)return a.a.debug("Found segment start time in previous manifest"),n.startTime;a.a.debug("Unable to find segment start time in previous manifest!")}a.a.debug("Fetching segment to find start time");if("audio/mpeg"==g)return 0;if(g==_.Zb)return m=yield VA(a,m),n=_.G(m.data),jA(n)?WA(n):XA(a,m.data);if(g==_.Ie||
|
|
29
|
+
g==_.bc)return m=[VA(a,m)],c&&m.push(VA(a,c)),m=yield Promise.all(m),YA(a,m[0].data,(m[1]||m[0]).data);if(g==_.He)return m=yield VA(a,m),XA(a,m.data);if(g===_.ac||g===_.$b||!MediaSource.isTypeSupported(`${g.split("/")[0]||""}/mp4;codecs="${h}"`))return 0;throw new _.H(_.F,4,4030);})},yA=function(a,b,c,d,e,f,g,h,k,l,m){return _.w(function*(){let n;a.K.has(b)?n=a.K.get(b):(n=(yield xA(a,c,d,e,f,g,h,k,m,!0))-l,a.a.debug("Discontinuity segment offset",n),a.K.set(b,n));return n})},lA=function(a,b){if(!a.B)throw new _.H(_.F,
|
|
30
|
+
7,7001);b=a.D.networkingEngine.fetch(b);_.eh(a.B,b);return b.R},VA=function(a,b){return _.w(function*(){const c=b.f(),d=_.Iu(b.Ea(),b.La,b.La+2048-1,a.g.attemptParameters);d.type=2;const e=_.Iu(b.Ea(),b.La,b.Ba,a.g.attemptParameters);e.type=2;c&&(e.keyInfo=c);try{return yield lA(a,a.I?e:d)}catch(f){if(7001==f.code||a.I)throw f;a.a.warn("Unable to fetch a partial HLS segment! Falling back to a full segment request, which is expensive! Your server should support Range requests and CORS preflights.",
|
|
31
|
+
d.uris[0]);return yield lA(a,e)}})},WA=function(a){function b(h,k,l){let m="";for(;k<l;k++)m+="%"+("00"+h[k].toString(16)).slice(-2);return m}function c(h){return h[0]<<21|h[1]<<14|h[2]<<7|h[3]}function d(){throw new _.H(_.F,4,4030);}jA(a)||d();let e=10;a[5]&64&&(e=e+4+c(a.subarray(10,14)));do{var f=c(a.subarray(e+4,e+8));1>f&&d();var g=String.fromCharCode(a[e],a[e+1],a[e+2],a[e+3]);if("PRIV"===g){g=a.subarray(e+10,e+f+10);for(let h=0;h<g.byteLength;h++)if(0===g[h]){if("com.apple.streaming.transportStreamTimestamp"===
|
|
32
|
+
unescape(b(g,0,h)))return a=g.subarray(h+1),f=(a[3]&1)<<30|a[4]<<22|a[5]<<14|a[6]<<6|a[7]>>>2,f*=4,f+=a[7]&3,Math.round(f/9E4);break}}jA(a,e)||d();e+=10;e+=f}while(e<a.byteLength);return d()},XA=function(a,b){function c(){e.seek(f+188);g=_.tj(e);71!=g&&(e.seek(f+192),g=_.tj(e));71!=g&&(e.seek(f+204),g=_.tj(e));71!=g&&d();Xz(e)}function d(){throw new _.H(_.F,4,4030);}const e=new _.qk(new DataView(b),!1);let f=0,g=0;f=ZA(e);0>f&&(a.a.error("Unable to find sync byte in TS after scanning"),d());for(;;){f=
|
|
33
|
+
e.getPosition();g=_.tj(e);71!=g&&d();a=_.uj(e);if(8191===(a&8191)){c();continue}if(!(a&16384)){c();continue}a=(_.tj(e)&48)>>4;0!=a&&2!=a||d();3==a&&(a=_.tj(e),e.skip(a));if(1!=_.M(e)>>8){c();continue}e.skip(3);a=_.tj(e)>>6;0!=a&&1!=a||d();0==_.tj(e)&&d();a=_.tj(e);b=_.uj(e);const h=_.uj(e);return(1073741824*((a&14)>>1)+((b&65534)<<14|(h&65534)>>1))/9E4}},YA=function(a,b,c){let d=0;(new _.Hj).N(_.wd,_.N).N(_.ve,_.N).N(_.rd,_.N).Y("mdhd",g=>{g.H.skip(0==g.version?8:16);d=_.M(g.H);g.Qa.stop()}).parse(c,
|
|
34
|
+
!0);if(!d)throw a.a.error("Unable to find timescale in init segment!"),new _.H(_.F,4,4030);let e=0,f=!1;(new _.Hj).N("moof",_.N).N("traf",_.N).Y("tfdt",g=>{e=(0==g.version?_.M(g.H):_.xj(g.H))/d;f=!0;g.Qa.stop()}).parse(b,!0);if(!f)throw new _.H(_.F,4,4030);return e},ZA=function(a){for(;a.getPosition()<a.wa()-1;){const b=a.getPosition();if(71===_.tj(a))return Xz(a),b}return-1},hA=class{constructor(a,b,c,d){this.f=a;this.type=b;this.ta=c;this.a=d||null}},eA=class{constructor(a,b,c=[]){this.ta=b;this.a=
|
|
35
|
+
a;this.f=c}},cA=[Pz,Jz,Hz,Lz,"EXT-X-MAP","EXT-X-I-FRAMES-ONLY",Iz,Nz,Kz],gA=[Qz,Fz,Gz,"EXT-X-PROGRAM-DATE-TIME","EXT-X-KEY","EXT-X-DATERANGE"],dA=["EXT-X-PART",Mz],$A=class{constructor(){this.a=0}},aB=class{constructor(){this.g=this.D=null;this.$=1;this.T=0;this.o=new Map;this.X=new Set;this.f=new Map;this.h=null;this.A="";this.M=new $A;this.W=0;this.S=new Map;this.w=new _.Qh(()=>{this.wb()});this.j=pA;this.J=null;this.C=0;this.F=Infinity;this.B=new _.Mo;this.V=[];this.L=new Map;this.I=!1;this.m=
|
|
36
|
+
new Map;this.O=null;this.a=new _.O("clpp.hls.HlsParser");this.G=new Map;this.K=new Map}configure(a){this.g=a}setCurrentVariant(a){const b=a.video?a.video.id:null;a=a.audio?a.audio.id:null;this.S.clear();for(const c of this.f.keys()){const d=this.f.get(c);!d.stream||d.stream.id!==b&&d.stream.id!==a||this.S.set(c,d)}}start(a,b){const c=this;return _.w(function*(){c.D=b;var d=yield mA(c,a);c.A=d.uri;yield sA(c,d.data);d=c.W;0<d&&c.w.aa(d);return c.J})}stop(){this.w&&(this.w.stop(),this.w=null);const a=
|
|
37
|
+
[];this.B&&(a.push(this.B.destroy()),this.B=null);this.g=this.D=null;this.X.clear();this.f.clear();this.G.clear();this.J=null;this.o.clear();this.m.clear();return Promise.all(a)}update(){const a=this;return _.w(function*(){if(a.j!=pA){var b=[];a.O=null;var c=Array.from(a.f.values()),d=Array.from(a.S.values());c=a.g.hlsLowLatency&&0<d.length?d:c;yield vA(a,c[0]);for(d=1;d<c.length;d++)b.push(vA(a,c[d]));yield Promise.all(b)}})}onExpirationUpdated(){}wb(){const a=this;return _.w(function*(){a.a.debug(_.Jt);
|
|
38
|
+
if(a.D)try{yield a.update(),a.w.aa(a.W)}catch(b){a.D&&(a.D.onError(b),1===b.severity&&a.w.aa(.1))}})}},nA={audio:{mp4:_.bc,m4s:_.bc,m4i:_.bc,m4a:_.bc,cmfa:_.bc,ts:_.He,aac:_.Zb,ec3:_.ac,ac3:_.$b},video:{mp4:_.Ie,m4s:_.Ie,m4i:_.Ie,m4v:_.Ie,cmfv:_.Ie,ts:_.He},text:{mp4:_.Sb,m4s:_.Sb,m4i:_.Sb,cmft:_.Sb,vtt:_.se,ttml:_.Vb},image:{jpg:_.cd,jpeg:_.cd,png:"image/png",svg:"image/svg+xml",webp:"image/webp",avif:"image/avif"}},RA={"com.apple.streamingkeydelivery":function(a,b){if(b===_.He)throw new _.H(_.F,
|
|
39
|
+
4,4041);return _.pu(_.Fc,[{initDataType:_.ge,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":kA,"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":kA,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=Wz(a,"METHOD");const c=["SAMPLE-AES",Tz];if(!c.includes(b))return _.Jf("Widevine in HLS is only supported with [",c.join(", "),"], not",b),null;b=Wz(a,_.lb);b=_.ao(b);b=_.G(b.data);b=_.pu(_.Hc,[{initDataType:_.qc,initData:b}],"");if(a=_.ng(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];
|
|
40
|
+
return b}},pA="VOD",SA="EVENT",rA="LIVE";_.x("clpp.hls.HlsComponent",class extends _.Ep{constructor(){super()}f(){_.Fn.m3u8=aB;_.Dn[_.wi]=aB;_.Dn[Vz]=aB}a(){_.bv("m3u8");_.cv(_.wi);_.cv(Vz)}id(){return"hls"}});};f.call(g, window);
|
package/cl.hlssmpte.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
else a.f.warn("A video element is not available. Skipping.")},
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var oI=function(a){a.a.one(a.l,_.nd,()=>nI(a))},nI=function(a){const b=a.l.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.Kb,d=>pI(a,d));var c=Array.from(b.textTracks);c.filter(d=>d.kind===_.td).forEach(d=>{pI(a,{track:d})});!qI(c)&&a.m&&(a.f.warn("The metadata track is not present. Changing an audio track in order to enforce the creation of the metadata track."),rI(a,b))}else a.f.warn("The clpp.ttml.TextParser class is not available. Please register the ttml component first.");
|
|
2
|
+
else a.f.warn("A video element is not available. Skipping.")},pI=function(a,b){b=b.track;b.kind===_.td&&(a.f.info("The metadata track has been added."),b.mode=_.ad,a.a.on(b,_.Kc,c=>sI(a,c)))},qI=function(a){return a.some(b=>b.kind===_.td)},rI=function(a,b){const c=a.l.getTrackManager(),d=c.ka(),e=c.getAudioTracks().find(g=>g!==d);if(e){var f=()=>c.qa(d);a.a.on(b.textTracks,_.Kb,g=>{g.track.kind===_.td&&(a.a.off(b.textTracks,_.Kb,f),c.qa(d))});c.qa(e)}else a.f.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},
|
|
3
|
+
sI=function(a,b){const c=tI(a);c&&Array.from(b.target.activeCues||[]).forEach(d=>{if(d!==a.g&&Number.isFinite(d.startTime)&&Number.isFinite(d.endTime)&&"org.id3"===d.type&&d.value&&"TXXX"===d.value.key){var e=new uI(d);if(e.f===c&&null!==e.a){a.g=d;d=a.h.parseMedia(_.Eg(e.a),{periodStart:a.j,segmentStart:e.startTime,segmentEnd:e.endTime});const f=a.l.getTextDisplayer();f.remove(0,e.startTime);f.append(d.cues,d.styles)}}})},tI=function(a){return(a=a.l.getTrackManager().la())&&a.language&&a.language.toLowerCase()},
|
|
4
|
+
uI=class{constructor(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.z(a)){a:{var b=a.info;if(_.of(b)&&(b=b.toLowerCase().match(/lang:(\w+)/))&&b[1]){b=b[1].toLowerCase();break a}b=null}this.f=b;a=a.data;this.a=a=_.of(a)?a:null}}};var vI=class{constructor(a,b,c){this.l=a;this.m=b;this.j=c;this.a=new _.po;this.h=(a=_.co[_.Vb]||null)?new a(this.l.getConfiguration()):null;this.f=new _.O("clpp.hlssmpte.ImageCueHandler");this.g=null;oI(this)}destroy(){this.a.release();this.g=null;return Promise.resolve()}};var wI=class extends _.bq{constructor(){super();this.a=null;this.f=!1}onPlayerCreated(){}onContentWillLoad(a){if(this.f=_.di()){var b=a.getConfiguration();b=_.jf(b.hlssmpte||{});typeof b.patchMetadataTrack!==_.fc&&(b.patchMetadataTrack=!1);_.pf(b.timestampOffset)||(b.timestampOffset=0);this.a=new vI(a,b.patchMetadataTrack,b.timestampOffset)}}onPlayerWillDestroy(){const a=this;return _.w(function*(){a.a&&(yield a.a.destroy(),a.a=null)})}id(){return"hlssmpte"}};_.x("clpp.hlssmpte.HlsSmptePlugin",wI);
|
|
5
|
+
wI.Id="hlssmpte";_.Nm(new class{create(){return new wI}});};f.call(g, window);
|
package/cl.htmlcue.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
function(a,b){for(const c in a)b.style[c]=a[c]},
|
|
3
|
-
0;c=parseFloat(c.getPropertyValue("border-bottom-width"))||0;const g=(b.top||a.offsetTop)+f;f=(b.height||a.offsetHeight)-f-c;return new
|
|
4
|
-
b.g);case "+y":return
|
|
5
|
-
_.
|
|
6
|
-
|
|
7
|
-
return a},
|
|
8
|
-
c=document.head;c.appendChild(e);
|
|
9
|
-
a.g.cssRules[0];d instanceof CSSStyleRule&&(c=d.selectorText.split(",").every(e=>0===e.trim().indexOf(`.${a.j} `)))}catch(d){}0<a.g.cssRules.length&&a.g.deleteRule(0);return c},
|
|
10
|
-
childList:!0});a.o.push(()=>d.disconnect())},
|
|
11
|
-
a.getBackgroundColor()
|
|
12
|
-
else{
|
|
13
|
-
c;for(;0<=d-1&&
|
|
14
|
-
a)}px`},
|
|
15
|
-
d.appendChild(g),d=g)}}else d.appendChild(document.createTextNode(
|
|
16
|
-
(c=_.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
d=this.a;d=Math.max(0,Math.min(c.g,d.g)-Math.max(c.f,d.f))*Math.max(0,Math.min(c.a,d.a)-Math.max(c.h,d.h))/(c.height*c.width);d>k&&(h=
|
|
20
|
-
_.
|
|
21
|
-
b=c;f*=b;break a;default:throw Error(
|
|
22
|
-
`because it's not safe: ${b}`)}}destroy(){const a=this;return _.w(function*(){null!=a.a&&(a.o.forEach(b=>b()),a.o=[],
|
|
23
|
-
|
|
24
|
-
this;return _.w(function*(){null!=a.h&&(
|
|
25
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var gH="Unsupported unit",hH="clpp-text-plain",iH="clpp-text-ttml",jH="clpp.htmlcue.HtmlTextDisplayer",kH="initial",lH=function(a,b){let c=0,d=a.length-1;for(;c<=d;){const e=c+d>>1,f=b(a[e]);if(0===f)return e;0<f?c=e+1:d=e-1}return-1},mH=function(a){if(!a.input)return null;var b=a.input.match(/^([^<]*)(<[^>]+>?)?/);b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},oH=function(a){let b=null;for(;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],c=>nH[c]);return a},qH=
|
|
2
|
+
function(a,b){pH(a,b);Array.from(b.getElementsByTagName("*")).forEach(c=>{pH(a,c)})},pH=function(a,b){for(const c in a)null!=a[c]&&(b.style[c]=a[c])},rH=function(a,b){return 0===a?"0":a+b},sH=function(a,b){return 1>Math.abs(a-b)||a<b},tH=function(a,b){return a<b&&1<Math.abs(a-b)},uH=function(a,b){return a>b&&1<Math.abs(a-b)},vH=function(a,b){return 1>Math.abs(a-b)||a>b},xH=function(a){const b=a.getBoundingClientRect();var c=getComputedStyle(a,null);const d=parseFloat(c.getPropertyValue("border-left-width"))||
|
|
3
|
+
0,e=parseFloat(c.getPropertyValue("border-right-width"))||0;var f=parseFloat(c.getPropertyValue("border-top-width"))||0;c=parseFloat(c.getPropertyValue("border-bottom-width"))||0;const g=(b.top||a.offsetTop)+f;f=(b.height||a.offsetHeight)-f-c;return new wH(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-d-e)},yH=function(a){return new wH(a.f,a.g,a.h,a.a,a.height,a.width)},zH=function(a,b){return b.some(c=>tH(a.f,c.g)&&uH(a.g,c.f)&&tH(a.h,c.a)&&uH(a.a,c.h))},AH=function(a,b){return vH(a.h,
|
|
4
|
+
b.h)&&sH(a.a,b.a)&&vH(a.f,b.f)&&sH(a.g,b.g)},BH=function(a,b,c){switch(c){case "+x":return tH(a.f,b.f);case "-x":return uH(a.g,b.g);case "+y":return tH(a.h,b.h);case "-y":return uH(a.a,b.a);default:throw Error("Unknown axis");}},CH=function(a){return a.f.writingMode===_.to},DH=function(a){var b=a.a.childNodes[0],c=a.a.getBoundingClientRect();const d=b.getClientRects();b=c.height/d.length;c=c.width/d.length;return CH(a)?b:c},EH=function(a){switch(a.f.writingMode){case _.to:return"horizontal-tb";case _.Ee:return _.Ee;
|
|
5
|
+
case _.Ge:return _.Ge;default:throw Error("Unknown writing mode");}},FH=function(a){switch(a.f.positionAlign){case _.ld:return _.gd;case "auto":case _.rc:return _.so;case _.md:return _.ce}return a.f.textAlign},GH=function(a,b){if(typeof a.f.position===_.p&&typeof a.f.size===_.p)switch(b){case _.ld:return a.f.position;case "auto":case _.rc:return a.f.position-a.f.size/2;case _.md:return a.f.position-a.f.size}return 0},HH=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.gd:case _.gd:return _.ld;
|
|
6
|
+
case _.so:return _.rc;case _.ce:case _.ce:return _.md}return a.f.positionAlign},KH=function(a,b,c){return(IH(a)||JH(a))&&_.pf(c)?rH(c,_.Wd):IH(a)&&_.z(c)?rH(0,_.Wd):CH(a)&&_.pf(b)?rH(b,"%"):kH},LH=function(a,b,c){return CH(a)&&_.pf(c)?rH(c,_.Wd):(IH(a)||JH(a))&&_.pf(b)?rH(b,"%"):kH},JH=function(a){return a.f.writingMode===_.Ge},IH=function(a){return a.f.writingMode===_.Ee},MH=function(a,b){if(a.h)switch(b.writingMode){case _.to:return["-y"];case _.Ee:return["+x"];case _.Ge:return["-x"]}a=[];switch(b.writingMode){case _.to:a=
|
|
7
|
+
["+y","-y"];break;case _.Ee:a=["+x","-x"];break;case _.Ge:a=["-x","+x"]}0>b.line&&(a=a.reverse());return a},NH=function(a){for(a.g=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=xH(a.j.a)},OH=function(a,b){NH(a.g);a.j.unshift(b);for(const c of a.j)a.g.append(c)},PH=function(a,b,c){a=a.f;const d=a.viewportAnchorUnits;if(d===_.Ao)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(gH);},RH=function(a,b,c,d){const e=document.createElement(_.oe),
|
|
8
|
+
f=e.dataset;f.name=b;f.for=c;d&&(f.name=`${b} (sandbox)`,f.sandbox=!0);c=document.head;c.appendChild(e);QH(a,c,b);a.f.debug(`Created HTML style element #${b}.`);return e.sheet},SH=function(a,b){a=`.${a.j} .clpp-text-container`;const c=`${a} .clpp-text-cue`;return b=b.replace(/::cue\((#[^)]+)\)/g,`${a} $1`).replace(/::cue\(([^)]+)\)/g,`${c} $1`).replace(/::cue-region\(([^)]+)\)/g,`${a} $1 .clpp-text-cue`).replace(/::cue/g,c).replace(/::cue-region/g,`${a} .clpp-text-cue-region .clpp-text-cue`).replace(/::ttml/g,
|
|
9
|
+
a)},TH=function(a,b){let c=!1;try{a.g.insertRule(b,0);const d=a.g.cssRules[0];d instanceof CSSStyleRule&&(c=d.selectorText.split(",").every(e=>0===e.trim().indexOf(`.${a.j} `)))}catch(d){}0<a.g.cssRules.length&&a.g.deleteRule(0);return c},UH=function(a){if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);a.m=[]}},QH=function(a,b,c){const d=new MutationObserver(e=>{e.forEach(f=>{f.removedNodes.forEach(g=>{g.id===c&&a.f.error(`PRESTOplay HTML style element #${c} has `+"been unexpectedly removed! Some styles will not work!")})})});
|
|
10
|
+
d.observe(b,{subtree:!1,childList:!0});a.o.push(()=>d.disconnect())},VH=function(a){a=_.jf(a.getConfiguration().htmlcue||{});_.z(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.z(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},aI=function(a,b){if((b||a.j)&&a.C){var c=a.l.getPosition();if(b||a.J!==c&&a.l.getState()===_.Nl)if(a.J=c,c=WH(a,c),b||(b=a.m,b=!(null===b&&null===c||null!==b&&null!==c&&b.start===c.start&&b.end===c.end)),b&&(a.m=c,XH(a),c)){b={color:a.getFontColor()||void 0,
|
|
11
|
+
backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.jo(a)||void 0};c=a.f.slice(c.start,c.end+1);for(const k of c){c=a;var d=k,e=b,f=c.a.a,g=null;switch(d.payloadType){case _.Ne:g="clpp-text-vtt";break;case _.we:g=iH;break;case _.ro:g=hH}g&&!f.classList.contains(g)&&_.hm(f,g);f=xH(c.a.a);if(0===f.width||0===f.height)c.M.warn("The height or width of the `.clpp-text-container` element is zero. Captions will not be displayed. Please check if the `clpp.styles.css` file has been included.");
|
|
12
|
+
else{pH({fontSize:YH(c,d.containerRows)},c.a.a);f=null;g=d.payloadType===_.Ne;var h=d.payloadType===_.we;d.region&&(g||h||d.backgroundImage)&&(c.A.has(d.region.id)?f=c.A.get(d.region.id):(f=new ZH(d.region,{}),c.A.set(d.region.id,f),OH(c.a,f)));d=new $H(d,c.L,e);f?OH(f,d):OH(c.a,d)}}}}},bI=function(a){XH(a);a.J=null;a.m=null;a.f=[]},cI=function(a,b){return a.startTime<=b&&a.endTime>b},WH=function(a,b){var c=lH(a.f,d=>cI(d,b)?0:b!==d.startTime?b-d.startTime:b-d.endTime);if(-1===c)return null;{let d=
|
|
13
|
+
c;for(;0<=d-1&&cI(a.f[d-1],b);)d--;for(;c+1<a.f.length&&cI(a.f[c+1],b);)c++;return{start:d,end:c}}},XH=function(a){a.A.clear();if(a.a){const b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(iH);b.classList.remove(hH);a=a.a;NH(a.g);a.j=[]}},YH=function(a,b){const c=xH(a.a.a).height;if(null!==a.I)return a.getFontSize();if(null!==a.B)return a=a.getFontSizePercent(),`${Math.round(c*a)}px`;if(typeof b===_.p&&0<b)return`${Math.round(c/b)}px`;a=a.getFontSizePercent();return`${Math.round(c*
|
|
14
|
+
a)}px`},gI=class{parse(a){a={input:a};const b=_.jm(_.Nc),c=[];let d=b;for(var e;null!==(e=mH(a));)if("\x3c"===e[0])if("/"===e[1])c.length&&c[c.length-1]===e.substr(2).replace("\x3e","")&&(c.pop(),d=d.parentNode);else{if(e=e.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/)){var f=e[1];var g=e[3];var h=dI[f];h?(h=_.jm(h),(f=eI[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||fI[g.localName]&&fI[g.localName]!==d.localName||(e[2]&&(g.className=e[2].substr(1).replace(/\./g," ")),c.push(e[1]),
|
|
15
|
+
d.appendChild(g),d=g)}}else d.appendChild(document.createTextNode(oH(e)));return b}},dI={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},eI={v:"voice",lang:"lang"},fI={rt:"ruby"},nH={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};var wH=class{constructor(a,b,c,d,e,f){this.f=a;this.g=b;this.h=c;this.a=d;this.height=e;this.width=f}};var hI=class{constructor(a,b,c){this.id=a;this.o=b;this.A=c;this.a=this.m();this.h=!1}init(){this.h=!0}w(){return!1}};var $H=class extends hI{constructor(a,b,c){super(a.id,"clpp-text-cue",{});this.j=b;this.f=a;this.g=!!this.f.backgroundImage;this.B=c}w(){return!this.g&&!(this.f.region&&this.f.region.displayAlign)}init(a){super.init(a);if(this.g)_.hm(this.a,"clpp-text-cue-image"),this.a.style.backgroundImage=`url("${this.f.backgroundImage}")`,this.j.stretchSmpteImage&&(this.a.style.backgroundSize="contain");else if(a){var b=this.f;if(b.payloadType===_.we){var c=_.jm(_.Nc);c.innerHTML=b.payload;b=c}else b.payloadType===
|
|
16
|
+
_.Ne?b=(new gI).parse(b.payload):(c=_.jm(_.Nc),c.textContent=b.payload,b=c);_.hm(b,this.o);this.id&&(b.id=this.id);for(d of this.f.cssClassList)_.hm(b,d);pH({writingMode:EH(this)},b);var d=b;this.a.appendChild(d);_.hm(this.a,"clpp-text-wrapper");for(var e of this.f.cssClassList)_.hm(this.a,`clpp-text-wrapper__${e}`);_.z(this.f.line)&&(this.f.lineInterpretation=_.uo,this.f.line=CH(this)?-1:0);e=EH(this);pH({writingMode:e,webkitWritingMode:e,direction:kH,textAlign:FH(this)},this.a);if(!this.f.region||
|
|
17
|
+
!this.f.region.displayAlign){e=GH(this,HH(this));pH({position:"absolute",left:KH(this,e,null),right:JH(this)&&_.z(null)?rH(0,_.Wd):kH,top:LH(this,e,null),width:CH(this)?rH(this.f.size,"%"):kH,height:IH(this)||JH(this)?rH(this.f.size,"%"):kH},this.a);b=this.f;a=CH(this)?a.height:a.width;c=DH(this);if(b.lineInterpretation===_.uo){var f=c*Math.round(b.line);Math.abs(f)>a&&(f=c*(0>b.line?0:-1));0>f&&(f+=a)}else{f=c/a*100;let g=b.line;switch(b.lineAlign){case _.rc:g-=f/2;break;case _.Vc:g-=f}f=Math.round(g/
|
|
18
|
+
100*a)}JH(this)&&(f=a-f-c);a=f;pH({left:KH(this,e,a),right:JH(this)&&_.z(a)?rH(0,_.Wd):kH,top:LH(this,e,a)},this.a)}qH(this.B,d)}}m(){return _.jm(_.Nc)}};var iI=class{constructor(a,b){this.j=a;this.f=a.a;this.h=void 0===b?!1:b;this.a=xH(a.a);this.g=[]}append(a){const b=a.a;b.style.visibility=_.ad;this.f.appendChild(b);a.h||a.init(this.a);if(a.w()){a:{var c=xH(a.a);var d=MH(this,a.f),e=DH(a);const g=yH(c);let h=null,k=0;for(const l of d){for(;BH(c,this.a,l)||AH(c,this.a)&&zH(c,this.g);){d=c;var f=e;switch(l){case "+x":d.f+=f;d.g+=f;break;case "-x":d.f-=f;d.g-=f;break;case "+y":d.h+=f;d.a+=f;break;case "-y":d.h-=f,d.a-=f}}if(this.h||AH(c,this.a))break a;
|
|
19
|
+
d=this.a;d=Math.max(0,Math.min(c.g,d.g)-Math.max(c.f,d.f))*Math.max(0,Math.min(c.a,d.a)-Math.max(c.h,d.h))/(c.height*c.width);d>k&&(h=yH(c),k=d);c=yH(g)}c=h||g}pH({top:rH(c.h-this.a.h,_.Wd),bottom:rH(this.a.a-c.a,_.Wd),left:rH(c.f-this.a.f,_.Wd),right:rH(this.a.g-c.g,_.Wd),height:rH(c.height,_.Wd),width:rH(c.width,_.Wd)},a.a)}b.style.visibility="visible";this.g.push(xH(a.a))}};var jI=class extends hI{constructor(a,b,c){super(a,b,c);this.g=null;this.j=[]}init(){this.g=new iI(this);this.h=!0}m(){const a=_.jm(_.Nc);_.hm(a,this.o);this.id&&(a.id=this.id);return a}};var ZH=class extends jI{constructor(a,b){super(a.id,"clpp-text-cue-region",b);this.f=a}init(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.Ao:b=b.width/100*a.width;break a;default:throw Error(gH);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.Ao)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(gH);d=a.height;const e=PH(this,d,a.height);pH(this.A,this.a);pH({left:rH(c,_.Wd),top:rH(e,_.Wd),width:rH(b,
|
|
20
|
+
_.Wd),height:rH(d,_.Wd)},this.a);this.f.writingMode&&pH({display:"flex","flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&pH({"justify-content":this.f.displayAlign},this.a);for(var f of this.f.cssClassList)_.hm(this.a,f);a:switch(f=this.f,f.heightUnits){case 0:f=f.height;break a;case _.Ao:f=f.height/100*a.height;break a;case 2:f=f.height;c=new $H(new _.xo(0,1,"Lorem ipsum",_.ro),{},{});b=c.a;this.a.appendChild(b);c.init(xH(this.a));c=b.getBoundingClientRect().height;this.a.removeChild(b);
|
|
21
|
+
b=c;f*=b;break a;default:throw Error(gH);}a=PH(this,f,a.height);pH({top:rH(a,_.Wd),height:rH(f,_.Wd)},this.a);this.g=new iI(this,!0);this.h=!0}getId(){return this.f.id}};var kI=class{constructor(a,b){this.f=new _.O("clpp.htmlcue.StyleManager");this.o=[];this.j=a.getSurface().getUniqueCssClass();this.h=b;this.m=[];this.a=RH(this,this.h,this.j);this.g=RH(this,this.h,this.j,!0);this.g.disabled=!0;this.f.debug(`Stylesheet ${this.h} has been created.`)}appendRule(a){if(null!=this.a&&!this.m.some(b=>b===a)){const b=SH(this,a);if(TH(this,b)){try{this.a.insertRule(b,this.a.cssRules.length),this.f.debug(`Added CSS rule ${b}`)}catch(c){this.f.error(`An error occurred when adding a CSS rule: ${b}`)}this.m.push(a)}else this.f.warn(`Stylesheet ${this.h} ignoring the CSS rule `+
|
|
22
|
+
`because it's not safe: ${b}`)}}destroy(){const a=this;return _.w(function*(){null!=a.a&&(a.o.forEach(b=>b()),a.o=[],UH(a),document.head.removeChild(a.a.ownerNode),document.head.removeChild(a.g.ownerNode),a.a=null,a.g=null,a.f.debug(`Stylesheet ${a.h} has been destroyed.`))})}};var lI=class extends _.Zp{constructor(a){super(a);this.M=new _.O(jH);this.l=a;this.L=VH(a);this.j=!1;this.f=[];this.C=a.getSurface().getContainer();this.h=new kI(a,"CLPP Subtitle Styles");this.a=new jI(null,"clpp-text-container",{});this.w=new _.Vp(a.getSurface(),this.V.bind(this));this.J=null;this.C?(this.C.appendChild(this.a.a),this.a.init(null)):this.M.warn("No container element! Subtitles will not appear. Please check your player surface configuration or switch to NativeTextDisplayer.");this.F=
|
|
23
|
+
new _.Qh(()=>{aI(this)});this.A=new Map;this.m=null}append(a,b){if(null!=this.h&&0!==a.length){for(const c of b)this.h.appendRule(c);a.sort((c,d)=>c.startTime!==d.startTime?c.startTime-d.startTime:c.endTime-d.endTime);b=this.f.findIndex(c=>c.startTime>=a[0].startTime);0===b?this.f=[]:0<b&&this.f.splice(0,b);for(const c of a)this.f.some(d=>d.payload!==c.payload?!1:d.startTime!==c.startTime?!1:d.endTime!==c.endTime?!1:!0)||this.f.push(c);this.m=null;aI(this,!1)}}g(){null==this.h||aI(this,!0)}destroy(){const a=
|
|
24
|
+
this;return _.w(function*(){null!=a.h&&(bI(a),a.F.stop(),yield a.h.destroy(),a.h=null,a.C.removeChild(a.a.a),a.a=null,a.w.stop(),a.w=null,a.j=!1)})}remove(a,b){if(null==this.h)return!1;this.f=this.f.filter(c=>c.startTime<a||c.endTime>=b);this.m=null;aI(this,!0);return!0}isTextVisible(){return this.j}setTextVisibility(a){null!=this.h&&this.j!==a&&((this.j=a)?(this.F.Va(.25),this.L.enableResizeObserver&&this.w.start(),aI(this,!0)):(this.F.stop(),this.w.stop(),bI(this)))}V(){aI(this,!0)}};_.x(jH,lI);
|
|
25
|
+
lI.prototype.setTextVisibility=lI.prototype.setTextVisibility;lI.prototype.isTextVisible=lI.prototype.isTextVisible;lI.prototype.remove=lI.prototype.remove;lI.prototype.destroy=lI.prototype.destroy;lI.prototype.append=lI.prototype.append;var mI=class{ba(a){return!!a.enableHtmlCue&&!_.fi()}create(a){return new lI(a)}};_.x("clpp.htmlcue.HtmlCueComponent",class extends _.Ep{f(){_.rl("html",new mI)}a(){}id(){return _.pe}});};f.call(g, window);
|