@castlabs/prestoplay 6.14.0 → 6.15.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 (62) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +113 -111
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +550 -529
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +74 -73
  10. package/cjs/cl.externs.js +191 -64
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +69 -68
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -30
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +290 -275
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +13 -13
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.simid.js +15 -15
  22. package/cjs/cl.smooth.js +72 -71
  23. package/cjs/cl.thumbnails.js +26 -26
  24. package/cjs/cl.tizen.js +70 -70
  25. package/cjs/cl.ttml.js +28 -28
  26. package/cjs/cl.verimatrix.js +5 -5
  27. package/cjs/cl.vimond.js +13 -13
  28. package/cjs/cl.vr.js +19 -19
  29. package/cjs/cl.vtt.js +14 -14
  30. package/cjs/cl.youbora.js +20 -20
  31. package/cl.adobe.js +3 -3
  32. package/cl.airplay.js +3 -3
  33. package/cl.broadpeak.js +5 -5
  34. package/cl.cast.js +89 -88
  35. package/cl.conviva.js +27 -27
  36. package/cl.core.js +457 -438
  37. package/cl.crypto.js +9 -9
  38. package/cl.dash.js +70 -68
  39. package/cl.externs.js +187 -64
  40. package/cl.freewheel.js +19 -19
  41. package/cl.hls.js +71 -69
  42. package/cl.hlssmpte.js +5 -5
  43. package/cl.htmlcue.js +26 -26
  44. package/cl.ima.js +17 -17
  45. package/cl.mse.js +255 -240
  46. package/cl.muxdata.js +13 -13
  47. package/cl.onboard.js +4 -4
  48. package/cl.persistent.js +11 -11
  49. package/cl.playlist.js +5 -5
  50. package/cl.simid.js +13 -13
  51. package/cl.smooth.js +59 -59
  52. package/cl.thumbnails.js +19 -19
  53. package/cl.tizen.js +57 -57
  54. package/cl.ttml.js +22 -22
  55. package/cl.verimatrix.js +4 -4
  56. package/cl.vimond.js +8 -8
  57. package/cl.vr.js +15 -15
  58. package/cl.vtt.js +12 -12
  59. package/cl.youbora.js +15 -15
  60. package/clpp.styles.css +2 -0
  61. package/package.json +1 -1
  62. package/typings.d.ts +387 -90
package/cjs/cl.smooth.js CHANGED
@@ -1,75 +1,76 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var rL="Full MP4 box must have flags defined",sL="clpp.smooth.SmoothMP4Processor",tL="codecPrivateData",uL=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)},vL=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.bm()}},wL=function(a,b){vL(a,b>>16&255);vL(a,b>>8&255);vL(a,b&255)},xL=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.bm()}},yL=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.bm()}},zL=function(a,b){try{a.f.setInt16(a.a,
3
- b,a.h),a.a+=2}catch(c){_.bm()}},AL=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},BL=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){BL.call(this,a);this.version=b;this.flags=c},CL=function(a,b,c){BL.call(this,a);this.h=b;this.offset=c},DL=function(a,b,c,
4
- d,e){Z.call(this,a,b,c);this.h=d;this.offset=e},EL=function(a,b,c){BL.call(this,"ftyp");this.j=a;this.hh=b;this.h=c},FL=function(){BL.call(this,_.Oe)},GL=function(){BL.call(this,_.fg)},HL=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]},IL=function(){BL.call(this,"mvex")},JL=function(a){Z.call(this,"trex",0,0);this.h=a},KL=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]},LL=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},ML=function(a){Z.call(this,"hdlr",0,0);this.h=a},NL=function(){Z.call(this,"vmhd",0,1);this.h=new Uint8Array([0,0,0,0,0,0])},OL=function(a){BL.call(this,a);this.A=!0},PL=function(a){OL.call(this,a);this.height=this.width=0;this.depth=24},QL=
6
- function(a,b,c,d){OL.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},RL=function(a,b){PL.call(this,"avc1");this.width=a;this.height=b},SL=function(a,b){RL.call(this,a,b);this.type="encv"},TL=function(a,b,c){QL.call(this,"mp4a",a,b,c)},UL=function(a,b,c){TL.call(this,a,b,c);this.type="enca"},VL=function(a,b){BL.call(this,"avcC");this.Ua=a;this.$b=b;this.version=1;this.h=this.Ua[0][1];this.j=this.Ua[0][2];this.level=this.Ua[0][3]},WL=function(a){Z.call(this,"esds",0,0);this.Ob=
7
- a},XL=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},YL=function(){Z.call(this,"dref",0,0)},ZL=function(){BL.call(this,_.Vf)},$L=function(){Z.call(this,_.Xf,0,0)},aM=function(){Z.call(this,"stts",0,0)},bM=function(){Z.call(this,"stsc",0,0)},cM=function(){Z.call(this,"stco",0,0)},dM=function(){Z.call(this,"stsz",0,0)},eM=function(){Z.call(this,"smhd",0,0)},fM=function(){BL.call(this,"dinf")},gM=function(){BL.call(this,_.Ne)},hM=function(){BL.call(this,_.Je)},iM=function(a,b){Z.call(this,
8
- "tfdt",a,0);this.h=b},jM=function(){Z.call(this,"mfhd",0,0);this.h=0},kM=function(a,b){Z.call(this,"trun",a,b);this.o=this.l=this.h=0;this.w=[];this.sampleSize=[];this.B=[];this.j=[]},lM=function(a,b){Z.call(this,"tfhd",a,b);this.h=255;this.o=this.w=this.l=this.B=this.j=0},mM=function(){BL.call(this,"traf")},nM=function(){BL.call(this,"moof")},oM=function(){BL.call(this,_.Ie);this.h=new Uint8Array(0)},pM=function(){Z.call(this,"tenc",0,0);this.h=1;this.j=8;this.o="";this.l=[]},qM=function(a,b){Z.call(this,
9
- "schm",0,0);this.h=a;this.j=b;this.Jb=""},rM=function(a){BL.call(this,"frma");this.h=a},sM=function(){Z.call(this,"saio",0,0);this.offset=[0]},tM=function(a,b,c){Z.call(this,"saiz",0,0);this.h=a;this.l=b;this.j=c},uM=function(a,b){Z.call(this,"senc",a,b);this.j=0;this.l=8;this.h=[]},vM=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},wM=function(a,b,c,d){c=b.Jg[c];b=b.Bm;a=a.replace("Manifest","");b=b.replace("{bitrate}",String(d.bitrate)).replace("{Bitrate}",
10
- String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.Bi([a],[b])[0]},xM=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.sg?c=["maxWidth","maxHeight","bitrate",tL,"fourCC"]:a.type===_.$c&&(c=["bitrate",tL,"channels","bitsPerSample","samplingRate","fourCC"]);return _.N.ta(a,b,c,["id","segmentIndex"])},yM=function(a,b,c){var d=c.ce.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Ua:null,$b:null,width:NaN,height:NaN,Ob:null,Nd:NaN,
11
- sampleSize:NaN,channelCount:NaN};switch(c.type){case _.sg:a.Ua=[_.gj(d[1])];a.$b=[_.gj(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.$c:a.Ob=_.gj(c.ce),a.sampleSize=c.ki||16,a.Nd=c.Nd,a.channelCount=c.hg}return a},zM=function(a,b){return a.filter(function(c){return c.type===b})},AM=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)},HM=function(a,b,c){var d=null;if(BM.test(a)){a=BM.exec(a);d=
12
- 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 CM.test(a)?d=AM(CM,a):DM.test(a)?d=AM(DM,a):EM.test(a)?(a=EM.exec(a),d=Number(a[1])/c.frameRate):FM.test(a)?(a=FM.exec(a),d=Number(a[1])/c.a):GM.test(a)&&(d=AM(GM,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*d);return b+":"+c+":"+a+"."+d},IM=function(a,
13
- 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))},KM=function(a){this.a=a;this.f=JM(this)},JM=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.am(b)},LM=function(a,b,c){a:{var d=_.u([_.Rd,_.Pd]);for(var e=d.next();!e.done;e=d.next())if((e=c.je(e.value))&&e.keyId){d=e.keyId;break a}_.J(sL,"Could not get default Key ID for DRM init data!");
14
- d=null}c=new BL("xxxx");a.type===_.sg?c=new SL(a.width,a.height):c=new UL(a.channelCount,a.sampleSize,a.Nd);a=new pM;a.h=1;a.j=8;a.o=d||"00000000000000000000000000000000";a=(new BL("schi")).append([a]);b=(new BL(_.Qf)).append([new rM(b),new qM(_.rd,65536),a]);c.append([b]);return c},MM=function(a,b){var c=b.pe(),d=new HL(a.timescale,a.duration,a.id),e=(new IL).append([new JL(a.id)]),f=new KL(a.id,a.duration,a.timescale,a.width,a.height),g=new LL(a.timescale,a.duration),h=new ML(a.type),l=null,m=new YL;
15
- m.entries=[new XL];var n=new $L;switch(a.type){case _.sg:var p=new VL(a.Ua,a.$b);c?(l=LM(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new RL(a.width,a.height)).append([p]),n.entries=[l]);l=new NL;break;case _.$c:p=new WL(a.Ob),c?(l=LM(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new TL(a.channelCount,a.sampleSize,a.Nd)).append([p]),n.entries=[l]),l=new eM}n=(new ZL).append([n,new aM,new bM,new dM,new cM]);m=(new fM).append([m]);m=(new gM).append([l,m,n]);g=(new hM).append([g,h,m]);f=(new GL).append([f,
16
- g]);d=(new FL).append([d,f,e]);e=new EL("dash",0,["iso6","mp41","avc1"]);c&&(c=b.je(_.Pd),f=b.je(_.Rd),c&&d.append([new CL("pssh",c.initData,8)]),f&&d.append([new CL("pssh",f.initData,8)]),c||f||_.J(sL,"Could not get PSSH init data!"));c=new KM([e,d]);return _.Ui(c.write())},OM=function(a,b){var c,d,e,f,g,h;(new _.mm).L("moof",_.nm).Y("mfhd",function(m){var n=new jM;n.h=_.W(m.reader);c=n}).L("traf",_.nm).Y("tfhd",function(m){var n=m.reader.Ga();if(null===m.flags)throw new _.P(_.Q,3,3019,rL);var p=
17
- new lM(m.version||0,m.flags||0);p.h=_.W(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.jm(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.Ga();if(null===m.flags)throw new _.P(_.Q,3,3019,rL);var p=new kM(m.version||0,m.flags||0);p.h=_.W(m.reader);0<n-
18
- m.reader.getPosition()&&m.flags&1&&(p.l=_.im(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(_.im(m.reader)));e=p}).Y("sdtp",function(m){var n=_.lm(m.reader,m.reader.Ga());f=new DL("sdtp",m.version||0,m.flags||0,n,0)}).L("uuid",function(m){var n=_.lm(m.reader,
19
- 16);if(_.ij(n,NM)){n=_.W(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new uM(m.version,m.flags);n.j=_.W(m.reader);m.flags&1&&(n.l=_.gm(m.reader));for(var p=0;p<n.j;p++){var q={Xg:_.lm(m.reader,8),dd:0,Qf:[]};if(m.flags&2){q.dd=_.hm(m.reader);for(var t=0;t<q.dd;t++){var v={fg:0,gg:0};v.fg=_.hm(m.reader);v.gg=_.W(m.reader);q.Qf.push(v)}}n.h.push(q)}g=n}}).L(_.Ie,function(m){var n=new oM;0<m.reader.Ga()?n.h=_.lm(m.reader,m.reader.Ga()):(_.J(sL,"mdat box is empty!"),n.h=new Uint8Array(0));h=n}).parse(a,
20
- !1);if(!h)return null;var l=(new mM).append([d,e]);f&&l.append([f]);b.pe()&&g&&l.append([g]);l=(new nM).append([c,l]);return new KM([l,h])},PM=function(a,b,c,d){var e=d.pe(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=OM(b,d);if(null===g)return a.request.contentType===_.bg?a.data:g;d=g.get(_.Ie);if(a.request.contentType===_.bg){e=d.h.buffer;if(c){e=_.R.yd(e);if((e=(new DOMParser).parseFromString(e,_.dg))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new IM(h.getAttribute("ttp:frameRate"),
21
- 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 D=q[v].name;if(D=D.match(t)){p=p.getAttribute(D[0]);break b}}p=null}}f.setAttribute(l[m],HM(p||
22
- "",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.R.Va(e).buffer}else c=e;return c}h=new nM;a=g.get("mfhd");b=new mM;l=g.get("tfhd");m=new iM(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].dd);else g=8;b.append([c,new sM,new tM(g,l,c.j)])}h.append([a,b]);f.flags|=1;f.l=h.a()+8;d=new KM([h,d]);h=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=
23
- c.start+16,d.seek(e.start),e.write(d),h=d.buffer);return h},QM=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},RM=function(a,b,c){a=_.pn(a);c&&a.version!==c&&(a=_.vz(a,c));return{initData:_.tz(a),initDataType:_.rd,keyId:b,periodId:null}},TM=function(){this.w=this.h=this.f=this.D=null;this.M=1;this.T=0;this.l="";this.B=this.a=null;this.g=
24
- new _.K("clpp.smooth.SmoothParser");this.J=!1;this.j=this.A=null;this.P=SM;this.H=0;this.C=this.I=Infinity;this.o=[];this.K=this.em.bind(this);this.G=new Map},UM=function(a,b){var c,d,e;return _.E(function(f){if(1==f.a)return c=_.rj(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,c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.D.networkingEngine.fetch(c),
25
- _.x(f,d.O,2);e=f.f;a.l=e.uri;return f["return"](e)})},aN=function(a,b){var c=null;try{var d=new DOMParser;try{var e=_.R.yd(b);var f=d.parseFromString(e.trim(),_.dg)}catch(hF){throw hF;}if(f&&f.documentElement.tagName==_.ac)var g=f.documentElement;c=g&&0<g.getElementsByTagName("parsererror").length?null:g}catch(hF){}if(!c)throw a.g.error("Unable to parse manifest"),new _.P(_.Q,4,4033,a.l);var h=+VM(a,c,"MajorVersion"),l=+VM(a,c,"MinorVersion"),m=+c.getAttribute("TimeScale")||1E7,n=+VM(a,c,"Duration"),
26
- p="TRUE"===c.getAttribute("IsLive"),q=+c.getAttribute("LookAheadCount"),t=+c.getAttribute("DVRWindowLength")||Infinity,v=_.an(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?(WM(a,XM),a.A=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.H,1E4),n=Infinity):WM(a,SM);a.a={startTime:0,delay:0,duration:n/m,af:t/m,Gd:0};if(v){var z=a.f.playreadyVersion,D=[],G=_.an(v,"ProtectionHeader")[0],
27
- F=_.fj(_.cn(G)||""),B=_.pn(F).a;D.push(QM(_.Rd,{initData:_.tz(_.hn(B)),initDataType:_.rd,keyId:B,periodId:null},[B]));D.push(QM(_.Pd,RM(F,B,z),[B]));a.o=D}var I=[],O=_.an(c,"StreamIndex");if(!O.length)throw a.g.error("No streams found!"),new _.P(_.Q,4,4034,a.l);for(var M=0;M<O.length;M++){for(var ba,ha=a,qa=O[M],Ta=VM(ha,qa,"Type"),Fa=+qa.getAttribute("Chunks"),Ca=qa.getAttribute("Subtype"),na=qa.getAttribute("Language")||_.hg,Ia=_.Ni(na),tb=qa.getAttribute("Name")||"",Jb=+qa.getAttribute(_.xb),Lc=
28
- +qa.getAttribute(_.wb),Dm=VM(ha,qa,"Url"),Ms=+qa.getAttribute("TimeScale")||null,Mc=[],Em=_.an(qa,_.Ob),ut=0;ut<Em.length;ut++){var qf=void 0,ic=void 0,vt=void 0,rf=ha,qd=Em[ut],wt=Ta,JQ=+qd.getAttribute("Index"),KQ=+VM(rf,qd,"Bitrate"),kF=NaN,lF=NaN,zn=NaN,xt=NaN,mF=NaN,nF=NaN,oF=NaN,pF=qd.getAttribute("FourCC");switch(wt){case _.sg:kF=+VM(rf,qd,_.wb);lF=+VM(rf,qd,_.xb);break;case _.$c:xt=+qd.getAttribute("Channels")||2,zn=+VM(rf,qd,"SamplingRate"),nF=+VM(rf,qd,"AudioTag"),mF=+VM(rf,qd,"BitsPerSample"),
29
- oF=+VM(rf,qd,"PacketSize")}var yt=String(qd.getAttribute("CodecPrivateData"));if(wt===_.$c&&!yt){var qF=xt,rF={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},An=rF[zn];if("AACH"===pF){ic=new Uint8Array(4);var sF=rF[2*zn];ic[0]=40|An>>1;ic[1]=An<<7|qF<<3|sF>>1;ic[2]=sF<<7|8;ic[3]=0;qf=new Uint16Array(2);qf[0]=(ic[0]<<8)+ic[1];qf[1]=(ic[2]<<8)+ic[3];vt=qf[0].toString(16)+qf[1].toString(16)}else ic=new Uint8Array(2),ic[0]=16|An>>1,ic[1]=An<<7|qF<<3,
30
- qf=new Uint16Array(1),qf[0]=(ic[0]<<8)+ic[1],vt=qf[0].toString(16);yt=vt.toUpperCase()}var LQ={id:rf.T++,type:wt,index:JQ,bitrate:KQ,ce:yt,maxHeight:kF,maxWidth:lF,Nd:zn,hg:xt,Um:nF,ki:mF,kn:oF,Wj:pF,segmentIndex:null};Mc.push(LQ)}ba=Mc;for(var Be=[],tF=_.an(qa,"c"),Ij=0;Ij<tF.length;Ij++){var zt=tF[Ij],Od=parseInt(zt.getAttribute("t"),10),Ah=parseInt(zt.getAttribute("d"),10),At=parseInt(zt.getAttribute("r"),10),Jj=0;if(isNaN(Od)&&isNaN(Ah))throw ha.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),
31
- new _.P(_.Q,4,4037,ha.l);0===Ij&&isNaN(Od)&&(Jj=Od=0);if(0<Ij){var ng=Be[Be.length-1];Jj=ng.n+1;ng.d||(ng.d=Od-ng.t);Od||(Od=ng.t+ng.d);Ah||(Ah=Od-ng.t)}Be.push({n:Jj,d:Ah,t:Od});if(At){At--;for(var uF=0;uF<At;uF++){var Bn=Be[Be.length-1];Jj=Bn.n+1;Od=Bn.t+Bn.d;Ah=Bn.d;Be.push({n:Jj,d:Ah,t:Od})}}}ha.qd()||Be.length===Fa||ha.g.warn("Number of fragments ("+Fa+") differs from number of chunks ("+Be.length+").");I.push({type:Ta,Ym:Fa,qm:Ca,language:Ia,Fd:na,name:tb,maxWidth:Jb,maxHeight:Lc,Bm:Dm,tracks:ba,
32
- Jg:Be,timescale:Ms})}var sf={hn:h,hh:l,timescale:m,duration:n,isLive:p,gn:q,af:t,kf:!1,streams:I};if(a.h&&a.w)return YM(a,sf),Promise.resolve();a.G.clear();var Bt=sf.timescale,Ct=sf.duration,NQ=zM(sf.streams,_.$c),OQ=zM(sf.streams,_.sg),PQ=zM(sf.streams,_.bg),vF=[],Cn=ZM(a,Ct,Bt,NQ),Dn=ZM(a,Ct,Bt,OQ),QQ=ZM(a,Ct,Bt,PQ);Cn.length||(Cn=[null]);Dn.length||(Dn=[null]);for(var Et=0;Et<Dn.length;Et++)for(var Ft=0;Ft<Cn.length;Ft++)vF.push($M(a,Dn[Et],Cn[Ft]));var wF={startTime:0,variants:vF,textStreams:QQ,
33
- thumbStreams:[]};var SQ=sf.streams,Gt=a.a.startTime,xF=a.a.delay,Ht=a.I,yF=Math.min(a.a.duration||Infinity,Ht),It=a.qd(),TQ=a.a.af,UQ=a.a.Gd,zF=a.H,AF=isFinite(a.C)?a.C:0;if(It)yF=Infinity,Gt=Date.now()/1E3-UQ,a.a.startTime=Gt,xF=3*zF;else for(var VQ=isFinite(Ht)?Ht:a.a.duration,BF=_.u(SQ),Jt=BF.next();!Jt.done;Jt=BF.next())for(var CF=_.u(Jt.value.tracks),Kt=CF.next();!Kt.done;Kt=CF.next()){var DF=Kt.value;DF.segmentIndex.offset(-AF);_.$z(DF.segmentIndex,VQ)}a.B=new _.fA(Gt,xF,!It,!0);a.B.f=yF;_.kA(a.B,
34
- zF);a.B.w=TQ;It||a.B.offset(-AF);a.D.filterAllPeriods([wF]);a.h={presentationTimeline:a.B,periods:[wF],offlineSessionIds:[],minBufferTime:0};Promise.resolve();a.J||(a.D.networkingEngine.hd(a.K),a.J=!0);a.w=sf;return Promise.resolve()},YM=function(a,b){for(var c=0;c<a.w.streams.length;c++)for(var d=b.streams[c],e={},f=_.u(a.w.streams[c].tracks),g=f.next();!g.done;e={Nb:e.Nb},g=f.next())if(e.Nb=g.value,g=d.tracks.find(function(l){return function(m){return m.type===l.Nb.type&&m.bitrate===l.Nb.bitrate}}(e))){xM(e.Nb,
35
- g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=bN(a,a.w.timescale,d,g);g=e.Nb.segmentIndex;g.oa(h);(h=a.a.af)&&_.wA(g,_.vA(g)-h).forEach(function(l){l.Sa().forEach(function(m){a.G["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.Nb.type+" track with bitrate "+(e.Nb.bitrate+". Skipping update."))},ZM=function(a,b,c,d){for(var e=[],f={Fc:0};f.Fc<d.length;f={Fc:f.Fc},f.Fc++){var g=d[f.Fc].tracks.map(function(h){return function(l){var m=
36
- d[h.Fc],n=bN(a,c,m,l);n=new _.uA(n);var p=null;m.type!==_.bg&&(p=cN(a,b,c,m,l));l.segmentIndex=n;var q=a.M++,t=Promise.resolve.bind(Promise),v=n.Mc.bind(n),z=n.get.bind(n),D=n.jd.bind(n),G=n.getDuration.bind(n),F=dN[m.type],B="";switch(m.type){case _.sg:B=l.ce;var I=/00000001[0-9]7/.exec(B);B="avc1."+(I&&I[0]?B.substr(B.indexOf(I[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",B);break;case _.$c:B=l.ce,I=2,"AACH"===l.Wj?I=5:B&&(I=(parseInt(B.substr(0,2),16)&248)>>3),B="mp4a.40."+I,a.g.debug("AUDIO CODECS: ",
37
- B)}I=m.type===_.bg?eN[m.qm]:void 0;return{id:q,originalId:null,mn:null,createSegmentIndex:t,findSegmentPosition:v,getSegmentReference:z,adjustSegmentDurations:D,getDuration:G,segmentIndex:n,segmentLookupStrategy:_.ez,initSegmentReference:p,mimeType:F,codecs:B,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:I,encrypted:a.mf(),keyId:null,language:m.language,originalLanguage:m.Fd,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,
38
- roles:[],channelsCount:l.hg||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},bN=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.Jg.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=wM(a.l,c,l,d);a.H=Math.max(a.H,m);f.push(new _.Li(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.G.set(q,n);e+=m});if(c.type===_.sg||c.type===_.$c)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.Gd?a.a.Gd=b.endTime:a.a.Gd=Math.min(a.a.Gd,
39
- b.endTime);return f},cN=function(a,b,c,d,e){b=yM(b,d.timescale||c,e);c={isLive:a.qd.bind(a),pe:a.mf.bind(a),ck:function(){return 1},je:a.Lg.bind(a)};d=new Uint8Array(0);try{d=MM(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,"+_.ej(d);return new _.Dz(function(){return[f]},0,null,null,!0)},$M=function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.hg;return c||b?{id:a.M++,language:e,primary:!1,audio:c,
40
- video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},VM=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);},fN=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.Hb.bind(a),b))},WM=function(a,b){var c=b===SM;if(a.h&&a.h.presentationTimeline){var d=a.h.presentationTimeline;d.j=c;d.l=c}c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.P=b},gN=function(){};
41
- BL.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};BL.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};BL.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};
42
- BL.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);_.cm(a,AL(this.type));this.size>b&&uL(a,this.size);"uuid"===this.type&&_.cm(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()};_.w(Z,BL);Z.prototype.a=function(){return 4+BL.prototype.a.call(this)};Z.prototype.write=function(a){BL.prototype.write.call(this,a);vL(a,this.version);wL(a,this.flags)};
43
- _.w(CL,BL);CL.prototype.a=function(){return this.h.byteLength+BL.prototype.a.call(this)-this.offset};CL.prototype.write=function(a){BL.prototype.write.call(this,a);_.cm(a,this.h,this.offset);a.getPosition()};_.w(DL,Z);DL.prototype.a=function(){return this.h.byteLength+Z.prototype.a.call(this)-this.offset};DL.prototype.write=function(a){Z.prototype.write.call(this,a);_.cm(a,this.h,this.offset);a.getPosition()};_.w(EL,BL);
44
- EL.prototype.a=function(){var a=this.j.length;a=a+4+this.h.join("").length;return a+BL.prototype.a.call(this)};EL.prototype.write=function(a){BL.prototype.write.call(this,a);_.cm(a,AL(this.j));_.V(a,this.hh);_.cm(a,AL(this.h.join("")));a.getPosition()};_.w(FL,BL);_.w(GL,BL);_.w(HL,Z);HL.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)};
45
- HL.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(uL(a,0),uL(a,0),_.V(a,this.timescale),uL(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));_.V(a,65536);xL(a,this.volume);xL(a,0);_.V(a,0);_.V(a,0);for(var b=0;b<this.h.length;b++)vL(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()};_.w(IL,BL);_.w(JL,Z);JL.prototype.a=function(){return 20+Z.prototype.a.call(this)};
46
- JL.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()};_.w(KL,Z);KL.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)};
47
- KL.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(uL(a,0),uL(a,0),_.V(a,this.j),_.V(a,0),uL(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);xL(a,0);xL(a,0);xL(a,this.volume);xL(a,0);for(var b=0;b<this.h.length;b++)vL(a,this.h[b]);xL(a,this.width);xL(a,0);xL(a,this.height);xL(a,0);a.getPosition()};_.w(LL,Z);LL.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
48
- LL.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(uL(a,0),uL(a,0),_.V(a,this.timescale),uL(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));xL(a,this.language);xL(a,0);a.getPosition()};_.w(ML,Z);ML.prototype.a=function(){return 33+Z.prototype.a.call(this)};
49
- ML.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,0);this.h===_.sg?_.cm(a,AL("vide")):_.cm(a,AL("soun"));_.V(a,0);_.V(a,0);_.V(a,0);this.h===_.sg?_.cm(a,AL("VideoHandler\x00")):_.cm(a,AL("SoundHandler\x00"));a.getPosition()};_.w(NL,Z);NL.prototype.a=function(){return 2+this.h.byteLength+Z.prototype.a.call(this)};NL.prototype.write=function(a){Z.prototype.write.call(this,a);xL(a,0);_.cm(a,this.h);a.getPosition()};_.w(OL,BL);OL.prototype.a=function(){return 8+BL.prototype.a.call(this)};
50
- OL.prototype.write=function(a){BL.prototype.write.call(this,a);_.V(a,0);xL(a,0);xL(a,1)};_.w(PL,OL);PL.prototype.a=function(){return 70+OL.prototype.a.call(this)};PL.prototype.write=function(a){OL.prototype.write.call(this,a);xL(a,0);xL(a,0);_.V(a,0);_.V(a,0);_.V(a,0);xL(a,this.width);xL(a,this.height);_.V(a,4718592);_.V(a,4718592);_.V(a,0);xL(a,1);vL(a,10);_.cm(a,AL("AVC Coding",31));xL(a,this.depth);zL(a,-1)};_.w(QL,OL);QL.prototype.a=function(){return 20+OL.prototype.a.call(this)};
51
- QL.prototype.write=function(a){OL.prototype.write.call(this,a);_.V(a,0);_.V(a,0);xL(a,this.channelCount);xL(a,this.sampleSize);zL(a,0);xL(a,0);xL(a,this.sampleRate);xL(a,0)};_.w(RL,PL);RL.prototype.write=function(a){PL.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.w(SL,RL);_.w(TL,QL);TL.prototype.write=function(a){QL.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.w(UL,TL);_.w(VL,BL);
52
- VL.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.$b[b].byteLength;return a+BL.prototype.a.call(this)};
53
- VL.prototype.write=function(a){BL.prototype.write.call(this,a);vL(a,this.version);vL(a,this.h);vL(a,this.j);vL(a,this.level);vL(a,255);vL(a,224|this.Ua.length);for(var b=0;b<this.Ua.length;b++)xL(a,this.Ua[b].length),_.cm(a,this.Ua[b]);vL(a,this.$b.length);for(b=0;b<this.$b.length;b++)xL(a,this.$b[b].length),_.cm(a,this.$b[b]);a.getPosition()};_.w(WL,Z);WL.prototype.a=function(){return 22+(this.Ob.byteLength+3)+Z.prototype.a.call(this)};
54
- WL.prototype.write=function(a){Z.prototype.write.call(this,a);vL(a,3);vL(a,23+this.Ob.byteLength);xL(a,1);vL(a,0);vL(a,4);vL(a,15+this.Ob.byteLength);vL(a,64);vL(a,21);wL(a,0);_.V(a,0);_.V(a,0);vL(a,5);vL(a,this.Ob.byteLength);_.cm(a,this.Ob);_.cm(a,new Uint8Array([6,1,2]));a.getPosition()};_.w(XL,Z);XL.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};XL.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.cm(a,AL(this.location));a.getPosition()};
55
- _.w(YL,Z);YL.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)};YL.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(ZL,BL);_.w($L,Z);$L.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)};
56
- $L.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(aM,Z);aM.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)};aM.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(bM,Z);
57
- bM.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)};bM.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(cM,Z);cM.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)};
58
- cM.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(dM,Z);dM.prototype.a=function(){return 8+Z.prototype.a.call(this)};dM.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,0);_.V(a,0);a.getPosition()};_.w(eM,Z);eM.prototype.a=function(){return 4+Z.prototype.a.call(this)};eM.prototype.write=function(a){Z.prototype.write.call(this,a);zL(a,0);xL(a,0);a.getPosition()};
59
- _.w(fM,BL);_.w(gM,BL);_.w(hM,BL);_.w(iM,Z);iM.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};iM.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?uL(a,this.h):_.V(a,this.h);a.getPosition()};_.w(jM,Z);jM.prototype.a=function(){return 4+Z.prototype.a.call(this)};jM.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);a.getPosition()};_.w(kM,Z);
60
- kM.prototype.a=function(){var a=4;this.flags&hN&&(a+=4);this.flags&iN&&(a+=4);for(var b=0;b<this.h;b++)this.flags&jN&&(a+=4),this.flags&kN&&(a+=4),this.flags&lN&&(a+=4),this.flags&mN&&(a+=4);return a+Z.prototype.a.call(this)};
61
- kM.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);this.flags&hN&&(a.getPosition(),yL(a,this.l));this.flags&iN&&_.V(a,this.o);for(var b=0;b<this.h;b++)this.flags&jN&&_.V(a,this.w[b]),this.flags&kN&&_.V(a,this.sampleSize[b]),this.flags&lN&&_.V(a,this.B[b]),this.flags&mN&&(0===this.version?_.V(a,this.j[b]):yL(a,this.j[b]));a.getPosition()};var hN=1,iN=4,jN=256,kN=512,lN=1024,mN=2048;_.w(lM,Z);
62
- lM.prototype.a=function(){var a=4;this.flags&nN&&(a+=8);this.flags&oN&&(a+=4);this.flags&pN&&(a+=4);this.flags&qN&&(a+=4);this.flags&rN&&(a+=4);return a+Z.prototype.a.call(this)};lM.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);this.flags&nN&&uL(a,this.j);this.flags&oN&&_.V(a,this.B);this.flags&pN&&_.V(a,this.l);this.flags&qN&&_.V(a,this.w);this.flags&rN&&_.V(a,this.o);a.getPosition()};var nN=1,oN=2,pN=8,qN=16,rN=32;_.w(mM,BL);_.w(nM,BL);_.w(oM,BL);
63
- oM.prototype.a=function(){return this.h.byteLength+BL.prototype.a.call(this)};oM.prototype.write=function(a){BL.prototype.write.call(this,a);0<this.h.byteLength&&_.cm(a,this.h)};_.w(pM,Z);pM.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)};
64
- pM.prototype.write=function(a){Z.prototype.write.call(this,a);vL(a,0);0===this.version?vL(a,0):vL(a,0);vL(a,this.h);vL(a,this.j);_.cm(a,_.gj(this.o));if(1===this.h&&0===this.j){vL(a,0);for(var b=0;b<this.l.length;b++)vL(a,this.l[b])}a.getPosition()};_.w(qM,Z);qM.prototype.a=function(){var a=8;this.flags&1&&(a+=AL(this.Jb).byteLength);return a+Z.prototype.a.call(this)};qM.prototype.write=function(a){Z.prototype.write.call(this,a);_.cm(a,AL(this.h));_.V(a,this.j);this.flags&1&&_.cm(a,AL(this.Jb));a.getPosition()};
65
- _.w(rM,BL);rM.prototype.a=function(){return AL(this.h).byteLength+BL.prototype.a.call(this)};rM.prototype.write=function(a){BL.prototype.write.call(this,a);_.cm(a,AL(this.h));a.getPosition()};_.w(sM,Z);sM.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)};
66
- sM.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]):uL(a,this.offset[b]);a.getPosition()};_.w(tM,Z);tM.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)};
67
- tM.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.V(a,0),_.V(a,0));vL(a,this.h);_.V(a,this.j);if(0===this.h)for(var b=0;b<this.j;b++)vL(a,this.l[b]);a.getPosition()};_.w(uM,Z);uM.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.j;b++)if(a+=this.h[b].Xg.byteLength,this.flags&2){a+=2;for(var c=0;c<this.h[b].dd;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
68
- uM.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.j);this.flags&1&&vL(a,this.l);for(var b=0;b<this.j;b++)if(_.cm(a,this.h[b].Xg),this.flags&2){xL(a,this.h[b].dd);for(var c=0;c<this.h[b].dd;c++)xL(a,this.h[b].Qf[c].fg),_.V(a,this.h[b].Qf[c].gg)}a.getPosition()};var BM=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,CM=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,DM=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,EM=/^(\d*\.?\d*)f$/,FM=/^(\d*\.?\d*)t$/,GM=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;KM.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};KM.prototype.write=function(){this.f=JM(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var NM=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.r=TM.prototype;_.r.configure=function(a){this.f=a};_.r.start=function(a,b){var c=this;this.D=b;var d=_.Og(new Set([a,vM(a)])).concat();return UM(this,d).then(function(e){return aN(c,e.data).then(function(){fN(c,c.A);return c.h})})};_.r.stop=function(){this.D&&this.D.networkingEngine.ze(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()};
69
- _.r.update=function(){var a=this;if(this.qd())return UM(this,[this.l]).then(function(b){return aN(a,b.data).then(function(){return a.h})})["catch"](function(b){if(a.D)a.D.onError(b)})};_.r.onExpirationUpdated=function(){};_.r.setCurrentVariant=function(){};_.r.Hb=function(){var a=this;this.g.debug(_.Yy);this.D&&(this.j=null,this.update().then(function(){fN(a,a.A)})["catch"](function(b){a.D&&(a.D.onError(b),1===b.severity&&fN(a,100))}))};_.r.qd=function(){return this.P===XM};
70
- _.r.mf=function(){return 0<this.o.length};_.r.Lg=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};
71
- _.r.em=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.qd.bind(this),pe:this.mf.bind(this),ck:function(){return 1},je:this.Lg.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=PM(a,b,g,c)}catch(h){d=
72
- !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 dN={video:_.ug,audio:_.dd,text:_.Xc},SM=_.lc,XM="LIVE",eN={Em:_.md,Nm:_.Zf};_.w(gN,_.Ir);gN.prototype.f=function(){_.Fs.ism=TM;_.Ds[_.Yc]=TM};gN.prototype.a=function(){_.CA("ism");_.DA(_.Yc)};gN.prototype.id=function(){return"smooth"};_.H("clpp.smooth.SmoothComponent",gN);};
2
+ var f=function(window){var cN="Full MP4 box must have flags defined",dN="clpp.smooth.SmoothMP4Processor",eN="codecPrivateData",fN=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)},gN=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.Cm()}},hN=function(a,b){gN(a,b>>16&255);gN(a,b>>8&255);gN(a,b&255)},iN=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.Cm()}},jN=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.Cm()}},kN=function(a,b){try{a.f.setInt16(a.a,
3
+ b,a.h),a.a+=2}catch(c){_.Cm()}},lN=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},mN=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){mN.call(this,a);this.version=b;this.flags=c},nN=function(a,b,c){mN.call(this,a);this.h=b;this.offset=c},oN=function(a,b,c,
4
+ d,e){Z.call(this,a,b,c);this.h=d;this.offset=e},pN=function(a,b,c){mN.call(this,"ftyp");this.j=a;this.zh=b;this.h=c},qN=function(){mN.call(this,_.Te)},rN=function(){mN.call(this,_.sg)},sN=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]},tN=function(){mN.call(this,"mvex")},uN=function(a){Z.call(this,"trex",0,0);this.h=a},vN=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]},wN=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},xN=function(a){Z.call(this,"hdlr",0,0);this.h=a},yN=function(){Z.call(this,"vmhd",0,1);this.h=new Uint8Array([0,0,0,0,0,0])},zN=function(a){mN.call(this,a);this.A=!0},AN=function(a){zN.call(this,a);this.height=this.width=0;this.depth=24},BN=
6
+ function(a,b,c,d){zN.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},CN=function(a,b){AN.call(this,"avc1");this.width=a;this.height=b},DN=function(a,b){CN.call(this,a,b);this.type="encv"},EN=function(a,b,c){BN.call(this,"mp4a",a,b,c)},FN=function(a,b,c){EN.call(this,a,b,c);this.type="enca"},GN=function(a,b){mN.call(this,"avcC");this.Ta=a;this.$b=b;this.version=1;this.h=this.Ta[0][1];this.j=this.Ta[0][2];this.level=this.Ta[0][3]},HN=function(a){Z.call(this,"esds",0,0);this.Pb=
7
+ a},IN=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},JN=function(){Z.call(this,"dref",0,0)},KN=function(){mN.call(this,_.gg)},LN=function(){Z.call(this,_.ig,0,0)},MN=function(){Z.call(this,"stts",0,0)},NN=function(){Z.call(this,"stsc",0,0)},ON=function(){Z.call(this,"stco",0,0)},PN=function(){Z.call(this,"stsz",0,0)},QN=function(){Z.call(this,"smhd",0,0)},RN=function(){mN.call(this,"dinf")},SN=function(){mN.call(this,_.Se)},TN=function(){mN.call(this,_.Oe)},UN=function(a,b){Z.call(this,
8
+ "tfdt",a,0);this.baseMediaDecodeTime=b},VN=function(){Z.call(this,"mfhd",0,0);this.h=0},WN=function(a,b){Z.call(this,"trun",a,b);this.o=this.l=this.h=0;this.w=[];this.sampleSize=[];this.B=[];this.j=[]},XN=function(a,b){Z.call(this,"tfhd",a,b);this.h=255;this.o=this.w=this.l=this.B=this.j=0},YN=function(){mN.call(this,"traf")},ZN=function(){mN.call(this,"moof")},$N=function(){mN.call(this,_.Ne);this.h=new Uint8Array(0)},aO=function(){Z.call(this,"tenc",0,0);this.h=1;this.j=8;this.o="";this.l=[]},bO=
9
+ function(a,b){Z.call(this,"schm",0,0);this.h=a;this.j=b;this.Jb=""},cO=function(a){mN.call(this,"frma");this.h=a},dO=function(){Z.call(this,"saio",0,0);this.offset=[0]},eO=function(a,b,c){Z.call(this,"saiz",0,0);this.h=a;this.l=b;this.j=c},fO=function(a,b){Z.call(this,"senc",a,b);this.j=0;this.l=8;this.h=[]},gO=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},hO=function(a,b,c,d){c=b.Yg[c];b=b.an;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 _.Pi([a],[b])[0]},iO=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.Fg?c=["maxWidth","maxHeight","bitrate",eN,"fourCC"]:a.type===_.bd&&(c=["bitrate",eN,"channels","bitsPerSample","samplingRate","fourCC"]);return _.O.ka(a,b,c,["id","segmentIndex"])},jO=function(a,b,c){var d=c.oe.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Ta:null,
11
+ $b:null,width:NaN,height:NaN,Pb:null,Wd:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.Fg:a.Ta=[_.yj(d[1])];a.$b=[_.yj(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.bd:a.Pb=_.yj(c.oe),a.sampleSize=c.Hi||16,a.Wd=c.Wd,a.channelCount=c.wg}return a},kO=function(a,b){return a.filter(function(c){return c.type===b})},lO=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)},sO=function(a,
12
+ b,c){var d=null;if(mO.test(a)){a=mO.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 nO.test(a)?d=lO(nO,a):oO.test(a)?d=lO(oO,a):pO.test(a)?(a=pO.exec(a),d=Number(a[1])/c.frameRate):qO.test(a)?(a=qO.exec(a),d=Number(a[1])/c.a):rO.test(a)&&(d=lO(rO,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},tO=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))},vO=function(a){this.a=a;this.f=uO(this)},uO=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.Bm(b)},wO=function(a,b,c){a:{var d=_.t([_.Td,_.Rd]);for(var e=d.next();!e.done;e=d.next())if((e=c.se(e.value))&&e.keyId){d=e.keyId;break a}_.J(dN,
14
+ "Could not get default Key ID for DRM init data!");d=null}c=new mN("xxxx");a.type===_.Fg?c=new DN(a.width,a.height):c=new FN(a.channelCount,a.sampleSize,a.Wd);a=new aO;a.h=1;a.j=8;a.o=d||"00000000000000000000000000000000";a=(new mN("schi")).append([a]);b=(new mN(_.bg)).append([new cO(b),new bO(_.td,65536),a]);c.append([b]);return c},xO=function(a,b){var c=b.ve(),d=new sN(a.timescale,a.duration,a.id),e=(new tN).append([new uN(a.id)]),f=new vN(a.id,a.duration,a.timescale,a.width,a.height),g=new wN(a.timescale,
15
+ a.duration),h=new xN(a.type),l=null,m=new JN;m.entries=[new IN];var n=new LN;switch(a.type){case _.Fg:var p=new GN(a.Ta,a.$b);c?(l=wO(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new CN(a.width,a.height)).append([p]),n.entries=[l]);l=new yN;break;case _.bd:p=new HN(a.Pb),c?(l=wO(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new EN(a.channelCount,a.sampleSize,a.Wd)).append([p]),n.entries=[l]),l=new QN}n=(new KN).append([n,new MN,new NN,new PN,new ON]);m=(new RN).append([m]);m=(new SN).append([l,m,n]);
16
+ g=(new TN).append([g,h,m]);f=(new rN).append([f,g]);d=(new qN).append([d,f,e]);e=new pN("dash",0,["iso6","mp41","avc1"]);c&&(c=b.se(_.Rd),f=b.se(_.Td),c&&d.append([new nN("pssh",c.initData,8)]),f&&d.append([new nN("pssh",f.initData,8)]),c||f||_.J(dN,"Could not get PSSH init data!"));c=new vO([e,d]);return _.lj(c.write())},zO=function(a,b){var c,d,e,f,g,h;(new _.Pm).M("moof",_.Qm).Y("mfhd",function(m){var n=new VN;n.h=_.W(m.reader);c=n}).M("traf",_.Qm).Y("tfhd",function(m){var n=m.reader.Fa();if(null===
17
+ m.flags)throw new _.P(_.Q,3,3019,cN);var p=new XN(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.Fa();if(null===m.flags)throw new _.P(_.Q,3,3019,cN);var p=new WN(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.Fa());f=new oN("sdtp",m.version||0,m.flags||0,
19
+ n,0)}).M("uuid",function(m){var n=_.Mm(m.reader,16);if(_.Aj(n,yO)){n=_.W(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new fO(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={nh:_.Mm(m.reader,8),fd:0,bg:[]};if(m.flags&2){q.fd=_.Im(m.reader);for(var u=0;u<q.fd;u++){var v={ug:0,vg:0};v.ug=_.Im(m.reader);v.vg=_.W(m.reader);q.bg.push(v)}}n.h.push(q)}g=n}}).M(_.Ne,function(m){var n=new $N;0<m.reader.Fa()?n.h=_.Mm(m.reader,m.reader.Fa()):(_.J(dN,"mdat box is empty!"),
20
+ n.h=new Uint8Array(0));h=n}).parse(a,!1);if(!h)return null;var l=(new YN).append([d,e]);f&&l.append([f]);b.ve()&&g&&l.append([g]);l=(new ZN).append([c,l]);return new vO([l,h])},AO=function(a,b,c,d){var e=d.ve(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=zO(b,d);if(null===g)return a.request.contentType===_.Ri?a.data:g;d=g.get(_.Ne);if(a.request.contentType===_.Ri){e=d.h.buffer;if(c){e=_.R.zd(e);if((e=(new DOMParser).parseFromString(e,_.og))&&"tt"===e.documentElement.tagName.toLowerCase())var h=
21
+ e.documentElement;if(h&&(d=new tO(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 B=q[v].name;if(B=B.match(u)){p=
22
+ p.getAttribute(B[0]);break b}}p=null}}f.setAttribute(l[m],sO(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.R.Ua(e).buffer}else c=e;return c}h=new ZN;a=g.get("mfhd");b=new YN;l=g.get("tfhd");m=new UN(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].fd);else g=8;b.append([c,new dO,new eO(g,l,c.j)])}h.append([a,b]);f.flags|=1;f.l=h.a()+8;d=
23
+ new vO([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},BO=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},CO=function(a,b,c){a=_.Wn(a);c&&a.version!==c&&(a=_.tA(a,c));return{initData:_.rA(a),initDataType:_.td,keyId:b,periodId:null}},EO=function(){this.w=this.h=this.f=
24
+ this.C=null;this.N=1;this.T=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=DO;this.H=0;this.D=this.I=Infinity;this.o=[];this.K=this.Bm.bind(this);this.G=new Map},FO=function(a,b){var c,d,e;return _.E(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),_.x(f,d.P,2);e=f.f;a.l=e.uri;return f["return"](e)})},MO=function(a,b){var c=null;try{var d=new DOMParser;try{var e=_.R.zd(b);var f=d.parseFromString(e.trim(),_.og)}catch(nG){throw nG;}if(f&&f.documentElement.tagName===_.cc)var g=f.documentElement;c=g&&0<g.getElementsByTagName("parsererror").length?null:g}catch(nG){}if(!c)throw a.g.error("Unable to parse manifest"),new _.P(_.Q,4,4033,a.l);var h=+GO(a,c,"MajorVersion"),
26
+ l=+GO(a,c,"MinorVersion"),m=+c.getAttribute("TimeScale")||1E7,n=+GO(a,c,"Duration"),p="TRUE"===c.getAttribute("IsLive"),q=+c.getAttribute("LookAheadCount"),u=+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 _.P(_.Q,4,4036,a.l);p?(HO(a,IO),a.A=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.H,1E4),n=Infinity):HO(a,DO);a.a={startTime:0,delay:0,
27
+ duration:n/m,pf:u/m,Qd:0};if(v){var z=a.f.playreadyVersion,B=[],I=_.Cn(v,"ProtectionHeader")[0],F=_.xj(_.En(I)||""),D=_.Wn(F).a;B.push(BO(_.Td,{initData:_.rA(_.Jn(D)),initDataType:_.td,keyId:D,periodId:null},[D]));B.push(BO(_.Rd,CO(F,D,z),[D]));a.o=B}var G=[],M=_.Cn(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 S,oa=a,Ba=M[N],$a=GO(oa,Ba,"Type"),ab=+Ba.getAttribute("Chunks"),Pa=Ba.getAttribute("Subtype"),Ca=Ba.getAttribute("Language")||
28
+ _.vg,db=_.dj(Ca),ic=Ba.getAttribute("Name")||"",pg=+Ba.getAttribute(_.yb),qg=+Ba.getAttribute(_.xb),Nm=GO(oa,Ba,"Url"),kt=+Ba.getAttribute("TimeScale")||null,Vc=[],Om=_.Cn(Ba,_.Rb),Tt=0;Tt<Om.length;Tt++){var rf=void 0,kc=void 0,Ut=void 0,sf=oa,zd=Om[Tt],Vt=$a,vS=+zd.getAttribute("Index"),wS=+GO(sf,zd,"Bitrate"),qG=NaN,rG=NaN,Kn=NaN,Wt=NaN,sG=NaN,tG=NaN,uG=NaN,vG=zd.getAttribute("FourCC");switch(Vt){case _.Fg:qG=+GO(sf,zd,_.xb);rG=+GO(sf,zd,_.yb);break;case _.bd:Wt=+zd.getAttribute("Channels")||2,
29
+ Kn=+GO(sf,zd,"SamplingRate"),tG=+GO(sf,zd,"AudioTag"),sG=+GO(sf,zd,"BitsPerSample"),uG=+GO(sf,zd,"PacketSize")}var Xt=String(zd.getAttribute("CodecPrivateData"));if(Vt===_.bd&&!Xt){var wG=Wt,xG={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},Ln=xG[Kn];if("AACH"===vG){kc=new Uint8Array(4);var yG=xG[2*Kn];kc[0]=40|Ln>>1;kc[1]=Ln<<7|wG<<3|yG>>1;kc[2]=yG<<7|8;kc[3]=0;rf=new Uint16Array(2);rf[0]=(kc[0]<<8)+kc[1];rf[1]=(kc[2]<<8)+kc[3];Ut=rf[0].toString(16)+
30
+ rf[1].toString(16)}else kc=new Uint8Array(2),kc[0]=16|Ln>>1,kc[1]=Ln<<7|wG<<3,rf=new Uint16Array(1),rf[0]=(kc[0]<<8)+kc[1],Ut=rf[0].toString(16);Xt=Ut.toUpperCase()}var xS={id:sf.T++,type:Vt,index:vS,bitrate:wS,oe:Xt,maxHeight:qG,maxWidth:rG,Wd:Kn,wg:Wt,un:tG,Hi:sG,Kn:uG,pk:vG,segmentIndex:null};Vc.push(xS)}S=Vc;for(var Ee=[],zG=_.Cn(Ba,"c"),Wj=0;Wj<zG.length;Wj++){var Yt=zG[Wj],Wd=parseInt(Yt.getAttribute("t"),10),Lh=parseInt(Yt.getAttribute("d"),10),Zt=parseInt(Yt.getAttribute("r"),10),Xj=0;if(isNaN(Wd)&&
31
+ isNaN(Lh))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===Wj&&isNaN(Wd)&&(Xj=Wd=0);if(0<Wj){var tg=Ee[Ee.length-1];Xj=tg.n+1;tg.d||(tg.d=Wd-tg.t);Wd||(Wd=tg.t+tg.d);Lh||(Lh=Wd-tg.t)}Ee.push({n:Xj,d:Lh,t:Wd});if(Zt){Zt--;for(var AG=0;AG<Zt;AG++){var Mn=Ee[Ee.length-1];Xj=Mn.n+1;Wd=Mn.t+Mn.d;Lh=Mn.d;Ee.push({n:Xj,d:Lh,t:Wd})}}}oa.rd()||Ee.length===ab||oa.g.warn("Number of fragments ("+ab+") differs from number of chunks ("+
32
+ Ee.length+").");G.push({type:$a,yn:ab,Nm:Pa,language:db,Pd:Ca,name:ic,maxWidth:pg,maxHeight:qg,an:Nm,tracks:S,Yg:Ee,timescale:kt})}var tf={In:h,zh:l,timescale:m,duration:n,isLive:p,Hn:q,pf:u,zf:!1,streams:G};if(a.h&&a.w)return JO(a,tf),Promise.resolve();a.G.clear();var $t=tf.timescale,Nn=tf.duration,zS=kO(tf.streams,_.bd),AS=kO(tf.streams,_.Fg),BS=kO(tf.streams,_.Ri),BG=[],On=KO(a,Nn,$t,zS),Pn=KO(a,Nn,$t,AS),CS=KO(a,Nn,$t,BS);On.length||(On=[null]);Pn.length||(Pn=[null]);for(var bu=0;bu<Pn.length;bu++)for(var cu=
33
+ 0;cu<On.length;cu++)BG.push(LO(a,Pn[bu],On[cu]));var CG={id:"ID",configurationId:void 0,startTime:0,endTime:Nn,variants:BG,textStreams:CS,thumbStreams:[]};var ES=tf.streams,du=a.a.startTime,DG=a.a.delay,eu=a.I,EG=Math.min(a.a.duration||Infinity,eu),fu=a.rd(),FS=a.a.pf,GS=a.a.Qd,FG=a.H,GG=isFinite(a.D)?a.D:0;if(fu)EG=Infinity,du=Date.now()/1E3-GS,a.a.startTime=du,DG=3*FG;else for(var HS=isFinite(eu)?eu:a.a.duration,HG=_.t(ES),gu=HG.next();!gu.done;gu=HG.next())for(var IG=_.t(gu.value.tracks),hu=IG.next();!hu.done;hu=
34
+ IG.next()){var JG=hu.value;JG.segmentIndex.offset(-GG);_.WA(JG.segmentIndex,HS)}a.B=new _.dB(a.f.timeline||{},du,DG,!fu,!0);a.B.f=EG;_.lB(a.B,FG);a.B.A=FS;fu||a.B.offset(-GG);a.C.filterAllPeriods([CG]);a.h={presentationTimeline:a.B,periods:[CG],minBufferTime:0};Promise.resolve();a.J||(a.C.networkingEngine.ld(a.K),a.J=!0);a.w=tf;return Promise.resolve()},JO=function(a,b){for(var c=0;c<a.w.streams.length;c++)for(var d=b.streams[c],e={},f=_.t(a.w.streams[c].tracks),g=f.next();!g.done;e={Nb:e.Nb},g=f.next())if(e.Nb=
35
+ g.value,g=d.tracks.find(function(l){return function(m){return m.type===l.Nb.type&&m.bitrate===l.Nb.bitrate}}(e))){iO(e.Nb,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=NO(a,a.w.timescale,d,g);g=e.Nb.segmentIndex;g.na(h);(h=a.a.pf)&&_.CB(g,_.BB(g)-h).forEach(function(l){l.Qa().forEach(function(m){a.G["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.Nb.type+" track with bitrate "+(e.Nb.bitrate+". Skipping update."))},
36
+ KO=function(a,b,c,d){for(var e=[],f={Fc:0};f.Fc<d.length;f={Fc:f.Fc},f.Fc++){var g=d[f.Fc].tracks.map(function(h){return function(l){var m=d[h.Fc],n=NO(a,c,m,l);n=new _.AB(n);var p=null;m.type!==_.Ri&&(p=OO(a,b,c,m,l));l.segmentIndex=n;var q=_.$G++,u=Promise.resolve.bind(Promise),v=n.Pc.bind(n),z=n.get.bind(n),B=n.md.bind(n),I=n.getDuration.bind(n),F=PO[m.type],D="";switch(m.type){case _.Fg:D=l.oe;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 _.bd:D=l.oe,G=2,"AACH"===l.pk?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===_.Ri?QO[m.Nm]:void 0;return{id:q,originalId:null,Mn:null,createSegmentIndex:u,findSegmentPosition:v,getSegmentReference:z,adjustSegmentDurations:B,getDuration:I,segmentIndex:n,segmentLookupStrategy:_.cA,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.Af(),
38
+ keyId:null,language:m.language,originalLanguage:m.Pd,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.wg||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},NO=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.Yg.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=hO(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===_.Fg||c.type===_.bd)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.Qd?a.a.Qd=b.endTime:a.a.Qd=Math.min(a.a.Qd,b.endTime);return f},OO=function(a,b,c,d,e){b=jO(b,d.timescale||c,e);c={isLive:a.rd.bind(a),ve:a.Af.bind(a),xk:function(){return 1},se:a.ah.bind(a)};d=new Uint8Array(0);try{d=xO(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 _.DA(function(){return[f]},0,null,null,!0)},
40
+ LO=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},GO=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);},RO=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.Hb.bind(a),b))},HO=function(a,b){var c=b===DO;a.h&&a.h.presentationTimeline&&_.gB(a.h.presentationTimeline,
41
+ c);c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.L=b},SO=function(){};mN.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};mN.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
+ mN.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
+ mN.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,lN(this.type));this.size>b&&fN(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()};_.w(Z,mN);Z.prototype.a=function(){return 4+mN.prototype.a.call(this)};Z.prototype.write=function(a){mN.prototype.write.call(this,a);gN(a,this.version);hN(a,this.flags)};
44
+ _.w(nN,mN);nN.prototype.a=function(){return this.h.byteLength+mN.prototype.a.call(this)-this.offset};nN.prototype.write=function(a){mN.prototype.write.call(this,a);_.Dm(a,this.h,this.offset);a.getPosition()};_.w(oN,Z);oN.prototype.a=function(){return this.h.byteLength+Z.prototype.a.call(this)-this.offset};oN.prototype.write=function(a){Z.prototype.write.call(this,a);_.Dm(a,this.h,this.offset);a.getPosition()};_.w(pN,mN);
45
+ pN.prototype.a=function(){var a=this.j.length;a=a+4+this.h.join("").length;return a+mN.prototype.a.call(this)};pN.prototype.write=function(a){mN.prototype.write.call(this,a);_.Dm(a,lN(this.j));_.V(a,this.zh);_.Dm(a,lN(this.h.join("")));a.getPosition()};_.w(qN,mN);_.w(rN,mN);_.w(sN,Z);sN.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
+ sN.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(fN(a,0),fN(a,0),_.V(a,this.timescale),fN(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));_.V(a,65536);iN(a,this.volume);iN(a,0);_.V(a,0);_.V(a,0);for(var b=0;b<this.h.length;b++)gN(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()};_.w(tN,mN);_.w(uN,Z);uN.prototype.a=function(){return 20+Z.prototype.a.call(this)};
47
+ uN.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()};_.w(vN,Z);vN.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
+ vN.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(fN(a,0),fN(a,0),_.V(a,this.j),_.V(a,0),fN(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);iN(a,0);iN(a,0);iN(a,this.volume);iN(a,0);for(var b=0;b<this.h.length;b++)gN(a,this.h[b]);iN(a,this.width);iN(a,0);iN(a,this.height);iN(a,0);a.getPosition()};_.w(wN,Z);wN.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
49
+ wN.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(fN(a,0),fN(a,0),_.V(a,this.timescale),fN(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));iN(a,this.language);iN(a,0);a.getPosition()};_.w(xN,Z);xN.prototype.a=function(){return 33+Z.prototype.a.call(this)};
50
+ xN.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,0);this.h===_.Fg?_.Dm(a,lN("vide")):_.Dm(a,lN("soun"));_.V(a,0);_.V(a,0);_.V(a,0);this.h===_.Fg?_.Dm(a,lN("VideoHandler\x00")):_.Dm(a,lN("SoundHandler\x00"));a.getPosition()};_.w(yN,Z);yN.prototype.a=function(){return 2+this.h.byteLength+Z.prototype.a.call(this)};yN.prototype.write=function(a){Z.prototype.write.call(this,a);iN(a,0);_.Dm(a,this.h);a.getPosition()};_.w(zN,mN);zN.prototype.a=function(){return 8+mN.prototype.a.call(this)};
51
+ zN.prototype.write=function(a){mN.prototype.write.call(this,a);_.V(a,0);iN(a,0);iN(a,1)};_.w(AN,zN);AN.prototype.a=function(){return 70+zN.prototype.a.call(this)};AN.prototype.write=function(a){zN.prototype.write.call(this,a);iN(a,0);iN(a,0);_.V(a,0);_.V(a,0);_.V(a,0);iN(a,this.width);iN(a,this.height);_.V(a,4718592);_.V(a,4718592);_.V(a,0);iN(a,1);gN(a,10);_.Dm(a,lN("AVC Coding",31));iN(a,this.depth);kN(a,-1)};_.w(BN,zN);BN.prototype.a=function(){return 20+zN.prototype.a.call(this)};
52
+ BN.prototype.write=function(a){zN.prototype.write.call(this,a);_.V(a,0);_.V(a,0);iN(a,this.channelCount);iN(a,this.sampleSize);kN(a,0);iN(a,0);iN(a,this.sampleRate);iN(a,0)};_.w(CN,AN);CN.prototype.write=function(a){AN.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.w(DN,CN);_.w(EN,BN);EN.prototype.write=function(a){BN.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.w(FN,EN);_.w(GN,mN);
53
+ GN.prototype.a=function(){for(var a=7,b=0;b<this.Ta.length;b++)a+=2,a+=this.Ta[b].byteLength;for(b=0;b<this.Ta.length;b++)a+=2,a+=this.$b[b].byteLength;return a+mN.prototype.a.call(this)};
54
+ GN.prototype.write=function(a){mN.prototype.write.call(this,a);gN(a,this.version);gN(a,this.h);gN(a,this.j);gN(a,this.level);gN(a,255);gN(a,224|this.Ta.length);for(var b=0;b<this.Ta.length;b++)iN(a,this.Ta[b].length),_.Dm(a,this.Ta[b]);gN(a,this.$b.length);for(b=0;b<this.$b.length;b++)iN(a,this.$b[b].length),_.Dm(a,this.$b[b]);a.getPosition()};_.w(HN,Z);HN.prototype.a=function(){return 22+(this.Pb.byteLength+3)+Z.prototype.a.call(this)};
55
+ HN.prototype.write=function(a){Z.prototype.write.call(this,a);gN(a,3);gN(a,23+this.Pb.byteLength);iN(a,1);gN(a,0);gN(a,4);gN(a,15+this.Pb.byteLength);gN(a,64);gN(a,21);hN(a,0);_.V(a,0);_.V(a,0);gN(a,5);gN(a,this.Pb.byteLength);_.Dm(a,this.Pb);_.Dm(a,new Uint8Array([6,1,2]));a.getPosition()};_.w(IN,Z);IN.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};IN.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.Dm(a,lN(this.location));a.getPosition()};
56
+ _.w(JN,Z);JN.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)};JN.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(KN,mN);_.w(LN,Z);LN.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
+ LN.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(MN,Z);MN.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)};MN.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(NN,Z);
58
+ NN.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)};NN.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(ON,Z);ON.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
+ ON.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(PN,Z);PN.prototype.a=function(){return 8+Z.prototype.a.call(this)};PN.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,0);_.V(a,0);a.getPosition()};_.w(QN,Z);QN.prototype.a=function(){return 4+Z.prototype.a.call(this)};QN.prototype.write=function(a){Z.prototype.write.call(this,a);kN(a,0);iN(a,0);a.getPosition()};
60
+ _.w(RN,mN);_.w(SN,mN);_.w(TN,mN);_.w(UN,Z);UN.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};UN.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?fN(a,this.baseMediaDecodeTime):_.V(a,this.baseMediaDecodeTime);a.getPosition()};_.w(VN,Z);VN.prototype.a=function(){return 4+Z.prototype.a.call(this)};VN.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);a.getPosition()};_.w(WN,Z);
61
+ WN.prototype.a=function(){var a=4;this.flags&TO&&(a+=4);this.flags&UO&&(a+=4);for(var b=0;b<this.h;b++)this.flags&VO&&(a+=4),this.flags&WO&&(a+=4),this.flags&XO&&(a+=4),this.flags&YO&&(a+=4);return a+Z.prototype.a.call(this)};
62
+ WN.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);this.flags&TO&&(a.getPosition(),jN(a,this.l));this.flags&UO&&_.V(a,this.o);for(var b=0;b<this.h;b++)this.flags&VO&&_.V(a,this.w[b]),this.flags&WO&&_.V(a,this.sampleSize[b]),this.flags&XO&&_.V(a,this.B[b]),this.flags&YO&&(0===this.version?_.V(a,this.j[b]):jN(a,this.j[b]));a.getPosition()};var TO=1,UO=4,VO=256,WO=512,XO=1024,YO=2048;_.w(XN,Z);
63
+ XN.prototype.a=function(){var a=4;this.flags&ZO&&(a+=8);this.flags&$O&&(a+=4);this.flags&aP&&(a+=4);this.flags&bP&&(a+=4);this.flags&cP&&(a+=4);return a+Z.prototype.a.call(this)};XN.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);this.flags&ZO&&fN(a,this.j);this.flags&$O&&_.V(a,this.B);this.flags&aP&&_.V(a,this.l);this.flags&bP&&_.V(a,this.w);this.flags&cP&&_.V(a,this.o);a.getPosition()};var ZO=1,$O=2,aP=8,bP=16,cP=32;_.w(YN,mN);_.w(ZN,mN);_.w($N,mN);
64
+ $N.prototype.a=function(){return this.h.byteLength+mN.prototype.a.call(this)};$N.prototype.write=function(a){mN.prototype.write.call(this,a);0<this.h.byteLength&&_.Dm(a,this.h)};_.w(aO,Z);aO.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
+ aO.prototype.write=function(a){Z.prototype.write.call(this,a);gN(a,0);0===this.version?gN(a,0):gN(a,0);gN(a,this.h);gN(a,this.j);_.Dm(a,_.yj(this.o));if(1===this.h&&0===this.j){gN(a,0);for(var b=0;b<this.l.length;b++)gN(a,this.l[b])}a.getPosition()};_.w(bO,Z);bO.prototype.a=function(){var a=8;this.flags&1&&(a+=lN(this.Jb).byteLength);return a+Z.prototype.a.call(this)};bO.prototype.write=function(a){Z.prototype.write.call(this,a);_.Dm(a,lN(this.h));_.V(a,this.j);this.flags&1&&_.Dm(a,lN(this.Jb));a.getPosition()};
66
+ _.w(cO,mN);cO.prototype.a=function(){return lN(this.h).byteLength+mN.prototype.a.call(this)};cO.prototype.write=function(a){mN.prototype.write.call(this,a);_.Dm(a,lN(this.h));a.getPosition()};_.w(dO,Z);dO.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
+ dO.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]):fN(a,this.offset[b]);a.getPosition()};_.w(eO,Z);eO.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
+ eO.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.V(a,0),_.V(a,0));gN(a,this.h);_.V(a,this.j);if(0===this.h)for(var b=0;b<this.j;b++)gN(a,this.l[b]);a.getPosition()};_.w(fO,Z);fO.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.j;b++)if(a+=this.h[b].nh.byteLength,this.flags&2){a+=2;for(var c=0;c<this.h[b].fd;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
69
+ fO.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.j);this.flags&1&&gN(a,this.l);for(var b=0;b<this.j;b++)if(_.Dm(a,this.h[b].nh),this.flags&2){iN(a,this.h[b].fd);for(var c=0;c<this.h[b].fd;c++)iN(a,this.h[b].bg[c].ug),_.V(a,this.h[b].bg[c].vg)}a.getPosition()};var mO=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,nO=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,oO=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,pO=/^(\d*\.?\d*)f$/,qO=/^(\d*\.?\d*)t$/,rO=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;vO.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};vO.prototype.write=function(){this.f=uO(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var yO=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.r=EO.prototype;_.r.configure=function(a){this.f=a};_.r.start=function(a,b){var c=this;this.C=b;var d=_.ah(new Set([a,gO(a)])).concat();return FO(this,d).then(function(e){return MO(c,e.data).then(function(){RO(c,c.A);return c.h})})};_.r.requestStop=function(){};_.r.stop=function(){this.C&&this.C.networkingEngine.Ie(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
+ _.r.update=function(){var a=this;if(this.rd())return FO(this,[this.l]).then(function(b){return MO(a,b.data).then(function(){return a.h})})["catch"](function(b){if(a.C)a.C.onError(b)})};_.r.setCurrentVariant=function(){};_.r.Hb=function(){var a=this;this.g.debug(_.Wz);this.C&&(this.j=null,this.update().then(function(){RO(a,a.A)})["catch"](function(b){a.C&&(a.C.onError(b),1===b.severity&&RO(a,100))}))};_.r.rd=function(){return this.L===IO};_.r.Af=function(){return 0<this.o.length};
71
+ _.r.ah=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
+ _.r.Bm=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.rd.bind(this),ve:this.Af.bind(this),xk:function(){return 1},se:this.ah.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=AO(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 PO={video:_.Hg,audio:_.fd,text:_.Zc},DO=_.oc,IO="LIVE",QO={cn:_.pd,mn:_.kg};_.w(SO,_.Cs);SO.prototype.f=function(){_.Ct.ism=EO;_.At[_.$c]=EO};SO.prototype.a=function(){_.dC("ism");_.eC(_.$c)};SO.prototype.id=function(){return"smooth"};_.H("clpp.smooth.SmoothComponent",SO);};
73
74
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
74
75
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
75
76
  else{_=this.clpp._;(f.call(g,this));}
@@ -1,30 +1,30 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var dx="No thumbnail found for position: ",ex="Position is out of range: ",fx="Thumbnail URL is mandatory",gx="Wrong gridSize format",hx="clpp.thumbnails",ix=function(){this.log=new _.K(hx);this.player=null;this.a=[];this.w=!1},kx=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Te&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return jx(a,0,e,!!f)})},Promise.resolve())},jx=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return lx(a,d).then(function(){return a.a[b].load()}).then(function(){return jx(a,
3
- e,c,d)})},lx=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.Mo)c();else a.player.one(_.id,function(){c()})})},mx=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.la=p;this.Bj=h;this.fm=l;this.qk=m;this.rk=n;this.Yb=null},nx=function(){ix.call(this);
4
- this.f=null;this.o=this.h=1;this.j=0},ox=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Kd=new _.wj},px=function(){this.g=new _.K(hx);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.wj},qx=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.Kd.resolve()})},sx=function(a,b){return rx(a,b).then(function(c){return new mx(c,b.time,b.duration)})},rx=function(a,b){return b.load().then(function(){var c=_.Ui(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
- _.dj(c)})},tx=function(){ix.call(this);this.f=null},ux=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},vx=function(){ix.apply(this,arguments)},wx=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Dd:c,Wf:d,Wg:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},xx=function(){this.g=new _.K(hx);this.a=this.m=null},yx=function(a){return a.some(function(b){return 0<
6
- b.thumbStreams.length})},Dx=function(a){return a?a===zx||a===Ax?new nx:a===Bx?new tx:a===Cx?new px:null:null},Ex=function(a){if(!a)return null;a=new _.Xj(a);return a.path.match(/.*\.vtt$/i)?Bx:a.path.match(/.*\.bif$/i)?Cx:a.path.match(/.*\.(png|jpg|jpeg)$/i)?zx:null},Fx=function(){};ix.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Gf,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&kx(c,b.preload)})};mx.prototype.raw=function(){return this.la.cloneNode(!1)};
7
- mx.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(_.Yd);e.style.width=c+_.Df;e.style.height=d+_.Df;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.la.naturalWidth||this.la.width))+"px "+Math.ceil(d/
8
- this.height*(this.la.naturalHeight||this.la.height))+_.Df;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Df;e.style.backgroundPositionY="-"+f*d+_.Df;return e};
9
- mx.prototype.load=function(){var a=this;this.Yb||(this.Yb=new Promise(function(b,c){function d(){a.width||(a.width=(a.la.naturalWidth||a.la.width)/a.Bj);a.height||(a.height=(a.la.naturalHeight||a.la.height)/a.fm);a.x||(a.x=a.width*a.qk);a.y||(a.y=a.height*a.rk)}if(a.la.src&&a.la.complete)d(),b(a);else{var e=null,f=function(){d();a.la.removeEventListener("load",f);a.la.removeEventListener(_.ne,e);b(a)};e=function(g){a.la.removeEventListener("load",f);a.la.removeEventListener(_.ne,e);c(new _.P(1,9,
10
- 2014,"Failed to load thumbnail.",g))};a.la.addEventListener("load",f);a.la.addEventListener(_.ne,e);a.la.src=a.src}}));return this.Yb};_.H("clpp.thumbnails.Thumbnail",mx);mx.prototype.load=mx.prototype.load;mx.prototype.element=mx.prototype.element;mx.prototype.raw=mx.prototype.raw;_.w(nx,ix);
11
- nx.prototype.init=function(a,b){if(!b||!b.url)throw new _.P(1,9,7100,fx);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,gx);}catch(d){throw this.log.error("Error during parsing gridSize",d),
12
- new _.P(1,9,7100,gx);}ix.prototype.init.call(this,a,b)};nx.prototype.get=function(a){var b=this,c,d,e,f;return _.E(function(g){if(1==g.a){c=b.player.getDuration();if(0>a||a>c)throw new _.P(1,9,2014,ex+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 _.x(g,f.load(),2)}return g["return"](f)})};
13
- nx.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 mx(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()};ox.prototype.load=function(){return this.Kd};
14
- px.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.P(1,9,7100,fx);var d=b.url,e=_.rj(d);e.type=_.qj;a.getNetworkEngine().fetch(e).O.then(function(f){f=f.data;var g=_.Ui(c.f);f=_.Ui(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=_.Ui(l);n=String.fromCharCode.apply(null,
15
- Gx);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 ox(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
- qx(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))})};px.prototype.get=function(a){var b=this,c,d;return _.E(function(e){switch(e.a){case 1:if(0>a)throw new _.P(1,9,2014,ex+a);return _.x(e,b.h,2);case 2:c=b.a.find(function(f){return a>=f.time&&a<f.time+f.duration});if(!c)throw new _.P(1,9,2014,dx+a);return _.x(e,sx(b,c),3);case 3:return d=e.f,_.x(e,d.load(),4);case 4:return e["return"](d)}})};
17
- px.prototype.Cd=function(){return 0<this.a.length};var Gx=[137,66,73,70,13,10,26,10];_.w(tx,ix);
18
- tx.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.P(1,9,7100,fx);var d=b.url,e=_.rj(d);e.type=_.qj;this.f=a.getNetworkEngine().fetch(e).O.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.R.Z(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=ux(l[0]);l=ux(l[1])-t;c.a.push(new mx(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 _.P(1,9,2013,"Error while loading VTT thumbnails.",f))});ix.prototype.init.call(this,a,b)};
20
- tx.prototype.get=function(a){var b=this,c;return _.E(function(d){if(1==d.a){if(0>a)throw new _.P(1,9,2014,ex+a);return _.x(d,b.f,2)}if(3!=d.a){c=b.a.find(function(e){return a>=e.time&&a<e.time+e.duration});if(!c)throw new _.P(1,9,2014,dx+a);return _.x(d,c.load(),3)}return d["return"](c)})};tx.prototype.l=function(){return this.f};_.w(vx,ix);
21
- vx.prototype.get=function(a){function b(){return new _.P(1,9,2014,dx+a)}var c=this,d,e,f,g,h,l,m,n,p,q,t,v,z;return _.E(function(D){if(1==D.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.P(1,9,2014,ex+a);d=c.player.getPeriods();for(var G=null,F=_.u(d),B=F.next();!B.done;B=F.next())B=B.value,B.startTime<=a&&(G=B);e=G;if(!e)throw c.log.error("Could not find period for specified position",a),b();f=e.thumbStreams.sort(c.f)[0];if(!f)throw c.log.error("Could not find thumb stream for specified position",a),
22
- b();g=f.findSegmentPosition(a-e.startTime);if(null===g||void 0===g)throw c.log.error("Could not find segment index for specified position",a),b();h=f.getSegmentReference(g);if(!h)return D.F(2);l=wx(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.Wg+m])):(q=h.Sa())&&0<q.length&&(v=t=0,z=h.startTime,1<l.Wg&&(t=m%l.Dd,v=Math.floor(m/l.Dd),z+=m*l.durationPerTile),n=new mx(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.Dd,l.Wf,
23
- t,v));return n?_.x(D,n.load(),4):D.F(2)}if(2!=D.a)return D["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};vx.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
- vx.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.u(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value.thumbStreams.sort(this.f)[0])for(var c=b.findSegmentPosition(0),d=void 0;null!==c&&!_.N.R(d=b.getSegmentReference(c++));)for(var e=wx(d,b),f=d.Sa()[0],g=new Image,h=d.startTime,l=0;l<e.Wf;++l)for(var m=0;m<e.Dd;++m)this.a.push(new mx(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Dd,e.Wf,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.r=xx.prototype;_.r.onPlayerCreated=function(a){this.m=a};_.r.onPlayerWillDestroy=function(){this.m=null};_.r.onPlayerWillRelease=function(){this.a=null};
25
- _.r.onContentWillLoad=function(a){var b=this,c=a.getConfiguration().thumbnails;if(c)if(!1===c.enabled)this.g.info("Thumbnails disabled.");else{var d=c.mode||null;d||(d=Ex(c.url||null));(this.a=Dx(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Fe,function(){b.g.info("Initialize thumbnails provider");try{b.a.init(a,c)}catch(e){b.m.onError(e)}})):this.g.warn("Unknown thumbnail mode",d)}else this.a=null};
26
- _.r.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);if(!this.a&&(c=(c=a.getConfiguration())&&c.thumbnails,!c||void 0===c.enabled||c.enabled)){var d=a.getPeriods();if(yx(d)){this.a=new vx;try{this.a.init(a,c)}catch(e){this.m.onError(e)}}}};_.r.get=function(a){return this.a?this.a.get(a):Promise.reject(new _.P(1,9,2014,"Thumbnail format is not supported"))};_.r.id=function(){return"thumbnails"};_.H("clpp.thumbnails.ThumbnailsPlugin",xx);xx.prototype.get=xx.prototype.get;xx.Id="thumbnails";
27
- Fx.prototype.create=function(){return new xx};_.nq(new Fx);var zx="SINGLE",Ax="GRID",Bx="WEBVTT",Cx="BIF";};
2
+ var f=function(window){var by="No thumbnail found for position: ",cy="Position is out of range: ",dy="Thumbnail URL is mandatory",ey="Wrong gridSize format",fy="clpp.thumbnails",gy=function(){this.log=new _.K(fy);this.player=null;this.a=[];this.w=!1},iy=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 hy(a,0,e,!!f)})},Promise.resolve())},hy=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return jy(a,d).then(function(){return a.a[b].load()}).then(function(){return hy(a,
3
+ e,c,d)})},jy=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.op)c();else a.player.one(_.ld,function(){c()})})},ky=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.oa=p;this.Uj=h;this.Cm=l;this.Nk=m;this.Ok=n;this.Bf=null},ly=function(){gy.call(this);
4
+ this.f=null;this.o=this.h=1;this.j=0},my=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Td=new _.Oj},ny=function(){this.g=new _.K(fy);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.Oj},oy=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.Td.resolve()})},qy=function(a,b){return py(a,b).then(function(c){return new ky(c,b.time,b.duration)})},py=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)})},ry=function(){gy.call(this);this.f=null},sy=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},ty=function(){gy.apply(this,arguments)},uy=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Jd:c,jg:d,mh:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},vy=function(){this.g=new _.K(fy);this.a=this.m=null},wy=function(a){return a.some(function(b){return 0<
6
+ b.thumbStreams.length})},By=function(a){return a?a===xy||a===yy?new ly:a===zy?new ry:a===Ay?new ny:null:null},Cy=function(a){if(!a)return null;a=new _.qk(a);return a.path.match(/.*\.vtt$/i)?zy:a.path.match(/.*\.bif$/i)?Ay:a.path.match(/.*\.(png|jpg|jpeg)$/i)?xy:null},Dy=function(){};gy.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Of,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&iy(c,b.preload)})};ky.prototype.raw=function(){return this.oa.cloneNode(!1)};
7
+ ky.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(_.ae);e.style.width=c+_.Lf;e.style.height=d+_.Lf;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.oa.naturalWidth||this.oa.width))+"px "+Math.ceil(d/
8
+ this.height*(this.oa.naturalHeight||this.oa.height))+_.Lf;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Lf;e.style.backgroundPositionY="-"+f*d+_.Lf;return e};
9
+ ky.prototype.load=function(){var a=this;this.Bf||(this.Bf=new Promise(function(b,c){function d(){a.width||(a.width=(a.oa.naturalWidth||a.oa.width)/a.Uj);a.height||(a.height=(a.oa.naturalHeight||a.oa.height)/a.Cm);a.x||(a.x=a.width*a.Nk);a.y||(a.y=a.height*a.Ok)}if(a.oa.src&&a.oa.complete)d(),b(a);else{var e=null,f=function(){d();a.oa.removeEventListener("load",f);a.oa.removeEventListener(_.re,e);b(a)};e=function(g){a.oa.removeEventListener("load",f);a.oa.removeEventListener(_.re,e);c(new _.P(1,9,
10
+ 2014,"Failed to load thumbnail.",g))};a.oa.addEventListener("load",f);a.oa.addEventListener(_.re,e);a.oa.src=a.src}}));return this.Bf};_.H("clpp.thumbnails.Thumbnail",ky);ky.prototype.load=ky.prototype.load;ky.prototype.element=ky.prototype.element;ky.prototype.raw=ky.prototype.raw;_.w(ly,gy);
11
+ ly.prototype.init=function(a,b){if(!b||!b.url)throw new _.P(1,9,7100,dy);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,ey);}catch(d){throw this.log.error("Error during parsing gridSize",d),
12
+ new _.P(1,9,7100,ey);}gy.prototype.init.call(this,a,b)};ly.prototype.get=function(a){var b=this,c,d,e,f;return _.E(function(g){if(1==g.a){c=b.player.getDuration();if(0>a||a>c)throw new _.P(1,9,2014,cy+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 _.x(g,f.load(),2)}return g["return"](f)})};
13
+ ly.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 ky(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()};my.prototype.load=function(){return this.Td};
14
+ ny.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.P(1,9,7100,dy);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
+ Ey);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 my(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
+ oy(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))})};ny.prototype.get=function(a){var b=this,c,d;return _.E(function(e){switch(e.a){case 1:if(0>a)throw new _.P(1,9,2014,cy+a);return _.x(e,b.h,2);case 2:c=b.a.find(function(f){return a>=f.time&&a<f.time+f.duration});if(!c)throw new _.P(1,9,2014,by+a);return _.x(e,qy(b,c),3);case 3:return d=e.f,_.x(e,d.load(),4);case 4:return e["return"](d)}})};
17
+ ny.prototype.Hd=function(){return 0<this.a.length};var Ey=[137,66,73,70,13,10,26,10];_.w(ry,gy);
18
+ ry.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.P(1,9,7100,dy);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=_.R.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 u=h.indexOf("#");h=0>u?h:h.substr(0,u);h.match(/^http|^\/\//)||(h=
19
+ d.substr(0,d.lastIndexOf("/"))+"/"+h);u=sy(l[0]);l=sy(l[1])-u;c.a.push(new ky(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))});gy.prototype.init.call(this,a,b)};
20
+ ry.prototype.get=function(a){var b=this,c;return _.E(function(d){if(1==d.a){if(0>a)throw new _.P(1,9,2014,cy+a);return _.x(d,b.f,2)}if(3!=d.a){c=b.a.find(function(e){return a>=e.time&&a<e.time+e.duration});if(!c)throw new _.P(1,9,2014,by+a);return _.x(d,c.load(),3)}return d["return"](c)})};ry.prototype.l=function(){return this.f};_.w(ty,gy);
21
+ ty.prototype.get=function(a){function b(){return new _.P(1,9,2014,by+a)}var c=this,d,e,f,g,h,l,m,n,p,q,u,v,z;return _.E(function(B){if(1==B.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.P(1,9,2014,cy+a);d=c.player.getPeriods();for(var I=null,F=_.t(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 B.F(2);l=uy(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.mh+m])):(q=h.Qa())&&0<q.length&&(v=u=0,z=h.startTime,1<l.mh&&(u=m%l.Jd,v=Math.floor(m/l.Jd),z+=m*l.durationPerTile),n=new ky(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.Jd,l.jg,
23
+ u,v));return n?_.x(B,n.load(),4):B.F(2)}if(2!=B.a)return B["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};ty.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
+ ty.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.t(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=uy(d,b),f=d.Qa()[0],g=new Image,h=d.startTime,l=0;l<e.jg;++l)for(var m=0;m<e.Jd;++m)this.a.push(new ky(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Jd,e.jg,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.r=vy.prototype;_.r.onPlayerCreated=function(a){this.m=a};_.r.onPlayerWillDestroy=function(){this.m=null};_.r.onPlayerWillRelease=function(){this.a=null};
25
+ _.r.onContentWillLoad=function(a){var b=this,c=a.getConfiguration().thumbnails;if(c)if(!1===c.enabled)this.g.info("Thumbnails disabled.");else{var d=c.mode||null;d||(d=Cy(c.url||null));(this.a=By(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Ke,function(){b.g.info("Initialize thumbnails provider");try{b.a.init(a,c)}catch(e){b.m.onError(e)}})):this.g.warn("Unknown thumbnail mode",d)}else this.a=null};
26
+ _.r.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);if(!this.a&&(c=(c=a.getConfiguration())&&c.thumbnails,!c||void 0===c.enabled||c.enabled)){var d=a.getPeriods();if(wy(d)){this.a=new ty;try{this.a.init(a,c)}catch(e){this.m.onError(e)}}}};_.r.get=function(a){return this.a?this.a.get(a):Promise.reject(new _.P(1,9,2014,"Thumbnail format is not supported"))};_.r.id=function(){return"thumbnails"};_.H("clpp.thumbnails.ThumbnailsPlugin",vy);vy.prototype.get=vy.prototype.get;vy.Id="thumbnails";
27
+ Dy.prototype.create=function(){return new vy};_.Vq(new Dy);var xy="SINGLE",yy="GRID",zy="WEBVTT",Ay="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));}