@castlabs/prestoplay 6.27.0 → 6.28.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 (67) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +113 -112
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +625 -624
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +89 -89
  10. package/cjs/cl.externs.js +80 -72
  11. package/cjs/cl.freewheel.js +25 -25
  12. package/cjs/cl.hls.js +78 -79
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +23 -24
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +347 -347
  18. package/cjs/cl.muxdata.js +14 -15
  19. package/cjs/cl.onboard.js +4 -3
  20. package/cjs/cl.persistent.js +14 -14
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.simid.js +16 -17
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +72 -72
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +12 -12
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +38 -38
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +6 -5
  36. package/cl.cast.js +91 -90
  37. package/cl.conviva.js +27 -27
  38. package/cl.core.js +503 -499
  39. package/cl.crypto.js +8 -8
  40. package/cl.dash.js +83 -82
  41. package/cl.externs.js +80 -72
  42. package/cl.freewheel.js +19 -19
  43. package/cl.hls.js +80 -80
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +17 -17
  47. package/cl.mediatailor.js +2 -3
  48. package/cl.mse.js +304 -305
  49. package/cl.muxdata.js +13 -13
  50. package/cl.onboard.js +4 -4
  51. package/cl.persistent.js +10 -10
  52. package/cl.playlist.js +5 -5
  53. package/cl.simid.js +14 -14
  54. package/cl.smooth.js +60 -60
  55. package/cl.thumbnails.js +19 -19
  56. package/cl.tizen.js +57 -57
  57. package/cl.ttml.js +22 -22
  58. package/cl.verimatrix.js +4 -4
  59. package/cl.vimond.js +8 -8
  60. package/cl.vr.js +15 -15
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -3
  63. package/cl.youbora.js +31 -29
  64. package/package.json +1 -1
  65. package/typings.d.ts +34 -65
  66. package/cjs/cl.sessions.js +0 -21
  67. package/cl.sessions.js +0 -10
package/cjs/cl.smooth.js CHANGED
@@ -1,76 +1,76 @@
1
1
  (function(){var g={}; var _ = _ || {}
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);};
2
+ var f=function(window){var MQ="Full MP4 box must have flags defined",NQ="clpp.smooth.SmoothMP4Processor",OQ="codecPrivateData",PQ=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)},QQ=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.Up()}},RQ=function(a,b){QQ(a,b>>16&255);QQ(a,b>>8&255);QQ(a,b&255)},SQ=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.Up()}},TQ=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.Up()}},UQ=function(a,b){try{a.f.setInt16(a.a,
3
+ b,a.h),a.a+=2}catch(c){_.Up()}},VQ=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},WQ=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){WQ.call(this,a);this.version=b;this.flags=c},XQ=function(a,b,c){WQ.call(this,a);this.f=b;this.offset=c},YQ=function(a,
4
+ b,c,d,e){Z.call(this,a,b,c);this.f=d;this.offset=e},ZQ=function(a,b,c){WQ.call(this,"ftyp");this.h=a;this.Hi=b;this.f=c},$Q=function(){WQ.call(this,_.Oe)},aR=function(){WQ.call(this,_.xg)},bR=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]},cR=function(){WQ.call(this,"mvex")},dR=function(a){Z.call(this,"trex",0,0);this.f=a},eR=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]},fR=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},gR=function(a){Z.call(this,"hdlr",0,0);this.f=a},hR=function(){Z.call(this,"vmhd",0,1);this.f=new Uint8Array([0,0,0,0,0,0])},iR=function(a){WQ.call(this,a);this.w=!0},jR=function(a){iR.call(this,a);this.height=this.width=0;this.depth=24},
6
+ kR=function(a,b,c,d){iR.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},lR=function(a,b){jR.call(this,"avc1");this.width=a;this.height=b},mR=function(a,b){lR.call(this,a,b);this.type="encv"},nR=function(a,b,c){kR.call(this,"mp4a",a,b,c)},oR=function(a,b,c){nR.call(this,a,b,c);this.type="enca"},pR=function(a,b){WQ.call(this,"avcC");this.cb=a;this.tc=b;this.version=1;this.f=this.cb[0][1];this.h=this.cb[0][2];this.level=this.cb[0][3]},qR=function(a){Z.call(this,"esds",0,0);this.mc=
7
+ a},rR=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},sR=function(){Z.call(this,"dref",0,0)},tR=function(){WQ.call(this,_.fg)},uR=function(){Z.call(this,_.hg,0,0)},vR=function(){Z.call(this,"stts",0,0)},wR=function(){Z.call(this,"stsc",0,0)},xR=function(){Z.call(this,"stco",0,0)},yR=function(){Z.call(this,"stsz",0,0)},zR=function(){Z.call(this,"smhd",0,0)},AR=function(){WQ.call(this,"dinf")},BR=function(){WQ.call(this,_.Ne)},CR=function(){WQ.call(this,_.Je)},DR=function(a,b){Z.call(this,
8
+ "tfdt",a,0);this.baseMediaDecodeTime=b},ER=function(){Z.call(this,"mfhd",0,0);this.f=0},FR=function(a,b){Z.call(this,"trun",a,b);this.l=this.j=this.f=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]},GR=function(a,b){Z.call(this,"tfhd",a,b);this.f=255;this.l=this.o=this.j=this.A=this.h=0},HR=function(){WQ.call(this,"traf")},IR=function(){WQ.call(this,"moof")},JR=function(){WQ.call(this,_.Ie);this.f=new Uint8Array(0)},KR=function(){Z.call(this,"tenc",0,0);this.f=1;this.h=8;this.l="";this.j=[]},LR=
9
+ function(a,b){Z.call(this,"schm",0,0);this.f=a;this.h=b;this.fc=""},MR=function(a){WQ.call(this,"frma");this.f=a},NR=function(){Z.call(this,"saio",0,0);this.offset=[0]},OR=function(a,b,c){Z.call(this,"saiz",0,0);this.f=a;this.j=b;this.h=c},PR=function(a,b){Z.call(this,"senc",a,b);this.h=0;this.j=8;this.f=[]},QR=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},RR=function(a,b,c,d){c=b.$h[c];b=b.Po;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 _.tC([a],[b])[0]},SR=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.Mg?c=["maxWidth","maxHeight","bitrate",OQ,"fourCC"]:a.type===_.Nc&&(c=["bitrate",OQ,"channels","bitsPerSample","samplingRate","fourCC"]);return _.M.ra(a,b,c,["id","segmentIndex"])},TR=function(a,b,c){var d=c.Ye.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,cb:null,
11
+ tc:null,width:NaN,height:NaN,mc:null,xe:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.Mg:a.cb=[_.Dm(d[1])];a.tc=[_.Dm(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.Nc:a.mc=_.Dm(c.Ye),a.sampleSize=c.Xj||16,a.xe=c.xe,a.channelCount=c.xh}return a},UR=function(a,b){return a.filter(function(c){return c.type===b})},VR=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)},cS=function(a,
12
+ b,c){var d=null;if(WR.test(a)){a=WR.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 YR.test(a)?d=VR(YR,a):ZR.test(a)?d=VR(ZR,a):$R.test(a)?(a=$R.exec(a),d=Number(a[1])/c.frameRate):aS.test(a)?(a=aS.exec(a),d=Number(a[1])/c.a):bS.test(a)&&(d=VR(bS,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},dS=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))},fS=function(a){this.a=a;this.f=eS(this)},eS=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.Tp(b)},gS=function(a,b,c){a:{var d=_.v([_.Fd,_.Dd]);for(var e=d.next();!e.done;e=d.next())if((e=c.df(e.value))&&e.keyId){d=e.keyId;break a}_.Lh(NQ,
14
+ "Could not get default Key ID for DRM init data!");d=null}c=new WQ("xxxx");a.type===_.Mg?c=new mR(a.width,a.height):c=new oR(a.channelCount,a.sampleSize,a.xe);a=new KR;a.f=1;a.h=8;a.l=d||"00000000000000000000000000000000";a=(new WQ("schi")).append([a]);b=(new WQ(_.$f)).append([new MR(b),new LR(_.fd,65536),a]);c.append([b]);return c},hS=function(a,b){var c=b.gf(),d=new bR(a.timescale,a.duration,a.id),e=(new cR).append([new dR(a.id)]),f=new eR(a.id,a.duration,a.timescale,a.width,a.height),g=new fR(a.timescale,
15
+ a.duration),h=new gR(a.type),l=null,m=new sR;m.entries=[new rR];var n=new uR;switch(a.type){case _.Mg:var p=new pR(a.cb,a.tc);c?(l=gS(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new lR(a.width,a.height)).append([p]),n.entries=[l]);l=new hR;break;case _.Nc:p=new qR(a.mc),c?(l=gS(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new nR(a.channelCount,a.sampleSize,a.xe)).append([p]),n.entries=[l]),l=new zR}n=(new tR).append([n,new vR,new wR,new yR,new xR]);m=(new AR).append([m]);m=(new BR).append([l,m,n]);
16
+ g=(new CR).append([g,h,m]);f=(new aR).append([f,g]);d=(new $Q).append([d,f,e]);e=new ZQ("dash",0,["iso6","mp41","avc1"]);c&&(c=b.df(_.Dd),f=b.df(_.Fd),c&&d.append([new XQ("pssh",c.initData,8)]),f&&d.append([new XQ("pssh",f.initData,8)]),c||f||_.Lh(NQ,"Could not get PSSH init data!"));c=new fS([e,d]);return _.Mi(c.write())},jS=function(a,b){var c,d,e,f,g,h;(new _.fq).M("moof",_.gq).ba("mfhd",function(m){var n=new ER;n.f=_.aq(m.reader);c=n}).M("traf",_.gq).ba("tfhd",function(m){var n=m.reader.Ua();
17
+ if(null===m.flags)throw new _.N(_.O,3,3019,MQ);var p=new GR(m.version||0,m.flags||0);p.f=_.aq(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.h=_.cq(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.A=_.aq(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.j=_.aq(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.o=_.aq(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.l=_.aq(m.reader));d=p}).ba("trun",function(m){var n=m.reader.Ua();if(null===m.flags)throw new _.N(_.O,3,3019,MQ);
18
+ var p=new FR(m.version||0,m.flags||0);p.f=_.aq(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.bq(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.l=_.aq(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.f;n++)m.flags&256&&p.o.push(_.aq(m.reader)),m.flags&512&&p.sampleSize.push(_.aq(m.reader)),m.flags&1024&&p.A.push(_.aq(m.reader)),m.flags&2048&&(0===m.version?p.h.push(_.aq(m.reader)):p.h.push(_.bq(m.reader)));e=p}).ba("sdtp",function(m){var n=_.eq(m.reader,m.reader.Ua());f=new YQ("sdtp",
19
+ m.version||0,m.flags||0,n,0)}).M("uuid",function(m){var n=_.eq(m.reader,16);if(_.Fm(n,iS)){n=_.aq(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new PR(m.version,m.flags);n.h=_.aq(m.reader);m.flags&1&&(n.j=_.Zp(m.reader));for(var p=0;p<n.h;p++){var q={si:_.eq(m.reader,8),xd:0,Rg:[]};if(m.flags&2){q.xd=_.$p(m.reader);for(var t=0;t<q.xd;t++){var u={th:0,uh:0};u.th=_.$p(m.reader);u.uh=_.aq(m.reader);q.Rg.push(u)}}n.f.push(q)}g=n}}).M(_.Ie,function(m){var n=new JR;0<m.reader.Ua()?n.f=_.eq(m.reader,m.reader.Ua()):
20
+ (_.Lh(NQ,"mdat box is empty!"),n.f=new Uint8Array(0));h=n}).parse(a,!1);if(!h)return null;var l=(new HR).append([d,e]);f&&l.append([f]);b.gf()&&g&&l.append([g]);l=(new IR).append([c,l]);return new fS([l,h])},kS=function(a,b,c,d){var e=d.gf(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=jS(b,d);if(null===g)return a.request.contentType===_.tn?a.data:g;d=g.get(_.Ie);if(a.request.contentType===_.tn){e=d.f.buffer;if(c){e=_.R.$d(e);if((e=(new DOMParser).parseFromString(e,_.og))&&"tt"===e.documentElement.tagName.toLowerCase())var h=
21
+ e.documentElement;if(h&&(d=new dS(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",_.he],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 B=q[u].name;if(B=B.match(t)){p=
22
+ p.getAttribute(B[0]);break b}}p=null}}f.setAttribute(l[m],cS(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.R.eb(e).buffer}else c=e;return c}h=new IR;a=g.get("mfhd");b=new HR;l=g.get("tfhd");m=new DR(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].xd);else g=8;b.append([c,new NR,new OR(g,l,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=
23
+ new fS([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},lS=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},mS=function(a,b,c){a=_.Hr(a);c&&a.version!==c&&(a=_.jC(a,c));return{initData:_.hC(a),initDataType:_.fd,keyId:b,periodId:null}},oS=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 _.L("clpp.smooth.SmoothParser");this.K=!1;this.l=this.B=null;this.O=nS;this.I=0;this.G=this.J=Infinity;this.w=[];this.L=this.jo.bind(this);this.H=new Map},pS=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.Mk(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)})},wS=function(a,b){var c=_.Cr,d=null;try{var e=_.R.$d(b);d=c.we(e,_.Jb)}catch(MX){}if(!d)throw a.g.error("Unable to parse manifest"),new _.N(_.O,4,4033,a.o);var f=+qS(a,d,"MajorVersion"),g=+qS(a,d,"MinorVersion"),h=+d.getAttribute("TimeScale")||1E7,l=+qS(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 _.N(_.O,4,4036,a.o);m?(rS(a,sS),a.B=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),l=Infinity):rS(a,nS);a.a={startTime:0,delay:0,duration:l/h,gg:p/h,re:0};if(q){var t=a.f.playreadyVersion,u=_.Cr,y=[],B=u.aa(q,"ProtectionHeader")[0],A=_.Cm(u.sa(B)||""),C=_.Hr(A).a;y.push(lS(_.Fd,{initData:_.hC(_.zr(C)),initDataType:_.fd,
27
+ keyId:C,periodId:null},[C]));y.push(lS(_.Dd,mS(A,C,t),[C]));a.w=y}var E=[],D=_.Cr.aa(d,"StreamIndex");if(!D.length)throw a.g.error("No streams found!"),new _.N(_.O,4,4034,a.o);for(var J=0;J<D.length;J++){for(var P,U=a,V=D[J],ra=qS(U,V,"Type"),Da=+V.getAttribute("Chunks"),wa=V.getAttribute("Subtype")||"",Ea=V.getAttribute("Language")||_.Bg,Ma=_.jo(Ea),vb=V.getAttribute("Name")||"",ee=+V.getAttribute(_.db),tf=+V.getAttribute(_.cb),wg=qS(U,V,"Url"),ru=+V.getAttribute("TimeScale")||null,hd=[],un=_.Cr.aa(V,
28
+ _.yb),ev=0;ev<un.length;ev++){var vf=void 0,oc=void 0,fv=void 0,wf=U,Hd=un[ev],gv=ra,nW=+Hd.getAttribute("Index"),oW=+qS(wf,Hd,"Bitrate"),RI=NaN,SI=NaN,so=NaN,hv=NaN,TI=NaN,UI=NaN,VI=NaN,WI=Hd.getAttribute("FourCC")||"";switch(gv){case _.Mg:RI=+qS(wf,Hd,_.cb);SI=+qS(wf,Hd,_.db);break;case _.Nc:hv=+Hd.getAttribute("Channels")||2,so=+qS(wf,Hd,"SamplingRate"),UI=+qS(wf,Hd,"AudioTag"),TI=+qS(wf,Hd,"BitsPerSample"),VI=+qS(wf,Hd,"PacketSize")}var iv=String(Hd.getAttribute("CodecPrivateData"));if(gv===_.Nc&&
29
+ !iv){var XI=hv,YI={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},to=YI[so];if("AACH"===WI){oc=new Uint8Array(4);var ZI=YI[2*so];oc[0]=40|to>>1;oc[1]=to<<7|XI<<3|ZI>>1;oc[2]=ZI<<7|8;oc[3]=0;vf=new Uint16Array(2);vf[0]=(oc[0]<<8)+oc[1];vf[1]=(oc[2]<<8)+oc[3];fv=vf[0].toString(16)+vf[1].toString(16)}else oc=new Uint8Array(2),oc[0]=16|to>>1,oc[1]=to<<7|XI<<3,vf=new Uint16Array(1),vf[0]=(oc[0]<<8)+oc[1],fv=vf[0].toString(16);iv=fv.toUpperCase()}var pW=
30
+ {id:wf.P++,type:gv,index:nW,bitrate:oW,Ye:iv,maxHeight:RI,maxWidth:SI,xe:so,xh:hv,gp:UI,Xj:TI,xp:VI,Nl:WI,segmentIndex:null};hd.push(pW)}P=hd;for(var Fe=[],$I=_.Cr.aa(V,"c"),jk=0;jk<$I.length;jk++){var jv=$I[jk],fe=parseInt(jv.getAttribute("t"),10),$h=parseInt(jv.getAttribute("d"),10),kv=parseInt(jv.getAttribute("r"),10),kk=0;if(isNaN(fe)&&isNaN($h))throw U.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.N(_.O,4,4037,U.o);0===jk&&
31
+ isNaN(fe)&&(kk=fe=0);if(0<jk){var zg=Fe[Fe.length-1];kk=zg.n+1;zg.d||(zg.d=fe-zg.t);fe||(fe=zg.t+zg.d);$h||($h=fe-zg.t)}Fe.push({n:kk,d:$h,t:fe});if(kv){kv--;for(var aJ=0;aJ<kv;aJ++){var uo=Fe[Fe.length-1];kk=uo.n+1;fe=uo.t+uo.d;$h=uo.d;Fe.push({n:kk,d:$h,t:fe})}}}U.Qd()||Fe.length===Da||U.g.warn("Number of fragments ("+Da+") differs from number of chunks ("+Fe.length+").");E.push({type:ra,lp:Da,Ao:wa,language:Ma,td:Ea,name:vb,maxWidth:ee,maxHeight:tf,Po:wg,tracks:P,$h:Fe,timescale:ru})}var xf={vp:f,
32
+ Hi:g,timescale:h,duration:l,isLive:m,up:n,gg:p,ng:!1,streams:E};if(a.j&&a.A)return tS(a,xf),Promise.resolve();a.H.clear();var lv=xf.timescale,vo=xf.duration,rW=UR(xf.streams,_.Nc),sW=UR(xf.streams,_.Mg),tW=UR(xf.streams,_.tn),bJ=[],wo=uS(a,vo,lv,rW),xo=uS(a,vo,lv,sW),uW=uS(a,vo,lv,tW);wo.length||(wo=[null]);xo.length||(xo=[null]);for(var nv=0;nv<xo.length;nv++)for(var ov=0;ov<wo.length;ov++)bJ.push(vS(a,xo[nv],wo[ov]));var cJ={id:"ID",configurationId:void 0,startTime:0,endTime:vo,variants:bJ,textStreams:uW,
33
+ thumbStreams:[]};var wW=xf.streams,pv=a.a.startTime,dJ=a.a.delay,qv=a.J,eJ=Math.min(a.a.duration||Infinity,qv),rv=a.Qd(),xW=a.a.gg,yW=a.a.re,fJ=a.I,gJ=isFinite(a.G)?a.G:0;if(rv)eJ=Infinity,pv=Date.now()/1E3-yW,a.a.startTime=pv,dJ=3*fJ;else for(var zW=isFinite(qv)?qv:a.a.duration,hJ=_.v(wW),sv=hJ.next();!sv.done;sv=hJ.next())for(var iJ=_.v(sv.value.tracks),uv=iJ.next();!uv.done;uv=iJ.next()){var jJ=uv.value;jJ.segmentIndex.offset(-gJ);_.YC(jJ.segmentIndex,zW)}var kJ=a.f.timeline||{};kJ.type=void 0;
34
+ a.F=new _.kD(kJ,pv,dJ,!rv,!0);a.F.f=eJ;_.sD(a.F,fJ);a.F.A=xW;rv||a.F.offset(-gJ);a.D.filterAllPeriods([cJ]);a.j={presentationTimeline:a.F,periods:[cJ],minBufferTime:0,cues:[]};Promise.resolve();a.K||(a.D.networkingEngine.Gd(a.L),a.K=!0);a.A=xf;return Promise.resolve()},tS=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={kc:e.kc},g=f.next())if(e.kc=g.value,g=d.tracks.find(function(l){return function(m){return m.type===
35
+ l.kc.type&&m.bitrate===l.kc.bitrate}}(e))){SR(e.kc,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=xS(a,a.A.timescale,d,g);g=e.kc.segmentIndex;g.ua(h);(h=a.a.gg)&&_.JD(g,_.ID(g)-h).forEach(function(l){l.Ka().forEach(function(m){a.H["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.kc.type+" track with bitrate "+(e.kc.bitrate+". Skipping update."))},uS=function(a,b,c,d){for(var e=[],f={Yc:0};f.Yc<d.length;f={Yc:f.Yc},
36
+ f.Yc++){var g=d[f.Yc].tracks.map(function(h){return function(l){var m=d[h.Yc],n=xS(a,c,m,l);n=new _.HD(n);var p=null;m.type!==_.tn&&(p=yS(a,b,c,m,l));l.segmentIndex=n;var q=_.$J++,t=Promise.resolve.bind(Promise),u=n.hd.bind(n),y=n.get.bind(n),B=n.Hd.bind(n),A=n.getDuration.bind(n),C=zS[m.type],E="";switch(m.type){case _.Mg:E=l.Ye;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 _.Nc:E=l.Ye,D=2,"AACH"===l.Nl?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===_.tn?AS[m.Ao]:void 0;return{id:q,originalId:null,Ap:null,createSegmentIndex:t,findSegmentPosition:u,getSegmentReference:y,adjustSegmentDurations:B,getDuration:A,segmentIndex:n,segmentLookupStrategy:_.QB,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.qg(),keyId:null,language:m.language,originalLanguage:m.td,
38
+ label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.xh||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},xS=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.$h.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=RR(a.o,c,l,d);a.I=Math.max(a.I,m);f.push(new _.Jp(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.H.set(q,n);e+=m});if(c.type===_.Mg||c.type===_.Nc)b=f[f.length-
39
+ 1],a.J=Math.min(a.J,e),0===a.a.re?a.a.re=b.endTime:a.a.re=Math.min(a.a.re,b.endTime);return f},yS=function(a,b,c,d,e){b=TR(b,d.timescale||c,e);c={isLive:a.Qd.bind(a),gf:a.qg.bind(a),Wl:function(){return 1},df:a.ei.bind(a)};d=new Uint8Array(0);try{d=hS(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,"+_.Bm(d);return new _.HC(function(){return[f]},0,null,null,!0)},vS=function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:
40
+ 0),e=c?c.language:_.Bg;return c||b?{id:a.h++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,allowedByApplication:!0,allowedByKeySystem:!0}:null},qS=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);},BS=function(a,b){null!=a.B&&null!=b&&(a.l=window.setTimeout(a.dc.bind(a),b))},rS=function(a,b){var c=b===nS;a.j&&a.j.presentationTimeline&&_.nD(a.j.presentationTimeline,c);c&&null!=a.l&&(window.clearTimeout(a.l),
41
+ a.l=null,a.B=null);a.O=b},CS=function(){};WQ.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};WQ.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
+ WQ.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
+ WQ.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);_.Vp(a,VQ(this.type));this.size>b&&PQ(a,this.size);"uuid"===this.type&&_.Vp(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,WQ);Z.prototype.a=function(){return 4+WQ.prototype.a.call(this)};
44
+ Z.prototype.write=function(a){WQ.prototype.write.call(this,a);QQ(a,this.version);RQ(a,this.flags)};_.w(XQ,WQ);XQ.prototype.a=function(){return this.f.byteLength+WQ.prototype.a.call(this)-this.offset};XQ.prototype.write=function(a){WQ.prototype.write.call(this,a);_.Vp(a,this.f,this.offset);a.getPosition()};_.w(YQ,Z);YQ.prototype.a=function(){return this.f.byteLength+Z.prototype.a.call(this)-this.offset};YQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.Vp(a,this.f,this.offset);a.getPosition()};
45
+ _.w(ZQ,WQ);ZQ.prototype.a=function(){var a=this.h.length;a=a+4+this.f.join("").length;return a+WQ.prototype.a.call(this)};ZQ.prototype.write=function(a){WQ.prototype.write.call(this,a);_.Vp(a,VQ(this.h));_.W(a,this.Hi);_.Vp(a,VQ(this.f.join("")));a.getPosition()};_.w($Q,WQ);_.w(aR,WQ);_.w(bR,Z);bR.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
+ bR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(PQ(a,0),PQ(a,0),_.W(a,this.timescale),PQ(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));_.W(a,65536);SQ(a,this.volume);SQ(a,0);_.W(a,0);_.W(a,0);for(var b=0;b<this.f.length;b++)QQ(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(cR,WQ);_.w(dR,Z);dR.prototype.a=function(){return 20+Z.prototype.a.call(this)};
47
+ dR.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(eR,Z);eR.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
+ eR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(PQ(a,0),PQ(a,0),_.W(a,this.h),_.W(a,0),PQ(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);SQ(a,0);SQ(a,0);SQ(a,this.volume);SQ(a,0);for(var b=0;b<this.f.length;b++)QQ(a,this.f[b]);SQ(a,this.width);SQ(a,0);SQ(a,this.height);SQ(a,0);a.getPosition()};_.w(fR,Z);fR.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
49
+ fR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(PQ(a,0),PQ(a,0),_.W(a,this.timescale),PQ(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));SQ(a,this.language);SQ(a,0);a.getPosition()};_.w(gR,Z);gR.prototype.a=function(){return 33+Z.prototype.a.call(this)};
50
+ gR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);this.f===_.Mg?_.Vp(a,VQ("vide")):_.Vp(a,VQ("soun"));_.W(a,0);_.W(a,0);_.W(a,0);this.f===_.Mg?_.Vp(a,VQ("VideoHandler\x00")):_.Vp(a,VQ("SoundHandler\x00"));a.getPosition()};_.w(hR,Z);hR.prototype.a=function(){return 2+this.f.byteLength+Z.prototype.a.call(this)};hR.prototype.write=function(a){Z.prototype.write.call(this,a);SQ(a,0);_.Vp(a,this.f);a.getPosition()};_.w(iR,WQ);iR.prototype.a=function(){return 8+WQ.prototype.a.call(this)};
51
+ iR.prototype.write=function(a){WQ.prototype.write.call(this,a);_.W(a,0);SQ(a,0);SQ(a,1)};_.w(jR,iR);jR.prototype.a=function(){return 70+iR.prototype.a.call(this)};jR.prototype.write=function(a){iR.prototype.write.call(this,a);SQ(a,0);SQ(a,0);_.W(a,0);_.W(a,0);_.W(a,0);SQ(a,this.width);SQ(a,this.height);_.W(a,4718592);_.W(a,4718592);_.W(a,0);SQ(a,1);QQ(a,10);_.Vp(a,VQ("AVC Coding",31));SQ(a,this.depth);UQ(a,-1)};_.w(kR,iR);kR.prototype.a=function(){return 20+iR.prototype.a.call(this)};
52
+ kR.prototype.write=function(a){iR.prototype.write.call(this,a);_.W(a,0);_.W(a,0);SQ(a,this.channelCount);SQ(a,this.sampleSize);UQ(a,0);SQ(a,0);SQ(a,this.sampleRate);SQ(a,0)};_.w(lR,jR);lR.prototype.write=function(a){jR.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};_.w(mR,lR);_.w(nR,kR);nR.prototype.write=function(a){kR.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};
53
+ _.w(oR,nR);_.w(pR,WQ);pR.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.tc[b].byteLength;return a+WQ.prototype.a.call(this)};
54
+ pR.prototype.write=function(a){WQ.prototype.write.call(this,a);QQ(a,this.version);QQ(a,this.f);QQ(a,this.h);QQ(a,this.level);QQ(a,255);QQ(a,224|this.cb.length);for(var b=0;b<this.cb.length;b++)SQ(a,this.cb[b].length),_.Vp(a,this.cb[b]);QQ(a,this.tc.length);for(b=0;b<this.tc.length;b++)SQ(a,this.tc[b].length),_.Vp(a,this.tc[b]);a.getPosition()};_.w(qR,Z);qR.prototype.a=function(){return 22+(this.mc.byteLength+3)+Z.prototype.a.call(this)};
55
+ qR.prototype.write=function(a){Z.prototype.write.call(this,a);QQ(a,3);QQ(a,23+this.mc.byteLength);SQ(a,1);QQ(a,0);QQ(a,4);QQ(a,15+this.mc.byteLength);QQ(a,64);QQ(a,21);RQ(a,0);_.W(a,0);_.W(a,0);QQ(a,5);QQ(a,this.mc.byteLength);_.Vp(a,this.mc);_.Vp(a,new Uint8Array([6,1,2]));a.getPosition()};_.w(rR,Z);rR.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};rR.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.Vp(a,VQ(this.location));a.getPosition()};
56
+ _.w(sR,Z);sR.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)};sR.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(tR,WQ);_.w(uR,Z);uR.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
+ uR.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(vR,Z);vR.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)};vR.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(wR,Z);
58
+ wR.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)};wR.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(xR,Z);xR.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
+ xR.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(yR,Z);yR.prototype.a=function(){return 8+Z.prototype.a.call(this)};yR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);_.W(a,0);a.getPosition()};_.w(zR,Z);zR.prototype.a=function(){return 4+Z.prototype.a.call(this)};zR.prototype.write=function(a){Z.prototype.write.call(this,a);UQ(a,0);SQ(a,0);a.getPosition()};
60
+ _.w(AR,WQ);_.w(BR,WQ);_.w(CR,WQ);_.w(DR,Z);DR.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};DR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?PQ(a,this.baseMediaDecodeTime):_.W(a,this.baseMediaDecodeTime);a.getPosition()};_.w(ER,Z);ER.prototype.a=function(){return 4+Z.prototype.a.call(this)};ER.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);a.getPosition()};_.w(FR,Z);
61
+ FR.prototype.a=function(){var a=4;this.flags&DS&&(a+=4);this.flags&ES&&(a+=4);for(var b=0;b<this.f;b++)this.flags&FS&&(a+=4),this.flags&GS&&(a+=4),this.flags&HS&&(a+=4),this.flags&IS&&(a+=4);return a+Z.prototype.a.call(this)};
62
+ FR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);this.flags&DS&&(a.getPosition(),TQ(a,this.j));this.flags&ES&&_.W(a,this.l);for(var b=0;b<this.f;b++)this.flags&FS&&_.W(a,this.o[b]),this.flags&GS&&_.W(a,this.sampleSize[b]),this.flags&HS&&_.W(a,this.A[b]),this.flags&IS&&(0===this.version?_.W(a,this.h[b]):TQ(a,this.h[b]));a.getPosition()};var DS=1,ES=4,FS=256,GS=512,HS=1024,IS=2048;_.w(GR,Z);
63
+ GR.prototype.a=function(){var a=4;this.flags&JS&&(a+=8);this.flags&KS&&(a+=4);this.flags&LS&&(a+=4);this.flags&MS&&(a+=4);this.flags&NS&&(a+=4);return a+Z.prototype.a.call(this)};GR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);this.flags&JS&&PQ(a,this.h);this.flags&KS&&_.W(a,this.A);this.flags&LS&&_.W(a,this.j);this.flags&MS&&_.W(a,this.o);this.flags&NS&&_.W(a,this.l);a.getPosition()};var JS=1,KS=2,LS=8,MS=16,NS=32;_.w(HR,WQ);_.w(IR,WQ);_.w(JR,WQ);
64
+ JR.prototype.a=function(){return this.f.byteLength+WQ.prototype.a.call(this)};JR.prototype.write=function(a){WQ.prototype.write.call(this,a);0<this.f.byteLength&&_.Vp(a,this.f)};_.w(KR,Z);KR.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
+ KR.prototype.write=function(a){Z.prototype.write.call(this,a);QQ(a,0);0===this.version?QQ(a,0):QQ(a,0);QQ(a,this.f);QQ(a,this.h);_.Vp(a,_.Dm(this.l));if(1===this.f&&0===this.h){QQ(a,0);for(var b=0;b<this.j.length;b++)QQ(a,this.j[b])}a.getPosition()};_.w(LR,Z);LR.prototype.a=function(){var a=8;this.flags&1&&(a+=VQ(this.fc).byteLength);return a+Z.prototype.a.call(this)};LR.prototype.write=function(a){Z.prototype.write.call(this,a);_.Vp(a,VQ(this.f));_.W(a,this.h);this.flags&1&&_.Vp(a,VQ(this.fc));a.getPosition()};
66
+ _.w(MR,WQ);MR.prototype.a=function(){return VQ(this.f).byteLength+WQ.prototype.a.call(this)};MR.prototype.write=function(a){WQ.prototype.write.call(this,a);_.Vp(a,VQ(this.f));a.getPosition()};_.w(NR,Z);NR.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
+ NR.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]):PQ(a,this.offset[b]);a.getPosition()};_.w(OR,Z);OR.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
+ OR.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));QQ(a,this.f);_.W(a,this.h);if(0===this.f)for(var b=0;b<this.h;b++)QQ(a,this.j[b]);a.getPosition()};_.w(PR,Z);PR.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.h;b++)if(a+=this.f[b].si.byteLength,this.flags&2){a+=2;for(var c=0;c<this.f[b].xd;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
69
+ PR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.h);this.flags&1&&QQ(a,this.j);for(var b=0;b<this.h;b++)if(_.Vp(a,this.f[b].si),this.flags&2){SQ(a,this.f[b].xd);for(var c=0;c<this.f[b].xd;c++)SQ(a,this.f[b].Rg[c].th),_.W(a,this.f[b].Rg[c].uh)}a.getPosition()};var WR=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,YR=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,ZR=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,$R=/^(\d*\.?\d*)f$/,aS=/^(\d*\.?\d*)t$/,bS=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;fS.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};fS.prototype.write=function(){this.f=eS(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var iS=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.r=oS.prototype;_.r.configure=function(a){this.f=a};_.r.start=function(a,b){var c=this;this.D=b;var d=_.jh(new Set([a,QR(a)])).concat();return pS(this,d).then(function(e){return wS(c,e.data).then(function(){BS(c,c.B);return c.j})})};_.r.requestStop=function(){};_.r.stop=function(){this.D&&this.D.networkingEngine.Df(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.Qd())return pS(this,[this.o]).then(function(b){return wS(a,b.data).then(function(){return a.j})})["catch"](function(b){if(a.D)a.D.onError(b)})};_.r.setCurrentVariant=function(){};_.r.dc=function(){var a=this;this.g.debug(_.HB);this.D&&(this.l=null,this.update().then(function(){BS(a,a.B)})["catch"](function(b){a.D&&(a.D.onError(b),1===b.severity&&BS(a,100))}))};_.r.Qd=function(){return this.O===sS};_.r.qg=function(){return 0<this.w.length};
71
+ _.r.ei=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.jo=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.Qd.bind(this),gf:this.qg.bind(this),Wl:function(){return 1},df:this.ei.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=kS(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 _.pi(_.xB+a);return f["return"](d)})};var zS={video:_.Og,audio:_.Rc,text:_.Kc},nS=_.Ub,sS="LIVE",AS={So:_.bd,Zo:_.jg};_.w(CS,_.Tu);CS.prototype.install=function(){_.Rv.ism=oS;_.Qv[_.Lc]=oS};CS.prototype.uninstall=function(){_.jE("ism");_.kE(_.Lc)};CS.prototype.id=function(){return _.ag};_.K("clpp.smooth.SmoothComponent",CS);};
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 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";};
2
+ var f=function(window){var Iz="No thumbnail found for position: ",Jz="Position is out of range: ",Kz="Thumbnail URL is mandatory",Lz="Wrong gridSize format",Mz="clpp.thumbnails",Nz=function(){this.log=new _.L(Mz);this.player=null;this.a=[];this.w=!1},Pz=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Se&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return Oz(a,0,e,!!f)})},Promise.resolve())},Oz=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return Qz(a,d).then(function(){return a.a[b].load()}).then(function(){return Oz(a,
3
+ e,c,d)})},Qz=function(a,b){return new Promise(function(c){if(b||2!==a.player.getState())c();else a.player.one(_.Yc,function(){c()})})},Rz=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},Sz=function(){Nz.call(this);
4
+ this.f=null;this.o=this.h=1;this.j=0},Tz=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.ud=new _.am},Uz=function(){this.g=new _.L(Mz);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.am},Vz=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.ud.resolve()})},Xz=function(a,b){return Wz(a,b).then(function(c){return new Rz(c,b.time,b.duration)})},Wz=function(a,b){return b.load().then(function(){var c=_.Mi(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
+ _.Am(c)})},Yz=function(){Nz.call(this);this.f=null},Zz=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},$z=function(){Nz.apply(this,arguments)},aA=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{ke:c,ah:d,ri:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},bA=function(){this.g=new _.L(Mz);this.a=this.m=null},cA=function(a){return a.some(function(b){return 0<
6
+ b.thumbStreams.length})},hA=function(a){return a?a===dA||a===eA?new Sz:a===fA?new Yz:a===gA?new Uz:null:null},iA=function(a){if(!a)return null;a=new _.mn(a);return a.path.match(/.*\.vtt$/i)?fA:a.path.match(/.*\.bif$/i)?gA:a.path.match(/.*\.(png|jpg|jpeg)$/i)?dA:null},jA=function(){};Nz.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Lf,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&Pz(c,b.preload)})};Rz.prototype.raw=function(){return this.a.cloneNode(!1)};
7
+ Rz.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(_.Pd);e.style.width=c+_.If;e.style.height=d+_.If;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))+_.If;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.If;e.style.backgroundPositionY="-"+f*d+_.If;return e};
9
+ Rz.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(_.Ce,f);a.a.removeEventListener(_.je,e);b(a)};e=function(g){a.a.removeEventListener(_.Ce,f);a.a.removeEventListener(_.je,e);c(new _.N(1,9,2014,"Failed to load thumbnail.",
10
+ g))};a.a.addEventListener(_.Ce,f);a.a.addEventListener(_.je,e);a.a.src=a.src}}));return this.f};_.K("clpp.thumbnails.Thumbnail",Rz);Rz.prototype.load=Rz.prototype.load;Rz.prototype.element=Rz.prototype.element;Rz.prototype.raw=Rz.prototype.raw;_.w(Sz,Nz);
11
+ Sz.prototype.init=function(a,b){if(!b||!b.url)throw new _.N(1,9,7100,Kz);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,Lz);}catch(d){throw this.log.error("Error during parsing gridSize",d),
12
+ new _.N(1,9,7100,Lz);}Nz.prototype.init.call(this,a,b)};Sz.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 _.N(1,9,2014,Jz+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
+ Sz.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 Rz(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()};Tz.prototype.load=function(){return this.ud};
14
+ Uz.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.N(1,9,7100,Kz);var d=b.url,e=_.Mk(d);e.type=_.Lk;a.getNetworkEngine().fetch(e).T.then(function(f){f=f.data;var g=_.Mi(c.f);f=_.Mi(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=_.Mi(l);n=String.fromCharCode.apply(null,
15
+ kA);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 Tz(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
+ Vz(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))})};Uz.prototype.get=function(a){var b=this,c,d;return _.I(function(e){switch(e.a){case 1:if(0>a)throw new _.N(1,9,2014,Jz+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,Iz+a);return _.x(e,Xz(b,c),3);case 3:return d=e.f,_.x(e,d.load(),4);case 4:return e["return"](d)}})};
17
+ Uz.prototype.pc=function(){return 0<this.a.length};var kA=[137,66,73,70,13,10,26,10];_.w(Yz,Nz);
18
+ Yz.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.N(1,9,7100,Kz);var d=b.url,e=_.Mk(d);e.type=_.Lk;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=Zz(l[0]);l=Zz(l[1])-t;c.a.push(new Rz(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))});Nz.prototype.init.call(this,a,b)};
20
+ Yz.prototype.get=function(a){var b=this,c;return _.I(function(d){if(1==d.a){if(0>a)throw new _.N(1,9,2014,Jz+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,Iz+a);return _.x(d,c.load(),3)}return d["return"](c)})};Yz.prototype.l=function(){return this.f};_.w($z,Nz);
21
+ $z.prototype.get=function(a){function b(){return new _.N(1,9,2014,Iz+a)}var c=this,d,e,f,g,h,l,m,n,p,q,t,u,y;return _.I(function(B){if(1==B.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.N(1,9,2014,Jz+a);d=c.player.getPeriods();for(var A=null,C=_.v(d),E=C.next();!E.done;E=C.next())E=E.value,E.startTime<=a&&(A=E);e=A;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 B.C(2);l=aA(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.ri+m])):(q=h.Ka())&&0<q.length&&(u=t=0,y=h.startTime,1<l.ri&&(t=m%l.ke,u=Math.floor(m/l.ke),y+=m*l.durationPerTile),n=new Rz(q[0],y,l.durationPerTile,void 0,void 0,void 0,void 0,l.ke,l.ah,
23
+ t,u));return n?_.x(B,n.load(),4):B.C(2)}if(2!=B.a)return B["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};$z.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
+ $z.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&&!_.M.R(d=b.getSegmentReference(c++));)for(var e=aA(d,b),f=d.Ka()[0],g=new Image,h=d.startTime,l=0;l<e.ah;++l)for(var m=0;m<e.ke;++m)this.a.push(new Rz(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.ke,e.ah,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.r=bA.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=iA(c.url||null));(this.a=hA(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Ee,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(cA(d)){this.a=new $z;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"};_.K("clpp.thumbnails.ThumbnailsPlugin",bA);bA.prototype.get=bA.prototype.get;bA.Id="thumbnails";
27
+ jA.prototype.create=function(){return new bA};var dA="SINGLE",eA="GRID",fA="WEBVTT",gA="BIF";_.To(new jA);};
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));}