(function(){var g={}; var _ = _ || {}
var f=function(window){var Gy='application/mp4; codecs\x3d"stpp.ttml"',Hy='application/mp4; codecs\x3d"stpp.ttml.im1i"',Iy='application/mp4; codecs\x3d"stpp.ttml.im1t"',Jy="backgroundColor",Ky="direction",Ly="displayAlign",My="region",Ny="sans-serif",Oy="textAlign",Py="textDecoration",Qy="writingMode",Ry=function(a,b,c){this.h=a;this.f=b;this.a=c},Sy=function(a,b,c){Ry.call(this,a,[],c);this.j=b||""},Ty=function(a,b,c){Ry.call(this,a,b,c)},Uy=function(a,b,c){a=a.f;for(var d=a.length-1;0<=d;d--){var e=b.get(a[d]);if(e.hasAttribute(c))return e.getAttribute(c)}return null},
bz=function(a,b){var c=null;if(Vy.test(a)){c=Vy.exec(a);var d=Number(c[1]),e=Number(c[2]),f=Number(c[3]),g=Number(c[4]);g+=(Number(c[5])||0)/b.f;f+=g/b.frameRate;c=f+60*e+3600*d}else Wy.test(a)?c=Xy(Wy,a):Yy.test(a)?c=Xy(Yy,a):Zy.test(a)?(c=Zy.exec(a),c=Number(c[1])/b.frameRate):$y.test(a)?(c=$y.exec(a),c=Number(c[1])/b.a):az.test(a)&&(c=Xy(az,a));return c},Xy=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)},cz=function(a){return a.split(":").pop()},dz=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},fz=function(a,b){for(;ez.test(a);){var c=ez.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},gz=function(a){return a?a.replace(/(\d*\.?\d+)%/g,function(b,c){return c/100+"em"}):""},hz=function(a,b,c,d,e,f,g){Ry.call(this,a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]},iz=function(a,b,c){a=Uy(a,b,Oy);if(!a&&c&&(a=Uy(c,b,Oy),!a&&"rltb"===Uy(c,b,Qy)))return _.ge;switch(a){case _.id:return _.Ni;
case _.Of:case _.ge:return _.ge;default:return _.ag}},jz=function(a,b,c){if(_.Q.nf(a.w))return document.createTextNode(_.Q.Pg(a.w||""));if(a.A)return _.er("br");for(var d=_.er("span"),e=_.u(a.f),f=e.next();!f.done;f=e.next())_.fr(d,f.value);a=_.u(a.j);for(e=a.next();!e.done;e=a.next())d.appendChild(jz(c.get(e.value),b,c));return d},kz=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*=Number(a[1])/Number(a[2]))},lz=function(a,b,c){Ry.call(this,a,b,c)},oz=function(a,b,c,d){var e=mz.exec(a);a=nz.exec(a);return typeof b===_.k&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},pz=function(a,b){return typeof b===_.k&&0<b?_.Ti:nz.test(a)?0:_.Ti},qz=function(a,b){Ry.call(this,"root-container",[],b);this.j=a},rz=function(a,b,c){return typeof a===_.k?a:typeof b===_.k?b:c},sz=function(a,b){var c=a.getAttribute("extent");return(c=nz.exec(c))?Number(c[b]):null},uz=
function(a){a=a.getAttribute("cellResolution");return(a=tz.exec(a))?Number(a[2]):null},vz=function(a,b,c){Ry.call(this,a,b,c)},wz=function(a){this.B=a;this.w=this.l=null;this.A=0;this.h=new Map;this.a=new Map;this.j=new Map;this.f=new Map;this.o=[]},yz=function(a){return xz.some(function(b){return b in a.attributes})},zz=function(a,b){if(0===b.length)return[];for(var c=[],d=_.u(b),e=d.next();!e.done;e=d.next())e=e.value,a.a.has(e)&&c.push.apply(c,_.gh(zz(a,a.a.get(e).f)).concat([e]));return c},Bz=
function(){return"inline-"+Az++},Cz=function(a){return a.o.map(function(b){return b.build(a.l,a.w,a.A,a.h,a.a,a.j,a.f)}).filter(function(b){return null!=b})},Dz=function(a){this.a=a.firstChild;this.f=new Set},Ez=function(a,b,c,d,e,f){this.h=a;this.a=b;this.j=c;this.l=d;this.f=e;this.attributes=f},Fz=function(a){return cz(a.h.nodeName)},Gz=function(){this.a=new Map},Iz=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null,e=[],f=[],g={},h=b.parentNode;if(h&&a.a.has(h)){var l=a.a.get(h);e=
_.gh(l.l).concat();-1===[_.da,"span","br"].indexOf(b.nodeName)&&(c=l.a,d=l.j,f=_.gh(l.f).concat(),g={},Hz.forEach(function(n){n in l.attributes&&(g[n]=l.attributes[n])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(My)&&(c=b.getAttribute(My));b.hasAttribute(_.gg)&&f.push.apply(f,_.gh(b.getAttribute(_.gg).split(" ")));d=Array.from(b.attributes).map(function(n){return n.name});d=_.u(d);for(h=d.next();!h.done;h=d.next()){h=h.value;var m=cz(h);g[m]=b.getAttribute(h)}d=g.backgroundImage}c=new Ez(b,
c,d,e,f,g);a.a.set(b,c);return c},Jz=function(a){this.a=a;this.f=new DOMParser},Kz=function(a){this.f=a},Lz=function(a){return String(Math.floor(a/3600)).padStart(2,"0")+":"+String(Math.floor(a/60%60)).padStart(2,"0")+":"+String(Math.floor(a%60)).padStart(2,"0")+"."+String(Math.floor(1E3*a%1E3)).padStart(3,"0")},Mz=function(){},Nz=function(a){this.a=new Jz(a);this.g=new _.J("clpp.ttml.Mp4TtmlParser")},Oz=function(){this.j=new Mz};Ry.prototype.getId=function(){return this.h};
Ry.prototype.hasAttribute=function(a){return a in this.a};Ry.prototype.getAttribute=function(a){return this.a[a]};_.w(Sy,Ry);_.w(Ty,Ry);var Vy=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Wy=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,Yy=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,Zy=/^(\d*(?:\.\d*)?)f$/,$y=/^(\d*(?:\.\d*)?)t$/,az=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,mz=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,nz=/^(\d+)px (\d+)px$/,tz=/^(\d+) (\d+)$/,ez=/(\d+)px/,Pz=/^(\d+px|\d+em|\d*\.?\d+c)$/,xz=[Jy,"color",Ky,Ly,"fontFamily","fontSize","fontStyle","fontWeight",
"lineHeight","opacity","padding",Oy,Py,"textOutline",Qy,"zIndex"],Hz=["begin",_.ge];_.w(hz,Ty);
hz.prototype.build=function(a,b,c,d,e,f,g){var h=bz(this.a.begin,b);b=bz(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.er(_.Qd);for(var l=_.u(this.j),m=l.next();!m.done;m=l.next())c.appendChild(jz(g.get(m.value),e,g));g=new _.Si(h,b,c.innerHTML.trim(),_.ug);g.cssClassList=_.gh(this.f).concat();g.textAlign=iz(this,e,null);g.writingMode=_.Oi;g.line=-1;g.lineInterpretation=_.Pi;g.lineAlign=_.Qi;g.containerRows=rz(null,uz(a),15);if(this.o&&(f=f.get(this.o))){g.region=f.build(a,e);g.textAlign=
iz(this,e,f);a:switch(Uy(f,e,Qy)){case "tb":case "tblr":a=_.Gg;break a;case "tbrl":a=_.Hg;break a;default:a=_.Oi}g.writingMode=a;a:switch(Uy(f,e,Ly)){case _.id:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(Uy(f,e,Ly)){case _.id:a=1;break a;default:a=_.Pi}g.lineInterpretation=a;a:switch(Uy(f,e,Ly)){case _.id:e=_.id;break a;default:e=_.Qi}g.lineAlign=e}this.l&&(a=d.get(this.l))&&(d=a.getAttribute("encoding"),e=a.getAttribute("imageType")||a.getAttribute("imagetype"),a=a.j.trim(),
g.backgroundImage=("PNG"===e&&"Base64"===d&&0<a.length?"data:image/png;base64,"+a:null)||"");return g};_.w(lz,Ty);
lz.prototype.build=function(a,b){var c=new _.Vi;c.id=this.getId();var d=rz(a.j.containerWidth,sz(a,1),720),e=rz(a.j.containerHeight,sz(a,2),480);a:switch(Uy(this,b,Ly)){case "after":var f="flex-start";break a;case _.id:f=_.id;break a;default:f="flex-end"}c.displayAlign=f;a:switch(Uy(this,b,Qy)){case "tb":case "tblr":f="row-reverse";break a;case "tbrl":f="row";break a;default:f=_.Ad}c.writingMode=f;f=this.getAttribute("extent")||Uy(this,b,"extent");c.width=oz(f,d,1,100);c.widthUnits=pz(f,d);c.height=
oz(f,e,2,100);c.heightUnits=pz(f,e);f=this.getAttribute("origin")||Uy(this,b,"origin");c.viewportAnchorX=oz(f,d,1,0);c.viewportAnchorY=oz(f,e,2,0);c.viewportAnchorUnits=pz(f,d);c.cssClassList=_.gh(this.f).concat();return c};_.w(qz,Ry);_.w(vz,Ry);
vz.prototype.build=function(a){var b=null;var c=uz(a);c&&(b=rz(a.j.containerHeight,sz(a,2),480)/c);b=rz(a.j.fontSizeRadix,b,16);a=[];c="::ttml ."+this.h+", ::ttml ."+this.h+" * {";for(var d=_.u(Qz.entries()),e=d.next();!e.done;e=d.next()){var f=_.u(e.value);e=f.next().value;f=f.next().value;e in this.a&&(c+=f+":"+dz(this.a[e])+";")}a:{if("unicodeBidi"in this.a){d=this.a.unicodeBidi;e="";switch(d){case "normal":case "embed":e=d;break;case "bidiOverride":e="bidi-override"}if(0<e.length){d="unicode-bidi:"+
e+";";break a}}d=""}c+=d;a:{if("textOutline"in this.a){d=this.a.textOutline.split(" ");e="black";f=".4em";var g=d[0]&&d[0].trim(),h=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!Pz.test(g)&&Pz.test(h)&&Pz.test(l)?(e=g,f=h):2===d.length&&!Pz.test(g)&&Pz.test(h)?(e=g,f=h):2===d.length&&Pz.test(g)&&Pz.test(h)&&(f=g);if(""!==f){f=dz(f);d="text-shadow:0 0 "+(f+" "+e+",0 0 ")+(f+" "+e+",0 0 ")+(f+" "+e+";");break a}}d=""}c+=d;"textShadow"in this.a?(d=gz(this.a.textShadow),d=dz(d),d="text-shadow:"+
d+";"):d="";c=c+d+("fontFamily"in this.a?"font-family:"+this.a.fontFamily.replace("monospaceSansSerif","monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif",Ny).replace("proportionalSerif",Ny).replace("sansSerif",Ny).replace("default",Ny)+";":"");a:{if(Py in this.a){d=[];e=_.u(this.a.textDecoration.split(" "));for(f=e.next();!f.done;f=e.next())switch(f=f.value,f){case "underline":case "overline":d.push(f);break;case "lineThrough":d.push("line-through")}if(0<d.length){d=
"text-decoration:"+d.join(" ")+";";break a}}d=""}e="padding"in this.a?"border: solid transparent;border-width:"+dz(this.a.padding)+";":"";c=c+d+e;"lineHeight"in this.a?(d="",e=this.a.lineHeight,e=dz(e),e=fz(e,b),d=d+"line-height:"+e+";"):d="";a.push(c+d+"}");a:{if("fontSize"in this.a&&(c=this.a.fontSize.split(" "),d=null,1===c.length&&(d=c[0]),2===c.length&&(d=c[1]),d)){d=d.trim();d=dz(d);d=fz(d,b);b="font-size:"+d+";";break a}b=null}b&&(c="::ttml ."+this.h+" .clpp-text-wrapper {",a.push(c+b+"}"),
c="::ttml .clpp-text-wrapper__"+this.h+" {",a.push(c+b+"}"));return a};var Qz=new Map([[Jy,"background-color"],["color","color"],[Ky,Ky],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var Az=0;Dz.prototype.me=function(){return!!this.a};Dz.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!Rz.has(cz(a.nodeName))||Sz.has(cz(a.nodeName))||!a.firstChild||this.f.has(a.firstChild)?a.nextSibling?a=a.nextSibling:a=a.parentNode:a=a.firstChild;while(a&&(this.f.has(a)||a.nodeType!==Node.TEXT_NODE&&!Rz.has(cz(a.nodeName))));var b=this.a;this.a=a;return b};
var Rz=new Set(["tt","head","layout",_.Je,_.se,My,"styling",_.gg,"body",_.Qd,"p","span","br"]),Sz=new Set([_.gg,_.se]);Ez.prototype.getId=function(){return this.attributes.id};Jz.prototype.parseInit=function(){};
Jz.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.L.kb(this.a.ttml||{}),e=_.Oj(a,0,c[0]);e=_.Q.ea(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.lg)}catch(n){throw new _.N(_.O,2,2005,"Failed to parse TTML.");}d=new wz(d);e=new Gz;f=new Dz(f);b=b.periodStart;typeof b===_.k&&(d.A=b);b=c[0];for(var g=1;g<c.length;++g){var h=c[g],l=_.Oj(a,b,h);l=_.Lm(l);var m="urn:mpeg:14496-30:subs:"+g;d.h.set(m,new Sy(m,l,{imageType:"PNG",encoding:"Base64"}));
b+=h}for(;f.me();)a=f.next(),a=Iz(e,a),"tt"===Fz(a)&&(d.l=new qz(d.B,Object.assign({},a.attributes))),"tt"===Fz(a)&&(d.w=new kz(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),Fz(a)!==_.se||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.h.set(c,new Sy(c,a.h.textContent,a.attributes))),Fz(a)===_.se&&a.attributes.begin&&a.attributes.end?(c="#"+Bz(),b=new Sy(c,a.h.textContent,a.attributes),d.h.set(c,b),c=b):c=null,c&&(a.j=c.getId()),
Fz(a)===_.gg&&(c=a.getId()||Bz(),b=new vz(c,a.f,Object.assign({},a.attributes)),d.a.set(c,b),a.a&&d.j.get(a.a).f.push(c)),Fz(a)!==_.gg&&yz(a)?(c=Bz(),b=new vz(c,[],Object.assign({},a.attributes)),d.a.set(c,b),c=b):c=null,c&&a.f.push(c.getId()),Fz(a)!==_.Qd||!a.attributes.extent&&!a.attributes.origin?c=null:(c=Bz(),b=new lz(c,zz(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),c=b),c&&(a.a=c.getId()),Fz(a)!==My?c=null:(c=a.getId(),b=new lz(c,zz(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),
c=b),c&&(a.a=c.getId()),c=a.l,-1===[_.da,"span","br"].indexOf(Fz(a))||0===c.length?c=null:(g=c[c.length-1],d.f.has(g)?(c=Bz(),b=new hz(c,a.h.nodeName===_.da?a.h.textContent:null,"br"===Fz(a),a.a,a.j,zz(d,a.f),a.attributes),d.f.set(c,b),(g=d.f.get(g))&&g.j.push(c),c=b):c=null),c&&a.l.push(c.getId()),"p"===Fz(a)||a.j?(c=Bz(),b=new hz(c,null,!1,a.a,a.j,zz(d,a.f),a.attributes),d.f.set(c,b),d.o.push(b),c=b):c=null,c&&a.l.push(c.getId());e=Cz(d);f=[];a=_.u(d.a.values());for(c=a.next();!c.done;c=a.next())f.push.apply(f,
_.gh(c.value.build(d.l)));return{cues:e,styles:f}};Kz.prototype.a=function(a){a=(new Jz(this.f)).parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}).cues;var b="WEBVTT\n\n";a=_.u(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=Lz(c.startTime)+" --\x3e "+Lz(c.endTime),e=[];switch(c.textAlign){case _.ve:e.push("align:left");break;case _.Of:e.push("align:right");break;case _.Ni:e.push("align:middle");break;case _.ag:e.push("align:start");break;case _.ge:e.push("align:end")}switch(c.writingMode){case _.Gg:e.push("vertical:lr");break;
case _.Hg:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.Q.hb(b)};Mz.prototype.probe=function(a,b){return a===_.Mc&&b===_.kg};Mz.prototype.create=function(a){return new Kz(a)};Nz.prototype.parseInit=function(a){var b=!1;(new _.pn).M(_.Ne,_.qn).M(_.tg,_.qn).M(_.He,_.qn).M(_.Le,_.qn).M(_.dg,_.qn).aa(_.fg,_.rn).M("stpp",function(c){b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.N(_.O,2,2007);};
Nz.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.pn).M("moof",_.qn).M("traf",_.qn).aa("subs",function(h){for(var l=_.kn(h.reader),m=0;m<l;++m){h.reader.skip(4);for(var n=_.jn(h.reader),p=0;p<n;++p){var q=1===h.version?_.kn(h.reader):_.jn(h.reader);g.push(q);h.reader.skip(6)}}}).M(_.Ge,_.sn(function(h){d=!0;h=c.a.parseMedia(h,b,g);e=e.concat(h.cues);f=f.concat(h.styles)})).parse(a);d||this.g.warn("Couldn't find the mdat box");return{cues:e,styles:f}};_.w(Oz,_.Bu);Oz.prototype.f=function(){_.Av(_.Mc,Jz);_.Av(_.Kc,Nz);_.Av(Gy,Nz);_.Av(Iy,Nz);_.Av(Hy,Nz);_.dl.push(this.j)};Oz.prototype.a=function(){_.Cv(_.Mc);_.Cv(_.Kc);_.Cv(Gy);_.Cv(Iy);_.Cv(Hy);_.fl(this.j)};Oz.prototype.id=function(){return"subtitles-ttml"};_.I("clpp.ttml.TtmlComponent",Oz);};
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
else{_=this.clpp._;(f.call(g,this));}
})();