(function(){var g={}; var _ = _ || {}
var f=function(window){var rV=function(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.L.R(a)){a:{var b=a.info;if(_.L.ia(b)&&(b=b.toLowerCase().match(/lang:(\w+)/))&&b[1]){b=b[1].toLowerCase();break a}b=null}this.f=b;a=a.data;this.a=_.L.ia(a)?a:null}},tV=function(a,b,c){this.m=a;this.l=b;this.j=c;this.a=new _.gi;this.h=(a=_.Bv(_.Mc))?new a(this.m.getConfiguration()):null;this.g=new _.J("clpp.hlssmpte.ImageCueHandler");this.f=null;sV(this)},sV=function(a){a.a.one(a.m,_.Ce,function(){return uV(a)})},
uV=function(a){var b=a.m.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.Bc,function(d){return vV(a,d)});var c=Array.from(b.textTracks);c.filter(function(d){return d.kind===_.Je}).forEach(function(d){vV(a,{track:d})});!wV(c)&&a.l&&(a.g.warn("The metadata track is not present. Changing an audio track in order to enforce the creation of the metadata track."),xV(a,b))}else a.g.warn("The clpp.ttml.TextParser class is not available. Please register the ttml component first.");else a.g.warn("A video element is not available. Skipping.")},
wV=function(a){return a.some(function(b){return b.kind===_.Je})},xV=function(a,b){var c=a.m.getTrackManager(),d=c.qa(),e=c.getAudioTracks().find(function(g){return g!==d});if(e){var f=function(){return c.Ia(d)};a.a.on(b.textTracks,_.Bc,function(g){g.track.kind===_.Je&&(a.a.off(b.textTracks,_.Bc,f),f())});c.Ia(e)}else a.g.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},vV=function(a,b){var c=b.track;c.kind===_.Je&&(a.g.info("The metadata track has been added."),
c.mode=_.qe,a.a.on(c,_.Ld,function(d){return yV(a,d)}))},yV=function(a,b){var c=zV(a);c&&Array.from(b.target.activeCues||[]).forEach(function(d){if(d!==a.f&&Number.isFinite(d.startTime)&&Number.isFinite(d.endTime)&&"org.id3"===d.type&&d.value&&"TXXX"===d.value.key){var e=new rV(d);if(e.f===c&&null!==e.a){a.f=d;d=a.h.parseMedia(_.Q.hb(e.a),{periodStart:a.j,segmentStart:e.startTime,segmentEnd:e.endTime});var f=a.m.getTextDisplayer();f.remove(0,e.startTime);f.append(d.cues,d.styles)}}})},zV=function(a){return(a=
a.m.getTrackManager().Ba())&&a.language&&a.language.toLowerCase()},AV=function(){this.a=null;this.f=!1},BV=function(){};tV.prototype.destroy=function(){this.a.release();this.f=null;return Promise.resolve()};_.w(AV,_.bw);AV.prototype.onPlayerCreated=function(){};AV.prototype.onContentWillLoad=function(a){if(this.f=_.xl()){var b=a.getConfiguration();b=_.L.kb(b.hlssmpte||{});_.L.pi(b.patchMetadataTrack)||(b.patchMetadataTrack=!1);_.L.wa(b.timestampOffset)||(b.timestampOffset=0);this.a=new tV(a,b.patchMetadataTrack,b.timestampOffset)}};AV.prototype.onPlayerWillDestroy=function(){var a=this;return _.H(function(b){if(1==b.a)return a.a?_.x(b,a.a.destroy(),3):b.D(0);a.a=null;_.y(b)})};AV.prototype.id=function(){return"hlssmpte"};
_.I("clpp.hlssmpte.HlsSmptePlugin",AV);AV.Id="hlssmpte";BV.prototype.create=function(){return new AV};_.Yt(new BV);};
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));}
})();