@castlabs/prestoplay 6.23.0 → 6.24.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.
Files changed (65) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +116 -116
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +606 -592
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +87 -81
  10. package/cjs/cl.externs.js +94 -30
  11. package/cjs/cl.freewheel.js +25 -24
  12. package/cjs/cl.hls.js +73 -70
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +347 -333
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +15 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.sessions.js +16 -16
  22. package/cjs/cl.simid.js +15 -15
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +72 -72
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +12 -12
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +37 -37
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +5 -5
  36. package/cl.cast.js +88 -88
  37. package/cl.conviva.js +27 -27
  38. package/cl.core.js +492 -479
  39. package/cl.crypto.js +9 -9
  40. package/cl.dash.js +81 -76
  41. package/cl.externs.js +94 -30
  42. package/cl.freewheel.js +19 -19
  43. package/cl.hls.js +75 -74
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +17 -17
  47. package/cl.mse.js +309 -298
  48. package/cl.muxdata.js +13 -13
  49. package/cl.onboard.js +4 -4
  50. package/cl.persistent.js +10 -10
  51. package/cl.playlist.js +5 -5
  52. package/cl.sessions.js +10 -10
  53. package/cl.simid.js +13 -13
  54. package/cl.smooth.js +59 -59
  55. package/cl.thumbnails.js +19 -19
  56. package/cl.tizen.js +57 -57
  57. package/cl.ttml.js +22 -22
  58. package/cl.verimatrix.js +4 -4
  59. package/cl.vimond.js +8 -8
  60. package/cl.vr.js +14 -14
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -3
  63. package/cl.youbora.js +28 -28
  64. package/package.json +1 -1
  65. package/typings.d.ts +44 -10
package/cjs/cl.smooth.js CHANGED
@@ -1,76 +1,76 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var yR="Full MP4 box must have flags defined",zR="clpp.smooth.SmoothMP4Processor",AR="codecPrivateData",BR=function(a,b){var c=Math.floor(b/Math.pow(2,32)),d=b-c*Math.pow(2,32);_.W(a,c);_.W(a,d)},CR=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.dn()}},DR=function(a,b){CR(a,b>>16&255);CR(a,b>>8&255);CR(a,b&255)},ER=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.dn()}},FR=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.dn()}},GR=function(a,b){try{a.f.setInt16(a.a,
3
- b,a.h),a.a+=2}catch(c){_.dn()}},HR=function(a,b){if(void 0!==b){for(var c=new Uint8Array(b),d=Math.min(a.length,b),e=0;e<d;++e)c[e]=a.charCodeAt(e);for(;e<b;e++)c[e]=0;return c}c=new Uint8Array(a.length);for(d=0;d<a.length;++d)c[d]=a.charCodeAt(d);return c},IR=function(a){this.type=a;this.size=this.start=0;this.parent=null;this.w=!1;this.entries=[];this.children=[]},Z=function(a,b,c){IR.call(this,a);this.version=b;this.flags=c},JR=function(a,b,c){IR.call(this,a);this.f=b;this.offset=c},KR=function(a,
4
- b,c,d,e){Z.call(this,a,b,c);this.f=d;this.offset=e},LR=function(a,b,c){IR.call(this,"ftyp");this.h=a;this.wi=b;this.f=c},MR=function(){IR.call(this,_.Te)},NR=function(){IR.call(this,_.rg)},OR=function(a,b,c){Z.call(this,"mvhd",1,0);this.timescale=a;this.duration=b;this.volume=256;this.h=c+1;this.f=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]},PR=function(){IR.call(this,"mvex")},QR=function(a){Z.call(this,"trex",0,0);this.f=a},RR=function(a,b,c,d,e){Z.call(this,"tkhd",
5
- 1,7);this.h=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.f=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]},SR=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},TR=function(a){Z.call(this,"hdlr",0,0);this.f=a},UR=function(){Z.call(this,"vmhd",0,1);this.f=new Uint8Array([0,0,0,0,0,0])},VR=function(a){IR.call(this,a);this.w=!0},WR=function(a){VR.call(this,a);this.height=this.width=0;this.depth=24},
6
- YR=function(a,b,c,d){VR.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},ZR=function(a,b){WR.call(this,"avc1");this.width=a;this.height=b},$R=function(a,b){ZR.call(this,a,b);this.type="encv"},aS=function(a,b,c){YR.call(this,"mp4a",a,b,c)},bS=function(a,b,c){aS.call(this,a,b,c);this.type="enca"},cS=function(a,b){IR.call(this,"avcC");this.Za=a;this.ic=b;this.version=1;this.f=this.Za[0][1];this.h=this.Za[0][2];this.level=this.Za[0][3]},dS=function(a){Z.call(this,"esds",0,0);this.fc=
7
- a},eS=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},fS=function(){Z.call(this,"dref",0,0)},gS=function(){IR.call(this,_.hg)},hS=function(){Z.call(this,_.jg,0,0)},iS=function(){Z.call(this,"stts",0,0)},jS=function(){Z.call(this,"stsc",0,0)},kS=function(){Z.call(this,"stco",0,0)},lS=function(){Z.call(this,"stsz",0,0)},mS=function(){Z.call(this,"smhd",0,0)},nS=function(){IR.call(this,"dinf")},oS=function(){IR.call(this,_.Se)},pS=function(){IR.call(this,_.Oe)},qS=function(a,b){Z.call(this,
8
- "tfdt",a,0);this.baseMediaDecodeTime=b},rS=function(){Z.call(this,"mfhd",0,0);this.f=0},sS=function(a,b){Z.call(this,"trun",a,b);this.l=this.j=this.f=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]},tS=function(a,b){Z.call(this,"tfhd",a,b);this.f=255;this.l=this.o=this.j=this.A=this.h=0},uS=function(){IR.call(this,"traf")},vS=function(){IR.call(this,"moof")},wS=function(){IR.call(this,_.Ne);this.f=new Uint8Array(0)},xS=function(){Z.call(this,"tenc",0,0);this.f=1;this.h=8;this.l="";this.j=[]},yS=
9
- function(a,b){Z.call(this,"schm",0,0);this.f=a;this.h=b;this.$b=""},zS=function(a){IR.call(this,"frma");this.f=a},AS=function(){Z.call(this,"saio",0,0);this.offset=[0]},BS=function(a,b,c){Z.call(this,"saiz",0,0);this.f=a;this.j=b;this.h=c},CS=function(a,b){Z.call(this,"senc",a,b);this.h=0;this.j=8;this.f=[]},DS=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},ES=function(a,b,c,d){c=b.Oh[c];b=b.no;a=a.replace("Manifest","");b=b.replace("{bitrate}",
10
- String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.aE([a],[b])[0]},FS=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.r?c=["maxWidth","maxHeight","bitrate",AR,"fourCC"]:a.type===_.Zc&&(c=["bitrate",AR,"channels","bitsPerSample","samplingRate","fourCC"]);return _.N.na(a,b,c,["id","segmentIndex"])},GS=function(a,b,c){var d=c.He.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Za:null,
11
- ic:null,width:NaN,height:NaN,fc:null,ne:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.r:a.Za=[_.Sj(d[1])];a.ic=[_.Sj(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.Zc:a.fc=_.Sj(c.He),a.sampleSize=c.Cj||16,a.ne=c.ne,a.channelCount=c.eh}return a},HS=function(a,b){return a.filter(function(c){return c.type===b})},IS=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},PS=function(a,b,
12
- c){var d=null;if(JS.test(a)){a=JS.exec(a);d=Number(a[1]);var e=Number(a[2]),f=Number(a[3]),g=Number(a[4]);g+=(Number(a[5])||0)/c.f;f+=g/c.frameRate;d=f+60*e+3600*d}else KS.test(a)?d=IS(KS,a):LS.test(a)?d=IS(LS,a):MS.test(a)?(a=MS.exec(a),d=Number(a[1])/c.frameRate):NS.test(a)?(a=NS.exec(a),d=Number(a[1])/c.a):OS.test(a)&&(d=IS(OS,a));d+=b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-3600*b-60*c);d-=a;10>b&&(b="0"+b);10>c&&(c="0"+c);10>a&&(a="0"+a);0===d?d="000":d=Math.round(1E3*
13
- d);return b+":"+c+":"+a+"."+d},QS=function(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0===this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=parseInt(a[1],10)/parseInt(a[2],10))},SS=function(a){this.a=a;this.f=RS(this)},RS=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.cn(b)},TS=function(a,b,c){a:{var d=_.w([_.Od,_.Md]);for(var e=d.next();!e.done;e=d.next())if((e=c.Me(e.value))&&e.keyId){d=e.keyId;break a}_.Hh(zR,
14
- "Could not get default Key ID for DRM init data!");d=null}c=new IR("xxxx");a.type===_.r?c=new $R(a.width,a.height):c=new bS(a.channelCount,a.sampleSize,a.ne);a=new xS;a.f=1;a.h=8;a.l=d||"00000000000000000000000000000000";a=(new IR("schi")).append([a]);b=(new IR(_.bg)).append([new zS(b),new yS(_.qd,65536),a]);c.append([b]);return c},US=function(a,b){var c=b.Qe(),d=new OR(a.timescale,a.duration,a.id),e=(new PR).append([new QR(a.id)]),f=new RR(a.id,a.duration,a.timescale,a.width,a.height),g=new SR(a.timescale,
15
- a.duration),h=new TR(a.type),l=null,m=new fS;m.entries=[new eS];var n=new hS;switch(a.type){case _.r:var p=new cS(a.Za,a.ic);c?(l=TS(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new ZR(a.width,a.height)).append([p]),n.entries=[l]);l=new UR;break;case _.Zc:p=new dS(a.fc),c?(l=TS(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new aS(a.channelCount,a.sampleSize,a.ne)).append([p]),n.entries=[l]),l=new mS}n=(new gS).append([n,new iS,new jS,new lS,new kS]);m=(new nS).append([m]);m=(new oS).append([l,m,n]);
16
- g=(new pS).append([g,h,m]);f=(new NR).append([f,g]);d=(new MR).append([d,f,e]);e=new LR("dash",0,["iso6","mp41","avc1"]);c&&(c=b.Me(_.Md),f=b.Me(_.Od),c&&d.append([new JR("pssh",c.initData,8)]),f&&d.append([new JR("pssh",f.initData,8)]),c||f||_.Hh(zR,"Could not get PSSH init data!"));c=new SS([e,d]);return _.Fj(c.write())},WS=function(a,b){var c,d,e,f,g,h;(new _.qn).N("moof",_.rn).X("mfhd",function(m){var n=new rS;n.f=_.ln(m.reader);c=n}).N("traf",_.rn).X("tfhd",function(m){var n=m.reader.Pa();if(null===
17
- m.flags)throw new _.O(_.P,3,3019,yR);var p=new tS(m.version||0,m.flags||0);p.f=_.ln(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.h=_.nn(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.A=_.ln(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.j=_.ln(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.o=_.ln(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.l=_.ln(m.reader));d=p}).X("trun",function(m){var n=m.reader.Pa();if(null===m.flags)throw new _.O(_.P,3,3019,yR);var p=new sS(m.version||
18
- 0,m.flags||0);p.f=_.ln(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.mn(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.l=_.ln(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.f;n++)m.flags&256&&p.o.push(_.ln(m.reader)),m.flags&512&&p.sampleSize.push(_.ln(m.reader)),m.flags&1024&&p.A.push(_.ln(m.reader)),m.flags&2048&&(0===m.version?p.h.push(_.ln(m.reader)):p.h.push(_.mn(m.reader)));e=p}).X("sdtp",function(m){var n=_.pn(m.reader,m.reader.Pa());f=new KR("sdtp",m.version||0,m.flags||
19
- 0,n,0)}).N("uuid",function(m){var n=_.pn(m.reader,16);if(_.Uj(n,VS)){n=_.ln(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new CS(m.version,m.flags);n.h=_.ln(m.reader);m.flags&1&&(n.j=_.jn(m.reader));for(var p=0;p<n.h;p++){var q={ei:_.pn(m.reader,8),nd:0,Fg:[]};if(m.flags&2){q.nd=_.kn(m.reader);for(var t=0;t<q.nd;t++){var v={ah:0,bh:0};v.ah=_.kn(m.reader);v.bh=_.ln(m.reader);q.Fg.push(v)}}n.f.push(q)}g=n}}).N(_.Ne,function(m){var n=new wS;0<m.reader.Pa()?n.f=_.pn(m.reader,m.reader.Pa()):(_.Hh(zR,
20
- "mdat box is empty!"),n.f=new Uint8Array(0));h=n}).parse(a,!1);if(!h)return null;var l=(new uS).append([d,e]);f&&l.append([f]);b.Qe()&&g&&l.append([g]);l=(new vS).append([c,l]);return new SS([l,h])},XS=function(a,b,c,d){var e=d.Qe(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=WS(b,d);if(null===g)return a.request.contentType===_.Q?a.data:g;d=g.get(_.Ne);if(a.request.contentType===_.Q){e=d.f.buffer;if(c){e=_.T.Sd(e);if((e=(new DOMParser).parseFromString(e,_.pg))&&"tt"===e.documentElement.tagName.toLowerCase())var h=
21
- e.documentElement;if(h&&(d=new QS(h.getAttribute("ttp:frameRate"),h.getAttribute("ttp:subFrameRate"),h.getAttribute("ttp:frameRateMultiplier"),h.getAttribute("ttp:tickRate")),h=h.getElementsByTagName("body")[0]))for(h=h.getElementsByTagName("p"),a=0,b=h.length;a<b;a++){f=h[a];g=c;for(var l=["begin",_.oe],m=0,n=l.length;m<n;m++){b:{var p=f;var q=l[m],t=new RegExp("\\w+:"+q),v=0;if(p.hasAttribute(q))p=p.getAttribute(q);else{q=p.attributes;for(var z=q.length;v<z;v++){var A=q[v].name;if(A=A.match(t)){p=
22
- p.getAttribute(A[0]);break b}}p=null}}f.setAttribute(l[m],PS(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.T.$a(e).buffer}else c=e;return c}h=new vS;a=g.get("mfhd");b=new uS;l=g.get("tfhd");m=new qS(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");l.f=1;l.flags&=16777214;l.flags|=131072;b.append([l,m,f]);n&&b.append([n]);if(e){g=0;l=[];if(c.flags&2)for(l=[],m=0;m<c.h;m++)l.push(10+6*c.f[m].nd);else g=8;b.append([c,new AS,new BS(g,l,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=
23
- new SS([h,d]);h=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=c.start+16,d.seek(e.start),e.write(d),h=d.buffer);return h},YS=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},ZS=function(a,b,c){a=_.zo(a);c&&a.version!==c&&(a=_.RD(a,c));return{initData:_.PD(a),initDataType:_.qd,keyId:b,periodId:null}},aT=function(){this.w=this.h=this.f=
24
- this.D=null;this.M=1;this.P=0;this.l="";this.B=this.a=null;this.g=new _.K("clpp.smooth.SmoothParser");this.J=!1;this.j=this.A=null;this.L=$S;this.H=0;this.C=this.I=Infinity;this.o=[];this.K=this.Jn.bind(this);this.G=new Map},bT=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.ek(b),c.timeout=a.f.attemptParameters.timeout,c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length),c.baseDelay=a.f.attemptParameters.baseDelay,c.backoffFactor=a.f.attemptParameters.backoffFactor,
25
- c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.D.networkingEngine.fetch(c),_.y(f,d.T,2);e=f.f;a.l=e.uri;return f["return"](e)})},iT=function(a,b){var c=null;try{var d=_.T.Sd(b);c=_.io(d,_.Yb)}catch(nY){}if(!c)throw a.g.error("Unable to parse manifest"),new _.O(_.P,4,4033,a.l);var e=+cT(a,c,"MajorVersion"),f=+cT(a,c,"MinorVersion"),g=+c.getAttribute("TimeScale")||1E7,h=+cT(a,c,"Duration"),l="TRUE"===c.getAttribute("IsLive"),m=+c.getAttribute("LookAheadCount"),n=+c.getAttribute("DVRWindowLength")||
26
- Infinity,p=_.fo(c,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+e+"."+f))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.O(_.P,4,4036,a.l);l?(dT(a,eT),a.A=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.H,1E4),h=Infinity):dT(a,$S);a.a={startTime:0,delay:0,duration:h/g,Nf:n/g,ge:0};if(p){var q=a.f.playreadyVersion,t=[],v=_.fo(p,"ProtectionHeader")[0],z=_.Rj(_.ho(v)||""),A=_.zo(z).a;t.push(YS(_.Od,{initData:_.PD(_.mo(A)),initDataType:_.qd,keyId:A,
27
- periodId:null},[A]));t.push(YS(_.Md,ZS(z,A,q),[A]));a.o=t}var G=[],E=_.fo(c,"StreamIndex");if(!E.length)throw a.g.error("No streams found!"),new _.O(_.P,4,4034,a.l);for(var C=0;C<E.length;C++){for(var H,M=a,R=E[C],V=cT(M,R,"Type"),S=+R.getAttribute("Chunks"),Ba=R.getAttribute("Subtype")||"",Ca=R.getAttribute("Language")||_.ug,jb=_.wj(Ca),Wa=R.getAttribute("Name")||"",Ma=+R.getAttribute(_.sb),wb=+R.getAttribute(_.rb),Jb=cT(M,R,"Url"),Cg=+R.getAttribute("TimeScale")||null,ok=[],BJ=_.fo(R,_.Nb),ev=0;ev<
28
- BJ.length;ev++){var Bf=M,Id=BJ[ev],fv=V,TW=+Id.getAttribute("Index"),UW=+cT(Bf,Id,"Bitrate"),CJ=NaN,DJ=NaN,qo=NaN,gv=NaN,EJ=NaN,FJ=NaN,GJ=NaN,HJ=Id.getAttribute("FourCC")||"";switch(fv){case _.r:CJ=+cT(Bf,Id,_.rb);DJ=+cT(Bf,Id,_.sb);break;case _.Zc:gv=+Id.getAttribute("Channels")||2,qo=+cT(Bf,Id,"SamplingRate"),FJ=+cT(Bf,Id,"AudioTag"),EJ=+cT(Bf,Id,"BitsPerSample"),GJ=+cT(Bf,Id,"PacketSize")}var hv=String(Id.getAttribute("CodecPrivateData"));if(fv===_.Zc&&!hv){var IJ=gv,JJ={96E3:0,88200:1,64E3:2,
29
- 48E3:3,44100:4,32E3:5,24E3:6,22050:7,16E3:8,12E3:9,11025:10,8E3:11,7350:12},ro=JJ[qo];if("AACH"===HJ){var Nc=new Uint8Array(4);var KJ=JJ[2*qo];Nc[0]=40|ro>>1;Nc[1]=ro<<7|IJ<<3|KJ>>1;Nc[2]=KJ<<7|8;Nc[3]=0;var Fg=new Uint16Array(2);Fg[0]=(Nc[0]<<8)+Nc[1];Fg[1]=(Nc[2]<<8)+Nc[3];var LJ=Fg[0].toString(16)+Fg[1].toString(16)}else Nc=new Uint8Array(2),Nc[0]=16|ro>>1,Nc[1]=ro<<7|IJ<<3,Fg=new Uint16Array(1),Fg[0]=(Nc[0]<<8)+Nc[1],LJ=Fg[0].toString(16);hv=LJ.toUpperCase()}var VW={id:Bf.P++,type:fv,index:TW,
30
- bitrate:UW,He:hv,maxHeight:CJ,maxWidth:DJ,ne:qo,eh:gv,Do:FJ,Cj:EJ,Uo:GJ,ul:HJ,segmentIndex:null};ok.push(VW)}H=ok;for(var Je=[],MJ=_.fo(R,"c"),pk=0;pk<MJ.length;pk++){var iv=MJ[pk],je=parseInt(iv.getAttribute("t"),10),ai=parseInt(iv.getAttribute("d"),10),jv=parseInt(iv.getAttribute("r"),10),qk=0;if(isNaN(je)&&isNaN(ai))throw M.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.O(_.P,4,4037,M.l);0===pk&&isNaN(je)&&(qk=je=0);if(0<pk){var Gg=
31
- Je[Je.length-1];qk=Gg.n+1;Gg.d||(Gg.d=je-Gg.t);je||(je=Gg.t+Gg.d);ai||(ai=je-Gg.t)}Je.push({n:qk,d:ai,t:je});if(jv){jv--;for(var NJ=0;NJ<jv;NJ++){var so=Je[Je.length-1];qk=so.n+1;je=so.t+so.d;ai=so.d;Je.push({n:qk,d:ai,t:je})}}}M.Gd()||Je.length===S||M.g.warn("Number of fragments ("+S+") differs from number of chunks ("+Je.length+").");G.push({type:V,Io:S,Xn:Ba,language:jb,fe:Ca,name:Wa,maxWidth:Ma,maxHeight:wb,no:Jb,tracks:H,Oh:Je,timescale:Cg})}var Cf={So:e,wi:f,timescale:g,duration:h,isLive:l,
32
- Ro:m,Nf:n,Wf:!1,streams:G};if(a.h&&a.w)return fT(a,Cf),Promise.resolve();a.G.clear();var kv=Cf.timescale,to=Cf.duration,XW=HS(Cf.streams,_.Zc),YW=HS(Cf.streams,_.r),ZW=HS(Cf.streams,_.Q),OJ=[],uo=gT(a,to,kv,XW),vo=gT(a,to,kv,YW),$W=gT(a,to,kv,ZW);uo.length||(uo=[null]);vo.length||(vo=[null]);for(var mv=0;mv<vo.length;mv++)for(var nv=0;nv<uo.length;nv++)OJ.push(hT(a,vo[mv],uo[nv]));var PJ={id:"ID",configurationId:void 0,startTime:0,endTime:to,variants:OJ,textStreams:$W,thumbStreams:[]};var bX=Cf.streams,
33
- ov=a.a.startTime,QJ=a.a.delay,pv=a.I,RJ=Math.min(a.a.duration||Infinity,pv),qv=a.Gd(),cX=a.a.Nf,dX=a.a.ge,SJ=a.H,TJ=isFinite(a.C)?a.C:0;if(qv)RJ=Infinity,ov=Date.now()/1E3-dX,a.a.startTime=ov,QJ=3*SJ;else for(var eX=isFinite(pv)?pv:a.a.duration,UJ=_.w(bX),rv=UJ.next();!rv.done;rv=UJ.next())for(var VJ=_.w(rv.value.tracks),sv=VJ.next();!sv.done;sv=VJ.next()){var WJ=sv.value;WJ.segmentIndex.offset(-TJ);_.yE(WJ.segmentIndex,eX)}var XJ=a.f.timeline||{};XJ.type=void 0;a.B=new _.GE(XJ,ov,QJ,!qv,!0);a.B.f=
34
- RJ;_.OE(a.B,SJ);a.B.A=cX;qv||a.B.offset(-TJ);a.D.filterAllPeriods([PJ]);a.h={presentationTimeline:a.B,periods:[PJ],minBufferTime:0,cues:[]};Promise.resolve();a.J||(a.D.networkingEngine.Rc(a.K),a.J=!0);a.w=Cf;return Promise.resolve()},fT=function(a,b){for(var c=0;c<a.w.streams.length;c++)for(var d=b.streams[c],e={},f=_.w(a.w.streams[c].tracks),g=f.next();!g.done;e={dc:e.dc},g=f.next())if(e.dc=g.value,g=d.tracks.find(function(l){return function(m){return m.type===l.dc.type&&m.bitrate===l.dc.bitrate}}(e))){FS(e.dc,
35
- g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=jT(a,a.w.timescale,d,g);g=e.dc.segmentIndex;g.qa(h);(h=a.a.Nf)&&_.dF(g,_.cF(g)-h).forEach(function(l){l.Xa().forEach(function(m){a.G["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.dc.type+" track with bitrate "+(e.dc.bitrate+". Skipping update."))},gT=function(a,b,c,d){for(var e=[],f={Lc:0};f.Lc<d.length;f={Lc:f.Lc},f.Lc++){var g=d[f.Lc].tracks.map(function(h){return function(l){var m=
36
- d[h.Lc],n=jT(a,c,m,l);n=new _.bF(n);var p=null;m.type!==_.Q&&(p=kT(a,b,c,m,l));l.segmentIndex=n;var q=_.kL++,t=Promise.resolve.bind(Promise),v=n.Wc.bind(n),z=n.get.bind(n),A=n.wd.bind(n),G=n.getDuration.bind(n),E=lT[m.type],C="";switch(m.type){case _.r:C=l.He;var H=/00000001[0-9]7/.exec(C);C="avc1."+(H&&H[0]?C.substr(C.indexOf(H[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",C);break;case _.Zc:C=l.He,H=2,"AACH"===l.ul?H=5:C&&(H=(parseInt(C.substr(0,2),16)&248)>>3),C="mp4a.40."+H,a.g.debug("AUDIO CODECS: ",
37
- C)}H=m.type===_.Q?mT[m.Xn]:void 0;return{id:q,originalId:null,Wo:null,createSegmentIndex:t,findSegmentPosition:v,getSegmentReference:z,adjustSegmentDurations:A,getDuration:G,segmentIndex:n,segmentLookupStrategy:_.xD,initSegmentReference:p,mimeType:E,codecs:C,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:H,encrypted:a.Yf(),keyId:null,language:m.language,originalLanguage:m.fe,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,
38
- roles:[],channelsCount:l.eh||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},jT=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.Oh.forEach(function(h,l){var m=h.d/g;if(0===l){var n=h.t/g;a.C=Math.min(a.C,n)}else n=f[l-1].endTime;var p=n+m,q=ES(a.l,c,l,d);a.H=Math.max(a.H,m);f.push(new _.uj(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.G.set(q,n);e+=m});if(c.type===_.r||c.type===_.Zc)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.ge?a.a.ge=b.endTime:a.a.ge=Math.min(a.a.ge,
39
- b.endTime);return f},kT=function(a,b,c,d,e){b=GS(b,d.timescale||c,e);c={isLive:a.Gd.bind(a),Qe:a.Yf.bind(a),Cl:function(){return 1},Me:a.Rh.bind(a)};d=new Uint8Array(0);try{d=US(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.O(_.P,3,4035,g);}var f="data:text/plain;base64,"+_.Qj(d);return new _.cE(function(){return[f]},0,null,null,!0)},hT=function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.ug;return c||b?{id:a.M++,language:e,primary:!1,audio:c,
40
- video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},cT=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.O(_.P,4,4038,a.l,c);},nT=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.Yb.bind(a),b))},dT=function(a,b){var c=b===$S;a.h&&a.h.presentationTimeline&&_.JE(a.h.presentationTimeline,c);c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.L=b},oT=function(){};
41
- IR.prototype.append=function(a){a=void 0===a?[]:a;for(var b=0;b<a.length;b++)this.children.push(a[b]),a[b].parent=this;return this};IR.prototype.get=function(a){if(this.type===a)return this;for(var b=0;b<this.children.length;b++){if(this.children[b].type===a)return this.children[b];var c=this.children[b].get(a);if(c)return c}return null};
42
- IR.prototype.a=function(){var a=Math.pow(2,32)-1;var b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.children.length)for(var c=0;c<this.children.length;c++)b+=this.children[c].a();this.size>a&&(b+=8);return b};
43
- IR.prototype.write=function(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.W(a,1):_.W(a,this.size);_.en(a,HR(this.type));this.size>b&&BR(a,this.size);"uuid"===this.type&&_.en(a,null);if(0<this.children.length&&!this.w)for(b=0;b<this.children.length;b++)this.children[b].write(a),this.children[b].a(),a.getPosition()};_.x(Z,IR);Z.prototype.a=function(){return 4+IR.prototype.a.call(this)};
44
- Z.prototype.write=function(a){IR.prototype.write.call(this,a);CR(a,this.version);DR(a,this.flags)};_.x(JR,IR);JR.prototype.a=function(){return this.f.byteLength+IR.prototype.a.call(this)-this.offset};JR.prototype.write=function(a){IR.prototype.write.call(this,a);_.en(a,this.f,this.offset);a.getPosition()};_.x(KR,Z);KR.prototype.a=function(){return this.f.byteLength+Z.prototype.a.call(this)-this.offset};KR.prototype.write=function(a){Z.prototype.write.call(this,a);_.en(a,this.f,this.offset);a.getPosition()};
45
- _.x(LR,IR);LR.prototype.a=function(){var a=this.h.length;a=a+4+this.f.join("").length;return a+IR.prototype.a.call(this)};LR.prototype.write=function(a){IR.prototype.write.call(this,a);_.en(a,HR(this.h));_.W(a,this.wi);_.en(a,HR(this.f.join("")));a.getPosition()};_.x(MR,IR);_.x(NR,IR);_.x(OR,Z);OR.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;a=a+44+this.f.length;return a+=Z.prototype.a.call(this)};
46
- OR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(BR(a,0),BR(a,0),_.W(a,this.timescale),BR(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));_.W(a,65536);ER(a,this.volume);ER(a,0);_.W(a,0);_.W(a,0);for(var b=0;b<this.f.length;b++)CR(a,this.f[b]);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,this.h);a.getPosition()};_.x(PR,IR);_.x(QR,Z);QR.prototype.a=function(){return 20+Z.prototype.a.call(this)};
47
- QR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);_.W(a,1);_.W(a,0);_.W(a,0);_.W(a,0);a.getPosition()};_.x(RR,Z);RR.prototype.a=function(){var a=0;a=1===this.version?a+32:a+20;a=a+24+this.f.length;return a+Z.prototype.a.call(this)};
48
- RR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(BR(a,0),BR(a,0),_.W(a,this.h),_.W(a,0),BR(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.h),_.W(a,0),_.W(a,this.duration*this.timescale));_.W(a,0);_.W(a,0);ER(a,0);ER(a,0);ER(a,this.volume);ER(a,0);for(var b=0;b<this.f.length;b++)CR(a,this.f[b]);ER(a,this.width);ER(a,0);ER(a,this.height);ER(a,0);a.getPosition()};_.x(SR,Z);SR.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
49
- SR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(BR(a,0),BR(a,0),_.W(a,this.timescale),BR(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));ER(a,this.language);ER(a,0);a.getPosition()};_.x(TR,Z);TR.prototype.a=function(){return 33+Z.prototype.a.call(this)};
50
- TR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);this.f===_.r?_.en(a,HR("vide")):_.en(a,HR("soun"));_.W(a,0);_.W(a,0);_.W(a,0);this.f===_.r?_.en(a,HR("VideoHandler\x00")):_.en(a,HR("SoundHandler\x00"));a.getPosition()};_.x(UR,Z);UR.prototype.a=function(){return 2+this.f.byteLength+Z.prototype.a.call(this)};UR.prototype.write=function(a){Z.prototype.write.call(this,a);ER(a,0);_.en(a,this.f);a.getPosition()};_.x(VR,IR);VR.prototype.a=function(){return 8+IR.prototype.a.call(this)};
51
- VR.prototype.write=function(a){IR.prototype.write.call(this,a);_.W(a,0);ER(a,0);ER(a,1)};_.x(WR,VR);WR.prototype.a=function(){return 70+VR.prototype.a.call(this)};WR.prototype.write=function(a){VR.prototype.write.call(this,a);ER(a,0);ER(a,0);_.W(a,0);_.W(a,0);_.W(a,0);ER(a,this.width);ER(a,this.height);_.W(a,4718592);_.W(a,4718592);_.W(a,0);ER(a,1);CR(a,10);_.en(a,HR("AVC Coding",31));ER(a,this.depth);GR(a,-1)};_.x(YR,VR);YR.prototype.a=function(){return 20+VR.prototype.a.call(this)};
52
- YR.prototype.write=function(a){VR.prototype.write.call(this,a);_.W(a,0);_.W(a,0);ER(a,this.channelCount);ER(a,this.sampleSize);GR(a,0);ER(a,0);ER(a,this.sampleRate);ER(a,0)};_.x(ZR,WR);ZR.prototype.write=function(a){WR.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};_.x($R,ZR);_.x(aS,YR);aS.prototype.write=function(a){YR.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};
53
- _.x(bS,aS);_.x(cS,IR);cS.prototype.a=function(){for(var a=7,b=0;b<this.Za.length;b++)a+=2,a+=this.Za[b].byteLength;for(b=0;b<this.Za.length;b++)a+=2,a+=this.ic[b].byteLength;return a+IR.prototype.a.call(this)};
54
- cS.prototype.write=function(a){IR.prototype.write.call(this,a);CR(a,this.version);CR(a,this.f);CR(a,this.h);CR(a,this.level);CR(a,255);CR(a,224|this.Za.length);for(var b=0;b<this.Za.length;b++)ER(a,this.Za[b].length),_.en(a,this.Za[b]);CR(a,this.ic.length);for(b=0;b<this.ic.length;b++)ER(a,this.ic[b].length),_.en(a,this.ic[b]);a.getPosition()};_.x(dS,Z);dS.prototype.a=function(){return 22+(this.fc.byteLength+3)+Z.prototype.a.call(this)};
55
- dS.prototype.write=function(a){Z.prototype.write.call(this,a);CR(a,3);CR(a,23+this.fc.byteLength);ER(a,1);CR(a,0);CR(a,4);CR(a,15+this.fc.byteLength);CR(a,64);CR(a,21);DR(a,0);_.W(a,0);_.W(a,0);CR(a,5);CR(a,this.fc.byteLength);_.en(a,this.fc);_.en(a,new Uint8Array([6,1,2]));a.getPosition()};_.x(eS,Z);eS.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};eS.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.en(a,HR(this.location));a.getPosition()};
56
- _.x(fS,Z);fS.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};fS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(gS,IR);_.x(hS,Z);hS.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};
57
- hS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(iS,Z);iS.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};iS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(jS,Z);
58
- jS.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};jS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(kS,Z);kS.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};
59
- kS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(lS,Z);lS.prototype.a=function(){return 8+Z.prototype.a.call(this)};lS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);_.W(a,0);a.getPosition()};_.x(mS,Z);mS.prototype.a=function(){return 4+Z.prototype.a.call(this)};mS.prototype.write=function(a){Z.prototype.write.call(this,a);GR(a,0);ER(a,0);a.getPosition()};
60
- _.x(nS,IR);_.x(oS,IR);_.x(pS,IR);_.x(qS,Z);qS.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};qS.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?BR(a,this.baseMediaDecodeTime):_.W(a,this.baseMediaDecodeTime);a.getPosition()};_.x(rS,Z);rS.prototype.a=function(){return 4+Z.prototype.a.call(this)};rS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);a.getPosition()};_.x(sS,Z);
61
- sS.prototype.a=function(){var a=4;this.flags&pT&&(a+=4);this.flags&qT&&(a+=4);for(var b=0;b<this.f;b++)this.flags&rT&&(a+=4),this.flags&sT&&(a+=4),this.flags&tT&&(a+=4),this.flags&uT&&(a+=4);return a+Z.prototype.a.call(this)};
62
- sS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);this.flags&pT&&(a.getPosition(),FR(a,this.j));this.flags&qT&&_.W(a,this.l);for(var b=0;b<this.f;b++)this.flags&rT&&_.W(a,this.o[b]),this.flags&sT&&_.W(a,this.sampleSize[b]),this.flags&tT&&_.W(a,this.A[b]),this.flags&uT&&(0===this.version?_.W(a,this.h[b]):FR(a,this.h[b]));a.getPosition()};var pT=1,qT=4,rT=256,sT=512,tT=1024,uT=2048;_.x(tS,Z);
63
- tS.prototype.a=function(){var a=4;this.flags&vT&&(a+=8);this.flags&wT&&(a+=4);this.flags&xT&&(a+=4);this.flags&yT&&(a+=4);this.flags&zT&&(a+=4);return a+Z.prototype.a.call(this)};tS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);this.flags&vT&&BR(a,this.h);this.flags&wT&&_.W(a,this.A);this.flags&xT&&_.W(a,this.j);this.flags&yT&&_.W(a,this.o);this.flags&zT&&_.W(a,this.l);a.getPosition()};var vT=1,wT=2,xT=8,yT=16,zT=32;_.x(uS,IR);_.x(vS,IR);_.x(wS,IR);
64
- wS.prototype.a=function(){return this.f.byteLength+IR.prototype.a.call(this)};wS.prototype.write=function(a){IR.prototype.write.call(this,a);0<this.f.byteLength&&_.en(a,this.f)};_.x(xS,Z);xS.prototype.a=function(){var a=20;1===this.f&&0===this.h&&(a=a+1+this.j.length);return a+Z.prototype.a.call(this)};
65
- xS.prototype.write=function(a){Z.prototype.write.call(this,a);CR(a,0);0===this.version?CR(a,0):CR(a,0);CR(a,this.f);CR(a,this.h);_.en(a,_.Sj(this.l));if(1===this.f&&0===this.h){CR(a,0);for(var b=0;b<this.j.length;b++)CR(a,this.j[b])}a.getPosition()};_.x(yS,Z);yS.prototype.a=function(){var a=8;this.flags&1&&(a+=HR(this.$b).byteLength);return a+Z.prototype.a.call(this)};yS.prototype.write=function(a){Z.prototype.write.call(this,a);_.en(a,HR(this.f));_.W(a,this.h);this.flags&1&&_.en(a,HR(this.$b));a.getPosition()};
66
- _.x(zS,IR);zS.prototype.a=function(){return HR(this.f).byteLength+IR.prototype.a.call(this)};zS.prototype.write=function(a){IR.prototype.write.call(this,a);_.en(a,HR(this.f));a.getPosition()};_.x(AS,Z);AS.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=4;for(var b=0;1>b;b++)a=0===this.version?a+4:a+8;return a+Z.prototype.a.call(this)};
67
- AS.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));_.W(a,1);for(var b=0;1>b;b++)0===this.version?_.W(a,this.offset[b]):BR(a,this.offset[b]);a.getPosition()};_.x(BS,Z);BS.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=5;0===this.f&&(a+=this.j.length);return a+Z.prototype.a.call(this)};
68
- BS.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));CR(a,this.f);_.W(a,this.h);if(0===this.f)for(var b=0;b<this.h;b++)CR(a,this.j[b]);a.getPosition()};_.x(CS,Z);CS.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.h;b++)if(a+=this.f[b].ei.byteLength,this.flags&2){a+=2;for(var c=0;c<this.f[b].nd;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
69
- CS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.h);this.flags&1&&CR(a,this.j);for(var b=0;b<this.h;b++)if(_.en(a,this.f[b].ei),this.flags&2){ER(a,this.f[b].nd);for(var c=0;c<this.f[b].nd;c++)ER(a,this.f[b].Fg[c].ah),_.W(a,this.f[b].Fg[c].bh)}a.getPosition()};var JS=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,KS=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,LS=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,MS=/^(\d*\.?\d*)f$/,NS=/^(\d*\.?\d*)t$/,OS=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;SS.prototype.get=function(a){for(var b=0;b<this.a.length;b++){var c=this.a[b].get(a);if(c)return c}return null};SS.prototype.write=function(){this.f=RS(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var VS=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.u=aT.prototype;_.u.configure=function(a){this.f=a};_.u.start=function(a,b){var c=this;this.D=b;var d=_.eh(new Set([a,DS(a)])).concat();return bT(this,d).then(function(e){return iT(c,e.data).then(function(){nT(c,c.A);return c.h})})};_.u.requestStop=function(){};_.u.stop=function(){this.D&&this.D.networkingEngine.me(this.K);this.A=this.w=this.h=this.f=this.D=null;this.j&&(clearTimeout(this.j),this.j=null);this.J=!1;this.I=this.C=Infinity;return Promise.resolve()};
70
- _.u.update=function(){var a=this;if(this.Gd())return bT(this,[this.l]).then(function(b){return iT(a,b.data).then(function(){return a.h})})["catch"](function(b){if(a.D)a.D.onError(b)})};_.u.setCurrentVariant=function(){};_.u.Yb=function(){var a=this;this.g.debug(_.nD);this.D&&(this.j=null,this.update().then(function(){nT(a,a.A)})["catch"](function(b){a.D&&(a.D.onError(b),1===b.severity&&nT(a,100))}))};_.u.Gd=function(){return this.L===eT};_.u.Yf=function(){return 0<this.o.length};
71
- _.u.Rh=function(a){var b=null;if(this.o.length)for(var c=0;c<this.o.length;c++)if(this.o[c].keySystem===a){b=this.o[c].initData[0];break}return b};
72
- _.u.Jn=function(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);var b=a.request.timescale||this.w.timescale,c={isLive:this.Gd.bind(this),Qe:this.Yf.bind(this),Cl:function(){return 1},Me:this.Rh.bind(this)},d=!1,e=new _.O(_.P,3,4035,null),f=null;try{var g=this.G.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.g.debug("Using base media decode time "+g+" instead of segment reference time "+a.request.startTime);f=XS(a,b,g,c)}catch(h){d=
73
- !0,e.data=h,3E3===h.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)};var lT={video:_.Jg,audio:_.cd,text:_.Wc},$S=_.hc,eT="LIVE",mT={po:_.md,wo:_.lg};_.x(oT,_.Kt);oT.prototype.f=function(){_.Ju.ism=aT;_.Hu[_.Xc]=aT};oT.prototype.a=function(){_.FF("ism");_.GF(_.Xc)};oT.prototype.id=function(){return _.cg};_.J("clpp.smooth.SmoothComponent",oT);};
2
+ var f=function(window){var vS="Full MP4 box must have flags defined",wS="clpp.smooth.SmoothMP4Processor",xS="codecPrivateData",yS=function(a,b){var c=Math.floor(b/Math.pow(2,32)),d=b-c*Math.pow(2,32);_.W(a,c);_.W(a,d)},zS=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.qn()}},AS=function(a,b){zS(a,b>>16&255);zS(a,b>>8&255);zS(a,b&255)},BS=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.qn()}},CS=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.qn()}},DS=function(a,b){try{a.f.setInt16(a.a,
3
+ b,a.h),a.a+=2}catch(c){_.qn()}},ES=function(a,b){if(void 0!==b){for(var c=new Uint8Array(b),d=Math.min(a.length,b),e=0;e<d;++e)c[e]=a.charCodeAt(e);for(;e<b;e++)c[e]=0;return c}c=new Uint8Array(a.length);for(d=0;d<a.length;++d)c[d]=a.charCodeAt(d);return c},FS=function(a){this.type=a;this.size=this.start=0;this.parent=null;this.w=!1;this.entries=[];this.children=[]},Z=function(a,b,c){FS.call(this,a);this.version=b;this.flags=c},GS=function(a,b,c){FS.call(this,a);this.f=b;this.offset=c},HS=function(a,
4
+ b,c,d,e){Z.call(this,a,b,c);this.f=d;this.offset=e},IS=function(a,b,c){FS.call(this,"ftyp");this.h=a;this.Qi=b;this.f=c},JS=function(){FS.call(this,_.bf)},KS=function(){FS.call(this,_.Ig)},LS=function(a,b,c){Z.call(this,"mvhd",1,0);this.timescale=a;this.duration=b;this.volume=256;this.h=c+1;this.f=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]},MS=function(){FS.call(this,"mvex")},NS=function(a){Z.call(this,"trex",0,0);this.f=a},OS=function(a,b,c,d,e){Z.call(this,"tkhd",
5
+ 1,7);this.h=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.f=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]},PS=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},QS=function(a){Z.call(this,"hdlr",0,0);this.f=a},RS=function(){Z.call(this,"vmhd",0,1);this.f=new Uint8Array([0,0,0,0,0,0])},SS=function(a){FS.call(this,a);this.w=!0},TS=function(a){SS.call(this,a);this.height=this.width=0;this.depth=24},
6
+ US=function(a,b,c,d){SS.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},VS=function(a,b){TS.call(this,"avc1");this.width=a;this.height=b},WS=function(a,b){VS.call(this,a,b);this.type="encv"},XS=function(a,b,c){US.call(this,"mp4a",a,b,c)},YS=function(a,b,c){XS.call(this,a,b,c);this.type="enca"},ZS=function(a,b){FS.call(this,"avcC");this.hb=a;this.tc=b;this.version=1;this.f=this.hb[0][1];this.h=this.hb[0][2];this.level=this.hb[0][3]},$S=function(a){Z.call(this,"esds",0,0);this.pc=
7
+ a},aT=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},bT=function(){Z.call(this,"dref",0,0)},cT=function(){FS.call(this,_.sg)},dT=function(){Z.call(this,_.ug,0,0)},eT=function(){Z.call(this,"stts",0,0)},fT=function(){Z.call(this,"stsc",0,0)},gT=function(){Z.call(this,"stco",0,0)},hT=function(){Z.call(this,"stsz",0,0)},iT=function(){Z.call(this,"smhd",0,0)},jT=function(){FS.call(this,"dinf")},kT=function(){FS.call(this,_.af)},lT=function(){FS.call(this,_.Xe)},mT=function(a,b){Z.call(this,
8
+ "tfdt",a,0);this.baseMediaDecodeTime=b},nT=function(){Z.call(this,"mfhd",0,0);this.f=0},oT=function(a,b){Z.call(this,"trun",a,b);this.l=this.j=this.f=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]},pT=function(a,b){Z.call(this,"tfhd",a,b);this.f=255;this.l=this.o=this.j=this.A=this.h=0},qT=function(){FS.call(this,"traf")},rT=function(){FS.call(this,"moof")},sT=function(){FS.call(this,_.We);this.f=new Uint8Array(0)},tT=function(){Z.call(this,"tenc",0,0);this.f=1;this.h=8;this.l="";this.j=[]},uT=
9
+ function(a,b){Z.call(this,"schm",0,0);this.f=a;this.h=b;this.kc=""},vT=function(a){FS.call(this,"frma");this.f=a},wT=function(){Z.call(this,"saio",0,0);this.offset=[0]},xT=function(a,b,c){Z.call(this,"saiz",0,0);this.f=a;this.j=b;this.h=c},yT=function(a,b){Z.call(this,"senc",a,b);this.h=0;this.j=8;this.f=[]},zT=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},AT=function(a,b,c,d){c=b.gi[c];b=b.Ro;a=a.replace("Manifest","");b=b.replace("{bitrate}",
10
+ String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.DE([a],[b])[0]},BT=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.r?c=["maxWidth","maxHeight","bitrate",xS,"fourCC"]:a.type===_.cd&&(c=["bitrate",xS,"channels","bitsPerSample","samplingRate","fourCC"]);return _.N.qa(a,b,c,["id","segmentIndex"])},CT=function(a,b,c){var d=c.We.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,hb:null,
11
+ tc:null,width:NaN,height:NaN,pc:null,Be:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.r:a.hb=[_.kk(d[1])];a.tc=[_.kk(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.cd:a.pc=_.kk(c.We),a.sampleSize=c.$j||16,a.Be=c.Be,a.channelCount=c.xh}return a},DT=function(a,b){return a.filter(function(c){return c.type===b})},ET=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},LT=function(a,b,
12
+ c){var d=null;if(FT.test(a)){a=FT.exec(a);d=Number(a[1]);var e=Number(a[2]),f=Number(a[3]),g=Number(a[4]);g+=(Number(a[5])||0)/c.f;f+=g/c.frameRate;d=f+60*e+3600*d}else GT.test(a)?d=ET(GT,a):HT.test(a)?d=ET(HT,a):IT.test(a)?(a=IT.exec(a),d=Number(a[1])/c.frameRate):JT.test(a)?(a=JT.exec(a),d=Number(a[1])/c.a):KT.test(a)&&(d=ET(KT,a));d+=b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-3600*b-60*c);d-=a;10>b&&(b="0"+b);10>c&&(c="0"+c);10>a&&(a="0"+a);0===d?d="000":d=Math.round(1E3*
13
+ d);return b+":"+c+":"+a+"."+d},MT=function(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0===this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=parseInt(a[1],10)/parseInt(a[2],10))},OT=function(a){this.a=a;this.f=NT(this)},NT=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.pn(b)},PT=function(a,b,c){a:{var d=_.w([_.Xd,_.Vd]);for(var e=d.next();!e.done;e=d.next())if((e=c.bf(e.value))&&e.keyId){d=e.keyId;break a}_.Wh(wS,
14
+ "Could not get default Key ID for DRM init data!");d=null}c=new FS("xxxx");a.type===_.r?c=new WS(a.width,a.height):c=new YS(a.channelCount,a.sampleSize,a.Be);a=new tT;a.f=1;a.h=8;a.l=d||"00000000000000000000000000000000";a=(new FS("schi")).append([a]);b=(new FS(_.mg)).append([new vT(b),new uT(_.vd,65536),a]);c.append([b]);return c},QT=function(a,b){var c=b.ef(),d=new LS(a.timescale,a.duration,a.id),e=(new MS).append([new NS(a.id)]),f=new OS(a.id,a.duration,a.timescale,a.width,a.height),g=new PS(a.timescale,
15
+ a.duration),h=new QS(a.type),l=null,m=new bT;m.entries=[new aT];var n=new dT;switch(a.type){case _.r:var p=new ZS(a.hb,a.tc);c?(l=PT(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new VS(a.width,a.height)).append([p]),n.entries=[l]);l=new RS;break;case _.cd:p=new $S(a.pc),c?(l=PT(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new XS(a.channelCount,a.sampleSize,a.Be)).append([p]),n.entries=[l]),l=new iT}n=(new cT).append([n,new eT,new fT,new hT,new gT]);m=(new jT).append([m]);m=(new kT).append([l,m,n]);
16
+ g=(new lT).append([g,h,m]);f=(new KS).append([f,g]);d=(new JS).append([d,f,e]);e=new IS("dash",0,["iso6","mp41","avc1"]);c&&(c=b.bf(_.Vd),f=b.bf(_.Xd),c&&d.append([new GS("pssh",c.initData,8)]),f&&d.append([new GS("pssh",f.initData,8)]),c||f||_.Wh(wS,"Could not get PSSH init data!"));c=new OT([e,d]);return _.Xj(c.write())},ST=function(a,b){var c,d,e,f,g,h;(new _.Cn).N("moof",_.Dn).aa("mfhd",function(m){var n=new nT;n.f=_.xn(m.reader);c=n}).N("traf",_.Dn).aa("tfhd",function(m){var n=m.reader.Wa();
17
+ if(null===m.flags)throw new _.O(_.P,3,3019,vS);var p=new pT(m.version||0,m.flags||0);p.f=_.xn(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.h=_.zn(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.A=_.xn(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.j=_.xn(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.o=_.xn(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.l=_.xn(m.reader));d=p}).aa("trun",function(m){var n=m.reader.Wa();if(null===m.flags)throw new _.O(_.P,3,3019,vS);
18
+ var p=new oT(m.version||0,m.flags||0);p.f=_.xn(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.yn(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.l=_.xn(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.f;n++)m.flags&256&&p.o.push(_.xn(m.reader)),m.flags&512&&p.sampleSize.push(_.xn(m.reader)),m.flags&1024&&p.A.push(_.xn(m.reader)),m.flags&2048&&(0===m.version?p.h.push(_.xn(m.reader)):p.h.push(_.yn(m.reader)));e=p}).aa("sdtp",function(m){var n=_.Bn(m.reader,m.reader.Wa());f=new HS("sdtp",
19
+ m.version||0,m.flags||0,n,0)}).N("uuid",function(m){var n=_.Bn(m.reader,16);if(_.mk(n,RT)){n=_.xn(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new yT(m.version,m.flags);n.h=_.xn(m.reader);m.flags&1&&(n.j=_.vn(m.reader));for(var p=0;p<n.h;p++){var q={Bi:_.Bn(m.reader,8),Cd:0,Xg:[]};if(m.flags&2){q.Cd=_.wn(m.reader);for(var u=0;u<q.Cd;u++){var v={uh:0,vh:0};v.uh=_.wn(m.reader);v.vh=_.xn(m.reader);q.Xg.push(v)}}n.f.push(q)}g=n}}).N(_.We,function(m){var n=new sT;0<m.reader.Wa()?n.f=_.Bn(m.reader,m.reader.Wa()):
20
+ (_.Wh(wS,"mdat box is empty!"),n.f=new Uint8Array(0));h=n}).parse(a,!1);if(!h)return null;var l=(new qT).append([d,e]);f&&l.append([f]);b.ef()&&g&&l.append([g]);l=(new rT).append([c,l]);return new OT([l,h])},TT=function(a,b,c,d){var e=d.ef(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=ST(b,d);if(null===g)return a.request.contentType===_.Q?a.data:g;d=g.get(_.We);if(a.request.contentType===_.Q){e=d.f.buffer;if(c){e=_.T.ce(e);if((e=(new DOMParser).parseFromString(e,_.Ag))&&"tt"===e.documentElement.tagName.toLowerCase())var h=
21
+ e.documentElement;if(h&&(d=new MT(h.getAttribute("ttp:frameRate"),h.getAttribute("ttp:subFrameRate"),h.getAttribute("ttp:frameRateMultiplier"),h.getAttribute("ttp:tickRate")),h=h.getElementsByTagName("body")[0]))for(h=h.getElementsByTagName("p"),a=0,b=h.length;a<b;a++){f=h[a];g=c;for(var l=["begin",_.xe],m=0,n=l.length;m<n;m++){b:{var p=f;var q=l[m],u=new RegExp("\\w+:"+q),v=0;if(p.hasAttribute(q))p=p.getAttribute(q);else{q=p.attributes;for(var z=q.length;v<z;v++){var A=q[v].name;if(A=A.match(u)){p=
22
+ p.getAttribute(A[0]);break b}}p=null}}f.setAttribute(l[m],LT(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.T.ib(e).buffer}else c=e;return c}h=new rT;a=g.get("mfhd");b=new qT;l=g.get("tfhd");m=new mT(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");l.f=1;l.flags&=16777214;l.flags|=131072;b.append([l,m,f]);n&&b.append([n]);if(e){g=0;l=[];if(c.flags&2)for(l=[],m=0;m<c.h;m++)l.push(10+6*c.f[m].Cd);else g=8;b.append([c,new wT,new xT(g,l,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=
23
+ new OT([h,d]);h=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=c.start+16,d.seek(e.start),e.write(d),h=d.buffer);return h},UT=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},VT=function(a,b,c){a=_.kp(a);c&&a.version!==c&&(a=_.sE(a,c));return{initData:_.qE(a),initDataType:_.vd,keyId:b,periodId:null}},XT=function(){this.A=this.j=this.f=
24
+ this.D=null;this.h=1;this.P=0;this.o="";this.C=this.a=null;this.g=new _.K("clpp.smooth.SmoothParser");this.K=!1;this.l=this.B=null;this.M=WT;this.I=0;this.G=this.J=Infinity;this.w=[];this.L=this.no.bind(this);this.H=new Map},YT=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.wk(b),c.timeout=a.f.attemptParameters.timeout,c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length),c.baseDelay=a.f.attemptParameters.baseDelay,c.backoffFactor=a.f.attemptParameters.backoffFactor,
25
+ c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.D.networkingEngine.fetch(c),_.y(f,d.T,2);e=f.f;a.o=e.uri;return f["return"](e)})},eU=function(a,b){var c=_.fp,d=null;try{var e=_.T.ce(b);d=c.we(e,_.Zb)}catch(jZ){}if(!d)throw a.g.error("Unable to parse manifest"),new _.O(_.P,4,4033,a.o);var f=+ZT(a,d,"MajorVersion"),g=+ZT(a,d,"MinorVersion"),h=+d.getAttribute("TimeScale")||1E7,l=+ZT(a,d,"Duration"),m="TRUE"===d.getAttribute("IsLive"),n=+d.getAttribute("LookAheadCount"),p=+d.getAttribute("DVRWindowLength")||
26
+ Infinity,q=c.Z(d,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+f+"."+g))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.O(_.P,4,4036,a.o);m?($T(a,aU),a.B=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),l=Infinity):$T(a,WT);a.a={startTime:0,delay:0,duration:l/h,gg:p/h,se:0};if(q){var u=a.f.playreadyVersion,v=_.fp,z=[],A=v.Z(q,"ProtectionHeader")[0],H=_.jk(v.sa(A)||""),G=_.kp(H).a;z.push(UT(_.Xd,{initData:_.qE(_.cp(G)),initDataType:_.vd,
27
+ keyId:G,periodId:null},[G]));z.push(UT(_.Vd,VT(H,G,u),[G]));a.w=z}var D=[],F=_.fp.Z(d,"StreamIndex");if(!F.length)throw a.g.error("No streams found!"),new _.O(_.P,4,4034,a.o);for(var M=0;M<F.length;M++){for(var R,la=a,V=F[M],za=ZT(la,V,"Type"),Ia=+V.getAttribute("Chunks"),Aa=V.getAttribute("Subtype")||"",Ca=V.getAttribute("Language")||_.Lg,La=_.Oj(Ca),zb=V.getAttribute("Name")||"",Nd=+V.getAttribute(_.ub),Ff=+V.getAttribute(_.tb),ei=ZT(la,V,"Url"),Od=+V.getAttribute("TimeScale")||null,Jn=[],jK=_.fp.Z(V,
28
+ _.Pb),Jv=0;Jv<jK.length;Jv++){var Hf=void 0,uc=void 0,Kv=void 0,If=la,Rd=jK[Jv],Lv=za,PX=+Rd.getAttribute("Index"),QX=+ZT(If,Rd,"Bitrate"),kK=NaN,lK=NaN,Go=NaN,Mv=NaN,mK=NaN,nK=NaN,oK=NaN,pK=Rd.getAttribute("FourCC")||"";switch(Lv){case _.r:kK=+ZT(If,Rd,_.tb);lK=+ZT(If,Rd,_.ub);break;case _.cd:Mv=+Rd.getAttribute("Channels")||2,Go=+ZT(If,Rd,"SamplingRate"),nK=+ZT(If,Rd,"AudioTag"),mK=+ZT(If,Rd,"BitsPerSample"),oK=+ZT(If,Rd,"PacketSize")}var Nv=String(Rd.getAttribute("CodecPrivateData"));if(Lv===_.cd&&
29
+ !Nv){var qK=Mv,rK={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},Ho=rK[Go];if("AACH"===pK){uc=new Uint8Array(4);var sK=rK[2*Go];uc[0]=40|Ho>>1;uc[1]=Ho<<7|qK<<3|sK>>1;uc[2]=sK<<7|8;uc[3]=0;Hf=new Uint16Array(2);Hf[0]=(uc[0]<<8)+uc[1];Hf[1]=(uc[2]<<8)+uc[3];Kv=Hf[0].toString(16)+Hf[1].toString(16)}else uc=new Uint8Array(2),uc[0]=16|Ho>>1,uc[1]=Ho<<7|qK<<3,Hf=new Uint16Array(1),Hf[0]=(uc[0]<<8)+uc[1],Kv=Hf[0].toString(16);Nv=Kv.toUpperCase()}var RX=
30
+ {id:If.P++,type:Lv,index:PX,bitrate:QX,We:Nv,maxHeight:kK,maxWidth:lK,Be:Go,xh:Mv,gp:nK,$j:mK,xp:oK,Wl:pK,segmentIndex:null};Jn.push(RX)}R=Jn;for(var Ne=[],tK=_.fp.Z(V,"c"),yk=0;yk<tK.length;yk++){var Ov=tK[yk],oe=parseInt(Ov.getAttribute("t"),10),ii=parseInt(Ov.getAttribute("d"),10),Pv=parseInt(Ov.getAttribute("r"),10),zk=0;if(isNaN(oe)&&isNaN(ii))throw la.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.O(_.P,4,4037,la.o);0===yk&&
31
+ isNaN(oe)&&(zk=oe=0);if(0<yk){var Mg=Ne[Ne.length-1];zk=Mg.n+1;Mg.d||(Mg.d=oe-Mg.t);oe||(oe=Mg.t+Mg.d);ii||(ii=oe-Mg.t)}Ne.push({n:zk,d:ii,t:oe});if(Pv){Pv--;for(var uK=0;uK<Pv;uK++){var Io=Ne[Ne.length-1];zk=Io.n+1;oe=Io.t+Io.d;ii=Io.d;Ne.push({n:zk,d:ii,t:oe})}}}la.Td()||Ne.length===Ia||la.g.warn("Number of fragments ("+Ia+") differs from number of chunks ("+Ne.length+").");D.push({type:za,lp:Ia,Co:Aa,language:La,re:Ca,name:zb,maxWidth:Nd,maxHeight:Ff,Ro:ei,tracks:R,gi:Ne,timescale:Od})}var Jf=
32
+ {vp:f,Qi:g,timescale:h,duration:l,isLive:m,up:n,gg:p,pg:!1,streams:D};if(a.j&&a.A)return bU(a,Jf),Promise.resolve();a.H.clear();var Qv=Jf.timescale,Jo=Jf.duration,TX=DT(Jf.streams,_.cd),UX=DT(Jf.streams,_.r),VX=DT(Jf.streams,_.Q),vK=[],Ko=cU(a,Jo,Qv,TX),Lo=cU(a,Jo,Qv,UX),WX=cU(a,Jo,Qv,VX);Ko.length||(Ko=[null]);Lo.length||(Lo=[null]);for(var Sv=0;Sv<Lo.length;Sv++)for(var Tv=0;Tv<Ko.length;Tv++)vK.push(dU(a,Lo[Sv],Ko[Tv]));var wK={id:"ID",configurationId:void 0,startTime:0,endTime:Jo,variants:vK,
33
+ textStreams:WX,thumbStreams:[]};var YX=Jf.streams,Uv=a.a.startTime,xK=a.a.delay,Vv=a.J,yK=Math.min(a.a.duration||Infinity,Vv),Wv=a.Td(),ZX=a.a.gg,$X=a.a.se,zK=a.I,AK=isFinite(a.G)?a.G:0;if(Wv)yK=Infinity,Uv=Date.now()/1E3-$X,a.a.startTime=Uv,xK=3*zK;else for(var aY=isFinite(Vv)?Vv:a.a.duration,BK=_.w(YX),Xv=BK.next();!Xv.done;Xv=BK.next())for(var CK=_.w(Xv.value.tracks),Yv=CK.next();!Yv.done;Yv=CK.next()){var DK=Yv.value;DK.segmentIndex.offset(-AK);_.fF(DK.segmentIndex,aY)}var EK=a.f.timeline||{};
34
+ EK.type=void 0;a.C=new _.nF(EK,Uv,xK,!Wv,!0);a.C.f=yK;_.vF(a.C,zK);a.C.A=ZX;Wv||a.C.offset(-AK);a.D.filterAllPeriods([wK]);a.j={presentationTimeline:a.C,periods:[wK],minBufferTime:0,cues:[]};Promise.resolve();a.K||(a.D.networkingEngine.fd(a.L),a.K=!0);a.A=Jf;return Promise.resolve()},bU=function(a,b){for(var c=0;c<a.A.streams.length;c++)for(var d=b.streams[c],e={},f=_.w(a.A.streams[c].tracks),g=f.next();!g.done;e={oc:e.oc},g=f.next())if(e.oc=g.value,g=d.tracks.find(function(l){return function(m){return m.type===
35
+ l.oc.type&&m.bitrate===l.oc.bitrate}}(e))){BT(e.oc,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=fU(a,a.A.timescale,d,g);g=e.oc.segmentIndex;g.ua(h);(h=a.a.gg)&&_.LF(g,_.KF(g)-h).forEach(function(l){l.eb().forEach(function(m){a.H["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.oc.type+" track with bitrate "+(e.oc.bitrate+". Skipping update."))},cU=function(a,b,c,d){for(var e=[],f={$c:0};f.$c<d.length;f={$c:f.$c},
36
+ f.$c++){var g=d[f.$c].tracks.map(function(h){return function(l){var m=d[h.$c],n=fU(a,c,m,l);n=new _.JF(n);var p=null;m.type!==_.Q&&(p=gU(a,b,c,m,l));l.segmentIndex=n;var q=_.cM++,u=Promise.resolve.bind(Promise),v=n.ld.bind(n),z=n.get.bind(n),A=n.Ld.bind(n),H=n.getDuration.bind(n),G=hU[m.type],D="";switch(m.type){case _.r:D=l.We;var F=/00000001[0-9]7/.exec(D);D="avc1."+(F&&F[0]?D.substr(D.indexOf(F[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",D);break;case _.cd:D=l.We,F=2,"AACH"===l.Wl?F=5:D&&(F=
37
+ (parseInt(D.substr(0,2),16)&248)>>3),D="mp4a.40."+F,a.g.debug("AUDIO CODECS: ",D)}F=m.type===_.Q?iU[m.Co]:void 0;return{id:q,originalId:null,Ap:null,createSegmentIndex:u,findSegmentPosition:v,getSegmentReference:z,adjustSegmentDurations:A,getDuration:H,segmentIndex:n,segmentLookupStrategy:_.YD,initSegmentReference:p,mimeType:G,codecs:D,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:F,encrypted:a.rg(),keyId:null,language:m.language,originalLanguage:m.re,
38
+ label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.xh||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},fU=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.gi.forEach(function(h,l){var m=h.d/g;if(0===l){var n=h.t/g;a.G=Math.min(a.G,n)}else n=f[l-1].endTime;var p=n+m,q=AT(a.o,c,l,d);a.I=Math.max(a.I,m);f.push(new _.Mj(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.H.set(q,n);e+=m});if(c.type===_.r||c.type===_.cd)b=f[f.length-
39
+ 1],a.J=Math.min(a.J,e),0===a.a.se?a.a.se=b.endTime:a.a.se=Math.min(a.a.se,b.endTime);return f},gU=function(a,b,c,d,e){b=CT(b,d.timescale||c,e);c={isLive:a.Td.bind(a),ef:a.rg.bind(a),cm:function(){return 1},bf:a.ki.bind(a)};d=new Uint8Array(0);try{d=QT(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.O(_.P,3,4035,g);}var f="data:text/plain;base64,"+_.ik(d);return new _.FE(function(){return[f]},0,null,null,!0)},dU=function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:
40
+ 0),e=c?c.language:_.Lg;return c||b?{id:a.h++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,allowedByApplication:!0,allowedByKeySystem:!0}:null},ZT=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.O(_.P,4,4038,a.o,c);},jU=function(a,b){null!=a.B&&null!=b&&(a.l=window.setTimeout(a.ic.bind(a),b))},$T=function(a,b){var c=b===WT;a.j&&a.j.presentationTimeline&&_.qF(a.j.presentationTimeline,c);c&&null!=a.l&&(window.clearTimeout(a.l),
41
+ a.l=null,a.B=null);a.M=b},kU=function(){};FS.prototype.append=function(a){a=void 0===a?[]:a;for(var b=0;b<a.length;b++)this.children.push(a[b]),a[b].parent=this;return this};FS.prototype.get=function(a){if(this.type===a)return this;for(var b=0;b<this.children.length;b++){if(this.children[b].type===a)return this.children[b];var c=this.children[b].get(a);if(c)return c}return null};
42
+ FS.prototype.a=function(){var a=Math.pow(2,32)-1;var b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.children.length)for(var c=0;c<this.children.length;c++)b+=this.children[c].a();this.size>a&&(b+=8);return b};
43
+ FS.prototype.write=function(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.W(a,1):_.W(a,this.size);_.rn(a,ES(this.type));this.size>b&&yS(a,this.size);"uuid"===this.type&&_.rn(a,null);if(0<this.children.length&&!this.w)for(b=0;b<this.children.length;b++)this.children[b].write(a),this.children[b].a(),a.getPosition()};_.x(Z,FS);Z.prototype.a=function(){return 4+FS.prototype.a.call(this)};
44
+ Z.prototype.write=function(a){FS.prototype.write.call(this,a);zS(a,this.version);AS(a,this.flags)};_.x(GS,FS);GS.prototype.a=function(){return this.f.byteLength+FS.prototype.a.call(this)-this.offset};GS.prototype.write=function(a){FS.prototype.write.call(this,a);_.rn(a,this.f,this.offset);a.getPosition()};_.x(HS,Z);HS.prototype.a=function(){return this.f.byteLength+Z.prototype.a.call(this)-this.offset};HS.prototype.write=function(a){Z.prototype.write.call(this,a);_.rn(a,this.f,this.offset);a.getPosition()};
45
+ _.x(IS,FS);IS.prototype.a=function(){var a=this.h.length;a=a+4+this.f.join("").length;return a+FS.prototype.a.call(this)};IS.prototype.write=function(a){FS.prototype.write.call(this,a);_.rn(a,ES(this.h));_.W(a,this.Qi);_.rn(a,ES(this.f.join("")));a.getPosition()};_.x(JS,FS);_.x(KS,FS);_.x(LS,Z);LS.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;a=a+44+this.f.length;return a+=Z.prototype.a.call(this)};
46
+ LS.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(yS(a,0),yS(a,0),_.W(a,this.timescale),yS(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));_.W(a,65536);BS(a,this.volume);BS(a,0);_.W(a,0);_.W(a,0);for(var b=0;b<this.f.length;b++)zS(a,this.f[b]);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,this.h);a.getPosition()};_.x(MS,FS);_.x(NS,Z);NS.prototype.a=function(){return 20+Z.prototype.a.call(this)};
47
+ NS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);_.W(a,1);_.W(a,0);_.W(a,0);_.W(a,0);a.getPosition()};_.x(OS,Z);OS.prototype.a=function(){var a=0;a=1===this.version?a+32:a+20;a=a+24+this.f.length;return a+Z.prototype.a.call(this)};
48
+ OS.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(yS(a,0),yS(a,0),_.W(a,this.h),_.W(a,0),yS(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.h),_.W(a,0),_.W(a,this.duration*this.timescale));_.W(a,0);_.W(a,0);BS(a,0);BS(a,0);BS(a,this.volume);BS(a,0);for(var b=0;b<this.f.length;b++)zS(a,this.f[b]);BS(a,this.width);BS(a,0);BS(a,this.height);BS(a,0);a.getPosition()};_.x(PS,Z);PS.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
49
+ PS.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(yS(a,0),yS(a,0),_.W(a,this.timescale),yS(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));BS(a,this.language);BS(a,0);a.getPosition()};_.x(QS,Z);QS.prototype.a=function(){return 33+Z.prototype.a.call(this)};
50
+ QS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);this.f===_.r?_.rn(a,ES("vide")):_.rn(a,ES("soun"));_.W(a,0);_.W(a,0);_.W(a,0);this.f===_.r?_.rn(a,ES("VideoHandler\x00")):_.rn(a,ES("SoundHandler\x00"));a.getPosition()};_.x(RS,Z);RS.prototype.a=function(){return 2+this.f.byteLength+Z.prototype.a.call(this)};RS.prototype.write=function(a){Z.prototype.write.call(this,a);BS(a,0);_.rn(a,this.f);a.getPosition()};_.x(SS,FS);SS.prototype.a=function(){return 8+FS.prototype.a.call(this)};
51
+ SS.prototype.write=function(a){FS.prototype.write.call(this,a);_.W(a,0);BS(a,0);BS(a,1)};_.x(TS,SS);TS.prototype.a=function(){return 70+SS.prototype.a.call(this)};TS.prototype.write=function(a){SS.prototype.write.call(this,a);BS(a,0);BS(a,0);_.W(a,0);_.W(a,0);_.W(a,0);BS(a,this.width);BS(a,this.height);_.W(a,4718592);_.W(a,4718592);_.W(a,0);BS(a,1);zS(a,10);_.rn(a,ES("AVC Coding",31));BS(a,this.depth);DS(a,-1)};_.x(US,SS);US.prototype.a=function(){return 20+SS.prototype.a.call(this)};
52
+ US.prototype.write=function(a){SS.prototype.write.call(this,a);_.W(a,0);_.W(a,0);BS(a,this.channelCount);BS(a,this.sampleSize);DS(a,0);BS(a,0);BS(a,this.sampleRate);BS(a,0)};_.x(VS,TS);VS.prototype.write=function(a){TS.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};_.x(WS,VS);_.x(XS,US);XS.prototype.write=function(a){US.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};
53
+ _.x(YS,XS);_.x(ZS,FS);ZS.prototype.a=function(){for(var a=7,b=0;b<this.hb.length;b++)a+=2,a+=this.hb[b].byteLength;for(b=0;b<this.hb.length;b++)a+=2,a+=this.tc[b].byteLength;return a+FS.prototype.a.call(this)};
54
+ ZS.prototype.write=function(a){FS.prototype.write.call(this,a);zS(a,this.version);zS(a,this.f);zS(a,this.h);zS(a,this.level);zS(a,255);zS(a,224|this.hb.length);for(var b=0;b<this.hb.length;b++)BS(a,this.hb[b].length),_.rn(a,this.hb[b]);zS(a,this.tc.length);for(b=0;b<this.tc.length;b++)BS(a,this.tc[b].length),_.rn(a,this.tc[b]);a.getPosition()};_.x($S,Z);$S.prototype.a=function(){return 22+(this.pc.byteLength+3)+Z.prototype.a.call(this)};
55
+ $S.prototype.write=function(a){Z.prototype.write.call(this,a);zS(a,3);zS(a,23+this.pc.byteLength);BS(a,1);zS(a,0);zS(a,4);zS(a,15+this.pc.byteLength);zS(a,64);zS(a,21);AS(a,0);_.W(a,0);_.W(a,0);zS(a,5);zS(a,this.pc.byteLength);_.rn(a,this.pc);_.rn(a,new Uint8Array([6,1,2]));a.getPosition()};_.x(aT,Z);aT.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};aT.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.rn(a,ES(this.location));a.getPosition()};
56
+ _.x(bT,Z);bT.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};bT.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(cT,FS);_.x(dT,Z);dT.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};
57
+ dT.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(eT,Z);eT.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};eT.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(fT,Z);
58
+ fT.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};fT.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(gT,Z);gT.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};
59
+ gT.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(hT,Z);hT.prototype.a=function(){return 8+Z.prototype.a.call(this)};hT.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);_.W(a,0);a.getPosition()};_.x(iT,Z);iT.prototype.a=function(){return 4+Z.prototype.a.call(this)};iT.prototype.write=function(a){Z.prototype.write.call(this,a);DS(a,0);BS(a,0);a.getPosition()};
60
+ _.x(jT,FS);_.x(kT,FS);_.x(lT,FS);_.x(mT,Z);mT.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};mT.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?yS(a,this.baseMediaDecodeTime):_.W(a,this.baseMediaDecodeTime);a.getPosition()};_.x(nT,Z);nT.prototype.a=function(){return 4+Z.prototype.a.call(this)};nT.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);a.getPosition()};_.x(oT,Z);
61
+ oT.prototype.a=function(){var a=4;this.flags&lU&&(a+=4);this.flags&mU&&(a+=4);for(var b=0;b<this.f;b++)this.flags&nU&&(a+=4),this.flags&oU&&(a+=4),this.flags&pU&&(a+=4),this.flags&qU&&(a+=4);return a+Z.prototype.a.call(this)};
62
+ oT.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);this.flags&lU&&(a.getPosition(),CS(a,this.j));this.flags&mU&&_.W(a,this.l);for(var b=0;b<this.f;b++)this.flags&nU&&_.W(a,this.o[b]),this.flags&oU&&_.W(a,this.sampleSize[b]),this.flags&pU&&_.W(a,this.A[b]),this.flags&qU&&(0===this.version?_.W(a,this.h[b]):CS(a,this.h[b]));a.getPosition()};var lU=1,mU=4,nU=256,oU=512,pU=1024,qU=2048;_.x(pT,Z);
63
+ pT.prototype.a=function(){var a=4;this.flags&rU&&(a+=8);this.flags&sU&&(a+=4);this.flags&tU&&(a+=4);this.flags&uU&&(a+=4);this.flags&vU&&(a+=4);return a+Z.prototype.a.call(this)};pT.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);this.flags&rU&&yS(a,this.h);this.flags&sU&&_.W(a,this.A);this.flags&tU&&_.W(a,this.j);this.flags&uU&&_.W(a,this.o);this.flags&vU&&_.W(a,this.l);a.getPosition()};var rU=1,sU=2,tU=8,uU=16,vU=32;_.x(qT,FS);_.x(rT,FS);_.x(sT,FS);
64
+ sT.prototype.a=function(){return this.f.byteLength+FS.prototype.a.call(this)};sT.prototype.write=function(a){FS.prototype.write.call(this,a);0<this.f.byteLength&&_.rn(a,this.f)};_.x(tT,Z);tT.prototype.a=function(){var a=20;1===this.f&&0===this.h&&(a=a+1+this.j.length);return a+Z.prototype.a.call(this)};
65
+ tT.prototype.write=function(a){Z.prototype.write.call(this,a);zS(a,0);0===this.version?zS(a,0):zS(a,0);zS(a,this.f);zS(a,this.h);_.rn(a,_.kk(this.l));if(1===this.f&&0===this.h){zS(a,0);for(var b=0;b<this.j.length;b++)zS(a,this.j[b])}a.getPosition()};_.x(uT,Z);uT.prototype.a=function(){var a=8;this.flags&1&&(a+=ES(this.kc).byteLength);return a+Z.prototype.a.call(this)};uT.prototype.write=function(a){Z.prototype.write.call(this,a);_.rn(a,ES(this.f));_.W(a,this.h);this.flags&1&&_.rn(a,ES(this.kc));a.getPosition()};
66
+ _.x(vT,FS);vT.prototype.a=function(){return ES(this.f).byteLength+FS.prototype.a.call(this)};vT.prototype.write=function(a){FS.prototype.write.call(this,a);_.rn(a,ES(this.f));a.getPosition()};_.x(wT,Z);wT.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=4;for(var b=0;1>b;b++)a=0===this.version?a+4:a+8;return a+Z.prototype.a.call(this)};
67
+ wT.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));_.W(a,1);for(var b=0;1>b;b++)0===this.version?_.W(a,this.offset[b]):yS(a,this.offset[b]);a.getPosition()};_.x(xT,Z);xT.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=5;0===this.f&&(a+=this.j.length);return a+Z.prototype.a.call(this)};
68
+ xT.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));zS(a,this.f);_.W(a,this.h);if(0===this.f)for(var b=0;b<this.h;b++)zS(a,this.j[b]);a.getPosition()};_.x(yT,Z);yT.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.h;b++)if(a+=this.f[b].Bi.byteLength,this.flags&2){a+=2;for(var c=0;c<this.f[b].Cd;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
69
+ yT.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.h);this.flags&1&&zS(a,this.j);for(var b=0;b<this.h;b++)if(_.rn(a,this.f[b].Bi),this.flags&2){BS(a,this.f[b].Cd);for(var c=0;c<this.f[b].Cd;c++)BS(a,this.f[b].Xg[c].uh),_.W(a,this.f[b].Xg[c].vh)}a.getPosition()};var FT=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,GT=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,HT=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,IT=/^(\d*\.?\d*)f$/,JT=/^(\d*\.?\d*)t$/,KT=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;OT.prototype.get=function(a){for(var b=0;b<this.a.length;b++){var c=this.a[b].get(a);if(c)return c}return null};OT.prototype.write=function(){this.f=NT(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var RT=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.t=XT.prototype;_.t.configure=function(a){this.f=a};_.t.start=function(a,b){var c=this;this.D=b;var d=_.th(new Set([a,zT(a)])).concat();return YT(this,d).then(function(e){return eU(c,e.data).then(function(){jU(c,c.B);return c.j})})};_.t.requestStop=function(){};_.t.stop=function(){this.D&&this.D.networkingEngine.ze(this.L);this.B=this.A=this.j=this.f=this.D=null;this.l&&(clearTimeout(this.l),this.l=null);this.K=!1;this.J=this.G=Infinity;return Promise.resolve()};
70
+ _.t.update=function(){var a=this;if(this.Td())return YT(this,[this.o]).then(function(b){return eU(a,b.data).then(function(){return a.j})})["catch"](function(b){if(a.D)a.D.onError(b)})};_.t.setCurrentVariant=function(){};_.t.ic=function(){var a=this;this.g.debug(_.OD);this.D&&(this.l=null,this.update().then(function(){jU(a,a.B)})["catch"](function(b){a.D&&(a.D.onError(b),1===b.severity&&jU(a,100))}))};_.t.Td=function(){return this.M===aU};_.t.rg=function(){return 0<this.w.length};
71
+ _.t.ki=function(a){var b=null;if(this.w.length)for(var c=0;c<this.w.length;c++)if(this.w[c].keySystem===a){b=this.w[c].initData[0];break}return b};
72
+ _.t.no=function(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);var b=a.request.timescale||this.A.timescale,c={isLive:this.Td.bind(this),ef:this.rg.bind(this),cm:function(){return 1},bf:this.ki.bind(this)},d=!1,e=new _.O(_.P,3,4035,null),f=null;try{var g=this.H.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.g.debug("Using base media decode time "+g+" instead of segment reference time "+a.request.startTime);f=TT(a,b,g,c)}catch(h){d=
73
+ !0,e.data=h,3E3===h.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)};var hU={video:_.Yg,audio:_.gd,text:_.$c},WT=_.jc,aU="LIVE",iU={To:_.rd,Zo:_.wg};_.x(kU,_.Fu);kU.prototype.f=function(){_.gv.ism=XT;_.ev[_.ad]=XT};kU.prototype.a=function(){_.mG("ism");_.nG(_.ad)};kU.prototype.id=function(){return _.ng};_.J("clpp.smooth.SmoothComponent",kU);};
74
74
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
75
75
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
76
76
  else{_=this.clpp._;(f.call(g,this));}
@@ -1,30 +1,30 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var zz="No thumbnail found for position: ",Az="Position is out of range: ",Bz="Thumbnail URL is mandatory",Cz="Wrong gridSize format",Dz="clpp.thumbnails",Ez=function(){this.log=new _.K(Dz);this.player=null;this.a=[];this.w=!1},Gz=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Xe&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return Fz(a,0,e,!!f)})},Promise.resolve())},Fz=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return Hz(a,d).then(function(){return a.a[b].load()}).then(function(){return Fz(a,
3
- e,c,d)})},Hz=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.$p)c();else a.player.one(_.id,function(){c()})})},Iz=function(a,b,c,d,e,f,g,h,l,m,n,p){d=void 0===d?0:d;e=void 0===e?0:e;f=void 0===f?0:f;g=void 0===g?0:g;h=void 0===h?1:h;l=void 0===l?1:l;m=void 0===m?0:m;n=void 0===n?0:n;p=void 0===p?new Image:p;this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.sa=p;this.$k=h;this.Mn=l;this.Rl=m;this.Sl=n;this.Zf=null},Jz=function(){Ez.call(this);
4
- this.f=null;this.o=this.h=1;this.j=0},Kz=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.hd=new _.mk},Lz=function(){this.g=new _.K(Dz);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.mk},Mz=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.hd.resolve()})},Oz=function(a,b){return Nz(a,b).then(function(c){return new Iz(c,b.time,b.duration)})},Nz=function(a,b){return b.load().then(function(){var c=_.Fj(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
- _.Pj(c)})},Pz=function(){Ez.call(this);this.f=null},Qz=function(a){a=a.split(/\.|:/).map(parseFloat);var b=0,c,d={3:.001,2:1,1:60,0:3600};for(c=a.length-1;0<=c;c--)b+=a[c]*d[c];return b},Rz=function(){Ez.apply(this,arguments)},Sz=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{ae:c,Og:d,di:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},Tz=function(){this.g=new _.K(Dz);this.a=this.m=null},Uz=function(a){return a.some(function(b){return 0<
6
- b.thumbStreams.length})},Zz=function(a){return a?a===Vz||a===Wz?new Jz:a===Xz?new Pz:a===Yz?new Lz:null:null},$z=function(a){if(!a)return null;a=new _.Qk(a);return a.path.match(/.*\.vtt$/i)?Xz:a.path.match(/.*\.bif$/i)?Yz:a.path.match(/.*\.(png|jpg|jpeg)$/i)?Vz:null},aA=function(){};Ez.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Of,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&Gz(c,b.preload)})};Iz.prototype.raw=function(){return this.sa.cloneNode(!1)};
7
- Iz.prototype.element=function(a,b){var c=this.width,d=this.height,e=this.width/this.height;void 0!==a&&void 0===b&&(b=0);null!==a&&void 0!==a&&(c=a);null!==b&&void 0!==b&&(d=b);c||(c=Math.ceil(d*e));d||(d=Math.ceil(c/e));e=document.createElement(_.Xd);e.style.width=c+_.Lf;e.style.height=d+_.Lf;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.sa.naturalWidth||this.sa.width))+"px "+Math.ceil(d/
8
- this.height*(this.sa.naturalHeight||this.sa.height))+_.Lf;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Lf;e.style.backgroundPositionY="-"+f*d+_.Lf;return e};
9
- Iz.prototype.load=function(){var a=this;this.Zf||(this.Zf=new Promise(function(b,c){function d(){a.width||(a.width=(a.sa.naturalWidth||a.sa.width)/a.$k);a.height||(a.height=(a.sa.naturalHeight||a.sa.height)/a.Mn);a.x||(a.x=a.width*a.Rl);a.y||(a.y=a.height*a.Sl)}if(a.sa.src&&a.sa.complete)d(),b(a);else{var e=null,f=function(){d();a.sa.removeEventListener(_.He,f);a.sa.removeEventListener(_.qe,e);b(a)};e=function(g){a.sa.removeEventListener(_.He,f);a.sa.removeEventListener(_.qe,e);c(new _.O(1,9,2014,
10
- "Failed to load thumbnail.",g))};a.sa.addEventListener(_.He,f);a.sa.addEventListener(_.qe,e);a.sa.src=a.src}}));return this.Zf};_.J("clpp.thumbnails.Thumbnail",Iz);Iz.prototype.load=Iz.prototype.load;Iz.prototype.element=Iz.prototype.element;Iz.prototype.raw=Iz.prototype.raw;_.x(Jz,Ez);
11
- Jz.prototype.init=function(a,b){if(!b||!b.url)throw new _.O(1,9,7100,Bz);if("GRID"===b.mode&&!b.gridSize)throw new _.O(1,9,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.O(1,9,7100,"Duration is mandatory");this.f=b;this.j=this.f.duration;if(this.f.gridSize)try{var c=this.f.gridSize.split(/x/).map(function(d){return parseInt(d,10)}).filter(function(d){return 0<d});if(2===c.length)this.h=c[0],this.o=c[1];else throw new _.O(1,9,7100,Cz);}catch(d){throw this.log.error("Error during parsing gridSize",d),
12
- new _.O(1,9,7100,Cz);}Ez.prototype.init.call(this,a,b)};Jz.prototype.get=function(a){var b=this,c,d,e,f;return _.I(function(g){if(1==g.a){c=b.player.getDuration();if(0>a||a>c)throw new _.O(1,9,2014,Az+a);d=b.f.duration;e=Math.floor(a/d);f=b.a[e];if(!f)throw new _.O(1,9,2014,"No thumbnail found for position "+a+" at index "+e);return _.y(g,f.load(),2)}return g["return"](f)})};
13
- Jz.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getDuration(),b=this.h*this.o;a=Math.ceil(Math.ceil(a/this.j)/b);for(var c=this.f.templateKey||"$index$",d=0;d<a;d++)for(var e=this.f.url.replace(c,String(d+1)),f=new Image,g=0;g<b;g++)this.a.push(new Iz(e,this.j*(d*b+g),this.j,0,0,0,0,this.h,this.o,g%this.h,Math.floor(g/this.h),f));return Promise.resolve()};Kz.prototype.load=function(){return this.hd};
14
- Lz.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.O(1,9,7100,Bz);var d=b.url,e=_.ek(d);e.type=_.dk;a.getNetworkEngine().fetch(e).T.then(function(f){f=f.data;var g=_.Fj(c.f);f=_.Fj(f);for(var h=g.byteLength+f.byteLength,l=new ArrayBuffer(h),m=new DataView(l),n=0,p=0,q=g.byteLength;p<q;p++)m.setUint8(n,g[p]),n+=1;g=0;for(p=f.byteLength;g<p;g++)m.setUint8(n,f[g]),n+=1;c.f=l;c.g.info("Appended "+f.byteLength+" bytes.Total data now "+(h+" bytes."));l=c.f;f=_.Fj(l);n=String.fromCharCode.apply(null,
15
- bA);g=Array.prototype.slice.call(f,0,8);f=64;h=0;m=!1;if(n===String.fromCharCode.apply(null,g))for(l=new DataView(l,16,20),l=l.getUint32(0,!0),0===l&&(l=1E3);!m;){h+=1;g=l;n=new DataView(c.f,f);m=n.getUint32(0,!0);g=m*g/1E3;n=n.getUint32(4,!0);n=new Kz(g,n);if(g=c.a.length)g=c.a[g-1],g.length=n.offset-g.offset,g.duration=n.time-g.time;c.a.push(n);f+=8;(m=4294967295===m)&&c.h.resolve();if(1E5<h)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");
16
- Mz(c)})["catch"](function(f){c.g.error("[BIF] Error while loading thumbnails '\n + 'URL: "+d,f);a.onError(new _.O(1,9,2013,"Error while loading and parsing BIF thumbnails.",f))})};Lz.prototype.get=function(a){var b=this,c,d;return _.I(function(e){switch(e.a){case 1:if(0>a)throw new _.O(1,9,2014,Az+a);return _.y(e,b.h,2);case 2:c=b.a.find(function(f){return a>=f.time&&a<f.time+f.duration});if(!c)throw new _.O(1,9,2014,zz+a);return _.y(e,Oz(b,c),3);case 3:return d=e.f,_.y(e,d.load(),4);case 4:return e["return"](d)}})};
17
- Lz.prototype.yc=function(){return 0<this.a.length};var bA=[137,66,73,70,13,10,26,10];_.x(Pz,Ez);
18
- Pz.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.O(1,9,7100,Bz);var d=b.url,e=_.ek(d);e.type=_.dk;this.f=a.getNetworkEngine().fetch(e).T.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.T.$(f).split(/\n/);for(var g=0;g<f.length;g++){var h=f[g],l=h.split(" --\x3e ");if(2===l.length){h=f[++g];var m=h.indexOf("\x3d"),n=0>m?[]:h.substr(m+1).split(/,/).map(parseFloat);m=n[0];var p=n[1],q=n[2];n=n[3];var t=h.indexOf("#");h=0>t?h:h.substr(0,t);h.match(/^http|^\/\//)||(h=
19
- d.substr(0,d.lastIndexOf("/"))+"/"+h);t=Qz(l[0]);l=Qz(l[1])-t;c.a.push(new Iz(h,t,l,m,p,q,n,0,0))}}})["catch"](function(f){c.log.error("[VTT] Error while loading thumbnails URL: "+d,f);a.onError(new _.O(1,9,2013,"Error while loading VTT thumbnails.",f))});Ez.prototype.init.call(this,a,b)};
20
- Pz.prototype.get=function(a){var b=this,c;return _.I(function(d){if(1==d.a){if(0>a)throw new _.O(1,9,2014,Az+a);return _.y(d,b.f,2)}if(3!=d.a){c=b.a.find(function(e){return a>=e.time&&a<e.time+e.duration});if(!c)throw new _.O(1,9,2014,zz+a);return _.y(d,c.load(),3)}return d["return"](c)})};Pz.prototype.l=function(){return this.f};_.x(Rz,Ez);
21
- Rz.prototype.get=function(a){function b(){return new _.O(1,9,2014,zz+a)}var c=this,d,e,f,g,h,l,m,n,p,q,t,v,z;return _.I(function(A){if(1==A.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.O(1,9,2014,Az+a);d=c.player.getPeriods();for(var G=null,E=_.w(d),C=E.next();!C.done;C=E.next())C=C.value,C.startTime<=a&&(G=C);e=G;if(!e)throw c.log.error("Could not find period for specified position",a),b();f=e.thumbStreams.sort(c.f)[0];if(!f)throw c.log.error("Could not find thumb stream for specified position",a),
22
- b();g=f.findSegmentPosition(a-e.startTime);if(null===g||void 0===g)throw c.log.error("Could not find segment index for specified position",a),b();h=f.getSegmentReference(g);if(!h)return A.F(2);l=Sz(h,f);m=Math.floor((a-h.startTime)/l.durationPerTile);0<c.a.length?(p=f.findSegmentPosition(0),null!==p&&(n=c.a[(g-p)*l.di+m])):(q=h.Xa())&&0<q.length&&(v=t=0,z=h.startTime,1<l.di&&(t=m%l.ae,v=Math.floor(m/l.ae),z+=m*l.durationPerTile),n=new Iz(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.ae,l.Og,
23
- t,v));return n?_.y(A,n.load(),4):A.F(2)}if(2!=A.a)return A["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};Rz.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
- Rz.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.w(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value.thumbStreams.sort(this.f)[0])for(var c=b.findSegmentPosition(0),d=void 0;null!==c&&!_.N.R(d=b.getSegmentReference(c++));)for(var e=Sz(d,b),f=d.Xa()[0],g=new Image,h=d.startTime,l=0;l<e.Og;++l)for(var m=0;m<e.ae;++m)this.a.push(new Iz(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.ae,e.Og,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.u=Tz.prototype;_.u.onPlayerCreated=function(a){this.m=a};_.u.onPlayerWillDestroy=function(){this.m=null};_.u.onPlayerWillRelease=function(){this.a=null};
25
- _.u.onContentWillLoad=function(a){var b=this,c=a.getConfiguration().thumbnails;if(c)if(!1===c.enabled)this.g.info("Thumbnails disabled.");else{var d=c.mode||null;d||(d=$z(c.url||null));(this.a=Zz(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Ke,function(){b.g.info("Initialize thumbnails provider");try{b.a.init(a,c)}catch(e){b.m.onError(e)}})):this.g.warn("Unknown thumbnail mode",d)}else this.a=null};
26
- _.u.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);if(!this.a&&(c=(c=a.getConfiguration())&&c.thumbnails,!c||void 0===c.enabled||c.enabled)){var d=a.getPeriods();if(Uz(d)){this.a=new Rz;try{this.a.init(a,c)}catch(e){this.m.onError(e)}}}};_.u.get=function(a){return this.a?this.a.get(a):Promise.reject(new _.O(1,9,2014,"Thumbnail format is not supported"))};_.u.id=function(){return"thumbnails"};_.J("clpp.thumbnails.ThumbnailsPlugin",Tz);Tz.prototype.get=Tz.prototype.get;Tz.Id="thumbnails";
27
- aA.prototype.create=function(){return new Tz};_.gt(new aA);var Vz="SINGLE",Wz="GRID",Xz="WEBVTT",Yz="BIF";};
2
+ var f=function(window){var $z="No thumbnail found for position: ",aA="Position is out of range: ",bA="Thumbnail URL is mandatory",cA="Wrong gridSize format",dA="clpp.thumbnails",eA=function(){this.log=new _.K(dA);this.player=null;this.a=[];this.w=!1},gA=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.ff&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return fA(a,0,e,!!f)})},Promise.resolve())},fA=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return hA(a,d).then(function(){return a.a[b].load()}).then(function(){return fA(a,
3
+ e,c,d)})},hA=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.Lq)c();else a.player.one(_.nd,function(){c()})})},iA=function(a,b,c,d,e,f,g,h,l,m,n,p){d=void 0===d?0:d;e=void 0===e?0:e;f=void 0===f?0:f;g=void 0===g?0:g;h=void 0===h?1:h;l=void 0===l?1:l;m=void 0===m?0:m;n=void 0===n?0:n;p=void 0===p?new Image:p;this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.va=p;this.Al=h;this.qo=l;this.qm=m;this.rm=n;this.sg=null},jA=function(){eA.call(this);
4
+ this.f=null;this.o=this.h=1;this.j=0},kA=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.yd=new _.Gk},lA=function(){this.g=new _.K(dA);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.Gk},mA=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.yd.resolve()})},oA=function(a,b){return nA(a,b).then(function(c){return new iA(c,b.time,b.duration)})},nA=function(a,b){return b.load().then(function(){var c=_.Xj(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
+ _.hk(c)})},pA=function(){eA.call(this);this.f=null},qA=function(a){a=a.split(/\.|:/).map(parseFloat);var b=0,c,d={3:.001,2:1,1:60,0:3600};for(c=a.length-1;0<=c;c--)b+=a[c]*d[c];return b},rA=function(){eA.apply(this,arguments)},sA=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{me:c,hh:d,Ai:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},tA=function(){this.g=new _.K(dA);this.a=this.m=null},uA=function(a){return a.some(function(b){return 0<
6
+ b.thumbStreams.length})},zA=function(a){return a?a===vA||a===wA?new jA:a===xA?new pA:a===yA?new lA:null:null},AA=function(a){if(!a)return null;a=new _.hl(a);return a.path.match(/.*\.vtt$/i)?xA:a.path.match(/.*\.bif$/i)?yA:a.path.match(/.*\.(png|jpg|jpeg)$/i)?vA:null},BA=function(){};eA.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Zf,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&gA(c,b.preload)})};iA.prototype.raw=function(){return this.va.cloneNode(!1)};
7
+ iA.prototype.element=function(a,b){var c=this.width,d=this.height,e=this.width/this.height;void 0!==a&&void 0===b&&(b=0);null!==a&&void 0!==a&&(c=a);null!==b&&void 0!==b&&(d=b);c||(c=Math.ceil(d*e));d||(d=Math.ceil(c/e));e=document.createElement(_.fe);e.style.width=c+_.Wf;e.style.height=d+_.Wf;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.va.naturalWidth||this.va.width))+"px "+Math.ceil(d/
8
+ this.height*(this.va.naturalHeight||this.va.height))+_.Wf;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Wf;e.style.backgroundPositionY="-"+f*d+_.Wf;return e};
9
+ iA.prototype.load=function(){var a=this;this.sg||(this.sg=new Promise(function(b,c){function d(){a.width||(a.width=(a.va.naturalWidth||a.va.width)/a.Al);a.height||(a.height=(a.va.naturalHeight||a.va.height)/a.qo);a.x||(a.x=a.width*a.qm);a.y||(a.y=a.height*a.rm)}if(a.va.src&&a.va.complete)d(),b(a);else{var e=null,f=function(){d();a.va.removeEventListener(_.Re,f);a.va.removeEventListener(_.ze,e);b(a)};e=function(g){a.va.removeEventListener(_.Re,f);a.va.removeEventListener(_.ze,e);c(new _.O(1,9,2014,
10
+ "Failed to load thumbnail.",g))};a.va.addEventListener(_.Re,f);a.va.addEventListener(_.ze,e);a.va.src=a.src}}));return this.sg};_.J("clpp.thumbnails.Thumbnail",iA);iA.prototype.load=iA.prototype.load;iA.prototype.element=iA.prototype.element;iA.prototype.raw=iA.prototype.raw;_.x(jA,eA);
11
+ jA.prototype.init=function(a,b){if(!b||!b.url)throw new _.O(1,9,7100,bA);if("GRID"===b.mode&&!b.gridSize)throw new _.O(1,9,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.O(1,9,7100,"Duration is mandatory");this.f=b;this.j=this.f.duration;if(this.f.gridSize)try{var c=this.f.gridSize.split(/x/).map(function(d){return parseInt(d,10)}).filter(function(d){return 0<d});if(2===c.length)this.h=c[0],this.o=c[1];else throw new _.O(1,9,7100,cA);}catch(d){throw this.log.error("Error during parsing gridSize",d),
12
+ new _.O(1,9,7100,cA);}eA.prototype.init.call(this,a,b)};jA.prototype.get=function(a){var b=this,c,d,e,f;return _.I(function(g){if(1==g.a){c=b.player.getDuration();if(0>a||a>c)throw new _.O(1,9,2014,aA+a);d=b.f.duration;e=Math.floor(a/d);f=b.a[e];if(!f)throw new _.O(1,9,2014,"No thumbnail found for position "+a+" at index "+e);return _.y(g,f.load(),2)}return g["return"](f)})};
13
+ jA.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getDuration(),b=this.h*this.o;a=Math.ceil(Math.ceil(a/this.j)/b);for(var c=this.f.templateKey||"$index$",d=0;d<a;d++)for(var e=this.f.url.replace(c,String(d+1)),f=new Image,g=0;g<b;g++)this.a.push(new iA(e,this.j*(d*b+g),this.j,0,0,0,0,this.h,this.o,g%this.h,Math.floor(g/this.h),f));return Promise.resolve()};kA.prototype.load=function(){return this.yd};
14
+ lA.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.O(1,9,7100,bA);var d=b.url,e=_.wk(d);e.type=_.vk;a.getNetworkEngine().fetch(e).T.then(function(f){f=f.data;var g=_.Xj(c.f);f=_.Xj(f);for(var h=g.byteLength+f.byteLength,l=new ArrayBuffer(h),m=new DataView(l),n=0,p=0,q=g.byteLength;p<q;p++)m.setUint8(n,g[p]),n+=1;g=0;for(p=f.byteLength;g<p;g++)m.setUint8(n,f[g]),n+=1;c.f=l;c.g.info("Appended "+f.byteLength+" bytes.Total data now "+(h+" bytes."));l=c.f;f=_.Xj(l);n=String.fromCharCode.apply(null,
15
+ CA);g=Array.prototype.slice.call(f,0,8);f=64;h=0;m=!1;if(n===String.fromCharCode.apply(null,g))for(l=new DataView(l,16,20),l=l.getUint32(0,!0),0===l&&(l=1E3);!m;){h+=1;g=l;n=new DataView(c.f,f);m=n.getUint32(0,!0);g=m*g/1E3;n=n.getUint32(4,!0);n=new kA(g,n);if(g=c.a.length)g=c.a[g-1],g.length=n.offset-g.offset,g.duration=n.time-g.time;c.a.push(n);f+=8;(m=4294967295===m)&&c.h.resolve();if(1E5<h)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");
16
+ mA(c)})["catch"](function(f){c.g.error("[BIF] Error while loading thumbnails '\n + 'URL: "+d,f);a.onError(new _.O(1,9,2013,"Error while loading and parsing BIF thumbnails.",f))})};lA.prototype.get=function(a){var b=this,c,d;return _.I(function(e){switch(e.a){case 1:if(0>a)throw new _.O(1,9,2014,aA+a);return _.y(e,b.h,2);case 2:c=b.a.find(function(f){return a>=f.time&&a<f.time+f.duration});if(!c)throw new _.O(1,9,2014,$z+a);return _.y(e,oA(b,c),3);case 3:return d=e.f,_.y(e,d.load(),4);case 4:return e["return"](d)}})};
17
+ lA.prototype.Kc=function(){return 0<this.a.length};var CA=[137,66,73,70,13,10,26,10];_.x(pA,eA);
18
+ pA.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.O(1,9,7100,bA);var d=b.url,e=_.wk(d);e.type=_.vk;this.f=a.getNetworkEngine().fetch(e).T.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.T.da(f).split(/\n/);for(var g=0;g<f.length;g++){var h=f[g],l=h.split(" --\x3e ");if(2===l.length){h=f[++g];var m=h.indexOf("\x3d"),n=0>m?[]:h.substr(m+1).split(/,/).map(parseFloat);m=n[0];var p=n[1],q=n[2];n=n[3];var u=h.indexOf("#");h=0>u?h:h.substr(0,u);h.match(/^http|^\/\//)||(h=
19
+ d.substr(0,d.lastIndexOf("/"))+"/"+h);u=qA(l[0]);l=qA(l[1])-u;c.a.push(new iA(h,u,l,m,p,q,n,0,0))}}})["catch"](function(f){c.log.error("[VTT] Error while loading thumbnails URL: "+d,f);a.onError(new _.O(1,9,2013,"Error while loading VTT thumbnails.",f))});eA.prototype.init.call(this,a,b)};
20
+ pA.prototype.get=function(a){var b=this,c;return _.I(function(d){if(1==d.a){if(0>a)throw new _.O(1,9,2014,aA+a);return _.y(d,b.f,2)}if(3!=d.a){c=b.a.find(function(e){return a>=e.time&&a<e.time+e.duration});if(!c)throw new _.O(1,9,2014,$z+a);return _.y(d,c.load(),3)}return d["return"](c)})};pA.prototype.l=function(){return this.f};_.x(rA,eA);
21
+ rA.prototype.get=function(a){function b(){return new _.O(1,9,2014,$z+a)}var c=this,d,e,f,g,h,l,m,n,p,q,u,v,z;return _.I(function(A){if(1==A.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.O(1,9,2014,aA+a);d=c.player.getPeriods();for(var H=null,G=_.w(d),D=G.next();!D.done;D=G.next())D=D.value,D.startTime<=a&&(H=D);e=H;if(!e)throw c.log.error("Could not find period for specified position",a),b();f=e.thumbStreams.sort(c.f)[0];if(!f)throw c.log.error("Could not find thumb stream for specified position",a),
22
+ b();g=f.findSegmentPosition(a-e.startTime);if(null===g||void 0===g)throw c.log.error("Could not find segment index for specified position",a),b();h=f.getSegmentReference(g);if(!h)return A.F(2);l=sA(h,f);m=Math.floor((a-h.startTime)/l.durationPerTile);0<c.a.length?(p=f.findSegmentPosition(0),null!==p&&(n=c.a[(g-p)*l.Ai+m])):(q=h.eb())&&0<q.length&&(v=u=0,z=h.startTime,1<l.Ai&&(u=m%l.me,v=Math.floor(m/l.me),z+=m*l.durationPerTile),n=new iA(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.me,l.hh,
23
+ u,v));return n?_.y(A,n.load(),4):A.F(2)}if(2!=A.a)return A["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};rA.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
+ rA.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.w(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value.thumbStreams.sort(this.f)[0])for(var c=b.findSegmentPosition(0),d=void 0;null!==c&&!_.N.R(d=b.getSegmentReference(c++));)for(var e=sA(d,b),f=d.eb()[0],g=new Image,h=d.startTime,l=0;l<e.hh;++l)for(var m=0;m<e.me;++m)this.a.push(new iA(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.me,e.hh,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.t=tA.prototype;_.t.onPlayerCreated=function(a){this.m=a};_.t.onPlayerWillDestroy=function(){this.m=null};_.t.onPlayerWillRelease=function(){this.a=null};
25
+ _.t.onContentWillLoad=function(a){var b=this,c=a.getConfiguration().thumbnails;if(c)if(!1===c.enabled)this.g.info("Thumbnails disabled.");else{var d=c.mode||null;d||(d=AA(c.url||null));(this.a=zA(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Te,function(){b.g.info("Initialize thumbnails provider");try{b.a.init(a,c)}catch(e){b.m.onError(e)}})):this.g.warn("Unknown thumbnail mode",d)}else this.a=null};
26
+ _.t.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);if(!this.a&&(c=(c=a.getConfiguration())&&c.thumbnails,!c||void 0===c.enabled||c.enabled)){var d=a.getPeriods();if(uA(d)){this.a=new rA;try{this.a.init(a,c)}catch(e){this.m.onError(e)}}}};_.t.get=function(a){return this.a?this.a.get(a):Promise.reject(new _.O(1,9,2014,"Thumbnail format is not supported"))};_.t.id=function(){return"thumbnails"};_.J("clpp.thumbnails.ThumbnailsPlugin",tA);tA.prototype.get=tA.prototype.get;tA.Id="thumbnails";
27
+ BA.prototype.create=function(){return new tA};_.bu(new BA);var vA="SINGLE",wA="GRID",xA="WEBVTT",yA="BIF";};
28
28
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
29
29
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
30
30
  else{_=this.clpp._;(f.call(g,this));}