@castlabs/prestoplay 6.25.2 → 6.27.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 (69) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +5 -5
  3. package/cjs/cl.adobe.js +3 -3
  4. package/cjs/cl.airplay.js +3 -3
  5. package/cjs/cl.broadpeak.js +7 -7
  6. package/cjs/cl.cast.js +115 -114
  7. package/cjs/cl.conviva.js +32 -32
  8. package/cjs/cl.core.js +620 -620
  9. package/cjs/cl.crypto.js +9 -9
  10. package/cjs/cl.dash.js +89 -88
  11. package/cjs/cl.externs.js +89 -51
  12. package/cjs/cl.freewheel.js +25 -25
  13. package/cjs/cl.hls.js +79 -77
  14. package/cjs/cl.hlssmpte.js +6 -6
  15. package/cjs/cl.htmlcue.js +30 -30
  16. package/cjs/cl.ima.js +24 -24
  17. package/cjs/cl.mediatailor.js +3 -3
  18. package/cjs/cl.mse.js +351 -336
  19. package/cjs/cl.muxdata.js +15 -15
  20. package/cjs/cl.onboard.js +3 -3
  21. package/cjs/cl.persistent.js +15 -15
  22. package/cjs/cl.playlist.js +6 -6
  23. package/cjs/cl.sessions.js +16 -16
  24. package/cjs/cl.simid.js +17 -17
  25. package/cjs/cl.smooth.js +72 -72
  26. package/cjs/cl.thumbnails.js +26 -26
  27. package/cjs/cl.tizen.js +73 -72
  28. package/cjs/cl.ttml.js +29 -29
  29. package/cjs/cl.verimatrix.js +5 -5
  30. package/cjs/cl.vimond.js +12 -12
  31. package/cjs/cl.vr.js +19 -19
  32. package/cjs/cl.vtt.js +14 -14
  33. package/cjs/cl.yospace.js +4 -4
  34. package/cjs/cl.youbora.js +39 -37
  35. package/cjs/polyfill.min.js +15 -3
  36. package/cl.adobe.js +3 -3
  37. package/cl.airplay.js +3 -3
  38. package/cl.broadpeak.js +5 -5
  39. package/cl.cast.js +92 -90
  40. package/cl.conviva.js +27 -27
  41. package/cl.core.js +496 -500
  42. package/cl.crypto.js +9 -9
  43. package/cl.dash.js +82 -82
  44. package/cl.externs.js +89 -51
  45. package/cl.freewheel.js +19 -19
  46. package/cl.hls.js +80 -80
  47. package/cl.hlssmpte.js +5 -5
  48. package/cl.htmlcue.js +26 -26
  49. package/cl.ima.js +17 -17
  50. package/cl.mediatailor.js +3 -3
  51. package/cl.mse.js +305 -294
  52. package/cl.muxdata.js +13 -13
  53. package/cl.onboard.js +4 -4
  54. package/cl.persistent.js +11 -11
  55. package/cl.playlist.js +5 -5
  56. package/cl.sessions.js +10 -10
  57. package/cl.simid.js +14 -14
  58. package/cl.smooth.js +60 -60
  59. package/cl.thumbnails.js +19 -19
  60. package/cl.tizen.js +57 -57
  61. package/cl.ttml.js +22 -22
  62. package/cl.verimatrix.js +4 -4
  63. package/cl.vimond.js +8 -8
  64. package/cl.vr.js +15 -15
  65. package/cl.vtt.js +12 -12
  66. package/cl.yospace.js +3 -3
  67. package/cl.youbora.js +29 -28
  68. package/package.json +3 -3
  69. package/typings.d.ts +124 -3
package/cjs/cl.smooth.js CHANGED
@@ -1,76 +1,76 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var JR="Full MP4 box must have flags defined",KR="clpp.smooth.SmoothMP4Processor",LR="codecPrivateData",MR=function(a,b){var c=Math.floor(b/Math.pow(2,32)),d=b-c*Math.pow(2,32);_.V(a,c);_.V(a,d)},NR=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.cn()}},OR=function(a,b){NR(a,b>>16&255);NR(a,b>>8&255);NR(a,b&255)},PR=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.cn()}},QR=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.cn()}},RR=function(a,b){try{a.f.setInt16(a.a,
3
- b,a.h),a.a+=2}catch(c){_.cn()}},SR=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},TR=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){TR.call(this,a);this.version=b;this.flags=c},UR=function(a,b,c){TR.call(this,a);this.f=b;this.offset=c},VR=function(a,
4
- b,c,d,e){Z.call(this,a,b,c);this.f=d;this.offset=e},WR=function(a,b,c){TR.call(this,"ftyp");this.h=a;this.Di=b;this.f=c},YR=function(){TR.call(this,_.Ne)},ZR=function(){TR.call(this,_.tg)},$R=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]},aS=function(){TR.call(this,"mvex")},bS=function(a){Z.call(this,"trex",0,0);this.f=a},cS=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]},dS=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},eS=function(a){Z.call(this,"hdlr",0,0);this.f=a},fS=function(){Z.call(this,"vmhd",0,1);this.f=new Uint8Array([0,0,0,0,0,0])},gS=function(a){TR.call(this,a);this.w=!0},hS=function(a){gS.call(this,a);this.height=this.width=0;this.depth=24},
6
- iS=function(a,b,c,d){gS.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},jS=function(a,b){hS.call(this,"avc1");this.width=a;this.height=b},kS=function(a,b){jS.call(this,a,b);this.type="encv"},lS=function(a,b,c){iS.call(this,"mp4a",a,b,c)},mS=function(a,b,c){lS.call(this,a,b,c);this.type="enca"},nS=function(a,b){TR.call(this,"avcC");this.gb=a;this.tc=b;this.version=1;this.f=this.gb[0][1];this.h=this.gb[0][2];this.level=this.gb[0][3]},oS=function(a){Z.call(this,"esds",0,0);this.oc=
7
- a},pS=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},qS=function(){Z.call(this,"dref",0,0)},rS=function(){TR.call(this,_.dg)},sS=function(){Z.call(this,_.fg,0,0)},tS=function(){Z.call(this,"stts",0,0)},uS=function(){Z.call(this,"stsc",0,0)},vS=function(){Z.call(this,"stco",0,0)},wS=function(){Z.call(this,"stsz",0,0)},xS=function(){Z.call(this,"smhd",0,0)},yS=function(){TR.call(this,"dinf")},zS=function(){TR.call(this,_.Le)},AS=function(){TR.call(this,_.He)},BS=function(a,b){Z.call(this,
8
- "tfdt",a,0);this.baseMediaDecodeTime=b},CS=function(){Z.call(this,"mfhd",0,0);this.f=0},DS=function(a,b){Z.call(this,"trun",a,b);this.l=this.j=this.f=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]},ES=function(a,b){Z.call(this,"tfhd",a,b);this.f=255;this.l=this.o=this.j=this.A=this.h=0},FS=function(){TR.call(this,"traf")},GS=function(){TR.call(this,"moof")},HS=function(){TR.call(this,_.Ge);this.f=new Uint8Array(0)},IS=function(){Z.call(this,"tenc",0,0);this.f=1;this.h=8;this.l="";this.j=[]},JS=
9
- function(a,b){Z.call(this,"schm",0,0);this.f=a;this.h=b;this.jc=""},KS=function(a){TR.call(this,"frma");this.f=a},LS=function(){Z.call(this,"saio",0,0);this.offset=[0]},MS=function(a,b,c){Z.call(this,"saiz",0,0);this.f=a;this.j=b;this.h=c},NS=function(a,b){Z.call(this,"senc",a,b);this.h=0;this.j=8;this.f=[]},OS=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},PS=function(a,b,c,d){c=b.Wh[c];b=b.Mo;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 _.JD([a],[b])[0]},QS=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.Jg?c=["maxWidth","maxHeight","bitrate",LR,"fourCC"]:a.type===_.Pc&&(c=["bitrate",LR,"channels","bitsPerSample","samplingRate","fourCC"]);return _.L.pa(a,b,c,["id","segmentIndex"])},RS=function(a,b,c){var d=c.Ve.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,gb:null,
11
- tc:null,width:NaN,height:NaN,oc:null,Ae:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.Jg:a.gb=[_.Om(d[1])];a.tc=[_.Om(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.Pc:a.oc=_.Om(c.Ve),a.sampleSize=c.Oj||16,a.Ae=c.Ae,a.channelCount=c.uh}return a},SS=function(a,b){return a.filter(function(c){return c.type===b})},TS=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)},$S=function(a,
12
- b,c){var d=null;if(US.test(a)){a=US.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 VS.test(a)?d=TS(VS,a):WS.test(a)?d=TS(WS,a):XS.test(a)?(a=XS.exec(a),d=Number(a[1])/c.frameRate):YS.test(a)?(a=YS.exec(a),d=Number(a[1])/c.a):ZS.test(a)&&(d=TS(ZS,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},aT=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))},cT=function(a){this.a=a;this.f=bT(this)},bT=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.bn(b)},dT=function(a,b,c){a:{var d=_.u([_.Gd,_.Ed]);for(var e=d.next();!e.done;e=d.next())if((e=c.af(e.value))&&e.keyId){d=e.keyId;break a}_.Jh(KR,
14
- "Could not get default Key ID for DRM init data!");d=null}c=new TR("xxxx");a.type===_.Jg?c=new kS(a.width,a.height):c=new mS(a.channelCount,a.sampleSize,a.Ae);a=new IS;a.f=1;a.h=8;a.l=d||"00000000000000000000000000000000";a=(new TR("schi")).append([a]);b=(new TR(_.Yf)).append([new KS(b),new JS(_.hd,65536),a]);c.append([b]);return c},eT=function(a,b){var c=b.df(),d=new $R(a.timescale,a.duration,a.id),e=(new aS).append([new bS(a.id)]),f=new cS(a.id,a.duration,a.timescale,a.width,a.height),g=new dS(a.timescale,
15
- a.duration),h=new eS(a.type),l=null,m=new qS;m.entries=[new pS];var n=new sS;switch(a.type){case _.Jg:var p=new nS(a.gb,a.tc);c?(l=dT(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new jS(a.width,a.height)).append([p]),n.entries=[l]);l=new fS;break;case _.Pc:p=new oS(a.oc),c?(l=dT(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new lS(a.channelCount,a.sampleSize,a.Ae)).append([p]),n.entries=[l]),l=new xS}n=(new rS).append([n,new tS,new uS,new wS,new vS]);m=(new yS).append([m]);m=(new zS).append([l,m,n]);
16
- g=(new AS).append([g,h,m]);f=(new ZR).append([f,g]);d=(new YR).append([d,f,e]);e=new WR("dash",0,["iso6","mp41","avc1"]);c&&(c=b.af(_.Ed),f=b.af(_.Gd),c&&d.append([new UR("pssh",c.initData,8)]),f&&d.append([new UR("pssh",f.initData,8)]),c||f||_.Jh(KR,"Could not get PSSH init data!"));c=new cT([e,d]);return _.Oj(c.write())},gT=function(a,b){var c,d,e,f,g,h;(new _.pn).M("moof",_.qn).aa("mfhd",function(m){var n=new CS;n.f=_.kn(m.reader);c=n}).M("traf",_.qn).aa("tfhd",function(m){var n=m.reader.Ta();
17
- if(null===m.flags)throw new _.N(_.O,3,3019,JR);var p=new ES(m.version||0,m.flags||0);p.f=_.kn(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.h=_.mn(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.A=_.kn(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.j=_.kn(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.o=_.kn(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.l=_.kn(m.reader));d=p}).aa("trun",function(m){var n=m.reader.Ta();if(null===m.flags)throw new _.N(_.O,3,3019,JR);
18
- var p=new DS(m.version||0,m.flags||0);p.f=_.kn(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.ln(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.l=_.kn(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.f;n++)m.flags&256&&p.o.push(_.kn(m.reader)),m.flags&512&&p.sampleSize.push(_.kn(m.reader)),m.flags&1024&&p.A.push(_.kn(m.reader)),m.flags&2048&&(0===m.version?p.h.push(_.kn(m.reader)):p.h.push(_.ln(m.reader)));e=p}).aa("sdtp",function(m){var n=_.on(m.reader,m.reader.Ta());f=new VR("sdtp",
19
- m.version||0,m.flags||0,n,0)}).M("uuid",function(m){var n=_.on(m.reader,16);if(_.Qm(n,fT)){n=_.kn(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new NS(m.version,m.flags);n.h=_.kn(m.reader);m.flags&1&&(n.j=_.hn(m.reader));for(var p=0;p<n.h;p++){var q={ni:_.on(m.reader,8),Ed:0,Qg:[]};if(m.flags&2){q.Ed=_.jn(m.reader);for(var t=0;t<q.Ed;t++){var v={qh:0,rh:0};v.qh=_.jn(m.reader);v.rh=_.kn(m.reader);q.Qg.push(v)}}n.f.push(q)}g=n}}).M(_.Ge,function(m){var n=new HS;0<m.reader.Ta()?n.f=_.on(m.reader,m.reader.Ta()):
20
- (_.Jh(KR,"mdat box is empty!"),n.f=new Uint8Array(0));h=n}).parse(a,!1);if(!h)return null;var l=(new FS).append([d,e]);f&&l.append([f]);b.df()&&g&&l.append([g]);l=(new GS).append([c,l]);return new cT([l,h])},hT=function(a,b,c,d){var e=d.df(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=gT(b,d);if(null===g)return a.request.contentType===_.pj?a.data:g;d=g.get(_.Ge);if(a.request.contentType===_.pj){e=d.f.buffer;if(c){e=_.Q.de(e);if((e=(new DOMParser).parseFromString(e,_.lg))&&"tt"===e.documentElement.tagName.toLowerCase())var h=
21
- e.documentElement;if(h&&(d=new aT(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",_.ge],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],$S(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.Q.hb(e).buffer}else c=e;return c}h=new GS;a=g.get("mfhd");b=new FS;l=g.get("tfhd");m=new BS(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].Ed);else g=8;b.append([c,new LS,new MS(g,l,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=
23
- new cT([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},iT=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},jT=function(a,b,c){a=_.Yo(a);c&&a.version!==c&&(a=_.yD(a,c));return{initData:_.wD(a),initDataType:_.hd,keyId:b,periodId:null}},lT=function(){this.A=this.j=this.f=
24
- this.F=null;this.h=1;this.P=0;this.o="";this.C=this.a=null;this.g=new _.J("clpp.smooth.SmoothParser");this.K=!1;this.l=this.B=null;this.N=kT;this.I=0;this.G=this.J=Infinity;this.w=[];this.L=this.ho.bind(this);this.H=new Map},mT=function(a,b){var c,d,e;return _.H(function(f){if(1==f.a)return c=_.ck(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.F.networkingEngine.fetch(c),_.x(f,d.S,2);e=f.f;a.o=e.uri;return f["return"](e)})},tT=function(a,b){var c=_.To,d=null;try{var e=_.Q.de(b);d=c.we(e,_.Lb)}catch(DY){}if(!d)throw a.g.error("Unable to parse manifest"),new _.N(_.O,4,4033,a.o);var f=+nT(a,d,"MajorVersion"),g=+nT(a,d,"MinorVersion"),h=+d.getAttribute("TimeScale")||1E7,l=+nT(a,d,"Duration"),m="TRUE"===d.getAttribute("IsLive"),n=+d.getAttribute("LookAheadCount"),p=+d.getAttribute("DVRWindowLength")||
26
- Infinity,q=c.$(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 _.N(_.O,4,4036,a.o);m?(oT(a,pT),a.B=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),l=Infinity):oT(a,kT);a.a={startTime:0,delay:0,duration:l/h,dg:p/h,se:0};if(q){var t=a.f.playreadyVersion,v=_.To,z=[],A=v.$(q,"ProtectionHeader")[0],D=_.Nm(v.ra(A)||""),G=_.Yo(D).a;z.push(iT(_.Gd,{initData:_.wD(_.Qo(G)),initDataType:_.hd,
27
- keyId:G,periodId:null},[G]));z.push(iT(_.Ed,jT(D,G,t),[G]));a.w=z}var B=[],F=_.To.$(d,"StreamIndex");if(!F.length)throw a.g.error("No streams found!"),new _.N(_.O,4,4034,a.o);for(var M=0;M<F.length;M++){for(var R,ka=a,U=F[M],qa=nT(ka,U,"Type"),Ba=+U.getAttribute("Chunks"),Ca=U.getAttribute("Subtype")||"",Da=U.getAttribute("Language")||_.wg,Na=_.Cj(Da),zb=U.getAttribute("Name")||"",me=+U.getAttribute(_.fb),Cf=+U.getAttribute(_.eb),Fg=nT(ka,U,"Url"),Pu=+U.getAttribute("TimeScale")||null,od=[],Ln=_.To.$(U,
28
- _.Ab),Ev=0;Ev<Ln.length;Ev++){var Ef=void 0,yc=void 0,Fv=void 0,Ff=ka,Od=Ln[Ev],Gv=qa,gX=+Od.getAttribute("Index"),hX=+nT(Ff,Od,"Bitrate"),uJ=NaN,vJ=NaN,Io=NaN,Hv=NaN,wJ=NaN,xJ=NaN,yJ=NaN,zJ=Od.getAttribute("FourCC")||"";switch(Gv){case _.Jg:uJ=+nT(Ff,Od,_.eb);vJ=+nT(Ff,Od,_.fb);break;case _.Pc:Hv=+Od.getAttribute("Channels")||2,Io=+nT(Ff,Od,"SamplingRate"),xJ=+nT(Ff,Od,"AudioTag"),wJ=+nT(Ff,Od,"BitsPerSample"),yJ=+nT(Ff,Od,"PacketSize")}var Iv=String(Od.getAttribute("CodecPrivateData"));if(Gv===
29
- _.Pc&&!Iv){var AJ=Hv,BJ={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},Jo=BJ[Io];if("AACH"===zJ){yc=new Uint8Array(4);var CJ=BJ[2*Io];yc[0]=40|Jo>>1;yc[1]=Jo<<7|AJ<<3|CJ>>1;yc[2]=CJ<<7|8;yc[3]=0;Ef=new Uint16Array(2);Ef[0]=(yc[0]<<8)+yc[1];Ef[1]=(yc[2]<<8)+yc[3];Fv=Ef[0].toString(16)+Ef[1].toString(16)}else yc=new Uint8Array(2),yc[0]=16|Jo>>1,yc[1]=Jo<<7|AJ<<3,Ef=new Uint16Array(1),Ef[0]=(yc[0]<<8)+yc[1],Fv=Ef[0].toString(16);Iv=Fv.toUpperCase()}var iX=
30
- {id:Ff.P++,type:Gv,index:gX,bitrate:hX,Ve:Iv,maxHeight:uJ,maxWidth:vJ,Ae:Io,uh:Hv,cp:xJ,Oj:wJ,up:yJ,Kl:zJ,segmentIndex:null};od.push(iX)}R=od;for(var Me=[],DJ=_.To.$(U,"c"),Ak=0;Ak<DJ.length;Ak++){var Jv=DJ[Ak],ne=parseInt(Jv.getAttribute("t"),10),hi=parseInt(Jv.getAttribute("d"),10),Kv=parseInt(Jv.getAttribute("r"),10),Bk=0;if(isNaN(ne)&&isNaN(hi))throw ka.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.N(_.O,4,4037,ka.o);0===Ak&&
31
- isNaN(ne)&&(Bk=ne=0);if(0<Ak){var Ig=Me[Me.length-1];Bk=Ig.n+1;Ig.d||(Ig.d=ne-Ig.t);ne||(ne=Ig.t+Ig.d);hi||(hi=ne-Ig.t)}Me.push({n:Bk,d:hi,t:ne});if(Kv){Kv--;for(var EJ=0;EJ<Kv;EJ++){var Ko=Me[Me.length-1];Bk=Ko.n+1;ne=Ko.t+Ko.d;hi=Ko.d;Me.push({n:Bk,d:hi,t:ne})}}}ka.Vd()||Me.length===Ba||ka.g.warn("Number of fragments ("+Ba+") differs from number of chunks ("+Me.length+").");B.push({type:qa,ip:Ba,xo:Ca,language:Na,yd:Da,name:zb,maxWidth:me,maxHeight:Cf,Mo:Fg,tracks:R,Wh:Me,timescale:Pu})}var Gf=
32
- {sp:f,Di:g,timescale:h,duration:l,isLive:m,rp:n,dg:p,kg:!1,streams:B};if(a.j&&a.A)return qT(a,Gf),Promise.resolve();a.H.clear();var Lv=Gf.timescale,Lo=Gf.duration,kX=SS(Gf.streams,_.Pc),lX=SS(Gf.streams,_.Jg),mX=SS(Gf.streams,_.pj),FJ=[],Mo=rT(a,Lo,Lv,kX),No=rT(a,Lo,Lv,lX),nX=rT(a,Lo,Lv,mX);Mo.length||(Mo=[null]);No.length||(No=[null]);for(var Nv=0;Nv<No.length;Nv++)for(var Ov=0;Ov<Mo.length;Ov++)FJ.push(sT(a,No[Nv],Mo[Ov]));var GJ={id:"ID",configurationId:void 0,startTime:0,endTime:Lo,variants:FJ,
33
- textStreams:nX,thumbStreams:[]};var pX=Gf.streams,Pv=a.a.startTime,HJ=a.a.delay,Qv=a.J,IJ=Math.min(a.a.duration||Infinity,Qv),Rv=a.Vd(),qX=a.a.dg,rX=a.a.se,JJ=a.I,KJ=isFinite(a.G)?a.G:0;if(Rv)IJ=Infinity,Pv=Date.now()/1E3-rX,a.a.startTime=Pv,HJ=3*JJ;else for(var sX=isFinite(Qv)?Qv:a.a.duration,LJ=_.u(pX),Sv=LJ.next();!Sv.done;Sv=LJ.next())for(var MJ=_.u(Sv.value.tracks),Tv=MJ.next();!Tv.done;Tv=MJ.next()){var NJ=Tv.value;NJ.segmentIndex.offset(-KJ);_.lE(NJ.segmentIndex,sX)}var OJ=a.f.timeline||{};
34
- OJ.type=void 0;a.C=new _.tE(OJ,Pv,HJ,!Rv,!0);a.C.f=IJ;_.BE(a.C,JJ);a.C.A=qX;Rv||a.C.offset(-KJ);a.F.filterAllPeriods([GJ]);a.j={presentationTimeline:a.C,periods:[GJ],minBufferTime:0,cues:[]};Promise.resolve();a.K||(a.F.networkingEngine.fd(a.L),a.K=!0);a.A=Gf;return Promise.resolve()},qT=function(a,b){for(var c=0;c<a.A.streams.length;c++)for(var d=b.streams[c],e={},f=_.u(a.A.streams[c].tracks),g=f.next();!g.done;e={nc:e.nc},g=f.next())if(e.nc=g.value,g=d.tracks.find(function(l){return function(m){return m.type===
35
- l.nc.type&&m.bitrate===l.nc.bitrate}}(e))){QS(e.nc,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=uT(a,a.A.timescale,d,g);g=e.nc.segmentIndex;g.ta(h);(h=a.a.dg)&&_.RE(g,_.QE(g)-h).forEach(function(l){l.cb().forEach(function(m){a.H["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.nc.type+" track with bitrate "+(e.nc.bitrate+". Skipping update."))},rT=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=uT(a,c,m,l);n=new _.PE(n);var p=null;m.type!==_.pj&&(p=vT(a,b,c,m,l));l.segmentIndex=n;var q=_.hL++,t=Promise.resolve.bind(Promise),v=n.ld.bind(n),z=n.get.bind(n),A=n.Nd.bind(n),D=n.getDuration.bind(n),G=wT[m.type],B="";switch(m.type){case _.Jg:B=l.Ve;var F=/00000001[0-9]7/.exec(B);B="avc1."+(F&&F[0]?B.substr(B.indexOf(F[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",B);break;case _.Pc:B=l.Ve,F=2,"AACH"===l.Kl?F=5:B&&
37
- (F=(parseInt(B.substr(0,2),16)&248)>>3),B="mp4a.40."+F,a.g.debug("AUDIO CODECS: ",B)}F=m.type===_.pj?xT[m.xo]:void 0;return{id:q,originalId:null,xp:null,createSegmentIndex:t,findSegmentPosition:v,getSegmentReference:z,adjustSegmentDurations:A,getDuration:D,segmentIndex:n,segmentLookupStrategy:_.hD,initSegmentReference:p,mimeType:G,codecs:B,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:F,encrypted:a.ng(),keyId:null,language:m.language,originalLanguage:m.yd,
38
- label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.uh||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},uT=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.Wh.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=PS(a.o,c,l,d);a.I=Math.max(a.I,m);f.push(new _.zj(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.H.set(q,n);e+=m});if(c.type===_.Jg||c.type===_.Pc)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},vT=function(a,b,c,d,e){b=RS(b,d.timescale||c,e);c={isLive:a.Vd.bind(a),df:a.ng.bind(a),Tl:function(){return 1},af:a.ai.bind(a)};d=new Uint8Array(0);try{d=eT(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.N(_.O,3,4035,g);}var f="data:text/plain;base64,"+_.Mm(d);return new _.LD(function(){return[f]},0,null,null,!0)},sT=function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:
40
- 0),e=c?c.language:_.wg;return c||b?{id:a.h++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,allowedByApplication:!0,allowedByKeySystem:!0}:null},nT=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.N(_.O,4,4038,a.o,c);},yT=function(a,b){null!=a.B&&null!=b&&(a.l=window.setTimeout(a.hc.bind(a),b))},oT=function(a,b){var c=b===kT;a.j&&a.j.presentationTimeline&&_.wE(a.j.presentationTimeline,c);c&&null!=a.l&&(window.clearTimeout(a.l),
41
- a.l=null,a.B=null);a.N=b},zT=function(){};TR.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};TR.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
- TR.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
- TR.prototype.write=function(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.V(a,1):_.V(a,this.size);_.dn(a,SR(this.type));this.size>b&&MR(a,this.size);"uuid"===this.type&&_.dn(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()};_.w(Z,TR);Z.prototype.a=function(){return 4+TR.prototype.a.call(this)};
44
- Z.prototype.write=function(a){TR.prototype.write.call(this,a);NR(a,this.version);OR(a,this.flags)};_.w(UR,TR);UR.prototype.a=function(){return this.f.byteLength+TR.prototype.a.call(this)-this.offset};UR.prototype.write=function(a){TR.prototype.write.call(this,a);_.dn(a,this.f,this.offset);a.getPosition()};_.w(VR,Z);VR.prototype.a=function(){return this.f.byteLength+Z.prototype.a.call(this)-this.offset};VR.prototype.write=function(a){Z.prototype.write.call(this,a);_.dn(a,this.f,this.offset);a.getPosition()};
45
- _.w(WR,TR);WR.prototype.a=function(){var a=this.h.length;a=a+4+this.f.join("").length;return a+TR.prototype.a.call(this)};WR.prototype.write=function(a){TR.prototype.write.call(this,a);_.dn(a,SR(this.h));_.V(a,this.Di);_.dn(a,SR(this.f.join("")));a.getPosition()};_.w(YR,TR);_.w(ZR,TR);_.w($R,Z);$R.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
- $R.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(MR(a,0),MR(a,0),_.V(a,this.timescale),MR(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));_.V(a,65536);PR(a,this.volume);PR(a,0);_.V(a,0);_.V(a,0);for(var b=0;b<this.f.length;b++)NR(a,this.f[b]);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,this.h);a.getPosition()};_.w(aS,TR);_.w(bS,Z);bS.prototype.a=function(){return 20+Z.prototype.a.call(this)};
47
- bS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.f);_.V(a,1);_.V(a,0);_.V(a,0);_.V(a,0);a.getPosition()};_.w(cS,Z);cS.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
- cS.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(MR(a,0),MR(a,0),_.V(a,this.h),_.V(a,0),MR(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.h),_.V(a,0),_.V(a,this.duration*this.timescale));_.V(a,0);_.V(a,0);PR(a,0);PR(a,0);PR(a,this.volume);PR(a,0);for(var b=0;b<this.f.length;b++)NR(a,this.f[b]);PR(a,this.width);PR(a,0);PR(a,this.height);PR(a,0);a.getPosition()};_.w(dS,Z);dS.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
49
- dS.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(MR(a,0),MR(a,0),_.V(a,this.timescale),MR(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));PR(a,this.language);PR(a,0);a.getPosition()};_.w(eS,Z);eS.prototype.a=function(){return 33+Z.prototype.a.call(this)};
50
- eS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,0);this.f===_.Jg?_.dn(a,SR("vide")):_.dn(a,SR("soun"));_.V(a,0);_.V(a,0);_.V(a,0);this.f===_.Jg?_.dn(a,SR("VideoHandler\x00")):_.dn(a,SR("SoundHandler\x00"));a.getPosition()};_.w(fS,Z);fS.prototype.a=function(){return 2+this.f.byteLength+Z.prototype.a.call(this)};fS.prototype.write=function(a){Z.prototype.write.call(this,a);PR(a,0);_.dn(a,this.f);a.getPosition()};_.w(gS,TR);gS.prototype.a=function(){return 8+TR.prototype.a.call(this)};
51
- gS.prototype.write=function(a){TR.prototype.write.call(this,a);_.V(a,0);PR(a,0);PR(a,1)};_.w(hS,gS);hS.prototype.a=function(){return 70+gS.prototype.a.call(this)};hS.prototype.write=function(a){gS.prototype.write.call(this,a);PR(a,0);PR(a,0);_.V(a,0);_.V(a,0);_.V(a,0);PR(a,this.width);PR(a,this.height);_.V(a,4718592);_.V(a,4718592);_.V(a,0);PR(a,1);NR(a,10);_.dn(a,SR("AVC Coding",31));PR(a,this.depth);RR(a,-1)};_.w(iS,gS);iS.prototype.a=function(){return 20+gS.prototype.a.call(this)};
52
- iS.prototype.write=function(a){gS.prototype.write.call(this,a);_.V(a,0);_.V(a,0);PR(a,this.channelCount);PR(a,this.sampleSize);RR(a,0);PR(a,0);PR(a,this.sampleRate);PR(a,0)};_.w(jS,hS);jS.prototype.write=function(a){hS.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};_.w(kS,jS);_.w(lS,iS);lS.prototype.write=function(a){iS.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};
53
- _.w(mS,lS);_.w(nS,TR);nS.prototype.a=function(){for(var a=7,b=0;b<this.gb.length;b++)a+=2,a+=this.gb[b].byteLength;for(b=0;b<this.gb.length;b++)a+=2,a+=this.tc[b].byteLength;return a+TR.prototype.a.call(this)};
54
- nS.prototype.write=function(a){TR.prototype.write.call(this,a);NR(a,this.version);NR(a,this.f);NR(a,this.h);NR(a,this.level);NR(a,255);NR(a,224|this.gb.length);for(var b=0;b<this.gb.length;b++)PR(a,this.gb[b].length),_.dn(a,this.gb[b]);NR(a,this.tc.length);for(b=0;b<this.tc.length;b++)PR(a,this.tc[b].length),_.dn(a,this.tc[b]);a.getPosition()};_.w(oS,Z);oS.prototype.a=function(){return 22+(this.oc.byteLength+3)+Z.prototype.a.call(this)};
55
- oS.prototype.write=function(a){Z.prototype.write.call(this,a);NR(a,3);NR(a,23+this.oc.byteLength);PR(a,1);NR(a,0);NR(a,4);NR(a,15+this.oc.byteLength);NR(a,64);NR(a,21);OR(a,0);_.V(a,0);_.V(a,0);NR(a,5);NR(a,this.oc.byteLength);_.dn(a,this.oc);_.dn(a,new Uint8Array([6,1,2]));a.getPosition()};_.w(pS,Z);pS.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};pS.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.dn(a,SR(this.location));a.getPosition()};
56
- _.w(qS,Z);qS.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)};qS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(rS,TR);_.w(sS,Z);sS.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
- sS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(tS,Z);tS.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)};tS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(uS,Z);
58
- uS.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)};uS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(vS,Z);vS.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
- vS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(wS,Z);wS.prototype.a=function(){return 8+Z.prototype.a.call(this)};wS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,0);_.V(a,0);a.getPosition()};_.w(xS,Z);xS.prototype.a=function(){return 4+Z.prototype.a.call(this)};xS.prototype.write=function(a){Z.prototype.write.call(this,a);RR(a,0);PR(a,0);a.getPosition()};
60
- _.w(yS,TR);_.w(zS,TR);_.w(AS,TR);_.w(BS,Z);BS.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};BS.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?MR(a,this.baseMediaDecodeTime):_.V(a,this.baseMediaDecodeTime);a.getPosition()};_.w(CS,Z);CS.prototype.a=function(){return 4+Z.prototype.a.call(this)};CS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.f);a.getPosition()};_.w(DS,Z);
61
- DS.prototype.a=function(){var a=4;this.flags&AT&&(a+=4);this.flags&BT&&(a+=4);for(var b=0;b<this.f;b++)this.flags&CT&&(a+=4),this.flags&DT&&(a+=4),this.flags&ET&&(a+=4),this.flags&FT&&(a+=4);return a+Z.prototype.a.call(this)};
62
- DS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.f);this.flags&AT&&(a.getPosition(),QR(a,this.j));this.flags&BT&&_.V(a,this.l);for(var b=0;b<this.f;b++)this.flags&CT&&_.V(a,this.o[b]),this.flags&DT&&_.V(a,this.sampleSize[b]),this.flags&ET&&_.V(a,this.A[b]),this.flags&FT&&(0===this.version?_.V(a,this.h[b]):QR(a,this.h[b]));a.getPosition()};var AT=1,BT=4,CT=256,DT=512,ET=1024,FT=2048;_.w(ES,Z);
63
- ES.prototype.a=function(){var a=4;this.flags&GT&&(a+=8);this.flags&HT&&(a+=4);this.flags&IT&&(a+=4);this.flags&JT&&(a+=4);this.flags&KT&&(a+=4);return a+Z.prototype.a.call(this)};ES.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.f);this.flags&GT&&MR(a,this.h);this.flags&HT&&_.V(a,this.A);this.flags&IT&&_.V(a,this.j);this.flags&JT&&_.V(a,this.o);this.flags&KT&&_.V(a,this.l);a.getPosition()};var GT=1,HT=2,IT=8,JT=16,KT=32;_.w(FS,TR);_.w(GS,TR);_.w(HS,TR);
64
- HS.prototype.a=function(){return this.f.byteLength+TR.prototype.a.call(this)};HS.prototype.write=function(a){TR.prototype.write.call(this,a);0<this.f.byteLength&&_.dn(a,this.f)};_.w(IS,Z);IS.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
- IS.prototype.write=function(a){Z.prototype.write.call(this,a);NR(a,0);0===this.version?NR(a,0):NR(a,0);NR(a,this.f);NR(a,this.h);_.dn(a,_.Om(this.l));if(1===this.f&&0===this.h){NR(a,0);for(var b=0;b<this.j.length;b++)NR(a,this.j[b])}a.getPosition()};_.w(JS,Z);JS.prototype.a=function(){var a=8;this.flags&1&&(a+=SR(this.jc).byteLength);return a+Z.prototype.a.call(this)};JS.prototype.write=function(a){Z.prototype.write.call(this,a);_.dn(a,SR(this.f));_.V(a,this.h);this.flags&1&&_.dn(a,SR(this.jc));a.getPosition()};
66
- _.w(KS,TR);KS.prototype.a=function(){return SR(this.f).byteLength+TR.prototype.a.call(this)};KS.prototype.write=function(a){TR.prototype.write.call(this,a);_.dn(a,SR(this.f));a.getPosition()};_.w(LS,Z);LS.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
- LS.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.V(a,0),_.V(a,0));_.V(a,1);for(var b=0;1>b;b++)0===this.version?_.V(a,this.offset[b]):MR(a,this.offset[b]);a.getPosition()};_.w(MS,Z);MS.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
- MS.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.V(a,0),_.V(a,0));NR(a,this.f);_.V(a,this.h);if(0===this.f)for(var b=0;b<this.h;b++)NR(a,this.j[b]);a.getPosition()};_.w(NS,Z);NS.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.h;b++)if(a+=this.f[b].ni.byteLength,this.flags&2){a+=2;for(var c=0;c<this.f[b].Ed;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
69
- NS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);this.flags&1&&NR(a,this.j);for(var b=0;b<this.h;b++)if(_.dn(a,this.f[b].ni),this.flags&2){PR(a,this.f[b].Ed);for(var c=0;c<this.f[b].Ed;c++)PR(a,this.f[b].Qg[c].qh),_.V(a,this.f[b].Qg[c].rh)}a.getPosition()};var US=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,VS=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,WS=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,XS=/^(\d*\.?\d*)f$/,YS=/^(\d*\.?\d*)t$/,ZS=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;cT.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};cT.prototype.write=function(){this.f=bT(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var fT=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.r=lT.prototype;_.r.configure=function(a){this.f=a};_.r.start=function(a,b){var c=this;this.F=b;var d=_.gh(new Set([a,OS(a)])).concat();return mT(this,d).then(function(e){return tT(c,e.data).then(function(){yT(c,c.B);return c.j})})};_.r.requestStop=function(){};_.r.stop=function(){this.F&&this.F.networkingEngine.ye(this.L);this.B=this.A=this.j=this.f=this.F=null;this.l&&(clearTimeout(this.l),this.l=null);this.K=!1;this.J=this.G=Infinity;return Promise.resolve()};
70
- _.r.update=function(){var a=this;if(this.Vd())return mT(this,[this.o]).then(function(b){return tT(a,b.data).then(function(){return a.j})})["catch"](function(b){if(a.F)a.F.onError(b)})};_.r.setCurrentVariant=function(){};_.r.hc=function(){var a=this;this.g.debug(_.ZC);this.F&&(this.l=null,this.update().then(function(){yT(a,a.B)})["catch"](function(b){a.F&&(a.F.onError(b),1===b.severity&&yT(a,100))}))};_.r.Vd=function(){return this.N===pT};_.r.ng=function(){return 0<this.w.length};
71
- _.r.ai=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
- _.r.ho=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.Vd.bind(this),df:this.ng.bind(this),Tl:function(){return 1},af:this.ai.bind(this)},d=!1,e=new _.N(_.O,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=hT(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)};_.r.loadVariant=function(a){return _.H(function(b){return b["return"](a)})};_.r.loadTextStream=function(a,b){var c=this,d,e;return _.H(function(f){(e=c.j.periods.find(function(g){return g.id===b}))&&(d=e.textStreams.find(function(g){return g.id===a})||null);if(!d)throw new _.Zi(_.PC+a);return f["return"](d)})};var wT={video:_.Lg,audio:_.Tc,text:_.Mc},kT=_.Wb,pT="LIVE",xT={Po:_.dd,Wo:_.hg};_.w(zT,_.Bu);zT.prototype.f=function(){_.dv.ism=lT;_.bv[_.Nc]=lT};zT.prototype.a=function(){_.sF("ism");_.tF(_.Nc)};zT.prototype.id=function(){return _.Zf};_.I("clpp.smooth.SmoothComponent",zT);};
2
+ var f=function(window){var ZR="Full MP4 box must have flags defined",$R="clpp.smooth.SmoothMP4Processor",aS="codecPrivateData",bS=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)},cS=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.vn()}},dS=function(a,b){cS(a,b>>16&255);cS(a,b>>8&255);cS(a,b&255)},eS=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.vn()}},fS=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.vn()}},gS=function(a,b){try{a.f.setInt16(a.a,
3
+ b,a.h),a.a+=2}catch(c){_.vn()}},hS=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},iS=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){iS.call(this,a);this.version=b;this.flags=c},jS=function(a,b,c){iS.call(this,a);this.f=b;this.offset=c},kS=function(a,
4
+ b,c,d,e){Z.call(this,a,b,c);this.f=d;this.offset=e},lS=function(a,b,c){iS.call(this,"ftyp");this.h=a;this.xi=b;this.f=c},mS=function(){iS.call(this,_.Me)},nS=function(){iS.call(this,_.ug)},oS=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]},pS=function(){iS.call(this,"mvex")},qS=function(a){Z.call(this,"trex",0,0);this.f=a},rS=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]},sS=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},tS=function(a){Z.call(this,"hdlr",0,0);this.f=a},uS=function(){Z.call(this,"vmhd",0,1);this.f=new Uint8Array([0,0,0,0,0,0])},vS=function(a){iS.call(this,a);this.w=!0},wS=function(a){vS.call(this,a);this.height=this.width=0;this.depth=24},
6
+ xS=function(a,b,c,d){vS.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},yS=function(a,b){wS.call(this,"avc1");this.width=a;this.height=b},zS=function(a,b){yS.call(this,a,b);this.type="encv"},AS=function(a,b,c){xS.call(this,"mp4a",a,b,c)},BS=function(a,b,c){AS.call(this,a,b,c);this.type="enca"},CS=function(a,b){iS.call(this,"avcC");this.cb=a;this.pc=b;this.version=1;this.f=this.cb[0][1];this.h=this.cb[0][2];this.level=this.cb[0][3]},DS=function(a){Z.call(this,"esds",0,0);this.kc=
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(){iS.call(this,_.dg)},HS=function(){Z.call(this,_.fg,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(){iS.call(this,"dinf")},OS=function(){iS.call(this,_.Le)},PS=function(){iS.call(this,_.He)},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(){iS.call(this,"traf")},VS=function(){iS.call(this,"moof")},WS=function(){iS.call(this,_.Ge);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.ec=""},ZS=function(a){iS.call(this,"frma");this.f=a},$S=function(){Z.call(this,"saio",0,0);this.offset=[0]},aT=function(a,b,c){Z.call(this,"saiz",0,0);this.f=a;this.j=b;this.h=c},bT=function(a,b){Z.call(this,"senc",a,b);this.h=0;this.j=8;this.f=[]},cT=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},dT=function(a,b,c,d){c=b.Qh[c];b=b.Ho;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 _.AD([a],[b])[0]},eT=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.Jg?c=["maxWidth","maxHeight","bitrate",aS,"fourCC"]:a.type===_.Oc&&(c=["bitrate",aS,"channels","bitsPerSample","samplingRate","fourCC"]);return _.N.ra(a,b,c,["id","segmentIndex"])},fT=function(a,b,c){var d=c.Te.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,cb:null,
11
+ pc:null,width:NaN,height:NaN,kc:null,we:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.Jg:a.cb=[_.sl(d[1])];a.pc=[_.sl(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.Oc:a.kc=_.sl(c.Te),a.sampleSize=c.Kj||16,a.we=c.we,a.channelCount=c.nh}return a},gT=function(a,b){return a.filter(function(c){return c.type===b})},hT=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)},oT=function(a,
12
+ b,c){var d=null;if(iT.test(a)){a=iT.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 jT.test(a)?d=hT(jT,a):kT.test(a)?d=hT(kT,a):lT.test(a)?(a=lT.exec(a),d=Number(a[1])/c.frameRate):mT.test(a)?(a=mT.exec(a),d=Number(a[1])/c.a):nT.test(a)&&(d=hT(nT,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},pT=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))},rT=function(a){this.a=a;this.f=qT(this)},qT=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.un(b)},sT=function(a,b,c){a:{var d=_.v([_.Fd,_.Dd]);for(var e=d.next();!e.done;e=d.next())if((e=c.Ze(e.value))&&e.keyId){d=e.keyId;break a}_.Jh($R,
14
+ "Could not get default Key ID for DRM init data!");d=null}c=new iS("xxxx");a.type===_.Jg?c=new zS(a.width,a.height):c=new BS(a.channelCount,a.sampleSize,a.we);a=new XS;a.f=1;a.h=8;a.l=d||"00000000000000000000000000000000";a=(new iS("schi")).append([a]);b=(new iS(_.Yf)).append([new ZS(b),new YS(_.gd,65536),a]);c.append([b]);return c},tT=function(a,b){var c=b.bf(),d=new oS(a.timescale,a.duration,a.id),e=(new pS).append([new qS(a.id)]),f=new rS(a.id,a.duration,a.timescale,a.width,a.height),g=new sS(a.timescale,
15
+ a.duration),h=new tS(a.type),l=null,m=new FS;m.entries=[new ES];var n=new HS;switch(a.type){case _.Jg:var p=new CS(a.cb,a.pc);c?(l=sT(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new yS(a.width,a.height)).append([p]),n.entries=[l]);l=new uS;break;case _.Oc:p=new DS(a.kc),c?(l=sT(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new AS(a.channelCount,a.sampleSize,a.we)).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 nS).append([f,g]);d=(new mS).append([d,f,e]);e=new lS("dash",0,["iso6","mp41","avc1"]);c&&(c=b.Ze(_.Dd),f=b.Ze(_.Fd),c&&d.append([new jS("pssh",c.initData,8)]),f&&d.append([new jS("pssh",f.initData,8)]),c||f||_.Jh($R,"Could not get PSSH init data!"));c=new rT([e,d]);return _.gj(c.write())},vT=function(a,b){var c,d,e,f,g,h;(new _.Hn).M("moof",_.In).ba("mfhd",function(m){var n=new RS;n.f=_.Cn(m.reader);c=n}).M("traf",_.In).ba("tfhd",function(m){var n=m.reader.Ua();
17
+ if(null===m.flags)throw new _.O(_.Q,3,3019,ZR);var p=new TS(m.version||0,m.flags||0);p.f=_.Cn(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.h=_.En(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.A=_.Cn(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.j=_.Cn(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.o=_.Cn(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.l=_.Cn(m.reader));d=p}).ba("trun",function(m){var n=m.reader.Ua();if(null===m.flags)throw new _.O(_.Q,3,3019,ZR);
18
+ var p=new SS(m.version||0,m.flags||0);p.f=_.Cn(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.Dn(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.l=_.Cn(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.f;n++)m.flags&256&&p.o.push(_.Cn(m.reader)),m.flags&512&&p.sampleSize.push(_.Cn(m.reader)),m.flags&1024&&p.A.push(_.Cn(m.reader)),m.flags&2048&&(0===m.version?p.h.push(_.Cn(m.reader)):p.h.push(_.Dn(m.reader)));e=p}).ba("sdtp",function(m){var n=_.Gn(m.reader,m.reader.Ua());f=new kS("sdtp",
19
+ m.version||0,m.flags||0,n,0)}).M("uuid",function(m){var n=_.Gn(m.reader,16);if(_.ul(n,uT)){n=_.Cn(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new bT(m.version,m.flags);n.h=_.Cn(m.reader);m.flags&1&&(n.j=_.An(m.reader));for(var p=0;p<n.h;p++){var q={hi:_.Gn(m.reader,8),wd:0,Kg:[]};if(m.flags&2){q.wd=_.Bn(m.reader);for(var t=0;t<q.wd;t++){var u={jh:0,kh:0};u.jh=_.Bn(m.reader);u.kh=_.Cn(m.reader);q.Kg.push(u)}}n.f.push(q)}g=n}}).M(_.Ge,function(m){var n=new WS;0<m.reader.Ua()?n.f=_.Gn(m.reader,m.reader.Ua()):
20
+ (_.Jh($R,"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.bf()&&g&&l.append([g]);l=(new VS).append([c,l]);return new rT([l,h])},wT=function(a,b,c,d){var e=d.bf(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=vT(b,d);if(null===g)return a.request.contentType===_.yj?a.data:g;d=g.get(_.Ge);if(a.request.contentType===_.yj){e=d.f.buffer;if(c){e=_.R.Yd(e);if((e=(new DOMParser).parseFromString(e,_.mg))&&"tt"===e.documentElement.tagName.toLowerCase())var h=
21
+ e.documentElement;if(h&&(d=new pT(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",_.fe],m=0,n=l.length;m<n;m++){b:{var p=f;var q=l[m],t=new RegExp("\\w+:"+q),u=0;if(p.hasAttribute(q))p=p.getAttribute(q);else{q=p.attributes;for(var y=q.length;u<y;u++){var A=q[u].name;if(A=A.match(t)){p=
22
+ p.getAttribute(A[0]);break b}}p=null}}f.setAttribute(l[m],oT(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.R.eb(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].wd);else g=8;b.append([c,new $S,new aT(g,l,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=
23
+ new rT([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},xT=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},yT=function(a,b,c){a=_.pp(a);c&&a.version!==c&&(a=_.rD(a,c));return{initData:_.pD(a),initDataType:_.gd,keyId:b,periodId:null}},AT=function(){this.A=this.j=this.f=
24
+ this.D=null;this.h=1;this.P=0;this.o="";this.F=this.a=null;this.g=new _.K("clpp.smooth.SmoothParser");this.K=!1;this.l=this.B=null;this.N=zT;this.I=0;this.G=this.J=Infinity;this.w=[];this.L=this.ao.bind(this);this.H=new Map},BT=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.Yj(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),_.x(f,d.T,2);e=f.f;a.o=e.uri;return f["return"](e)})},IT=function(a,b){var c=_.kp,d=null;try{var e=_.R.Yd(b);d=c.te(e,_.Kb)}catch(UY){}if(!d)throw a.g.error("Unable to parse manifest"),new _.O(_.Q,4,4033,a.o);var f=+CT(a,d,"MajorVersion"),g=+CT(a,d,"MinorVersion"),h=+d.getAttribute("TimeScale")||1E7,l=+CT(a,d,"Duration"),m="TRUE"===d.getAttribute("IsLive"),n=+d.getAttribute("LookAheadCount"),p=+d.getAttribute("DVRWindowLength")||
26
+ Infinity,q=c.aa(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(_.Q,4,4036,a.o);m?(DT(a,ET),a.B=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),l=Infinity):DT(a,zT);a.a={startTime:0,delay:0,duration:l/h,$f:p/h,oe:0};if(q){var t=a.f.playreadyVersion,u=_.kp,y=[],A=u.aa(q,"ProtectionHeader")[0],B=_.rl(u.sa(A)||""),C=_.pp(B).a;y.push(xT(_.Fd,{initData:_.pD(_.hp(C)),initDataType:_.gd,
27
+ keyId:C,periodId:null},[C]));y.push(xT(_.Dd,yT(B,C,t),[C]));a.w=y}var E=[],D=_.kp.aa(d,"StreamIndex");if(!D.length)throw a.g.error("No streams found!"),new _.O(_.Q,4,4034,a.o);for(var L=0;L<D.length;L++){for(var P,U=a,V=D[L],ra=CT(U,V,"Type"),Da=+V.getAttribute("Chunks"),wa=V.getAttribute("Subtype")||"",Ea=V.getAttribute("Language")||_.xg,Oa=_.Kj(Ea),zb=V.getAttribute("Name")||"",pe=+V.getAttribute(_.eb),Df=+V.getAttribute(_.db),Hg=CT(U,V,"Url"),Uu=+V.getAttribute("TimeScale")||null,od=[],Qn=_.kp.aa(V,
28
+ _.yb),Jv=0;Jv<Qn.length;Jv++){var Ff=void 0,xc=void 0,Kv=void 0,Gf=U,Pd=Qn[Jv],Lv=ra,xX=+Pd.getAttribute("Index"),yX=+CT(Gf,Pd,"Bitrate"),IJ=NaN,JJ=NaN,No=NaN,Mv=NaN,KJ=NaN,LJ=NaN,MJ=NaN,NJ=Pd.getAttribute("FourCC")||"";switch(Lv){case _.Jg:IJ=+CT(Gf,Pd,_.db);JJ=+CT(Gf,Pd,_.eb);break;case _.Oc:Mv=+Pd.getAttribute("Channels")||2,No=+CT(Gf,Pd,"SamplingRate"),LJ=+CT(Gf,Pd,"AudioTag"),KJ=+CT(Gf,Pd,"BitsPerSample"),MJ=+CT(Gf,Pd,"PacketSize")}var Nv=String(Pd.getAttribute("CodecPrivateData"));if(Lv===_.Oc&&
29
+ !Nv){var OJ=Mv,PJ={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},Oo=PJ[No];if("AACH"===NJ){xc=new Uint8Array(4);var QJ=PJ[2*No];xc[0]=40|Oo>>1;xc[1]=Oo<<7|OJ<<3|QJ>>1;xc[2]=QJ<<7|8;xc[3]=0;Ff=new Uint16Array(2);Ff[0]=(xc[0]<<8)+xc[1];Ff[1]=(xc[2]<<8)+xc[3];Kv=Ff[0].toString(16)+Ff[1].toString(16)}else xc=new Uint8Array(2),xc[0]=16|Oo>>1,xc[1]=Oo<<7|OJ<<3,Ff=new Uint16Array(1),Ff[0]=(xc[0]<<8)+xc[1],Kv=Ff[0].toString(16);Nv=Kv.toUpperCase()}var zX=
30
+ {id:Gf.P++,type:Lv,index:xX,bitrate:yX,Te:Nv,maxHeight:IJ,maxWidth:JJ,we:No,nh:Mv,Yo:LJ,Kj:KJ,pp:MJ,El:NJ,segmentIndex:null};od.push(zX)}P=od;for(var Ne=[],RJ=_.kp.aa(V,"c"),Ak=0;Ak<RJ.length;Ak++){var Ov=RJ[Ak],qe=parseInt(Ov.getAttribute("t"),10),ki=parseInt(Ov.getAttribute("d"),10),Pv=parseInt(Ov.getAttribute("r"),10),Bk=0;if(isNaN(qe)&&isNaN(ki))throw U.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.O(_.Q,4,4037,U.o);0===Ak&&
31
+ isNaN(qe)&&(Bk=qe=0);if(0<Ak){var Kg=Ne[Ne.length-1];Bk=Kg.n+1;Kg.d||(Kg.d=qe-Kg.t);qe||(qe=Kg.t+Kg.d);ki||(ki=qe-Kg.t)}Ne.push({n:Bk,d:ki,t:qe});if(Pv){Pv--;for(var SJ=0;SJ<Pv;SJ++){var Po=Ne[Ne.length-1];Bk=Po.n+1;qe=Po.t+Po.d;ki=Po.d;Ne.push({n:Bk,d:ki,t:qe})}}}U.Od()||Ne.length===Da||U.g.warn("Number of fragments ("+Da+") differs from number of chunks ("+Ne.length+").");E.push({type:ra,cp:Da,ro:wa,language:Oa,sd:Ea,name:zb,maxWidth:pe,maxHeight:Df,Ho:Hg,tracks:P,Qh:Ne,timescale:Uu})}var Hf={np:f,
32
+ xi:g,timescale:h,duration:l,isLive:m,mp:n,$f:p,gg:!1,streams:E};if(a.j&&a.A)return FT(a,Hf),Promise.resolve();a.H.clear();var Qv=Hf.timescale,Qo=Hf.duration,BX=gT(Hf.streams,_.Oc),CX=gT(Hf.streams,_.Jg),DX=gT(Hf.streams,_.yj),TJ=[],Ro=GT(a,Qo,Qv,BX),So=GT(a,Qo,Qv,CX),EX=GT(a,Qo,Qv,DX);Ro.length||(Ro=[null]);So.length||(So=[null]);for(var Sv=0;Sv<So.length;Sv++)for(var Tv=0;Tv<Ro.length;Tv++)TJ.push(HT(a,So[Sv],Ro[Tv]));var UJ={id:"ID",configurationId:void 0,startTime:0,endTime:Qo,variants:TJ,textStreams:EX,
33
+ thumbStreams:[]};var GX=Hf.streams,Uv=a.a.startTime,VJ=a.a.delay,Vv=a.J,WJ=Math.min(a.a.duration||Infinity,Vv),Wv=a.Od(),HX=a.a.$f,IX=a.a.oe,XJ=a.I,YJ=isFinite(a.G)?a.G:0;if(Wv)WJ=Infinity,Uv=Date.now()/1E3-IX,a.a.startTime=Uv,VJ=3*XJ;else for(var JX=isFinite(Vv)?Vv:a.a.duration,ZJ=_.v(GX),Xv=ZJ.next();!Xv.done;Xv=ZJ.next())for(var $J=_.v(Xv.value.tracks),Yv=$J.next();!Yv.done;Yv=$J.next()){var aK=Yv.value;aK.segmentIndex.offset(-YJ);_.hE(aK.segmentIndex,JX)}var bK=a.f.timeline||{};bK.type=void 0;
34
+ a.F=new _.pE(bK,Uv,VJ,!Wv,!0);a.F.f=WJ;_.xE(a.F,XJ);a.F.A=HX;Wv||a.F.offset(-YJ);a.D.filterAllPeriods([UJ]);a.j={presentationTimeline:a.F,periods:[UJ],minBufferTime:0,cues:[]};Promise.resolve();a.K||(a.D.networkingEngine.bd(a.L),a.K=!0);a.A=Hf;return Promise.resolve()},FT=function(a,b){for(var c=0;c<a.A.streams.length;c++)for(var d=b.streams[c],e={},f=_.v(a.A.streams[c].tracks),g=f.next();!g.done;e={ic:e.ic},g=f.next())if(e.ic=g.value,g=d.tracks.find(function(l){return function(m){return m.type===
35
+ l.ic.type&&m.bitrate===l.ic.bitrate}}(e))){eT(e.ic,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=JT(a,a.A.timescale,d,g);g=e.ic.segmentIndex;g.ua(h);(h=a.a.$f)&&_.OE(g,_.NE(g)-h).forEach(function(l){l.Ka().forEach(function(m){a.H["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.ic.type+" track with bitrate "+(e.ic.bitrate+". Skipping update."))},GT=function(a,b,c,d){for(var e=[],f={Vc:0};f.Vc<d.length;f={Vc:f.Vc},
36
+ f.Vc++){var g=d[f.Vc].tracks.map(function(h){return function(l){var m=d[h.Vc],n=JT(a,c,m,l);n=new _.ME(n);var p=null;m.type!==_.yj&&(p=KT(a,b,c,m,l));l.segmentIndex=n;var q=_.lL++,t=Promise.resolve.bind(Promise),u=n.gd.bind(n),y=n.get.bind(n),A=n.Fd.bind(n),B=n.getDuration.bind(n),C=LT[m.type],E="";switch(m.type){case _.Jg:E=l.Te;var D=/00000001[0-9]7/.exec(E);E="avc1."+(D&&D[0]?E.substr(E.indexOf(D[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",E);break;case _.Oc:E=l.Te,D=2,"AACH"===l.El?D=5:E&&
37
+ (D=(parseInt(E.substr(0,2),16)&248)>>3),E="mp4a.40."+D,a.g.debug("AUDIO CODECS: ",E)}D=m.type===_.yj?MT[m.ro]:void 0;return{id:q,originalId:null,sp:null,createSegmentIndex:t,findSegmentPosition:u,getSegmentReference:y,adjustSegmentDurations:A,getDuration:B,segmentIndex:n,segmentLookupStrategy:_.$C,initSegmentReference:p,mimeType:C,codecs:E,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:D,encrypted:a.jg(),keyId:null,language:m.language,originalLanguage:m.sd,
38
+ label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.nh||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.Qh.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=dT(a.o,c,l,d);a.I=Math.max(a.I,m);f.push(new _.Hj(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.H.set(q,n);e+=m});if(c.type===_.Jg||c.type===_.Oc)b=f[f.length-
39
+ 1],a.J=Math.min(a.J,e),0===a.a.oe?a.a.oe=b.endTime:a.a.oe=Math.min(a.a.oe,b.endTime);return f},KT=function(a,b,c,d,e){b=fT(b,d.timescale||c,e);c={isLive:a.Od.bind(a),bf:a.jg.bind(a),Nl:function(){return 1},Ze:a.Vh.bind(a)};d=new Uint8Array(0);try{d=tT(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.O(_.Q,3,4035,g);}var f="data:text/plain;base64,"+_.ql(d);return new _.CD(function(){return[f]},0,null,null,!0)},HT=function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:
40
+ 0),e=c?c.language:_.xg;return c||b?{id:a.h++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,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(_.Q,4,4038,a.o,c);},NT=function(a,b){null!=a.B&&null!=b&&(a.l=window.setTimeout(a.cc.bind(a),b))},DT=function(a,b){var c=b===zT;a.j&&a.j.presentationTimeline&&_.sE(a.j.presentationTimeline,c);c&&null!=a.l&&(window.clearTimeout(a.l),
41
+ a.l=null,a.B=null);a.N=b},OT=function(){};iS.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};iS.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
+ iS.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
+ iS.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);_.wn(a,hS(this.type));this.size>b&&bS(a,this.size);"uuid"===this.type&&_.wn(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()};_.w(Z,iS);Z.prototype.a=function(){return 4+iS.prototype.a.call(this)};
44
+ Z.prototype.write=function(a){iS.prototype.write.call(this,a);cS(a,this.version);dS(a,this.flags)};_.w(jS,iS);jS.prototype.a=function(){return this.f.byteLength+iS.prototype.a.call(this)-this.offset};jS.prototype.write=function(a){iS.prototype.write.call(this,a);_.wn(a,this.f,this.offset);a.getPosition()};_.w(kS,Z);kS.prototype.a=function(){return this.f.byteLength+Z.prototype.a.call(this)-this.offset};kS.prototype.write=function(a){Z.prototype.write.call(this,a);_.wn(a,this.f,this.offset);a.getPosition()};
45
+ _.w(lS,iS);lS.prototype.a=function(){var a=this.h.length;a=a+4+this.f.join("").length;return a+iS.prototype.a.call(this)};lS.prototype.write=function(a){iS.prototype.write.call(this,a);_.wn(a,hS(this.h));_.W(a,this.xi);_.wn(a,hS(this.f.join("")));a.getPosition()};_.w(mS,iS);_.w(nS,iS);_.w(oS,Z);oS.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
+ oS.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(bS(a,0),bS(a,0),_.W(a,this.timescale),bS(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));_.W(a,65536);eS(a,this.volume);eS(a,0);_.W(a,0);_.W(a,0);for(var b=0;b<this.f.length;b++)cS(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()};_.w(pS,iS);_.w(qS,Z);qS.prototype.a=function(){return 20+Z.prototype.a.call(this)};
47
+ qS.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()};_.w(rS,Z);rS.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
+ rS.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(bS(a,0),bS(a,0),_.W(a,this.h),_.W(a,0),bS(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);eS(a,0);eS(a,0);eS(a,this.volume);eS(a,0);for(var b=0;b<this.f.length;b++)cS(a,this.f[b]);eS(a,this.width);eS(a,0);eS(a,this.height);eS(a,0);a.getPosition()};_.w(sS,Z);sS.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
49
+ sS.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(bS(a,0),bS(a,0),_.W(a,this.timescale),bS(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));eS(a,this.language);eS(a,0);a.getPosition()};_.w(tS,Z);tS.prototype.a=function(){return 33+Z.prototype.a.call(this)};
50
+ tS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);this.f===_.Jg?_.wn(a,hS("vide")):_.wn(a,hS("soun"));_.W(a,0);_.W(a,0);_.W(a,0);this.f===_.Jg?_.wn(a,hS("VideoHandler\x00")):_.wn(a,hS("SoundHandler\x00"));a.getPosition()};_.w(uS,Z);uS.prototype.a=function(){return 2+this.f.byteLength+Z.prototype.a.call(this)};uS.prototype.write=function(a){Z.prototype.write.call(this,a);eS(a,0);_.wn(a,this.f);a.getPosition()};_.w(vS,iS);vS.prototype.a=function(){return 8+iS.prototype.a.call(this)};
51
+ vS.prototype.write=function(a){iS.prototype.write.call(this,a);_.W(a,0);eS(a,0);eS(a,1)};_.w(wS,vS);wS.prototype.a=function(){return 70+vS.prototype.a.call(this)};wS.prototype.write=function(a){vS.prototype.write.call(this,a);eS(a,0);eS(a,0);_.W(a,0);_.W(a,0);_.W(a,0);eS(a,this.width);eS(a,this.height);_.W(a,4718592);_.W(a,4718592);_.W(a,0);eS(a,1);cS(a,10);_.wn(a,hS("AVC Coding",31));eS(a,this.depth);gS(a,-1)};_.w(xS,vS);xS.prototype.a=function(){return 20+vS.prototype.a.call(this)};
52
+ xS.prototype.write=function(a){vS.prototype.write.call(this,a);_.W(a,0);_.W(a,0);eS(a,this.channelCount);eS(a,this.sampleSize);gS(a,0);eS(a,0);eS(a,this.sampleRate);eS(a,0)};_.w(yS,wS);yS.prototype.write=function(a){wS.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};_.w(zS,yS);_.w(AS,xS);AS.prototype.write=function(a){xS.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};
53
+ _.w(BS,AS);_.w(CS,iS);CS.prototype.a=function(){for(var a=7,b=0;b<this.cb.length;b++)a+=2,a+=this.cb[b].byteLength;for(b=0;b<this.cb.length;b++)a+=2,a+=this.pc[b].byteLength;return a+iS.prototype.a.call(this)};
54
+ CS.prototype.write=function(a){iS.prototype.write.call(this,a);cS(a,this.version);cS(a,this.f);cS(a,this.h);cS(a,this.level);cS(a,255);cS(a,224|this.cb.length);for(var b=0;b<this.cb.length;b++)eS(a,this.cb[b].length),_.wn(a,this.cb[b]);cS(a,this.pc.length);for(b=0;b<this.pc.length;b++)eS(a,this.pc[b].length),_.wn(a,this.pc[b]);a.getPosition()};_.w(DS,Z);DS.prototype.a=function(){return 22+(this.kc.byteLength+3)+Z.prototype.a.call(this)};
55
+ DS.prototype.write=function(a){Z.prototype.write.call(this,a);cS(a,3);cS(a,23+this.kc.byteLength);eS(a,1);cS(a,0);cS(a,4);cS(a,15+this.kc.byteLength);cS(a,64);cS(a,21);dS(a,0);_.W(a,0);_.W(a,0);cS(a,5);cS(a,this.kc.byteLength);_.wn(a,this.kc);_.wn(a,new Uint8Array([6,1,2]));a.getPosition()};_.w(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&&_.wn(a,hS(this.location));a.getPosition()};
56
+ _.w(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()};_.w(GS,iS);_.w(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()};_.w(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()};_.w(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()};_.w(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()};_.w(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()};_.w(MS,Z);MS.prototype.a=function(){return 4+Z.prototype.a.call(this)};MS.prototype.write=function(a){Z.prototype.write.call(this,a);gS(a,0);eS(a,0);a.getPosition()};
60
+ _.w(NS,iS);_.w(OS,iS);_.w(PS,iS);_.w(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?bS(a,this.baseMediaDecodeTime):_.W(a,this.baseMediaDecodeTime);a.getPosition()};_.w(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()};_.w(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(),fS(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]):fS(a,this.h[b]));a.getPosition()};var PT=1,QT=4,RT=256,ST=512,TT=1024,UT=2048;_.w(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&&bS(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;_.w(US,iS);_.w(VS,iS);_.w(WS,iS);
64
+ WS.prototype.a=function(){return this.f.byteLength+iS.prototype.a.call(this)};WS.prototype.write=function(a){iS.prototype.write.call(this,a);0<this.f.byteLength&&_.wn(a,this.f)};_.w(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);cS(a,0);0===this.version?cS(a,0):cS(a,0);cS(a,this.f);cS(a,this.h);_.wn(a,_.sl(this.l));if(1===this.f&&0===this.h){cS(a,0);for(var b=0;b<this.j.length;b++)cS(a,this.j[b])}a.getPosition()};_.w(YS,Z);YS.prototype.a=function(){var a=8;this.flags&1&&(a+=hS(this.ec).byteLength);return a+Z.prototype.a.call(this)};YS.prototype.write=function(a){Z.prototype.write.call(this,a);_.wn(a,hS(this.f));_.W(a,this.h);this.flags&1&&_.wn(a,hS(this.ec));a.getPosition()};
66
+ _.w(ZS,iS);ZS.prototype.a=function(){return hS(this.f).byteLength+iS.prototype.a.call(this)};ZS.prototype.write=function(a){iS.prototype.write.call(this,a);_.wn(a,hS(this.f));a.getPosition()};_.w($S,Z);$S.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
+ $S.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]):bS(a,this.offset[b]);a.getPosition()};_.w(aT,Z);aT.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
+ aT.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));cS(a,this.f);_.W(a,this.h);if(0===this.f)for(var b=0;b<this.h;b++)cS(a,this.j[b]);a.getPosition()};_.w(bT,Z);bT.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.h;b++)if(a+=this.f[b].hi.byteLength,this.flags&2){a+=2;for(var c=0;c<this.f[b].wd;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
69
+ bT.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.h);this.flags&1&&cS(a,this.j);for(var b=0;b<this.h;b++)if(_.wn(a,this.f[b].hi),this.flags&2){eS(a,this.f[b].wd);for(var c=0;c<this.f[b].wd;c++)eS(a,this.f[b].Kg[c].jh),_.W(a,this.f[b].Kg[c].kh)}a.getPosition()};var iT=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,jT=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,kT=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,lT=/^(\d*\.?\d*)f$/,mT=/^(\d*\.?\d*)t$/,nT=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;rT.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};rT.prototype.write=function(){this.f=qT(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var uT=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.r=AT.prototype;_.r.configure=function(a){this.f=a};_.r.start=function(a,b){var c=this;this.D=b;var d=_.hh(new Set([a,cT(a)])).concat();return BT(this,d).then(function(e){return IT(c,e.data).then(function(){NT(c,c.B);return c.j})})};_.r.requestStop=function(){};_.r.stop=function(){this.D&&this.D.networkingEngine.ue(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
+ _.r.update=function(){var a=this;if(this.Od())return BT(this,[this.o]).then(function(b){return IT(a,b.data).then(function(){return a.j})})["catch"](function(b){if(a.D)a.D.onError(b)})};_.r.setCurrentVariant=function(){};_.r.cc=function(){var a=this;this.g.debug(_.RC);this.D&&(this.l=null,this.update().then(function(){NT(a,a.B)})["catch"](function(b){a.D&&(a.D.onError(b),1===b.severity&&NT(a,100))}))};_.r.Od=function(){return this.N===ET};_.r.jg=function(){return 0<this.w.length};
71
+ _.r.Vh=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
+ _.r.ao=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.Od.bind(this),bf:this.jg.bind(this),Nl:function(){return 1},Ze:this.Vh.bind(this)},d=!1,e=new _.O(_.Q,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=wT(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)};_.r.loadVariant=function(a){return _.I(function(b){return b["return"](a)})};_.r.loadTextStream=function(a,b){var c=this,d,e;return _.I(function(f){(e=c.j.periods.find(function(g){return g.id===b}))&&(d=e.textStreams.find(function(g){return g.id===a})||null);if(!d)throw new _.Zi(_.HC+a);return f["return"](d)})};var LT={video:_.Mg,audio:_.Sc,text:_.Lc},zT=_.Vb,ET="LIVE",MT={Ko:_.cd,Ro:_.hg};_.w(OT,_.Wu);OT.prototype.f=function(){_.qv.ism=AT;_.pv[_.Mc]=AT};OT.prototype.a=function(){_.oF("ism");_.pF(_.Mc)};OT.prototype.id=function(){return _.Zf};_.J("clpp.smooth.SmoothComponent",OT);};
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 Tz="No thumbnail found for position: ",Uz="Position is out of range: ",Vz="Thumbnail URL is mandatory",Wz="Wrong gridSize format",Xz="clpp.thumbnails",Yz=function(){this.log=new _.J(Xz);this.player=null;this.a=[];this.w=!1},$z=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Re&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return Zz(a,0,e,!!f)})},Promise.resolve())},Zz=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return aA(a,d).then(function(){return a.a[b].load()}).then(function(){return Zz(a,
3
- e,c,d)})},aA=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.yq)c();else a.player.one(_.$c,function(){c()})})},bA=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.ua=p;this.nl=h;this.ko=l;this.hm=m;this.im=n;this.og=null},cA=function(){Yz.call(this);
4
- this.f=null;this.o=this.h=1;this.j=0},dA=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.zd=new _.kk},eA=function(){this.g=new _.J(Xz);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.kk},fA=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.zd.resolve()})},hA=function(a,b){return gA(a,b).then(function(c){return new bA(c,b.time,b.duration)})},gA=function(a,b){return b.load().then(function(){var c=_.Oj(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
- _.Lm(c)})},iA=function(){Yz.call(this);this.f=null},jA=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},kA=function(){Yz.apply(this,arguments)},lA=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{ne:c,$g:d,mi:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},mA=function(){this.g=new _.J(Xz);this.a=this.m=null},nA=function(a){return a.some(function(b){return 0<
6
- b.thumbStreams.length})},sA=function(a){return a?a===oA||a===pA?new cA:a===qA?new iA:a===rA?new eA:null:null},tA=function(a){if(!a)return null;a=new _.Mk(a);return a.path.match(/.*\.vtt$/i)?qA:a.path.match(/.*\.bif$/i)?rA:a.path.match(/.*\.(png|jpg|jpeg)$/i)?oA:null},uA=function(){};Yz.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Kf,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&$z(c,b.preload)})};bA.prototype.raw=function(){return this.ua.cloneNode(!1)};
7
- bA.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(_.Qd);e.style.width=c+_.Hf;e.style.height=d+_.Hf;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.ua.naturalWidth||this.ua.width))+"px "+Math.ceil(d/
8
- this.height*(this.ua.naturalHeight||this.ua.height))+_.Hf;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Hf;e.style.backgroundPositionY="-"+f*d+_.Hf;return e};
9
- bA.prototype.load=function(){var a=this;this.og||(this.og=new Promise(function(b,c){function d(){a.width||(a.width=(a.ua.naturalWidth||a.ua.width)/a.nl);a.height||(a.height=(a.ua.naturalHeight||a.ua.height)/a.ko);a.x||(a.x=a.width*a.hm);a.y||(a.y=a.height*a.im)}if(a.ua.src&&a.ua.complete)d(),b(a);else{var e=null,f=function(){d();a.ua.removeEventListener(_.Be,f);a.ua.removeEventListener(_.ie,e);b(a)};e=function(g){a.ua.removeEventListener(_.Be,f);a.ua.removeEventListener(_.ie,e);c(new _.N(1,9,2014,
10
- "Failed to load thumbnail.",g))};a.ua.addEventListener(_.Be,f);a.ua.addEventListener(_.ie,e);a.ua.src=a.src}}));return this.og};_.I("clpp.thumbnails.Thumbnail",bA);bA.prototype.load=bA.prototype.load;bA.prototype.element=bA.prototype.element;bA.prototype.raw=bA.prototype.raw;_.w(cA,Yz);
11
- cA.prototype.init=function(a,b){if(!b||!b.url)throw new _.N(1,9,7100,Vz);if("GRID"===b.mode&&!b.gridSize)throw new _.N(1,9,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.N(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 _.N(1,9,7100,Wz);}catch(d){throw this.log.error("Error during parsing gridSize",d),
12
- new _.N(1,9,7100,Wz);}Yz.prototype.init.call(this,a,b)};cA.prototype.get=function(a){var b=this,c,d,e,f;return _.H(function(g){if(1==g.a){c=b.player.getDuration();if(0>a||a>c)throw new _.N(1,9,2014,Uz+a);d=b.f.duration;e=Math.floor(a/d);f=b.a[e];if(!f)throw new _.N(1,9,2014,"No thumbnail found for position "+a+" at index "+e);return _.x(g,f.load(),2)}return g["return"](f)})};
13
- cA.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 bA(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()};dA.prototype.load=function(){return this.zd};
14
- eA.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.N(1,9,7100,Vz);var d=b.url,e=_.ck(d);e.type=_.bk;a.getNetworkEngine().fetch(e).S.then(function(f){f=f.data;var g=_.Oj(c.f);f=_.Oj(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=_.Oj(l);n=String.fromCharCode.apply(null,
15
- vA);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 dA(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
- fA(c)})["catch"](function(f){c.g.error("[BIF] Error while loading thumbnails '\n + 'URL: "+d,f);a.onError(new _.N(1,9,2013,"Error while loading and parsing BIF thumbnails.",f))})};eA.prototype.get=function(a){var b=this,c,d;return _.H(function(e){switch(e.a){case 1:if(0>a)throw new _.N(1,9,2014,Uz+a);return _.x(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 _.N(1,9,2014,Tz+a);return _.x(e,hA(b,c),3);case 3:return d=e.f,_.x(e,d.load(),4);case 4:return e["return"](d)}})};
17
- eA.prototype.Jc=function(){return 0<this.a.length};var vA=[137,66,73,70,13,10,26,10];_.w(iA,Yz);
18
- iA.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.N(1,9,7100,Vz);var d=b.url,e=_.ck(d);e.type=_.bk;this.f=a.getNetworkEngine().fetch(e).S.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.Q.ea(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=jA(l[0]);l=jA(l[1])-t;c.a.push(new bA(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 _.N(1,9,2013,"Error while loading VTT thumbnails.",f))});Yz.prototype.init.call(this,a,b)};
20
- iA.prototype.get=function(a){var b=this,c;return _.H(function(d){if(1==d.a){if(0>a)throw new _.N(1,9,2014,Uz+a);return _.x(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 _.N(1,9,2014,Tz+a);return _.x(d,c.load(),3)}return d["return"](c)})};iA.prototype.l=function(){return this.f};_.w(kA,Yz);
21
- kA.prototype.get=function(a){function b(){return new _.N(1,9,2014,Tz+a)}var c=this,d,e,f,g,h,l,m,n,p,q,t,v,z;return _.H(function(A){if(1==A.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.N(1,9,2014,Uz+a);d=c.player.getPeriods();for(var D=null,G=_.u(d),B=G.next();!B.done;B=G.next())B=B.value,B.startTime<=a&&(D=B);e=D;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.D(2);l=lA(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.mi+m])):(q=h.cb())&&0<q.length&&(v=t=0,z=h.startTime,1<l.mi&&(t=m%l.ne,v=Math.floor(m/l.ne),z+=m*l.durationPerTile),n=new bA(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.ne,l.$g,
23
- t,v));return n?_.x(A,n.load(),4):A.D(2)}if(2!=A.a)return A["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};kA.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
- kA.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.u(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&&!_.L.R(d=b.getSegmentReference(c++));)for(var e=lA(d,b),f=d.cb()[0],g=new Image,h=d.startTime,l=0;l<e.$g;++l)for(var m=0;m<e.ne;++m)this.a.push(new bA(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.ne,e.$g,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.r=mA.prototype;_.r.onPlayerCreated=function(a){this.m=a};_.r.onPlayerWillDestroy=function(){this.m=null};_.r.onPlayerWillRelease=function(){this.a=null};
25
- _.r.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=tA(c.url||null));(this.a=sA(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.De,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
- _.r.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(nA(d)){this.a=new kA;try{this.a.init(a,c)}catch(e){this.m.onError(e)}}}};_.r.get=function(a){return this.a?this.a.get(a):Promise.reject(new _.N(1,9,2014,"Thumbnail format is not supported"))};_.r.id=function(){return"thumbnails"};_.I("clpp.thumbnails.ThumbnailsPlugin",mA);mA.prototype.get=mA.prototype.get;mA.Id="thumbnails";
27
- uA.prototype.create=function(){return new mA};_.Yt(new uA);var oA="SINGLE",pA="GRID",qA="WEBVTT",rA="BIF";};
2
+ var f=function(window){var Lz="No thumbnail found for position: ",Mz="Position is out of range: ",Nz="Thumbnail URL is mandatory",Oz="Wrong gridSize format",Pz="clpp.thumbnails",Qz=function(){this.log=new _.K(Pz);this.player=null;this.a=[];this.w=!1},Sz=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Re&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return Rz(a,0,e,!!f)})},Promise.resolve())},Rz=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return Tz(a,d).then(function(){return a.a[b].load()}).then(function(){return Rz(a,
3
+ e,c,d)})},Tz=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.Qq)c();else a.player.one(_.Zc,function(){c()})})},Uz=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.a=p;this.h=h;this.o=l;this.j=m;this.l=n;this.f=null},Vz=function(){Qz.call(this);
4
+ this.f=null;this.o=this.h=1;this.j=0},Wz=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.td=new _.gk},Xz=function(){this.g=new _.K(Pz);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.gk},Yz=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.td.resolve()})},$z=function(a,b){return Zz(a,b).then(function(c){return new Uz(c,b.time,b.duration)})},Zz=function(a,b){return b.load().then(function(){var c=_.gj(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
+ _.pl(c)})},aA=function(){Qz.call(this);this.f=null},bA=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},cA=function(){Qz.apply(this,arguments)},dA=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{he:c,Ug:d,gi:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},eA=function(){this.g=new _.K(Pz);this.a=this.m=null},fA=function(a){return a.some(function(b){return 0<
6
+ b.thumbStreams.length})},kA=function(a){return a?a===gA||a===hA?new Vz:a===iA?new aA:a===jA?new Xz:null:null},lA=function(a){if(!a)return null;a=new _.rj(a);return a.path.match(/.*\.vtt$/i)?iA:a.path.match(/.*\.bif$/i)?jA:a.path.match(/.*\.(png|jpg|jpeg)$/i)?gA:null},mA=function(){};Qz.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Kf,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&Sz(c,b.preload)})};Uz.prototype.raw=function(){return this.a.cloneNode(!1)};
7
+ Uz.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(_.Od);e.style.width=c+_.Ef;e.style.height=d+_.Ef;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.a.naturalWidth||this.a.width))+"px "+Math.ceil(d/
8
+ this.height*(this.a.naturalHeight||this.a.height))+_.Ef;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Ef;e.style.backgroundPositionY="-"+f*d+_.Ef;return e};
9
+ Uz.prototype.load=function(){var a=this;this.f||(this.f=new Promise(function(b,c){function d(){a.width||(a.width=(a.a.naturalWidth||a.a.width)/a.h);a.height||(a.height=(a.a.naturalHeight||a.a.height)/a.o);a.x||(a.x=a.width*a.j);a.y||(a.y=a.height*a.l)}if(a.a.src&&a.a.complete)d(),b(a);else{var e=null,f=function(){d();a.a.removeEventListener(_.Be,f);a.a.removeEventListener(_.he,e);b(a)};e=function(g){a.a.removeEventListener(_.Be,f);a.a.removeEventListener(_.he,e);c(new _.O(1,9,2014,"Failed to load thumbnail.",
10
+ g))};a.a.addEventListener(_.Be,f);a.a.addEventListener(_.he,e);a.a.src=a.src}}));return this.f};_.J("clpp.thumbnails.Thumbnail",Uz);Uz.prototype.load=Uz.prototype.load;Uz.prototype.element=Uz.prototype.element;Uz.prototype.raw=Uz.prototype.raw;_.w(Vz,Qz);
11
+ Vz.prototype.init=function(a,b){if(!b||!b.url)throw new _.O(1,9,7100,Nz);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,Oz);}catch(d){throw this.log.error("Error during parsing gridSize",d),
12
+ new _.O(1,9,7100,Oz);}Qz.prototype.init.call(this,a,b)};Vz.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,Mz+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 _.x(g,f.load(),2)}return g["return"](f)})};
13
+ Vz.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 Uz(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()};Wz.prototype.load=function(){return this.td};
14
+ Xz.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.O(1,9,7100,Nz);var d=b.url,e=_.Yj(d);e.type=_.Xj;a.getNetworkEngine().fetch(e).T.then(function(f){f=f.data;var g=_.gj(c.f);f=_.gj(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=_.gj(l);n=String.fromCharCode.apply(null,
15
+ nA);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 Wz(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
+ Yz(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))})};Xz.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,Mz+a);return _.x(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,Lz+a);return _.x(e,$z(b,c),3);case 3:return d=e.f,_.x(e,d.load(),4);case 4:return e["return"](d)}})};
17
+ Xz.prototype.Ec=function(){return 0<this.a.length};var nA=[137,66,73,70,13,10,26,10];_.w(aA,Qz);
18
+ aA.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.O(1,9,7100,Nz);var d=b.url,e=_.Yj(d);e.type=_.Xj;this.f=a.getNetworkEngine().fetch(e).T.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.R.ea(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=bA(l[0]);l=bA(l[1])-t;c.a.push(new Uz(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))});Qz.prototype.init.call(this,a,b)};
20
+ aA.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,Mz+a);return _.x(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,Lz+a);return _.x(d,c.load(),3)}return d["return"](c)})};aA.prototype.l=function(){return this.f};_.w(cA,Qz);
21
+ cA.prototype.get=function(a){function b(){return new _.O(1,9,2014,Lz+a)}var c=this,d,e,f,g,h,l,m,n,p,q,t,u,y;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,Mz+a);d=c.player.getPeriods();for(var B=null,C=_.v(d),E=C.next();!E.done;E=C.next())E=E.value,E.startTime<=a&&(B=E);e=B;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.C(2);l=dA(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.gi+m])):(q=h.Ka())&&0<q.length&&(u=t=0,y=h.startTime,1<l.gi&&(t=m%l.he,u=Math.floor(m/l.he),y+=m*l.durationPerTile),n=new Uz(q[0],y,l.durationPerTile,void 0,void 0,void 0,void 0,l.he,l.Ug,
23
+ t,u));return n?_.x(A,n.load(),4):A.C(2)}if(2!=A.a)return A["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};cA.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
+ cA.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.v(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=dA(d,b),f=d.Ka()[0],g=new Image,h=d.startTime,l=0;l<e.Ug;++l)for(var m=0;m<e.he;++m)this.a.push(new Uz(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.he,e.Ug,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.r=eA.prototype;_.r.onPlayerCreated=function(a){this.m=a};_.r.onPlayerWillDestroy=function(){this.m=null};_.r.onPlayerWillRelease=function(){this.a=null};
25
+ _.r.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=lA(c.url||null));(this.a=kA(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.De,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
+ _.r.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(fA(d)){this.a=new cA;try{this.a.init(a,c)}catch(e){this.m.onError(e)}}}};_.r.get=function(a){return this.a?this.a.get(a):Promise.reject(new _.O(1,9,2014,"Thumbnail format is not supported"))};_.r.id=function(){return"thumbnails"};_.J("clpp.thumbnails.ThumbnailsPlugin",eA);eA.prototype.get=eA.prototype.get;eA.Id="thumbnails";
27
+ mA.prototype.create=function(){return new eA};_.ru(new mA);var gA="SINGLE",hA="GRID",iA="WEBVTT",jA="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));}