@castlabs/prestoplay 6.17.1 → 6.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +115 -114
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +575 -565
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +77 -74
  10. package/cjs/cl.externs.js +175 -293
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +70 -69
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -29
  15. package/cjs/cl.ima.js +24 -24
  16. package/cjs/cl.mse.js +315 -314
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.sessions.js +16 -15
  22. package/cjs/cl.simid.js +15 -15
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +71 -71
  26. package/cjs/cl.ttml.js +29 -28
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +13 -13
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.youbora.js +18 -18
  32. package/cl.adobe.js +3 -3
  33. package/cl.airplay.js +3 -3
  34. package/cl.broadpeak.js +5 -5
  35. package/cl.cast.js +90 -89
  36. package/cl.conviva.js +27 -27
  37. package/cl.core.js +473 -466
  38. package/cl.crypto.js +9 -9
  39. package/cl.dash.js +72 -70
  40. package/cl.externs.js +172 -294
  41. package/cl.freewheel.js +19 -19
  42. package/cl.hls.js +74 -72
  43. package/cl.hlssmpte.js +5 -5
  44. package/cl.htmlcue.js +26 -26
  45. package/cl.ima.js +17 -17
  46. package/cl.mse.js +276 -273
  47. package/cl.muxdata.js +13 -13
  48. package/cl.onboard.js +4 -4
  49. package/cl.persistent.js +11 -11
  50. package/cl.playlist.js +5 -5
  51. package/cl.sessions.js +10 -10
  52. package/cl.simid.js +13 -13
  53. package/cl.smooth.js +59 -59
  54. package/cl.thumbnails.js +19 -19
  55. package/cl.tizen.js +57 -57
  56. package/cl.ttml.js +22 -22
  57. package/cl.verimatrix.js +4 -4
  58. package/cl.vimond.js +8 -8
  59. package/cl.vr.js +15 -15
  60. package/cl.vtt.js +12 -12
  61. package/cl.youbora.js +15 -15
  62. package/clpp.styles.css +14 -0
  63. package/package.json +2 -2
  64. package/typings.d.ts +406 -377
package/cjs/cl.smooth.js CHANGED
@@ -1,76 +1,76 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var mP="Full MP4 box must have flags defined",nP="clpp.smooth.SmoothMP4Processor",oP="codecPrivateData",pP=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)},qP=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.Dm()}},rP=function(a,b){qP(a,b>>16&255);qP(a,b>>8&255);qP(a,b&255)},sP=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.Dm()}},tP=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.Dm()}},uP=function(a,b){try{a.f.setInt16(a.a,
3
- b,a.h),a.a+=2}catch(c){_.Dm()}},vP=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},wP=function(a){this.type=a;this.size=this.start=0;this.parent=null;this.A=!1;this.entries=[];this.f=[]},Z=function(a,b,c){wP.call(this,a);this.version=b;this.flags=c},xP=function(a,b,c){wP.call(this,a);this.h=b;this.offset=c},yP=function(a,b,c,
4
- d,e){Z.call(this,a,b,c);this.h=d;this.offset=e},zP=function(a,b,c){wP.call(this,"ftyp");this.j=a;this.Mh=b;this.h=c},AP=function(){wP.call(this,_.Te)},BP=function(){wP.call(this,_.sg)},CP=function(a,b,c){Z.call(this,"mvhd",1,0);this.timescale=a;this.duration=b;this.volume=256;this.j=c+1;this.h=[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]},DP=function(){wP.call(this,"mvex")},EP=function(a){Z.call(this,"trex",0,0);this.h=a},FP=function(a,b,c,d,e){Z.call(this,"tkhd",1,7);
5
- this.j=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.h=[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]},GP=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},HP=function(a){Z.call(this,"hdlr",0,0);this.h=a},IP=function(){Z.call(this,"vmhd",0,1);this.h=new Uint8Array([0,0,0,0,0,0])},JP=function(a){wP.call(this,a);this.A=!0},KP=function(a){JP.call(this,a);this.height=this.width=0;this.depth=24},LP=
6
- function(a,b,c,d){JP.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},MP=function(a,b){KP.call(this,"avc1");this.width=a;this.height=b},NP=function(a,b){MP.call(this,a,b);this.type="encv"},OP=function(a,b,c){LP.call(this,"mp4a",a,b,c)},PP=function(a,b,c){OP.call(this,a,b,c);this.type="enca"},QP=function(a,b){wP.call(this,"avcC");this.Ua=a;this.ac=b;this.version=1;this.h=this.Ua[0][1];this.j=this.Ua[0][2];this.level=this.Ua[0][3]},RP=function(a){Z.call(this,"esds",0,0);this.Qb=
7
- a},SP=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},TP=function(){Z.call(this,"dref",0,0)},UP=function(){wP.call(this,_.ig)},VP=function(){Z.call(this,_.kg,0,0)},WP=function(){Z.call(this,"stts",0,0)},XP=function(){Z.call(this,"stsc",0,0)},YP=function(){Z.call(this,"stco",0,0)},ZP=function(){Z.call(this,"stsz",0,0)},$P=function(){Z.call(this,"smhd",0,0)},aQ=function(){wP.call(this,"dinf")},bQ=function(){wP.call(this,_.Se)},cQ=function(){wP.call(this,_.Oe)},dQ=function(a,b){Z.call(this,
8
- "tfdt",a,0);this.baseMediaDecodeTime=b},eQ=function(){Z.call(this,"mfhd",0,0);this.h=0},fQ=function(a,b){Z.call(this,"trun",a,b);this.o=this.l=this.h=0;this.w=[];this.sampleSize=[];this.B=[];this.j=[]},gQ=function(a,b){Z.call(this,"tfhd",a,b);this.h=255;this.o=this.w=this.l=this.B=this.j=0},hQ=function(){wP.call(this,"traf")},iQ=function(){wP.call(this,"moof")},jQ=function(){wP.call(this,_.Ne);this.h=new Uint8Array(0)},kQ=function(){Z.call(this,"tenc",0,0);this.h=1;this.j=8;this.o="";this.l=[]},lQ=
9
- function(a,b){Z.call(this,"schm",0,0);this.h=a;this.j=b;this.Kb=""},mQ=function(a){wP.call(this,"frma");this.h=a},nQ=function(){Z.call(this,"saio",0,0);this.offset=[0]},oQ=function(a,b,c){Z.call(this,"saiz",0,0);this.h=a;this.l=b;this.j=c},pQ=function(a,b){Z.call(this,"senc",a,b);this.j=0;this.l=8;this.h=[]},qQ=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},rQ=function(a,b,c,d){c=b.kh[c];b=b.xn;a=a.replace("Manifest","");b=b.replace("{bitrate}",
10
- String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.DC([a],[b])[0]},sQ=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.r?c=["maxWidth","maxHeight","bitrate",oP,"fourCC"]:a.type===_.ad&&(c=["bitrate",oP,"channels","bitsPerSample","samplingRate","fourCC"]);return _.O.la(a,b,c,["id","segmentIndex"])},tQ=function(a,b,c){var d=c.se.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Ua:null,
11
- ac:null,width:NaN,height:NaN,Qb:null,Yd:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.r:a.Ua=[_.yj(d[1])];a.ac=[_.yj(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.ad:a.Qb=_.yj(c.se),a.sampleSize=c.Vi||16,a.Yd=c.Yd,a.channelCount=c.Cg}return a},uQ=function(a,b){return a.filter(function(c){return c.type===b})},vQ=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},CQ=function(a,b,
12
- c){var d=null;if(wQ.test(a)){a=wQ.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 xQ.test(a)?d=vQ(xQ,a):yQ.test(a)?d=vQ(yQ,a):zQ.test(a)?(a=zQ.exec(a),d=Number(a[1])/c.frameRate):AQ.test(a)?(a=AQ.exec(a),d=Number(a[1])/c.a):BQ.test(a)&&(d=vQ(BQ,a));d+=b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-3600*b-60*c);d-=a;10>b&&(b="0"+b);10>c&&(c="0"+c);10>a&&(a="0"+a);0===d?d="000":d=Math.round(1E3*
13
- d);return b+":"+c+":"+a+"."+d},DQ=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))},FQ=function(a){this.a=a;this.f=EQ(this)},EQ=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.Cm(b)},GQ=function(a,b,c){a:{var d=_.w([_.Td,_.Rd]);for(var e=d.next();!e.done;e=d.next())if((e=c.xe(e.value))&&e.keyId){d=e.keyId;break a}_.Fh(nP,
14
- "Could not get default Key ID for DRM init data!");d=null}c=new wP("xxxx");a.type===_.r?c=new NP(a.width,a.height):c=new PP(a.channelCount,a.sampleSize,a.Yd);a=new kQ;a.h=1;a.j=8;a.o=d||"00000000000000000000000000000000";a=(new wP("schi")).append([a]);b=(new wP(_.cg)).append([new mQ(b),new lQ(_.td,65536),a]);c.append([b]);return c},HQ=function(a,b){var c=b.Ae(),d=new CP(a.timescale,a.duration,a.id),e=(new DP).append([new EP(a.id)]),f=new FP(a.id,a.duration,a.timescale,a.width,a.height),g=new GP(a.timescale,
15
- a.duration),h=new HP(a.type),l=null,m=new TP;m.entries=[new SP];var n=new VP;switch(a.type){case _.r:var p=new QP(a.Ua,a.ac);c?(l=GQ(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new MP(a.width,a.height)).append([p]),n.entries=[l]);l=new IP;break;case _.ad:p=new RP(a.Qb),c?(l=GQ(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new OP(a.channelCount,a.sampleSize,a.Yd)).append([p]),n.entries=[l]),l=new $P}n=(new UP).append([n,new WP,new XP,new ZP,new YP]);m=(new aQ).append([m]);m=(new bQ).append([l,m,n]);
16
- g=(new cQ).append([g,h,m]);f=(new BP).append([f,g]);d=(new AP).append([d,f,e]);e=new zP("dash",0,["iso6","mp41","avc1"]);c&&(c=b.xe(_.Rd),f=b.xe(_.Td),c&&d.append([new xP("pssh",c.initData,8)]),f&&d.append([new xP("pssh",f.initData,8)]),c||f||_.Fh(nP,"Could not get PSSH init data!"));c=new FQ([e,d]);return _.lj(c.write())},JQ=function(a,b){var c,d,e,f,g,h;(new _.Pm).M("moof",_.Qm).Y("mfhd",function(m){var n=new eQ;n.h=_.Km(m.reader);c=n}).M("traf",_.Qm).Y("tfhd",function(m){var n=m.reader.Ha();if(null===
17
- m.flags)throw new _.P(_.Q,3,3019,mP);var p=new gQ(m.version||0,m.flags||0);p.h=_.Km(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.Mm(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.B=_.Km(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.l=_.Km(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.w=_.Km(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.o=_.Km(m.reader));d=p}).Y("trun",function(m){var n=m.reader.Ha();if(null===m.flags)throw new _.P(_.Q,3,3019,mP);var p=new fQ(m.version||
18
- 0,m.flags||0);p.h=_.Km(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.l=_.Lm(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.o=_.Km(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.h;n++)m.flags&256&&p.w.push(_.Km(m.reader)),m.flags&512&&p.sampleSize.push(_.Km(m.reader)),m.flags&1024&&p.B.push(_.Km(m.reader)),m.flags&2048&&(0===m.version?p.j.push(_.Km(m.reader)):p.j.push(_.Lm(m.reader)));e=p}).Y("sdtp",function(m){var n=_.Om(m.reader,m.reader.Ha());f=new yP("sdtp",m.version||0,m.flags||
19
- 0,n,0)}).M("uuid",function(m){var n=_.Om(m.reader,16);if(_.Aj(n,IQ)){n=_.Km(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new pQ(m.version,m.flags);n.j=_.Km(m.reader);m.flags&1&&(n.l=_.Im(m.reader));for(var p=0;p<n.j;p++){var q={zh:_.Om(m.reader,8),hd:0,ig:[]};if(m.flags&2){q.hd=_.Jm(m.reader);for(var u=0;u<q.hd;u++){var v={Ag:0,Bg:0};v.Ag=_.Jm(m.reader);v.Bg=_.Km(m.reader);q.ig.push(v)}}n.h.push(q)}g=n}}).M(_.Ne,function(m){var n=new jQ;0<m.reader.Ha()?n.h=_.Om(m.reader,m.reader.Ha()):(_.Fh(nP,
20
- "mdat box is empty!"),n.h=new Uint8Array(0));h=n}).parse(a,!1);if(!h)return null;var l=(new hQ).append([d,e]);f&&l.append([f]);b.Ae()&&g&&l.append([g]);l=(new iQ).append([c,l]);return new FQ([l,h])},KQ=function(a,b,c,d){var e=d.Ae(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=JQ(b,d);if(null===g)return a.request.contentType===_.R?a.data:g;d=g.get(_.Ne);if(a.request.contentType===_.R){e=d.h.buffer;if(c){e=_.S.Bd(e);if((e=(new DOMParser).parseFromString(e,_.qg))&&"tt"===e.documentElement.tagName.toLowerCase())var h=
21
- e.documentElement;if(h&&(d=new DQ(h.getAttribute("ttp:frameRate"),h.getAttribute("ttp:subFrameRate"),h.getAttribute("ttp:frameRateMultiplier"),h.getAttribute("ttp:tickRate")),h=h.getElementsByTagName("body")[0]))for(h=h.getElementsByTagName("p"),a=0,b=h.length;a<b;a++){f=h[a];g=c;for(var l=["begin",_.pe],m=0,n=l.length;m<n;m++){b:{var p=f;var q=l[m],u=new RegExp("\\w+:"+q),v=0;if(p.hasAttribute(q))p=p.getAttribute(q);else{q=p.attributes;for(var z=q.length;v<z;v++){var C=q[v].name;if(C=C.match(u)){p=
22
- p.getAttribute(C[0]);break b}}p=null}}f.setAttribute(l[m],CQ(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.S.Va(e).buffer}else c=e;return c}h=new iQ;a=g.get("mfhd");b=new hQ;l=g.get("tfhd");m=new dQ(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");l.h=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.j;m++)l.push(10+6*c.h[m].hd);else g=8;b.append([c,new nQ,new oQ(g,l,c.j)])}h.append([a,b]);f.flags|=1;f.l=h.a()+8;d=
23
- new FQ([h,d]);h=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=c.start+16,d.seek(e.start),e.write(d),h=d.buffer);return h},LQ=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},MQ=function(a,b,c){a=_.Sn(a);c&&a.version!==c&&(a=_.tC(a,c));return{initData:_.rC(a),initDataType:_.td,keyId:b,periodId:null}},OQ=function(){this.w=this.h=this.f=
24
- this.C=null;this.N=1;this.S=0;this.l="";this.B=this.a=null;this.g=new _.K("clpp.smooth.SmoothParser");this.J=!1;this.j=this.A=null;this.L=NQ;this.H=0;this.D=this.I=Infinity;this.o=[];this.K=this.Xm.bind(this);this.G=new Map},PQ=function(a,b){var c,d,e;return _.H(function(f){if(1==f.a)return c=_.Jj(b),c.timeout=a.f.attemptParameters.timeout,c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length),c.baseDelay=a.f.attemptParameters.baseDelay,c.backoffFactor=a.f.attemptParameters.backoffFactor,
25
- c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.C.networkingEngine.fetch(c),_.y(f,d.P,2);e=f.f;a.l=e.uri;return f["return"](e)})},WQ=function(a,b){var c=null;try{var d=new DOMParser;try{var e=_.S.Bd(b);var f=d.parseFromString(e.trim(),_.qg)}catch(oI){throw oI;}if(f&&f.documentElement.tagName===_.cc)var g=f.documentElement;c=g&&0<g.getElementsByTagName("parsererror").length?null:g}catch(oI){}if(!c)throw a.g.error("Unable to parse manifest"),new _.P(_.Q,4,4033,a.l);var h=+QQ(a,c,"MajorVersion"),
26
- l=+QQ(a,c,"MinorVersion"),m=+c.getAttribute("TimeScale")||1E7,n=+QQ(a,c,"Duration"),p="TRUE"===c.getAttribute("IsLive"),q=+c.getAttribute("LookAheadCount"),u=+c.getAttribute("DVRWindowLength")||Infinity,v=_.En(c,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+h+"."+l))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.P(_.Q,4,4036,a.l);p?(RQ(a,SQ),a.A=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.H,1E4),n=Infinity):RQ(a,NQ);a.a={startTime:0,delay:0,
27
- duration:n/m,vf:u/m,Rd:0};if(v){var z=a.f.playreadyVersion,C=[],I=_.En(v,"ProtectionHeader")[0],F=_.xj(_.Gn(I)||""),D=_.Sn(F).a;C.push(LQ(_.Td,{initData:_.rC(_.Ln(D)),initDataType:_.td,keyId:D,periodId:null},[D]));C.push(LQ(_.Rd,MQ(F,D,z),[D]));a.o=C}var G=[],M=_.En(c,"StreamIndex");if(!M.length)throw a.g.error("No streams found!"),new _.P(_.Q,4,4034,a.l);for(var N=0;N<M.length;N++){for(var U,oa=a,Ca=M[N],ab=QQ(oa,Ca,"Type"),bb=+Ca.getAttribute("Chunks"),Qa=Ca.getAttribute("Subtype"),Da=Ca.getAttribute("Language")||
28
- _.vg,fb=_.dj(Da),pc=Ca.getAttribute("Name")||"",Ag=+Ca.getAttribute(_.zb),Bg=+Ca.getAttribute(_.yb),nn=QQ(oa,Ca,"Url"),Xt=+Ca.getAttribute("TimeScale")||null,fd=[],on=_.En(Ca,_.Sb),Gu=0;Gu<on.length;Gu++){var Cf=void 0,rc=void 0,Hu=void 0,Df=oa,Gd=on[Gu],Iu=ab,FU=+Gd.getAttribute("Index"),GU=+QQ(Df,Gd,"Bitrate"),rI=NaN,sI=NaN,ko=NaN,Ju=NaN,tI=NaN,uI=NaN,vI=NaN,wI=Gd.getAttribute("FourCC");switch(Iu){case _.r:rI=+QQ(Df,Gd,_.yb);sI=+QQ(Df,Gd,_.zb);break;case _.ad:Ju=+Gd.getAttribute("Channels")||2,
29
- ko=+QQ(Df,Gd,"SamplingRate"),uI=+QQ(Df,Gd,"AudioTag"),tI=+QQ(Df,Gd,"BitsPerSample"),vI=+QQ(Df,Gd,"PacketSize")}var Ku=String(Gd.getAttribute("CodecPrivateData"));if(Iu===_.ad&&!Ku){var xI=Ju,yI={96E3:0,88200:1,64E3:2,48E3:3,44100:4,32E3:5,24E3:6,22050:7,16E3:8,12E3:9,11025:10,8E3:11,7350:12},lo=yI[ko];if("AACH"===wI){rc=new Uint8Array(4);var zI=yI[2*ko];rc[0]=40|lo>>1;rc[1]=lo<<7|xI<<3|zI>>1;rc[2]=zI<<7|8;rc[3]=0;Cf=new Uint16Array(2);Cf[0]=(rc[0]<<8)+rc[1];Cf[1]=(rc[2]<<8)+rc[3];Hu=Cf[0].toString(16)+
30
- Cf[1].toString(16)}else rc=new Uint8Array(2),rc[0]=16|lo>>1,rc[1]=lo<<7|xI<<3,Cf=new Uint16Array(1),Cf[0]=(rc[0]<<8)+rc[1],Hu=Cf[0].toString(16);Ku=Hu.toUpperCase()}var HU={id:Df.S++,type:Iu,index:FU,bitrate:GU,se:Ku,maxHeight:rI,maxWidth:sI,Yd:ko,Cg:Ju,Nn:uI,Vi:tI,co:vI,Ik:wI,segmentIndex:null};fd.push(HU)}U=fd;for(var Me=[],AI=_.En(Ca,"c"),lk=0;lk<AI.length;lk++){var Lu=AI[lk],fe=parseInt(Lu.getAttribute("t"),10),Yh=parseInt(Lu.getAttribute("d"),10),Mu=parseInt(Lu.getAttribute("r"),10),mk=0;if(isNaN(fe)&&
31
- isNaN(Yh))throw oa.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.P(_.Q,4,4037,oa.l);0===lk&&isNaN(fe)&&(mk=fe=0);if(0<lk){var Eg=Me[Me.length-1];mk=Eg.n+1;Eg.d||(Eg.d=fe-Eg.t);fe||(fe=Eg.t+Eg.d);Yh||(Yh=fe-Eg.t)}Me.push({n:mk,d:Yh,t:fe});if(Mu){Mu--;for(var BI=0;BI<Mu;BI++){var mo=Me[Me.length-1];mk=mo.n+1;fe=mo.t+mo.d;Yh=mo.d;Me.push({n:mk,d:Yh,t:fe})}}}oa.sd()||Me.length===bb||oa.g.warn("Number of fragments ("+bb+") differs from number of chunks ("+
32
- Me.length+").");G.push({type:ab,Rn:bb,hn:Qa,language:fb,Qd:Da,name:pc,maxWidth:Ag,maxHeight:Bg,xn:nn,tracks:U,kh:Me,timescale:Xt})}var Ef={ao:h,Mh:l,timescale:m,duration:n,isLive:p,$n:q,vf:u,Ff:!1,streams:G};if(a.h&&a.w)return TQ(a,Ef),Promise.resolve();a.G.clear();var Nu=Ef.timescale,no=Ef.duration,JU=uQ(Ef.streams,_.ad),KU=uQ(Ef.streams,_.r),LU=uQ(Ef.streams,_.R),CI=[],oo=UQ(a,no,Nu,JU),po=UQ(a,no,Nu,KU),MU=UQ(a,no,Nu,LU);oo.length||(oo=[null]);po.length||(po=[null]);for(var Pu=0;Pu<po.length;Pu++)for(var Qu=
33
- 0;Qu<oo.length;Qu++)CI.push(VQ(a,po[Pu],oo[Qu]));var DI={id:"ID",configurationId:void 0,startTime:0,endTime:no,variants:CI,textStreams:MU,thumbStreams:[]};var OU=Ef.streams,Ru=a.a.startTime,EI=a.a.delay,Su=a.I,FI=Math.min(a.a.duration||Infinity,Su),Tu=a.sd(),PU=a.a.vf,QU=a.a.Rd,GI=a.H,HI=isFinite(a.D)?a.D:0;if(Tu)FI=Infinity,Ru=Date.now()/1E3-QU,a.a.startTime=Ru,EI=3*GI;else for(var RU=isFinite(Su)?Su:a.a.duration,II=_.w(OU),Uu=II.next();!Uu.done;Uu=II.next())for(var JI=_.w(Uu.value.tracks),Vu=JI.next();!Vu.done;Vu=
34
- JI.next()){var KI=Vu.value;KI.segmentIndex.offset(-HI);_.aD(KI.segmentIndex,RU)}a.B=new _.iD(a.f.timeline||{},Ru,EI,!Tu,!0);a.B.f=FI;_.qD(a.B,GI);a.B.A=PU;Tu||a.B.offset(-HI);a.C.filterAllPeriods([DI]);a.h={presentationTimeline:a.B,periods:[DI],minBufferTime:0};Promise.resolve();a.J||(a.C.networkingEngine.Nc(a.K),a.J=!0);a.w=Ef;return Promise.resolve()},TQ=function(a,b){for(var c=0;c<a.w.streams.length;c++)for(var d=b.streams[c],e={},f=_.w(a.w.streams[c].tracks),g=f.next();!g.done;e={Ob:e.Ob},g=f.next())if(e.Ob=
35
- g.value,g=d.tracks.find(function(l){return function(m){return m.type===l.Ob.type&&m.bitrate===l.Ob.bitrate}}(e))){sQ(e.Ob,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=XQ(a,a.w.timescale,d,g);g=e.Ob.segmentIndex;g.oa(h);(h=a.a.vf)&&_.HD(g,_.GD(g)-h).forEach(function(l){l.Ra().forEach(function(m){a.G["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.Ob.type+" track with bitrate "+(e.Ob.bitrate+". Skipping update."))},
36
- UQ=function(a,b,c,d){for(var e=[],f={Hc:0};f.Hc<d.length;f={Hc:f.Hc},f.Hc++){var g=d[f.Hc].tracks.map(function(h){return function(l){var m=d[h.Hc],n=XQ(a,c,m,l);n=new _.FD(n);var p=null;m.type!==_.R&&(p=YQ(a,b,c,m,l));l.segmentIndex=n;var q=_.kJ++,u=Promise.resolve.bind(Promise),v=n.find.bind(n),z=n.get.bind(n),C=n.nd.bind(n),I=n.getDuration.bind(n),F=ZQ[m.type],D="";switch(m.type){case _.r:D=l.se;var G=/00000001[0-9]7/.exec(D);D="avc1."+(G&&G[0]?D.substr(D.indexOf(G[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",
37
- D);break;case _.ad:D=l.se,G=2,"AACH"===l.Ik?G=5:D&&(G=(parseInt(D.substr(0,2),16)&248)>>3),D="mp4a.40."+G,a.g.debug("AUDIO CODECS: ",D)}G=m.type===_.R?$Q[m.hn]:void 0;return{id:q,originalId:null,fo:null,createSegmentIndex:u,findSegmentPosition:v,getSegmentReference:z,adjustSegmentDurations:C,getDuration:I,segmentIndex:n,segmentLookupStrategy:_.aC,initSegmentReference:p,mimeType:F,codecs:D,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:G,encrypted:a.Gf(),
38
- keyId:null,language:m.language,originalLanguage:m.Qd,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.Cg||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},XQ=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.kh.forEach(function(h,l){var m=h.d/g;if(0===l){var n=h.t/g;a.D=Math.min(a.D,n)}else n=f[l-1].endTime;var p=n+m,q=rQ(a.l,c,l,d);a.H=Math.max(a.H,m);f.push(new _.bj(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.G.set(q,
39
- n);e+=m});if(c.type===_.r||c.type===_.ad)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.Rd?a.a.Rd=b.endTime:a.a.Rd=Math.min(a.a.Rd,b.endTime);return f},YQ=function(a,b,c,d,e){b=tQ(b,d.timescale||c,e);c={isLive:a.sd.bind(a),Ae:a.Gf.bind(a),Qk:function(){return 1},xe:a.nh.bind(a)};d=new Uint8Array(0);try{d=HQ(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.P(_.Q,3,4035,g);}var f="data:text/plain;base64,"+_.wj(d);return new _.FC(function(){return[f]},0,null,null,!0)},VQ=
40
- function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.vg;return c||b?{id:a.N++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},QQ=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.P(_.Q,4,4038,a.l,c);},aR=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.Ib.bind(a),b))},RQ=function(a,b){var c=b===NQ;a.h&&a.h.presentationTimeline&&_.lD(a.h.presentationTimeline,
41
- c);c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.L=b},bR=function(){};wP.prototype.append=function(a){a=void 0===a?[]:a;for(var b=0;b<a.length;b++)this.f.push(a[b]),a[b].parent=this;return this};wP.prototype.get=function(a){if(this.type===a)return this;for(var b=0;b<this.f.length;b++){if(this.f[b].type===a)return this.f[b];var c=this.f[b].get(a);if(c)return c}return null};
42
- wP.prototype.a=function(){var a=Math.pow(2,32)-1;var b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.f.length)for(var c=0;c<this.f.length;c++)b+=this.f[c].a();this.size>a&&(b+=8);return b};
43
- wP.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);_.Em(a,vP(this.type));this.size>b&&pP(a,this.size);"uuid"===this.type&&_.Em(a,null);if(0<this.f.length&&!this.A)for(b=0;b<this.f.length;b++)this.f[b].write(a),this.f[b].a(),a.getPosition()};_.x(Z,wP);Z.prototype.a=function(){return 4+wP.prototype.a.call(this)};Z.prototype.write=function(a){wP.prototype.write.call(this,a);qP(a,this.version);rP(a,this.flags)};
44
- _.x(xP,wP);xP.prototype.a=function(){return this.h.byteLength+wP.prototype.a.call(this)-this.offset};xP.prototype.write=function(a){wP.prototype.write.call(this,a);_.Em(a,this.h,this.offset);a.getPosition()};_.x(yP,Z);yP.prototype.a=function(){return this.h.byteLength+Z.prototype.a.call(this)-this.offset};yP.prototype.write=function(a){Z.prototype.write.call(this,a);_.Em(a,this.h,this.offset);a.getPosition()};_.x(zP,wP);
45
- zP.prototype.a=function(){var a=this.j.length;a=a+4+this.h.join("").length;return a+wP.prototype.a.call(this)};zP.prototype.write=function(a){wP.prototype.write.call(this,a);_.Em(a,vP(this.j));_.W(a,this.Mh);_.Em(a,vP(this.h.join("")));a.getPosition()};_.x(AP,wP);_.x(BP,wP);_.x(CP,Z);CP.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;a=a+44+this.h.length;return a+=Z.prototype.a.call(this)};
46
- CP.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(pP(a,0),pP(a,0),_.W(a,this.timescale),pP(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));_.W(a,65536);sP(a,this.volume);sP(a,0);_.W(a,0);_.W(a,0);for(var b=0;b<this.h.length;b++)qP(a,this.h[b]);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,this.j);a.getPosition()};_.x(DP,wP);_.x(EP,Z);EP.prototype.a=function(){return 20+Z.prototype.a.call(this)};
47
- EP.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.h);_.W(a,1);_.W(a,0);_.W(a,0);_.W(a,0);a.getPosition()};_.x(FP,Z);FP.prototype.a=function(){var a=0;a=1===this.version?a+32:a+20;a=a+24+this.h.length;return a+Z.prototype.a.call(this)};
48
- FP.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(pP(a,0),pP(a,0),_.W(a,this.j),_.W(a,0),pP(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.j),_.W(a,0),_.W(a,this.duration*this.timescale));_.W(a,0);_.W(a,0);sP(a,0);sP(a,0);sP(a,this.volume);sP(a,0);for(var b=0;b<this.h.length;b++)qP(a,this.h[b]);sP(a,this.width);sP(a,0);sP(a,this.height);sP(a,0);a.getPosition()};_.x(GP,Z);GP.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
49
- GP.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(pP(a,0),pP(a,0),_.W(a,this.timescale),pP(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));sP(a,this.language);sP(a,0);a.getPosition()};_.x(HP,Z);HP.prototype.a=function(){return 33+Z.prototype.a.call(this)};
50
- HP.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);this.h===_.r?_.Em(a,vP("vide")):_.Em(a,vP("soun"));_.W(a,0);_.W(a,0);_.W(a,0);this.h===_.r?_.Em(a,vP("VideoHandler\x00")):_.Em(a,vP("SoundHandler\x00"));a.getPosition()};_.x(IP,Z);IP.prototype.a=function(){return 2+this.h.byteLength+Z.prototype.a.call(this)};IP.prototype.write=function(a){Z.prototype.write.call(this,a);sP(a,0);_.Em(a,this.h);a.getPosition()};_.x(JP,wP);JP.prototype.a=function(){return 8+wP.prototype.a.call(this)};
51
- JP.prototype.write=function(a){wP.prototype.write.call(this,a);_.W(a,0);sP(a,0);sP(a,1)};_.x(KP,JP);KP.prototype.a=function(){return 70+JP.prototype.a.call(this)};KP.prototype.write=function(a){JP.prototype.write.call(this,a);sP(a,0);sP(a,0);_.W(a,0);_.W(a,0);_.W(a,0);sP(a,this.width);sP(a,this.height);_.W(a,4718592);_.W(a,4718592);_.W(a,0);sP(a,1);qP(a,10);_.Em(a,vP("AVC Coding",31));sP(a,this.depth);uP(a,-1)};_.x(LP,JP);LP.prototype.a=function(){return 20+JP.prototype.a.call(this)};
52
- LP.prototype.write=function(a){JP.prototype.write.call(this,a);_.W(a,0);_.W(a,0);sP(a,this.channelCount);sP(a,this.sampleSize);uP(a,0);sP(a,0);sP(a,this.sampleRate);sP(a,0)};_.x(MP,KP);MP.prototype.write=function(a){KP.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.x(NP,MP);_.x(OP,LP);OP.prototype.write=function(a){LP.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.x(PP,OP);_.x(QP,wP);
53
- QP.prototype.a=function(){for(var a=7,b=0;b<this.Ua.length;b++)a+=2,a+=this.Ua[b].byteLength;for(b=0;b<this.Ua.length;b++)a+=2,a+=this.ac[b].byteLength;return a+wP.prototype.a.call(this)};
54
- QP.prototype.write=function(a){wP.prototype.write.call(this,a);qP(a,this.version);qP(a,this.h);qP(a,this.j);qP(a,this.level);qP(a,255);qP(a,224|this.Ua.length);for(var b=0;b<this.Ua.length;b++)sP(a,this.Ua[b].length),_.Em(a,this.Ua[b]);qP(a,this.ac.length);for(b=0;b<this.ac.length;b++)sP(a,this.ac[b].length),_.Em(a,this.ac[b]);a.getPosition()};_.x(RP,Z);RP.prototype.a=function(){return 22+(this.Qb.byteLength+3)+Z.prototype.a.call(this)};
55
- RP.prototype.write=function(a){Z.prototype.write.call(this,a);qP(a,3);qP(a,23+this.Qb.byteLength);sP(a,1);qP(a,0);qP(a,4);qP(a,15+this.Qb.byteLength);qP(a,64);qP(a,21);rP(a,0);_.W(a,0);_.W(a,0);qP(a,5);qP(a,this.Qb.byteLength);_.Em(a,this.Qb);_.Em(a,new Uint8Array([6,1,2]));a.getPosition()};_.x(SP,Z);SP.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};SP.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.Em(a,vP(this.location));a.getPosition()};
56
- _.x(TP,Z);TP.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)};TP.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(UP,wP);_.x(VP,Z);VP.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
- VP.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(WP,Z);WP.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)};WP.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(XP,Z);
58
- XP.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)};XP.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(YP,Z);YP.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
- YP.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(ZP,Z);ZP.prototype.a=function(){return 8+Z.prototype.a.call(this)};ZP.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);_.W(a,0);a.getPosition()};_.x($P,Z);$P.prototype.a=function(){return 4+Z.prototype.a.call(this)};$P.prototype.write=function(a){Z.prototype.write.call(this,a);uP(a,0);sP(a,0);a.getPosition()};
60
- _.x(aQ,wP);_.x(bQ,wP);_.x(cQ,wP);_.x(dQ,Z);dQ.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};dQ.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?pP(a,this.baseMediaDecodeTime):_.W(a,this.baseMediaDecodeTime);a.getPosition()};_.x(eQ,Z);eQ.prototype.a=function(){return 4+Z.prototype.a.call(this)};eQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.h);a.getPosition()};_.x(fQ,Z);
61
- fQ.prototype.a=function(){var a=4;this.flags&cR&&(a+=4);this.flags&dR&&(a+=4);for(var b=0;b<this.h;b++)this.flags&eR&&(a+=4),this.flags&fR&&(a+=4),this.flags&gR&&(a+=4),this.flags&hR&&(a+=4);return a+Z.prototype.a.call(this)};
62
- fQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.h);this.flags&cR&&(a.getPosition(),tP(a,this.l));this.flags&dR&&_.W(a,this.o);for(var b=0;b<this.h;b++)this.flags&eR&&_.W(a,this.w[b]),this.flags&fR&&_.W(a,this.sampleSize[b]),this.flags&gR&&_.W(a,this.B[b]),this.flags&hR&&(0===this.version?_.W(a,this.j[b]):tP(a,this.j[b]));a.getPosition()};var cR=1,dR=4,eR=256,fR=512,gR=1024,hR=2048;_.x(gQ,Z);
63
- gQ.prototype.a=function(){var a=4;this.flags&iR&&(a+=8);this.flags&jR&&(a+=4);this.flags&kR&&(a+=4);this.flags&lR&&(a+=4);this.flags&mR&&(a+=4);return a+Z.prototype.a.call(this)};gQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.h);this.flags&iR&&pP(a,this.j);this.flags&jR&&_.W(a,this.B);this.flags&kR&&_.W(a,this.l);this.flags&lR&&_.W(a,this.w);this.flags&mR&&_.W(a,this.o);a.getPosition()};var iR=1,jR=2,kR=8,lR=16,mR=32;_.x(hQ,wP);_.x(iQ,wP);_.x(jQ,wP);
64
- jQ.prototype.a=function(){return this.h.byteLength+wP.prototype.a.call(this)};jQ.prototype.write=function(a){wP.prototype.write.call(this,a);0<this.h.byteLength&&_.Em(a,this.h)};_.x(kQ,Z);kQ.prototype.a=function(){var a=20;1===this.h&&0===this.j&&(a=a+1+this.l.length);return a+Z.prototype.a.call(this)};
65
- kQ.prototype.write=function(a){Z.prototype.write.call(this,a);qP(a,0);0===this.version?qP(a,0):qP(a,0);qP(a,this.h);qP(a,this.j);_.Em(a,_.yj(this.o));if(1===this.h&&0===this.j){qP(a,0);for(var b=0;b<this.l.length;b++)qP(a,this.l[b])}a.getPosition()};_.x(lQ,Z);lQ.prototype.a=function(){var a=8;this.flags&1&&(a+=vP(this.Kb).byteLength);return a+Z.prototype.a.call(this)};lQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.Em(a,vP(this.h));_.W(a,this.j);this.flags&1&&_.Em(a,vP(this.Kb));a.getPosition()};
66
- _.x(mQ,wP);mQ.prototype.a=function(){return vP(this.h).byteLength+wP.prototype.a.call(this)};mQ.prototype.write=function(a){wP.prototype.write.call(this,a);_.Em(a,vP(this.h));a.getPosition()};_.x(nQ,Z);nQ.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=4;for(var b=0;1>b;b++)a=0===this.version?a+4:a+8;return a+Z.prototype.a.call(this)};
67
- nQ.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]):pP(a,this.offset[b]);a.getPosition()};_.x(oQ,Z);oQ.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=5;0===this.h&&(a+=this.l.length);return a+Z.prototype.a.call(this)};
68
- oQ.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));qP(a,this.h);_.W(a,this.j);if(0===this.h)for(var b=0;b<this.j;b++)qP(a,this.l[b]);a.getPosition()};_.x(pQ,Z);pQ.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.j;b++)if(a+=this.h[b].zh.byteLength,this.flags&2){a+=2;for(var c=0;c<this.h[b].hd;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
69
- pQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.j);this.flags&1&&qP(a,this.l);for(var b=0;b<this.j;b++)if(_.Em(a,this.h[b].zh),this.flags&2){sP(a,this.h[b].hd);for(var c=0;c<this.h[b].hd;c++)sP(a,this.h[b].ig[c].Ag),_.W(a,this.h[b].ig[c].Bg)}a.getPosition()};var wQ=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,xQ=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,yQ=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,zQ=/^(\d*\.?\d*)f$/,AQ=/^(\d*\.?\d*)t$/,BQ=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;FQ.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};FQ.prototype.write=function(){this.f=EQ(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var IQ=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.t=OQ.prototype;_.t.configure=function(a){this.f=a};_.t.start=function(a,b){var c=this;this.C=b;var d=_.ch(new Set([a,qQ(a)])).concat();return PQ(this,d).then(function(e){return WQ(c,e.data).then(function(){aR(c,c.A);return c.h})})};_.t.requestStop=function(){};_.t.stop=function(){this.C&&this.C.networkingEngine.Xd(this.K);this.A=this.w=this.h=this.f=this.C=null;this.j&&(clearTimeout(this.j),this.j=null);this.J=!1;this.I=this.D=Infinity;return Promise.resolve()};
70
- _.t.update=function(){var a=this;if(this.sd())return PQ(this,[this.l]).then(function(b){return WQ(a,b.data).then(function(){return a.h})})["catch"](function(b){if(a.C)a.C.onError(b)})};_.t.setCurrentVariant=function(){};_.t.Ib=function(){var a=this;this.g.debug(_.TB);this.C&&(this.j=null,this.update().then(function(){aR(a,a.A)})["catch"](function(b){a.C&&(a.C.onError(b),1===b.severity&&aR(a,100))}))};_.t.sd=function(){return this.L===SQ};_.t.Gf=function(){return 0<this.o.length};
71
- _.t.nh=function(a){var b=null;if(this.o.length)for(var c=0;c<this.o.length;c++)if(this.o[c].keySystem===a){b=this.o[c].initData[0];break}return b};
72
- _.t.Xm=function(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);var b=a.request.timescale||this.w.timescale,c={isLive:this.sd.bind(this),Ae:this.Gf.bind(this),Qk:function(){return 1},xe:this.nh.bind(this)},d=!1,e=new _.P(_.Q,3,4035,null),f=null;try{var g=this.G.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.g.debug("Using base media decode time "+g+" instead of segment reference time "+a.request.startTime);f=KQ(a,b,g,c)}catch(h){d=
73
- !0,e.data=h,3E3===h.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)};var ZQ={video:_.Jg,audio:_.ed,text:_.Yc},NQ=_.mc,SQ="LIVE",$Q={zn:_.pd,Gn:_.mg};_.x(bR,_.Ms);bR.prototype.f=function(){_.Lt.ism=OQ;_.Jt[_.Zc]=OQ};bR.prototype.a=function(){_.iE("ism");_.jE(_.Zc)};bR.prototype.id=function(){return _.dg};_.J("clpp.smooth.SmoothComponent",bR);};
2
+ var f=function(window){var CP="Full MP4 box must have flags defined",DP="clpp.smooth.SmoothMP4Processor",EP="codecPrivateData",FP=function(a,b){var c=Math.floor(b/Math.pow(2,32)),d=b-c*Math.pow(2,32);_.V(a,c);_.V(a,d)},GP=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.Cm()}},HP=function(a,b){GP(a,b>>16&255);GP(a,b>>8&255);GP(a,b&255)},IP=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.Cm()}},JP=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.Cm()}},KP=function(a,b){try{a.f.setInt16(a.a,
3
+ b,a.h),a.a+=2}catch(c){_.Cm()}},LP=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},MP=function(a){this.type=a;this.size=this.start=0;this.parent=null;this.A=!1;this.entries=[];this.f=[]},Z=function(a,b,c){MP.call(this,a);this.version=b;this.flags=c},NP=function(a,b,c){MP.call(this,a);this.h=b;this.offset=c},OP=function(a,b,c,
4
+ d,e){Z.call(this,a,b,c);this.h=d;this.offset=e},PP=function(a,b,c){MP.call(this,"ftyp");this.j=a;this.Zh=b;this.h=c},QP=function(){MP.call(this,_.Qe)},RP=function(){MP.call(this,_.pg)},SP=function(a,b,c){Z.call(this,"mvhd",1,0);this.timescale=a;this.duration=b;this.volume=256;this.j=c+1;this.h=[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]},TP=function(){MP.call(this,"mvex")},UP=function(a){Z.call(this,"trex",0,0);this.h=a},VP=function(a,b,c,d,e){Z.call(this,"tkhd",1,7);
5
+ this.j=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.h=[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]},WP=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},XP=function(a){Z.call(this,"hdlr",0,0);this.h=a},YP=function(){Z.call(this,"vmhd",0,1);this.h=new Uint8Array([0,0,0,0,0,0])},ZP=function(a){MP.call(this,a);this.A=!0},$P=function(a){ZP.call(this,a);this.height=this.width=0;this.depth=24},aQ=
6
+ function(a,b,c,d){ZP.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},bQ=function(a,b){$P.call(this,"avc1");this.width=a;this.height=b},cQ=function(a,b){bQ.call(this,a,b);this.type="encv"},dQ=function(a,b,c){aQ.call(this,"mp4a",a,b,c)},eQ=function(a,b,c){dQ.call(this,a,b,c);this.type="enca"},fQ=function(a,b){MP.call(this,"avcC");this.Xa=a;this.ec=b;this.version=1;this.h=this.Xa[0][1];this.j=this.Xa[0][2];this.level=this.Xa[0][3]},gQ=function(a){Z.call(this,"esds",0,0);this.bc=
7
+ a},hQ=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},iQ=function(){Z.call(this,"dref",0,0)},jQ=function(){MP.call(this,_.eg)},kQ=function(){Z.call(this,_.gg,0,0)},lQ=function(){Z.call(this,"stts",0,0)},mQ=function(){Z.call(this,"stsc",0,0)},nQ=function(){Z.call(this,"stco",0,0)},oQ=function(){Z.call(this,"stsz",0,0)},pQ=function(){Z.call(this,"smhd",0,0)},qQ=function(){MP.call(this,"dinf")},rQ=function(){MP.call(this,_.Pe)},sQ=function(){MP.call(this,_.Le)},tQ=function(a,b){Z.call(this,
8
+ "tfdt",a,0);this.baseMediaDecodeTime=b},uQ=function(){Z.call(this,"mfhd",0,0);this.h=0},vQ=function(a,b){Z.call(this,"trun",a,b);this.o=this.l=this.h=0;this.w=[];this.sampleSize=[];this.B=[];this.j=[]},wQ=function(a,b){Z.call(this,"tfhd",a,b);this.h=255;this.o=this.w=this.l=this.B=this.j=0},xQ=function(){MP.call(this,"traf")},yQ=function(){MP.call(this,"moof")},zQ=function(){MP.call(this,_.Ke);this.h=new Uint8Array(0)},AQ=function(){Z.call(this,"tenc",0,0);this.h=1;this.j=8;this.o="";this.l=[]},BQ=
9
+ function(a,b){Z.call(this,"schm",0,0);this.h=a;this.j=b;this.Wb=""},CQ=function(a){MP.call(this,"frma");this.h=a},DQ=function(){Z.call(this,"saio",0,0);this.offset=[0]},EQ=function(a,b,c){Z.call(this,"saiz",0,0);this.h=a;this.l=b;this.j=c},FQ=function(a,b){Z.call(this,"senc",a,b);this.j=0;this.l=8;this.h=[]},GQ=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},HQ=function(a,b,c,d){c=b.uh[c];b=b.Ln;a=a.replace("Manifest","");b=b.replace("{bitrate}",
10
+ String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.JC([a],[b])[0]},IQ=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.r?c=["maxWidth","maxHeight","bitrate",EP,"fourCC"]:a.type===_.$c&&(c=["bitrate",EP,"channels","bitsPerSample","samplingRate","fourCC"]);return _.M.la(a,b,c,["id","segmentIndex"])},JQ=function(a,b,c){var d=c.ve.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Xa:null,
11
+ ec:null,width:NaN,height:NaN,bc:null,be:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.r:a.Xa=[_.yj(d[1])];a.ec=[_.yj(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.$c:a.bc=_.yj(c.ve),a.sampleSize=c.ij||16,a.be=c.be,a.channelCount=c.Ng}return a},KQ=function(a,b){return a.filter(function(c){return c.type===b})},LQ=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},SQ=function(a,b,
12
+ c){var d=null;if(MQ.test(a)){a=MQ.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 NQ.test(a)?d=LQ(NQ,a):OQ.test(a)?d=LQ(OQ,a):PQ.test(a)?(a=PQ.exec(a),d=Number(a[1])/c.frameRate):QQ.test(a)?(a=QQ.exec(a),d=Number(a[1])/c.a):RQ.test(a)&&(d=LQ(RQ,a));d+=b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-3600*b-60*c);d-=a;10>b&&(b="0"+b);10>c&&(c="0"+c);10>a&&(a="0"+a);0===d?d="000":d=Math.round(1E3*
13
+ d);return b+":"+c+":"+a+"."+d},TQ=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))},VQ=function(a){this.a=a;this.f=UQ(this)},UQ=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.Bm(b)},WQ=function(a,b,c){a:{var d=_.w([_.Pd,_.Nd]);for(var e=d.next();!e.done;e=d.next())if((e=c.Be(e.value))&&e.keyId){d=e.keyId;break a}_.Dh(DP,
14
+ "Could not get default Key ID for DRM init data!");d=null}c=new MP("xxxx");a.type===_.r?c=new cQ(a.width,a.height):c=new eQ(a.channelCount,a.sampleSize,a.be);a=new AQ;a.h=1;a.j=8;a.o=d||"00000000000000000000000000000000";a=(new MP("schi")).append([a]);b=(new MP(_.Zf)).append([new CQ(b),new BQ(_.sd,65536),a]);c.append([b]);return c},XQ=function(a,b){var c=b.Ee(),d=new SP(a.timescale,a.duration,a.id),e=(new TP).append([new UP(a.id)]),f=new VP(a.id,a.duration,a.timescale,a.width,a.height),g=new WP(a.timescale,
15
+ a.duration),h=new XP(a.type),l=null,m=new iQ;m.entries=[new hQ];var n=new kQ;switch(a.type){case _.r:var p=new fQ(a.Xa,a.ec);c?(l=WQ(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new bQ(a.width,a.height)).append([p]),n.entries=[l]);l=new YP;break;case _.$c:p=new gQ(a.bc),c?(l=WQ(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new dQ(a.channelCount,a.sampleSize,a.be)).append([p]),n.entries=[l]),l=new pQ}n=(new jQ).append([n,new lQ,new mQ,new oQ,new nQ]);m=(new qQ).append([m]);m=(new rQ).append([l,m,n]);
16
+ g=(new sQ).append([g,h,m]);f=(new RP).append([f,g]);d=(new QP).append([d,f,e]);e=new PP("dash",0,["iso6","mp41","avc1"]);c&&(c=b.Be(_.Nd),f=b.Be(_.Pd),c&&d.append([new NP("pssh",c.initData,8)]),f&&d.append([new NP("pssh",f.initData,8)]),c||f||_.Dh(DP,"Could not get PSSH init data!"));c=new VQ([e,d]);return _.lj(c.write())},ZQ=function(a,b){var c,d,e,f,g,h;(new _.Nm).M("moof",_.Om).Y("mfhd",function(m){var n=new uQ;n.h=_.W(m.reader);c=n}).M("traf",_.Om).Y("tfhd",function(m){var n=m.reader.Ma();if(null===
17
+ m.flags)throw new _.N(_.O,3,3019,CP);var p=new wQ(m.version||0,m.flags||0);p.h=_.W(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.Km(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.B=_.W(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.l=_.W(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.w=_.W(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.o=_.W(m.reader));d=p}).Y("trun",function(m){var n=m.reader.Ma();if(null===m.flags)throw new _.N(_.O,3,3019,CP);var p=new vQ(m.version||
18
+ 0,m.flags||0);p.h=_.W(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.l=_.Jm(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.o=_.W(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.h;n++)m.flags&256&&p.w.push(_.W(m.reader)),m.flags&512&&p.sampleSize.push(_.W(m.reader)),m.flags&1024&&p.B.push(_.W(m.reader)),m.flags&2048&&(0===m.version?p.j.push(_.W(m.reader)):p.j.push(_.Jm(m.reader)));e=p}).Y("sdtp",function(m){var n=_.Mm(m.reader,m.reader.Ma());f=new OP("sdtp",m.version||0,m.flags||0,
19
+ n,0)}).M("uuid",function(m){var n=_.Mm(m.reader,16);if(_.Aj(n,YQ)){n=_.W(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new FQ(m.version,m.flags);n.j=_.W(m.reader);m.flags&1&&(n.l=_.Hm(m.reader));for(var p=0;p<n.j;p++){var q={Kh:_.Mm(m.reader,8),md:0,tg:[]};if(m.flags&2){q.md=_.Im(m.reader);for(var t=0;t<q.md;t++){var v={Lg:0,Mg:0};v.Lg=_.Im(m.reader);v.Mg=_.W(m.reader);q.tg.push(v)}}n.h.push(q)}g=n}}).M(_.Ke,function(m){var n=new zQ;0<m.reader.Ma()?n.h=_.Mm(m.reader,m.reader.Ma()):(_.Dh(DP,"mdat box is empty!"),
20
+ n.h=new Uint8Array(0));h=n}).parse(a,!1);if(!h)return null;var l=(new xQ).append([d,e]);f&&l.append([f]);b.Ee()&&g&&l.append([g]);l=(new yQ).append([c,l]);return new VQ([l,h])},$Q=function(a,b,c,d){var e=d.Ee(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=ZQ(b,d);if(null===g)return a.request.contentType===_.P?a.data:g;d=g.get(_.Ke);if(a.request.contentType===_.P){e=d.h.buffer;if(c){e=_.S.Ld(e);if((e=(new DOMParser).parseFromString(e,_.mg))&&"tt"===e.documentElement.tagName.toLowerCase())var h=
21
+ e.documentElement;if(h&&(d=new TQ(h.getAttribute("ttp:frameRate"),h.getAttribute("ttp:subFrameRate"),h.getAttribute("ttp:frameRateMultiplier"),h.getAttribute("ttp:tickRate")),h=h.getElementsByTagName("body")[0]))for(h=h.getElementsByTagName("p"),a=0,b=h.length;a<b;a++){f=h[a];g=c;for(var l=["begin",_.le],m=0,n=l.length;m<n;m++){b:{var p=f;var q=l[m],t=new RegExp("\\w+:"+q),v=0;if(p.hasAttribute(q))p=p.getAttribute(q);else{q=p.attributes;for(var z=q.length;v<z;v++){var C=q[v].name;if(C=C.match(t)){p=
22
+ p.getAttribute(C[0]);break b}}p=null}}f.setAttribute(l[m],SQ(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.S.Ya(e).buffer}else c=e;return c}h=new yQ;a=g.get("mfhd");b=new xQ;l=g.get("tfhd");m=new tQ(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");l.h=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.j;m++)l.push(10+6*c.h[m].md);else g=8;b.append([c,new DQ,new EQ(g,l,c.j)])}h.append([a,b]);f.flags|=1;f.l=h.a()+8;d=
23
+ new VQ([h,d]);h=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=c.start+16,d.seek(e.start),e.write(d),h=d.buffer);return h},aR=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},bR=function(a,b,c){a=_.Qn(a);c&&a.version!==c&&(a=_.zC(a,c));return{initData:_.xC(a),initDataType:_.sd,keyId:b,periodId:null}},dR=function(){this.w=this.h=this.f=
24
+ this.D=null;this.N=1;this.P=0;this.l="";this.B=this.a=null;this.g=new _.K("clpp.smooth.SmoothParser");this.J=!1;this.j=this.A=null;this.L=cR;this.H=0;this.C=this.I=Infinity;this.o=[];this.K=this.hn.bind(this);this.G=new Map},eR=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.Jj(b),c.timeout=a.f.attemptParameters.timeout,c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length),c.baseDelay=a.f.attemptParameters.baseDelay,c.backoffFactor=a.f.attemptParameters.backoffFactor,
25
+ c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.D.networkingEngine.fetch(c),_.y(f,d.U,2);e=f.f;a.l=e.uri;return f["return"](e)})},lR=function(a,b){var c=null;try{var d=new DOMParser;try{var e=_.S.Ld(b);var f=d.parseFromString(e.trim(),_.mg)}catch(sI){throw sI;}if(f&&f.documentElement.tagName===_.$b)var g=f.documentElement;c=g&&0<g.getElementsByTagName("parsererror").length?null:g}catch(sI){}if(!c)throw a.g.error("Unable to parse manifest"),new _.N(_.O,4,4033,a.l);var h=+fR(a,c,"MajorVersion"),
26
+ l=+fR(a,c,"MinorVersion"),m=+c.getAttribute("TimeScale")||1E7,n=+fR(a,c,"Duration"),p="TRUE"===c.getAttribute("IsLive"),q=+c.getAttribute("LookAheadCount"),t=+c.getAttribute("DVRWindowLength")||Infinity,v=_.Cn(c,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+h+"."+l))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.N(_.O,4,4036,a.l);p?(gR(a,hR),a.A=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.H,1E4),n=Infinity):gR(a,cR);a.a={startTime:0,delay:0,
27
+ duration:n/m,Df:t/m,Xd:0};if(v){var z=a.f.playreadyVersion,C=[],H=_.Cn(v,"ProtectionHeader")[0],E=_.xj(_.En(H)||""),B=_.Qn(E).a;C.push(aR(_.Pd,{initData:_.xC(_.Jn(B)),initDataType:_.sd,keyId:B,periodId:null},[B]));C.push(aR(_.Nd,bR(E,B,z),[B]));a.o=C}var G=[],Q=_.Cn(c,"StreamIndex");if(!Q.length)throw a.g.error("No streams found!"),new _.N(_.O,4,4034,a.l);for(var R=0;R<Q.length;R++){for(var oa,da=a,Ca=Q[R],bb=fR(da,Ca,"Type"),cb=+Ca.getAttribute("Chunks"),Ta=Ca.getAttribute("Subtype"),Da=Ca.getAttribute("Language")||
28
+ _.sg,fb=_.cj(Da),lc=Ca.getAttribute("Name")||"",Ag=+Ca.getAttribute(_.wb),Bg=+Ca.getAttribute(_.vb),nn=fR(da,Ca,"Url"),Vt=+Ca.getAttribute("TimeScale")||null,fd=[],on=_.Cn(Ca,_.Pb),Gu=0;Gu<on.length;Gu++){var xf=void 0,nc=void 0,Hu=void 0,yf=da,Fd=on[Gu],Iu=bb,XU=+Fd.getAttribute("Index"),YU=+fR(yf,Fd,"Bitrate"),vI=NaN,wI=NaN,ko=NaN,Ju=NaN,xI=NaN,yI=NaN,zI=NaN,AI=Fd.getAttribute("FourCC");switch(Iu){case _.r:vI=+fR(yf,Fd,_.vb);wI=+fR(yf,Fd,_.wb);break;case _.$c:Ju=+Fd.getAttribute("Channels")||2,
29
+ ko=+fR(yf,Fd,"SamplingRate"),yI=+fR(yf,Fd,"AudioTag"),xI=+fR(yf,Fd,"BitsPerSample"),zI=+fR(yf,Fd,"PacketSize")}var Ku=String(Fd.getAttribute("CodecPrivateData"));if(Iu===_.$c&&!Ku){var BI=Ju,CI={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},lo=CI[ko];if("AACH"===AI){nc=new Uint8Array(4);var DI=CI[2*ko];nc[0]=40|lo>>1;nc[1]=lo<<7|BI<<3|DI>>1;nc[2]=DI<<7|8;nc[3]=0;xf=new Uint16Array(2);xf[0]=(nc[0]<<8)+nc[1];xf[1]=(nc[2]<<8)+nc[3];Hu=xf[0].toString(16)+
30
+ xf[1].toString(16)}else nc=new Uint8Array(2),nc[0]=16|lo>>1,nc[1]=lo<<7|BI<<3,xf=new Uint16Array(1),xf[0]=(nc[0]<<8)+nc[1],Hu=xf[0].toString(16);Ku=Hu.toUpperCase()}var ZU={id:yf.P++,type:Iu,index:XU,bitrate:YU,ve:Ku,maxHeight:vI,maxWidth:wI,be:ko,Ng:Ju,ao:yI,ij:xI,so:zI,Uk:AI,segmentIndex:null};fd.push(ZU)}oa=fd;for(var Ge=[],EI=_.Cn(Ca,"c"),lk=0;lk<EI.length;lk++){var Lu=EI[lk],de=parseInt(Lu.getAttribute("t"),10),Wh=parseInt(Lu.getAttribute("d"),10),Mu=parseInt(Lu.getAttribute("r"),10),mk=0;if(isNaN(de)&&
31
+ isNaN(Wh))throw da.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.N(_.O,4,4037,da.l);0===lk&&isNaN(de)&&(mk=de=0);if(0<lk){var Eg=Ge[Ge.length-1];mk=Eg.n+1;Eg.d||(Eg.d=de-Eg.t);de||(de=Eg.t+Eg.d);Wh||(Wh=de-Eg.t)}Ge.push({n:mk,d:Wh,t:de});if(Mu){Mu--;for(var FI=0;FI<Mu;FI++){var mo=Ge[Ge.length-1];mk=mo.n+1;de=mo.t+mo.d;Wh=mo.d;Ge.push({n:mk,d:Wh,t:de})}}}da.zd()||Ge.length===cb||da.g.warn("Number of fragments ("+cb+") differs from number of chunks ("+
32
+ Ge.length+").");G.push({type:bb,fo:cb,wn:Ta,language:fb,Wd:Da,name:lc,maxWidth:Ag,maxHeight:Bg,Ln:nn,tracks:oa,uh:Ge,timescale:Vt})}var zf={qo:h,Zh:l,timescale:m,duration:n,isLive:p,po:q,Df:t,Mf:!1,streams:G};if(a.h&&a.w)return iR(a,zf),Promise.resolve();a.G.clear();var Nu=zf.timescale,no=zf.duration,aV=KQ(zf.streams,_.$c),bV=KQ(zf.streams,_.r),cV=KQ(zf.streams,_.P),GI=[],oo=jR(a,no,Nu,aV),po=jR(a,no,Nu,bV),dV=jR(a,no,Nu,cV);oo.length||(oo=[null]);po.length||(po=[null]);for(var Pu=0;Pu<po.length;Pu++)for(var Qu=
33
+ 0;Qu<oo.length;Qu++)GI.push(kR(a,po[Pu],oo[Qu]));var HI={id:"ID",configurationId:void 0,startTime:0,endTime:no,variants:GI,textStreams:dV,thumbStreams:[]};var fV=zf.streams,Ru=a.a.startTime,II=a.a.delay,Su=a.I,JI=Math.min(a.a.duration||Infinity,Su),Tu=a.zd(),gV=a.a.Df,hV=a.a.Xd,KI=a.H,LI=isFinite(a.C)?a.C:0;if(Tu)JI=Infinity,Ru=Date.now()/1E3-hV,a.a.startTime=Ru,II=3*KI;else for(var iV=isFinite(Su)?Su:a.a.duration,MI=_.w(fV),Uu=MI.next();!Uu.done;Uu=MI.next())for(var NI=_.w(Uu.value.tracks),Vu=NI.next();!Vu.done;Vu=
34
+ NI.next()){var OI=Vu.value;OI.segmentIndex.offset(-LI);_.gD(OI.segmentIndex,iV)}var PI=a.f.timeline||{};PI.type=void 0;a.B=new _.oD(PI,Ru,II,!Tu,!0);a.B.f=JI;_.wD(a.B,KI);a.B.A=gV;Tu||a.B.offset(-LI);a.D.filterAllPeriods([HI]);a.h={presentationTimeline:a.B,periods:[HI],minBufferTime:0,cues:[]};Promise.resolve();a.J||(a.D.networkingEngine.Qc(a.K),a.J=!0);a.w=zf;return Promise.resolve()},iR=function(a,b){for(var c=0;c<a.w.streams.length;c++)for(var d=b.streams[c],e={},f=_.w(a.w.streams[c].tracks),g=
35
+ f.next();!g.done;e={$b:e.$b},g=f.next())if(e.$b=g.value,g=d.tracks.find(function(l){return function(m){return m.type===l.$b.type&&m.bitrate===l.$b.bitrate}}(e))){IQ(e.$b,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=mR(a,a.w.timescale,d,g);g=e.$b.segmentIndex;g.sa(h);(h=a.a.Df)&&_.MD(g,_.LD(g)-h).forEach(function(l){l.Va().forEach(function(m){a.G["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.$b.type+" track with bitrate "+
36
+ (e.$b.bitrate+". Skipping update."))},jR=function(a,b,c,d){for(var e=[],f={Kc:0};f.Kc<d.length;f={Kc:f.Kc},f.Kc++){var g=d[f.Kc].tracks.map(function(h){return function(l){var m=d[h.Kc],n=mR(a,c,m,l);n=new _.KD(n);var p=null;m.type!==_.P&&(p=nR(a,b,c,m,l));l.segmentIndex=n;var q=_.vJ++,t=Promise.resolve.bind(Promise),v=n.Wc.bind(n),z=n.get.bind(n),C=n.sd.bind(n),H=n.getDuration.bind(n),E=oR[m.type],B="";switch(m.type){case _.r:B=l.ve;var G=/00000001[0-9]7/.exec(B);B="avc1."+(G&&G[0]?B.substr(B.indexOf(G[0])+
37
+ 10,6):"42c00c");a.g.debug("VIDEO CODECS: ",B);break;case _.$c:B=l.ve,G=2,"AACH"===l.Uk?G=5:B&&(G=(parseInt(B.substr(0,2),16)&248)>>3),B="mp4a.40."+G,a.g.debug("AUDIO CODECS: ",B)}G=m.type===_.P?pR[m.wn]:void 0;return{id:q,originalId:null,uo:null,createSegmentIndex:t,findSegmentPosition:v,getSegmentReference:z,adjustSegmentDurations:C,getDuration:H,segmentIndex:n,segmentLookupStrategy:_.fC,initSegmentReference:p,mimeType:E,codecs:B,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||
38
+ void 0,kind:G,encrypted:a.Nf(),keyId:null,language:m.language,originalLanguage:m.Wd,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.Ng||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},mR=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.uh.forEach(function(h,l){var m=h.d/g;if(0===l){var n=h.t/g;a.C=Math.min(a.C,n)}else n=f[l-1].endTime;var p=n+m,q=HQ(a.l,c,l,d);a.H=Math.max(a.H,m);f.push(new _.aj(l,n,p,function(){return[q]},
39
+ 0,null,0,null,!0,g));a.G.set(q,n);e+=m});if(c.type===_.r||c.type===_.$c)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.Xd?a.a.Xd=b.endTime:a.a.Xd=Math.min(a.a.Xd,b.endTime);return f},nR=function(a,b,c,d,e){b=JQ(b,d.timescale||c,e);c={isLive:a.zd.bind(a),Ee:a.Nf.bind(a),bl:function(){return 1},Be:a.xh.bind(a)};d=new Uint8Array(0);try{d=XQ(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.N(_.O,3,4035,g);}var f="data:text/plain;base64,"+_.wj(d);return new _.LC(function(){return[f]},
40
+ 0,null,null,!0)},kR=function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.sg;return c||b?{id:a.N++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},fR=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.N(_.O,4,4038,a.l,c);},qR=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.Ub.bind(a),b))},gR=function(a,b){var c=b===cR;a.h&&a.h.presentationTimeline&&
41
+ _.rD(a.h.presentationTimeline,c);c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.L=b},rR=function(){};MP.prototype.append=function(a){a=void 0===a?[]:a;for(var b=0;b<a.length;b++)this.f.push(a[b]),a[b].parent=this;return this};MP.prototype.get=function(a){if(this.type===a)return this;for(var b=0;b<this.f.length;b++){if(this.f[b].type===a)return this.f[b];var c=this.f[b].get(a);if(c)return c}return null};
42
+ MP.prototype.a=function(){var a=Math.pow(2,32)-1;var b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.f.length)for(var c=0;c<this.f.length;c++)b+=this.f[c].a();this.size>a&&(b+=8);return b};
43
+ MP.prototype.write=function(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.V(a,1):_.V(a,this.size);_.Dm(a,LP(this.type));this.size>b&&FP(a,this.size);"uuid"===this.type&&_.Dm(a,null);if(0<this.f.length&&!this.A)for(b=0;b<this.f.length;b++)this.f[b].write(a),this.f[b].a(),a.getPosition()};_.x(Z,MP);Z.prototype.a=function(){return 4+MP.prototype.a.call(this)};Z.prototype.write=function(a){MP.prototype.write.call(this,a);GP(a,this.version);HP(a,this.flags)};
44
+ _.x(NP,MP);NP.prototype.a=function(){return this.h.byteLength+MP.prototype.a.call(this)-this.offset};NP.prototype.write=function(a){MP.prototype.write.call(this,a);_.Dm(a,this.h,this.offset);a.getPosition()};_.x(OP,Z);OP.prototype.a=function(){return this.h.byteLength+Z.prototype.a.call(this)-this.offset};OP.prototype.write=function(a){Z.prototype.write.call(this,a);_.Dm(a,this.h,this.offset);a.getPosition()};_.x(PP,MP);
45
+ PP.prototype.a=function(){var a=this.j.length;a=a+4+this.h.join("").length;return a+MP.prototype.a.call(this)};PP.prototype.write=function(a){MP.prototype.write.call(this,a);_.Dm(a,LP(this.j));_.V(a,this.Zh);_.Dm(a,LP(this.h.join("")));a.getPosition()};_.x(QP,MP);_.x(RP,MP);_.x(SP,Z);SP.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;a=a+44+this.h.length;return a+=Z.prototype.a.call(this)};
46
+ SP.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(FP(a,0),FP(a,0),_.V(a,this.timescale),FP(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));_.V(a,65536);IP(a,this.volume);IP(a,0);_.V(a,0);_.V(a,0);for(var b=0;b<this.h.length;b++)GP(a,this.h[b]);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,this.j);a.getPosition()};_.x(TP,MP);_.x(UP,Z);UP.prototype.a=function(){return 20+Z.prototype.a.call(this)};
47
+ UP.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);_.V(a,1);_.V(a,0);_.V(a,0);_.V(a,0);a.getPosition()};_.x(VP,Z);VP.prototype.a=function(){var a=0;a=1===this.version?a+32:a+20;a=a+24+this.h.length;return a+Z.prototype.a.call(this)};
48
+ VP.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(FP(a,0),FP(a,0),_.V(a,this.j),_.V(a,0),FP(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.j),_.V(a,0),_.V(a,this.duration*this.timescale));_.V(a,0);_.V(a,0);IP(a,0);IP(a,0);IP(a,this.volume);IP(a,0);for(var b=0;b<this.h.length;b++)GP(a,this.h[b]);IP(a,this.width);IP(a,0);IP(a,this.height);IP(a,0);a.getPosition()};_.x(WP,Z);WP.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
49
+ WP.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(FP(a,0),FP(a,0),_.V(a,this.timescale),FP(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));IP(a,this.language);IP(a,0);a.getPosition()};_.x(XP,Z);XP.prototype.a=function(){return 33+Z.prototype.a.call(this)};
50
+ XP.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,0);this.h===_.r?_.Dm(a,LP("vide")):_.Dm(a,LP("soun"));_.V(a,0);_.V(a,0);_.V(a,0);this.h===_.r?_.Dm(a,LP("VideoHandler\x00")):_.Dm(a,LP("SoundHandler\x00"));a.getPosition()};_.x(YP,Z);YP.prototype.a=function(){return 2+this.h.byteLength+Z.prototype.a.call(this)};YP.prototype.write=function(a){Z.prototype.write.call(this,a);IP(a,0);_.Dm(a,this.h);a.getPosition()};_.x(ZP,MP);ZP.prototype.a=function(){return 8+MP.prototype.a.call(this)};
51
+ ZP.prototype.write=function(a){MP.prototype.write.call(this,a);_.V(a,0);IP(a,0);IP(a,1)};_.x($P,ZP);$P.prototype.a=function(){return 70+ZP.prototype.a.call(this)};$P.prototype.write=function(a){ZP.prototype.write.call(this,a);IP(a,0);IP(a,0);_.V(a,0);_.V(a,0);_.V(a,0);IP(a,this.width);IP(a,this.height);_.V(a,4718592);_.V(a,4718592);_.V(a,0);IP(a,1);GP(a,10);_.Dm(a,LP("AVC Coding",31));IP(a,this.depth);KP(a,-1)};_.x(aQ,ZP);aQ.prototype.a=function(){return 20+ZP.prototype.a.call(this)};
52
+ aQ.prototype.write=function(a){ZP.prototype.write.call(this,a);_.V(a,0);_.V(a,0);IP(a,this.channelCount);IP(a,this.sampleSize);KP(a,0);IP(a,0);IP(a,this.sampleRate);IP(a,0)};_.x(bQ,$P);bQ.prototype.write=function(a){$P.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.x(cQ,bQ);_.x(dQ,aQ);dQ.prototype.write=function(a){aQ.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.x(eQ,dQ);_.x(fQ,MP);
53
+ fQ.prototype.a=function(){for(var a=7,b=0;b<this.Xa.length;b++)a+=2,a+=this.Xa[b].byteLength;for(b=0;b<this.Xa.length;b++)a+=2,a+=this.ec[b].byteLength;return a+MP.prototype.a.call(this)};
54
+ fQ.prototype.write=function(a){MP.prototype.write.call(this,a);GP(a,this.version);GP(a,this.h);GP(a,this.j);GP(a,this.level);GP(a,255);GP(a,224|this.Xa.length);for(var b=0;b<this.Xa.length;b++)IP(a,this.Xa[b].length),_.Dm(a,this.Xa[b]);GP(a,this.ec.length);for(b=0;b<this.ec.length;b++)IP(a,this.ec[b].length),_.Dm(a,this.ec[b]);a.getPosition()};_.x(gQ,Z);gQ.prototype.a=function(){return 22+(this.bc.byteLength+3)+Z.prototype.a.call(this)};
55
+ gQ.prototype.write=function(a){Z.prototype.write.call(this,a);GP(a,3);GP(a,23+this.bc.byteLength);IP(a,1);GP(a,0);GP(a,4);GP(a,15+this.bc.byteLength);GP(a,64);GP(a,21);HP(a,0);_.V(a,0);_.V(a,0);GP(a,5);GP(a,this.bc.byteLength);_.Dm(a,this.bc);_.Dm(a,new Uint8Array([6,1,2]));a.getPosition()};_.x(hQ,Z);hQ.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};hQ.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.Dm(a,LP(this.location));a.getPosition()};
56
+ _.x(iQ,Z);iQ.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)};iQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(jQ,MP);_.x(kQ,Z);kQ.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
+ kQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(lQ,Z);lQ.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)};lQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(mQ,Z);
58
+ mQ.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)};mQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(nQ,Z);nQ.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
+ nQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(oQ,Z);oQ.prototype.a=function(){return 8+Z.prototype.a.call(this)};oQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,0);_.V(a,0);a.getPosition()};_.x(pQ,Z);pQ.prototype.a=function(){return 4+Z.prototype.a.call(this)};pQ.prototype.write=function(a){Z.prototype.write.call(this,a);KP(a,0);IP(a,0);a.getPosition()};
60
+ _.x(qQ,MP);_.x(rQ,MP);_.x(sQ,MP);_.x(tQ,Z);tQ.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};tQ.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?FP(a,this.baseMediaDecodeTime):_.V(a,this.baseMediaDecodeTime);a.getPosition()};_.x(uQ,Z);uQ.prototype.a=function(){return 4+Z.prototype.a.call(this)};uQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);a.getPosition()};_.x(vQ,Z);
61
+ vQ.prototype.a=function(){var a=4;this.flags&sR&&(a+=4);this.flags&tR&&(a+=4);for(var b=0;b<this.h;b++)this.flags&uR&&(a+=4),this.flags&vR&&(a+=4),this.flags&wR&&(a+=4),this.flags&xR&&(a+=4);return a+Z.prototype.a.call(this)};
62
+ vQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);this.flags&sR&&(a.getPosition(),JP(a,this.l));this.flags&tR&&_.V(a,this.o);for(var b=0;b<this.h;b++)this.flags&uR&&_.V(a,this.w[b]),this.flags&vR&&_.V(a,this.sampleSize[b]),this.flags&wR&&_.V(a,this.B[b]),this.flags&xR&&(0===this.version?_.V(a,this.j[b]):JP(a,this.j[b]));a.getPosition()};var sR=1,tR=4,uR=256,vR=512,wR=1024,xR=2048;_.x(wQ,Z);
63
+ wQ.prototype.a=function(){var a=4;this.flags&yR&&(a+=8);this.flags&zR&&(a+=4);this.flags&AR&&(a+=4);this.flags&BR&&(a+=4);this.flags&CR&&(a+=4);return a+Z.prototype.a.call(this)};wQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);this.flags&yR&&FP(a,this.j);this.flags&zR&&_.V(a,this.B);this.flags&AR&&_.V(a,this.l);this.flags&BR&&_.V(a,this.w);this.flags&CR&&_.V(a,this.o);a.getPosition()};var yR=1,zR=2,AR=8,BR=16,CR=32;_.x(xQ,MP);_.x(yQ,MP);_.x(zQ,MP);
64
+ zQ.prototype.a=function(){return this.h.byteLength+MP.prototype.a.call(this)};zQ.prototype.write=function(a){MP.prototype.write.call(this,a);0<this.h.byteLength&&_.Dm(a,this.h)};_.x(AQ,Z);AQ.prototype.a=function(){var a=20;1===this.h&&0===this.j&&(a=a+1+this.l.length);return a+Z.prototype.a.call(this)};
65
+ AQ.prototype.write=function(a){Z.prototype.write.call(this,a);GP(a,0);0===this.version?GP(a,0):GP(a,0);GP(a,this.h);GP(a,this.j);_.Dm(a,_.yj(this.o));if(1===this.h&&0===this.j){GP(a,0);for(var b=0;b<this.l.length;b++)GP(a,this.l[b])}a.getPosition()};_.x(BQ,Z);BQ.prototype.a=function(){var a=8;this.flags&1&&(a+=LP(this.Wb).byteLength);return a+Z.prototype.a.call(this)};BQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.Dm(a,LP(this.h));_.V(a,this.j);this.flags&1&&_.Dm(a,LP(this.Wb));a.getPosition()};
66
+ _.x(CQ,MP);CQ.prototype.a=function(){return LP(this.h).byteLength+MP.prototype.a.call(this)};CQ.prototype.write=function(a){MP.prototype.write.call(this,a);_.Dm(a,LP(this.h));a.getPosition()};_.x(DQ,Z);DQ.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=4;for(var b=0;1>b;b++)a=0===this.version?a+4:a+8;return a+Z.prototype.a.call(this)};
67
+ DQ.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.V(a,0),_.V(a,0));_.V(a,1);for(var b=0;1>b;b++)0===this.version?_.V(a,this.offset[b]):FP(a,this.offset[b]);a.getPosition()};_.x(EQ,Z);EQ.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=5;0===this.h&&(a+=this.l.length);return a+Z.prototype.a.call(this)};
68
+ EQ.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.V(a,0),_.V(a,0));GP(a,this.h);_.V(a,this.j);if(0===this.h)for(var b=0;b<this.j;b++)GP(a,this.l[b]);a.getPosition()};_.x(FQ,Z);FQ.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.j;b++)if(a+=this.h[b].Kh.byteLength,this.flags&2){a+=2;for(var c=0;c<this.h[b].md;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
69
+ FQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.j);this.flags&1&&GP(a,this.l);for(var b=0;b<this.j;b++)if(_.Dm(a,this.h[b].Kh),this.flags&2){IP(a,this.h[b].md);for(var c=0;c<this.h[b].md;c++)IP(a,this.h[b].tg[c].Lg),_.V(a,this.h[b].tg[c].Mg)}a.getPosition()};var MQ=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,NQ=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,OQ=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,PQ=/^(\d*\.?\d*)f$/,QQ=/^(\d*\.?\d*)t$/,RQ=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;VQ.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};VQ.prototype.write=function(){this.f=UQ(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var YQ=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.u=dR.prototype;_.u.configure=function(a){this.f=a};_.u.start=function(a,b){var c=this;this.D=b;var d=_.ah(new Set([a,GQ(a)])).concat();return eR(this,d).then(function(e){return lR(c,e.data).then(function(){qR(c,c.A);return c.h})})};_.u.requestStop=function(){};_.u.stop=function(){this.D&&this.D.networkingEngine.ae(this.K);this.A=this.w=this.h=this.f=this.D=null;this.j&&(clearTimeout(this.j),this.j=null);this.J=!1;this.I=this.C=Infinity;return Promise.resolve()};
70
+ _.u.update=function(){var a=this;if(this.zd())return eR(this,[this.l]).then(function(b){return lR(a,b.data).then(function(){return a.h})})["catch"](function(b){if(a.D)a.D.onError(b)})};_.u.setCurrentVariant=function(){};_.u.Ub=function(){var a=this;this.g.debug(_.YB);this.D&&(this.j=null,this.update().then(function(){qR(a,a.A)})["catch"](function(b){a.D&&(a.D.onError(b),1===b.severity&&qR(a,100))}))};_.u.zd=function(){return this.L===hR};_.u.Nf=function(){return 0<this.o.length};
71
+ _.u.xh=function(a){var b=null;if(this.o.length)for(var c=0;c<this.o.length;c++)if(this.o[c].keySystem===a){b=this.o[c].initData[0];break}return b};
72
+ _.u.hn=function(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);var b=a.request.timescale||this.w.timescale,c={isLive:this.zd.bind(this),Ee:this.Nf.bind(this),bl:function(){return 1},Be:this.xh.bind(this)},d=!1,e=new _.N(_.O,3,4035,null),f=null;try{var g=this.G.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.g.debug("Using base media decode time "+g+" instead of segment reference time "+a.request.startTime);f=$Q(a,b,g,c)}catch(h){d=
73
+ !0,e.data=h,3E3===h.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)};var oR={video:_.Hg,audio:_.dd,text:_.Xc},cR=_.jc,hR="LIVE",pR={Nn:_.od,Un:_.ig};_.x(rR,_.Us);rR.prototype.f=function(){_.Tt.ism=dR;_.Rt[_.Yc]=dR};rR.prototype.a=function(){_.nE("ism");_.oE(_.Yc)};rR.prototype.id=function(){return _.$f};_.J("clpp.smooth.SmoothComponent",rR);};
74
74
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
75
75
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
76
76
  else{_=this.clpp._;(f.call(g,this));}
@@ -1,30 +1,30 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var ky="No thumbnail found for position: ",ly="Position is out of range: ",my="Thumbnail URL is mandatory",ny="Wrong gridSize format",oy="clpp.thumbnails",py=function(){this.log=new _.K(oy);this.player=null;this.a=[];this.w=!1},ry=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Xe&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return qy(a,0,e,!!f)})},Promise.resolve())},qy=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return sy(a,d).then(function(){return a.a[b].load()}).then(function(){return qy(a,
3
- e,c,d)})},sy=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.qp)c();else a.player.one(_.ld,function(){c()})})},ty=function(a,b,c,d,e,f,g,h,l,m,n,p){d=void 0===d?0:d;e=void 0===e?0:e;f=void 0===f?0:f;g=void 0===g?0:g;h=void 0===h?1:h;l=void 0===l?1:l;m=void 0===m?0:m;n=void 0===n?0:n;p=void 0===p?new Image:p;this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.pa=p;this.mk=h;this.Ym=l;this.gl=m;this.hl=n;this.Hf=null},uy=function(){py.call(this);
4
- this.f=null;this.o=this.h=1;this.j=0},vy=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Ud=new _.Oj},wy=function(){this.g=new _.K(oy);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.Oj},xy=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.Ud.resolve()})},zy=function(a,b){return yy(a,b).then(function(c){return new ty(c,b.time,b.duration)})},yy=function(a,b){return b.load().then(function(){var c=_.lj(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
- _.vj(c)})},Ay=function(){py.call(this);this.f=null},By=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},Cy=function(){py.apply(this,arguments)},Dy=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Kd:c,qg:d,yh:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},Ey=function(){this.g=new _.K(oy);this.a=this.m=null},Fy=function(a){return a.some(function(b){return 0<
6
- b.thumbStreams.length})},Ky=function(a){return a?a===Gy||a===Hy?new uy:a===Iy?new Ay:a===Jy?new wy:null:null},Ly=function(a){if(!a)return null;a=new _.qk(a);return a.path.match(/.*\.vtt$/i)?Iy:a.path.match(/.*\.bif$/i)?Jy:a.path.match(/.*\.(png|jpg|jpeg)$/i)?Gy:null},My=function(){};py.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Pf,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&ry(c,b.preload)})};ty.prototype.raw=function(){return this.pa.cloneNode(!1)};
7
- ty.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(_.$d);e.style.width=c+_.Mf;e.style.height=d+_.Mf;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.pa.naturalWidth||this.pa.width))+"px "+Math.ceil(d/
8
- this.height*(this.pa.naturalHeight||this.pa.height))+_.Mf;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Mf;e.style.backgroundPositionY="-"+f*d+_.Mf;return e};
9
- ty.prototype.load=function(){var a=this;this.Hf||(this.Hf=new Promise(function(b,c){function d(){a.width||(a.width=(a.pa.naturalWidth||a.pa.width)/a.mk);a.height||(a.height=(a.pa.naturalHeight||a.pa.height)/a.Ym);a.x||(a.x=a.width*a.gl);a.y||(a.y=a.height*a.hl)}if(a.pa.src&&a.pa.complete)d(),b(a);else{var e=null,f=function(){d();a.pa.removeEventListener("load",f);a.pa.removeEventListener(_.re,e);b(a)};e=function(g){a.pa.removeEventListener("load",f);a.pa.removeEventListener(_.re,e);c(new _.P(1,9,
10
- 2014,"Failed to load thumbnail.",g))};a.pa.addEventListener("load",f);a.pa.addEventListener(_.re,e);a.pa.src=a.src}}));return this.Hf};_.J("clpp.thumbnails.Thumbnail",ty);ty.prototype.load=ty.prototype.load;ty.prototype.element=ty.prototype.element;ty.prototype.raw=ty.prototype.raw;_.x(uy,py);
11
- uy.prototype.init=function(a,b){if(!b||!b.url)throw new _.P(1,9,7100,my);if("GRID"===b.mode&&!b.gridSize)throw new _.P(1,9,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.P(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 _.P(1,9,7100,ny);}catch(d){throw this.log.error("Error during parsing gridSize",d),
12
- new _.P(1,9,7100,ny);}py.prototype.init.call(this,a,b)};uy.prototype.get=function(a){var b=this,c,d,e,f;return _.H(function(g){if(1==g.a){c=b.player.getDuration();if(0>a||a>c)throw new _.P(1,9,2014,ly+a);d=b.f.duration;e=Math.floor(a/d);f=b.a[e];if(!f)throw new _.P(1,9,2014,"No thumbnail found for position "+a+" at index "+e);return _.y(g,f.load(),2)}return g["return"](f)})};
13
- uy.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 ty(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()};vy.prototype.load=function(){return this.Ud};
14
- wy.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.P(1,9,7100,my);var d=b.url,e=_.Jj(d);e.type=_.Ij;a.getNetworkEngine().fetch(e).P.then(function(f){f=f.data;var g=_.lj(c.f);f=_.lj(f);for(var h=g.byteLength+f.byteLength,l=new ArrayBuffer(h),m=new DataView(l),n=0,p=0,q=g.byteLength;p<q;p++)m.setUint8(n,g[p]),n+=1;g=0;for(p=f.byteLength;g<p;g++)m.setUint8(n,f[g]),n+=1;c.f=l;c.g.info("Appended "+f.byteLength+" bytes.Total data now "+(h+" bytes."));l=c.f;f=_.lj(l);n=String.fromCharCode.apply(null,
15
- Ny);g=Array.prototype.slice.call(f,0,8);f=64;h=0;m=!1;if(n===String.fromCharCode.apply(null,g))for(l=new DataView(l,16,20),l=l.getUint32(0,!0),0===l&&(l=1E3);!m;){h+=1;g=l;n=new DataView(c.f,f);m=n.getUint32(0,!0);g=m*g/1E3;n=n.getUint32(4,!0);n=new vy(g,n);if(g=c.a.length)g=c.a[g-1],g.length=n.offset-g.offset,g.duration=n.time-g.time;c.a.push(n);f+=8;(m=4294967295===m)&&c.h.resolve();if(1E5<h)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");
16
- xy(c)})["catch"](function(f){c.g.error("[BIF] Error while loading thumbnails '\n + 'URL: "+d,f);a.onError(new _.P(1,9,2013,"Error while loading and parsing BIF thumbnails.",f))})};wy.prototype.get=function(a){var b=this,c,d;return _.H(function(e){switch(e.a){case 1:if(0>a)throw new _.P(1,9,2014,ly+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 _.P(1,9,2014,ky+a);return _.y(e,zy(b,c),3);case 3:return d=e.f,_.y(e,d.load(),4);case 4:return e["return"](d)}})};
17
- wy.prototype.Jd=function(){return 0<this.a.length};var Ny=[137,66,73,70,13,10,26,10];_.x(Ay,py);
18
- Ay.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.P(1,9,7100,my);var d=b.url,e=_.Jj(d);e.type=_.Ij;this.f=a.getNetworkEngine().fetch(e).P.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.S.ba(f).split(/\n/);for(var g=0;g<f.length;g++){var h=f[g],l=h.split(" --\x3e ");if(2===l.length){h=f[++g];var m=h.indexOf("\x3d"),n=0>m?[]:h.substr(m+1).split(/,/).map(parseFloat);m=n[0];var p=n[1],q=n[2];n=n[3];var u=h.indexOf("#");h=0>u?h:h.substr(0,u);h.match(/^http|^\/\//)||(h=
19
- d.substr(0,d.lastIndexOf("/"))+"/"+h);u=By(l[0]);l=By(l[1])-u;c.a.push(new ty(h,u,l,m,p,q,n,0,0))}}})["catch"](function(f){c.log.error("[VTT] Error while loading thumbnails URL: "+d,f);a.onError(new _.P(1,9,2013,"Error while loading VTT thumbnails.",f))});py.prototype.init.call(this,a,b)};
20
- Ay.prototype.get=function(a){var b=this,c;return _.H(function(d){if(1==d.a){if(0>a)throw new _.P(1,9,2014,ly+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 _.P(1,9,2014,ky+a);return _.y(d,c.load(),3)}return d["return"](c)})};Ay.prototype.l=function(){return this.f};_.x(Cy,py);
21
- Cy.prototype.get=function(a){function b(){return new _.P(1,9,2014,ky+a)}var c=this,d,e,f,g,h,l,m,n,p,q,u,v,z;return _.H(function(C){if(1==C.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.P(1,9,2014,ly+a);d=c.player.getPeriods();for(var I=null,F=_.w(d),D=F.next();!D.done;D=F.next())D=D.value,D.startTime<=a&&(I=D);e=I;if(!e)throw c.log.error("Could not find period for specified position",a),b();f=e.thumbStreams.sort(c.f)[0];if(!f)throw c.log.error("Could not find thumb stream for specified position",a),
22
- b();g=f.findSegmentPosition(a-e.startTime);if(null===g||void 0===g)throw c.log.error("Could not find segment index for specified position",a),b();h=f.getSegmentReference(g);if(!h)return C.F(2);l=Dy(h,f);m=Math.floor((a-h.startTime)/l.durationPerTile);0<c.a.length?(p=f.findSegmentPosition(0),null!==p&&(n=c.a[(g-p)*l.yh+m])):(q=h.Ra())&&0<q.length&&(v=u=0,z=h.startTime,1<l.yh&&(u=m%l.Kd,v=Math.floor(m/l.Kd),z+=m*l.durationPerTile),n=new ty(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.Kd,l.qg,
23
- u,v));return n?_.y(C,n.load(),4):C.F(2)}if(2!=C.a)return C["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};Cy.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
- Cy.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.w(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value.thumbStreams.sort(this.f)[0])for(var c=b.findSegmentPosition(0),d=void 0;null!==c&&!_.O.R(d=b.getSegmentReference(c++));)for(var e=Dy(d,b),f=d.Ra()[0],g=new Image,h=d.startTime,l=0;l<e.qg;++l)for(var m=0;m<e.Kd;++m)this.a.push(new ty(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Kd,e.qg,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.t=Ey.prototype;_.t.onPlayerCreated=function(a){this.m=a};_.t.onPlayerWillDestroy=function(){this.m=null};_.t.onPlayerWillRelease=function(){this.a=null};
25
- _.t.onContentWillLoad=function(a){var b=this,c=a.getConfiguration().thumbnails;if(c)if(!1===c.enabled)this.g.info("Thumbnails disabled.");else{var d=c.mode||null;d||(d=Ly(c.url||null));(this.a=Ky(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Je,function(){b.g.info("Initialize thumbnails provider");try{b.a.init(a,c)}catch(e){b.m.onError(e)}})):this.g.warn("Unknown thumbnail mode",d)}else this.a=null};
26
- _.t.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);if(!this.a&&(c=(c=a.getConfiguration())&&c.thumbnails,!c||void 0===c.enabled||c.enabled)){var d=a.getPeriods();if(Fy(d)){this.a=new Cy;try{this.a.init(a,c)}catch(e){this.m.onError(e)}}}};_.t.get=function(a){return this.a?this.a.get(a):Promise.reject(new _.P(1,9,2014,"Thumbnail format is not supported"))};_.t.id=function(){return"thumbnails"};_.J("clpp.thumbnails.ThumbnailsPlugin",Ey);Ey.prototype.get=Ey.prototype.get;Ey.Id="thumbnails";
27
- My.prototype.create=function(){return new Ey};_.$q(new My);var Gy="SINGLE",Hy="GRID",Iy="WEBVTT",Jy="BIF";};
2
+ var f=function(window){var ny="No thumbnail found for position: ",oy="Position is out of range: ",py="Thumbnail URL is mandatory",qy="Wrong gridSize format",ry="clpp.thumbnails",sy=function(){this.log=new _.K(ry);this.player=null;this.a=[];this.w=!1},uy=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Ue&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return ty(a,0,e,!!f)})},Promise.resolve())},ty=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return vy(a,d).then(function(){return a.a[b].load()}).then(function(){return ty(a,
3
+ e,c,d)})},vy=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.op)c();else a.player.one(_.kd,function(){c()})})},wy=function(a,b,c,d,e,f,g,h,l,m,n,p){d=void 0===d?0:d;e=void 0===e?0:e;f=void 0===f?0:f;g=void 0===g?0:g;h=void 0===h?1:h;l=void 0===l?1:l;m=void 0===m?0:m;n=void 0===n?0:n;p=void 0===p?new Image:p;this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.pa=p;this.zk=h;this.kn=l;this.ql=m;this.rl=n;this.Of=null},xy=function(){sy.call(this);
4
+ this.f=null;this.o=this.h=1;this.j=0},yy=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.gd=new _.Oj},zy=function(){this.g=new _.K(ry);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.Oj},Ay=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.gd.resolve()})},Cy=function(a,b){return By(a,b).then(function(c){return new wy(c,b.time,b.duration)})},By=function(a,b){return b.load().then(function(){var c=_.lj(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
+ _.vj(c)})},Dy=function(){sy.call(this);this.f=null},Ey=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},Fy=function(){sy.apply(this,arguments)},Gy=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Sd:c,Bg:d,Jh:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},Hy=function(){this.g=new _.K(ry);this.a=this.m=null},Iy=function(a){return a.some(function(b){return 0<
6
+ b.thumbStreams.length})},Ny=function(a){return a?a===Jy||a===Ky?new xy:a===Ly?new Dy:a===My?new zy:null:null},Oy=function(a){if(!a)return null;a=new _.pk(a);return a.path.match(/.*\.vtt$/i)?Ly:a.path.match(/.*\.bif$/i)?My:a.path.match(/.*\.(png|jpg|jpeg)$/i)?Jy:null},Py=function(){};sy.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Lf,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&uy(c,b.preload)})};wy.prototype.raw=function(){return this.pa.cloneNode(!1)};
7
+ wy.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(_.Wd);e.style.width=c+_.If;e.style.height=d+_.If;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.pa.naturalWidth||this.pa.width))+"px "+Math.ceil(d/
8
+ this.height*(this.pa.naturalHeight||this.pa.height))+_.If;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.If;e.style.backgroundPositionY="-"+f*d+_.If;return e};
9
+ wy.prototype.load=function(){var a=this;this.Of||(this.Of=new Promise(function(b,c){function d(){a.width||(a.width=(a.pa.naturalWidth||a.pa.width)/a.zk);a.height||(a.height=(a.pa.naturalHeight||a.pa.height)/a.kn);a.x||(a.x=a.width*a.ql);a.y||(a.y=a.height*a.rl)}if(a.pa.src&&a.pa.complete)d(),b(a);else{var e=null,f=function(){d();a.pa.removeEventListener(_.Ee,f);a.pa.removeEventListener(_.ne,e);b(a)};e=function(g){a.pa.removeEventListener(_.Ee,f);a.pa.removeEventListener(_.ne,e);c(new _.N(1,9,2014,
10
+ "Failed to load thumbnail.",g))};a.pa.addEventListener(_.Ee,f);a.pa.addEventListener(_.ne,e);a.pa.src=a.src}}));return this.Of};_.J("clpp.thumbnails.Thumbnail",wy);wy.prototype.load=wy.prototype.load;wy.prototype.element=wy.prototype.element;wy.prototype.raw=wy.prototype.raw;_.x(xy,sy);
11
+ xy.prototype.init=function(a,b){if(!b||!b.url)throw new _.N(1,9,7100,py);if("GRID"===b.mode&&!b.gridSize)throw new _.N(1,9,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.N(1,9,7100,"Duration is mandatory");this.f=b;this.j=this.f.duration;if(this.f.gridSize)try{var c=this.f.gridSize.split(/x/).map(function(d){return parseInt(d,10)}).filter(function(d){return 0<d});if(2===c.length)this.h=c[0],this.o=c[1];else throw new _.N(1,9,7100,qy);}catch(d){throw this.log.error("Error during parsing gridSize",d),
12
+ new _.N(1,9,7100,qy);}sy.prototype.init.call(this,a,b)};xy.prototype.get=function(a){var b=this,c,d,e,f;return _.I(function(g){if(1==g.a){c=b.player.getDuration();if(0>a||a>c)throw new _.N(1,9,2014,oy+a);d=b.f.duration;e=Math.floor(a/d);f=b.a[e];if(!f)throw new _.N(1,9,2014,"No thumbnail found for position "+a+" at index "+e);return _.y(g,f.load(),2)}return g["return"](f)})};
13
+ xy.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 wy(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()};yy.prototype.load=function(){return this.gd};
14
+ zy.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.N(1,9,7100,py);var d=b.url,e=_.Jj(d);e.type=_.Ij;a.getNetworkEngine().fetch(e).U.then(function(f){f=f.data;var g=_.lj(c.f);f=_.lj(f);for(var h=g.byteLength+f.byteLength,l=new ArrayBuffer(h),m=new DataView(l),n=0,p=0,q=g.byteLength;p<q;p++)m.setUint8(n,g[p]),n+=1;g=0;for(p=f.byteLength;g<p;g++)m.setUint8(n,f[g]),n+=1;c.f=l;c.g.info("Appended "+f.byteLength+" bytes.Total data now "+(h+" bytes."));l=c.f;f=_.lj(l);n=String.fromCharCode.apply(null,
15
+ Qy);g=Array.prototype.slice.call(f,0,8);f=64;h=0;m=!1;if(n===String.fromCharCode.apply(null,g))for(l=new DataView(l,16,20),l=l.getUint32(0,!0),0===l&&(l=1E3);!m;){h+=1;g=l;n=new DataView(c.f,f);m=n.getUint32(0,!0);g=m*g/1E3;n=n.getUint32(4,!0);n=new yy(g,n);if(g=c.a.length)g=c.a[g-1],g.length=n.offset-g.offset,g.duration=n.time-g.time;c.a.push(n);f+=8;(m=4294967295===m)&&c.h.resolve();if(1E5<h)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");
16
+ Ay(c)})["catch"](function(f){c.g.error("[BIF] Error while loading thumbnails '\n + 'URL: "+d,f);a.onError(new _.N(1,9,2013,"Error while loading and parsing BIF thumbnails.",f))})};zy.prototype.get=function(a){var b=this,c,d;return _.I(function(e){switch(e.a){case 1:if(0>a)throw new _.N(1,9,2014,oy+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 _.N(1,9,2014,ny+a);return _.y(e,Cy(b,c),3);case 3:return d=e.f,_.y(e,d.load(),4);case 4:return e["return"](d)}})};
17
+ zy.prototype.wc=function(){return 0<this.a.length};var Qy=[137,66,73,70,13,10,26,10];_.x(Dy,sy);
18
+ Dy.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.N(1,9,7100,py);var d=b.url,e=_.Jj(d);e.type=_.Ij;this.f=a.getNetworkEngine().fetch(e).U.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.S.aa(f).split(/\n/);for(var g=0;g<f.length;g++){var h=f[g],l=h.split(" --\x3e ");if(2===l.length){h=f[++g];var m=h.indexOf("\x3d"),n=0>m?[]:h.substr(m+1).split(/,/).map(parseFloat);m=n[0];var p=n[1],q=n[2];n=n[3];var t=h.indexOf("#");h=0>t?h:h.substr(0,t);h.match(/^http|^\/\//)||(h=
19
+ d.substr(0,d.lastIndexOf("/"))+"/"+h);t=Ey(l[0]);l=Ey(l[1])-t;c.a.push(new wy(h,t,l,m,p,q,n,0,0))}}})["catch"](function(f){c.log.error("[VTT] Error while loading thumbnails URL: "+d,f);a.onError(new _.N(1,9,2013,"Error while loading VTT thumbnails.",f))});sy.prototype.init.call(this,a,b)};
20
+ Dy.prototype.get=function(a){var b=this,c;return _.I(function(d){if(1==d.a){if(0>a)throw new _.N(1,9,2014,oy+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 _.N(1,9,2014,ny+a);return _.y(d,c.load(),3)}return d["return"](c)})};Dy.prototype.l=function(){return this.f};_.x(Fy,sy);
21
+ Fy.prototype.get=function(a){function b(){return new _.N(1,9,2014,ny+a)}var c=this,d,e,f,g,h,l,m,n,p,q,t,v,z;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 _.N(1,9,2014,oy+a);d=c.player.getPeriods();for(var H=null,E=_.w(d),B=E.next();!B.done;B=E.next())B=B.value,B.startTime<=a&&(H=B);e=H;if(!e)throw c.log.error("Could not find period for specified position",a),b();f=e.thumbStreams.sort(c.f)[0];if(!f)throw c.log.error("Could not find thumb stream for specified position",a),
22
+ b();g=f.findSegmentPosition(a-e.startTime);if(null===g||void 0===g)throw c.log.error("Could not find segment index for specified position",a),b();h=f.getSegmentReference(g);if(!h)return C.F(2);l=Gy(h,f);m=Math.floor((a-h.startTime)/l.durationPerTile);0<c.a.length?(p=f.findSegmentPosition(0),null!==p&&(n=c.a[(g-p)*l.Jh+m])):(q=h.Va())&&0<q.length&&(v=t=0,z=h.startTime,1<l.Jh&&(t=m%l.Sd,v=Math.floor(m/l.Sd),z+=m*l.durationPerTile),n=new wy(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.Sd,l.Bg,
23
+ t,v));return n?_.y(C,n.load(),4):C.F(2)}if(2!=C.a)return C["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};Fy.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
+ Fy.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.w(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value.thumbStreams.sort(this.f)[0])for(var c=b.findSegmentPosition(0),d=void 0;null!==c&&!_.M.R(d=b.getSegmentReference(c++));)for(var e=Gy(d,b),f=d.Va()[0],g=new Image,h=d.startTime,l=0;l<e.Bg;++l)for(var m=0;m<e.Sd;++m)this.a.push(new wy(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Sd,e.Bg,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.u=Hy.prototype;_.u.onPlayerCreated=function(a){this.m=a};_.u.onPlayerWillDestroy=function(){this.m=null};_.u.onPlayerWillRelease=function(){this.a=null};
25
+ _.u.onContentWillLoad=function(a){var b=this,c=a.getConfiguration().thumbnails;if(c)if(!1===c.enabled)this.g.info("Thumbnails disabled.");else{var d=c.mode||null;d||(d=Oy(c.url||null));(this.a=Ny(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.He,function(){b.g.info("Initialize thumbnails provider");try{b.a.init(a,c)}catch(e){b.m.onError(e)}})):this.g.warn("Unknown thumbnail mode",d)}else this.a=null};
26
+ _.u.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);if(!this.a&&(c=(c=a.getConfiguration())&&c.thumbnails,!c||void 0===c.enabled||c.enabled)){var d=a.getPeriods();if(Iy(d)){this.a=new Fy;try{this.a.init(a,c)}catch(e){this.m.onError(e)}}}};_.u.get=function(a){return this.a?this.a.get(a):Promise.reject(new _.N(1,9,2014,"Thumbnail format is not supported"))};_.u.id=function(){return"thumbnails"};_.J("clpp.thumbnails.ThumbnailsPlugin",Hy);Hy.prototype.get=Hy.prototype.get;Hy.Id="thumbnails";
27
+ Py.prototype.create=function(){return new Hy};_.qs(new Py);var Jy="SINGLE",Ky="GRID",Ly="WEBVTT",My="BIF";};
28
28
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
29
29
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
30
30
  else{_=this.clpp._;(f.call(g,this));}