(function(){var g={}; var _ = _ || {}
var f=function(window){var wx=" The setting will be ignored.",xx="VTT parser encountered an invalid VTT setting: ",yx="application/x-subrip",zx="text/srt",Ax='text/vtt; codecs\x3d"vtt"',Bx='text/vtt; codecs\x3d"wvtt"',Cx=function(a){_.Jj(a,/[ \t]+/gm)},Dx=function(a){return a.a===a.f.length?null:(a=_.Jj(a,/[^ \t\n]*/gm))?a[0]:null},Ex=function(){},Fx=function(a){var b="";for(a=a.split(/\n/);3<a.length;){for(var c=3;c<a.length;++c)a[2]+="\n"+a[c];a.splice(3,a.length-3)}if(3!==a.length)return"";c=0;!a[0].match(/\d+:\d+:\d+/)&&
a[1].match(/\d+:\d+:\d+/)&&(b+=a[0].match(/\w+/)+"\n",++c);if(a[c].match(/\d+:\d+:\d+/)){var d=a[1].match(/(\d+):(\d+):(\d+)(?:,(\d+))?\s*--?>\s*(\d+):(\d+):(\d+)(?:,(\d+))?/);if(d)b+=d[1]+":"+d[2]+":"+d[3]+"."+d[4]+" --\x3e ",b+=d[5]+":"+d[6]+":"+d[7]+"."+d[8]+"\n",++c;else return""}else return"";a[c]&&(b+=a[c]+"\n\n");return b},Gx=function(){},Hx=function(a){this.a=a},Jx=function(a,b,c){var d;if(d=/^align:(start|middle|center|end|left|right)$/.exec(b))b=d[1],"middle"===b?a.textAlign=_.Ni:a.textAlign=
_.hw[b.toUpperCase()];else if(d=/^vertical:(lr|rl)$/.exec(b))a.writingMode="lr"===d[1]?_.Gg:_.Hg;else if(d=/^size:([\d.]+)%$/.exec(b))a.size=Number(d[1]);else if(d=/^position:([\d.]+)%(?:,(line-left|line-right|center|start|end))?$/.exec(b))a.position=Number(d[1]),d[2]&&(b=d[2],a.positionAlign=b===_.ye||b===_.ag?_.ye:b===_.ze||b===_.ge?_.ze:_.id);else if(d=/^region:(.*)$/.exec(b)){if(b=Ix(c,d[1]))a.region=b}else{a:{if(c=/^line:([\d.]+)%(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=1,a.line=
Number(c[1]),c[2]&&(a.lineAlign=_.iw[c[2].toUpperCase()]);else if(c=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=_.Pi,a.line=Number(c[1]),c[2]&&(a.lineAlign=_.iw[c[2].toUpperCase()]);else{a=!1;break a}a=!0}return a}return!0},Ix=function(a,b){var c=a.filter(function(d){return d.id===b});return c.length?c[0]:(_.Jh("VTT parser could not find a region with id: ",b," The region will be ignored."),null)},Kx=function(a){a=_.Jj(a,/(?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{2,3})/g);if(null==
a)return null;var b=Number(a[2]),c=Number(a[3]);return 59<b||59<c?null:Number(a[4])/1E3+c+60*b+3600*(Number(a[1])||0)},Lx=function(){Hx.apply(this,arguments)},Mx=function(){this.a=null;this.g=new _.J("clpp.vtt.mp4")},Ox=function(a,b,c){var d,e,f;(new _.pn).M("payl",_.sn(function(g){d=_.Q.ea(g)})).M("iden",_.sn(function(g){e=_.Q.ea(g)})).M("sttg",_.sn(function(g){f=_.Q.ea(g)})).parse(a);return d?Nx(d,e,f,b,c):null},Nx=function(a,b,c,d,e){a=new _.Si(d,e,a,_.Qg);b&&(a.id=b);if(c)for(b=new _.Ij(c),c=
Dx(b);c;)Jx(a,c,[])||_.Jh(xx,c,wx),Cx(b),c=Dx(b);return a},Px=function(){this.j=new Gx};Ex.prototype.a=function(a){a=_.Q.ea(a);a=a.replace(/\r+/g,"");a=a.replace(/^\s+|\s+$/g,"");a=a.replace(/<[a-zA-Z\\/][^>]*>/g,"");var b=a.split("\n\n");a="";if(0<b.length){a+="WEBVTT\n\n";b=_.u(b);for(var c=b.next();!c.done;c=b.next())a+=Fx(c.value)}return _.Q.hb(a)};Gx.prototype.create=function(){return new Ex};Gx.prototype.probe=function(a,b){return(a===zx||a===yx)&&b===_.kg};Hx.prototype.parseInit=function(){};
Hx.prototype.parseMedia=function(a,b){var c=_.Q.ea(a);c=c.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");var d=c.split(/\n{2,}/m);if(!/^WEBVTT($|[ \t\n])/m.test(d[0]))throw new _.N(_.O,2,2E3);c=b.periodStart;if(d[0].includes("X-TIMESTAMP-MAP")){var e=d[0].match(/LOCAL:((?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3}))/m),f=d[0].match(/MPEGTS:(\d+)/m);if(e&&f){c=Kx(new _.Ij(e[1]));if(null==c)throw new _.N(_.O,2,2E3);f=Number(f[1]);for(e=b.segmentStart;95443.7176888889<=e;)e-=95443.7176888889,f+=8589934592;c=b.periodStart+
f/9E4-c}}else this.a.streaming.relativeTextTimestamp&&null!==b.segmentStart&&(c=b.segmentStart);f=[];e=_.u(d);for(var g=e.next();!g.done;g=e.next()){var h=g.value;if(/^region/.test(h.toLowerCase())){h=new _.Ij(h.replace(/\n/g," "));g=new _.Vi;Dx(h);Cx(h);for(var l=Dx(h);l;){var m;a:{var n=g,p=l;if(m=/^id:(.*)$/.exec(p))n.id=m[1];else if(m=/^width:(\d{1,2}|100)%$/.exec(p))n.width=Number(m[1]);else if(m=/^lines:(\d+)$/.exec(p))n.height=Number(m[1]),n.heightUnits=2;else if(m=/^regionanchor:(\d{1,2}|100)%,(\d{1,2}|100)%$/.exec(p))n.regionAnchorX=
Number(m[1]),n.regionAnchorY=Number(m[2]);else if(m=/^viewportanchor:(\d{1,2}|100)%,(\d{1,2}|100)%$/.exec(p))n.viewportAnchorX=Number(m[1]),n.viewportAnchorY=Number(m[2]);else if(/^scroll:up$/.exec(p))n.scroll="up";else{m=!1;break a}m=!0}m||_.Jh("VTT parser encountered an invalid VTTRegion setting: ",l,wx);Cx(h);l=Dx(h)}f.push(g)}}e=[];h=_.u(d);for(g=h.next();!g.done;g=h.next())if(g=g.value,/^style/.test(g.toLowerCase())){g=g.replace(/^style/i,"").replace(/\n/g," ");l=/[^{}]+{[^{}]*}/g;do(m=l.exec(g))&&
e.push(m[0]);while(m)}h=[];d=_.u(d);for(g=d.next();!g.done;g=d.next())if(g=g.value,g.includes("--\x3e")){p=g.split("\n");var q=c;if(1===p.length&&!p[0]||/^NOTE($|[ \t])/.test(p[0])||"STYLE"===p[0])g=null;else{g=null;p[0].includes("--\x3e")||(g=p[0],p.splice(0,1));l=new _.Ij(p[0]);m=Kx(l);var t=_.Jj(l,/[ \t]+--\x3e[ \t]+/g);n=Kx(l);if(null==m||null==t||null==n)throw new _.N(_.O,2,2001);m+=q;n+=q;p=p.slice(1).join("\n").trim();m=new _.Si(m,n,p,_.Qg);g&&(m.id=g);Cx(l);for(n=Dx(l);n;)Jx(m,n,f)||_.Jh(xx,
n,wx),Cx(l),n=Dx(l);null!=g&&(m.id=g);g=m}g&&h.push(g)}return{cues:h,styles:e}};_.w(Lx,Hx);Lx.prototype.parseMedia=function(a,b){return Hx.prototype.parseMedia.call(this,(new Ex).a(a),b)};Mx.prototype.parseInit=function(a){var b=this,c=!1;(new _.pn).M(_.Ne,_.qn).M(_.tg,_.qn).M(_.He,_.qn).aa("mdhd",function(d){0===d.version?(d.reader.skip(4),d.reader.skip(4),b.a=_.kn(d.reader),d.reader.skip(4)):(d.reader.skip(8),d.reader.skip(8),b.a=_.kn(d.reader),d.reader.skip(8));d.reader.skip(4)}).M(_.Le,_.qn).M(_.dg,_.qn).aa(_.fg,_.rn).M("wvtt",function(){c=!0}).parse(a);if(!this.a)throw new _.N(_.O,2,2008);if(!c)throw new _.N(_.O,2,2008);};
Mx.prototype.parseMedia=function(a,b){if(!this.a)throw this.g.error("No init segment for MP4+VTT!"),new _.N(_.O,2,2008);var c=0,d=[],e,f=[],g=!1,h=!1,l=!1,m=null;(new _.pn).M("moof",_.qn).M("traf",_.qn).aa("tfdt",function(F){g=!0;c=0===F.version?_.kn(F.reader):_.mn(F.reader)}).aa("tfhd",function(F){var M=F.flags;F=F.reader;F.skip(4);M&1&&F.skip(8);M&2&&F.skip(4);m=M&8?_.kn(F):null}).aa("trun",function(F){h=!0;var M=F.version,R=F.flags;F=F.reader;var ka=_.kn(F);R&1&&F.skip(4);R&4&&F.skip(4);for(var U=
[],qa=0;qa<ka;qa++){var Ba={duration:null,sampleSize:null,Tg:null};R&256&&(Ba.duration=_.kn(F));R&512&&(Ba.sampleSize=_.kn(F));R&1024&&F.skip(4);R&2048&&(Ba.Tg=0===M?_.kn(F):_.ln(F));U.push(Ba)}d=U}).M(_.Ge,_.sn(function(F){l=!0;e=F})).parse(a);if(!l&&!g&&!h)throw new _.N(_.O,2,2008);var n=c,p=new DataView(e.buffer,e.byteOffset,e.byteLength);p=new _.en(p,!1);for(var q=_.u(d),t=q.next();!t.done;t=q.next()){t=t.value;var v=t.duration||m,z=t.Tg?c+t.Tg:n;n=z+(v||0);var A=0;do{var D=_.kn(p);A+=D;var G=
_.kn(p);G=_.un(G);var B=null;"vttc"===G?8<D&&(B=_.on(p,D-8)):("vtte"!==G&&this.g.error("Unknown box "+G+"! Skipping!"),p.skip(D-8));v?B&&f.push(Ox(B,b.periodStart+z/this.a,b.periodStart+n/this.a)):this.g.error("WVTT sample duration unknown, and no default found!")}while(t.sampleSize&&A<t.sampleSize)}return{cues:f.filter(_.aj),styles:[]}};_.w(Px,_.Bu);Px.prototype.f=function(){_.Av(_.kg,Hx);_.Av(Ax,Hx);_.Av(Bx,Hx);_.Av(_.Lc,Mx);_.Av(zx,Lx);_.Av(yx,Lx);_.dl.push(this.j)};Px.prototype.a=function(){_.Cv(_.kg);_.Cv(Ax);_.Cv(Bx);_.Cv(_.Lc);_.Cv(zx);_.Cv(yx);_.fl(this.j)};Px.prototype.id=function(){return"subtitles-vtt"};_.I("clpp.vtt.VttComponent",Px);};
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));}
})();