@castlabs/prestoplay 6.31.0 → 6.32.0-beta.2

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 (68) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +2 -2
  3. package/cjs/cl.adobe.js +3 -3
  4. package/cjs/cl.airplay.js +3 -3
  5. package/cjs/cl.broadpeak.js +18 -18
  6. package/cjs/cl.cast.js +127 -125
  7. package/cjs/cl.cdn.js +13 -0
  8. package/cjs/cl.conviva.js +32 -32
  9. package/cjs/cl.core.js +615 -610
  10. package/cjs/cl.crypto.js +9 -9
  11. package/cjs/cl.dash.js +101 -95
  12. package/cjs/cl.externs.js +113 -44
  13. package/cjs/cl.freewheel.js +26 -26
  14. package/cjs/cl.hls.js +78 -78
  15. package/cjs/cl.hlssmpte.js +6 -6
  16. package/cjs/cl.htmlcue.js +30 -30
  17. package/cjs/cl.ima.js +26 -26
  18. package/cjs/cl.mediatailor.js +3 -3
  19. package/cjs/cl.mse.js +351 -350
  20. package/cjs/cl.muxdata.js +14 -14
  21. package/cjs/cl.onboard.js +4 -4
  22. package/cjs/cl.persistent.js +14 -14
  23. package/cjs/cl.playlist.js +6 -6
  24. package/cjs/cl.simid.js +16 -16
  25. package/cjs/cl.smooth.js +71 -71
  26. package/cjs/cl.thumbnails.js +26 -26
  27. package/cjs/cl.tizen.js +71 -71
  28. package/cjs/cl.ttml.js +29 -29
  29. package/cjs/cl.verimatrix.js +5 -5
  30. package/cjs/cl.vimond.js +11 -11
  31. package/cjs/cl.vr.js +19 -19
  32. package/cjs/cl.vtt.js +14 -14
  33. package/cjs/cl.yospace.js +4 -4
  34. package/cjs/cl.youbora.js +40 -40
  35. package/cl.adobe.js +3 -3
  36. package/cl.airplay.js +3 -3
  37. package/cl.broadpeak.js +14 -14
  38. package/cl.cast.js +102 -101
  39. package/cl.cdn.js +7 -0
  40. package/cl.conviva.js +27 -27
  41. package/cl.core.js +498 -495
  42. package/cl.crypto.js +9 -9
  43. package/cl.dash.js +91 -87
  44. package/cl.externs.js +109 -44
  45. package/cl.freewheel.js +20 -20
  46. package/cl.hls.js +82 -82
  47. package/cl.hlssmpte.js +5 -5
  48. package/cl.htmlcue.js +26 -26
  49. package/cl.ima.js +20 -20
  50. package/cl.mediatailor.js +2 -2
  51. package/cl.mse.js +301 -300
  52. package/cl.muxdata.js +13 -13
  53. package/cl.onboard.js +4 -4
  54. package/cl.persistent.js +10 -10
  55. package/cl.playlist.js +5 -5
  56. package/cl.simid.js +14 -14
  57. package/cl.smooth.js +61 -61
  58. package/cl.thumbnails.js +19 -19
  59. package/cl.tizen.js +56 -56
  60. package/cl.ttml.js +22 -22
  61. package/cl.verimatrix.js +4 -4
  62. package/cl.vimond.js +8 -8
  63. package/cl.vr.js +14 -14
  64. package/cl.vtt.js +12 -12
  65. package/cl.yospace.js +3 -3
  66. package/cl.youbora.js +31 -31
  67. package/package.json +10 -1
  68. package/typings.d.ts +328 -114
package/cjs/cl.smooth.js CHANGED
@@ -1,75 +1,75 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var KQ="Full MP4 box must have flags defined",LQ="clpp.smooth.SmoothMP4Processor",MQ="codecPrivateData",NQ=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)},OQ=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.cq()}},PQ=function(a,b){OQ(a,b>>16&255);OQ(a,b>>8&255);OQ(a,b&255)},QQ=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.cq()}},RQ=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.cq()}},SQ=function(a,b){try{a.f.setInt16(a.a,
3
- b,a.h),a.a+=2}catch(c){_.cq()}},TQ=function(a,b){for(var c=0;c<a.a.length;++c)if(a.a[c].endTime>b)return a.a.splice(0,c);c=a.a;a.a=[];return c},UQ=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},VQ=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){VQ.call(this,
4
- a);this.version=b;this.flags=c},WQ=function(a,b,c){VQ.call(this,a);this.f=b;this.offset=c},XQ=function(a,b,c,d,e){Z.call(this,a,b,c);this.f=d;this.offset=e},YQ=function(a,b,c){VQ.call(this,"ftyp");this.h=a;this.$i=b;this.f=c},ZQ=function(){VQ.call(this,_.We)},$Q=function(){VQ.call(this,_.Bg)},aR=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]},bR=function(){VQ.call(this,
5
- "mvex")},cR=function(a){Z.call(this,"trex",0,0);this.f=a},dR=function(a,b,c,d,e){Z.call(this,"tkhd",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]},eR=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},fR=function(a){Z.call(this,"hdlr",0,0);this.f=a},gR=function(){Z.call(this,"vmhd",0,1);this.f=new Uint8Array([0,0,0,0,0,0])},hR=function(a){VQ.call(this,
6
- a);this.w=!0},iR=function(a){hR.call(this,a);this.height=this.width=0;this.depth=24},jR=function(a,b,c,d){hR.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},kR=function(a,b){iR.call(this,"avc1");this.width=a;this.height=b},lR=function(a,b){kR.call(this,a,b);this.type="encv"},mR=function(a,b,c){jR.call(this,"mp4a",a,b,c)},nR=function(a,b,c){mR.call(this,a,b,c);this.type="enca"},oR=function(a,b){VQ.call(this,"avcC");this.rb=a;this.Dc=b;this.version=1;this.f=this.rb[0][1];this.h=
7
- this.rb[0][2];this.level=this.rb[0][3]},pR=function(a){Z.call(this,"esds",0,0);this.vc=a},qR=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},rR=function(){Z.call(this,"dref",0,0)},sR=function(){VQ.call(this,_.kg)},tR=function(){Z.call(this,_.mg,0,0)},uR=function(){Z.call(this,"stts",0,0)},vR=function(){Z.call(this,"stsc",0,0)},wR=function(){Z.call(this,"stco",0,0)},xR=function(){Z.call(this,"stsz",0,0)},yR=function(){Z.call(this,"smhd",0,0)},zR=function(){VQ.call(this,"dinf")},
8
- AR=function(){VQ.call(this,_.Ve)},BR=function(){VQ.call(this,_.Qe)},CR=function(a,b){Z.call(this,"tfdt",a,0);this.baseMediaDecodeTime=b},DR=function(){Z.call(this,"mfhd",0,0);this.f=0},ER=function(a,b){Z.call(this,"trun",a,b);this.l=this.j=this.f=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]},FR=function(a,b){Z.call(this,"tfhd",a,b);this.f=255;this.l=this.o=this.j=this.A=this.h=0},GR=function(){VQ.call(this,"traf")},HR=function(){VQ.call(this,"moof")},IR=function(){VQ.call(this,_.Oe);this.f=
9
- new Uint8Array(0)},JR=function(){Z.call(this,"tenc",0,0);this.f=1;this.h=8;this.l="";this.j=[]},KR=function(a,b){Z.call(this,"schm",0,0);this.f=a;this.h=b;this.oc=""},LR=function(a){VQ.call(this,"frma");this.f=a},MR=function(){Z.call(this,"saio",0,0);this.offset=[0]},NR=function(a,b,c){Z.call(this,"saiz",0,0);this.f=a;this.j=b;this.h=c},OR=function(a,b){Z.call(this,"senc",a,b);this.h=0;this.j=8;this.f=[]},PR=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?
10
- a:a+"/Manifest"},QR=function(a,b,c,d){c=b.si[c];b=b.op;a=a.replace("Manifest","");b=b.replace("{bitrate}",String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.xC([a],[b])[0]},RR=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.Sg?c=["maxWidth","maxHeight","bitrate",MQ,"fourCC"]:a.type===_.Sc&&(c=["bitrate",MQ,"channels","bitsPerSample","samplingRate","fourCC"]);return _.N.ua(a,b,c,["id","segmentIndex"])},
11
- SR=function(a,b,c){var d=c.pf.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,rb:null,Dc:null,width:NaN,height:NaN,vc:null,Le:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.Sg:a.rb=[_.Mm(d[1])];a.Dc=[_.Mm(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.Sc:a.vc=_.Mm(c.pf),a.sampleSize=c.rk||16,a.Le=c.Le,a.channelCount=c.Ph}return a},TR=function(a,b){return a.filter(function(c){return c.type===b})},UR=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:
12
- (Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},bS=function(a,b,c){var d=null;if(VR.test(a)){a=VR.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 WR.test(a)?d=UR(WR,a):YR.test(a)?d=UR(YR,a):ZR.test(a)?(a=ZR.exec(a),d=Number(a[1])/c.frameRate):$R.test(a)?(a=$R.exec(a),d=Number(a[1])/c.a):aS.test(a)&&(d=UR(aS,a));d+=b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-
13
- 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*d);return b+":"+c+":"+a+"."+d},cS=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))},eS=function(a){this.a=a;this.f=dS(this)},dS=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.bq(b)},fS=function(a,b,c){a:{var d=
14
- _.v([_.Md,_.Kd]);for(var e=d.next();!e.done;e=d.next())if((e=c.xf(e.value))&&e.keyId){d=e.keyId;break a}_.Qh(LQ,"Could not get default Key ID for DRM init data!");d=null}c=new VQ("xxxx");a.type===_.Sg?c=new lR(a.width,a.height):c=new nR(a.channelCount,a.sampleSize,a.Le);a=new JR;a.f=1;a.h=8;a.l=d||"00000000000000000000000000000000";a=(new VQ("schi")).append([a]);b=(new VQ(_.eg)).append([new LR(b),new KR(_.ld,65536),a]);c.append([b]);return c},gS=function(a,b){var c=b.zf(),d=new aR(a.timescale,a.duration,
15
- a.id),e=(new bR).append([new cR(a.id)]),f=new dR(a.id,a.duration,a.timescale,a.width,a.height),g=new eR(a.timescale,a.duration),k=new fR(a.type),l=null,m=new rR;m.entries=[new qR];var n=new tR;switch(a.type){case _.Sg:var p=new oR(a.rb,a.Dc);c?(l=fS(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new kR(a.width,a.height)).append([p]),n.entries=[l]);l=new gR;break;case _.Sc:p=new pR(a.vc),c?(l=fS(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new mR(a.channelCount,a.sampleSize,a.Le)).append([p]),n.entries=
16
- [l]),l=new yR}n=(new sR).append([n,new uR,new vR,new xR,new wR]);m=(new zR).append([m]);m=(new AR).append([l,m,n]);g=(new BR).append([g,k,m]);f=(new $Q).append([f,g]);d=(new ZQ).append([d,f,e]);e=new YQ("dash",0,["iso6","mp41","avc1"]);c&&(c=b.xf(_.Kd),f=b.xf(_.Md),c&&d.append([new WQ("pssh",c.initData,8)]),f&&d.append([new WQ("pssh",f.initData,8)]),c||f||_.Qh(LQ,"Could not get PSSH init data!"));c=new eS([e,d]);return _.Qi(c.write())},iS=function(a,b){var c,d,e,f,g,k;(new _.oq).N("moof",_.pq).da("mfhd",
17
- function(m){var n=new DR;n.f=_.jq(m.reader);c=n}).N("traf",_.pq).da("tfhd",function(m){var n=m.reader.bb();if(null===m.flags)throw new _.O(_.P,3,3019,KQ);var p=new FR(m.version||0,m.flags||0);p.f=_.jq(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.h=_.lq(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.A=_.jq(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.j=_.jq(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.o=_.jq(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.l=_.jq(m.reader));
18
- d=p}).da("trun",function(m){var n=m.reader.bb();if(null===m.flags)throw new _.O(_.P,3,3019,KQ);var p=new ER(m.version||0,m.flags||0);p.f=_.jq(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.kq(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.l=_.jq(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.f;n++)m.flags&256&&p.o.push(_.jq(m.reader)),m.flags&512&&p.sampleSize.push(_.jq(m.reader)),m.flags&1024&&p.A.push(_.jq(m.reader)),m.flags&2048&&(0===m.version?p.h.push(_.jq(m.reader)):p.h.push(_.kq(m.reader)));
19
- e=p}).da("sdtp",function(m){var n=_.nq(m.reader,m.reader.bb());f=new XQ("sdtp",m.version||0,m.flags||0,n,0)}).N("uuid",function(m){var n=_.nq(m.reader,16);if(_.Om(n,hS)){n=_.jq(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new OR(m.version,m.flags);n.h=_.jq(m.reader);m.flags&1&&(n.j=_.hq(m.reader));for(var p=0;p<n.h;p++){var q={Ni:_.nq(m.reader,8),Md:0,kh:[]};if(m.flags&2){q.Md=_.iq(m.reader);for(var t=0;t<q.Md;t++){var u={Lh:0,Mh:0};u.Lh=_.iq(m.reader);u.Mh=_.jq(m.reader);q.kh.push(u)}}n.f.push(q)}g=
20
- n}}).N(_.Oe,function(m){var n=new IR;0<m.reader.bb()?n.f=_.nq(m.reader,m.reader.bb()):(_.Qh(LQ,"mdat box is empty!"),n.f=new Uint8Array(0));k=n}).parse(a,!1);if(!k)return null;var l=(new GR).append([d,e]);f&&l.append([f]);b.zf()&&g&&l.append([g]);l=(new HR).append([c,l]);return new eS([l,k])},jS=function(a,b,c,d){var e=d.zf(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=iS(b,d);if(null===g)return a.request.contentType===_.Cn?a.data:g;d=g.get(_.Oe);if(a.request.contentType===_.Cn){e=d.f.buffer;
21
- if(c){e=_.R.le(e);if((e=(new DOMParser).parseFromString(e,_.tg))&&"tt"===e.documentElement.tagName.toLowerCase())var k=e.documentElement;if(k&&(d=new cS(k.getAttribute("ttp:frameRate"),k.getAttribute("ttp:subFrameRate"),k.getAttribute("ttp:frameRateMultiplier"),k.getAttribute("ttp:tickRate")),k=k.getElementsByTagName("body")[0]))for(k=k.getElementsByTagName("p"),a=0,b=k.length;a<b;a++){f=k[a];g=c;for(var l=["begin",_.oe],m=0,n=l.length;m<n;m++){b:{var p=f;var q=l[m],t=new RegExp("\\w+:"+q),u=0;if(p.hasAttribute(q))p=
22
- p.getAttribute(q);else{q=p.attributes;for(var y=q.length;u<y;u++){var C=q[u].name;if(C=C.match(t)){p=p.getAttribute(C[0]);break b}}p=null}}f.setAttribute(l[m],bS(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.R.sb(e).buffer}else c=e;return c}k=new HR;a=g.get("mfhd");b=new GR;l=g.get("tfhd");m=new CR(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+
23
- 6*c.f[m].Md);else g=8;b.append([c,new MR,new NR(g,l,c.h)])}k.append([a,b]);f.flags|=1;f.j=k.a()+8;d=new eS([k,d]);k=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=c.start+16,d.seek(e.start),e.write(d),k=d.buffer);return k},kS=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},lS=function(a,b,c){a=_.Qr(a);c&&a.version!==c&&(a=_.nC(a,c));
24
- return{initData:_.lC(a),initDataType:_.ld,keyId:b,periodId:null}},nS=function(){this.A=this.j=this.f=this.F=null;this.h=1;this.P=0;this.o="";this.D=this.a=null;this.g=new _.M("clpp.smooth.SmoothParser");this.K=!1;this.l=this.B=null;this.M=mS;this.I=0;this.G=this.J=Infinity;this.w=[];this.L=this.Go.bind(this);this.H=new Map},oS=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.Zk(b),c.timeout=a.f.attemptParameters.timeout,c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length),
25
- c.baseDelay=a.f.attemptParameters.baseDelay,c.backoffFactor=a.f.attemptParameters.backoffFactor,c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.F.networkingEngine.fetch(c),_.x(f,d.U,2);e=f.f;a.o=e.uri;return f["return"](e)})},vS=function(a,b){var c=_.Lr,d=null;try{var e=_.R.le(b);d=c.Je(e,_.Jb)}catch(SX){}if(!d)throw a.g.error("Unable to parse manifest"),new _.O(_.P,4,4033,a.o);var f=+pS(a,d,"MajorVersion"),g=+pS(a,d,"MinorVersion"),k=+d.getAttribute("TimeScale")||1E7,l=+pS(a,d,"Duration"),
26
- m="TRUE"===d.getAttribute("IsLive"),n=+d.getAttribute("LookAheadCount"),p=+d.getAttribute("DVRWindowLength")||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(_.P,4,4036,a.o);m?(qS(a,rS),a.B=typeof a.f.liveRefreshPeriod===_.h?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),l=Infinity):qS(a,mS);a.a={startTime:0,delay:0,duration:l/k,wg:p/k,Ce:0};if(q){var t=a.f.playreadyVersion,u=_.Lr,y=[],C=u.aa(q,
27
- "ProtectionHeader")[0],D=_.Lm(u.va(C)||""),B=_.Qr(D).a;y.push(kS(_.Md,{initData:_.lC(_.Ir(B)),initDataType:_.ld,keyId:B,periodId:null},[B]));y.push(kS(_.Kd,lS(D,B,t),[B]));a.w=y}var E=[],z=_.Lr.aa(d,"StreamIndex");if(!z.length)throw a.g.error("No streams found!"),new _.O(_.P,4,4034,a.o);for(var L=0;L<z.length;L++){for(var J,V=a,U=z[L],ta=pS(V,U,"Type"),wa=+U.getAttribute("Chunks"),qa=U.getAttribute("Subtype")||"",za=U.getAttribute("Language")||_.Hg,Fa=_.ro(za),Ya=U.getAttribute("Name")||"",ec=+U.getAttribute(_.eb),
28
- qd=+U.getAttribute(_.db),rd=pS(V,U,"Url"),dk=+U.getAttribute("TimeScale")||null,tc=[],Pe=_.Lr.aa(U,_.yb),Dg=0;Dg<Pe.length;Dg++){var Pd=void 0,Yb=void 0,fc=void 0,Qd=V,vc=Pe[Dg],Eg=ta,tW=+vc.getAttribute("Index"),uW=+pS(Qd,vc,"Bitrate"),nJ=NaN,oJ=NaN,Eo=NaN,Av=NaN,pJ=NaN,qJ=NaN,rJ=NaN,sJ=vc.getAttribute("FourCC")||"";switch(Eg){case _.Sg:nJ=+pS(Qd,vc,_.db);oJ=+pS(Qd,vc,_.eb);break;case _.Sc:Av=+vc.getAttribute("Channels")||2,Eo=+pS(Qd,vc,"SamplingRate"),qJ=+pS(Qd,vc,"AudioTag"),pJ=+pS(Qd,vc,"BitsPerSample"),
29
- rJ=+pS(Qd,vc,"PacketSize")}var Bv=String(vc.getAttribute("CodecPrivateData"));if(Eg===_.Sc&&!Bv){var tJ=Av,uJ={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},Fo=uJ[Eo];if("AACH"===sJ){Yb=new Uint8Array(4);var vJ=uJ[2*Eo];Yb[0]=40|Fo>>1;Yb[1]=Fo<<7|tJ<<3|vJ>>1;Yb[2]=vJ<<7|8;Yb[3]=0;Pd=new Uint16Array(2);Pd[0]=(Yb[0]<<8)+Yb[1];Pd[1]=(Yb[2]<<8)+Yb[3];fc=Pd[0].toString(16)+Pd[1].toString(16)}else Yb=new Uint8Array(2),Yb[0]=16|Fo>>1,Yb[1]=Fo<<7|tJ<<3,
30
- Pd=new Uint16Array(1),Pd[0]=(Yb[0]<<8)+Yb[1],fc=Pd[0].toString(16);Bv=fc.toUpperCase()}var vW={id:Qd.P++,type:Eg,index:tW,bitrate:uW,pf:Bv,maxHeight:nJ,maxWidth:oJ,Le:Eo,Ph:Av,Fp:qJ,rk:pJ,Wp:rJ,im:sJ,segmentIndex:null};tc.push(vW)}J=tc;for(var Se=[],wJ=_.Lr.aa(U,"c"),sk=0;sk<wJ.length;sk++){var Cv=wJ[sk],le=parseInt(Cv.getAttribute("t"),10),bi=parseInt(Cv.getAttribute("d"),10),Dv=parseInt(Cv.getAttribute("r"),10),tk=0;if(isNaN(le)&&isNaN(bi))throw V.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),
31
- new _.O(_.P,4,4037,V.o);0===sk&&isNaN(le)&&(tk=le=0);if(0<sk){var Gg=Se[Se.length-1];tk=Gg.n+1;Gg.d||(Gg.d=le-Gg.t);le||(le=Gg.t+Gg.d);bi||(bi=le-Gg.t)}Se.push({n:tk,d:bi,t:le});if(Dv){Dv--;for(var xJ=0;xJ<Dv;xJ++){var Go=Se[Se.length-1];tk=Go.n+1;le=Go.t+Go.d;bi=Go.d;Se.push({n:tk,d:bi,t:le})}}}V.be()||Se.length===wa||V.g.warn("Number of fragments ("+wa+") differs from number of chunks ("+Se.length+").");E.push({type:ta,Kp:wa,Wo:qa,language:Fa,Gd:za,name:Ya,maxWidth:ec,maxHeight:qd,op:rd,tracks:J,
32
- si:Se,timescale:dk})}var Ef={Up:f,$i:g,timescale:k,duration:l,isLive:m,Tp:n,wg:p,Eg:!1,streams:E};if(a.j&&a.A)return sS(a,Ef),Promise.resolve();a.H.clear();var Ev=Ef.timescale,Ho=Ef.duration,xW=TR(Ef.streams,_.Sc),yW=TR(Ef.streams,_.Sg),zW=TR(Ef.streams,_.Cn),yJ=[],Io=tS(a,Ho,Ev,xW),Jo=tS(a,Ho,Ev,yW),AW=tS(a,Ho,Ev,zW);Io.length||(Io=[null]);Jo.length||(Jo=[null]);for(var Gv=0;Gv<Jo.length;Gv++)for(var Hv=0;Hv<Io.length;Hv++)yJ.push(uS(a,Jo[Gv],Io[Hv]));var zJ={id:"ID",configurationId:void 0,startTime:0,
33
- endTime:Ho,variants:yJ,textStreams:AW,thumbStreams:[]};var CW=Ef.streams,Iv=a.a.startTime,AJ=a.a.delay,Jv=a.J,BJ=Math.min(a.a.duration||Infinity,Jv),Kv=a.be(),DW=a.a.wg,EW=a.a.Ce,CJ=a.I,DJ=isFinite(a.G)?a.G:0;if(Kv)BJ=Infinity,Iv=Date.now()/1E3-EW,a.a.startTime=Iv,AJ=3*CJ;else for(var FW=isFinite(Jv)?Jv:a.a.duration,EJ=_.v(CW),Lv=EJ.next();!Lv.done;Lv=EJ.next())for(var FJ=_.v(Lv.value.tracks),Mv=FJ.next();!Mv.done;Mv=FJ.next()){var GJ=Mv.value;GJ.segmentIndex.offset(-DJ);_.bD(GJ.segmentIndex,FW)}var HJ=
34
- a.f.timeline||{};HJ.type=void 0;a.D=new _.oD(HJ,Iv,AJ,!Kv,!0);a.D.f=BJ;_.wD(a.D,CJ);a.D.A=DW;Kv||a.D.offset(-DJ);a.F.filterAllPeriods([zJ]);a.j={presentationTimeline:a.D,periods:[zJ],minBufferTime:0,cues:[]};Promise.resolve();a.K||(a.F.networkingEngine.Ud(a.L),a.K=!0);a.A=Ef;return Promise.resolve()},sS=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={uc:e.uc},g=f.next())if(e.uc=g.value,g=d.tracks.find(function(l){return function(m){return m.type===
35
- l.uc.type&&m.bitrate===l.uc.bitrate}}(e))){RR(e.uc,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var k=wS(a,a.A.timescale,d,g);g=e.uc.segmentIndex;g.ta(k);(k=a.a.wg)&&TQ(g,(g.a.length?g.a[g.a.length-1].endTime:0)-k).forEach(function(l){l.Ia().forEach(function(m){a.H["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.uc.type+" track with bitrate "+(e.uc.bitrate+". Skipping update."))},tS=function(a,b,c,d){for(var e=[],f=
36
- {jd:0};f.jd<d.length;f={jd:f.jd},f.jd++){var g=d[f.jd].tracks.map(function(k){return function(l){var m=d[k.jd],n=wS(a,c,m,l);n=new _.LD(n);var p=null;m.type!==_.Cn&&(p=xS(a,b,c,m,l));l.segmentIndex=n;var q=_.aK++,t=Promise.resolve.bind(Promise),u=n.nf.bind(n),y=n.get.bind(n),C=n.lg.bind(n),D=n.getDuration.bind(n),B=yS[m.type],E="";switch(m.type){case _.Sg:E=l.pf;var z=/00000001[0-9]7/.exec(E);E="avc1."+(z&&z[0]?E.substr(E.indexOf(z[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",E);break;case _.Sc:E=
37
- l.pf,z=2,"AACH"===l.im?z=5:E&&(z=(parseInt(E.substr(0,2),16)&248)>>3),E="mp4a.40."+z,a.g.debug("AUDIO CODECS: ",E)}z=m.type===_.Cn?zS[m.Wo]:void 0;return{id:q,originalId:null,Zp:null,createSegmentIndex:t,findSegmentPosition:u,getSegmentReference:y,adjustSegmentDurations:C,getDuration:D,segmentIndex:n,segmentLookupStrategy:_.UB,initSegmentReference:p,mimeType:B,codecs:E,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:z,encrypted:a.Hg(),keyId:null,language:m.language,
38
- originalLanguage:m.Gd,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.Ph||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},wS=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.si.forEach(function(k,l){var m=k.d/g;if(0===l){var n=k.t/g;a.G=Math.min(a.G,n)}else n=f[l-1].endTime;var p=n+m,q=QR(a.o,c,l,d);a.I=Math.max(a.I,m);f.push(new _.Sp(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.H.set(q,n);e+=m});if(c.type===_.Sg||
39
- c.type===_.Sc)b=f[f.length-1],a.J=Math.min(a.J,e),0===a.a.Ce?a.a.Ce=b.endTime:a.a.Ce=Math.min(a.a.Ce,b.endTime);return f},xS=function(a,b,c,d,e){b=SR(b,d.timescale||c,e);c={isLive:a.be.bind(a),zf:a.Hg.bind(a),sm:function(){return 1},xf:a.zi.bind(a)};d=new Uint8Array(0);try{d=gS(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.O(_.P,3,4035,g);}var f="data:text/plain;base64,"+_.Km(d);return new _.LC(function(){return[f]},0,null,null,!0)},uS=function(a,b,c){var d=(c?
40
- c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.Hg;return c||b?{id:a.h++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,allowedByApplication:!0,allowedByKeySystem:!0}:null},pS=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.O(_.P,4,4038,a.o,c);},AS=function(a,b){null!=a.B&&null!=b&&(a.l=window.setTimeout(a.mc.bind(a),b))},qS=function(a,b){var c=b===mS;a.j&&a.j.presentationTimeline&&_.rD(a.j.presentationTimeline,c);c&&null!=
41
- a.l&&(window.clearTimeout(a.l),a.l=null,a.B=null);a.M=b},BS=function(){};VQ.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};VQ.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
- VQ.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
- VQ.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);_.dq(a,UQ(this.type));this.size>b&&NQ(a,this.size);"uuid"===this.type&&_.dq(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,VQ);Z.prototype.a=function(){return 4+VQ.prototype.a.call(this)};
44
- Z.prototype.write=function(a){VQ.prototype.write.call(this,a);OQ(a,this.version);PQ(a,this.flags)};_.w(WQ,VQ);WQ.prototype.a=function(){return this.f.byteLength+VQ.prototype.a.call(this)-this.offset};WQ.prototype.write=function(a){VQ.prototype.write.call(this,a);_.dq(a,this.f,this.offset);a.getPosition()};_.w(XQ,Z);XQ.prototype.a=function(){return this.f.byteLength+Z.prototype.a.call(this)-this.offset};XQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.dq(a,this.f,this.offset);a.getPosition()};
45
- _.w(YQ,VQ);YQ.prototype.a=function(){var a=this.h.length;a=a+4+this.f.join("").length;return a+VQ.prototype.a.call(this)};YQ.prototype.write=function(a){VQ.prototype.write.call(this,a);_.dq(a,UQ(this.h));_.W(a,this.$i);_.dq(a,UQ(this.f.join("")));a.getPosition()};_.w(ZQ,VQ);_.w($Q,VQ);_.w(aR,Z);aR.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
- aR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(NQ(a,0),NQ(a,0),_.W(a,this.timescale),NQ(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));_.W(a,65536);QQ(a,this.volume);QQ(a,0);_.W(a,0);_.W(a,0);for(var b=0;b<this.f.length;b++)OQ(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(bR,VQ);_.w(cR,Z);cR.prototype.a=function(){return 20+Z.prototype.a.call(this)};
47
- cR.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(dR,Z);dR.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
- dR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(NQ(a,0),NQ(a,0),_.W(a,this.h),_.W(a,0),NQ(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);QQ(a,0);QQ(a,0);QQ(a,this.volume);QQ(a,0);for(var b=0;b<this.f.length;b++)OQ(a,this.f[b]);QQ(a,this.width);QQ(a,0);QQ(a,this.height);QQ(a,0);a.getPosition()};_.w(eR,Z);eR.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
49
- eR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(NQ(a,0),NQ(a,0),_.W(a,this.timescale),NQ(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));QQ(a,this.language);QQ(a,0);a.getPosition()};_.w(fR,Z);fR.prototype.a=function(){return 33+Z.prototype.a.call(this)};
50
- fR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);this.f===_.Sg?_.dq(a,UQ("vide")):_.dq(a,UQ("soun"));_.W(a,0);_.W(a,0);_.W(a,0);this.f===_.Sg?_.dq(a,UQ("VideoHandler\x00")):_.dq(a,UQ("SoundHandler\x00"));a.getPosition()};_.w(gR,Z);gR.prototype.a=function(){return 2+this.f.byteLength+Z.prototype.a.call(this)};gR.prototype.write=function(a){Z.prototype.write.call(this,a);QQ(a,0);_.dq(a,this.f);a.getPosition()};_.w(hR,VQ);hR.prototype.a=function(){return 8+VQ.prototype.a.call(this)};
51
- hR.prototype.write=function(a){VQ.prototype.write.call(this,a);_.W(a,0);QQ(a,0);QQ(a,1)};_.w(iR,hR);iR.prototype.a=function(){return 70+hR.prototype.a.call(this)};iR.prototype.write=function(a){hR.prototype.write.call(this,a);QQ(a,0);QQ(a,0);_.W(a,0);_.W(a,0);_.W(a,0);QQ(a,this.width);QQ(a,this.height);_.W(a,4718592);_.W(a,4718592);_.W(a,0);QQ(a,1);OQ(a,10);_.dq(a,UQ("AVC Coding",31));QQ(a,this.depth);SQ(a,-1)};_.w(jR,hR);jR.prototype.a=function(){return 20+hR.prototype.a.call(this)};
52
- jR.prototype.write=function(a){hR.prototype.write.call(this,a);_.W(a,0);_.W(a,0);QQ(a,this.channelCount);QQ(a,this.sampleSize);SQ(a,0);QQ(a,0);QQ(a,this.sampleRate);QQ(a,0)};_.w(kR,iR);kR.prototype.write=function(a){iR.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};_.w(lR,kR);_.w(mR,jR);mR.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()};
53
- _.w(nR,mR);_.w(oR,VQ);oR.prototype.a=function(){for(var a=7,b=0;b<this.rb.length;b++)a+=2,a+=this.rb[b].byteLength;for(b=0;b<this.rb.length;b++)a+=2,a+=this.Dc[b].byteLength;return a+VQ.prototype.a.call(this)};
54
- oR.prototype.write=function(a){VQ.prototype.write.call(this,a);OQ(a,this.version);OQ(a,this.f);OQ(a,this.h);OQ(a,this.level);OQ(a,255);OQ(a,224|this.rb.length);for(var b=0;b<this.rb.length;b++)QQ(a,this.rb[b].length),_.dq(a,this.rb[b]);OQ(a,this.Dc.length);for(b=0;b<this.Dc.length;b++)QQ(a,this.Dc[b].length),_.dq(a,this.Dc[b]);a.getPosition()};_.w(pR,Z);pR.prototype.a=function(){return 22+(this.vc.byteLength+3)+Z.prototype.a.call(this)};
55
- pR.prototype.write=function(a){Z.prototype.write.call(this,a);OQ(a,3);OQ(a,23+this.vc.byteLength);QQ(a,1);OQ(a,0);OQ(a,4);OQ(a,15+this.vc.byteLength);OQ(a,64);OQ(a,21);PQ(a,0);_.W(a,0);_.W(a,0);OQ(a,5);OQ(a,this.vc.byteLength);_.dq(a,this.vc);_.dq(a,new Uint8Array([6,1,2]));a.getPosition()};_.w(qR,Z);qR.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};qR.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.dq(a,UQ(this.location));a.getPosition()};
56
- _.w(rR,Z);rR.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)};rR.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(sR,VQ);_.w(tR,Z);tR.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
- tR.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(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)};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);
58
- 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);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)};
59
- 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(){return 8+Z.prototype.a.call(this)};xR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);_.W(a,0);a.getPosition()};_.w(yR,Z);yR.prototype.a=function(){return 4+Z.prototype.a.call(this)};yR.prototype.write=function(a){Z.prototype.write.call(this,a);SQ(a,0);QQ(a,0);a.getPosition()};
60
- _.w(zR,VQ);_.w(AR,VQ);_.w(BR,VQ);_.w(CR,Z);CR.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};CR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?NQ(a,this.baseMediaDecodeTime):_.W(a,this.baseMediaDecodeTime);a.getPosition()};_.w(DR,Z);DR.prototype.a=function(){return 4+Z.prototype.a.call(this)};DR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);a.getPosition()};_.w(ER,Z);
61
- ER.prototype.a=function(){var a=4;this.flags&1&&(a+=4);this.flags&4&&(a+=4);for(var b=0;b<this.f;b++)this.flags&256&&(a+=4),this.flags&512&&(a+=4),this.flags&1024&&(a+=4),this.flags&2048&&(a+=4);return a+Z.prototype.a.call(this)};
62
- ER.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);this.flags&1&&(a.getPosition(),RQ(a,this.j));this.flags&4&&_.W(a,this.l);for(var b=0;b<this.f;b++)this.flags&256&&_.W(a,this.o[b]),this.flags&512&&_.W(a,this.sampleSize[b]),this.flags&1024&&_.W(a,this.A[b]),this.flags&2048&&(0===this.version?_.W(a,this.h[b]):RQ(a,this.h[b]));a.getPosition()};_.w(FR,Z);
63
- FR.prototype.a=function(){var a=4;this.flags&1&&(a+=8);this.flags&2&&(a+=4);this.flags&8&&(a+=4);this.flags&16&&(a+=4);this.flags&32&&(a+=4);return a+Z.prototype.a.call(this)};FR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);this.flags&1&&NQ(a,this.h);this.flags&2&&_.W(a,this.A);this.flags&8&&_.W(a,this.j);this.flags&16&&_.W(a,this.o);this.flags&32&&_.W(a,this.l);a.getPosition()};_.w(GR,VQ);_.w(HR,VQ);_.w(IR,VQ);IR.prototype.a=function(){return this.f.byteLength+VQ.prototype.a.call(this)};
64
- IR.prototype.write=function(a){VQ.prototype.write.call(this,a);0<this.f.byteLength&&_.dq(a,this.f)};_.w(JR,Z);JR.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)};JR.prototype.write=function(a){Z.prototype.write.call(this,a);OQ(a,0);0===this.version?OQ(a,0):OQ(a,0);OQ(a,this.f);OQ(a,this.h);_.dq(a,_.Mm(this.l));if(1===this.f&&0===this.h){OQ(a,0);for(var b=0;b<this.j.length;b++)OQ(a,this.j[b])}a.getPosition()};_.w(KR,Z);
65
- KR.prototype.a=function(){var a=8;this.flags&1&&(a+=UQ(this.oc).byteLength);return a+Z.prototype.a.call(this)};KR.prototype.write=function(a){Z.prototype.write.call(this,a);_.dq(a,UQ(this.f));_.W(a,this.h);this.flags&1&&_.dq(a,UQ(this.oc));a.getPosition()};_.w(LR,VQ);LR.prototype.a=function(){return UQ(this.f).byteLength+VQ.prototype.a.call(this)};LR.prototype.write=function(a){VQ.prototype.write.call(this,a);_.dq(a,UQ(this.f));a.getPosition()};_.w(MR,Z);
66
- MR.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)};MR.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]):NQ(a,this.offset[b]);a.getPosition()};_.w(NR,Z);NR.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)};
67
- NR.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));OQ(a,this.f);_.W(a,this.h);if(0===this.f)for(var b=0;b<this.h;b++)OQ(a,this.j[b]);a.getPosition()};_.w(OR,Z);OR.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.h;b++)if(a+=this.f[b].Ni.byteLength,this.flags&2){a+=2;for(var c=0;c<this.f[b].Md;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
68
- OR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.h);this.flags&1&&OQ(a,this.j);for(var b=0;b<this.h;b++)if(_.dq(a,this.f[b].Ni),this.flags&2){QQ(a,this.f[b].Md);for(var c=0;c<this.f[b].Md;c++)QQ(a,this.f[b].kh[c].Lh),_.W(a,this.f[b].kh[c].Mh)}a.getPosition()};var VR=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,WR=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,YR=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,ZR=/^(\d*\.?\d*)f$/,$R=/^(\d*\.?\d*)t$/,aS=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;eS.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};eS.prototype.write=function(){this.f=dS(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var hS=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.r=nS.prototype;_.r.configure=function(a){this.f=a};_.r.start=function(a,b){var c=this;this.F=b;var d=_.ph(new Set([a,PR(a)])).concat();return oS(this,d).then(function(e){return vS(c,e.data).then(function(){AS(c,c.B);return c.j})})};_.r.requestStop=function(){};_.r.stop=function(){this.F&&this.F.networkingEngine.Vf(this.L);this.B=this.A=this.j=this.f=this.F=null;this.l&&(clearTimeout(this.l),this.l=null);this.K=!1;this.J=this.G=Infinity;return Promise.resolve()};
69
- _.r.update=function(){var a=this;if(this.be())return oS(this,[this.o]).then(function(b){return vS(a,b.data).then(function(){return a.j})})["catch"](function(b){if(a.F)a.F.onError(b)})};_.r.setCurrentVariant=function(){};_.r.mc=function(){var a=this;this.g.debug(_.LB);this.F&&(this.l=null,this.update().then(function(){AS(a,a.B)})["catch"](function(b){a.F&&(a.F.onError(b),1===b.severity&&AS(a,100))}))};_.r.be=function(){return this.M===rS};_.r.Hg=function(){return 0<this.w.length};
70
- _.r.zi=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};
71
- _.r.Go=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.be.bind(this),zf:this.Hg.bind(this),sm:function(){return 1},xf:this.zi.bind(this)},d=!1,e=new _.O(_.P,3,4035,null),f=null;try{var g=this.H.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.g.debug("Using base media decode time "+g+" instead of segment reference time "+a.request.startTime);f=jS(a,b,g,c)}catch(k){d=
72
- !0,e.data=k,3E3===k.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 _.ui(_.BB+a);return f["return"](d)})};var yS={video:_.Ug,audio:_.Wc,text:_.Pc},mS=_.Ub,rS="LIVE",zS={rp:_.gd,yp:_.og};_.w(BS,_.av);BS.prototype.install=function(){_.Wv.ism=nS;_.Vv[_.Qc]=nS};BS.prototype.uninstall=function(){_.jE("ism");_.kE(_.Qc)};BS.prototype.id=function(){return _.fg};_.K("clpp.smooth.SmoothComponent",BS);};
2
+ var f=function(window){var ZQ="Full MP4 box must have flags defined",$Q="clpp.smooth.SmoothMP4Processor",aR="codecPrivateData",bR=function(a,b){var c=Math.floor(b/Math.pow(2,32)),d=b-c*Math.pow(2,32);_.W(a,c);_.W(a,d)},cR=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.hq()}},dR=function(a,b){cR(a,b>>16&255);cR(a,b>>8&255);cR(a,b&255)},eR=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.hq()}},fR=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.hq()}},gR=function(a,b){try{a.f.setInt16(a.a,
3
+ b,a.h),a.a+=2}catch(c){_.hq()}},hR=function(a,b){for(var c=0;c<a.a.length;++c)if(a.a[c].endTime>b)return a.a.splice(0,c);c=a.a;a.a=[];return c},iR=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},jR=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){jR.call(this,
4
+ a);this.version=b;this.flags=c},kR=function(a,b,c){jR.call(this,a);this.f=b;this.offset=c},lR=function(a,b,c,d,e){Z.call(this,a,b,c);this.f=d;this.offset=e},mR=function(a,b,c){jR.call(this,"ftyp");this.h=a;this.ij=b;this.f=c},nR=function(){jR.call(this,_.We)},oR=function(){jR.call(this,_.Dg)},pR=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]},qR=function(){jR.call(this,
5
+ "mvex")},rR=function(a){Z.call(this,"trex",0,0);this.f=a},sR=function(a,b,c,d,e){Z.call(this,"tkhd",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]},tR=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},uR=function(a){Z.call(this,"hdlr",0,0);this.f=a},vR=function(){Z.call(this,"vmhd",0,1);this.f=new Uint8Array([0,0,0,0,0,0])},wR=function(a){jR.call(this,
6
+ a);this.w=!0},xR=function(a){wR.call(this,a);this.height=this.width=0;this.depth=24},yR=function(a,b,c,d){wR.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},zR=function(a,b){xR.call(this,"avc1");this.width=a;this.height=b},AR=function(a,b){zR.call(this,a,b);this.type="encv"},BR=function(a,b,c){yR.call(this,"mp4a",a,b,c)},CR=function(a,b,c){BR.call(this,a,b,c);this.type="enca"},DR=function(a,b){jR.call(this,"avcC");this.sb=a;this.Kc=b;this.version=1;this.f=this.sb[0][1];this.h=
7
+ this.sb[0][2];this.level=this.sb[0][3]},ER=function(a){Z.call(this,"esds",0,0);this.Ac=a},FR=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},GR=function(){Z.call(this,"dref",0,0)},HR=function(){jR.call(this,_.mg)},IR=function(){Z.call(this,_.og,0,0)},JR=function(){Z.call(this,"stts",0,0)},KR=function(){Z.call(this,"stsc",0,0)},LR=function(){Z.call(this,"stco",0,0)},MR=function(){Z.call(this,"stsz",0,0)},NR=function(){Z.call(this,"smhd",0,0)},OR=function(){jR.call(this,"dinf")},
8
+ PR=function(){jR.call(this,_.Ve)},QR=function(){jR.call(this,_.Qe)},RR=function(a,b){Z.call(this,"tfdt",a,0);this.baseMediaDecodeTime=b},SR=function(){Z.call(this,"mfhd",0,0);this.f=0},TR=function(a,b){Z.call(this,"trun",a,b);this.l=this.j=this.f=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]},UR=function(a,b){Z.call(this,"tfhd",a,b);this.f=255;this.l=this.o=this.j=this.A=this.h=0},VR=function(){jR.call(this,"traf")},WR=function(){jR.call(this,"moof")},YR=function(){jR.call(this,_.Pe);this.f=
9
+ new Uint8Array(0)},ZR=function(){Z.call(this,"tenc",0,0);this.f=1;this.h=8;this.l="";this.j=[]},$R=function(a,b){Z.call(this,"schm",0,0);this.f=a;this.h=b;this.tc=""},aS=function(a){jR.call(this,"frma");this.f=a},bS=function(){Z.call(this,"saio",0,0);this.offset=[0]},cS=function(a,b,c){Z.call(this,"saiz",0,0);this.f=a;this.j=b;this.h=c},dS=function(a,b){Z.call(this,"senc",a,b);this.h=0;this.j=8;this.f=[]},eS=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?
10
+ a:a+"/Manifest"},fS=function(a,b,c,d){c=b.Ei[c];b=b.xp;a=a.replace("Manifest","");b=b.replace("{bitrate}",String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.DC([a],[b])[0]},gS=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.Tg?c=["maxWidth","maxHeight","bitrate",aR,"fourCC"]:a.type===_.Sc&&(c=["bitrate",aR,"channels","bitsPerSample","samplingRate","fourCC"]);return _.N.ua(a,b,c,["id","segmentIndex"])},
11
+ hS=function(a,b,c){var d=c.Bf.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,sb:null,Kc:null,width:NaN,height:NaN,Ac:null,We:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.Tg:a.sb=[_.Qm(d[1])];a.Kc=[_.Qm(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.Sc:a.Ac=_.Qm(c.Bf),a.sampleSize=c.Ak||16,a.We=c.We,a.channelCount=c.Zh}return a},iS=function(a,b){return a.filter(function(c){return c.type===b})},jS=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:
12
+ (Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},qS=function(a,b,c){var d=null;if(kS.test(a)){a=kS.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 lS.test(a)?d=jS(lS,a):mS.test(a)?d=jS(mS,a):nS.test(a)?(a=nS.exec(a),d=Number(a[1])/c.frameRate):oS.test(a)?(a=oS.exec(a),d=Number(a[1])/c.a):pS.test(a)&&(d=jS(pS,a));d+=b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-
13
+ 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*d);return b+":"+c+":"+a+"."+d},rS=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))},tS=function(a){this.a=a;this.f=sS(this)},sS=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.gq(b)},uS=function(a,b,c){a:{var d=
14
+ _.v([_.Md,_.Kd]);for(var e=d.next();!e.done;e=d.next())if((e=c.Kf(e.value))&&e.keyId){d=e.keyId;break a}_.Vh($Q,"Could not get default Key ID for DRM init data!");d=null}c=new jR("xxxx");a.type===_.Tg?c=new AR(a.width,a.height):c=new CR(a.channelCount,a.sampleSize,a.We);a=new ZR;a.f=1;a.h=8;a.l=d||"00000000000000000000000000000000";a=(new jR("schi")).append([a]);b=(new jR(_.gg)).append([new aS(b),new $R(_.md,65536),a]);c.append([b]);return c},vS=function(a,b){var c=b.Mf(),d=new pR(a.timescale,a.duration,
15
+ a.id),e=(new qR).append([new rR(a.id)]),f=new sR(a.id,a.duration,a.timescale,a.width,a.height),g=new tR(a.timescale,a.duration),k=new uR(a.type),l=null,m=new GR;m.entries=[new FR];var n=new IR;switch(a.type){case _.Tg:var p=new DR(a.sb,a.Kc);c?(l=uS(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new zR(a.width,a.height)).append([p]),n.entries=[l]);l=new vR;break;case _.Sc:p=new ER(a.Ac),c?(l=uS(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new BR(a.channelCount,a.sampleSize,a.We)).append([p]),n.entries=
16
+ [l]),l=new NR}n=(new HR).append([n,new JR,new KR,new MR,new LR]);m=(new OR).append([m]);m=(new PR).append([l,m,n]);g=(new QR).append([g,k,m]);f=(new oR).append([f,g]);d=(new nR).append([d,f,e]);e=new mR("dash",0,["iso6","mp41","avc1"]);c&&(c=b.Kf(_.Kd),f=b.Kf(_.Md),c&&d.append([new kR("pssh",c.initData,8)]),f&&d.append([new kR("pssh",f.initData,8)]),c||f||_.Vh($Q,"Could not get PSSH init data!"));c=new tS([e,d]);return _.Vi(c.write())},xS=function(a,b){var c,d,e,f,g,k;(new _.tq).N("moof",_.uq).da("mfhd",
17
+ function(m){var n=new SR;n.f=_.oq(m.reader);c=n}).N("traf",_.uq).da("tfhd",function(m){var n=m.reader.cb();if(null===m.flags)throw new _.O(_.P,3,3019,ZQ);var p=new UR(m.version||0,m.flags||0);p.f=_.oq(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.h=_.qq(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.A=_.oq(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.j=_.oq(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.o=_.oq(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.l=_.oq(m.reader));
18
+ d=p}).da("trun",function(m){var n=m.reader.cb();if(null===m.flags)throw new _.O(_.P,3,3019,ZQ);var p=new TR(m.version||0,m.flags||0);p.f=_.oq(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.pq(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.l=_.oq(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.f;n++)m.flags&256&&p.o.push(_.oq(m.reader)),m.flags&512&&p.sampleSize.push(_.oq(m.reader)),m.flags&1024&&p.A.push(_.oq(m.reader)),m.flags&2048&&(0===m.version?p.h.push(_.oq(m.reader)):p.h.push(_.pq(m.reader)));
19
+ e=p}).da("sdtp",function(m){var n=_.sq(m.reader,m.reader.cb());f=new lR("sdtp",m.version||0,m.flags||0,n,0)}).N("uuid",function(m){var n=_.sq(m.reader,16);if(_.Sm(n,wS)){n=_.oq(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new dS(m.version,m.flags);n.h=_.oq(m.reader);m.flags&1&&(n.j=_.mq(m.reader));for(var p=0;p<n.h;p++){var q={Wi:_.sq(m.reader,8),Xd:0,vh:[]};if(m.flags&2){q.Xd=_.nq(m.reader);for(var t=0;t<q.Xd;t++){var u={Vh:0,Wh:0};u.Vh=_.nq(m.reader);u.Wh=_.oq(m.reader);q.vh.push(u)}}n.f.push(q)}g=
20
+ n}}).N(_.Pe,function(m){var n=new YR;0<m.reader.cb()?n.f=_.sq(m.reader,m.reader.cb()):(_.Vh($Q,"mdat box is empty!"),n.f=new Uint8Array(0));k=n}).parse(a,!1);if(!k)return null;var l=(new VR).append([d,e]);f&&l.append([f]);b.Mf()&&g&&l.append([g]);l=(new WR).append([c,l]);return new tS([l,k])},yS=function(a,b,c,d){var e=d.Mf(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=xS(b,d);if(null===g)return a.request.contentType===_.Gn?a.data:g;d=g.get(_.Pe);if(a.request.contentType===_.Gn){e=d.f.buffer;
21
+ if(c){e=_.R.we(e);if((e=(new DOMParser).parseFromString(e,_.vg))&&"tt"===e.documentElement.tagName.toLowerCase())var k=e.documentElement;if(k&&(d=new rS(k.getAttribute("ttp:frameRate"),k.getAttribute("ttp:subFrameRate"),k.getAttribute("ttp:frameRateMultiplier"),k.getAttribute("ttp:tickRate")),k=k.getElementsByTagName("body")[0]))for(k=k.getElementsByTagName("p"),a=0,b=k.length;a<b;a++){f=k[a];g=c;for(var l=["begin",_.oe],m=0,n=l.length;m<n;m++){b:{var p=f;var q=l[m],t=new RegExp("\\w+:"+q),u=0;if(p.hasAttribute(q))p=
22
+ p.getAttribute(q);else{q=p.attributes;for(var z=q.length;u<z;u++){var B=q[u].name;if(B=B.match(t)){p=p.getAttribute(B[0]);break b}}p=null}}f.setAttribute(l[m],qS(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.R.ub(e).buffer}else c=e;return c}k=new WR;a=g.get("mfhd");b=new VR;l=g.get("tfhd");m=new RR(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+
23
+ 6*c.f[m].Xd);else g=8;b.append([c,new bS,new cS(g,l,c.h)])}k.append([a,b]);f.flags|=1;f.j=k.a()+8;d=new tS([k,d]);k=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=c.start+16,d.seek(e.start),e.write(d),k=d.buffer);return k},zS=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},AS=function(a,b,c){a=_.Zr(a);c&&a.version!==c&&(a=_.tC(a,c));
24
+ return{initData:_.rC(a),initDataType:_.md,keyId:b,periodId:null}},CS=function(){this.A=this.j=this.f=this.F=null;this.h=1;this.P=0;this.o="";this.D=this.a=null;this.g=new _.M("clpp.smooth.SmoothParser");this.K=!1;this.l=this.B=null;this.M=BS;this.I=0;this.G=this.J=Infinity;this.w=[];this.L=this.Qo.bind(this);this.H=new Map},DS=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.dl(b),c.timeout=a.f.attemptParameters.timeout,c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length),
25
+ c.baseDelay=a.f.attemptParameters.baseDelay,c.backoffFactor=a.f.attemptParameters.backoffFactor,c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.F.networkingEngine.fetch(c),_.y(f,d.U,2);e=f.f;a.o=e.uri;return f["return"](e)})},KS=function(a,b){var c=_.Ur,d=null;try{var e=_.R.we(b);d=c.Te(e,_.Jb)}catch(lY){}if(!d)throw a.g.error("Unable to parse manifest"),new _.O(_.P,4,4033,a.o);var f=+ES(a,d,"MajorVersion"),g=+ES(a,d,"MinorVersion"),k=+d.getAttribute("TimeScale")||1E7,l=+ES(a,d,"Duration"),
26
+ m="TRUE"===d.getAttribute("IsLive"),n=+d.getAttribute("LookAheadCount"),p=+d.getAttribute("DVRWindowLength")||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(_.P,4,4036,a.o);m?(FS(a,GS),a.B=typeof a.f.liveRefreshPeriod===_.h?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),l=Infinity):FS(a,BS);a.a={startTime:0,delay:0,duration:l/k,Ig:p/k,Ne:0};if(q){var t=a.f.playreadyVersion,u=_.Ur,z=[],B=u.aa(q,
27
+ "ProtectionHeader")[0],D=_.Pm(u.va(B)||""),C=_.Zr(D).a;z.push(zS(_.Md,{initData:_.rC(_.Rr(C)),initDataType:_.md,keyId:C,periodId:null},[C]));z.push(zS(_.Kd,AS(D,C,t),[C]));a.w=z}var E=[],x=_.Ur.aa(d,"StreamIndex");if(!x.length)throw a.g.error("No streams found!"),new _.O(_.P,4,4034,a.o);for(var J=0;J<x.length;J++){for(var L,U=a,V=x[J],ta=ES(U,V,"Type"),za=+V.getAttribute("Chunks"),va=V.getAttribute("Subtype")||"",qa=V.getAttribute("Language")||_.Gg,Fa=_.vo(qa),sc=V.getAttribute("Name")||"",ab=+V.getAttribute(_.eb),
28
+ Uc=+V.getAttribute(_.db),Pd=ES(U,V,"Url"),Ff=+V.getAttribute("TimeScale")||null,uc=[],ei=_.Ur.aa(V,_.yb),Hf=0;Hf<ei.length;Hf++){var td=void 0,Nb=void 0,fc=void 0,Rd=U,wc=ei[Hf],Ig=ta,JW=+wc.getAttribute("Index"),KW=+ES(Rd,wc,"Bitrate"),HJ=NaN,IJ=NaN,Jo=NaN,Mv=NaN,JJ=NaN,KJ=NaN,LJ=NaN,MJ=wc.getAttribute("FourCC")||"";switch(Ig){case _.Tg:HJ=+ES(Rd,wc,_.db);IJ=+ES(Rd,wc,_.eb);break;case _.Sc:Mv=+wc.getAttribute("Channels")||2,Jo=+ES(Rd,wc,"SamplingRate"),KJ=+ES(Rd,wc,"AudioTag"),JJ=+ES(Rd,wc,"BitsPerSample"),
29
+ LJ=+ES(Rd,wc,"PacketSize")}var Nv=String(wc.getAttribute("CodecPrivateData"));if(Ig===_.Sc&&!Nv){var NJ=Mv,OJ={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},Ko=OJ[Jo];if("AACH"===MJ){Nb=new Uint8Array(4);var PJ=OJ[2*Jo];Nb[0]=40|Ko>>1;Nb[1]=Ko<<7|NJ<<3|PJ>>1;Nb[2]=PJ<<7|8;Nb[3]=0;td=new Uint16Array(2);td[0]=(Nb[0]<<8)+Nb[1];td[1]=(Nb[2]<<8)+Nb[3];fc=td[0].toString(16)+td[1].toString(16)}else Nb=new Uint8Array(2),Nb[0]=16|Ko>>1,Nb[1]=Ko<<7|NJ<<3,
30
+ td=new Uint16Array(1),td[0]=(Nb[0]<<8)+Nb[1],fc=td[0].toString(16);Nv=fc.toUpperCase()}var LW={id:Rd.P++,type:Ig,index:JW,bitrate:KW,Bf:Nv,maxHeight:HJ,maxWidth:IJ,We:Jo,Zh:Mv,Np:KJ,Ak:JJ,eq:LJ,rm:MJ,segmentIndex:null};uc.push(LW)}L=uc;for(var Te=[],QJ=_.Ur.aa(V,"c"),wk=0;wk<QJ.length;wk++){var Ov=QJ[wk],le=parseInt(Ov.getAttribute("t"),10),ii=parseInt(Ov.getAttribute("d"),10),Pv=parseInt(Ov.getAttribute("r"),10),xk=0;if(isNaN(le)&&isNaN(ii))throw U.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),
31
+ new _.O(_.P,4,4037,U.o);0===wk&&isNaN(le)&&(xk=le=0);if(0<wk){var Kg=Te[Te.length-1];xk=Kg.n+1;Kg.d||(Kg.d=le-Kg.t);le||(le=Kg.t+Kg.d);ii||(ii=le-Kg.t)}Te.push({n:xk,d:ii,t:le});if(Pv){Pv--;for(var RJ=0;RJ<Pv;RJ++){var Lo=Te[Te.length-1];xk=Lo.n+1;le=Lo.t+Lo.d;ii=Lo.d;Te.push({n:xk,d:ii,t:le})}}}U.me()||Te.length===za||U.g.warn("Number of fragments ("+za+") differs from number of chunks ("+Te.length+").");E.push({type:ta,Sp:za,fp:va,language:Fa,Qd:qa,name:sc,maxWidth:ab,maxHeight:Uc,xp:Pd,tracks:L,
32
+ Ei:Te,timescale:Ff})}var Jf={bq:f,ij:g,timescale:k,duration:l,isLive:m,aq:n,Ig:p,Og:!1,streams:E};if(a.j&&a.A)return HS(a,Jf),Promise.resolve();a.H.clear();var Qv=Jf.timescale,Mo=Jf.duration,NW=iS(Jf.streams,_.Sc),OW=iS(Jf.streams,_.Tg),PW=iS(Jf.streams,_.Gn),SJ=[],No=IS(a,Mo,Qv,NW),Oo=IS(a,Mo,Qv,OW),QW=IS(a,Mo,Qv,PW);No.length||(No=[null]);Oo.length||(Oo=[null]);for(var Sv=0;Sv<Oo.length;Sv++)for(var Tv=0;Tv<No.length;Tv++)SJ.push(JS(a,Oo[Sv],No[Tv]));var TJ={id:"ID",configurationId:void 0,startTime:0,
33
+ endTime:Mo,variants:SJ,textStreams:QW,thumbStreams:[]};var SW=Jf.streams,Uv=a.a.startTime,UJ=a.a.delay,Vv=a.J,VJ=Math.min(a.a.duration||Infinity,Vv),Wv=a.me(),TW=a.a.Ig,UW=a.a.Ne,WJ=a.I,XJ=isFinite(a.G)?a.G:0;if(Wv)VJ=Infinity,Uv=Date.now()/1E3-UW,a.a.startTime=Uv,UJ=3*WJ;else for(var VW=isFinite(Vv)?Vv:a.a.duration,YJ=_.v(SW),Xv=YJ.next();!Xv.done;Xv=YJ.next())for(var ZJ=_.v(Xv.value.tracks),Yv=ZJ.next();!Yv.done;Yv=ZJ.next()){var $J=Yv.value;$J.segmentIndex.offset(-XJ);_.hD($J.segmentIndex,VW)}var aK=
34
+ a.f.timeline||{};aK.type=void 0;a.D=new _.uD(aK,Uv,UJ,!Wv,!0);a.D.f=VJ;_.CD(a.D,WJ);a.D.A=TW;Wv||a.D.offset(-XJ);a.F.filterAllPeriods([TJ]);a.j={presentationTimeline:a.D,periods:[TJ],minBufferTime:0,cues:[]};Promise.resolve();a.K||(a.F.networkingEngine.yd(a.L),a.K=!0);a.A=Jf;return Promise.resolve()},HS=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={zc:e.zc},g=f.next())if(e.zc=g.value,g=d.tracks.find(function(l){return function(m){return m.type===
35
+ l.zc.type&&m.bitrate===l.zc.bitrate}}(e))){gS(e.zc,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var k=LS(a,a.A.timescale,d,g);g=e.zc.segmentIndex;g.ta(k);(k=a.a.Ig)&&hR(g,(g.a.length?g.a[g.a.length-1].endTime:0)-k).forEach(function(l){l.Ia().forEach(function(m){a.H["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.zc.type+" track with bitrate "+(e.zc.bitrate+". Skipping update."))},IS=function(a,b,c,d){for(var e=[],f=
36
+ {td:0};f.td<d.length;f={td:f.td},f.td++){var g=d[f.td].tracks.map(function(k){return function(l){var m=d[k.td],n=LS(a,c,m,l);n=new _.RD(n);var p=null;m.type!==_.Gn&&(p=MS(a,b,c,m,l));l.segmentIndex=n;var q=_.gK++,t=Promise.resolve.bind(Promise),u=n.Af.bind(n),z=n.get.bind(n),B=n.wg.bind(n),D=n.getDuration.bind(n),C=NS[m.type],E="";switch(m.type){case _.Tg:E=l.Bf;var x=/00000001[0-9]7/.exec(E);E="avc1."+(x&&x[0]?E.substr(E.indexOf(x[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",E);break;case _.Sc:E=
37
+ l.Bf,x=2,"AACH"===l.rm?x=5:E&&(x=(parseInt(E.substr(0,2),16)&248)>>3),E="mp4a.40."+x,a.g.debug("AUDIO CODECS: ",E)}x=m.type===_.Gn?OS[m.fp]:void 0;return{id:q,originalId:null,hq:null,createSegmentIndex:t,findSegmentPosition:u,getSegmentReference:z,adjustSegmentDurations:B,getDuration:D,segmentIndex:n,segmentLookupStrategy:_.$B,initSegmentReference:p,mimeType:C,codecs:E,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:x,encrypted:a.Rg(),keyId:null,language:m.language,
38
+ originalLanguage:m.Qd,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.Zh||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},LS=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.Ei.forEach(function(k,l){var m=k.d/g;if(0===l){var n=k.t/g;a.G=Math.min(a.G,n)}else n=f[l-1].endTime;var p=n+m,q=fS(a.o,c,l,d);a.I=Math.max(a.I,m);f.push(new _.Wp(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.H.set(q,n);e+=m});if(c.type===_.Tg||
39
+ c.type===_.Sc)b=f[f.length-1],a.J=Math.min(a.J,e),0===a.a.Ne?a.a.Ne=b.endTime:a.a.Ne=Math.min(a.a.Ne,b.endTime);return f},MS=function(a,b,c,d,e){b=hS(b,d.timescale||c,e);c={isLive:a.me.bind(a),Mf:a.Rg.bind(a),Bm:function(){return 1},Kf:a.Ji.bind(a)};d=new Uint8Array(0);try{d=vS(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.O(_.P,3,4035,g);}var f="data:text/plain;base64,"+_.Om(d);return new _.RC(function(){return[f]},0,null,null,!0)},JS=function(a,b,c){var d=(c?
40
+ c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.Gg;return c||b?{id:a.h++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,allowedByApplication:!0,allowedByKeySystem:!0}:null},ES=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.O(_.P,4,4038,a.o,c);},PS=function(a,b){null!=a.B&&null!=b&&(a.l=window.setTimeout(a.rc.bind(a),b))},FS=function(a,b){var c=b===BS;a.j&&a.j.presentationTimeline&&_.xD(a.j.presentationTimeline,c);c&&null!=
41
+ a.l&&(window.clearTimeout(a.l),a.l=null,a.B=null);a.M=b},QS=function(){};jR.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};jR.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
+ jR.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
+ jR.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);_.iq(a,iR(this.type));this.size>b&&bR(a,this.size);"uuid"===this.type&&_.iq(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,jR);Z.prototype.a=function(){return 4+jR.prototype.a.call(this)};
44
+ Z.prototype.write=function(a){jR.prototype.write.call(this,a);cR(a,this.version);dR(a,this.flags)};_.w(kR,jR);kR.prototype.a=function(){return this.f.byteLength+jR.prototype.a.call(this)-this.offset};kR.prototype.write=function(a){jR.prototype.write.call(this,a);_.iq(a,this.f,this.offset);a.getPosition()};_.w(lR,Z);lR.prototype.a=function(){return this.f.byteLength+Z.prototype.a.call(this)-this.offset};lR.prototype.write=function(a){Z.prototype.write.call(this,a);_.iq(a,this.f,this.offset);a.getPosition()};
45
+ _.w(mR,jR);mR.prototype.a=function(){var a=this.h.length;a=a+4+this.f.join("").length;return a+jR.prototype.a.call(this)};mR.prototype.write=function(a){jR.prototype.write.call(this,a);_.iq(a,iR(this.h));_.W(a,this.ij);_.iq(a,iR(this.f.join("")));a.getPosition()};_.w(nR,jR);_.w(oR,jR);_.w(pR,Z);pR.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
+ pR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(bR(a,0),bR(a,0),_.W(a,this.timescale),bR(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));_.W(a,65536);eR(a,this.volume);eR(a,0);_.W(a,0);_.W(a,0);for(var b=0;b<this.f.length;b++)cR(a,this.f[b]);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,this.h);a.getPosition()};_.w(qR,jR);_.w(rR,Z);rR.prototype.a=function(){return 20+Z.prototype.a.call(this)};
47
+ rR.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(sR,Z);sR.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
+ sR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(bR(a,0),bR(a,0),_.W(a,this.h),_.W(a,0),bR(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.h),_.W(a,0),_.W(a,this.duration*this.timescale));_.W(a,0);_.W(a,0);eR(a,0);eR(a,0);eR(a,this.volume);eR(a,0);for(var b=0;b<this.f.length;b++)cR(a,this.f[b]);eR(a,this.width);eR(a,0);eR(a,this.height);eR(a,0);a.getPosition()};_.w(tR,Z);tR.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
49
+ tR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(bR(a,0),bR(a,0),_.W(a,this.timescale),bR(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));eR(a,this.language);eR(a,0);a.getPosition()};_.w(uR,Z);uR.prototype.a=function(){return 33+Z.prototype.a.call(this)};
50
+ uR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);this.f===_.Tg?_.iq(a,iR("vide")):_.iq(a,iR("soun"));_.W(a,0);_.W(a,0);_.W(a,0);this.f===_.Tg?_.iq(a,iR("VideoHandler\x00")):_.iq(a,iR("SoundHandler\x00"));a.getPosition()};_.w(vR,Z);vR.prototype.a=function(){return 2+this.f.byteLength+Z.prototype.a.call(this)};vR.prototype.write=function(a){Z.prototype.write.call(this,a);eR(a,0);_.iq(a,this.f);a.getPosition()};_.w(wR,jR);wR.prototype.a=function(){return 8+jR.prototype.a.call(this)};
51
+ wR.prototype.write=function(a){jR.prototype.write.call(this,a);_.W(a,0);eR(a,0);eR(a,1)};_.w(xR,wR);xR.prototype.a=function(){return 70+wR.prototype.a.call(this)};xR.prototype.write=function(a){wR.prototype.write.call(this,a);eR(a,0);eR(a,0);_.W(a,0);_.W(a,0);_.W(a,0);eR(a,this.width);eR(a,this.height);_.W(a,4718592);_.W(a,4718592);_.W(a,0);eR(a,1);cR(a,10);_.iq(a,iR("AVC Coding",31));eR(a,this.depth);gR(a,-1)};_.w(yR,wR);yR.prototype.a=function(){return 20+wR.prototype.a.call(this)};
52
+ yR.prototype.write=function(a){wR.prototype.write.call(this,a);_.W(a,0);_.W(a,0);eR(a,this.channelCount);eR(a,this.sampleSize);gR(a,0);eR(a,0);eR(a,this.sampleRate);eR(a,0)};_.w(zR,xR);zR.prototype.write=function(a){xR.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};_.w(AR,zR);_.w(BR,yR);BR.prototype.write=function(a){yR.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};
53
+ _.w(CR,BR);_.w(DR,jR);DR.prototype.a=function(){for(var a=7,b=0;b<this.sb.length;b++)a+=2,a+=this.sb[b].byteLength;for(b=0;b<this.sb.length;b++)a+=2,a+=this.Kc[b].byteLength;return a+jR.prototype.a.call(this)};
54
+ DR.prototype.write=function(a){jR.prototype.write.call(this,a);cR(a,this.version);cR(a,this.f);cR(a,this.h);cR(a,this.level);cR(a,255);cR(a,224|this.sb.length);for(var b=0;b<this.sb.length;b++)eR(a,this.sb[b].length),_.iq(a,this.sb[b]);cR(a,this.Kc.length);for(b=0;b<this.Kc.length;b++)eR(a,this.Kc[b].length),_.iq(a,this.Kc[b]);a.getPosition()};_.w(ER,Z);ER.prototype.a=function(){return 22+(this.Ac.byteLength+3)+Z.prototype.a.call(this)};
55
+ ER.prototype.write=function(a){Z.prototype.write.call(this,a);cR(a,3);cR(a,23+this.Ac.byteLength);eR(a,1);cR(a,0);cR(a,4);cR(a,15+this.Ac.byteLength);cR(a,64);cR(a,21);dR(a,0);_.W(a,0);_.W(a,0);cR(a,5);cR(a,this.Ac.byteLength);_.iq(a,this.Ac);_.iq(a,new Uint8Array([6,1,2]));a.getPosition()};_.w(FR,Z);FR.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};FR.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.iq(a,iR(this.location));a.getPosition()};
56
+ _.w(GR,Z);GR.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)};GR.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(HR,jR);_.w(IR,Z);IR.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
+ IR.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(JR,Z);JR.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)};JR.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(KR,Z);
58
+ KR.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)};KR.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(LR,Z);LR.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
+ LR.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(MR,Z);MR.prototype.a=function(){return 8+Z.prototype.a.call(this)};MR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);_.W(a,0);a.getPosition()};_.w(NR,Z);NR.prototype.a=function(){return 4+Z.prototype.a.call(this)};NR.prototype.write=function(a){Z.prototype.write.call(this,a);gR(a,0);eR(a,0);a.getPosition()};
60
+ _.w(OR,jR);_.w(PR,jR);_.w(QR,jR);_.w(RR,Z);RR.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};RR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?bR(a,this.baseMediaDecodeTime):_.W(a,this.baseMediaDecodeTime);a.getPosition()};_.w(SR,Z);SR.prototype.a=function(){return 4+Z.prototype.a.call(this)};SR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);a.getPosition()};_.w(TR,Z);
61
+ TR.prototype.a=function(){var a=4;this.flags&1&&(a+=4);this.flags&4&&(a+=4);for(var b=0;b<this.f;b++)this.flags&256&&(a+=4),this.flags&512&&(a+=4),this.flags&1024&&(a+=4),this.flags&2048&&(a+=4);return a+Z.prototype.a.call(this)};
62
+ TR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);this.flags&1&&(a.getPosition(),fR(a,this.j));this.flags&4&&_.W(a,this.l);for(var b=0;b<this.f;b++)this.flags&256&&_.W(a,this.o[b]),this.flags&512&&_.W(a,this.sampleSize[b]),this.flags&1024&&_.W(a,this.A[b]),this.flags&2048&&(0===this.version?_.W(a,this.h[b]):fR(a,this.h[b]));a.getPosition()};_.w(UR,Z);
63
+ UR.prototype.a=function(){var a=4;this.flags&1&&(a+=8);this.flags&2&&(a+=4);this.flags&8&&(a+=4);this.flags&16&&(a+=4);this.flags&32&&(a+=4);return a+Z.prototype.a.call(this)};UR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);this.flags&1&&bR(a,this.h);this.flags&2&&_.W(a,this.A);this.flags&8&&_.W(a,this.j);this.flags&16&&_.W(a,this.o);this.flags&32&&_.W(a,this.l);a.getPosition()};_.w(VR,jR);_.w(WR,jR);_.w(YR,jR);YR.prototype.a=function(){return this.f.byteLength+jR.prototype.a.call(this)};
64
+ YR.prototype.write=function(a){jR.prototype.write.call(this,a);0<this.f.byteLength&&_.iq(a,this.f)};_.w(ZR,Z);ZR.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)};ZR.prototype.write=function(a){Z.prototype.write.call(this,a);cR(a,0);0===this.version?cR(a,0):cR(a,0);cR(a,this.f);cR(a,this.h);_.iq(a,_.Qm(this.l));if(1===this.f&&0===this.h){cR(a,0);for(var b=0;b<this.j.length;b++)cR(a,this.j[b])}a.getPosition()};_.w($R,Z);
65
+ $R.prototype.a=function(){var a=8;this.flags&1&&(a+=iR(this.tc).byteLength);return a+Z.prototype.a.call(this)};$R.prototype.write=function(a){Z.prototype.write.call(this,a);_.iq(a,iR(this.f));_.W(a,this.h);this.flags&1&&_.iq(a,iR(this.tc));a.getPosition()};_.w(aS,jR);aS.prototype.a=function(){return iR(this.f).byteLength+jR.prototype.a.call(this)};aS.prototype.write=function(a){jR.prototype.write.call(this,a);_.iq(a,iR(this.f));a.getPosition()};_.w(bS,Z);
66
+ bS.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)};bS.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));_.W(a,1);for(var b=0;1>b;b++)0===this.version?_.W(a,this.offset[b]):bR(a,this.offset[b]);a.getPosition()};_.w(cS,Z);cS.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)};
67
+ cS.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));cR(a,this.f);_.W(a,this.h);if(0===this.f)for(var b=0;b<this.h;b++)cR(a,this.j[b]);a.getPosition()};_.w(dS,Z);dS.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.h;b++)if(a+=this.f[b].Wi.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)};
68
+ dS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.h);this.flags&1&&cR(a,this.j);for(var b=0;b<this.h;b++)if(_.iq(a,this.f[b].Wi),this.flags&2){eR(a,this.f[b].Xd);for(var c=0;c<this.f[b].Xd;c++)eR(a,this.f[b].vh[c].Vh),_.W(a,this.f[b].vh[c].Wh)}a.getPosition()};var kS=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,lS=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,mS=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,nS=/^(\d*\.?\d*)f$/,oS=/^(\d*\.?\d*)t$/,pS=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;tS.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};tS.prototype.write=function(){this.f=sS(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var wS=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.r=CS.prototype;_.r.configure=function(a){this.f=a};_.r.start=function(a,b){var c=this;this.F=b;var d=_.uh(new Set([a,eS(a)])).concat();return DS(this,d).then(function(e){return KS(c,e.data).then(function(){PS(c,c.B);return c.j})})};_.r.requestStop=function(){};_.r.stop=function(){this.F&&this.F.networkingEngine.Ve(this.L);this.B=this.A=this.j=this.f=this.F=null;this.l&&(clearTimeout(this.l),this.l=null);this.K=!1;this.J=this.G=Infinity;return Promise.resolve()};
69
+ _.r.update=function(){var a=this;if(this.me())return DS(this,[this.o]).then(function(b){return KS(a,b.data).then(function(){return a.j})})["catch"](function(b){if(a.F)a.F.onError(b)})};_.r.setCurrentVariant=function(){};_.r.rc=function(){var a=this;this.g.debug(_.RB);this.F&&(this.l=null,this.update().then(function(){PS(a,a.B)})["catch"](function(b){a.F&&(a.F.onError(b),1===b.severity&&PS(a,100))}))};_.r.me=function(){return this.M===GS};_.r.Rg=function(){return 0<this.w.length};
70
+ _.r.Ji=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};
71
+ _.r.Qo=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.me.bind(this),Mf:this.Rg.bind(this),Bm:function(){return 1},Kf:this.Ji.bind(this)},d=!1,e=new _.O(_.P,3,4035,null),f=null;try{var g=this.H.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.g.debug("Using base media decode time "+g+" instead of segment reference time "+a.request.startTime);f=yS(a,b,g,c)}catch(k){d=
72
+ !0,e.data=k,3E3===k.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(_.HB+a);return f["return"](d)})};var NS={video:_.Vg,audio:_.Xc,text:_.Pc},BS=_.Vb,GS="LIVE",OS={Ap:_.hd,Hp:_.qg};_.w(QS,_.jv);QS.prototype.install=function(){_.ew.ism=CS;_.dw[_.Qc]=CS};QS.prototype.uninstall=function(){_.pE("ism");_.qE(_.Qc)};QS.prototype.id=function(){return _.hg};_.K("clpp.smooth.SmoothComponent",QS);};
73
73
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
74
74
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
75
75
  else{_=this.clpp._;(f.call(g,this));}
@@ -1,30 +1,30 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var Mz="No thumbnail found for position: ",Nz="Position is out of range: ",Oz="Thumbnail URL is mandatory",Pz="Wrong gridSize format",Qz="clpp.thumbnails",Rz=function(){this.log=new _.M(Qz);this.player=null;this.a=[];this.w=!1},Tz=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.$e&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return Sz(a,0,e,!!f)})},Promise.resolve())},Sz=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return Uz(a,d).then(function(){return a.a[b].load()}).then(function(){return Sz(a,
3
- e,c,d)})},Uz=function(a,b){return new Promise(function(c){if(b||2!==a.player.getState())c();else a.player.one(_.cd,function(){c()})})},Vz=function(a,b,c,d,e,f,g,k,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;k=void 0===k?1:k;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=k;this.o=l;this.j=m;this.l=n;this.f=null},Wz=function(){Rz.call(this);
4
- this.f=null;this.o=this.h=1;this.j=0},Xz=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Hd=new _.nm},Yz=function(){this.g=new _.M(Qz);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.nm},Zz=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.Hd.resolve()})},aA=function(a,b){return $z(a,b).then(function(c){return new Vz(c,b.time,b.duration)})},$z=function(a,b){return b.load().then(function(){var c=_.Qi(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
- _.Jm(c)})},bA=function(){Rz.call(this);this.f=null},cA=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},dA=function(){Rz.apply(this,arguments)},eA=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{ve:c,uh:d,Mi:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},fA=function(){this.g=new _.M(Qz);this.a=this.m=null},gA=function(a){return a.some(function(b){return 0<
6
- b.thumbStreams.length})},lA=function(a){return a?a===hA||a===iA?new Wz:a===jA?new bA:a===kA?new Yz:null:null},mA=function(a){if(!a)return null;a=new _.vn(a);return a.path.match(/.*\.vtt$/i)?jA:a.path.match(/.*\.bif$/i)?kA:a.path.match(/.*\.(png|jpg|jpeg)$/i)?hA:null},nA=function(){};Rz.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Qf,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&Tz(c,b.preload)})};Vz.prototype.raw=function(){return this.a.cloneNode(!1)};
7
- Vz.prototype.element=function(a,b){var c=this.width,d=this.height,e=this.width/this.height;void 0!==a&&void 0===b&&(b=0);null!==a&&void 0!==a&&(c=a);null!==b&&void 0!==b&&(d=b);c||(c=Math.ceil(d*e));d||(d=Math.ceil(c/e));e=document.createElement(_.Xd);e.style.width=c+_.Nf;e.style.height=d+_.Nf;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))+_.Nf;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Nf;e.style.backgroundPositionY="-"+f*d+_.Nf;return e};
9
- Vz.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(_.Je,f);a.a.removeEventListener(_.qe,e);b(a)};e=function(g){a.a.removeEventListener(_.Je,f);a.a.removeEventListener(_.qe,e);c(new _.O(1,9,2014,"Failed to load thumbnail.",
10
- g))};a.a.addEventListener(_.Je,f);a.a.addEventListener(_.qe,e);a.a.src=a.src}}));return this.f};_.K("clpp.thumbnails.Thumbnail",Vz);Vz.prototype.load=Vz.prototype.load;Vz.prototype.element=Vz.prototype.element;Vz.prototype.raw=Vz.prototype.raw;_.w(Wz,Rz);
11
- Wz.prototype.init=function(a,b){if(!b||!b.url)throw new _.O(1,9,7100,Oz);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,Pz);}catch(d){throw this.log.error("Error during parsing gridSize",d),
12
- new _.O(1,9,7100,Pz);}Rz.prototype.init.call(this,a,b)};Wz.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,Nz+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
- Wz.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 Vz(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()};Xz.prototype.load=function(){return this.Hd};
14
- Yz.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.O(1,9,7100,Oz);var d=b.url,e=_.Zk(d);e.type=_.Yk;a.getNetworkEngine().fetch(e).U.then(function(f){f=f.data;var g=_.Qi(c.f);f=_.Qi(f);for(var k=g.byteLength+f.byteLength,l=new ArrayBuffer(k),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 "+(k+" bytes."));l=c.f;f=_.Qi(l);n=String.fromCharCode.apply(null,
15
- oA);g=Array.prototype.slice.call(f,0,8);f=64;k=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;){k+=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 Xz(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<k)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");
16
- Zz(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))})};Yz.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,Nz+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,Mz+a);return _.x(e,aA(b,c),3);case 3:return d=e.f,_.x(e,d.load(),4);case 4:return e["return"](d)}})};
17
- Yz.prototype.Wb=function(){return 0<this.a.length};var oA=[137,66,73,70,13,10,26,10];_.w(bA,Rz);
18
- bA.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.O(1,9,7100,Oz);var d=b.url,e=_.Zk(d);e.type=_.Yk;this.f=a.getNetworkEngine().fetch(e).U.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.R.ga(f).split(/\n/);for(var g=0;g<f.length;g++){var k=f[g],l=k.split(" --\x3e ");if(2===l.length){k=f[++g];var m=k.indexOf("\x3d"),n=0>m?[]:k.substr(m+1).split(/,/).map(parseFloat);m=n[0];var p=n[1],q=n[2];n=n[3];var t=k.indexOf("#");k=0>t?k:k.substr(0,t);k.match(/^http|^\/\//)||(k=
19
- d.substr(0,d.lastIndexOf("/"))+"/"+k);t=cA(l[0]);l=cA(l[1])-t;c.a.push(new Vz(k,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))});Rz.prototype.init.call(this,a,b)};
20
- bA.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,Nz+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,Mz+a);return _.x(d,c.load(),3)}return d["return"](c)})};bA.prototype.l=function(){return this.f};_.w(dA,Rz);
21
- dA.prototype.get=function(a){function b(){return new _.O(1,9,2014,Mz+a)}var c=this,d,e,f,g,k,l,m,n,p,q,t,u,y;return _.I(function(C){if(1==C.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.O(1,9,2014,Nz+a);d=c.player.getPeriods();for(var D=null,B=_.v(d),E=B.next();!E.done;E=B.next())E=E.value,E.startTime<=a&&(D=E);e=D;if(!e)throw c.log.error("Could not find period for specified position",a),b();f=e.thumbStreams.sort(c.f)[0];if(!f)throw c.log.error("Could not find thumb stream for specified position",a),
22
- b();g=f.findSegmentPosition(a-e.startTime);if(null===g||void 0===g)throw c.log.error("Could not find segment index for specified position",a),b();k=f.getSegmentReference(g);if(!k)return C.C(2);l=eA(k,f);m=Math.floor((a-k.startTime)/l.durationPerTile);0<c.a.length?(p=f.findSegmentPosition(0),null!==p&&(n=c.a[(g-p)*l.Mi+m])):(q=k.Ia())&&0<q.length&&(u=t=0,y=k.startTime,1<l.Mi&&(t=m%l.ve,u=Math.floor(m/l.ve),y+=m*l.durationPerTile),n=new Vz(q[0],y,l.durationPerTile,void 0,void 0,void 0,void 0,l.ve,l.uh,
23
- t,u));return n?_.x(C,n.load(),4):C.C(2)}if(2!=C.a)return C["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};dA.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
- dA.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=eA(d,b),f=d.Ia()[0],g=new Image,k=d.startTime,l=0;l<e.uh;++l)for(var m=0;m<e.ve;++m)this.a.push(new Vz(f,k,e.durationPerTile,void 0,void 0,void 0,void 0,e.ve,e.uh,m,l,g)),k+=e.durationPerTile;return Promise.resolve()};_.r=fA.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=mA(c.url||null));(this.a=lA(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Le,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(gA(d)){this.a=new dA;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"};_.K("clpp.thumbnails.ThumbnailsPlugin",fA);fA.prototype.get=fA.prototype.get;fA.Id="thumbnails";
27
- nA.prototype.create=function(){return new fA};var hA="SINGLE",iA="GRID",jA="WEBVTT",kA="BIF";_.bp(new nA);};
2
+ var f=function(window){var Tz="No thumbnail found for position: ",Uz="Position is out of range: ",Vz="Thumbnail URL is mandatory",Wz="Wrong gridSize format",Xz="clpp.thumbnails",Yz=function(){this.log=new _.M(Xz);this.player=null;this.a=[];this.w=!1},$z=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.$e&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return Zz(a,0,e,!!f)})},Promise.resolve())},Zz=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return aA(a,d).then(function(){return a.a[b].load()}).then(function(){return Zz(a,
3
+ e,c,d)})},aA=function(a,b){return new Promise(function(c){if(b||2!==a.player.getState())c();else a.player.one(_.dd,function(){c()})})},bA=function(a,b,c,d,e,f,g,k,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;k=void 0===k?1:k;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=k;this.o=l;this.j=m;this.l=n;this.f=null},cA=function(){Yz.call(this);
4
+ this.f=null;this.o=this.h=1;this.j=0},dA=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Rd=new _.rm},eA=function(){this.g=new _.M(Xz);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.rm},fA=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.Rd.resolve()})},hA=function(a,b){return gA(a,b).then(function(c){return new bA(c,b.time,b.duration)})},gA=function(a,b){return b.load().then(function(){var c=_.Vi(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
+ _.Nm(c)})},iA=function(){Yz.call(this);this.f=null},jA=function(a){a=a.split(/\.|:/).map(parseFloat);var b=0,c,d={3:.001,2:1,1:60,0:3600};for(c=a.length-1;0<=c;c--)b+=a[c]*d[c];return b},kA=function(){Yz.apply(this,arguments)},lA=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Ge:c,Fh:d,Vi:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},mA=function(){this.g=new _.M(Xz);this.a=this.m=null},nA=function(a){return a.some(function(b){return 0<
6
+ b.thumbStreams.length})},sA=function(a){return a?a===oA||a===pA?new cA:a===qA?new iA:a===rA?new eA:null:null},tA=function(a){if(!a)return null;a=new _.zn(a);return a.path.match(/.*\.vtt$/i)?qA:a.path.match(/.*\.bif$/i)?rA:a.path.match(/.*\.(png|jpg|jpeg)$/i)?oA:null},uA=function(){};Yz.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Sf,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&$z(c,b.preload)})};bA.prototype.raw=function(){return this.a.cloneNode(!1)};
7
+ bA.prototype.element=function(a,b){var c=this.width,d=this.height,e=this.width/this.height;void 0!==a&&void 0===b&&(b=0);null!==a&&void 0!==a&&(c=a);null!==b&&void 0!==b&&(d=b);c||(c=Math.ceil(d*e));d||(d=Math.ceil(c/e));e=document.createElement(_.Xd);e.style.width=c+_.Pf;e.style.height=d+_.Pf;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))+_.Pf;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Pf;e.style.backgroundPositionY="-"+f*d+_.Pf;return e};
9
+ bA.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(_.Ke,f);a.a.removeEventListener(_.qe,e);b(a)};e=function(g){a.a.removeEventListener(_.Ke,f);a.a.removeEventListener(_.qe,e);c(new _.O(1,9,2014,"Failed to load thumbnail.",
10
+ g))};a.a.addEventListener(_.Ke,f);a.a.addEventListener(_.qe,e);a.a.src=a.src}}));return this.f};_.K("clpp.thumbnails.Thumbnail",bA);bA.prototype.load=bA.prototype.load;bA.prototype.element=bA.prototype.element;bA.prototype.raw=bA.prototype.raw;_.w(cA,Yz);
11
+ cA.prototype.init=function(a,b){if(!b||!b.url)throw new _.O(1,9,7100,Vz);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,Wz);}catch(d){throw this.log.error("Error during parsing gridSize",d),
12
+ new _.O(1,9,7100,Wz);}Yz.prototype.init.call(this,a,b)};cA.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,Uz+a);d=b.f.duration;e=Math.floor(a/d);f=b.a[e];if(!f)throw new _.O(1,9,2014,"No thumbnail found for position "+a+" at index "+e);return _.y(g,f.load(),2)}return g["return"](f)})};
13
+ cA.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getDuration(),b=this.h*this.o;a=Math.ceil(Math.ceil(a/this.j)/b);for(var c=this.f.templateKey||"$index$",d=0;d<a;d++)for(var e=this.f.url.replace(c,String(d+1)),f=new Image,g=0;g<b;g++)this.a.push(new bA(e,this.j*(d*b+g),this.j,0,0,0,0,this.h,this.o,g%this.h,Math.floor(g/this.h),f));return Promise.resolve()};dA.prototype.load=function(){return this.Rd};
14
+ eA.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.O(1,9,7100,Vz);var d=b.url,e=_.dl(d);e.type=_.bl;a.getNetworkEngine().fetch(e).U.then(function(f){f=f.data;var g=_.Vi(c.f);f=_.Vi(f);for(var k=g.byteLength+f.byteLength,l=new ArrayBuffer(k),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 "+(k+" bytes."));l=c.f;f=_.Vi(l);n=String.fromCharCode.apply(null,
15
+ vA);g=Array.prototype.slice.call(f,0,8);f=64;k=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;){k+=1;g=l;n=new DataView(c.f,f);m=n.getUint32(0,!0);g=m*g/1E3;n=n.getUint32(4,!0);n=new dA(g,n);if(g=c.a.length)g=c.a[g-1],g.length=n.offset-g.offset,g.duration=n.time-g.time;c.a.push(n);f+=8;(m=4294967295===m)&&c.h.resolve();if(1E5<k)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");
16
+ fA(c)})["catch"](function(f){c.g.error("[BIF] Error while loading thumbnails '\n + 'URL: "+d,f);a.onError(new _.O(1,9,2013,"Error while loading and parsing BIF thumbnails.",f))})};eA.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,Uz+a);return _.y(e,b.h,2);case 2:c=b.a.find(function(f){return a>=f.time&&a<f.time+f.duration});if(!c)throw new _.O(1,9,2014,Tz+a);return _.y(e,hA(b,c),3);case 3:return d=e.f,_.y(e,d.load(),4);case 4:return e["return"](d)}})};
17
+ eA.prototype.Zb=function(){return 0<this.a.length};var vA=[137,66,73,70,13,10,26,10];_.w(iA,Yz);
18
+ iA.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.O(1,9,7100,Vz);var d=b.url,e=_.dl(d);e.type=_.bl;this.f=a.getNetworkEngine().fetch(e).U.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 k=f[g],l=k.split(" --\x3e ");if(2===l.length){k=f[++g];var m=k.indexOf("\x3d"),n=0>m?[]:k.substr(m+1).split(/,/).map(parseFloat);m=n[0];var p=n[1],q=n[2];n=n[3];var t=k.indexOf("#");k=0>t?k:k.substr(0,t);k.match(/^http|^\/\//)||(k=
19
+ d.substr(0,d.lastIndexOf("/"))+"/"+k);t=jA(l[0]);l=jA(l[1])-t;c.a.push(new bA(k,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))});Yz.prototype.init.call(this,a,b)};
20
+ iA.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,Uz+a);return _.y(d,b.f,2)}if(3!=d.a){c=b.a.find(function(e){return a>=e.time&&a<e.time+e.duration});if(!c)throw new _.O(1,9,2014,Tz+a);return _.y(d,c.load(),3)}return d["return"](c)})};iA.prototype.l=function(){return this.f};_.w(kA,Yz);
21
+ kA.prototype.get=function(a){function b(){return new _.O(1,9,2014,Tz+a)}var c=this,d,e,f,g,k,l,m,n,p,q,t,u,z;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 _.O(1,9,2014,Uz+a);d=c.player.getPeriods();for(var D=null,C=_.v(d),E=C.next();!E.done;E=C.next())E=E.value,E.startTime<=a&&(D=E);e=D;if(!e)throw c.log.error("Could not find period for specified position",a),b();f=e.thumbStreams.sort(c.f)[0];if(!f)throw c.log.error("Could not find thumb stream for specified position",a),
22
+ b();g=f.findSegmentPosition(a-e.startTime);if(null===g||void 0===g)throw c.log.error("Could not find segment index for specified position",a),b();k=f.getSegmentReference(g);if(!k)return B.C(2);l=lA(k,f);m=Math.floor((a-k.startTime)/l.durationPerTile);0<c.a.length?(p=f.findSegmentPosition(0),null!==p&&(n=c.a[(g-p)*l.Vi+m])):(q=k.Ia())&&0<q.length&&(u=t=0,z=k.startTime,1<l.Vi&&(t=m%l.Ge,u=Math.floor(m/l.Ge),z+=m*l.durationPerTile),n=new bA(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.Ge,l.Fh,
23
+ t,u));return n?_.y(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();})};kA.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
+ kA.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.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=lA(d,b),f=d.Ia()[0],g=new Image,k=d.startTime,l=0;l<e.Fh;++l)for(var m=0;m<e.Ge;++m)this.a.push(new bA(f,k,e.durationPerTile,void 0,void 0,void 0,void 0,e.Ge,e.Fh,m,l,g)),k+=e.durationPerTile;return Promise.resolve()};_.r=mA.prototype;_.r.onPlayerCreated=function(a){this.m=a};_.r.onPlayerWillDestroy=function(){this.m=null};_.r.onPlayerWillRelease=function(){this.a=null};
25
+ _.r.onContentWillLoad=function(a){var b=this,c=a.getConfiguration().thumbnails;if(c)if(!1===c.enabled)this.g.info("Thumbnails disabled.");else{var d=c.mode||null;d||(d=tA(c.url||null));(this.a=sA(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Me,function(){b.g.info("Initialize thumbnails provider");try{b.a.init(a,c)}catch(e){b.m.onError(e)}})):this.g.warn("Unknown thumbnail mode",d)}else this.a=null};
26
+ _.r.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);if(!this.a&&(c=(c=a.getConfiguration())&&c.thumbnails,!c||void 0===c.enabled||c.enabled)){var d=a.getPeriods();if(nA(d)){this.a=new kA;try{this.a.init(a,c)}catch(e){this.m.onError(e)}}}};_.r.get=function(a){return this.a?this.a.get(a):Promise.reject(new _.O(1,9,2014,"Thumbnail format is not supported"))};_.r.id=function(){return"thumbnails"};_.K("clpp.thumbnails.ThumbnailsPlugin",mA);mA.prototype.get=mA.prototype.get;mA.Id="thumbnails";
27
+ uA.prototype.create=function(){return new mA};var oA="SINGLE",pA="GRID",qA="WEBVTT",rA="BIF";_.fp(new uA);};
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));}