1(function(){var HS=Object.create;var ll=Object.defineProperty;var VS=Object.getOwnPropertyDescriptor;var KS=Object.getOwnPropertyNames;var WS=Object.getPrototypeOf,qS=Object.prototype.hasOwnProperty;var W=function(n,i){return function(){return n&&(i=n(n=0)),i}};var fi=function(n,i){return function(){return i||n((i={exports:{}}).exports,i),i.exports}},Et=function(n,i){for(var t in i)ll(n,t,{get:i[t],enumerable:!0})},YS=function(n,i,t,e){if(i&&typeof i=="object"||typeof i=="function")for(var r=KS(i),a=0,s=r.length,o;a<s;a++)o=r[a],!qS.call(n,o)&&o!==t&&ll(n,o,{get:function(l){return i[l]}.bind(null,o),enumerable:!(e=VS(i,o))||e.enumerable});return n};var fr=function(n,i,t){return t=n!=null?HS(WS(n)):{},YS(i||!n||!n.__esModule?ll(t,"default",{value:n,enumerable:!0}):t,n)};function ud(n,i,t,e,r,a,s){try{var o=n[a](s),l=o.value}catch(u){t(u);return}o.done?i(l):Promise.resolve(l).then(e,r)}function ut(n){return function(){var i=this,t=arguments;return new Promise(function(e,r){var a=n.apply(i,t);function s(l){ud(a,e,r,s,o,"next",l)}function o(l){ud(a,e,r,s,o,"throw",l)}s(void 0)})}}var wr=W(function(){T()});function pe(n){"@babel/helpers - typeof";return pe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},pe(n)}var vt=W(function(){T()});var cd=fi(function(BP,di){T();function ul(n){"@babel/helpers - typeof";return di.exports=ul=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},di.exports.__esModule=!0,di.exports.default=di.exports,ul(n)}di.exports=ul,di.exports.__esModule=!0,di.exports.default=di.exports});var hd=fi(function(jP,hi){T();var fd=cd().default;function dd(){"use strict";hi.exports=dd=function(){return i},hi.exports.__esModule=!0,hi.exports.default=hi.exports;var n,i={},t=Object.prototype,e=t.hasOwnProperty,r=Object.defineProperty||function(N,j,z){N[j]=z.value},a=typeof Symbol=="function"?Symbol:{},s=a.iterator||"@@iterator",o=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(N,j,z){return Object.defineProperty(N,j,{value:z,enumerable:!0,configurable:!0,writable:!0}),N[j]}try{u({},"")}catch(N){u=function(z,ee,U){return z[ee]=U}}function c(N,j,z,ee){var U=j&&j.prototype instanceof g?j:g,F=Object.create(U.prototype),H=new $(ee||[]);return r(F,"_invoke",{value:L(N,z,H)}),F}function f(N,j,z){try{return{type:"normal",arg:N.call(j,z)}}catch(ee){return{type:"throw",arg:ee}}}i.wrap=c;var d="suspendedStart",h="suspendedYield",v="executing",m="completed",p={};function g(){}function E(){}function y(){}var _={};u(_,s,function(){return this});var b=Object.getPrototypeOf,C=b&&b(b(Z([])));C&&C!==t&&e.call(C,s)&&(_=C);var R=y.prototype=g.prototype=Object.create(_);function M(N){["next","throw","return"].forEach(function(j){u(N,j,function(z){return this._invoke(j,z)})})}function D(N,j){function z(U,F,H,G){var ve=f(N[U],N,F);if(ve.type!=="throw"){var ye=ve.arg,Ee=ye.value;return Ee&&fd(Ee)=="object"&&e.call(Ee,"__await")?j.resolve(Ee.__await).then(function(Ce){z("next",Ce,H,G)},function(Ce){z("throw",Ce,H,G)}):j.resolve(Ee).then(function(Ce){ye.value=Ce,H(ye)},function(Ce){return z("throw",Ce,H,G)})}G(ve.arg)}var ee;r(this,"_invoke",{value:function(F,H){function G(){return new j(function(ve,ye){z(F,H,ve,ye)})}return ee=ee?ee.then(G,G):G()}})}function L(N,j,z){var ee=d;return function(U,F){if(ee===v)throw new Error("Generator is already running");if(ee===m){if(U==="throw")throw F;return{value:n,done:!0}}for(z.method=U,z.arg=F;;){var H=z.delegate;if(H){var G=O(H,z);if(G){if(G===p)continue;return G}}if(z.method==="next")z.sent=z._sent=z.arg;else if(z.method==="throw"){if(ee===d)throw ee=m,z.arg;z.dispatchException(z.arg)}else z.method==="return"&&z.abrupt("return",z.arg);ee=v;var ve=f(N,j,z);if(ve.type==="normal"){if(ee=z.done?m:h,ve.arg===p)continue;return{value:ve.arg,done:z.done}}ve.type==="throw"&&(ee=m,z.method="throw",z.arg=ve.arg)}}}function O(N,j){var z=j.method,ee=N.iterator[z];if(ee===n)return j.delegate=null,z==="throw"&&N.iterator.return&&
vendor: 4,979 bytes, line 1
1(j.method="return",j.arg=n,O(N,j),j.method==="throw")||z!=="return"&&(j.method="throw",j.arg=new TypeError("The iterator does not provide a '"+z+"' method")),p;var U=f(ee,N.iterator,j.arg);if(U.type==="throw")return j.method="throw",j.arg=U.arg,j.delegate=null,p;var F=U.arg;return F?F.done?(j[N.resultName]=F.value,j.next=N.nextLoc,j.method!=="return"&&(j.method="next",j.arg=n),j.delegate=null,p):F:(j.method="throw",j.arg=new TypeError("iterator result is not an object"),j.delegate=null,p)}function x(N){var j={tryLoc:N[0]};1 in N&&(j.catchLoc=N[1]),2 in N&&(j.finallyLoc=N[2],j.afterLoc=N[3]),this.tryEntries.push(j)}function Y(N){var j=N.completion||{};j.type="normal",delete j.arg,N.completion=j}function $(N){this.tryEntries=[{tryLoc:"root"}],N.forEach(x,this),this.reset(!0)}function Z(N){if(N||N===""){var j=N[s];if(j)return j.call(N);if(typeof N.next=="function")return N;if(!isNaN(N.length)){var z=-1,ee=function U(){for(;++z<N.length;)if(e.call(N,z))return U.value=N[z],U.done=!1,U;return U.value=n,U.done=!0,U};return ee.next=ee}}throw new TypeError(fd(N)+" is not iterable")}return E.prototype=y,r(R,"constructor",{value:y,configurable:!0}),r(y,"constructor",{value:E,configurable:!0}),E.displayName=u(y,l,"GeneratorFunction"),i.isGeneratorFunction=function(N){var j=typeof N=="function"&&N.constructor;return!!j&&(j===E||(j.displayName||j.name)==="GeneratorFunction")},i.mark=function(N){return Object.setPrototypeOf?Object.setPrototypeOf(N,y):(N.__proto__=y,u(N,l,"GeneratorFunction")),N.prototype=Object.create(R),N},i.awrap=function(N){return{__await:N}},M(D.prototype),u(D.prototype,o,function(){return this}),i.AsyncIterator=D,i.async=function(N,j,z,ee,U){U===void 0&&(U=Promise);var F=new D(c(N,j,z,ee),U);return i.isGeneratorFunction(j)?F:F.next().then(function(H){return H.done?H.value:F.next()})},M(R),u(R,l,"Generator"),u(R,s,function(){return this}),u(R,"toString",function(){return"[object Generator]"}),i.keys=function(N){var j=Object(N),z=[];for(var ee in j)z.push(ee);return z.reverse(),function U(){for(;z.length;){var F=z.pop();if(F in j)return U.value=F,U.done=!1,U}return U.done=!0,U}},i.values=Z,$.prototype={constructor:$,reset:function(j){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(Y),!j)for(var z in this)z.charAt(0)==="t"&&e.call(this,z)&&!isNaN(+z.slice(1))&&(this[z]=n)},stop:function(){this.done=!0;var j=this.tryEntries[0].completion;if(j.type==="throw")throw j.arg;return this.rval},dispatchException:function(j){if(this.done)throw j;var z=this;function ee(ye,Ee){return H.type="throw",H.arg=j,z.next=ye,Ee&&(z.method="next",z.arg=n),!!Ee}for(var U=this.tryEntries.length-1;U>=0;--U){var F=this.tryEntries[U],H=F.completion;if(F.tryLoc==="root")return ee("end");if(F.tryLoc<=this.prev){var G=e.call(F,"catchLoc"),ve=e.call(F,"finallyLoc");if(G&&ve){if(this.prev<F.catchLoc)return ee(F.catchLoc,!0);if(this.prev<F.finallyLoc)return ee(F.finallyLoc)}else if(G){if(this.prev<F.catchLoc)return ee(F.catchLoc,!0)}else{if(!ve)throw new Error("try statement without catch or finally");if(this.prev<F.finallyLoc)return ee(F.finallyLoc)}}}},abrupt:function(j,z){for(var ee=this.tryEntries.length-1;ee>=0;--ee){var U=this.tryEntries[ee];if(U.tryLoc<=this.prev&&e.call(U,"finallyLoc")&&this.prev<U.finallyLoc){var F=U;break}}F&&(j==="break"||j==="continue")&&F.tryLoc<=z&&z<=F.finallyLoc&&(F=null);var H=F?F.completion:{};return H.type=j,H.arg=z,F?(this.method="next",this.next=F.finallyLoc,p):this.complete(H)},complete:function(j,z){if(j.type==="throw")throw j.arg;return j.type==="break"||j.type==="continue"?this.next=j.arg:j.type==="return"?(this.rval=this.arg=j.arg,this.method="return",this.next="end"):j.type==="normal"&&z&&(this.next=z),p},finish:function(j){for(var z=this.tryEntries.length-1;z>=0;--z){var ee=this.tryEntries[z];if(ee.finallyLoc===j)return this.complete(ee.completion,ee.afterLoc),Y(ee),p}},catch:function(j){for(var z=this.tryEntries.length-1;z>=0;--z){var ee=this.tryEntries[z];if(ee.tryLoc===j){var U=ee.completion;if(U.type==="throw"){var F=U.arg;Y(ee)}return F}}throw new Error("illegal catch attempt")},delegateYield:function(j,z,ee){return this.delegate={iterator:Z(j),resultName:z,nextLoc:ee},this.method==="next"&&(this.arg=n),p}},i}hi.exports=dd,hi.exports.__esModule=!0,hi.exports.default=hi.exports});var xr=fi(function(KP,vd){T();vt();var vs=hd()();vd.exports=vs;try{regeneratorRuntime=vs}catch(n){(typeof globalThis=="undefined"?"undefined":pe(globalThis))==="object"?globalThis.regeneratorRuntime=vs:Function("r","regeneratorRuntime = r")(vs)}});function cl(n){if(Array.isArray(n))return n}var pd=W(function(){T()});function fl(n,i){var t=n==null?null:typeof Symbol!="undefined"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var e,r,a,s,o=[],l=!0,u=!1;try{if(a=(t=t.call(n)).next,i===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(e=a.call(t)).done)&&(o.push(e.value),o.length!==i);l=!0);}catch(c){u=!0,r=c}
1finally{try{if(!l&&t.return!=null&&(s=t.return(),Object(s)!==s))return}finally{if(u)throw r}}return o}}var md=W(function(){T()});function _n(n,i){(i==null||i>n.length)&&(i=n.length);for(var t=0,e=new Array(i);t<i;t++)e[t]=n[t];return e}var dl=W(function(){T()});function ma(n,i){if(n){if(typeof n=="string")return _n(n,i);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _n(n,i)}}var hl=W(function(){T();dl()});function vl(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var gd=W(function(){T()});function Te(n,i){return cl(n)||fl(n,i)||ma(n,i)||vl()}var Pr=W(function(){T();pd();md();hl();gd()});function k(n,i){if(!(n instanceof i))throw new TypeError("Cannot call a class as a function")}var J=W(function(){T()});function pl(n,i){if(pe(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var e=t.call(n,i||"default");if(pe(e)!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(n)}var yd=W(function(){T();vt()});function ya(n){var i=pl(n,"string");return pe(i)=="symbol"?i:String(i)}var ml=W(function(){T();vt();yd()});function _d(n,i){for(var t=0;t<i.length;t++){var e=i[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,ya(e.key),e)}}function A(n,i,t){return i&&_d(n.prototype,i),t&&_d(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n}var X=W(function(){T();ml()});var gl,Ed=W(function(){T();J();X();gl=function(){function n(){k(this,n)}return A(n,null,[{key:"initDebug",value:function(){window.location.hash.match(/debug=314159/)&&(jeef.debug=!0)}},{key:"initUserRolGPT",value:function(t){var e=window.location.hash.match(/ugpt=(.*)/);if(e&&e.length>0){var r=!1;switch(e[1]){case"1":r=t.ad.usersRolesGPT[0];break;case"2":r=t.ad.usersRolesGPT[1];break;case"3":r=t.ad.usersRolesGPT[2];break;case"4":r=t.ad.usersRolesGPT[3];break;default:}(e[1]==="3"||e[1]==="4")&&(t.ad.seedTag=!1,t.ad.sticky=!1,t.ad.vidoomy=!1),t.ad.userRolGPT=r}return t}}]),n}()});function V(n,i,t){return i=ya(i),i in n?Object.defineProperty(n,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[i]=t,n}var Ge=W(function(){T();ml()});var Je,En=W(function(){T();X();J();Ge();Je=A(function n(){k(this,n)});V(Je,"PIANO_SCREEN_LOGIN","login");V(Je,"PIANO_SCREEN_REGISTER","register");V(Je,"PIANO_SCREEN_PASSWORD","new-password");V(Je,"PIANO_SCREEN_RESTORE","restore");V(Je,"PIANO_DISPLAY_MODAL","modal");V(Je,"PIANO_DISPLAY_POPUP","popup");V(Je,"PIANO_DISPLAY_INLINE","inline");V(Je,"PIANO_STAGE","")});function ps(){var n=window.location.hostname.split(".").pop(),i="",t="pro";return window.location.hostname.startsWith("pre-")?(n="com",i="pre-",t="pre"):window.location.hostname.startsWith("int-")?(n="com",i="int-",t="int"):window.location.hostname.startsWith("local-")&&(n="com",i="local-",t="local"),{sufix:n,prefix:i,envGPT:t}}var yl=W(function(){T()});var en,_l=W(function(){T();en={LAZYLOAD:{TYPES:{DISABLED:"disabled",GOOGLETAG:"googletag",NATIVE:"native"},OFFSET_Y:300}}});var Td=fi(function(FD,Sd){T();Sd.exports=["WebView","(iPhone|iPod|iPad)(?!.*Safari)","Android.*(;\\s+wv|Version/\\d.\\d\\s+Chrome/\\d+(\\.0){3})","Linux; U; Android"]});var kd=fi(function(BD,bd){T();var zS=Td(),JS=new RegExp("("+zS.join("|")+")","ig");bd.exports=function(i){return!!i.match(JS)}});function Id(){return window.appVersion||(window.appVersion=XS("appversion")),window.appVersion}function XS(n){var i=/\s-\s(.+)$/gm,t=i.exec(navigator.userAgent);if(!t)return!1;for(var e=t[1].split(";"),r={},a=0;a<e.length;a++){var s=e[a].split(":");r["".concat(s[0])]=s[1]}return r[n]}var Ad,Ri,Cd,Ld,Sn=W(function(){T();J();X();Ad=fr(kd(),1);Ri=function(){return Id()},Cd=function(){if(window.appAI)return window.appAI},Ld=function(){var i=Id();return(0,Ad.default)(navigator.userAgent)&&!i}});var Tn,Rd,El,QS,vi,ms,Od,wd=W(function(){T();Ed();En();yl();_l();Sn();Rd=ps(),El=Rd.sufix,QS=Rd.envGPT,vi=!1;switch((Tn=navigator)===null||Tn===void 0||(Tn=Tn.connection)===null||Tn===void 0?void 0:Tn.effectiveType){case"4g":vi="F";break;case"3g":vi="M";break;case"2g":vi="S";break}ms={isApp:!!Ri(),environment:El==="com"||El==="pro"?"pro":El,allowedDomains:[],environmentGPT:QS,delayScroll:.5,lazyOffset:550,resizeControl:250,scrollControl:100,earlyScripts:[],geaConfig:{sdkJS:["https://accounts.google.com/gsi/client","https://news.google.com/swg/js/v1/swg-gaa.js"]},cmp:{consentId:""},antiAd:"/assets_js/dyn/adsbygoogle.js",lazyAd:{mobile:!1,tablet:!1,desktop:!1},ad:{googleGpt:!0,sunMedia:!0,seedTag:!0,taboola:!0,vidoomy:!0,sticky:!0,prebid:!0,gpt:{position:{},discardSectionsAndTagsGpt:{default:[]},lazyload:en.LAZYLOAD.TYPES.DISABLED},exclusiveSegments:[],disableAd1x1:{default:!0},disable:!0,userRolGPT:!1,usersRolesGPT:["anonimo","registrado","suscriptorAutoPromo","suscriptorEspecPromo"],lazyTimeout:vi=="F"||!vi?1e4:vi=="M"?3e4:0,lazyTimeoutInterstitial:vi=="F"||!vi?1e4:vi=="M"?3e4:0,lazyRelatedOutbrain:{lazyTimeoutRelated:"40000",rootMarginRelated:"600px"},lazySlider:{lazyTime:8e3},formats:{relatedSearch:{default:!1},inText1:{default:!1},inText2:{default:!1},related:{default:!1},midArticle:{default:!1},sideBar:{default:!1},inImage:{default:!1,exceptionTags:[]},scripts:{default:!1},sliderDesktop:{default:!1},sliderMobile:{default:!1},providers:{},interstitial:{default:!1},adwall:{default:!1},formatTypes:{},gpt:{default:!1}},googleCsaAfs:{enabled:!1},sunMediaConfig:{adv_paragraph_1:{default:!1},adv_paragraph_2:{default:!1},inImage:{default:!1}},exCoConfig:{adv_paragraph_1:{}},stickyConfig:{default:{home:!1,content:!1,disableMobile:!0,disableDesktop:!0}},enableRefreshGPT:{default:!1},billboardSkinCampaignIds:{default:[]},scriptsBeforeGPT:{default:!1},scriptsAfterGPT:{default:!1},enableVidoomySections:{default:!1},apsAmazon:{allowedSizes:[[320,50],[300,250],[728,90],[300,600],[160,600],[640,390],[336,280],[320,100],[300,50],[640,480],[320,480],[640,360],[970,250],[400,225]],excludedContainers:["skyizq","skyder"]},adUser:{disable:!0},freeIntrusiveAdvertising:{ids:[34181]},intrusiveAdsOnSubscriberContent:!1,hideTaboolaForRegistered:!1},ws:{landing:"/suscripciones/",androidApp:"/openApp/"},timeRefresh:600,stats:{isOkDomains:!1,analytics:{disabled:!0,all:"UA-58108281-1",uas:{default:{}},uasGA4:{},events:{compra1:["Suscripciones","paso1"],compra2:["Suscripciones","paso2"],compra3:["Suscripciones","paso3"],azkaban:["Muro","general"],infiniteScroll:["PaginaScroll","general"],liveBlog:["LiveBlog","recarga"],comments:["Comentarios","Paginacion"],swipe:["Swipe","Swipe"],newsletters:{web_ui_header:["web_ui","Click","button_newsletter_subscribe_enveloper"],web_ui_landing:["web_ui","Click","button_newsletter_subscribe_landingsubs"]},swipeNav:{buttonHome:["recirculation","click","backHome"],buttonNextArticle:["recirculation","click","nextArticle"]}},urlPagesSubs:{login:"login/",signin:"sign-in/",payment:"payment/",paymentOk:"payment_made/",paymentKo:"payment_off/"}}
1,comscore:{disabled:!0},gfk:{url:"//es-config.sensic.net/s2s-web.js",urlPre:"//es-config-preproduction.sensic.net/s2s-web.js",disabled:!0},facebook:{disabled:!0,all:"461768093983650",compra1:"Lead",compra2:"InitiateCheckout",compra3:"Purchase",piano:{compra1:"checkoutSuccess"}},pixel:{disabled:!0},webvitals:{disabled:!0},liveRamp:{disabled:!0,src:"https://launchpad-wrapper.privacymanager.io/1879244f-8348-464c-95d4-2c291570c689/launchpad-liveramp.js",preloadSrc:"https://launchpad.privacymanager.io/latest/launchpad.bundle.js"},seedtag:{disabled:!0,idBySection:{},tagsDisabled:{}},citiServi:{disabled:!0},optimalNetwork:{isEnable:!1},utiq:{disabled:!0}},app:{disableInterface:!0},tools:{ws:{rating:"/services/rating/",bookmark:"/services/bookmark/",list:"/usuarios/favoritos/page/"}},liveBlog:{ws:{paging:"/espliveblog/"},timerCheck:10,timerRepeatCount:0},comments:{enabled:!1,spotIm:{elespanol:{spotId:"sp_CstmmJW7",token:"03191218DYnvNE"},invertia:{spotId:"sp_bSfOGVFz",token:"03191218lIF1SS"}},timeOutEnableForm:5e3,timerCheck:120,timerRepeatCount:0},dyn:{addevwebJS:{discardSectionsAndTags:{default:[]}}},user:{userRoutes:{ws:"",wsSecure:"",fluffyDoor:"",loginPage:"",logoutPage:"",loginPageAMP:"",loginPageInvertia:"",profilePage:"",profilePageInvertia:"",home:"",homeInvertia:"",homeHemerotecaElCultural:"",subscriptionPage:"",stage:"",pianoSync:"",pianoLogin:"",pianoPurchase:"",gotGae:"",commentsFormModal:"",alohomoraComments:""},azkaban:{siriusblack:"/modals/paywall1.html",isOkDomains:!1},piano_modals:{user:{login:{screen:Je.PIANO_SCREEN_LOGIN,display:Je.PIANO_DISPLAY_MODAL},register:{screen:Je.PIANO_SCREEN_REGISTER,display:Je.PIANO_DISPLAY_MODAL},restore:{screen:Je.PIANO_SCREEN_RESTORE,display:Je.PIANO_DISPLAY_MODAL},"new-password":{screen:Je.PIANO_SCREEN_PASSWORD,display:Je.PIANO_DISPLAY_MODAL}}},googleOneTap:{active:!1,lazy:{time:7e3,scroll:15}}},followContent:{localstorage:{ws:{saveStory:"/services/story",saveTag:"/services/tag"}}},zonan:{home:{ws:{}},promo:{ws:{}}},communities:{texts:{defaultAnswer:"Has participado correctamente en la promoci\xF3n.\n En breve recibir\xE1s un correo electr\xF3nico con las instrucciones para confirmar tu participaci\xF3n.\n Revisa tu bandeja de entrada (y la carpeta de spam) para no perderte nada."},login:"default"},concursos:{ws:{postContest:"",getContestList:""}},loteria:{ws:{principalPrizes:""}},infinite:{portadilla:"/espscroll.html",buscador:"/espscrollsearch.html",blogs:"/espblogscroll.html",liveblog:"/espliveblog/"},linkslp:{legalpolicy:"",windowsize:"width=1000,height=950px"},subDomain:"",social:{},opta:{assets:{jsV2:"https://secure.widget.cloud.opta.net/2.0/js/widgets.opta.js",cssV2:"https://secure.widget.cloud.opta.net/2.0/css/widgets.opta.css",jsV3:"https://secure.widget.cloud.opta.net/v3/v3.opta-widgets.js",cssV3:"https://secure.widget.cloud.opta.net/v3/css/v3.football.opta-widgets.css"}},alertsInterval:{home:5e3},modalCss:"/assets_css/v1.1/css/modals-e2t.css",alertsCMS:{URL:"/eemodules/BB3UrgentMO/mo.html?p=W10&h=6f4b",isOkDomains:!0},GDPR:{url:"/modals/cookies.html",apiGet:"https://acl.eestatic.com/7e618c7aa6i/api/get/{UID}/",apiSet:"https://acl.eestatic.com/7e618c7aa6i/api/set/",nameCookieGDPR:"chk_usr_gdpr",expireTimeCookieGDPR:1,nameCookieUID:"uid",nameCookieCkApi:"chk_api",expireTimeCookieCkApi:1,versionCookiePolicy:"2.0",dateCookiePolicy:"24/05/2018",salt:"15c280c792288",isOkDomains:!1},cookiesConf:{domain:""},homePagesTypes:["homepage","tag","author","destacado","blog","buscador"],piano:{init:"",sdk:"",debug:!1,socialLoginDomain:"",ridSwg:"",offer:{templateId:"",offerId:"",defaultTermId:""},ari:{enabled:!1}},subscriptionConfLandingPages:{checkUserSubscriber:!1,checkUserSubscriberExcludedUrls:[]},sharedConfRRSS:{twitter:{via:{default:!1}}},GoogleRRME:{active:!1},cookiewall:{enabled:!1}};window.jeefSiteConfig=ms;gl.initDebug();ms=gl.initUserRolGPT(ms);Od=ms});function Sl(n){if(Array.isArray(n))return _n(n)}var xd=W(function(){T();dl()});function Tl(n){if(typeof Symbol!="undefined"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}var Pd=W(function(){T()});function bl(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var Dd=W(function(){T()});function nr(n){return Sl(n)||Tl(n)||ma(n)||bl()}var tn=W(function(){T();xd();Pd();hl();Dd()});var bn,Md=W(function(){T();tn();vt();J();X();bn=function(){function n(){k(this,n)}return A(n,null,[{key:"mixinObject",value:function(){for(var t=function(o){return o&&pe(o)==="object"},e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];
1return r.reduce(function(s,o){return Object.keys(o).forEach(function(l){var u=s[l],c=o[l];Array.isArray(u)&&Array.isArray(c)?s[l]=u.concat.apply(u,nr(c)):t(u)&&t(c)?s[l]=n.mixinObject(u,c):s[l]=c}),s})}}]),n}()});var He,kn=W(function(){T();He={elespanol:"elespanol",cronicavasca:"cronicavasca",cronicaglobal:"cronicaglobal",metropoliabierta:"metropoliabierta",elespanolb:"elespanolb",redaccionmedica:"redaccionmedica"}});var $S,gs,kl=W(function(){T();kn();$S=function(){var i,t=window.location.hostname;switch(!0){case t.includes(He.metropoliabierta):i=He.metropoliabierta;break;case t.includes(He.cronicaglobal):i=He.cronicaglobal;break;case t.includes(He.cronicavasca):i=He.cronicavasca;break;case t.includes(He.elespanolb):i=He.elespanolb;break;case t.includes(He.redaccionmedica):i=He.redaccionmedica;break;default:i=He.elespanol;break}return i},gs=$S()});var _a,ZS,L1,I,_e=W(function(){T();Pr();J();X();wd();Md();kl();_a=function(i){return structuredClone(i)},ZS=function(){function n(){k(this,n),this.finalConfig={}}return A(n,[{key:"init",value:function(){var t=this;return this.finalConfig=_a(Od),this.loadExternalConfigs(),Object.defineProperty(window,"jeefConfig",{get:function(){return t.getConfig()},configurable:!1,enumerable:!0}),this.finalConfig}},{key:"getConfig",value:function(){return _a(this.finalConfig)}},{key:"loadExternalConfigs",value:function(){try{if(!window.jeefRemoteConfig||!window.jeefRemoteConfig.length)return;for(var t=_a(window.jeefRemoteConfig),e={};t.length>0;){var r=t.pop();e=bn.mixinObject(e,r)}var a=bn.mixinObject(_a(this.finalConfig),e);this.finalConfig=this.mixSpecificPathsConfig(a)}catch(s){console.error("Error loading external config:",s)}}},{key:"mixSpecificPathsConfig",value:function(t){if(t.pathConfigs)for(var e=0,r=Object.entries(t.pathConfigs);e<r.length;e++){var a=Te(r[e],2),s=a[0],o=a[1];if(o.paths&&Array.isArray(o.paths)){var l=o.paths.some(function(u){return document.location.pathname.startsWith(u)});if(l&&o.specific){t=bn.mixinObject(t,o.specific);break}}}return t}},{key:"loadInternalConfigs",value:function(){try{if(typeof window.specificSitesConfig=="undefined"||window.specificSitesConfig.length===0)return;for(var t=_a(window.specificSitesConfig),e=gs,r={};t.length>0;)for(var a=t.pop(),s=0,o=Object.entries(a);s<o.length;s++){var l=Te(o[s],2),u=l[0],c=l[1];c.site&&c.site===e&&(r=bn.mixinObject(r,c))}r&&Object.keys(r).length>0&&(this.finalConfig=bn.mixinObject(this.finalConfig,r))}catch(f){console.error("Error loading internal config:",f)}}}]),n}();window.__mainConfigInstance||(window.__mainConfigInstance=new ZS,window.__jeeConf=window.__mainConfigInstance.init());L1=window.__mainConfigInstance,I=window.__jeeConf});function eT(){return Il.apply(this,arguments)}function Il(){return Il=ut(Al.default.mark(function n(){return Al.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(window.fetch){t.next=3;break}return t.next=3,__import__("".concat(I.assets).concat("/assets_js/web/v2/","polyfill_fetch_nomodule.min.js"),"fetch");case 3:if(window.customElements){t.next=6;break}return t.next=6,__import__("".concat(I.assets).concat("/assets_js/web/v2/","customElements.min.js"),"customElements");case 6:case"end":return t.stop()}},n)})),Il.apply(this,arguments)}var Al,T=W(function(){wr();Al=fr(xr(),1);_e();window.__import__=function(n,i){return new Promise(function(t){console.log("... loading",i,"polyfill");var e=document.createElement("script");e.onload=function(){setTimeout(function(){console.log("......loaded",i,"polyfill"),t(!0)},20)},e.src=n,document.getElementsByTagName("head")[0].appendChild(e)})};eT();window.nhfp_all_polyfills_loaded=function(){return!!window.fetch}});function qe(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}var Dr=W(function(){T()});function q(n,i){if(i&&(pe(i)==="object"||typeof i=="function"))return i;if(i!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qe(n)}var ue=W(function(){T();vt();Dr()});function w(n){return w=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},w(n)}var oe=W(function(){T()});function kr(n,i){return kr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},kr(n,i)}var An=W(function(){T()});
1function B(n,i){if(typeof i!="function"&&i!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(i&&i.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),i&&kr(n,i)}var le=W(function(){T();An()});var At,Oi=W(function(){T();At={};At.ON_ERROR_LOAD_SDK="onLoadSdk";At.TRIGGER_DIDOMI="onTriggerDidomi";At.NOTICE_CLOSED="onDidomiNoticeClosed";At.ADS_CONSENT_GRANTED="onDidomiAdsGranted"});var Nd,Fd=W(function(){T();J();X();Nd=function(){function n(){k(this,n)}return A(n,null,[{key:"write",value:function(t,e,r,a){}},{key:"clear",value:function(){}}]),n}()});var Cl,In,Ve,Cn=W(function(){T();try{Cl=window}catch(n){Cl=global}In=Cl;In.jeef=In.jeef||{};Ve=In.jeef});function tT(n,i,t){return i=w(i),q(n,Ud()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function Ud(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Ud=function(){return!!n})()}var Bd,rT,pr,Gd=W(function(){T();J();X();ue();oe();le();Fd();Cn();Bd=function(n){B(i,n);function i(){return k(this,i),tT(this,i)}return A(i,null,[{key:"write",value:function(e,r,a,s){switch(e.splice(0,0,"["+a+"]"),r){case 0:break;case 1:pr.log=Function.prototype.bind.call(console.log,top.console),pr.log.apply(top.console,e);break;case 2:pr.debug?(pr.debug=Function.prototype.bind.call(console.debug,top.console),pr.debug.apply(top.console,e)):(e.splice(0,0,"[DEBUG]"),pr.log=Function.prototype.bind.call(console.log,top.console),pr.log.apply(top.console,e));break;case 3:pr.info=Function.prototype.bind.call(console.info,top.console),pr.info.apply(top.console,e);break;case 4:pr.warn=Function.prototype.bind.call(console.warn,top.console),pr.warn.apply(top.console,e);break;case 5:pr.error=Function.prototype.bind.call(console.error,top.console),pr.error.apply(top.console,e);break}}},{key:"clear",value:function(){pr.clear()}}]),i}(Nd),rT=function(){if(!In.console){var i=function(){};return console={log:i,warn:i,error:i,info:i,debug:i,clear:i},console}return In.console},pr=rT()});function Ll(n,i){for(;!Object.prototype.hasOwnProperty.call(n,i)&&(n=w(n),n!==null););return n}var jd=W(function(){T();oe()});function ar(){return typeof Reflect!="undefined"&&Reflect.get?ar=Reflect.get.bind():ar=function(i,t,e){var r=Ll(i,t);if(r){var a=Object.getOwnPropertyDescriptor(r,t);return a.get?a.get.call(arguments.length<3?i:e):a.value}},ar.apply(this,arguments)}var rn=W(function(){T();jd()});var $d=fi(function(mM,Rl){"use strict";T();vt();var Ln=(typeof Reflect=="undefined"?"undefined":pe(Reflect))==="object"?Reflect:null,Hd=Ln&&typeof Ln.apply=="function"?Ln.apply:function(i,t,e){return Function.prototype.apply.call(i,t,e)},ys;Ln&&typeof Ln.ownKeys=="function"?ys=Ln.ownKeys:Object.getOwnPropertySymbols?ys=function(i){return Object.getOwnPropertyNames(i).concat(Object.getOwnPropertySymbols(i))}:ys=function(i){return Object.getOwnPropertyNames(i)};function iT(n){console&&console.warn&&console.warn(n)}var Kd=Number.isNaN||function(i){return i!==i};function rt(){rt.init.call(this)}Rl.exports=rt;Rl.exports.once=oT;rt.EventEmitter=rt;rt.prototype._events=void 0;rt.prototype._eventsCount=0;rt.prototype._maxListeners=void 0;var Vd=10;function _s(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+pe(n))}Object.defineProperty(rt,"defaultMaxListeners",{enumerable:!0,get:function(){return Vd},set:function(i){if(typeof i!="number"||i<0||Kd(i))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+i+".");Vd=i}});rt.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};rt.prototype.setMaxListeners=function(i){if(typeof i!="number"||i<0||Kd(i))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+i+".");return this._maxListeners=i,this};function Wd(n){return n._maxListeners===void 0?rt.defaultMaxListeners:n._maxListeners}rt.prototype.getMaxListeners=function(){return Wd(this)};rt.prototype.emit=function(i){for(var t=[],e=1;e<arguments.length;e++)t.push(arguments[e]);var r=i==="error",a=this._events;if(a!==void 0)r=r&&a.error===void 0;else if(!r)return!1;if(r){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var l=a[i];if(l===void 0)return!1;if(typeof l=="function")Hd(l,this,t);else for(var u=l.length,c=Xd(l,u),e=0;e<u;++e)Hd(c[e],this,t);return!0};function qd(n,i,t,e){var r,a,s;if(_s(t),a=n._events,a===void 0?(a=n._events=Object.create(null),n._eventsCount=0):(a.newListener!==void 0&&(n.emit("newListener",i,t.listener?t.listener:t),a=n._events),s=a[i]),s===void 0)s=a[i]=t,++n._eventsCount;else if(typeof s=="function"?s=a[i]=e?[t,s]:[s,t]:e?s.unshift(t):s.push(t),r=Wd(n),r>0&&s.length>r&&!s.warned){s.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(i)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=n,o.type=i,o.count=s.length,iT(o)}return n}rt.prototype.addListener=function(i,t){return qd(this,i,t,!1)};rt.prototype.on=rt.prototype.addListener;rt.prototype.prependListener=function(i,t){return qd(this,i,t,!0)};
1function nT(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Yd(n,i,t){var e={fired:!1,wrapFn:void 0,target:n,type:i,listener:t},r=nT.bind(e);return r.listener=t,e.wrapFn=r,r}rt.prototype.once=function(i,t){return _s(t),this.on(i,Yd(this,i,t)),this};rt.prototype.prependOnceListener=function(i,t){return _s(t),this.prependListener(i,Yd(this,i,t)),this};rt.prototype.removeListener=function(i,t){var e,r,a,s,o;if(_s(t),r=this._events,r===void 0)return this;if(e=r[i],e===void 0)return this;if(e===t||e.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[i],r.removeListener&&this.emit("removeListener",i,e.listener||t));else if(typeof e!="function"){for(a=-1,s=e.length-1;s>=0;s--)if(e[s]===t||e[s].listener===t){o=e[s].listener,a=s;break}if(a<0)return this;a===0?e.shift():aT(e,a),e.length===1&&(r[i]=e[0]),r.removeListener!==void 0&&this.emit("removeListener",i,o||t)}return this};rt.prototype.off=rt.prototype.removeListener;rt.prototype.removeAllListeners=function(i){var t,e,r;if(e=this._events,e===void 0)return this;if(e.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):e[i]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete e[i]),this;if(arguments.length===0){var a=Object.keys(e),s;for(r=0;r<a.length;++r)s=a[r],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=e[i],typeof t=="function")this.removeListener(i,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(i,t[r]);return this};function zd(n,i,t){var e=n._events;if(e===void 0)return[];var r=e[i];return r===void 0?[]:typeof r=="function"?t?[r.listener||r]:[r]:t?sT(r):Xd(r,r.length)}rt.prototype.listeners=function(i){return zd(this,i,!0)};rt.prototype.rawListeners=function(i){return zd(this,i,!1)};rt.listenerCount=function(n,i){return typeof n.listenerCount=="function"?n.listenerCount(i):Jd.call(n,i)};rt.prototype.listenerCount=Jd;function Jd(n){var i=this._events;if(i!==void 0){var t=i[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}rt.prototype.eventNames=function(){return this._eventsCount>0?ys(this._events):[]};function Xd(n,i){for(var t=new Array(i),e=0;e<i;++e)t[e]=n[e];return t}function aT(n,i){for(;i+1<n.length;i++)n[i]=n[i+1];n.pop()}function sT(n){for(var i=new Array(n.length),t=0;t<i.length;++t)i[t]=n[t].listener||n[t];return i}function oT(n,i){return new Promise(function(t,e){function r(s){n.removeListener(i,a),e(s)}function a(){typeof n.removeListener=="function"&&n.removeListener("error",r),t([].slice.call(arguments))}Qd(n,i,a,{once:!0}),i!=="error"&&lT(n,r,{once:!0})})}function lT(n,i,t){typeof n.on=="function"&&Qd(n,"error",i,t)}function Qd(n,i,t,e){if(typeof n.on=="function")e.once?n.once(i,t):n.on(i,t);else if(typeof n.addEventListener=="function")n.addEventListener(i,function r(a){e.once&&n.removeEventListener(i,r),t(a)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+pe(n))}});var Ze,Ol=W(function(){T();Ze={};Ze.ON_DOM_SWYPE_TOP="onDOMSwypeTop";Ze.ON_DOM_SWYPE_BOT="onDOMSwypeBot";Ze.ON_DOM_SWYPE_LEFT="onDOMSwypeLeft";Ze.ON_DOM_SWYPE_RIGHT="onDOMSwypeRight";Ze.ON_DOM_SCROLL_TOP="onDOMScrollTop";Ze.ON_DOM_SCROLL_BOTTOM="onDOMScrollBottom";Ze.ON_DOM_SCROLL_LEFT_MAX="onDomScrollLeftMax";Ze.ON_DOM_SCROLL_LEFT_PROGRESS="onDomScrollLeftProgress";Ze.ON_DOM_SCROLL_PROGRESS="onDOMScrollProgress";Ze.ON_DOM_SCROLL="onDOMScroll";Ze.ON_DOM_RESIZE="onDOMResize";Ze.ON_DOM_CONTRASCROLL_UP="onDOMContraScrollUp";Ze.ON_DOM_CONTRASCROLL_DOWN="onDOMContraScrollDown";Ze.ON_DOM_LOAD="load";Ze.ON_DOM_CONTENT_LOADED="DOMContentLoaded";Ze.ON_DOM_CLICK="click";Ze.ON_DOM_KEYUP="keyup";Ze.ON_DOM_KEYDOWN="keydown";Ze.ON_DOM_SUBMIT_FORM="submit";Ze.ON_DOM_SELECT_CHANGE="change";Ze.ON_DOM_SELECT_FOCUS="focus";Ze.ON_DOM_MESSAGE="message"});function uT(n,i,t){return i=w(i),q(n,eh()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function eh(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(eh=function(){return!!n})()}function Zd(n,i,t,e){var r=ar(w(1&e?n.prototype:n),i,t);return 2&e&&typeof r=="function"?function(a){return r.apply(t,a)}:r}var th,Es,Ht,Qr=W(function(){T();J();X();ue();oe();rn();
1le();th=fr($d());Ol();Es=null,Ht=function(n){B(i,n);function i(){var t;return k(this,i),t=uT(this,i),t.persistentEvents=new Map,t.setMaxListeners(50),t}return A(i,[{key:"persistentEmit",value:function(e){for(var r=arguments.length,a=new Array(r>1?r-1:0),s=1;s<r;s++)a[s-1]=arguments[s];this.persistentEvents.set(e,a),Zd(i,"emit",this,3)([e].concat(a))}},{key:"onPersistentEvent",value:function(e,r){this.persistentEvents.has(e)&&r(this.persistentEvents.get(e));for(var a=arguments.length,s=new Array(a>2?a-2:0),o=2;o<a;o++)s[o-2]=arguments[o];Zd(i,"on",this,3)([e,r].concat(s))}},{key:"startDomEvents",value:function(){var e=this;window.addEventListener(Ze.ON_DOM_CONTENT_LOADED,function(r){e.emit(Ze.ON_DOM_CONTENT_LOADED)}),window.addEventListener(Ze.ON_DOM_LOAD,function(r){e.emit(Ze.ON_DOM_LOAD)})}}],[{key:"getInstance",value:function(){return Es||(Es=new i,Es.startDomEvents()),Es}}]),i}(th.default)});function rh(n){Ve.debug=n}function ne(n){return n in Yt||(Yt[n]={status:!0}),Yt[n]}function P(n,i){Rn(n,Ve.log.levelType.LOG,i)}function zt(n,i){Rn(n,Ve.log.levelType.DEBUG,i)}function xl(n,i){Rn(n,Ve.log.levelType.INFO,i)}function St(n,i){Rn(n,Ve.log.levelType.WARNING,i)}function Dt(n,i){Rn(n,Ve.log.levelType.ERROR,i)}function cT(n,i,t){(i===void 0||fT(i)===!1)&&(i=Ve.log.levelType.LOG),Rn(n,i,t)}var Yt,wl,Rn,fT,Se=W(function(){T();Gd();Cn();Qr();Ve.debug=window._mmJeefDebug||!1;Ve.JeefEvents||(Ve.JeefEvents=Ht.getInstance());Yt={DEFAULT:{status:!0}};wl=[];wl.push(Bd);Ve.log={levelType:{OFF:0,LOG:1,DEBUG:2,INFO:3,WARNING:4,ERROR:5},showChannels:function(){return Yt},getChannel:function(i){return i in Yt||(Yt[i]={status:!0}),Yt[i]},enableChannel:function(i){return Yt[i]!==void 0?(Yt[i].status=!0,!0):!1},onlyChannel:function(i){var t;for(t in Yt)Yt[t].status=t===i},disableChannel:function(i){return Yt[i]!==void 0?(Yt[i].status=!1,!0):!1}};Rn=function(i,t,e){if(Ve.debug===!0&&Object.prototype.toString.call(i)==="[object Array]"){if(Yt[e]===void 0&&(e="DEFAULT"),Yt[e].status!==!0){P.getChannel("jeef.LOG"),cT("El canal "+e+" est\xE1 inactivo creamos canal jeef.LOG",t,"jeef.LOG");return}for(var r=0;r<wl.length;r++){var a=new Date;wl[r].write(i,t,e,a)}}},fT=function(i){for(var t in Ve.log.levelType)if(i===Ve.log.levelType[t])return!0;return!1}});var ih=W(function(){T();typeof Object.assign!="function"&&Object.defineProperty(Object,"assign",{value:function(i,t){"use strict";if(i==null)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(i),r=1;r<arguments.length;r++){var a=arguments[r];if(a!=null)for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e},writable:!0,configurable:!0})});function Mt(n){return n!==void 0}function ct(n,i,t){var e=n.split("."),r=t||dT;!(e[0]in r)&&r.execScript&&r.execScript("var "+e[0]);for(var a;e.length&&(a=e.shift());)!e.length&&Mt(i)?r=r[a]=i:r[a]?r=r[a]:r=r[a]={};return r}var dT,Jt=W(function(){T();Ge();vt();ih();dT=window});function dr(n){for(var i=n+"=",t=document.cookie.split(";"),e=0;e<t.length;e++){for(var r=t[e];r.charAt(0)===" ";)r=r.substring(1,r.length);if(r.indexOf(i)===0)return r.substring(i.length,r.length)}return null}function Vr(n,i){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:360,e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:window.location.host,r=new Date,a,s=e||window.location.host;r.setTime(r.getTime()+t*24*60*60*1e3),a="; expires="+r.toGMTString(),document.cookie=n+"="+i+a+"; path=/; domain="+s}function Ss(n,i,t){var e=t||window.location.host,r=i||"/";dr(n)&&(document.cookie=n+"="+(r?";path="+r:"")+(e?";domain="+e:"")+";expires=Thu, 01 Jan 1970 00:00:01 GMT")}function On(n,i){Vr(n,"",-1,i)}function wi(n){if(Mt(Storage))try{return localStorage.getItem(n)}catch(i){return null}return null}function xi(n,i){if(Mt(Storage))try{localStorage.setItem(n,i)}catch(t){St(["jeef.sec.setLocalStorage>","Modo privado o est\xE1s utilizando navegador que no soporta localStorage"],nh)}}function ah(n){if(Mt(Storage))try{localStorage.removeItem(n)}catch(i){St(["jeef.sec.clearLocalStorage>","Modo privado o est\xE1s utilizando navegador que no soporta localStorage"],nh)}}var nh,mr=W(function(){T();Jt();Se();nh="SEC"});function xn(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"data-target";if(Mt(n)){var t=(n.getAttribute(i)||"").split(","),e=0,r=[],a;for(e;e<t.length;e++)switch(t[e]){case"self":r.push(n);break;case"next":r.push(n.nextSibling);break;case"previous":r.push(n.previousSibling);break;case"parent":r.push(n.parentElement);break;default:a=document.getElementById(t[e]),Mt(a)&&r.push(a)}return r}}function sh(n){if(n){var i=Dl(n);n.getAttribute("data-subtype")==="params"&&(i+=i.indexOf("?")!=-1?window.location.search.replace("?","&"):window.location.search),document.location.href=i}}function nn(n,i){var t=0,e=n.getAttribute("data-granted-role")||void 0,r,a=n.getAttribute("data-toggler")||void 0,s=[],o="data-target";if(e!==void 0){var l=Vt("data-user-role",n,document),u=l?l[1]:void 0,c=e.split(",").map(function(f){return f.trim()}).includes(u);o=c?"data-granted-target":"data-not-granted-target"}for(r=xn(n,o)||[],t;t<r.length;t++)r[t]&&s.push(ae(r[t],i,a));return s}function an(n){return n?n.getAttribute("data-action")==="toggle"&&n.getAttribute("data-status")==="on":!1}function ae(n,i){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",e="data-".concat(t?t+"-":"","status");if(n){if(Mt(i)||(i=n.getAttribute(e)!="on"),n.setAttribute(e,i?"on":"off"),n.setAttribute("data-action","toggle"),!i&&n==wn?wn=null:Pl(n),n.getAttribute("data-behaviour")=="volatile"&&i&&(wn=n),n.getAttribute("data-behaviour")=="persist"){var r="ee-persist-".concat(n.id);xi(r,JSON.stringify(i))}return i}}function oh(n){if(n){var i=Vt("data-behaviour",n,document,"persist"),t=n.getAttribute("data-type")==="toggler",e="ee-persist-".concat(i[0].id),r=JSON.parse(wi(e));r!==null&&nn(i[0],r)}}function Pl(n){var i=Vt("data-behaviour",n,document,"volatile"),t=n.getAttribute("data-type")==="toggler";wn&&!t&&(!i||i[0]!==wn)&&ae(wn,!1)}function lh(n){var i=0,t=xn(n);for(i;i<t.length;i++)ae(t[i],i===0)}function $r(n,i){n.setAttribute("data-animation",i?"on":"off")}function uh(n){return n.getAttribute("data-animation")=="on"}function Sa(n,i){n&&(n.setAttribute("data-action","layout"),i=i||"",n.setAttribute("data-behaviour",i))}function Dl(n){return n?n.href||n.getAttribute("data-href"):!1}
1function Vt(n,i,t,e){var r=i.getAttribute(n);return!e&&r||e&&e==r?[i,r]:i&&i.parentNode&&i.parentNode!=t&&i!=document&&i!=document.documentElement&&i!=t?Vt(n,i.parentNode,t,e):!1}function Pn(n){Ea=Ea||document.getElementsByTagName("meta");for(var i=0;i<Ea.length;i++)if(Ea[i].getAttribute("property")===n)return Ea[i].getAttribute("content");return!1}function Ta(n,i,t,e){if(n){var r;if(Mt(t))if(n.setAttribute("data-action","notify"),n.setAttribute("data-behaviour",i),e)n.setAttribute("data-value",t);else return r=document.createElement("p"),r.innerHTML=t,n.appendChild(r),r;else n.removeAttribute("data-action"),n.removeAttribute("data-behaviour"),n.removeAttribute("data-value")}}function Ml(n,i){if(n)return i&&n.setAttribute("data-value",i),n.getAttribute("data-value")}var hT,wn,Ea,ft=W(function(){T();Se();Jt();mr();hT="BROWSER";ne(hT);wn=null;Ea=null});var Qe,sr=W(function(){T();X();J();Qe=A(function n(i){k(this,n),this.type=i,this.target=null,this.currentTarget=null})});function vT(n,i,t){return i=w(i),q(n,ch()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function ch(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(ch=function(){return!!n})()}var de,Mr=W(function(){T();J();X();ue();oe();le();sr();Jt();ct("jeef.events.DOMEvent");de=function(n){B(i,n);function i(t){var e;return k(this,i),e=vT(this,i,[t]),e.native={},e.prop=0,e.currentTarget={},e.innerHandler=null,e.nativeType=null,e}return A(i,[{key:"unlisten",value:function(){this.currentTarget.removeEventListener(this.nativeType,this.innerHandler)}}]),i}(Qe);de.ON_DOM_SWYPE_TOP="onDOMSwypeTop";de.ON_DOM_SWYPE_BOT="onDOMSwypeBot";de.ON_DOM_SWYPE_LEFT="onDOMSwypeLeft";de.ON_DOM_SWYPE_RIGHT="onDOMSwypeRight";de.ON_DOM_SCROLL_TOP="onDOMScrollTop";de.ON_DOM_SCROLL_BOTTOM="onDOMScrollBottom";de.ON_DOM_SCROLL_LEFT_MAX="onDomScrollLeftMax";de.ON_DOM_SCROLL_LEFT_PROGRESS="onDomScrollLeftProgress";de.ON_DOM_SCROLL_PROGRESS="onDOMScrollProgress";de.ON_DOM_SCROLL="onDOMScroll";de.ON_DOM_RESIZE="onDOMResize";de.ON_DOM_CONTRASCROLL_UP="onDOMContraScrollUp";de.ON_DOM_CONTRASCROLL_DOWN="onDOMContraScrollDown";de.ON_DOM_LOAD="load";de.ON_DOM_CONTENT_LOADED="DOMContentLoaded";de.ON_DOM_CLICK="click";de.ON_DOM_KEYUP="keyup";de.ON_DOM_KEYDOWN="keydown";de.ON_DOM_SUBMIT_FORM="submit";de.ON_DOM_SELECT_CHANGE="change";de.ON_DOM_SELECT_FOCUS="focus";de.ON_DOM_MOUSE_ENTER="mouseenter";de.ON_DOM_MOUSE_LEAVE="mouseleave";de.ON_DOM_MESSAGE="message";de.ON_DOM_SCROLL_GREATERTHAN="onDOMScrollGreaterThan";de.ON_DOM_SCROLL_LESSTHAN="onDOMScrollLessThan";window.jeef.events.DOMEvent=de});function ie(n,i,t,e){if(n){var r=e||this,a=function l(u){var c=new de,f;return c.type=i,c.target=u.srcElement||u.target,c.delegateTarget=n,c.currentTarget=u.currentTarget,c.native=u,c.innerHandler=l,c.nativeType=i,f=t.apply(e,[c]),f===!1&&(u.stopPropagation(),u.preventDefault()),f};if(n.addEventListener){var s=["mouseenter","mouseleave","mousedown","resize","orientationchange","scroll"],o=["touchstart","touchend","touchmove"];return s.indexOf(i)>-1?n.addEventListener(i,a,{passive:!0}):o.indexOf(i)>-1?n.addEventListener(i,a,{passive:!1}):n.addEventListener(i,a,!1),a}else n.listen&&n.listen(i,t,e)}else console.error("Se ha intentado escuchar eventos de un elemento no definido")}function ba(n,i,t,e){n.removeEventListener?n.removeEventListener(i,t):n.unlisten&&n.unlisten(i,t,e)}var ze=W(function(){T();Mr();Jt();ct("jeef.events");jeef.provide=ct;window.jeef.events.listen=ie;window.jeef.events.unlisten=ba});function IT(){return Oe.indexOf("Android")!==-1||Oe.indexOf("iPhone")!==-1||Oe.indexOf("iPod")!==-1||Oe.indexOf("iPad")!==-1||Oe.indexOf("IEMobile")!==-1||Oe.indexOf("BlackBerry")!==-1||Oe.indexOf("Opera Mini")!==-1}function dh(){return Oe.indexOf("Android")!==-1||Oe.indexOf("iPhone")!==-1||Oe.indexOf("IEMobile")!==-1||Oe.indexOf("BlackBerry")!==-1||Oe.indexOf("Opera Mini")!==-1}function CT(){var n=window.devicePixelRatio||1,i={width:window.screen.width*n,height:window.screen.height*n};return i.width===2048&&i.height===2732||i.width===2732&&i.height===2048}function LT(){var n=null;return dh()?n=Kr.MOBILE:CT()?n=Kr.IPADPRO:we.tablet?n=Kr.TABLET:n=Kr.DESKTOP,n}function RT(n){return n===Kr.MOBILE||n===Kr.TABLET||n===Kr.IPADPRO}function ka(){var n=window.navigator.userAgent,i=window.navigator.platform,t=["Macintosh","MacIntel","MacPPC","Mac68K"],e=["Win32","Win64","Windows","WinCE"],r=["iPhone","iPad","iPod"],a=null;return t.indexOf(i)!==-1?a="Mac OS":r.indexOf(i)!==-1?a="iOS":e.indexOf(i)!==-1?a="Windows":/Android/.test(n)?a="Android":!a&&/Linux/.test(i)&&(a="Linux"),a}function OT(){return(Fl||Nl)&&/CriOS/i.test(Oe)}var Oe,je,pT,mT,gT,yT,fh,_T,Nl,Fl,dN,ET,ST,TT,bT,kT,Dn,we,Mn,AT,Kr,Tt,Me,hh,Ul,hN,vh,pt=W(function(){T();Oe=navigator.userAgent,je=!0,pT=/msie/i.test(Oe),mT=/.NET/i.test(Oe),gT=/IEmobile/i.test(Oe),yT=/blackberry/i.test(Oe),fh=/chrome/i.test(Oe),_T=/safari/i.test(Oe)&&!fh,Nl=/iphone/i.test(Oe),Fl=/ipad/i.test(Oe),dN=/ipod/i.test(Oe),ET=/android/i.test(Oe),ST=/opera/i.test(Oe),TT=/firefox/i.test(Oe),bT=/gecko\//i.test(Oe),kT=/seamonkey\//i.test(Oe),Dn=/version\/(\d+(\.\d+)?)/i,AT=function(){return we={},mT&&(we={msie:je,version:11}),pT&&(we={msie:je,version:Oe.match(/msie (\d+(\.\d+)?);/i)[1]}),fh&&(we={webkit:je,chrome:je,version:Oe.match(/chrome\/(\d+(\.\d+)?)/i)[1]}),_T&&(Mn=Oe.match(Dn),Mn&&(we={webkit:je,safari:je,version:Mn[1]})),ST&&(Mn=Oe.match(Dn),Mn&&(we={opera:je,version:Mn[1]}),Oe.match(/Opera Mini/i)&&(we.mobile=je,we.smartphone=je)),bT&&(we={gecko:je,mozilla:je,version:Oe.match(/firefox\/(\d+(\.\d+)?)/i)[1]},TT&&(we.firefox=je),Oe.match(/Mobile/i)&&(we.mobile=je,we.smartphone=je),Oe.match(/Tablet/i)&&(we.tablet=je)),kT&&(we={seamonkey:je,version:Oe.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]}),yT&&(we.blackberry=je,we.mobile=je,we.smartphone=je),gT&&(we.msie=je,we.mobile=je,we.windowsphone=je,we.smartphone=je),Nl&&(we.webkit=je,we.mobile=je,we.ios=je,we.iphone=Nl,Dn.test(Oe)&&(we.version=Oe.match(Dn)[1],we.smartphone=je)),Fl&&(we.webkit=je,we.mobile=je,we.ios=je,we.ipad=Fl,we.tablet=je,Dn.test(Oe)&&(we.version=Oe.match(Dn)[1])),ET&&(we.webkit=je,we.android=je,we.version=Oe.match(/Android\s+([\d\.]+)/i)[1],we.mobile=je,Oe.match(/Mobile/i)?we.smartphone=je:we.tablet=je),we};Kr={MOBILE:"mobile",IPADPRO:"ipadPro",TABLET:"tablet",DESKTOP:"desktop"};Tt=AT(),Me=IT(),hh=dh(),Ul=LT(),hN=RT(Ul),vh=OT()});var Re,mt=W(function(){T();J();X();Ge();Re=function(){function n(){k(this,n),V(this,"_eventListeners",{})}return A(n,[{key:"listen",value:function(t,e,r){this._eventListeners[t]||(this._eventListeners[t]=[]),this._eventListeners[t].push({listener:e,scope:r})}},{key:"unlisten",value:function(t,e,r){var a=this._eventListeners[t];a&&(this._eventListeners[t]=a.filter(function(s){return s.listener!==e||s.scope!==r}))}},{key:"dispatchEvent",value:function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=this._eventListeners[t.type];if(r){t.target=t.target||this,t.currentTarget=this;for(var a=function(c){var f=r[c];return f.listener.apply(f.scope,[t])},s,o=function(){if(e){var c=l;setTimeout(function(){return a(c)},1)}else{var f=a(l);f===!1&&(s=!1)}},l=0;l<r.length;l++)o();return s}}}]),n}()});function PT(n,i,t){return i=w(i),q(n,gh()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function gh(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(gh=function(){return!!n})()}var hr,Fn=W(function(){T();X();J();ue();oe();le();sr();hr=function(n){B(i,n);function i(t){return k(this,i),PT(this,i,[t])}return A(i)}(Qe);hr.ON_TM_TIMER="timer";hr.ON_TM_COMPLETE="timerComplete"});function DT(n,i,t){return i=w(i),q(n,yh()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function yh(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(yh=function(){return!!n})()}var Pi,MT,Aa=W(function(){T();J();X();ue();oe();le();mt();Fn();Pi=function(n){B(i,n);function i(t,e){var r;return k(this,i),r=DT(this,i),r._intervalID=null,r._currentCount=0,r._delay=t!==void 0?t:1e3,r._repeatCount=e!==void 0?e:0,r._running=!1,r}return A(i,[{key:"delay",value:function(e){return e!==void 0&&e>0&&(this._delay=e),this._delay}},{key:"repeatCount",value:function(e){return e!==void 0&&e>0&&(this._repeatCount=e),this._repeatCount}},{key:"running",value:function(){return this._running}},{key:"start",value:function(){var e=this;this._running||(this._intervalID=setInterval(function(){MT.apply(e,[])},this._delay),this._running=!0)}},{key:"stop",value:function(){this._running&&(clearInterval(this._intervalID),this._running=!1)}},{key:"reset",value:function(){this.stop(),this._currentCount=0}}]),i}(Re),MT=function(){this._currentCount++,this.dispatchEvent(new hr(hr.ON_TM_TIMER)),this._repeatCount!==0&&this._repeatCount===this._currentCount&&(this.reset(),this.dispatchEvent(new hr(hr.ON_TM_COMPLETE)))}});function qT(n,i,t){return i=w(i),q(n,Eh()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function Eh(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Eh=function(){return!!n})()}var he,Ut=W(function(){T();X();J();ue();oe();le();sr();he=function(n){B(i,n);function i(t){var e;return k(this,i),e=qT(this,i,[t]),e.response=null,e.status=0,e.progress=0,e.status_number=0,e.id="",e}return A(i)}(Qe);he.ON_IO_TIMEOUT="onIOTimeout";he.ON_IO_STATUS_CHANGE="onIOStatusChange";he.ON_IO_ERROR="onIOError";he.ON_IO_PROGRESS="onIOProgress";he.ON_IO_FINISH="onIOFinish";he.ON_IO_QUEUE="onIOQueue"});function YT(n,i,t){return i=w(i),q(n,Th()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function Th(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Th=function(){return!!n})()}var Ke,bs,Sh,Xt=W(function(){T();J();X();ue();oe();le();mt();Ut();Ke=function(n){B(i,n);function i(){var t;return k(this,i),t=YT(this,i),t._max=0,t._pending=[],t._error=!1,t._first=!1,t._async=!0,t}return A(i,[{key:"load",value:function(e,r,a){if(this._max===0){this._async=r,this._first=a;var s=0,o;if(Array.isArray(e))if(this._max=e.length,r)for(;s<e.length;s++)bs.apply(this,[e[s]]);
1else this._pending=e,o=this._pending.shift(),bs.apply(this,[o]);else this._max=1,bs.apply(this,arguments);return!0}else return!1}}]),i}(Re),bs=function(i){var t=this,e=document.createElement("script"),r;this._async&&(e.async=!0),e.src=i,e.onerror=function(){t._error=!0,Sh.apply(t,[])},e.onreadystatechange=e.onload=function(){var a=e.readyState;(!a||/loaded|complete/.test(a))&&Sh.apply(t,[])},this._first?(r=document.getElementsByTagName("script")[0],r.parentNode.insertBefore(e,r)):document.head.appendChild(e)},Sh=function(){if(this._max--,this._max<=0)this._error?this.dispatchEvent(new he(he.ON_IO_ERROR)):this.dispatchEvent(new he(he.ON_IO_FINISH));else if(!this._async){var i=this._pending.shift();bs.apply(this,[i])}}});function zT(n,i,t){return i=w(i),q(n,bh()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function bh(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(bh=function(){return!!n})()}var ks,jl=W(function(){T();vt();J();X();ue();oe();le();mt();Ut();ks=function(n){B(i,n);function i(t,e,r){var a;return k(this,i),a=zT(this,i),a._timeOut=e,a._responseType=t,a._status=0,a._params="",a._id=r,a}return A(i,[{key:"getId",value:function(){return this._id}},{key:"_notifyOnTimeout",value:function(e){var r=new he(he.ON_IO_TIMEOUT);r.id=e,this.dispatchEvent(r)}},{key:"_notifyOnStatusChange",value:function(e,r){var a=new he(he.ON_IO_STATUS_CHANGE);a.status=e,a.id=r,this.dispatchEvent(a)}},{key:"_notifyOnError",value:function(e,r,a){var s=new he(he.ON_IO_ERROR);s.response=e,s.status_number=r,s.id=a,this.dispatchEvent(s)}},{key:"_notifyOnProgress",value:function(e,r){var a=new he(he.ON_IO_PROGRESS);a.progress=e,a.id=r,this.dispatchEvent(a)}},{key:"_processJSON",value:function(e){var r;if(typeof JSON!="undefined"&&typeof JSON.parse!="undefined")try{pe(e)==="object"?r=e:r=JSON.parse(e)}catch(a){}return r}},{key:"_notifyOnFinish",value:function(e,r,a){var s=new he(he.ON_IO_FINISH);s.response=e,s.status_number=r,s.id=a,this.dispatchEvent(s)}}]),i}(Re)});function JT(n,i,t){return i=w(i),q(n,kh()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function kh(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(kh=function(){return!!n})()}var Hl,XT,Ah=W(function(){T();J();X();ue();oe();Dr();le();jl();Jt();Bt();Hl=function(n){B(i,n);function i(){var t;k(this,i);for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];return t=JT(this,i,[].concat(r)),t._xmlhttp=null,t._disableAjaxRequestHeader=!1,XT.apply(qe(t)),t}return A(i,[{key:"setStatusDisableAjaxRequestHeader",value:function(e){return this._disableAjaxRequestHeader=e,this}},{key:"open",value:function(e,r,a,s){var o=Mt(r)?r:Wr.GET;s=Mt(s)?s:!0;var l=bt(a),u=e;r===Wr.GET&&l!==""&&(u=e+"?"+l),this._xmlhttp.open(o,u,s)}},{key:"send",value:function(e){this._disableAjaxRequestHeader||this._xmlhttp.setRequestHeader("X-Requested-With","XMLHttpRequest"),e=e||"",this._xmlhttp.send(e)}},{key:"abort",value:function(){this._xmlhttp&&this._xmlhttp.abort()}},{key:"setRequestHeader",value:function(e,r){this._xmlhttp&&this._xmlhttp.setRequestHeader(e,r)}},{key:"withCredentials",value:function(e){this._xmlhttp.withCredentials!=null&&(this._xmlhttp.withCredentials=e)}}]),i}(ks),XT=function(){var i=this;this._xmlhttp=new XMLHttpRequest,this._xmlhttp.timeout&&(this._xmlhttp.timeout=this._timeOut),this._xmlhttp.ontimeout=function(){i._notifyOnTimeout(i._id)},this._xmlhttp.onprogress=function(t){i._notifyOnProgress(t.loaded/t.total,i._id)},this._xmlhttp.onreadystatechange=function(){switch(this.readyState){case 0:i._notifyOnStatusChange(Zr.STOP,i._id);break;case 1:i._notifyOnStatusChange(Zr.CONNECTED,i._id);break;case 2:i._notifyOnStatusChange(Zr.REQUESTED,i._id);break;case 3:i._notifyOnStatusChange(Zr.PROCESING,i._id);break;case 4:if(i._notifyOnStatusChange(Zr.FINISHED,i._id),this.status===200)switch(i._responseType){case Qt.TEXT:i._notifyOnFinish(this.responseText,this.status,i._id);break;case Qt.JSON:var t;try{t=i._processJSON(this.responseText)}catch(r){i._notifyOnError(r.toString(),this.status,i._id);break}i._notifyOnFinish(t,this.status,i._id);break;case Qt.XML:i._notifyOnFinish(this.responseXML,this.status,i._id);break}else{var e;try{e=JSON.parse(this.responseText)}catch(r){e=this.responseText||"Error"}i._notifyOnError(e,this.status,i._id)}break}}}});function QT(n,i,t){return i=w(i),q(n,Ih()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function Ih(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Ih=function(){return!!n})()}var Ch,$T,Lh=W(function(){T();J();X();ue();oe();le();jl();Bt();Ch=function(n){B(i,n);function i(t,e,r){var a;return k(this,i),a=QT(this,i,[t,e,r]),a._script=null,a.JSONPCallback="jeef_net_IOMediator_jsonCallback_"+r,a.JSONParamName="jsonp",a}return A(i,[{key:"open",value:function(e,r,a,s){var o=this,l=e.indexOf("?")>-1?"&":"?",u=jeef.net.getParams(a),c=u===""?"":"&"+u;this._script=document.createElement("script"),this._script.setAttribute("type","text/javascript"),this._script.setAttribute("src",e+l+c+this.JSONParamName+"="+this.JSONPCallback),window[this.JSONPCallback]=function(f){$T.apply(o,arguments)}}},{key:"send",value:function(e){this._notifyOnStatusChange(Zr.REQUESTED,this._id),document.getElementsByTagName("head")[0].appendChild(this._script)}}]),i}(ks),$T=function(i){this._notifyOnStatusChange(Zr.PROCESING,this._id),this._notifyOnStatusChange(Zr.FINISHED,this._id),this._notifyOnFinish(this._processJSON(i),void 0,this._id)}});function Nr(n,i,t){var e,r="create_"+eb();switch(n=n||Qt.JSON,i=i||ei.DISABLED,t=t||0,i){case ei.CORS:var a=new XMLHttpRequest;if("withCredentials"in a)e=new Hl(n,t,r),e.withCredentials(!0);else throw Error("jeef.net.getIOObj>> Navegador no soportado para peticiones CORS");break;case ei.JSONP:e=new Ch(n,t,r);break;case ei.DISABLED:e=new Hl(n,t,r);break}return e}function eb(){return ZT++}function bt(n){var i="",t=0,e=Mt(n)?Object.keys(n):"";if(pe(n)=="object")for(t;t<e.length;t++)t!=0&&(i+="&"),i+=e[t]+"="+encodeURIComponent(n[e[t]]).replace(/\-/g,"%2D").replace(/\_/g,"%5F").replace(/\./g,"%2E").replace(/\!/g,"%21").replace(/\~/g,"%7E").replace(/\*/g,"%2A").replace(/\'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29");else typeof n=="string"&&(i=n);return i}function Rh(i){var i=i||decodeURIComponent(window.location.href),t=i.indexOf("?"),e=t!=-1?i.substr(t+1,i.length):"",r=e.split("&"),a=[],s={},o=0;if(e!="")for(o;o<r.length;o++)a=r[o].split("="),s[a[0]]=a[1];return s}function Vl(n,i){var t=document.styleSheets,e,r=t.length,a=!1,s,o,l;for(e=0;e<r&&!a;e++)t[e].href&&t[e].href.indexOf(n)!=-1&&(a=!0);return a?!1:(s=document.createElement("link"),s.rel="stylesheet",s.href=n,i&&(s.id=i),document.getElementsByTagName("head")[0].appendChild(s),!0)}var ZT,Qt,Zr,Wr,ei,Bt=W(function(){T();vt();Jt();Ah();Lh();ZT=0,Qt={TEXT:"text",XML:"xml",JSON:"json"},Zr={STOP:0,CONNECTED:1,REQUESTED:2,PROCESING:3,FINISHED:4}
1,Wr={GET:"get",POST:"post",DELETE:"delete",PUT:"put"},ei={CORS:"cors",JSONP:"jsonp",DISABLED:""}});var Ae,De,Q,As,ib,Kl,$e=W(function(){T();J();X();Ge();Jt();ct("jeeiSite.dyn.info");Ae={},De=null,Q=function(){function n(){k(this,n)}return A(n,null,[{key:"add",value:function(t){var e=0,r=0,a;for(e;e<t.length;e++)if(a=t[e],Ae[a.id])for(r in a.data)Ae[a.id][r]=a.data[r];else Ae[a.id]=a.data}},{key:"setMainId",value:function(t){De=t}},{key:"get",value:function(t){return Ae[t]}},{key:"getMainId",value:function(){return De}},{key:"getMain",value:function(){return Ae[De]}},{key:"getSections",value:function(){return ib()}},{key:"getSection",value:function(){return Kl(0)}},{key:"getSubSection",value:function(){return Kl(1)}},{key:"getSectionId",value:function(){return As(0,"id")}},{key:"getSectionName",value:function(){return As(0,"name")}},{key:"getTags",value:function(){var t=n.getMain().hashtags;return t?t.split(","):[]}},{key:"getSubSectionId",value:function(){return As(1,"id")}},{key:"getSubSectionName",value:function(){return As(1,"name")}},{key:"getProductionSection",value:function(){var t;return Ae[De].productionSection&&(t=Ae[De].productionSection),t}},{key:"getContentType",value:function(){var t;return Ae[De].contentType&&(t=Ae[De].contentType),t}},{key:"getType",value:function(){var t;return Ae[De].type&&(t=Ae[De].type),t}},{key:"getOpeningStructure",value:function(){var t;return Ae[De].espOpeningType&&(t=Ae[De].espOpeningType),t}},{key:"isCommentable",value:function(){var t,e;return(t=(e=Ae[De])===null||e===void 0?void 0:e.commentable)!==null&&t!==void 0?t:!1}},{key:"getTitle",value:function(){var t;return Ae[De].title&&(t=Ae[De].title),t}},{key:"getAuthor",value:function(){var t;return Ae[De].author&&(t=Ae[De].author),t}},{key:"getStickyId",value:function(){var t;return Ae[De].stickyId&&(t=Ae[De].stickyId),t}},{key:"getFilterContentHashTag",value:function(){var t=[];return Ae[De].filtercontenthashtag&&(t=Ae[De].filtercontenthashtag),t}},{key:"getSlugHashTags",value:function(){var t=[];return Ae[De].slugHashTags&&(t=Ae[De].slugHashTags.split(",")),t}},{key:"isSuscriberContent",value:function(){return Ae[De].isSuscriberContent===!0}},{key:"hasRating",value:function(){return Ae[De].rating===!0}},{key:"getAudioPlayerStatus",value:function(){return!(!Ae[De].audioPlayer||Ae[De].audioPlayer.status!=="on")}},{key:"getAudioPlayerScope",value:function(){return!Ae[De].audioPlayer||Ae[De].audioPlayer.status!=="on"?!1:Ae[De].isSuscriberContent===!0?"suscriptor":Ae[De].audioPlayer.scope}},{key:"getMetricsData",value:function(t){var e,r;return(Ae==null||(e=Ae[De])===null||e===void 0||(e=e.metrics)===null||e===void 0?void 0:e[t])||(Ae==null||(r=Ae[De])===null||r===void 0?void 0:r.metrics)}}]),n}();V(Q,"getXVersion",function(){return Ae[De].xVersion?Ae[De].xVersion:!1});As=function(i,t){var e=Kl(i);return e?e[t]:null},ib=function(){var i=[];return Ae[De]&&Ae[De].section&&(i=Ae[De].section),i},Kl=function(i){var t;return Ae[De]&&Ae[De].section[i]&&(t=Ae[De].section[i]),t};window.jeeiSite.dyn.info=Q});function nb(n,i,t){return i=w(i),q(n,xh()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function xh(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(xh=function(){return!!n})()}var xe,pi=W(function(){T();X();J();ue();oe();le();Ge();sr();xe=function(n){B(i,n);function i(t){var e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return k(this,i),e=nb(this,i,[t]),e.origin="",e.data=r,e}return A(i)}(Qe);V(xe,"ON_LAYOUT_REFRESH","onLayoutRefresh");V(xe,"ON_USER_SYNC_LAYOUT_FINISH","onUserSyncLayoutFinish");V(xe,"ON_USERRQ_WAITING","onUserRqWaiting");V(xe,"ON_USERRQ_FINISH","onUserRqFinish");V(xe,"ON_LOGIN","onLogin");V(xe,"ON_USER_PURCHASE_REFRESH","onUserPurchaseRefresh");V(xe,"ON_TRACKING_EVENTS","events")});function ab(n,i,t){return i=w(i),q(n,Ph()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function Ph(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Ph=function(){return!!n})()}var me,Un=W(function(){T();X();J();ue();oe();le();Ge();sr();me=function(n){B(i,n);function i(t,e){var r;return k(this,i),r=ab(this,i,[t]),r.data=e,r}return A(i)}(Qe);V(me,"ON_TRIGGER_SDK_LOADED","onTriggerPianoSdkLoaded");V(me,"ON_TRIGGER_ERROR_SDK_LOADED","onTriggerErrorPianoSdkLoaded");V(me,"ON_LOGGIN_SUCCESS","onLoginSuccess");V(me,"ON_LOGOUT_SUCCESS","onLogoutSuccess");V(me,"ON_REGISTER_SUCCESS","onRegisterSuccess");V(me,"ON_CHECKOUT_COMPLETE","onCheckoutComplete");V(me,"ON_EXTERNAL_CHECKOUT_COMPLETE","onExternalCheckoutComplete");V(me,"ON_LOGOUT_TRIGGER","onLogoutTrigger");V(me,"ON_LOGOUT_TRIGGER_PAYWALL","onLogoutTriggerPaywall");V(me,"ON_ACCEPT_COOKIES_TRIGGER_COOKIEWALL","onAcceptCookiesTriggerCookiewall");V(me,"ON_LAYOUT_REFRESH","onLayoutRefresh");V(me,"ON_PROFILE_UPDATE","onProfileUpdate");V(me,"ON_CHECKOUTSTART_PROMOTION","onCheckOutStartPromotion");V(me,"ON_STARTCHECKOUT_LOGIN_SUCCESS","onCheckOutStartLoginSuccess");V(me,"ON_CHECKOUT_CUSTOM_EVENT","onCheckOutCustomEvent")});
1function sb(n,i){var t=typeof Symbol!="undefined"&&n[Symbol.iterator]||n["@@iterator"];if(!t){if(Array.isArray(n)||(t=ob(n))||i&&n&&typeof n.length=="number"){t&&(n=t);var e=0,r=function(){};return{s:r,n:function(){return e>=n.length?{done:!0}:{done:!1,value:n[e++]}},e:function(u){throw u},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){t=t.call(n)},n:function(){var u=t.next();return s=u.done,u},e:function(u){o=!0,a=u},f:function(){try{s||t.return==null||t.return()}finally{if(o)throw a}}}}function ob(n,i){if(n){if(typeof n=="string")return Dh(n,i);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Dh(n,i):void 0}}function Dh(n,i){(i==null||i>n.length)&&(i=n.length);for(var t=0,e=Array(i);t<i;t++)e[t]=n[t];return e}function Mh(){try{return window.self!==window.top}catch(n){return!0}}function Is(n,i,t,e){if(e){var r=document.createElement("span");r.innerHTML=i,n.appendChild(r)}else t&&(n.innerHTML=n.innerHTML+i);t||(n.innerHTML=i);var a,s,o=0,l;for(a=document.createElement("div"),a.innerHTML=i,s=a.getElementsByTagName("script"),o;o<s.length;o++)l=document.createElement("script"),l.innerHTML=s[o].innerHTML,s[o].getAttribute("src")!==null&&l.setAttribute("src",s[o].getAttribute("src")),document.body.appendChild(l)}function Nh(n){for(var i=n.split(" "),t=!1,e=0;e<i.length;e++)document.createElement("div").style[i[e]]!==void 0&&(t=!0);return t}function Cs(n,i,t){var e=n.getBoundingClientRect(),r=t?e.top:e.bottom;return i=i||0,r+i>0&&e.right>0&&e.left<=(window.innerWidth||document.documentElement.clientWidth)&&e.top-i<(window.innerHeight||document.documentElement.clientHeight)}function Fh(n,i){return n===window||n===document?fb():i.scrollTop/(i.scrollHeight-i.offsetHeight)}function Uh(n,i){return n===window||n===document?window.document.documentElement.offsetWidth+window.document.documentElement.scrollLeft===window.document.documentElement.scrollWidth:i.offsetWidth+i.scrollLeft===i.scrollWidth}function lb(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0}function ub(){return Math.max(document.body.scrollHeight||0,document.documentElement.scrollHeight||0,document.body.offsetHeight||0,document.documentElement.offsetHeight||0,document.body.clientHeight||0,document.documentElement.clientHeight||0)}function cb(){return window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop||0}function Bh(n,i){var t=document.createElement(i),e=sb(n.attributes),r;try{for(e.s();!(r=e.n()).done;){var a=r.value;t.setAttribute(a.name,a.value)}}catch(s){e.e(s)}finally{e.f()}for(;n.firstChild;)t.appendChild(n.firstChild);return n.parentNode.replaceChild(t,n),t}var fb,mi=W(function(){T();fb=function(){return cb()/(ub()-lb())}});var be,ti=W(function(){T();be={ON_SORTINGHAT_CODE_103:"ON_SORTINGHAT_CODE_103",ON_SORTINGHAT_CODE_104:"ON_SORTINGHAT_CODE_104",ON_USER_SYNC_LAYOUT_FINISH:"ON_USER_SYNC_LAYOUT_FINISH",ON_DOM_AND_USER_READY:"ON_DOM_AND_USER_READY",ON_SAVE_USER_FOLLOW_STORY_TAG_OK:"ON_SAVE_USER_FOLLOW_STORY_TAG_OK",ON_SAVE_USER_FOLLOW_STORY_TAG_NOK:"ON_SAVE_USER_FOLLOW_STORY_TAG_NOK",ON_CLICK_ELEMENT_FOLLOW_CONTENT:"ON_CLICK_ELEMENT_FOLLOW_CONTENT",ON_CHANGE_BRAND_OK:"ON_CHANGE_BRAND_OK",ON_CHANGE_BRAND_KO:"ON_CHANGE_BRAND_KO",ON_MAIN_DATA_LOADED:"ON_MAIN_DATA_LOADED",ON_DOM_CLICK:"click",ON_PIANO_SHOW_OFFER:"ON_PIANO_SHOW_OFFER",ON_FBODY_CHANGE:"ON_FBODY_CHANGE",ON_LOAD_INITIAL_DATA_SURVEY:"ON_LOAD_INITIAL_DATA_SURVEY",ON_LOAD_INITIAL_DATA_SURVEY_ERROR:"ON_LOAD_INITIAL_DATA_SURVEY_ERROR",ON_LOAD_USER_INITIAL_DATA_SURVEY:"ON_USER_LOAD_INITIAL_DATA_SURVEY",ON_LOAD_USER_INITIAL_DATA_SURVEY_ERROR:"ON_USER_LOAD_INITIAL_DATA_SURVEY_ERROR",ON_LOAD_USER_SEND_DATA_SURVEY:"ON_USER_LOAD_SEND_DATA_SURVEY",ON_LOAD_USER_SEND_DATA_SURVEY_ERROR:"ON_USER_LOAD_SEND_DATA_SURVEY_ERROR"}});var Wl,ql,db,hb,vb,pb,Gh=W(function(){T();J();X();mr();Wl=function(){function n(){k(this,n)}return A(n,null,[{key:"set",value:function(t,e,r){pb(t,e,r)}},{key:"get",value:function(t,e){var r=e||window.location.host,a=hb(t)||dr(t)||wi(t);return a}},{key:"clear",value:function(t,e){ah(t),On(t,e),vb(t)}}]),n}(),ql={},db=function(i,t){ql[i]=t},hb=function(i){return ql[i]},vb=function(i){delete ql[i]},pb=function(i,t,e){xi(i,t),Vr(i,t,30,e),db(i,t)}});function jh(n,i){var t=mb(i,n);return t[0].getMonth()-t[1].getMonth()+12*(t[0].getFullYear()-t[1].getFullYear())}function Hh(n,i){var t=new Date(n).getTime(),e=i?Date.now():new Date(i).getTime(),r=t-e;if(r<0||isNaN(r))throw Error("Los milisegundos no puede ser un valor negativo o no es un valor v\xE1lido:"+r);return gb(r)}var mb,gb,Ls,Yl=W(function(){T();mb=function(i,t){var e=i?new Date(i*1e3):new Date,r=new Date(t*1e3);return[e,r]},gb=function(i){var t=Math.floor(i/864e5),e=i%(24*60*60*1e3),r=Math.floor(e/(60*60*1e3)),a=i%(60*60*1e3),s=Math.floor(a/(60*1e3)),o=i%(60*1e3),l=Math.floor(o/1e3);return{days:Ls(t),hours:Ls(r),minutes:Ls(s),seconds:Ls(l)}},Ls=function(i){return i<10?"0"+i:i}});var zl,on,Ia,Jl=W(function(){T();J();X();_e();Se();Gh();
1$e();dt();mr();Yl();Rs();zl=null,on="PaywallGEA";ne("PaywallGEA");Ia=function(){function n(){k(this,n),this._instance=null,this._spells={},this.maxViews=I.geaConfig.paywall.maxViews,this._contentWeb=null,this.modalType=null,this.offerInnerHTML=null,this._nameHorrocruxe=null,this._user=se.getInstance(),this._init()}return A(n,[{key:"_init",value:function(){P(["jeeiSite.hp.PaywallGEA>init>","Inicializamos el PaywallGEA"],on),this.isOkDomains&&(this._nameHorrocruxe=I.geaConfig.paywall.name,this.modalType=I.geaConfig.paywall.type,this.offerInnerHTML=I.geaConfig.paywall.innerHTML,!I.geaConfig.paywall.disabled&&!gi.isArticleFree()?(this._checkSpells(),this._user.isSubscriber()||this._user.isSubscriberEE()||(this.isMaxViews()?this.showPaywall():this.processSpell())):I.geaConfig.paywall.disabled&&!gi.isArticleFree()&&(this._user._roles[I.geaConfig.subscriptionCookieName]||this.showPaywall(window.location.href)))}},{key:"isOkDomains",value:function(){return!!window.location.host.match(/(www)\.elespanol\./)}},{key:"processSpell",value:function(){if(dr("_pc_test_piano")!=="1"&&this.isOkDomains){P(["jeeiSite.hp.Azkaban>processSpell>","Realizando comprobaci\xF3n del Azkaban en el spell "],on);var t=this._learnSpell();this._onFawKes(),this._user.isSubscriber()||this._user.isSubscriberEE()||this._addSpell(t)}}},{key:"showPaywall",value:function(t){var e=t||I.user.userRoutes.home;this.modalType=="footer"?this.showFooterPaywall(e):this.modalType=="modal"&&this.showModalPaywall(e)}},{key:"showFooterPaywall",value:function(t){var e=document.querySelector(".msg-footer"),r=window,a=document,s=a.documentElement,o=a.getElementsByTagName("body")[0],l=r.innerWidth||s.clientWidth||o.clientWidth;e.innerHTML=this.offerInnerHTML.replaceAll("${window_width}",l).replaceAll("${callBack}",t);var u=document.getElementsByClassName("main-story");u[0].classList.add("inline-hidden")}},{key:"showModalPaywall",value:function(t){var e=document.createElement("div");e.classList.add("tp-modal"),e.style.zIndex="300050",e.style.display="block";var r=window,a=document,s=a.documentElement,o=a.getElementsByTagName("body")[0],l=r.innerWidth||s.clientWidth||o.clientWidth;e.innerHTML=this.offerInnerHTML.replaceAll("${window_width}",l).replaceAll("${callBack}",t),document.body.appendChild(e)}},{key:"unlockPaywall",value:function(){this.modalType=="footer"?this.unlockFooterPaywall():this.modalType=="modal"&&this.unlockModalPaywall()}},{key:"unlockModalPaywall",value:function(){var t=document.querySelector(".msg-footer");t.innerHTML="";var e=document.getElementsByClassName("main-story");e[0].classList.remove("inline-hidden")}},{key:"unlockFooterPaywall",value:function(){var t=document.querySelector(".msg-footer");t.innerHTML="";var e=document.getElementsByClassName("main-story");e[0].classList.remove("inline-hidden")}},{key:"_onFawKes",value:function(){var t=Math.floor(Date.now()/1e3);this._spells.fawkes||(this._spells.fawkes=t),jh(this._spells.fawkes)>0&&(this._spells={histories:[]},this._spells.fawkes=t,this._showModal=!1)}},{key:"isMaxViews",value:function(){return this._spells.histories.length>=this.maxViews}},{key:"_checkSpells",value:function(){P(["jeeiSite.hp.AzkabanMixin>_checkSpells>","Obteniendo del horrocruxe las noticias .."],on),this._spells=Wl.get(this._nameHorrocruxe,I.subDomain);try{this._spells=JSON.parse(window.atob(this._spells))}catch(t){this._spells={histories:[]}}P(["jeeiSite.hp.AzkabanMIxin>_checkSpells>","Noticias obtenidas: "+this._spells],on)}},{key:"_findSpell",value:function(t){P(["jeeiSite.hp.Azkaban>_findHistory>","Realizando b\xFAsqueda de historia en horrocruxes..."],on);var e=0,r=!1;for(e;e<this._spells.histories.length;e++)t.id===this._spells.histories[e].id&&(r=!0,P(["jeeiSite.hp.Azkaban>_findHistory>","Ya existe el spell en horrocruxe",t.ts,this._spells.histories[e].ts],on));return r}},{key:"_addSpell",value:function(t){this._findSpell(t)||this._spells.histories.push({id:t.id}),Wl.set(this._nameHorrocruxe,window.btoa(JSON.stringify(this._spells)),I.subDomain)}},{key:"_learnSpell",value:function(){return P(["jeeiSite.hp.Azkaban>_learnSpell>","Obteniendo spell de la historia..."],on),{ts:parseInt(Q.getMain().publish_ts),id:Q.getMainId()}}}],[{key:"getInstance",value:function(){return zl||(zl=new n),zl}}]),n}()});var Mi,Ca=W(function(){T();dt();ft();Mi=function(){var i=document.getElementById("fbody");if(i){var t=se.getInstance();Sa(i,t.getRole());var e=t.isSubscriberForSiteURL()?"SUS":t.isAnonymous()?"ANON":"REG";i.setAttribute("data-user-role",e);var r=t.getInitials();r&&r!=="--"&&(i.setAttribute("data-user-initials","true"),i.style.setProperty("--user-initials","'".concat(r,"'")))}}});var Ql,yb,Ni,Xl,Vh,Kh,Fi,gi,Rs=W(function(){T();wr();J();X();Ql=fr(xr(),1);_e();Xt();Ut();ze();Se();dt();Jl();Ca();yi();
1$e();yb="767219290479-km007m94ujb1ihr2o0jcgjfemll7mbsh.apps.googleusercontent.com",Ni={SUBSCRIBER:"SUBSCRIBER",METERING:"METERING"};window.SWG=[];Vh=[],Kh=!1;ne("EA");Fi="EA",gi=function(){function n(){var i=this;k(this,n),this.userStatePiano=null,this.userState=null,this.contentStatus=null,this.user=se.getInstance(),this.product=null,this.paywallGEA=Ia.getInstance(),this.publicationId=null,this.name=null,this.resolveCheckEntitlementsPublisher=null,this.rejectCheckEntitlementsPublisher=null,this.checkEntitlementsPublisher=function(){return new Promise(function(t,e){i.resolveCheckEntitlementsPublisher=t,i.rejectCheckEntitlementsPublisher=e})}()}return A(n,[{key:"init",value:function(){this.publicationId=I.geaConfig.publicationId,this.product="basic",this.name=I.geaConfig.name,this.injectMarktup(),this.injectJss(),this.overWritePianoUser()}},{key:"overWritePianoUser",value:function(){I.geaConfig.paywall.disabled?this.userStatePiano={granted:n.isArticleFree(),grantedReason:this.user.isSubscriberForSiteURL()?Ni.SUBSCRIBER:n.isArticleFree()?null:Ni.METERING}:this.userStatePiano={granted:!this.paywallGEA.isMaxViews(),grantedReason:this.user.isSubscriberForSiteURL()?Ni.SUBSCRIBER:this.paywallGEA.isMaxViews()?null:Ni.METERING},this.contentStatus={type:"dynamicPaywall"},this.resolveCheckEntitlementsPublisher()}},{key:"injectJss",value:function(){var t=document.createElement("script");t.src="https://news.google.com/swg/js/v1/swg.js",t.async=!0,t.setAttribute("subscriptions-control","manual"),document.head.appendChild(t);var e=document.createElement("script");e.src="https://news.google.com/swg/js/v1/swg-gaa.js",e.async=!0,document.head.appendChild(e);var r=new Ke;r.load("https://accounts.google.com/gsi/client",!0,!0),ie(r,he.ON_IO_FINISH,this._onLoadGEA,this)}},{key:"injectMarktup",value:function(){var t='{\n "@context": "http://schema.org",\n "@type": "CreativeWork",\n "isAccessibleForFree": '.concat(n.isArticleFree()?"true":"false",',\n "isPartOf": {\n "@type": ["CreativeWork", "Product"],\n "name" : "').concat(this.name,'",\n "productID": "').concat(this.publicationId+":"+this.product,'"\n }\n }'),e=document.createElement("script");e.innerHTML=t,e.type="application/ld+json",document.head.appendChild(e)}},{key:"_onLoadGEA",value:function(){var t=this,e=["elespanol.com","seguro.elespanol.com","www.elespanol.com"];(self.SWG=self.SWG||[]).push(function(r){var a=new Promise(function(l){GaaMetering.getGaaUserPromise().then(function(){var u=ut(Ql.default.mark(function c(f){var d,h,v,m;return Ql.default.wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return d={"X-Requested-With":"XMLHttpRequest"},h={google_credential:f.credential},g.next=3,fetch(I.user.userRoutes.gotGae,{method:"POST",body:JSON.stringify(h),credentials:"include",headers:d});case 3:return v=g.sent,g.next=6,v.json();case 6:m=g.sent;try{m.success===!0&&(t.user.refreshUser(),Mi())}catch(E){}l(t.getUserState());case 9:case"end":return g.stop()}},c)}));return function(c){return u.apply(this,arguments)}}())}),s=new Promise(function(l){GaaMetering.getLoginPromise().then(function(){window.location.href="".concat(I.user.userRoutes.loginPage,"?callback=").concat(encodeURIComponent(window.location.href))})}),o=new Promise(function(l){l(t.getUserState())});GaaMetering.init({googleApiClientId:yb,allowedReferrers:e,userState:t.getUserState(),unlockArticle:function(){return t.unlockArticle()},showPaywall:function(){return t.showPaywall()},registerUserPromise:a,handleLoginPromise:s,publisherEntitlementPromise:o,handleSwGEntitlement:function(){return t.handleSwGEntitlement()}})}),Kh=!0,Vh.forEach(function(r){r()})}},{key:"handleSwGEntitlement",value:function(){ht.getInstance().load(!0),P(["jeeiSite.hp.GoogleEA.handleSwGEntitlement> Llamada a window.tp.swg.__protected__.initSwgFlow."],Fi)}},{key:"anonymousUserHasAccess",value:function(){return this.userStatePiano.granted===!0&&this.userStatePiano.grantReason===Ni.METERING}},{key:"showPaywall",value:function(t){this.paywallGEA.showPaywall(t),P(["jeeiSite.hp.GoogleEA.showPaywall> Mostramos nuestro muro (Piano)"],Fi)}},{key:"unlockArticle",value:function(){this.paywallGEA.unlockPaywall(),P(["jeeiSite.hp.GoogleEA.unlockArticle> Desbloqueamos el articulo"],Fi)}},{key:"getUserState",value:function(){var t={};if(t.granted=!1,this.user.isAnonymous())t.granted=this.userStatePiano.granted,t.granted&&(t.grantReason=Ni.METERING);else if(this.user.isRegisteredEE()&&(t.id=this.user.getUid(),t.granted=this.userStatePiano.granted,t.grantReason=Ni.METERING,t.registrationTimestamp=this.user._roles.reg.ts,this.user.isSubscriberForSiteURL())){var e;t.granted=!0,t.grantReason=Ni.SUBSCRIBER,t.subscriptionTimestamp=(e=this.user._roles[I.geaConfig.subscriptionCookieName])===null||e===void 0?void 0:e.ts}return this.userState=t,P(["jeeiSite.hp.GoogleEA.getUserState> UserState",t],Fi),this.userState}},{key:"setRunJSFromPiano",value:function(t){}}
1],[{key:"getInstance",value:function(){return Xl||(Xl=new n),Xl}},{key:"isArticleFree",value:function(){return I.geaConfig.paywall.disabled?!Q.isSuscriberContent():I.geaConfig.paywall.sectionsFree.length>0&&!!window.location.href.match(new RegExp("/(".concat(I.geaConfig.paywall.sectionsFree.join("|"),")/")))}},{key:"getQueryParams",value:function(){var t={};return location.search.substring(1).split("&").forEach(function(e){var r=e.split("=");t[r[0]]=r[1]}),t}},{key:"isGaa",value:function(){var t=n.getQueryParams();return t.gaa_at?t.gaa_at==="na"?(Dt(["jeeiSite.hp.GoogleEA.isGaa> SwG Entitlements: The `gaa_n` URL param is set to `na`, the user should not get Extended Access."],Fi),!1):t.gaa_n?t.gaa_sig?t.gaa_ts?!0:(Dt(["jeeiSite.hp.GoogleEA.isGaa>SwG Entitlements: The `gaa_ts` URL param is missing.'"],Fi),!1):(Dt(["jeeiSite.hp.GoogleEA.isGaa>SwG Entitlements: The `gaa_sig` URL param is missing.'"],Fi),!1):(Dt(["jeeiSite.hp.GoogleEA.isGaa> SwG Entitlements: The `gaa_n` URL param is missing.'"],Fi),!1):!1}},{key:"isGNews",value:function(){return window.location.href.match(/\/suscripciones/)?!1:(document.referrer.match(/news.google.com/)||navigator.userAgent.match(/GNews/))&&!window.location.host.match(/(seguro)\.elespanol\./)}},{key:"onLoadGEA",value:function(t){Kh?t():Vh.push(t)}}]),n}()});function _b(n,i,t){return i=w(i),q(n,Wh()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function Wh(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Wh=function(){return!!n})()}var it,Os=W(function(){T();X();J();ue();oe();le();Ge();sr();it=function(n){B(i,n);function i(){k(this,i);for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return _b(this,i,[].concat(e))}return A(i)}(Qe);V(it,"DIDOMY_LIBRARY_LOADED","onLoadedDidomiLibrary");V(it,"USER_AGREE_TO_ALL","onUserDidomiAgreeToAll");V(it,"USER_DISAGREE_TO_SOMETHING","onUserDidomiDisagreeToSomething");V(it,"USER_CMP_RESOLVED","onUserDidomiResolved");V(it,"PIANO_LOAD","onDidomiPianoLoad");V(it,"INDIGITALL_LOAD","onDidomiIndigitallLoad");V(it,"GPT_INIT","onDidomiGptInit");V(it,"AD_DISABLE","onDidomiAdDisable")});var $l,Zl,eu=W(function(){T();$l=function(){var i,t;window.tp||(window.tp=[]);var e=!1,r=[],a=[];try{r=JSON.parse('["cookies", "select_personalized_ads", "measure_ad_performance"]'),a=JSON.parse('["google"]')}catch(l){}var s=((i=window.Didomi)===null||i===void 0||(i=i.getUserConsentStatusForAll())===null||i===void 0||(i=i.purposes)===null||i===void 0?void 0:i.enabled)||[],o=((t=window.Didomi)===null||t===void 0||(t=t.getUserConsentStatusForAll())===null||t===void 0||(t=t.vendors)===null||t===void 0?void 0:t.enabled)||[];return(!r.every(function(l){return s.includes(l)})||!a.every(function(l){return o.includes(l)}))&&(e=!0),e},Zl=function(){window.tp||(window.tp=[]),window.tp.push(["setCustomVariable","CookiesRejected",$l()])}});function Eb(n,i,t){return i=w(i),q(n,qh()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function qh(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(qh=function(){return!!n})()}var qr,Yh=W(function(){T();X();J();ue();oe();le();Ge();sr();qr=function(n){B(i,n);function i(){var t;k(this,i);for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];return t=Eb(this,i,[].concat(r)),t.value=!1,t.tags=[],t}return A(i)}(Qe);V(qr,"ON_NAVIGATION_COMMENT_BUTTON_CLICK","onNavigationCommentButtonClick");V(qr,"ON_STOP_MEDIA_REQUEST","onStopMediaRequest");V(qr,"ON_SHARE_REQUEST","onShareRequest");V(qr,"ON_HISTORY_FOCUS","onHistoryFocus");V(qr,"ON_NOTIFICATION_TAGS","onNotificationTags");V(qr,"ON_TEXTSIZE_REQ","onTextSizeReq");V(qr,"ON_SORTING_HAT","onSortingHat");V(qr,"ON_METADA_NOTIFICATION","onMetaDataNotification")});function Sb(n,i,t){return i=w(i),q(n,zh()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function zh(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(zh=function(){return!!n})()}var ws,tu,ru,iu,La,Ui,Jh=W(function(){T();J();X();ue();oe();le();Se();Jt();Bt();mt();Yh();$e();yi();dt();_e();ws="INTERFACE";ne(ws);tu=null,ru=!1,iu=[],La=function(n){B(i,n);function i(){return k(this,i),Sb(this,i,arguments)}return A(i,[{key:"onNavigationCommentButtonClick",value:function(){this.dispatchEvent(new qr(qr.ON_NAVIGATION_COMMENT_BUTTON_CLICK))}}],[{key:"getInstance",value:function(){return tu||(tu=new i),tu}},{key:"share",value:function(e,r,a,s){Ui("shareContent",{url:e,via:a,title:r,social:s},!0)}},{key:"sendPianoMetadata",value:function(){var e=Q.getMain(),r=Q.getTags(),a=Q.getSlugHashTags(),s=Q.getSection().name||"",o=JSON.stringify(Q.getSections())||"",l=e.author||"",u=e.publish_ts||"",c=e.contentType||"",f=ht.getInstance(),d=ht.prepareHashTags2Piano(r,a),h=Q.isSuscriberContent(),v=Q.getMainId(),m=Q.isCommentable(),p=Q.getTitle(),g=[];for(var E in d)d[E]!=="/contenido-suscriptor/"?g.push(d[E]):d[E]==="/contenido-suscriptor/"&&g.push("contenido_cerrado");Ui("metaData",{id:v,title:p,setContentSection:s,sections:o,setTags:g,setZone:f.getZone(),role:se.getInstance().getRole(),
1ContentType:c,setContentCreated:new Date(u*1e3).toISOString(),setContentIsNative:!1,setContentAuthor:l,setUsePianoIdUserProvider:!0,setSubscriberContent:h,isCommentable:m},!0)}},{key:"doLogout",value:function(){Ui("logout")}},{key:"doLogin",value:function(){Ui("login")}},{key:"openNews",value:function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"default";console.log("----openNews----",e,r,a),Ui("showNewsDetail",{ext:r,url:e,urlTo:a},!0)}},{key:"savePromotion",value:function(e,r,a){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;console.log("----savePromotion----",e,r);try{window.ReactNativeWebView.postMessage("button_participation='".concat(a,"'"))}catch(o){console.log("*** ERROR: no tenemos el window.ReactNativeWebView")}Ui("savePromotion",{promotionId:e,userRole:r,attributes:a,url:s},!0)}},{key:"initComplete",value:function(){Ui("initComplete",{})}},{key:"openDidomi",value:function(){Ui("openDidomi",{})}},{key:"onNavigationCommentButtonClick",value:function(){i.getInstance().onNavigationCommentButtonClick()}}]),i}(Re),Ui=function n(i,t,e){var r,a=arguments,s,o;I.app.disableInterface||(ru?(P(["_call>_call> Se encola petici\xF3n",a,Date.now()],ws),iu.push(arguments)):(ru=!0,P(["_call>_call> Se inicia llamada",a,Date.now()],ws),s=document.createElement("IFRAME"),o="elespannolApp://"+i+"/"+bt(t),e&&(o="elespannolApp://"+i+"/"+bt(t)+"&urlEncode="+encodeURIComponent(t.url)),s.setAttribute("src",o),document.documentElement.appendChild(s),s.parentNode.removeChild(s),s=null,r=function(){P(["call>call> Termina petici\xF3n",a,Date.now()],ws),ru=!1,iu.length>0&&n.apply(void 0,iu.shift())},setTimeout(r,6/1e3)))};ct("jeeiSite.app.link");window.jeeiSite.app.link=La});function xs(){var n,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"es",t=window.location.hostname,e="https://www.elespanol.com/politica_de_cookies/",r=!!(I!==null&&I!==void 0&&(n=I.stats)!==null&&n!==void 0&&n.utiq&&!I.stats.utiq.disabled),a=Xh[i]||Xh.es,s=r?" (".concat(a.utiqInlineWord,' <img src="https://utiqcontent.com/website/logos/utiq-com.svg" style="height:1em;width:auto;vertical-align:middle;cursor:pointer;" alt="Utiq">)'):"",o=r?'\n <h3>\n <img style="height:1em;" src="https://utiqcontent.com/website/logos/utiq-com.svg" alt="Utiq">\n '.concat(a.utiqTitle,"\n </h3>\n <p>").concat(a.utiqBody(t),"</p>\n "):"";return'\n <div id="utiq-section">\n '.concat(a.publisherParagraph(s,e),'\n <div id="utiq-data-processing-anchor"></div> <!-- marcador -->\n ').concat(o,"\n </div>\n ")}function Tb(n,i){var t=(document.documentElement.lang||"es").split("-")[0],e=t==="ca",r=e?{es:xs("ca"),ca:xs("ca")}:{es:xs("es"),ca:xs("ca")};return{app:{language:t},languages:{enabled:e?["ca"]:["es"],default:t},notice:{enable:n,content:{popup:r,notice:r}},sdkPath:i,apiPath:"".concat(i,"api")}}function bb(){var n=this,i=(document.documentElement.lang||"es").split("-")[0],t=null;window.didomiOnReady=window.didomiOnReady||[],i==="ca"&&window.didomiOnReady.push(function(){var l=document.createElement("style");l.textContent='#didomi-host .didomi-popup-notice-text-container::before { content: "Accepta per continuar llegint." !important; }',document.head.appendChild(l)}),window.didomiOnReady.push(function(){function l(){var c=document.querySelector(".didomi-popup-notice");if(c){var f=c.querySelector("#utiq-section"),d=c.querySelector(".didomi-notice-data-processing-container"),h=document.querySelector(".didomi-notice-view-partners-link");if(f){if(d&&!f.contains(d)){var v=f.querySelector("#utiq-data-processing-anchor");v?v.after(d):f.appendChild(d)}h&&!f.contains(h)&&f.appendChild(h)}}}var u=document.querySelector(".didomi-popup-notice");u&&(t=new MutationObserver(function(){return l()}),t.observe(u,{childList:!0,subtree:!0}),l())});var e=function(){window.Didomi.preferences.show()},r=function(){La===null||La===void 0||La.openDidomi()},a=function(){var u=document.getElementById("cookies-policy__btn");u&&(I.isApp?ie(u,"click",r,n):ie(u,"click",e,n))};window.didomiOnReady=window.didomiOnReady||[],window.didomiOnReady.push(function(){jeef.JeefEvents.persistentEmit(it.DIDOMY_LIBRARY_LOADED),a()});var s=!1,o=function(){window.didomiOnReady.push(function(){Didomi.getConfig().notice.enable!==!1&&(Didomi.shouldConsentBeCollected()?kb():Zl())}),window.didomiOnReady.push(function(){window.Didomi.isConsentRequired()?(window.Didomi.getObservableOnUserConsentStatusForVendor("412").filter(function(u){return!!(u===!1||u)}).first().subscribe(function(u){s||jeef.JeefEvents.persistentEmit(it.PIANO_LOAD),s=!0}),window.Didomi.getObservableOnUserConsentStatusForVendor("c:piano-app").filter(function(u){return!!(u===!1||u)}).first().subscribe(function(u){s||jeef.JeefEvents.persistentEmit(it.PIANO_LOAD),s=!0})):jeef.JeefEvents.persistentEmit(it.PIANO_LOAD)})};o(),window.didomiOnReady.push(function(){if(Didomi.getUserConsentStatusForAll().vendors.enabled.length||Didomi.getUserConsentStatusForAll().vendors.disabled.lenght)var l=Didomi.getUserConsentStatusForAll().vendors.enabled.indexOf("c:piano-app")===-1,u=Didomi.getUserConsentStatusForAll().vendors.disabled.indexOf("c:piano-app")===-1,c=Didomi.getUserConsentStatusForAll().vendors.enabled.indexOf("google")===-1,f=Didomi.getUserConsentStatusForAll().vendors.disabled.indexOf("google")===-1}),window.didomiEventListeners=window.didomiEventListeners||[],window.didomiOnReady.push(function(){window.Didomi.shouldConsentBeCollected()||(jeef.JeefEvents.persistentEmit(it.USER_CMP_RESOLVED),$h())}),window.didomiEventListeners.push({event:"notice.hidden",listener:function(){t.disconnect(),jeef.JeefEvents.persistentEmit(At.NOTICE_CLOSED),jeef.JeefEvents.persistentEmit(it.USER_CMP_RESOLVED)}}),window.didomiEventListeners.push({event:"consent.changed",listener:function(){Ab()}}),nu||(window.didomiEventListeners.push({event:"preferences.clicksavechoices",listener:function(){Ra()}}),window.didomiEventListeners.push({event:"notice.clickagree",listener:function(){Ra()}}),window.didomiEventListeners.push({event:"notice.clickdisagree",listener:function(){Ra()}}),window.didomiEventListeners.push({event:"preferences.clickdisagreetoall",listener:function(){Ra()}}),window.didomiEventListeners.push({event:"preferences.clickagreetoall",listener:function(){Ra()}}))}function kb(){if(!nu)try{var n=document.querySelector("body"),i=document.createElement("div");i.setAttribute("id","nhfp_didomi_block_page"),i.setAttribute("style","top: 0; left: 0; right: 0; bottom: 0; z-index: 25000; position: fixed; background-color: rgba(0, 0, 0, 0.3); "),n.appendChild(i),document.body.style.overflow="hidden"}catch(t){}}function Ra(){try{var n=document.getElementById("nhfp_didomi_block_page");n!=null&&(n.style.display="none"),document.body.style.overflow=""}catch(i){}}function Ab(){var n;Zl(),typeof((n=window.tp)===null||n===void 0||(n=n.experience)===null||n===void 0?void 0:n.execute)=="function"&&window.tp.experience.execute(),$h()}function $h(){try{jeef.JeefEvents.persistentEmit(it.GPT_INIT),au()?jeef.JeefEvents.persistentEmit(it.USER_DISAGREE_TO_SOMETHING):(jeef.JeefEvents.persistentEmit(it.USER_AGREE_TO_ALL),jeef.JeefEvents.persistentEmit(At.TRIGGER_DIDOMI),jeef.JeefEvents.persistentEmit(At.ADS_CONSENT_GRANTED),jeef.JeefEvents.persistentEmit(it.INDIGITALL_LOAD))}catch(n){console.error(n),jeef.JeefEvents.persistentEmit(it.AD_DISABLE)}}function au(){var n=window.Didomi.getUserStatus();return n.vendors.consent.enabled.length+n.purposes.consent.enabled.length===0&&n.vendors.consent.disabled.length+n.purposes.consent.disabled.length>0}var nu,Qh,Xh,su=W(function(){T();vt();Jt();ze();Sn();Oi();Os();eu();Qr();_e();Jh();jeef.JeefEvents||(jeef.JeefEvents=Ht.getInstance());ct("jeeiSite.dyn.DynManager");nu=!1,Qh=function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(window.jeeiSite.dyn.didomiLoaded!==!0||i===!0){var t=!0,e=Ri();e&&(console.log("appVersion",e),isNaN(e.split(".")[0])||e.split(".")[0]*1>2&&(t=!1,nu=!0)),window.jeeiSite.dyn.didomiLoaded=!0,window.jeeiSite.dyn.didomi=[];var r=jeefConfig.assets+"/eprivacy/";window.gdprAppliesGlobally=!0,window.didomiConfig=Tb(t,r),function(){function a(o){if(!window.frames[o])if(document.body&&document.body.firstChild){var l=document.body,u=document.createElement("iframe");u.style.display="none",u.name=o,u.title=o,l.insertBefore(u,l.firstChild)}else setTimeout(function(){a(o)},5)}function s(o,l,u,c,f){function d(v,m,p,g){if(typeof p=="function"){window[l]||(window[l]=[]);var E=!1;f&&(E=f(v,g,p)),E||window[l].push({command:v,version:m,callback:p,parameter:g})}}d.stub=!0,d.stubVersion=2;function h(v){if(!(!window[o]||window[o].stub!==!0)&&v.data){var m=typeof v.data=="str
1ing",p;try{p=m?JSON.parse(v.data):v.data}catch(E){return}if(p[u]){var g=p[u];window[o](g.command,g.version,function(E,y){var _={};_[c]={returnValue:E,success:y,callId:g.callId},v.source&&v.source.postMessage(m?JSON.stringify(_):_,"*")},g.parameter)}}}typeof window[o]!="function"&&(window[o]=d,window.addEventListener?window.addEventListener("message",h,!1):window.attachEvent("onmessage",h))}s("__tcfapi","__tcfapiBuffer","__tcfapiCall","__tcfapiReturn"),a("__tcfapiLocator")}(),function(){window.__gpp_addFrame=function(a){if(!window.frames[a])if(document.body){var s=document.createElement("iframe");s.style.cssText="display:none",s.name=a,document.body.appendChild(s)}else window.setTimeout(window.__gpp_addFrame,10,a)},window.__gpp_stub=function(){var a=arguments;if(__gpp.queue=__gpp.queue||[],__gpp.events=__gpp.events||[],!a.length||a.length==1&&a[0]=="queue")return __gpp.queue;if(a.length==1&&a[0]=="events")return __gpp.events;var s=a[0],o=a.length>1?a[1]:null,l=a.length>2?a[2]:null;if(s==="ping")o({gppVersion:"1.1",cmpStatus:"stub",cmpDisplayStatus:"hidden",signalStatus:"not ready",supportedAPIs:["2:tcfeuv2","5:tcfcav1","6:uspv1","7:usnat","8:usca","9:usva","10:usco","11:usut","12:usct"],cmpId:"7",sectionList:[],applicableSections:[],gppString:"",parsedSections:{}},!0);else if(s==="addEventListener"){"lastId"in __gpp||(__gpp.lastId=0),__gpp.lastId++;var u=__gpp.lastId;__gpp.events.push({id:u,callback:o,parameter:l}),o({eventName:"listenerRegistered",listenerId:u,data:!0,pingData:{gppVersion:"1.1",cmpStatus:"stub",cmpDisplayStatus:"hidden",signalStatus:"not ready",supportedAPIs:["2:tcfeuv2","5:tcfcav1","6:uspv1","7:usnat","8:usca","9:usva","10:usco","11:usut","12:usct"],cmpId:"7",sectionList:[],applicableSections:[],gppString:"",parsedSections:{}}},!0)}else if(s==="removeEventListener"){for(var c=!1,f=0;f<__gpp.events.length;f++)if(__gpp.events[f].id==l){__gpp.events.splice(f,1),c=!0;break}o({eventName:"listenerRemoved",listenerId:l,data:c,pingData:{gppVersion:"1.1",cmpStatus:"stub",cmpDisplayStatus:"hidden",signalStatus:"not ready",supportedAPIs:["2:tcfeuv2","5:tcfcav1","6:uspv1","7:usnat","8:usca","9:usva","10:usco","11:usut","12:usct"],cmpId:"7",sectionList:[],applicableSections:[],gppString:"",parsedSections:{}}},!0)}else s==="hasSection"?o(!1,!0):s==="getSection"||s==="getField"?o(null,!0):__gpp.queue.push([].slice.apply(a))},window.__gpp_msghandler=function(a){var s=typeof a.data=="string";try{var o=s?JSON.parse(a.data):a.data}catch(u){var o=null}if(pe(o)==="object"&&o!==null&&"__gppCall"in o){var l=o.__gppCall;window.__gpp(l.command,function(u,c){var f={__gppReturn:{returnValue:u,success:c,callId:l.callId}};a.source.postMessage(s?JSON.stringify(f):f,"*")},"parameter"in l?l.parameter:null,"version"in l?l.version:"1.1")}},(!("__gpp"in window)||typeof window.__gpp!="function")&&(window.__gpp=window.__gpp_stub,window.addEventListener("message",window.__gpp_msghandler,!1),window.__gpp_addFrame("__gppLocator"))}(),function(){(function(a,s){var o=document.createElement("script");o.id="spcloader",o.type="text/javascript",o.async=!0,o.charset="utf-8";var l=r+a+"/loader.js?target_type=notice&target="+s;if(window.didomiConfig&&window.didomiConfig.user){var u=window.didomiConfig.user,c=u.country,f=u.region;c&&(l=l+"&country="+c,f&&(l=l+"®ion="+f))}o.src=l;var d=document.getElementsByTagName("script")[0];d.parentNode.insertBefore(o,d)})("ddf34e44-5386-4edd-8cfd-41b236983182",I.cmp.consentId)}(),bb()}},Xh={es:{utiqInlineWord:"incluyendo",publisherParagraph:function(i,t){return'\n <p>\n Con tu consentimiento, nosotros y\n <a href="#" onclick="Didomi.preferences.show(\'vendors\'); return false;">\n nuestros socios</a>\n usamos cookies o tecnolog\xEDas similares'.concat(i,' para almacenar, acceder y procesar\n datos personales, como tus visitas a esta p\xE1gina web, las direcciones IP y los\n identificadores de cookies. Algunos socios no te piden consentimiento para procesar\n tus datos y se amparan en su leg\xEDtimo inter\xE9s comercial.\n Puedes retirar tu consentimiento u oponerte al procesamiento de datos seg\xFAn el inter\xE9s\n leg\xEDtimo en cualquier momento haciendo clic en "M\xE1s informaci\xF3n" o en la\n <a href="').concat(t,'" target="_blank" rel="noopener noreferrer">\n pol\xEDtica de cookies\n </a> de esta p\xE1gina web.\n </p>\n ')},utiqTitle:"\xBFQuieres activar la tecnolog\xEDa Utiq impulsada por las operadoras de telefon\xEDa?",utiqBody:function(i){return'Si das tu consentimiento y usas una <a href="https://consenthub.utiq.com/pages/privacy-statement#telecom-operators" target="_blank"><strong>conexi\xF3n a internet habilitada</strong></a> (m\xF3vil y banda ancha), nosotros, El Espa\xF1ol, utilizaremos identificadores de marketing que nos proporciona Utiq para llevar a cabo <a href="https://www.elespanol.com/politica_de_privacidad/" target="_blank">actividades de marketing digital o an\xE1lisis</a>. Para crear estos identificadores, Utiq trabaja con tu operadora de telefon\xEDa, que usa tu direcci\xF3n IP y otros datos (como tu n\xFAmero de tel\xE9fono m\xF3vil), pero sin compartirlos. Estos identificadores nos ayudan a conectar la actividad de navegaci\xF3n dentro de <a href="https://consenthub.utiq.com/pages/digital-properties?domain='.concat(i,'" target="_blank">nuestra(s) propiedad(es) digital(es)</a> donde se haya dado un consentimiento Utiq. Esto incluye tu actividad y la de los que compartan tu conexi\xF3n. <a href="#" onclick="if(window.Didomi){Didomi.preferences.show();}return false;">Puedes rechazar Utiq ahora</a> o retirar tu consentimiento en cualquier momento a trav\xE9s de "Administrar Utiq" o en el <a href="https://consenthub.utiq.com" target="_blank">portal de privacidad de Utiq</a>. Si te suscribes, Utiq no estar\xE1 en uso. Al dar tu consentimiento, confirmas que eres el titular de la cuenta de internet o que tienes su permiso para activar Utiq en esa conexi\xF3n. Para m\xE1s informaci\xF3n, consulta la <a href="https://consenthub.utiq.com/pages/privacy-statement" target="_blank">pol\xEDtica de privacidad de Utiq</a>.')}},ca:{utiqInlineWord:"incloent-hi",publisherParagraph:function(i,t){return'\n <p>\n Amb el vostre acord, nosaltres i\n <a href="#" onclick="Didomi.preferences.show(\'vendors\'); return false;">\n els nostres socis</a>\n fem servir galetes o tecnologies similars'.concat(i,' per emmagatzemar, accedir i processar\n dades personals com la vostra visita a aquest lloc web, adreces IP i\n identificadors de galetes. Alguns socis no demanen el vostre consentiment per processar\n les vostres dades i es basen en el seu inter\xE8s comercial leg\xEDtim.\n Podeu retirar el vostre consentiment o oposar-vos al tractament de dades basat en un inter\xE8s\n leg\xEDtim en qualsevol moment fent clic a "M\xE9s informaci\xF3" o a la\n <a href="').concat(t,'" target="_blank" rel="noopener noreferrer">\n pol\xEDtica de galetes\n </a> d\'aquest lloc web.\n </p>\n ')},utiqTitle:"Vols activar la tecnologia Utiq impulsada per les operadores de telefonia?",utiqBody:function(i){return'Si dones el teu consentiment i fas servir una <a href="https://consenthub.utiq.com/pages/privacy-statement#telecom-operators" target="_blank"><strong>connexi\xF3 a internet habilitada</strong></a> (m\xF2bil i banda ampla), nosaltres, El Espa\xF1ol, farem servir identificadors de m\xE0rqueting proporcionats per Utiq per a <a href="https://www.elespanol.com/politica_de_privacidad/" target="_blank">activitats publicit\xE0ries o d\'anal\xEDtica</a>. Utiq treballa amb el teu operador de telecomunicacions, que far\xE0 servir la teva adre\xE7a IP en relaci\xF3 amb dades internes (per exemple, el n\xFAmero de m\xF2bil), sense divulgar-les, per crear identificadors per a cada connexi\xF3 que utilitzi. Fem servir aquests identificadors per vincular l\'activitat de navegaci\xF3 a trav\xE9s de <a href="https://consenthub.utiq.com/pages/digital-properties?domain='.concat(i,'" target="_blank">les nostres propietats</a> on es dona consentiment a Utiq, incloent-hi les d\'altres que utilitzen la mateixa connexi\xF3.
1<a href="#" onclick="if(window.Didomi){Didomi.preferences.show();}return false;">Pots rebutjar Utiq ara</a> o retirar el consentiment m\xE9s endavant a trav\xE9s de "Gestionar Utiq" o al <a href="https://consenthub.utiq.com" target="_blank">portal de privacitat d\'Utiq</a>. Si et subscrius, Utiq no s\'utilitzar\xE0. Confirmes que ets el titular del compte de connexi\xF3 o tens perm\xEDs per activar Utiq. Per a m\xE9s informaci\xF3, consulta la <a href="https://consenthub.utiq.com/pages/privacy-statement" target="_blank">declaraci\xF3 de privacitat d\'Utiq</a>.')}}}});function ev(){if(Zh){var n=parseInt(sessionStorage.getItem("ee_pv")||"0",10)+1;if(sessionStorage.setItem("ee_pv",n.toString()),document.location.pathname.endsWith("/")){var i=parseInt(sessionStorage.getItem("ee_board_pv")||"0",10)+1;sessionStorage.setItem("ee_board_pv",i.toString())}Zh=!1}}function Oa(){return parseInt(sessionStorage.getItem("ee_board_pv")||"0",10)}var Zh,ou=W(function(){T();Zh=!0});function tv(){return document.location.pathname.endsWith("/")?Me?Oa()!==2:Oa()!==1:!0}function rv(){return document.location.pathname.endsWith("/")?Me?Oa()===2:Oa()===1:!1}var lu=W(function(){T();pt();ou()});function Ib(n,i,t){return i=w(i),q(n,iv()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function iv(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(iv=function(){return!!n})()}var uu,Cb,ht,yi=W(function(){T();J();X();ue();oe();le();ze();Ut();Xt();mt();Un();$e();dt();mi();Mr();_e();pt();ti();Rs();Jl();Qr();Oi();su();lu();jeef.JeefEvents||(jeef.JeefEvents=Ht.getInstance());uu=null,Cb="merchant.com.elespannol.ElEspannol",ht=function(n){B(i,n);function i(){var t,e;return k(this,i),e=Ib(this,i),e.flagLogginSucces=!1,e._loaded=!1,e._loadedHandlers=!1,e._customEventsNameDispatcher=[me.ON_LOGOUT_TRIGGER_PAYWALL,me.ON_CHECKOUTSTART_PROMOTION],e.originLoad="",window.tp=window.tp||[],((t=window.location)===null||t===void 0?void 0:t.href)==="https://www.elespanol.com/como/escribe/476702580_0.html"&&(console.log("PIANO PDL"),window.pdl=window.pdl||{},window.pdl.requireConsent="v2"),window.tp.push(["setCustomVariable","so",ka()]),e}return A(i,[{key:"setOriginLoad",value:function(e){this.originLoad=e}},{key:"getOriginLoad",value:function(){return this.originLoad}},{key:"fillMetadaVSComposer",value:function(){var e=Q.getMain(),r=Q.getTags(),a=Q.getSlugHashTags(),s=Q.getSection().name||"",o=e.author||"",l=e.publish_ts||"",u=e.contentType!==void 0&&e.contentType!==null?e.contentType:"";window.tp=window.tp||[],window.tp.push(["setSandbox",I.piano.debug]),window.tp.push(["setDebug",I.piano.debug]),window.tp.push(["setUsePianoIdUserProvider",!0]),window.tp.push(["setContentSection",s]),window.tp.push(["setTags",i.prepareHashTags2Piano(r,a,e.contentType)]),window.tp.push(["setZone",this.getZone()]),window.tp.push(["setCustomVariable","Role",se.getInstance().getRole()]),window.tp.push(["setCustomVariable","ContentType",u]),window.tp.push(["setCustomVariable","sticky",!!rv()]),window.tp.push(["setContentAuthor",o]),window.tp.push(["setContentCreated",l&&typeof l=="number"?new Date(l*1e3).toISOString():null]),window.tp.push(["setContentIsNative",!1]),window.tp.push(["setPianoIdUrl",I.piano.socialLoginDomain]),window.tp.push(["setApplePayMerchantId",Cb])}},{key:"loadVSComposerData",value:function(){var e=this;this.fillMetadaVSComposer(),this._loadedHandlers||(window.tp=window.tp||[],window.tp.push(["addHandler","loginSuccess",function(r){e.checkFlowLoginOrSignInUser(r)}]),window.tp.push(["addHandler","checkoutComplete",function(r){e.dispatchEvent(new me(me.ON_CHECKOUT_COMPLETE,r))}]),window.tp.push(["addHandler","externalCheckoutComplete",function(r){e.dispatchEvent(new me(me.ON_EXTERNAL_CHECKOUT_COMPLETE,r))}]),window.tp.push(["addHandler","showTemplate",function(r){i._onLoadPianoModal(r.showCloseButton)}]),window.tp.push(["addHandler","showOffer",function(r){jeef.JeefEvents.emit(be.ON_PIANO_SHOW_OFFER,r),i._onLoadPianoModal(r.showCloseButton)}]),window.tp.push(["addHandler","logout",function(r){e.dispatchEvent(new me(me.ON_LOGOUT_TRIGGER,r))}]),window.tp.push(["addHandler","checkoutCustomEvent",function(r){switch(r.eventName){case"onAcceptCookiesTriggerCookiewall":e.dis
1patchEvent(new me(me.ON_ACCEPT_COOKIES_TRIGGER_COOKIEWALL,r));break}}]),window.tp.push(["init",function(){var r;((r=window.location)===null||r===void 0?void 0:r.href)==="https://www.elespanol.com/como/escribe/476702580_0.html"&&(console.log("PIANO PDL CONSENT CHECH"),au()?window.tp.consent.setAllPurposes("opt-out"):window.tp.consent.setAllPurposes("opt-in")),I.piano.init&&window.tp.pianoId.init({profileUpdate:function(o){e.dispatchEvent(new me(me.ON_PROFILE_UPDATE,o))}});var a=se.getInstance().getUid();window.tp.setGA4Config({measurementId:I.stats.analytics.uasGA4.piano,eventParameters:{send_page_view:!0,page_location:window.location.href,page_title:document.title,user_id:a}}),e.dispatchEvent(new me(me.ON_TRIGGER_SDK_LOADED))}]),this._loadedHandlers=!0)}},{key:"setHandler",value:function(e,r){var a=this;window.tp.push(["addHandler",e,function(s){var o=!1;return s.eventName==="logout-user-from-paywall"&&r===me.ON_LOGOUT_TRIGGER_PAYWALL&&(o=!0),s.eventName==="login"&&r===me.ON_CHECKOUTSTART_PROMOTION&&(o=!0),o&&a.dispatchEvent(new me(r,s)),!1}])}},{key:"getZone",value:function(){var e=se.getInstance().getDevice();switch(e){case se.DEVICE_DESKTOP:return i.WEB_ZONE;case se.DEVICE_MOBILE:return i.MOBILE_ZONE;case se.DEVICE_TABLET:return i.TABLET_ZONE;case se.DEVICE_MOBILE_APP:case se.DEVICE_TABLET_APP:return i.APP_ZONE;default:return i.WEB_ZONE}}},{key:"load",value:function(e){var r=this,a=function(){if(!r._loaded){var o=new Ke;o.load(I.piano.sdk,!0),ie(o,he.ON_IO_FINISH,r._onLoadPianoSDK,r),ie(o,he.ON_IO_ERROR,r._onErrorLoadPianoSDK,r),r._loaded=!0}};gi.isGaa()?(Q.getSlugHashTags().indexOf("/contenido-suscriptor/")!==-1&&(document.readyState==="complete"||document.readyState==="loaded"||document.readyState==="interactive")&&document.body.classList.remove("closed-content"),e===!0&&(a(),Ia.getInstance().unlockPaywall()),Ia.getInstance()):a()}},{key:"_onLoadPianoSDK",value:function(){}},{key:"_onErrorLoadPianoSDK",value:function(){this.dispatchEvent(new me(me.ON_TRIGGER_ERROR_SDK_LOADED))}},{key:"checkFlowLoginOrSignInUser",value:function(e){var r=window.referer||new URLSearchParams(window.location.search).get("referer");e.registration===!0&&e.source==="PIANOID"?this.flagLogginSucces||(r&&(e.context=r),e.onBoardingRegister=!0,this.flagLogginSucces=!0,this.dispatchEvent(new me(me.ON_REGISTER_SUCCESS,e))):!e.registration&&e.source==="PIANOID"?this.flagLogginSucces||(r&&(e.context=r),this.flagLogginSucces=!0,this.dispatchEvent(new me(me.ON_LOGGIN_SUCCESS,e))):e.registration===!0&&e.source==="OFFER"?(e.context="purchase",this.dispatchEvent(new me(me.ON_REGISTER_SUCCESS,e))):!e.registration&&e.source==="OFFER"&&(this.flagLogginSucces||(this.flagLogginSucces=!0,this.dispatchEvent(new me(me.ON_LOGGIN_SUCCESS,{params:{uid:e.user.uid}}))),this.dispatchEvent(new me(me.ON_STARTCHECKOUT_LOGIN_SUCCESS,e)))}}],[{key:"getInstance",value:function(){return uu||(uu=new i),uu}},{key:"prepareHashTags2Piano",value:function(e,r,a){var s=e;return r.length>0&&(s=r.concat(e)),a!=null&&a!==""&&s.push("ContentType_"+a),gi.isGaa()&&(s.push("extended-access"),window.tp.push(["setCustomVariable","extended-access","on"])),(document.referrer.match(/news.google.com/)||navigator.userAgent.match(/GNews/))&&s.push("google-news"),s}},{key:"_onLoadPianoModal",value:function(e){if(e){var r=document.getElementsByClassName("tp-modal"),a;a=typeof r[r.length-1]!="undefined"?r[r.length-1]:null,a&&ie(a,de.ON_DOM_CLICK,i._onClickPianoCloseModal)}}},{key:"_onClickPianoCloseModal",value:function(){window.tp.template.close()}}]),i}(Re);ht.MOBILE_ZONE="Mobile";ht.TABLET_ZONE="Tablet";ht.WEB_ZONE="Web";ht.APP_ZONE="App";(function(){window.jeeiSite.dyn.loadPianoBasic!==!0&&(Mh()||(window.didomiOnReady=window.didomiOnReady||[],window.didomiOnReady.push(function(){jeef.JeefEvents.onPersistentEvent(At.TRIGGER_DIDOMI,function(){window.document.cookie="__adblocker=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/",window.setNptTechAdblockerCookie=function(i){var t=new Date;t.setTime(t.getTime()+60*5*1e3),document.cookie="__adblocker="+(i?"true":"false")+"; expires="+t.toUTCString()+"; path=/"};var n=document.createElement("script");n.setAttribute("async",!0),n.setAttribute("src","//www.npttech.com/advertising.js"),n.setAttribute("onerror","setNptTechAdblockerCookie(true);"),window.document.getElementsByTagName("head")[0].appendChild(n)})})))})()});var cu=fi(function(wa,nv){T();vt();(function(n,i){(typeof wa=="undefined"?"undefined":pe(wa))==="object"?nv.exports=wa=i():typeof define=="function"&&define.amd?define([],i):n.CryptoJS=i()})(wa,function(){var n=n||function(i,t){var e=Object.create||function(){function m(){}return function(p){var g;return m.prototype=p,g=new m,m.prototype=null,g}}(),r={},a=r.lib={},s=a.Base=function(){return{extend:function(p){var g=e(this);return p&&g.mixIn(p),(!g.hasOwnProperty("init")||this.init===g.init)&&(g.init=function(){g.$super.init.a
vendor: 6,560 bytes, line 1
1pply(this,arguments)}),g.init.prototype=g,g.$super=this,g},create:function(){var p=this.extend();return p.init.apply(p,arguments),p},init:function(){},mixIn:function(p){for(var g in p)p.hasOwnProperty(g)&&(this[g]=p[g]);p.hasOwnProperty("toString")&&(this.toString=p.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),o=a.WordArray=s.extend({init:function(p,g){p=this.words=p||[],g!=t?this.sigBytes=g:this.sigBytes=p.length*4},toString:function(p){return(p||u).stringify(this)},concat:function(p){var g=this.words,E=p.words,y=this.sigBytes,_=p.sigBytes;if(this.clamp(),y%4)for(var b=0;b<_;b++){var C=E[b>>>2]>>>24-b%4*8&255;g[y+b>>>2]|=C<<24-(y+b)%4*8}else for(var b=0;b<_;b+=4)g[y+b>>>2]=E[b>>>2];return this.sigBytes+=_,this},clamp:function(){var p=this.words,g=this.sigBytes;p[g>>>2]&=4294967295<<32-g%4*8,p.length=i.ceil(g/4)},clone:function(){var p=s.clone.call(this);return p.words=this.words.slice(0),p},random:function(p){for(var g=[],E=function(M){var M=M,D=987654321,L=4294967295;return function(){D=36969*(D&65535)+(D>>16)&L,M=18e3*(M&65535)+(M>>16)&L;var O=(D<<16)+M&L;return O/=4294967296,O+=.5,O*(i.random()>.5?1:-1)}},y=0,_;y<p;y+=4){var b=E((_||i.random())*4294967296);_=b()*987654071,g.push(b()*4294967296|0)}return new o.init(g,p)}}),l=r.enc={},u=l.Hex={stringify:function(p){for(var g=p.words,E=p.sigBytes,y=[],_=0;_<E;_++){var b=g[_>>>2]>>>24-_%4*8&255;y.push((b>>>4).toString(16)),y.push((b&15).toString(16))}return y.join("")},parse:function(p){for(var g=p.length,E=[],y=0;y<g;y+=2)E[y>>>3]|=parseInt(p.substr(y,2),16)<<24-y%8*4;return new o.init(E,g/2)}},c=l.Latin1={stringify:function(p){for(var g=p.words,E=p.sigBytes,y=[],_=0;_<E;_++){var b=g[_>>>2]>>>24-_%4*8&255;y.push(String.fromCharCode(b))}return y.join("")},parse:function(p){for(var g=p.length,E=[],y=0;y<g;y++)E[y>>>2]|=(p.charCodeAt(y)&255)<<24-y%4*8;return new o.init(E,g)}},f=l.Utf8={stringify:function(p){try{return decodeURIComponent(escape(c.stringify(p)))}catch(g){throw new Error("Malformed UTF-8 data")}},parse:function(p){return c.parse(unescape(encodeURIComponent(p)))}},d=a.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(p){typeof p=="string"&&(p=f.parse(p)),this._data.concat(p),this._nDataBytes+=p.sigBytes},_process:function(p){var g=this._data,E=g.words,y=g.sigBytes,_=this.blockSize,b=_*4,C=y/b;p?C=i.ceil(C):C=i.max((C|0)-this._minBufferSize,0);var R=C*_,M=i.min(R*4,y);if(R){for(var D=0;D<R;D+=_)this._doProcessBlock(E,D);var L=E.splice(0,R);g.sigBytes-=M}return new o.init(L,M)},clone:function(){var p=s.clone.call(this);return p._data=this._data.clone(),p},_minBufferSize:0}),h=a.Hasher=d.extend({cfg:s.extend(),init:function(p){this.cfg=this.cfg.extend(p),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(p){return this._append(p),this._process(),this},finalize:function(p){p&&this._append(p);var g=this._doFinalize();return g},blockSize:512/32,_createHelper:function(p){return function(g,E){return new p.init(E).finalize(g)}},_createHmacHelper:function(p){return function(g,E){return new v.HMAC.init(p,E).finalize(g)}}}),v=r.algo={};return r}(Math);return n})});var sv=fi(function(xa,av){T();vt();(function(n,i){(typeof xa=="undefined"?"undefined":pe(xa))==="object"?av.exports=xa=i(cu()):typeof define=="function"&&define.amd?define(["./core"],i):i(n.CryptoJS)})(xa,function(n){return function(i){var t=n,e=t.lib,r=e.WordArray,a=e.Hasher,s=t.algo,o=[];(function(){for(var h=0;h<64;h++)o[h]=i.abs(i.sin(h+1))*4294967296|0})();var l=s.MD5=a.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(v,m){for(var p=0;p<16;p++){var g=m+p,E=v[g];v[g]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360}var y=this._hash.words,_=v[m+0],b=v[m+1],C=v[m+2],R=v[m+3],M=v[m+4],D=v[m+5],L=v[m+6],O=v[m+7],x=v[m+8],Y=v[m+9],$=v[m+10],Z=v[m+11],N=v[m+12],j=v[m+13],z=v[m+14],ee=v[m+15],U=y[0],F=y[1],H=y[2],G=y[3];U=u(U,F,H,G,_,7,o[0]),G=u(G,U,F,H,b,12,o[1]),H=u(H,G,U,F,C,17,o[2]),F=u(F,H,G,U,R,22,o[3]),U=u(U,F,H,G,M,7,o[4]),G=u(G,U,F,H,D,12,o[5]),H=u(H,G,U,F,L,17,o[6]),F=u(F,H,G,U,O,22,o[7]),U=u(U,F,H,G,x,7,o[8]),G=u(G,U,F,H,Y,12,o[9]),H=u(H,G,U,F,$,17,o[10]),F=u(F,H,G,U,Z,22,o[11]),U=u(U,F,H,G,N,7,o[12]),G=u(G,U,F,H,j,12,o[13]),H=u(H,G,U,F,z,17,o[14]),F=u(F,H,G,U,ee,22,o[15]),U=c(U,F,H,G,b,5,o[16]),G=c(G,U,F,H,L,9,o[17]),H=c(H,G,U,F,Z,14,o[18]),F=c(F,H,G,U,_,20,o[19]),U=c(U,F,H,G,D,5,o[20]),G=c(G,U,F,H,$,9,o[21]),H=c(H,G,U,F,ee,14,o[22]),F=c(F,H,G,U,M,20,o[23]),U=c(U,F,H,G,Y,5,o[24]),G=c(G,U,F,H,z,9,o[25]),H=c(H,G,U,F,R,14,o[26]),F=c(F,H,G,U,x,20,o[27]),U=c(U,F,H,G,j,5,o[28]),G=c(G,U,F,H,C,9,o[29]),H=c(H,G,U,F,O,14,o[30]),F=c(F,H,G,U,N,20,o[31]),U=f(U,F,H,G,D,4,o[32]),G=f(G,U,F,H,x,11,o[33]),H=f(H,G,U,F,Z,16,o[34]),F=f(F,H,G,U,z,23,o[35]),U=f(U,F,H,G,b,4,o[36]),G=f(G,U,F,H,M,11,o[37]),H=f(H,G,U,F,O,16,o[38]),F=f(F,H,G,U,$,23,o[39]),U=f(U,F,H,G,j,4,o[40]),G=f(G,U,F,H,_,11,o[41]),H=f(H,G,U,F,R,16,o[42]),F=f(F,H,G,U,L,23,o[43]),U=f(U,F,H,G,Y,4,o[44]),G=f(G,U,F,H,N,11,o[45]),H=f(H,G,U,F,ee,16,o[46]),F=f(F,H,G,U,C,23,o[47]),U=d(U,F,H,G,_,6,o[48]),G=d(G,U,F,H,O,10,o[49]),H=d(H,G,U,F,z,15,o[50]),F=d(F,H,G,U,D,21,o[51]),U=d(U,F,H,G,N,6,o[52]),G=d(G,U,F,H,R,10,o[53]),H=d(H,G,U,F,$,15,o[54]),F=d(F,H,G,U,b,21,o[55]),U=d(U,F,H,G,x,6,o[56]),G=d(G,U,F,H,ee,10,o[57]),H=d(H,G,U,F,L,15,o[58]),F=d(F,H,G,U,j,21,o[59]),U=d(U,F,H,G,M,6,o[60]),G=d(G,U,F,H,Z,10,o[61]),H=d(H,G,U,F,C,15,o[62]),F=d(F,H,G,U,Y,21,o[63]),y[0]=y[0]+U|0,y[1]=y[1]+F|0,y[2]=y[2]+H|0,y[3]=y[3]+G|0},_doFinalize:function(){var v=this._data,m=v.words,p=this._nDataBytes*8,g=v.sigBytes*8;m[g>>>5]|=128<<24-g%32;var E=i.floor(p/4294967296),y=p;m[(g+64>>>9<<4)+15]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,m[(g+64>>>9<<4)+14]=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,v.sigBytes=(m.length+1)*4,this._process();for(var _=this._hash,b=_.words,C=0;C<4;C++){var R=b[C];b[C]=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360}return _},clone:function(){var v=a.clone.call(this);return v._hash=this._hash.clone(),v}});function u(h,v,m,p,g,E,y){var _=h+(v&m|~v&p)+g+y;return(_<<E|_>>>32-E)+v}function c(h,v,m,p,g,E,y){var _=h+(v&p|m&~p)+g+y;return(_<<E|_>>>32-E)+v}function f(h,v,m,p,g,E,y){var _=h+(v^m^p)+g+y;return(_<<E|_>>>32-E)+v}function d(h,v,m,p,g,E,y){var _=h+(m^(v|~p))+g+y;return(_<<E|_>>>32-E)+v}t.MD5=a._createHelper(l),t.HmacMD5=a._createHmacHelper(l)}(Math),n.MD5})});var fu,Ps,du,Lb,Rb,Ob,wb,xb,Pb,Db,ov=W(function(){T();J();X();pt();fu=fr(sv()),Ps=null,du=function(){function n(){k(this,n)}
1return A(n,null,[{key:"setDebugLayer",value:function(t){Ps=t}},{key:"getDebugLayer",value:function(){return Ps}},{key:"get",value:function(t,e){return Lb(t,e)}}]),n}(),Lb=function(i,t){var e=[navigator.userAgent,navigator.language,navigator.platform,screen.colorDepth,screen.height+"x"+screen.width,new Date().getTimezoneOffset(),Ob()?1:0,wb()?1:0,xb()?1:0,navigator.cpuClass?navigator.cpuClass:"unknown",navigator.platform?navigator.platform:"unknown",Db()],r=(0,fu.default)(e.join("#"),"").toString(),a=Pb(r),s=a||r;return s=Rb(s,t),s},Rb=function(i,t){var e=i+"D";return Tt.ipad||Tt.tablet?(e=i+"W",t||(e=i+"T")):Tt.mobile&&(e=i+"O",t||(e=i+"M")),e},Ob=function(){try{return!!window.sessionStorage}catch(i){return!0}},wb=function(){try{return!!window.localStorage}catch(i){return!0}},xb=function(){return!!window.indexedDB},Pb=function(i){var t=document.createElement("canvas"),e;if(t.getContext&&t.getContext("2d")){var r=document.createElement("canvas"),a=r.getContext("2d"),s=i;return a.textBaseline="top",a.textBaseline="alphabetic",a.font="17px 'Arial'",a.fillStyle="#f60",a.fillRect(125,1,62,20),a.fillStyle="#069",a.fillText(s,2,15),a.fillStyle="rgba(102, 204, 0, 0.7)",a.fillText(s,4,17),a.globalAlpha=.5,a.rotate(.1),a.font="31px 'Arial'",a.fillStyle="#C99F9F",a.fillText(", http://www.elespanol.com \u1F60",1,19),Ps&&(e=document.getElementById(Ps),e&&e.appendChild(r)),(0,fu.default)(r.toDataURL()).toString()}else return!1},Db=function(){var i,t="",e;if(navigator.plugins)for(i=0;i<navigator.plugins.length;i++)e=navigator.plugins[i],t+=i!=0?":":"",t+=e.name+" - "+e.description;return t}});function hu(n){try{return Function.toString.call(n).indexOf("[native code]")!==-1}catch(i){return typeof n=="function"}}var lv=W(function(){T()});function Ds(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Ds=function(){return!!n})()}var uv=W(function(){T()});function vu(n,i,t){if(Ds())return Reflect.construct.apply(null,arguments);var e=[null];e.push.apply(e,i);var r=new(n.bind.apply(n,e));return t&&kr(r,t.prototype),r}var cv=W(function(){T();An();uv()});function Fr(n){var i=typeof Map=="function"?new Map:void 0;return Fr=function(e){if(e===null||!hu(e))return e;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(typeof i!="undefined"){if(i.has(e))return i.get(e);i.set(e,r)}function r(){return vu(e,arguments,w(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),kr(r,e)},Fr(n)}var Ms=W(function(){T();oe();An();lv();cv()});function Mb(n,i,t){return i=w(i),q(n,fv()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function fv(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(fv=function(){return!!n})()}function Nb(n){return decodeURIComponent(atob(n).replace(/(.)/g,function(i,t){var e=t.charCodeAt(0).toString(16).toUpperCase();return e.length<2&&(e="0"+e),"%"+e}))}function Fb(n){var i=n.replace(/-/g,"+").replace(/_/g,"/");switch(i.length%4){case 0:break;case 2:i+="==";break;case 3:i+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return Nb(i)}catch(t){return atob(i)}}function dv(n,i){if(typeof n!="string")throw new Pa("Invalid token specified: must be a string");i||(i={});var t=i.header===!0?0:1,e=n.split(".")[t];if(typeof e!="string")throw new Pa("Invalid token specified: missing part #".concat(t+1));var r;try{r=Fb(e)}catch(a){throw new Pa("Invalid token specified: invalid base64 for part #".concat(t+1," (").concat(a.message,")"))}try{return JSON.parse(r)}catch(a){throw new Pa("Invalid token specified: invalid json for part #".concat(t+1," (").concat(a.message,")"))}}var Pa,hv=W(function(){T();X();J();ue();oe();le();Ms();Pa=function(n){B(i,n);function i(){return k(this,i),Mb(this,i,arguments)}return A(i)}(Fr(Error));Pa.prototype.name="InvalidTokenError"});function Ub(n,i,t){return i=w(i),q(n,vv()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function vv(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(vv=function(){return!!n})()}var Bn,We,se,Bb,Gb,jb,pv,$t,Hb,Vb,Kb,Wb,qb,dt=W(function(){T();Pr();J();X();ue();oe();Dr();le();Ge();mt();Se();ze();_e();pi();Jt();pt();yi();Un();mr();ov();ti();kn();hv();Bn=null,We="User";ne(We);se=function(n){B(i,n);function i(){var t,e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return k(this,i),t=Ub(this,i),V(qe(t),"dataUser",{}),V(qe(t),"_roles",{}),t.dataUser={},t._roles={},t._uid="",t._name="",t._lastName="",t._email="",t._products="",t._status=!1,t._code="",t._forceApp=!1,t._ppid=null,e||(t._pianoSDKLoader=ht.getInstance(),ie(t._pianoSDKLoader,me.ON_TRIGGER_SDK_LOADED,t._onPianoTrigger,qe(t))),t}return A(i,[{key:"_onPianoTrigger",value:function(){this._pianoSDKLoader&&ie(this._pianoSDKLoader,me.ON_PROFILE_UPDATE,this._onProfileUpdate,this)}},{key:"_onProfileUpdate",value:function(e){var r=I.user.userRoutes.pianoSync.replace("{id}",e.data.user.sub);this._onRequestSyncService(r,"POST",function(){},function(){})}},{key:"registerSync",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;
1this._onCookieLoginEERequest(e,r,a)}},{key:"loginSync",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;this._onCookieLoginEERequest(e,r)}},{key:"purchaseSync",value:function(e){this._onCookiePurchaseEERequest(e)}},{key:"_onRequestSyncService",value:function(e,r,a,s){var o=this,l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,u=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,c=arguments.length>6&&arguments[6]!==void 0?arguments[6]:"include",f={method:r,credentials:c};l&&(f.headers=l),u&&(f.body=u),fetch(e,f).then(function(d){return d.json()}).then(function(d){return P(["jeeiSite.user.User>_onCookieLoginEERequest>","Respuesta del fetch:",d],We),d}).then(function(d){return a.apply(o,[d])}).catch(function(d){P(["jeeiSite.user.User>_onCookieLoginEERequest>","Error en el fetch:",d],We),s.apply(o,[d])})}},{key:"_onCookieLoginEERequest",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;P(["jeeiSite.user.User>_onCookieLoginEERequest>","Identificaci\xF3n/Registro del usuario en nuestro sistema"],We);var s=I.user.userRoutes.pianoLogin.replace("{id}",e);s=r&&r!=="elespanol"?s.replace("{originLoad}","/".concat(r)):s.replace("{originLoad}",""),this._onRequestSyncService(s,"POST",this._onEEFinishRequest,this._onEEErrorRequest,null,JSON.stringify({context:a}))}},{key:"_onCookiePurchaseEERequest",value:function(e){P(["jeeiSite.user.User>_onCookiePurchaseEERequest>","Actualizaci\xF3n de la compra del usuario en back y en la sesi\xF3n del mismo"],We),this._onRequestSyncService(I.user.userRoutes.pianoPurchase,"POST",this._onEEFinishPurchaseRequest,this._onEEErrorPurchaseRequest,null,e)}},{key:"_onEEFinishPurchaseRequest",value:function(){$t.apply(this),this.dispatchEvent(new xe(xe.ON_USER_PURCHASE_REFRESH))}},{key:"_onEEErrorPurchaseRequest",value:function(){console.log("_onEEErrorPurchaseRequest")}},{key:"_onEEFinishRequest",value:function(e){$t.apply(this),jeef.JeefEvents.emit(be.ON_USER_SYNC_LAYOUT_FINISH,e.response),this.dispatchEvent(new xe(xe.ON_USER_SYNC_LAYOUT_FINISH)),jeef.JeefEvents.emit(be.ON_USER_SYNC_LAYOUT_FINISH)}},{key:"_onEEErrorRequest",value:function(){}},{key:"logout",value:function(){window.tp.pianoId.logout()}},{key:"cleanSession",value:function(){Ss("uid","/",I.subDomain),Ss("juid","/",I.subDomain),this._roles={}}},{key:"init",value:function(){Bb.apply(this)}},{key:"refreshUser",value:function(){$t.apply(this)}},{key:"isAnonymous",value:function(){return P(["jeeiSite.user.User>isAnonymous>","Comprobando si el usuario es an\xF3nimo"],We),$t.apply(this),this._roles.an!==void 0}},{key:"isSusAutoPromo",value:function(){return P(["jeeiSite.user.User>isSusAutoPromo>","Comprobando si es un suscriptor autopromo"],We),$t.apply(this),this._roles.spu!==void 0?this._roles.spu:!1}},{key:"isSubscriber",value:function(){return P(["jeeiSite.user.User>isSubscriber>","Comprobando si es un suscriptor"],We),$t.apply(this),this._roles.sus!==void 0?this._roles.sus:!1}},{key:"isSubscriberEE",value:function(){return P(["jeeiSite.user.User>isSubscriberEE>","Comprobando si es un suscriptor de El Espa\xF1ol"],We),$t.apply(this),this._roles.sue!==void 0?this._roles.sue:!1}},{key:"isSubscriberInvertia",value:function(){return P(["jeeiSite.user.User>isInvertiaSubscriber>","Comprobando si es un suscriptor de Invertia"],We),$t.apply(this),this._roles.sui!==void 0?this._roles.sui:!1}},{key:"wasSubscriber",value:function(){return P(["jeeiSite.user.User>isRavenclaw>","Comprobando si es un antiguo suscriptor"],We),$t.apply(this),this._roles.susp!==void 0?this._roles.susp:!1}},{key:"isRegisteredEE",value:function(){return P(["jeeiSite.user.User.isRegisteredEE>","Comprobando si es un usuario registrado"],We),$t.apply(this),this._roles.reg!==void 0?this._roles.reg:!1}},{key:"isSubscriberSpecPromo",value:function(){if(this.isAnySubscriber()){var e=this.isSusAutoPromo();return!e}return!1}},{key:"isStockHolder",value:function(){return P(["jeeiSite.user.User>isStockHolder>","Comprobando si es accionista ..."],We),$t.apply(this),this._roles.st!==void 0?this._roles.st:!1}},{key:"isRegistered",value:function(){return this.isRegisteredEE()&&!this.isAnySubscriber()}},{key:"isSubscriberForSiteURL",value:function(){var e=I.site,r=document.location.pathname,a=[He.elespanol,He.elespanolb,He.magas,He.metropoliabierta];return a.includes(e)?r.includes("/invertia/")?this.isAnySubscriber():r.includes("/el-cultural/hemeroteca/")?this.isSubscriberElCultural():r.includes("/el-cultural/")?this.isSubscriberElCulturalWeb()||this.isSubscriberElCultural()||this.isSubscriber()||this.isSubscriberEE():this.isSubscriber()||this.isSubscriberEE():e===He.cronicaglobal?this.isSubscriberCronicaGlobal():e===He.cronicavasca?this.isSubscriberCronicaVasca():!1}},{key:"hasAnySubscriptionForThisSite",value:function(){var e=!1,r=I.site;switch(r){case He.elespanol:case He.elespanolb:case He.magas:case He.metropoliabierta:(this.isAnySubscriber()||this.isSubscriberElCultural()||this.isSubscriberElCulturalWeb()||this.isSubscriberEE())&&(e=!0);break;case He.cronicaglobal:e=this.isSubscriberCronicaGlobal();break;case He.cronicavasca:e=this.isSubscriberCronicaVasca();break}return e}},{key:"isAnySubscriber",value:function(){return this.isSubscriberInvertia()||this.isSubscriber()}},{key:"isSubscriberInvertiaApp",value:function(){return this.isSubscriberInvertia()&&document.location.href.match(/\/invertia\//)}},{key:"isSubscriberEEApp",value:function(){return this.isSubscriberEE()&&document.location.href.match(/^((?!elespanol\.com\/invertia\/).)*$/)!==null}},{key:"isSubscriberElCultural",value:function(){return P(["jeeiSite.user.User>isSubscriberElCultural>","Comprobando si es subscriptor de El Cultural ..."],We),$t.apply(this),this._roles.cul!==void 0?this._roles.cul:!1}},{key:"isSubscriberElCulturalWeb",value:function(){return P(["jeeiSite.user.User>isSubscriberElCulturalWeb>","Comprobando si es subscriptor de El Cultural web ..."],We),$t.apply(this),this._roles.culw!==void 0?this._roles.culw:!1}},{key:"isSubscriberCronicaGlobal",value:function(){return P(["jeeiSite.user.User>isSubscriberCronicaGlobal>","Comprobando si es subscriptor de CronicaGlobal ..."],We),$t.apply(this),this._roles.scg!==void 0?this._roles.scg:!1}},{key:"isSubscriberCronicaVasca",value:function(){return P(["jeeiSite.user.User>isSubscriberCronicaGlobal>","Comprobando si es subscriptor de CronicaVasca ..."],We),$t.apply(this),this._roles.scv!==void 0?this._roles.scv:!1}},{key:"isSubscriberNoCookies",value:function(){return P(["jeeiSite.user.User>isSubscriberNoCookies>","Comprobando si es subscriptor con el producto de navegar con la cookies rechazadas ..."],We),$t.apply(this),Array.isArray(this._products)&&this._products.some(function(e){var r=e.split(":"),a=Te(r,2),s=a[0],o=a[1];return o=parseInt(o,10)*1e3,s.indexOf("COK")===0&&o>new Date().getTime()})}},{key:"isAbleToComment",value:function(){return P(["jeeiSite.user.User>isAbleToComment>","Comprobando si puede comentar el usuario .... "],We),Wb.apply(this,["COMNT"])}},{key:"getName",value:function(){return P(["jeeiSite.user.User>getName>","Obteniendo nombre de usuario:"+this.dataUser],We),this.dataUser.name}},{key:"getLastName",value:function(){return P(["jeeiSite.user.User>getLastName>","Obteniendo apellidos del usuario:"+this._lastName],We),this.dataUser.surname}},{key:"getHashedEmail",value:function(){return P(["jeeiSite.user.User>getHashedEmail>","Obteniendo correo hasheado del usuario:"+this._email],We),this.dataUser.hash||""}},{key:"getInitials",value:function(){P(["jeeiSite.user.User>getInitials>"],We);var e="",r=this.getName(),a=this.getLastName();return!this.isAnonymous()&&r&&a&&(e=r.charAt(0)+a.charAt(0)),e}},{key:"getUid",value:function(){return P(["jeeiSite.user.User>getUid>","Obteniendo uid del user:"+this.dataUser.sub],We),this.dataUser.sub!==void 0?this.dataUser.sub:!1}},{key:"getPpid",value:function(){return P(["jeeiSite.user.User>getPpid>","Obteniendo ppid del user:"+this.dataUser.ppid],We),this.dataUser.ppid!==void 0?this.dataUser.ppid:!1}},{key:"getStatus",value:function(){return this._status}},{key:"getRole",value:function(){var e="MUG";return this._roles&&(this._roles.sus!=null?(e="GRY",this._roles.sue!=null&&(e="GRY-EE",this._roles.sui!=null&&(e="GRY"))):this._roles.sui!=null?e="DYB":this._roles.rei!=null?e="BXB":this._roles.st!=null?(e="SLY",this._roles.sus!=null?e="GRY-SLY":this._roles.susp!=null&&(e="RAV-SLY")):this._roles.susp!=null||this._roles.suip!=null||this._roles.suep!=null?e="RAV":this._roles.reg!=null&&(e="HUF")),e}},{key:"getRoleForGpt",value:function(){var e=this.getRole(),r;switch(e){case"MUG":r="anonimo";break;
1case"GRY":case"GRY-EE":case"GRY-SLY":case"DYB":this.isSubscriberSpecPromo()?r="suscriptorEspecPromo":r="suscriptorAutoPromo";break;case"RAV-SLY":case"SLY":case"RAV":case"HUF":case"BXB":r="registrado";break}return r}},{key:"getSimpleRole",value:function(){switch(this.getRoleForGpt()){case"anonimo":return"ANON";case"suscriptorEspecPromo":case"suscriptorAutoPromo":return"SUS";case"registrado":return"REG";default:return"ANON"}}},{key:"forceApp",value:function(e){this._forceApp=e}},{key:"login",value:function(e){var r=new xe(xe.ON_LOGIN);r.origin=e,this.dispatchEvent(r)}},{key:"getDevice",value:function(){return qb()}},{key:"getRoles",value:function(){return this._roles}}],[{key:"getInstance",value:function(){return Bn||(Bn=new i),Bn}},{key:"getInstanceNoPiano",value:function(){return Bn||(Bn=new i(!0),du.get(I.subDomain,I.isApp)),Bn}}]),i}(Re);V(se,"DEVICE_DESKTOP","deviceDesktop");V(se,"DEVICE_MOBILE","deviceMobile");V(se,"DEVICE_TABLET","deviceTablet");V(se,"DEVICE_MOBILE_APP","deviceMobileApp");V(se,"DEVICE_TABLET_APP","deviceTabletApp");ct("jeeiSite.hp.User");window.jeeiSite.hp.User=se;Bb=function(){if(window.location.host!==""){var i="".concat(I.user.userRoutes.ws,"?").concat(new URLSearchParams({stigma:du.get(I.subDomain,I.isApp)}).toString()),t={};(I.isApp||this._forceApp)&&(t["E2S-NApp"]="91703A97A41BBE9AE287006D27BA20B0"),se.getInstance()._onRequestSyncService(i,"GET",Gb,jb,t,null)}else{P(["_init>_init> Evitamos peticion a Sortinghat al no encontrar dominio"],We);var e=new xe(xe.ON_USERRQ_WAITING);this.dispatchEvent(e),P(["_init>_init> Esperando a evento de APP"],We)}},Gb=function(i){switch($t.apply(this),this._status=i==null?void 0:i.status,this._code=i==null?void 0:i.code,this._code){case"006":case"010":case"012":case"013":pv();break;case"103":jeef.JeefEvents.emit(be.ON_SORTINGHAT_CODE_103,i.response);break;case"104":jeef.JeefEvents.emit(be.ON_SORTINGHAT_CODE_104);break;default:break}var t=new xe(xe.ON_USERRQ_FINISH);this.dispatchEvent(t),jeef.JeefEvents.emit(xe.ON_USERRQ_FINISH,i==null?void 0:i.response)},jb=function(i){St(["jeeiSite.user.User>_onRqError>_onRqError>","Ha existido un error en la petici\xF3n del control de user",i],We),P(["jeeiSite.user.User>_onRqError>_onRqError>","Por defecto es an\xF3nimo ...",i],We),this._uid="0000000000";var t=new xe(xe.ON_USERRQ_FINISH);pv(),this.dispatchEvent(t)},pv=function(){I.user.azkaban.isOkDomains&&/\/subscription\//.test(window.location.href)&&(Ss(I.GDPR.nameCookieUID),window.location.href=I.user.userRoutes.loginPage)},$t=function(){if(this._roles={},document.location.host==="cms.nhfp.org"){this._roles.reg={name:"REG",ts:new Date().getTime()},this._roles.spu={name:"SPU",ts:new Date().getTime()},this._roles.sus={name:"SUS",ts:new Date().getTime()};return}Hb.apply(this),Vb.apply(this)},Hb=function(){try{this.dataUser=dv(dr("juid")||""),P(["jeeiSite.user.User>_prepareDataCookie>","Preparando los datos de la cookie",this.dataUser],We)}catch(i){return!1}},Vb=function(){if(!this.dataUser.products||Object.entries(this.dataUser.products).length===0)return this._roles.an=!0,P(["jeeiSite.hp.User>_processRoles>","El usuario es an\xF3nimo"],We),!0;Kb.apply(this)},Kb=function(){P(["jeeiSite.user.User>_detectProductsRoles>"],We);var i=Math.floor(Date.now()/1e3),t,e,r;for(var a in this.dataUser.products)if(r=this.dataUser.products[a],r)switch(a){case"SUS":t=r,r>=i?this._roles.sus={name:a,ts:r}:this._roles.susp={name:a,ts:r};break;case"SUE":t=this.dataUser.products[a],e=r,t===e&&e>=i?this._roles.sue={name:a,ts:r}:this._roles.suep={name:a,ts:r};break;case"SUI":r>=i?this._roles.sui={name:a,ts:r}:this._roles.suip={name:a,ts:r};break;case"REG":this._roles.reg={name:a,ts:r};break;case"STK":this._roles.st={name:a,ts:r};break;case"REI":this._roles.rei={name:a,ts:r};break;case"SPU":this._roles.spu={name:a,ts:r};break;case"CUL":r>=i&&(this._roles.cul={name:a,ts:r});break;case"CULW":r>=i&&(this._roles.culw={name:a,ts:r});break;case"SCG":r>=i&&(this._roles.scg={name:a,ts:r});break;case"SCV":r>=i&&(this._roles.scv={name:a,ts:r});break}P(["jeeiSite.user.User>_detectProductsRoles>","El usuario dispone de los siguientes productos/roles: ",this._roles],We)},Wb=function(i){var t;P(["jeeiSite.user.User>_detectProductsRoles>","Realizando comprobaci\xF3n de un producto determinado: ".concat(i)],We);var e=((t=this.dataUser.products)===null||t===void 0?void 0:t[i])!==void 0?!0:null;return P(["jeeiSite.user.User>_detectProductsRoles>
1","Estado de producto ".concat(i,": ").concat(e)],We),e},qb=function(){switch(Ul){case Kr.DESKTOP:return se.DEVICE_DESKTOP;case Kr.MOBILE:return I.isApp?se.DEVICE_MOBILE_APP:se.DEVICE_MOBILE;case Kr.TABLET:return I.isApp?se.DEVICE_TABLET_APP:se.DEVICE_TABLET;default:return se.DEVICE_DESKTOP}}});function mv(n,i){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);i&&(e=e.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,e)}return t}function Yb(n){for(var i=1;i<arguments.length;i++){var t=arguments[i]!=null?arguments[i]:{};i%2?mv(Object(t),!0).forEach(function(e){V(n,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):mv(Object(t)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})}return n}var gv,pu,yv,zb,Jb,_v,mu=W(function(){T();vt();Pr();Ge();J();X();Xt();_e();dt();gv=!1,pu=null,yv=function(){function n(){k(this,n)}return A(n,[{key:"trackPageView",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=t.params,r=e===void 0?{}:e;if(!I.stats.citiServi.disabled&&I.stats.isOkDomains){var a=encodeURIComponent(window.location.href),s="; ".concat(document.cookie).split("; _btrid=").pop().split(";").shift();Jb.apply(this,[Yb({ref:a,bt:s,mode:2,p:"iu3yfn9q",sid:8032},r)])}}}],[{key:"getInstance",value:function(){return pu||(pu=new n),pu}}]),n}(),zb=function(i){for(var t=new URLSearchParams,e=function(){var o=Te(a[r],2),l=o[0],u=o[1];Array.isArray(u)?u.forEach(function(c){t.append(l,c)}):pe(u)==="object"?Object.values(u).forEach(function(c){t.append(l,c)}):t.append(l,u)},r=0,a=Object.entries(i);r<a.length;r++)e();return t.toString()},Jb=function(i){var t=se.getInstance();if(!gv){var e=new Ke,r=t.getHashedEmail(),a=zb(i),s="https://dmp.citiservi.es/pxtrack.js";a&&(s+="?".concat(a)),r&&r.length&&(s+="".concat(a?"&":"?","id=").concat(r)),e.load(s,!0,!1),gv=!0}},_v=function(){var i=decodeURIComponent("; ".concat(document.cookie)).split("; ").find(function(t){return t.startsWith("btrseg=")});return i?i.split("=")[1].split(","):[]}});function Ar(n,i){var t,e=nr(Q.getSections());return(t=e.reverse().reduce(function(r,a){return r||(n==null?void 0:n[a.id])},null))!==null&&t!==void 0?t:i}var ln=W(function(){T();tn();$e()});function Ev(n,i){var t=typeof Symbol!="undefined"&&n[Symbol.iterator]||n["@@iterator"];if(!t){if(Array.isArray(n)||(t=Xb(n))||i&&n&&typeof n.length=="number"){t&&(n=t);var e=0,r=function(){};return{s:r,n:function(){return e>=n.length?{done:!0}:{done:!1,value:n[e++]}},e:function(u){throw u},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){t=t.call(n)},n:function(){var u=t.next();return s=u.done,u},e:function(u){o=!0,a=u},f:function(){try{s||t.return==null||t.return()}finally{if(o)throw a}}}}function Xb(n,i){if(n){if(typeof n=="string")return Sv(n,i);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Sv(n,i):void 0}}function Sv(n,i){(i==null||i>n.length)&&(i=n.length);for(var t=0,e=Array(i);t<i;t++)e[t]=n[t];return e}var gu,or,un=W(function(){T();vt();J();X();Ge();$e();_e();mu();ln();dt();gu=null,or=function(){function n(){k(this,n),V(this,"_isSectionBrandedAd",!1),V(this,"_isBrandedImage",!1),V(this,"_isBrandedAdGpt",!1),this._excludedInImages(),this._detectSectionBranded()}return A(n,[{key:"reload",value:function(){this._isSectionBrandedAd=!1,this._isBrandedImage=!1,this._isBrandedAdGpt=!1,this._excludedInImages(),this._detectSectionBranded()}},{key:"isFreeIntrusiveAdvertising",value:function(){var t,e=!1,r=Q.getSections();for(var a in r){var s=r[a];I.ad.freeIntrusiveAdvertising.ids.indexOf(s.id)>-1&&(e=!0)}return Q.getType()==="historia_edicion"&&(e=!0),((t=globalThis.jeefConfig)===null||t===void 0||(t=t.ad)===null||t===void 0||(t=t.TemporalEnableExepcitonForAdGpt)===null||t===void 0?void 0:t.enable)===!0&&(e=!0),e}},{key:"mustHaveAds",value:function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,r=I.ad.formats[t],a=Ar(r,r==null?void 0:r.default),s=pe(a)==="object"?a==null?void 0:a.provider:a;if(!s||this.is404Page()||(this.isCriticalTag()||this.isCriticalTagFromHashTag())&&s!==I.ad.formats.providers.ADVIDOOMY)return!1;var o=this._evaluateProviderConditions(s,e);return o?a:!1}},{key:"_evaluateProviderConditions",value:function(t,e){var r=I.ad.formats.providers,a=this.isSectionBrandedAd(),s=this.shouldServeGptExclusively(),o=this.hasNativeAds(),l=this.isFreeIntrusiveAdvertising(),u=this.isInImageBrandedAd(),c=this.isBrandedAdGpt(),f=Q.getSlugHashTags().includes("/temas/marcas_destacadas/"),d=I.ad.intrusiveAdsOnSubscriberContent===!0,h=(I.ad.adUser.disable||!se.getInstance().isAnySubscriber())&&(d||!Q.isSuscriberContent()),v=I.ad.hideTaboolaForRegistered===!0&&se.getInstance().isRegisteredEE();switch(t){case r.ADDOOR:case r.OUTBRAIN:case r.ADGAGE:case r.MEMBRANA:case r.BRNDTS:case r.ADVIDOOMY:case r.EXCO:case r.GOOGLE_CSA:case r.OPTIDIGITAL:return h&&!a&&!s&&!l;case r.TABOOLA:return h&&!a&&!s&&!l&&!v;case r.SUNMEDIA:return h&&!a&&o&&!l&&!s;case r.SEEDTAG:return h&&!a&&o&&!s&&!l&&!u&&!f;case r.GPT:return e===I.ad.gpt.position.STICKY?h&&!c&&!l:!c;default:return!1}}},{key:"isSectionBrandedAd",value:function(){return this._isSectionBrandedAd}},{key:"isBrandedAdGpt",value:function(){return this._isBrandedAdGpt}},{key:"isInImageBrandedAd",value:function(){return this._isBrandedImage}},{key:"hasSpecialTag",value:function(){return this._hasTag("Marcas_N")}},{key:"hasNativeAds",value:function(){return!this._hasTag("ads_interno_no_native_ads")}},{key:"is404Page",value:function(){var t;return Q.getType()=="404"||((t=I.content)===null||t===void 0||(t=t.data)===null||t===void 0?void 0:t.type)=="404"}},{key:"isCriticalTag",value:function(){var t,e,r=(t=Q.getMain)===null||t===void 0?void 0:t.call(Q),a=(e=r==null?void 0:r.filtercontenthashtag)!==null&&e!==void 0?e:[];return a.includes("Contenido_critico")}},{key:"_hasTag",value:function(t){var e,r,a=(e=Q.getMain)===null||e===void 0?void 0:e.call(Q),s=(r=a==null?void 0:a.hashtags)!==null&&r!==void 0?r:"";return s.split(",").includes(t)}},{key:"isCriticalTagFromHashTag",value:function(){return this._hasTag("Contenido_critico")}},{key:"isSensibleContent",value:function(){return this._hasTag("Contenido_sensible")}},{key:"_detectSectionBranded",value:function(){var t,e,r=Q.get(Q.getMainId());
1if(r){if(this.hasSpecialTag()){this._isSectionBrandedAd=!0,this._isBrandedAdGpt=!0;return}var a=r.sectionIds||[],s=r.section||[],o=(t=I.dyn.addevwebJS)===null||t===void 0?void 0:t.discardSectionsAndTags;o&&this._checkDiscardedSectionsAndTags(o,a,s)&&(this._isSectionBrandedAd=!0);var l=(e=I.ad.gpt)===null||e===void 0?void 0:e.discardSectionsAndTagsGpt;l&&this._checkDiscardedSectionsAndTags(l,a,s)&&(this._isBrandedAdGpt=!0)}}},{key:"_checkDiscardedSectionsAndTags",value:function(t,e,r){var a=Ar(t,t==null?void 0:t.default);if(Array.isArray(a)){var s=Ev(a),o;try{var l=function(){var f=o.value;if(e.some(function(d){return Number(d)===f})||r.some(function(d){return d.id===f}))return{v:!0}},u;for(s.s();!(o=s.n()).done;)if(u=l(),u)return u.v}catch(c){s.e(c)}finally{s.f()}}return!1}},{key:"shouldServeGptExclusively",value:function(){var t=_v()||[];if(t.length===0)return!1;var e=I.ad.exclusiveSegments||[];return e.some(function(r){return t.includes(r)})}},{key:"_excludedInImages",value:function(){var t=I.ad.formats.inImage.exceptionTags||[],e=[Q.getSectionId()],r=Ev(t),a;try{for(r.s();!(a=r.n()).done;){var s=a.value;if(e.includes(s)){this._isBrandedImage=!0;break}}}catch(o){r.e(o)}finally{r.f()}}}],[{key:"getInstance",value:function(){return gu||(gu=new n),gu}}]),n}()});function bk(n,i,t){return i=w(i),q(n,xv()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function xv(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(xv=function(){return!!n})()}var Us,Pv=W(function(){T();X();J();ue();oe();le();Ge();sr();Us=function(n){B(i,n);function i(){k(this,i);for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return bk(this,i,[].concat(e))}return A(i)}(Qe);V(Us,"ON_GOOGLE_ANALYTICS_LOAD","onGoogleAnalyticsLoad")});function kk(n,i,t){return i=w(i),q(n,Mv()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function Mv(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Mv=function(){return!!n})()}var Dv,Bs,It,Ak,cn,Ik,Hn,Ck,Lk,Rk,Ok,Gi=W(function(){T();Pr();J();X();ue();oe();le();_e();mt();Pv();$e();dt();mr();$e();Dv=!1,Bs=null,It=function(n){B(i,n);function i(){var t;return k(this,i),t=kk(this,i),t._property=null,t._value=null,t._dynamicData={},t}return A(i,[{key:"init",value:function(e,r){this._dynamicData=e,!I.stats.analytics.disabled&&I.stats.isOkDomains&&cn.apply(this,[r,!0])}},{key:"pageView",value:function(e){!I.stats.analytics.disabled&&I.stats.isOkDomains&&cn.apply(this,[e,!0])}},{key:"set",value:function(e,r){this._property=e,this._value=r}},{key:"setDynamicData",value:function(e){this._dynamicData=e}},{key:"track",value:function(e,r){!I.stats.analytics.disabled&&I.stats.isOkDomains&&(cn.apply(this,[r,!0]),ga("send","event",e[0],e[1],r||window.location.pathname,0),ga("DATALAKE.send","event",e[0],e[1],r||window.location.pathname,0),Q.getSectionId()===I.sectionsIds.castillalamancha&&ga("CLM.send","event",e[0],e[1],r||window.location.pathname,0),Q.getSectionId()===I.sectionsIds.castillayleon&&ga("CYL.send","event",e[0],e[1],r||window.location.pathname,0),Q.getSectionId()===I.sectionsIds.elcultural&&ga("CUL.send","event",e[0],e[1],r||window.location.pathname,0)
1)}},{key:"simpleTrack",value:function(e){!I.stats.analytics.disabled&&I.stats.isOkDomains&&(cn.apply(this,[null,!1]),ga("send","event",e[0],e[1],e[2],0),ga("DATALAKE.send","event",e[0],e[1],e[2],0),Q.getSectionId()===I.sectionsIds.castillalamancha&&ga("CLM.send","event",e[0],e[1],e[2],0),Q.getSectionId()===I.sectionsIds.castillayleon&&ga("CYL.send","event",e[0],e[1],e[2],0),Q.getSectionId()===I.sectionsIds.elcultural&&ga("CUL.send","event",e[0],e[1],e[2],0))}},{key:"simpleTrackWithCallback",value:function(e,r){!I.stats.analytics.disabled&&I.stats.isOkDomains&&(cn.apply(this,[null,!1]),ga("send","event",e[0],e[1],e[2],{hitCallback:r}),ga("DATALAKE.send","event",e[0],e[1],e[2],{hitCallback:r}),Q.getSectionId()===I.sectionsIds.castillalamancha&&ga("CLM.send","event",e[0],e[1],e[2],{hitCallback:r}),Q.getSectionId()===I.sectionsIds.castillayleon&&ga("CYL.send","event",e[0],e[1],e[2],{hitCallback:r}),Q.getSectionId()===I.sectionsIds.elcultural&&ga("CUL.send","event",e[0],e[1],e[2],{hitCallback:r}))}},{key:"webVitalsEventTrack",value:function(e){var r=e.name,a=e.delta,s=e.id,o=e.entries,l=e.value,u=e.rating,c=e.debugInfo;if(!I.stats.analytics.disabled&&I.stats.isOkDomains){var f;switch(dr("cdn")){case"ftly":f="_ftly";break;case"tr2":f="_tr2";break;default:f="";break}cn.apply(this,[null,!1]);var d={eventCategory:"Web Vitals".concat(f),eventAction:r,eventValue:Math.round(r==="CLS"?a*1e3:a),eventLabel:s,nonInteraction:!0,transport:"beacon",dimension7:u,dimension8:c};ga("send","event",d),ga("DATALAKE.send","event",d),Q.getSectionId()===I.sectionsIds.castillalamancha&&ga("CLM.send","event",d),Q.getSectionId()===I.sectionsIds.castillayleon&&ga("CYL.send","event",d),Q.getSectionId()===I.sectionsIds.elcultural&&ga("CUL.send","event",d)}}},{key:"cleanCookies",value:function(e){if(!I.stats.analytics.disabled&&I.stats.isOkDomains){cn.apply(this,[null,!1]);var r={eventCategory:"Cookies",eventAction:"clear",eventValue:e};ga("send","event",r),ga("DATALAKE.send","event",r),Q.getSectionId()===I.sectionsIds.castillalamancha&&ga("CLM.send","event",r),Q.getSectionId()===I.sectionsIds.castillayleon&&ga("CYL.send","event",r),Q.getSectionId()===I.sectionsIds.elcultural&&ga("CUL.send","event",r)}}},{key:"getDataSendAnalytics",value:function(){var e={};if(Q.getMainId()&&(Q.getAuthor()&&(e.dimension1=Q.getAuthor()),Q.getContentType()&&(e.dimension2=Q.getSectionName(),Q.getProductionSection()&&(e.dimension2=Q.getProductionSection()),Q.getSectionName()&&(e.dimension3=Q.getSectionName()),e.dimension2||e.dimension3))){var r=se.getInstance().getRoleForGpt(),a;if(r){switch(r){case"anonimo":a="Anonymous";break;case"suscriptorEspecPromo":case"suscriptorAutoPromo":a="Subscriber";break;case"registrado":a="Registered";break}a&&(e.dimension5=a,Q.isSuscriberContent()?e.dimension6="Closed":e.dimension6="Open")}}return e}}],[{key:"getInstance",value:function(){return Bs||(Bs=new i),Bs}}]),i}(Re),Ak=function(){Bs.dispatchEvent(new Us(Us.ON_GOOGLE_ANALYTICS_LOAD))},cn=function(i,t){Dv||(function(e,r,a,s,o,l,u){e.GoogleAnalyticsObject=o,e[o]=e[o]||function(){(e[o].q=e[o].q||[]).push(arguments)},e[o].l=1*new Date,l=r.createElement(a),u=r.getElementsByTagName(a)[0],l.async=1,l.src=s,l.onload=Ak,u.parentNode.insertBefore(l,u)}(window,document,"script","//www.google-analytics.com/analytics.js","ga"),Ik(),Dv=!0),Ck.apply(this),Lk.apply(this),t===!0&&Rk.apply(this,[i]),Ok.apply(this,[se.getInstance().getUid()])},Ik=function(){ga("create",I.stats.analytics.all,"auto");for(var i=0,t=Object.entries(I.stats.analytics.uas);i<t.length;i++){var e=Te(t[i],2),r=e[0],a=e[1];parseInt(r,10)==Q.getSectionId()&&ga("create",a,"auto",r)}for(var s=0,o=Object.entries((l=I.stats.analytics.uas)===null||l===void 0?void 0:l.default);s<o.length;s++){var l,u=Te(o[s],2),c=u[0],f=u[1];ga("create",f,"auto",c)}},Hn=function(i){for(var t=arguments.length,e=new Array(t>1?t-1:0),r=1;r<t;r++)e[r-1]=arguments[r];ga.apply(void 0,[i].concat(e));for(var a=0,s=Object.entries(I.stats.analytics.uas);a<s.length;a++){var o=Te(s[a],2),l=o[0],u=o[1];parseInt(l,10)===Q.getSectionId()&&ga.apply(void 0,["".concat(l,".").concat(i)].concat(e))}for(var c=0,f=Object.entries(I.stats.analytics.uas.default);c<f.length;c++){var d=Te(f[c],2),h=d[0],v=d[1];ga.apply(void 0,["".concat(h,".").concat(i)].concat(e))}},Ck=function(){this._property!==null&&this._value!==null&&(Hn("set",this._property,this._value),this._property=null,this._value=null)},Lk=function(){if(Object.keys(this._dynamicData).length>0){for(var i in this._dynamicData)Hn("set",i,this._dynamicData[i]);this._dynamicData={}}},Rk=function(i){typeof i!="undefined"&&Hn("set","page",i),Hn("send","pageview")},Ok=function(i){Hn("set","userId",i),Hn("send","event","authentication","user-id available")}});function wk(n,i,t){return i=w(i),q(n,Nv()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function Nv(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Nv=function(){return!!n})()}var Tu,Da,bu=W(function(){T();J();X();ue();oe();le();mt();Xt();ze();Ut();_e();ln();mr();Tu=null,Da=function(n){B(i,n);function i(){var t;return k(this,i),t=wk(this,i),t._url="https://www.googletagmanager.com/gtag/js?i
1d=",t}return A(i,[{key:"init",value:function(){var e=this,r=I.stats.analytics.uasGA4,a=Ar(r,r.default||[]);a.forEach(function(s){s&&e._onLoadGA4(s)})}},{key:"webVitalsEventTrack",value:function(e,r){!I.stats.analytics.disabled&&I.stats.isOkDomains&&(r.cdn=dr("cdn"),window.gtag("event",e,r))}},{key:"_onLoadGA4",value:function(e){var r=this,a=new Ke;a.load(this._url+e,!0,!0),ie(a,he.ON_IO_FINISH,function(){r._addDL(e)},this)}},{key:"_addDL",value:function(e){window.dataLayer=window.dataLayer||[];function r(){dataLayer.push(arguments)}r("js",new Date),r("config",e)}}],[{key:"getInstance",value:function(){return Tu||(Tu=new i),Tu}}]),i}(Re)});function xk(n,i,t){return i=w(i),q(n,Fv()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function Fv(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Fv=function(){return!!n})()}var ku,Uv,Bv=W(function(){T();J();X();ue();oe();le();mt();_e();$e();ku=null,Uv=function(n){B(i,n);function i(){var t;return k(this,i),t=xk(this,i),t._url="elep.spxl.socy.es",t}return A(i,[{key:"init",value:function(){if(I.stats.analytics.besocy){var e=I.stats.analytics.besocy[Q.getSectionId()]||I.stats.analytics.besocy.default;this._onLoad(document,"script","dogtrack-pixel",this._url,e)}}},{key:"_onLoad",value:function(e,r,a,s,o){var l=e.getElementsByTagName(r)[0];if(!e.getElementById(a)){var u=e.createElement("script");u.id=a,u.async=1,u.h=s,u.t=o;var c=encodeURI(btoa(e.referrer));u.src="//"+s+"/pixel/js/"+o+"/"+c,l.parentNode.insertBefore(u,l)}}}],[{key:"getInstance",value:function(){return ku||(ku=new i),ku}}]),i}(Re)});function Pk(n,i,t){return i=w(i),q(n,Gv()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function Gv(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Gv=function(){return!!n})()}var ji,Au=W(function(){T();X();J();ue();oe();le();Ge();sr();ji=function(n){B(i,n);function i(){k(this,i);for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Pk(this,i,[].concat(e))}return A(i)}(Qe);V(ji,"ON_COMSCORE_LOAD","onComscoreLoad")});function Dk(n,i,t){return i=w(i),q(n,Vv()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function Vv(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Vv=function(){return!!n})()}var Kv,Mk,jv,Iu,Yr,Hv,Nk,Fk,Uk,Bk,Gk,Vn=W(function(){T();J();X();ue();oe();le();Se();_e();Bt();Ut();Xt();ze();mt();Au();Kv="COMSCORE";ne(Kv);Mk=window._comscore=window._comscore||[],jv=!1,Iu=null,Yr=function(n){B(i,n);function i(){return k(this,i),Dk(this,i,arguments)}return A(i,[{key:"track",value:function(e,r){if(!I.stats.comscore.disabled&&I.stats.isOkDomains){var a=I.stats.comscore.firstParty,s=Hv(e,r,a);Mk.push(s),Uk.apply(this)}}},{key:"reTrack",value:function(e,r){if(!I.stats.comscore.disabled&&I.stats.isOkDomains){var a=I.stats.comscore.firstParty,s=Hv(e,r,a);window.COMSCORE&&window.COMSCORE.beacon&&window.COMSCORE.beacon(s)}}},{key:"pageViewCandidate",value:function(){if(!I.stats.comscore.disabled&&I.stats.isOkDomains){var e=Nr(Qt.TEXT);e.listen(he.ON_IO_FINISH,Nk,this),e.listen(he.ON_IO_ERROR,Fk,this),e.open(I.stats.comscore.pageCandidate,Wr.GET),e.send()}}}],[{key:"getInstance",value:function(){return Iu||(Iu=new i),Iu}}]),i}(Re),Hv=function(i,t,e){var r={c1:i,c2:t};if(window.Didomi&&typeof window.Didomi.getUserConsentStatusForVendor(77)=="undefined")r={c1:i,c2:t};else{var a;(a=window.Didomi)!==null&&a!==void 0&&a.getUserConsentStatusForVendor(77)?r.cs_ucfr=1:r.cs_ucfr=0}return e&&(r.options=r.options||{},r.options.enableFirstPartyCookie=!0),r},Nk=function(i){i.response.indexOf("pageview_candidate")!==-1&&this.reTrack(I.stats.comscore.c1,I.stats.comscore.c2)},Fk=function(i){Dt(["jeeiSite.stats.px.comscore>_onPageCandidateError>","Error en la petici\xF3n PageViewCandidate",i],Kv)},Uk=function(){if(!jv){var i=new Ke,t=I.stats.comscore.c2,e="".concat(document.location.protocol==="https:"?"https://sb":"http://b",".scorecardresearch.com/cs/").concat(t,"/beacon.js");ie(i,he.ON_IO_FINISH,Gk,this),ie(i,he.ON_IO_ERROR,Bk,this),i.load(e,!0,!0),jv=!0}},Bk=function(){this.dispatchEvent(new ji(ji.ON_COMSCORE_LOAD))},Gk=function(){this.dispatchEvent(new ji(ji.ON_COMSCORE_LOAD))}});var Gs,qv,Cu,Wv,Yv,zv=W(function(){T();J();X();_e();Gs=!1,Cu=function(){function n(){k(this,n)}return A(n,null,[{key:"init",value:function(t){!I.stats.facebook.disabled&&I.stats.isOkDomains&&(qv=t,Gs||Wv())}},{key:"track",value:function(t,e){!I.stats.facebook.disabled&&I.stats.isOkDomains&&(Gs||Wv(),Yv(t,e))}}]),n}(),Wv=function(){Gs||(function(i,t,e,r,a,s,o){i.fbq||(a=i.fbq=function(){a.callMethod?a.callMethod.apply(a,arguments):a.queue.push(arguments)},i._fbq||(i._fbq=a),a.push=a,a.loaded=!0,a.version="2.0",a.queue=[],s=t.createElement(e),s.async=!0,s.src=r,o=t.getElementsByTagName(e)[0],o.parentNode.insertBefore(s,o))}(window,document,"script","//connect.facebook.net/en_US/fbevents.js"),Gs=!0,window.fbq("init",qv),Yv("PageView"))},Yv=function(i,t){if(t){window.fbq("track",i,t);return}window.fbq("track",i)}});
vendor: 4,574 bytes, line 1
1var Ou,wu,jk,Hk,Vk,ep,Kk,Wk,qk,Jv,tp,Xv,Yk,zk,rp,Lu,js,Jk,ip,Xk,Qv,np,$v,ri,Ru,Zv,Qk,ap,sp=W(function(){T();wu=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},jk=function(i){if(document.readyState==="loading")return"loading";var t=wu();if(t){if(i<t.domInteractive)return"loading";if(t.domContentLoadedEventStart===0||i<t.domContentLoadedEventStart)return"dom-interactive";if(t.domComplete===0||i<t.domComplete)return"dom-content-loaded"}return"complete"},Hk=function(i){var t=i.nodeName;return i.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},Vk=function(i,t){var e="";try{for(;i&&i.nodeType!==9;){var r=i,a=r.id?"#"+r.id:Hk(r)+(r.classList&&r.classList.value&&r.classList.value.trim()&&r.classList.value.trim().length?"."+r.classList.value.trim().replace(/\s+/g,"."):"");if(e.length+a.length>(t||100)-1)return e||a;if(e=e?a+">"+e:a,r.id)break;i=r.parentNode}}catch(s){}return e},ep=-1,Kk=function(){return ep},Wk=function(i){addEventListener("pageshow",function(t){t.persisted&&(ep=t.timeStamp,i(t))},!0)},qk=function(){var i=wu();return i&&i.activationStart||0},Jv=function(i,t){var e=wu(),r="navigate";return Kk()>=0?r="back-forward-cache":e&&(document.prerendering||qk()>0?r="prerender":document.wasDiscarded?r="restore":e.type&&(r=e.type.replace(/_/g,"-"))),{name:i,value:t===void 0?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},tp=function(i,t,e){try{if(PerformanceObserver.supportedEntryTypes.includes(i)){var r=new PerformanceObserver(function(a){Promise.resolve().then(function(){t(a.getEntries())})});return r.observe(Object.assign({type:i,buffered:!0},e||{})),r}}catch(a){}},Xv=function(i,t,e,r){var a,s;return function(o){t.value>=0&&(o||r)&&((s=t.value-(a||0))||a===void 0)&&(a=t.value,t.delta=s,t.rating=function(l,u){return l>u[1]?"poor":l>u[0]?"needs-improvement":"good"}(t.value,e),i(t))}},Yk=function(i){var t=function(r){r.type!=="pagehide"&&document.visibilityState!=="hidden"||i(r)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},zk=function(i){document.prerendering?addEventListener("prerenderingchange",function(){return i()},!0):i()},rp=0,Lu=1/0,js=0,Jk=function(i){i.forEach(function(t){t.interactionId&&(Lu=Math.min(Lu,t.interactionId),js=Math.max(js,t.interactionId),rp=js?(js-Lu)/7+1:0)})},ip=function(){return Ou?rp:performance.interactionCount||0},Xk=function(){"interactionCount"in performance||Ou||(Ou=tp("event",Jk,{type:"event",buffered:!0,durationThreshold:0}))},Qv=[200,500],np=0,$v=function(){return ip()-np},ri=[],Ru={},Zv=function(i){var t=ri[ri.length-1],e=Ru[i.interactionId];if(e||ri.length<10||i.duration>t.latency){if(e)e.entries.push(i),e.latency=Math.max(e.latency,i.duration);else{var r={id:i.interactionId,latency:i.duration,entries:[i]};Ru[r.id]=r,ri.push(r)}ri.sort(function(a,s){return s.latency-a.latency}),ri.splice(10).forEach(function(a){delete Ru[a.id]})}},Qk=function(i,t){t=t||{},zk(function(){var e;Xk();var r,a=Jv("INP"),s=function(u){u.forEach(function(d){d.interactionId&&Zv(d),d.entryType==="first-input"&&!ri.some(function(h){return h.entries.some(function(v){return d.duration===v.duration&&d.startTime===v.startTime})})&&Zv(d)});var c,f=(c=Math.min(ri.length-1,Math.floor($v()/50)),ri[c]);f&&f.latency!==a.value&&(a.value=f.latency,a.entries=f.entries,r())},o=tp("event",s,{durationThreshold:(e=t.durationThreshold)!==null&&e!==void 0?e:40});r=Xv(i,a,Qv,t.reportAllChanges),o&&("PerformanceEventTiming"in window&&"interactionId"in PerformanceEventTiming.prototype&&o.observe({type:"first-input",buffered:!0}),Yk(function(){s(o.takeRecords()),a.value<0&&$v()>0&&(a.value=0,a.entries=[]),r(!0)}),Wk(function(){ri=[],np=ip(),a=Jv("INP"),r=Xv(i,a,Qv,t.reportAllChanges)}))})},ap=function(i,t){Qk(function(e){(function(r){if(r.entries.length){var a=r.entries.sort(function(o,l){return l.duration-o.duration||l.processingEnd-l.processingStart-(o.processingEnd-o.processingStart)})[0],s=r.entries.find(function(o){return o.target});r.attribution={eventTarget:Vk(s&&s.target),eventType:a.name,eventTime:a.startTime,eventEntry:a,loadState:jk(a.startTime)}}else r.attribution={}})(e),i(e)},t)}});function op(n,i){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);i&&(e=e.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,e)}return t}function lp(n){for(var i=1;i<arguments.length;i++){var t=arguments[i]!=null?arguments[i]:{};
1i%2?op(Object(t),!0).forEach(function(e){V(n,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):op(Object(t)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})}return n}function Zk(n){var i=Da.getInstance(),t=n.name||"WebVitals",e={value:n.value,rating:eA(n.value,$k[n.name]),navigation_type:n.navigationType,category:"Web Vitals"};try{var r=tA({name:n.name,entries:n.entries,attribution:n.attribution});pe(r)==="object"?e=lp(lp({},e),r):typeof r=="string"&&(e.debug_info=r)}catch(a){console.warn(a)}i.webVitalsEventTrack(t,e),P([[t,n.value,e,n]],up)}function eA(n,i){return n>i[1]?"poor":n>i[0]?"ni":"good"}function tA(n){var i,t,e,r,a,s=n.name,o=n.entries,l=o===void 0?[]:o,u=n.attribution,c=l[0],f=l[l.length-1];switch(s){case"LCP":if(f)return Hs(f==null?void 0:f.element);break;case"FID":if(c){var d,h=c.name;return c!=null&&(d=c.target)!==null&&d!==void 0&&d.closest("#google-signin2")?"".concat(h,":#google-signin2"):"".concat(h,":").concat(Hs(c.target))}break;case"CLS":if(l.length){var v=l.reduce(function(g,E){return g&&g.value>E.value?g:E});if(v&&v.sources){var m=v.sources.reduce(function(g,E){var y,_,b,C;return g.node&&((y=g.previousRect)===null||y===void 0?void 0:y.width)*((_=g.previousRect)===null||_===void 0?void 0:_.height)>((b=E.previousRect)===null||b===void 0?void 0:b.width)*((C=E.previousRect)===null||C===void 0?void 0:C.height)?g:E});
1if(m)return Hs(m.node)}}break;case"INP":var p=new Error().stack.replaceAll("at ","").split("\n").map(function(g){return g.trim()}).slice(-4);return{starter_scripts:p.join(";"),starter:(i=p.pop().match(/https?:\/\/[^\s?:]+/))===null||i===void 0?void 0:i[0],target:(u==null?void 0:u.eventTarget)||rA((t=l.find(function(g){return!!g.target}))===null||t===void 0?void 0:t.target)||"(none)",action:(u==null||(e=u.eventEntry)===null||e===void 0?void 0:e.name)||"(none)",start_time:Math.round((u==null||(r=u.eventEntry)===null||r===void 0?void 0:r.startTime)||0),interaction_id:u==null||(a=u.eventEntry)===null||a===void 0?void 0:a.interactionId};default:return"(not set)"}}function Hs(n,i){try{var t=n.nodeName.toLowerCase();return t==="body"?"html>body":n.id?"".concat(t,"#").concat(n.id):(n.className.length&&(t+=".".concat(nr(n.classList.values()).join("."))),"".concat(Hs(n.parentElement),">").concat(t))}catch(e){return"(error)"}}function rA(n){if(!n||!(n instanceof Element))return null;if(n.id)return"#".concat(n.id);for(var i=[],t=n;t.nodeType===Node.ELEMENT_NODE;){var e=t.nodeName.toLowerCase();t.className&&(e+="."+t.className.trim().replace(/\s+/g,"."));var r=Array.from(t.parentNode.children),a=r.indexOf(t);if(r.length>1&&a>=0&&(e+=":nth-child(".concat(a+1,")")),i.unshift(e),t=t.parentNode,t===document)break}return i.join(" > ")}var up,xu,Pu,$k,cp=W(function(){T();tn();Ge();vt();J();X();Se();bu();sp();Sn();_e();up="WEBVITALS";ne(up);Pu=function(){function n(){k(this,n)}return A(n,[{key:"track",value:function(){!I.stats.webvitals.disabled&&!I.stats.analytics.disabled&&I.stats.isOkDomains&&(Ri()||ap(Zk,{reportAllChanges:!0}))}}],[{key:"getInstance",value:function(){return xu||(xu=new n),xu}}]),n}(),$k={CLS:[.1,.25],FCP:[1800,3e3],FID:[100,300],LCP:[2500,4e3],INP:[200,400]}});var iA,fp,dp=W(function(){T();J();X();_e();ln();iA=function(){function n(){k(this,n)}return A(n,[{key:"init",value:function(){!I.stats.pixel.disabled&&I.stats.isOkDomains&&this.facebook()}},{key:"facebook",value:function(){var t,e=Ar(I.stats.pixel,I.stats.pixel.default);if(e){t=e;var r=document.createElement("img");r.src=t,r.setAttribute("alt","FB"),r.setAttribute("height","1"),r.setAttribute("width","1"),document.body.appendChild(r)}}}]),n}(),fp=new iA});function hp(n,i){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);i&&(e=e.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,e)}return t}function vp(n){for(var i=1;i<arguments.length;i++){var t=arguments[i]!=null?arguments[i]:{};i%2?hp(Object(t),!0).forEach(function(e){V(n,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):hp(Object(t)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})}return n}var pp,mp,nA,Du,Vs,aA,Mu=W(function(){T();Ge();J();X();Se();_e();$e();pt();pt();Sn();ln();pp="GFK";ne(pp);mp=window.gfkS2s={},nA=!1,Vs=function(){function n(){k(this,n),aA()}return A(n,[{key:"track",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!I.stats.gfk.disabled){var r=window.location.hostname,a=window.location.hostname.match(/^((pre-|int-|local-)?)www\.(elespanol|redaccionmedica)\.com/);if(a){var s="iOS";I.isApp?ka()===s?r=I.stats.gfk.cp1DefaultAppIOS:r=I.stats.gfk.cp1DefaultApp:r=I.stats.gfk.cp1Default}var o={c1:r,c2:e||Q.getSection().name},l=mp.getAgent(),u=vp(vp({},t),o);zt(["Stats > GFK Custom params",u],pp),l.impression("default",u)}}}],[{key:"getInstance",value:function(){return Du||(Du=new n),Du}}]),n}(),aA=function(){if(!nA){var i=null,t=I.stats.gfk;try{var e=Ar(t.idBySection,t);i=e.mediaID}catch(u){i=t.mediaID,console.info("Error fetching sections:",u)}var r={media:i,url:I.isApp&&Ri()==="3.7.0"?I.stats.gfk.urlPre:I.stats.gfk.url,type:"WEB",logLevel:"none"};if(I.isApp){var a="UNKNOWN",s=ka(),o=Cd(),l="ElespanolWeb";r.type="APP",r.ai=o||"",hh?a="SMARTPHONE":Me&&(a="TABLET"),r.device=a,s==="Android"?l="ElespanolAndroid":s==="iOS"&&(l="ElespanolIos"),r.media=l,console.log("appai",r.ai)}(function(u,c,f,d,h,v){if(!c.getElementById(h)){u.gfkS2sConf=f,u[h]={},u[h].agents=[];var m=["playStreamLive","playStreamOnDemand","stop","skip","screen","volume","impression"];u.gfks=function(){function g(y,_,b){return function(){y.p=b(),y.queue.push({f:_,a:arguments})}}function E(y,_,b){for(var C={queue:[],config:y,cb:b,pId:_},R=0;R<m.length;R++){var M=m[R];C[M]=g(C,M,b)}return C}return E}(),u[h].getAgent=function(g,E){var y={a:new u.gfks(f,E||"",g||function(){return 0})};function _(R,M){return function(){return R.a[M].apply(R.a,arguments)}}for(var b=0;b<m.length;b++){var C=m[b];y[C]=_(y,C)}return u[h].agents.push(y),y};var p=function(E,y){var _=c.createElement(d),b=c.getElementsByTagName(d)[0];_.id=E,_.async=!0,_.type="text/javascript",_.src=y,b.parentNode.insertBefore(_,b)};f.hasOwnProperty(v)&&p(h+v,f[v]),p(h,f.url)}})(window,document,r,"script","gfkS2s","visUrl"),mp=window.gfkS2s}}});var ii,Ma=W(function(){T();ii={ON_CHECKOUT_COMPLETE:"on piano checkout complete",INFO_EDITIONV2_NEWS_COMPLETE:"info news complete",ON_REGISTER_COMPLETE:"on piano register complete"}});var gp,yp=W(function(){T();gp=function(i){var t=window.location.hash,e=new URLSearchParams(t.substr(1));return e.get(i)}});var _p,Nu,Ep,Sp=W(function(){T();J();X();Xt();_e();yp();_p=!1,Nu=null,Ep=function(){function n(){k(this,n)}return A(n,[{key:"loadScript",value:function(){var t=gp("enableOptimalNetwork");if(!_p&&t==="true"&&I.stats.optimalNetwork.isEnable&&I.stats.isOkDomains){var e=new Ke,r="https://servg1.net/o.js?uid=c34cac255bba16553c919872";e.load(r,!0,!1),_p=!0}}}],[{key:"getInstance",value:function(){return Nu||(Nu=new n),Nu}}]),n}()});var Tp,Fu,sA,bp,kp=W(function(){T();J();X();Xt();_e();Tp=!1,Fu=null,sA=function(){function n(){var i,t;k(this,n),this.utiqPurposeId=(i=I.stats.utiq)===null||i===void 0?void 0:i.purposeId,this.utiqVendorId=(t=I.stats.utiq)===null||t===void 0?void 0:t.vendorId}return A(n,[{key:"isConsentGranted",value:function(t){var e,r,a=t.getCurrentUserStatus(),s=!!(a!=null&&a.consent_string);if(s){var o=a==null||(e=a.purposes)===null||e===void 0||(e=e[this.utiqPurposeId])===null||e===void 0?void 0:e.enabled,l=a==null||(r=a.vendors)===null||r===void 0||(r=r[this.utiqVendorId])===null||r===void 0?void 0:r.enabled;return o===!1&&l===!1?!1:o===!0&&l!==!1}}},{key:"updateConsent",value:function(t,e){var r=this.isConsentGranted(t);if(e===!1&&r===!0){var a=t.openCurrentUserStatusTransaction();a.disablePurpose(this.utiqPurposeId),a.disableVendor(this.utiqVendorId),a.commit()}else if(e===!0&&r===!1){var s=t.openCurrentUserStatusTransaction();s.enablePurpose(this.utiqPurposeId),s.enableVendor(this.utiqVendorId),s.commit()}else if(e===void 0&&r!==void 0){var o;(o=window.Utiq)===null||o===void 0||(o=o.API)===null||o===void 0||o.handleConsentChange(r)}}},{key:"init",value:function(){var t,e=this;Tp||(t=I.stats.utiq)!==null&&t!==void 0&&t.disabled||(window.Utiq=window.Utiq||{},window.Utiq.queue=window.Utiq.queue||[],window.didomiOnReady=window.didomiOnReady||[],window.didomiEventListeners=window.didomiEventListeners||[],window.didomiOnReady.push(function(r){var a,s;(a=window.didomiEventListeners)===null||a===void 0||a.push({event:"consent.changed",listener:function(l){var u;(u=window.Utiq)===null||u===void 0||(u=u.queue)===null||u===void 0||u.push(function(){var c=e.isConsentGranted(r);if((l==null?void 0:l.action)==="click"&&c){var f;(f=window.Utiq)===null||f===void 0||(f=f.API)===null||f===void 0||f.handleConsentChange(c,{syncConsentOnAccept:!0})}else{var d;(d=window.Utiq)===null||d===void 0||(d=d.API)===null||d===void 0||d.handleConsentChange(c)}})}}),(s=window.Utiq)===null||s===void 0||(s=s.queue)===null||s===void 0||s.push(function(){var o;(o=window.Utiq)===null||o===void 0||(o=o.API)===null||o===void 0||o.addEventListener("onConsentUpdateFinished",function(c){var f=c.isConsentGranted;e.updateConsent(r,f)});try{var l;e.updateConsent(r,(l=window.Utiq)===null||l===void 0||(l=l.API)===null||l===void 0?void 0:l.getUtiqConsentStatus())}catch(c){var u=c;console.error("UTIQ: getUtiqConsentStatus API call failed. Reason: ".concat(u.message))}})}),window.Utiq.config={CMP:"none"},this.loadScript(),Tp=!0)}},{key:"loadScript",value:function(){var t,e=new Ke,r=(t=I.stats.utiq)===null||t===void 0?void 0:t.scriptUrl;e.load(r,!0,!1)}}],[{key:"getInstance",value:function(){return Fu||(Fu=new n),Fu}}]),n}(),bp=sA});var Ur,Na=W(function(){T();J();X();Ge();Gi();bu();Bv();Vn();Kn();zv();_e();cp();dp();Mu();Ma();mu();Sp();$e();pi();kp();Ur=function(){function n(){k(this,n)}return A(n,null,[{key:"init",value:function(){var t;It.getInstance().init(It.getInstance().getDataSendAnalytics()),Da.getInstance().init(),yv.getInstance().trackPageView({params:(t=Q.getMetricsData("citiservi"))===null||t===void 0?void 0:t.params}),Ep.getInstance().loadScript(),Uv.getInstance().init(),Cu.init(I.stats.facebook.all),gr.getInstance(),Pu.getInstance().track(),jeef.JeefEvents.on(ii.ON_CHECKOUT_COMPLETE,function(){Cu.track(I.stats.facebook.piano.compra1),gr.getInstance().trackConversion()}),jeef.JeefEvents.on(ii.ON_REGISTER_COMPLETE,function(){gr.getInstance().trackConversion("signup")}),fp.init(),!I.isApp&&window.location.hostname.endsWith("elespanol.com")&&bp.getInstance().init()}},{key:"trackMandatoryPixels",value:function(){Vs.getInstance().track(),Yr.getInstance().track(I.stats.comscore.c1,I.stats.comscore.c2),gr.loadCompass(!1)}},{key:"initForFlowcards",value:function(){It.getInstance().init(It.getInstance().getDataSendAnalytics()),Da.getInstance().init(),Yr.getInstance().reTrack(I.stats.comscore.c1,I.stats.comscore.c2),Pu.getInstance().track()}},{key:"trackingHandler",value:function(t,e){switch(t){case xe.ON_TRACKING_EVENTS:gr.getInstance().trackConversion(e);break;default:break}}}]),n}();V(Ur,"home",!1);Ur.home=!1});function oA(){window.marfeel.cmd.push(["compass",function(n){n.getRFV(function(i){var t=i.rfv,e="unknown";t<=1?e="new":t<=10?e="fly-by":t<=35?e="casual":t<=60?e="engaged":e="addict",window.tp=window.tp||[],window.tp.push(["setCustomVariable","compassEngagement",e])})}])}
1function Ip(n){if(!Ap){var i=function(s){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,l=document.createElement("script");l.src=s,l.defer=!0,o?l.type="module":(l.type="text/javascript",l.setAttribute("nomodule",""));var u=document.getElementsByTagName("script")[0];u.parentNode.insertBefore(l,u)},t=function(s,o,l){var u,c,f;(u=s.marfeel)!==null&&u!==void 0||(s.marfeel={}),(c=(f=s.marfeel).cmd)!==null&&c!==void 0||(f.cmd=[]),s.marfeel.config=l,s.marfeel.config.accountId=o;var d="https://sdk.mrf.io/statics";i("".concat(d,"/marfeel-sdk.js?id=").concat(o),!0),i("".concat(d,"/marfeel-sdk.es5.js?id=").concat(o),!1)};Ap=!0;var e=n?"app":"web",r={adsTrackingFromClient:!0,pageType:e,flowcards:{targeting:{entorno:e,enable_flowcard:or.getInstance().isCriticalTagFromHashTag()?"off":"on"}}};window.googletag=window.googletag||{cmd:[]},function(a,s){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};t(a,s,o)}(window,148,r),googletag.cmd.push(function(){googletag.pubads().addEventListener("slotRenderEnded",function(a){a.isEmpty||window.marfeel.cmd.push(["compass",function(s){s.trackAdRendered(a.lineItemId!=null?a.lineItemId:a.slot.getAdUnitPath(),a.slot.getAdUnitPath())}])})})}}var Uu,Ap,gr,Kn=W(function(){T();J();X();_e();dt();Na();ti();un();Ap=!1,gr=function(){function n(){var i=this;k(this,n),this.enable=!1,I.stats.isOkDomains&&(Ip(I.isApp),window.marfeel=window.marfeel||{},window.marfeel.cmd=window.marfeel.cmd||[],window.googletag=window.googletag||{cmd:[]},window.marfeel.cmd.push(["flowcards","compass",function(t,e){t.addEventListener("navigationfromcard",function(r){e.trackNewPage(),Ur.initForFlowcards(),googletag&&googletag.cmd.push(function(){googletag.pubads()&&googletag.pubads().refresh()})})}]),window.marfeel.cmd.push(["compass",function(t){t.predict().then(function(e){console.log(e.probability)})}]),window.marfeel.cmd.push(["compass",function(t){var e=se.getInstance().getRoleForGpt();if(e!=="anonimo"?(e==="suscriptorEspecPromo"||e==="suscriptorAutoPromo"?t.setUserType("paid"):t.setUserType("logged"),t.setSiteUserId(se.getInstance().getUid())):(t.setUserType("anonymous"),t.setSiteUserId(0)),window.Didomi){var r=Didomi.getUserConsentStatusForAll().purposes.enabled.indexOf("cookies")>-1;t.setCookies(r),oA(),i.enable=!0}}]),jeef.JeefEvents.on(be.ON_PIANO_SHOW_OFFER,function(t){if(t&&t.offerType==="purchase"&&(t.displayMode==="inline"&&window.marfeel.cmd.push(["compass",function(r){r.setPageVar("closed","hard-paywall")}]),t.displayMode==="modal"&&t.activeMeters)){var e=JSON.parse(t.activeMeters);Array.isArray(e)&&(e=e[0]),e.meterName==="DefaultMeter"&&window.marfeel.cmd.push(["compass",function(r){r.setPageVar("closed","dynamic-paywall")}])}}))}return A(n,[{key:"trackAdBlockUser",value:function(t){t&&window.marfeel.cmd.push(["compass",function(e){e.setSessionVar("adblock_user","si")}])}},{key:"trackConversion",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"subscribe";this.enable&&window.marfeel.cmd.push(["compass",function(e){e.trackConversion(t)}])}}],[{key:"getInstance",value:function(){return Uu||(Uu=new n),Uu}},{key:"loadCompass",value:function(t){I.stats.isOkDomains&&Ip(t)}}]),n}()});var yA,Fa,Ku=W(function(){T();J();X();yA=function(){function n(){var i=this;k(this,n),this.listeners=[],document.addEventListener("click",function(t){return i.handleClick(t)})}return A(n,[{key:"handleClick",value:function(t){this.listeners.forEach(function(e){var r=e.ancestor,a=e.selector,s=e.callback;if(!(r&&!r.contains(t.target))){var o=t.target.closest(a);o&&s(t,o)}})}},{key:"onClick",value:function(t){var e=t.selector,r=t.callback,a=t.ancestor,s=a===void 0?null:a;this.listeners.push({ancestor:s,selector:e,callback:r})}}]),n}(),Fa=new yA});var Yp,zp=W(function(){T();J();X();Yp=function(){function n(){k(this,n),this.eventListeners=new Map}return A(n,[{key:"on",value:function(t,e){this.eventListeners.has(t)||this.eventListeners.set(t,[]),this.eventListeners.get(t).push(e)}},{key:"emit",value:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),a=1;a<e;a++)r[a-1]=arguments[a];var s=this.eventListeners.get(t);
1s&&s.forEach(function(o){return o.apply(void 0,r)})}},{key:"removeListener",value:function(t,e){var r=this.eventListeners.get(t);if(r){var a=r.indexOf(e);a>-1&&r.splice(a,1)}}}]),n}()});var _A,zs,Wu=W(function(){T();Pr();J();X();zp();_A=function(){function n(i,t){var e=this;k(this,n),this.eventEmitter=new Yp,this.containerObject=i,this.mediaObject=t,this.lastSecond=-1,this.paused=!0,this.progress=0,this.totalTime={minutes:0,seconds:0},this.currentTime={minutes:0,seconds:0},this.events={timeupdate:[function(){return e.updateTime()},function(){return e.emit("timeupdate")}],ended:[function(){return e.setStopState()},function(){return e.emit("ended")}],pause:[function(){return e.setPausedState()},function(){return e.emit("pause")}],canplay:function(){return e.setPlayingState()},playing:function(){return e.setPlayingState()},waiting:function(){return e.setBufferingState()},play:function(){return e.emit("play")},error:function(a){return e.emit("error",a)}}}return A(n,[{key:"on",value:function(t,e){this.eventEmitter.on(t,e)}},{key:"emit",value:function(t){for(var e,r=arguments.length,a=new Array(r>1?r-1:0),s=1;s<r;s++)a[s-1]=arguments[s];(e=this.eventEmitter).emit.apply(e,[t].concat(a))}},{key:"initPlayer",value:function(){var t=this;this.attachListeners(),this.mediaObject.readyState>=1?this.setMetadata():this.mediaObject.addEventListener("loadedmetadata",function(){return t.setMetadata()})}},{key:"setMetadata",value:function(){var t=Math.floor(this.mediaObject.duration);this.totalTime.minutes=Math.floor(t/60),this.totalTime.seconds=t%60,this.emit("loadedmetadata",this.totalTime),this.containerObject.style.setProperty("--totalTime",'"'.concat(this.totalTime.minutes,":").concat(this.totalTime.seconds,'"'))}},{key:"attachListeners",value:function(){var t=this;Object.entries(this.events).forEach(function(e){var r=Te(e,2),a=r[0],s=r[1],o=Array.isArray(s)?s:[s];o.forEach(function(l){return t.mediaObject.addEventListener(a,l)})})}},{key:"removeListeners",value:function(){var t=this;Object.entries(this.events).forEach(function(e){var r=Te(e,2),a=r[0],s=r[1],o=Array.isArray(s)?s:[s];o.forEach(function(l){return t.mediaObject.removeEventListener(a,l)})})}},{key:"updateTime",value:function(){var t=Math.floor(this.mediaObject.currentTime);t!==this.lastSecond&&(this.lastSecond=t,this.progress=Math.round(this.mediaObject.currentTime/this.mediaObject.duration*100),this.currentTime.minutes=Math.floor(this.mediaObject.currentTime/60).toString().padStart(1,"0"),this.currentTime.seconds=Math.floor(this.mediaObject.currentTime%60).toString().padStart(2,"0"),this.containerObject.style.setProperty("--progressValue","".concat(this.progress,"%")),this.containerObject.style.setProperty("--currentTime",'"'.concat(this.currentTime.minutes,":").concat(this.currentTime.seconds,'"')))}},{key:"setStopState",value:function(){this.containerObject.dataset.playerState="stopped",this.containerObject.style.setProperty("--progressValue","0%"),this.containerObject.style.setProperty("--currentTime",'"0:00"')}},{key:"setPausedState",value:function(){this.containerObject.dataset.playerState="paused"}},{key:"setPlayingState",value:function(){this.containerObject.dataset.playerState="playing"}},{key:"setBufferingState",value:function(){this.containerObject.dataset.playerState="buffering"}},{key:"togglePlay",value:function(){this.mediaObject.paused?this.play():this.pause()}},{key:"play",value:function(){this.paused=!1,this.mediaObject.play()}},{key:"pause",value:function(){this.paused=!0,this.mediaObject.pause()}},{key:"stop",value:function(){this.paused=!0,this.mediaObject.pause()}},{key:"destroy",value:function(){this.removeListeners()}}]),n}(),zs=_A});function EA(n,i,t){return i=w(i),q(n,Jp()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function Jp(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Jp=function(){return!!n})()}function Js(n,i,t,e){var r=ar(w(1&e?n.prototype:n),i,t);return 2&e&&typeof r=="function"?function(a){return r.apply(t,a)}:r}var SA,Xp,Qp=W(function(){T();J();X();ue();oe();rn();
1le();Ku();Wu();SA=function(n){B(i,n);function i(t){var e;k(this,i);var r=document.querySelector('[data-module-podcast="'.concat(t,'"]')),a=r.querySelector("audio");return e=EA(this,i,[r,a]),e.id=t,e.podcastModule=r,e.playPauseButton=e.podcastModule.querySelector("[data-module-podcast-button-play-pause]"),e.progressBar=e.podcastModule.querySelector("[data-module-podcast-timeline-progress]"),e.currentText=e.podcastModule.querySelector("[data-module-podcast-current]"),e.observer=null,e.initObserver(),e}return A(i,[{key:"initObserver",value:function(){var e=this;this.observer=new IntersectionObserver(function(r){r.forEach(function(a){a.isIntersecting&&(e.initPlayer(),e.attachCustomListeners(),e.observer.disconnect())})},{threshold:.5}),this.observer.observe(this.podcastModule)}},{key:"attachCustomListeners",value:function(){var e=this;Fa.onClick({selector:"[data-module-podcast-timeline]",ancestor:this.podcastModule,callback:function(a,s){var o=a.offsetX/s.clientWidth;e.mediaObject.currentTime=e.mediaObject.duration*o}}),Fa.onClick({selector:"[data-module-podcast-button-play-pause]",ancestor:this.podcastModule,callback:function(){e.togglePlay()}})}},{key:"updateTime",value:function(){Js(i,"updateTime",this,3)([]),this.containerObject.style.setProperty("--podcastProgressValue","".concat(this.progress,"%")),this.containerObject.style.setProperty("--podcastCurrentTime",'"'.concat(this.currentTime.minutes,":").concat(this.currentTime.seconds,'"'))}},{key:"setMetadata",value:function(){Js(i,"setMetadata",this,3)([]),this.containerObject.style.setProperty("--podcastTotalTime",'"'.concat(this.totalTime.minutes,":").concat(this.totalTime.seconds,'"'))}},{key:"setStopState",value:function(){Js(i,"setStopState",this,3)([]),this.playPauseButton.dataset.status="on"}},{key:"setPausedState",value:function(){Js(i,"setPausedState",this,3)([]),this.playPauseButton.dataset.status="on"}}]),i}(zs),Xp=SA});var $p={};Et($p,{default:function(){return bA}});var TA,bA,Zp=W(function(){T();X();J();Ge();Qp();TA=A(function n(){var i=this;k(this,n),V(this,"createPodcast",function(t){var e=t.id;if(i.podcasts.has(e))return i.podcasts.get(e);var r=new Xp(e);return r.on("play",function(){i.podcasts.forEach(function(a,s){s!==e&&!a.paused&&a.pause()})}),i.podcasts.set(e,r),r}),this.podcasts=new Map}),bA=new TA});var qu={};Et(qu,{default:function(){return AA}});var kA,AA,Yu=W(function(){T();J();X();dt();Na();pi();kA=function(){function n(){k(this,n)}return A(n,[{key:"sendClick",value:function(t,e){var r=e.target.getAttribute("data-locution-item");switch(r){case"play":if(se.getInstance().getSimpleRole()!=="SUS")return;this._handlePlay(t);break;case"playExternal":if(se.getInstance().getSimpleRole()!=="SUS")return;t=document.getElementById(e.target.getAttribute("data-playerId")),t&&this._handlePlay(t);break;case"pauseExternal":if(se.getInstance().getSimpleRole()!=="SUS")return;t=document.getElementById(e.target.getAttribute("data-playerId")),t&&this._pausePlayer(t);break;case"stop":this._handleStop(t);break;case"stopExternal":t=document.getElementById(e.target.getAttribute("data-playerId")),t&&this._handleStop(t);break;case"timeline":case"timeline-progress":this._handleTimelineClick(t,e);break;case"timebackward":this._handleTimeBackward(t);break;case"timeforward":this._handleTimeForward(t);break;case"speeddown":this._handleSpeedDown(t);break;case"speedup":this._handleSpeedUp(t);break;default:return}}},{key:"_handleTimeForward",value:function(t){var e=t.querySelector("audio");e.currentTime=Math.min(e.duration,e.currentTime+15),this._setCurrentTime(t,e.currentTime),this._setProgress(t,e.currentTime,e.duration),e.currentTime===e.duration&&(t.dataset.buttonPlayPause="pause")}},{key:"_handleTimeBackward",value:function(t){var e=t.querySelector("audio");e.currentTime=Math.max(0,e.currentTime-15),this._setCurrentTime(t,e.currentTime),this._setProgress(t,e.currentTime,e.duration)}},{key:"_handleTimelineClick",value:function(t,e){var r,a,s=t.querySelector("audio");if(!(!s.duration||!isFinite(s.duration))){var o=t.querySelector('[data-locution-item="timeline"]'),l=o.getBoundingClientRect();if(l.width){var u=(r=e.clientX)!==null&&r!==void 0?r:(a=e.native)===null||a===void 0?void 0:a.clientX,c=(u-l.left)/l.width;s.currentTime=s.duration*c,this._setCurrentTime(t,s.currentTime),this._setProgress(t,s.currentTime,s.duration),c>=1&&(t.dataset.buttonPlayPause="pause")}}}},{key:"_handlePlay",value:function(t){var e=this,r=t.querySelector("audio");if(r.paused){if(!t.hasAttribute("data-locution-dirty")){var a=function(){isFinite(r.duration)&&t.style.setProperty("--audio-total-time","'".concat(e._formatTime(r.duration),"'"))};isFinite(r.duration)?a():r.addEventListener("loadedmetadata",a,{once:!0}),t.setAttribute("data-locution-dirty",""),Ur.trackingHandler(xe.ON_TRACKING_EVENTS,"play_locution_ia")}r.play(),t.dataset.buttonPlayPause="play",this._attachTimeUpdate(t,r)}else this._pausePlayer(t)}},{key:"_pausePlayer",value:function(t){var e=t.querySelector("audio");e.pause(),t.dataset.buttonPlayPause="pause",this._detachTimeUpdate(e)}},{key:"_handleStop",value:function(t){var e=t.querySelector("audio");e.stop(),t.dataset.buttonPlayPause="pause"}},{key:"_handleSpeedUp",value:function(t){var e=t.querySelector("audio");e.playbackRate=Math.min(2,parseFloat((e.playbackRate+.5).toFixed(1))),this._setSpeed(t,e.playbackRate)}},{key:"_handleSpeedDown",value:function(t){var e=t.querySelector("audio");e.playbackRate=Math.max(1,parseFloat((e.playbackRate-.5).toFixed(1))),this._setSpeed(t,e.playbackRate)}},{key:"_setSpeed",value:function(t,e){t.style.setProperty("--audio-current-speed","'".concat(e.toFixed(1),"x'"))}},{key:"_setCurrentTime",value:function(t,e){t.style.setProperty("--audio-current-time","'".concat(this._formatTime(e),"'"))}},{key:"_setProgress",value:function(t,e,r){var a=r?parseFloat((e/r*100).toFixed(2)):0;t.style.setProperty("--audio-timeline-progress","".concat(a,"%"))}},{key:"_attachTimeUpdate",value:function(t,e){var r=this;e._timeUpdateHandler=function(){r._setCurrentTime(t,e.currentTime),r._setProgress(t,e.currentTime,e.duration)},e.addEventListener("timeupdate",e._timeUpdateHandler),e.addEventListener("ended",function(){t.dataset.buttonPlayPause="pause",r._detachTimeUpdate(e)},{once:!0})}},{key:"_detachTimeUpdate",value:function(t){t._timeUpdateHandler&&(t.removeEventListener("timeupdate",t._timeUpdateHandler),t._timeUpdateHandler=null)}},{key:"_formatTime",value:function(t){var e=Math.floor(t/60),r=Math.floor(t%60).toString().padStart(2,"0");return"".concat(e,":").concat(r)}}]),n}(),AA=new kA});function IA(n,i,t){return i=w(i),q(n,em()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function em(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(em=function(){return!!n})()}var _i,zu=W(function(){T();X();J();ue();oe();le();sr();_i=function(n){B(i,n);function i(t){var e;return k(this,i),e=IA(this,i,[t]),e.position=0,e.id=0,e}return A(i)}(Qe);_i.ON_UI_NAV_MOVE="onUINavMove";_i.ON_UI_NAV_STATIC_CLICK_TOUCH="onUINavStatic"});function CA(n,i,t){return i=w(i),q(n,tm()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function tm(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(tm=function(){return!!n})()}var Xs,Ju=W(function(){T();J();X();ue();oe();le();mt();zu();Xs=function(n){B(i,n);function i(t,e){var r;return k(this,i),r=CA(this,i),r.id=t,r.long=e||0,r}return A(i,[{key:"notifyOnMoveTo",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this._dispatch(_i.ON_UI_NAV_MOVE,e,r)}},{key:"_dispatch",value:function(e,r,a){var s=new _i(e);s.position=r,s.id=this.id,s.isAdPosition=a,this.dispatchEvent(s,!0)}},{key:"notifyOnNoMove",value:function(e,r){this._dispatch(_i.ON_UI_NAV_STATIC_CLICK_TOUCH,e,r)}}]),i}(Re)});function rm(n,i,t,e){return n==e?i+t:t*(-Math.pow(2,-10*n/e)+1)+i}var im=W(function(){T()});function LA(n,i,t){return i=w(i),q(n,nm()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function nm(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(nm=function(){return!!n})()}var Xu,am,sm=W(function(){T();J();X();ue();oe();le();Ju();Se();ze();mi();ft();Aa();Fn();ft();pt();im();ne("GALLERY");Xu="GALLERY",am=function(n){B(i,n);function i(t,e,r){var a,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:[],o=arguments.length>4?arguments[4]:void 0;k(this,i),a=LA(this,i,[t,o]);var l=t.split("_");return a._id=l[1],a._container=e,a.wrapper=r,a.centered=!0,a._next=null,a._prev=null,a.elements=s,a._step=1,a.startIndex=1,a.position=a.startIndex,a._gap=0,a._limit=1,a._disabled=!1,a._loader=null,a._fitToWrapper=null,a._firstChild=null,a._allowTransformation3D=Nh("transform -webkit-transform -ms-transform -moz-transform"),a._side=0,a.roundIndex=[],a._isInfinite=!1,a._isInitialized=!1,a._widthList=0,a._currentOffset=0,a._adPos=[],a._automatic=!1,a._type=null,a.long=o,a._long=o,a._fitToHeight=!1,a._enableTracking=!1,a._pauseElement=null,a._playElement=null,a._closeElement=null,a._timer=null,a._timerInterval=7*1e3,a._realPosition=0,a._lastX=0,a._dragMoveX=0,a._dragMoveY=0,a._flagTracking=!1,a._freeze=!1,a}return A(i,[{key:"setFreeze",value:function(e){return this._freeze=e,this}},{key:"getFreeze",value:function(){return this._freeze}},{key:"isPlaying",value:function(){return an(this._pauseElement)}},{key:"setFlagTracking",value:function(e){return this._flagTracking=e,this}},{key:"getFlagTracking",value:function(){return this._flagTracking}},{key:"getRealPosition",value:function(){return this._realPosition}},{key:"setCloseElement",value:function(e){return this._closeElement=e,this}},{key:"setPauseElement",value:function(e){return this._pauseElement=e,this}},{key:"setPlayElement",value:function(e){return this._playElement=e,this}},{key:"setStatusTracking",value:function(e){return this._enableTracking=e,this}},{key:"getStatusTracking",value:function(){return this._enableTracking}},{key:"startAutomatic",value:function(){this._automatic&&(this._timer||(this._timer=new Pi(this._timerInterval),ie(this._timer,hr.ON_TM_TIMER,this._onTimerAutoGallery,this)),(!this._freeze||!this.isPlaying())&&(ae(this._pauseElement,!0),ae(this._playElement,!1)),this._timer.start())}},{key:"stopAutomatic",value:function(){this._timer&&this._automatic&&(this._freeze||(ae(this._pauseElement,!1),ae(this._playElement,!0)),this._timer.stop())}},{key:"_onTimerAutoGallery",value:function(){var e=this.getPosition(),r=this.long;this._isInfinite?this.next():e===r?(this.position=1,this.direct(this.position)):this.next()}},{key:"isAdPosition",value:function(e){for(var r=!1,a=0;a<this._adPos.length;a++)e==this._adPos[a]&&(r=!0);return r}},{key:"getAdPosElements",value:function(){return this._adPos}},{key:"getPosition",value:function(){return this.position}},{key:"setType",value:function(e){return this._type=e,this}},{key:"getType",value:function(){return this._type}},{key:"fitToHeight",value:function(e){return this._fitToHeight=e,this}},{key:"setAnimationOffset",value:function(e){if(vh&&uh(this._container)){var r=function f(d){a||(a=d);var h=d-a,v=Math.min(h,o)/o*(e-c)+c,m=rm(h,0,e-c,o);s.style.transform="translate3d("+(m+c)+"px, 0, 0)",h<o?window.requestAnimationFrame(f):$r(s,!0)};$r(this._container,!1),function(){var f=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;window.requestAnimationFrame=f}();
1var a=null,s=this._container,o=300,l=Math.sign(e),u=Math.abs(e),c=this._currentOffset;window.requestAnimationFrame(r)}else this._container.style.transitionTimingFunction="cubic-bezier(0.5,0.25,0,1)",this._container.style.transform="translate3d("+e+"px,0,0)",this._allowTransformation3D||(this._container.style.marginLeft=e+"px");this._currentOffset=e}},{key:"getLong",value:function(){return this.long}},{key:"setAutomatic",value:function(e){return this._automatic=e,this}},{key:"getElements",value:function(){return this.elements}},{key:"setCentered",value:function(e){return this.centered=e,this}},{key:"addAdPosition",value:function(e,r){this._adPos[e]=r}},{key:"setStep",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;return this._step=e,this}},{key:"setInfinite",value:function(e){return this._isInfinite=e,this}},{key:"setStartIndex",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;return this.startIndex=e,this.position=this.startIndex,this}},{key:"setLoader",value:function(e){return this._loader=e,this}},{key:"fitToWrapper",value:function(e){return this._fitToWrapper=e,this}},{key:"setNextElement",value:function(e){return this._next=e,this}},{key:"setPrevElement",value:function(e){return this._prev=e,this}},{key:"init",value:function(){}},{key:"disableNextPrev",value:function(){ae(this._next,!1),this._next=void 0,ae(this._prev,!1),this._prev=void 0}},{key:"next",value:function(){P(["jeef.ui.nav.Gallery>next>","Avanzado posiciones dependiendo del n\xFAmero de steps y del ancho de pantalla ... "],Xu);var e;this._isInfinite?e=this.position+this._step:(this.position+=this._step,e=this.position>this.long?this.long:this.position),this._directGoto(e)}},{key:"prev",value:function(){P(["jeef.ui.nav.Gallery>prev>","Retrasamos posiciones dependiendo del n\xFAmero de steps y del ancho de pantalla ... "],Xu);var e;this._isInfinite?e=this.position-this._step:(this.position-=this._step,e=this.position<=0?1:this.position),this._directGoto(e)}},{key:"direct",value:function(e){P(["jeef.ui.nav.Gallery>direct>","Avanzando hacia la siguiente posici\xF3n del listado de elementos de la galer\xEDa: "+e],Xu),this.position=e,this._directGoto(e)}},{key:"_directGoto",value:function(e){}},{key:"isRunning",value:function(){return this._timer?this._timer.running():!1}},{key:"reCalculate",value:function(){}},{key:"disable",value:function(){this._disabled=!0}},{key:"enable",value:function(){this._disabled=!1}}],[{key:"ease",value:function(e){return e=--e*e*e+1,e=Math.max(0,e),e=Math.min(1,e),e}}]),i}(Xs)});function om(n){return n>0?1:n<0?-1:0}var lm=W(function(){T()});function RA(n,i,t){return i=w(i),q(n,cm()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function cm(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(cm=function(){return!!n})()}var OA,Qs,wA,fm,dm,xA,PA,DA,hm,MA,NA,FA,UA,BA,GA,jA,HA,VA,um,qn,KA,WA,qA,YA,vm,zA,pm=W(function(){T();J();X();ue();oe();le();sm();ft();Se();ze();lm();ne("GALLERY");OA="GALLERY",Qs=function(n){B(i,n);function i(t,e,r,a,s){var o;return k(this,i),o=RA(this,i,[t,e,r,a,s]),o._fullGaps=[],o._steps=[],o._startDragPosition=0,o._downOffset=0,o._downTimestamp=0,o._dragging=!1,o._preventClick=!1,o._BORDER_PROP_OFFSET=.15,o._twoFinger=!1,o.maxHeightElementGallery=0,o}return A(i,[{key:"init",value:function(){var e=this;$r(this._container,!1),this._firstChild=this.elements[this.startIndex-1],um.apply(this),qn.apply(this,[this.position]),setTimeout(function(){$r(e._container,!0)},0),this._makeInfiniteAbsoluteItems(),this._isInitialized=!0,this._listenUIEvents(),this.startAutomatic()}},{key:"middleAutoStart",value:function(e,r){this.setFreeze(!0),this.stopAutomatic(),e.apply(this,r),this.startAutomatic(),this.setFreeze(!1)}},{key:"_listenUIEvents",value:function(){var e=this;ie(this.wrapper,"touchstart",xA,this),ie(this.wrapper,"touchend",hm,this),ie(this.wrapper,"touchmove",DA,this),ie(this.wrapper,"click",PA,this);for(var r=this.wrapper.querySelectorAll("img"),a=[],s=function(u){var c=new Promise(function(f){r[u].complete?f(!0):r[u].addEventListener("load",function(){f(!0)})});a.push(c)},o=0;o<r.length;o++)s(o);Promise.all(a).then(function(l){var u=[];r.forEach(function(c){u.push(c.parentNode.parentNode.parentNode.parentNode.offsetHeight)}),e.maxHeightElementGallery=Math.max.apply(Math,u),e._makeInfiniteAbsoluteItems()})}},{key:"_directGoto",value:function(e){qn.apply(this,[e])}},{key:"reCalculate",value:function(){if(P(["jeef.ui.nav.Gallery>reCalculate>"],OA),!fm()&&!this._twoFingers){this._enableTracking=!1;var e=this._step;$r(this._container,!1),this._isInfinite&&this._quitInfiniteAbsoluteItems(),um.apply(this),MA.apply(this,[e]),this._enableTracking=!0,$r(this._container,!0)}}},{key:"_makeInfiniteAbsoluteItems",value:function(){this._isInfinite&&(NA.apply(this),this.wrapper.style.height=this.maxHeightElementGallery+"px")}},{key:"_quitInfiniteAbsoluteItems",value:function(){if(this._isInfinite){this.position=dm.apply(this);for(var e=0;e<this.elements.length;e++)this.elements[e].style.position="static",this.elements[e].style.left=""}}}]),i}(am),wA=function(i){this._twoFingers=i.native.touches.length>1}
1,fm=function(){return window.visualViewport&&window.visualViewport.scale>1},dm=function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this._step;i||(t=0);var e=(this.position-t)/this.long,r=this.position;return this.position<=0?(r=this.position+this.long*Math.max(1,Math.trunc(Math.abs(e))),e<-1&&r<0?r=-Math.abs(r)+this.long:r===0&&(r=this.long)):e>=1&&(r=this.position-this.long*Math.trunc(e)),r},xA=function(i){wA.apply(this,[i]),this._dragging||(this._startDragPosition=this.position,this._downTimestamp=Date.now(),this._downOffset=this._currentOffset,this._dragging=!0,this._lastX=i.native.changedTouches[0].pageX,this._dragMoveX=i.native.changedTouches[0].pageX,this._dragMoveY=i.native.changedTouches[0].pageY,$r(this._container,!1))},PA=function(i){if(this._preventClick)return this._preventClick=!1,!1},DA=function(i){if(this.wrapper.offsetWidth<this._widthList&&this._dragging){this.setFreeze(!0),this.stopAutomatic();var t=this._downOffset+(i.native.changedTouches[0].pageX-this._lastX),e=t,r,a,s=Math.abs(this._dragMoveX-i.native.changedTouches[0].pageX),o=Math.abs(this._dragMoveY-i.native.changedTouches[0].pageY);if(s>=o&&!fm()&&!this._twoFingers)return this._isInfinite||(t>0&&(r=t/this.wrapper.offsetWidth,r=Qs.ease(r),e=this._gap*r*this._BORDER_PROP_OFFSET),a=-this._widthList+this.wrapper.offsetWidth,t<a&&(r=(t-a)/-this._gap,r=Qs.ease(r),e=a-this._gap*r*this._BORDER_PROP_OFFSET)),this.setAnimationOffset(e),!1;hm.apply(this,arguments)}},hm=function(i){if(this._dragging){var t,e=om(this._downOffset-this._currentOffset),r=(Date.now()-this._downTimestamp)/1e3,a=Math.abs(this._downOffset-this._currentOffset),s=i.native.changedTouches[0].pageX,o=a/r;t=Math.round((this._currentOffset-this._side)/-this._gap)+1,o>window.innerWidth*.5&&t==this._startDragPosition&&(t+=1*e),$r(this._container,!0),this._dragging=!1,a===0?this.centered&&(this._preventClick=!1,s<this.wrapper.getBoundingClientRect().left+this._side&&(this.prev(),this.startAutomatic(),this.setFreeze(!1),this._preventClick=!0),s>this.wrapper.getBoundingClientRect().right-this._side?(this.next(),this.startAutomatic(),this.setFreeze(!1),this._preventClick=!0):this._freeze||this.notifyOnNoMove(this.getPosition(),!1)):(this._preventClick=!0,qn.apply(this,[t]),this.startAutomatic(),this.setFreeze(!1))}},MA=function(i){if(!this._isInfinite)this._step!==i&&this.position%this._step===0&&(this.position=this.position-this._step+1),qn.apply(this,[this.position]);else{var t=this.position;this._enableTracking=!1,qn.apply(this,[this.startIndex]),this._makeInfiniteAbsoluteItems(),this._enableTracking=!0,qn.apply(this,[t])}},NA=function(){var i=this.elements[0].parentNode,t=parseInt(document.defaultView.getComputedStyle(this._firstChild,"").marginRight),e=0,r=0;for(i.style.position="relative",i.style.minHeight="205px",r;e<this.elements.length;e++)this.elements[e].style.position="absolute",this.elements[e].style.top="0",this.elements[e].style.left=r+"px",r+=this.elements[0].offsetWidth+t;for(e=0;e<this.long;e++)this.roundIndex[e]=e},FA=function(i){ae(this._next,i),ae(this._prev,i)},UA=function(i){var t=0;for(this._gap=this.wrapper.offsetWidth;t<i;t++)this.elements[t].style.width=this._gap+"px";this._widthList=this.wrapper.offsetWidth*i},BA=function(i,t){var e=this.roundIndex.length/2,r;e=Math.round(e);for(var a=i-e,s=this.position-e;s<=a;s++)for(r=0;r<this.roundIndex.length;r++)this.roundIndex[r]===s&&(this.roundIndex[r]+=this.long,this.elements[r].style.left=(this.elements[0].offsetWidth+t)*(s+this.long)+"px")},GA=function(i,t){for(var e=this.roundIndex.length-2,r=i+e,a=this.position+e;a>=r;a--)for(var s=0;s<this.roundIndex.length;s++)this.roundIndex[s]===a&&(this.roundIndex[s]-=this.long,this.elements[s].style.left=(this.elements[0].offsetWidth+t)*(a-this.long)+"px")},jA=function(i){var t=parseInt(document.defaultView.getComputedStyle(this._firstChild,"").marginRight);i>this.position?BA.apply(this,[i,t]):i<this.position&&GA.apply(this,[i,t])},HA=function(i){for(var t=parseInt(document.defaultView.getComputedStyle(this._firstChild,"").marginRight),e=0,r=0;r<i;r++)e+=this.elements[r].getBoundingClientRect().width+t;return this._widthList=e-t,this._gap=this._firstChild.offsetWidth+t,this.centered&&(this._side=(this.wrapper.offsetWidth%this._gap+t)*.5),t},VA=function(){(this._limit>=this.elements.length||this._widthList<this.wrapper.offsetWidth)&&(this.disable.apply(this),this._isInfinite||FA.apply(this,[!1]))},um=function(){var i=this.elements.length,t=0;ae(this._loader,!0),this._fitToWrapper?UA.apply(this,[i]):t=HA.apply(this,[i]),this._limit=1,this._limit=Math.floor((this.wrapper.offsetWidth+t)/this._gap),this._step>this._limit&&(this._step=this._limit),VA.apply(this),ae(this._loader,!1),ae(this._container,!0)},qn=function(i){if(!this._disabled){var t=YA.apply(this,[i]),e=zA.apply(this,[t]),r;jA.apply(this,[t]),r=-(this._gap*(t-1))+e,this._isInfinite||(r=Math.max(r,-this._widthList+this.wrapper.offsetWidth)),this.position=t,this.setAnimationOffset(r),qA.apply(this,[t]);var a=this.position,s=!1;if(this._isInfinite){var o=WA.apply(this);a=o[0],this._realPosition=a,s=o[1]}this.notifyOnMoveTo(a,s)}},KA=function(i){for(var t,e=!1,r=0,a=0;a<i;a++)for(var s=0;s<this._adPos.length;s++)a===this._adPos[s]&&r++,i-this._step===this._adPos[s]&&(e=!0);return t=i-r,Math.max(0,t),[t,e]},WA=function(){var i=dm.apply(this,[!0]);return KA.apply(this,[i])},qA=function(i){this._next&&this._prev&&(ae(this._next,!0),ae(this._prev,!0),this._isInfinite||(i>=this.long-this._limit+1&&ae(this._next,!1),i===1&&ae(this._prev,!1)))},YA=function(i){var t;return t=i,this._isInfinite||(t=Math.min(i,vm.apply(this)),t=Math.min(i,this.long),t=Math.max(1,t)),t},vm=function(){return this.long-this._limit+1},zA=function(i){var t;return t=i===1?0:this._side,t=i===vm.apply(this)?this._side*2:t,t}});function JA(n,i,t){return i=w(i),q(n,mm()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function mm(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(mm=function(){return!!n})()}var gm,Qu,ym=W(function(){T();J();X();ue();oe();le();Ju();ft();gm=function(n){B(i,n);function i(t,e,r){var a;k(this,i);var s=e||[];return a=JA(this,i,[t,s.length]),a._elements=s,a._position=r||1,a}return A(i,[{key:"next",value:function(){this._position<this._elements.length&&Qu.apply(this,[this._position+1])}},{key:"prev",value:function(){this._position>1&&Qu.apply(this,[this._position-1])}},{key:"direct",value:function(e){e>0&&e<=this._elements.length&&Qu.apply(this,[e])}}]),i}(Xs),Qu=function(i){this._position=i;var t=0;for(t;t<this._elements.length;t++)ae(this._elements[t],t+1==this._position);this.notifyOnMoveTo(this._position)}});var bm={};Et(bm,{default:function(){return Tm}});function XA(n,i,t){return i=w(i),q(n,Sm()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function Sm(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Sm=function(){return!!n})()}var $u,$s,Tm,QA,$A,_m,ZA,Em,eI,tI,rI,iI,km=W(function(){T();J();X();ue();oe();le();Se();_e();Jt();ft();pm();ym();pt();ze();zu();mt();Gi();Vn();$u="INT/GAL";ne($u);ct("jeeiSite.ui.Gallery");$s=null,Tm=function(n){B(i,n);function i(){var t;return k(this,i),t=XA(this,i),t._galleries={},t._adPos=[],t._trackingPosition=!1,t.outherWidth=window.outerWidth,t.outherHeight=window.outerHeight,t.flagFirstResize=!0,t}return A(i,[{key:"getGallery",value:function(e){return this._galleries[e]}},{key:"registerElement",value:function(e,r){P(["jeeiSite.ui.Gallery>registerElement> ",e,r],$u);var a=document.getElementById(e),s,o,l,u=[],c,f,d,h,v,m,p=!1,g=!1,E=!1,y=!1;if(a&&a.getAttribute("data-type")==="gallery"){for(y=a.getAttribute("data-subtype"),o=a.id.replace("gallery_",""),l=parseInt(r||a.getAttribute("data-long")||0),c=parseInt(a.getAttribute("data-start"))||1,p=a.getAttribute("data-automatic")||!1,g=a.getAttribute("data-infinite")||!1,f=document.getElementById("gallery_list_"+o),d=document.getElementById("gallery_wrapper_"+o),v=document.getElementById("gallery_loader_"+o
1),m=a?a.getAttribute("data-fit")=="true":!1,E=a.getAttribute("data-fitheight")||!1,h=0;h<l;h++)u[h]=document.getElementById("gallery_element_"+(h+1)+"_"+o);if(l&&u.length){switch(y){case"toggle":s=new gm(o,u,c),ie(s,_i.ON_UI_NAV_MOVE,Em,this);break;case"kinetic":case"horizontal":case"fullHorizontal":default:s=new Qs(o,f,d,u,l),s.setType(y).setCentered(Me).setStep().setStep(parseInt(a.getAttribute("data-step"))).setInfinite(g).setLoader(v).fitToHeight(E).setNextElement(document.getElementById("gallery_next_"+o)).setCloseElement(document.getElementById("gallery_close_"+o)).setPrevElement(document.getElementById("gallery_prev_"+o)).setPauseElement(document.getElementById("gallery_pause_"+o)).setPlayElement(document.getElementById("gallery_play_"+o)).setStartIndex(c).fitToWrapper(m).setAutomatic(p).setFlagTracking(!1).init(),QA.apply(this,[s]),ie(s,_i.ON_UI_NAV_MOVE,Em,this);break}this._galleries[e]=s}return s}else return!1}}],[{key:"getInstance",value:function(){return $s||($s=new i,$A.apply($s)),$s}}]),i}(Re),QA=function(i){var t,e,r=i.getLong();for(t=0,e=0;e<r;e++)i.getElements()[e].querySelector('[id*="robagaleria"]')&&(i.addAdPosition(t,e),t++)},$A=function(){var i=this;ie(window,"ready",function(){i.outherWidth=window.outerWidth,i.outherHeight=window.outerHeight},this),ie(document,"click",ZA,this),ie(window,"resize",_m,this),ie(window,"orientationchange",_m,this)},_m=function(i){if(this.flagFirstResize||this.outherWidth!==window.outerWidth||this.outherHeight!==window.outerHeight){this.flagFirstResize=!1,console.log("_onResize -----> ");var t=0;for(t in this._galleries)this._galleries[t].reCalculate()}},ZA=function(i){var t=Vt("data-type",i.target,window.document),e=t?xn(t[0]):null,r,a;try{a=this.getGallery(e[0].id)}catch(s){}switch(t[1]){case"prev":a.middleAutoStart(a.prev),i.native.preventDefault();break;case"next":a.middleAutoStart(a.next),i.native.preventDefault();break;case"nav":r=parseInt(t[0].getAttribute("data-value")),a.middleAutoStart(a.direct,[r]),i.native.preventDefault();break;case"pause":a.stopAutomatic(),i.native.preventDefault();break;case"play":a.startAutomatic(),i.native.preventDefault();break}},Em=function(i){var t=rI(i.target.long,i.position);tI(i.id,i.target.long,t),iI.apply(this,[i.id,i.target.long,t,i.isAdPosition]),eI.apply(this,[i.target,t,i.isAdPosition]),this.dispatchEvent(i)},eI=function(i,t,e){i.getFlagTracking()&&i.getStatusTracking()&&t!==this._trackingPosition&&!e&&(this._trackingPosition=t,window.location.hash="",history.pushState({},document.title,"".concat(window.location.href.replace("#",""),"#img_").concat(t)),It.getInstance().pageView(window.location.href.replace(window.location.protocol+"//www"+I.subDomain,"")),Yr.getInstance().pageViewCandidate()),e&&(this._trackingPosition=null)},tI=function(i,t,e){var r,a;for(a=1;a<=t;a++)try{r=document.getElementById("gallery_bullet_"+a+"_"+i),r.setAttribute("data-action","toggle"),r!==null&&a===e?r.setAttribute("data-status","on"):r.setAttribute("data-status","off")}catch(s){St(["_updateBullets>_updateBullets> No se encontraron bullets para ",i],$u);break}},rI=function(i,t){var e=t;if(t>i)e=t/i,e=Math.trunc(e),e=e*i,e=t-e;else if(e<0){e=t/i,e=Math.trunc(e),e=e*i,e=t-e,e=Math.abs(e);var r=[],a,s;for(a=0,s=i;a<i;a++,s--)r[a]=s;e=r[e]}return e===0&&(e=i),e},iI=function(i,t,e,r){var a=e,s=t-this._galleries["gallery_"+i].getAdPosElements().length,o=a.toString()+' de <a href="#" data-value="'+t+'" data-type="nav" data-target="gallery_'+i+'">'+t+"</a>";this._galleries["gallery_"+i].getType()==="fullHorizontal"&&(o=a.toString()+" de "+s),document.getElementById("gallery_indicator_"+i)!==null&&(document.getElementById("gallery_indicator_"+i).innerHTML=o),Sa(document.getElementById("gallery_indicator_"+i),""),r&&(document.getElementById("gallery_indicator_"+i).innerHTML=o,Sa(document.getElementById("gallery_indicator_"+i),"ad"),window.location.hash="")};window.jeeiSite.ui.Gallery=Tm});var Lm={};Et(Lm,{default:function(){return Cm}});function nI(n,i,t){return i=w(i),q(n,Am()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function Am(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Am=function(){return!!n})()}var Zs,Im,Cm,aI,Rm=W(function(){T();J();X();ue();oe();le();Se();Jt();mt();Zs=null,Im="GALLERYNEWS";ne(Im);ct("jeeiSite.ui.GalleryNews");Cm=function(n){B(i,n);function i(){var t;return k(this,i),t=nI(this,i),t._galleries={},t._adPos=[],t}return A(i,[{key:"registerElement",value:function(e,r){P(["jeeiSite.ui.GalleryNews>registerElement> ",e,r],Im);var a=document.getElementById(e),s,o,l=[],u;if(a&&a.getAttribute("data-type")=="gallerynews"){for(s=a.id.replace("gallerynews_",""),o=parseInt(r||a.getAttribute("data-long")||0),u=0;u<o;u++)l[u]=document.getElementById("gallerynews_element_"+(u+1)+"_"+s);return l[2]&&(l[2].style.display="none"),{init:function(){return!1}}}else return!1}}],[{key:"getInstance",value:function(){return Zs||(Zs=new i,aI.apply(Zs)),Zs}}]),i}(Re),aI=function(){};window.jeeiSite.ui.GalleryNews=Cm});var wm={};Et(wm,{default:function(){return sI}});var sI,Om,xm=W(function(){T();J();X();ft();ze();Aa();Fn();Yl();Jt();ct("jeeiSite.widgets.CountDown");sI=function(){function n(i,t,e){k(this,n),this._container=i,this._highDate=t,this._lessDate=e,this._timer=null}return A(n,[{key:"init",value:function(){this._timer=new Pi(this._params.delay===void 0||this._params.delay===""?1e3:this._params.delay),this._timer.start(),ie(this._timer,hr.ON_TM_TIMER,Om,this)}},{key:"printTime",value:function(){Om.apply(this)}},{key:"setParams",value:function(t){this._params=t}},{key:"stopCountDown",value:function(){this._timer.stop()}}]),n}(),Om=function(){var i=null;try{i=Hh(this._highDate,this._lessDate)}catch(t){i={days:"00",hours:"00",minutes:"00",seconds:"00"},this._timer.stop()}this._params.ids&&(Ta(document.getElementById(this._params.ids.days),"info",i.days,!0),Ta(document.getElementById(this._params.ids.hours),"info",i.hours,!0),Ta(document.getElementById(this._params.ids.minutes),"info",i.minutes,!0),Ta(document.getElementById(this._params.ids.seconds),"info",i.seconds,!0))}});function oI(n,i,t){return i=w(i),q(n,Pm()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function Pm(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Pm=function(){return!!n})()}var Zt,Yn=W(function(){T();X();J();ue();oe();le();Ge();sr();Zt=function(n){B(i,n);function i(t){return k(this,i),oI(this,i,[t])}return A(i)}(Qe);V(Zt,"ON_SUBSCRIPTION_FINISH","onSubscriptionFinish");V(Zt,"ON_BASE_LOAD","onBaseLoad");V(Zt,"ON_PAYMENT_COMPLETE","onPaymentComplete");V(Zt,"ON_PURCHASE_FINISH","onPurchaseFinish")});var eo,Zu=W(function(){T();J();X();Ge();Yn();Se();Qr();jeef.JeefEvents||(jeef.JeefEvents=Ht.getInstance());ne("Base");
1eo=function(){function n(){k(this,n),V(this,"baseLoaded",!1)}return A(n,[{key:"injectJss",value:function(){var t=this;if(!this.baseLoaded){this.publicationId=this.conf.publicationId,this.product=this.conf.productType,this.productId=this.publicationId+":"+this.product;var e=document.createElement("script");e.src=this.conf.swgJS,e.async=!0,e.setAttribute("subscriptions-control","manual"),document.head.appendChild(e),(self.SWG=self.SWG||[]).push(function(r){r.init(t.productId)}),this.baseLoaded=!0}jeef.JeefEvents.emit(Zt.ON_BASE_LOAD)}}]),n}()});function lI(n,i,t){return i=w(i),q(n,Dm()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function Dm(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Dm=function(){return!!n})()}var ec,Mm,Nm=W(function(){T();wr();J();X();ue();oe();le();ec=fr(xr(),1);Zu();Se();Qr();Yn();jeef.JeefEvents||(jeef.JeefEvents=Ht.getInstance());ne("Purchase");Mm=function(n){B(i,n);function i(){return k(this,i),lI(this,i)}return A(i,[{key:"showCarrousel",value:function(){var e=this;(self.SWG=self.SWG||[]).push(function(r){r.configure({paySwgVersion:"2"}),r.showOffers({skus:e.conf.offers||[]},{isClosable:!0}),r.setOnLoginRequest(function(){window.location.href="".concat(e.conf.loginPage,"?callback=").concat(window.location.href)}),r.setOnPaymentResponse(function(){var a=ut(ec.default.mark(function s(o){var l;return ec.default.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,o;case 2:return l=c.sent,jeef.JeefEvents.emit(Zt.ON_PURCHASE_FINISH,l),c.next=6,l.complete();case 6:jeef.JeefEvents.emit(Zt.ON_PAYMENT_COMPLETE,l);case 7:case"end":return c.stop()}},s)}));return function(s){return a.apply(this,arguments)}}())})}}]),i}(eo)});function uI(n,i,t){return i=w(i),q(n,Fm()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function Fm(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Fm=function(){return!!n})()}var tc,fn,rc=W(function(){T();J();X();ue();oe();le();Se();Nm();dt();Cn();Qr();Yn();Bt();Ca();Ve.JeefEvents||(Ve.JeefEvents=Ht.getInstance());ne("SubscriptionLinkingTS");tc="SubscriptionLinkingTS",fn=function(n){B(i,n);function i(){var t;return k(this,i),t=uI(this,i),t._user=se.getInstance(),t}return A(i,[{key:"checkUser",value:function(e){this.conf=e,this._user.isSubscriber()||this.init()}},{key:"init",value:function(){var e=this;Ve.JeefEvents.on(Zt.ON_PAYMENT_COMPLETE,function(r){e.onPaymentComplete(r)}),Ve.JeefEvents.on(Zt.ON_PURCHASE_FINISH,function(r){e.onPurchaseFinish(r)}),this.injectJss()}},{key:"onPurchaseFinish",value:function(e){this.setPurchaseRequest(this.conf.purchaseEndpoint,Wr.POST,this._onPurchaseFinishRequest,this._onPurchaseErrorRequest,null,e)}},{key:"setPurchaseRequest",value:function(e,r,a,s){var o=this,l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,u=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,c=arguments.length>6&&arguments[6]!==void 0?arguments[6]:"include",f={method:r,credentials:c};l&&(f.headers=l),u&&(f.body=JSON.stringify(u)),fetch(e,f).then(function(d){return d.json()}).catch(function(d){return s.apply(o,[d])}).then(function(d){return a.apply(o,[d])})}},{key:"_onPurchaseFinishRequest",value:function(e){this._user.refreshUser(),Mi(),P(['jeeiSite.user.googleRRME.Carrousel>_onPurchaseFinishRequest", "Respuesta del servicio: '.concat(e)],tc)}},{key:"_onPurchaseErrorRequest",value:function(e){P(['jeeiSite.user.googleRRME.Carrousel>_onPurchaseErrorRequest", "Respuesta del servicio: '.concat(e)],tc)}},{key:"onPaymentComplete",value:function(e){P(['jeeiSite.user.googleRRME.Carrousel>onPaymentComplete", "Respuesta del servicio: '.concat(e)],tc)}}],[{key:"getInstance",value:function(){return this._instance||(this._instance=new i),this._instance}}]),i}(Mm)});function cI(n){var i=document.querySelector(".full-suscriptor-container");if(n){i==null||i.remove();return}if(!i){var t=document.getElementById("paragraph_1");if(t){var e=document.createElement("div");e.className="full-suscriptor-container",t.insertAdjacentElement("afterend",e)}}}function fI(n,i){document.body.classList.toggle("closed-content",!i),n.setAttribute("data-user-access",i?"true":"false"),cI(i)}function Um(n){if(window.jeeiSite.dyn.DOMContentLoaded!==!0){ie(document,"DOMContentLoaded",function(){return Um(n)});return}var i=(n==null?void 0:n.access)===!0||(n==null?void 0:n.granted)===!0,t=document.getElementById("fbody");t&&fI(t,i)}var Bm=W(function(){T();ze();jeef.user||(jeef.user={});jeef.user.SetUserAccess=Um});function dI(n,i,t){return i=w(i),q(n,Gm()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function Gm(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Gm=function(){return!!n})()}var er,ic,Gr,zn=W(function(){T();J();X();ue();oe();le();yi();eu();ze();Un();mt();ft();Se();dt();Mr();pi();
1_e();Ma();ti();rc();Bm();er="CommonPianoIntegration";ne(er);ic="rmSkipOnboardingFromComments",Gr=function(n){B(i,n);function i(){var t;return k(this,i),t=dI(this,i),t._pianoSDK=ht.getInstance(),t._onBoardingRegister=!1,t._onBoardingSubscriber=!1,t._user=se.getInstance(),t._reload=!1,t._data=null,t._originLoad=null,t._configurationPianoModals=I.user.piano_modals,t.ridSWG=I.piano.ridSwg,t.callback=window.location.href,t.listeningForLoginInCookieWall=!1,I.user.userRoutes.stage!==""&&I.user.userRoutes.stage&&t.setOriginLoad(I.user.userRoutes.stage),t}return A(i,[{key:"setCallBack",value:function(e){this.callback=e}},{key:"getCallBack",value:function(){return this.callback}},{key:"setRidSWG",value:function(e){this.ridSWG=e}},{key:"getRidSWG",value:function(){return this.ridSWG}},{key:"setConfigurationPianoModals",value:function(e){this._configurationPianoModals=e}},{key:"setOriginLoad",value:function(e){this._originLoad=e}},{key:"enableReload",value:function(e){return this._reload=e,this}},{key:"init",value:function(){this._originLoad&&this._pianoSDK.setOriginLoad(this._originLoad),P(["jeeiSite.hp.CommonPianoIntegration>init>","Iniciamos la carga del JS de Piano"],er),ie(this._pianoSDK,me.ON_TRIGGER_SDK_LOADED,this._onPianoReady,this),this.addListeners()}},{key:"addListeners",value:function(){var e=this;P(["jeeiSite.hp.CommonPianoIntegration>addListeners>","A\xF1adimos los callbacks necesarios"],er),ie(this._pianoSDK,me.ON_LOGGIN_SUCCESS,this._onLogin,this),ie(this._pianoSDK,me.ON_LOGOUT_SUCCESS,this._onLogout,this),ie(this._pianoSDK,me.ON_REGISTER_SUCCESS,this._onRegister,this),ie(this._pianoSDK,me.ON_LOGOUT_TRIGGER,this._onLogoutTrigger,this),ie(this._pianoSDK,me.ON_ACCEPT_COOKIES_TRIGGER_COOKIEWALL,this._onAcceptCookiesTriggerCookiewall,this),ie(this._pianoSDK,me.ON_CHECKOUT_COMPLETE,this._onCheckoutComplete,this),jeef.JeefEvents.on(be.ON_PIANO_SHOW_OFFER,function(){return e._onShowOffer()})}},{key:"_retrieveCallback",value:function(e){P(["jeeiSite.hp.CommonPianoIntegration>_retrieveCallback>","Llamada a recuperar el par\xE1metro callback de la URL si lo hubiera"],er);var r=new URLSearchParams(window.location.search);return r.get("callback")||e}},{key:"_onCheckoutComplete",value:function(e){P(["jeeiSite.hp.CommonPianoIntegration>_onCheckoutComplete>","El usuario termina la compra en Piano"],er),this._user.loginSync(e.data.uid,this._originLoad),this._data=e.data,this._data.origin=this._originLoad,jeef.JeefEvents.emit(ii.ON_CHECKOUT_COMPLETE),this.enableReload(!0),document.location.href.match(/\/(suscripciones|subscriptions)\//)&&document.location.href.match(/^((?!callback=).)*$/)!==null&&this.enableReload(!1),ie(this._user,xe.ON_USER_SYNC_LAYOUT_FINISH,this._postDispatchPurchaseUser,this)}},{key:"_postDispatchPurchaseUser",value:function(){P(["jeeiSite.hp.CommonPianoIntegration>_postDispatchPurchaseUser>","Ejecutamos acciones despu\xE9s de la compra del usuario"],er);var e={data:JSON.stringify(this._data)};this._user.purchaseSync(JSON.stringify(e)),this._onBoardingSubscriber=!0,ie(this._user,xe.ON_USER_PURCHASE_REFRESH,this._postDispatchLoginRefresh,this)}},{key:"_onLogin",value:function(e){P(["jeeiSite.hp.CommonPianoIntegration>_onLogin>","Piano nos devuelve el control para identificar al usuario en nuestro sistema"],er),this._user.loginSync(e.data.params.uid,this._originLoad),ie(this._user,xe.ON_USER_SYNC_LAYOUT_FINISH,this._postDispatchLogin,this)}},{key:"_onAcceptCookiesTriggerCookiewall",value:function(e){window.Didomi.setUserAgreeToAll(),this._unlistenForLoginInCookiewall()}},{key:"_onLoginForCookies",value:function(){this._user.isSubscriberNoCookies()&&(window.tp.offer.close(),this._unlistenForLoginInCookiewall())}},{key:"_listenForLoginInCookiewall",value:function(){this.listeningForLoginInCookieWall=!0,ie(this._user,xe.ON_USER_SYNC_LAYOUT_FINISH,this._onLoginForCookies,this)}},{key:"_unlistenForLoginInCookiewall",value:function(){this.listeningForLoginInCookieWall&&ba(this._pianoSDK,me.ON_LOGGIN_SUCCESS,this._onLoginForCookies,this)}},{key:"_onShowOffer",value:function(){$l()===!0&&!this._user.isSubscriberNoCookies()&&this._listenForLoginInCookiewall()}},{key:"_postDispatchLoginRefresh",value:function(){var e=this;P(["jeeiSite.hp.CommonPianoIntegration>_postDispatchLoginRefresh>","Acciones de refresco o no de p\xE1gina despu\xE9s del login"],er),setTimeout(function(){e._hasOnboardingActive()?window.location.href=e._getOnboardingRedirectUrl():e._reload&&(window.location.href=e._retrieveCallback(e.getCallBack()))},50)}},{key:"_hasOnboardingActive",value:function(){var e,r,a,s,o;try{if(window.sessionStorage.getItem(ic))return window.sessionStorage.removeItem(ic),!1}catch(l){}return!(!((e=I.user.onboarding)!==null&&e!==void 0&&e.active)||this._onBoardingRegister&&((r=I.user.onboarding.excludedReg
1istrationPaths)!==null&&r!==void 0?r:[]).some(function(l){return window.location.pathname.includes(l)})||!this._onBoardingSubscriber&&!this._onBoardingRegister||this._onBoardingSubscriber&&((a=I.user.onboarding.excludedSubscriptionPaths)!==null&&a!==void 0?a:[]).some(function(l){return window.location.pathname.includes(l)})&&!((s=this._data)!==null&&s!==void 0&&s.rid&&((o=I.user.onboarding.subscriberExcludedPathsExceptions)!==null&&o!==void 0?o:[]).includes(this._data.rid)))}},{key:"_getOnboardingRedirectUrl",value:function(){var e=new URL(window.location.href),r=e.pathname,a=e.searchParams,s=new URL(I.user.userRoutes.onBoardingSubscriber),o=this.getCallBack(),l=o||window.location.href;return r.includes(I.user.userRoutes.pathOnboardingRegister)&&(s=r.replace(I.user.userRoutes.pathOnboardingRegister,I.user.userRoutes.pathOnboardingSubscriber),o||(l=I.user.userRoutes.home)),a.set("callback",encodeURIComponent(l)),s+"?"+a.toString()}},{key:"_postDispatchLogin",value:function(){var e=this;P(["jeeiSite.hp.CommonPianoIntegration>_postDispatchLogin>","Acciones de refresco o no de p\xE1gina despu\xE9s del login"],er),setTimeout(function(){if(e._hasOnboardingActive()){var r=e._onBoardingSubscriber?I.user.userRoutes.onBoardingSubscriber:I.user.userRoutes.onBoardingRegister;window.location.href="".concat(r,"?callback=").concat(encodeURIComponent(window.location.href))}else e._reload&&(window.location.href=e._retrieveCallback(e.getCallBack()))},50)}},{key:"_onLogout",value:function(e){P(["jeeiSite.hp.CommonPianoIntegration>_onLogout>","Piano nos devuelve el control para desconectar al usuario en nuestro sistema"],er),this._user.logout(),this._doLogoutSpotIm()}},{key:"_doLogoutSpotIm",value:function(){window.SPOTIM&&window.SPOTIM.logout&&window.SPOTIM.logout()}},{key:"_onRegister",value:function(e){e.data.stage&&(this._originLoad=e.data.stage),e.data.onBoardingRegister&&(this._onBoardingRegister=e.data.onBoardingRegister),jeef.JeefEvents.emit(ii.ON_REGISTER_COMPLETE),P(["jeeiSite.hp.CommonPianoIntegration>_onRegister>","Piano nos devuelve el control para registrar al usuario en nuestro sistema"],er),this._user.registerSync(e.data.params.uid,this._originLoad,e.data.context),ie(this._user,xe.ON_USER_SYNC_LAYOUT_FINISH,this._postDispatchLogin,this)}},{key:"_onLogoutTrigger",value:function(e){P(["jeeiSite.hp.CommonPianoIntegration>_onLogoutTrigger>","Piano nos devuelve el control para desconectar al usuario en nuestro sistema"],er),this._user.cleanSession(),this._postDispatchLogout(e)}},{key:"_postDispatchLogout",value:function(e){var r=this;P(["jeeiSite.hp.CommonPianoIntegration>_onLogoutTrigger>","Acciones despu\xE9s de desconectar al usuario en nuestro sistema"],er),setTimeout(function(){window.location.href=r._retrieveCallback(window.location.href)},50)}},{key:"_onPianoReady",value:function(){P(["jeeiSite.hp.CommonPianoIntegration>_onPianoReady>","Termina la carga del JS de Piano"],er),ie(document,de.ON_DOM_CLICK,this._onClickElement,this),ie(window,de.ON_DOM_MESSAGE,this._postMessage,this),this._changeProfileUrls(),this._doSpecificImplementation()}},{key:"_changeProfileUrls",value:function(){var e=I.user.userRoutes.loginPage,r=I.user.userRoutes.logoutPage,a=I.user.userRoutes.profilePage,s=I.user.userRoutes.subscriptionPage;document.querySelectorAll(".user__edit").forEach(function(o){return o.setAttribute("href",a)}),document.querySelectorAll(".user__close").forEach(function(o){return o.setAttribute("href",r)}),document.querySelectorAll(".user__close").forEach(function(o){return o.setAttribute("href",r)}),document.querySelectorAll(".user__login").forEach(function(o){return o.setAttribute("href",e)}),["nav_suscribete","link_bar_top_user_area"].forEach(function(o){var l=document.getElementById(o);try{var u;l==null||l.getAttribute("href").replace(new URL((u=document.getElementById(o))===null||u===void 0?void 0:u.getAttribute("href")).pathname,new URL(s).pathname),l&&i.addCallBackPageInLinkElement(l)}catch(c){Dt(c)}})}},{key:"_onClickElement",value:function(e){P(["jeeiSite.hp.CommonPianoIntegration>_onClickElement>","Click en los botones de Identificacion/Registro de la hamburguesa"],er);var r=Vt("data-type",e.target,e.currentTarget),a,s,o;switch(r&&(a=r[1],s=r[0].getAttribute("data-subtype"),o=r[0].getAttribute("data-refresh")||this._reload||!1),a){case"user":if(e.native.preventDefault(),s==="logout"){ht.getInstance().dispatchEvent(new me(me.ON_LOGOUT_SUCCESS));return}try{var l=this._configurationPianoModals[a][s],u=l.screen,c=l.display,f=l.stage;i.showModal(u,c,f),this.enableReload(o)}catch(d){P(["Error de modal de usuario:",d.message],CHANNEL)}break}}},{key:"_doSpecificImplementation",value:function(){}},{key:"_postMessage",value:function(e){var r=/^https:\/\/([a-z0-9-]+\.)?(elespanol\.com|tinypass\.com)$/;e.native.data==="buttonRRME"&&r.test(e.native.origin)&&(fn.getInstance().checkUser(I.GoogleRRME),fn.getInstance().showCarrousel())}},{key:"_handleOnboardingRedirect",value:function(){if(this._hasOnboardingActive()){var e=this._onBoardingSubscriber?I.user.userRoutes.onBoardingSubscriber:I.user.userRoutes.onBoardingRegister;window.location.href="".concat(e,"?callback=").concat(encodeURIComponent(window.location.href))}}}],[{key:"showInlineFormPiano",value:function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;P(["jeeiSite.hp.CommonPianoIntegration>showInlineFormPiano>","Carga de modal de Piano inline"],er),window.tp.pianoId.show({displayMode:r,
1screen:e,containerSelector:"#".concat(a),stage:s})}},{key:"skipOnboardingOnce",value:function(){try{window.sessionStorage.setItem(ic,"1")}catch(e){}}},{key:"showModal",value:function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;P(["jeeiSite.hp.CommonPianoIntegration>showInlineFormPiano>","Carga de modal de Piano"],er),window.tp.pianoId.show({displayMode:r,screen:e,stage:a})}},{key:"addCallBackPageInLinkElement",value:function(e){if(e){var r=e.getAttribute("href"),a="?",s=encodeURIComponent(document.location.href);r.match(/callback/)?r=r.replace(/callback=([^&]*)/,"callback="+s):(r.match(/\?/)&&(a="&"),r=r+a+"callback="+s),e.setAttribute("href",r)}}}]),i}(Re)});var jm={};Et(jm,{default:function(){return hI}});var hI,Hm=W(function(){T();J();X();$e();dt();zn();yi();Un();ze();En();hI=function(){function n(i,t){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;k(this,n),this._spotId=i,this._token=r,this._pianoSDK=ht.getInstance(),this._containerId=t,this._postId=e}return A(n,[{key:"setToken",value:function(t){return this._token=t,this}},{key:"setPostId",value:function(t){return this._postId=t,this}},{key:"setContainerId",value:function(t){return this._containerId=t,this}},{key:"setSpotId",value:function(t){return this._spotId=t,this}},{key:"load",value:function(){var t=this,e=document.createElement("script"),r=Q.getMain(),a=document.getElementById(this._containerId),s=r.hashtags||"",o="".concat(location.protocol,"//").concat(location.host).concat(location.pathname),l=this._postId?this._postId:Q.getMainId(),u=this._pianoSDK.getOriginLoad();e.async=!0,e.src="https://launcher.spot.im/spot/".concat(this._spotId),e.onload=function(){se.getInstance().isAnonymous()?(ie(t._pianoSDK,me.ON_LOGGIN_SUCCESS,function(){window.SPOTIM&&window.SPOTIM.startSSOForProvider?c.bind(t)():document.addEventListener("spot-im-api-ready",c,!1)},t),window.SPOTIM&&window.SPOTIM.logout?window.SPOTIM.logout():document.addEventListener("spot-im-api-ready",function(){window.SPOTIM.logout()},!1),document.addEventListener("spot-im-login-start",function(f){Gr.showModal(Je.PIANO_SCREEN_LOGIN,Je.PIANO_DISPLAY_MODAL,u)})):window.SPOTIM&&window.SPOTIM.startSSOForProvider?c.bind(t)():document.addEventListener("spot-im-api-ready",c,!1);function c(){window.SPOTIM.startSSOForProvider({provider:"piano",token:window.tp.pianoId.getToken()}).then(function(f){console.log(f)}).catch(function(f){console.log(f)})}se.getInstance().isSubscriber()&&(window.__SPOTIM_ADS_DISABLED__=!0,window.__SPOTIM_DISABLE_ADS__&&window.__SPOTIM_DISABLE_ADS__())},e.setAttribute("data-spotim-module","spotim-launcher"),e.setAttribute("data-post-url",o),e.setAttribute("data-article-tags",s),e.setAttribute("data-post-id",l),a.appendChild(e)}}]),n}()});var lr,Ei=W(function(){T();J();X();mi();lr=function(){function n(i,t){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};k(this,n),this._containerId=i,this._symbolCompany="",this._symbolNormalized="",this._data=t,this._id="",this._ids=[],this._extraParams=e}return A(n,[{key:"getURLWidget",value:function(){return""}},{key:"load",value:function(){this._prepareSymbol(),this._printContent(this._composeHTML())}},{key:"_printContent",value:function(t){var e=document.getElementById(this._containerId);e&&(Is(e,t,!0),this._loadScript())}},{key:"_loadScript",value:function(){}},{key:"_appendTagScript",value:function(t){var e=document.createElement("script");e.src=this.getURLWidget(),e.async=!0,e.type="text/javascript",e.innerHTML=JSON.stringify(t),document.getElementById(this._containerId).appendChild(e)}},{key:"_prepareSymbol",value:function(){try{this._id=this._data.id,this._symbolCompany=this._id.split(":")[0],this._symbolNormalized=this._id.replace(":","-")}catch(t){}}},{key:"_composeHTML",value:function(){}}]),n}()});var Km={};Et(Km,{default:function(){return pI}});function vI(n,i,t){return i=w(i),q(n,Vm()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function Vm(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Vm=function(){return!!n})()}var pI,Wm=W(function(){T();J();X();ue();oe();le();Ei();pI=function(n){B(i,n);function i(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return k(this,i),vI(this,i,[t,e,r])}return A(i,[{key:"getURLWidget",value:function(){return"https://s3.tradingview.com/external-embedding/embed-widget-financials.js"}},{key:"_loadScript",value:function(){var e={symbol:this._id,colorTheme:"light",isTransparent:!0,largeChartUrl:"",displayMode:"compact",customer:"elespanolcom",width:"100%",height:"490",locale:"es"};this._appendTagScript(Object.assign(e,this._extraParams))}},{key:"_composeHTML",value:function(){return'<div class="tradingview-widget-container__widget"></div>\n <div class="tradingview-widget-copyright">\n <a href="https://es.tradingview.com/symbols/NASDAQ-AAPL/" rel="noopener" target="_blank"><span class="blue-text">AAPL Datos fundamentales </span></a> por TradingView\n </div>'}}]),i}(lr)});var Ym={};Et(Ym,{default:function(){return gI}});function mI(n,i,t){return i=w(i),q(n,qm()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function qm(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(qm=function(){return!!n})()}var gI,zm=W(function(){T();J();X();ue();oe();le();Ei();Xt();ze();Ut();pt();gI=function(n){B(i,n);function i(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return k(this,i),mI(this,i,[t,e,r])}return A(i,[{key:"getURLWidget",value:function(){return"https://s3.tradingview.com/tv.js"}},{key:"load",value:function(){this._prepareSymbol(),this._composeHTML()}},{key:"_composeHTML",value:function(){var e=this,r="tradingiew_382c4_".concat(this._symbolCompany),a={width:"100%",height:550,symbol:this._id,interval:"60",timezone:"Europe/Madrid",customer:"elespanolcom",theme:"Light",style:"2",locale:"es",toolbar_bg:"#f1f3f6",hide_legend:!0,details:!0,enable_publishing:!1,hide_top_toolbar:!1,save_image:!1,
1container_id:r};Tt.smartphone&&(a={width:"100%",height:350,symbol:this._id,interval:"60",timezone:"Europe/Madrid",customer:"elespanolcom",theme:"Light",style:"3",locale:"es",toolbar_bg:"#fff0e5",hide_legend:!0,hide_top_toolbar:!1,enable_publishing:!1,isTransparent:!0,save_image:!1,container_id:r});var s=Object.assign(a,this._extraParams),o=new Ke;window.TrandingView?this._printContent(this._getTemplateHTML(s,r)):(ie(o,he.ON_IO_FINISH,function(){e._printContent(e._getTemplateHTML(s,r))},this),o.load(this.getURLWidget()))}},{key:"_getTemplateHTML",value:function(e,r){return"<div id=".concat(r,'></div>\n <div class="tradingview-widget-copyright"><a href="https://es.tradingview.com/symbols/').concat(this._symbolNormalized,'/" rel="noopener" target="_blank"><span class="blue-text">').concat(this._symbolCompany,' Gr\xE1fico</span></a> por TradingView</div>\n <script type="text/javascript">\n\n new TradingView.widget(\n ').concat(JSON.stringify(e),"\n )\n\n <\/script>")}}]),i}(lr)});var Xm={};Et(Xm,{default:function(){return _I}});function yI(n,i,t){return i=w(i),q(n,Jm()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function Jm(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Jm=function(){return!!n})()}var _I,Qm=W(function(){T();J();X();ue();oe();le();Ei();_I=function(n){B(i,n);function i(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return k(this,i),yI(this,i,[t,e,r])}return A(i,[{key:"getURLWidget",value:function(){return"https://s3.tradingview.com/external-embedding/embed-widget-technical-analysis.js"}},{key:"_loadScript",value:function(){var e={interval:"1m",width:"100%",height:"475",customer:"elespanolcom",colorTheme:"light",isTransparent:!0,symbol:this._id,showIntervalTabs:!0,locale:"es"};this._appendTagScript(Object.assign(e,this._extraParams))}},{key:"_composeHTML",value:function(){return'<div class="tradingview-widget-container__widget"></div>\n <div class="tradingview-widget-copyright"><a href="https://es.tradingview.com/symbols/'.concat(this._symbolNormalized,'/technicals/" rel="noopener" target="_blank"><span class="blue-text">An\xE1lisis t\xE9cnico de ').concat(this._symbolCompany,"</span></a> por TradingView</div>\n ")}}]),i}(lr)});var Zm={};Et(Zm,{default:function(){return SI}});function EI(n,i,t){return i=w(i),q(n,$m()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function $m(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return($m=function(){return!!n})()}var SI,eg=W(function(){T();J();X();ue();oe();le();Ei();SI=function(n){B(i,n);function i(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return k(this,i),EI(this,i,[t,e,r])}return A(i,[{key:"getURLWidget",value:function(){return"https://s3.tradingview.com/external-embedding/embed-widget-market-quotes.js"}},{key:"_loadScript",value:function(){var e={width:"100%",height:"350",customer:"elespanolcom",colorTheme:"light",isTransparent:!0,locale:"es",symbolsGroups:this._data.ids};this._appendTagScript(Object.assign(e,this._extraParams))}},{key:"_composeHTML",value:function(){return'<div class="tradingview-widget-container__widget"></div>\n <div class="tradingview-widget-copyright"><a href="https://es.tradingview.com/markets/indices/" rel="noopener" target="_blank"><span class="blue-text">\xCDndices</span></a> por Tradingview</div>'}}]),i}(lr)});var rg={};Et(rg,{default:function(){return bI}});function TI(n,i,t){return i=w(i),q(n,tg()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function tg(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(tg=function(){return!!n})()}var bI,ig=W(function(){T();J();X();ue();oe();le();Ei();bI=function(n){B(i,n);function i(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return k(this,i),TI(this,i,[t,e,r])}return A(i,[{key:"getURLWidget",value:function(){return"https://s3.tradingview.com/external-embedding/embed-widget-single-quote.js"}},{key:"_loadScript",value:function(){var e={symbol:this._id,width:"100%",colorTheme:"light",isTransparent:!0,customer:"elespanolcom",locale:"es"};this._appendTagScript(Object.assign(e,this._extraParams))}},{key:"_composeHTML",value:function(){return'<div class="tradingview-widget-container__widget"></div>\n <div class="tradingview-widget-copyright"><a\n href="https://es.tradingview.com/symbols/'.concat(this._symbolNormalized,'/" rel="noopener"\n target="_blank"><span class="blue-text">').concat(this._symbolCompany," Cotizaciones</span></a> por\n TradingView</div>")}}]),i}(lr)});var ag={};Et(ag,{default:function(){return AI}});function kI(n,i,t){return i=w(i),q(n,ng()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function ng(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(ng=function(){return!!n})()}var AI,sg=W(function(){T();J();X();ue();oe();le();Ei();AI=function(n){B(i,n);function i(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return k(this,i),kI(this,i,[t,e,r])}return A(i,[{key:"getURLWidget",value:function(){return"https://s3.tradingview.com/external-embedding/embed-widget-mini-symbol-overview.js"}},{key:"_loadScript",value:function(){var e={symbol:this._id,width:"100%",height:"100%",locale:"es",dateRange:"1d",colorTheme:"light",customer:"elespanolcom",trendLineColor:"rgba(101, 101, 101, 1)",underLineColor:"rgba(152, 152, 152, 0.25)",isTransparent:!0,autosize:!0,largeChartUrl:""};this._appendTagScript(Object.assign(e,this._extraParams))}},{key:"_composeHTML",value:function(){return'<div class="tradingview-widget-container__widget"></div>\n <div class="tradingview-widget-copyright"><a\n href="https://es.tradingview.com/symbols/'.concat(this._symbolNormalized,'/" rel="noopener"\n target="_blank"><span class="blue-text">').concat(this._symbolCompany," Cotizaciones</span></a> por\n TradingView</div>")}}]),i}(lr)});var lg={};Et(lg,{default:function(){return CI}});function II(n,i,t){return i=w(i),q(n,og()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function og(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(og=function(){return!!n})()}var CI,ug=W(function(){T();J();X();ue();oe();le();Ei();CI=function(n){B(i,n);function i(){k(this,i);for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return II(this,i,[].concat(e))}return A(i,[{key:"getURLWidget",value:function(){return"https://s3.tradingview.com/external-embedding/embed-widget-market-
1overview.js"}},{key:"_loadScript",value:function(){var e={colorTheme:"light",dateRange:"12m",showChart:!1,locale:"es",width:"100%",height:"400",customer:"elespanolcom",largeChartUrl:"",isTransparent:!0,tabs:this._data.ids};this._appendTagScript(Object.assign(e,this._extraParams))}},{key:"_composeHTML",value:function(){var e="";return this._ids.forEach(function(r){e+='<a ref="https://es.tradingview.com/markets/indices/" rel="noopener" target="_blank"><span class="blue-text">'.concat(r.title,"</span></a>")}),'<div class="tradingview-widget-container__widget"></div>\n <div class="tradingview-widget-copyright">\n '.concat(e," \n </div>")}}]),i}(lr)});var fg={};Et(fg,{default:function(){return RI}});function LI(n,i,t){return i=w(i),q(n,cg()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function cg(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(cg=function(){return!!n})()}var RI,dg=W(function(){T();J();X();ue();oe();le();Ei();Xt();ze();Ut();RI=function(n){B(i,n);function i(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return k(this,i),LI(this,i,[t,e,r])}return A(i,[{key:"getURLWidget",value:function(){return"https://s3.tradingview.com/tv.js"}},{key:"load",value:function(){this._prepareSymbol(),this._composeHTML()}},{key:"_composeHTML",value:function(){var e=this,r="tradingiew_382c4_".concat(this._symbolCompany),a={symbols:[[this._id.split(":")[0],this._id]],chartOnly:!1,width:"100%",height:"300",customer:"elespanolcom",locale:"es",colorTheme:"light",gridLineColor:"#F0F3FA",trendLineColor:"rgba(101, 101, 101, 1)",fontColor:"#787B86",underLineColor:"rgba(182, 182, 182, 0.29)",isTransparent:!0,autosize:!1,container_id:r},s=Object.assign(a,this._extraParams),o=new Ke;window.TrandingView?this._printContent(this._getTemplateHTML(s,r)):(ie(o,he.ON_IO_FINISH,function(){e._printContent(e._getTemplateHTML(s,r))},this),o.load(this.getURLWidget()))}},{key:"_getTemplateHTML",value:function(e,r){return"<div id=".concat(r,'></div>\n <div class="tradingview-widget-copyright"><a href="https://es.tradingview.com/symbols/').concat(this._symbolNormalized,'/" rel="noopener" target="_blank"><span class="blue-text">').concat(this._symbolCompany,' Cotizaciones</span></a> por TradingView</div>\n <script type="text/javascript">\n \n new TradingView.MediumWidget(\n ').concat(JSON.stringify(e),"\n )\n \n <\/script>")}}]),i}(lr)});var vg={};Et(vg,{default:function(){return hg}});var hg,pg=W(function(){T();J();X();Jt();ct("jeeiSite.video.youTube.AdYouTubeSM");hg=function(){function n(){k(this,n)}return A(n,null,[{key:"init",value:function(t){if(typeof SMYTPlayerIP!="undefined"&&typeof SMYTPlayerIP.slot=="function"&&typeof t.ids!="undefined")for(var e=0,r=t.ids;r.length>e;e++)SMYTPlayerIP.slot(r[e])}}]),n}();window.jeeiSite.video.youTube.AdYouTubeSM=hg});var mg={};Et(mg,{default:function(){return OI}});var OI,gg=W(function(){T();J();X();ze();Aa();Fn();Mr();OI=function(){function n(i,t){k(this,n),this.imagesToLoad=t.imagesToLoad||[],this.timerInterval=t.timerInterval||5,this.imgElementSupport=document.getElementById(t.elementId),this.containerElement=document.getElementById(i),this.captionElement=document.getElementById("media_"+t.captionId),this.dataCaption=t.captionToLoad||[],this.position=1,this.initialPosition=0,this.timer=new Pi(this.timerInterval*1e3),this.loadTimer=!1}return A(n,[{key:"init",value:function(){this.containerElement&&this.imgElementSupport&&(this.imgElementSupport.src=this.imagesToLoad[this.initialPosition],ie(this.imgElementSupport,de.ON_DOM_LOAD,this.onLoadFirstImgElement,this))}},{key:"changeCaption",value:function(){if(this.captionElement&&this.dataCaption[this.position]){var t=this.captionElement.querySelector(".caption-author"),e=this.captionElement.querySelector(".caption-provider"),r=this.captionElement.querySelector(".caption-location");t&&(t.innerHTML=this.dataCaption[this.position][0]),e&&(e.innerHTML=this.dataCaption[this.position][1]),r&&(e.innerHTML=this.dataCaption[this.position][2])}}}
1,{key:"onTimerRefreshImages",value:function(){this.imgElementSupport.getAttribute("srcset")&&this.imgElementSupport.removeAttribute("srcset"),this.imgElementSupport.src=this.imagesToLoad[this.position],this.changeCaption(),this.position++,this.position===this.imagesToLoad.length&&(this.position=0)}},{key:"onLoadFirstImgElement",value:function(){this.loadTimer||(ie(this.timer,hr.ON_TM_TIMER,this.onTimerRefreshImages,this),this.timer.start(),this.loadTimer=!0)}}]),n}()});var _g=fi(function(Ua,yg){T();vt();(function(n,i){(typeof Ua=="undefined"?"undefined":pe(Ua))==="object"?yg.exports=Ua=i(cu()):typeof define=="function"&&define.amd?define(["./core"],i):i(n.CryptoJS)})(Ua,function(n){return function(){var i=n,t=i.lib,e=t.WordArray,r=t.Hasher,a=i.algo,s=[],o=a.SHA1=r.extend({_doReset:function(){this._hash=new e.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(u,c){for(var f=this._hash.words,d=f[0],h=f[1],v=f[2],m=f[3],p=f[4],g=0;g<80;g++){if(g<16)s[g]=u[c+g]|0;else{var E=s[g-3]^s[g-8]^s[g-14]^s[g-16];s[g]=E<<1|E>>>31}var y=(d<<5|d>>>27)+p+s[g];g<20?y+=(h&v|~h&m)+1518500249:g<40?y+=(h^v^m)+1859775393:g<60?y+=(h&v|h&m|v&m)-1894007588:y+=(h^v^m)-899497514,p=m,m=v,v=h<<30|h>>>2,h=d,d=y}f[0]=f[0]+d|0,f[1]=f[1]+h|0,f[2]=f[2]+v|0,f[3]=f[3]+m|0,f[4]=f[4]+p|0},_doFinalize:function(){var u=this._data,c=u.words,f=this._nDataBytes*8,d=u.sigBytes*8;return c[d>>>5]|=128<<24-d%32,c[(d+64>>>9<<4)+14]=Math.floor(f/4294967296),c[(d+64>>>9<<4)+15]=f,u.sigBytes=c.length*4,this._process(),this._hash},clone:function(){var u=r.clone.call(this);return u._hash=this._hash.clone(),u}});i.SHA1=r._createHelper(o),i.HmacSHA1=r._createHmacHelper(o)}(),n.SHA1})});var Eg,to,Sg,Tg=W(function(){T();J();X();ft();Se();Eg=fr(_g(),1),to="CommonOptaScore";ne(to);Sg=function(){function n(i){k(this,n),this.params=i,this.hashInitialData=null,this.timeInterval=1e4,this.maxIntervalExec=10,this.execInterval=0,this.intervalId=null}return A(n,[{key:"processMatch",value:function(t,e){if(e.getAttribute("data-load")==="manual"){var r=this.checkStatusMatchManual(e),a=e.querySelector(".".concat(r));r==="playing"&&this.showLiveLinkInFixtureMatch(e,t.envivo),r!=="played"&&t.channel.logo&&(e.querySelector("."+t.status+" .score__date-channel").setAttribute("src",t.channel.logo),e.querySelector("."+t.status+" .score__date-channel").setAttribute("title",t.channel.title)),r==="fixture"&&(a.querySelector(".info").innerHTML=t.date+" "+t.time,t.envivo&&this.showLiveLinkInFixtureMatch(e,t.envivo)),r==="played"&&a.setAttribute("href",t.cronica)}if(e.getAttribute("data-load")!=="manual"){var s,o;e.setAttribute("data-state",t.status);var l=e.querySelector("."+t.status);e.querySelector(".left .score__score").childNodes[0].textContent=t.teams[0].score,e.querySelector(".right .score__score").childNodes[0].textContent=t.teams[1].score,t.status==="playing"&&e.querySelector(".score__date-detail.live.playing").setAttribute("href",t.envivo),t.status!=="played"&&t.channel.logo&&(e.querySelector("."+t.status+" .score__date-channel").setAttribute("src",t.channel.logo),e.querySelector("."+t.status+" .score__date-channel").setAttribute("title",t.channel.title)),l&&t.status==="fixture"&&(l.querySelector(".info").innerHTML=t.date+" "+t.time,t.envivo&&this.showLiveLinkInFixtureMatch(e,t.envivo)),l&&t.status==="played"&&l.setAttribute("href",t.cronica),l&&ae(l,!0);var u=e.querySelector(".left .score__players");u&&t!==null&&t!==void 0&&(s=t.goalPlayers)!==null&&s!==void 0&&s.goalPlayersHouse&&(ae(u,!0),e.querySelector(".left .score__players").textContent=t.goalPlayers.goalPlayersHouse.join(", "));var c=e.querySelector(".right .score__players");if(c&&t!==null&&t!==void 0&&(o=t.goalPlayers)!==null&&o!==void 0&&o.goalPlayersAway&&(ae(c,!0),e.querySelector(".right .score__players").textContent=t.goalPlayers.goalPlayersAway.join(", ")),t.teams[1].score_pen){var f=e.querySelector(".left .score__score .penalti");f.textContent=t.teams[0].score_pen;var d=e.querySelector(".right .score__score .penalti");d.textContent=t.teams[1].score_pen,ae(f,!0),ae(d,!0)}}}},{key:"processMetadata",value:function(){var t=this;P(["jeeiSite.mod.deportes.soccer.CommonOptaScore.processMetadata>","Procesamos los datos del marcador de f\xFAtbol",this.params],to),this.callServiceMatchesData.apply(this),this.intervalId=setInterval(function(){P(["jeeiSite.mod.deportes.soccer.CommonOptaScore.processMetadata>setInterval","Se hace petici\xF3n a los datos cada ".concat(t.timeInterval," milisegundos"),t.params],to),t.callServiceMatchesData.apply(t)},this.timeInterval)}},{key:"callServiceMatchesData",value:function(){var t=this;fetch("/services/data/opta/soccer/matches/".concat(this.params.competition,"/").concat(this.params.date,"/")).then(function(e){return e.json()}).then(function(e){var r=(0,Eg.default)(JSON.stringify(e)).toString();if(!t.hashInitialData||t.hashInitialData!==r){P(["jeeiSite.mod.deportes.soccer.CommonOptaScore.processMetadata>setInterval>callServiceMatchesData","Se actualizan los datos del marcador",t.params],to),t.hashInitialData=r;var a=document.getElementById(t.params.container);e.results.map(function(s){var o=a.querySelector("#match_".concat(s.idMatch));o&&t.processMatch(s,o)})}}),this.execInterval++,this.execInterval===this.maxIntervalExec&&(clearInterval(this.intervalId),this.execInterval=0)}}
1,{key:"checkStatusMatchManual",value:function(t){var e="played";return t.querySelector(".score__date-detail.fixture").getAttribute("data-status")==="on"?e="fixture":t.querySelector(".score__date-detail.live.playing").getAttribute("data-status")==="on"?e="playing":t.querySelector(".score__date-detail.cronica.played").getAttribute("data-status")==="on"&&(e="played"),e}},{key:"showLiveLinkInFixtureMatch",value:function(t,e){t.querySelector(".score__date-detail.live.playing").setAttribute("href",e),ae(t.querySelector(".score__date-detail.live.playing"),!0),ae(t.querySelector(".score__date-detail.fixture"),!1)}}]),n}()});var kg={};Et(kg,{default:function(){return PI}});function wI(n,i,t){return i=w(i),q(n,bg()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function bg(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(bg=function(){return!!n})()}function xI(n,i,t,e){var r=ar(w(1&e?n.prototype:n),i,t);return 2&e&&typeof r=="function"?function(a){return r.apply(t,a)}:r}var PI,Ag=W(function(){T();J();X();ue();oe();rn();le();Tg();PI=function(n){B(i,n);function i(t){return k(this,i),wI(this,i,[t])}return A(i,[{key:"processMetadata",value:function(){xI(i,"processMetadata",this,3)([])}}]),i}(Sg)});var Si,Ig,Cg=W(function(){T();J();X();ze();Ol();Se();pi();dt();zn();ti();En();_e();Si="SURVEYS_ABSTRACT";ne(Si);Ig=function(){function n(i){k(this,n),this.eventShowPiano=i.eventShowPiano||Je.PIANO_SCREEN_LOGIN,this.editionId=i.editionId,this.categoryId=i.categoryId,this.urlServiceLoadInitialData=i.urlServiceLoadInitialData,this.urlServiceLoadUserInitialData=i.urlServiceLoadUserInitialData,this.urlServiceVote=i.urlServiceVote,this.maxVotes=null,this.userRoleVote=i.userRoleVote,this.originLoad=I.user.userRoutes.stage,this.requestHeaders={"Content-Type":"application/json"},this.container=null,this.user=se.getInstance(),this.promisesData=[],this.promiseLogin=function(){}}return A(n,[{key:"setContainer",value:function(t){document.getElementById(t)&&(this.container=document.getElementById(t))}},{key:"init",value:function(){this.loadInitialData(),this.user.isRegisteredEE()&&this.loadInitialUserData(!0),ie(this.container,Ze.ON_DOM_CLICK,this._onClick,this),ie(this.user,xe.ON_USER_SYNC_LAYOUT_FINISH,this._onLoadDataUserPostLogin,this),Promise.all(this.promisesData).then(function(t){t.forEach(function(e){jeef.JeefEvents.emit(e.event,e.data)})})}},{key:"_onLoadDataUserPostLogin",value:function(){this.promiseLogin(),this.loadInitialUserData(!1).then(function(t){jeef.JeefEvents.emit(t.event,t.data)})}},{key:"resolveLoginSendData",value:function(t){this.loadSendData(t).then(function(e){jeef.JeefEvents.emit(e.event,e.data)})}},{key:"_onClick",value:function(t){var e=this,r=t.target,a=r.getAttribute("data-candidate-id");if(a)if(this.user.isRegisteredEE())this.resolveLoginSendData(a);else return Gr.showModal(this.eventShowPiano,Je.PIANO_DISPLAY_MODAL,this.originLoad),new Promise(function(s){e.promiseLogin=s}).then(function(s){e.resolveLoginSendData(a)}),!1;zt(["SurveysAbstract._onClick>element",r],Si)}},{key:"callServiceSurvey",value:function(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{"Content-Type":"application/json"},a=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0;return new Promise(function(l){var u={method:e,headers:r};a&&(u.body=JSON.stringify(a)),zt(["SurveysAbstract.callServiceSurvey> ",t,u,o,s],Si),fetch(t,u).then(function(c){return c.json()}).then(function(c){l({success:!0,data:c,event:s})}).catch(function(c){l({success:!1,data:c,event:o})})})}},{key:"loadInitialUserData",value:function(){var t=this,e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;jeef.JeefEvents.once(be.ON_LOAD_USER_INITIAL_DATA_SURVEY,function(a){zt(["SurveysAbstract.loadInitialUserDataSuccess",be.ON_LOAD_USER_INITIAL_DATA_SURVEY,a],Si),t.renderInitialUserDataSurvey(a)}),jeef.JeefEvents.once(be.ON_LOAD_USER_INITIAL_DATA_SURVEY_ERROR,function(a){zt(["SurveysAbstract.loadInitialUserDataError",be.ON_LOAD_USER_INITIAL_DATA_SURVEY_ERROR,a],Si)});var r=this.callServiceSurvey(this.urlServiceLoadUserInitialData,"GET",this.requestHeaders,!1,be.ON_LOAD_USER_INITIAL_DATA_SURVEY,be.ON_LOAD_USER_INITIAL_DATA_SURVEY_ERROR);if(e)this.promisesData.push(r);else return r}},{key:"loadInitialData",value:function(){var t=this;jeef.JeefEvents.once(be.ON_LOAD_INITIAL_DATA_SURVEY,function(e){zt(["SurveysAbstract.loadInitialDataSuccess",be.ON_LOAD_INITIAL_DATA_SURVEY,e],Si),t.renderInitialDataSurvey(e)}),jeef.JeefEvents.once(be.ON_LOAD_INITIAL_DATA_SURVEY_ERROR,function(e){zt(["SurveysAbstract.loadInitialDataError",be.ON_LOAD_INITIAL_DATA_SURVEY_ERROR,e],Si)}),this.promisesData.push(this.callServiceSurvey(this.urlServiceLoadInitialData,"GET",this.requestHeaders,!1,be.ON_LOAD_INITIAL_DATA_SURVEY,be.ON_LOAD_INITIAL_DATA_SURVEY_ERROR))}},{key:"loadSendData",value:function(t){var e=this;jeef.JeefEvents.once(be.ON_LOAD_USER_SEND_DATA_SURVEY,function(a){zt(["SurveysAbstract.sendDataVoteEventSuccess",be.ON_LOAD_USER_SEND_DATA_SURVEY,a],Si),e.render
1SendVote(a,t)}),jeef.JeefEvents.once(be.ON_LOAD_USER_SEND_DATA_SURVEY_ERROR,function(a){zt(["SurveysAbstract.sendDataVoteEventError",be.ON_LOAD_USER_SEND_DATA_SURVEY_ERROR,a],Si)});var r={candidate_id:t,category_id:this.categoryId,edition_id:this.editionId};return this.callServiceSurvey(this.urlServiceVote,"POST",this.requestHeaders,r,be.ON_LOAD_USER_SEND_DATA_SURVEY,be.ON_LOAD_USER_SEND_DATA_SURVEY_ERROR)}},{key:"renderInitialDataSurvey",value:function(t){}},{key:"renderInitialUserDataSurvey",value:function(t){}},{key:"renderSendVote",value:function(t,e){}}]),n}()});var Rg={};Et(Rg,{default:function(){return MI}});function DI(n,i,t){return i=w(i),q(n,Lg()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function Lg(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Lg=function(){return!!n})()}var ro,MI,Og=W(function(){T();J();X();ue();oe();le();Cg();ft();Se();ro="SURVEY_TOP100";ne(ro);MI=function(n){B(i,n);function i(t){var e;return k(this,i),e=DI(this,i,[t]),e.numUserVotes=0,e}return A(i,[{key:"renderInitialDataSurvey",value:function(e){var r=this;this.maxVotes=e.data.max,this.setNumUserVotesLeft(this.getUserTotalVotes(),this.maxVotes);var a=this.container.querySelectorAll(".data-news");a.length>0?a.forEach(function(s){r.renderElementInitialData(e,s)}):this.renderElementInitialData(e,this.container),zt(["Surveys.renderInitialDataSurvey>data",e],ro)}},{key:"renderElementInitialData",value:function(e,r){var a=!1,s=r.getAttribute("id").match(/candidate_(\d+)/),o=s[1];if(a=document.getElementById("candidate_".concat(o)),a){this.changeStateCandidateButtonVote(a,"vote",!e.data.active);var l=a.querySelector(".data-vote [data-value]"),u="0";Object.keys(e.data.candidates).includes(o)&&(u=(parseInt(l.getAttribute("data-value"))+parseInt(e.data.candidates[o])).toString()),Ml(l,u)}}},{key:"renderInitialUserDataSurvey",value:function(e){var r=this;this.setUserTotalVotes(e.data.totals);var a=!1;this.setNumUserVotesLeft(this.getUserTotalVotes(),this.maxVotes);for(var s in e.data.candidates)a=document.getElementById("candidate_".concat(s)),a&&this.changeStateCandidateButtonVote(a,"voted",!e.data.active);if(this.getUserTotalVotes()===this.maxVotes){var o=this.container.querySelectorAll(".data-news");if(o.length>0)o.forEach(function(c){var f=c.getAttribute("id").match(/candidate_(\d+)/),d=f[1];Object.keys(e.data.candidates).includes(d)||r.changeStateCandidateButtonVote(c,"vote",!0)});else{var l=this.container.getAttribute("id").match(/candidate_(\d+)/),u=l[1];Object.keys(e.data.candidates).includes(u)||this.changeStateCandidateButtonVote(this.container,"vote",!0)}}zt(["Surveys.renderInitialUserDataSurvey>data",e],ro)}},{key:"renderSendVote",value:function(e,r){var a=document.getElementById("candidate_".concat(r)),s=a.querySelector(".data-vote [data-value]"),o=parseInt(s.getAttribute("data-value"))+1;this.changeStateCandidateButtonVote(a,"voting"),e.code==="max-participates"?o=parseInt(s.getAttribute("data-value")):(this.setMoreVotes(1),this.setNumUserVotesLeft(this.getUserTotalVotes(),this.maxVotes),this.getUserTotalVotes()>=this.maxVotes&&this.disableAllButtons()),Ml(s,o.toString()),zt(["Surveys.renderSendVote>data",e],ro)}},{key:"disableAllButtons",value:function(){var e=this;this.container.querySelectorAll(".data-news").forEach(function(r){r.querySelectorAll('.button-item[data-state="vote"]').length&&e.changeStateCandidateButtonVote(r,"voted")})}},{key:"setUserTotalVotes",value:function(e){this.numUserVotes=e}},{key:"getUserTotalVotes",value:function(){return this.numUserVotes}},{key:"setMoreVotes",value:function(e){this.numUserVotes+=e}},{key:"changeStateCandidateButtonVote",value:function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=e.querySelector(".button-item");a?s.removeAttribute("data-state"):s.setAttribute("data-state",r)}},{key:"setNumUserVotesLeft",value:function(e,r){document.getElementById("fbody").style.setProperty("--app-lasTop100-userNumVotes",'"'.concat(this.getUserTotalVotes(),"/").concat(r,'"'))}}]),i}(Ig)});function Vg(n){return pe(n)=="object"&&n!=null&&n.nodeType===1}function Kg(n,i){return(!i||n!=="hidden")&&n!=="visible"&&n!=="clip"}
1function fc(n,i){if(n.clientHeight<n.scrollHeight||n.clientWidth<n.scrollWidth){var t=getComputedStyle(n,null);return Kg(t.overflowY,i)||Kg(t.overflowX,i)||function(e){var r=function(a){if(!a.ownerDocument||!a.ownerDocument.defaultView)return null;try{return a.ownerDocument.defaultView.frameElement}catch(s){return null}}(e);return!!r&&(r.clientHeight<e.scrollHeight||r.clientWidth<e.scrollWidth)}(n)}return!1}function no(n,i,t,e,r,a,s,o){return a<n&&s>i||a>n&&s<i?0:a<=n&&o<=t||s>=i&&o>=t?a-n-e:s>i&&o<t||a<n&&o>t?s-i+r:0}var dc,Wg=W(function(){T();vt();dc=function(i,t){var e=window,r=t.scrollMode,a=t.block,s=t.inline,o=t.boundary,l=t.skipOverflowHiddenElements,u=typeof o=="function"?o:function(xt){return xt!==o};if(!Vg(i))throw new TypeError("Invalid target");for(var c,f,d=document.scrollingElement||document.documentElement,h=[],v=i;Vg(v)&&u(v);){if((v=(f=(c=v).parentElement)==null?c.getRootNode().host||null:f)===d){h.push(v);break}v!=null&&v===document.body&&fc(v)&&!fc(document.documentElement)||v!=null&&fc(v,l)&&h.push(v)}for(var m=e.visualViewport?e.visualViewport.width:innerWidth,p=e.visualVie
1wport?e.visualViewport.height:innerHeight,g=window.scrollX||pageXOffset,E=window.scrollY||pageYOffset,y=i.getBoundingClientRect(),_=y.height,b=y.width,C=y.top,R=y.right,M=y.bottom,D=y.left,L=a==="start"||a==="nearest"?C:a==="end"?M:C+_/2,O=s==="center"?D+b/2:s==="end"?R:D,x=[],Y=0;Y<h.length;Y++){var $=h[Y],Z=$.getBoundingClientRect(),N=Z.height,j=Z.width,z=Z.top,ee=Z.right,U=Z.bottom,F=Z.left;if(r==="if-needed"&&C>=0&&D>=0&&M<=p&&R<=m&&C>=z&&M<=U&&D>=F&&R<=ee)return x;var H=getComputedStyle($),G=parseInt(H.borderLeftWidth,10),ve=parseInt(H.borderTopWidth,10),ye=parseInt(H.borderRightWidth,10),Ee=parseInt(H.borderBottomWidth,10),Ce=0,Ye=0,ot="offsetWidth"in $?$.offsetWidth-$.clientWidth-G-ye:0,Ue="offsetHeight"in $?$.offsetHeight-$.clientHeight-ve-Ee:0,yt="offsetWidth"in $?$.offsetWidth===0?0:j/$.offsetWidth:0,Le="offsetHeight"in $?$.offsetHeight===0?0:N/$.offsetHeight:0;if(d===$)Ce=a==="start"?L:a==="end"?L-p:a==="nearest"?no(E,E+p,p,ve,Ee,E+L,E+L+_,_):L-p/2,Ye=s==="start"?O:s==="center"?O-m/2:s==="end"?O-m:no(g,g+m,m,G,ye,g+O,g+O+b,b),Ce=Math.max(0,Ce+E),Ye=Math.max(0,Ye+g);else{Ce=a==="start"?L-z-ve:a==="end"?L-U+Ee+Ue:a==="nearest"?no(z,U,N,ve,Ee+Ue,L,L+_,_):L-(z+N/2)+Ue/2,Ye=s==="start"?O-F-G:s==="center"?O-(F+j/2)+ot/2:s==="end"?O-ee+ye+ot:no(F,ee,j,G,ye+ot,O,O+b,b);var _t=$.scrollLeft,wt=$.scrollTop;L+=wt-(Ce=Math.max(0,Math.min(wt+Ce/Le,$.scrollHeight-N/Le+Ue))),O+=_t-(Ye=Math.max(0,Math.min(_t+Ye/yt,$.scrollWidth-j/yt+ot)))}x.push({el:$,top:Ce,left:Ye})}return x}});function qg(n){return n===Object(n)&&Object.keys(n).length!==0}function VI(n,i){i===void 0&&(i="auto");var t="scrollBehavior"in document.body.style;n.forEach(function(e){var r=e.el,a=e.top,s=e.left;r.scroll&&t?r.scroll({top:a,left:s,behavior:i}):(r.scrollTop=a,r.scrollLeft=s)})}function KI(n){return n===!1?{block:"end",inline:"nearest"}:qg(n)?n:{block:"start",inline:"nearest"}}function WI(n,i){var t=n.isConnected||n.ownerDocument.documentElement.contains(n);if(qg(i)&&typeof i.behavior=="function")return i.behavior(t?dc(n,i):[]);if(t){var e=KI(i);return VI(dc(n,e),e.behavior)}}var hc,Yg=W(function(){T();Wg();hc=WI});function Jg(n){var i=zg(),t=Math.min((i-n.startTime)/n.duration,1),e=n.ease(t),r=n.startX+(n.x-n.startX)*e,a=n.startY+(n.y-n.startY)*e;n.method(r,a),r!==n.x||a!==n.y?requestAnimationFrame(function(){return Jg(n)}):n.cb()}function qI(n,i,t,e,r,a){e===void 0&&(e=600),r===void 0&&(r=function(f){return 1+--f*f*f*f*f});var s,o,l,u;s=n,o=n.scrollLeft,l=n.scrollTop,u=function(f,d){n.scrollLeft=Math.ceil(f),n.scrollTop=Math.ceil(d)},Jg({scrollable:s,method:u,startTime:zg(),startX:o,startY:l,x:i,y:t,duration:e,ease:r,cb:a})}function zI(n,i){var t=i||{};return YI(t)?hc(n,{block:t.block,inline:t.inline,scrollMode:t.scrollMode,boundary:t.boundary,behavior:function(r){return Promise.all(r.reduce(function(a,s){var o=s.el,l=s.left,u=s.top,c=o.scrollLeft,f=o.scrollTop;return c===l&&f===u?a:[].concat(a,[new Promise(function(d){return qI(o,l,u,t.duration,t.ease,function(){return d({el:o,left:[c,l],top:[f,u]})})})])},[]))}}):Promise.resolve(hc(n,i))}var vc,zg,YI,JI,Jn,pc=W(function(){T();Yg();zg=function(){return vc||(vc="performance"in window?performance.now.bind(performance):Date.now),vc()};YI=function(i){return i&&!i.behavior||i.behavior==="smooth"};JI=zI,Jn=JI});var uy={};Et(uy,{init:function(){return gC}});function ly(n,i){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);i&&(e=e.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,e)}return t}function lo(n){for(var i=1;i<arguments.length;i++){var t=arguments[i]!=null?arguments[i]:{};i%2?ly(Object(t),!0).forEach(function(e){V(n,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ly(Object(t)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})}return n}function vC(){(function(n,i,t,e,r,a,s,o){if(n.CPObject=t,!n[t]){n[t]=function(){for(var l=arguments.length,u=new Array(l),c=0;c<l;c++)u[c]=arguments[c];var f=u[0],d=u[1],h=u[2];if(n[t].q||(n[t].q=[]),r=Array.prototype.slice.call(arguments,0),!n[t].patched){if(f==="fatal"&&d)n[t].le=d,Array.prototype.forEach.call(n[t].q,function(g){g[0]==="error"&&typeof g[1]=="function"&&g[1](d)});else if(f==="error"&&typeof d=="function")n[t].le&&d(n[t].le);else if(f==="extension"&&d)h&&typeof h.init=="function"&&(h.init(),h.initialized=!0);
1else if(f==="authenticate"&&typeof d=="function"){try{a=(i.cookie||"").indexOf("_cpauthhint=")===-1&&!(n.localStorage||{})._cpuser&&n.location.href.toLowerCase().indexOf("cpauthenticated")===-1}catch(g){a=!1}if(a){s={isLoggedIn:function(){return!1},hasValidSubscription:function(){return!1}};var v=d,m=!1,p=function(E,y){m||(m=!0,v(E,y))};if(r[1]=p,typeof i.hasPrivateToken=="function")try{i.hasPrivateToken(e||"https://my.contentpass.net").then(function(g){g||p(null,s)}).catch(function(){})}catch(g){}else p(null,s)}}}n[t].q.push(r)};try{((o=(i.cookie.split("_cpauthhint=")[1]||"").split(";")[0])?Number(o[1]):NaN)>0&&(i.body?i.body.classList.add("cpauthenticated"):i.addEventListener("DOMContentLoaded",function(){i.body.classList.add("cpauthenticated")}))}catch(l){}n[t].l=+new Date,n[t].sv=6}})(window,document,"cp",void 0,void 0,void 0,void 0,void 0)}function pC(){var n=window.cp;n("extension","didomi",{version:1,init:function(){(function(){var t=window;t.didomiConfig||(t.didomiConfig={}),t.didomiConfig.notice||(t.didomiConfig.notice={}),t.didomiConfig.notice.enable=!1})(),n("error",function(){var t=window;t.didomiOnReady=t.didomiOnReady||[],t.didomiOnReady.push(function(e){var r=e.getConfig()||{};e.configure(lo(lo({},r),{},{notice:lo(lo({},r.notice),{},{enable:!0})}))})})}})}function mC(n){var i=document.createElement("script");i.src="".concat(n,"/now.js"),i.async=!0,i.fetchPriority="high",i.onerror=function(){window.cp("fatal",new Error("ContentPass SDK failed to load"))},document.head.appendChild(i)}function gC(n,i){var t;if(((t=window.jeeiSite)===null||t===void 0||(t=t.dyn)===null||t===void 0?void 0:t.contentpassLoaded)!==!0){window.jeeiSite.dyn.contentpassLoaded=!0,vC();var e=window.cp;e("create",n,{baseUrl:i}),e("render",{onFullConsent:function(){}}),e("authenticate",function(r,a){r||a.isLoggedIn()&&a.hasValidSubscription()}),pC(),mC(i)}}var cy=W(function(){T();Ge();Qr();jeef.JeefEvents||(jeef.JeefEvents=Ht.getInstance())});var hy={};Et(hy,{default:function(){return yC}});var fy,dy,yC,vy=W(function(){T();J();X();mr();ft();$e();_e();fy="ee_va",dy="1",yC=function(){function n(){k(this,n),this._fbody=null}return A(n,[{key:"init",value:function(){if(this._fbody=document.getElementById("fbody"),!!this._fbody){var t=document.getElementById("age_modal");t&&this._initAgeVerification()}}},{key:"_initAgeVerification",value:function(){var t=dr(fy)===dy;ae(this._fbody,t,"isadult")}},{key:"_setSecureCookie",value:function(t,e,r,a){var s=new Date;s.setTime(s.getTime()+r*24*60*60*1e3);var o=s.toGMTString(),l=a&&a!==""?"; domain=".concat(a):"",u="; expires=".concat(o),c="; Secure",f="; SameSite=None",d="; Priority=High";document.cookie="".concat(t,"=").concat(encodeURIComponent(e)).concat(u,"; path=/").concat(l).concat(f).concat(c).concat(d)}},{key:"handleAgeVerification",value:function(t){t.id==="age_verify_adult"?(ae(this._fbody,!0,"isadult"),this._setSecureCookie(fy,dy,15,I.subDomain)):this._redirectToMainSection()}},{key:"_redirectToMainSection",value:function(){var t,e=Q.getMainId(),r=(t=I.ageVerificationRedirects)===null||t===void 0?void 0:t.redirects,a=(r==null?void 0:r[e])||"/";I.isApp?window.ReactNativeWebView.postMessage("close_window=true"):window.location.href=a}}]),n}()});var gy={};Et(gy,{default:function(){return _C}});var py,my,_C,yy=W(function(){T();J();X();mr();ft();_e();py="ee_vpz",my="1",_C=function(){function n(){k(this,n),this._fbody=null,this._sliderHeader=null}return A(n,[{key:"init",value:function(){this._fbody=document.getElementById("fbody"),this._fbody&&(this._sliderHeader=document.getElementById("slider_header"),this._sliderHeader&&(this._sliderHeaderAction=document.getElementById("slider_header_action"),this._sliderHeaderAction&&this._initSliderHeader()))}},{key:"_initSliderHeader",value:function(){var t=dr(py)!==my;ae(this._fbody,t,"sliderHeader"),ae(this._sliderHeader,t),ae(this._sliderHeaderAction,!t)}},{key:"_setSecureCookie",value:function(t,e,r,a){var s=new Date;s.setTime(s.getTime()+r*24*60*60*1e3);var o=s.toGMTString(),l=a&&a!==""?"; domain=".concat(a):"",u="; expires=".concat(o),c="; Secure",f="; SameSite=None",d="; Priority=High";document.cookie="".concat(t,"=").concat(encodeURIComponent(e)).concat(u,"; path=/").concat(l).concat(f).concat(c).concat(d)}},{key:"handleChangeStatusSliderHeader",value:function(t){if(t.id==="toggle_slider_header"){var e=this._sliderHeader.getAttribute("data-status")=="off";ae(this._fbody,e,"sliderHeader"),ae(this._sliderHeader,e),ae(this._sliderHeaderAction,!e),e||this._setSecureCookie(py,my,15,I.subDomain)}}}]),n}()});function Ie(n,i,t,e){var r=ar(w(1&e?n.prototype:n),i,t);return 2&e&&typeof r=="function"?function(a){return r.apply(t,a)}:r}function Xe(n,i,t){return i=w(i),q(n,N_()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function N_(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(N_=function(){return!!n})()}function bC(n,i,t){return(i=AC(i))in n?Object.defineProperty(n,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[i]=t,n}function nt(){return nt=Object.assign?Object.assign.bind():function(n){for(var i=1;i<arguments.length;i++){var t=arguments[i];for(var e in t)({}).hasOwnProperty.call(t,e)&&(n[e]=t[e])}return n},nt.apply(null,arguments)}function _y(n,i){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);i&&(e=e.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,e)}return t}function et(n){for(var i=1;i<arguments.length;i++){var t=arguments[i]!=null?arguments[i]:{};
1i%2?_y(Object(t),!0).forEach(function(e){bC(n,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):_y(Object(t)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})}return n}function kC(n,i){if(pe(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var e=t.call(n,i);if(pe(e)!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(n)}function AC(n){var i=kC(n,"string");return pe(i)=="symbol"?i:i+""}function qc(){return nt({},IC)}function CC(n,i){var t=self.console[n];return t?t.bind(self.console,"".concat(i?"["+i+"] ":"","[").concat(n,"] >")):Wi}function Ey(n,i,t){return i[n]?i[n].bind(i):CC(n,t)}function LC(n,i,t){var e=qc();if((typeof console=="undefined"?"undefined":pe(console))==="object"&&n===!0||pe(n)==="object"){var r=["debug","log","info","warn","error"];r.forEach(function(a){e[a]=Ey(a,n,t)});try{e.log('Debug logs enabled for "'.concat(i,'" in hls.js version ',"1.6.16"))}catch(a){return qc()}r.forEach(function(a){Yc[a]=Ey(a,n)})}else nt(Yc,e);return e}function qi(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;if(typeof self!="undefined"){var i=(n||!self.MediaSource)&&self.ManagedMediaSource;return i||self.MediaSource||self.WebKitMediaSource}}function RC(n){return typeof self!="undefined"&&n===self.ManagedMediaSource}function F_(n,i){var t=Object.keys(n),e=Object.keys(i),r=t.length,a=e.length;return!r||!a||r===a&&!t.some(function(s){return e.indexOf(s)===-1})}function Or(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(typeof TextDecoder!="undefined"){var t=new TextDecoder("utf-8"),e=t.decode(n);if(i){var r=e.indexOf("\0");return r!==-1?e.substring(0,r):e}return e.replace(/\0/g,"")}for(var a=n.length,s,o,l,u="",c=0;c<a;){if(s=n[c++],s===0&&i)return u;if(s===0||s===3)continue;switch(s>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:u+=String.fromCharCode(s);break;case 12:case 13:o=n[c++],u+=String.fromCharCode((s&31)<<6|o&63);break;case 14:o=n[c++],l=n[c++],u+=String.fromCharCode((s&15)<<12|(o&63)<<6|(l&63)<<0);break}}return u}function tr(n){for(var i="",t=0;t<n.length;t++){var e=n[t].toString(16);e.length<2&&(e="0"+e),i+=e}return i}function U_(n){return Uint8Array.from(n.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function OC(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function wC(){return Sy||(Sy=1,function(n,i){(function(t){var e=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,a=/(?:\/|^)\.(?=\/)/g,s=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(u,c,f){if(f=f||{},u=u.trim(),c=c.trim(),!c){if(!f.alwaysNormalize)return u;var d=o.parseURL(u);if(!d)throw new Error("Error trying to parse base URL.");return d.path=o.normalizePath(d.path),o.buildURLFromParts(d)}var h=o.parseURL(c);if(!h)throw new Error("Error trying to parse relative URL.");if(h.scheme)return f.alwaysNormalize?(h.path=o.normalizePath(h.path),o.buildURLFromParts(h)):c;var v=o.parseURL(u);if(!v)throw new Error("Error trying to parse base URL.");if(!v.netLoc&&v.path&&v.path[0]!=="/"){var m=r.exec(v.path);v.netLoc=m[1],v.path=m[2]}v.netLoc&&!v.path&&(v.path="/");var p={scheme:v.scheme,netLoc:h.netLoc,path:null,params:h.params,query:h.query,fragment:h.fragment};if(!h.netLoc&&(p.netLoc=v.netLoc,h.path[0]!=="/"))if(!h.path)p.path=v.path,h.params||(p.params=v.params,h.query||(p.query=v.query));else{var g=v.path,E=g.substring(0,g.lastIndexOf("/")+1)+h.path;p.path=o.normalizePath(E)}return p.path===null&&(p.path=f.alwaysNormalize?o.normalizePath(h.path):h.path),o.buildURLFromParts(p)},parseURL:function(u){var c=e.exec(u);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(u){for(u=u.split("").reverse().join("").replace(a,"");u.length!==(u=u.replace(s,"")).length;);return u.split("").reverse().join("")},buildURLFromParts:function(u){return u.scheme+u.netLoc+u.path+u.params+u.query+u.fragment}};n.exports=o})()}(Tc)),Tc.exports}function Rt(n){return n.sn!=="initSegment"}function G_(n,i){var t=Object.getPrototypeOf(n);if(t){var e=Object.getOwnPropertyDescriptor(t,i);return e||G_(t,i)}}function PC(n,i){var t=G_(n,i);t&&(t.enumerable=!0,Object.defineProperty(n,i,t))}function Gt(n){return String.fromCharCode.apply(null,n)}function H_(n,i){var t=n[i]<<8|n[i+1];return t<0?65536+t:t}function ke(n,i){var t=V_(n,i);return t<0?4294967296+t:t}function by(n,i){var t=ke(n,i);return t*=Math.pow(2,32),t+=ke(n,i+4),t}function V_(n,i){return n[i]<<24|n[i+1]<<16|n[i+2]<<8|n[i+3]}function MC(n){for(var i=n.byteLength,t=0;t<i;){var e=ke(n,t);if(e>8&&n[t+4]===109&&n[t+5]===111&&n[t+6]===111&&n[t+7]===102)return!0;t=e>1?t+e:i}return!1}function Ne(n,i){var t=[];if(!i.length)return t;for(var e=n.byteLength,r=0;r<e;){var a=ke(n,r),s=Gt(n.subarray(r+4,r+8)),o=a>1?r+a:e;if(s===i[0])if(i.length===1)t.push(n.subarray(r+8,o));else{var l=Ne(n.subarray(r+8,o),i.slice(1));l.length&&DC.apply(t,l)}r=o}return t}function NC(n){var i=[],t=n[0],e=8,r=ke(n,e);e+=4;var a=0,s=0;t===0?(a=ke(n,e),s=ke(n,e+4),e+=8):(a=by(n,e),s=by(n,e+8),e+=16),e+=2;var o=n.length+s,l=H_(n,e);e+=2;for(var u=0;u<l;u++){var c=e,f=ke(n,c);c+=4;var d=f&2147483647,h=(f&2147483648)>>>31;if(h===1)return tt.warn("SIDX has hierarchical references (not supported)"),null;var v=ke(n,c);c+=4,i.push({referenceSize:d,subsegmentDuration:v,info:{duration:v/r,start:o,end:o+d-1}}),o+=d,c+=4,e=c}return{earliestPresentationTime:a,timescale:r,version:t,referencesCount:l,references:i}}function K_(n){for(var i=[],t=Ne(n,["moov","trak"]),e=0;e<t.length;e++){var r=t[e],a=Ne(r,["tkhd"])[0];if(a){var s=a[0],o=ke(a,s===0?12:20),l=Ne(r,["mdia","mdhd"])[0];if(l){s=l[0];var u=ke(l,s===0?12:20),c=Ne(r,["mdia","hdlr"])[0];if(c){var f=Gt(c.subarray(8,12)),d={soun:at.AUDIO,vide:at.VIDEO}[f],h=Ne(r,["mdia","minf","stbl","stsd"])[0],v=FC(h);d?(i[o]={timescale:u,type:d,stsd:v},i[d]=et({timescale:u,id:o},v)):i[o]={timescale:u,type:f,stsd:v}}}}}var m=Ne(n,["moov","mvex","trex"]);return m.forEach(function(p){var g=ke(p,4),E=i[g];E&&(E.default={duration:ke(p,12),flags:ke(p,20)})}),i}function FC(n){var i=n.subarray(8),t=i.subarray(86),e=Gt(i.subarray(4,8)),r=e,a,s=e==="enca"||e==="encv";if(s){var o=Ne(i,[e])[0],l=o.subarray(e==="enca"?28:78),u=Ne(l,["sinf"]);u.forEach(function(wt){var xt=Ne(wt,["schm"])[0];if(xt){var qt=Gt(xt.subarray(4,8));if(qt==="cbcs"||qt==="cenc"){var lt=Ne(wt,["frma"])[0];lt&&(r=Gt(lt))}}})}var c=r;switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{var f=Ne(t,["avcC"])[0];f&&f.length>3&&(r+="."+co(f[1])+co(f[2])+co(f[3]),a=uo(c==="avc1"?"dva1":"dvav",t));break}case"mp4a":{var d=Ne(i,[e])[0],h=Ne(d.subarray(28),["esds"])[0];if(h&&h.length>7){var v=4;if(h[v++]!==3)break;v=kc(h,v),v+=2;var m=h[v++];if(m&128&&(v+=2),m&64&&(v+=h[v++]),h[v++]!==4)break;v=kc(h,v);var p=h[v++];if(p===64)r+="."+co(p);else break;if(v+=12,h[v++]!==5)break;v=kc(h,v);var g=h[v++],E=(g&248)>>3;E===31&&(E+=1+((g&7)<<3)+((h[v]&224)>>5)),r+="."+E}break}case"hvc1":case"hev1":{var y=Ne(t,["hvcC"])[0];if(y&&y.length>12){var _=y[1],b=["","A","B","C"][_>>6],C=_&31,R=ke(y,2),M=(_&32)>>5?"H":"L",D=y[12],L=y.subarray(6,12);r+="."+b+C,r+="."+UC(R).toString(16).toUpperCase(),r+="."+M+D;for(var O="",x=L.length;x--;){var Y=L[x];if(Y||O){var $=Y.toString(16).toUpperCase();O="."+$+O}}r+=O}a=uo(c=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{r=uo(r,t)||r;break}case"vp09":{var Z=Ne(t,["vpcC"])[0];if(Z&&Z.length>6){var N=Z[4],j=Z[5],z=Z[6]>>4&15;r+="."+oi(N)+"."+oi(j)+"."+oi(z)}break}case"av01":{var ee=Ne(t,["av1C"])[0];if(ee&&ee.length>2){var U=ee[1]>>>5,F=ee[1]&31,H=ee[2]>>>7?"H":"M",G=(ee[2]&64)>>6,ve=(ee[2]&32)>>5,ye=U===2&&G?ve?12:10:G?10:8,Ee=(ee[2]&16)>>4,Ce=(ee[2]&8)>>3,Ye=(ee[2]&4)>>2,ot=ee[2]&3,Ue=1,yt=1,Le=1,_t=0;r+="."+U+"."+oi(F)+H+"."+oi(ye)+"."+Ee+"."+Ce+Ye+ot+"."+oi(Ue)+"."+oi(yt)+"."+oi(Le)+"."+_t,a=uo("dav1",t)}break}}return{codec:r,encrypted:s,supplemental:a}}function uo(n,i){var t=Ne(i,["dvvC"]),e=t.length?t[0]:Ne(i,["dvcC"])[0];if(e){var r=e[2]>>1&127,a=e[2]<<5&32|e[3]>>3&31;return n+"."+oi(r)+"."+oi(a)}}function UC(n){for(var i=0,t=0;t<32;t++)i|=(n>>t&1)<<31-t;return i>>>0}function kc(n,i){for(var t=i+5;n[i++]&128&&i<t;);return i}function co(n){return("0"+n.toString(16).toUpperCase()).slice(-2)}function oi(n){return(n<10?"0":"")+n}
1function BC(n,i){if(!(!n||!i)){var t=i.keyId;t&&i.isCommonEncryption&&W_(n,function(e,r){var a=e.subarray(8,24);a.some(function(s){return s!==0})||(tt.log("[eme] Patching keyId in 'enc".concat(r?"a":"v",">sinf>>tenc' box: ").concat(tr(a)," -> ").concat(tr(t))),e.set(t,8))})}}function GC(n){var i=[];return W_(n,function(t){return i.push(t.subarray(8,24))}),i}function W_(n,i){var t=Ne(n,["moov","trak"]);t.forEach(function(e){var r=Ne(e,["mdia","minf","stbl","stsd"])[0];if(r){var a=r.subarray(8),s=Ne(a,["enca"]),o=s.length>0;o||(s=Ne(a,["encv"])),s.forEach(function(l){var u=o?l.subarray(28):l.subarray(78),c=Ne(u,["sinf"]);c.forEach(function(f){var d=q_(f);d&&i(d,o)})})}})}function q_(n){var i=Ne(n,["schm"])[0];if(i){var t=Gt(i.subarray(4,8));if(t==="cbcs"||t==="cenc"){var e=Ne(n,["schi","tenc"])[0];if(e)return e}}}function jC(n,i,t){for(var e={},r=Ne(n,["moof","traf"]),a=0;a<r.length;a++){var s=r[a],o=Ne(s,["tfhd"])[0],l=ke(o,4),u=i[l];if(u){e[l]||(e[l]={start:NaN,duration:0,sampleCount:0,timescale:u.timescale,type:u.type});var c=e[l],f=Ne(s,["tfdt"])[0];if(f){var d=f[0],h=ke(f,4);d===1&&(h===Ty?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(h*=Ty+1,h+=ke(f,8))),ce(h)&&(!ce(c.start)||h<c.start)&&(c.start=h)}var v=u.default,m=ke(o,0)|(v==null?void 0:v.flags),p=(v==null?void 0:v.duration)||0;m&8&&(m&2?p=ke(o,12):p=ke(o,8));for(var g=Ne(s,["trun"]),E=c.start||0,y=0,_=p,b=0;b<g.length;b++){var C=g[b],R=ke(C,4),M=c.sampleCount;c.sampleCount+=R;var D=C[3]&1,L=C[3]&4,O=C[2]&1,x=C[2]&2,Y=C[2]&4,$=C[2]&8,Z=8,N=R;if(D&&(Z+=4),L&&R){var j=C[Z+1]&1;!j&&c.keyFrameIndex===void 0&&(c.keyFrameIndex=M),Z+=4,O?(_=ke(C,Z),Z+=4):_=p,x&&(Z+=4),$&&(Z+=4),E+=_,y+=_,N--}for(;N--;){if(O?(_=ke(C,Z),Z+=4):_=p,x&&(Z+=4),Y){var z=C[Z+1]&1;z||c.keyFrameIndex===void 0&&(c.keyFrameIndex=c.sampleCount-(N+1),c.keyFrameStart=E),Z+=4}$&&(Z+=4),E+=_,y+=_}!y&&p&&(y+=p*R)}c.duration+=y}}if(!Object.keys(e).some(function(ye){return e[ye].duration})){for(var ee=1/0,U=0,F=Ne(n,["sidx"]),H=0;H<F.length;H++){var G=NC(F[H]);if(G!=null&&G.references){ee=Math.min(ee,G.earliestPresentationTime/G.timescale);var ve=G.references.reduce(function(ye,Ee){return ye+Ee.info.duration||0},0);U=Math.max(U,ve+G.earliestPresentationTime/G.timescale)}}U&&ce(U)&&Object.keys(e).forEach(function(ye){e[ye].duration||(e[ye].duration=U*e[ye].timescale-e[ye].start)})}return e}function HC(n){var i={valid:null,remainder:null},t=Ne(n,["moof"]);if(t.length<2)return i.remainder=n,i;var e=t[t.length-1];return i.valid=n.slice(0,e.byteOffset-8),i.remainder=n.slice(e.byteOffset-8),i}function jr(n,i){var t=new Uint8Array(n.length+i.length);return t.set(n),t.set(i,n.length),t}function ky(n,i){var t=[],e=i.samples,r=i.timescale,a=i.id,s=!1,o=Ne(e,["moof"]);return o.map(function(l){var u=l.byteOffset-8,c=Ne(l,["traf"]);c.map(function(f){var d=Ne(f,["tfdt"]).map(function(h){var v=h[0],m=ke(h,4);return v===1&&(m*=Math.pow(2,32),m+=ke(h,8)),m/r})[0];return d!==void 0&&(n=d),Ne(f,["tfhd"]).map(function(h){var v=ke(h,4),m=ke(h,0)&16777215,p=(m&1)!==0,g=(m&2)!==0,E=(m&8)!==0,y=0,_=(m&16)!==0,b=0,C=(m&32)!==0,R=8;v===a&&(p&&(R+=8),g&&(R+=4),E&&(y=ke(h,R),R+=4),_&&(b=ke(h,R),R+=4),C&&(R+=4),i.type==="video"&&(s=Ko(i.codec)),Ne(f,["trun"]).map(function(M){var D=M[0],L=ke(M,0)&16777215,O=(L&1)!==0,x=0,Y=(L&4)!==0,$=(L&256)!==0,Z=0,N=(L&512)!==0,j=0,z=(L&1024)!==0,ee=(L&2048)!==0,U=0,F=ke(M,4),H=8;O&&(x=ke(M,H),H+=4),Y&&(H+=4);for(var G=x+u,ve=0;ve<F;ve++){if($?(Z=ke(M,H),H+=4):Z=y,N?(j=ke(M,H),H+=4):j=b,z&&(H+=4),ee&&(D===0?U=ke(M,H):U=V_(M,H),H+=4),i.type===at.VIDEO)for(var ye=0;ye<j;){var Ee=ke(e,G);if(G+=4,VC(s,e[G])){var Ce=e.subarray(G,G+Ee);hf(Ce,s?2:1,n+U/r,t)}G+=Ee,ye+=Ee+4}n+=Z/r}}))})})}),t}function Ko(n){if(!n)return!1;var i=n.substring(0,4);return i==="hvc1"||i==="hev1"||i==="dvh1"||i==="dvhe"}function VC(n,i){if(n){var t=i>>1&63;return t===39||t===40}else{var e=i&31;return e===6}}function hf(n,i,t,e){var r=Y_(n),a=0;a+=i;for(var s=0,o=0,l=0;a<r.length;){s=0;do{if(a>=r.length)break;l=r[a++],s+=l}while(l===255);o=0;do{if(a>=r.length)break;l=r[a++],o+=l}while(l===255);var u=r.length-a,c=a;if(o<u)a+=o;else if(o>u){tt.error("Malformed SEI payload. ".concat(o," is too small, only ").concat(u," bytes left to parse."));break}if(s===4){var f=r[c++];if(f===181){var d=H_(r,c);if(c+=2,d===49){var h=ke(r,c);if(c+=4,h===1195456820){var v=r[c++];if(v===3){var m=r[c++],p=31&m,g=64&m,E=g?2+p*3:0,y=new Uint8Array(E);if(g){y[0]=m;for(var _=1;_<E;_++)y[_]=r[c++]}e.push({type:v,payloadType:s,pts:t,bytes:y})}}}}}else if(s===5&&o>16){for(var b=[],C=0;C<16;C++){var R=r[c++].toString(16);b.push(R.length==1?"0"+R:R),(C===3||C===5||C===7||C===9)&&b.push("-")}for(var M=o-16,D=new Uint8Array(M),L=0;L<M;L++)D[L]=r[c++];e.push({payloadType:s,pts:t,uuid:b.join(""),userData:Or(D),userDataBytes:D})}}}function Y_(n){for(var i=n.byteLength,t=[],e=1;e<i-2;)n[e]===0&&n[e+1]===0&&n[e+2]===3?(t.push(e+2),e+=2):e++;if(t.length===0)return n;var r=i-t.length,a=new Uint8Array(r),s=0;for(e=0;e<r;s++,e++)s===t[0]&&(s++,t.shift()),a[e]=n[s];return a}function KC(n){var i=n[0],t="",e="",r=0,a=0,s=0,o=0,l=0,u=0;if(i===0){for(;Gt(n.subarray(u,u+1))!=="\0";)t+=Gt(n.subarray(u,u+1)),u+=1;for(t+=Gt(n.subarray(u,u+1)),u+=1;Gt(n.subarray(u,u+1))!=="\0";)e+=Gt(n.subarray(u,u+1)),u+=1;e+=Gt(n.subarray(u,u+1)),u+=1,r=ke(n,12),a=ke(n,16),o=ke(n,20),l=ke(n,24),u=28}else if(i===1){u+=4,r=ke(n,u),u+=4;var c=ke(n,u);u+=4;var f=ke(n,u);for(u+=4,s=Math.pow(2,32)*c+f,EC(s)||(s=Number.MAX_SAFE_INTEGER,tt.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=ke(n,u),u+=4,l=ke(n,u),u+=4;Gt(n.subarray(u,u+1))!=="\0";)t+=Gt(n.subarray(u,u+1)),u+=1;for(t+=Gt(n.subarray(u,u+1)),u+=1;Gt(n.subarray(u,u+1))!=="\0";)e+=Gt(n.subarray(u,u+1)),u+=1;e+=Gt(n.subarray(u,u+1)),u+=1}var d=n.subarray(u,n.byteLength);return{schemeIdUri:t,value:e,timeScale:r,presentationTime:s,presentationTimeDelta:a,eventDuration:o,id:l,payload:d}}function WC(n){for(var i=arguments.length,t=new Array(i>1?i-1:0),e=1;e<i;e++)t[e-1]=arguments[e];for(var r=t.length,a=8,s=r;s--;)a+=t[s].byteLength;var o=new Uint8Array(a);for(o[0]=a>>24&255,o[1]=a>>16&255,o[2]=a>>8&255,o[3]=a&255,o.set(n,4),s=0,a=8;s<r;s++)o.set(t[s],a),a+=t[s].byteLength;return o}function qC(n,i,t){if(n.byteLength!==16)throw new RangeError("Invalid system id");var e,r;e=0,r=new Uint8Array;var a;e>0?(a=new Uint8Array(4),i.length>0&&new DataView(a.buffer).setUint32(0,i.length,!1)):a=new Uint8Array;var s=new Uint8Array(4);return t.byteLength>0&&new DataView(s.buffer).setUint32(0,t.byteLength,!1),WC([112,115,115,104],new Uint8Array([e,0,0,0]),n,a,r,s,t)}function YC(n){var i=[];if(n instanceof ArrayBuffer)for(var t=n.byteLength,e=0;e+32<t;){var r=new DataView(n,e),a=zC(r);i.push(a),e+=a.size}return i}function zC(n){var i=n.getUint32(0),t=n.byteOffset,e=n.byteLength;if(e<i)return{offset:t,size:e};var r=n.getUint32(4);if(r!==1886614376)return{offset:t,size:i};var a=n.getUint32(8)>>>24;if(a!==0&&a!==1)return{offset:t,size:i};var s=n.buffer,o=tr(new Uint8Array(s,t+12,16)),l=null,u=null,c=0;if(a===0)c=28;else{var f=n.getUint32(28);if(!f||e<32+f*16)return{offset:t,size:i};l=[];for(var d=0;d<f;d++)l.push(new Uint8Array(s,t+32+d*16,16));c=32+f*16}if(!c)return{offset:t,size:i};var h=n.getUint32(c);return i-32<h?{offset:t,size:i}
1:(u=new Uint8Array(s,t+c+4,h),{version:a,systemId:o,kids:l,data:u,offset:t,size:i})}function vf(n,i){var t=oa[i];return!!t&&!!t[n.slice(0,4)]}function Xa(n,i){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return!n.split(",").some(function(e){return!pf(e,i,t)})}function pf(n,i){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,e,r=qi(t);return(e=r==null?void 0:r.isTypeSupported(Qa(n,i)))!=null?e:!1}function Qa(n,i){return"".concat(i,"/mp4;codecs=").concat(n)}function Ay(n){if(n){var i=n.substring(0,4);return oa.video[i]}return 2}function xo(n){var i=z_();return n.split(",").reduce(function(t,e){var r=i&&Ko(e),a=r?9:oa.video[e];return a?(a*2+t)/(t?3:2):(oa.audio[e]+t)/(t?2:1)},0)}function JC(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(Ac[n])return Ac[n];for(var t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[n],e=0;e<t.length;e++){var r;if(pf(t[e],"audio",i))return Ac[n]=t[e],t[e];if(t[e]==="mp3"&&(r=qi(i))!=null&&r.isTypeSupported("audio/mpeg"))return""}return n}function Po(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return n.replace(XC,function(t){return JC(t.toLowerCase(),i)})}function QC(n,i){var t=[];if(n)for(var e=n.split(","),r=0;r<e.length;r++)vf(e[r],"video")||t.push(e[r]);return i&&t.push(i),t.join(",")}function ko(n,i){if(n&&(n.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(n)!==-1)&&(Iy(n,"audio")||Iy(n,"video")))return n;if(i){var t=i.split(",");if(t.length>1){if(n){for(var e=t.length;e--;)if(t[e].substring(0,4)===n.substring(0,4))return t[e]}return t[0]}}return i||n}function Iy(n,i){return vf(n,i)&&pf(n,i)}function $C(n){for(var i=n.split(","),t=0;t<i.length;t++){var e=i[t].split(".");e.length>2&&e[0]==="avc1"&&(i[t]="avc1.".concat(parseInt(e[1]).toString(16)).concat(("000"+parseInt(e[2]).toString(16)).slice(-4)))}return i.join(",")}function ZC(n){if(n.startsWith("av01.")){for(var i=n.split("."),t=["0","111","01","01","01","0"],e=i.length;e>4&&e<10;e++)i[e]=t[e-4];return i.join(".")}return n}function Cy(n){var i=qi(n)||{isTypeSupported:function(){return!1}};return{mpeg:i.isTypeSupported("audio/mpeg"),mp3:i.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:i.isTypeSupported('audio/mp4; codecs="ac-3"')}}function zc(n){return n.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}function X_(n,i){return{supported:!1,configurations:i,decodingInfoResults:[tL],error:n}}function rL(n,i,t,e,r,a){var s=n.videoCodec,o=n.audioCodec?n.audioGroups:null,l=a==null?void 0:a.audioCodec,u=a==null?void 0:a.channels,c=u?parseInt(u):l?1/0:2,f=null;if(o!=null&&o.length)try{o.length===1&&o[0]?f=i.groups[o[0]].channels:f=o.reduce(function(d,h){if(h){var v=i.groups[h];if(!v)throw new Error("Audio track group ".concat(h," not found"));Object.keys(v.channels).forEach(function(m){d[m]=(d[m]||0)+v.channels[m]})}return d},{2:0})}catch(d){return!0}return s!==void 0&&(s.split(",").some(function(d){return Ko(d)})||n.width>1920&&n.height>1088||n.height>1920&&n.width>1088||n.frameRate>Math.max(e,30)||n.videoRange!=="SDR"&&n.videoRange!==t||n.bitrate>Math.max(r,8e6))||!!f&&ce(c)&&Object.keys(f).some(function(d){return parseInt(d)>c})}function Q_(n,i,t){var e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},r=n.videoCodec;if(!r&&!n.audioCodec||!t)return Promise.resolve(J_);for(var a=[],s=iL(n),o=s.length,l=nL(n,i,o>0),u=l.length,c=o||1*u||1;c--;){var f={type:"media-source"};if(o&&(f.video=s[c%o]),u){f.audio=l[c%u];var d=f.audio.bitrate;f.video&&d&&(f.video.bitrate-=d)}a.push(f)}if(r){var h=navigator.userAgent;if(r.split(",").some(function(v){return Ko(v)})&&z_())return Promise.resolve(X_(new Error("Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (".concat(h,")")),a))}return Promise.all(a.map(function(v){var m=sL(v);return e[m]||(e[m]=t.decodingInfo(v))})).then(function(v){return{supported:!v.some(function(m){return!m.supported}),configurations:a,decodingInfoResults:v}}).catch(function(v){return{supported:!1,configurations:a,decodingInfoResults:[],error:v}})}function iL(n){var i,t=(i=n.videoCodec)==null?void 0:i.split(","),e=$_(n),r=n.width||640,a=n.height||480,s=n.frameRate||30,o=n.videoRange.toLowerCase();return t?t.map(function(l){var u={contentType:Qa(ZC(l),"video"),width:r,height:a,bitrate:e,framerate:s};return o!=="sdr"&&(u.transferFunction=o),u}):[]}function nL(n,i,t){var e,r=(e=n.audioCodec)==null?void 0:e.split(","),a=$_(n);return r&&n.audioGroups?n.audioGroups.reduce(function(s,o){var l,u=o?(l=i.groups[o])==null?void 0:l.tracks:null;return u?u.reduce(function(c,f){if(f.groupId===o){var d=parseFloat(f.channels||"");r.forEach(function(h){var v={contentType:Qa(h,"audio"),bitrate:t?aL(h,a):a};d&&(v.channels=""+d),c.push(v)})}return c},s):s},[]):[]}
1function aL(n,i){if(i<=1)return 1;var t=128e3;return n==="ec-3"?t=768e3:n==="ac-3"&&(t=64e4),Math.min(i/2,t)}function $_(n){return Math.ceil(Math.max(n.bitrate*.9,n.averageBitrate)/1e3)*1e3||1}function sL(n){var i="",t=n.audio,e=n.video;if(e){var r=zc(e.contentType);i+="".concat(r,"_r").concat(e.height,"x").concat(e.width,"f").concat(Math.ceil(e.framerate)).concat(e.transferFunction||"sd","_").concat(Math.ceil(e.bitrate/1e5))}if(t){var a=zc(t.contentType);i+="".concat(e?"_":"").concat(a,"_c").concat(t.channels)}return i}function oL(n){return Jc.indexOf(n)>-1}function lL(n){return!!n&&Do.indexOf(n)>-1}function Ly(n){var i=n.canSkipUntil,t=n.canSkipDateRanges,e=n.age,r=e<i/2;return i&&r?t?Ao.v2:Ao.Yes:Ao.No}function Oy(n,i){return!i||!n?!1:n.indexOf(i)!==-1}function uL(){if(typeof matchMedia=="function"){var n=matchMedia("(dynamic-range: high)"),i=matchMedia("bad query");if(n.media!==i.media)return n.matches===!0}return!1}function cL(n,i){var t=!1,e=[];if(n&&(t=n!=="SDR",e=[n]),i){e=i.allowedVideoRanges||Do.slice(0);var r=e.join("")!=="SDR"&&!i.videoCodec;t=i.preferHDR!==void 0?i.preferHDR:r&&uL(),t||(e=["SDR"])}return{preferHDR:t,allowedVideoRanges:e}}function dL(n,i,t,e,r){for(var a=Object.keys(n),s=e==null?void 0:e.channels,o=e==null?void 0:e.audioCodec,l=r==null?void 0:r.videoCodec,u=s&&parseInt(s)===2,c=!1,f=!1,d=1/0,h=1/0,v=1/0,m=1/0,p=0,g=[],E=cL(i,r),y=E.preferHDR,_=E.allowedVideoRanges,b=function(){var x=n[a[C]];c||(c=x.channels[2]>0),d=Math.min(d,x.minHeight),h=Math.min(h,x.minFramerate),v=Math.min(v,x.minBitrate);var Y=_.filter(function($){return x.videoRanges[$]>0});Y.length>0&&(f=!0)},C=a.length;C--;)b();d=ce(d)?d:0,h=ce(h)?h:0;var R=Math.max(1080,d),M=Math.max(30,h);v=ce(v)?v:t,t=Math.max(v,t),f||(i=void 0);var D=a.length>1,L=a.reduce(function(O,x){var Y=n[x];if(x===O)return O;if(g=f?_.filter(function($){return Y.videoRanges[$]>0}):[],D){if(Y.minBitrate>t)return ai(x,"min bitrate of ".concat(Y.minBitrate," > current estimate of ").concat(t)),O;if(!Y.hasDefaultAudio)return ai(x,"no renditions with default or auto-select sound found"),O;if(o&&x.indexOf(o.substring(0,4))%5!==0)return ai(x,'audio codec preference "'.concat(o,'" not found')),O;if(s&&!u){if(!Y.channels[s])return ai(x,"no renditions with ".concat(s," channel sound found (channels options: ").concat(Object.keys(Y.channels),")")),O}else if((!o||u)&&c&&Y.channels[2]===0)return ai(x,"no renditions with stereo sound found"),O;if(Y.minHeight>R)return ai(x,"min resolution of ".concat(Y.minHeight," > maximum of ").concat(R)),O;if(Y.minFramerate>M)return ai(x,"min framerate of ".concat(Y.minFramerate," > maximum of ").concat(M)),O;if(!g.some(function($){return Y.videoRanges[$]>0}))return ai(x,"no variants with VIDEO-RANGE of ".concat(st(g)," found")),O;if(l&&x.indexOf(l.substring(0,4))%5!==0)return ai(x,'video codec preference "'.concat(l,'" not found')),O;if(Y.maxScore<p)return ai(x,"max score of ".concat(Y.maxScore," < selected max of ").concat(p)),O}return O&&(xo(x)>=xo(O)||Y.fragmentError>n[O].fragmentError)?O:(m=Y.minIndex,p=Y.maxScore,x)},void 0);return{codecSet:L,videoRanges:g,preferHDR:y,minFramerate:h,minBitrate:v,minIndex:m}}function ai(n,i){tt.log('[abr] start candidates with "'.concat(n,'" ignored because ').concat(i))}function Z_(n){return n.reduce(function(i,t){var e=i.groups[t.groupId];e||(e=i.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),e.tracks.push(t);var r=t.channels||"2";return e.channels[r]=(e.channels[r]||0)+1,e.hasDefault=e.hasDefault||t.default,e.hasAutoSelect=e.hasAutoSelect||t.autoselect,e.hasDefault&&(i.hasDefaultAudio=!0),e.hasAutoSelect&&(i.hasAutoSelectAudio=!0),i},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function hL(n,i,t,e){return n.slice(t,e+1).reduce(function(r,a,s){if(!a.codecSet)return r;var o=a.audioGroups,l=r[a.codecSet];l||(r[a.codecSet]=l={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:s,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),l.minBitrate=Math.min(l.minBitrate,a.bitrate);var u=Math.min(a.height,a.width);return l.minHeight=Math.min(l.minHeight,u),l.minFramerate=Math.min(l.minFramerate,a.frameRate),l.minIndex=Math.min(l.minIndex,s),l.maxScore=Math.max(l.maxScore,a.score),l.fragmentError+=a.fragmentError,l.videoRanges[a.videoRange]=(l.videoRanges[a.videoRange]||0)+1,o&&o.forEach(function(c){if(c){var f=i.groups[c];f&&(l.hasDefaultAudio=l.hasDefaultAudio||i.hasDefaultAudio?f.hasDefault:f.hasAutoSelect||!i.hasDefaultAudio&&!i.hasAutoSelectAudio,Object.keys(f.channels).forEac
1h(function(d){l.channels[d]=(l.channels[d]||0)+f.channels[d]}))}}),r},{})}function wy(n){if(!n)return n;var i=n.lang,t=n.assocLang,e=n.characteristics,r=n.channels,a=n.audioCodec;return{lang:i,assocLang:t,characteristics:e,channels:r,audioCodec:a}}function ui(n,i,t){if("attrs"in n){var e=i.indexOf(n);if(e!==-1)return e}for(var r=0;r<i.length;r++){var a=i[r];if(mn(n,a,t))return r}return-1}function mn(n,i,t){var e=n.groupId,r=n.name,a=n.lang,s=n.assocLang,o=n.default,l=n.forced;return(e===void 0||i.groupId===e)&&(r===void 0||i.name===r)&&(a===void 0||vL(a,i.lang))&&(a===void 0||i.assocLang===s)&&(o===void 0||i.default===o)&&(l===void 0||i.forced===l)&&(!("characteristics"in n)||pL(n.characteristics||"",i.characteristics))&&(t===void 0||t(n,i))}function vL(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"--";return n.length===i.length?n===i:n.startsWith(i)||i.startsWith(n)}function pL(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",t=n.split(","),e=i.split(",");return t.length===e.length&&!t.some(function(r){return e.indexOf(r)===-1})}function pn(n,i){var t=n.audioCodec,e=n.channels;return(t===void 0||(i.audioCodec||"").substring(0,4)===t.substring(0,4))&&(e===void 0||e===(i.channels||"2"))}function mL(n,i,t,e,r){var a=i[e],s=i.reduce(function(d,h,v){var m=h.uri,p=d[m]||(d[m]=[]);return p.push(v),d},{}),o=s[a.uri];o.length>1&&(e=Math.max.apply(Math,o));var l=a.videoRange,u=a.frameRate,c=a.codecSet.substring(0,4),f=xy(i,e,function(d){if(d.videoRange!==l||d.frameRate!==u||d.codecSet.substring(0,4)!==c)return!1;var h=d.audioGroups,v=t.filter(function(m){return!h||h.indexOf(m.groupId)!==-1});return ui(n,v,r)>-1});return f>-1?f:xy(i,e,function(d){var h=d.audioGroups,v=t.filter(function(m){return!h||h.indexOf(m.groupId)!==-1});return ui(n,v,r)>-1})}function xy(n,i,t){for(var e=i;e>-1;e--)if(t(n[e]))return e;for(var r=i+1;r<n.length;r++)if(t(n[r]))return r;return-1}function Mo(n,i){var t;return!!n&&n!==((t=i.loadLevelObj)==null?void 0:t.uri)}function yL(n,i,t){if(i===null||!Array.isArray(n)||!n.length||!ce(i))return null;var e=n[0].programDateTime;if(i<(e||0))return null;var r=n[n.length-1].endProgramDateTime;if(i>=(r||0))return null;for(var a=0;a<n.length;++a){var s=n[a];if(EL(i,t,s))return s}return null}function gn(n,i){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:.005,a=null;if(n){a=i[1+n.sn-i[0].sn]||null;var s=n.endDTS-t;s>0&&s<15e-7&&(t+=15e-7),a&&n.level!==a.level&&a.end<=n.end&&(a=i[2+n.sn-i[0].sn]||null)}else t===0&&i[0].start===0&&(a=i[0]);if(a&&((!n||n.level===a.level)&&Py(t,e,a)===0||_L(a,n,Math.min(r,e))))return a;var o=e0.search(i,Py.bind(null,t,e));return o&&(o!==n||!a)?o:a}function _L(n,i,t){if(i&&i.start===0&&i.level<n.level&&(i.endPTS||0)>0){var e=i.tagList.reduce(function(r,a){return a[0]==="INF"&&(r+=parseFloat(a[1])),r},t);return n.start<=e}return!1}function Py(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,t=arguments.length>2?arguments[2]:void 0;if(t.start<=n&&t.start+t.duration>n)return 0;var e=Math.min(i,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-e<=n?1:t.start-e>n&&t.start?-1:0}function EL(n,i,t){var e=Math.min(i,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3,r=t.endProgramDateTime||0;return r-e>n}function t0(n,i,t){if(n&&n.startCC<=i&&n.endCC>=i){var e=n.fragments,r=n.fragmentHint;r&&(e=e.concat(r));var a;return e0.search(e,function(s){return s.cc<i?1:s.cc>i?-1:(a=s,s.end<=t?1:s.start>t?-1:0)}),a||null}return null}function No(n){switch(n.details){case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_TIMEOUT:case K.LEVEL_LOAD_TIMEOUT:case K.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function r0(n){return n.details.startsWith("key")}function i0(n){return r0(n)&&!!n.frag&&!n.frag.decryptdata}function Dy(n,i){var t=No(i);return n.default["".concat(t?"timeout":"error","Retry")]}function mf(n,i){var t=n.backoff==="linear"?1:Math.pow(2,i);return Math.min(t*n.retryDelayMs,n.maxRetryDelayMs)}function My(n){return et(et({},n),{errorRetry:null,timeoutRetry:null})}function Fo(n,i,t,e){if(!n)return!1;var r=e==null?void 0:e.code,a=i<n.maxNumRetry&&(SL(r)||!!t);return n.shouldRetry?n.shouldRetry(n,i,t,e,a):a}
1function SL(n){return Xc(n)||!!n&&(n<400||n>499)}function Xc(n){return n===0&&navigator.onLine===!1}function na(n){var i={action:Wt.DoNothing,flags:Cr.None};return n&&(i.resolved=!0),i}function fo(n){var i,t,e;return n.buffered&&!!(n.body.gap||(i=n.range.video)!=null&&i.partial||(t=n.range.audio)!=null&&t.partial||(e=n.range.audiovideo)!=null&&e.partial)}function Qn(n){return"".concat(n.type,"_").concat(n.level,"_").concat(n.sn)}function Ny(n,i){return n.filter(function(t){var e=i(t);return e||t.clearElementaryStreamInfo(),e})}function AL(n){var i=n.byteLength,t=i&&new DataView(n.buffer).getUint8(i-1);return t?n.slice(0,i-t):n}function LL(n){switch(n){case Yi.cbc:return"AES-CBC";case Yi.ctr:return"AES-CTR";default:throw new Error("[FastAESKey] invalid aes mode ".concat(n))}}function Uy(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,t=i||n,e={frag:n,part:i,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},r=t.byteRangeStartOffset,a=t.byteRangeEndOffset;if(ce(r)&&ce(a)){var s,o=r,l=a;if(n.sn==="initSegment"&&wL((s=n.decryptdata)==null?void 0:s.method)){var u=a-r;u%16&&(l=a+(16-u%16)),r!==0&&(e.resetIV=!0,o=r-16)}e.rangeStart=o,e.rangeEnd=l}return e}function By(n,i){var t=new Error("GAP ".concat(n.gap?"tag":"attribute"," found")),e={type:ge.MEDIA_ERROR,details:K.FRAG_GAP,fatal:!1,frag:n,error:t,networkDetails:null};return i&&(e.part=i),(i||n).stats.aborted=!0,new ki(e)}function wL(n){return n==="AES-128"||n==="AES-256"}function ho(){return{start:0,executeStart:0,executeEnd:0,end:0}}function jy(n){return a0.test(n)}function Qc(n,i){if(n.variableList!==null||n.hasVariableRefs){var t=n.variableList;return i.replace(a0,function(e){var r=e.substring(2,e.length-1),a=t==null?void 0:t[r];return a===void 0?(n.playlistParsingError||(n.playlistParsingError=new Error('Missing preceding EXT-X-DEFINE tag for Variable Reference: "'.concat(r,'"'))),e):a})}return i}function Hy(n,i,t){var e=n.variableList;e||(n.variableList=e={});var r,a;if("QUERYPARAM"in i){r=i.QUERYPARAM;try{var s=new self.URL(t).searchParams;if(s.has(r))a=s.get(r);else throw new Error('"'.concat(r,'" does not match any query parameter in URI: "').concat(t,'"'))}catch(o){n.playlistParsingError||(n.playlistParsingError=new Error("EXT-X-DEFINE QUERYPARAM: ".concat(o.message)))}}else r=i.NAME,a=i.VALUE;r in e?n.playlistParsingError||(n.playlistParsingError=new Error('EXT-X-DEFINE duplicate Variable Name declarations: "'.concat(r,'"'))):e[r]=a||""}function xL(n,i,t){var e=i.IMPORT;if(t&&e in t){var r=n.variableList;r||(n.variableList=r={}),r[e]=t[e]}else n.playlistParsingError||(n.playlistParsingError=new Error('EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "'.concat(e,'"')))}function ML(n){return n!=="ID"&&n!=="CLASS"&&n!=="CUE"&&n!=="START-DATE"&&n!=="DURATION"&&n!=="END-DATE"&&n!=="END-ON-NEXT"}function NL(n){return n==="SCTE35-OUT"||n==="SCTE35-IN"||n==="SCTE35-CMD"}function Uo(n,i){return n.length===i.length?!n.some(function(t,e){return t!==i[e]}):!1}function Ky(n,i){return!n&&!i?!0:!n||!i?!1:Uo(n,i)}function aa(n){return n==="AES-128"||n==="AES-256"||n==="AES-256-CTR"}function _f(n){switch(n){case"AES-128":case"AES-256":return Yi.cbc;case"AES-256-CTR":return Yi.ctr;default:throw new Error("invalid full segment method ".concat(n))}}function Ef(n){return Uint8Array.from(atob(n),function(i){return i.charCodeAt(0)})}function $c(n){return Uint8Array.from(unescape(encodeURIComponent(n)),function(i){return i.charCodeAt(0)})}function BL(n){var i=$c(n).subarray(0,16),t=new Uint8Array(16);return t.set(i,16-i.length),t}function o0(n){var i=function(e,r,a){var s=e[r];e[r]=e[a],e[a]=s};i(n,0,3),i(n,1,2),i(n,4,5),i(n,6,7)}function l0(n){var i=n.split(":"),t=null;if(i[0]==="data"&&i.length===2){var e=i[1].split(";"),r=e[e.length-1].split(",");if(r.length===2){var a=r[0]==="base64",s=r[1];a?(e.splice(-1,1),t=Ef(s)):t=BL(s)}}return t}function Io(n){switch(n){case rr.FAIRPLAY:return gt.FAIRPLAY;case rr.PLAYREADY:return gt.PLAYREADY;case rr.WIDEVINE:return gt.WIDEVINE;case rr.CLEARKEY:return gt.CLEARKEY}}function Ic(n){switch(n){case gt.FAIRPLAY:return rr.FAIRPLAY;case gt.PLAYREADY:return rr.PLAYREADY;
1case gt.WIDEVINE:return rr.WIDEVINE;case gt.CLEARKEY:return rr.CLEARKEY}}function Wa(n){var i=n.drmSystems,t=n.widevineLicenseUrl,e=i?[gt.FAIRPLAY,gt.WIDEVINE,gt.PLAYREADY,gt.CLEARKEY].filter(function(r){return!!i[r]}):[];return!e[gt.WIDEVINE]&&t&&e.push(gt.WIDEVINE),e}function GL(n,i,t,e){var r;switch(n){case gt.FAIRPLAY:r=["cenc","sinf"];break;case gt.WIDEVINE:case gt.PLAYREADY:r=["cenc"];break;case gt.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error("Unknown key-system: ".concat(n))}return jL(r,i,t,e)}function jL(n,i,t,e){var r={initDataTypes:n,persistentState:e.persistentState||"optional",distinctiveIdentifier:e.distinctiveIdentifier||"optional",sessionTypes:e.sessionTypes||[e.sessionType||"temporary"],audioCapabilities:i.map(function(a){return{contentType:"audio/mp4; codecs=".concat(a),robustness:e.audioRobustness||"",encryptionScheme:e.audioEncryptionScheme||null}}),videoCapabilities:t.map(function(a){return{contentType:"video/mp4; codecs=".concat(a),robustness:e.videoRobustness||"",encryptionScheme:e.videoEncryptionScheme||null}})};return[r]}function HL(n){var i;return!!n&&(n.sessionType==="persistent-license"||!!((i=n.sessionTypes)!=null&&i.some(function(t){return t==="persistent-license"})))}function c0(n){var i=new Uint16Array(n.buffer,n.byteOffset,n.byteLength/2),t=String.fromCharCode.apply(null,Array.from(i)),e=t.substring(t.indexOf("<"),t.length),r=new DOMParser,a=r.parseFromString(e,"text/xml"),s=a.getElementsByTagName("KID")[0];if(s){var o=s.childNodes[0]?s.childNodes[0].nodeValue:s.getAttribute("VALUE");if(o){var l=Ef(o).subarray(0,16);return o0(l),l}}return null}function VL(n){var i=n==null?void 0:n[rr.WIDEVINE];return i?i.keyId:null}function Wy(n){var i=n==null?void 0:n[rr.PLAYREADY];if(i){var t=l0(i.uri);if(t)return c0(t)}return null}function KL(n){for(var i=new Uint8Array(16),t=12;t<16;t++)i[t]=n>>8*(15-t)&255;return i}function f0(n,i){var t=n.length;if(!t)if(i.hasProgramDateTime){var e=i.fragments[i.fragments.length-1];n.push(e),t++}else return;for(var r=n[t-1],a=i.live?1/0:i.totalduration,s=Object.keys(i.dateRanges),o=s.length;o--;){var l=i.dateRanges[s[o]],u=l.startDate.getTime();l.tagAnchor=r.ref;for(var c=t;c--;){var f;if(((f=n[c])==null?void 0:f.sn)<i.startSN)break;var d=YL(i,u,n,c,a);if(d!==-1){l.tagAnchor=i.fragments[d].ref;break}}}}function YL(n,i,t,e,r){var a=t[e];if(a){var s=a.programDateTime;if(i>=s||e===0){var o,l=(((o=t[e+1])==null?void 0:o.start)||r)-a.start;if(i<=s+l*1e3){var u=t[e].sn-n.startSN;if(u<0)return-1;var c=n.fragments;if(c.length>t.length)for(var f=t[e+1]||c[c.length-1],d=f.sn-n.startSN,h=d;h>u;h--){var v=c[h].programDateTime;if(i>=v&&i<v+c[h].duration*1e3)return h}return u}}}return-1}function zy(n,i,t){var e,r,a=new Lt(n,t),s=(e=a.METHOD)!=null?e:"",o=a.URI,l=a.hexadecimalInteger("IV"),u=a.KEYFORMATVERSIONS,c=(r=a.KEYFORMAT)!=null?r:"identity";o&&a.IV&&!l&&tt.error("Invalid IV: ".concat(a.IV));var f=o?qa.resolve(o,i):"",d=(u||"1").split("/").map(Number).filter(Number.isFinite);return new Go(s,f,c,d,l,a.KEYID)}function Jy(n){var i=new Lt(n),t=i.decimalFloatingPoint("TIME-OFFSET");return ce(t)?t:null}function Xy(n,i){var t=(n||"").split(/[ ,]+/).filter(function(e){return e});["video","audio","text"].forEach(function(e){var r=t.filter(function(a){return vf(a,e)});r.length&&(i["".concat(e,"Codec")]=r.map(function(a){return a.split("/")[0]}).join(","),t=t.filter(function(a){return r.indexOf(a)===-1}))}),i.unknownCodecs=t}function Qy(n,i,t){var e=i[t];e&&(n[t]=e)}function zL(n,i){for(var t=n[i],e=i;e--;){var r=n[e];if(!r)return;r.programDateTime=t.programDateTime-r.duration*1e3,t=r}}function Zc(n,i,t){n.rawProgramDateTime?t.push(n):i!=null&&i.programDateTime&&(n.programDateTime=i.endProgramDateTime)}function $y(n,i,t,e){n.relurl=i.URI,i.BYTERANGE&&n.setByteRange(i.BYTERANGE),n.level=t,n.sn="initSegment",e&&(n.levelkeys=e),n.initSegment=null}function Zy(n,i,t){n.levelkeys=i;var e=t.encryptedFragments;(!e.length||e[e.length-1].levelkeys!==i)&&Object.keys(i).some(function(r){return i[r].isCommonEncryption})&&e.push(n)}function Ti(n,i,t){n.playlistParsingError=new Error("#EXT-X-".concat(i," must not appear more than once (").concat(t[0],")"))}function e_(n,i,t){n.playlistParsingError=new Error("#EXT-X-".concat(i," must appear before the first Media Segment (").concat(t[0],")"))}function Lc(n,i){var t=i.startPTS;if(ce(t)){var e=0,r;i.sn>n.sn?(e=t-n.start,r=n):(e=n.start-t,r=i),r.duration!==e&&r.setDuration(e)}else if(i.sn>n.sn){var a=n.cc===i.cc;a&&n.minEndPTS?i.setStart(n.start+(n.minEndPTS-n.start)):i.setStart(n.start+n.duration)}else i.setStart(Math.max(n.start-i.duration,0))}function d0(n,i,t,e,r,a,s){var o=e-t;o<=0&&(s.warn("Fragment should have a positive duration",i),e=t+i.duration,a=r+i.duration);var l=t,u=e,c=i.startPTS,f=i.endPTS;if(ce(c)){var d=Math.abs(c-t);n&&d>n.totalduration?s.warn("media timestamps and playlist times differ by ".concat(d,"s for level ").concat(i.level," ").concat(n.url)):ce(i.deltaPTS)?i.deltaPTS=Math.max(d,i.deltaPTS):i.deltaPTS=d,l=Math.max(t,c),t=Math.min(t,c),r=i.startDTS!==void 0?Math.min(r,i.startDTS):r,u=Math.min(e,f),e=Math.max(e,f),a=i.endDTS!==void 0?Math.max(a,i.endDTS):a}var h=t-i.start;i.start!==0&&i.setStart(t),i.setDuration(e-i.start),i.startPTS=t,i.maxStartPTS=l,i.startDTS=r,i.endPTS=e,i.minEndPTS=u,i.endDTS=a;var v=i.sn;if(!n||v<n.startSN||v>n.endSN)return 0;var m,p=v-n.startSN,g=n.fragments;for(g[p]=i,m=p;m>0;m--)Lc(g[m],g[m-1]);for(m=p;m<g.length-1;m++)Lc(g[m],g[m+1]);return n.fragmentHint&&Lc(g[g.length-1],n.fragmentHint),n.PTSKnown=n.alignedSliding=!0,h}function JL(n,i,t){if(n!==i){for(var e=null,r=n.fragments,a=r.length-1;a>=0;a--){var s=r[a].initSegment;if(s){e=s;break}}n.fragmentHint&&delete n.fragmentHint.endPTS;var o;$L(n,i,function(g,E,y,_){if((!i.startCC||i.skippedSegments)&&E.cc!==g.cc){for(var b=g.cc-E.cc,C=y;C<_.length;C++)_[C].cc+=b;i.endCC=_[_.length-1].cc}ce(g.startPTS)&&ce(g.endPTS)&&(E.setStart(E.startPTS=g.startPTS),E.startDTS=g.startDTS,E.maxStartPTS=g.maxStartPTS,E.endPTS=g.endPTS,E.endDTS=g.endDTS,E.minEndPTS=g.minEndPTS,E.setDuration(g.endPTS-g.startPTS),E.duration&&(o=E),i.PTSKnown=i.alignedSliding=!0),g.hasStream
1s&&(E.elementaryStreams=g.elementaryStreams),E.loader=g.loader,g.hasStats&&(E.stats=g.stats),g.initSegment&&(E.initSegment=g.initSegment,e=g.initSegment)});var l=i.fragments,u=i.fragmentHint?l.concat(i.fragmentHint):l;if(e&&u.forEach(function(g){var E;g&&(!g.initSegment||g.initSegment.relurl===((E=e)==null?void 0:E.relurl))&&(g.initSegment=e)}),i.skippedSegments){if(i.deltaUpdateFailed=l.some(function(g){return!g}),i.deltaUpdateFailed){t.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var c=i.skippedSegments;c--;)l.shift();i.startSN=l[0].sn}else{i.canSkipDateRanges&&(i.dateRanges=XL(n.dateRanges,i,t));var f=n.fragments.filter(function(g){return g.rawProgramDateTime});if(n.hasProgramDateTime&&!i.hasProgramDateTime)for(var d=1;d<u.length;d++)u[d].programDateTime===null&&Zc(u[d],u[d-1],f);f0(f,i)}i.endCC=l[l.length-1].cc}if(!i.startCC){var h,v=p0(n,i.startSN-1);i.startCC=(h=v==null?void 0:v.cc)!=null?h:l[0].cc}QL(n.partList,i.partList,function(g,E){E.elementaryStreams=g.elementaryStreams,E.stats=g.stats}),o?d0(i,o,o.startPTS,o.endPTS,o.startDTS,o.endDTS,t):h0(n,i),l.length&&(i.totalduration=i.edge-l[0].start),i.driftStartTime=n.driftStartTime,i.driftStart=n.driftStart;var m=i.advancedDateTime;if(i.advanced&&m){var p=i.edge;i.driftStart||(i.driftStartTime=m,i.driftStart=p),i.driftEndTime=m,i.driftEnd=p}else i.driftEndTime=n.driftEndTime,i.driftEnd=n.driftEnd,i.advancedDateTime=n.advancedDateTime;i.requestScheduled===-1&&(i.requestScheduled=n.requestScheduled)}}function XL(n,i,t){var e=i.dateRanges,r=i.recentlyRemovedDateranges,a=nt({},n);r&&r.forEach(function(l){delete a[l]});var s=Object.keys(a),o=s.length;return o?(Object.keys(e).forEach(function(l){var u=a[l],c=new s0(e[l].attr,u);c.isValid?(a[l]=c,u||(c.tagOrder+=o)):t.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'.concat(st(e[l].attr),'"'))}),a):e}function QL(n,i,t){if(n&&i)for(var e=0,r=0,a=n.length;r<=a;r++){var s=n[r],o=i[r+e];s&&o&&s.index===o.index&&s.fragment.sn===o.fragment.sn?t(s,o):e--}}function $L(n,i,t){for(var e=i.skippedSegments,r=Math.max(n.startSN,i.startSN)-i.startSN,a=(n.fragmentHint?1:0)+(e?i.endSN:Math.min(n.endSN,i.endSN))-i.startSN,s=i.startSN-n.startSN,o=i.fragmentHint?i.fragments.concat(i.fragmentHint):i.fragments,l=n.fragmentHint?n.fragments.concat(n.fragmentHint):n.fragments,u=r;u<=a;u++){var c=l[s+u],f=o[u];if(e&&!f&&c&&(f=i.fragments[u]=c),c&&f){t(c,f,u,o);var d=c.relurl,h=f.relurl;if(d&&ZL(d,h)){i.playlistParsingError=t_("media sequence mismatch ".concat(f.sn,":"),n,i,c,f);return}else if(c.cc!==f.cc){i.playlistParsingError=t_("discontinuity sequence mismatch (".concat(c.cc,"!=").concat(f.cc,")"),n,i,c,f);return}}}}function t_(n,i,t,e,r){return new Error("".concat(n," ").concat(r.url,"\nPlaylist starting @").concat(i.startSN,"\n").concat(i.m3u8,"\n\nPlaylist starting @").concat(t.startSN,"\n").concat(t.m3u8))}function h0(n,i){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,e=i.startSN+i.skippedSegments-n.startSN,r=n.fragments,a=e>=0,s=0;if(a&&e<r.length)s=r[e].start;else if(a&&i.startSN===n.endSN+1)s=n.fragmentEnd;else if(a&&t)s=n.fragmentStart+e*i.levelTargetDuration;else if(!i.skippedSegments&&i.fragmentStart===0)s=n.fragmentStart;else return;ef(i,s)}function ef(n,i){if(i){for(var t=n.fragments,e=n.skippedSegments;e<t.length;e++)t[e].addStart(i);n.fragmentHint&&n.fragmentHint.addStart(i)}}function v0(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1/0,t=1e3*n.targetduration;if(n.updated){var e=n.fragments,r=4;if(e.length&&t*r>i){var a=e[e.length-1].duration*1e3;a<t&&(t=a)}}else t/=2;return Math.round(t)}function p0(n,i,t){if(!n)return null;var e=n.fragments[i-n.startSN];return e||(e=n.fragmentHint,e&&e.sn===i)?e:i<n.startSN&&t&&t.sn===i?t:null}function r_(n,i,t){return n?m0(n.partList,i,t):null}function m0(n,i,t){if(n)for(var e=n.length;e--;){var r=n[e];if(r.index===t&&r.fragment.sn===i)return r}return null}function g0(n){n.forEach(function(i,t){var e;(e=i.details)==null||e.fragments.forEach(function(r){r.level=t,r.initSegment&&(r.initSegment.level=t)})})}function ZL(n,i){return n!==i&&i?i_(n)!==i_(i):!1}function i_(n){return n.replace(/\?[^?]*$/,"")}function Ya(n,i){for(var t=0,e=n.length;t<e;t++){var r;if(((r=n[t])==null?void 0:r.cc)===i)return n[t]}return null}function eR(n,i){return!!(n&&i.startCC<n.endCC&&i.endCC>n.startCC)}function n_(n,i){var t=n.start+i;n.startPTS=t,n.setStart(t),n.endPTS=t+n.duration}function y0(n,i){for(var t=i.fragments,e=0,r=t.length;e<r;e++)n_(t[e],n);i.fragmentHint&&n_(i.fragmentHint,n),i.alignedSliding=!0}function tR(n,i){n&&(_0(i,n),i.alignedSliding||jo(i,n),!i.alignedSliding&&!i.skippedSegments&&h0(n,i,!1))}
1function _0(n,i){if(eR(i,n)){var t=Math.min(i.endCC,n.endCC),e=Ya(i.fragments,t),r=Ya(n.fragments,t);if(!(!e||!r)){tt.log("Aligning playlist at start of dicontinuity sequence ".concat(t));var a=e.start-r.start;y0(a,n)}}}function jo(n,i){if(!(!n.hasProgramDateTime||!i.hasProgramDateTime)){var t=n.fragments,e=i.fragments;if(!(!t.length||!e.length)){var r,a,s=Math.min(i.endCC,n.endCC);i.startCC<s&&n.startCC<s&&(r=Ya(e,s),a=Ya(t,s)),(!r||!a)&&(r=e[Math.floor(e.length/2)],a=Ya(t,r.cc)||t[Math.floor(t.length/2)]);var o=r.programDateTime,l=a.programDateTime;if(!(!o||!l)){var u=(l-o)/1e3-(a.start-r.start);y0(u,n)}}}}function vr(n,i,t){Er(n,i,t),n.addEventListener(i,t)}function Er(n,i,t){n.removeEventListener(i,t)}function a_(n){return!!n.interstitialsController&&n.enableInterstitialPlayback!==!1}function iR(n,i){for(var t=new Uint8Array(i),e=0,r=0;r<n.length;r++){var a=n[r];t.set(a,e),e+=a.length}return t}function nR(){return s_||(s_=1,function(n){var i=Object.prototype.hasOwnProperty,t="~";function e(){}Object.create&&(e.prototype=Object.create(null),new e().__proto__||(t=!1));function r(l,u,c){this.fn=l,this.context=u,this.once=c||!1}function a(l,u,c,f,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var h=new r(c,f||l,d),v=t?t+u:u;return l._events[v]?l._events[v].fn?l._events[v]=[l._events[v],h]:l._events[v].push(h):(l._events[v]=h,l._eventsCount++),l}function s(l,u){--l._eventsCount===0?l._events=new e:delete l._events[u]}function o(){this._events=new e,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],c,f;if(this._eventsCount===0)return u;for(f in c=this._events)i.call(c,f)&&u.push(t?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},o.prototype.listeners=function(u){var c=t?t+u:u,f=this._events[c];if(!f)return[];if(f.fn)return[f.fn];for(var d=0,h=f.length,v=new Array(h);d<h;d++)v[d]=f[d].fn;return v},o.prototype.listenerCount=function(u){var c=t?t+u:u,f=this._events[c];return f?f.fn?1:f.length:0},o.prototype.emit=function(u,c,f,d,h,v){var m=t?t+u:u;if(!this._events[m])return!1;var p=this._events[m],g=arguments.length,E,y;if(p.fn){switch(p.once&&this.removeListener(u,p.fn,void 0,!0),g){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,c),!0;case 3:return p.fn.call(p.context,c,f),!0;case 4:return p.fn.call(p.context,c,f,d),!0;case 5:return p.fn.call(p.context,c,f,d,h),!0;case 6:return p.fn.call(p.context,c,f,d,h,v),!0}for(y=1,E=new Array(g-1);y<g;y++)E[y-1]=arguments[y];p.fn.apply(p.context,E)}else{var _=p.length,b;for(y=0;y<_;y++)switch(p[y].once&&this.removeListener(u,p[y].fn,void 0,!0),g){case 1:p[y].fn.call(p[y].context);break;case 2:p[y].fn.call(p[y].context,c);break;case 3:p[y].fn.call(p[y].context,c,f);break;case 4:p[y].fn.call(p[y].context,c,f,d);break;default:if(!E)for(b=1,E=new Array(g-1);b<g;b++)E[b-1]=arguments[b];p[y].fn.apply(p[y].context,E)}}return!0},o.prototype.on=function(u,c,f){return a(this,u,c,f,!1)},o.prototype.once=function(u,c,f){return a(this,u,c,f,!0)},o.prototype.removeListener=function(u,c,f,d){var h=t?t+u:u;if(!this._events[h])return this;if(!c)return s(this,h),this;var v=this._events[h];if(v.fn)v.fn===c&&(!d||v.once)&&(!f||v.context===f)&&s(this,h);else{for(var m=0,p=[],g=v.length;m<g;m++)(v[m].fn!==c||d&&!v[m].once||f&&v[m].context!==f)&&p.push(v[m]);p.length?this._events[h]=p.length===1?p[0]:p:s(this,h)}return this},o.prototype.removeAllListeners=function(u){var c;return u?(c=t?t+u:u,this._events[c]&&s(this,c)):(this._events=new e,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,n.exports=o}(Rc)),Rc.exports}function sR(){return typeof __HLS_WORKER_BUNDLE__=="function"}function oR(){var n=la[Za];if(n)return n.clientCount++,n;var i=new self.Blob(["var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(".concat(__HLS_WORKER_BUNDLE__.toString(),")(true);")],{type:"text/javascript"}),t=self.URL.createObjectURL(i),e=new self.Worker(t),r={worker:e,objectURL:t,clientCount:1};return la[Za]=r,r}function lR(n){var i=la[n];if(i)return i.clientCount++,i;var t=new self.URL(n,self.location.href).href,e=new self.Worker(t),r={worker:e,scriptURL:t,clientCount:1};return la[n]=r,r}function uR(n){var i=la[n||Za];if(i){var t=i.clientCount--;if(t===1){var e=i.worker,r=i.objectURL;delete la[n||Za],r&&self.URL.revokeObjectURL(r),e.terminate()}}}function S0(n,i){return i+10<=n.length&&n[i]===51&&n[i+1]===68&&n[i+2]===73&&n[i+3]<255&&n[i+4]<255&&n[i+6]<128&&n[i+7]<128&&n[i+8]<128&&n[i+9]<128}function bf(n,i){return i+10<=n.length&&n[i]===73&&n[i+1]===68&&n[i+2]===51&&n[i+3]<255&&n[i+4]<255&&n[i+6]<128&&n[i+7]<128&&n[i+8]<128&&n[i+9]<128}function Wo(n,i){var t=0;return t=(n[i]&127)<<21,t|=(n[i+1]&127)<<14,t|=(n[i+2]&127)<<7,t|=n[i+3]&127,t}function es(n,i){for(var t=i,e=0;bf(n,i);){e+=10;var r=Wo(n,i+6);e+=r,S0(n,i+10)&&(e+=10),i+=e}if(e>0)return n.subarray(t,t+e)}function cR(n,i,t,e){var r=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],a=i[t+2],s=a>>2&15;if(s>12){var o=new Error("invalid ADTS sampling index:".concat(s));n.emit(S.ERROR,S.ERROR,{type:ge.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!0,error:o,reason:o.message});return}var l=(a>>6&3)+1,u=i[t+3]>>6&3|(a&1)<<2,c="mp4a.40."+l,f=r[s],d=s;(l===5||l===29)&&(d-=3);var h=[l<<3|(d&14)>>1,(d&1)<<7|u<<3];return tt.log("manifest codec:".concat(e,", parsed codec:").concat(c,", channels:").concat(u,", rate:").concat(f," (ADTS object type:").concat(l," sampling index:").concat(s,")")),{config:h,samplerate:f,channelCount:u,codec:c,parsedCodec:c,manifestCodec:e}}function T0(n,i){return n[i]===255&&(n[i+1]&246)===240}function b0(n,i){return n[i+1]&1?7:9}function kf(n,i){return(n[i+3]&3)<<11|n[i+4]<<3|(n[i+5]&224)>>>5}function fR(n,i){return i+5<n.length}function Ho(n,i){return i+1<n.length&&T0(n,i)}function dR(n,i){return fR(n,i)&&T0(n,i)&&kf(n,i)<=n.length-i}
1function hR(n,i){if(Ho(n,i)){var t=b0(n,i);if(i+t>=n.length)return!1;var e=kf(n,i);if(e<=t)return!1;var r=i+e;return r===n.length||Ho(n,r)}return!1}function k0(n,i,t,e,r){if(!n.samplerate){var a=cR(i,t,e,r);if(!a)return;nt(n,a)}}function A0(n){return 1024*9e4/n}function vR(n,i){var t=b0(n,i);if(i+t<=n.length){var e=kf(n,i)-t;if(e>0)return{headerLength:t,frameLength:e}}}function I0(n,i,t,e,r){var a=A0(n.samplerate),s=e+r*a,o=vR(i,t),l;if(o){var u=o.frameLength,c=o.headerLength,f=c+u,d=Math.max(0,t+f-i.length);d?(l=new Uint8Array(f-c),l.set(i.subarray(t+c,i.length),0)):l=i.subarray(t+c,t+f);var h={unit:l,pts:s};return d||n.samples.push(h),{sample:h,length:f,missing:d}}var v=i.length-t;l=new Uint8Array(v),l.set(i.subarray(t,i.length),0);var m={unit:l,pts:s};return{sample:m,length:v,missing:-1}}function pR(n,i){return bf(n,i)&&Wo(n,i+6)+10<=n.length-i}function mR(n){return n instanceof ArrayBuffer?n:n.byteOffset==0&&n.byteLength==n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer}function Oc(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1/0;return gR(n,i,t,Uint8Array)}function gR(n,i,t,e){var r=yR(n),a=1;"BYTES_PER_ELEMENT"in e&&(a=e.BYTES_PER_ELEMENT);var s=_R(n)?n.byteOffset:0,o=(s+n.byteLength)/a,l=(s+i)/a,u=Math.floor(Math.max(0,Math.min(l,o))),c=Math.floor(Math.min(u+Math.max(t,0),o));return new e(r,u,c-u)}function yR(n){return n instanceof ArrayBuffer?n:n.buffer}function _R(n){return n&&n.buffer instanceof ArrayBuffer&&n.byteLength!==void 0&&n.byteOffset!==void 0}function ER(n){var i={key:n.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(!(n.size<2)){if(n.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}var e=n.data.subarray(1).indexOf(0);if(e!==-1){var r=Or(Oc(n.data,1,e)),a=n.data[2+e],s=n.data.subarray(3+e).indexOf(0);if(s!==-1){var o=Or(Oc(n.data,3+e,s)),l;return r==="-->"?l=Or(Oc(n.data,4+e+s)):l=mR(n.data.subarray(4+e+s)),i.mimeType=r,i.pictureType=a,i.description=o,i.data=l,i}}}}function SR(n){if(!(n.size<2)){var i=Or(n.data,!0),t=new Uint8Array(n.data.subarray(i.length+1));return{key:n.type,info:i,data:t.buffer}}}function TR(n){if(!(n.size<2)){if(n.type==="TXXX"){var i=1,t=Or(n.data.subarray(i),!0);i+=t.length+1;var e=Or(n.data.subarray(i));return{key:n.type,info:t,data:e}}var r=Or(n.data.subarray(1));return{key:n.type,info:"",data:r}}}function bR(n){if(n.type==="WXXX"){if(n.size<2)return;var i=1,t=Or(n.data.subarray(i),!0);i+=t.length+1;var e=Or(n.data.subarray(i));return{key:n.type,info:t,data:e}}var r=Or(n.data);return{key:n.type,info:"",data:r}}function kR(n){return n.type==="PRIV"?SR(n):n.type[0]==="W"?bR(n):n.type==="APIC"?ER(n):TR(n)}function AR(n){var i=String.fromCharCode(n[0],n[1],n[2],n[3]),t=Wo(n,4),e=10;return{type:i,size:t,data:n.subarray(e,e+t)}}function C0(n){for(var i=0,t=[];bf(n,i);){var e=Wo(n,i+6);n[i+5]>>6&1&&(i+=vo),i+=vo;for(var r=i+e;i+IR<r;){var a=AR(n.subarray(i)),s=kR(a);s&&t.push(s),i+=a.size+vo}S0(n,i)&&(i+=vo)}return t}function L0(n){return n&&n.key==="PRIV"&&n.info==="com.apple.streaming.transportStreamTimestamp"}function CR(n){if(n.data.byteLength===8){var i=new Uint8Array(n.data),t=i[3]&1,e=(i[4]<<23)+(i[5]<<15)+(i[6]<<7)+i[7];return e/=45,t&&(e+=4772185884e-2),Math.round(e)}}function Af(n){for(var i=C0(n),t=0;t<i.length;t++){var e=i[t];if(L0(e))return CR(e)}}function li(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:9e4;return{type:n,id:-1,pid:-1,inputTimeScale:i,sequenceNumber:-1,samples:[],dropped:0}}function R0(n,i,t,e,r){if(!(t+24>i.length)){var a=O0(i,t);if(a&&t+a.frameLength<=i.length){var s=a.samplesPerFrame*9e4/a.sampleRate,o=e+r*s,l={unit:i.subarray(t,t+a.frameLength),pts:o,dts:o};return n.config=[],n.channelCount=a.channelCount,n.samplerate=a.sampleRate,n.samples.push(l),{sample:l,length:a.frameLength,missing:0}}}}function O0(n,i){var t=n[i+1]>>3&3,e=n[i+1]>>1&3,r=n[i+2]>>4&15,a=n[i+2]>>2&3;if(t!==1&&r!==0&&r!==15&&a!==3){var s=n[i+2]>>1&1,o=n[i+3]>>6,l=t===3?3-e:e===3?3:4,u=RR[l*14+r-1]*1e3,c=t===3?0:t===2?1:2,f=OR[c*3+a],d=o===3?1:2,h=wR[t][e],v=xR[e],m=h*8*v,p=Math.floor(h*u/f+s)*v;if(po===null){var g=navigator.userAgent||"",E=g.match(/Chrome\/(\d+)/i);po=E?parseInt(E[1]):0}var y=!!po&&po<=87;return y&&e===2&&u>=224e3&&o===0&&(n[i+3]=n[i+3]|128),{sampleRate:f,channelCount:d,frameLength:p,samplesPerFrame:m}}}function Cf(n,i){return n[i]===255&&(n[i+1]&224)===224&&(n[i+1]&6)!==0}function w0(n,i){return i+1<n.length&&Cf(n,i)}function PR(n,i){var t=4;return Cf(n,i)&&t<=n.length-i}
1function x0(n,i){if(i+1<n.length&&Cf(n,i)){var t=4,e=O0(n,i),r=t;e!=null&&e.frameLength&&(r=e.frameLength);var a=i+r;return a===n.length||w0(n,a)}return!1}function D0(n,i,t,e,r){if(t+8>i.length||i[t]!==11||i[t+1]!==119)return-1;var a=i[t+4]>>6;if(a>=3)return-1;var s=[48e3,44100,32e3],o=s[a],l=i[t+4]&63,u=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920],c=u[l*3+a]*2;if(t+c>i.length)return-1;var f=i[t+6]>>5,d=0;f===2?d+=2:(f&1&&f!==1&&(d+=2),f&4&&(d+=2));var h=(i[t+6]<<8|i[t+7])>>12-d&1,v=[2,1,2,3,3,4,4,5],m=v[f]+h,p=i[t+5]>>3,g=i[t+5]&7,E=new Uint8Array([a<<6|p<<1|g>>2,(g&3)<<6|f<<3|h<<2|l>>4,l<<4&224]),y=1536/o*9e4,_=e+r*y,b=i.subarray(t,t+c);return n.config=E,n.channelCount=m,n.samplerate=o,n.samples.push({unit:b,pts:_}),c}function o_(n,i){return ce(n.presentationTime)?n.presentationTime/n.timeScale:i+n.presentationTimeDelta/n.timeScale}function tf(n,i){return((n[i+1]&31)<<8)+n[i+2]}function VR(n,i){return(n[i+10]&31)<<8|n[i+11]}function KR(n,i,t,e,r,a){var s={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=(n[i+1]&15)<<8|n[i+2],l=i+3+o-4,u=(n[i+10]&15)<<8|n[i+11];for(i+=12+u;i<l;){var c=tf(n,i),f=(n[i+3]&15)<<8|n[i+4];switch(n[i]){case 207:if(!e){wc("ADTS AAC",a);break}case 15:s.audioPid===-1&&(s.audioPid=c);break;case 21:s.id3Pid===-1&&(s.id3Pid=c);break;case 219:if(!e){wc("H.264",a);break}case 27:s.videoPid===-1&&(s.videoPid=c);break;case 3:case 4:!t.mpeg&&!t.mp3?a.log("MPEG audio found, not supported in this browser"):s.audioPid===-1&&(s.audioPid=c,s.segmentAudioCodec="mp3");break;case 193:if(!e){wc("AC-3",a);break}case 129:t.ac3?s.audioPid===-1&&(s.audioPid=c,s.segmentAudioCodec="ac3"):a.log("AC-3 audio found, not supported in this browser");break;case 6:if(s.audioPid===-1&&f>0)for(var d=i+5,h=f;h>2;){var v=n[d];switch(v){case 106:t.ac3!==!0?a.log("AC-3 audio found, not supported in this browser for now"):(s.audioPid=c,s.segmentAudioCodec="ac3");break}var m=n[d+1]+2;d+=m,h-=m}break;case 194:case 135:return rf(r,new Error("Unsupported EC-3 in M2TS found"),void 0,a),s;case 36:s.videoPid===-1&&(s.videoPid=c,s.segmentVideoCodec="hevc",a.log("HEVC in M2TS found"));break}i+=f+5}return s}function rf(n,i,t,e){e.warn("parsing error: ".concat(i.message)),n.emit(S.ERROR,S.ERROR,{type:ge.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:i,reason:i.message})}function wc(n,i){i.log("".concat(n," with AES-128-CBC encryption found in unencrypted stream"))}function Zn(n,i){var t=0,e,r,a,s,o,l=n.data;if(!n||n.size===0)return null;for(;l[0].length<19&&l.length>1;)l[0]=jr(l[0],l[1]),l.splice(1,1);e=l[0];var u=(e[0]<<16)+(e[1]<<8)+e[2];if(u===1){if(r=(e[4]<<8)+e[5],r&&r>n.size-6)return null;var c=e[7];c&192&&(s=(e[9]&14)*536870912+(e[10]&255)*4194304+(e[11]&254)*16384+(e[12]&255)*128+(e[13]&254)/2,c&64?(o=(e[14]&14)*536870912+(e[15]&255)*4194304+(e[16]&254)*16384+(e[17]&255)*128+(e[18]&254)/2,s-o>60*9e4&&(i.warn("".concat(Math.round((s-o)/9e4),"s delta between PTS and DTS, align them")),s=o)):o=s),a=e[8];var f=a+9;if(n.size<=f)return null;n.size-=f;for(var d=new Uint8Array(n.size),h=0,v=l.length;h<v;h++){e=l[h];var m=e.byteLength;if(f)if(f>m){f-=m;continue}else e=e.subarray(f),m-=f,f=0;d.set(e,t),t+=m}return r&&(r-=a+3),{data:d,pts:s,dts:o,len:r}}return null}function Lf(n,i){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=n*i*t;return e?Math.round(r):r}function qR(n,i){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return Lf(n,i,1/t,e)}function Ka(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Lf(n,1e3,1/N0,i)}function YR(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Lf(n,N0,1/i)}function l_(n){var i=n.baseTime,t=n.timescale,e=n.trackId;return"".concat(i/t," (").concat(i,"/").concat(t,") trackId: ").concat(e)}function u_(n,i,t,e){return{duration:i,size:t,cts:e,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:n?2:1,isNonSync:n?0:1}}}function Lr(n,i){var t;if(i===null)return n;for(i<n?t=-8589934592:t=8589934592;Math.abs(n-i)>4294967296;)n+=t;return n}function $R(n){for(var i=0;i<n.length;i++)if(n[i].key)return i;return-1}function F0(n,i,t,e){var r=n.samples.length;if(r){for(var a=n.inputTimeScale,s=0;s<r;s++){var o=n.samples[s];o.pts=Lr(o.pts-t.baseTime*a/t.timescale,i*a)/a,o.dts=Lr(o.dts-e.baseTime*a/e.timescale,i*a)/a}var l=n.samples;return n.samples=[],{samples:l}}}function U0(n,i,t){var e=n.samples.length;if(e){for(var r=n.inputTimeScale,a=0;a<e;a++){var s=n.samples[a];s.pts=Lr(s.pts-t.baseTime*r/t.timescale,i*r)/r}n.samples.sort(function(l,u){return l.pts-u.pts});var o=n.samples;return n.samples=[],{samples:o}}}function mo(n,i){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return(n==null?void 0:n.start)!==void 0?(n.start+(t?n.duration:0))/n.timescale:i}function eO(n,i,t,e){if(n===null)return!0;var r=Math.max(e,1),a=i-n.baseTime/n.timescale;return Math.abs(a-t)>r}function c_(n,i,t){var e=n.codec;if(e&&e.length>4)return e;if(i===at.AUDIO){if(e==="ec-3"||e==="ac-3"||e==="alac")return e;if(e==="fLaC"||e==="Opus"){var r=!1;return Po(e,r)}return t.warn('Unhandled audio codec "'.concat(e,'" in mp4 MAP')),e||"mp4a"}return t.warn('Unhandled video codec "'.concat(e,'" in mp4 MAP')),e||"avc1"}function tO(n,i){var t=null;return n.byteLength>0&&(i==null?void 0:i.key)!=null&&i.iv!==null&&i.method!=null&&(t=i),t}function ts(n){return"then"in n&&n.then instanceof Function}
1function G0(n,i){if(n.length!==i.length)return!1;for(var t=0;t<n.length;t++)if(!rs(n[t].attrs,i[t].attrs))return!1;return!0}function rs(n,i,t){var e=n["STABLE-RENDITION-ID"];return e&&!t?e===i["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(function(r){return n[r]!==i[r]})}function nf(n,i){return i.label.toLowerCase()===n.name.toLowerCase()&&(!i.language||i.language.toLowerCase()===(n.lang||"").toLowerCase())}function p_(n){var i=n.querySelectorAll("source");[].slice.call(i).forEach(function(t){n.removeChild(t)})}function uO(n,i){var t=self.document.createElement("source");t.type="video/mp4",t.src=i,n.appendChild(t)}function Dc(n){return n==="audio"?1:0}function pO(n){return Array.isArray(n)?JSON.stringify(n):n instanceof Map?"Map{}":n instanceof Set?"Set{}":pe(n)==="object"?JSON.stringify(n):String(n)}function mO(n,i,t,e){return new Error("failed to ".concat(n,' "').concat(pO(i),'" as ').concat(t),{cause:e})}function ci(n,i,t){return mO("serialize",n,i,t)}function yO(n){if(typeof n!="boolean")throw ci(n,gO);return n?"?1":"?0"}function _O(n){return btoa(String.fromCharCode.apply(String,nr(n)))}function SO(n){if(ArrayBuffer.isView(n)===!1)throw ci(n,EO);return":".concat(_O(n),":")}function bO(n){return n<-999999999999999||999999999999999<n}function V0(n){if(bO(n))throw ci(n,TO);return n.toString()}function kO(n){return"@".concat(V0(n.getTime()/1e3))}function K0(n,i){if(n<0)return-K0(-n,i);var t=Math.pow(10,i),e=Math.abs(n*t%1-.5)<Number.EPSILON;if(e){var r=Math.floor(n*t);return(r%2===0?r:r+1)/t}else return Math.round(n*t)/t}function IO(n){var i=K0(n,3);if(Math.floor(Math.abs(i)).toString().length>12)throw ci(n,AO);var t=i.toString();return t.includes(".")?t:"".concat(t,".0")}function RO(n){if(LO.test(n))throw ci(n,CO);return'"'.concat(n.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),'"')}function OO(n){return n.description||n.toString().slice(7,-1)}function g_(n){var i=OO(n);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(i)===!1)throw ci(i,wO);return i}function af(n){switch(pe(n)){case"number":if(!ce(n))throw ci(n,m_);return Number.isInteger(n)?V0(n):IO(n);case"string":return RO(n);case"symbol":return g_(n);case"boolean":return yO(n);case"object":if(n instanceof Date)return kO(n);if(n instanceof Uint8Array)return SO(n);if(n instanceof H0)return g_(n);default:throw ci(n,m_)}}function sf(n){if(/^[a-z*][a-z0-9\-_.*]*$/.test(n)===!1)throw ci(n,xO);return n}function Of(n){return n==null?"":Object.entries(n).map(function(i){var t=Te(i,2),e=t[0],r=t[1];return r===!0?";".concat(sf(e)):";".concat(sf(e),"=").concat(af(r))}).join("")}function W0(n){return n instanceof yn?"".concat(af(n.value)).concat(Of(n.params)):af(n)}function PO(n){return"(".concat(n.value.map(W0).join(" "),")").concat(Of(n.params))}function DO(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{whitespace:!0};if(pe(n)!=="object"||n==null)throw ci(n,vO);var t=n instanceof Map?n.entries():Object.entries(n),e=i!=null&&i.whitespace?" ":"";return Array.from(t).map(function(r){var a=Te(r,2),s=a[0],o=a[1];o instanceof yn||(o=new yn(o));var l=sf(s);return o.value===!0?l+=Of(o.params):(l+="=",Array.isArray(o.value)?l+=PO(o):l+=W0(o)),l}).join(",".concat(e))}function q0(n,i){return DO(n,i)}function FO(n){return Object.keys(n).reduce(function(i,t){var e;return(e=n[t])===null||e===void 0||e.forEach(function(r){return i[r]=t}),i},{})}function UO(n,i){var t={};if(!n)return t;var e=Object.keys(n),r=i?FO(i):{};return e.reduce(function(a,s){var o,l=MO[s]||r[s]||NO.REQUEST,u=(o=a[l])!==null&&o!==void 0?o:a[l]={};return u[s]=n[s],a},t)}function BO(n){return["ot","sf","st","e","sta"].includes(n)}function GO(n){return typeof n=="number"?ce(n):n!=null&&n!==""&&n!==!1}function jO(n,i){var t=new URL(n),e=new URL(i);if(t.origin!==e.origin)return n;for(var r=t.pathname.split("/").slice(1),a=e.pathname.split("/").slice(1,-1);r[0]===a[0];)r.shift(),a.shift();for(;a.length;)a.shift(),r.unshift("..");var s=r.join("/");return s+t.search+t.hash}function qo(n){return qO.test(n)}function YO(n){return wf.includes(n)||WO.includes(n)||qo(n)}function zO(n){return wf.includes(n)||X0.includes(n)||qo(n)}function XO(n){return wf.includes(n)||X0.includes(n)||JO.includes(n)||qo(n)}function $O(n){return QO.includes(n)||qo(n)}function Q0(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t={};if(n==null||pe(n)!=="object")return t;var e=i.version||n.v||1,r=i.reportingMode||z0,a=e===1?$O:ZO[r],s=Object.keys(n).filter(a),o=i.filter;typeof o=="function"&&(s=s.filter(o));var l=r===J0||r===Y0;l&&!s.includes("ts")&&s.push("ts"),e>1&&!s.includes("v")&&s.push("v");var u=nt({},KO,i.formatters),c={version:e,reportingMode:r,baseUrl:i.baseUrl};
1return s.sort().forEach(function(f){var d=n[f],h=u[f];if(typeof h=="function"&&(d=h(d,c)),f==="v"){if(e===1)return;d=e}f=="pr"&&d===1||(l&&f==="ts"&&!ce(d)&&(d=Date.now()),GO(d)&&(BO(f)&&typeof d=="string"&&(d=new H0(d)),t[f]=d))}),t}function ew(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t={};if(!n)return t;var e=Q0(n,i),r=UO(e,i==null?void 0:i.customHeaderMap);return Object.entries(r).reduce(function(a,s){var o=Te(s,2),l=o[0],u=o[1],c=q0(u,{whitespace:!1});return c&&(a[l]=c),a},t)}function tw(n,i,t){return nt(n,ew(i,t))}function iw(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return n?q0(Q0(n,i),{whitespace:!1}):""}function nw(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!n)return"";var t=iw(n,i);return encodeURIComponent(t)}function aw(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!n)return"";var t=nw(n,i);return"".concat(rw,"=").concat(t)}function sw(n,i,t){var e=aw(i,t);if(!e)return n;if(y_.test(n))return n.replace(y_,e);var r=n.includes("?")?"&":"?";return"".concat(n).concat(r).concat(e)}
1function __(n,i,t,e){n&&Object.keys(i).forEach(function(r){var a=n.filter(function(s){return s.groupId===r}).map(function(s){var o=nt({},s);return o.details=void 0,o.attrs=new Lt(o.attrs),o.url=o.attrs.URI=$0(s.url,s.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=i[r],o.attrs["PATHWAY-ID"]=e,o});n.push.apply(n,nr(a))})}function $0(n,i,t,e){var r=e.HOST,a=e.PARAMS,s=e[t],o;i&&(o=s==null?void 0:s[i],o&&(n=o));var l=new self.URL(n);return r&&!o&&(l.host=r),a&&Object.keys(a).sort().forEach(function(u){u&&l.searchParams.set(u,a[u])}),l.href}function yo(n){if(!n)throw new Error("Could not read keyId of undefined decryptdata");if(n.keyId===null)throw new Error("keyId is null");return tr(n.keyId)}function cw(n,i){if(n.keyId&&i.mediaKeysSession.keyStatuses.has(n.keyId))return i.mediaKeysSession.keyStatuses.get(n.keyId);if(n.matches(i.decryptdata))return i.keyStatus}function E_(n,i){var t=n==="output-restricted",e=t?K.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:K.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new Ir({type:ge.KEY_SYSTEM_ERROR,details:e,fatal:!1,decryptdata:i},t?"HDCP level output restricted":'key status changed to "'.concat(n,'"'))}function eE(n,i){var t;try{t=new Event("addtrack")}catch(e){t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=n,i.dispatchEvent(t)}function tE(n,i){var t=n.mode;if(t==="disabled"&&(n.mode="hidden"),n.cues&&!n.cues.getCueById(i.id))try{if(n.addCue(i),!n.cues.getCueById(i.id))throw new Error("addCue is failed for: ".concat(i))}catch(r){tt.debug("[texttrack-utils]: ".concat(r));try{var e=new self.TextTrackCue(i.startTime,i.endTime,i.text);e.id=i.id,n.addCue(e)}catch(a){tt.debug("[texttrack-utils]: Legacy TextTrackCue fallback failed: ".concat(a))}}t==="disabled"&&(n.mode=t)}function ia(n,i){var t=n.mode;if(t==="disabled"&&(n.mode="hidden"),n.cues)for(var e=n.cues.length;e--;)i&&n.cues[e].removeEventListener("enter",i),n.removeCue(n.cues[e]);t==="disabled"&&(n.mode=t)}function of(n,i,t,e){var r=n.mode;if(r==="disabled"&&(n.mode="hidden"),n.cues&&n.cues.length>0)for(var a=hw(n.cues,i,t),s=0;s<a.length;s++)(!e||e(a[s]))&&n.removeCue(a[s]);r==="disabled"&&(n.mode=r)}function dw(n,i){if(i<=n[0].startTime)return 0;var t=n.length-1;if(i>n[t].endTime)return-1;for(var e=0,r=t,a;e<=r;)if(a=Math.floor((r+e)/2),i<n[a].startTime)r=a-1;else if(i>n[a].startTime&&e<t)e=a+1;else return a;return n[e].startTime-i<i-n[r].startTime?e:r}function hw(n,i,t){var e=[],r=dw(n,i);if(r>-1)for(var a=r,s=n.length;a<s;a++){var o=n[a];if(o.startTime>=i&&o.endTime<=t)e.push(o);else if(o.startTime>t)return e}return e}function Oo(n){for(var i=[],t=0;t<n.length;t++){var e=n[t];(e.kind==="subtitles"||e.kind==="captions")&&e.label&&i.push(n[t])}return i}function pw(){try{return crypto.randomUUID()}catch(r){try{var n=URL.createObjectURL(new Blob),i=n.toString();return URL.revokeObjectURL(n),i.slice(i.lastIndexOf("/")+1)}catch(a){var t=new Date().getTime(),e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(s){var o=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(s=="x"?o:o&3|8).toString(16)});return e}}}function Ja(n){for(var i=5381,t=n.length;t;)i=i*33^n.charCodeAt(--t);return(i>>>0).toString()}function mw(n,i,t){return"".concat(n.identifier,"-").concat(t+1,"-").concat(Ja(i))}function Mc(n,i){return n-i.start<i.duration/2&&!(Math.abs(n-(i.start+i.duration))<sa)?i.start:i.start+i.duration}function rE(n,i,t){var e=new self.URL(n,t);return e.protocol!=="data:"&&e.searchParams.set("_HLS_primary_id",i),e}function Nc(n,i){for(;(t=n.assetList[++i])!=null&&t.error;)var t;return i}function yw(n){return'["'.concat(n.identifier,'" ').concat(n.cue.pre?"<pre>":n.cue.post?"<post>":"").concat(n.timelineStart.toFixed(2),"-").concat(n.resumeTime.toFixed(2),"]")}function ra(n){var i=n.timelineStart,t=n.duration||0;return'["'.concat(n.identifier,'" ').concat(i.toFixed(2),"-").concat((i+t).toFixed(2),"]")}function Jr(n){return"[".concat(n.event?'"'+n.event.identifier+'"':"primary",": ").concat(n.start.toFixed(2),"-").concat(n.end.toFixed(2),"]")}function T_(n){var i;n==null||(i=n.play())==null||i.catch(function(){})}function ta(n,i){return"[".concat(n,"] Advancing timeline position to ").concat(i)}function _o(n,i,t){t.a=n,t.b=i}function Dw(n,i,t){return t.a===n&&t.b===i}function Mw(){return{a:null,b:null}}function aE(n){function i(e,r,a,s){return(e|0)*3600+(r|0)*60+(a|0)+parseFloat(s||0)}var t=n.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?i(t[2],t[3],0,t[4]):i(t[1],t[2],t[3],t[4]):null}function sE(n,i,t,e){var r=e?n.split(e):[n];for(var a in r)if(typeof r[a]=="string"){var s=r[a].split(t);if(s.length===2){var o=s[0],l=s[1];i(o,l)}}}function Uw(n,i,t){var e=n;function r(){var o=aE(n);if(o===null)throw new Error("Malformed timestamp: "+e);return n=n.replace(/^[^\sa-zA-Z-]+/,""),o}function a(o,l){var u=new Fw;sE(o,function(d,h){var v;switch(d){case"region":for(var m=t.length-1;m>=0;m--)if(t[m].id===h){u.set(d,t[m].region);break}break;case"vertical":u.alt(d,h,["rl","lr"]);break;case"line":v=h.split(","),u.integer(d,v[0]),u.percent(d,v[0])&&u.set("snapToLines",!1),u.alt(d,v[0],["auto"]),v.length===2&&u.alt("lineAlign",v[1],["start",Eo,"end"]);break;case"position":v=h.split(","),u.percent(d,v[0]),v.length===2&&u.alt("positionAlign",v[1],["start",Eo,"end","line-left","line-right","auto"]);break;case"size":u.percent(d,h);break;case"align":u.alt(d,h,["start",Eo,"end","left","right"]);break}}
1,/:/,/\s/),l.region=u.get("region",null),l.vertical=u.get("vertical","");var c=u.get("line","auto");c==="auto"&&lf.line===-1&&(c=-1),l.line=c,l.lineAlign=u.get("lineAlign","start"),l.snapToLines=u.get("snapToLines",!0),l.size=u.get("size",100),l.align=u.get("align",Eo);var f=u.get("position","auto");f==="auto"&&lf.position===50&&(f=l.align==="start"||l.align==="left"?0:l.align==="end"||l.align==="right"?100:50),l.position=f}function s(){n=n.replace(/^\s+/,"")}if(s(),i.startTime=r(),s(),n.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+e);n=n.slice(3),s(),i.endTime=r(),s(),a(n,i)}function oE(n){return n.replace(/<br(?: \/)?>/gi,"\n")}function Pf(n,i,t){return Ja(n.toString())+Ja(i.toString())+Ja(t)}function Vw(n,i,t,e,r,a,s){var o=new Bw,l=Or(new Uint8Array(n)).trim().replace(Gw,"\n").split("\n"),u=[],c=i?YR(i.baseTime,i.timescale):0,f="00:00.000",d=0,h=0,v,m=!0;o.oncue=function(p){var g=t[e],E=t.ccOffset,y=(d-c)/9e4;if(g!=null&&g.new&&(h!==void 0?E=t.ccOffset=g.start:Hw(t,e,y)),y){if(!i){v=new Error("Missing initPTS for VTT MPEGTS");return}E=y-t.presentationOffset}var _=p.endTime-p.startTime,b=Lr((p.startTime+E-h)*9e4,r*9e4)/9e4;p.startTime=Math.max(b,0),p.endTime=Math.max(b+_,0);var C=p.text.trim();p.text=decodeURIComponent(encodeURIComponent(C)),p.id||(p.id=Pf(p.startTime,p.endTime,C)),p.endTime>0&&u.push(p)},o.onparsingerror=function(p){v=p},o.onflush=function(){if(v){s(v);return}a(u)},l.forEach(function(p){if(m)if(Uc(p,"X-TIMESTAMP-MAP=")){m=!1,p.slice(16).split(",").forEach(function(g){Uc(g,"LOCAL:")?f=g.slice(6):Uc(g,"MPEGTS:")&&(d=parseInt(g.slice(7)))});try{h=jw(f)/1e3}catch(g){v=g}return}else p===""&&(m=!1);o.parse(p+"\n")}),o.flush()}function I_(n,i,t,e){var r=Ne(new Uint8Array(n),["mdat"]);if(r.length===0){e(new Error("Could not parse IMSC1 mdat"));return}var a=r.map(function(o){return Or(o)}),s=qR(i.baseTime,1,i.timescale);try{a.forEach(function(o){return t(Ww(o,s))})}catch(o){e(o)}}function Ww(n,i){var t=new DOMParser,e=t.parseFromString(n,"text/xml"),r=e.getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");var a={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},s=Object.keys(a).reduce(function(f,d){return f[d]=r.getAttribute("ttp:".concat(d))||a[d],f},{}),o=r.getAttribute("xml:space")!=="preserve",l=C_(Gc(r,"styling","style")),u=C_(Gc(r,"layout","region")),c=Gc(r,"body","[begin]");return[].map.call(c,function(f){var d=cE(f,o);if(!d||!f.hasAttribute("begin"))return null;var h=Hc(f.getAttribute("begin"),s),v=Hc(f.getAttribute("dur"),s),m=Hc(f.getAttribute("end"),s);if(h===null)throw L_(f);if(m===null){if(v===null)throw L_(f);m=h+v}var p=new xf(h-i,m-i,d);p.id=Pf(p.startTime,p.endTime,p.text);var g=u[f.getAttribute("region")],E=l[f.getAttribute("style")],y=qw(g,E,l),_=y.textAlign;if(_){var b=Kw[_];b&&(p.lineAlign=b),p.align=_}return nt(p,y),p}).filter(function(f){return f!==null})}function Gc(n,i,t){var e=n.getElementsByTagName(i)[0];return e?[].slice.call(e.querySelectorAll(t)):[]}function C_(n){return n.reduce(function(i,t){var e=t.getAttribute("xml:id");return e&&(i[e]=t),i},{})}function cE(n,i){return[].slice.call(n.childNodes).reduce(function(t,e,r){var a;return e.nodeName==="br"&&r?t+"\n":(a=e.childNodes)!=null&&a.length?cE(e,i):i?t+e.textContent.trim().replace(/\s+/g," "):t+e.textContent},"")}function qw(n,i,t){var e="http://www.w3.org/ns/ttml#styling",r=null,a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],s=n!=null&&n.hasAttribute("style")?n.getAttribute("style"):null;return s&&t.hasOwnProperty(s)&&(r=t[s]),a.reduce(function(o,l){var u=jc(i,e,l)||jc(n,e,l)||jc(r,e,l);return u&&(o[l]=u),o},{})}function jc(n,i,t){return n&&n.hasAttributeNS(i,t)?n.getAttributeNS(i,t):null}function L_(n){return new Error("Could not parse ttml timestamp ".concat(n))}function Hc(n,i){if(!n)return null;var t=aE(n);return t===null&&(lE.test(n)?t=Yw(n,i):uE.test(n)&&(t=zw(n,i))),t}function Yw(n,i){var t=lE.exec(n),e=(t[4]|0)+(t[5]|0)/i.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+e/i.frameRate}function zw(n,i){var t=uE.exec(n),e=Number(t[1]),r=t[2];switch(r){case"h":return e*3600;case"m":return e*60;case"ms":return e*1e3;case"f":return e/i.frameRate;case"t":return e/i.tickRate}return e}function fE(n){return n.characteristics&&/transcribes-spoken-dialog/gi.test(n.characteristics)&&/describes-music-and-sound/gi.test(n.characteristics)?"captions":"subtitles"}function R_(n,i){return!!n&&n.kind===fE(i)&&nf(i,n)}function Xw(n,i,t,e){return Math.min(i,e)-Math.max(n,t)}function O_(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}function Zw(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(n){}return!1}function tx(n,i){var t={method:"GET",mode:"cors",credentials:"same-origin",signal:i,headers:new self.Headers(nt({},n.headers))};return n.rangeEnd&&t.headers.set("Range","bytes="+n.rangeStart+"-"+String(n.rangeEnd-1)),t}function rx(n){var i=ex.exec(n);if(i)return parseInt(i[2])-parseInt(i[1])+1}function ix(n){var i=n.get("Content-Range");if(i){var t=rx(i);if(ce(t))return t}var e=n.get("Content-Length");if(e)return parseInt(e)}
1function nx(n,i){return new self.Request(n.url,i)}function ux(){return{cueHandler:$w,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function cx(n,i,t){if((i.liveSyncDurationCount||i.liveMaxLatencyDurationCount)&&(i.liveSyncDuration||i.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(i.liveMaxLatencyDurationCount!==void 0&&(i.liveSyncDurationCount===void 0||i.liveMaxLatencyDurationCount<=i.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(i.liveMaxLatencyDuration!==void 0&&(i.liveSyncDuration===void 0||i.liveMaxLatencyDuration<=i.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');var e=uf(n),r=["manifest","level","frag"],a=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return r.forEach(function(s){var o="".concat(s==="level"?"playlist":s,"LoadPolicy"),l=i[o]===void 0,u=[];a.forEach(function(c){var f="".concat(s,"Loading").concat(c),d=i[f];if(d!==void 0&&l){u.push(f);var h=e[o].default;switch(i[o]={default:h},c){case"TimeOut":h.maxLoadTimeMs=d,h.maxTimeToFirstByteMs=d;break;case"MaxRetry":h.errorRetry.maxNumRetry=d,h.timeoutRetry.maxNumRetry=d;break;case"RetryDelay":h.errorRetry.retryDelayMs=d,h.timeoutRetry.retryDelayMs=d;break;case"MaxRetryTimeout":h.errorRetry.maxRetryDelayMs=d,h.timeoutRetry.maxRetryDelayMs=d;break}}}),u.length&&t.warn('hls.js config: "'.concat(u.join('", "'),'" setting(s) are deprecated, use "').concat(o,'": ').concat(st(i[o])))}),et(et({},e),i)}function uf(n){return n&&pe(n)==="object"?Array.isArray(n)?n.map(uf):Object.keys(n).reduce(function(i,t){return i[t]=uf(n[t]),i},{}):n}function fx(n,i){var t=n.loader;if(t!==w_&&t!==dE)i.log("[config]: Custom loader detected, cannot enable progressive streaming"),n.progressive=!1;else{var e=Zw();e&&(n.loader=w_,n.progressive=!0,n.enableSoftwareAES=!0,i.log("[config]: Progressive streaming enabled, using FetchLoader"))}}function x_(n,i){var t=P_(n.main);if(t&&t.start<=i)return t;var e=P_(n.audio);return e&&e.start<=i?e:null}function P_(n){if(!n)return null;switch(n.state){case re.IDLE:case re.STOPPED:case re.ENDED:case re.ERROR:return null}return n.frag}function To(n,i){return i.getAppendedFrag(n,fe.MAIN)||i.getPartialFragment(n)}function cf(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function Vc(n,i,t,e,r){var a=new n(i,t,"");try{a.value=e,r&&(a.type=r)}catch(s){a=new n(i,t,st(r?et({type:r},e):e))}return a}function D_(n){var i={};n.forEach(function(t){var e=t.groupId||"";t.id=i[e]=i[e]||0,i[e]++})}function hE(){return self.SourceBuffer||self.WebKitSourceBuffer}function vE(){var n=qi();if(!n)return!1;var i=hE();return!i||i.prototype&&typeof i.prototype.appendBuffer=="function"&&typeof i.prototype.remove=="function"}function Ex(){if(!vE())return!1;var n=qi();return typeof(n==null?void 0:n.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(function(i){return n.isTypeSupported(Qa(i,"video"))})||["mp4a.40.2","fLaC"].some(function(i){return n.isTypeSupported(Qa(i,"audio"))}))}function Sx(){var n,i=hE();return typeof(i==null||(n=i.prototype)==null?void 0:n.changeType)=="function"}function Kc(n){if(n.keyFormat!==rr.FAIRPLAY){var i=n.keyId;if(i)return tr(i)}return n.uri}function M_(n){var i=n.type;switch(i){case Be.AUDIO_TRACK:return fe.AUDIO;case Be.SUBTITLE_TRACK:return fe.SUBTITLE;default:return fe.MAIN}}function Wc(n,i){var t=n.url;return(t===void 0||t.indexOf("data:")===0)&&(t=i.url),t}var ce,EC,SC,ge,K,S,Be,fe,Xn,TC,Hr,Wi,IC,Yc,tt,Tc,Sy,ff,df,at,B_,bc,xC,Ty,DC,j_,z_,oa,Ac,XC,eL,tL,J_,Jc,Do,Ao,Ry,$a,fL,st,gL,e0,Wt,Cr,TL,jt,bL,Yi,kL,IL,CL,RL,gf,Fy,OL,ki,n0,yf,Gy,Fe,a0,PL,Vy,Lt,DL,s0,FL,UL,Bo,gt,rr,u0,$n,Go,qy,Yy,WL,Cc,qL,qa,rR,re,Sf,E0,Rc,s_,aR,Tf,Za,la,vo,IR,Rr,If,LR,po,RR,OR,wR,xR,DR,P0,MR,NR,FR,UR,BR,M0,za,GR,jR,Kt,HR,WR,Vi,ir,N0,zR,JR,XR,QR,ea,xc,Co,ZR,Ai,Lo,f_,Pc,rO,iO,d_,B0,h_,nO,Rf,aO,sO,v_,j0,oO,lO,cO,fO,_r,dO,hO,yn,vO,H0,m_,gO,EO,TO,AO,CO,LO,wO,xO,si,kt,hn,Ki,MO,NO,Y0,Ro,HO,go,VO,KO,z0,J0,wf,WO,qO,X0,JO,QO,ZO,rw,y_,ow,lw,uw,Z0,Ir,fw,vw,sa,Vo,gw,_w,S_,Ew,Sw,Tw,b_,bw,kw,Aw,iE,Xr,bi,Iw,Cw,Lw,Rw,Ow,ww,vn,nE,xw,Pw,Fc,k_,A_,xf,Nw,Fw,lf,Eo,Bw,Gw,Uc,jw,Hw,Bc,lE,uE,Kw,So,Jw,Qw,$w,ex,w_,ax,sx,dE,ox,lx,wo,dx,hx,vx,px,mx,bo,gx,yx,_x,Tx,bx,kx,Ax,zi,pE=W(function(){T();tn();Pr();rn();Ms();Dr();ue();oe();le();Ge();vt();J();X();ce=Number.isFinite||function(n){return typeof n=="number"&&isFinite(n)},EC=Number.isSafeInteger||function(n){return typeof n=="number"&&Math.abs(n)<=SC},SC=Number.MAX_SAFE_INTEGER||9007199254740991,ge=function(n){return n.NETWORK_E
1RROR="networkError",n.MEDIA_ERROR="mediaError",n.KEY_SYSTEM_ERROR="keySystemError",n.MUX_ERROR="muxError",n.OTHER_ERROR="otherError",n}({}),K=function(n){return n.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",n.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",n.KEY_SYSTEM_NO_SESSION="keySystemNoSession",n.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",n.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",n.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",n.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",n.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",n.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",n.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",n.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",n.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",n.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",n.MANIFEST_LOAD_ERROR="manifestLoadError",n.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",n.MANIFEST_PARSING_ERROR="manifestParsingError",n.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",n.LEVEL_EMPTY_ERROR="levelEmptyError",n.LEVEL_LOAD_ERROR="levelLoadError",n.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",n.LEVEL_PARSING_ERROR="levelParsingError",n.LEVEL_SWITCH_ERROR="levelSwitchError",n.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",n.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",n.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",n.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",n.FRAG_LOAD_ERROR="fragLoadError",n.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",n.FRAG_DECRYPT_ERROR="fragDecryptError",n.FRAG_PARSING_ERROR="fragParsingError",n.FRAG_GAP="fragGap",n.REMUX_ALLOC_ERROR="remuxAllocError",n.KEY_LOAD_ERROR="keyLoadError",n.KEY_LOAD_TIMEOUT="keyLoadTimeOut",n.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",n.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",n.BUFFER_APPEND_ERROR="bufferAppendError",n.BUFFER_APPENDING_ERROR="bufferAppendingError",n.BUFFER_STALLED_ERROR="bufferStalledError",n.BUFFER_FULL_ERROR="bufferFullError",n.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",n.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",n.ASSET_LIST_LOAD_ERROR="assetListLoadError",n.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",n.ASSET_LIST_PARSING_ERROR="assetListParsingError",n.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",n.INTERNAL_EXCEPTION="internalException",n.INTERNAL_ABORTED="aborted",n.ATTACH_MEDIA_ERROR="attachMediaError",n.UNKNOWN="unknown",n}({}),S=function(n){return n.MEDIA_ATTACHING="hlsMediaAttaching",n.MEDIA_ATTACHED="hlsMediaAttached",n.MEDIA_DETACHING="hlsMediaDetaching",n.MEDIA_DETACHED="hlsMediaDetached",n.MEDIA_ENDED="hlsMediaEnded",n.STALL_RESOLVED="hlsStallResolved",n.BUFFER_RESET="hlsBufferReset",n.BUFFER_CODECS="hlsBufferCodecs",n.BUFFER_CREATED="hlsBufferCreated",n.BUFFER_APPENDING="hlsBufferAppending",n.BUFFER_APPENDED="hlsBufferAppended",n.BUFFER_EOS="hlsBufferEos",n.BUFFERED_TO_END="hlsBufferedToEnd",n.BUFFER_FLUSHING="hlsBufferFlushing",n.BUFFER_FLUSHED="hlsBufferFlushed",n.MANIFEST_LOADING="hlsManifestLoading",n.MANIFEST_LOADED="hlsManifestLoaded",n.MANIFEST_PARSED="hlsManifestParsed",n.LEVEL_SWITCHING="hlsLevelSwitching",n.LEVEL_SWITCHED="hlsLevelSwitched",n.LEVEL_LOADING="hlsLevelLoading",n.LEVEL_LOADED="hlsLevelLoaded",n.LEVEL_UPDATED="hlsLevelUpdated",n.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",n.LEVELS_UPDATED="hlsLevelsUpdated",n.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",n.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",n.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",n.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",n.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",n.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",n.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",n.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",n.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",n.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",n.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",n.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",n.SUBTITLE_FRAG_PROCESSED="hl
1sSubtitleFragProcessed",n.CUES_PARSED="hlsCuesParsed",n.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",n.INIT_PTS_FOUND="hlsInitPtsFound",n.FRAG_LOADING="hlsFragLoading",n.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",n.FRAG_LOADED="hlsFragLoaded",n.FRAG_DECRYPTED="hlsFragDecrypted",n.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",n.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",n.FRAG_PARSING_METADATA="hlsFragParsingMetadata",n.FRAG_PARSED="hlsFragParsed",n.FRAG_BUFFERED="hlsFragBuffered",n.FRAG_CHANGED="hlsFragChanged",n.FPS_DROP="hlsFpsDrop",n.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",n.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",n.ERROR="hlsError",n.DESTROYING="hlsDestroying",n.KEY_LOADING="hlsKeyLoading",n.KEY_LOADED="hlsKeyLoaded",n.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",n.BACK_BUFFER_REACHED="hlsBackBufferReached",n.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",n.ASSET_LIST_LOADING="hlsAssetListLoading",n.ASSET_LIST_LOADED="hlsAssetListLoaded",n.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",n.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",n.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",n.INTERSTITIAL_STARTED="hlsInterstitialStarted",n.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",n.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",n.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",n.INTERSTITIAL_ENDED="hlsInterstitialEnded",n.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",n.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",n.EVENT_CUE_ENTER="hlsEventCueEnter",n}({}),Be={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},fe={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"},Xn=function(){function n(i){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;k(this,n),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=i,this.alpha_=i?Math.exp(Math.log(.5)/i):0,this.estimate_=t,this.totalWeight_=e}return A(n,[{key:"sample",value:function(t,e){var r=Math.pow(this.alpha_,t);this.estimate_=e*(1-r)+r*this.estimate_,this.totalWeight_+=t}},{key:"getTotalWeight",value:function(){return this.totalWeight_}},{key:"getEstimate",value:function(){if(this.alpha_){var t=1-Math.pow(this.alpha_,this.totalWeight_);if(t)return this.estimate_/t}return this.estimate_}}]),n}(),TC=function(){function n(i,t,e){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:100;k(this,n),this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=e,this.minWeight_=.001,this.minDelayMs_=50,this.slow_
1=new Xn(i),this.fast_=new Xn(t),this.defaultTTFB_=r,this.ttfb_=new Xn(i)}return A(n,[{key:"update",value:function(t,e){var r=this.slow_,a=this.fast_,s=this.ttfb_;r.halfLife!==t&&(this.slow_=new Xn(t,r.getEstimate(),r.getTotalWeight())),a.halfLife!==e&&(this.fast_=new Xn(e,a.getEstimate(),a.getTotalWeight())),s.halfLife!==t&&(this.ttfb_=new Xn(t,s.getEstimate(),s.getTotalWeight()))}},{key:"sample",value:function(t,e){t=Math.max(t,this.minDelayMs_);var r=8*e,a=t/1e3,s=r/a;this.fast_.sample(a,s),this.slow_.sample(a,s)}},{key:"sampleTTFB",value:function(t){var e=t/1e3,r=Math.sqrt(2)*Math.exp(-Math.pow(e,2)/2);this.ttfb_.sample(r,Math.max(t,5))}},{key:"canEstimate",value:function(){return this.fast_.getTotalWeight()>=this.minWeight_}},{key:"getEstimate",value:function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}},{key:"getEstimateTTFB",value:function(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}},{key:"defaultEstimate",get:function(){return this.defaultEstimate_}},{key:"destroy",value:function(){}}]),n}();Hr=A(function n(i,t){k(this,n),this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;var e="[".concat(i,"]:");this.trace=Wi,this.debug=t.debug.bind(null,e),this.log=t.log.bind(null,e),this.warn=t.warn.bind(null,e),this.info=t.info.bind(null,e),this.error=t.error.bind(null,e)}),Wi=function(){},IC={trace:Wi,debug:Wi,log:Wi,warn:Wi,info:Wi,error:Wi};Yc=qc();tt=Yc;Tc={exports:{}};ff=wC(),df=A(function n(){k(this,n),this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}),at={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"},B_=function(){function n(i){k(this,n),this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof i=="string"&&(i={url:i}),this.base=i,PC(this,"stats")}return A(n,[{key:"setByteRange",value:function(t,e){var r=t.split("@",2),a;r.length===1?a=(e==null?void 0:e.byteRangeEndOffset)||0:a=parseInt(r[1]),this._byteRange=[a,parseInt(r[0])+a]}},{key:"baseurl",get:function(){return this.base.url}},{key:"byteRange",get:function(){return this._byteRange===null?[]:this._byteRange}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"elementaryStreams",get:function(){return this._streams===null&&(this._streams=V(V(V({},at.AUDIO,null),at.VIDEO,null),at.AUDIOVIDEO,null)),this._streams},set:function(t){this._streams=t}},{key:"hasStats",get:function(){return this._stats!==null}},{key:"hasStreams",get:function(){return this._streams!==null}},{key:"stats",get:function(){return this._stats===null&&(this._stats=new df),this._stats},set:function(t){this._stats=t}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=ff.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(t){this._url=t}},{key:"clearElementaryStreamInfo",value:function(){var t=this.elementaryStreams;t[at.AUDIO]=null,t[at.VIDEO]=null,t[at.AUDIOVIDEO]=null}}]),n}();bc=function(n){B(i,n);function i(t,e){var r;return k(this,i),r=Xe(this,i,[e]),r._decryptdata=null,r._programDateTime=null,r._ref=null,r._bitrate=void 0,r.rawProgramDateTime=null,r.tagList=[],r.duration=0,r.sn=0,r.levelkeys=void 0,r.type=void 0,r.loader=null,r.keyLoader=null,r.level=-1,r.cc=0,r.startPTS=void 0,r.endPTS=void 0,r.startDTS=void 0,r.endDTS=void 0,r.start=0,r.playlistOffset=0,r.deltaPTS=void 0,r.maxStartPTS=void 0,r.minEndPTS=void 0,r.data=void 0,r.bitrateTest=!1,r.title=null,r.initSegment=null,r.endList=void 0,r.gap=void 0,r.urlId=0,r.type=t,r}return A(i,[{key:"byteLength",get:function(){if(this.hasStats){var e=this.stats.total;if(e)return e}if(this.byteRange.length){var r=this.byteRange[0],a=this.byteRange[1];if(ce(r)&&ce(a))return a-r}return null}},{key:"bitrate",get:function(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null},set:function(e){this._bitrate=e}},{key:"decryptdata",get:function(){var e,r=this.levelkeys;if(!r||r.NONE)return null;if(r.identity)this._decryptdata||(this._decryptdata=r.identity.getDecryptData(this.sn));else if(!((e=this._decryptdata)!=null&&e.keyId)){var a=Object.keys(r);if(a.length===1){var s=this._decryptdata=r[a[0]]||null;s&&(this._decryptdata=s.getDecryptData(this.sn,r))}}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;var e=ce(this.duration)?this.duration:0;return this.programDateTime+e*1e3}},{key:"encrypted",get:function(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;
1if(this.levelkeys){var r,a=Object.keys(this.levelkeys),s=a.length;if(s>1||s===1&&(r=this.levelkeys[a[0]])!=null&&r.encrypted)return!0}return!1}},{key:"programDateTime",get:function(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime},set:function(e){if(!ce(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}},{key:"ref",get:function(){return Rt(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}},{key:"addStart",value:function(e){this.setStart(this.start+e)}},{key:"setStart",value:function(e){this.start=e,this._ref&&(this._ref.start=e)}},{key:"setDuration",value:function(e){this.duration=e,this._ref&&(this._ref.duration=e)}},{key:"setKeyFormat",value:function(e){var r=this.levelkeys;if(r){var a,s=r[e];s&&!((a=this._decryptdata)!=null&&a.keyId)&&(this._decryptdata=s.getDecryptData(this.sn,r))}}},{key:"abortRequests",value:function(){var e,r;(e=this.loader)==null||e.abort(),(r=this.keyLoader)==null||r.abort()}},{key:"setElementaryStreamInfo",value:function(e,r,a,s,o){var l=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1,u=this.elementaryStreams,c=u[e];if(!c){u[e]={startPTS:r,endPTS:a,startDTS:s,endDTS:o,partial:l};return}c.startPTS=Math.min(c.startPTS,r),c.endPTS=Math.max(c.endPTS,a),c.startDTS=Math.min(c.startDTS,s),c.endDTS=Math.max(c.endDTS,o)}}]),i}(B_),xC=function(n){B(i,n);function i(t,e,r,a,s){var o;k(this,i),o=Xe(this,i,[r]),o.fragOffset=0,o.duration=0,o.gap=!1,o.independent=!1,o.relurl=void 0,o.fragment=void 0,o.index=void 0,o.duration=t.decimalFloatingPoint("DURATION"),o.gap=t.bool("GAP"),o.independent=t.bool("INDEPENDENT"),o.relurl=t.enumeratedString("URI"),o.fragment=e,o.index=a;var l=t.enumeratedString("BYTERANGE");return l&&o.setByteRange(l,s),s&&(o.fragOffset=s.fragOffset+s.duration),o}return A(i,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var e=this.elementaryStreams;return!!(e.audio||e.video||e.audiovideo)}}]),i}(B_);Ty=Math.pow(2,32)-1,DC=[].push,j_={video:1,audio:2,id3:3,text:4};z_=function(){return/\(Windows.+Firefox\//i.test(navigator.userAgent)},oa={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};Ac={};XC=/flac|opus|mp4a\.40\.34/i;eL={supported:!0,powerEfficient:!0,smooth:!0},tL={supported:!1,smooth:!1,powerEfficient:!1},J_={supported:!0,configurations:[],decodingInfoResults:[eL]};Jc=["NONE","TYPE-0","TYPE-1",null];Do=["SDR","PQ","HLG"];Ao={No:"",Yes:"YES",v2:"v2"};Ry=function(){function n(i,t,e){k(this,n),this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=i,this.part=t,this.skip=e}return A(n,[{key:"addDirectives",value:function(t){var e=new self.URL(t);return this.msn!==void 0&&e.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&e.searchParams.set("_HLS_part",this.part.toString()),this.skip&&e.searchParams.set("_HLS_skip",this.skip),e.href}}]),n}(),$a=function(){function n(i){if(k(this,n),this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[i.url],this._attrs=[i.attrs],this.bitrate=i.bitrate,i.details&&(this.details=i.details),this.id=i.id||0,this.name=i.name,this.width=i.width||0,this.height=i.height||0,this.frameRate=i.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=i.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=i.audioCodec,this.videoCodec=i.videoCodec,this.codecSet=[i.videoCodec,i.audioCodec].filter(function(r){return!!r}).map(function(r){return r.substring(0,4)}).join(","),"supplemental"in i){var t;this.supplemental=i.supplemental;var e=(t=i.supplemental)==null?void 0:t.videoCodec;e&&e!==i.videoCodec&&(this.codecSet+=",".concat(e.substring(0,4)))}this.addGroupId("audio",i.attrs.AUDIO),this.addGroupId("text",i.attrs.SUBTITLES)}return A(n,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"averageBitrate",get:function(){return this._avgBitrate||this.realBitrate||this.bitrate}},{key:"attrs",get:function(){return this._attrs[0]}},{key:"codecs",get:function(){return this.attrs.CODECS||""}},{key:"pathwayId",get:function(){return this.attrs["PATHWAY-ID"]||"."}},{key:"videoRange",get:function(){return this.attrs["VIDEO-RANGE"]||"SDR"}},{key:"score",get:function(){return this.attrs.optionalFloat("SCORE",0)}},{key:"uri",get:function(){return this.url[0]||""}},{key:"hasAudioGroup",value:function(t){return Oy(this._audioGroups,t)}},{key:"hasSubtitleGroup",value:function(t){return Oy(this._subtitleGroups,t)}},{key:"audioGroups",get:function(){return this._audioGroups}},{key:"subtitleGroups",get:function(){return this._subtitleGroups}},{key:"addGroupId",value:function(t,e){if(e){if(t==="audio"){var r=this._audioGroups;r||(r=this._audioGroups=[]),r.indexOf(e)===-1&&r.push(e)}else if(t==="text"){var a=this._subtitleGroups;a||(a=this._subtitleGroups=[]),a.indexOf(e)===-1&&a.push(e)}}}},{key:"urlId",get:function(){return 0},set:function(t){}}
1,{key:"audioGroupIds",get:function(){return this.audioGroups?[this.audioGroupId]:void 0}},{key:"textGroupIds",get:function(){return this.subtitleGroups?[this.textGroupId]:void 0}},{key:"audioGroupId",get:function(){var t;return(t=this.audioGroups)==null?void 0:t[0]}},{key:"textGroupId",get:function(){var t;return(t=this.subtitleGroups)==null?void 0:t[0]}},{key:"addFallback",value:function(){}}]),n}();fL=function(i){var t=new WeakSet;return function(e,r){if(i&&(r=i(e,r)),pe(r)==="object"&&r!==null){if(t.has(r))return;t.add(r)}return r}},st=function(i,t){return JSON.stringify(i,fL(t))};gL=function(n){B(i,n);function i(t){var e;return k(this,i),e=Xe(this,i,["abr",t.logger]),e.hls=void 0,e.lastLevelLoadSec=0,e.lastLoadedFragLevel=-1,e.firstSelection=-1,e._nextAutoLevel=-1,e.nextAutoLevelKey="",e.audioTracksByGroup=null,e.codecTiers=null,e.timer=-1,e.fragCurrent=null,e.partCurrent=null,e.bitrateTestDelay=0,e.rebufferNotice=-1,e.supportedCache={},e.bwEstimator=void 0,e._abandonRulesCheck=function(r){var a,s=qe(e),o=s.fragCurrent,l=s.partCurrent,u=s.hls,c=u.autoLevelEnabled,f=u.media;if(!(!o||!f)){var d=performance.now(),h=l?l.stats:o.stats,v=l?l.duration:o.duration,m=d-h.loading.start,p=u.minAutoLevel,g=o.level,E=e._nextAutoLevel;if(h.aborted||h.loaded&&h.loaded===h.total||g<=p){e.clearTimer(),e._nextAutoLevel=-1;return}if(c){var y=E>-1&&E!==g,_=!!r||y;if(!(!_&&(f.paused||!f.playbackRate||!f.readyState))){var b=u.mainForwardBufferInfo;if(!(!_&&b===null)){var C=e.bwEstimator.getEstimateTTFB(),R=Math.abs(f.playbackRate);if(!(m<=Math.max(C,1e3*(v/(R*2))))){var M=b?b.len/R:0,D=h.loading.first?h.loading.first-h.loading.start:-1,L=h.loaded&&D>-1,O=e.getBwEstimate(),x=u.levels,Y=x[g],$=Math.max(h.loaded,Math.round(v*(o.bitrate||Y.averageBitrate)/8)),Z=L?m-D:m;Z<1&&L&&(Z=Math.min(m,h.loaded*8/O));var N=L?h.loaded*1e3/Z:0,j=C/1e3,z=N?($-h.loaded)/N:$*8/O+j;if(!(z<=M)){var ee=N?N*8:O,U=((a=(r==null?void 0:r.details)||e.hls.latestLevelDetails)==null?void 0:a.live)===!0,F=e.hls.config.abrBandWidthUpFactor,H=Number.POSITIVE_INFINITY,G;for(G=g-1;G>p;G--){var ve=x[G].maxBitrate,ye=!x[G].details||U;if(H=e.getTimeToLoadFrag(j,ee,v*ve,ye),H<Math.min(M,v+j))break}if(!(H>=z)&&!(H>v*10)){L?e.bwEstimator.sample(m-Math.min(C,D),h.loaded):e.bwEstimator.sampleTTFB(m);var Ee=x[G].maxBitrate;e.getBwEstimate()*F>Ee&&e.resetEstimator(Ee);var Ce=e.findBestLevel(Ee,p,G,0,M,1,1);Ce>-1&&(G=Ce),e.warn("Fragment ".concat(o.sn).concat(l?" part "+l.index:""," of level ").concat(g," is loading too slowly;\n Fragment duration: ").concat(o.duration.toFixed(3),"\n Time to underbuffer: ").concat(M.toFixed(3)," s\n Estimated load time for current fragment: ").concat(z.toFixed(3)," s\n Estimated load time for down switch fragment: ").concat(H.toFixed(3)," s\n TTFB estimate: ").concat(D|0," ms\n Current BW estimate: ").concat(ce(O)?O|0:"Unknown"," bps\n New BW estimate: ").concat(e.getBwEstimate()|0," bps\n Switching to level ").concat(G," @ ").concat(Ee|0," bps")),u.nextLoadLevel=u.nextAutoLevel=G,e.clearTimer();var Ye=function(){if(e.clearTimer(),e.fragCurrent===o&&e.hls.loadLevel===G&&G>0){var Ue=e.getStarvationDelay();if(e.warn("Aborting inflight request ".concat(G>0?"and switching down":"","\n Fragment duration: ").concat(o.duration.toFixed(3)," s\n Time to underbuffer: ").concat(Ue.toFixed(3)," s")),o.abortRequests(),e.fragCurrent=e.partCurrent=null,G>p){var yt=e.findBestLevel(e.hls.levels[p].bitrate,p,G,0,Ue,1,1);yt===-1&&(yt=p),e.hls.nextLoadLevel=e.hls.nextAutoLevel=yt,e.resetEstimator(e.hls.levels[yt].bitrate)}}};y||z>H*2?Ye():e.timer=self.setInterval(Ye,H*1e3),u.trigger(S.FRAG_LOAD_EMERGENCY_ABORTED,{frag:o,part:l,stats:h})}}}}}}}},e.hls=t,e.bwEstimator=e.initEstimator(),e.registerListeners(),e}return A(i,[{key:"resetEstimator",value:function(e){e&&(this.log("setting initial bwe to ".concat(e)),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}},{key:"initEstimator",value:function(){var e=this.hls.config;return new TC(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}},{key:"registerListeners",value:function(){var e=this.hls;e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.FRAG_LOADING,this.onFragLoading,this),e.on(S.FRAG_LOADED,this.onFragLoaded,this),e.on(S.FRAG_BUFFERED,this.onFragBuffered,this),e.on(S.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(S.LEVEL_LOADED,this.onLevelLoaded,this),e.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(S.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(S.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.FRAG_LOADING,this.onFragLoading,this),e.off(S.FRAG_LOADED,this.onFragLoaded,this),e.off(S.FRAG_BUFFERED,this.onFragBuffered,this),e.off(S.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(S.LEVEL_LOADED,this.onLevelLoaded,this),e.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(S.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(S.ERROR,this.onError,this))}},{key:"destroy",value:function(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}},{key:"onManifestLoading",value:function(e,r){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}},{key:"onLevelsUpdated",value:function(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}},{key:"onMaxAutoLevelUpdated",value:function(){this.firstSelection=-1,this.nextAutoLevelKey=""}},{key:"onFragLoading",value:function(e,r){var a=r.frag;if(!this.ignoreFragment(a)){if(!a.bitrateTest){var s;this.fragCurrent=a,this.partCurrent=(s=r.part)!=null?s:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}},{key:"onLevelSwitching",value:function(e,r){this.clearTimer()}},{key:"onError",value:function(e,r){if(!r.fatal)switch(r.details){case K.BUFFER_ADD_CODEC_ERROR:case K.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case K.FRAG_LOAD_TIMEOUT:{var a=r.frag,s=this.fragCurrent,o=this.partCurrent;if(a&&s&&a.sn===s.sn&&a.level===s.level){var l=performance.now(),u=o?o.stats:a.stats,c=l-u.loading.start,f=u.loading.first?u.loading.first-u.loading.start:-1,d=u.loaded&&f>-1;if(d){var h=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(c-Math.min(h,f),u.loaded)}else this.bwEstimator.sampleTTFB(c)}break}}}},{key:"getTimeToLoadFrag",value:function(e,r,a,s){var o=e+a/r,l=s?e+this.lastLevelLoadSec:0;return o+l}},{key:"onLevelLoaded",value:function(e,r){var a=this.hls.config,s=r.stats.loading,o=s.end-s.first;ce(o)&&(this.lastLevelLoadSec=o/1e3),r.details.live?this.bwEstimator.update(a.abrEwmaSlowLive,a.abrEwmaFastLive):this.bwEstimator.update(a.abrEwmaSlowVoD,a.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(r.levelInfo)}},{key:"onFragLoaded",value:function(e,r){var a=r.frag,s=r.part,o=s?s.stats:a.stats;if(a.type===fe.MAIN&&this.bwEstimator.sampleTTFB(o.loading.first-o.loading.start),!this.ignoreFragment(a)){if(this.clearTimer(),a.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){var l=s?s.duration:a.duration,u=this.hls.levels[a.level],c=(u.loaded?u.loaded.bytes:0)+o.loaded,f=(u.loaded?u.loaded.duration:0)+l;u.loaded={bytes:c,duration:f},u.realBitrate=Math.round(8*c/f)}if(a.bitrateTest){var d={stats:o,frag:a,part:s,id:a.type};this.onFragBuffered(S.FRAG_BUFFERED,d),a.bitrateTest=!1}else this.lastLoadedFragLevel=a.level}}},{key:"onFragBuffered",value:function(e,r){var a=r.frag,s=r.part,o=s!=null&&s.stats.loaded?s.stats:a.stats;if(!o.aborted&&!this.ignoreFragment(a)){var l=o.parsing.end-o.loading.start-Math.min(o.loading.first-o.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(l,o.loaded),o.bwEstimate=this.getBwEstimate(),a.bitrateTest?this.bitrateTestDelay=l/1e3:this.bitrateTestDelay=0}}},{key:"ignoreFragment",value:function(e){return e.type!==fe.MAIN||e.sn==="initSegment"}},{key:"clearTimer",value:function(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}},{key:"firstAutoLevel",get:function(){var e=this.hls,r=e.maxAutoLevel,a=e.minAutoLevel,s=this.getBwEstimate(),o=this.hls.config.maxStarvationDelay,l=this.findBestLevel(s,a,r,0,o,1,1);if(l>-1)return l;var u=this.hls.firstLevel,c=Math.min(Math.max(u,a),r);return this.warn("Could not find best starting auto level. Defaulting to first in playlist ".concat(u," clamped to ").concat(c)),c}},{key:"forcedAutoLevel",get:function(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}},{key:"nextAutoLevel",get:function(){var e=this.forcedAutoLevel,r=this.bwEstimator,a=r.canEstimate(),s=this.lastLoadedFragLevel>-1;if(e!==-1&&(!a||!s||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;var o=a&&s?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){var l=this.hls.levels;if(l.length>Math.max(e,o)&&l[e].loadError<=l[o].loadError)return e}return this._nextAutoLevel=o,this.nextAutoLevelKey=this.getAutoLevelKey(),o},set:function(e){var r=this.deriveNextAutoLevel(e);this._nextAutoLevel!==r&&(this.nextAutoLevelKey="",this._nextAutoLevel=r)}},{key:"getAutoLevelKey",value:function(){return"".concat(this.getBwEstimate(),"_").concat(this.getStarvationDelay().toFixed(2))}},{key:"getNextABRAutoLevel",value:function(){var e=this.fragCurrent,r=this.partCurrent,a=this.hls;if(a.levels.length<=1)return a.loadLevel;var s=a.maxAutoLevel,o=a.config,l=a.minAutoLevel,u=r?r.duration:e?e.duration:0,
1c=this.getBwEstimate(),f=this.getStarvationDelay(),d=o.abrBandWidthFactor,h=o.abrBandWidthUpFactor;if(f){var v=this.findBestLevel(c,l,s,f,0,d,h);if(v>=0)return this.rebufferNotice=-1,v}var m=u?Math.min(u,o.maxStarvationDelay):o.maxStarvationDelay;if(!f){var p=this.bitrateTestDelay;if(p){var g=u?Math.min(u,o.maxLoadingDelay):o.maxLoadingDelay;m=g-p,this.info("bitrate test took ".concat(Math.round(1e3*p),"ms, set first fragment max fetchDuration to ").concat(Math.round(1e3*m)," ms")),d=h=1}}var E=this.findBestLevel(c,l,s,f,m,d,h);if(this.rebufferNotice!==E&&(this.rebufferNotice=E,this.info("".concat(f?"rebuffering expected":"buffer is empty",", optimal quality level ").concat(E))),E>-1)return E;var y=a.levels[l],_=a.loadLevelObj;return _&&(y==null?void 0:y.bitrate)<_.bitrate?l:a.loadLevel}},{key:"getStarvationDelay",value:function(){var e=this.hls,r=e.media;if(!r)return 1/0;var a=r&&r.playbackRate!==0?Math.abs(r.playbackRate):1,s=e.mainForwardBufferInfo;return(s?s.len:0)/a}},{key:"getBwEstimate",value:function(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}},{key:"findBestLevel",value:function(e,r,a,s,o,l,u){var c=this,f,d=s+o,h=this.lastLoadedFragLevel,v=h===-1?this.hls.firstLevel:h,m=this.fragCurrent,p=this.partCurrent,g=this.hls,E=g.levels,y=g.allAudioTracks,_=g.loadLevel,b=g.config;if(E.length===1)return 0;var C=E[v],R=!!((f=this.hls.latestLevelDetails)!=null&&f.live),M=_===-1||h===-1,D,L="SDR",O=(C==null?void 0:C.frameRate)||0,x=b.audioPreference,Y=b.videoPreference,$=this.audioTracksByGroup||(this.audioTracksByGroup=Z_(y)),Z=-1;if(M){if(this.firstSelection!==-1)return this.firstSelection;var N=this.codecTiers||(this.codecTiers=hL(E,$,r,a)),j=dL(N,L,e,x,Y),z=j.codecSet,ee=j.videoRanges,U=j.minFramerate,F=j.minBitrate,H=j.minIndex,G=j.preferHDR;Z=H,D=z,L=G?ee[ee.length-1]:ee[0],O=U,e=Math.max(e,F),this.log("picked start tier ".concat(st(j)))}else D=C==null?void 0:C.codecSet,L=C==null?void 0:C.videoRange;for(var ve=p?p.duration:m?m.duration:0,ye=this.bwEstimator.getEstimateTTFB()/1e3,Ee=[],Ce=function(){var Le=E[Ue],_t=Ue>v;if(!Le)return 0;if(b.useMediaCapabilities&&!Le.supportedResult&&!Le.supportedPromise){var wt=navigator.mediaCapabilities;typeof(wt==null?void 0:wt.decodingInfo)=="function"&&rL(Le,$,L,O,e,x)?(Le.supportedPromise=Q_(Le,$,wt,c.supportedCache),Le.supportedPromise.then(function(Pt){if(c.hls){Le.supportedResult=Pt;var Ji=c.hls.levels,Tr=Ji.indexOf(Le);Pt.error?c.warn('MediaCapabilities decodingInfo error: "'.concat(Pt.error,'" for level ').concat(Tr," ").concat(st(Pt))):Pt.supported?Pt.decodingInfoResults.some(function(Xi){return Xi.smooth===!1||Xi.powerEfficient===!1})&&c.log("MediaCapabilities decodingInfo for level ".concat(Tr," not smooth or powerEfficient: ").concat(st(Pt))):(c.warn("Unsupported MediaCapabilities decodingInfo result for level ".concat(Tr," ").concat(st(Pt))),Tr>-1&&Ji.length>1&&(c.log("Removing unsupported level ".concat(Tr)),c.hls.removeLevel(Tr),c.hls.loadLevel===-1&&(c.hls.nextLoadLevel=0)))}}).catch(function(Pt){c.warn("Error handling MediaCapabilities decodingInfo: ".concat(Pt))})):Le.supportedResult=J_}if((D&&Le.codecSet!==D||L&&Le.videoRange!==L||_t&&O>Le.frameRate||!_t&&O>0&&O<Le.frameRate||(Ye=Le.supportedResult)!=null&&(Ye=Ye.decodingInfoResults)!=null&&Ye.some(function(Pt){return Pt.smooth===!1}))&&(!M||Ue!==Z))return Ee.push(Ue),0;var xt=Le.details,qt=(p?xt==null?void 0:xt.partTarget:xt==null?void 0:xt.averagetargetduration)||ve,lt;_t?lt=u*e:lt=l*e;var Sr=ve&&s>=ve*2&&o===0?Le.averageBitrate:Le.maxBitrate,cr=c.getTimeToLoadFrag(ye,lt,Sr*qt,xt===void 0),Nt=lt>=Sr&&(Ue===h||Le.loadError===0&&Le.fragmentError===0)&&(cr<=ye||!ce(cr)||R&&!c.bitrateTestDelay||cr<d);if(Nt){var Ft=c.forcedAutoLevel;return Ue!==_&&(Ft===-1||Ft!==_)&&(Ee.length&&c.trace("Skipped level(s) ".concat(Ee.join(",")," of ").concat(a,' max with CODECS and VIDEO-RANGE:"').concat(E[Ee[0]].codecs,'" ').concat(E[Ee[0]].videoRange,'; not compatible with "').concat(D,'" ').concat(L)),c.info("switch candidate:".concat(v,"->").concat(Ue," adjustedbw(").concat(Math.round(lt),")-bitrate=").concat(Math.round(lt-Sr)," ttfb:").concat(ye.toFixed(1)," avgDuration:").concat(qt.toFixed(1)," maxFetchDuration:").concat(d.toFixed(1)," fetchDuration:").concat(cr.toFixed(1)," firstSelection:").concat(M," codecSet:").concat(Le.codecSet," videoRange:").concat(Le.videoRange," hls.loadLevel:").concat(_))),M&&(c.firstSelection=Ue),{v:Ue}}},Ye,ot,Ue=a;Ue>=r;Ue--)if(ot=Ce(),ot!==0&&ot)return ot.v;return-1}},{key:"deriveNextAutoLevel",value:function(e){var r=this.hls,a=r.maxAutoLevel,s=r.minAutoLevel;return Math.min(Math.max(e,s),a)}}]),i}
1(Hr),e0={search:function(i,t){for(var e=0,r=i.length-1,a=null,s=null;e<=r;){a=(e+r)/2|0,s=i[a];var o=t(s);if(o>0)e=a+1;else if(o<0)r=a-1;else return s}return null}};Wt={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Cr={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4,SwitchToSDR:8},TL=function(n){B(i,n);function i(t){var e;return k(this,i),e=Xe(this,i,["error-controller",t.logger]),e.hls=void 0,e.playlistError=0,e.hls=t,e.registerListeners(),e}return A(i,[{key:"registerListeners",value:function(){var e=this.hls;e.on(S.ERROR,this.onError,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.LEVEL_UPDATED,this.onLevelUpdated,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(e.off(S.ERROR,this.onError,this),e.off(S.ERROR,this.onErrorOut,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.LEVEL_UPDATED,this.onLevelUpdated,this))}},{key:"destroy",value:function(){this.unregisterListeners(),this.hls=null}},{key:"startLoad",value:function(e){}},{key:"stopLoad",value:function(){this.playlistError=0}},{key:"getVariantLevelIndex",value:function(e){return(e==null?void 0:e.type)===fe.MAIN?e.level:this.getVariantIndex()}},{key:"getVariantIndex",value:function(){var e,r=this.hls,a=r.currentLevel;return(e=r.loadLevelObj)!=null&&e.details||a===-1?r.loadLevel:a}},{key:"variantHasKey",value:function(e,r){if(e){var a;if((a=e.details)!=null&&a.hasKey(r))return!0;var s=e.audioGroups;if(s){var o=this.hls.allAudioTracks.filter(function(l){return s.indexOf(l.groupId)>=0});return o.some(function(l){var u;return(u=l.details)==null?void 0:u.hasKey(r)})}}return!1}},{key:"onManifestLoading",value:function(){this.playlistError=0}},{key:"onLevelUpdated",value:function(){this.playlistError=0}},{key:"onError",value:function(e,r){var a;if(!r.fatal){var s=this.hls,o=r.context;switch(r.details){case K.FRAG_LOAD_ERROR:case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_ERROR:case K.KEY_LOAD_TIMEOUT:r.errorAction=this.getFragRetryOrSwitchAction(r);return;case K.FRAG_PARSING_ERROR:if((a=r.frag)!=null&&a.gap){r.errorAction=na();return}case K.FRAG_GAP:case K.FRAG_DECRYPT_ERROR:{r.errorAction=this.getFragRetryOrSwitchAction(r),r.errorAction.action=Wt.SendAlternateToPenaltyBox;return}case K.LEVEL_EMPTY_ERROR:case K.LEVEL_PARSING_ERROR:{var l,u=r.parent===fe.MAIN?r.level:s.loadLevel;r.details===K.LEVEL_EMPTY_ERROR&&((l=r.context)!=null&&(l=l.levelDetails)!=null&&l.live)?r.errorAction=this.getPlaylistRetryOrSwitchAction(r,u):(r.levelRetry=!1,r.errorAction=this.getLevelSwitchAction(r,u))}return;case K.LEVEL_LOAD_ERROR:case K.LEVEL_LOAD_TIMEOUT:typeof(o==null?void 0:o.level)=="number"&&(r.errorAction=this.getPlaylistRetryOrSwitchAction(r,o.level));return;case K.AUDIO_TRACK_LOAD_ERROR:case K.AUDIO_TRACK_LOAD_TIMEOUT:case K.SUBTITLE_LOAD_ERROR:case K.SUBTITLE_TRACK_LOAD_TIMEOUT:if(o){var c=s.loadLevelObj;if(c&&(o.type===Be.AUDIO_TRACK&&c.hasAudioGroup(o.groupId)||o.type===Be.SUBTITLE_TRACK&&c.hasSubtitleGroup(o.groupId))){r.errorAction=this.getPlaylistRetryOrSwitchAction(r,s.loadLevel),r.errorAction.action=Wt.SendAlternateToPenaltyBox,r.errorAction.flags=Cr.MoveAllAlternatesMatchingHost;return}}return;case K.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:r.errorAction={action:Wt.SendAlternateToPenaltyBox,flags:Cr.MoveAllAlternatesMatchingHDCP};return;case K.KEY_SYSTEM_SESSION_UPDATE_FAILED:case K.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case K.KEY_SYSTEM_NO_SESSION:r.errorAction={action:Wt.SendAlternateToPenaltyBox,flags:Cr.MoveAllAlternatesMatchingKey};return;case K.BUFFER_ADD_CODEC_ERROR:case K.REMUX_ALLOC_ERROR:case K.BUFFER_APPEND_ERROR:if(!r.errorAction){var f;r.errorAction=this.getLevelSwitchAction(r,(f=r.level)!=null?f:s.loadLevel)}return;case K.INTERNAL_EXCEPTION:case K.BUFFER_APPENDING_ERROR:case K.BUFFER_FULL_ERROR:case K.LEVEL_SWITCH_ERROR:case K.BUFFER_STALLED_ERROR:case K.BUFFER_SEEK_OVER_HOLE:case K.BUFFER_NUDGE_ON_STALL:r.errorAction=na();return}r.type===ge.KEY_SYSTEM_ERROR&&(r.levelRetry=!1,r.errorAction=na())}}},{key:"getPlaylistRetryOrSwitchAction",value:function(e,r){var a=this.hls,s=Dy(a.config.playlistLoadPolicy,e),o=this.playlistError++,l=Fo(s,o,No(e),e.response);if(l)return{action:Wt.RetryRequest,flags:Cr.None,retryConfig:s,retryCount:o};var u=this.getLevelSwitchAction(e,r);return s&&(u.retryConfig=s,u.retryCount=o),u}},{key:"getFragRetryOrSwitchAction",value:function(e){var r=this.hls,a=this.getVariantLevelIndex(e.frag),s=r.levels[a],o=r.config,l=o.fragLoadPolicy,u=o.keyLoadPolicy,c=Dy(r0(e)?u:l,e),f=r.levels.reduce(function(v,m){return v+m.fragmentError},0);if(s&&(e.details!==K.FRAG_GAP&&s.fragmentError++,!i0(e))){var d=Fo(c,f,No(e),e.response);if(d)return{action:Wt.RetryRequest,flags:Cr.None,retryConfig:c,retryCount:f}}var h=this.getLevelSwitchAction(e,a);return c&&(h.retryConfig=c,h.retryCount=f),h}},{key:"getLevelSwitchAction",value:function(e,r){var a=this.hls;r==null&&(r=a.loadLevel);var s=this.hls.levels[r];if(s){var o,l,u=e.details;s.loadError++,u===K.BUFFER_APPEND_ERROR&&s.fragmentError++;var c=-1,f=a.levels,d=a.loadLevel,h=a.minAutoLevel,v=a.maxAutoLevel;!a.autoLevelEnabled&&!a.config.preserveManualLevelOnError&&(a.loadLevel=-1);for(var m=(o=e.frag)==null?void 0:o.type,p=m===fe.AUDIO&&u===K.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(u===K.BUFFER_ADD_CODEC_ERROR||u===K.BUFFER_APPEND_ERROR),g=p&&f.some(function(x){var Y=x.audioCodec;return s.audioCodec!==Y}),E=e.sourceBufferName==="video"&&(u===K.BUFFER_ADD_CODEC_ERROR||u===K.BUFFER_APPEND_ERROR),y=E&&f.some(function(x){var Y=x.codecSet,$=x.audioCodec;return s.codecSet!==Y&&s.audioCodec===$}),_=(l=e.context)!=null?l:{},b=_.type,C=_.groupId,R=function(){var Y=(O+d)%f.length;if(Y!==d&&Y>=h&&Y<=v&&f[Y].loadError===0){var $=f[Y];if(u===K.FRAG_GAP&&m===fe.MAIN&&e.frag){var Z=f[Y].details;if(Z){var N=gn(e.frag,Z.fragments,e.frag.start);if(N!=null&&N.gap)return 0}}else{if(b===Be.AUDIO_TRACK&&$.hasAudioGroup(C)||b===Be.SUBTITLE_TRACK&&$.hasSubtitleGroup(C))return 0;if(m===fe.AUDIO&&(M=s.audioGroups)!=null&&M.some(function(j){return $.hasAudioGroup(j)})||m===fe.SUBTITLE&&(D=s.subtitleGroups)!=null&&D.some(function(j){return $.hasSubtitleGroup(j)})||g&&s.audioCodec===$.audioCodec||y&&s.codecSet===$.codecSet||!g&&s.codecSet!==$.codecSet)return 0}return c=Y,1}}
1,M,D,L,O=f.length;O--&&(L=R(),!(L!==0&&L===1)););if(c>-1&&a.loadLevel!==c)return e.levelRetry=!0,this.playlistError=0,{action:Wt.SendAlternateToPenaltyBox,flags:Cr.None,nextAutoLevel:c}}return{action:Wt.SendAlternateToPenaltyBox,flags:Cr.MoveAllAlternatesMatchingHost}}},{key:"onErrorOut",value:function(e,r){var a;switch((a=r.errorAction)==null?void 0:a.action){case Wt.DoNothing:break;case Wt.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(r),!r.errorAction.resolved&&r.details!==K.FRAG_GAP?r.fatal=!0:/MediaSource readyState: ended/.test(r.error.message)&&(this.warn('MediaSource ended after "'.concat(r.sourceBufferName,'" sourceBuffer append error. Attempting to recover from media error.')),this.hls.recoverMediaError());break;case Wt.RetryRequest:break}if(r.fatal){this.hls.stopLoad();return}}},{key:"sendAlternateToPenaltyBox",value:function(e){var r=this.hls,a=e.errorAction;if(a){var s=a.flags,o=a.nextAutoLevel;switch(s){case Cr.None:this.switchLevel(e,o);break;case Cr.MoveAllAlternatesMatchingHDCP:{var l=this.getVariantLevelIndex(e.frag),u=r.levels[l],c=u==null?void 0:u.attrs["HDCP-LEVEL"];if(a.hdcpLevel=c,c==="NONE")this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(c){r.maxHdcpLevel=Jc[Jc.indexOf(c)-1],a.resolved=!0,this.warn('Restricting playback to HDCP-LEVEL of "'.concat(r.maxHdcpLevel,'" or lower'));break}}case Cr.MoveAllAlternatesMatchingKey:{var f=e.decryptdata;if(f){for(var d=this.hls.levels,h=d.length,v=h;v--;)if(this.variantHasKey(d[v],f)){var m,p;this.log("Banned key found in level ".concat(v," (").concat(d[v].bitrate,'bps) or audio group "').concat((m=d[v].audioGroups)==null?void 0:m.join(","),'" (').concat((p=e.frag)==null?void 0:p.type," fragment) ").concat(tr(f.keyId||[]))),d[v].fragmentError++,d[v].loadError++,this.log("Removing level ".concat(v," with key error (").concat(e.error,")")),this.hls.removeLevel(v)}var g=e.frag;if(this.hls.levels.length<h)a.resolved=!0;else if(g&&g.type!==fe.MAIN){var E=g.decryptdata;E&&!f.matches(E)&&(a.resolved=!0)}}break}}a.resolved||this.switchLevel(e,o)}}},{key:"switchLevel",value:function(e,r){if(r!==void 0&&e.errorAction&&(this.warn("switching to level ".concat(r," after ").concat(e.details)),this.hls.nextAutoLevel=r,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===K.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo"))for(var a=zc(e.mimeType),s=this.hls.levels,o=s.length;o--;)s[o]["".concat(e.sourceBufferName,"Codec")]===a&&(this.log("Removing level ".concat(o," for ").concat(e.details,' ("').concat(a,'" not supported)')),this.hls.removeLevel(o))}}]),i}(Hr);jt={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"},bL=function(){function n(i){k(this,n),this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=i,this._registerListeners()}return A(n,[{key:"_registerListeners",value:function(){var t=this.hls;t&&(t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.BUFFER_APPENDED,this.onBufferAppended,this),t.on(S.FRAG_BUFFERED,this.onFragBuffered,this),t.on(S.FRAG_LOADED,this.onFragLoaded,this))}},{key:"_unregisterListeners",value:function(){var t=this.hls;t&&(t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.BUFFER_APPENDED,this.onBufferAppended,this),t.off(S.FRAG_BUFFERED,this.onFragBuffered,this),t.off(S.FRAG_LOADED,this.onFragLoaded,this))}},{key:"destroy",value:function(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}},{key:"getAppendedFrag",value:function(t,e){var r=this.activePartLists[e];if(r)for(var a=r.length;a--;){var s=r[a];if(!s)break;if(s.start<=t&&t<=s.end&&s.loaded)return s}return this.getBufferedFrag(t,e)}},{key:"getBufferedFrag",value:function(t,e){return this.getFragAtPos(t,e,!0)}},{key:"getFragAtPos",value:function(t,e,r){for(var a=this.fragments,s=Object.keys(a),o=s.length;o--;){var l=a[s[o]];if((l==null?void 0:l.body.type)===e&&(!r||l.buffered)){var u=l.body;if(u.start<=t&&t<=u.end)return u}}return null}},{key:"detectEvictedFragments",value:function(t,e,r,a,s){var o=this;this.timeRanges&&(this.timeRanges[t]=e);var l=(a==null?void 0:a.fragment.sn)||-1;
1Object.keys(this.fragments).forEach(function(u){var c=o.fragments[u];if(c&&!(l>=c.body.sn)){if(!c.buffered&&(!c.loaded||s)){c.body.type===r&&o.removeFragment(c.body);return}var f=c.range[t];if(f){if(f.time.length===0){o.removeFragment(c.body);return}f.time.some(function(d){var h=!o.isTimeBuffered(d.startPTS,d.endPTS,e);return h&&o.removeFragment(c.body),h})}}})}},{key:"detectPartialFragments",value:function(t){var e=this,r=this.timeRanges;if(!(!r||t.frag.sn==="initSegment")){var a=t.frag,s=Qn(a),o=this.fragments[s];if(!(!o||o.buffered&&a.gap)){var l=!a.relurl;Object.keys(r).forEach(function(u){var c=a.elementaryStreams[u];if(c){var f=r[u],d=l||c.partial===!0;o.range[u]=e.getBufferedTimes(a,t.part,d,f)}}),o.loaded=null,Object.keys(o.range).length?(this.bufferedEnd(o,a),fo(o)||this.removeParts(a.sn-1,a.type)):this.removeFragment(o.body)}}}},{key:"bufferedEnd",value:function(t,e){t.buffered=!0;var r=t.body.endList=e.endList||t.body.endList;r&&(this.endListFragments[t.body.type]=t)}},{key:"removeParts",value:function(t,e){var r=this.activePartLists[e];r&&(this.activePartLists[e]=Ny(r,function(a){return a.fragment.sn>=t}))}},{key:"fragBuffered",value:function(t,e){var r=Qn(t),a=this.fragments[r];!a&&e&&(a=this.fragments[r]={body:t,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},t.gap&&(this.hasGaps=!0)),a&&(a.loaded=null,this.bufferedEnd(a,t))}},{key:"getBufferedTimes",value:function(t,e,r,a){for(var s={time:[],partial:r},o=t.start,l=t.end,u=t.minEndPTS||l,c=t.maxStartPTS||o,f=0;f<a.length;f++){var d=a.start(f)-this.bufferPadding,h=a.end(f)+this.bufferPadding;if(c>=d&&u<=h){s.time.push({startPTS:Math.max(o,a.start(f)),endPTS:Math.min(l,a.end(f))});break}else if(o<h&&l>d){var v=Math.max(o,a.start(f)),m=Math.min(l,a.end(f));m>v&&(s.partial=!0,s.time.push({startPTS:v,endPTS:m}))}else if(l<=d)break}return s}},{key:"getPartialFragment",value:function(t){var e=null,r,a,s,o=0,l=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach(function(c){var f=u[c];f&&fo(f)&&(a=f.body.start-l,s=f.body.end+l,t>=a&&t<=s&&(r=Math.min(t-a,s-t),o<=r&&(e=f.body,o=r)))}),e}},{key:"isEndListAppended",value:function(t){var e=this.endListFragments[t];return e!==void 0&&(e.buffered||fo(e))}},{key:"getState",value:function(t){var e=Qn(t),r=this.fragments[e];return r?r.buffered?fo(r)?jt.PARTIAL:jt.OK:jt.APPENDING:jt.NOT_LOADED}},{key:"isTimeBuffered",value:function(t,e,r){for(var a,s,o=0;o<r.length;o++){if(a=r.start(o)-this.bufferPadding,s=r.end(o)+this.bufferPadding,t>=a&&e<=s)return!0;if(e<=a)return!1}return!1}},{key:"onManifestLoading",value:function(){this.removeAllFragments()}},{key:"onFragLoaded",value:function(t,e){if(!(e.frag.sn==="initSegment"||e.frag.bitrateTest)){var r=e.frag,a=e.part?null:e,s=Qn(r);this.fragments[s]={body:r,appendedPTS:null,loaded:a,buffered:!1,range:Object.create(null)}}}},{key:"onBufferAppended",value:function(t,e){var r=e.frag,a=e.part,s=e.timeRanges,o=e.type;if(r.sn!=="initSegment"){var l=r.type;if(a){var u=this.activePartLists[l];u||(this.activePartLists[l]=u=[]),u.push(a)}this.timeRanges=s;var c=s[o];this.detectEvictedFragments(o,c,l,a)}}},{key:"onFragBuffered",value:function(t,e){this.detectPartialFragments(e)}},{key:"hasFragment",value:function(t){var e=Qn(t);return!!this.fragments[e]}},{key:"hasFragments",value:function(t){var e=this.fragments,r=Object.keys(e);if(!t)return r.length>0;for(var a=r.length;a--;){var s=e[r[a]];if((s==null?void 0:s.body.type)===t)return!0}return!1}},{key:"hasParts",value:function(t){var e;return!!((e=this.activePartLists[t])!=null&&e.length)}},{key:"removeFragmentsInRange",value:function(t,e,r,a,s){var o=this;a&&!this.hasGaps||Object.keys(this.fragments).forEach(function(l){var u=o.fragments[l];if(u){var c=u.body;c.type!==r||a&&!c.gap||c.start<e&&c.end>t&&(u.buffered||s)&&o.removeFragment(c)}})}},{key:"removeFragment",value:function(t){var e=Qn(t);t.clearElementaryStreamInfo();var r=this.activePartLists[t.type];if(r){var a=t.sn;this.activePartLists[t.type]=Ny(r,function(s){return s.fragment.sn!==a})}delete this.fragments[e],t.endList&&delete this.endListFragments[t.type]}},{key:"removeAllFragments",value:function(){var t;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;var e=(t=this.hls)==null||(t=t.latestLevelDetails)==null?void 0:t.partList;e&&e.forEach(function(r){return r.clearElementaryStreamInfo()})}}]),n}();Yi={cbc:0,ctr:1},kL=function(){function n(i,t,e){k(this,n),this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=i,this.aesIV=t,this.aesMode=e}return A(n,[{key:"decrypt",value:function(t,e){switch(this.aesMode){case Yi.cbc:return this.subtle.decrypt({
1name:"AES-CBC",iv:this.aesIV},e,t);case Yi.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},e,t);default:throw new Error("[AESCrypto] invalid aes mode ".concat(this.aesMode))}}}]),n}();IL=function(){function n(){k(this,n),this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}return A(n,[{key:"uint8ArrayToUint32Array_",value:function(t){for(var e=new DataView(t),r=new Uint32Array(4),a=0;a<4;a++)r[a]=e.getUint32(a*4);return r}},{key:"initTable",value:function(){var t=this.sBox,e=this.invSBox,r=this.subMix,a=r[0],s=r[1],o=r[2],l=r[3],u=this.invSubMix,c=u[0],f=u[1],d=u[2],h=u[3],v=new Uint32Array(256),m=0,p=0,g=0;for(g=0;g<256;g++)g<128?v[g]=g<<1:v[g]=g<<1^283;for(g=0;g<256;g++){var E=p^p<<1^p<<2^p<<3^p<<4;E=E>>>8^E&255^99,t[m]=E,e[E]=m;var y=v[m],_=v[y],b=v[_],C=v[E]*257^E*16843008;a[m]=C<<24|C>>>8,s[m]=C<<16|C>>>16,o[m]=C<<8|C>>>24,l[m]=C,C=b*16843009^_*65537^y*257^m*16843008,c[E]=C<<24|C>>>8,f[E]=C<<16|C>>>16,d[E]=C<<8|C>>>24,h[E]=C,m?(m=y^v[v[v[b^y]]],p^=v[v[p]]):m=p=1}}},{key:"expandKey",value:function(t){for(var e=this.uint8ArrayToUint32Array_(t),r=!0,a=0;a<e.length&&r;)r=e[a]===this.key[a],a++;if(!r){this.key=e;var s=this.keySize=e.length;if(s!==4&&s!==6&&s!==8)throw new Error("Invalid aes key size="+s);var o=this.ksRows=(s+6+1)*4,l,u,c=this.keySchedule=new Uint32Array(o),f=this.invKeySchedule=new Uint32Array(o),d=this.sBox,h=this.rcon,v=this.invSubMix,m=v[0],p=v[1],g=v[2],E=v[3],y,_;for(l=0;l<o;l++){if(l<s){y=c[l]=e[l];continue}_=y,l%s===0?(_=_<<8|_>>>24,_=d[_>>>24]<<24|d[_>>>16&255]<<16|d[_>>>8&255]<<8|d[_&255],_^=h[l/s|0]<<24):s>6&&l%s===4&&(_=d[_>>>24]<<24|d[_>>>16&255]<<16|d[_>>>8&255]<<8|d[_&255]),c[l]=y=(c[l-s]^_)>>>0}for(u=0;u<o;u++)l=o-u,u&3?_=c[l]:_=c[l-4],u<4||l<=4?f[u]=_:f[u]=m[d[_>>>24]]^p[d[_>>>16&255]]^g[d[_>>>8&255]]^E[d[_&255]],f[u]=f[u]>>>0}}},{key:"networkToHostOrderSwap",value:function(t){return t<<24|(t&65280)<<8|(t&16711680)>>8|t>>>24}},{key:"decrypt",value:function(t,e,r){for(var a=this.keySize+6,s=this.invKeySchedule,o=this.invSBox,l=this.invSubMix,u=l[0],c=l[1],f=l[2],d=l[3],h=this.uint8ArrayToUint32Array_(r),v=h[0],m=h[1],p=h[2],g=h[3],E=new Int32Array(t),y=new Int32Array(E.length),_,b,C,R,M,D,L,O,x,Y,$,Z,N,j,z=this.networkToHostOrderSwap;e<E.length;){for(x=z(E[e]),Y=z(E[e+1]),$=z(E[e+2]),Z=z(E[e+3]),M=x^s[0],D=Z^s[1],L=$^s[2],O=Y^s[3],N=4,j=1;j<a;j++)_=u[M>>>24]^c[D>>16&255]^f[L>>8&255]^d[O&255]^s[N],b=u[D>>>24]^c[L>>16&255]^f[O>>8&255]^d[M&255]^s[N+1],C=u[L>>>24]^c[O>>16&255]^f[M>>8&255]^d[D&255]^s[N+2],R=u[O>>>24]^c[M>>16&255]^f[D>>8&255]^d[L&255]^s[N+3],M=_,D=b,L=C,O=R,N=N+4;_=o[M>>>24]<<24^o[D>>16&255]<<16^o[L>>8&255]<<8^o[O&255]^s[N],b=o[D>>>24]<<24^o[L>>16&255]<<16^o[O>>8&255]<<8^o[M&255]^s[N+1],C=o[L>>>24]<<24^o[O>>16&255]<<16^o[M>>8&255]<<8^o[D&255]^s[N+2],R=o[O>>>24]<<24^o[M>>16&255]<<16^o[D>>8&255]<<8^o[L&255]^s[N+3],y[e]=z(_^v),y[e+1]=z(R^m),y[e+2]=z(C^p),y[e+3]=z(b^g),v=x,m=Y,p=$,g=Z,e=e+4}return y.buffer}}]),n}(),CL=function(){function n(i,t,e){k(this,n),this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=i,this.key=t,this.aesMode=e}return A(n,[{key:"expandKey",value:function(){var t=LL(this.aesMode);return this.subtle.importKey("raw",this.key,{name:t},!1,["encrypt","decrypt"])}}]),n}();RL=16,gf=function(){function n(i){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=t.removePKCS7Padding,r=e===void 0?!0:e;if(k(this,n),this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=i.enableSoftwareAES,this.removePKCS7Padding=r,r)try{var a=self.crypto;a&&(this.subtle=a.subtle||a.webkitSubtle)}catch(s){}this.useSoftware=!this.subtle}return A(n,[{key:"destroy",value:function(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}},{key:"isSync",value:function(){return this.useSoftware}},{key:"flush",value:function(){var t=this.currentResult,e=this.remainderData;if(!t||e)return this.reset(),null;
1var r=new Uint8Array(t);return this.reset(),this.removePKCS7Padding?AL(r):r}},{key:"reset",value:function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}},{key:"decrypt",value:function(t,e,r,a){var s=this;return this.useSoftware?new Promise(function(o,l){var u=ArrayBuffer.isView(t)?t:new Uint8Array(t);s.softwareDecrypt(u,e,r,a);var c=s.flush();c?o(c.buffer):l(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(t),e,r,a)}},{key:"softwareDecrypt",value:function(t,e,r,a){var s=this.currentIV,o=this.currentResult,l=this.remainderData;if(a!==Yi.cbc||e.byteLength!==16)return tt.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),l&&(t=jr(l,t),this.remainderData=null);var u=this.getValidChunk(t);if(!u.length)return null;s&&(r=s);var c=this.softwareDecrypter;c||(c=this.softwareDecrypter=new IL),c.expandKey(e);var f=o;return this.currentResult=c.decrypt(u.buffer,0,r),this.currentIV=u.slice(-16).buffer,f||null}},{key:"webCryptoDecrypt",value:function(t,e,r,a){var s=this;if(this.key!==e||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(t,e,r,a));this.key=e,this.fastAesKey=new CL(this.subtle,e,a)}return this.fastAesKey.expandKey().then(function(o){if(!s.subtle)return Promise.reject(new Error("web crypto not initialized"));s.logOnce("WebCrypto AES decrypt");var l=new kL(s.subtle,new Uint8Array(r),a);return l.decrypt(t.buffer,o)}).catch(function(o){return tt.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, ".concat(o.name,": ").concat(o.message)),s.onWebCryptoError(t,e,r,a)})}},{key:"onWebCryptoError",value:function(t,e,r,a){var s=this.enableSoftwareAES;if(s){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(t,e,r,a);var o=this.flush();if(o)return o.buffer}throw new Error("WebCrypto"+(s?" and softwareDecrypt":"")+": failed to decrypt data")}},{key:"getValidChunk",value:function(t){var e=t,r=t.length-t.length%RL;return r!==t.length&&(e=t.slice(0,r),this.remainderData=t.slice(r)),e}},{key:"logOnce",value:function(t){this.logEnabled&&(tt.log("[decrypter]: ".concat(t)),this.logEnabled=!1)}}]),n}(),Fy=Math.pow(2,17),OL=function(){function n(i){k(this,n),this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=i}return A(n,[{key:"destroy",value:function(){this.loader&&(this.loader.destroy(),this.loader=null)}},{key:"abort",value:function(){this.loader&&this.loader.abort()}},{key:"load",value:function(t,e){var r=this,a=t.url;if(!a)return Promise.reject(new ki({type:ge.NETWORK_ERROR,details:K.FRAG_LOAD_ERROR,fatal:!1,frag:t,error:new Error("Fragment does not have a ".concat(a?"part list":"url")),networkDetails:null}));this.abort();var s=this.config,o=s.fLoader,l=s.loader;return new Promise(function(u,c){if(r.loader&&r.loader.destroy(),t.gap)if(t.tagList.some(function(p){return p[0]==="GAP"})){c(By(t));return}else t.gap=!1;var f=r.loader=o?new o(s):new l(s),d=Uy(t);t.loader=f;var h=My(s.fragLoadPolicy.default),v={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:t.sn==="initSegment"?1/0:Fy};t.stats=f.stats;var m={onSuccess:function(g,E,y,_){r.resetLoader(t,f);var b=g.data;y.resetIV&&t.decryptdata&&(t.decryptdata.iv=new Uint8Array(b.slice(0,16)),b=b.slice(16)),u({frag:t,part:null,payload:b,networkDetails:_})},onError:function(g,E,y,_){r.resetLoader(t,f),c(new ki({type:ge.NETWORK_ERROR,details:K.FRAG_LOAD_ERROR,fatal:!1,frag:t,response:et({url:a,data:void 0},g),error:new Error("HTTP Error ".concat(g.code," ").concat(g.text)),networkDetails:y,stats:_}))},onAbort:function(g,E,y){r.resetLoader(t,f),c(new ki({type:ge.NETWORK_ERROR,details:K.INTERNAL_ABORTED,fatal:!1,frag:t,error:new Error("Aborted"),networkDetails:y,stats:g}))},onTimeout:function(g,E,y){r.resetLoader(t,f),c(new ki({type:ge.NETWORK_ERROR,details:K.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,error:new Error("Timeout after ".concat(v.timeout,"ms")),networkDetails:y,stats:g}))}};e&&(m.onProgress=function(p,g,E,y){return e({frag:t,part:null,payload:E,networkDetails:y})}),f.load(d,v,m)})}},{key:"loadPart",value:function(t,e,r){var a=this;this.abort();var s=this.config,o=s.fLoader,l=s.loader;
1return new Promise(function(u,c){if(a.loader&&a.loader.destroy(),t.gap||e.gap){c(By(t,e));return}var f=a.loader=o?new o(s):new l(s),d=Uy(t,e);t.loader=f;var h=My(s.fragLoadPolicy.default),v={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Fy};e.stats=f.stats,f.load(d,v,{onSuccess:function(p,g,E,y){a.resetLoader(t,f),a.updateStatsFromPart(t,e);var _={frag:t,part:e,payload:p.data,networkDetails:y};r(_),u(_)},onError:function(p,g,E,y){a.resetLoader(t,f),c(new ki({type:ge.NETWORK_ERROR,details:K.FRAG_LOAD_ERROR,fatal:!1,frag:t,part:e,response:et({url:d.url,data:void 0},p),error:new Error("HTTP Error ".concat(p.code," ").concat(p.text)),networkDetails:E,stats:y}))},onAbort:function(p,g,E){t.stats.aborted=e.stats.aborted,a.resetLoader(t,f),c(new ki({type:ge.NETWORK_ERROR,details:K.INTERNAL_ABORTED,fatal:!1,frag:t,part:e,error:new Error("Aborted"),networkDetails:E,stats:p}))},onTimeout:function(p,g,E){a.resetLoader(t,f),c(new ki({type:ge.NETWORK_ERROR,details:K.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,part:e,error:new Error("Timeout after ".concat(v.timeout,"ms")),networkDetails:E,stats:p}))}})})}},{key:"updateStatsFromPart",value:function(t,e){var r=t.stats,a=e.stats,s=a.total;if(r.loaded+=a.loaded,s){var o=Math.round(t.duration/e.duration),l=Math.min(Math.round(r.loaded/s),o),u=o-l,c=u*Math.round(r.loaded/l);r.total=r.loaded+c}else r.total=Math.max(r.loaded,r.total);var f=r.loading,d=a.loading;f.start?f.first+=d.first-d.start:(f.start=d.start,f.first=d.first),f.end=d.end}},{key:"resetLoader",value:function(t,e){t.loader=null,this.loader===e&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),e.destroy()}}]),n}();ki=function(n){B(i,n);function i(t){var e;return k(this,i),e=Xe(this,i,[t.error.message]),e.data=void 0,e.data=t,e}return A(i)}(Fr(Error)),n0=function(n){B(i,n);function i(t,e){var r;return k(this,i),r=Xe(this,i,[t,e]),r._boundTick=void 0,r._tickTimer=null,r._tickInterval=null,r._tickCallCount=0,r._boundTick=r.tick.bind(qe(r)),r}return A(i,[{key:"destroy",value:function(){this.onHandlerDestroying(),this.onHandlerDestroyed()}},{key:"onHandlerDestroying",value:function(){this.clearNextTick(),this.clearInterval()}},{key:"onHandlerDestroyed",value:function(){}},{key:"hasInterval",value:function(){return!!this._tickInterval}},{key:"hasNextTick",value:function(){return!!this._tickTimer}},{key:"setInterval",value:function(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}},{key:"clearInterval",value:function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}},{key:"clearNextTick",value:function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}},{key:"tick",value:function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}},{key:"tickImmediate",value:function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}},{key:"doTick",value:function(){}}]),i}(Hr),yf=A(function n(i,t,e){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1;k(this,n),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=ho(),this.buffering={audio:ho(),video:ho(),audiovideo:ho()},this.level=i,this.sn=t,this.id=e,this.size=r,this.part=a,this.partial=s});Gy={length:0,start:function(){return 0},end:function(){return 0}},Fe=function(){function n(){k(this,n)}return A(n,null,[{key:"isBuffered",value:function(t,e){if(t){for(var r=n.getBuffered(t),a=r.length;a--;)if(e>=r.start(a)&&e<=r.end(a))return!0}return!1}},{key:"bufferedRanges",value:function(t){if(t){var e=n.getBuffered(t);return n.timeRangesToArray(e)}return[]}},{key:"timeRangesToArray",value:function(t){for(var e=[],r=0;r<t.length;r++)e.push({start:t.start(r),end:t.end(r)});return e}},{key:"bufferInfo",value:function(t,e,r){if(t){var a=n.bufferedRanges(t);if(a.length)return n.bufferedInfo(a,e,r)}return{len:0,start:e,end:e,bufferedIndex:-1}}},{key:"bufferedInfo",value:function(t,e,r){e=Math.max(0,e),t.length>1&&t.sort(function(g,E){return g.start-E.start||E.end-g.end});var a=-1,s=[];if(r)for(var o=0;o<t.length;o++){e>
1=t[o].start&&e<=t[o].end&&(a=o);var l=s.length;if(l){var u=s[l-1].end;t[o].start-u<r?t[o].end>u&&(s[l-1].end=t[o].end):s.push(t[o])}else s.push(t[o])}else s=t;for(var c=0,f,d=e,h=e,v=0;v<s.length;v++){var m=s[v].start,p=s[v].end;if(a===-1&&e>=m&&e<=p&&(a=v),e+r>=m&&e<p)d=m,h=p,c=h-e;else if(e+r<m){f=m;break}}return{len:c,start:d||0,end:h||0,nextStart:f,buffered:t,bufferedIndex:a}}},{key:"getBuffered",value:function(t){try{return t.buffered||Gy}catch(e){return tt.log("failed to get media.buffered",e),Gy}}}]),n}(),a0=/\{\$([a-zA-Z0-9-_]+)\}/g;PL=/^(\d+)x(\d+)$/,Vy=/(.+?)=(".*?"|.*?)(?:,|$)/g,Lt=function(){function n(i,t){k(this,n),typeof i=="string"&&(i=n.parseAttrList(i,t)),nt(this,i)}return A(n,[{key:"clientAttrs",get:function(){return Object.keys(this).filter(function(t){return t.substring(0,2)==="X-"})}},{key:"decimalInteger",value:function(t){var e=parseInt(this[t],10);return e>Number.MAX_SAFE_INTEGER?1/0:e}},{key:"hexadecimalInteger",value:function(t){if(this[t]){var e=(this[t]||"0x").slice(2);e=(e.length&1?"0":"")+e;for(var r=new Uint8Array(e.length/2),a=0;a<e.length/2;a++)r[a]=parseInt(e.slice(a*2,a*2+2),16);return r}return null}},{key:"hexadecimalIntegerAsNumber",value:function(t){var e=parseInt(this[t],16);return e>Number.MAX_SAFE_INTEGER?1/0:e}},{key:"decimalFloatingPoint",value:function(t){return parseFloat(this[t])}},{key:"optionalFloat",value:function(t,e){var r=this[t];return r?parseFloat(r):e}},{key:"enumeratedString",value:function(t){return this[t]}},{key:"enumeratedStringList",value:function(t,e){var r=this[t];return(r?r.split(/[ ,]+/):[]).reduce(function(a,s){return a[s.toLowerCase()]=!0,a},e)}},{key:"bool",value:function(t){return this[t]==="YES"}},{key:"decimalResolution",value:function(t){var e=PL.exec(this[t]);if(e!==null)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}}}],[{key:"parseAttrList",value:function(t,e){var r,a={},s='"';for(Vy.lastIndex=0;(r=Vy.exec(t))!==null;){var o=r[1].trim(),l=r[2],u=l.indexOf(s)===0&&l.lastIndexOf(s)===l.length-1,c=!1;if(u)l=l.slice(1,-1);else switch(o){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":c=!0}if(e&&(u||c))l=Qc(e,l);else if(!c&&!u)switch(o){case"CLOSED-CAPTIONS":if(l==="NONE")break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":tt.warn("".concat(t,": attribute ").
1concat(o," is missing quotes"))}a[o]=l}return a}}]),n}(),DL="com.apple.hls.interstitial";s0=function(){function n(i,t){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;k(this,n);var r;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(t==null?void 0:t.tagAnchor)||null,this.tagOrder=(r=t==null?void 0:t.tagOrder)!=null?r:e,t){var a=t.attr;for(var s in a)if(Object.prototype.hasOwnProperty.call(i,s)&&i[s]!==a[s]){tt.warn('DATERANGE tag attribute: "'.concat(s,'" does not match for tags with ID: "').concat(i.ID,'"')),this._badValueForSameId=s;break}i=nt(new Lt({}),a,i)}if(this.attr=i,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(i["START-DATE"]),"END-DATE"in this.attr){var o=(t==null?void 0:t.endDate)||new Date(this.attr["END-DATE"]);ce(o.getTime())&&(this._endDate=o)}}return A(n,[{key:"id",get:function(){return this.attr.ID}},{key:"class",get:function(){return this.attr.CLASS}},{key:"cue",get:function(){var t=this._cue;return t===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):t}},{key:"startTime",get:function(){var t=this.tagAnchor;return t===null||t.programDateTime===null?(tt.warn('Expected tagAnchor Fragment with PDT set for DateRange "'.concat(this.id,'": ').concat(t)),NaN):t.start+(this.startDate.getTime()-t.programDateTime)/1e3}},{key:"startDate",get:function(){return this._startDate}},{key:"endDate",get:function(){var t=this._endDate||this._dateAtEnd;if(t)return t;var e=this.duration;return e!==null?this._dateAtEnd=new Date(this._startDate.getTime()+e*1e3):null}},{key:"duration",get:function(){if("DURATION"in this.attr){var t=this.attr.decimalFloatingPoint("DURATION");if(ce(t))return t}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:"plannedDuration",get:function(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}},{key:"endOnNext",get:function(){return this.attr.bool("END-ON-NEXT")}},{key:"isInterstitial",get:function(){return this.class===DL}},{key:"isValid",get:function(){return!!this.id&&!this._badValueForSameId&&ce(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}]),n}(),FL=10,UL=function(){function n(i){k(this,n),this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=i}return A(n,[{key:"reloaded",value:function(t){if(!t){this.advanced=!0,this.updated=!0;return}var e=this.lastPartSn-t.lastPartSn,r=this.lastPartIndex-t.lastPartIndex;this.updated=this.endSN!==t.endSN||!!r||!!e||!this.live,this.advanced=this.endSN>t.endSN||e>0||e===0&&r>0,this.updated||this.advanced?this.misses=Math.floor(t.misses*.6):this.misses=t.misses+1}},{key:"hasKey",value:function(t){return this.encryptedFragments.some(function(e){var r=e.decryptdata;return r||(e.setKeyFormat(t.keyFormat),r=e.decryptdata),!!r&&t.matches(r)})}},{key:"hasProgramDateTime",get:function(){return this.fragments.length?ce(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||FL}}
1,{key:"drift",get:function(){var t=this.driftEndTime-this.driftStartTime;if(t>0){var e=this.driftEnd-this.driftStart;return e*1e3/t}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var t;return(t=this.partList)!=null&&t.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}},{key:"fragmentStart",get:function(){return this.fragments.length?this.fragments[0].start:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var t;return(t=this.partList)!=null&&t.length?this.partList[this.partList.length-1].index:-1}},{key:"maxPartIndex",get:function(){var t=this.partList;if(t){var e=this.lastPartIndex;if(e!==-1){for(var r=t.length;r--;)if(t[r].index>e)return t[r].index;return e}}return 0}},{key:"lastPartSn",get:function(){var t;return(t=this.partList)!=null&&t.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}},{key:"expired",get:function(){if(this.live&&this.age&&this.misses<3){var t=this.partEnd-this.fragmentStart;return this.age>Math.max(t,this.totalduration)+this.levelTargetDuration}return!1}}]),n}();Bo=typeof self!="undefined"?self:void 0,gt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},rr={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};u0=function(n){return Bo!=null&&(n=Bo.navigator)!=null&&n.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();$n={},Go=function(){function n(i,t,e){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:[1],a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,s=arguments.length>5?arguments[5]:void 0;k(this,n),this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=i,this.uri=t,this.keyFormat=e,this.keyFormatVersions=r,this.iv=a,this.encrypted=i?i!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!aa(i),s!=null&&s.startsWith("0x")&&(this.keyId=new Uint8Array(U_(s)))}return A(n,[{key:"matches",value:function(t){return t.uri===this.uri&&t.method===this.method&&t.encrypted===this.encrypted&&t.keyFormat===this.keyFormat&&Uo(t.keyFormatVersions,this.keyFormatVersions)&&Ky(t.iv,this.iv)&&Ky(t.keyId,this.keyId)}},{key:"isSupported",value:function(){if(this.method){if(aa(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case rr.FAIRPLAY:case rr.WIDEVINE:case rr.PLAYREADY:case rr.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}},{key:"getDecryptData",value:function(t,e){if(!this.encrypted||!this.uri)return null;if(aa(this.method)){var r=this.iv;r||(typeof t!="number"&&(tt.warn('missing IV for initialization segment with method="'.concat(this.method,'" - compliance issue')),t=0),r=KL(t));var a=new n(this.method,this.uri,"identity",this.keyFormatVersions,r);return a}if(this.keyId){var s=$n[this.uri];if(s&&!Uo(this.keyId,s)&&n.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}var o=l0(this.uri);if(o)switch(this.keyFormat){case rr.WIDEVINE:if(this.pssh=o,!this.keyId){var l=YC(o.buffer);if(l.length){var u,c=l[0];this.keyId=(u=c.kids)!=null&&u.length?c.kids[0]:null}}this.keyId||(this.keyId=Wy(e));break;case rr.PLAYREADY:{var f=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=qC(f,null,o),this.keyId=c0(o);break}default:{var d=o.subarray(0,16);if(d.length!==16){var h=new Uint8Array(16);h.set(d,16-d.length),d=h}this.keyId=d;break}}if(!this.keyId||this.keyId.byteLength!==16){var v;v=VL(e),v||(v=Wy(e),v||(v=$n[this.uri])),v&&(this.keyId=v,n.setKeyIdForUri(this.uri,v))}return this}}],[{key:"clearKeyUriToKeyIdMap",value:function(){$n={}}},{key:"setKeyIdForUri",value:function(t,e){$n[t]=e}},{key:"addKeyIdForUri",value:function(t){var e=Object.keys($n).length%Number.MAX_SAFE_INTEGER,r=new
1Uint8Array(16),a=new DataView(r.buffer,12,4);return a.setUint32(0,e),$n[t]=r,r}}]),n}();qy=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,Yy=/#EXT-X-MEDIA:(.*)/g,WL=/^#EXT(?:INF|-X-TARGETDURATION):/m,Cc=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),qL=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),qa=function(){function n(){k(this,n)}return A(n,null,[{key:"findGroup",value:function(t,e){for(var r=0;r<t.length;r++){var a=t[r];if(a.id===e)return a}}},{key:"resolve",value:function(t,e){return ff.buildAbsoluteURL(e,t,{alwaysNormalize:!0})}},{key:"isMediaPlaylist",value:function(t){return WL.test(t)}},{key:"parseMasterPlaylist",value:function(t,e){var r=jy(t),a={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:r},s=[];if(qy.lastIndex=0,!t.startsWith("#EXTM3U"))return a.playlistParsingError=new Error("no EXTM3U delimiter"),a;for(var o;(o=qy.exec(t))!=null;)if(o[1]){var l,u=new Lt(o[1],a),c=Qc(a,o[2]),f={attrs:u,bitrate:u.decimalInteger("BANDWIDTH")||u.decimalInteger("AVERAGE-BANDWIDTH"),name:u.NAME,url:n.resolve(c,e)},d=u.decimalResolution("RESOLUTION");d&&(f.width=d.width,f.height=d.height),Xy(u.CODECS,f);var h=u["SUPPLEMENTAL-CODECS"];h&&(f.supplemental={},Xy(h,f.supplemental)),(l=f.unknownCodecs)!=null&&l.length||s.push(f),a.levels.push(f)}else if(o[3]){var v=o[3],m=o[4];switch(v){case"SESSION-DATA":{var p=new Lt(m,a),g=p["DATA-ID"];g&&(a.sessionData===null&&(a.sessionData={}),a.sessionData[g]=p);break}case"SESSION-KEY":{var E=zy(m,e,a);E.encrypted&&E.isSupported()?(a.sessionKeys===null&&(a.sessionKeys=[]),a.sessionKeys.push(E)):tt.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "'.concat(m,'"'));break}case"DEFINE":{{var y=new Lt(m,a);Hy(a,y,e)}break}case"CONTENT-STEERING":{var _=new Lt(m,a);a.contentSteering={uri:n.resolve(_["SERVER-URI"],e),pathwayId:_["PATHWAY-ID"]||"."};break}case"START":{a.startTimeOffset=Jy(m);break}}}var b=s.length>0&&s.length<a.levels.length;return a.levels=b?s:a.levels,a.levels.length===0&&(a.playlistParsingError=new Error("no levels found in manifest")),a}},{key:"parseMasterPlaylistMedia",value:function(t,e,r){var a,s={},o=r.levels,l={AUDIO:o.map(function(b){return{id:b.attrs.AUDIO,audioCodec:b.audioCodec}}),SUBTITLES:o.map(function(b){return{id:b.attrs.SUBTITLES,textCodec:b.textCodec}}),"CLOSED-CAPTIONS":[]},u=0;for(Yy.lastIndex=0;(a=Yy.exec(t))!==null;){var c=new Lt(a[1],r),f=c.TYPE;if(f){var d=l[f],h=s[f]||[];s[f]=h;var v=c.LANGUAGE,m=c["ASSOC-LANGUAGE"],p=c.CHANNELS,g=c.CHARACTERISTICS,E=c["INSTREAM-ID"],y={attrs:c,bitrate:0,id:u++,groupId:c["GROUP-ID"]||"",name:c.NAME||v||"",type:f,default:c.bool("DEFAULT"),autoselect:c.bool("AUTOSELECT"),forced:c.bool("FORCED"),lang:v,url:c.URI?n.resolve(c.URI,e):""};if(m&&(y.assocLang=m),p&&(y.channels=p),g&&(y.characteristics=g),E&&(y.instreamId=E),d!=null&&d.length){var _=n.findGroup(d,y.groupId)||d[0];Qy(y,_,"audioCodec"),Qy(y,_,"textCodec")}h.push(y)}}return s}},{key:"parseLevelPlaylist",value:function(t,e,r,a,s,o){var l,u={url:e},c=new UL(e),f=c.fragments,d=[],h=null,v=0,m=0,p=0,g=0,E=0,y=null,_=new bc(a,u),b,C,R,M=-1,D=!1,L=null,O;if(Cc.lastIndex=0,c.m3u8=t,c.hasVariableRefs=jy(t),((l=Cc.exec(t))==null?void 0:l[0])!=="#EXTM3U")return c.playlistParsingError=new Error("Missing format identifier #EXTM3U"),c;for(;(b=Cc.exec(t))!==null;){D&&(D=!1,_=new bc(a,u),_.playlistOffset=p,_.setStart(p),_.sn=v,_.cc=g,E&&(_.bitrate=E),_.level=r,h&&(_.initSegment=h,h.rawProgramDateTime&&(_.rawProgramDateTime=h.rawProgramDateTime,h.rawProgramDateTime=null),L&&(_.setByteRange(L),L=null)));var x=b[1];if(x){_.duration=parseFloat(x);var Y=(" "+b[2]).slice(1);_.title=Y||null,_.tagList.push(Y?["INF",x,Y]:["INF",x])}else if(b[3]){if(ce(_.duration)){_.playlistOffset=p,_.setStart(p),R&&Zy(_,R,c),_.sn=v,_.level=r,_.cc=g,f.push(_);var $=(" "+b[3]).slice(1);_.relurl=Qc(c,$),Zc(_,y,d),y=_,p+=_.duration,v++,m=0,D=!0}}
1else{if(b=b[0].match(qL),!b){tt.warn("No matches on slow regex match for level playlist!");continue}for(C=1;C<b.length&&b[C]===void 0;C++);var Z=(" "+b[C]).slice(1),N=(" "+b[C+1]).slice(1),j=b[C+2]?(" "+b[C+2]).slice(1):null;switch(Z){case"BYTERANGE":y?_.setByteRange(N,y):_.setByteRange(N);break;case"PROGRAM-DATE-TIME":_.rawProgramDateTime=N,_.tagList.push(["PROGRAM-DATE-TIME",N]),M===-1&&(M=f.length);break;case"PLAYLIST-TYPE":c.type&&Ti(c,Z,b),c.type=N.toUpperCase();break;case"MEDIA-SEQUENCE":c.startSN!==0?Ti(c,Z,b):f.length>0&&e_(c,Z,b),v=c.startSN=parseInt(N);break;case"SKIP":{c.skippedSegments&&Ti(c,Z,b);var z=new Lt(N,c),ee=z.decimalInteger("SKIPPED-SEGMENTS");if(ce(ee)){c.skippedSegments+=ee;for(var U=ee;U--;)f.push(null);v+=ee}var F=z.enumeratedString("RECENTLY-REMOVED-DATERANGES");F&&(c.recentlyRemovedDateranges=(c.recentlyRemovedDateranges||[]).concat(F.split(" ")));break}case"TARGETDURATION":c.targetduration!==0&&Ti(c,Z,b),c.targetduration=Math.max(parseInt(N),1);break;case"VERSION":c.version!==null&&Ti(c,Z,b),c.version=parseInt(N);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":c.live||Ti(c,Z,b),c.live=!1;break;case"#":(N||j)&&_.tagList.push(j?[N,j]:[N]);break;case"DISCONTINUITY":g++,_.tagList.push(["DIS"]);break;case"GAP":_.gap=!0,_.tagList.push([Z]);break;case"BITRATE":_.tagList.push([Z,N]),E=parseInt(N)*1e3,ce(E)?_.bitrate=E:E=0;break;case"DATERANGE":{var H=new Lt(N,c),G=new s0(H,c.dateRanges[H.ID],c.dateRangeTagCount);c.dateRangeTagCount++,G.isValid||c.skippedSegments?c.dateRanges[G.id]=G:tt.warn('Ignoring invalid DATERANGE tag: "'.concat(N,'"')),_.tagList.push(["EXT-X-DATERANGE",N]);break}case"DEFINE":{{var ve=new Lt(N,c);"IMPORT"in ve?xL(c,ve,o):Hy(c,ve,e)}break}case"DISCONTINUITY-SEQUENCE":c.startCC!==0?Ti(c,Z,b):f.length>0&&e_(c,Z,b),c.startCC=g=parseInt(N);break;case"KEY":{var ye=zy(N,e,c);if(ye.isSupported()){if(ye.method==="NONE"){R=void 0;break}R||(R={});var Ee=R[ye.keyFormat];Ee!=null&&Ee.matches(ye)||(Ee&&(R=nt({},R)),R[ye.keyFormat]=ye)}else tt.warn('[Keys] Ignoring unsupported EXT-X-KEY tag: "'.concat(N,'"'));break}case"START":c.startTimeOffset=Jy(N);break;case"MAP":{var Ce=new Lt(N,c);if(_.duration){var Ye=new bc(a,u);$y(Ye,Ce,r,R),h=Ye,_.initSegment=h,h.rawProgramDateTime&&!_.rawProgramDateTime&&(_.rawProgramDateTime=h.rawProgramDateTime)}else{var ot=_.byteRangeEndOffset;if(ot){var Ue=_.byteRangeStartOffset;L="".concat(ot-Ue,"@").concat(Ue)}else L=null;$y(_,Ce,r,R),h=_,D=!0}h.cc=g;break}case"SERVER-CONTROL":{O&&Ti(c,Z,b),O=new Lt(N),c.canBlockReload=O.bool("CAN-BLOCK-RELOAD"),c.canSkipUntil=O.optionalFloat("CAN-SKIP-UNTIL",0),c.canSkipDateRanges=c.canSkipUntil>0&&O.bool("CAN-SKIP-DATERANGES"),c.partHoldBack=O.optionalFloat("PART-HOLD-BACK",0),c.holdBack=O.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{c.partTarget&&Ti(c,Z,b);
1var yt=new Lt(N);c.partTarget=yt.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Le=c.partList;Le||(Le=c.partList=[]);var _t=m>0?Le[Le.length-1]:void 0,wt=m++,xt=new Lt(N,c),qt=new xC(xt,_,u,wt,_t);Le.push(qt),_.duration+=qt.duration;break}case"PRELOAD-HINT":{var lt=new Lt(N,c);c.preloadHint=lt;break}case"RENDITION-REPORT":{var Sr=new Lt(N,c);c.renditionReports=c.renditionReports||[],c.renditionReports.push(Sr);break}default:tt.warn("line parsed but not handled: ".concat(b));break}}}y&&!y.relurl?(f.pop(),p-=y.duration,c.partList&&(c.fragmentHint=y)):c.partList&&(Zc(_,y,d),_.cc=g,c.fragmentHint=_,R&&Zy(_,R,c)),c.targetduration||(c.playlistParsingError=new Error("Missing Target Duration"));var cr=f.length,Nt=f[0],Ft=f[cr-1];if(p+=c.skippedSegments*c.targetduration,p>0&&cr&&Ft){c.averagetargetduration=p/cr;var Pt=Ft.sn;c.endSN=Pt!=="initSegment"?Pt:0,c.live||(Ft.endList=!0),M>0&&(zL(f,M),Nt&&d.unshift(Nt))}return c.fragmentHint&&(p+=c.fragmentHint.duration),c.totalduration=p,d.length&&c.dateRangeTagCount&&Nt&&f0(d,c),c.endCC=g,c}}]),n}();rR={toString:function(i){for(var t="",e=i.length,r=0;r<e;r++)t+="[".concat(i.start(r).toFixed(3),"-").concat(i.end(r).toFixed(3),"]");return t}},re={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},Sf=function(n){B(i,n);function i(t,e,r,a,s){var o;return k(this,i),o=Xe(this,i,[a,t.logger]),o.hls=void 0,o.fragPrevious=null,o.fragCurrent=null,o.fragmentTracker=void 0,o.transmuxer=null,o._state=re.STOPPED,o.playlistType=void 0,o.media=null,o.mediaBuffer=null,o.config=void 0,o.bitrateTest=!1,o.lastCurrentTime=0,o.nextLoadPosition=0,o.startPosition=0,o.startTimeOffset=null,o.retryDate=0,o.levels=null,o.fragmentLoader=void 0,o.keyLoader=void 0,o.levelLastLoaded=null,o.startFragRequested=!1,o.decrypter=void 0,o.initPTS=[],o.buffering=!0,o.loadingParts=!1,o.loopSn=void 0,o.onMediaSeeking=function(){var l=qe(o),u=l.config,c=l.fragCurrent,f=l.media,d=l.mediaBuffer,h=l.state,v=f?f.currentTime:0,m=Fe.bufferInfo(d||f,v,u.maxBufferHole),p=!m.len;if(o.log("Media seeking to ".concat(ce(v)?v.toFixed(3):v,", state: ").concat(h,", ").concat(p?"out of":"in"," buffer")),o.state===re.ENDED)o.resetLoadingState();else if(c){var g=u.maxFragLookUpTolerance,E=c.start-g,y=c.start+c.duration+g;if(p||y<m.start||E>m.end){var _=v>y;(v<E||_)&&(_&&c.loader&&(o.log("Cancelling fragment load for seek (sn: ".concat(c.sn,")")),c.abortRequests(),o.resetLoadingState()),o.fragPrevious=null)}}if(f){o.fragmentTracker.removeFragmentsInRange(v,1/0,o.playlistType,!0);var b=o.lastCurrentTime;if(v>b&&(o.lastCurrentTime=v),!o.loadingParts){var C=Math.max(m.end,v),R=o.shouldLoadParts(o.getLevelDetails(),C);R&&(o.log("LL-Part loading ON after seeking to ".concat(v.toFixed(2)," with buffer @").concat(C.toFixed(2))),o.loadingParts=R)}}o.hls.hasEnoughToStart||(o.log("Setting ".concat(p?"startPosition":"nextLoadPosition"," to ").concat(v," for seek without enough to start")),o.nextLoadPosition=v,p&&(o.startPosition=v)),p&&o.state===re.IDLE&&o.tickImmediate()},o.onMediaEnded=function(){o.log("setting startPosition to 0 because media ended"),o.startPosition=o.lastCurrentTime=0},o.playlistType=s,o.hls=t,o.fragmentLoader=new OL(t.config),o.keyLoader=r,o.fragmentTracker=e,o.config=t.config,o.decrypter=new gf(t.config),o}return A(i,[{key:"registerListeners",value:function(){var e=this.hls;e.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(S.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(S.ERROR,this.onError,this)}},{key:"doTick",value:function(){this.onTickEnd()}},{key:"onTickEnd",value:function(){}},{key:"startLoad",value:function(e){}},{key:"stopLoad",value:function(){if(this.state!==re.STOPPED){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);var e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=re.STOPPED}}},{key:"startPositionValue",get:function(){var e=this.nextLoadPosition,r=this.startPosition;return r===-1&&e?e:r}},{key:"bufferingEnabled",get:function(){return this.buffering}}
1,{key:"pauseBuffering",value:function(){this.buffering=!1}},{key:"resumeBuffering",value:function(){this.buffering=!0}},{key:"inFlightFrag",get:function(){return{frag:this.fragCurrent,state:this.state}}},{key:"_streamEnded",value:function(e,r){if(r.live||!this.media)return!1;var a=e.end||0,s=this.config.timelineOffset||0;if(a<=s)return!1;var o=e.buffered;this.config.maxBufferHole&&o&&o.length>1&&(e=Fe.bufferedInfo(o,e.start,0));var l=e.nextStart,u=l&&l>s&&l<r.edge;if(u||this.media.currentTime<e.start)return!1;var c=r.partList;if(c!=null&&c.length){var f=c[c.length-1],d=Fe.isBuffered(this.media,f.start+f.duration/2);return d}var h=r.fragments[r.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(h)}},{key:"getLevelDetails",value:function(){if(this.levels&&this.levelLastLoaded!==null)return this.levelLastLoaded.details}},{key:"timelineOffset",get:function(){var e=this.config.timelineOffset;if(e){var r;return((r=this.getLevelDetails())==null?void 0:r.appliedTimelineOffset)||e}return 0}},{key:"onMediaAttached",value:function(e,r){var a=this.media=this.mediaBuffer=r.media;vr(a,"seeking",this.onMediaSeeking),vr(a,"ended",this.onMediaEnded);var s=this.config;this.levels&&s.autoStartLoad&&this.state===re.STOPPED&&this.startLoad(s.startPosition)}},{key:"onMediaDetaching",value:function(e,r){var a=!!r.transferMedia,s=this.media;if(s!==null){if(s.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),Er(s,"seeking",this.onMediaSeeking),Er(s,"ended",this.onMediaEnded),this.keyLoader&&!a&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,a){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}},{key:"onManifestLoading",value:function(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}},{key:"onError",value:function(e,r){}},{key:"onManifestLoaded",value:function(e,r){this.startTimeOffset=r.startTimeOffset}},{key:"onHandlerDestroying",value:function(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),Ie(i,"onHandlerDestroying",this,3)([]),this.hls=this.onMediaSeeking=this.onMediaEnded=null}},{key:"onHandlerDestroyed",value:function(){this.state=re.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,Ie(i,"onHandlerDestroyed",this,3)([])}},{key:"loadFragment",value:function(e,r,a){this.startFragRequested=!0,this._loadFragForPlayback(e,r,a)}},{key:"_loadFragForPlayback",value:function(e,r,a){var s=this,o=function(u){var c=u.frag;if(s.fragContextChanged(c)){s.warn("".concat(c.type," sn: ").concat(c.sn).concat(u.part?" part: "+u.part.index:""," of ").concat(s.fragInfo(c,!1,u.part),") was dropped during download.")),s.fragmentTracker.removeFragment(c);return}c.stats.chunkCount++,s._handleFragmentLoadProgress(u)};this._doFragLoad(e,r,a,o).then(function(l){if(l){var u=s.state,c=l.frag;if(s.fragContextChanged(c)){(u===re.FRAG_LOADING||!s.fragCurrent&&u===re.PARSING)&&(s.fragmentTracker.removeFragment(c),s.state=re.IDLE);return}"payload"in l&&(s.log("Loaded ".concat(c.type," sn: ").concat(c.sn," of ").concat(s.playlistLabel()," ").concat(c.level)),s.hls.trigger(S.FRAG_LOADED,l)),s._handleFragmentLoadComplete(l)}}).catch(function(l){s.state===re.STOPPED||s.state===re.ERROR||(s.warn("Frag error: ".concat((l==null?void 0:l.message)||l)),s.resetFragmentLoading(e))})}},{key:"clearTrackerIfNeeded",value:function(e){var r,a=this.fragmentTracker,s=a.getState(e);if(s===jt.APPENDING){var o=e.type,l=this.getFwdBufferInfo(this.mediaBuffer,o),u=Math.max(e.duration,l?l.len:this.config.maxBufferLength),c=this.backtrackFragment,f=c?e.sn-c.sn:0;(f===1||this.reduceMaxBufferLength(u,e.duration))&&a.removeFragment(e)}else((r=this.mediaBuffer)==null?void 0:r.buffered.length)===0?a.removeAllFragments():a.hasParts(e.type)&&(a.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),a.getState(e)===jt.PARTIAL&&a.removeFragment(e))}},{key:"checkLiveUpdate",value:function(e){if(e.updated&&!e.live){var r=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:r,part:null,stats:r.stats,id:r.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}},{key:"waitForLive",value:function(e){var r=e.details;return(r==null?void 0:r.live)&&r.type!=="EVENT"&&(this.levelLastLoaded!==e||r.expired)}},{key:"flushMainBuffer",value:function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(e-r){var s={startOffset:e,endOffset:r,type:a};this.hls.trigger(S.BUFFER_FLUSHING,s)}}},{key:"_loadInitSegment",value:function(e,r){var a=this;this._doFragLoad(e,r).then(function(s){var o=s==null?void 0:s.frag;if(!o||a.fragContextChanged(o)||!a.levels)throw new Error("init load aborted");return s}
1).then(function(s){var o=a.hls,l=s.frag,u=s.payload,c=l.decryptdata;if(u&&u.byteLength>0&&c!=null&&c.key&&c.iv&&aa(c.method)){var f=self.performance.now();return a.decrypter.decrypt(new Uint8Array(u),c.key.buffer,c.iv.buffer,_f(c.method)).catch(function(d){throw o.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:K.FRAG_DECRYPT_ERROR,fatal:!1,error:d,reason:d.message,frag:l}),d}).then(function(d){var h=self.performance.now();return o.trigger(S.FRAG_DECRYPTED,{frag:l,payload:d,stats:{tstart:f,tdecrypt:h}}),s.payload=d,a.completeInitSegmentLoad(s)})}return a.completeInitSegmentLoad(s)}).catch(function(s){a.state===re.STOPPED||a.state===re.ERROR||(a.warn(s),a.resetFragmentLoading(e))})}},{key:"completeInitSegmentLoad",value:function(e){var r=this.levels;if(!r)throw new Error("init load aborted, missing levels");var a=e.frag.stats;this.state!==re.STOPPED&&(this.state=re.IDLE),e.frag.data=new Uint8Array(e.payload),a.parsing.start=a.buffering.start=self.performance.now(),a.parsing.end=a.buffering.end=self.performance.now(),this.tick()}},{key:"unhandledEncryptionError",value:function(e,r){var a,s,o=e.tracks;if(o&&!r.encrypted&&((a=o.audio)!=null&&a.encrypted||(s=o.video)!=null&&s.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){var l=this.media,u=new Error("Encrypted track with no key in ".concat(this.fragInfo(r)," (media ").concat(l?"attached mediaKeys: "+l.mediaKeys:"detached",")"));return this.warn(u.message),!l||l.mediaKeys?!1:(this.hls.trigger(S.ERROR,{type:ge.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_KEYS,fatal:!1,error:u,frag:r}),this.resetTransmuxer(),!0)}return!1}},{key:"fragContextChanged",value:function(e){var r=this.fragCurrent;return!e||!r||e.sn!==r.sn||e.level!==r.level}},{key:"fragBufferedComplete",value:function(e,r){var a=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log("Buffered ".concat(e.type," sn: ").concat(e.sn).concat(r?" part: "+r.index:""," of ").concat(this.fragInfo(e,!1,r)," > buffer:").concat(a?rR.toString(Fe.getBuffered(a)):"(detached)",")")),Rt(e)){var s;if(e.type!==fe.SUBTITLE){var o=e.elementaryStreams;if(!Object.keys(o).some(function(u){return!!o[u]})){this.state=re.IDLE;return}}var l=(s=this.levels)==null?void 0:s[e.level];l!=null&&l.fragmentError&&(this.log("Resetting level fragment error count of ".concat(l.fragmentError," on frag buffered")),l.fragmentError=0)}this.state=re.IDLE}},{key:"_handleFragmentLoadComplete",value:function(e){var r=this.transmuxer;if(r){var a=e.frag,s=e.part,o=e.partsLoaded,l=!o||o.length===0||o.some(function(c){return!c}),u=new yf(a.level,a.sn,a.stats.chunkCount+1,0,s?s.index:-1,!l);r.flush(u)}}},{key:"_handleFragmentLoadProgress",value:function(e){}},{key:"_doFragLoad",value:function(e,r){var a=this,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,o=arguments.length>3?arguments[3]:void 0,l;this.fragCurrent=e;var u=r.details;if(!this.levels||!u)throw new Error("frag load aborted, missing level".concat(u?"":" detail","s"));var c=null;if(e.encrypted&&!((l=e.decryptdata)!=null&&l.key)){if(this.log("Loading key for ".concat(e.sn," of [").concat(u.startSN,"-").concat(u.endSN,"], ").concat(this.playlistLabel()," ").concat(e.level)),this.state=re.KEY_LOADING,this.fragCurrent=e,c=this.keyLoader.load(e).then(function(_){if(!a.fragContextChanged(_.frag))return a.hls.trigger(S.KEY_LOADED,_),a.state===re.KEY_LOADING&&(a.state=re.IDLE),_}),this.hls.trigger(S.KEY_LOADING,{frag:e}),this.fragCurrent===null)return this.log("context changed in KEY_LOADING"),Promise.resolve(null)}else e.encrypted||(c=this.keyLoader.loadClear(e,u.encryptedFragments,this.startFragRequested),c&&this.log("[eme] blocking frag load until media-keys acquired"));var f=this.fragPrevious;if(Rt(e)&&(!f||e.sn!==f.sn)){var d=this.shouldLoadParts(r.details,e.end);d!==this.loadingParts&&(this.log("LL-Part loading ".concat(d?"ON":"OFF"," loading sn ").concat(f==null?void 0:f.sn,"->").concat(e.sn)),this.loadingParts=d)}if(s=Math.max(e.start,s||0),this.loadingParts&&Rt(e)){var h=u.partList;if(h&&o){s>u.fragmentEnd&&u.fragmentHint&&(e=u.fragmentHint);var v=this.getNextPart(h,e,s);if(v>-1){var m=h[v];e=this.fragCurrent=m.fragment,this.log("Loading ".concat(e.type," sn: ").concat(e.sn," part: ").concat(m.index," (").concat(v,"/").concat(h.length-1,") of ").concat(this.fragInfo(e,!1,m),") cc: ").concat(e.cc," [").concat(u.startSN,"-").concat(u.endSN,"], target: ").concat(parseFloat(s.toFixed(3)))),this.nextLoadPosition=m.start+m.duration,this.state=re.FRAG_LOADING;var p;return c?p=c.then(function(_){return!_||a.fragContextChanged(_.frag)?null:a.doFragPartsLoad(e,m,r,o)}).catch(function(_){return a.handleFragLoadError(_)}):p=this.doFragPartsLoad(e,m,r,o).catch(function(_){return a.handleFragLoadError(_)}),this.hls.trigger(S.FRAG_LOADING,{frag:e,part:m,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):p}else if(!e.url||this.loadedEndOfParts(h,s))return Promise.resolve(null)}}if(Rt(e)&&this.loadingParts){var g;this.log("LL-Part loading OFF after next part miss @".concat(s.toFixed(2)," Check buffer at sn: ").concat(e.sn," loaded parts: ").concat((g=u.partList)==null?void 0:g.filter(function(_){return _.loaded}).map(function(_){return"[".concat(_.start,"-").concat(_.end,"]")}))),this.loadingParts=!1}else if(!e.url)return Promise.resolve(null);this.log("Loading ".concat(e.type," sn: ").concat(e.sn," of ").concat(this.fragInfo(e,!1),") cc: ").concat(e.cc," ").concat("["+u.startSN+"-"+u.endSN+"]",", target: ").concat(parseFloat(s.toFixed(3)))),ce(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=re.FRAG_LOADING;var E=this.config.progressive&&e.type!==fe.SUBTITLE,y;return E&&c?y=c.then(function(_){return!_||a.fragContextChanged(_.frag)?null:a.fragmentLoader.load(e,o)}).catch(function(_){return a.handleFragLoadError(_)}):y=Promise.all([this.fragmentLoader.load(e,E?o:void 0),c]).then(function(_){var b=Te(_,1),C=b[0];return!E&&o&&o(C),C}).catch(function(_){return a.handleFragLoadError(_)}),this.hls.trigger(S.FRAG_LOADING,{frag:e,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):y}},{key:"doFragPartsLoad",value:function(e,r,a,s){var o=this;return new Promise(function(l,u){var c,f=[],d=(c=a.details)==null?void 0:c.partList,h=function v(m){o.fragmentLoader.loadPart(e,m,s).then(function(p){f[m.index]=p;var g=p.part;o.hls.trigger(S.FRAG_LOADED,p);var E=r_(a.details,e.sn,m.index+1)||m0(d,e.sn,m.index+1);if(E)v(E);else return l({frag:e,part:g,partsLoaded:f})}).catch(u)};h(r)})}},{key:"handleFragLoadError",value:function(e){if("data"in e){var r=e.data;r.frag&&r.details===K.INTERNAL_ABORTED?this.handleFragLoadAborted(r.frag,r.part):r.frag&&r.type===ge.KEY_SYSTEM_ERROR?(r.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(r.frag)):this.hls.trigger(S.ERROR,r)}else this.hls.trigger(S.ERROR,{type:ge.OTHER_ERROR,details:K.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}},{key:"_handleTransmuxerFlush",value:function(e){var r=this.getCurrentContext(e);if(!r||this.state!==re.PARSING){!this.fragCurrent&&this.state!==re.STOPPED&&this.state!==re.ERROR&&(this.state=re.IDLE);return}var a=r.frag,s=r.part,o=r.level,l=self.performance.now();a.stats.parsing.end=l,s&&(s.stats.parsing.end=l);var u=this.getLevelDetails(),c=u&&a.sn>u.endSN,f=c||this.shouldLoadParts(u,a.end);f!==this.loadingParts&&(this.log("LL-Part loading ".concat(f?"ON":"OFF"," after parsing segment ending @").concat(a.end.toFixed(2))),this.loadingParts=f),this.updateLevelTiming(a,s,o,e.partial)}},{key:"shouldLoadParts",value:function(e,r){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var a,s=e.partList[0];if(s.fragment.type===fe.SUBTITLE)return!1;var o=s.end+(((a=e.fragmentHint)==null?void 0:a.duration)||0);if(r>=o){var l,u=this.hls.hasEnoughToStart?((l=this.media)==null?void 0:l.currentTime)||this.lastCurrentTime:this.getLoadPosition();if(u>s.start-s.fragment.duration)return!0}}}return!1}},{key:"getCurrentContext",value:function(e){var r=this.levels,a=this.fragCurrent,s=e.level,o=e.sn,l=e.part;if(!(r!=null&&r[s]))return this.warn("Levels object was unset while buffering fragment ".concat(o," of ").concat(this.playlistLabel()," ").concat(s,". The current chunk will not be buffered.")),null;var u=r[s],c=u.details,f=l>-1?r_(c,o,l):null,d=f?f.fragment:p0(c,o,a);return d?(a&&a!==d&&(d.stats=a.stats),{frag:d,part:f,level:u}):null}},{key:"bufferFragmentData",value:function(e,r,a,s,o){if(this.state===re.PARSING){var l=e.data1,u=e.data2,c=l;if(u&&(c=jr(l,u)),!!c.length){var f=this.initPTS[r.cc],d=f?-f.baseTime/f.timescale:void 0,h={type:e.type,frag:r,part:a,chunkMeta:s,offset:d,parent:r.type,data:c};if(this.hls.trigger(S.BUFFER_APPENDING,h),e.dropped&&e.independent&&!a){if(o)return;this.flushBufferGap(r)}}}}},{key:"flushBufferGap",value:function(e){var r=this.media;if(r){if(!Fe.isBuffered(r,r.currentTime)){this.flushMainBuffer(0,e.start);return}var a=r.currentTime,s=Fe.bufferInfo(r,a,0),o=e.duration,l=Math.min(this.config.maxFragLookUpTolerance*2,o*.25),u=Math.max(Math.min(e.start-l,s.end-l),a+l);e.start-u>l&&this.flushMainBuffer(u,e.start)}}},{key:"getFwdBufferInfo",value:function(e,r){var a,s=this.getLoadPosition();if(!ce(s))return null;var o=this.lastCurrentTime>s,l=o||(a=this.media)!=null&&a.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,s,r,l)}},{key:"getFwdBufferInfoAtPos",value:function(e,r,a,s){var o=Fe.bufferInfo(e,r,s);if(o.len===0&&o.nextStart!==void 0){var l=this.fragmentTracker.getBufferedFrag(r,a);if(l&&(o.nextStart<=l.end||l.gap)){var u=Math.max(Math.min(o.nextStart,l.end)-r,s);return Fe.bufferInfo(e,r,u)}}return o}},{key:"getMaxBufferLength",value:function(e){var r=this.config,a;return e?a=Math.max(8*r.maxBufferSize/e,r.maxBufferLength):a=r.maxBufferLength,Math.min(a,r.maxMaxBufferLength)}},{key:"exceedsMaxBuffer",value:function(e,r,a){var s=e.nextStart;if(s&&a.start>s){var o=e.buffered;if(o){for(var l=e.len,u=e.bufferedIndex,c=o.length-1;c>u;c--)o[c].start<a.start&&(l+=o[c].end-o[c].start);return l>=r}}return!1}},{key:"reduceMaxBufferLength",value:function(e,r){var a=this.config,s=Math.max(Math.min(e-r,a.maxBufferLength),r),o=Math.max(e-r*3,a.maxMaxBufferLength/2,s);return o>=s?(a.maxMaxBufferLength=o,this.warn("Reduce max buffer length to ".concat(o,"s")),!0):!1}},{key:"getAppendedFrag",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:fe.MAIN,a=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,r):null;return a&&"fragment"in a?a.fragment:a}},{key:"getNextFragment",value:function(e,r){var a=r.fragments,s=a.length;if(!s)return null;var o=this.config,l=r.fragmentStart,u=o.lowLatencyMode&&!!r.partList,c=null;if(r.live){var f=o.initialLiveManifestSize;if(s<f)return this.warn("Not enough fragments to start playback (have: ".concat(s,", need: ").concat(f,")")),null;if(!r.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<l){var d;u&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),c=this.getInitialLiveFragment(r);var h=this.config.startPosition,v=this.hls.startPosition,m=this.hls.liveSyncPosition,p=((d=c)==null?void 0:d.start)||0,g,E;v!==-1&&v>=l?(g=v,E=v===h?"config":"next load start"):m!==null?(g=m,E="live edge"):(g=e,E="buffer pos"),g<p&&(g=p,E="live frag start"),g<l&&(g=l,E="playlist start"),(this.startPosition!=g||this.nextLoadPosition!=g)&&(this.log("Setting startPosition to ".concat(g.toFixed(3)," ").concat(v===-1?"":"(from ".concat(h,") "),"based on ").concat(E,". live edge: ").concat(m," live frag start: ").concat(p.toFixed(3)," playlist start: ").concat(l.toFixed(3)," buffer pos: ").concat(e)),this.startPosition=this.nextLoadPosition=g)}}else e<=l&&(c=a[0]);if(!c){var y=this.loadingParts?r.partEnd:r.fragmentEnd;c=this.getFragmentAtPosition(e,y,r)}var _=this.filterReplacedPrimary(c,r);if(!_&&c){var b=c.sn-r.startSN;_=this.filterReplacedPrimary(a[b+1]||null,r)}return this.mapToInitFragWhenRequired(_)}},{key:"isLoopLoading",value:function(e,r){if(this.nextLoadPosition<=r)return!1;var a=this.fragmentTracker.getState(e);return a===jt.OK||a===jt.PARTIAL&&!!e.gap}},{key:"getNextFragmentLoopLoading",value:function(e,r,a,s,o){var l=null;
1if(e.gap&&(l=this.getNextFragment(this.nextLoadPosition,r),l&&!l.gap&&a.nextStart)){var u=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,a.nextStart,s,0);if(u!==null&&a.len+u.len>=o){var c=l.sn;return this.loopSn!==c&&(this.log('buffer full after gaps in "'.concat(s,'" playlist starting at sn: ').concat(c)),this.loopSn=c),null}}return this.loopSn=void 0,l}},{key:"primaryPrefetch",get:function(){if(a_(this.config)){var e,r=(e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null?void 0:e.event;if(r)return!0}return!1}},{key:"filterReplacedPrimary",value:function(e,r){if(!e)return e;if(a_(this.config)&&e.type!==fe.SUBTITLE){var a=this.hls.interstitialsManager,s=a==null?void 0:a.bufferingItem;if(s){var o=s.event;if(o){if(o.appendInPlace||Math.abs(e.start-s.start)>1||s.start===0)return null}else if(e.end<=s.start&&(r==null?void 0:r.live)===!1||e.start>s.end&&s.nextEvent&&(s.nextEvent.appendInPlace||e.start-s.end>1))return null}var l=a==null?void 0:a.playerQueue;if(l)for(var u=l.length;u--;){var c=l[u].interstitial;if(c.appendInPlace&&e.start>=c.startTime&&e.end<=c.resumeTime)return null}}return e}},{key:"mapToInitFragWhenRequired",value:function(e){return e!=null&&e.initSegment&&!e.initSegment.data&&!this.bitrateTest?e.initSegment:e}},{key:"getNextPart",value:function(e,r,a){for(var s=-1,o=!1,l=!0,u=0,c=e.length;u<c;u++){var f=e[u];if(l=l&&!f.independent,s>-1&&a<f.start)break;var d=f.loaded;d?s=-1:(o||(f.independent||l)&&f.fragment===r)&&(f.fragment!==r&&this.warn("Need buffer at ".concat(a," but next unloaded part starts at ").concat(f.start)),s=u),o=d}return s}},{key:"loadedEndOfParts",value:function(e,r){for(var a,s=e.length;s--;){if(a=e[s],!a.loaded)return!1;if(r>a.start)return!0}return!1}},{key:"getInitialLiveFragment",value:function(e){var r=e.fragments,a=this.fragPrevious,s=null;if(a){if(e.hasProgramDateTime&&(s=yL(r,a.endProgramDateTime,this.config.maxFragLookUpTolerance),s&&this.log("Live playlist, switching playlist, load frag with same PDT: ".concat(a.programDateTime))),!s){var o=a.sn+1;if(o>=e.startSN&&o<=e.endSN){var l=r[o-e.startSN];a.cc===l.cc&&(s=l,this.log("Live playlist, switching playlist, load frag with next SN: ".concat(s.sn)))}s||(s=t0(e,a.cc,a.end),s&&this.log("Live playlist, switching playlist, load frag with same CC: ".concat(s.sn)))}}else{var u=this.hls.liveSyncPosition;u!==null&&(s=this.getFragmentAtPosition(u,this.bitrateTest?e.fragmentEnd:e.edge,e))}return s}},{key:"getFragmentAtPosition",value:function(e,r,a){var s=this.config,o=this.fragPrevious,l=a.fragments,u=a.endSN,c=a.fragmentHint,f=s.maxFragLookUpTolerance,d=a.partList,h=!!(this.loadingParts&&d!=null&&d.length&&c);h&&!this.bitrateTest&&d[d.length-1].fragment.sn===c.sn&&(l=l.concat(c),u=c.sn);var v;if(e<r){var m,p=e<this.lastCurrentTime,g=p||e>r-f||(m=this.media)!=null&&m.paused||!this.startFragRequested?0:f;v=gn(o,l,e,g)}else v=l[l.length-1];if(v){var E=v.sn-a.startSN,y=this.fragmentTracker.getState(v);if((y===jt.OK||y===jt.PARTIAL&&v.gap)&&(o=v),o&&v.sn===o.sn&&(!h||d[0].fragment.sn>v.sn||!a.live)){var _=v.level===o.level;if(_){var b=l[E+1];v.sn<u&&this.fragmentTracker.getState(b)!==jt.OK?v=b:v=null}}}return v}},{key:"alignPlaylists",value:function(e,r,a){var s=e.fragments.length;if(!s)return this.warn("No fragments in live playlist"),0;var o=e.fragmentStart,l=!r,u=e.alignedSliding&&ce(o);if(l||!u&&!o){tR(a,e);var c=e.fragmentStart;return this.log("Live playlist sliding: ".concat(c.toFixed(2)," start-sn: ").concat(r?r.startSN:"na","->").concat(e.startSN," fragments: ").concat(s)),c}return o}},{key:"waitForCdnTuneIn",value:function(e){var r=3;return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*r)}},{key:"setStartPosition",value:function(e,r){var a=this.startPosition;a<r&&(a=-1);var s=this.timelineOffset;if(a===-1){var o=this.startTimeOffset!==null,l=o?this.startTimeOffset:e.startTimeOffset;l!==null&&ce(l)?(a=r+l,l<0&&(a+=e.edge),a=Math.min(Math.max(r,a),r+e.totalduration),this.log("Setting startPosition to ".concat(a," for start time offset ").concat(l," found in ").concat(o?"multivariant":"media"," playlist")),this.startPosition=a):e.live?(a=this.hls.liveSyncPosition||r,this.log("Setting startPosition to -1 to start at live edge ".concat(a)),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=a=0),this.lastCurrentTime=a+s}this.nextLoadPosition=a+s}},{key:"getLoadPosition",value:function(){var e,r=this.media,a=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&r?a=r.currentTime:this.nextLoadPosition>=0&&(a=this.nextLoadPosition),a}},{key:"handleFragLoadAborted",value:function(e,r){this.transmuxer&&e.type===this.playlistType&&Rt(e)&&e.stats.aborted&&(this.log("Fragment ".concat(e.sn).c
1oncat(r?" part "+r.index:""," of ").concat(this.playlistLabel()," ").concat(e.level," was aborted")),this.resetFragmentLoading(e))}},{key:"resetFragmentLoading",value:function(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==re.FRAG_LOADING_WAITING_RETRY)&&(this.state=re.IDLE)}},{key:"onFragmentOrKeyLoadError",value:function(e,r){var a;if(r.chunkMeta&&!r.frag){var s=this.getCurrentContext(r.chunkMeta);s&&(r.frag=s.frag)}var o=r.frag;if(!(!o||o.type!==e||!this.levels)){if(this.fragContextChanged(o)){var l;this.warn("Frag load error must match current frag to retry ".concat(o.url," > ").concat((l=this.fragCurrent)==null?void 0:l.url));return}var u=r.details===K.FRAG_GAP;u&&this.fragmentTracker.fragBuffered(o,!0);var c=r.errorAction;if(!c){this.state=re.ERROR;return}var f=c.action,d=c.flags,h=c.retryCount,v=h===void 0?0:h,m=c.retryConfig,p=!!m,g=p&&f===Wt.RetryRequest,E=p&&!c.resolved&&d===Cr.MoveAllAlternatesMatchingHost,y=(a=this.hls.latestLevelDetails)==null?void 0:a.live;if(!g&&E&&Rt(o)&&!o.endList&&y&&!i0(r))this.resetFragmentErrors(e),this.treatAsGap(o),c.resolved=!0;else if((g||E)&&v<m.maxNumRetry){var _,b=Xc((_=r.response)==null?void 0:_.code),C=mf(m,v);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+C,this.state=re.FRAG_LOADING_WAITING_RETRY,c.resolved=!0,b){this.log("Waiting for connection (offline)"),this.retryDate=1/0,r.reason="offline";return}this.warn("Fragment ".concat(o.sn," of ").concat(e," ").concat(o.level," errored with ").concat(r.details,", retrying loading ").concat(v+1,"/").concat(m.maxNumRetry," in ").concat(C,"ms"))}else if(m)if(this.resetFragmentErrors(e),v<m.maxNumRetry)!u&&f!==Wt.RemoveAlternatePermanently&&(c.resolved=!0);else{this.warn("".concat(r.details," reached or exceeded max retry (").concat(v,")"));return}else f===Wt.SendAlternateToPenaltyBox?this.state=re.WAITING_LEVEL:this.state=re.ERROR;this.tickImmediate()}}},{key:"checkRetryDate",value:function(){var e=self.performance.now(),r=this.retryDate,a=r===1/0;(!r||e>=r||a&&!Xc(0))&&(a&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=re.IDLE)}},{key:"reduceLengthAndFlushBuffer",value:function(e){if(this.state===re.PARSING||this.state===re.PARSED){var r=e.frag,a=e.parent,s=this.getFwdBufferInfo(this.mediaBuffer,a),o=s&&s.len>.5;o&&this.reduceMaxBufferLength(s.len,(r==null?void 0:r.duration)||10);var l=!o;return l&&this.warn("Buffer full error while media.currentTime (".concat(this.getLoadPosition(),") is not buffered, flush ").concat(a," buffer")),r&&(this.fragmentTracker.removeFragment(r),this.nextLoadPosition=r.start),this.resetLoadingState(),l}return!1}},{key:"resetFragmentErrors",value:function(e){e===fe.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==re.STOPPED&&(this.state=re.IDLE)}},{key:"afterBufferFlushed",value:function(e,r,a){if(e){var s=Fe.getBuffered(e);this.fragmentTracker.detectEvictedFragments(r,s,a),this.state===re.ENDED&&this.resetLoadingState()}}},{key:"resetLoadingState",value:function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==re.STOPPED&&(this.state=re.IDLE)}},{key:"resetStartWhenNotLoaded",value:function(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;var e=this.levelLastLoaded,r=e?e.details:null;r!=null&&r.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(r,r.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}},{key:"resetWhenMissingContext",value:function(e){this.log("Loading context changed while buffering sn ".concat(e.sn," of ").concat(this.playlistLabel()," ").concat(e.level===-1?"<removed>":e.level,". This chunk will not be buffered.")),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}},{key:"removeUnbufferedFrags",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}},{key:"updateLevelTiming",value:function(e,r,a,s){var o=this,l=a.details;if(!l){this.warn("level.details undefined");return}var u=Object.keys(e.elementaryStreams).reduce(function(h,v){var m=e.elementaryStreams[v];if(m){var p=m.endPTS-m.startPTS;if(p<=0)return o.warn("Could not parse fragment ".concat(e.sn," ").concat(v," duration reliably (").concat(p,")")),h||!1;var g=s?0:d0(l,e,m.startPTS,m.endPTS,m.startDTS,m.endDTS,o);return o.hls.trigger(S.LEVEL_PTS_UPDATED,{details:l,level:a,drift:g,type:v,frag:e,start:m.startPTS,end:m.endPTS}),!0}return h},!1);if(!u){var c,f=((c=this.transmuxer)==null?void 0:c.error)===null;if((a.fragmentError===0||f&&(a.fragmentError<2||e.endList))&&this.treatAsGap(e,a),f){var d=new Error("Found no media in fragment ".concat(e.sn," of ").concat(this.playlistLabel()," ").concat(e.level," resetting transmuxer to fallback to playlist timing"));if(this.warn(d.message),this.hls.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!1,error:d,frag:e,reason:"Found no media in msn ".concat(e.sn," of ").concat(this.playlistLabel(),' "').concat(a.url,'"')}),!this.hls)return;this.resetTransmuxer()}}this.state=re.PARSED,this.log("Parsed ".concat(e.type," sn: ").concat(e.sn).c
1oncat(r?" part: "+r.index:""," of ").concat(this.fragInfo(e,!1,r),")")),this.hls.trigger(S.FRAG_PARSED,{frag:e,part:r})}},{key:"playlistLabel",value:function(){return this.playlistType===fe.MAIN?"level":"track"}},{key:"fragInfo",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,a=arguments.length>2?arguments[2]:void 0,s,o;return"".concat(this.playlistLabel()," ").concat(e.level," (").concat(a?"part":"frag",":[").concat(((s=r&&!a?e.startPTS:(a||e).start)!=null?s:NaN).toFixed(3),"-").concat(((o=r&&!a?e.endPTS:(a||e).end)!=null?o:NaN).toFixed(3),"]").concat(a&&e.type==="main"?"INDEPENDENT="+(a.independent?"YES":"NO"):"")}},{key:"treatAsGap",value:function(e,r){r&&r.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}},{key:"resetTransmuxer",value:function(){var e;(e=this.transmuxer)==null||e.reset()}},{key:"recoverWorkerError",value:function(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}},{key:"state",get:function(){return this._state},set:function(e){var r=this._state;r!==e&&(this._state=e,this.log("".concat(r,"->").concat(e)))}}]),i}(n0);E0=function(){function n(){k(this,n),this.chunks=[],this.dataLength=0}return A(n,[{key:"push",value:function(t){this.chunks.push(t),this.dataLength+=t.length}},{key:"flush",value:function(){var t=this.chunks,e=this.dataLength,r;if(t.length)t.length===1?r=t[0]:r=iR(t,e);else return new Uint8Array(0);return this.reset(),r}},{key:"reset",value:function(){this.chunks.length=0,this.dataLength=0}}]),n}();Rc={exports:{}};aR=nR(),Tf=OC(aR),Za="1.6.16",la={};vo=10,IR=10;Rr=function(n){return n.audioId3="org.id3",n.dateRange="com.apple.quicktime.HLS",n.emsg="https://aomedia.org/emsg/ID3",n.misbklv="urn:misb:KLV:bin:1910.1",n}({});If=function(){function n(){k(this,n),this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}return A(n,[{key:"resetInitSegment",value:function(t,e,r,a){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}},{key:"resetTimeStamp",value:function(t){this.initPTS=t,this.resetContiguity()}},{key:"resetContiguity",value:function(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}},{key:"canParse",value:function(t,e){return!1}},{key:"appendFrame",value:function(t,e,r){}},{key:"demux",value:function(t,e){this.cachedData&&(t=jr(this.cachedData,t),this.cachedData=null);var r=es(t,0),a=r?r.length:0,s,o=this._audioTrack,l=this._id3Track,u=r?Af(r):void 0,c=t.length;for((this.basePTS===null||this.frameIndex===0&&ce(u))&&(this.basePTS=LR(u,e,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),r&&r.length>0&&l.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:Rr.audioId3,duration:Number.POSITIVE_INFINITY});a<c;){if(this.canParse(t,a)){var f=this.appendFrame(o,t,a);f?(this.frameIndex++,this.lastPTS=f.sample.pts,a+=f.length,s=a):a=c}else pR(t,a)?(r=es(t,a),l.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:Rr.audioId3,duration:Number.POSITIVE_INFINITY}),a+=r.length,s=a):a++;if(a===c&&s!==c){var d=t.slice(s);this.cachedData?this.cachedData=jr(this.cachedData,d):this.cachedData=d}}return{audioTrack:o,videoTrack:li(),id3Track:l,textTrack:li()}}},{key:"demuxSampleAes",value:function(t,e,r){return Promise.reject(new Error("[".concat(this,"] This demuxer does not support Sample-AES decryption")))}},{key:"flush",value:function(t){var e=this.cachedData;return e&&(this.cachedData=null,this.demux(e,0)),{audioTrack:this._audioTrack,videoTrack:li(),id3Track:this._id3Track,textTrack:li()}}},{key:"destroy",value:function(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}]),n}(),LR=function(i,t,e){if(ce(i))return i*90;var r=e?e.baseTime*9e4/e.timescale:0;return t*9e4+r},po=null,RR=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],OR=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],wR=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],xR=[0,1,1,4];DR=function(n){B(i,n);function i(t,e){var r;return k(this,i),r=Xe(this,i),r.observer=void 0,r.config=void 0,r.observer=t,r.config=e,r}return A(i,[{key:"resetInitSegment",value:function(e,r,a,s){Ie(i,"resetInitSegment",this,3)([e,r,a,s]),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:r,duration:s,inputTimeScale:9e4,dropped:0}}},{key:"canParse",value:function(e,r){return dR(e,r)}},{key:"appendFrame",value:function(e,r,a){k0(e,this.observer,r,a,e.manifestCodec);var s=I0(e,r,a,this.basePTS,this.frameIndex);if(s&&s.missing===0)return s}}],[{key:"probe",value:function(e,r){if(!e)return!1;var a=es(e,0),s=(a==null?void 0:a.length)||0;if(x0(e,s))return!1;for(var o=e.length;s<o;s++)if(hR(e,s))return r.log("ADTS sync word found !"),!0;return!1}}]),i}(If),P0=function(i,t){var e=0,r=5;t+=r;for(var a=new Uint32Array(1),s=new Uint32Array(1),o=new Uint8Array(1);r>0;){o[0]=i[t];var l=Math.min(r,8),u=8-l;s[0]=4278190080>>>24+u<<u,a[0]=(o[0]&s[0])>>u,e=e?e<<l|a[0]:a[0],t+=1,r-=l}return e},MR=function(n){B(i,n);function i(t){var e;return k(this,i),e=Xe(this,i),e.observer=void 0,e.observer=t,e}return A(i,[{key:"resetInitSegment",value:function(e,r,a,s){Ie(i,"resetInitSegment",this,3)([e,r,a,s]),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:r,duration:s,inputTimeScale:9e4,dropped:0}}},{key:"canParse",value:function(e,r){return r+64<e.length}},{key:"appendFrame",value:function(e,r,a){var s=D0(e,r,a,this.basePTS,this.frameIndex);if(s!==-1){var o=e.samples[e.samples.length-1];return{sample:o,length:s,missing:0}}}}],[{key:"probe",value:function(e){if(!e)return!1;var r=es(e,0);if(!r)return!1;var a=r.length;return e[a]===11&&e[a+1]===119&&Af(r)!==void 0&&P0(e,a)<16}}]),i}(If);NR=function(n){B(i,n);function i(){return k(this,i),Xe(this,i,arguments)}return A(i,[{key:"resetInitSegment",value:function(e,r,a,s){Ie(i,"resetInitSegment",this,3)([e,r,a,s]),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:r,duration:s,inputTimeScale:9e4,dropped:0}}},{key:"canParse",value:function(e,r){return PR(e,r)}},{key:"appendFrame",value:function(e,r,a){if(this.basePTS!==null)return R0(e,r,a,this.basePTS,this.frameIndex)}}],[{key:"probe",value:function(e){if(!e)return!1;var r=es(e,0),a=(r==null?void 0:r.length)||0;if(r&&e[a]===11&&e[a+1]===119&&Af(r)!==void 0&&P0(e,a)<=16)return!1;for(var s=e.length;a<s;a++)if(x0(e,a))return tt.log("MPEG Audio sync word found !"),!0;return!1}}]),i}(If),FR=/\/emsg[-/]ID3/i,UR=function(){function n(i,t){k(this,n),this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}return A(n,[{key:"resetTimeStamp",value:function(){}},{key:"resetInitSegment",value:function(t,e,r,a){var s=this.videoTrack=li("video",1),o=this.audioTrack=li("audio",1),l=this.txtTrack=li("text",1);if(this.id3Track=li("id3",1),this.timeOffset=0,!!(t!=null&&t.byteLength)){var u=K_(t);if(u.video){var c=u.video,f=c.id,d=c.timescale,h=c.codec,v=c.supplemental;
1s.id=f,s.timescale=l.timescale=d,s.codec=h,s.supplemental=v}if(u.audio){var m=u.audio,p=m.id,g=m.timescale,E=m.codec;o.id=p,o.timescale=g,o.codec=E}l.id=j_.text,s.sampleDuration=0,s.duration=o.duration=a}}},{key:"resetContiguity",value:function(){this.remainderData=null}},{key:"demux",value:function(t,e){this.timeOffset=e;var r=t,a=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(r=jr(this.remainderData,t));var o=HC(r);this.remainderData=o.remainder,a.samples=o.valid||new Uint8Array}else a.samples=r;var l=this.extractID3Track(a,e);return s.samples=ky(e,a),{videoTrack:a,audioTrack:this.audioTrack,id3Track:l,textTrack:this.txtTrack}}},{key:"flush",value:function(){var t=this.timeOffset,e=this.videoTrack,r=this.txtTrack;e.samples=this.remainderData||new Uint8Array,this.remainderData=null;var a=this.extractID3Track(e,this.timeOffset);return r.samples=ky(t,e),{videoTrack:e,audioTrack:li(),id3Track:a,textTrack:li()}}},{key:"extractID3Track",value:function(t,e){var r=this,a=this.id3Track;if(t.samples.length){var s=Ne(t.samples,["emsg"]);s&&s.forEach(function(o){var l=KC(o);if(FR.test(l.schemeIdUri)){var u=o_(l,e),c=l.eventDuration===4294967295?Number.POSITIVE_INFINITY:l.eventDuration/l.timeScale;c<=.001&&(c=Number.POSITIVE_INFINITY);var f=l.payload;a.samples.push({data:f,len:f.byteLength,dts:u,pts:u,type:Rr.emsg,duration:c})}else if(r.config.enableEmsgKLVMetadata&&l.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){var d=o_(l,e);a.samples.push({data:l.payload,len:l.payload.byteLength,dts:d,pts:d,type:Rr.misbklv,duration:Number.POSITIVE_INFINITY})}})}return a}},{key:"demuxSampleAes",value:function(t,e,r){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}},{key:"destroy",value:function(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}}],[{key:"probe",value:function(t){return MC(t)}}]),n}();BR=function(){function n(i,t,e){k(this,n),this.keyData=void 0,this.decrypter=void 0,this.keyData=e,this.decrypter=new gf(t,{removePKCS7Padding:!1})}return A(n,[{key:"decryptBuffer",value:function(t){return this.decrypter.decrypt(t,this.keyData.key.buffer,this.keyData.iv.buffer,Yi.cbc)}},{key:"decryptAacSample",value:function(t,e,r){var a=this,s=t[e].unit;if(!(s.length<=16)){var o=s.subarray(16,s.length-s.length%16),l=o.buffer.slice(o.byteOffset,o.byteOffset+o.length);this.decryptBuffer(l).then(function(u){var c=new Uint8Array(u);s.set(c,16),a.decrypter.isSync()||a.decryptAacSamples(t,e+1,r)}).catch(r)}}},{key:"decryptAacSamples",value:function(t,e,r){for(;;e++){if(e>=t.length){r();return}if(!(t[e].unit.length<32)&&(this.decryptAacSample(t,e,r),!this.decrypter.isSync()))return}}},{key:"getAvcEncryptedData",value:function(t){for(var e=Math.floor((t.length-48)/160)*16+16,r=new Int8Array(e),a=0,s=32;s<t.length-16;s+=160,a+=16)r.set(t.subarray(s,s+16),a);return r}},{key:"getAvcDecryptedUnit",value:function(t,e){for(var r=new Uint8Array(e),a=0,s=32;s<t.length-16;s+=160,a+=16)t.set(r.subarray(a,a+16),s);return t}},{key:"decryptAvcSample",value:function(t,e,r,a,s){var o=this,l=Y_(s.data),u=this.getAvcEncryptedData(l);this.decryptBuffer(u.buffer).then(function(c){s.data=o.getAvcDecryptedUnit(l,c),o.decrypter.isSync()||o.decryptAvcSamples(t,e,r+1,a)}).catch(a)}},{key:"decryptAvcSamples",value:function(t,e,r,a){if(t instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;e++,r=0){if(e>=t.length){a();return}for(var s=t[e].units;!(r>=s.length);r++){var o=s[r];if(!(o.data.length<=48||o.type!==1&&o.type!==5)&&(this.decryptAvcSample(t,e,r,a,o),!this.decrypter.isSync()))return}}}}]),n}(),M0=function(){function n(){k(this,n),this.VideoSample=null}return A(n,[{key:"createVideoSample",value:function(t,e,r){return{key:t,frame:!1,pts:e,dts:r,units:[],length:0}}},{key:"getLastNalUnit",value:function(t){var e,r=this.VideoSample,a;if((!r||r.units.length===0)&&(r=t[t.length-1]),(e=r)!=null&&e.units){var s=r.units;a=s[s.length-1]}return a}},{key:"pushAccessUnit",value:function(t,e){if(t.units.length&&t.frame){if(t.pts===void 0){var r=e.samples,a=r.length;if(a){var s=r[a-1];t.pts=s.pts,t.dts=s.dts}else{e.dropped++;return}}e.samples.push(t)}}},{key:"parseNALu",value:function(t,e,r){var a=e.byteLength,s=t.naluState||0,o=s,l=[],u=0,c,f,d,h=-1,v=0;for(s===-1&&(h=0,v=this.getNALuType(e,0),s=0,u=1);u<a;){if(c=e[u++],!s){s=c?0:1;continue}if(s===1){s=c?0:2;continue}if(!c)s=3;else if(c===1){if(f=u-s-1,h>=0){var m={data:e.subarray(h,f),type:v};l.push(m)}else{var p=this.getLastNalUnit(t.samples);p&&(o&&u<=4-o&&p.state&&(p.data=p.data.subarray(0,p.data.byteLength-o)),f>0&&(p.data=jr(p.data,e.subarray(0,f)),p.state=0))}u<a?(d=this.getNALuType(e,u),h=u,v=d,s=0):s=-1}else s=0}if(h>=0&&s>=0){var g={data:e.subarray(h,a),type:v,state:s};l.push(g)}if(l.length===0){var E=this.getLastNalUnit(t.samples);E&&(E.data=jr(E.data,e))}return t.naluState=s,l}}]),n}(),za=function(){function n(i){k(this,n),this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=i,this.bytesAvailable=i.byteLength,this.word=0,this.bitsAvailable=0}return A(n,[{key:"loadWord",value:function(){var t=this.data,e=this.bytesAvailable,r=t.byteLength-e,a=new Uint8Array(4),s=Math.min(4,e);if(s===0)throw new Error("no bytes available");a.set(t.subarray(r,r+s)),this.word=new DataView(a.buffer).getUint32(0),this.bitsAvailable=s*8,this.bytesAvailable-=s}},{key:"skipBits",value:function(t){var e;t=Math.min(t,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>t?(this.word<<=t,this.bitsAvailable-=t):(t-=this.bitsAvailable,e=t>>3,t-=e<<3,this.bytesAvailable-=e,this.loadWord(),this.word<<=t,this.bitsAvailable-=t)}},{key:"readBits",value:function(t){var e=Math.min(this.bitsAvailable,t),r=this.word>>>32-e;if(t>32&&tt.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0)this.word<<=e;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return e=t-e,e>0&&this.bitsAvailable?r<<e|this.readBits(e):r}},{key:"skipLZ",value:function(){var t;for(t=0;t<this.bitsAvailable;++t)if(this.word&2147483648>>>t)return this.word<<=t,this.bitsAvailable-=t,t;return this.loadWord(),t+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"skipEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var t=this.skipLZ();return this.readBits(t+1)-1}},{key:"readEG",value:function(){var t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)}},{key:"readBoolean",value:function(){return this.readBits(1)===1}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"readUShort",value:function(){return this.readBits(16)}},{key:"readUInt",value:function(){return this.readBits(32)}}]),n}(),GR=function(n){B(i,n);function i(){return k(this,i),Xe(this,i,arguments)}return A(i,[{key:"parsePES",value:function(e,r,a,s){var o=this,l=this.parseNALu(e,a.data,s),u=this.VideoSample,c,f=!1;a.data=null,u&&l.length&&!e.audFound&&(this.pushAccessUnit(u,e),u=this.VideoSample=this.createVideoSample(!1,a.pts,a.dts)),l.forEach(function(d){var h,v;switch(d.type){case 1:{var m=!1;c=!0;var p=d.data;if(f&&p.length>4){var g=o.readSliceType(p);(g===2||g===4||g===7||g===9)&&(m=!0)}if(m){var E;(E=u)!=null&&E.frame&&!u.key&&(o.pushAccessUnit(u,e),u=o.VideoSample=null)}u||(u=o.VideoSample=o.createVideoSample(!0,a.pts,a.dts)),u.frame=!0,u.key=m;break}case 5:c=!0,(h=u)!=null&&h.frame&&!u.key&&(o.pushAccessUnit(u,e),u=o.VideoSample=null),u||(u=o.VideoSample=o.createVideoSample(!0,a.pts,a.dts)),u.key=!0,u.frame=!0;break;case 6:{c=!0,hf(d.data,1,a.pts,r.samples);break}case 7:{var y,_;c=!0,f=!0;var b=d.data,C=o.readSPS(b);if(!e.sps||e.width!==C.width||e.height!==C.height||((y=e.pixelRatio)==null?void 0:y[0])!==C.pixelRatio[0]||((_=e.pixelRatio)==null?void 0:_[1])!==C.pixelRatio[1]){e.width=C.width,e.height=C.height,e.pixelRatio=C.pixelRatio,e.sps=[b];for(var R=b.subarray(1,4),M="avc1.",D=0;D<3;D++){var L=R[D].toString(16);L.length<2&&(L="0"+L),M+=L}e.codec=M}break}case 8:c=!0,e.pps=[d.data];break;case 9:c=!0,e.audFound=!0,(v=u)!=null&&v.frame&&(o.pushAccessUnit(u,e),u=null),u||(u=o.VideoSample=o.createVideoSample(!1,a.pts,a.dts));break;case 12:c=!0;break;default:c=!1;break}if(u&&c){var O=u.units;O.push(d)}}),s&&u&&(this.pushAccessUnit(u,e),this.VideoSample=null)}},{key:"getNALuType",value:function(e,r){return e[r]&31}},{key:"readSliceType",value:function(e){var r=new za(e);return r.readUByte(),r.readUEG(),r.readUEG()}},{key:"skipScalingList",value:function(e,r){for(var a=8,s=8,o,l=0;l<e;l++)s!==0&&(o=r.readEG(),s=(a+o+256)%256),a=s===0?a:s}},{key:"readSPS",value:function(e){var r=new za(e),a=0,s=0,o=0,l=0,u,c,f,d=r.readUByte.bind(r),h=r.readBits.bind(r),v=r.readUEG.bind(r),m=r.readBoolean.bind(r),p=r.skipBits.bind(r),g=r.skipEG.bind(r),E=r.skipUEG.bind(r),y=this.skipScalingList.bind(this);d();var _=d();if(h(5),p(3),d(),E(),_===100||_===110||_===122||_===244||_===44||_===83||_===86||_===118||_===128){var b=v();if(b===3&&p(1),E(),E(),p(1),m())for(c=b!==3?8:12,f=0;f<c;f++)m()&&(f<6?y(16,r):y(64,r))}E();var C=v();if(C===0)v();else if(C===1)for(p(1),g(),g(),u=v(),f=0;f<u;f++)g();E(),p(1);var R=v(),M=v(),D=h(1);D===0&&p(1),p(1),m()&&(a=v(),s=v(),o=v(),l=v());var L=[1,1];if(m()&&m()){var O=d();switch(O){case 1:L=[1,1];break;case 2:L=[12,11];break;case 3:L=[10,11];break;case 4:L=[16,11];break;case 5:L=[40,33];break;case 6:L=[24,11];break;case 7:L=[20,11];break;case 8:L=[32,11];break;case 9:L=[80,33];break;case 10:L=[18,11];break;case 11:L=[15,11];break;case 12:L=[64,33];break;case 13:L=[160,99];break;case 14:L=[4,3];break;case 15:L=[3,2];break;case 16:L=[2,1];break;case 255:{L=[d()<<8|d(),d()<<8|d()];break}}}return{width:Math.ceil((R+1)*16-a*2-s*2),height:(2-D)*(M+1)*16-(D?2:4)*(o+l),pixelRatio:L}}}]),i}(M0),jR=function(n){B(i,n);function i(){var t;k(this,i);for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];return t=Xe(this,i,[].concat(r)),t.initVPS=null,t}return A(i,[{key:"parsePES",value:function(e,r,a,s){var o=this,l=this.parseNALu(e,a.data,s),u=this.VideoSample,c,f=!1;a.data=null,u&&l.length&&!e.audFound&&(this.pushAccessUnit(u,e),u=this.VideoSample=this.createVideoSample(!1,a.pts,a.dts)),l.forEach(function(d){var h,v;
1switch(d.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:u||(u=o.VideoSample=o.createVideoSample(!1,a.pts,a.dts)),u.frame=!0,c=!0;break;case 16:case 17:case 18:case 21:if(c=!0,f){var m;(m=u)!=null&&m.frame&&!u.key&&(o.pushAccessUnit(u,e),u=o.VideoSample=null)}u||(u=o.VideoSample=o.createVideoSample(!0,a.pts,a.dts)),u.key=!0,u.frame=!0;break;case 19:case 20:c=!0,(h=u)!=null&&h.frame&&!u.key&&(o.pushAccessUnit(u,e),u=o.VideoSample=null),u||(u=o.VideoSample=o.createVideoSample(!0,a.pts,a.dts)),u.key=!0,u.frame=!0;break;case 39:c=!0,hf(d.data,2,a.pts,r.samples);break;case 32:c=!0,e.vps||(pe(e.params)!=="object"&&(e.params={}),e.params=nt(e.params,o.readVPS(d.data)),o.initVPS=d.data),e.vps=[d.data];break;case 33:if(c=!0,f=!0,e.vps!==void 0&&e.vps[0]!==o.initVPS&&e.sps!==void 0&&!o.matchSPS(e.sps[0],d.data)&&(o.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){var p=o.readSPS(d.data);e.width=p.width,e.height=p.height,e.pixelRatio=p.pixelRatio,e.codec=p.codecString,e.sps=[],pe(e.params)!=="object"&&(e.params={});for(var g in p.params)e.params[g]=p.params[g]}o.pushParameterSet(e.sps,d.data,e.vps),u||(u=o.VideoSample=o.createVideoSample(!0,a.pts,a.dts)),u.key=!0;break;case 34:if(c=!0,pe(e.params)==="object"){if(!e.pps){e.pps=[];var E=o.readPPS(d.data);for(var y in E)e.params[y]=E[y]}o.pushParameterSet(e.pps,d.data,e.vps)}break;case 35:c=!0,e.audFound=!0,(v=u)!=null&&v.frame&&(o.pushAccessUnit(u,e),u=null),u||(u=o.VideoSample=o.createVideoSample(!1,a.pts,a.dts));break;default:c=!1;break}if(u&&c){var _=u.units;_.push(d)}}),s&&u&&(this.pushAccessUnit(u,e),this.VideoSample=null)}},{key:"pushParameterSet",value:function(e,r,a){(a&&a[0]===this.initVPS||!a&&!e.length)&&e.push(r)}},{key:"getNALuType",value:function(e,r){return(e[r]&126)>>>1}},{key:"ebsp2rbsp",value:function(e){for(var r=new Uint8Array(e.byteLength),a=0,s=0;s<e.byteLength;s++)s>=2&&e[s]===3&&e[s-1]===0&&e[s-2]===0||(r[a]=e[s],a++);return new Uint8Array(r.buffer,0,a)}},{key:"pushAccessUnit",value:function(e,r){Ie(i,"pushAccessUnit",this,3)([e,r]),this.initVPS&&(this.initVPS=null)}},{key:"readVPS",value:function(e){var r=new za(e);r.readUByte(),r.readUByte(),r.readBits(4),r.skipBits(2),r.readBits(6);var a=r.readBits(3),s=r.readBoolean();return{numTemporalLayers:a+1,temporalIdNested:s}}},{key:"readSPS",value:function(e){var r=new za(this.ebsp2rbsp(e));r.readUByte(),r.readUByte(),r.readBits(4);var a=r.readBits(3);r.readBoolean();for(var s=r.readBits(2),o=r.readBoolean(),l=r.readBits(5),u=r.readUByte(),c=r.readUByte(),f=r.readUByte(),d=r.readUByte(),h=r.readUByte(),v=r.readUByte(),m=r.readUByte(),p=r.readUByte(),g=r.readUByte(),E=r.readUByte(),y=r.readUByte(),_=[],b=[],C=0;C<a;C++)_.push(r.readBoolean()),b.push(r.readBoolean());if(a>0)for(var R=a;R<8;R++)r.readBits(2);for(var M=0;M<a;M++)_[M]&&(r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte()),b[M]&&r.readUByte();r.readUEG();var D=r.readUEG();D==3&&r.skipBits(1);var L=r.readUEG(),O=r.readUEG(),x=r.readBoolean(),Y=0,$=0,Z=0,N=0;x&&(Y+=r.readUEG(),$+=r.readUEG(),Z+=r.readUEG(),N+=r.readUEG());for(var j=r.readUEG(),z=r.readUEG(),ee=r.readUEG(),U=r.readBoolean(),F=U?0:a;F<=a;F++)r.skipUEG(),r.skipUEG(),r.skipUEG();r.skipUEG(),r.skipUEG(),r.skipUEG(),r.skipUEG(),r.skipUEG(),r.skipUEG();var H=r.readBoolean();if(H){var G=r.readBoolean();if(G)for(var ve=0;ve<4;ve++)for(var ye=0;ye<(ve===3?2:6);ye++){var Ee=r.readBoolean();if(!Ee)r.readUEG();else{var Ce=Math.min(64,1<<4+(ve<<1));ve>1&&r.readEG();for(var Ye=0;Ye<Ce;Ye++)r.readEG()}}}r.readBoolean(),r.readBoolean();var ot=r.readBoolean();ot&&(r.readUByte(),r.skipUEG(),r.skipUEG(),r.readBoolean());for(var Ue=r.readUEG(),yt=0,Le=0;Le<Ue;Le++){var _t=!1;if(Le!==0&&(_t=r.readBoolean()),_t){Le===Ue&&r.readUEG(),r.readBoolean(),r.readUEG();for(var wt=0,xt=0;xt<=yt;xt++){var qt=r.readBoolean(),lt=!1;qt||(lt=r.readBoolean()),(qt||lt)&&wt++}yt=wt}else{var Sr=r.readUEG(),cr=r.readUEG();yt=Sr+cr;for(var Nt=0;Nt<Sr;Nt++)r.readUEG(),r.readBoolean();for(var Ft=0;Ft<cr;Ft++)r.readUEG(),r.readBoolean()}}var Pt=r.readBoolean();if(Pt)for(var Ji=r.readUEG(),Tr=0;Tr<Ji;Tr++){for(var Xi=0;Xi<ee+4;Xi++)r.readBits(1);r.readBits(1)}var fa=0,da=1,Qi=1,Ii=!0,ha=1,$i=0;r.readBoolean(),r.readBoolean();var os=!1,va=r.readBoolean();if(va){var $o=r.readBoolean();if($o){var Ci=r.readUByte(),pa=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],br=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Ci>0&&Ci<16?(da=pa[Ci-1],Qi=br[Ci-1]):Ci===255&&(da=r.readBits(16),Qi=r.readBits(16))}var ls=r.readBoolean();ls&&r.readBoolean();var us=r.readBoolean();if(us){r.readBits(3),r.readBoolean();var Zo=r.readBoolean();Zo&&(r.readUByte(),r.readUByte(),r.readUByte())}var el=r.readBoolean();el&&(r.readUEG(),r.readUEG()),r.readBoolean(),r.readBoolean(),r.readBoolean(),os=r.readBoolean(),os&&(r.skipUEG(),r.skipUEG(),r.skipUEG(),r.skipUEG());var tl=r.readBoolean();if(tl){ha=r.readBits(32),$i=r.readBits(32);var rl=r.readBoolean();rl&&r.readUEG();var il=r.readBoolean();if(il){var cs=r.readBoolean(),Zi=r.readBoolean(),Li=!1;(cs||Zi)&&(Li=r.readBoolean(),Li&&(r.readUByte(),r.readBits(5),r.readBoolean(),r.readBits(5)),r.readBits(4),r.readBits(4),Li&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(var fs=0;fs<=a;fs++){Ii=r.readBoolean();var nl=Ii||r.readBoolean(),id=!1;nl?r.readEG():id=r.readBoolean();var nd=id?1:r.readUEG()+1;if(cs)for(var ad=0;ad<nd;ad++)r.readUEG(),r.readUEG(),Li&&(r.readUEG(),r.readUEG()),r.skipBits(1);if(Zi)for(var sd=0;sd<nd;sd++)r.readUEG(),r.readUEG(),Li&&(r.readUEG(),r.readUEG()),r.skipBits(1)}}}var US=r.readBoolean();US&&(r.readBoolean(),r.readBoolean(),r.readBoolean(),fa=r.readUEG())}var od=L,ld=O;if(x){var ds=1,al=1;D===1?ds=al=2:D==2&&(ds=2),od=L-ds*$-ds*Y,ld=O-al*N-al*Z}for(var BS=s?["A","B","C"][s]:"",GS=u<<24|c<<16|f<<8|d,sl=0,hs=0;hs<32;hs++)sl=(sl|(GS>>hs&1)<<31-hs)>>>0;var ol=sl.toString(16);l===1&&ol==="2"&&(ol="6");var jS=o?"H":"L";return{codecString:"hvc1.".concat(BS).concat(l,".").concat(ol,".").concat(jS).concat(y,".B0"),params:{general_tier_flag:o,general_profile_idc:l,general_profile_space:s,general_profile_compatibility_flags:[u,c,f,d],general_constraint_indicator_flags:[h,v,m,p,g,E],general_level_idc:y,bit_depth:j+8,bit_depth_luma_minus8:j,bit_depth_chroma_minus8:z,min_spatial_segmentation_idc:fa,chroma_format_idc:D,frame_rate:{fixed:Ii,fps:$i/ha}},width:od,height:ld,pixelRatio:[da,Qi]}}},{key:"readPPS",value:function(e){var r=new za(this.ebsp2rbsp(e));r.readUByte(),r.readUByte(),r.skipUEG(),r.skipUEG(),r.skipBits(2),r.ski
1pBits(3),r.skipBits(2),r.skipUEG(),r.skipUEG(),r.skipEG(),r.skipBits(2);var a=r.readBoolean();a&&r.skipUEG(),r.skipEG(),r.skipEG(),r.skipBits(4);var s=r.readBoolean(),o=r.readBoolean(),l=1;return o&&s?l=0:o?l=3:s&&(l=2),{parallelismType:l}}},{key:"matchSPS",value:function(e,r){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,r).substr(3)}}]),i}(M0),Kt=188,HR=function(){function n(i,t,e,r){k(this,n),this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=i,this.config=t,this.typeSupported=e,this.logger=r,this.videoParser=null}return A(n,[{key:"resetInitSegment",value:function(t,e,r,a){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=n.createTrack("video"),this._videoTrack.duration=a,this._audioTrack=n.createTrack("audio",a),this._id3Track=n.createTrack("id3"),this._txtTrack=n.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=e,this.videoCodec=r}},{key:"resetTimeStamp",value:function(){}},{key:"resetContiguity",value:function(){var t=this._audioTrack,e=this._videoTrack,r=this._id3Track;t&&(t.pesData=null),e&&(e.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.remainderData=null}},{key:"demux",value:function(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;r||(this.sampleAes=null);var s,o=this._videoTrack,l=this._audioTrack,u=this._id3Track,c=this._txtTrack,f=o.pid,d=o.pesData,h=l.pid,v=u.pid,m=l.pesData,p=u.pesData,g=null,E=this.pmtParsed,y=this._pmtId,_=t.length;if(this.remainderData&&(t=jr(this.remainderData,t),_=t.length,this.remainderData=null),_<Kt&&!a)return this.remainderData=t,{audioTrack:l,videoTrack:o,id3Track:u,textTrack:c};var b=Math.max(0,n.syncOffset(t));_-=(_-b)%Kt,_<t.byteLength&&!a&&(this.remainderData=new Uint8Array(t.buffer,_,t.buffer.byteLength-_));for(var C=0,R=b;R<_;R+=Kt)if(t[R]===71){var M=!!(t[R+1]&64),D=tf(t,R),L=(t[R+3]&48)>>4,O=void 0;if(L>1){if(O=R+5+t[R+4],O===R+Kt)continue}else O=R+4;switch(D){case f:M&&(d&&(s=Zn(d,this.logger))&&(this.readyVideoParser(o.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(o,c,s,!1)),d={data:[],size:0}),d&&(d.data.push(t.subarray(O,R+Kt)),d.size+=R+Kt-O);break;case h:if(M){if(m&&(s=Zn(m,this.logger)))switch(l.segmentCodec){case"aac":this.parseAACPES(l,s);break;case"mp3":this.parseMPEGPES(l,s);break;case"ac3":this.parseAC3PES(l,s);break}m={data:[],size:0}}m&&(m.data.push(t.subarray(O,R+Kt)),m.size+=R+Kt-O);break;case v:M&&(p&&(s=Zn(p,this.logger))&&this.parseID3PES(u,s),p={data:[],size:0}),p&&(p.data.push(t.subarray(O,R+Kt)),p.size+=R+Kt-O);break;case 0:M&&(O+=t[O]+1),y=this._pmtId=VR(t,O);break;case y:{M&&(O+=t[O]+1);var x=KR(t,O,this.typeSupported,r,this.observer,this.logger);f=x.videoPid,f>0&&(o.pid=f,o.segmentCodec=x.segmentVideoCodec),h=x.audioPid,h>0&&(l.pid=h,l.segmentCodec=x.segmentAudioCodec),v=x.id3Pid,v>0&&(u.pid=v),g!==null&&!E&&(this.logger.warn("MPEG-TS PMT found at ".concat(R," after unknown PID '").concat(g,"'. Backtracking to sync byte @").concat(b," to parse all TS packets.")),g=null,R=b-188),E=this.pmtParsed=!0;break}case 17:case 8191:break;default:g=D;break}}else C++;C>0&&rf(this.observer,new Error("Found ".concat(C," TS packet/s that do not start with 0x47")),void 0,this.logger),o.pesData=d,l.pesData=m,u.pesData=p;var Y={audioTrack:l,videoTrack:o,id3Track:u,textTrack:c};return a&&this.extractRemainingSamples(Y),Y}},{key:"flush",value:function(){var t=this.remainderData;this.remainderData=null;var e;return t?e=this.demux(t,-1,!1,!0):e={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(e),this.sampleAes?this.decrypt(e,this.sampleAes):e}},{key:"extractRemainingSamples",value:function(t){var e=t.audioTrack,r=t.videoTrack,a=t.id3Track,s=t.textTrack,o=r.pesData,l=e.pesData,u=a.pesData,c;if(o&&(c=Zn(o,this.logger))?(this.readyVideoParser(r.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(r,s,c,!0),r.pesData=null)):r.pesData=o,l&&(c=Zn(l,this.logger))){switch(e.segmentCodec){case"aac":this.parseAACPES(e,c);break;case"mp3":this.parseMPEGPES(e,c);break;case"ac3":this.parseAC3PES(e,c);break}e.pesData=null}else l!=null&&l.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),e.pesData=l;u&&(c=Zn(u,this.logger))?(this.parseID3PES(a,c),a.pesData=null):a.pesData=u}},{key:"demuxSampleAes",value:function(t,e,r){var a=this.demux(t,r,!0,!this.config.progressive),s=this.sampleAes=new BR(this.observer,this.config,e);return this.decrypt(a,s)}},{key:"readyVideoParser",value:function(t){this.videoParser===null&&(t==="avc"?this.videoParser=new GR:t==="hevc"&&(this.videoParser=new jR))}},{key:"decrypt",value:function(t,e){return new Promise(function(r){var a=t.audioTrack,s=t.videoTrack;a.samples&&a.segmentCodec==="aac"?e.decryptAacSamples(a.samples,0,function(){s.samples?e.decryptAvcSamples(s.samples,0,0,function(){r(t)}):r(t)}):s.samples&&e.decryptAvcSamples(s.samples,0,0,function(){r(t)})})}},{key:"destroy",value:function(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}},{key:"parseAACPES",value:function(t,e){var r=0,a=this.aacOverFlow,s=e.data;if(a){this.aacOverFlow=null;var o=a.missing,l=a.sample.unit.byteLength;if(o===-1)s=jr(a.sample.unit,s);else{var u=l-o;a.sample.unit.set(s.subarray(0,o),u),t.samples.push(a.sample),r=a.missing}}var c,f;for(c=r,f=s.length;c<f-1&&!Ho(s,c);c++);if(c!==r){var d,h=c<f-1;
1if(h?d="AAC PES did not start with ADTS header,offset:".concat(c):d="No ADTS header found in AAC PES",rf(this.observer,new Error(d),h,this.logger),!h)return}k0(t,this.observer,s,c,this.audioCodec);var v;if(e.pts!==void 0)v=e.pts;else if(a){var m=A0(t.samplerate);v=a.sample.pts+m}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var p=0,g;c<f;)if(g=I0(t,s,c,v,p),c+=g.length,g.missing){this.aacOverFlow=g;break}else for(p++;c<f-1&&!Ho(s,c);c++);}},{key:"parseMPEGPES",value:function(t,e){var r=e.data,a=r.length,s=0,o=0,l=e.pts;if(l===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<a;)if(w0(r,o)){var u=R0(t,r,o,l,s);if(u)o+=u.length,s++;else break}else o++}},{key:"parseAC3PES",value:function(t,e){{var r=e.data,a=e.pts;if(a===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}for(var s=r.length,o=0,l=0,u;l<s&&(u=D0(t,r,l,a,o++))>0;)l+=u}}},{key:"parseID3PES",value:function(t,e){if(e.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}var r=nt({},e,{type:this._videoTrack?Rr.emsg:Rr.audioId3,duration:Number.POSITIVE_INFINITY});t.samples.push(r)}}],[{key:"probe",value:function(t,e){var r=n.syncOffset(t);return r>0&&e.warn("MPEG2-TS detected but first sync word found @ offset ".concat(r)),r!==-1}},{key:"syncOffset",value:function(t){for(var e=t.length,r=Math.min(Kt*5,e-Kt)+1,a=0;a<r;){for(var s=!1,o=-1,l=0,u=a;u<e;u+=Kt)if(t[u]===71&&(e-u===Kt||t[u+Kt]===71)){if(l++,o===-1&&(o=u,o!==0&&(r=Math.min(o+Kt*99,t.length-Kt)+1)),s||(s=tf(t,u)===0),s&&l>1&&(o===0&&l>2||u+Kt>r))return o}else{if(l)return-1;break}a++}return-1}},{key:"createTrack",value:function(t,e){return{container:t==="video"||t==="audio"?"video/mp2t":void 0,type:t,id:j_[t],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:t==="audio"?e:void 0}}}]),n}();WR=function(){function n(){k(this,n)}return A(n,null,[{key:"getSilentFrame",value:function(t,e){switch(t){case"mp4a.40.2":if(e===1)return new Uint8Array([0,200,0,128,35,128]);if(e===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(e===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(e===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(e===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(e===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(e===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(e===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(e===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}]),n}(),Vi=Math.pow(2,32)-1,ir=function(){function n(){k(this,n)}return A(n,null,[{key:"init",value:function(){n.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var t;for(t in n.types)n.types.hasOwnProperty(t)&&(n.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var e=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),r=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);n.HDLR_TYPES={video:e,audio:r};var a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),s=new Uint8Array([0,0,0,0,0,0,0,0]);n.STTS=n.STSC=n.STCO=s,n.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),n.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),n.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),n.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var o=new Uint8Array([105,115,111,109]),l=new Uint8Array([97,118,99,49]),u=new Uint8Array([0,0,0,1]);n.FTYP=n.box(n.types.ftyp,o,u,o,l),n.DINF=n.box(n.types.dinf,n.box(n.types.dref,a))}},{key:"box",value:function(t){for(var e=8,r=arguments.length,a=new Array(r>1?r-1:0),s=1;s<r;s++)a[s-1]=arguments[s];for(var o=a.length,l=o;o--;)e+=a[o].byteLength;var u=new Uint8Array(e);for(u[0]=e>>24&255,u[1]=e>>16&255,u[2]=e>>8&255,u[3]=e&255,u.set(t,4),o=0,e=8;o<l;o++)u.set(a[o],e),e+=a[o].byteLength;return u}},{key:"hdlr",value:function(t){return n.box(n.types.hdlr,n.HDLR_TYPES[t])}},{key:"mdat",value:function(t){return n.box(n.types.mdat,t)}},{key:"mdhd",value:function(t,e){e*=t;var r=Math.floor(e/(Vi+1)),a=Math.floor(e%(Vi+1));return n.box(n.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,r>>24,r>>16&255,r>>8&255,r&255,a>>24,a>>16&255,a>>8&255,a&255,85,196,0,0]))}},{key:"mdia",value:function(t){return n.box(n.types.mdia,n.mdhd(t.timescale||0,t.duration||0),n.hdlr(t.type),n.minf(t))}},{key:"mfhd",value:function(t){return n.box(n.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255]))}},{key:"minf",value:function(t){return t.type==="audio"?n.box(n.types.minf,n.box(n.types.smhd,n.SMH
1D),n.DINF,n.stbl(t)):n.box(n.types.minf,n.box(n.types.vmhd,n.VMHD),n.DINF,n.stbl(t))}},{key:"moof",value:function(t,e,r){return n.box(n.types.moof,n.mfhd(t),n.traf(r,e))}},{key:"moov",value:function(t){for(var e=t.length,r=[];e--;)r[e]=n.trak(t[e]);return n.box.apply(null,[n.types.moov,n.mvhd(t[0].timescale||0,t[0].duration||0)].concat(r).concat(n.mvex(t)))}},{key:"mvex",value:function(t){for(var e=t.length,r=[];e--;)r[e]=n.trex(t[e]);return n.box.apply(null,[n.types.mvex].concat(r))}},{key:"mvhd",value:function(t,e){e*=t;var r=Math.floor(e/(Vi+1)),a=Math.floor(e%(Vi+1)),s=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,r>>24,r>>16&255,r>>8&255,r&255,a>>24,a>>16&255,a>>8&255,a&255,0,1,0,0,1,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,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return n.box(n.types.mvhd,s)}},{key:"sdtp",value:function(t){var e=t.samples||[],r=new Uint8Array(4+e.length),a,s;for(a=0;a<e.length;a++)s=e[a].flags,r[a+4]=s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy;return n.box(n.types.sdtp,r)}},{key:"stbl",value:function(t){return n.box(n.types.stbl,n.stsd(t),n.box(n.types.stts,n.STTS),n.box(n.types.stsc,n.STSC),n.box(n.types.stsz,n.STSZ),n.box(n.types.stco,n.STCO))}},{key:"avc1",value:function(t){var e=[],r=[],a,s,o;for(a=0;a<t.sps.length;a++)s=t.sps[a],o=s.byteLength,e.push(o>>>8&255),e.push(o&255),e=e.concat(Array.prototype.slice.call(s));for(a=0;a<t.pps.length;a++)s=t.pps[a],o=s.byteLength,r.push(o>>>8&255),r.push(o&255),r=r.concat(Array.prototype.slice.call(s));var l=n.box(n.types.avcC,new Uint8Array([1,e[3],e[4],e[5],255,224|t.sps.length].concat(e).concat([t.pps.length]).concat(r))),u=t.width,c=t.height,f=t.pixelRatio[0],d=t.pixelRatio[1];return n.box(n.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,u>>8&255,u&255,c>>8&255,c&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),l,n.box(n.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),n.box(n.types.pasp,new Uint8Array([f>>24,f>>16&255,f>>8&255,f&255,d>>24,d>>16&255,d>>8&255,d&255])))}},{key:"esds",value:function(t){var e=t.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2].concat(nr(e),[6,1,2]))}},{key:"audioStsd",value:function(t){var e=t.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount||0,0,16,0,0,0,0,e>>8&255,e&255,0,0])}},{key:"mp4a",value:function(t){return n.box(n.types.mp4a,n.audioStsd(t),n.box(n.types.esds,n.esds(t)))}},{key:"mp3",value:function(t){return n.box(n.types[".mp3"],n.audioStsd(t))}},{key:"ac3",value:function(t){return n.box(n.types["ac-3"],n.audioStsd(t),n.box(n.types.dac3,t.config))}},{key:"stsd",value:function(t){var e=t.segmentCodec;if(t.type==="audio"){if(e==="aac")return n.box(n.types.stsd,n.STSD,n.mp4a(t));if(e==="ac3"&&t.config)return n.box(n.types.stsd,n.STSD,n.ac3(t));if(e==="mp3"&&t.codec==="mp3")return n.box(n.types.stsd,n.STSD,n.mp3(t))}else if(t.pps&&t.sps){if(e==="avc")return n.box(n.types.stsd,n.STSD,n.avc1(t));if(e==="hevc"&&t.vps)return n.box(n.types.stsd,n.STSD,n.hvc1(t))}else throw new Error("video track missing pps or sps");throw new Error("unsupported ".concat(t.type," segment codec (").concat(e,"/").concat(t.codec,")"))}},{key:"tkhd",value:function(t){var e=t.id,r=(t.duration||0)*(t.timescale||0),a=t.width||0,s=t.height||0,o=Math.floor(r/(Vi+1)),l=Math.floor(r%(Vi+1));return n.box(n.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,0,0,0,0,o>>24,o>>16&255,o>>8&255,o&255,l>>24,l>>16&255,l>>8&255,l&255,0,0,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,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,a>>8&255,a&255,0,0,s>>8&255,s&255,0,0]))}},{key:"traf",value:function(t,e){var r=n.sdtp(t),a=t.id,s=Math.floor(e/(Vi+1)),o=Math.floor(e%(Vi+1));return n.box(n.types.traf,n.box(n.types.tfhd,new Uint8Array([0,0,0,0,a>>24,a>>16&255,a>>8&255,a&255])),n.box(n.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,s&255,o>>24,o>>16&255,o>>8&255,o&255])),n.trun(t,r.length+16+20+8+16+8+8),r)}},{key:"trak",value:function(t){return t.duration=t.duration||4294967295,n.box(n.types.trak,n.tkhd(t),n.mdia(t))}}
1,{key:"trex",value:function(t){var e=t.id;return n.box(n.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(t,e){var r=t.samples||[],a=r.length,s=12+16*a,o=new Uint8Array(s),l,u,c,f,d,h;for(e+=8+s,o.set([t.type==="video"?1:0,0,15,1,a>>>24&255,a>>>16&255,a>>>8&255,a&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255],0),l=0;l<a;l++)u=r[l],c=u.duration,f=u.size,d=u.flags,h=u.cts,o.set([c>>>24&255,c>>>16&255,c>>>8&255,c&255,f>>>24&255,f>>>16&255,f>>>8&255,f&255,d.isLeading<<2|d.dependsOn,d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|d.isNonSync,d.degradPrio&61440,d.degradPrio&15,h>>>24&255,h>>>16&255,h>>>8&255,h&255],12+16*l);return n.box(n.types.trun,o)}},{key:"initSegment",value:function(t){n.types||n.init();var e=n.moov(t),r=jr(n.FTYP,e);return r}},{key:"hvc1",value:function(t){for(var e=t.params,r=[t.vps,t.sps,t.pps],a=4,s=new Uint8Array([1,e.general_profile_space<<6|(e.general_tier_flag?32:0)|e.general_profile_idc,e.general_profile_compatibility_flags[0],e.general_profile_compatibility_flags[1],e.general_profile_compatibility_flags[2],e.general_profile_compatibility_flags[3],e.general_constraint_indicator_flags[0],e.general_constraint_indicator_flags[1],e.general_constraint_indicator_flags[2],e.general_constraint_indicator_flags[3],e.general_constraint_indicator_flags[4],e.general_constraint_indicator_flags[5],e.general_level_idc,240|e.min_spatial_segmentation_idc>>8,255&e.min_spatial_segmentation_idc,252|e.parallelismType,252|e.chroma_format_idc,248|e.bit_depth_luma_minus8,248|e.bit_depth_chroma_minus8,0,parseInt(e.frame_rate.fps),a-1|e.temporal_id_nested<<2|e.num_temporal_layers<<3|(e.frame_rate.fixed?64:0),r.length]),o=s.length,l=0;l<r.length;l+=1){o+=3;for(var u=0;u<r[l].length;u+=1)o+=2+r[l][u].length}var c=new Uint8Array(o);c.set(s,0),o=s.length;for(var f=r.length-1,d=0;d<r.length;d+=1){c.set(new Uint8Array([32+d|(d===f?128:0),0,r[d].length]),o),o+=3;for(var h=0;h<r[d].length;h+=1)c.set(new Uint8Array([r[d][h].length>>8,r[d][h].length&255]),o),o+=2,c.set(r[d][h],o),o+=r[d][h].length}var v=n.box(n.types.hvcC,c),m=t.width,p=t.height,g=t.pixelRatio[0],E=t.pixelRatio[1];return n.box(n.types.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,m>>8&255,m&255,p>>8&255,p&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),v,n.box(n.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),n.box(n.types.pasp,new Uint8Array([g>>24,g>>16&255,g>>8&255,g&255,E>>24,E>>16&255,E>>8&255,E&255])))}}]),n}();ir.types=void 0;ir.HDLR_TYPES=void 0;ir.STTS=void 0;ir.STSC=void 0;ir.STCO=void 0;ir.STSZ=void 0;ir.VMHD=void 0;ir.SMHD=void 0;ir.STSD=void 0;ir.FTYP=void 0;ir.DINF=void 0;N0=9e4;zR=10*1e3,JR=1024,XR=1152,QR=1536,ea=null,xc=null;Co=function(n){B(i,n);function i(t,e,r,a){var s;if(k(this,i),s=Xe(this,i,["mp4-remuxer",a]),s.observer=void 0,s.config=void 0,s.typeSupported=void 0,s.ISGenerated=!1,s._initPTS=null,s._initDTS=null,s.nextVideoTs=null,s.nextAudioTs=null,s.videoSampleDuration=null,s.isAudioContiguous=!1,s.isVideoContiguous=!1,s.videoTrackConfig=void 0,s.observer=t,s.config=e,s.typeSupported=r,s.ISGenerated=!1,ea===null){var o=navigator.userAgent||"",l=o.match(/Chrome\/(\d+)/i);ea=l?parseInt(l[1]):0}if(xc===null){var u=navigator.userAgent.match(/Safari\/(\d+)/i);xc=u?parseInt(u[1]):0}return s}return A(i,[{key:"destroy",value:function(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}},{key:"resetTimeStamp",value:function(e){var r=this._initPTS;(!r||!e||e.trackId!==r.trackId||e.baseTime!==r.baseTime||e.timescale!==r.timescale)&&this.log("Reset initPTS: ".concat(r&&l_(r)," > ").concat(e&&l_(e))),this._initPTS=this._initDTS=e}},{key:"resetNextTimestamp",value:function(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}},{key:"resetInitSegment",value:function(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}},{key:"getVideoStartPts",value:function(e){var r=!1,a=e[0].pts,s=e.reduce(function(o,l){var u=l.pts,c=u-o;return c<-4294967296&&(r=!0,u=Lr(u,a),c=u-o),c>0?o:u},a);return r&&this.debug("PTS rollover detected"),s}},{key:"remux",value:function(e,r,a,s,o,l,u,c){var f,d,h,v,m,p,g=o,E=o,y=e.pid>-1,_=r.pid>-1,b=r.samples.length,C=e.samples.length>0,R=u&&b>0||b>1,M=(!y||C)&&(!_||R)||this.ISGenerated||u;if(M){if(this.ISGenerated){var D,L,O,x,Y=this.videoTrackConfig;(Y&&(r.width!==Y.width||r.height!==Y.height||((D=r.pixelRatio)==null?void 0:D[0])!==((L=Y.pixelRatio)==null?void 0:L[0])||((O=r.pixelRatio)==null?void 0:O[1])!==((x=Y.pixelRatio)==null?void 0:x[1]))||!Y&&R||this.nextAudioTs===null&&C)&&this.resetInitSegment()}this.ISGenerated||(h=this.generateIS(e,r,o,l));var $=this.isVideoContiguous,Z=-1,N;if(R&&(Z=$R(r.samples),!$&&this.config.forceKeyFrameOnDiscontinuity)
1)if(p=!0,Z>0){this.warn("Dropped ".concat(Z," out of ").concat(b," video samples due to a missing keyframe"));var j=this.getVideoStartPts(r.samples);r.samples=r.samples.slice(Z),r.dropped+=Z,E+=(r.samples[0].pts-j)/r.inputTimeScale,N=E}else Z===-1&&(this.warn("No keyframe found out of ".concat(b," video samples")),p=!1);if(this.ISGenerated){if(C&&R){var z=this.getVideoStartPts(r.samples),ee=Lr(e.samples[0].pts,z)-z,U=ee/r.inputTimeScale;g+=Math.max(0,U),E+=Math.max(0,-U)}if(C){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),h=this.generateIS(e,r,o,l)),d=this.remuxAudio(e,g,this.isAudioContiguous,l,_||R||c===fe.AUDIO?E:void 0),R){var F=d?d.endPTS-d.startPTS:0;r.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),h=this.generateIS(e,r,o,l)),f=this.remuxVideo(r,E,$,F)}}else R&&(f=this.remuxVideo(r,E,$,0));f&&(f.firstKeyFrame=Z,f.independent=Z!==-1,f.firstKeyFramePTS=N)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(a.samples.length&&(m=F0(a,o,this._initPTS,this._initDTS)),s.samples.length&&(v=U0(s,o,this._initPTS))),{audio:d,video:f,initSegment:h,independent:p,text:v,id3:m}}},{key:"computeInitPts",value:function(e,r,a,s){var o=Math.round(a*r),l=Lr(e,o);if(l<o+r)for(this.log("Adjusting PTS for rollover in timeline near ".concat((o-l)/r," ").concat(s));l<o+r;)l+=8589934592;return l-o}},{key:"generateIS",value:function(e,r,a,s){var o=e.samples,l=r.samples,u=this.typeSupported,c={},f=this._initPTS,d=!f||s,h="audio/mp4",v,m,p,g=-1;if(d&&(v=m=1/0),e.config&&o.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":u.mpeg?(h="audio/mpeg",e.codec=""):u.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}c.audio={id:"audio",container:h,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&u.mpeg?new Uint8Array(0):ir.initSegment([e]),metadata:{channelCount:e.channelCount}},d&&(g=e.id,p=e.inputTimeScale,!f||p!==f.timescale?v=m=this.computeInitPts(o[0].pts,p,a,"audio"):d=!1)}if(r.sps&&r.pps&&l.length){if(r.timescale=r.inputTimeScale,c.video={id:"main",container:"video/mp4",codec:r.codec,initSegment:ir.initSegment([r]),metadata:{width:r.width,height:r.height}},d)if(g=r.id,p=r.inputTimeScale,!f||p!==f.timescale){var E=this.getVideoStartPts(l),y=Lr(l[0].dts,E),_=this.computeInitPts(y,p,a,"video"),b=this.computeInitPts(E,p,a,"video");m=Math.min(m,_),v=Math.min(v,b)}else d=!1;this.videoTrackConfig={width:r.width,height:r.height,pixelRatio:r.pixelRatio}}if(Object.keys(c).length)return this.ISGenerated=!0,d?(f&&this.warn("Timestamps at playlist time: ".concat(s?"":"~").concat(a," ").concat(v/p," != initPTS: ").concat(f.baseTime/f.timescale," (").concat(f.baseTime,"/").concat(f.timescale,") trackId: ").concat(f.trackId)),this.log("Found initPTS at playlist time: ".concat(a," offset: ").concat(v/p," (").concat(v,"/").concat(p,") trackId: ").concat(g)),this._initPTS={baseTime:v,timescale:p,trackId:g},this._initDTS={baseTime:m,timescale:p,trackId:g}):v=p=void 0,{tracks:c,initPTS:v,timescale:p,trackId:g}}},{key:"remuxVideo",value:function(e,r,a,s){var o=e.inputTimeScale,l=e.samples,u=[],c=l.length,f=this._initPTS,d=f.baseTime*o/f.timescale,h=this.nextVideoTs,v=8,m=this.videoSampleDuration,p,g,E=Number.POSITIVE_INFINITY,y=Number.NEGATIVE_INFINITY,_=!1;if(!a||h===null){var b=d+r*o,C=l[0].pts-Lr(l[0].dts,l[0].pts);ea&&h!==null&&Math.abs(b-C-(h+d))<15e3?a=!0:h=b-C-d}for(var R=h+d,M=0;M<c;M++){var D=l[M];D.pts=Lr(D.pts,R),D.dts=Lr(D.dts,R),D.dts<l[M>0?M-1:M].dts&&(_=!0)}_&&l.sort(function(Zi,Li){var fs=Zi.dts-Li.dts,nl=Zi.pts-Li.pts;return fs||nl}),p=l[0].dts,g=l[l.length-1].dts;var L=g-p,O=L?Math.round(L/(c-1)):m||e.inputTimeScale/30;if(a){var x=p-R,Y=x>O,$=x<-1;if((Y||$)&&(Y?this.warn("".concat((e.segmentCodec||"").toUpperCase(),": ").concat(Ka(x,!0)," ms (").concat(x,"dts) hole between fragments detected at ").concat(r.toFixed(3))):this.warn("".concat((e.segmentCodec||"").toUpperCase(),": ").concat(Ka(-x,!0)," ms (").concat(x,"dts) overlapping between fragments detected at ").concat(r.toFixed(3))),!$||R>=l[0].pts||ea)){p=R;var Z=l[0].pts-x;if(Y)l[0].dts=p,l[0].pts=Z;else for(var N=!0,j=0;j<l.length&&!(l[j].dts>Z&&N);j++){var z=l[j].pts;if(l[j].dts-=x,l[j].pts-=x,j<l.length-1){var ee=l[j+1].pts,U=l[j].pts,F=ee<=U,H=ee<=z;N=F==H}}this.log("Video: Initial PTS/DTS adjusted: ".concat(Ka(Z,!0),"/").concat(Ka(p,!0),", delta: ").concat(Ka(x,!0)," ms"))}}p=Math.max(0,p);for(var G=0,ve=0,ye=p,Ee=0;Ee<c;Ee++){for(var Ce=l[Ee],Ye=Ce.units,ot=Ye.length,Ue=0,yt=0;yt<ot;yt++)Ue+=Ye[yt].data.length;ve+=Ue,G+=ot,Ce.length=Ue,Ce.dts<ye?(Ce.dts=ye,ye+=O/4|0||1):ye=Ce.dts,E=Math.min(Ce.pts,E),y=Math.max(Ce.pts,y)}g=l[c-1].dts;var Le=ve+4*G+8,_t;try{_t=new Uint8Array(Le)}catch(Zi){this.observer.emit(S.ERROR,S.ERROR,{type:ge.MUX_ERROR,details:K.REMUX_ALLOC_ER
1ROR,fatal:!1,error:Zi,bytes:Le,reason:"fail allocating video mdat ".concat(Le)});return}var wt=new DataView(_t.buffer);wt.setUint32(0,Le),_t.set(ir.types.mdat,4);for(var xt=!1,qt=Number.POSITIVE_INFINITY,lt=Number.POSITIVE_INFINITY,Sr=Number.NEGATIVE_INFINITY,cr=Number.NEGATIVE_INFINITY,Nt=0;Nt<c;Nt++){for(var Ft=l[Nt],Pt=Ft.units,Ji=0,Tr=0,Xi=Pt.length;Tr<Xi;Tr++){var fa=Pt[Tr],da=fa.data,Qi=fa.data.byteLength;wt.setUint32(v,Qi),v+=4,_t.set(da,v),v+=Qi,Ji+=4+Qi}var Ii=void 0;if(Nt<c-1)m=l[Nt+1].dts-Ft.dts,Ii=l[Nt+1].pts-Ft.pts;else{var ha=this.config,$i=Nt>0?Ft.dts-l[Nt-1].dts:O;if(Ii=Nt>0?Ft.pts-l[Nt-1].pts:O,ha.stretchShortVideoTrack&&this.nextAudioTs!==null){var os=Math.floor(ha.maxBufferHole*o),va=(s?E+s*o:this.nextAudioTs+d)-Ft.pts;va>os?(m=va-$i,m<0?m=$i:xt=!0,this.log("It is approximately ".concat(va/90," ms to the next segment; using duration ").concat(m/90," ms for the last video frame."))):m=$i}else m=$i}var $o=Math.round(Ft.pts-Ft.dts);qt=Math.min(qt,m),Sr=Math.max(Sr,m),lt=Math.min(lt,Ii),cr=Math.max(cr,Ii),u.push(u_(Ft.key,m,Ji,$o))}if(u.length){if(ea){if(ea<70){var Ci=u[0].flags;Ci.dependsOn=2,Ci.isNonSync=0}}else if(xc&&cr-lt<Sr-qt&&O/Sr<.025&&u[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var pa=p,br=0,ls=u.length;br<ls;br++){var us=pa+u[br].duration,Zo=pa+u[br].cts;if(br<ls-1){var el=us+u[br+1].cts;u[br].duration=el-Zo}else u[br].duration=br?u[br-1].duration:O;u[br].cts=0,pa=us}}}m=xt||!m?O:m;var tl=g+m;this.nextVideoTs=h=tl-d,this.videoSampleDuration=m,this.isVideoContiguous=!0;var rl=ir.moof(e.sequenceNumber++,p,nt(e,{samples:u})),il="video",cs={data1:rl,data2:_t,startPTS:(E-d)/o,endPTS:(y+m-d)/o,startDTS:(p-d)/o,endDTS:h/o,type:il,hasAudio:!1,hasVideo:!0,nb:u.length,dropped:e.dropped};return e.samples=[],e.dropped=0,cs}},{key:"getSamplesPerFrame",value:function(e){switch(e.segmentCodec){case"mp3":return XR;case"ac3":return QR;default:return JR}}},{key:"remuxAudio",value:function(e,r,a,s,o){var l=e.inputTimeScale,u=e.samplerate?e.samplerate:l,c=l/u,f=this.getSamplesPerFrame(e),d=f*c,h=this._initPTS,v=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,m=[],p=o!==void 0,g=e.samples,E=v?0:8,y=this.nextAudioTs||-1,_=h.baseTime*l/h.timescale,b=_+r*l;if(this.isAudioContiguous=a=a||g.length&&y>0&&(s&&Math.abs(b-(y+_))<9e3||Math.abs(Lr(g[0].pts,b)-(y+_))<20*d),g.forEach(function(lt){lt.pts=Lr(lt.pts,b)}),!a||y<0){var C=g.length;if(g=g.filter(function(lt){return lt.pts>=0}),C!==g.length&&this.warn("Removed ".concat(g.length-C," of ").concat(C," samples (initPTS ").concat(_," / ").concat(l,")")),!g.length)return;o===0?y=0:s&&!p?y=Math.max(0,b-_):y=g[0].pts-_}if(e.segmentCodec==="aac")for(var R=this.config.maxAudioFramesDrift,M=0,D=y+_;M<g.length;M++){var L=g[M],O=L.pts,x=O-D,Y=Math.abs(1e3*x/l);if(x<=-R*d&&p)M===0&&(this.warn("Audio frame @ ".concat((O/l).toFixed(3),"s overlaps marker by ").concat(Math.round(1e3*x/l)," ms.")),this.nextAudioTs=y=O-_,D=O);else if(x>=R*d&&Y<zR&&p){var $=Math.round(x/d);for(D=O-$*d;D<0&&$&&d;)$--,D+=d;M===0&&(this.nextAudioTs=y=D-_),this.warn("Injecting ".concat($," audio frames @ ").concat(((D-_)/l).toFixed(3),"s due to ").concat(Math.round(1e3*x/l)," ms gap."));for(var Z=0;Z<$;Z++){var N=WR.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);N||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),N=L.unit.subarray()),g.splice(M,0,{unit:N,pts:D}),D+=d,M++}}L.pts=D,D+=d}for(var j=null,z=null,ee,U=0,F=g.length;F--;)U+=g[F].unit.byteLength;for(var H=0,G=g.length;H<G;H++){var ve=g[H],ye=ve.unit,Ee=ve.pts;if(z!==null){var Ce=m[H-1];Ce.duration=Math.round((Ee-z)/c)}else if(a&&e.segmentCodec==="aac"&&(Ee=y+_),j=Ee,U>0){U+=E;try{ee=new Uint8Array(U)}catch(lt){this.observer.emit(S.ERROR,S.ERROR,{type:ge.MUX_ERROR,details:K.REMUX_ALLOC_ERROR,fatal:!1,error:lt,bytes:U,reason:"fail allocating audio mdat ".concat(U)});return}if(!v){var Ye=new DataView(ee.buffer);Ye.setUint32(0,U),ee.set(ir.types.mdat,4)}}else return;ee.set(ye,E);var ot=ye.byteLength;E+=ot,m.push(u_(!0,f,ot,0)),z=Ee}var Ue=m.length;if(Ue){var yt=m[m.length-1];y=z-_,this.nextAudioTs=y+c*yt.duration;var Le=v?new Uint8Array(0):ir.moof(e.sequenceNumber++,j/c,nt({},e,{samples:m}));e.samples=[];var _t=(j-_)/l,wt=this.nextAudioTs/l,xt="audio",qt={data1:Le,data2:ee,startPTS:_t,endPTS:wt,startDTS:_t,endDTS:wt,type:xt,hasAudio:!0,hasVideo:!1,nb:Ue};return this.isAudioContiguous=!0,qt}}}]),i}
1(Hr);ZR=function(n){B(i,n);function i(t,e,r,a){var s;return k(this,i),s=Xe(this,i,["passthrough-remuxer",a]),s.emitInitSegment=!1,s.audioCodec=void 0,s.videoCodec=void 0,s.initData=void 0,s.initPTS=null,s.initTracks=void 0,s.lastEndTime=null,s.isVideoContiguous=!1,s}return A(i,[{key:"destroy",value:function(){}},{key:"resetTimeStamp",value:function(e){this.lastEndTime=null;var r=this.initPTS;r&&e&&r.baseTime===e.baseTime&&r.timescale===e.timescale||(this.initPTS=e)}},{key:"resetNextTimestamp",value:function(){this.isVideoContiguous=!1,this.lastEndTime=null}},{key:"resetInitSegment",value:function(e,r,a,s){this.audioCodec=r,this.videoCodec=a,this.generateInitSegment(e,s),this.emitInitSegment=!0}},{key:"generateInitSegment",value:function(e,r){var a=this.audioCodec,s=this.videoCodec;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}var o=this.initData=K_(e),l=o.audio,u=o.video;if(r)BC(e,r);else{var c=l||u;c!=null&&c.encrypted&&this.warn('Init segment with encrypted track with has no key ("'.concat(c.codec,'")!'))}l&&(a=c_(l,at.AUDIO,this)),u&&(s=c_(u,at.VIDEO,this));var f={};l&&u?f.audiovideo={container:"video/mp4",codec:a+","+s,supplemental:u.supplemental,encrypted:u.encrypted,initSegment:e,id:"main"}:l?f.audio={container:"audio/mp4",codec:a,encrypted:l.encrypted,initSegment:e,id:"audio"}:u?f.video={container:"video/mp4",codec:s,supplemental:u.supplemental,encrypted:u.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=f}},{key:"remux",value:function(e,r,a,s,o,l){var u,c,f=this.initPTS,d=this.lastEndTime,h={audio:void 0,video:void 0,text:s,id3:a,initSegment:void 0};ce(d)||(d=this.lastEndTime=o||0);var v=r.samples;if(!v.length)return h;var m={initPTS:void 0,timescale:void 0,trackId:void 0},p=this.initData;if((u=p)!=null&&u.length||(this.generateInitSegment(v),p=this.initData),!((c=p)!=null&&c.length))return this.warn("Failed to generate initSegment."),h;this.emitInitSegment&&(m.tracks=this.initTracks,this.emitInitSegment=!1);var g=jC(v,p,this),E=p.audio?g[p.audio.id]:null,y=p.video?g[p.video.id]:null,_=mo(y,1/0),b=mo(E,1/0),C=mo(y,0,!0),R=mo(E,0,!0),M=o,D=0,L=E&&(!y||!f&&b<_||f&&f.trackId===p.audio.id),O=L?E:y;if(O){var x=O.timescale,Y=O.start-o*x,$=L?p.audio.id:p.video.id;M=O.start/x,D=L?R-b:C-_,(l||!f)&&(eO(f,M,o,D)||x!==f.timescale)&&(f&&this.warn("Timestamps at playlist time: ".concat(l?"":"~").concat(o," ").concat(Y/x," != initPTS: ").concat(f.baseTime/f.timescale," (").concat(f.baseTime,"/").concat(f.timescale,") trackId: ").concat(f.trackId)),this.log("Found initPTS at playlist time: ".concat(o," offset: ").concat(M-o," (").concat(Y,"/").concat(x,") trackId: ").concat($)),f=null,m.initPTS=Y,m.timescale=x,m.trackId=$)}else this.warn("No audio or video samples found for initPTS at playlist time: ".concat(o));f?(m.initPTS=f.baseTime,m.timescale=f.timescale,m.trackId=f.trackId):((!m.timescale||m.trackId===void 0||m.initPTS===void 0)&&(this.warn("Could not set initPTS"),m.initPTS=M,m.timescale=1,m.trackId=-1),this.initPTS=f={baseTime:m.initPTS,timescale:m.timescale,trackId:m.trackId});var Z=M-f.baseTime/f.timescale,N=Z+D;D>0?this.lastEndTime=N:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var j=!!p.audio,z=!!p.video,ee="";j&&(ee+="audio"),z&&(ee+="video");var U=(p.audio?p.audio.encrypted:!1)||(p.video?p.video.encrypted:!1),F={data1:v,startPTS:Z,startDTS:Z,endPTS:N,endDTS:N,type:ee,hasAudio:j,hasVideo:z,nb:1,dropped:0,encrypted:U};h.audio=j&&!z?F:void 0,h.video=z?F:void 0;var H=y==null?void 0:y.sampleCount;if(H){var G=y.keyFrameIndex,ve=G!==-1;F.nb=H,F.dropped=G===0||this.isVideoContiguous?0:ve?G:H,F.independent=ve,F.firstKeyFrame=G,ve&&y.keyFrameStart&&(F.firstKeyFramePTS=(y.keyFrameStart-f.baseTime)/f.timescale),this.isVideoContiguous||(h.independent=ve),this.isVideoContiguous||(this.isVideoContiguous=ve),F.dropped&&this.warn("fmp4 does not start with IDR: firstIDR ".concat(G,"/").concat(H," dropped: ").concat(F.dropped," start: ").concat(F.firstKeyFramePTS||"NA"))}return h.initSegment=m,h.id3=F0(a,o,f,f),s.samples.length&&(h.text=U0(s,o,f)),h}}]),i}
1(Hr);try{Ai=self.performance.now.bind(self.performance)}catch(n){Ai=Date.now}Lo=[{demux:UR,remux:ZR},{demux:HR,remux:Co},{demux:DR,remux:Co},{demux:NR,remux:Co}];Lo.splice(2,0,{demux:MR,remux:Co});f_=function(){function n(i,t,e,r,a,s){k(this,n),this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=i,this.typeSupported=t,this.config=e,this.id=a,this.logger=s}return A(n,[{key:"configure",value:function(t){this.transmuxConfig=t,this.decrypter&&this.decrypter.reset()}},{key:"push",value:function(t,e,r,a){var s=this,o=r.transmuxing;o.executeStart=Ai();var l=new Uint8Array(t),u=this.currentTransmuxState,c=this.transmuxConfig;a&&(this.currentTransmuxState=a);var f=a||u,d=f.contiguous,h=f.discontinuity,v=f.trackSwitch,m=f.accurateTimeOffset,p=f.timeOffset,g=f.initSegmentChange,E=c.audioCodec,y=c.videoCodec,_=c.defaultInitPts,b=c.duration,C=c.initSegmentData,R=tO(l,e);if(R&&aa(R.method)){var M=this.getDecrypter(),D=_f(R.method);if(M.isSync()){var L=M.softwareDecrypt(l,R.key.buffer,R.iv.buffer,D),O=r.part>-1;if(O){var x=M.flush();L=x&&x.buffer}if(!L)return o.executeEnd=Ai(),Pc(r);l=new Uint8Array(L)}else return this.asyncResult=!0,this.decryptionPromise=M.webCryptoDecrypt(l,R.key.buffer,R.iv.buffer,D).then(function(j){var z=s.push(j,null,r);return s.decryptionPromise=null,z}),this.decryptionPromise}var Y=this.needsProbing(h,v);if(Y){var $=this.configureTransmuxer(l);if($)return this.logger.warn("[transmuxer] ".concat($.message)),this.observer.emit(S.ERROR,S.ERROR,{type:ge.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!1,error:$,reason:$.message}),o.executeEnd=Ai(),Pc(r)}(h||v||g||Y)&&this.resetInitSegment(C,E,y,b,e),(h||g||Y)&&this.resetInitialTimestamp(_),d||this.resetContiguity();var Z=this.transmux(l,R,p,m,r);this.asyncResult=ts(Z);var N=this.currentTransmuxState;return N.contiguous=!0,N.discontinuity=!1,N.trackSwitch=!1,o.executeEnd=Ai(),Z}},{key:"flush",value:function(t){var e=this,r=t.transmuxing;r.executeStart=Ai();var a=this.decrypter,s=this.currentTransmuxState,o=this.decryptionPromise;if(o)return this.asyncResult=!0,o.then(function(){return e.flush(t)});var l=[],u=s.timeOffset;if(a){var c=a.flush();c&&l.push(this.push(c.buffer,null,t))}var f=this.demuxer,d=this.remuxer;if(!f||!d){r.executeEnd=Ai();var h=[Pc(t)];return this.asyncResult?Promise.resolve(h):h}var v=f.flush(u);return ts(v)?(this.asyncResult=!0,v.then(function(m){return e.flushRemux(l,m,t),l})):(this.flushRemux(l,v,t),this.asyncResult?Promise.resolve(l):l)}},{key:"flushRemux",value:function(t,e,r){var a=e.audioTrack,s=e.videoTrack,o=e.id3Track,l=e.textTrack,u=this.currentTransmuxState,c=u.accurateTimeOffset,f=u.timeOffset;this.logger.log("[transmuxer.ts]: Flushed ".concat(this.id," sn: ").concat(r.sn).concat(r.part>-1?" part: "+r.part:""," of ").concat(this.id===fe.MAIN?"level":"track"," ").concat(r.level));var d=this.remuxer.remux(a,s,o,l,f,c,!0,this.id);t.push({remuxResult:d,chunkMeta:r}),r.transmuxing.executeEnd=Ai()}},{key:"resetInitialTimestamp",value:function(t){var e=this.demuxer,r=this.remuxer;!e||!r||(e.resetTimeStamp(t),r.resetTimeStamp(t))}},{key:"resetContiguity",value:function(){var t=this.demuxer,e=this.remuxer;!t||!e||(t.resetContiguity(),e.resetNextTimestamp())}},{key:"resetInitSegment",value:function(t,e,r,a,s){var o=this.demuxer,l=this.remuxer;!o||!l||(o.resetInitSegment(t,e,r,a),l.resetInitSegment(t,e,r,s))}},{key:"destroy",value:function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}},{key:"transmux",value:function(t,e,r,a,s){var o;return e&&e.method==="SAMPLE-AES"?o=this.transmuxSampleAes(t,e,r,a,s):o=this.transmuxUnencrypted(t,r,a,s),o}},{key:"transmuxUnencrypted",value:function(t,e,r,a){var s=this.demuxer.demux(t,e,!1,!this.config.progressive),o=s.audioTrack,l=s.videoTrack,u=s.id3Track,c=s.textTrack,f=this.remuxer.remux(o,l,u,c,e,r,!1,this.id);return{remuxResult:f,chunkMeta:a}}},{key:"transmuxSampleAes",value:function(t,e,r,a,s){var o=this;return this.demuxer.demuxSampleAes(t,e,r).then(function(l){var u=o.remuxer.remux(l.audioTrack,l.videoTrack,l.id3Track,l.textTrack,r,a,!1,o.id);return{remuxResult:u,chunkMeta:s}})}},{key:"configureTransmuxer",value:function(t){for(var e=this.config,r=this.observer,a=this.typeSupp
1orted,s,o=0,l=Lo.length;o<l;o++){var u;if((u=Lo[o].demux)!=null&&u.probe(t,this.logger)){s=Lo[o];break}}if(!s)return new Error("Failed to find demuxer by probing fragment data");var c=this.demuxer,f=this.remuxer,d=s.remux,h=s.demux;(!f||!(f instanceof d))&&(this.remuxer=new d(r,e,a,this.logger)),(!c||!(c instanceof h))&&(this.demuxer=new h(r,e,a,this.logger),this.probe=h.probe)}},{key:"needsProbing",value:function(t,e){return!this.demuxer||!this.remuxer||t||e}},{key:"getDecrypter",value:function(){var t=this.decrypter;return t||(t=this.decrypter=new gf(this.config)),t}}]),n}();Pc=function(i){return{remuxResult:{},chunkMeta:i}};rO=A(function n(i,t,e,r,a){k(this,n),this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=i,this.videoCodec=t,this.initSegmentData=e,this.duration=r,this.defaultInitPts=a||null}),iO=A(function n(i,t,e,r,a,s){k(this,n),this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=i,this.contiguous=t,this.accurateTimeOffset=e,this.trackSwitch=r,this.timeOffset=a,this.initSegmentChange=s}),d_=0,B0=function(){function n(i,t,e,r){var a=this;k(this,n),this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=d_++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=function(d){var h=d.data,v=a.hls;if(!(!v||!(h!=null&&h.event)||h.instanceNo!==a.instanceNo))switch(h.event){case"init":{var m,p=(m=a.workerContext)==null?void 0:m.objectURL;p&&self.URL.revokeObjectURL(p);break}case"transmuxComplete":{a.handleTransmuxComplete(h.data);break}case"flush":{a.onFlush(h.data);break}case"workerLog":{v.logger[h.data.logType]&&v.logger[h.data.logType](h.data.message);break}default:{h.data=h.data||{},h.data.frag=a.frag,h.data.part=a.part,h.data.id=a.id,v.trigger(h.event,h.data);break}}},this.onWorkerError=function(d){if(a.hls){var h=new Error("".concat(d.message," (").concat(d.filename,":").concat(d.lineno,")"));a.hls.config.enableWorker=!1,a.hls.logger.warn('Error in "'.concat(a.id,'" Web Worker, fallback to inline')),a.hls.trigger(S.ERROR,{type:ge.OTHER_ERROR,details:K.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:h})}};var s=i.config;this.hls=i,this.id=t,this.useWorker=!!s.enableWorker,this.onTransmuxComplete=e,this.onFlush=r;var o=function(h,v){v=v||{},v.frag=a.frag||void 0,h===S.ERROR&&(v=v,v.parent=a.id,v.part=a.part,a.error=v.error),a.hls.trigger(h,v)};this.observer=new Tf,this.observer.on(S.FRAG_DECRYPTED,o),this.observer.on(S.ERROR,o);var l=Cy(s.preferManagedMediaSource);if(this.useWorker&&typeof Worker!="undefined"){var u=this.hls.logger,c=s.workerPath||sR();if(c){try{s.workerPath?(u.log("loading Web Worker ".concat(s.workerPath,' for "').concat(t,'"')),this.workerContext=lR(s.workerPath)):(u.log('injecting Web Worker for "'.concat(t,'"')),this.workerContext=oR());var f=this.workerContext.worker;f.addEventListener("message",this.onWorkerMessage),f.addEventListener("error",this.onWorkerError),f.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:l,id:t,config:st(s)})}catch(d){u.warn('Error setting up "'.concat(t,'" Web Worker, fallback to inline'),d),this.terminateWorker(),this.error=null,this.transmuxer=new f_(this.observer,l,s,"",t,i.logger)}return}}this.transmuxer=new f_(this.observer,l,s,"",t,i.logger)}return A(n,[{key:"reset",value:function(){if(this.frag=null,this.part=null,this.workerContext){var t=this.instanceNo;this.instanceNo=d_++;var e=this.hls.config,r=Cy(e.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:t,typeSupported:r,id:this.id,c
1onfig:st(e)})}}},{key:"terminateWorker",value:function(){if(this.workerContext){var t=this.workerContext.worker;this.workerContext=null,t.removeEventListener("message",this.onWorkerMessage),t.removeEventListener("error",this.onWorkerError),uR(this.hls.config.workerPath)}}},{key:"destroy",value:function(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{var t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}var e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}},{key:"push",value:function(t,e,r,a,s,o,l,u,c,f){var d=this,h,v;c.transmuxing.start=self.performance.now();var m=this.instanceNo,p=this.transmuxer,g=o?o.start:s.start,E=s.decryptdata,y=this.frag,_=!(y&&s.cc===y.cc),b=!(y&&c.level===y.level),C=y?c.sn-y.sn:-1,R=this.part?c.part-this.part.index:-1,M=C===0&&c.id>1&&c.id===(y==null?void 0:y.stats.chunkCount),D=!b&&(C===1||C===0&&(R===1||M&&R<=0)),L=self.performance.now();(b||C||s.stats.parsing.start===0)&&(s.stats.parsing.start=L),o&&(R||!D)&&(o.stats.parsing.start=L);var O=!(y&&((h=s.initSegment)==null?void 0:h.url)===((v=y.initSegment)==null?void 0:v.url)),x=new iO(_,D,u,b,g,O);if(!D||_||O){this.hls.logger.log("[transmuxer-interface]: Starting new transmux session for ".concat(s.type," sn: ").concat(c.sn).concat(c.part>-1?" part: "+c.part:""," ").concat(this.id===fe.MAIN?"level":"track",": ").concat(c.level," id: ").concat(c.id,"\n discontinuity: ").concat(_,"\n trackSwitch: ").concat(b,"\n contiguous: ").concat(D,"\n accurateTimeOffset: ").concat(u,"\n timeOffset: ").concat(g,"\n initSegmentChange: ").concat(O));var Y=new rO(r,a,e,l,f);this.configureTransmuxer(Y)}if(this.frag=s,this.part=o,this.workerContext)this.workerContext.worker.postMessage({instanceNo:m,cmd:"demux",data:t,decryptdata:E,chunkMeta:c,state:x},t instanceof ArrayBuffer?[t]:[]);else if(p){var $=p.push(t,E,c,x);ts($)?$.then(function(Z){d.handleTransmuxComplete(Z)}).catch(function(Z){d.transmuxerError(Z,c,"transmuxer-interface push error")}):this.handleTransmuxComplete($)}}},{key:"flush",value:function(t){var e=this;t.transmuxing.start=self.performance.now();var r=this.instanceNo,a=this.transmuxer;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:r,cmd:"flush",chunkMeta:t});else if(a){var s=a.flush(t);ts(s)?s.then(function(o){e.handleFlushResult(o,t)}).catch(function(o){e.transmuxerError(o,t,"transmuxer-interface flush error")}):this.handleFlushResult(s,t)}}},{key:"transmuxerError",value:function(t,e,r){this.hls&&(this.error=t,this.hls.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,chunkMeta:e,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:t,err:t,reason:r}))}},{key:"handleFlushResult",value:function(t,e){var r=this;t.forEach(function(a){r.handleTransmuxComplete(a)}),this.onFlush(e)}},{key:"configureTransmuxer",value:function(t){var e=this.instanceNo,r=this.transmuxer;this.workerContext?this.workerContext.worker.postMessage({instanceNo:e,cmd:"configure",config:t}):r&&r.configure(t)}},{key:"handleTransmuxComplete",value:function(t){t.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(t)}}]),n}(),h_=100,nO=function(n){B(i,n);function i(t,e,r){var a;return k(this,i),a=Xe(this,i,[t,e,r,"audio-stream-controller",fe.AUDIO]),a.mainAnchor=null,a.mainFragLoading=null,a.audioOnly=!1,a.bufferedTrack=null,a.switchingTrack=null,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.flushing=!1,a.bufferFlushed=!1,a.cachedTrackLoadedData=null,a.registerListeners(),a}return A(i,[{key:"onHandlerDestroying",value:function(){this.unregisterListeners(),Ie(i,"onHandlerDestroying",this,3)([]),this.resetItem()}},{key:"resetItem",value:function(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}},{key:"registerListeners",value:function(){Ie(i,"registerListeners",this,3)([]);var e=this.hls;e.on(S.LEVEL_LOADED,this.onLevelLoaded,this),e.on(S.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(S.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(S.BUFFER_RESET,this.onBufferReset,this),e.on(S.BUFFER_CREATED,this.onBufferCreated,this),e.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(S.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(S.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(S.FRAG_LOADING,this.onFragLoading,this),e.on(S.FRAG_BUFFERED,this.onFragBuffered,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(Ie(i,"unregisterListeners",this,3)([]),e.off(S.LEVEL_LOADED,this.onLevelLoaded,this),e.off(S.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(S.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(S.BUFFER_RESET,this.onBufferReset,this),e.off(S.BUFFER_CREATED,this.onBufferCreated,this),e.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(S.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(S.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(S.FRAG_LOADING,this.onFragLoading,this),e.off(S.FRAG_BUFFERED,this.onFragBuffered,this))}},{key:"onInitPtsFound",value:function(e,r){var a=r.frag,s=r.id,o=r.initPTS,l=r.timescale,u=r.trackId;if(s===fe.MAIN){var c=a.cc,f=this.fragCurrent;if(this.initPTS[c]={baseTime:o,timescale:l,trackId:u},this.log("InitPTS for cc: ".concat(c," found from main: ").concat(o/l," (").concat(o,"/").concat(l,") trackId: ").concat(u)),this.mainAnchor=a,this.state===re.WAITING_INIT_PTS){var d=this.waitingData;(!d&&!this.loadingParts||d&&d.frag.cc!==c)&&this.syncWithAnchor(
1a,d==null?void 0:d.frag)}else!this.hls.hasEnoughToStart&&f&&f.cc!==c?(f.abortRequests(),this.syncWithAnchor(a,f)):this.state===re.IDLE&&this.tick()}}},{key:"getLoadPosition",value:function(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:Ie(i,"getLoadPosition",this,3)([])}},{key:"syncWithAnchor",value:function(e,r){var a,s=((a=this.mainFragLoading)==null?void 0:a.frag)||null;if(!(r&&(s==null?void 0:s.cc)===r.cc)){var o=(s||e).cc,l=this.getLevelDetails(),u=this.getLoadPosition(),c=t0(l,o,u);c&&(this.log("Syncing with main frag at ".concat(c.start," cc ").concat(c.cc)),this.startFragRequested=!1,this.nextLoadPosition=c.start,this.resetLoadingState(),this.state===re.IDLE&&this.doTickIdle())}}},{key:"startLoad",value:function(e,r){if(!this.levels){this.startPosition=e,this.state=re.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(h_),a>0&&e===-1?(this.log("Override startPosition with lastCurrentTime @".concat(a.toFixed(3))),e=a,this.state=re.IDLE):this.state=re.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=r?-1:e,this.tick()}},{key:"doTick",value:function(){switch(this.state){case re.IDLE:this.doTickIdle();break;case re.WAITING_TRACK:{var e=this.levels,r=this.trackId,a=e==null?void 0:e[r],s=a==null?void 0:a.details;if(s&&!this.waitForLive(a)){if(this.waitForCdnTuneIn(s))break;this.state=re.WAITING_INIT_PTS}break}case re.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case re.WAITING_INIT_PTS:{var o=this.waitingData;if(o){var l=o.frag,u=o.part,c=o.cache,f=o.complete,d=this.mainAnchor;if(this.initPTS[l.cc]!==void 0){this.waitingData=null,this.state=re.FRAG_LOADING;var h=c.flush().buffer,v={frag:l,part:u,payload:h,networkDetails:null};this._handleFragmentLoadProgress(v),f&&Ie(i,"_handleFragmentLoadComplete",this,3)([v])}else d&&d.cc!==o.frag.cc&&this.syncWithAnchor(d,o.frag)}else this.state=re.IDLE}}this.onTickEnd()}},{key:"resetLoadingState",value:function(){var e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),Ie(i,"resetLoadingState",this,3)([])}},{key:"onTickEnd",value:function(){var e=this.media;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}},{key:"doTickIdle",value:function(){var e,r=this.hls,a=this.levels,s=this.media,o=this.trackId,l=r.config;if(!(!this.buffering||!s&&!this.primaryPrefetch&&(this.startFragRequested||!l.startFragPrefetch)||!(a!=null&&a[o]))){var u=a[o],c=u.details;if(!c||this.waitForLive(u)||this.waitForCdnTuneIn(c)){this.state=re.WAITING_TRACK,this.startFragRequested=!1;return}var f=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&f&&(this.bufferFlushed=!1,this.afterBufferFlushed(f,at.AUDIO,fe.AUDIO));var d=this.getFwdBufferInfo(f,fe.AUDIO);if(d!==null){if(!this.switchingTrack&&this._streamEnded(d,c)){r.trigger(S.BUFFER_EOS,{type:"audio"}),this.state=re.ENDED;return}var h=d.len,v=r.maxBufferLength,m=c.fragments,p=m[0].start,g=this.getLoadPosition(),E=this.flushing?g:d.end;if(this.switchingTrack&&s){var y=g;c.PTSKnown&&y<p&&(d.end>p||d.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),s.currentTime=p+.05)}if(!(h>=v&&!this.switchingTrack&&E<m[m.length-1].start)){var _=this.getNextFragment(E,c);if(_&&this.isLoopLoading(_,E)&&(_=this.getNextFragmentLoopLoading(_,c,d,fe.MAIN,v)),!_){this.bufferFlushed=!0;return}if(!this.exceedsMaxBuffer(d,v,_)){var b=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&b&&Rt(_)&&!_.endList&&(!c.live||!this.loadingParts&&E<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(b)===jt.OK&&(this.mainFragLoading=b=null),b&&Rt(b))){if(_.start>b.end){var C=this.fragmentTracker.getFragAtPos(E,fe.MAIN);C&&C.end>b.end&&(b=C,this.mainFragLoading={frag:C,targetBufferTime:null})}var R=_.start>b.end;if(R)return}this.loadFragment(_,u,E)}}}}}},{key:"onMediaDetaching",value:function(e,r){this.bufferFlushed=this.flushing=!1,Ie(i,"onMediaDetaching",this,3)([e,r])}},{key:"onAudioTracksUpdated",value:function(e,r){var a=r.audioTracks;this.resetTransmuxer(),this.levels=a.map(function(s){return new $a(s)})}},{key:"onAudioTrackSwitching",value:function(e,r){var a=!!r.url;this.trackId=r.id;var s=this.fragCurrent;s&&(s.abortRequests(),this.removeUnbufferedFrags(s.start)),this.resetLoadingState(),a?(this.switchingTrack=r,this.flushAudioIfNeeded(r),this.state!==re.STOPPED&&(this.setInterval(h_),this.state=re.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=r,this.clearInterval())}},{key:"onManifestLoading",value:function(){Ie(i,"onManifestLoading",this,3)([]),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}},{key:"onLevelLoaded",value:function(e,r){this.mainDetails=r.details;var a=this.cachedTrackLoadedData;a&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(S.AUDIO_TRACK_LOADED,a))}},{key:"onAudioTrackLoaded",value:function(e,r){var a,s=this.levels,o=r.details,l=r.id,u=r.groupId,c=r.track;if(!s){this.warn("Audio tracks reset while loading track ".concat(l,' "').concat(c.name,'" of "').concat(u,'"'));return}var f=this.mainDetails;if(!f||o.endCC>f.endCC||f.expired){this.cachedTrackLoadedData=r,this.state!==re.STOPPED&&(this.state=re.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log("Audio track ".concat(l,' "').concat(c.name,'" of "').concat(u,'" loaded [').concat(o.startSN,",").concat(o.endSN,"]").concat(o.lastPartSn?"[part-".concat(o.lastPartSn,"-").concat(o.lastPartIndex,"]"):"",",duration:").concat(o.totalduration));var d=s[l],h=0;if(o.live||(a=d.details)!=null&&a.live){if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;if(d.details){var v;h=this.alignPlaylists(o,d.details,(v=this.levelLastLoaded)==null?void 0:v.details)}o.alignedSliding||(_0(o,f),o.alignedSliding||jo(o,f),h=o.fragmentStart)}d.details=o,this.levelLastLoaded=d,this.startFragRequested||this.setStartPosition(f,h),this.hls.trigger(S.AUDIO_TRACK_UPDATED,{details:o,id:l,groupId:r.groupId}),this.state===re.WAITING_TRACK&&!this.waitForCdnTuneIn(o)&&(this.state=re.IDLE),this.tick()}},{key:"_handleFragmentLoadProgress",value:function(e){var r,a=e.frag,s=e.part,o=e.payload,l=this.config,u=this.trackId,c=this.levels;if(!c){this.warn("Audio tracks were reset while fragment load was in progress. Fragment ".concat(a.sn," of level ").concat(a.level," will not be buffered"));return}var f=c[u];if(!f){this.warn("Audio track is undefined on fragment load progress");return}var d=f.details;if(!d){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(a.start);return}var h=l.defaultAudioCodec||f.audioCodec||"mp4a.40.2",v=this.transmuxer;v||(v=this.transmuxer=new B0(this.hls,fe.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var m=this.initPTS[a.cc],p=(r=a.initSegment)==null?void 0:r.data;if(m!==void 0){var g=!1,E=s?s.index:-1,y=E!==-1,_=new yf(a.level,a.sn,a.stats.chunkCount,o.byteLength,E,y);v.push(o,p,h,"",a,s,d.totalduration,g,_,m)}else{this.log("Unknown video PTS for cc ".concat(a.cc,", waiting for video PTS before demuxing audio frag ").concat(a.sn," of [").concat(d.startSN," ,").concat(d.endSN,"],track ").concat(u));var b=this.waitingData=this.waitingData||{frag:a,part:s,cache:new E0,complete:!1},C=b.cache;C.push(new Uint8Array(o)),this.state!==re.STOPPED&&(this.state=re.WAITING_INIT_PTS)}}},{key:"_handleFragmentLoadComplete",value:function(e){if(this.waitingData){this.waitingData.complete=!0;return}Ie(i,"_handleFragmentLoadComplete",this,3)([e])}},{key:"onBufferReset",value:function(){this.mediaBuffer=null}},{key:"onBufferCreated",value:function(e,r){this.bufferFlushed=this.flushing=!1;var a=r.tracks.audio;a&&(this.mediaBuffer=a.buffer||null)}},{key:"onFragLoading",value:function(e,r){!this.audioOnly&&r.frag.type===fe.MAIN&&Rt(r.frag)&&(this.mainFragLoading=r,this.state===re.IDLE&&this.tick())}},{key:"onFragBuffered",value:function(e,r){var a=r.frag,s=r.part;if(a.type!==fe.AUDIO){!this.audioOnly&&a.type===fe.MAIN&&!a.elementaryStreams.video&&!a.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(a)){this.warn("Fragment ".concat(a.sn).concat(s?" p: "+s.index:""," of level ").concat(a.level," finished buffering, but was aborted. state: ").concat(this.state,", audioSwitch: ").concat(this.switchingTrack?this.switchingTrack.name:"false"));return}if(Rt(a)){this.fragPrevious=a;var o=this.switchingTrack;o&&(this.bufferedTrack=o,this.switchingTrack=null,this.hls.trigger(S.AUDIO_TRACK_SWITCHED,et({},o)))}this.fragBufferedComplete(a,s),this.media&&this.tick()}},{key:"onError",value:function(e,r){var a;if(r.fatal){this.state=re.ERROR;return}switch(r.details){case K.FRAG_GAP:case K.FRAG_PARSING_ERROR:case K.FRAG_DECRYPT_ERROR:case K.FRAG_LOAD_ERROR:case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_ERROR:case K.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(fe.AUDIO,r);break;case K.AUDIO_TRACK_LOAD_ERROR:case K.AUDIO_TRACK_LOAD_TIMEOUT:case K.LEVEL_PARSING_ERROR:!r.levelRetry&&this.state===re.WAITING_TRACK&&((a=r.context)==null?void 0:a.type)===Be.AUDIO_TRACK&&(this.state=re.IDLE);break;case K.BUFFER_ADD_CODEC_ERROR:case K.BUFFER_APPEND_ERROR:if(r.parent!=="audio")return;this.reduceLengthAndFlushBuffer(r)||this.resetLoadingState();break;case K.BUFFER_FULL_ERROR:if(r.parent!=="audio")return;this.reduceLengthAndFlushBuffer(r)&&(this.bufferedTrack=null,Ie(i,"flushMainBuffer",this,3)([0,Number.POSITIVE_INFINITY,"audio"]));break;case K.INTERNAL_EXCEPTION:this.recoverWorkerError(r);break}}},{key:"onBufferFlushing",value:function(e,r){var a=r.type;a!==at.VIDEO&&(this.flushing=!0)}},{key:"onBufferFlushed",value:function(e,r){var a=r.type;if(a!==at.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===re.ENDED&&(this.state=re.IDLE);var s=this.mediaBuffer||this.media;s&&(this.afterBufferFlushed(s,a,fe.AUDIO),this.tick())}}},{key:"_handleTransmuxComplete",value:function(e){var r,a="audio",s=this.hls,o=e.remuxResult,l=e.chunkMeta,u=this.getCurrentContext(l);if(!u){this.resetWhenMissingContext(l);return}var c=u.frag,f=u.part,d=u.level,h=d.details,v=o.audio,m=o.text,p=o.id3,g=o.initSegment;if(this.fragContextChanged(c)||!h){this.fragmentTracker.removeFragment(c);return}if(this.state=re.PARSING,this.switchingTrack&&v&&this.completeAudioSwitch(this.switchingTrack),g!=null&&g.tracks){var E=c.initSegment||c;if(this.unhandledEncryptionError(g,c))return;this._bufferInitSegment(d,g.tracks,E,l),s.trigger(S.FRAG_PARSING_INIT_SEGMENT,{frag:E,id:a,tracks:g.tracks})}if(v){var y=v.startPTS,_=v.endPTS,b=v.startDTS,C=v.endDTS;f&&(f.elementaryStreams[at.AUDIO]={startPTS:y,endPTS:_,startDTS:b,endDTS:C}),c.setElementaryStreamInfo(at.AUDIO,y,_,b,C),this.bufferFragmentData(v,c,f,l)}if(p!=null&&(r=p.samples)!=null&&r.length){var R=nt({id:a,frag:c,details:h},p);s.trigger(S.FRAG_PARSING_METADATA,R)}if(m){var M=nt({id:a,frag:c,details:h},m);s.trigger(S.FRAG_PARSING_USERDATA,M)}}},{key:"_bufferInitSegment",value:function(e,r,a,s){if(this.state===re.PARSING&&(r.video&&delete r.video,r.audiovideo&&delete r.audiovideo,!!r.audio)){var o=r.audio;o.id=fe.AUDIO;var l=e.audioCodec;this.log("Init audio buffer, container:".concat(o.container,", codecs[level/parsed]=[").concat(l,"/").concat(o.codec,"]")),l&&l.split(",").length===1&&(o.levelCodec=l),this.hls.trigger(S.BUFFER_CODECS,r);var u=o.initSegment;if(u!=null&&u.byteLength){var c={type:"audio",frag:a,part:null,chunkMeta:s,parent:a.type,data:u};this.hls.trigger(S.BUFFER_APPENDING,c)}this.tickImmediate()}}},{key:"loadFragment",value:function(e,r,a){var s=this.fragmentTracker.getState(e);if(this.switchingTrack||s===jt.NOT_LOADED||s===jt.PARTIAL){var o;
1if(!Rt(e))this._loadInitSegment(e,r);else if((o=r.details)!=null&&o.live&&!this.initPTS[e.cc]){this.log("Waiting for video PTS in continuity counter ".concat(e.cc," of live stream before loading audio fragment ").concat(e.sn," of level ").concat(this.trackId)),this.state=re.WAITING_INIT_PTS;var l=this.mainDetails;l&&l.fragmentStart!==r.details.fragmentStart&&jo(r.details,l)}else Ie(i,"loadFragment",this,3)([e,r,a])}else this.clearTrackerIfNeeded(e)}},{key:"flushAudioIfNeeded",value:function(e){if(this.media&&this.bufferedTrack){var r=this.bufferedTrack,a=r.name,s=r.lang,o=r.assocLang,l=r.characteristics,u=r.audioCodec,c=r.channels;mn({name:a,lang:s,assocLang:o,characteristics:l,audioCodec:u,channels:c},e,pn)||(Mo(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),Ie(i,"flushMainBuffer",this,3)([0,Number.POSITIVE_INFINITY,"audio"]),this.bufferedTrack=null):this.bufferedTrack=e)}}},{key:"completeAudioSwitch",value:function(e){var r=this.hls;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,r.trigger(S.AUDIO_TRACK_SWITCHED,et({},e))}}]),i}(Sf),Rf=function(n){B(i,n);function i(t,e){var r;return k(this,i),r=Xe(this,i,[e,t.logger]),r.hls=void 0,r.canLoad=!1,r.timer=-1,r.hls=t,r}return A(i,[{key:"destroy",value:function(){this.clearTimer(),this.hls=this.log=this.warn=null}},{key:"clearTimer",value:function(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}},{key:"startLoad",value:function(){this.canLoad=!0,this.loadPlaylist()}},{key:"stopLoad",value:function(){this.canLoad=!1,this.clearTimer()}},{key:"switchParams",value:function(e,r,a){var s=r==null?void 0:r.renditionReports;if(s){for(var o=-1,l=0;l<s.length;l++){var u=s[l],c=void 0;try{c=new self.URL(u.URI,r.url).href}catch(p){this.warn("Could not construct new URL for Rendition Report: ".concat(p)),c=u.URI||""}if(c===e){o=l;break}else c===e.substring(0,c.length)&&(o=l)}if(o!==-1){var f=s[o],d=parseInt(f["LAST-MSN"])||r.lastPartSn,h=parseInt(f["LAST-PART"])||r.lastPartIndex;if(this.hls.config.lowLatencyMode){var v=Math.min(r.age-r.partTarget,r.targetduration);h>=0&&v>r.partTarget&&(h+=1)}var m=a&&Ly(a);return new Ry(d,h>=0?h:void 0,m)}}}},{key:"loadPlaylist",value:function(e){this.clearTimer()}},{key:"loadingPlaylist",value:function(e,r){this.clearTimer()}},{key:"shouldLoadPlaylist",value:function(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}},{key:"getUrlWithDirectives",value:function(e,r){if(r)try{return r.addDirectives(e)}catch(a){this.warn("Could not construct new URL with HLS Delivery Directives: ".concat(a))}return e}},{key:"playlistLoaded",value:function(e,r,a){var s=r.details,o=r.stats,l=self.performance.now(),u=o.loading.first?Math.max(0,l-o.loading.first):0;s.advancedDateTime=Date.now()-u;var c=this.hls.config.timelineOffset;if(c!==s.appliedTimelineOffset){var f=Math.max(c||0,0);s.appliedTimelineOffset=f,s.fragments.forEach(function(ee){ee.setStart(ee.playlistOffset+f)})}if(s.live||a!=null&&a.live){var d="levelInfo"in r?r.levelInfo:r.track;if(s.reloaded(a),a&&s.fragments.length>0){JL(a,s,this);var h=s.playlistParsingError;if(h){this.warn(h);var v=this.hls;if(!v.config.ignorePlaylistParsingErrors){var m,p=r.networkDetails;v.trigger(S.ERROR,{type:ge.NETWORK_ERROR,details:K.LEVEL_PARSING_ERROR,fatal:!1,url:s.url,error:h,reason:h.message,level:r.level||void 0,parent:(m=s.fragments[0])==null?void 0:m.type,networkDetails:p,stats:o});return}s.playlistParsingError=null}}s.requestScheduled===-1&&(s.requestScheduled=o.loading.start);var g=this.hls.mainForwardBufferInfo,E=g?g.end-g.len:0,y=(s.edge-E)*1e3,_=v0(s,y);if(s.requestScheduled+_<l?s.requestScheduled=l:s.requestScheduled+=_,this.log("live playlist ".concat(e," ").concat(s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:s.updated?"UPDATED":"MISSED")),!this.canLoad||!s.live)return;var b,C=void 0,R=void 0;if(s.canBlockReload&&s.endSN&&s.advanced){var M=this.hls.config.lowLatencyMode,D=s.lastPartSn,L=s.endSN,O=s.lastPartIndex,x=O!==-1,Y=D===L;x?Y?(C=L+1,R=M?0:O):(C=D,R=M?O+1:s.maxPartIndex):C=L+1;var $=s.age,Z=$+s.ageHeader,N=Math.min(Z-s.partTarget,s.targetduration*1.5);if(N>0){if(Z>s.targetduration*3)this.log("Playlist last advanced ".concat($.toFixed(2),"s ago. Omitting segment and part directives.")),C=void 0,R=void 0;else if(a!=null&&a.tuneInGoal&&Z-s.partTarget>a.tuneInGoal)this.warn("CDN Tune-in goal increased from: ".concat(a.tuneInGoal," to: ").concat(N," with playlist age: ").concat(s.age)),N=0;else{var j=Math.floor(N/s.targetduration);if(C+=j,R!==void 0){var z=Math.round(N%s.targetduration/s.partTarget);R+=z}this.log("CDN Tune-in age: ".concat(s.ageHeader,"s last advanced ").concat($.toFixed(2),"s goal: ").concat(N," skip sn ").concat(j," to part ").concat(R))}s.tuneInGoal=N}if(b=this.getDeliveryDirectives(s,r.deliveryDirectives,C,R),M||!Y){s.requestScheduled=l,this.loadingPlaylist(d,b);return}}else(s.canBlockReload||s.canSkipUntil)&&(b=this.getDeliveryDirectives(s,r.deliveryDirectives,C,R));b&&C!==void 0&&s.canBlockReload&&(s.requestScheduled=o.loading.first+Math.max(_-u*2,_/2)),this.scheduleLo
1ading(d,b,s)}else this.clearTimer()}},{key:"scheduleLoading",value:function(e,r,a){var s=this,o=a||e.details;if(!o){this.loadingPlaylist(e,r);return}var l=self.performance.now(),u=o.requestScheduled;if(l>=u){this.loadingPlaylist(e,r);return}var c=u-l;this.log("reload live playlist ".concat(e.name||e.bitrate+"bps"," in ").concat(Math.round(c)," ms")),this.clearTimer(),this.timer=self.setTimeout(function(){return s.loadingPlaylist(e,r)},c)}},{key:"getDeliveryDirectives",value:function(e,r,a,s){var o=Ly(e);return r!=null&&r.skip&&e.deltaUpdateFailed&&(a=r.msn,s=r.part,o=Ao.No),new Ry(a,s,o)}},{key:"checkRetry",value:function(e){var r=this,a=e.details,s=No(e),o=e.errorAction,l=o||{},u=l.action,c=l.retryCount,f=c===void 0?0:c,d=l.retryConfig,h=!!o&&!!d&&(u===Wt.RetryRequest||!o.resolved&&u===Wt.SendAlternateToPenaltyBox);if(h){var v;if(f>=d.maxNumRetry)return!1;if(s&&(v=e.context)!=null&&v.deliveryDirectives)this.warn("Retrying playlist loading ".concat(f+1,"/").concat(d.maxNumRetry,' after "').concat(a,'" without delivery-directives')),this.loadPlaylist();else{var m=mf(d,f);this.clearTimer(),this.timer=self.setTimeout(function(){return r.loadPlaylist()},m),this.warn("Retrying playlist loading ".concat(f+1,"/").concat(d.maxNumRetry,' after "').concat(a,'" in ').concat(m,"ms"))}e.levelRetry=!0,o.resolved=!0}return h}}]),i}(Hr);aO=function(n){B(i,n);function i(t){var e;return k(this,i),e=Xe(this,i,[t,"audio-track-controller"]),e.tracks=[],e.groupIds=null,e.tracksInGroup=[],e.trackId=-1,e.currentTrack=null,e.selectDefaultTrack=!0,e.registerListeners(),e}return A(i,[{key:"registerListeners",value:function(){var e=this.hls;e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.MANIFEST_PARSED,this.onManifestParsed,this),e.on(S.LEVEL_LOADING,this.onLevelLoading,this),e.on(S.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(S.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(S.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.MANIFEST_PARSED,this.onManifestParsed,this),e.off(S.LEVEL_LOADING,this.onLevelLoading,this),e.off(S.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(S.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(S.ERROR,this.onError,this)}},{key:"destroy",value:function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,Ie(i,"destroy",this,3)([])}},{key:"onManifestLoading",value:function(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}},{key:"onManifestParsed",value:function(e,r){this.tracks=r.audioTracks||[]}},{key:"onAudioTrackLoaded",value:function(e,r){var a=r.id,s=r.groupId,o=r.details,l=this.tracksInGroup[a];if(!l||l.groupId!==s){this.warn("Audio track with id:".concat(a," and group:").concat(s," not found in active group ").concat(l==null?void 0:l.groupId));return}var u=l.details;l.details=r.details,this.log("Audio track ".concat(a,' "').concat(l.name,'" lang:').concat(l.lang," group:").concat(s," loaded [").concat(o.startSN,"-").concat(o.endSN,"]")),a===this.trackId&&this.playlistLoaded(a,r,u)}},{key:"onLevelLoading",value:function(e,r){this.switchLevel(r.level)}},{key:"onLevelSwitching",value:function(e,r){this.switchLevel(r.level)}},{key:"switchLevel",value:function(e){var r=this.hls.levels[e];if(r){var a=r.audioGroups||null,s=this.groupIds,o=this.currentTrack;if(!a||(s==null?void 0:s.length)!==(a==null?void 0:a.length)||a!=null&&a.some(function(g){return(s==null?void 0:s.indexOf(g))===-1})){this.groupIds=a,this.trackId=-1,this.currentTrack=null;var l=this.tracks.filter(function(g){return!a||a.indexOf(g.groupId)!==-1});if(l.length)this.selectDefaultTrack&&!l.some(function(g){return g.default})&&(this.selectDefaultTrack=!1),l.forEach(function(g,E){g.id=E});else if(!o&&!this.tracksInGroup.length)return;this.tracksInGroup=l;var u=this.hls.config.audioPreference;if(!o&&u){var c=ui(u,l,pn);if(c>-1)o=l[c];else{var f=ui(u,this.tracks);o=this.tracks[f]}}var d=this.findTrackId(o);d===-1&&o&&(d=this.findTrackId(null));var h={audioTracks:l};this.log("Updating audio tracks, ".concat(l.length," track(s) found in group(s): ").concat(a==null?void 0:a.join(","))),this.hls.trigger(S.AUDIO_TRACKS_UPDATED,h);var v=this.trackId;if(d!==-1&&v===-1)this.setAudioTrack(d);else if(l.length&&v===-1){var m,p=new Error("No audio track selected for current audio group-ID(s): ".concat((m=this.groupIds)==null?void 0:m.join(",")," track count: ").concat(l.length));this.warn(p.message),this.hls.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:K.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:p})}}}}},{key:"onError",value:function(e,r){r.fatal||!r.context||r.context.type===Be.AUDIO_TRACK&&r.context.
1id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(r.context.groupId)!==-1)&&this.checkRetry(r)}},{key:"allAudioTracks",get:function(){return this.tracks}},{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}},{key:"setAudioOption",value:function(e){var r=this.hls;if(r.config.audioPreference=e,e){var a=this.allAudioTracks;if(this.selectDefaultTrack=!1,a.length){var s=this.currentTrack;if(s&&mn(e,s,pn))return s;var o=ui(e,this.tracksInGroup,pn);if(o>-1){var l=this.tracksInGroup[o];return this.setAudioTrack(o),l}else if(s){var u=r.loadLevel;u===-1&&(u=r.firstAutoLevel);var c=mL(e,r.levels,a,u,pn);if(c===-1)return null;r.nextLoadLevel=c}if(e.channels||e.audioCodec){var f=ui(e,a);if(f>-1)return a[f]}}}return null}},{key:"setAudioTrack",value:function(e){var r=this.tracksInGroup;if(e<0||e>=r.length){this.warn("Invalid audio track id: ".concat(e));return}this.selectDefaultTrack=!1;var a=this.currentTrack,s=r[e],o=s.details&&!s.details.live;if(!(e===this.trackId&&s===a&&o)&&(this.log("Switching to audio-track ".concat(e,' "').concat(s.name,'" lang:').concat(s.lang," group:").concat(s.groupId," channels:").concat(s.channels)),this.trackId=e,this.currentTrack=s,this.hls.trigger(S.AUDIO_TRACK_SWITCHING,et({},s)),!o)){var l=this.switchParams(s.url,a==null?void 0:a.details,s.details);this.loadPlaylist(l)}}},{key:"findTrackId",value:function(e){for(var r=this.tracksInGroup,a=0;a<r.length;a++){var s=r[a];if(!(this.selectDefaultTrack&&!s.default)&&(!e||mn(e,s,pn)))return a}if(e){for(var o=e.name,l=e.lang,u=e.assocLang,c=e.characteristics,f=e.audioCodec,d=e.channels,h=0;h<r.length;h++){var v=r[h];if(mn({name:o,lang:l,assocLang:u,characteristics:c,audioCodec:f,channels:d},v,pn))return h}for(var m=0;m<r.length;m++){var p=r[m];if(rs(e.attrs,p.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return m}for(var g=0;g<r.length;g++){var E=r[g];if(rs(e.attrs,E.attrs,["LANGUAGE"]))return g}}return-1}},{key:"loadPlaylist",value:function(e){Ie(i,"loadPlaylist",this,3)([]);var r=this.currentTrack;this.shouldLoadPlaylist(r)&&Mo(r.url,this.hls)&&this.scheduleLoading(r,e)}},{key:"loadingPlaylist",value:function(e,r){Ie(i,"loadingPlaylist",this,3)([e,r]);var a=e.id,s=e.groupId,o=this.getUrlWithDirectives(e.url,r),l=e.details,u=l==null?void 0:l.age;this.log("Loading audio-track ".concat(a,' "').concat(e.name,'" lang:').concat(e.lang," group:").concat(s).concat((r==null?void 0:r.msn)!==void 0?" at sn "+r.msn+" part "+r.part:"").concat(u&&l.live?" age "+u.toFixed(1)+(l.type&&" "+l.type||""):""," ").concat(o)),this.hls.trigger(S.AUDIO_TRACK_LOADING,{url:o,id:a,groupId:s,deliveryDirectives:r||null,track:e})}}]),i}(Rf),sO=function(){function n(i){k(this,n),this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=i}return A(n,[{key:"destroy",value:function(){this.tracks=this.queues=null}},{key:"append",value:function(t,e,r){if(!(this.queues===null||this.tracks===null)){var a=this.queues[e];a.push(t),a.length===1&&!r&&this.executeNext(e)}}},{key:"appendBlocker",value:function(t){var e=this;return new Promise(function(r){var a={label:"async-blocker",execute:r,onStart:function(){},onComplete:function(){},onError:function(){}};e.append(a,t)})}},{key:"prependBlocker",value:function(t){var e=this;return new Promise(function(r){if(e.queues){var a={label:"async-blocker-prepend",execute:r,onStart:function(){},onComplete:function(){},onError:function(){}};e.queues[t].unshift(a)}})}},{key:"removeBlockers",value:function(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(function(t){var e,r=(e=t[0])==null?void 0:e.label;(r==="async-blocker"||r==="async-blocker-prepend")&&(t[0].execute(),t.splice(0,1))})}},{key:"unblockAudio",value:function(t){if(this.queues!==null){var e=this.queues.audio;e[0]===t&&this.shiftAndExecuteNext("audio")}}},{key:"executeNext",value:function(t){if(!(this.queues===null||this.tracks===null)){var e=this.queues[t];if(e.length){var r=e[0];try{r.execute()}catch(o){var a;if(r.onError(o),this.queues===null||this.tracks===null)return;var s=(a=this.tracks[t])==null?void 0:a.buffer;s!=null&&s.updating||this.shiftAndExecuteNext(t)}}}}},{key:"shiftAndExecuteNext",value:function(t){this.queues!==null&&(this.queues[t].shift(),this.executeNext(t))}},{key:"current",value:function(t){var e;return((e=this.queues)==null?void 0:e[t][0])||null}},{key:"toString",value:function(){var t=this.queues,e=this.tracks;return t===null||e===null?"<destroyed>":"\n".concat(this.list("video"),"\n").concat(this.list("audio"),"\n").concat(this.list("audiovideo"),"}")}},{key:"list",value:function(t){var e,r;return(e=this.queues)!=null&&e[t]||(r=this.tracks)!=null&&r[t]?"".concat(t,": (").concat(this.listSbInfo(t),") ").concat(this.listOps(t)):""}},{key:"listSbInfo",value:function(t){var e,r=(e=this.tracks)==null?void 0:e[t],a=r==null?void 0:r.buffer;return a?"SourceBuffer".concat(a.updating?" updating":"").concat(r.ended?" ended":"").concat(r.ending?" ending":""):"none"}},{key:"listOps",value:function(t){var e;return((e=this.queues)==null?void 0:e[t].map(function(r){return r.label}).join(", "))||""}}]),n}(),v_=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,j0="HlsJsTrackRemovedError",oO=function(n){B(i,n);function i(t){var e;return k(this,i),e=Xe(this,i,[t]),e.name=j0,e}return A(i)}(Fr(Error)),lO=function(n){B(i,n);function i(t,e){var r;return k(this,i),r=Xe(this,i,["buffer-controller",t.logger]),r.hls=void 0,r.fragmentTracker=void 0,r.details=null,r._objectUrl=null,r.operationQueue=null,r.bufferCodecEventsTotal=0,r.media=null,r.mediaSource=null,r.lastMpegAudioChunk=null,r.blockedAudioAppend=null,r.lastVideoAppendEnd=0,r.appendSource=void 0,r.transferData=void 0,r.overrides=void 0,r.appendErrors={audio:0,video:0,audiovideo:0},r.tracks={},r.sourceBuffers=[[null,null],[null,null]],r._onEndStreaming=function(a){var s;r.hls&&((s=r.mediaSource)==null?void 0:s.readyState)==="open"&&r.hls.pauseBuffer
1ing()},r._onStartStreaming=function(a){r.hls&&r.hls.resumeBuffering()},r._onMediaSourceOpen=function(a){var s=qe(r),o=s.media,l=s.mediaSource;a&&r.log("Media source opened"),!(!o||!l)&&(l.removeEventListener("sourceopen",r._onMediaSourceOpen),o.removeEventListener("emptied",r._onMediaEmptied),r.updateDuration(),r.hls.trigger(S.MEDIA_ATTACHED,{media:o,mediaSource:l}),r.mediaSource!==null&&r.checkPendingTracks())},r._onMediaSourceClose=function(){r.log("Media source closed")},r._onMediaSourceEnded=function(){r.log("Media source ended")},r._onMediaEmptied=function(){var a=qe(r),s=a.mediaSrc,o=a._objectUrl;s!==o&&r.error("Media element src was set while attaching MediaSource (".concat(o," > ").concat(s,")"))},r.hls=t,r.fragmentTracker=e,r.appendSource=RC(qi(t.config.preferManagedMediaSource)),r.initTracks(),r.registerListeners(),r}return A(i,[{key:"hasSourceTypes",value:function(){return Object.keys(this.tracks).length>0}},{key:"destroy",value:function(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}},{key:"registerListeners",value:function(){var e=this.hls;e.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.MANIFEST_PARSED,this.onManifestParsed,this),e.on(S.BUFFER_RESET,this.onBufferReset,this),e.on(S.BUFFER_APPENDING,this.onBufferAppending,this),e.on(S.BUFFER_CODECS,this.onBufferCodecs,this),e.on(S.BUFFER_EOS,this.onBufferEos,this),e.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(S.FRAG_PARSED,this.onFragParsed,this),e.on(S.FRAG_CHANGED,this.onFragChanged,this),e.on(S.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.MANIFEST_PARSED,this.onManifestParsed,this),e.off(S.BUFFER_RESET,this.onBufferReset,this),e.off(S.BUFFER_APPENDING,this.onBufferAppending,this),e.off(S.BUFFER_CODECS,this.onBufferCodecs,this),e.off(S.BUFFER_EOS,this.onBufferEos,this),e.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(S.FRAG_PARSED,this.onFragParsed,this),e.off(S.FRAG_CHANGED,this.onFragChanged,this),e.off(S.ERROR,this.onError,this)}},{key:"transferMedia",value:function(){var e=this,r=this.media,a=this.mediaSource;if(!r)return null;var s={};if(this.operationQueue){var o=this.isUpdating();o||this.operationQueue.removeBlockers();var l=this.isQueued();(o||l)&&this.warn("Transfering MediaSource with".concat(l?" operations in queue":"").concat(o?" updating SourceBuffer(s)":""," ").concat(this.operationQueue)),this.operationQueue.destroy()}var u=this.transferData;return!this.sourceBufferCount&&u&&u.mediaSource===a?nt(s,u.tracks):this.sourceBuffers.forEach(function(c){var f=Te(c,1),d=f[0];d&&(s[d]=nt({},e.tracks[d]),e.removeBuffer(d)),c[0]=c[1]=null}),{media:r,mediaSource:a,tracks:s}}},{key:"initTracks",value:function(){var e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}},{key:"onManifestLoading",value:function(){this.bufferCodecEventsTotal=0,this.details=null}},{key:"onManifestParsed",value:function(e,r){var a,s=2;(r.audio&&!r.video||!r.altAudio)&&(s=1),this.bufferCodecEventsTotal=s,this.log("".concat(s," bufferCodec event(s) expected.")),(a=this.transferData)!=null&&a.mediaSource&&this.sourceBufferCount&&s&&this.bufferCreated()}},{key:"onMediaAttaching",value:function(e,r){var a=this.media=r.media;this.transferData=this.overrides=void 0;var s=qi(this.appendSource);if(s){var o=!!r.mediaSource;(o||r.overrides)&&(this.transferData=r,this.overrides=r.overrides);var l=this.mediaSource=r.mediaSource||new s;if(this.assignMediaSource(l),o)this._objectUrl=a.src,this.attachTransferred();else{var u=this._objectUrl=self.URL.createObjectURL(l);if(this.appendSource)try{a.removeAttribute("src");var c=self.ManagedMediaSource;a.disableRemotePlayback=a.disableRemotePlayback||c&&l instanceof c,p_(a),uO(a,u),a.load()}catch(f){a.src=u}else a.src=u}a.addEventListener("emptied",this._onMediaEmptied)}}},{key:"assignMediaSource",value:function(e){var r,a;this.log("".concat(((r=this.transferData)==null?void 0:r.mediaSource)===e?"transferred":"created"," media source: ").concat((a=e.constructor)==null?void 0:a.name)),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}},{key:"attachTransferred",value:function(){var e=this,r=this.media,a=this.transferData;if(!(!a||!r)){var s=this.tracks,o=a.tracks,l=o?Object.keys(o):null,u=l?l.length:0,c=function(){Promise.resolve().then(function(){e.media&&e.mediaSourceOpenOrEnded&&e._onMediaSourceOpen()})};if(o&&l&&u){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log("attachTransferred: (bufferCodecEventsTotal ".concat(this.bufferCodecEventsTotal,")\nrequired tracks: ").concat(st(s,function(v,m){return v==="initSegment"?void 0:m}),";\ntransfer tracks: ").concat(st(o,function(v,m){return v==="initSegment"?void 0:m}),"}")),!F_(o,s)){a.mediaSource=null,a.tracks=void 0;var f=r.currentTime,d=this.details,h=Math.max(f,(d==null?void 0:d.fragments[0].start)||0);if(h-f>1){this.log("attachTransferred: waiting for playback to reach new tracks start time ".concat(f," -> ").concat(h));return}this.warn('attachTransferred: resetting MediaSource for incompatible tracks ("'.concat(Object.keys(o),'"->"').concat(Object.keys(s),'") start time: ').concat(h," currentTime: ").concat(f)),this.onMediaDetaching(S.MEDIA_DETACHING,{}
1),this.onMediaAttaching(S.MEDIA_ATTACHING,a),r.currentTime=h;return}this.transferData=void 0,l.forEach(function(v){var m=v,p=o[m];if(p){var g=p.buffer;if(g){var E=e.fragmentTracker,y=p.id;if(E.hasFragments(y)||E.hasParts(y)){var _=Fe.getBuffered(g);E.detectEvictedFragments(m,_,y,null,!0)}var b=Dc(m),C=[m,g];e.sourceBuffers[b]=C,g.updating&&e.operationQueue&&e.operationQueue.prependBlocker(m),e.trackSourceBuffer(m,p)}}}),c(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),c()}}},{key:"mediaSourceOpenOrEnded",get:function(){var e,r=(e=this.mediaSource)==null?void 0:e.readyState;return r==="open"||r==="ended"}},{key:"onMediaDetaching",value:function(e,r){var a=this,s=!!r.transferMedia;this.transferData=this.overrides=void 0;var o=this.media,l=this.mediaSource,u=this._objectUrl;if(l){if(this.log("media source ".concat(s?"transferring":"detaching")),s)this.sourceBuffers.forEach(function(h){var v=Te(h,1),m=v[0];m&&a.removeBuffer(m)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){var c=l.readyState==="open";try{for(var f=l.sourceBuffers,d=f.length;d--;)c&&f[d].abort(),l.removeSourceBuffer(f[d]);c&&l.endOfStream()}catch(h){this.warn("onMediaDetaching: ".concat(h.message," while calling endOfStream"))}}this.sourceBufferCount&&this.onBufferReset()}l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(l.removeEventListener("startstreaming",this._onStartStreaming),l.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}o&&(o.removeEventListener("emptied",this._onMediaEmptied),s||(u&&self.URL.revokeObjectURL(u),this.mediaSrc===u?(o.removeAttribute("src"),this.appendSource&&p_(o),o.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(S.MEDIA_DETACHED,r)}},{key:"onBufferReset",value:function(){var e=this;this.sourceBuffers.forEach(function(r){var a=Te(r,1),s=a[0];s&&e.resetBuffer(s)}),this.initTracks()}},{key:"resetBuffer",value:function(e){var r,a=(r=this.tracks[e])==null?void 0:r.buffer;if(this.removeBuffer(e),a)try{var s;(s=this.mediaSource)!=null&&s.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(a)}catch(o){this.warn("onBufferReset ".concat(e),o)}delete this.tracks[e]}},{key:"removeBuffer",value:function(e){this.removeBufferListeners(e),this.sourceBuffers[Dc(e)]=[null,null];var r=this.tracks[e];r&&(r.buffer=void 0)}},{key:"resetQueue",value:function(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new sO(this.tracks)}},{key:"onBufferCodecs",value:function(e,r){var a=this,s,o=this.tracks,l=Object.keys(r);this.log('BUFFER_CODECS: "'.concat(l,'" (current SB count ').concat(this.sourceBufferCount,")"));var u="audiovideo"in r&&(o.audio||o.video)||o.audiovideo&&("audio"in r||"video"in r),c=!u&&this.sourceBufferCount&&this.media&&l.some(function(f){return!o[f]});if(u||c){this.warn('Unsupported transition between "'.concat(Object.keys(o),'" and "').concat(l,'" SourceBuffers'));return}l.forEach(function(f){var d,h,v=r[f],m=v.id,p=v.codec,g=v.levelCodec,E=v.container,y=v.metadata,_=v.supplemental,b=o[f],C=(d=a.transferData)==null||(d=d.tracks)==null?void 0:d[f],R=C!=null&&C.buffer?C:b,M=(R==null?void 0:R.pendingCodec)||(R==null?void 0:R.codec),D=R==null?void 0:R.levelCodec;b||(b=o[f]={buffer:void 0,listeners:[],codec:p,supplemental:_,container:E,levelCodec:g,metadata:y,id:m});var L=ko(M,D),O=L==null?void 0:L.replace(v_,"$1"),x=ko(p,g),Y=(h=x)==null?void 0:h.replace(v_,"$1");x&&L&&O!==Y&&(f.slice(0,5)==="audio"&&(x=Po(x,a.appendSource)),a.log("switching codec ".concat(M," to ").concat(x)),x!==(b.pendingCodec||b.codec)&&(b.pendingCodec=x),b.container=E,a.appendChangeType(f,E,x))}),(this.tracksReady||this.sourceBufferCount)&&(r.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!r.video&&((s=r.audio)==null?void 0:s.id)==="main"&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}},{key:"sourceBufferTracks",get:function(){var e=this;return Object.keys(this.tracks).reduce(function(r,a){var s=e.tracks[a];return r[a]={id:s.id,container:s.container,codec:s.codec,levelCodec:s.levelCodec},r},{})}},{key:"appendChangeType",value:function(e,r,a){var s=this,o="".concat(r,";codecs=").concat(a),l={label:"change-type=".concat(o),execute:function(){var c=s.tracks[e];if(c){var f=c.buffer;f!=null&&f.changeType&&(s.log("changing ".concat(e," sourceBuffer type to ").concat(o)),f.changeType(o),c.codec=a,c.container=r)}s.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(c){s.warn("Failed to change ".concat(e," SourceBuffer type"),c)}};this.append(l,e,this.isPending(this.tracks[e]))}},{key:"blockAudio",value:function(e){var r=this,a,s=e.start,o=s+e.duration*.05,l=((a=this.fragmentTracker.getAppendedFrag(s,fe.MAIN))==null?void 0:a.gap)===!0;if(!l){var u={label:"block-audio",execute:function(){var f,d=r.tracks.video;(r.lastVideoAppendEnd>o||d!=null&&d.buffer&&Fe.isBuffered(d.buffer,o)||((f=r.fragmentTracker.getAppendedFrag(o,fe.MAIN))==null?void 0:f.gap)===!0)&&(r.blockedAudioAppend=null,r.shiftAndExecuteNext("audio"))},onStart:function(){},onComplete:function(){},onError:function(f){r.warn("Error executing block-audio operation",f)}};this.blockedAudioAppend={op:u,frag:e},this.append(u,"audio",!0)}}},{key:"unblockAudio",value:function(){var e=this.blockedAudioAppend,r=this.operationQueue;e&&r&&(this.blockedAudioAppend=null,r.unblockAudio(e.op))}},{key:"onBufferAppending",value:function(e,r){var a=this,s=this.tracks,o=r.data,l=r.type,u=r.parent,c=r.frag,f=r.part,d=r.chunkMeta,h=r.offset,v=d.buffering[l],m=c.sn,p=c.cc,g=self.performance.now();v.start=g;var E=c.stats.buffering,y=f?f.stats.buffering:null;E.start===0&&(E.start=g),y&&y.start===0&&(y.start=g);var _=s.audio,b=!1;l==="audio"&&(_==null?void 0:_.container)==="audio/mpeg"&&(b=!this.lastMpegAudioChunk||d.id===1||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);var C=s.video,R=C==null?void 0:C.buffer;if(R&&m!=="initSegment"){var M=f||c,D=this.blockedAudioAppend;if(l==="audio"&&u!=="main"&&!this.blockedAudioAppend&&!(C.ending||C.ended)){var L=M.start,O=L+M.duration*.05,x=R.buffered,Y=this.currentOp("video");!x.length&&!Y?this.blockAudio(M):!Y&&!Fe.isBuffered(R,O)&&this.lastVideoAppendEnd<O&&this.blockAudio(M)}else if(l==="video"){var $=M.end;if(D){var Z=D.frag.start;($>Z||$<this.lastVideoAppendEnd||Fe.isBuffered(R,Z))&&this.unblockAudio()}this.lastVideoAppendEnd=$}}var N=(f||c).start,j={label:"append-".concat(l),execute:function(){var ee;v.executeStart=self.performance.now();var U=(ee=a.tracks[l])==null?void 0:ee.buffer;U&&(b?a.updateTimestampOffset(U,N,.1,l,m,p):h!==void 0&&ce(h)&&a.updateTimestampOffset(U,h,1e-6,l,m,p)),a.appendExecutor(o,l)},onStart:function(){},onComplete:function(){var ee=self.performance.now();v.executeEnd=v.end=ee,E.first===0&&(E.first=ee),y&&y.first===0&&(y.first=ee);var U={};
1a.sourceBuffers.forEach(function(F){var H=Te(F,2),G=H[0],ve=H[1];G&&(U[G]=Fe.getBuffered(ve))}),a.appendErrors[l]=0,l==="audio"||l==="video"?a.appendErrors.audiovideo=0:(a.appendErrors.audio=0,a.appendErrors.video=0),a.hls.trigger(S.BUFFER_APPENDED,{type:l,frag:c,part:f,chunkMeta:d,parent:c.type,timeRanges:U})},onError:function(ee){var U,F={type:ge.MEDIA_ERROR,parent:c.type,details:K.BUFFER_APPEND_ERROR,sourceBufferName:l,frag:c,part:f,chunkMeta:d,error:ee,err:ee,fatal:!1},H=(U=a.media)==null?void 0:U.error;if(ee.code===DOMException.QUOTA_EXCEEDED_ERR||ee.name=="QuotaExceededError"||"quota"in ee)F.details=K.BUFFER_FULL_ERROR;else if(ee.code===DOMException.INVALID_STATE_ERR&&a.mediaSourceOpenOrEnded&&!H)F.errorAction=na(!0);else if(ee.name===j0&&a.sourceBufferCount===0)F.errorAction=na(!0);else{var G=++a.appendErrors[l];a.warn("Failed ".concat(G,"/").concat(a.hls.config.appendErrorMaxRetry,' times to append segment in "').concat(l,'" sourceBuffer (').concat(H||"no media error",")")),(G>=a.hls.config.appendErrorMaxRetry||H)&&(F.fatal=!0)}a.hls.trigger(S.ERROR,F)}};this.log('queuing "'.concat(l,'" append sn: ').concat(m).concat(f?" p: "+f.index:""," of ").concat(c.type===fe.MAIN?"level":"track"," ").concat(c.level," cc: ").concat(p)),this.append(j,l,this.isPending(this.tracks[l]))}},{key:"getFlushOp",value:function(e,r,a){var s=this;return this.log('queuing "'.concat(e,'" remove ').concat(r,"-").concat(a)),{label:"remove",execute:function(){s.removeExecutor(e,r,a)},onStart:function(){},onComplete:function(){s.hls.trigger(S.BUFFER_FLUSHED,{type:e})},onError:function(l){s.warn("Failed to remove ".concat(r,"-").concat(a,' from "').concat(e,'" SourceBuffer'),l)}}}},{key:"onBufferFlushing",value:function(e,r){var a=this,s=r.type,o=r.startOffset,l=r.endOffset;s?this.append(this.getFlushOp(s,o,l),s):this.sourceBuffers.forEach(function(u){var c=Te(u,1),f=c[0];f&&a.append(a.getFlushOp(f,o,l),f)}
1)}},{key:"onFragParsed",value:function(e,r){var a=this,s=r.frag,o=r.part,l=[],u=o?o.elementaryStreams:s.elementaryStreams;u[at.AUDIOVIDEO]?l.push("audiovideo"):(u[at.AUDIO]&&l.push("audio"),u[at.VIDEO]&&l.push("video"));var c=function(){var d=self.performance.now();s.stats.buffering.end=d,o&&(o.stats.buffering.end=d);var h=o?o.stats:s.stats;a.hls.trigger(S.FRAG_BUFFERED,{frag:s,part:o,stats:h,id:s.type})};l.length===0&&this.warn("Fragments must have at least one ElementaryStreamType set. type: ".concat(s.type," level: ").concat(s.level," sn: ").concat(s.sn)),this.blockBuffers(c,l).catch(function(f){a.warn("Fragment buffered callback ".concat(f)),a.stepOperationQueue(a.sourceBufferTypes)})}},{key:"onFragChanged",value:function(e,r){this.trimBuffers()}},{key:"bufferedToEnd",get:function(){var e=this;return this.sourceBufferCount>0&&!this.sourceBuffers.some(function(r){var a=Te(r,1),s=a[0];if(s){var o=e.tracks[s];if(o)return!o.ended||o.ending}return!1})}},{key:"onBufferEos",value:function(e,r){var a=this,s;this.sourceBuffers.forEach(function(u){var c=Te(u,1),f=c[0];if(f){var d=a.tracks[f];(!r.type||r.type===f)&&(d.ending=!0,d.ended||(d.ended=!0,a.log("".concat(f," buffer reached EOS"))))}});var o=((s=this.overrides)==null?void 0:s.endOfStream)!==!1,l=this.sourceBufferCount>0&&!this.sourceBuffers.some(function(u){var c=Te(u,1),f=c[0],d;return f&&!((d=a.tracks[f])!=null&&d.ended)});l?o?(this.log("Queueing EOS"),this.blockUntilOpen(function(){a.tracksEnded();var u=a.mediaSource;if(!u||u.readyState!=="open"){u&&a.log("Could not call mediaSource.endOfStream(). mediaSource.readyState: ".concat(u.readyState));return}a.log("Calling mediaSource.endOfStream()"),u.endOfStream(),a.hls.trigger(S.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(S.BUFFERED_TO_END,void 0)):r.type==="video"&&this.unblockAudio()}},{key:"tracksEnded",value:function(){var e=this;this.sourceBuffers.forEach(function(r){var a=Te(r,1),s=a[0];if(s!==null){var o=e.tracks[s];o&&(o.ending=!1)}})}},{key:"onLevelUpdated",value:function(e,r){var a=r.details;a.fragments.length&&(this.details=a,this.updateDuration())}},{key:"updateDuration",value:function(){var e=this;this.blockUntilOpen(function(){var r=e.getDurationAndRange();r&&e.updateMediaSource(r)})}},{key:"onError",value:function(e,r){if(r.details===K.BUFFER_APPEND_ERROR&&r.frag){var a,s=(a=r.errorAction)==null?void 0:a.nextAutoLevel;ce(s)&&s!==r.frag.level&&this.resetAppendErrors()}}},{key:"resetAppendErrors",value:function(){this.appendErrors={audio:0,video:0,audiovideo:0}}},{key:"trimBuffers",value:function(){var e=this.hls,r=this.details,a=this.media;if(!(!a||r===null)&&this.sourceBufferCount){var s=e.config,o=a.currentTime,l=r.levelTargetDuration,u=r.live&&s.liveBackBufferLength!==null?s.liveBackBufferLength:s.backBufferLength;if(ce(u)&&u>=0){var c=Math.max(u,l),f=Math.floor(o/l)*l-c;this.flushBackBuffer(o,l,f)}var d=s.frontBufferFlushThreshold;if(ce(d)&&d>0){var h=Math.max(s.maxBufferLength,d),v=Math.max(h,l),m=Math.floor(o/l)*l+v;this.flushFrontBuffer(o,l,m)}}}},{key:"flushBackBuffer",value:function(e,r,a){var s=this;this.sourceBuffers.forEach(function(o){var l=Te(o,2),u=l[0],c=l[1];if(c){var f=Fe.getBuffered(c);if(f.length>0&&a>f.start(0)){var d;s.hls.trigger(S.BACK_BUFFER_REACHED,{bufferEnd:a});var h=s.tracks[u];if((d=s.details)!=null&&d.live)s.hls.trigger(S.LIVE_BACK_BUFFER_REACHED,{bufferEnd:a});else if(h!=null&&h.ended){s.log("Cannot flush ".concat(u," back buffer while SourceBuffer is in ended state"));return}s.hls.trigger(S.BUFFER_FLUSHING,{startOffset:0,endOffset:a,type:u})}}})}},{key:"flushFrontBuffer",value:function(e,r,a){var s=this;this.sourceBuffers.forEach(function(o){var l=Te(o,2),u=l[0],c=l[1];if(c){var f=Fe.getBuffered(c),d=f.length;if(d<2)return;var h=f.start(d-1),v=f.end(d-1);if(a>h||e>=h&&e<=v)return;s.hls.trigger(S.BUFFER_FLUSHING,{startOffset:h,endOffset:1/0,type:u})}})}},{key:"getDurationAndRange",value:function(){var e,r=this.details,a=this.mediaSource;if(!r||!this.media||(a==null?void 0:a.readyState)!=="open")return null;var s=r.edge;if(r.live&&this.hls.config.liveDurationInfinity){var o=r.fragments.length;if(o&&a.setLiveSeekableRange){var l=Math.max(0,r.fragmentStart),u=Math.max(l,s);return{duration:1/0,start:l,end:u}}return{duration:1/0}}var c=(e=this.overrides)==null?void 0:e.duration;if(c)return ce(c)?{duration:c}:null;var f=this.media.duration,d=ce(a.duration)?a.duration:0;return s>d&&s>f||!ce(f)?{duration:s}:null}},{key:"updateMediaSource",value:function(e){var r=e.duration,a=e.start,s=e.end,o=this.mediaSource;!this.media||!o||o.readyState!=="open"||(o.duration!==r&&(ce(r)&&this.log("Updating MediaSource duration to ".concat(r.toFixed(3))),o.duration=r),a!==void 0&&s!==void 0&&(this.log("MediaSource duration is set to ".concat(o.duration,". Setting seekable range to ").concat(a,"-").concat(s,".")),o.setLiveSeekableRange(a,s)))}},{key:"tracksReady",get:function(){var e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}},{key:"checkPendingTracks",value:function(){var e=this.bufferCodecEventsTotal,r=this.pendingTrackCount,a=this.tracks;
1if(this.log("checkPendingTracks (pending: ".concat(r," codec events expected: ").concat(e,") ").concat(st(a))),this.tracksReady){var s,o=(s=this.transferData)==null?void 0:s.tracks;o&&Object.keys(o).length?this.attachTransferred():this.createSourceBuffers()}}},{key:"bufferCreated",value:function(){var e=this;if(this.sourceBufferCount){var r={};this.sourceBuffers.forEach(function(s){var o=Te(s,2),l=o[0],u=o[1];if(l){var c=e.tracks[l];r[l]={buffer:u,container:c.container,codec:c.codec,supplemental:c.supplemental,levelCodec:c.levelCodec,id:c.id,metadata:c.metadata}}}),this.hls.trigger(S.BUFFER_CREATED,{tracks:r}),this.log("SourceBuffers created. Running queue: ".concat(this.operationQueue)),this.sourceBuffers.forEach(function(s){var o=Te(s,1),l=o[0];e.executeNext(l)})}else{var a=new Error("could not create source buffer for media codec(s)");this.hls.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:K.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:a,reason:a.message})}}},{key:"createSourceBuffers",value:function(){var e=this.tracks,r=this.sourceBuffers,a=this.mediaSource;if(!a)throw new Error("createSourceBuffers called when mediaSource was null");for(var s in e){var o=s,l=e[o];if(this.isPending(l)){var u=this.getTrackCodec(l,o),c="".concat(l.container,";codecs=").concat(u);l.codec=u,this.log("creating sourceBuffer(".concat(c,")").concat(this.currentOp(o)?" Queued":""," ").concat(st(l)));try{var f=a.addSourceBuffer(c),d=Dc(o),h=[o,f];r[d]=h,l.buffer=f}catch(m){var v;this.error("error while trying to add sourceBuffer: ".concat(m.message)),this.shiftAndExecuteNext(o),(v=this.operationQueue)==null||v.removeBlockers(),delete this.tracks[o],this.hls.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:K.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:m,sourceBufferName:o,mimeType:c,parent:l.id});return}this.trackSourceBuffer(o,l)}}this.bufferCreated()}},{key:"getTrackCodec",value:function(e,r){var a=e.supplemental,s=e.codec;a&&(r==="video"||r==="audiovideo")&&Xa(a,"video")&&(s=QC(s,a));var o=ko(s,e.levelCodec);return o?r.slice(0,5)==="audio"?Po(o,this.appendSource):o:""}},{key:"trackSourceBuffer",value:function(e,r){var a=this,s=r.buffer;if(s){var o=this.getTrackCodec(r,e);this.tracks[e]={buffer:s,codec:o,container:r.container,levelCodec:r.levelCodec,supplemental:r.supplemental,metadata:r.metadata,id:r.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",function(l,u){var c=u.removedRanges;c!=null&&c.length&&a.hls.trigger(S.BUFFER_FLUSHED,{type:l})})}}},{key:"mediaSrc",get:function(){var e,r,a=((e=this.media)==null||(r=e.querySelector)==null?void 0:r.call(e,"source"))||this.media;return a==null?void 0:a.src}},{key:"onSBUpdateStart",value:function(e){var r=this.currentOp(e);r&&r.onStart()}},{key:"onSBUpdateEnd",value:function(e){var r;if(((r=this.mediaSource)==null?void 0:r.readyState)==="closed"){this.resetBuffer(e);return}var a=this.currentOp(e);a&&(a.onComplete(),this.shiftAndExecuteNext(e))}},{key:"onSBUpdateError",value:function(e,r){var a,s=new Error("".concat(e," SourceBuffer error. MediaSource readyState: ").concat((a=this.mediaSource)==null?void 0:a.readyState));this.error("".concat(s),r),this.hls.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:K.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:s,fatal:!1});var o=this.currentOp(e);o&&o.onError(s)}},{key:"updateTimestampOffset",value:function(e,r,a,s,o,l){var u=r-e.timestampOffset;Math.abs(u)>=a&&(this.log("Updating ".concat(s," SourceBuffer timestampOffset to ").concat(r," (sn: ").concat(o," cc: ").concat(l,")")),e.timestampOffset=r)}},{key:"removeExecutor",value:function(e,r,a){var s=this.media,o=this.mediaSource,l=this.tracks[e],u=l==null?void 0:l.buffer;if(!s||!o||!u){this.warn("Attempting to remove from the ".concat(e," SourceBuffer, but it does not exist")),this.shiftAndExecuteNext(e);return}var c=ce(s.duration)?s.duration:1/0,f=ce(o.duration)?o.duration:1/0,d=Math.max(0,r),h=Math.min(a,c,f);h>d&&(!l.ending||l.ended)?(l.ended=!1,this.log("Removing [".concat(d,",").concat(h,"] from the ").concat(e," SourceBuffer")),u.remove(d,h)):this.shiftAndExecuteNext(e)}},{key:"appendExecutor",value:function(e,r){var a=this.tracks[r],s=a==null?void 0:a.buffer;if(!s)throw new oO("Attempting to append to the ".concat(r," SourceBuffer, but it does not exist"));a.ending=!1,a.ended=!1,s.appendBuffer(e)}},{key:"blockUntilOpen",value:function(e){var r=this;if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(function(a){r.warn("SourceBuffer blocked callback ".concat(a)),r.stepOperation
1Queue(r.sourceBufferTypes)});else try{e()}catch(a){this.warn("Callback run without blocking ".concat(this.operationQueue," ").concat(a))}}},{key:"isUpdating",value:function(){return this.sourceBuffers.some(function(e){var r=Te(e,2),a=r[0],s=r[1];return a&&s.updating})}},{key:"isQueued",value:function(){var e=this;return this.sourceBuffers.some(function(r){var a=Te(r,1),s=a[0];return s&&!!e.currentOp(s)})}},{key:"isPending",value:function(e){return!!e&&!e.buffer}},{key:"blockBuffers",value:function(e){var r=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.sourceBufferTypes;if(!a.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);var s=this.operationQueue,o=a.map(function(u){return r.appendBlocker(u)}),l=a.length>1&&!!this.blockedAudioAppend;return l&&this.unblockAudio(),Promise.all(o).then(function(u){s===r.operationQueue&&(e(),r.stepOperationQueue(r.sourceBufferTypes))})}},{key:"stepOperationQueue",value:function(e){var r=this;e.forEach(function(a){var s,o=(s=r.tracks[a])==null?void 0:s.buffer;!o||o.updating||r.shiftAndExecuteNext(a)})}},{key:"append",value:function(e,r,a){this.operationQueue&&this.operationQueue.append(e,r,a)}},{key:"appendBlocker",value:function(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}},{key:"currentOp",value:function(e){return this.operationQueue?this.operationQueue.current(e):null}},{key:"executeNext",value:function(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}},{key:"shiftAndExecuteNext",value:function(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}},{key:"pendingTrackCount",get:function(){var e=this;return Object.keys(this.tracks).reduce(function(r,a){return r+(e.isPending(e.tracks[a])?1:0)},0)}},{key:"sourceBufferCount",get:function(){return this.sourceBuffers.reduce(function(e,r){var a=Te(r,1),s=a[0];return e+(s?1:0)},0)}},{key:"sourceBufferTypes",get:function(){return this.sourceBuffers.map(function(e){var r=Te(e,1),a=r[0];return a}).filter(function(e){return!!e})}},{key:"addBufferListener",value:function(e,r,a){var s=this.tracks[e];if(s){var o=s.buffer;if(o){var l=a.bind(this,e);s.listeners.push({event:r,listener:l}),o.addEventListener(r,l)}}}},{key:"removeBufferListeners",value:function(e){var r=this.tracks[e];if(r){var a=r.buffer;a&&(r.listeners.forEach(function(s){a.removeEventListener(s.event,s.listener)}),r.listeners.length=0)}}}]),i}(Hr);cO=function(){function n(i){k(this,n),this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=i,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}return A(n,[{key:"setStreamController",value:function(t){this.streamController=t}},{key:"destroy",value:function(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}},{key:"registerListeners",value:function(){var t=this.hls;t.on(S.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(S.MANIFEST_PARSED,this.onManifestParsed,this),t.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(S.BUFFER_CODECS,this.onBufferCodecs,this),t.on(S.MEDIA_DETACHING,this.onMediaDetaching,this)}},{key:"unregisterListener",value:function(){var t=this.hls;t.off(S.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(S.MANIFEST_PARSED,this.onManifestParsed,this),t.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(S.BUFFER_CODECS,this.onBufferCodecs,this),t.off(S.MEDIA_DETACHING,this.onMediaDetaching,this)}},{key:"onFpsDropLevelCapping",value:function(t,e){var r=this.hls.levels[e.droppedLevel];this.isLevelAllowed(r)&&this.restrictedLevels.push({bitrate:r.bitrate,height:r.height,width:r.width})}},{key:"onMediaAttaching",value:function(t,e){this.media=e.media instanceof HTMLVideoElement?e.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}},{key:"onManifestParsed",value:function(t,e){var r=this.hls;this.restrictedLevels=[],this.firstLevel=e.firstLevel,r.config.capLevelToPlayerSize&&e.video&&this.startCapping()}},{key:"onLevelsUpdated",value:function(t,e){this.timer&&ce(this.autoLevelCapping)&&this.detectPlayerSize()}},{key:"onBufferCodecs",value:function(t,e){var r=this.hls;r.config.capLevelToPlayerSize&&e.video&&this.startCapping()}},{key:"onMediaDetaching",value:function(){this.stopCapping(),this.media=null}},{key:"detectPlayerSize",value:function(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}var t=this.hls.levels;if(t.length){var e=this.hls,r=this.getMaxLevel(t.length-1);r!==this.autoLevelCapping&&e.logger.log("Setting autoLevelCapping to ".concat(r,": ").concat(t[r].height,"p@").concat(t[r].bitrate," for media ").concat(this.mediaWidth,"x").concat(this.mediaHeight)),e.autoLevelCapping=r,e.autoLevelEnabled&&e.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=e.autoLevelCapping}}}},{key:"getMaxLevel",value:function(t){var e=this,r=this.hls.levels;if(!r.length)return-1;var a=r.filter(function(s,o){return e.isLevelAllowed(s)&&o<=t});return this.clientRect=null,n.getMaxLevelByMediaSize(a,this.mediaWidth,this.mediaHeight)}},{key:"startCapping",value:function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}},{key:"stopCapping",value:function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}},{key:"getDimensions",value:function(){if(this.clientRect)return this.clientRect;var t=this.media,e={width:0,height:0};if(t){var r=t.getBoundingClientRect();e.width=r.width,e.height=r.height,!e.width&&!e.height&&(e.width=r.right-r.left||t.width||0,e.height=r.bottom-r.top||t.height||0)}return this.clientRect=e,e}},{key:"mediaWidth",get:function(){return this.getDimensions().width*this.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*this.contentScaleFactor}},{key:"contentScaleFactor",get:function(){var t=1;if(!this.hls.config.ignoreDevicePixelRatio)try{t=self.devicePixelRatio}catch(e){}return Math.min(t,this.hls.config.maxDevicePixelRatio)}},{key:"isLevelAllowed",value:function(t){var e=this.restrictedLevels;
1return!e.some(function(r){return t.bitrate===r.bitrate&&t.width===r.width&&t.height===r.height})}}],[{key:"getMaxLevelByMediaSize",value:function(t,e,r){if(!(t!=null&&t.length))return-1;for(var a=function(f,d){return d?f.width!==d.width||f.height!==d.height:!0},s=t.length-1,o=Math.max(e,r),l=0;l<t.length;l+=1){var u=t[l];if((u.width>=o||u.height>=o)&&a(u,t[l+1])){s=l;break}}return s}}]),n}(),fO={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},_r=fO,dO={HLS:"h"},hO=dO,yn=A(function n(i,t){k(this,n),Array.isArray(i)&&(i=i.map(function(e){return e instanceof n?e:new n(e)})),this.value=i,this.params=t}),vO="Dict";H0=A(function n(i){k(this,n),this.description=i}),m_="Bare Item",gO="Boolean";EO="Byte Sequence";TO="Integer";AO="Decimal";CO="String",LO=/[\x00-\x1f\x7f]+/;wO="Token";xO="Key";si="CMCD-Object",kt="CMCD-Request",hn="CMCD-Session",Ki="CMCD-Status",MO={br:si,ab:si,d:si,ot:si,tb:si,tpb:si,lb:si,tab:si,lab:si,url:si,pb:kt,bl:kt,tbl:kt,dl:kt,ltc:kt,mtp:kt,nor:kt,nrr:kt,rc:kt,sn:kt,sta:kt,su:kt,ttfb:kt,ttfbb:kt,ttlb:kt,cmsdd:kt,cmsds:kt,smrt:kt,df:kt,cs:kt,ts:kt,cid:hn,pr:hn,sf:hn,sid:hn,st:hn,v:hn,msd:hn,bs:Ki,bsd:Ki,cdn:Ki,rtp:Ki,bg:Ki,pt:Ki,ec:Ki,e:Ki},NO={REQUEST:kt};Y0="event";Ro=function(i){return Math.round(i)},HO=function n(i,t){return Array.isArray(i)?i.map(function(e){return n(e,t)}):i instanceof yn&&typeof i.value=="string"?new yn(n(i.value,t),i.params):(t.baseUrl&&(i=jO(i,t.baseUrl)),t.version===1?encodeURIComponent(i):i)},go=function(i){return Ro(i/100)*100},VO=function(i,t){var e=i;return t.version>=2&&(i instanceof yn&&typeof i.value=="string"?e=new yn([i]):typeof i=="string"&&(e=[i])),HO(e,t)},KO={br:Ro,d:Ro,bl:go,dl:go,mtp:go,nor:VO,rtp:go,tb:Ro},z0="request",J0="response",wf=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],WO=["e"],qO=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;X0=["d","dl","nor","ot","rtp","su"];JO=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];QO=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];ZO=V(V(V({},J0,XO),Y0,YO),z0,zO);rw="CMCD";y_=/CMCD=[^&#]+/;ow=function(){function n(i){var t=this;k(this,n),this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){t.initialized&&(t.starved=!0),t.buffering=!0},this.onPlaying=function(){t.initialized||(t.initialized=!0),t.buffering=!1},this.applyPlaylistData=function(a){try{t.apply(a,{ot:_r.MANIFEST,su:!t.initialized})}catch(s){t.hls.logger.warn("Could not generate manifest CMCD data.",s)}},this.applyFragmentData=function(a){try{var s=a.frag,o=a.part,l=t.hls.levels[s.level],u=t.getObjectType(s),c={d:(o||s).duration*1e3,ot:u};(u===_r.VIDEO||u===_r.AUDIO||u==_r.MUXED)&&(c.br=l.bitrate/1e3,c.tb=t.getTopBandwidth(u)/1e3,c.bl=t.getBufferLength(u));var f=o?t.getNextPart(o):t.getNextFrag(s);f!=null&&f.url&&f.url!==s.url&&(c.nor=f.url),t.apply(a,c)}catch(d){t.hls.logger.warn("Could not generate segment CMCD data.",d)}},this.hls=i;var e=this.config=i.config,r=e.cmcd;r!=null&&(e.pLoader=this.createPlaylistLoader(),e.fLoader=this.createFragmentLoader(),this.sid=r.sessionId||i.sessionId,this.cid=r.contentId,this.useHeaders=r.useHeaders===!0,this.includeKeys=r.includeKeys,this.registerListeners())}return A(n,[{key:"registerListeners",value:function(){var t=this.hls;t.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(S.MEDIA_DETACHED,this.onMediaDetached,this),t.on(S.BUFFER_CREATED,this.onBufferCreated,this)}},{key:"unregisterListeners",value:function(){var t=this.hls;t.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(S.MEDIA_DETACHED,this.onMediaDetached,this),t.off(S.BUFFER_CREATED,this.onBufferCreated,this)}},{key:"destroy",value:function(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}},{key:"onMediaAttached",value:function(t,e){this.media=e.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}},{key:"onMediaDetached",value:function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}},{key:"onBufferCreated",value:function(t,e){var r,a;this.audioBuffer=(r=e.tracks.audio)==null?void 0:r.buffer,this.videoBuffer=(a=e.tracks.video)==null?void 0:a.buffer}},{key:"createData",value:function(){var t;return{v:1,sf:hO.HLS,sid:this.sid,cid:this.cid,pr:(t=this.media)==null?void 0:t.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}},{key:"apply",value:function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};nt(e,this.createData());var r=e.ot===_r.INIT||e.ot===_r.VIDEO||e.ot===_r.MUXED;this.starved&&r&&(e.bs=!0,e.su=!0,this.starved=!1),e.su==null&&(e.su=this.buffering);var a=this.includeKeys;a&&(e=Object.keys(e).reduce(function(o,l){return a.includes(l)&&(o[l]=e[l]),o},{}));var s={baseUrl:t.url};this.useHeaders?(t.headers||(t.headers={}),tw(t.headers,e,s)):t.url=sw(t.url,e,s)}},{key:"getNextFrag",value:function(t){var e,r=(e=this.hls.levels[t.level])==null?void 0:e.details;if(r){var a=t.sn-r.startSN;return r.fragments[a+1]}}},{key:"getNextPart",value:function(t){var e,r=t.index,a=t.fragment,s=(e=this.hls.levels[a.level])==null||(e=e.details)==null?void 0:e.partList;if(s)for(var o=a.sn,l=s.length-1;l>=0;l--){var u=s[l];if(u.index===r&&u.fragment.sn===o)return s[l+1]}}},{key:"getObjectType",value:function(t){var e=t.type;if(e==="subtitle")return _r.TIMED_TEXT;if(t.sn==="initSegment")return _r.INIT;if(e==="audio")return _r.AUDIO;if(e==="main")return this.hls.audioTracks.length?_r.VIDEO:_r.MUXED}},{key:"getTopBandwidth",value:function(t){var e=0,r,a=this.hls;if(t===_r.AUDIO)r=a.audioTracks;else{var s=a.maxAutoLevel,o=s>-1?s+1:a.levels.length;r=a.levels.slice(0,o)}return r.forEach(function(l){l.bitrate>e&&(e=l.bitrate)}),e>0?e:NaN}},{key:"getBufferLength",value:function(t){var e=this.media,r=t===_r.AUDIO?this.audioBuffer:this.videoBuffer;if(!r||!e)return NaN;var a=Fe.bufferInfo(r,e.currentTime,this.config.maxBufferHole);return a.len*1e3}},{key:"createPlaylistLoader",value:function(){var t=this.config.pLoader,e=this.applyPlaylistData,r=t||this.config.loader;return function(){function a(s){k(this,a),this.loader=void 0,this.loader=new r(s)}return A(a,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}},{key:"destroy",value:function(){this.loader.destroy()}},{key:"abort",value:function(){this.loader.abort()}},{key:"load",value:function(o,l,u){e(o),this.loader.load(o,l,u)}}]),a}()}},{key:"createFragmentLoader",value:function(){var t=this.config.fLoa
1der,e=this.applyFragmentData,r=t||this.config.loader;return function(){function a(s){k(this,a),this.loader=void 0,this.loader=new r(s)}return A(a,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}},{key:"destroy",value:function(){this.loader.destroy()}},{key:"abort",value:function(){this.loader.abort()}},{key:"load",value:function(o,l,u){e(o),this.loader.load(o,l,u)}}]),a}()}}]),n}(),lw=3e5,uw=function(n){B(i,n);function i(t){var e;return k(this,i),e=Xe(this,i,["content-steering",t.logger]),e.hls=void 0,e.loader=null,e.uri=null,e.pathwayId=".",e._pathwayPriority=null,e.timeToLoad=300,e.reloadTimer=-1,e.updated=0,e.started=!1,e.enabled=!0,e.levels=null,e.audioTracks=null,e.subtitleTracks=null,e.penalizedPathways={},e.hls=t,e.registerListeners(),e}return A(i,[{key:"registerListeners",value:function(){var e=this.hls;e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(S.MANIFEST_PARSED,this.onManifestParsed,this),e.on(S.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(S.MANIFEST_PARSED,this.onManifestParsed,this),e.off(S.ERROR,this.onError,this))}},{key:"pathways",value:function(){return(this.levels||[]).reduce(function(e,r){return e.indexOf(r.pathwayId)===-1&&e.push(r.pathwayId),e},[])}},{key:"pathwayPriority",get:function(){return this._pathwayPriority},set:function(e){this.updatePathwayPriority(e)}},{key:"startLoad",value:function(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){var e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}},{key:"stopLoad",value:function(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}},{key:"clearTimeout",value:function(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}},{key:"destroy",value:function(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}},{key:"removeLevel",value:function(e){var r=this.levels;r&&(this.levels=r.filter(function(a){return a!==e}))}},{key:"onManifestLoading",value:function(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}},{key:"onManifestLoaded",value:function(e,r){var a=r.contentSteering;a!==null&&(this.pathwayId=a.pathwayId,this.uri=a.uri,this.started&&this.startLoad())}},{key:"onManifestParsed",value:function(e,r){this.audioTracks=r.audioTracks,this.subtitleTracks=r.subtitleTracks}},{key:"onError",value:function(e,r){var a=r.errorAction;if((a==null?void 0:a.action)===Wt.SendAlternateToPenaltyBox&&a.flags===Cr.MoveAllAlternatesMatchingHost){var s=this.levels,o=this._pathwayPriority,l=this.pathwayId;if(r.context){var u=r.context,c=u.groupId,f=u.pathwayId,d=u.type;c&&s?l=this.getPathwayForGroupId(c,d,l):f&&(l=f)}l in this.penalizedPathways||(this.penalizedPathways[l]=performance.now()),!o&&s&&(o=this.pathways()),o&&o.length>1&&(this.updatePathwayPriority(o),a.resolved=this.pathwayId!==l),r.details===K.BUFFER_APPEND_ERROR&&!r.fatal?a.resolved=!0:a.resolved||this.warn("Could not resolve ".concat(r.details,' ("').concat(r.error.message,'") with content-steering for Pathway: ').concat(l," levels: ").concat(s&&s.length," priorities: ").concat(st(o)," penalized: ").concat(st(this.penalizedPathways)))}}},{key:"filterParsedLevels",value:function(e){this.levels=e;var r=this.getLevelsForPathway(this.pathwayId);if(r.length===0){var a=e[0].pathwayId;this.log("No levels found in Pathway ".concat(this.pathwayId,'. Setting initial Pathway to "').concat(a,'"')),r=this.getLevelsForPathway(a),this.pathwayId=a}return r.length!==e.length&&this.log("Found ".concat(r.length,"/").concat(e.length,' levels in Pathway "').concat(this.pathwayId,'"')),r}},{key:"getLevelsForPathway",value:function(e){return this.levels===null?[]:this.levels.filter(function(r){return e===r.pathwayId})}},{key:"updatePathwayPriority",value:function(e){this._pathwayPriority=e;var r,a=this.penalizedPathways,s=performance.now();
1Object.keys(a).forEach(function(d){s-a[d]>lw&&delete a[d]});for(var o=0;o<e.length;o++){var l=e[o];if(!(l in a)){if(l===this.pathwayId)return;var u=this.hls.nextLoadLevel,c=this.hls.levels[u];if(r=this.getLevelsForPathway(l),r.length>0){this.log('Setting Pathway to "'.concat(l,'"')),this.pathwayId=l,g0(r),this.hls.trigger(S.LEVELS_UPDATED,{levels:r});var f=this.hls.levels[u];c&&f&&this.levels&&(f.attrs["STABLE-VARIANT-ID"]!==c.attrs["STABLE-VARIANT-ID"]&&f.bitrate!==c.bitrate&&this.log("Unstable Pathways change from bitrate ".concat(c.bitrate," to ").concat(f.bitrate)),this.hls.nextLoadLevel=u);break}}}}},{key:"getPathwayForGroupId",value:function(e,r,a){for(var s=this.getLevelsForPathway(a).concat(this.levels||[]),o=0;o<s.length;o++)if(r===Be.AUDIO_TRACK&&s[o].hasAudioGroup(e)||r===Be.SUBTITLE_TRACK&&s[o].hasSubtitleGroup(e))return s[o].pathwayId;return a}},{key:"clonePathways",value:function(e){var r=this,a=this.levels;if(a){var s={},o={};e.forEach(function(l){var u=l.ID,c=l["BASE-ID"],f=l["URI-REPLACEMENT"];if(!a.some(function(h){return h.pathwayId===u})){var d=r.getLevelsForPathway(c).map(function(h){var v=new Lt(h.attrs);v["PATHWAY-ID"]=u;var m=v.AUDIO&&"".concat(v.AUDIO,"_clone_").concat(u),p=v.SUBTITLES&&"".concat(v.SUBTITLES,"_clone_").concat(u);m&&(s[v.AUDIO]=m,v.AUDIO=m),p&&(o[v.SUBTITLES]=p,v.SUBTITLES=p);var g=$0(h.uri,v["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",f),E=new $a({attrs:v,audioCodec:h.audioCodec,bitrate:h.bitrate,height:h.height,name:h.name,url:g,videoCodec:h.videoCodec,width:h.width});if(h.audioGroups)for(var y=1;y<h.audioGroups.length;y++)E.addGroupId("audio","".concat(h.audioGroups[y],"_clone_").concat(u));if(h.subtitleGroups)for(var _=1;_<h.subtitleGroups.length;_++)E.addGroupId("text","".concat(h.subtitleGroups[_],"_clone_").concat(u));return E});a.push.apply(a,nr(d)),__(r.audioTracks,s,f,u),__(r.subtitleTracks,o,f,u)}})}}},{key:"loadSteeringManifest",value:function(e){var r=this,a=this.hls.config,s=a.loader;this.loader&&this.loader.destroy(),this.loader=new s(a);var o;try{o=new self.URL(e)}catch(v){this.enabled=!1,this.log("Failed to parse Steering Manifest URI: ".concat(e));return}if(o.protocol!=="data:"){var l=(this.hls.bandwidthEstimate||a.abrEwmaDefaultEstimate)|0;o.searchParams.set("_HLS_pathway",this.pathwayId),o.searchParams.set("_HLS_throughput",""+l)}var u={responseType:"json",url:o.href},c=a.steeringManifestLoadPolicy.default,f=c.errorRetry||c.timeoutRetry||{},d={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:f.maxNumRetry||0,retryDelay:f.retryDelayMs||0,maxRetryDelay:f.maxRetryDelayMs||0},h={onSuccess:function(m,p,g,E){r.log('Loaded steering manifest: "'.concat(o,'"'));var y=m.data;if((y==null?void 0:y.VERSION)!==1){r.log("Steering VERSION ".concat(y.VERSION," not supported!"));return}r.updated=performance.now(),r.timeToLoad=y.TTL;var _=y["RELOAD-URI"],b=y["PATHWAY-CLONES"],C=y["PATHWAY-PRIORITY"];if(_)try{r.uri=new self.URL(_,o).href}catch(M){r.enabled=!1,r.log("Failed to parse Steering Manifest RELOAD-URI: ".concat(_));return}r.scheduleRefresh(r.uri||g.url),b&&r.clonePathways(b);var R={steeringManifest:y,url:o.toString()};r.hls.trigger(S.STEERING_MANIFEST_LOADED,R),C&&r.updatePathwayPriority(C)},onError:function(m,p,g,E){if(r.log("Error loading steering manifest: ".concat(m.code," ").concat(m.text," (").concat(p.url,")")),r.stopLoad(),m.code===410){r.enabled=!1,r.log("Steering manifest ".concat(p.url," no longer available"));return}var y=r.timeToLoad*1e3;if(m.code===429){var _=r.loader;if(typeof(_==null?void 0:_.getResponseHeader)=="function"){var b=_.getResponseHeader("Retry-After");b&&(y=parseFloat(b)*1e3)}r.log("Steering manifest ".concat(p.url," rate limited"));return}r.scheduleRefresh(r.uri||p.url,y)},onTimeout:function(m,p,g){r.log("Timeout loading steering manifest (".concat(p.url,")")),r.scheduleRefresh(r.uri||p.url)}};this.log("Requesting steering manifest: ".concat(o)),this.loader.load(u,d,h)}},{key:"scheduleRefresh",value:function(e){var r=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.timeToLoad*1e3;this.clearTimeout(),this.reloadTimer=self.setTimeout(function(){var s,o=(s=r.hls)==null?void 0:s.media;if(o&&!o.ended){r.loadSteeringManifest(e);return}r.scheduleRefresh(e,r.timeToLoad*1e3)},a)}}]),i}
1(Hr);Z0=function(n){B(i,n);function i(t){var e;return k(this,i),e=Xe(this,i,["eme",t.logger]),e.hls=void 0,e.config=void 0,e.media=null,e.mediaResolved=void 0,e.keyFormatPromise=null,e.keySystemAccessPromises={},e._requestLicenseFailureCount=0,e.mediaKeySessions=[],e.keyIdToKeySessionPromise={},e.mediaKeys=null,e.setMediaKeysQueue=i.CDMCleanupPromise?[i.CDMCleanupPromise]:[],e.bannedKeyIds={},e.onMediaEncrypted=function(r){var a=r.initDataType,s=r.initData,o='"'.concat(r.type,'" event: init data type: "').concat(a,'"');if(e.debug(o),s!==null){if(!e.keyFormatPromise){var l=Object.keys(e.keySystemAccessPromises);l.length||(l=Wa(e.config));var u=l.map(Ic).filter(function(c){return!!c});e.keyFormatPromise=e.getKeyFormatPromise(u)}e.keyFormatPromise.then(function(c){var f=Io(c);if(a!=="sinf"||f!==gt.FAIRPLAY){e.log('Ignoring "'.concat(r.type,'" event with init data type: "').concat(a,'" for selected key-system ').concat(f));return}var d;try{var h=Gt(new Uint8Array(s)),v=Ef(JSON.parse(h).sinf),m=q_(v);if(!m)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");d=new Uint8Array(m.subarray(8,24))}catch(M){e.warn("".concat(o," Failed to parse sinf: ").concat(M));return}for(var p=tr(d),g=qe(e),E=g.keyIdToKeySessionPromise,y=g.mediaKeySessions,_=E[p],b=function(){var D=y[R],L=D.decryptdata;if(!L.keyId)return 0;var O=tr(L.keyId);if(Uo(d,L.keyId)||L.uri.replace(/-/g,"").indexOf(p)!==-1)return _=E[O],_?(L.pssh||(delete E[O],L.pssh=new Uint8Array(s),L.keyId=d,_=E[p]=_.then(function(){return e.generateRequestWithPreferredKeySession(D,a,s,"encrypted-event-key-match")}),_.catch(function(x){return e.handleError(x)})),1):0},C,R=0;R<y.length&&(C=b(),!(C!==0&&C===1));R++);_||e.handleError(new Error("Key ID ".concat(p," not encountered in playlist. Key-system sessions ").concat(y.length,".")))}).catch(function(c){return e.handleError(c)})}},e.onWaitingForKey=function(r){e.log('"'.concat(r.type,'" event'))},e.hls=t,e.config=t.config,e.registerListeners(),e}return A(i,[{key:"destroy",value:function(){this.onDestroying(),this.onMediaDetached();var e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}},{key:"registerListeners",value:function(){this.hls.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(S.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(S.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(S.DESTROYING,this.onDestroying,this)}},{key:"unregisterListeners",value:function(){this.hls.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(S.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(S.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(S.DESTROYING,this.onDestroying,this)}},{key:"getLicenseServerUrl",value:function(e){var r=this.config,a=r.drmSystems,s=r.widevineLicenseUrl,o=a==null?void 0:a[e];if(o)return o.licenseUrl;if(e===gt.WIDEVINE&&s)return s}},{key:"getLicenseServerUrlOrThrow",value:function(e){var r=this.getLicenseServerUrl(e);if(r===void 0)throw new Error('no license server URL configured for key-system "'.concat(e,'"'));return r}},{key:"getServerCertificateUrl",value:function(e){var r=this.config.drmSystems,a=r==null?void 0:r[e];if(a)return a.serverCertificateUrl;this.log('No Server Certificate in config.drmSystems["'.concat(e,'"]'))}},{key:"attemptKeySystemAccess",value:function(e){var r=this,a=this.hls.levels,s=function(c,f,d){return!!c&&d.indexOf(c)===f},o=a.map(function(u){return u.audioCodec}).filter(s),l=a.map(function(u){return u.videoCodec}).filter(s);return o.length+l.length===0&&l.push("avc1.42e01e"),new Promise(function(u,c){var f=function d(h){var v=h.shift();r.getMediaKeysPromise(v,o,l).then(function(m){return u({keySystem:v,mediaKeys:m})}).catch(function(m){h.length?d(h):m instanceof Ir?c(m):c(new Ir({type:ge.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_ACCESS,error:m,fatal:!0},m.message))})};f(e)})}},{key:"requestMediaKeySystemAccess",value:function(e,r){var a=this.config.requestMediaKeySystemAccessFunc;if(typeof a!="function"){var s="Configured requestMediaKeySystemAccess is not a function ".concat(a);return u0===null&&self.location.protocol==="http:"&&(s="navigator.requestMediaKeySystemAccess is not available over insecure protocol ".concat(location.protocol)),Promise.reject(new Error(s))}return a(e,r)}},{key:"getMediaKeysPromise",value:function(e,r,a){var s=this,o,l=GL(e,r,a,this.config.drmSystemOptions||{}),u=this.keySystemAccessPromises[e],c=(o=u)==null?void 0:o.keySystemAccess;if(!c){this.log('Requesting encrypted media "'.concat(e,'" key-system access with config: ').concat(st(l))),c=this.requestMediaKeySystemAccess(e,l);var f=u=this.keySystemAccessPromises[e]={keySystemAccess:c};return c.catch(function(d){s.log('Failed to obtain access to key-system "'.concat(e,'": ').concat(d))}
1),c.then(function(d){s.log('Access for key-system "'.concat(d.keySystem,'" obtained'));var h=s.fetchServerCertificate(e);s.log('Create media-keys for "'.concat(e,'"'));var v=f.mediaKeys=d.createMediaKeys().then(function(m){return s.log('Media-keys created for "'.concat(e,'"')),f.hasMediaKeys=!0,h.then(function(p){return p?s.setMediaKeysServerCertificate(m,e,p):m})});return v.catch(function(m){s.error('Failed to create media-keys for "'.concat(e,'"}: ').concat(m))}),v})}return c.then(function(){return u.mediaKeys})}},{key:"createMediaKeySessionContext",value:function(e){var r=e.decryptdata,a=e.keySystem,s=e.mediaKeys;this.log('Creating key-system session "'.concat(a,'" keyId: ').concat(tr(r.keyId||[])," keyUri: ").concat(r.uri));var o=s.createSession(),l={decryptdata:r,keySystem:a,mediaKeys:s,mediaKeysSession:o,keyStatus:"status-pending"};return this.mediaKeySessions.push(l),l}},{key:"renewKeySession",value:function(e){var r=e.decryptdata;if(r.pssh){var a=this.createMediaKeySessionContext(e),s=yo(r),o="cenc";this.keyIdToKeySessionPromise[s]=this.generateRequestWithPreferredKeySession(a,o,r.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}},{key:"updateKeySession",value:function(e,r){var a=e.mediaKeysSession;return this.log('Updating key-session "'.concat(a.sessionId,'" for keyId ').concat(tr(e.decryptdata.keyId||[]),"\n } (data length: ").concat(r.byteLength,")")),a.update(r)}},{key:"getSelectedKeySystemFormats",value:function(){var e=this;return Object.keys(this.keySystemAccessPromises).map(function(r){return{keySystem:r,hasMediaKeys:e.keySystemAccessPromises[r].hasMediaKeys}}).filter(function(r){var a=r.hasMediaKeys;return!!a}).map(function(r){var a=r.keySystem;return Ic(a)}).filter(function(r){return!!r})}},{key:"getKeySystemAccess",value:function(e){var r=this;return this.getKeySystemSelectionPromise(e).then(function(a){var s=a.keySystem,o=a.mediaKeys;return r.attemptSetMediaKeys(s,o)})}},{key:"selectKeySystem",value:function(e){var r=this;return new Promise(function(a,s){r.getKeySystemSelectionPromise(e).then(function(o){var l=o.keySystem,u=Ic(l);u?a(u):s(new Error('Unable to find format for key-system "'.concat(l,'"')))}).catch(s)})}},{key:"selectKeySystemFormat",value:function(e){var r=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log("Selecting key-system from fragment (sn: ".concat(e.sn," ").concat(e.type,": ").concat(e.level,") key formats ").concat(r.join(", "))),this.keyFormatPromise=this.getKeyFormatPromise(r)),this.keyFormatPromise}},{key:"getKeyFormatPromise",value:function(e){var r=Wa(this.config),a=e.map(Io).filter(function(s){return!!s&&r.indexOf(s)!==-1});return this.selectKeySystem(a)}},{key:"getKeyStatus",value:function(e){for(var r=this.mediaKeySessions,a=0;a<r.length;a++){var s=cw(e,r[a]);if(s)return s}}},{key:"loadKey",value:function(e){var r=this,a=e.keyInfo.decryptdata,s=yo(a),o=this.bannedKeyIds[s];if(o||this.getKeyStatus(a)==="internal-error"){var l=E_(o||"internal-error",a);return this.handleError(l,e.frag),Promise.reject(l)}var u="(keyId: ".concat(s,' format: "').concat(a.keyFormat,'" method: ').concat(a.method," uri: ").concat(a.uri,")");this.log("Starting session for key ".concat(u));var c=this.keyIdToKeySessionPromise[s];if(!c){var f=this.getKeySystemForKeyPromise(a).then(function(d){var h=d.keySystem,v=d.mediaKeys;return r.throwIfDestroyed(),r.log("Handle encrypted media sn: ".concat(e.frag.sn," ").concat(e.frag.type,": ").concat(e.frag.level," using key ").concat(u)),r.attemptSetMediaKeys(h,v).then(function(){return r.throwIfDestroyed(),r.createMediaKeySessionContext({keySystem:h,mediaKeys:v,decryptdata:a})})}).then(function(d){var h="cenc",v=a.pssh?a.pssh.buffer:null;return r.generateRequestWithPreferredKeySession(d,h,v,"playlist-key")});return f.catch(function(d){return r.handleError(d,e.frag)}),this.keyIdToKeySessionPromise[s]=f,f}return c.catch(function(d){if(d instanceof Ir){var h=et({},d.data);r.getKeyStatus(a)==="internal-error"&&(h.decryptdata=a);var v=new Ir(h,d.message);r.handleError(v,e.frag)}}),c}},{key:"throwIfDestroyed",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"Invalid state";if(!this.hls)throw new Error("invalid state")}},{key:"handleError",value:function(e,r){if(this.hls)if(e instanceof Ir){r&&(e.data.frag=r);var a=e.data.decryptdata;this.error("".concat(e.message).concat(a?" (".concat(tr(a.keyId||[]),")"):"")),this.hls.trigger(S.ERROR,e.data)}else this.error(e.message),this.hls.trigger(S.ERROR,{type:ge.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}},{key:"getKeySystemForKeyPromise",value:function(e){var r=yo(e),a=this.keyIdToKeySessionPromise[r];if(!a){var s=Io(e.keyFormat),o=s?[s]:Wa(this.config);return this.attemptKeySystemAccess(o)}return a}},{key:"getKeySystemSelectionPromise",value:function(e){if(e.length||(e=Wa(this.config)),e.length===0)throw new Ir({type:ge.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options ".concat(st({drmSystems:this.config.drmSystems})));return this.attemptKeySystemAccess(e)}},{key:"attemptSetMediaKeys",value:function(e,r){var a=this;if(this.mediaResolved=void 0,this.mediaKeys===r)return Promise.resolve();var s=this.setMediaKeysQueue.slice();this.log('Setting media-keys for "'.concat(e,'"'));var o=Promise.all(s).then(function(){return a.media?a.media.setMediaKeys(r):new Promise(function(l,u){a.mediaResolved=function(){if(a.mediaResolved=void 0,!a.media)return u(new Error("Attempted to set mediaKeys without media element attached"));a.mediaKeys=r,a.media.setMediaKeys(r).then(l).catch(u)}})});return this.mediaKeys=r,this.setMediaKeysQueue.push(o),o.then(function(){a.log('Media-keys set for "'.concat(e,'"')),s.push(o),a.setMediaKeysQueue=a.setMediaKeysQueue.filter(function(l){return s.indexOf(l)===-1})})}},{key:"generateRequestWithPreferredKeySession",value:function(e,r,a,s){var o=this,l,u=(l=this.config.drmSystems)==null||(l=l[e.keySystem])==null?void 0:l.generateRequest;if(u)try{var c=u.call(this.hls,r,a,e);if(!c)throw new Error("Invalid response from configured generateRequest filter");r=c.initDataType,a=c.initData?c.initData:null,e.decryptdata.pssh=a?new Uint8Array(a):null}
1catch(E){if(this.warn(E.message),this.hls&&this.hls.config.debug)throw E}if(a===null)return this.log('Skipping key-session request for "'.concat(s,'" (no initData)')),Promise.resolve(e);var f=yo(e.decryptdata),d=e.decryptdata.uri;this.log('Generating key-session request for "'.concat(s,'" keyId: ').concat(f," URI: ").concat(d," (init data type: ").concat(r," length: ").concat(a.byteLength,")"));var h=new Tf,v=e._onmessage=function(E){var y=e.mediaKeysSession;if(!y){h.emit("error",new Error("invalid state"));return}var _=E.messageType,b=E.message;o.log('"'.concat(_,'" message event for session "').concat(y.sessionId,'" message size: ').concat(b.byteLength)),_==="license-request"||_==="license-renewal"?o.renewLicense(e,b).catch(function(C){h.eventNames().length?h.emit("error",C):o.handleError(C)}):_==="license-release"?e.keySystem===gt.FAIRPLAY&&o.updateKeySession(e,$c("acknowledged")).then(function(){return o.removeSession(e)}).catch(function(C){return o.handleError(C)}):o.warn('unhandled media key message type "'.concat(_,'"'))},m=function(y,_){_.keyStatus=y;var b;y.startsWith("usable")?h.emit("resolved"):y==="internal-error"||y==="output-restricted"||y==="output-downscaled"?b=E_(y,_.decryptdata):y==="expired"?b=new Error("key expired (keyId: ".concat(f,")")):y==="released"?b=new Error("key released"):y==="status-pending"||o.warn('unhandled key status change "'.concat(y,'" (keyId: ').concat(f,")")),b&&(h.eventNames().length?h.emit("error",b):o.handleError(b))},p=e._onkeystatuseschange=function(E){var y=e.mediaKeysSession;if(!y){h.emit("error",new Error("invalid state"));return}var _=o.getKeyStatuses(e),b=Object.keys(_);if(b.some(function(D){return _[D]!=="status-pending"})){if(_[f]==="expired"){o.log("Expired key ".concat(st(_),' in key-session "').concat(e.mediaKeysSession.sessionId,'"')),o.renewKeySession(e);return}var C=_[f];if(C)m(C,e);else{var R,M=1e3;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(R=e.keyStatusTimeouts)[f]||(R[f]=self.setTimeout(function(){if(!(!e.mediaKeysSession||!o.mediaKeys)){var D=o.getKeyStatus(e.decryptdata);if(D&&D!=="status-pending")return o.log("No status for keyId ".concat(f,' in key-session "').concat(e.mediaKeysSession.sessionId,'". Using session key-status ').concat(D," from other session.")),m(D,e);o.log("key status for ".concat(f,' in key-session "').concat(e.mediaKeysSession.sessionId,'" timed out after ').concat(M,"ms")),C="internal-error",m(C,e)}},M)),o.log("No status for keyId ".concat(f," (").concat(st(_),")."))}}};vr(e.mediaKeysSession,"message",v),vr(e.mediaKeysSession,"keystatuseschange",p);var g=new Promise(function(E,y){h.on("error",y),h.on("resolved",E)});return e.mediaKeysSession.generateRequest(r,a).then(function(){o.log('Request generated for key-session "'.concat(e.mediaKeysSession.sessionId,'" keyId: ').concat(f," URI: ").concat(d))}).catch(function(E){throw new Ir({type:ge.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_SESSION,error:E,decryptdata:e.decryptdata,fatal:!1},"Error generating key-session request: ".concat(E))}).then(function(){return g}).catch(function(E){return h.removeAllListeners(),o.removeSession(e).then(function(){throw E})}).then(function(){return h.removeAllListeners(),e})}},{key:"getKeyStatuses",value:function(e){var r=this,a={};return e.mediaKeysSession.keyStatuses.forEach(function(s,o){if(typeof o=="string"&&pe(s)==="object"){var l=o;o=s,s=l}var u="buffer"in o?new Uint8Array(o.buffer,o.byteOffset,o.byteLength):new Uint8Array(o);if(e.keySystem===gt.PLAYREADY&&u.length===16){var c=tr(u);a[c]=s,o0(u)}var f=tr(u);s==="internal-error"&&(r.bannedKeyIds[f]=s),r.log('key status change "'.concat(s,'" for keyStatuses keyId: ').concat(f,' key-session "').concat(e.mediaKeysSession.sessionId,'"')),a[f]=s}),a}},{key:"fetchServerCertificate",value:function(e){var r=this.config,a=r.loader,s=new a(r),o=this.getServerCertificateUrl(e);return o?(this.log('Fetching server certificate for "'.concat(e,'"')),new Promise(function(l,u){var c={responseType:"arraybuffer",url:o},f=r.certLoadPolicy.default,d={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:function(m,p,g,E){l(m.data)},onError:function(m,p,g,E){u(new Ir({type:ge.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:g,response:et({url:c.url,data:void 0},m)},'"'.concat(e,'" certificate request failed (').concat(o,"). Status: ").concat(m.code," (").concat(m.text,")")))},onTimeout:function(m,p,g){u(new Ir({type:ge.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:g,response:{url:c.url,data:void 0}},'"'.concat(e,'" certificate request timed out (').concat(o,")")))},onAbort:function(m,p,g){u(new Error("aborted"))}};s.load(c,d,h)})):Promise.resolve()}},{key:"setMediaKeysServerCertificate",value:function(e,r,a){var s=this;return new Promise(function(o,l){e.setServerCertificate(a).then(function(u){s.log("setServerCertificate ".concat(u?"success":"not supported by CDM"," (").concat(a.byteLength,') on "').concat(r,'"')),o(e)}).catch(function(u){l(new Ir({type:ge.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:u,fatal:!0},u.message))})})}},{key:"renewLicense",value:function(e,r){var a=this;return this.requestLicense(e,new Uint8Array(r)).then(function(s){return a.updateKeySession(e,new Uint8Array(s)).catch(function(o){throw new Ir({type:ge.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:o,fatal:!1},o.message)})})}},{key:"unpackPlayReadyKeyMessage",value:function(e,r){var a=String.fromCharCode.apply(null,new Uint16Array(r.buffer));if(!a.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),r;var s=new DOMParser().parseFromString(a,"application/xml"),o=s.querySelectorAll("HttpHeader");if(o.length>0)for(var l,u=0,c=o.length;u<c;u++){var f,d;l=o[u];var h=(f=l.querySelector("name"))==null?void 0:f.textContent,v=(d=l.querySelector("value"))==null?void 0:d.textContent;h&&v&&e.setRequestHeader(h,v)}var m=s.querySelector("Challenge"),p=m==null?void 0:m.textContent;
1if(!p)throw new Error("Cannot find <Challenge> in key message");return $c(atob(p))}},{key:"setupLicenseXHR",value:function(e,r,a,s){var o=this,l=this.config.licenseXhrSetup;return l?Promise.resolve().then(function(){if(!a.decryptdata)throw new Error("Key removed");return l.call(o.hls,e,r,a,s)}).catch(function(u){if(!a.decryptdata)throw u;return e.open("POST",r,!0),l.call(o.hls,e,r,a,s)}).then(function(u){e.readyState||e.open("POST",r,!0);var c=u||s;return{xhr:e,licenseChallenge:c}}):(e.open("POST",r,!0),Promise.resolve({xhr:e,licenseChallenge:s}))}},{key:"requestLicense",value:function(e,r){var a=this,s=this.config.keyLoadPolicy.default;return new Promise(function(o,l){var u=a.getLicenseServerUrlOrThrow(e.keySystem);a.log("Sending license request to URL: ".concat(u));var c=new XMLHttpRequest;c.responseType="arraybuffer",c.onreadystatechange=function(){if(!a.hls||!e.mediaKeysSession)return l(new Error("invalid state"));if(c.readyState===4)if(c.status===200){a._requestLicenseFailureCount=0;var f=c.response;a.log("License received ".concat(f instanceof ArrayBuffer?f.byteLength:f));var d=a.config.licenseResponseCallback;if(d)try{f=d.call(a.hls,c,u,e)}catch(p){a.error(p)}o(f)}else{var h=s.errorRetry,v=h?h.maxNumRetry:0;if(a._requestLicenseFailureCount++,a._requestLicenseFailureCount>v||c.status>=400&&c.status<500)l(new Ir({type:ge.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:c,response:{url:u,data:void 0,code:c.status,text:c.statusText}},"License Request XHR failed (".concat(u,"). Status: ").concat(c.status," (").concat(c.statusText,")")));else{var m=v-a._requestLicenseFailureCount+1;a.warn("Retrying license request, ".concat(m," attempts left")),a.requestLicense(e,r).then(o,l)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=c,a.setupLicenseXHR(c,u,e,r).then(function(f){var d=f.xhr,h=f.licenseChallenge;e.keySystem==gt.PLAYREADY&&(h=a.unpackPlayReadyKeyMessage(d,h)),d.send(h)}).catch(l)})}},{key:"onDestroying",value:function(){this.unregisterListeners(),this._clear()}},{key:"onMediaAttached",value:function(e,r){if(this.config.emeEnabled){var a=r.media;this.media=a,vr(a,"encrypted",this.onMediaEncrypted),vr(a,"waitingforkey",this.onWaitingForKey);var s=this.mediaResolved;s?s():this.mediaKeys=a.mediaKeys}}},{key:"onMediaDetached",value:function(){var e=this.media;e&&(Er(e,"encrypted",this.onMediaEncrypted),Er(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}},{key:"_clear",value:function(){var e=this,r;this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={};var a=this.mediaResolved;if(a&&a(),!(!this.mediaKeys&&!this.mediaKeySessions.length)){var s=this.media,o=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,Go.clearKeyUriToKeyIdMap();var l=o.length;i.CDMCleanupPromise=Promise.all(o.map(function(u){return e.removeSession(u)}).concat((s==null||(r=s.setMediaKeys(null))==null?void 0:r.catch(function(u){e.log("Could not clear media keys: ".concat(u)),e.hls&&e.hls.trigger(S.ERROR,{type:ge.OTHER_ERROR,details:K.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error("Could not clear media keys: ".concat(u))})}))||Promise.resolve())).catch(function(u){e.log("Could not close sessions and clear media keys: ".concat(u)),e.hls&&e.hls.trigger(S.ERROR,{type:ge.OTHER_ERROR,details:K.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error("Could not close sessions and clear media keys: ".concat(u))})}).then(function(){l&&e.log("finished closing key sessions and clearing media keys")})}}},{key:"onManifestLoading",value:function(){this._clear()}},{key:"onManifestLoaded",value:function(e,r){var a=r.sessionKeys;if(!(!a||!this.config.emeEnabled)&&!this.keyFormatPromise){var s=a.reduce(function(o,l){return o.indexOf(l.keyFormat)===-1&&o.push(l.keyFormat),o},[]);this.log("Selecting key-system from session-keys ".concat(s.join(", "))),this.keyFormatPromise=this.getKeyFormatPromise(s)}}},{key:"removeSession",value:function(e){var r=this,a=e.mediaKeysSession,s=e.licenseXhr,o=e.decryptdata;
1if(a){this.log('Remove licenses and keys and close session "'.concat(a.sessionId,'" keyId: ').concat(tr((o==null?void 0:o.keyId)||[]))),e._onmessage&&(a.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(a.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),s&&s.readyState!==XMLHttpRequest.DONE&&s.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;var l=this.mediaKeySessions.indexOf(e);l>-1&&this.mediaKeySessions.splice(l,1);var u=e.keyStatusTimeouts;u&&Object.keys(u).forEach(function(d){return self.clearTimeout(u[d])});var c=this.config.drmSystemOptions,f=HL(c)?new Promise(function(d,h){self.setTimeout(function(){return h(new Error("MediaKeySession.remove() timeout"))},8e3),a.remove().then(d).catch(h)}):Promise.resolve();return f.catch(function(d){r.log("Could not remove session: ".concat(d)),r.hls&&r.hls.trigger(S.ERROR,{type:ge.OTHER_ERROR,details:K.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error("Could not remove session: ".concat(d))})}).then(function(){return a.close()}).catch(function(d){r.log("Could not close session: ".concat(d)),r.hls&&r.hls.trigger(S.ERROR,{type:ge.OTHER_ERROR,details:K.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error("Could not close session: ".concat(d))})})}return Promise.resolve()}}]),i}(Hr);Z0.CDMCleanupPromise=void 0;Ir=function(n){B(i,n);function i(t,e){var r;return k(this,i),r=Xe(this,i,[e]),r.data=void 0,t.error||(t.error=new Error(e)),r.data=t,t.err=t.error,r}return A(i)}(Fr(Error));fw=function(){function n(i){k(this,n),this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=i,this.registerListeners()}return A(n,[{key:"setStreamController",value:function(t){this.streamController=t}},{key:"registerListeners",value:function(){this.hls.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(S.MEDIA_DETACHING,this.onMediaDetaching,this)}},{key:"unregisterListeners",value:function(){this.hls.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(S.MEDIA_DETACHING,this.onMediaDetaching,this)}},{key:"destroy",value:function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}},{key:"onMediaAttaching",value:function(t,e){var r=this.hls.config;if(r.capLevelOnFPSDrop){var a=e.media instanceof self.HTMLVideoElement?e.media:null;this.media=a,a&&typeof a.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),r.fpsDroppedMonitoringPeriod)}}},{key:"onMediaDetaching",value:function(){this.media=null}},{key:"checkFPS",value:function(t,e,r){var a=performance.now();if(e){if(this.lastTime){var s=a-this.lastTime,o=r-this.lastDroppedFrames,l=e-this.lastDecodedFrames,u=1e3*o/s,c=this.hls;if(c.trigger(S.FPS_DROP,{currentDropped:o,currentDecoded:l,totalDroppedFrames:r}),u>0&&o>c.config.fpsDroppedMonitoringThreshold*l){var f=c.currentLevel;c.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+f),f>0&&(c.autoLevelCapping===-1||c.autoLevelCapping>=f)&&(f=f-1,c.trigger(S.FPS_DROP_LEVEL_CAPPING,{level:f,droppedLevel:c.currentLevel}),c.autoLevelCapping=f,this.streamController.nextLevelSwitch())}}this.lastTime=a,this.lastDroppedFrames=r,this.lastDecodedFrames=e}}},{key:"checkFPSInterval",value:function(){var t=this.media;if(t)if(this.isVideoPlaybackQualityAvailable){var e=t.getVideoPlaybackQuality();this.checkFPS(t,e.totalVideoFrames,e.droppedVideoFrames)}else this.checkFPS(t,t.webkitDecodedFrameCount,t.webkitDroppedFrameCount)}}]),n}();vw=function(n){B(i,n);function i(t){var e;return k(this,i),e=Xe(this,i,[t,"subtitle-track-controller"]),e.media=null,e.tracks=[],e.groupIds=null,e.tracksInGroup=[],e.trackId=-1,e.currentTrack=null,e.selectDefaultTrack=!0,e.queuedDefaultTrack=-1,e.useTextTrackPolling=!1,e.subtitlePollingInterval=-1,e._subtitleDisplay=!0,e.asyncPollTrackChange=function(){return e.pollTrackChange(0)},e.onTextTracksChanged=function(){if(e.useTextTrackPolling||self.clearInterval(e.subtitlePollingInterval),!(!e.media||!e.hls.config.renderTextTracksNatively)){for(var r=null,a=Oo(e.media.textTracks),s=0;s<a.length;
1s++)if(a[s].mode==="hidden")r=a[s];else if(a[s].mode==="showing"){r=a[s];break}var o=e.findTrackForTextTrack(r);e.subtitleTrack!==o&&e.setSubtitleTrack(o)}},e.registerListeners(),e}return A(i,[{key:"destroy",value:function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,Ie(i,"destroy",this,3)([])}},{key:"subtitleDisplay",get:function(){return this._subtitleDisplay},set:function(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}},{key:"registerListeners",value:function(){var e=this.hls;e.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.MANIFEST_PARSED,this.onManifestParsed,this),e.on(S.LEVEL_LOADING,this.onLevelLoading,this),e.on(S.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(S.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(S.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.MANIFEST_PARSED,this.onManifestParsed,this),e.off(S.LEVEL_LOADING,this.onLevelLoading,this),e.off(S.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(S.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(S.ERROR,this.onError,this)}},{key:"onMediaAttached",value:function(e,r){this.media=r.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}},{key:"pollTrackChange",value:function(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}},{key:"onMediaDetaching",value:function(e,r){var a=this.media;if(a){var s=!!r.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||a.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,!s){var o=Oo(a.textTracks);o.forEach(function(l){ia(l)})}}}},{key:"onManifestLoading",value:function(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}},{key:"onManifestParsed",value:function(e,r){this.tracks=r.subtitleTracks}},{key:"onSubtitleTrackLoaded",value:function(e,r){var a=r.id,s=r.groupId,o=r.details,l=this.tracksInGroup[a];if(!l||l.groupId!==s){this.warn("Subtitle track with id:".concat(a," and group:").concat(s," not found in active group ").concat(l==null?void 0:l.groupId));return}var u=l.details;l.details=r.details,this.log("Subtitle track ".concat(a,' "').concat(l.name,'" lang:').concat(l.lang," group:").concat(s," loaded [").concat(o.startSN,"-").concat(o.endSN,"]")),a===this.trackId&&this.playlistLoaded(a,r,u)}},{key:"onLevelLoading",value:function(e,r){this.switchLevel(r.level)}},{key:"onLevelSwitching",value:function(e,r){this.switchLevel(r.level)}},{key:"switchLevel",value:function(e){var r=this.hls.levels[e];if(r){var a=r.subtitleGroups||null,s=this.groupIds,o=this.currentTrack;if(!a||(s==null?void 0:s.length)!==(a==null?void 0:a.length)||a!=null&&a.some(function(v){return(s==null?void 0:s.indexOf(v))===-1})){this.groupIds=a,this.trackId=-1,this.currentTrack=null;var l=this.tracks.filter(function(v){return!a||a.indexOf(v.groupId)!==-1});if(l.length)this.selectDefaultTrack&&!l.some(function(v){return v.default})&&(this.selectDefaultTrack=!1),l.forEach(function(v,m){v.id=m});else if(!o&&!this.tracksInGroup.length)return;this.tracksInGroup=l;var u=this.hls.config.subtitlePreference;if(!o&&u){this.selectDefaultTrack=!1;var c=ui(u,l);if(c>-1)o=l[c];else{var f=ui(u,this.tracks);o=this.tracks[f]}}var d=this.findTrackId(o);d===-1&&o&&(d=this.findTrackId(null));var h={subtitleTracks:l};this.log("Updating subtitle tracks, ".concat(l.length,' track(s) found in "').concat(a==null?void 0:a.join(","),'" group-id')),this.hls.trigger(S.SUBTITLE_TRACKS_UPDATED,h),d!==-1&&this.trackId===-1&&this.setSubtitleTrack(d)}}}},{key:"findTrackId",value:function(e){for(var r=this.tracksInGroup,a=this.selectDefaultTrack,s=0;s<r.length;s++){var o=r[s];if(!(a&&!o.default||!a&&!e)&&(!e||mn(o,e)))return s}if(e){for(var l=0;l<r.length;l++){var u=r[l];if(rs(e.attrs,u.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return l}for(var c=0;c<r.length;c++){var f=r[c];if(rs(e.attrs,f.attrs,["LANGUAGE"]))return c}}return-1}},{key:"findTrackForTextTrack",value:function(e){if(e)for(var r=this.tracksInGroup,a=0;a<r.length;a++){var s=r[a];if(nf(s,e))return a}return-1}},{key:"onError",value:function(e,r){r.fatal||!r.context||r.context.type===Be.SUBTITLE_TRACK&&r.context.
1id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(r.context.groupId)!==-1)&&this.checkRetry(r)}},{key:"allSubtitleTracks",get:function(){return this.tracks}},{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}},{key:"setSubtitleOption",value:function(e){if(this.hls.config.subtitlePreference=e,e){if(e.id===-1)return this.setSubtitleTrack(-1),null;var r=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,r.length){var a=this.currentTrack;if(a&&mn(e,a))return a;var s=ui(e,this.tracksInGroup);if(s>-1){var o=this.tracksInGroup[s];return this.setSubtitleTrack(s),o}else{if(a)return null;var l=ui(e,r);if(l>-1)return r[l]}}}return null}},{key:"loadPlaylist",value:function(e){Ie(i,"loadPlaylist",this,3)([]),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}},{key:"loadingPlaylist",value:function(e,r){Ie(i,"loadingPlaylist",this,3)([e,r]);var a=e.id,s=e.groupId,o=this.getUrlWithDirectives(e.url,r),l=e.details,u=l==null?void 0:l.age;this.log("Loading subtitle ".concat(a,' "').concat(e.name,'" lang:').concat(e.lang," group:").concat(s).concat((r==null?void 0:r.msn)!==void 0?" at sn "+r.msn+" part "+r.part:"").concat(u&&l.live?" age "+u.toFixed(1)+(l.type&&" "+l.type||""):""," ").concat(o)),this.hls.trigger(S.SUBTITLE_TRACK_LOADING,{url:o,id:a,groupId:s,deliveryDirectives:r||null,track:e})}},{key:"toggleTrackModes",value:function(){var e=this.media;if(e){var r=Oo(e.textTracks),a=this.currentTrack,s;if(a&&(s=r.filter(function(l){return nf(a,l)})[0],s||this.warn('Unable to find subtitle TextTrack with name "'.concat(a.name,'" and language "').concat(a.lang,'"'))),[].slice.call(r).forEach(function(l){l.mode!=="disabled"&&l!==s&&(l.mode="disabled")}),s){var o=this.subtitleDisplay?"showing":"hidden";s.mode!==o&&(s.mode=o)}}}},{key:"setSubtitleTrack",value:function(e){var r=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=r.length||!ce(e)){this.warn("Invalid subtitle track id: ".concat(e));return}this.selectDefaultTrack=!1;var a=this.currentTrack,s=r[e]||null;if(this.trackId=e,this.currentTrack=s,this.toggleTrackModes(),!s){this.hls.trigger(S.SUBTITLE_TRACK_SWITCH,{id:e});return}var o=!!s.details&&!s.details.live;if(!(e===this.trackId&&s===a&&o)){this.log("Switching to subtitle-track ".concat(e)+(s?' "'.concat(s.name,'" lang:').concat(s.lang," group:").concat(s.groupId):""));var l=s.id,u=s.groupId,c=u===void 0?"":u,f=s.name,d=s.type,h=s.url;this.hls.trigger(S.SUBTITLE_TRACK_SWITCH,{id:l,groupId:c,name:f,type:d,url:h});var v=this.switchParams(s.url,a==null?void 0:a.details,s.details);this.loadPlaylist(v)}}}]),i}(Rf);sa=.025,Vo=function(n){return n[n.Point=0]="Point",n[n.Range=1]="Range",n}({});gw=function(){function n(i,t){k(this,n),this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=i,this.setDateRange(i)}return A(n,[{key:"setDateRange",value:function(t){this.dateRange=t,this.resumeOffset=t.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=t.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=t.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=t.attr.enumeratedStringList("X-SNAP",this.snapOptions)}},{key:"reset",value:function(){var t;this.appendInPlaceStarted=!1,(t=this.assetListLoader)==null||t.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}},{key:"isAssetPastPlayoutLimit",value:function(t){var e;if(t>0&&t>=this.assetList.length)return!0;var r=this.playoutLimit;
1if(t<=0||isNaN(r))return!1;if(r===0)return!0;var a=((e=this.assetList[t])==null?void 0:e.startOffset)||0;return a>r}},{key:"findAssetIndex",value:function(t){var e=this.assetList.indexOf(t);return e}},{key:"identifier",get:function(){return this.dateRange.id}},{key:"startDate",get:function(){return this.dateRange.startDate}},{key:"startTime",get:function(){var t=this.dateRange.startTime;if(this.snapOptions.out){var e=this.dateRange.tagAnchor;if(e)return Mc(t,e)}return t}},{key:"startOffset",get:function(){return this.cue.pre?0:this.startTime}},{key:"startIsAligned",get:function(){if(this.startTime===0||this.snapOptions.out)return!0;var t=this.dateRange.tagAnchor;if(t){var e=this.dateRange.startTime,r=Mc(e,t);return e-r<.1}return!1}},{key:"resumptionOffset",get:function(){var t=this.resumeOffset,e=ce(t)?t:this.duration;return this.cumulativeDuration+e}},{key:"resumeTime",get:function(){var t=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){var e=this.resumeAnchor;if(e)return Mc(t,e)}return t}},{key:"appendInPlace",get:function(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<sa))},set:function(t){if(this.appendInPlaceStarted){this.resetOnResume=!t;return}this.appendInPlaceDisabled=!t}},{key:"timelineStart",get:function(){return this._timelineStart!==null?this._timelineStart:this.startTime},set:function(t){this._timelineStart=t}},{key:"duration",get:function(){var t=this.playoutLimit,e;return this._duration!==null?e=this._duration:this.dateRange.duration?e=this.dateRange.duration:e=this.dateRange.plannedDuration||0,!isNaN(t)&&t<e&&(e=t),e},set:function(t){this._duration=t}},{key:"cue",get:function(){return this.dateRange.cue}},{key:"timelineOccupancy",get:function(){return this.dateRange.attr["X-TIMELINE-OCCUPIES"]==="RANGE"?Vo.Range:Vo.Point}},{key:"supplementsPrimary",get:function(){return this.dateRange.attr["X-TIMELINE-STYLE"]==="PRIMARY"}},{key:"contentMayVary",get:function(){return this.dateRange.attr["X-CONTENT-MAY-VARY"]!=="NO"}},{key:"assetUrl",get:function(){return this.dateRange.attr["X-ASSET-URI"]}},{key:"assetListUrl",get:function(){return this.dateRange.attr["X-ASSET-LIST"]}},{key:"baseUrl",get:function(){return this.base.url}},{key:"assetListLoaded",get:function(){return this.assetList.length>0||this.assetListResponse!==null}},{key:"toString",value:function(){return yw(this)}}]),n}();_w=function(){function n(i,t,e,r){var a=this;k(this,n),this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=function(){a.reachedPlayout(a.currentTime)&&a.hls&&a.hls.trigger(S.PLAYOUT_LIMIT_REACHED,{})};var s=this.hls=new i(t);this.interstitial=e,this.assetItem=r;var o=function(){a.hasDetails=!0};s.once(S.LEVEL_LOADED,o),s.once(S.AUDIO_TRACK_LOADED,o),s.once(S.SUBTITLE_TRACK_LOADED,o),s.on(S.MEDIA_ATTACHING,function(l,u){var c=u.media;a.removeMediaListeners(),a.mediaAttached=c;var f=a.interstitial;f.playoutLimit&&(c.addEventListener("timeupdate",a.checkPlayout),a.appendInPlace&&s.on(S.BUFFER_APPENDED,function(){var d=a.bufferedEnd;a.reachedPlayout(d)&&(a._bufferedEosTime=d,s.trigger(S.BUFFERED_TO_END,void 0))}))})}return A(n,[{key:"appendInPlace",get:function(){return this.interstitial.appendInPlace}},{key:"loadSource",value:function(){var t=this.hls;if(t)if(t.url)t.levels.length&&!t.started&&t.startLoad(-1,!0);else{var e=this.assetItem.uri;try{e=rE(e,t.config.primarySessionId||"").href}catch(r){}t.loadSource(e)}}},{key:"bufferedInPlaceToEnd",value:function(t){var e;if(!this.appendInPlace)return!1;if((e=this.hls)!=null&&e.bufferedToEnd)return!0;if(!t)return!1;var r=Math.min(this._bufferedEosTime||1/0,this.duration),a=this.timelineOffset,s=Fe.bufferInfo(t,a,0),o=this.getAssetTime(s.end);return o>=r-.02}},{key:"reachedPlayout",value:function(t){var e=this.interstitial,r=e.playoutLimit;return this.startOffset+t>=r}},{key:"destroyed",get:function(){var t;return!((t=this.hls)!=null&&t.userConfig)}},{key:"assetId",get:function(){return this.assetItem.identifier}},{key:"interstitialId",get:function(){return this.assetItem.parentIdentifier}},{key:"media",get:function(){var t;return((t=this.hls)==null?void 0:t.media)||null}},{key:"bufferedEnd",get:function(){var t=this.media||this.mediaAttached;if(!t)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;var e=Fe.bufferInfo(t,t.currentTime,.001);return this.getAssetTime(e.end)}},{key:"currentTime",get:function(){var t=this.media||this.mediaAttached;return t?this.getAssetTime(t.currentTime):this._currentTime||0}},{key:"duration",get:function(){var t=this.assetItem.duration;if(!t)return 0;var e=this.interstitial.playoutLimit;if(e){var r=e-this.startOffset;if(r>0&&r<t)return r}return t}},{key:"remaining",get:function(){var t=this.duration;return t?Math.max(0,t-this.currentTime):0}},{key:"startOffset",get:function(){return this.assetItem.startOffset}},{key:"timelineOffset",get:function(){var t;return((t=this.hls)==null?void 0:t.config.timelineOffset)||0},set:function(t){var e=this.timelineOffset;if(t!==e){var r=t-e;if(Math.abs(r)>
11/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=t}}}},{key:"getAssetTime",value:function(t){var e=this.timelineOffset,r=this.duration;return Math.min(Math.max(0,t-e),r)}},{key:"removeMediaListeners",value:function(){var t=this.mediaAttached;t&&(this._currentTime=t.currentTime,this.bufferSnapShot(),t.removeEventListener("timeupdate",this.checkPlayout))}},{key:"bufferSnapShot",value:function(){if(this.mediaAttached){var t;(t=this.hls)!=null&&t.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}},{key:"destroy",value:function(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}},{key:"attachMedia",value:function(t){var e;this.loadSource(),(e=this.hls)==null||e.attachMedia(t)}},{key:"detachMedia",value:function(){var t;this.removeMediaListeners(),this.mediaAttached=null,(t=this.hls)==null||t.detachMedia()}},{key:"resumeBuffering",value:function(){var t;(t=this.hls)==null||t.resumeBuffering()}},{key:"pauseBuffering",value:function(){var t;(t=this.hls)==null||t.pauseBuffering()}},{key:"transferMedia",value:function(){var t;return this.bufferSnapShot(),((t=this.hls)==null?void 0:t.transferMedia())||null}},{key:"resetDetails",value:function(){var t=this.hls;if(t&&this.hasDetails){t.stopLoad();var e=function(a){return delete a.details};t.levels.forEach(e),t.allAudioTracks.forEach(e),t.allSubtitleTracks.forEach(e),this.hasDetails=!1}}},{key:"on",value:function(t,e,r){var a;(a=this.hls)==null||a.on(t,e)}},{key:"once",value:function(t,e,r){var a;(a=this.hls)==null||a.once(t,e)}},{key:"off",value:function(t,e,r){var a;(a=this.hls)==null||a.off(t,e)}},{key:"toString",value:function(){var t;return"HlsAssetPlayer: ".concat(ra(this.assetItem)," ").concat((t=this.hls)==null?void 0:t.sessionId," ").concat(this.appendInPlace?"append-in-place":"")}}]),n}(),S_=.033,Ew=function(n){B(i,n);function i(t,e){var r;return k(this,i),r=Xe(this,i,["interstitials-sched",e]),r.onScheduleUpdate=void 0,r.eventMap={},r.events=null,r.items=null,r.durations={primary:0,playout:0,integrated:0},r.onScheduleUpdate=t,r}return A(i,[{key:"destroy",value:function(){this.reset(),this.onScheduleUpdate=null}},{key:"reset",value:function(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(function(e){return e.reset()}),this.events=this.items=null}},{key:"resetErrorsInRange",value:function(e,r){return this.events?this.events.reduce(function(a,s){return e<=s.startOffset&&r>s.startOffset?(delete s.error,a+1):a},0):0}},{key:"duration",get:function(){var e=this.items;return e?e[e.length-1].end:0}},{key:"length",get:function(){return this.items?this.items.length:0}},{key:"getEvent",value:function(e){return e&&this.eventMap[e]||null}},{key:"hasEvent",value:function(e){return e in this.eventMap}},{key:"findItemIndex",value:function(e,r){if(e.event)return this.findEventIndex(e.event.identifier);var a=-1;e.nextEvent?a=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(a=this.findEventIndex(e.previousEvent.identifier)+1);var s=this.items;if(s)for(s[a]||(r===void 0&&(r=e.start),a=this.findItemIndexAtTime(r));a>=0&&(o=s[a])!=null&&o.event;){var o;a--}return a}},{key:"findItemIndexAtTime",value:function(e,r){var a=this.items;if(a)for(var s=0;s<a.length;s++){var o=a[s];if(r&&r!=="primary"&&(o=o[r]),e===o.start||e>o.start&&e<o.end)return s}return-1}},{key:"findJumpRestrictedIndex",value:function(e,r){var a=this.items;if(a)for(var s=e;s<=r&&a[s];s++){var o=a[s].event;if(o!=null&&o.restrictions.jump&&!o.appendInPlace)return s}return-1}},{key:"findEventIndex",value:function(e){var r=this.items;if(r)for(var a=r.length;a--;){var s;if(((s=r[a].event)==null?void 0:s.identifier)===e)return a}return-1}},{key:"findAssetIndex",value:function(e,r){var a=e.assetList,s=a.length;if(s>1)for(var o=0;o<s;o++){var l=a[o];if(!l.error){var u=l.timelineStart;if(r===u||r>u&&(r<u+(l.duration||0)||o===s-1))return o}}return 0}},{key:"assetIdAtEnd",get:function(){var e,r=(e=this.items)==null||(e=e[this.length-1])==null?void 0:e.event;if(r){var a=r.assetList,s=a[a.length-1];if(s)return s.identifier}return null}},{key:"parseInterstitialDateRanges",value:function(e,r){var a=this,s=e.main.details,o=s.dateRanges,l=this.events,u=this.parseDateRanges(o,{url:s.url},r),c=Object.keys(o),f=l?l.filter(function(d){return!c.includes(d.identifier)}):[];u.length&&u.sort(function(d,h){var v=d.cue.pre,m=d.cue.post,p=h.cue.pre,g=h.cue.post;if(v&&!p)return-1;if(p&&!v||m&&!g)return 1;if(g&&!m)return-1;if(!v&&!p&&!m&&!g){var E=d.startTime,y=h.startTime;if(E!==y)return E-y}return d.dateRange.tagOrder-h.dateRange.tagOrder}),this.events=u,f.forEach(function(d){a.removeEvent(d)}),this.updateSchedule(e,f)}},{key:"updateSchedule",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=this.events||[];
1if(s.length||r.length||this.length<2){var o=this.items,l=this.parseSchedule(s,e),u=a||r.length||(o==null?void 0:o.length)!==l.length||l.some(function(c,f){return Math.abs(c.playout.start-o[f].playout.start)>.005||Math.abs(c.playout.end-o[f].playout.end)>.005});u&&(this.items=l,this.onScheduleUpdate(r,o))}}},{key:"parseDateRanges",value:function(e,r,a){for(var s=[],o=Object.keys(e),l=0;l<o.length;l++){var u=o[l],c=e[u];if(c.isInterstitial){var f=this.eventMap[u];f?f.setDateRange(c):(f=new gw(c,r),this.eventMap[u]=f,a===!1&&(f.appendInPlace=a)),s.push(f)}}return s}},{key:"parseSchedule",value:function(e,r){var a=[],s=r.main.details,o=s.live?1/0:s.edge,l=0;if(e=e.filter(function(g){return!g.error&&!(g.cue.once&&g.hasPlayed)}),e.length){this.resolveOffsets(e,r);var u=0,c=0;if(e.forEach(function(g,E){var y=g.cue.pre,_=g.cue.post,b=e[E-1]||null,C=g.appendInPlace,R=_?o:g.startOffset,M=g.duration,D=g.timelineOccupancy===Vo.Range?M:0,L=g.resumptionOffset,O=(b==null?void 0:b.startTime)===R,x=R+g.cumulativeDuration,Y=C?x+M:R+L;if(y||!_&&R<=0){var $=c;c+=D,g.timelineStart=x;var Z=l;l+=M,a.push({event:g,start:x,end:Y,playout:{start:Z,end:l},integrated:{start:$,end:c}})}else if(R<=o){if(!O){var N=R-u;if(N>S_){var j=u,z=c;c+=N;var ee=l;l+=N;var U={previousEvent:e[E-1]||null,nextEvent:g,start:j,end:j+N,playout:{start:ee,end:l},integrated:{start:z,end:c}};a.push(U)}else N>0&&b&&(b.cumulativeDuration+=N,a[a.length-1].end=R)}_&&(Y=x),g.timelineStart=x;var F=c;c+=D;var H=l;l+=M,a.push({event:g,start:x,end:Y,playout:{start:H,end:l},integrated:{start:F,end:c}})}else return;var G=g.resumeTime;_||G>o?u=o:u=G}),u<o){var f,d=u,h=c,v=o-u;c+=v;var m=l;l+=v,a.push({previousEvent:((f=a[a.length-1])==null?void 0:f.event)||null,nextEvent:null,start:u,end:d+v,playout:{start:m,end:l},integrated:{start:h,end:c}})}this.setDurations(o,l,c)}else{var p=0;a.push({previousEvent:null,nextEvent:null,start:p,end:o,playout:{start:p,end:o},integrated:{start:p,end:o}}),this.setDurations(o,o,o)}return a}},{key:"setDurations",value:function(e,r,a){this.durations={primary:e,playout:r,integrated:a}}},{key:"resolveOffsets",value:function(e,r){var a=this,s=r.main.details,o=s.live?1/0:s.edge,l=0,u=-1;e.forEach(function(c,f){var d=c.cue.pre,h=c.cue.post,v=d?0:h?o:c.startTime;a.updateAssetDurations(c);var m=u===v;if(m?c.cumulativeDuration=l:(l=0,u=v),!h&&c.snapOptions.in&&(c.resumeAnchor=gn(null,s.fragments,c.startOffset+c.resumptionOffset,0,0)||void 0),c.appendInPlace&&!c.appendInPlaceStarted){var p=a.primaryCanResumeInPlaceAt(c,r);p||(c.appendInPlace=!1)}if(!c.appendInPlace&&f+1<e.length){var g=e[f+1].startTime-e[f].resumeTime;g<S_&&(e[f+1].appendInPlace=!1,e[f+1].appendInPlace&&a.warn("Could not change append strategy for abutting event ".concat(c)))}var E=ce(c.resumeOffset)?c.resumeOffset:c.duration;l+=E})}},{key:"primaryCanResumeInPlaceAt",value:function(e,r){var a=this,s=e.resumeTime,o=e.startTime+e.resumptionOffset;if(Math.abs(s-o)>sa)return this.log('"'.concat(e.identifier,'" resumption ').concat(s," not aligned with estimated timeline end ").concat(o)),!1;var l=Object.keys(r);return!l.some(function(u){var c=r[u].details,f=c.edge;if(s>=f)return a.log('"'.concat(e.identifier,'" resumption ').concat(s," past ").concat(u," playlist end ").concat(f)),!1;var d=gn(null,c.fragments,s);if(!d)return a.log('"'.concat(e.identifier,'" resumption ').concat(s," does not align with any fragments in ").concat(u," playlist (").concat(c.fragStart,"-").concat(c.fragmentEnd,")")),!0;var h=u==="audio"?.175:0,v=Math.abs(d.start-s)<sa+h||Math.abs(d.end-s)<sa+h;return v?!1:(a.log('"'.concat(e.identifier,'" resumption ').concat(s," not aligned with ").concat(u," fragment bounds (").concat(d.start,"-").concat(d.end," sn: ").concat(d.sn," cc: ").concat(d.cc,")")),!0)})}},{key:"updateAssetDurations",value:function(e){if(e.assetListLoaded){for(var r=e.timelineStart,a=0,s=!1,o=!1,l=0;l<e.assetList.length;l++){var u=e.assetList[l],c=r+a;u.startOffset=a,u.timelineStart=c,s||(s=u.duration===null),o||(o=!!u.error);var f=u.error?0:u.duration||0;a+=f}s&&!o?e.duration=Math.max(a,e.duration):e.duration=a}}},{key:"removeEvent",value:function(e){e.reset(),delete this.eventMap[e.identifier]}}]),i}
1(Hr);Sw=function(){function n(i){k(this,n),this.hls=void 0,this.hls=i}return A(n,[{key:"destroy",value:function(){this.hls=null}},{key:"loadAssetList",value:function(t,e){var r=this,a=t.assetListUrl,s;try{s=rE(a,this.hls.sessionId,t.baseUrl)}catch(m){var o=this.assignAssetListError(t,K.ASSET_LIST_LOAD_ERROR,m,a);this.hls.trigger(S.ERROR,o);return}e&&s.protocol!=="data:"&&s.searchParams.set("_HLS_start_offset",""+e);var l=this.hls.config,u=l.loader,c=new u(l),f={responseType:"json",url:s.href},d=l.interstitialAssetListLoadPolicy.default,h={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},v={onSuccess:function(p,g,E,y){var _=p.data,b=_==null?void 0:_.ASSETS;if(!Array.isArray(b)){var C=r.assignAssetListError(t,K.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),E.url,g,y);r.hls.trigger(S.ERROR,C);return}t.assetListResponse=_,r.hls.trigger(S.ASSET_LIST_LOADED,{event:t,assetListResponse:_,networkDetails:y})},onError:function(p,g,E,y){var _=r.assignAssetListError(t,K.ASSET_LIST_LOAD_ERROR,new Error("Error loading X-ASSET-LIST: HTTP status ".concat(p.code," ").concat(p.text," (").concat(g.url,")")),g.url,y,E);r.hls.trigger(S.ERROR,_)},onTimeout:function(p,g,E){var y=r.assignAssetListError(t,K.ASSET_LIST_LOAD_TIMEOUT,new Error("Timeout loading X-ASSET-LIST (".concat(g.url,")")),g.url,p,E);r.hls.trigger(S.ERROR,y)}};return c.load(f,h,v),this.hls.trigger(S.ASSET_LIST_LOADING,{event:t}),c}},{key:"assignAssetListError",value:function(t,e,r,a,s,o){return t.error=r,{type:ge.NETWORK_ERROR,details:e,fatal:!1,interstitial:t,url:a,error:r,networkDetails:o,stats:s}}}]),n}();Tw=function(n){B(i,n);function i(t,e){var r;return k(this,i),r=Xe(this,i,["interstitials",t.logger]),r.HlsPlayerClass=void 0,r.hls=void 0,r.assetListLoader=void 0,r.mediaSelection=null,r.altSelection=null,r.media=null,r.detachedData=null,r.requiredTracks=null,r.manager=null,r.playerQueue=[],r.bufferedPos=-1,r.timelinePos=-1,r.schedule=void 0,r.playingItem=null,r.bufferingItem=null,r.waitingItem=null,r.endedItem=null,r.playingAsset=null,r.endedAsset=null,r.bufferingAsset=null,r.shouldPlay=!1,r.onPlay=function(){r.shouldPlay=!0},r.onPause=function(){r.shouldPlay=!1},r.onSeeking=function(){var a=r.currentTime;if(!(a===void 0||r.playbackDisabled||!r.schedule)){var s=a-r.timelinePos,o=Math.abs(s)<1/7056e5;if(!o){var l=s<=-.01;r.timelinePos===-1&&!r.effectivePlayingItem&&r.checkStart(),r.timelinePos=a,r.bufferedPos=a;var u=r.playingItem;if(!u){r.checkBuffer();return}if(l){var c=r.schedule.resetErrorsInRange(a,a-s);c&&r.updateSchedule(!0)}if(r.checkBuffer(),l&&a<u.start||a>=u.end){var f,d=r.findItemIndex(u),h=r.schedule.findItemIndexAtTime(a);if(h===-1&&(h=d+(l?-1:1),r.log("seeked ".concat(l?"back ":"","to position not covered by schedule ").concat(a," (resolving from ").concat(d," to ").concat(h,")"))),!r.isInterstitial(u)&&(f=r.media)!=null&&f.paused&&(r.shouldPlay=!1),!l&&h>d){var v=r.schedule.findJumpRestrictedIndex(d+1,h);if(v>d){r.setSchedulePosition(v);return}}r.setSchedulePosition(h);return}var m=r.playingAsset;if(!m){if(r.playingLastItem&&r.isInterstitial(u)){var p=u.event.assetList[0];p&&(r.endedItem=r.playingItem,r.playingItem=null,r.setScheduleToAssetAtTime(a,p))}return}var g=m.timelineStart,E=m.duration||0;if(l&&a<g||a>=g+E){var y;(y=u.event)!=null&&y.appendInPlace&&(r.clearAssetPlayers(u.event,u),r.flushFrontBuffer(a)),r.setScheduleToAssetAtTime(a,m)}}}},r.onTimeupdate=function(){var a=r.currentTime;if(!(a===void 0||r.playbackDisabled)){if(r.timelinePos===-1&&!r.effectivePlayingItem&&r.checkStart(),a>r.timelinePos)r.timelinePos=a,a>r.bufferedPos&&r.checkBuffer();else return;var s=r.playingItem;if(!(!s||r.playingLastItem)){if(a>=s.end){r.timelinePos=s.end;var o=r.findItemIndex(s);r.setSchedulePosition(o+1)}var l=r.playingAsset;if(l){var u=l.timelineStart+(l.duration||0);a>=u&&r.setScheduleToAssetAtTime(a,l)}}}},r.onScheduleUpdate=function(a,s){var o=r.schedule;if(o){var l=r.playingItem,u=o.events||[],c=o.items||[],f=o.durations,d=a.map(function(g){return g.identifier}),h=!!(u.length||d.length);(h||s)&&r.log("INTERSTITIALS_UPDATED (".concat(u.length,"): ").concat(u,"\nSchedule: ").concat(c.map(function(g){return Jr(g)})," pos: ").concat(r.timelinePos)),d.length&&r.log("Removed events ".concat(d));var v=null,m=null;l&&(v=r.updateItem(l,r.timelinePos),r.itemsMatch(l,v)?r.playingItem=v:r.waitingItem=r.endedItem=null),r.waitingItem=r.updateItem(r.waitingItem),r.endedItem=r.updateItem(r.endedItem);var p=r.bufferingItem;if(p&&(m=r.updateItem(p,r.bufferedPos),r.itemsMatch(p,m)?r.bufferingItem=m:p.event&&(r.bufferingItem=r.playingItem,r.clearInterstitial(p.event,null))),a.forEach(function(g){g.assetList.forEach(function(E){r.clearAssetPlayer(E.identifier,null)})}),r.playerQueue.forEach(function(g){if(g.interstitial.appendInPlace){var E=g.assetItem.timelineStart,y=g.timelineOffset-E;if(y)try{g.timelineOffset=E}catch(_){Math.abs(y)>
1sa&&r.warn("".concat(_,' ("').concat(g.assetId,'" ').concat(g.timelineOffset,"->").concat(E,")"))}}}),h||s){if(r.hls.trigger(S.INTERSTITIALS_UPDATED,{events:u.slice(0),schedule:c.slice(0),durations:f,removedIds:d}),r.isInterstitial(l)&&d.includes(l.event.identifier)){r.warn('Interstitial "'.concat(l.event.identifier,'" removed while playing')),r.primaryFallback(l.event);return}l&&r.trimInPlace(v,l),p&&m!==v&&r.trimInPlace(m,p),r.checkBuffer()}}},r.hls=t,r.HlsPlayerClass=e,r.assetListLoader=new Sw(t),r.schedule=new Ew(r.onScheduleUpdate,t.logger),r.registerListeners(),r}return A(i,[{key:"registerListeners",value:function(){var e=this.hls;e&&(e.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(S.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(S.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(S.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(S.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(S.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(S.BUFFER_APPENDED,this.onBufferAppended,this),e.on(S.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(S.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(S.MEDIA_ENDED,this.onMediaEnded,this),e.on(S.ERROR,this.onError,this),e.on(S.DESTROYING,this.onDestroying,this))}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(e.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(S.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(S.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(S.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(S.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(S.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(S.BUFFER_CODECS,this.onBufferCodecs,this),e.off(S.BUFFER_APPENDED,this.onBufferAppended,this),e.off(S.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(S.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(S.MEDIA_ENDED,this.onMediaEnded,this),e.off(S.ERROR,this.onError,this),e.off(S.DESTROYING,this.onDestroying,this))}},{key:"startLoad",value:function(){this.resumeBuffering()}},{key:"stopLoad",value:function(){this.pauseBuffering()}},{key:"resumeBuffering",value:function(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}},{key:"pauseBuffering",value:function(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}},{key:"destroy",value:function(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}},{key:"onDestroying",value:function(){var e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}},{key:"removeMediaListeners",value:function(e){Er(e,"play",this.onPlay),Er(e,"pause",this.onPause),Er(e,"seeking",this.onSeeking),Er(e,"timeupdate",this.onTimeupdate)}},{key:"onMediaAttaching",value:function(e,r){var a=this.media=r.media;vr(a,"seeking",this.onSeeking),vr(a,"timeupdate",this.onTimeupdate),vr(a,"play",this.onPlay),vr(a,"pause",this.onPause)}},{key:"onMediaAttached",value:function(e,r){var a=this.effectivePlayingItem,s=this.detachedData;if(this.detachedData=null,a===null)this.checkStart();else if(!s){this.clearScheduleState();var o=this.findItemIndex(a);this.setSchedulePosition(o)}}},{key:"clearScheduleState",value:function(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}},{key:"onMediaDetaching",value:function(e,r){var a=!!r.transferMedia,s=this.media;if(this.media=null,!a&&(s&&this.removeMediaListeners(s),this.detachedData)){var o=this.getBuffer
1ingPlayer();o&&(this.log("Removing schedule state for detachedData and ".concat(o)),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,o.detachMedia()),this.shouldPlay=!1}}},{key:"interstitialsManager",get:function(){if(!this.hls)return null;if(this.manager)return this.manager;var e=this,r=function(){return e.bufferingItem||e.waitingItem},a=function(v){return v&&e.getAssetPlayer(v.identifier)},s=function(v,m,p,g,E){if(v){var y=v[m].start,_=v.event;if(_){if(m==="playout"||_.timelineOccupancy!==Vo.Point){var b=a(p);(b==null?void 0:b.interstitial)===_&&(y+=b.assetItem.startOffset+b[E])}}else{var C=g==="bufferedPos"?l():e[g];y+=C-v.start}return y}return 0},o=function(v,m){var p;if(v!==0&&m!=="primary"&&(p=e.schedule)!=null&&p.length){var g,E=e.schedule.findItemIndexAtTime(v),y=(g=e.schedule.items)==null?void 0:g[E];if(y){var _=y[m].start-y.start;return v+_}}return v},l=function(){var v=e.bufferedPos;return v===Number.MAX_VALUE?u("primary"):Math.max(v,0)},u=function(v){var m,p;return(m=e.primaryDetails)!=null&&m.live?e.primaryDetails.edge:((p=e.schedule)==null?void 0:p.durations[v])||0},c=function(v,m){var p,g,E=e.effectivePlayingItem;if(!(E!=null&&(p=E.event)!=null&&p.restrictions.skip||!e.schedule)){e.log("seek to ".concat(v,' "').concat(m,'"'));var y=e.effectivePlayingItem,_=e.schedule.findItemIndexAtTime(v,m),b=(g=e.schedule.items)==null?void 0:g[_],C=e.getBufferingPlayer(),R=C==null?void 0:C.interstitial,M=R==null?void 0:R.appendInPlace,D=y&&e.itemsMatch(y,b);if(y&&(M||D)){var L=a(e.playingAsset),O=(L==null?void 0:L.media)||e.primaryMedia;if(O){var x=m==="primary"?O.currentTime:s(y,m,e.playingAsset,"timelinePos","currentTime"),Y=v-x,$=(M?x:O.currentTime)+Y;if($>=0&&(!L||M||$<=L.duration)){O.currentTime=$;return}}}if(b){var Z=v;if(m!=="primary"){var N=b[m].start,j=v-N;Z=b.start+j}var z=!e.isInterstitial(b);if((!e.isInterstitial(y)||y.event.appendInPlace)&&(z||b.event.appendInPlace)){var ee=e.media||(M?C==null?void 0:C.media:null);ee&&(ee.currentTime=Z)}else if(y){var U=e.findItemIndex(y);if(_>U){var F=e.schedule.findJumpRestrictedIndex(U+1,_);if(F>U){e.setSchedulePosition(F);return}}var H=0;if(z)e.timelinePos=Z,e.checkBuffer();else for(var G=b.event.assetList,ve=v-(b[m]||b).start,ye=G.length;ye--;){var Ee=G[ye];if(Ee.duration&&ve>=Ee.startOffset&&ve<Ee.startOffset+Ee.duration){H=ye;break}}e.setSchedulePosition(_,H)}}}},f=function(){var v=e.effectivePlayingItem;if(e.isInterstitial(v))return v;var m=r();return e.isInterstitial(m)?m:null},d={get bufferedEnd(){var h=r(),v=e.bufferingItem;if(v&&v===h){var m;return s(v,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-v.playout.start||((m=e.bufferingAsset)==null?void 0:m.startOffset)||0}return 0},get currentTime(){var h=f(),v=e.effectivePlayingItem;return v&&v===h?s(v,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-v.playout.start:0},set currentTime(h){var v=f(),m=e.effectivePlayingItem;m&&m===v&&c(h+m.playout.start,"playout")},get duration(){var h=f();return h?h.playout.end-h.playout.start:0},get assetPlayers(){var h,v=(h=f())==null?void 0:h.event.assetList;return v?v.map(function(m){return e.getAssetPlayer(m.identifier)}):[]},get playingIndex(){var h,v=(h=f())==null?void 0:h.event;return v&&e.effectivePlayingAsset?v.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return f()}};return this.manager={get events(){var h;return((h=e.schedule)==null||(h=h.events)==null?void 0:h.slice(0))||[]},get schedule(){var h;return((h=e.schedule)==null||(h=h.items)==null?void 0:h.slice(0))||[]},get interstitialPlayer(){return f()?d:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return r()},get bufferingIndex(){var h=r();return e.findItemIndex(h)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){var h=e.effectivePlayingItem;return e.findItemIndex(h)},primary:{get bufferedEnd(){return l()},get currentTime(){var h=e.timelinePos;return h>0?h:0},set currentTime(h){c(h,"primary")},get duration(){return u("primary")},get seekableStart(){var h;return((h=e.primaryDetails)==null?void 0:h.fragmentStart)||0}},integrated:{get bufferedEnd(){return s(r(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return s(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(h){c(h,"integrated")},get duration(){return u("integrated")},get seekableStart(){var h;return o(((h=e.primaryDetails)==null?void 0:h.fragmentStart)||0,"integrated")}},skip:function(){var v=e.effectivePlayingItem,m=v==null?void 0:v.event;if(m&&!m.restrictions.skip){var p=e.findItemIndex(v);if(m.appendInPlace){var g=v.playout.start+v.event.duration;c(g+.001,"playout")}else e.advanceAfterAssetEnded(m,p,1/0)}}}}},{key:"effectivePlayingItem",get:function(){return this.waitingItem||this.playingItem||this.endedItem}},{key:"effectivePlayingAsset",get:function(){return this.playingAsset||this.endedAsset}},{key:"playingLastItem",get:function(){var e,r=this.playingItem,a=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!r||!a?!1:this.findItemIndex(r)===a.length-1}},{key:"playbackStarted",get:function(){return this.effectivePlayingItem!==null}},{key:"currentTime",get:function(){var e,r;if(this.mediaSelection!==null){var a=this.waitingItem||this.playingItem;if(!(this.isInterstitial(a)&&!a.event.appendInPlace)){var s=this.media;!s&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(s=this.primaryMedia);var o=(r=s)==null?void 0:r.currentTime;if(!(o===void 0||!ce(o)))return o}}}},{key:"primaryMedia",get:function(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}},{key:"isInterstitial",value:function(e){return!!(e!=null&&e.event)}},{key:"retreiveMediaSource",value:function(e,r){var a=this.getAssetPlayer(e);a&&this.transferMediaFromPlayer(a,r)}},{key:"transferMediaFromPlayer",value:function(e,r){var a=e.interstitial.appendInPlace,s=e.media;if(a&&s===this.primaryMedia){if(this.bufferingAsset=null,(!r||this.isInterstitial(r)&&!r.event.appendInPlace)&&r&&s){this.detachedData={media:s};return}var o=e.transferMedia();this.log("transfer MediaSource from ".concat(e," ").concat(st(o))),this.detachedData=o}else r&&s&&(this.shouldPlay||(this.shouldPlay=!s.paused))}},{key:"transferMediaTo",value:function(e,r){var a=this,s,o;if(e.media!==r){var l=null,u=this.hls,c=e!==u,f=c&&e.interstitial.appendInPlace,d=(s=this.detachedData)==null?void 0:s.mediaSource,h;if(u.media)f&&(l=u.transferMedia(),this.detachedData=l),h="Primary";
1else if(d){var v=this.getBufferingPlayer();v?(l=v.transferMedia(),h="".concat(v)):h="detached MediaSource"}else h="detached media";if(!l){if(d)l=this.detachedData,this.log("using detachedData: MediaSource ".concat(st(l)));else if(!this.detachedData||u.media===r){var m=this.playerQueue;m.length>1&&m.forEach(function(_){if(c&&_.interstitial.appendInPlace!==f){var b=_.interstitial;a.clearInterstitial(_.interstitial,null),b.appendInPlace=!1,b.appendInPlace&&a.warn("Could not change append strategy for queued assets ".concat(b))}}),this.hls.detachMedia(),this.detachedData={media:r}}}var p=l&&"mediaSource"in l&&((o=l.mediaSource)==null?void 0:o.readyState)!=="closed",g=p&&l?l:r;this.log("".concat(p?"transfering MediaSource":"attaching media"," to ").concat(c?e:"Primary"," from ").concat(h," (media.currentTime: ").concat(r.currentTime,")"));var E=this.schedule;if(g===l&&E){var y=c&&e.assetId===E.assetIdAtEnd;g.overrides={duration:E.duration,endOfStream:!c||y,cueRemoval:!c}}e.attachMedia(g)}}},{key:"onInterstitialCueEnter",value:function(){this.onTimeupdate()}},{key:"checkStart",value:function(){var e=this.schedule,r=e==null?void 0:e.events;if(!(!r||this.playbackDisabled||!this.media)){this.bufferedPos===-1&&(this.bufferedPos=0);var a=this.timelinePos,s=this.effectivePlayingItem;if(a===-1){var o=this.hls.startPosition;if(this.timelinePos=o,r.length===0)this.setSchedulePosition(0);else if(r[0].cue.pre){this.log(ta("checkStart (preroll)",o));var l=e.findEventIndex(r[0].identifier);this.setSchedulePosition(l)}else if(o>=0||!this.primaryLive){this.log(ta("checkStart",o));var u=this.timelinePos=o>0?o:0,c=e.findItemIndexAtTime(u);this.setSchedulePosition(c)}else this.hls.liveSyncPosition===0?this.setSchedulePosition(0):this.log("[checkStart] waiting for live start")}else if(s&&!this.playingItem){this.log(ta("checkStart (playing item)",s.start));var f=e.findItemIndex(s);this.setSchedulePosition(f)}}}},{key:"advanceAssetBuffering",value:function(e,r){var a=e.event,s=a.findAssetIndex(r),o=Nc(a,s);if(!a.isAssetPastPlayoutLimit(o))this.bufferedToEvent(e,o);else if(this.schedule){var l,u=(l=this.schedule.items)==null?void 0:l[this.findItemIndex(e)+1];u&&this.bufferedToItem(u)}}},{key:"advanceAfterAssetEnded",value:function(e,r,a){var s=Nc(e,a);if(e.isAssetPastPlayoutLimit(s)){if(this.schedule){var l=this.schedule.items;if(l){var u=r+1,c=l.length;if(u>=c){this.setSchedulePosition(-1);return}var f=e.resumeTime;this.timelinePos<f&&(this.log(ta("advanceAfterAssetEnded",f)),this.timelinePos=f,e.appendInPlace&&this.advanceInPlace(f),this.checkBuffer(this.bufferedPos<f)),this.setSchedulePosition(u)}}}else{if(e.appendInPlace){var o=e.assetList[s];o&&this.advanceInPlace(o.timelineStart)}this.setSchedulePosition(r,s)}}},{key:"setScheduleToAssetAtTime",value:function(e,r){var a=this.schedule;if(a){var s=r.parentIdentifier,o=a.getEvent(s);if(o){var l=a.findEventIndex(s),u=a.findAssetIndex(o,e);this.advanceAfterAssetEnded(o,l,u-1)}}}},{key:"setSchedulePosition",value:function(e,r){var a,s=(a=this.schedule)==null?void 0:a.items;if(!(!s||this.playbackDisabled)){var o=e>=0?s[e]:null;this.log("setSchedulePosition ".concat(e,", ").concat(r," (").concat(o&&Jr(o),") pos: ").concat(this.timelinePos));var l=this.waitingItem||this.playingItem,u=this.playingLastItem;if(this.isInterstitial(l)){var c=l.event,f=this.playingAsset,d=f==null?void 0:f.identifier,h=d?this.getAssetPlayer(d):null;if(h&&d&&(!this.eventItemsMatch(l,o)||r!==void 0&&d!==c.assetList[r].identifier)){var v,m=c.findAssetIndex(f);if(this.log("INTERSTITIAL_ASSET_ENDED ".concat(m+1,"/").concat(c.assetList.length," ").concat(ra(f))),this.endedAsset=f,this.playingAsset=null,this.hls.trigger(S.INTERSTITIAL_ASSET_ENDED,{asset:f,assetListIndex:m,event:c,schedule:s.slice(0),scheduleIndex:e,player:h}),l!==this.playingItem){this.itemsMatch(l,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(c,this.findItemIndex(this.playingItem),m);return}this.retreiveMediaSource(d,o),h.media&&!((v=this.detachedData)!=null&&v.mediaSource)&&h.detachMedia()}if(!this.eventItemsMatch(l,o)&&(this.endedItem=l,this.playingItem=null,this.log("INTERSTITIAL_ENDED ".concat(c," ").concat(Jr(l))),c.hasPlayed=!0,this.hls.trigger(S.INTERSTITIAL_ENDED,{event:c,schedule:s.slice(0),scheduleIndex:e}),c.cue.once)){var p;this.updateSchedule();var g=(p=this.schedule)==null?void 0:p.items;if(o&&g){var E=this.findItemIndex(o);this.advanceSchedule(E,g,r,l,u)}return}}this.advanceSchedule(e,s,r,l,u)}
1}},{key:"advanceSchedule",value:function(e,r,a,s,o){var l=this,u=this.schedule;if(u){var c=r[e]||null,f=this.primaryMedia,d=this.playerQueue;if(d.length&&d.forEach(function(y){var _=y.interstitial,b=u.findEventIndex(_.identifier);(b<e||b>e+1)&&l.clearInterstitial(_,c)}),this.isInterstitial(c)){this.timelinePos=Math.min(Math.max(this.timelinePos,c.start),c.end);var h=c.event;if(a===void 0){a=u.findAssetIndex(h,this.timelinePos);var v=Nc(h,a-1);if(h.isAssetPastPlayoutLimit(v)||h.appendInPlace&&this.timelinePos===c.end){this.advanceAfterAssetEnded(h,e,a);return}a=v}var m=this.waitingItem;this.assetsBuffered(c,f)||this.setBufferingItem(c);var p=this.preloadAssets(h,a);if(this.eventItemsMatch(c,m||s)||(this.waitingItem=c,this.log("INTERSTITIAL_STARTED ".concat(Jr(c)," ").concat(h.appendInPlace?"append in place":"")),this.hls.trigger(S.INTERSTITIAL_STARTED,{event:h,schedule:r.slice(0),scheduleIndex:e})),!h.assetListLoaded){this.log("Waiting for ASSET-LIST to complete loading ".concat(h));return}if(h.assetListLoader&&(h.assetListLoader.destroy(),h.assetListLoader=void 0),!f){this.log("Waiting for attachMedia to start Interstitial ".concat(h));return}this.waitingItem=this.endedItem=null,this.playingItem=c;var g=h.assetList[a];if(!g){this.advanceAfterAssetEnded(h,e,a||0);return}if(p||(p=this.getAssetPlayer(g.identifier)),p===null||p.destroyed){var E=h.assetList.length;this.warn("asset ".concat(a+1,"/").concat(E," player destroyed ").concat(h)),p=this.createAssetPlayer(h,g,a),p.loadSource()}if(!this.eventItemsMatch(c,this.bufferingItem)&&h.appendInPlace&&this.isAssetBuffered(g))return;this.startAssetPlayer(p,a,r,e,f),this.shouldPlay&&T_(p.media)}else c?(this.resumePrimary(c,e,s),this.shouldPlay&&T_(this.hls.media)):o&&this.isInterstitial(s)&&(this.endedItem=null,this.playingItem=s,s.event.appendInPlace||this.attachPrimary(u.durations.primary,null))}}},{key:"playbackDisabled",get:function(){return this.hls.config.enableInterstitialPlayback===!1}},{key:"primaryDetails",get:function(){var e;return(e=this.mediaSelection)==null?void 0:e.main.details}},{key:"primaryLive",get:function(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}},{key:"resumePrimary",value:function(e,r,a){var s,o;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log("resuming ".concat(Jr(e))),!((s=this.detachedData)!=null&&s.mediaSource)){var l=this.timelinePos;(l<e.start||l>=e.end)&&(l=this.getPrimaryResumption(e,r),this.log(ta("resumePrimary",l)),this.timelinePos=l),this.attachPrimary(l,e)}if(a){var u=(o=this.schedule)==null?void 0:o.items;u&&(this.log("INTERSTITIALS_PRIMARY_RESUMED ".concat(Jr(e))),this.hls.trigger(S.INTERSTITIALS_PRIMARY_RESUMED,{schedule:u.slice(0),scheduleIndex:r}),this.checkBuffer())}}},{key:"getPrimaryResumption",value:function(e,r){var a=e.start;if(this.primaryLive){var s=this.primaryDetails;if(r===0)return this.hls.startPosition;if(s&&(a<s.fragmentStart||a>s.edge))return this.hls.liveSyncPosition||-1}return a}},{key:"isAssetBuffered",value:function(e){var r=this.getAssetPlayer(e.identifier);if(r!=null&&r.hls)return r.hls.bufferedToEnd;var a=Fe.bufferInfo(this.primaryMedia,this.timelinePos,0);return a.end+1>=e.timelineStart+(e.duration||0)}},{key:"attachPrimary",value:function(e,r,a){r?this.setBufferingItem(r):this.bufferingItem=this.playingItem,this.bufferingAsset=null;var s=this.primaryMedia;if(s){var o=this.hls;o.media?this.checkBuffer():(this.transferMediaTo(o,s),a&&this.startLoadingPrimaryAt(e,a)),a||(this.log(ta("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,a))}}},{key:"startLoadingPrimaryAt",value:function(e,r){var a,s=this.hls;!s.loadingEnabled||!s.media||Math.abs((((a=s.mainForwardBufferInfo)==null?void 0:a.start)||s.media.currentTime)-e)>.5?s.startLoad(e,r):s.bufferingEnabled||s.resumeBuffering()}},{key:"onManifestLoading",value:function(){var e;this.stopLoad(),(e=this.schedule)==null||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(S.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(S.BUFFER_CODECS,this.onBufferCodecs,this)}},{key:"onLevelUpdated",value:function(e,r){if(!(r.level===-1||!this.schedule)){var a=this.hls.levels[r.level];if(a.details){var s=et(et({},this.mediaSelection||this.altSelection),{},{main:a});this.mediaSelection=s,this.schedule.parseInterstitialDateRanges(s,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}}}},{key:"onAudioTrackUpdated",value:function(e,r){var a=this.hls.audioTracks[r.id],s=this.mediaSelection;if(!s){this.altSelection=et(et({},this.altSelection),{},{audio:a});return}var o=et(et({},s),{},{audio:a});this.mediaSelection=o}},{key:"onSubtitleTrackUpdated",value:function(e,r){var a=this.hls.subtitleTracks[r.id],s=this.mediaSelection;if(!s){this.altSelection=et(et({},this.altSelection),{},{subtitles:a});return}var o=et(et({},s),{},{subtitles:a});this.mediaSelection=o}},{key:"onAudioTrackSwitching",value:function(e,r){var a=wy(r);this.playerQueue.forEach(function(s){var o=s.hls;return o&&(o.setAudioOption(r)||o.setAudioOption(a))})}},{key:"onSubtitleTrackSwitch",value:function(e,r){var a=wy(r);this.playerQueue.forEach(function(s){var o=s.hls;return o&&(o.setSubtitleOption(r)||r.id!==-1&&o.setSubtitleOption(a))})}},{key:"onBufferCodecs",value:function(e,r){var a=r.tracks;a&&(this.requiredTracks=a)}},{key:"onBufferAppended",value:function(e,r){this.checkBuffer()}},{key:"onBufferFlushed",value:function(e,r){var a=this.playingItem;if(a&&!this.itemsMatch(a,this.bufferingItem)&&!this.isInterstitial(a)){var s=this.timelinePos;this.bufferedPos=s,this.checkBuffer()}}},{key:"onBufferedToEnd",value:function(e){if(this.schedule){var r=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&r){for(var a=0;a<r.length;a++){var s=r[a];if(s.cue.post){var o,l=this.schedule.findEventIndex(s.identifier),u=(o=this.schedule.items)==null?void 0:o[l];this.isInterstitial(u)&&this.eventItemsMatch(u,this.bufferingItem)&&this.bufferedToItem(u,0);break}}this.bufferedPos=Number.MAX_VALUE}}}},{key:"onMediaEnded",value:function(e){var r=this.playingItem;if(!this.playingLastItem&&r){var a=this.findItemIndex(r);this.setSchedulePosition(a+1)}else this.shouldPlay=!1}
1},{key:"updateItem",value:function(e,r){var a,s=(a=this.schedule)==null?void 0:a.items;if(e&&s){var o=this.findItemIndex(e,r);return s[o]||null}return null}},{key:"trimInPlace",value:function(e,r){var a=this;if(this.isInterstitial(e)&&e.event.appendInPlace&&r.end-e.end>.25){e.event.assetList.forEach(function(u,c){e.event.isAssetPastPlayoutLimit(c)&&a.clearAssetPlayer(u.identifier,null)});var s=e.end+.25,o=Fe.bufferInfo(this.primaryMedia,s,0);if(o.end>s||(o.nextStart||0)>s){this.log("trim buffered interstitial ".concat(Jr(e)," (was ").concat(Jr(r),")"));var l=!0;this.attachPrimary(s,null,l),this.flushFrontBuffer(s)}}}},{key:"itemsMatch",value:function(e,r){return!!r&&(e===r||e.event&&r.event&&this.eventItemsMatch(e,r)||!e.event&&!r.event&&this.findItemIndex(e)===this.findItemIndex(r))}},{key:"eventItemsMatch",value:function(e,r){var a;return!!r&&(e===r||e.event.identifier===((a=r.event)==null?void 0:a.identifier))}},{key:"findItemIndex",value:function(e,r){return e&&this.schedule?this.schedule.findItemIndex(e,r):-1}},{key:"updateSchedule",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,r,a=this.mediaSelection;a&&((r=this.schedule)==null||r.updateSchedule(a,[],e))}},{key:"checkBuffer",value:function(e){var r,a=(r=this.schedule)==null?void 0:r.items;if(a){var s=Fe.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=s.len<1),this.updateBufferedPos(s.end,a,e)}}},{key:"updateBufferedPos",value:function(e,r,a){var s=this.schedule,o=this.bufferingItem;if(!(this.bufferedPos>e||!s)){if(r.length===1&&this.itemsMatch(r[0],o)){this.bufferedPos=e;return}var l=this.playingItem,u=this.findItemIndex(l),c=s.findItemIndexAtTime(e);if(this.bufferedPos<e){var f,d=this.findItemIndex(o),h=Math.min(d+1,r.length-1),v=r[h];if((c===-1&&o&&e>=o.end||(f=v.event)!=null&&f.appendInPlace&&e+.01>=v.start)&&(c=h),this.isInterstitial(o)){var m=o.event;if(h-u>1&&m.appendInPlace===!1||m.assetList.length===0&&m.assetListLoader)return}if(this.bufferedPos=e,c>d&&c>u)this.bufferedToItem(v);else{var p=this.primaryDetails;this.primaryLive&&p&&e>p.edge-p.targetduration&&v.start<p.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(v)&&this.preloadAssets(v.event,0)}}else a&&l&&!this.itemsMatch(l,o)&&(c===u?this.bufferedToItem(l):c===u+1&&this.bufferedToItem(r[c]))}}},{key:"assetsBuffered",value:function(e,r){var a=this,s=e.event.assetList;return s.length===0?!1:!e.event.assetList.some(function(o){var l=a.getAssetPlayer(o.identifier);return!(l!=null&&l.bufferedInPlaceToEnd(r))})}},{key:"setBufferingItem",value:function(e){var r=this,a=this.bufferingItem,s=this.schedule;if(!this.itemsMatch(e,a)&&s){var o=s.items,l=s.events;if(!o||!l)return a;var u=this.isInterstitial(e),c=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));var f=c?c.remaining:a?a.end-this.timelinePos:0;if(this.log("INTERSTITIALS_BUFFERED_TO_BOUNDARY ".concat(Jr(e))+(a?" (".concat(f.toFixed(2)," remaining)"):"")),!this.playbackDisabled)if(u){var d=s.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach(function(h,v){var m=r.getAssetPlayer(h.identifier);m&&(v===d&&m.loadSource(),m.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(function(h){return h.pauseBuffering()});this.hls.trigger(S.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:l.slice(0),schedule:o.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return a}},{key:"bufferedToItem",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,r);else if(a!==null){this.bufferingAsset=null;var s=this.detachedData;if(s)if(s.mediaSource){var o=!0;this.attachPrimary(e.start,e,o)}else this.preloadPrimary(e);else this.preloadPrimary(e)}}}},{key:"preloadPrimary",value:function(e){var r=this.findItemIndex(e),a=this.getPrimaryResumption(e,r);this.startLoadingPrimaryAt(a)}},{key:"bufferedToEvent",value:function(e,r){var a=e.event,s=a.assetList.length===0&&!a.assetListLoader,o=a.cue.once;if(s||!o){var l=this.preloadAssets(a,r);if(l!=null&&l.interstitial.appendInPlace){var u=this.primaryMedia;u&&this.bufferAssetPlayer(l,u)}}}},{key:"preloadAssets",value:function(e,r){var a=e.assetUrl,s=e.assetList.length,o=s===0&&!e.assetListLoader,l=e.cue.once;if(o){var u=e.timelineStart;if(e.appendInPlace){var c,f=this.playingItem;!this.isInterstitial(f)&&(f==null||(c=f.nextEvent)==null?void 0:c.identifier)===e.identifier&&this.flushFrontBuffer(u+.25)}var d,h=0;if(!this.playingItem&&this.primaryLive&&(h=this.hls.startPosition,h===-1&&(h=this.hls.liveSyncPosition||0)),h&&!(e.cue.pre||e.cue.post)){var v=h-u;v>0&&(d=Math.round(v*1e3)/1e3)}if(this.log("Load interstitial asset ".concat(r+1,"/").concat(a?1:s," ").concat(e).concat(d?" live-start: ".concat(h," start-offset: ").concat(d):"")),a)return this.createAsset(e,0,0,u,e.duration,a);var m=this.assetListLoader.loadAssetList(e,d);m&&(e.assetListLoader=m)}else if(!l&&s){for(var p=r;p<s;p++){var g=e.assetList[p],E=this.getAssetPlayerQueueIndex(g.identifier);(E===-1||this.playerQueue[E].destroyed)&&!g.error&&this.createAssetPlayer(e,g,p)}var y=e.assetList[r];if(y){var _=this.getAssetPlayer(y.identifier);return _&&_.loadSource(),_}}return null}},{key:"flushFrontBuffer",value:function(e){var r=this,a=this.requiredTracks;
1if(a){this.log("Removing front buffer starting at ".concat(e));var s=Object.keys(a);s.forEach(function(o){r.hls.trigger(S.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:o})})}}},{key:"getAssetPlayerQueueIndex",value:function(e){for(var r=this.playerQueue,a=0;a<r.length;a++)if(e===r[a].assetId)return a;return-1}},{key:"getAssetPlayer",value:function(e){var r=this.getAssetPlayerQueueIndex(e);return this.playerQueue[r]||null}},{key:"getBufferingPlayer",value:function(){var e=this.playerQueue,r=this.primaryMedia;if(r){for(var a=0;a<e.length;a++)if(e[a].media===r)return e[a]}return null}},{key:"createAsset",value:function(e,r,a,s,o,l){var u={parentIdentifier:e.identifier,identifier:mw(e,l,r),duration:o,startOffset:a,timelineStart:s,uri:l};return this.createAssetPlayer(e,u,r)}},{key:"createAssetPlayer",value:function(e,r,a){var s=this,o=this.hls,l=o.userConfig,u=l.videoPreference,c=o.loadLevelObj||o.levels[o.currentLevel];(u||c)&&(u=nt({},u),c.videoCodec&&(u.videoCodec=c.videoCodec),c.videoRange&&(u.allowedVideoRanges=[c.videoRange]));var f=o.audioTracks[o.audioTrack],d=o.subtitleTracks[o.subtitleTrack],h=0;if(this.primaryLive||e.appendInPlace){var v=this.timelinePos-r.timelineStart;if(v>1){var m=r.duration;m&&v<m&&(h=v)}}var p=r.identifier,g=et(et({},l),{},{maxMaxBufferLength:Math.min(180,o.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:o.sessionId,assetPlayerId:p,abrEwmaDefaultEstimate:o.bandwidthEstimate,interstitialsController:void 0,startPosition:h,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:u,audioPreference:f||l.audioPreference,subtitlePreference:d||l.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,r.timelineStart&&(g.timelineOffset=r.timelineStart));var E=g.cmcd;E!=null&&E.sessionId&&E.contentId&&(g.cmcd=nt({},E,{contentId:Ja(r.uri)})),this.getAssetPlayer(p)&&this.warn("Duplicate date range identifier ".concat(e," and asset ").concat(p));var y=new _w(this.HlsPlayerClass,g,e,r);this.playerQueue.push(y),e.assetList[a]=r;var _=!0,b=function(L){if(L.live){var O,x=new Error("Interstitials MUST be VOD assets ".concat(e)),Y={fatal:!0,type:ge.OTHER_ERROR,details:K.INTERSTITIAL_ASSET_ITEM_ERROR,error:x},$=((O=s.schedule)==null?void 0:O.findEventIndex(e.identifier))||-1;s.handleAssetItemError(Y,e,$,a,x.message);return}var Z=L.edge-L.fragmentStart,N=r.duration;(_||N===null||Z>N)&&(_=!1,s.log('Interstitial asset "'.concat(p,'" duration change ').concat(N," > ").concat(Z)),r.duration=Z,s.updateSchedule())};y.on(S.LEVEL_UPDATED,function(D,L){var O=L.details;return b(O)}),y.on(S.LEVEL_PTS_UPDATED,function(D,L){var O=L.details;return b(O)}),y.on(S.EVENT_CUE_ENTER,function(){return s.onInterstitialCueEnter()});var C=function D(L,O){var x=s.getAssetPlayer(p);if(x&&O.tracks){x.off(S.BUFFER_CODECS,D),x.tracks=O.tracks;var Y=s.primaryMedia;s.bufferingAsset===x.assetItem&&Y&&!x.media&&s.bufferAssetPlayer(x,Y)}};y.on(S.BUFFER_CODECS,C);var R=function(){var L,O=s.getAssetPlayer(p);if(s.log("buffered to end of asset ".concat(O)),!(!O||!s.schedule)){var x=s.schedule.findEventIndex(e.identifier),Y=(L=s.schedule.items)==null?void 0:L[x];s.isInterstitial(Y)&&s.advanceAssetBuffering(Y,r)}};y.on(S.BUFFERED_TO_END,R);var M=function(L){return function(){var O=s.getAssetPlayer(p);if(!(!O||!s.schedule)){s.shouldPlay=!0;var x=s.schedule.findEventIndex(e.identifier);s.advanceAfterAssetEnded(e,x,L)}}};return y.once(S.MEDIA_ENDED,M(a)),y.once(S.PLAYOUT_LIMIT_REACHED,M(1/0)),y.on(S.ERROR,function(D,L){if(s.schedule){var O=s.getAssetPlayer(p);if(L.details===K.BUFFER_STALLED_ERROR){if(O!=null&&O.appendInPlace){s.handleInPlaceStall(e);return}s.onTimeupdate(),s.checkBuffer(!0);return}s.handleAssetItemError(L,e,s.schedule.findEventIndex(e.identifier),a,"Asset player error ".concat(L.error," ").concat(e))}}),y.on(S.DESTROYING,function(){var D=s.getAssetPlayer(p);if(!(!D||!s.schedule)){var L=new Error("Asset player destroyed unexpectedly ".concat(p)),O={fatal:!0,type:ge.OTHER_ERROR,details:K.INTERSTITIAL_ASSET_ITEM_ERROR,error:L};s.handleAssetItemError(O,e,s.schedule.findEventIndex(e.identifier),a,L.message)}}),this.log("INTERSTITIAL_ASSET_PLAYER_CREATED ".concat(ra(r))),this.hls.trigger(S.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:r,assetListIndex:a,event:e,player:y}),y}},{key:"clearInterstitial",value:function(e,r){this.clearAssetPlayers(e,r),e.reset()}},{key:"clearAssetPlayers",value:function(e,r){var a=this;e.assetList.forEach(function(s){a.clearAssetPlayer(s.identifier,r)})}},{key:"resetAssetPlayer",value:function(e){var r=this.getAssetPlayerQueueIndex(e);if(r!==-1){this.log('reset asset player "'.concat(e,'" after error'));var a=this.playerQueue[r];this.transferMediaFromPlayer(a,null),a.resetDetails()}}},{key:"clearAssetPlayer",value:function(e,r){var a=this.getAssetPlayerQueueIndex(e);if(a!==-1){var s=this.playerQueue[a];this.log("clear ".concat(s," toSegment: ").concat(r&&Jr(r))),this.transferMediaFromPlayer(s,r),this.playerQueue.splice(a,1),s.destroy()}}},{key:"emptyPlayerQueue",value:function(){for(var e;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}},{key:"startAssetPlayer",value:function(e,r,a,s,o){var l=e.interstitial,u=e.assetItem,c=e.assetId,f=l.assetList.length,d=this.playingAsset;this.endedAsset=null,this.playingAsset=u,(!d||d.identifier!==c)&&(d&&(this.clearAssetPlayer(d.identifier,a[s]),delete d.error),this.log("INTERSTITIAL_ASSET_STARTED ".concat(r+1,"/").concat(f," ").concat(ra(u))),this.hls.trigger(S.INTERSTITIAL_ASSET_STARTED,{asset:u,assetListIndex:r,event:l,sc
1hedule:a.slice(0),scheduleIndex:s,player:e})),this.bufferAssetPlayer(e,o)}},{key:"bufferAssetPlayer",value:function(e,r){var a,s;if(this.schedule){var o=e.interstitial,l=e.assetItem,u=this.schedule.findEventIndex(o.identifier),c=(a=this.schedule.items)==null?void 0:a[u];if(c){e.loadSource(),this.setBufferingItem(c),this.bufferingAsset=l;var f=this.getBufferingPlayer();if(f!==e){var d=o.appendInPlace;if(!(d&&(f==null?void 0:f.interstitial.appendInPlace)===!1)){var h=(f==null?void 0:f.tracks)||((s=this.detachedData)==null?void 0:s.tracks)||this.requiredTracks;if(d&&l!==this.playingAsset){if(!e.tracks){this.log("Waiting for track info before buffering ".concat(e));return}if(h&&!F_(h,e.tracks)){var v=new Error("Asset ".concat(ra(l)," SourceBuffer tracks ('").concat(Object.keys(e.tracks),"') are not compatible with primary content tracks ('").concat(Object.keys(h),"')")),m={fatal:!0,type:ge.OTHER_ERROR,details:K.INTERSTITIAL_ASSET_ITEM_ERROR,error:v},p=o.findAssetIndex(l);this.handleAssetItemError(m,o,u,p,v.message);return}}this.transferMediaTo(e,r)}}}}}},{key:"handleInPlaceStall",value:function(e){var r=this.schedule,a=this.primaryMedia;if(!(!r||!a)){var s=a.currentTime,o=r.findAssetIndex(e,s),l=e.assetList[o];if(l){var u=this.getAssetPlayer(l.identifier);if(u){var c=u.currentTime||s-l.timelineStart,f=u.duration-c;if(this.warn("Stalled at ".concat(c," of ").concat(c+f," in ").concat(u," ").concat(e," (media.currentTime: ").concat(s,")")),c&&(f/a.playbackRate<.5||u.bufferedInPlaceToEnd(a))&&u.hls){var d=r.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,d,o)}}}}}},{key:"advanceInPlace",value:function(e){var r=this.primaryMedia;r&&r.currentTime<e&&(r.currentTime=e)}},{key:"handleAssetItemError",value:function(e,r,a,s,o){if(e.details!==K.BUFFER_STALLED_ERROR){var l=r.assetList[s]||null;if(this.warn("INTERSTITIAL_ASSET_ERROR ".concat(l&&ra(l)," ").concat(e.error)),!!this.schedule){var u=(l==null?void 0:l.identifier)||"",c=this.getAssetPlayerQueueIndex(u),f=this.playerQueue[c]||null,d=this.schedule.items,h=nt({},e,{fatal:!1,errorAction:na(!0),asset:l,assetListIndex:s,event:r,schedule:d,scheduleIndex:a,player:f});if(this.hls.trigger(S.INTERSTITIAL_ASSET_ERROR,h),!!e.fatal){var v=this.playingAsset,m=this.bufferingAsset,p=new Error(o);if(l&&(this.clearAssetPlayer(u,null),l.error=p),!r.assetList.some(function(E){return!E.error}))r.error=p;else for(var g=s;g<r.assetList.length;g++)this.resetAssetPlayer(r.assetList[g].identifier);this.updateSchedule(!0),r.error?this.primaryFallback(r):v&&v.identifier===u?this.advanceAfterAssetEnded(r,a,s):m&&m.identifier===u&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,m)}}}}},{key:"primaryFallback",value:function(e){var r=e.timelineStart,a=this.effectivePlayingItem,s=this.timelinePos;if(a){this.log('Fallback to primary from event "'.concat(e.identifier,'" start: ').concat(r," pos: ").concat(s," playing: ").concat(Jr(a)," error: ").concat(e.error)),s===-1&&(s=this.hls.startPosition);var o=this.updateItem(a,s);this.itemsMatch(a,o)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(r,null),this.flushFrontBuffer(r))}else if(s===-1){this.checkStart();return}if(this.schedule){var l=this.schedule.findItemIndexAtTime(s);this.setSchedulePosition(l)}}},{key:"onAssetListLoaded",value:function(e,r){var a=this,s,o,l=r.event,u=l.identifier,c=r.assetListResponse.ASSETS;if((s=this.schedule)!=null&&s.hasEvent(u)){var f=l.timelineStart,d=l.duration,h=0;
1c.forEach(function(M,D){var L=parseFloat(M.DURATION);a.createAsset(l,D,h,f+h,L,M.URI),h+=L}),l.duration=h,this.log("Loaded asset-list with duration: ".concat(h," (was: ").concat(d,") ").concat(l));var v=this.waitingItem,m=(v==null?void 0:v.event.identifier)===u;this.updateSchedule();var p=(o=this.bufferingItem)==null?void 0:o.event;if(m){var g,E=this.schedule.findEventIndex(u),y=(g=this.schedule.items)==null?void 0:g[E];if(y){if(!this.playingItem&&this.timelinePos>y.end){var _=this.schedule.findItemIndexAtTime(this.timelinePos);if(_!==E){l.error=new Error("Interstitial ".concat(c.length?"no longer within playback range":"asset-list is empty"," ").concat(this.timelinePos," ").concat(l)),this.log(l.error.message),this.updateSchedule(!0),this.primaryFallback(l);return}}this.setBufferingItem(y)}this.setSchedulePosition(E)}else if((p==null?void 0:p.identifier)===u){var b=l.assetList[0];if(b){var C=this.getAssetPlayer(b.identifier);if(p.appendInPlace){var R=this.primaryMedia;C&&R&&this.bufferAssetPlayer(C,R)}else C&&C.loadSource()}}}}},{key:"onError",value:function(e,r){if(this.schedule)switch(r.details){case K.ASSET_LIST_PARSING_ERROR:case K.ASSET_LIST_LOAD_ERROR:case K.ASSET_LIST_LOAD_TIMEOUT:{var a=r.interstitial;a&&(this.updateSchedule(!0),this.primaryFallback(a));break}case K.BUFFER_STALLED_ERROR:{var s=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(s)&&s.event.appendInPlace){this.handleInPlaceStall(s.event);return}this.log("Primary player stall @".concat(this.timelinePos," bufferedPos: ").concat(this.bufferedPos)),this.onTimeupdate(),this.checkBuffer(!0);break}}}}]),i}(Hr),b_=500,bw=function(n){B(i,n);function i(t,e,r){var a;return k(this,i),a=Xe(this,i,[t,e,r,"subtitle-stream-controller",fe.SUBTITLE]),a.currentTrackId=-1,a.tracksBuffered=[],a.mainDetails=null,a.registerListeners(),a}return A(i,[{key:"onHandlerDestroying",value:function(){this.unregisterListeners(),Ie(i,"onHandlerDestroying",this,3)([]),this.mainDetails=null}},{key:"registerListeners",value:function(){Ie(i,"registerListeners",this,3)([]);var e=this.hls;e.on(S.LEVEL_LOADED,this.onLevelLoaded,this),e.on(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(S.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(S.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(S.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this)}},{key:"unregisterListeners",value:function(){Ie(i,"unregisterListeners",this,3)([]);var e=this.hls;e.off(S.LEVEL_LOADED,this.onLevelLoaded,this),e.off(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(S.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(S.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(S.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this)}},{key:"startLoad",value:function(e,r){this.stopLoad(),this.state=re.IDLE,this.setInterval(b_),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=r?-1:e,this.tick()}},{key:"onManifestLoading",value:function(){Ie(i,"onManifestLoading",this,3)([]),this.mainDetails=null}},{key:"onMediaDetaching",value:function(e,r){this.tracksBuffered=[],Ie(i,"onMediaDetaching",this,3)([e,r])}},{key:"onLevelLoaded",value:function(e,r){this.mainDetails=r.details}},{key:"onSubtitleFragProcessed",value:function(e,r){var a=r.frag,s=r.success;if(this.fragContextChanged(a)||(Rt(a)&&(this.fragPrevious=a),this.state=re.IDLE),!!s){var o=this.tracksBuffered[this.currentTrackId];if(o){for(var l,u=a.start,c=0;c<o.length;c++)if(u>=o[c].start&&u<=o[c].end){l=o[c];break}var f=a.start+a.duration;l?l.end=f:(l={start:u,end:f},o.push(l)),this.fragmentTracker.fragBuffered(a),this.fragBufferedComplete(a,null),this.media&&this.tick()}}}},{key:"onBufferFlushing",value:function(e,r){var a=r.startOffset,s=r.endOffset;if(a===0&&s!==Number.POSITIVE_INFINITY){var o=s-1;if(o<=0)return;r.endOffsetSubtitles=Math.max(0,o),this.tracksBuffered.forEach(function(l){for(var u=0;u<l.length;){if(l[u].end<=o){l.shift();continue}else if(l[u].start<o)l[u].start=o;else break;u++}}),this.fragmentTracker.removeFragmentsInRange(a,o,fe.SUBTITLE)}}},{key:"onError",value:function(e,r){var a=r.frag;(a==null?void 0:a.type)===fe.SUBTITLE&&(r.details===K.FRAG_GAP&&this.fragmentTracker.fragBuffered(a,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==re.STOPPED&&(this.state=re.IDLE))}}
1,{key:"onSubtitleTracksUpdated",value:function(e,r){var a=this,s=r.subtitleTracks;if(this.levels&&G0(this.levels,s)){this.levels=s.map(function(o){return new $a(o)});return}this.tracksBuffered=[],this.levels=s.map(function(o){var l=new $a(o);return a.tracksBuffered[l.id]=[],l}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,fe.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}},{key:"onSubtitleTrackSwitch",value:function(e,r){var a;if(this.currentTrackId=r.id,!((a=this.levels)!=null&&a.length)||this.currentTrackId===-1){this.clearInterval();return}var s=this.levels[this.currentTrackId];s!=null&&s.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,s&&this.state!==re.STOPPED&&this.setInterval(b_)}},{key:"onSubtitleTrackLoaded",value:function(e,r){var a,s=this.currentTrackId,o=this.levels,l=r.details,u=r.id;if(!o){this.warn("Subtitle tracks were reset while loading level ".concat(u));return}var c=o[u];if(!(u>=o.length||!c)){this.log("Subtitle track ".concat(u," loaded [").concat(l.startSN,",").concat(l.endSN,"]").concat(l.lastPartSn?"[part-".concat(l.lastPartSn,"-").concat(l.lastPartIndex,"]"):"",",duration:").concat(l.totalduration)),this.mediaBuffer=this.mediaBufferTimeRanges;var f=0;if(l.live||(a=c.details)!=null&&a.live){if(l.deltaUpdateFailed)return;var d=this.mainDetails;if(!d){this.startFragRequested=!1;return}var h=d.fragments[0];if(!c.details)l.hasProgramDateTime&&d.hasProgramDateTime?(jo(l,d),f=l.fragmentStart):h&&(f=h.start,ef(l,f));else{var v;f=this.alignPlaylists(l,c.details,(v=this.levelLastLoaded)==null?void 0:v.details),f===0&&h&&(f=h.start,ef(l,f))}d&&!this.startFragRequested&&this.setStartPosition(d,f)}if(c.details=l,this.levelLastLoaded=c,u===s&&(this.hls.trigger(S.SUBTITLE_TRACK_UPDATED,{details:l,id:u,groupId:r.groupId}),this.tick(),l.live&&!this.fragCurrent&&this.media&&this.state===re.IDLE)){var m=gn(null,l.fragments,this.media.currentTime,0);m||(this.warn("Subtitle playlist not aligned with playback"),c.details=void 0)}}}},{key:"_handleFragmentLoadComplete",value:function(e){var r=this,a=e.frag,s=e.payload,o=a.decryptdata,l=this.hls;if(!this.fragContextChanged(a)&&s&&s.byteLength>0&&o!=null&&o.key&&o.iv&&aa(o.method)){var u=performance.now();this.decrypter.decrypt(new Uint8Array(s),o.key.buffer,o.iv.buffer,_f(o.method)).catch(function(c){throw l.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:K.FRAG_DECRYPT_ERROR,fatal:!1,error:c,reason:c.message,frag:a}),c}).then(function(c){var f=performance.now();l.trigger(S.FRAG_DECRYPTED,{frag:a,payload:c,stats:{tstart:u,tdecrypt:f}})}).catch(function(c){r.warn("".concat(c.name,": ").concat(c.message)),r.state=re.IDLE})}}},{key:"doTick",value:function(){if(!this.media){this.state=re.IDLE;return}if(this.state===re.IDLE){var e=this.currentTrackId,r=this.levels,a=r==null?void 0:r[e];if(!a||!r.length||!a.details||this.waitForLive(a))return;var s=this.config,o=this.getLoadPosition(),l=Fe.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],o,s.maxBufferHole),u=l.end,c=l.len,f=a.details,d=this.hls.maxBufferLength+f.levelTargetDuration;if(c>d)return;var h=f.fragments,v=h.length,m=f.edge,p=null,g=this.fragPrevious;if(u<m){var E=s.maxFragLookUpTolerance,y=u>m-E?0:E;p=gn(g,h,Math.max(h[0].start,u),y),!p&&g&&g.start<h[0].start&&(p=h[0])}else p=h[v-1];if(p=this.filterReplacedPrimary(p,a.details),!p)return;var _=p.sn-f.startSN,b=h[_-1];if(b&&b.cc===p.cc&&this.fragmentTracker.getState(b)===jt.NOT_LOADED&&(p=b),this.fragmentTracker.getState(p)===jt.NOT_LOADED){var C=this.mapToInitFragWhenRequired(p);C&&this.loadFragment(C,a,u)}}}},{key:"loadFragment",value:function(e,r,a){Rt(e)?Ie(i,"loadFragment",this,3)([e,r,a]):this._loadInitSegment(e,r)}},{key:"mediaBufferTimeRanges",get:function(){return new kw(this.tracksBuffered[this.currentTrackId]||[])}}]),i}(Sf),kw=A(function n(i){k(this,n),this.buffered=void 0;var t=function(r,a,s){if(a=a>>>0,a>s-1)throw new DOMException("Failed to execute '".concat(r,"' on 'TimeRanges': The index provided (").concat(a,") is greater than the maximum bound (").concat(s,")"));return i[a][r]};this.buffered={get length(){return i.length},end:function(r){return t("end",r,i.length)},start:function(r){return t("start",r,i.length)}}}),Aw={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,
1185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},iE=function(i){return String.fromCharCode(Aw[i]||i)},Xr=15,bi=100,Iw={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Cw={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Lw={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Rw={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Ow=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],ww=function(){function n(){k(this,n),this.time=null,this.verboseLevel=0}return A(n,[{key:"log",value:function(t,e){if(this.verboseLevel>=t){var r=typeof e=="function"?e():e;tt.log("".concat(this.time," [").concat(t,"] ").concat(r))}}}]),n}(),vn=function(i){for(var t=[],e=0;e<i.length;e++)t.push(i[e].toString(16));return t},nE=function(){function n(){k(this,n),this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}return A(n,[{key:"reset",value:function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}},{key:"setStyles",value:function(t){for(var e=["foreground","underline","italics","background","flash"],r=0;r<e.length;r++){var a=e[r];t.hasOwnProperty(a)&&(this[a]=t[a])}}},{key:"isDefault",value:function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}},{key:"equals",value:function(t){return this.foreground===t.foreground&&this.underline===t.underline&&this.italics===t.italics&&this.background===t.background&&this.flash===t.flash}},{key:"copy",value:function(t){this.foreground=t.foreground,this.underline=t.underline,this.italics=t.italics,this.background=t.background,this.flash=t.flash}},{key:"toString",value:function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}]),n}(),xw=function(){function n(){k(this,n),this.uchar=" ",this.penState=new nE}return A(n,[{key:"reset",value:function(){this.uchar=" ",this.penState.reset()}},{key:"setChar",value:function(t,e){this.uchar=t,this.penState.copy(e)}},{key:"setPenState",value:function(t){this.penState.copy(t)}},{key:"equals",value:function(t){return this.uchar===t.uchar&&this.penState.equals(t.penState)}},{key:"copy",value:function(t){this.uchar=t.uchar,this.penState.copy(t.penState)}},{key:"isEmpty",value:function(){return this.uchar===" "&&this.penState.isDefault()}}]),n}(),Pw=function(){function n(i){k(this,n),this.chars=[],this.pos=0,this.currPenState=new nE,this.cueStartTime=null,this.logger=void 0;for(var t=0;t<bi;t++)this.chars.push(new xw);this.logger=i}return A(n,[{key:"equals",value:function(t){for(var e=0;e<bi;e++)if(!this.chars[e].equals(t.chars[e]))return!1;return!0}},{key:"copy",value:function(t){for(var e=0;e<bi;e++)this.chars[e].copy(t.chars[e])}},{key:"isEmpty",value:function(){for(var t=!0,e=0;e<bi;e++)if(!this.chars[e].isEmpty()){t=!1;break}return t}},{key:"setCursor",value:function(t){this.pos!==t&&(this.pos=t),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>bi&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=bi)}},{key:"moveCursor",value:function(t){var e=this.pos+t;if(t>1)for(var r=this.pos+1;r<e+1;r++)this.chars[r].setPenState(this.currPenState);this.setCursor(e)}},{key:"backSpace",value:function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}},{key:"insertChar",value:function(t){var e=this;t>=144&&this.backSpace();var r=iE(t);if(this.pos>=bi){this.logger.log(0,function(){return"Cannot insert "+t.toString(16)+" ("+r+") at position "+e.pos+". Skipping it!"});return}this.chars[this.pos].setChar(r,this.currPenState),this.moveCursor(1)}},{key:"clearFromPos",value:function(t){var e;for(e=t;e<bi;e++)this.chars[e].reset()}},{key:"clear",value:function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}},{key:"clearToEndOfRow",value:function(){this.clearFromPos(this.pos)}},{key:"getTextString",value:function(){for(var t=[],e=!0,r=0;r<bi;r++){var a=this.chars[r].uchar;a!==" "&&(e=!1),t.push(a)}return e?"":t.join("")}},{key:"setPenStyles",value:function(t){this.currPenState.setStyles(t);var e=this.chars[this.pos];e.setPenState(this.currPenState)}}]),n}(),Fc=function(){function n(i){k(this,n),this.rows=[],this.currRow=Xr-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(var t=0;t<Xr;t++)this.rows.push(new Pw(i));this.logger=i}return A(n,[{key:"reset",value:function(){for(var t=0;t<Xr;t++)this.rows[t].clear();this.currRow=Xr-1}},{key:"equals",value:function(t){for(var e=!0,r=0;r<Xr;r++)if(!this.rows[r].equals(t.rows[r])){e=!1;break}return e}},{key:"copy",value:function(t){for(var e=0;e<Xr;e++)this.rows[e].copy(t.rows[e])}},{key:"isEmpty",value:function(){for(var t=!0,e=0;e<Xr;e++)if(!this.rows[e].isEmpty()){t=!1;break}return t}},{key:"backSpace",value:function(){var t=this.rows[this.currRow];
1t.backSpace()}},{key:"clearToEndOfRow",value:function(){var t=this.rows[this.currRow];t.clearToEndOfRow()}},{key:"insertChar",value:function(t){var e=this.rows[this.currRow];e.insertChar(t)}},{key:"setPen",value:function(t){var e=this.rows[this.currRow];e.setPenStyles(t)}},{key:"moveCursor",value:function(t){var e=this.rows[this.currRow];e.moveCursor(t)}},{key:"setCursor",value:function(t){this.logger.log(2,"setCursor: "+t);var e=this.rows[this.currRow];e.setCursor(t)}},{key:"setPAC",value:function(t){this.logger.log(2,function(){return"pacData = "+st(t)});var e=t.row-1;if(this.nrRollUpRows&&e<this.nrRollUpRows-1&&(e=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==e){for(var r=0;r<Xr;r++)this.rows[r].clear();var a=this.currRow+1-this.nrRollUpRows,s=this.lastOutputScreen;if(s){var o=s.rows[a].cueStartTime,l=this.logger.time;if(o!==null&&l!==null&&o<l)for(var u=0;u<this.nrRollUpRows;u++)this.rows[e-this.nrRollUpRows+u+1].copy(s.rows[a+u])}}this.currRow=e;var c=this.rows[this.currRow];if(t.indent!==null){var f=t.indent,d=Math.max(f-1,0);c.setCursor(t.indent),t.color=c.chars[d].penState.foreground}var h={foreground:t.color,underline:t.underline,italics:t.italics,background:"black",flash:!1};this.setPen(h)}},{key:"setBkgData",value:function(t){this.logger.log(2,function(){return"bkgData = "+st(t)}),this.backSpace(),this.setPen(t),this.insertChar(32)}},{key:"setRollUpRows",value:function(t){this.nrRollUpRows=t}},{key:"rollUp",value:function(){var t=this;if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,function(){return t.getDisplayText()});var e=this.currRow+1-this.nrRollUpRows,r=this.rows.splice(e,1)[0];r.clear(),this.rows.splice(this.currRow,0,r),this.logger.log(2,"Rolling up")}},{key:"getDisplayText",value:function(t){t=t||!1;for(var e=[],r="",a=-1,s=0;s<Xr;s++){var o=this.rows[s].getTextString();o&&(a=s+1,t?e.push("Row "+a+": '"+o+"'"):e.push(o.trim()))}return e.length>0&&(t?r="["+e.join(" | ")+"]":r=e.join("\n")),r}},{key:"getTextAndFormat",value:function(){return this.rows}}]),n}(),k_=function(){function n(i,t,e){k(this,n),this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=i,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Fc(e),this.nonDisplayedMemory=new Fc(e),this.lastOutputScreen=new Fc(e),this.currRollUpRow=this.displayedMemory.rows[Xr-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=e}return A(n,[{key:"reset",value:function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Xr-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}},{key:"getHandler",value:function(){return this.outputFilter}},{key:"setHandler",value:function(t){this.outputFilter=t}},{key:"setPAC",value:function(t){this.writeScreen.setPAC(t)}},{key:"setBkgData",value:function(t){this.writeScreen.setBkgData(t)}},{key:"setMode",value:function(t){t!==this.mode&&(this.mode=t,this.logger.log(2,function(){return"MODE="+t}),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=t)}},{key:"insertChars",value:function(t){for(var e=this,r=0;r<t.length;r++)this.writeScreen.insertChar(t[r]);var a=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,function(){return a+": "+e.writeScreen.getDisplayText(!0)}),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,function(){return"DISPLAYED: "+e.displayedMemory.getDisplayText(!0)}),this.outputDataUpdate())}},{key:"ccRCL",value:function(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}},{key:"ccBS",value:function(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}},{key:"ccAOF",value:function(){}},{key:"ccAON",value:function(){}},{key:"ccDER",value:function(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}},{key:"ccRU",value:function(t){this.logger.log(2,"RU("+t+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(t)}},{key:"ccFON",value:function(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}},{key:"ccRDC",value:function(){this.logger.log(2,"RDC - Resume Direct
1Captioning"),this.setMode("MODE_PAINT-ON")}},{key:"ccTR",value:function(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}},{key:"ccRTD",value:function(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}},{key:"ccEDM",value:function(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}},{key:"ccCR",value:function(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}},{key:"ccENM",value:function(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}},{key:"ccEOC",value:function(){var t=this;if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,function(){return"DISP: "+t.displayedMemory.getDisplayText()})}this.outputDataUpdate(!0)}},{key:"ccTO",value:function(t){this.logger.log(2,"TO("+t+") - Tab Offset"),this.writeScreen.moveCursor(t)}},{key:"ccMIDROW",value:function(t){var e={flash:!1};if(e.underline=t%2===1,e.italics=t>=46,e.italics)e.foreground="white";else{var r=Math.floor(t/2)-16,a=["white","green","blue","cyan","red","yellow","magenta"];e.foreground=a[r]}this.logger.log(2,"MIDROW: "+st(e)),this.writeScreen.setPen(e)}},{key:"outputDataUpdate",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.logger.time;e!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=e:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,e,this.lastOutputScreen),t&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:e),this.lastOutputScreen.copy(this.displayedMemory))}},{key:"cueSplitAtTime",value:function(t){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,t,this.displayedMemory),this.cueStartTime=t))}}]),n}(),A_=function(){function n(i,t,e){k(this,n),this.channels=void 0,this.currentChannel=0,this.cmdHistory=Mw(),this.logger=void 0;var r=this.logger=new ww;this.channels=[null,new k_(i,t,r),new k_(i+1,e,r)]}return A(n,[{key:"getHandler",value:function(t){return this.channels[t].getHandler()}},{key:"setHandler",value:function(t,e){this.channels[t].setHandler(e)}},{key:"addData",value:function(t,e){var r=this;this.logger.time=t;for(var a=function(u){var c=e[u]&127,f=e[u+1]&127,d=!1,h=null;if(c===0&&f===0)return 0;r.logger.log(3,function(){return"["+vn([e[u],e[u+1]])+"] -> ("+vn([c,f])+")"});var v=r.cmdHistory,m=c>=16&&c<=31;if(m){if(Dw(c,f,v))return _o(null,null,v),r.logger.log(3,function(){return"Repeated command ("+vn([c,f])+") is dropped"}),0;_o(c,f,r.cmdHistory),d=r.parseCmd(c,f),d||(d=r.parseMidrow(c,f)),d||(d=r.parsePAC(c,f)),d||(d=r.parseBackgroundAttributes(c,f))}else _o(null,null,v);if(!d&&(h=r.parseChars(c,f),h)){var p=r.currentChannel;if(p&&p>0){var g=r.channels[p];g.insertChars(h)}else r.logger.log(2,"No channel found yet. TEXT-MODE?")}!d&&!h&&r.logger.log(2,function(){return"Couldn't parse cleaned data "+vn([c,f])+" orig: "+vn([e[u],e[u+1]])})},s,o=0;o<e.length;o+=2)s=a(o)}},{key:"parseCmd",value:function(t,e){var r=(t===20||t===28||t===21||t===29)&&e>=32&&e<=47,a=(t===23||t===31)&&e>=33&&e<=35;if(!(r||a))return!1;var s=t===20||t===21||t===23?1:2,o=this.channels[s];return t===20||t===21||t===28||t===29?e===32?o.ccRCL():e===33?o.ccBS():e===34?o.ccAOF():e===35?o.ccAON():e===36?o.ccDER():e===37?o.ccRU(2):e===38?o.ccRU(3):e===39?o.ccRU(4):e===40?o.ccFON():e===41?o.ccRDC():e===42?o.ccTR():e===43?o.ccRTD():e===44?o.ccEDM():e===45?o.ccCR():e===46?o.ccENM():e===47&&o.ccEOC():o.ccTO(e-32),this.currentChannel=s,!0}},{key:"parseMidrow",value:function(t,e){var r=0;if((t===17||t===25)&&e>=32&&e<=47){if(t===17?r=1:r=2,r!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;var a=this.channels[r];return a?(a.ccMIDROW(e),this.logger.log(3,function(){return"MIDROW ("+vn([t,e])+")"}),!0):!1}return!1}},{key:"parsePAC",value:function(t,e){var r,a=(t>=17&&t<=23||t>=25&&t<=31)&&e>=64&&e<=127,s=(t===16||t===24)&&e>=64&&e<=95;if(!(a||s))return!1;var o=t<=23?1:2;e>=64&&e<=95?r=o===1?Iw[t]:Lw[t]:r=o===1?Cw[t]:Rw[t];var l=this.channels[o];return l?(l.setPAC(this.interpretPAC(r,e)),this.currentChannel=o,!0):!1}},{key:"interpretPAC",value:function(t,e){var r,a={color:null,italics:!1,indent:null,underline:!1,row:t};return e>
195?r=e-96:r=e-64,a.underline=(r&1)===1,r<=13?a.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(a.italics=!0,a.color="white"):a.indent=Math.floor((r-16)/2)*4,a}},{key:"parseChars",value:function(t,e){var r,a=null,s=null;if(t>=25?(r=2,s=t-8):(r=1,s=t),s>=17&&s<=19){var o;s===17?o=e+80:s===18?o=e+112:o=e+144,this.logger.log(2,function(){return"Special char '"+iE(o)+"' in channel "+r}),a=[o]}else t>=32&&t<=127&&(a=e===0?[t]:[t,e]);return a&&this.logger.log(3,function(){return"Char codes = "+vn(a).join(",")}),a}},{key:"parseBackgroundAttributes",value:function(t,e){var r=(t===16||t===24)&&e>=32&&e<=47,a=(t===23||t===31)&&e>=45&&e<=47;if(!(r||a))return!1;var s,o={};t===16||t===24?(s=Math.floor((e-32)/2),o.background=Ow[s],e%2===1&&(o.background=o.background+"_semi")):e===45?o.background="transparent":(o.foreground="black",e===47&&(o.underline=!0));var l=t<=23?1:2,u=this.channels[l];return u.setBkgData(o),!0}},{key:"reset",value:function(){for(var t=0;t<Object.keys(this.channels).length;t++){var e=this.channels[t];e&&e.reset()}_o(null,null,this.cmdHistory)}},{key:"cueSplitAtTime",value:function(t){for(var e=0;e<this.channels.length;e++){var r=this.channels[e];r&&r.cueSplitAtTime(t)}}}]),n}();xf=function(){if(Bo!=null&&Bo.VTTCue)return self.VTTCue;var n=["","lr","rl"],i=["start","middle","end","left","right"];function t(o,l){if(typeof l!="string"||!Array.isArray(o))return!1;var u=l.toLowerCase();return~o.indexOf(u)?u:!1}function e(o){return t(n,o)}function r(o){return t(i,o)}function a(o){for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;c<l;c++)u[c-1]=arguments[c];for(var f=1;f<arguments.length;f++){var d=arguments[f];for(var h in d)o[h]=d[h]}return o}function s(o,l,u){var c=this,f={enumerable:!0};c.hasBeenReset=!1;var d="",h=!1,v=o,m=l,p=u,g=null,E="",y=!0,_="auto",b="start",C=50,R="middle",M=50,D="middle";Object.defineProperty(c,"id",a({},f,{get:function(){return d},set:function(O){d=""+O}})),Object.defineProperty(c,"pauseOnExit",a({},f,{get:function(){return h},set:function(O){h=!!O}})),Object.defineProperty(c,"startTime",a({},f,{get:function(){return v},set:function(O){if(typeof O!="number")throw new TypeError("Start time must be set to a number.");v=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"endTime",a({},f,{get:function(){return m},set:function(O){if(typeof O!="number")throw new TypeError("End time must be set to a number.");m=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"text",a({},f,{get:function(){return p},set:function(O){p=""+O,this.hasBeenReset=!0}})),Object.defineProperty(c,"region",a({},f,{get:function(){return g},set:function(O){g=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"vertical",a({},f,{get:function(){return E},set:function(O){var x=e(O);if(x===!1)throw new SyntaxError("An invalid or illegal string was specified.");E=x,this.hasBeenReset=!0}})),Object.defineProperty(c,"snapToLines",a({},f,{get:function(){return y},set:function(O){y=!!O,this.hasBeenReset=!0}})),Object.defineProperty(c,"line",a({},f,{get:function(){return _},set:function(O){if(typeof O!="number"&&O!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");_=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"lineAlign",a({},f,{get:function(){return b},set:function(O){var x=r(O);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");b=x,this.hasBeenReset=!0}})),Object.defineProperty(c,"position",a({},f,{get:function(){return C},set:function(O){if(O<0||O>100)throw new Error("Position must be between 0 and 100.");C=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"positionAlign",a({},f,{get:function(){return R},set:function(O){var x=r(O);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");R=x,this.hasBeenReset=!0}})),Object.defineProperty(c,"size",a({},f,{get:function(){return M},set:function(O){if(O<0||O>100)throw new Error("Size must be between 0 and 100.");M=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"align",a({},f,{get:function(){return D},set:function(O){var x=r(O);if(!x)throw new SyntaxError("An invalid or illegal string was specified.");D=x,this.hasBeenReset=!0}})),c.displayState=void 0}return s.prototype.getCueAsHTML=function(){var o=self.WebVTT;return o.convertCueToDOMTree(self,this.text)},s}(),Nw=function(){function n(){k(this,n)}return A(n,[{key:"decode",value:function(t,e){if(!t)return"";if(typeof t!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}]),n}();Fw=function(){function n(){k(this,n),this.values=Object.create(null)}return A(n,[{key:"set",value:function(t,e){!this.get(t)&&e!==""&&(this.values[t]=e)}},{key:"get",value:function(t,e,r){return r?this.has(t)?this.values[t]:e[r]:this.has(t)?this.values[t]:e}},{key:"has",value:function(t){return t in this.values}},{key:"alt",value:function(t,e,r){for(var a=0;a<r.length;++a)if(e===r[a]){this.set(t,e);break}}},{key:"integer",value:function(t,e){/^-?\d+$/.test(e)&&this.set(t,parseInt(e,10))}},{key:"percent",value:function(t,e){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(e)){var r=parseFloat(e);
1if(r>=0&&r<=100)return this.set(t,r),!0}return!1}}]),n}();lf=new xf(0,0,""),Eo=lf.align==="middle"?"middle":"center";Bw=function(){function n(){k(this,n),this.state="INITIAL",this.buffer="",this.decoder=new Nw,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}return A(n,[{key:"parse",value:function(t){var e=this;t&&(e.buffer+=e.decoder.decode(t,{stream:!0}));function r(){var c=e.buffer,f=0;for(c=oE(c);f<c.length&&c[f]!=="\r"&&c[f]!=="\n";)++f;var d=c.slice(0,f);return c[f]==="\r"&&++f,c[f]==="\n"&&++f,e.buffer=c.slice(f),d}function a(c){sE(c,function(f,d){},/:/)}try{var s="";if(e.state==="INITIAL"){if(!/\r\n|\n/.test(e.buffer))return this;s=r();var o=s.match(/^()?WEBVTT([ \t].*)?$/);if(!(o!=null&&o[0]))throw new Error("Malformed WebVTT signature.");e.state="HEADER"}for(var l=!1;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;switch(l?l=!1:s=r(),e.state){case"HEADER":/:/.test(s)?a(s):s||(e.state="ID");continue;case"NOTE":s||(e.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(s)){e.state="NOTE";break}if(!s)continue;if(e.cue=new xf(0,0,""),e.state="CUE",s.indexOf("-->")===-1){e.cue.id=s;continue}case"CUE":if(!e.cue){e.state="BADCUE";continue}try{Uw(s,e.cue,e.regionList)}catch(c){e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":{var u=s.indexOf("-->")!==-1;if(!s||u&&(l=!0)){e.oncue&&e.cue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}if(e.cue===null)continue;e.cue.text&&(e.cue.text+="\n"),e.cue.text+=s}continue;case"BADCUE":s||(e.state="ID")}}}catch(c){e.state==="CUETEXT"&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state=e.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}},{key:"flush",value:function(){var t=this;try{if((t.cue||t.state==="HEADER")&&(t.buffer+="\n\n",t.parse()),t.state==="INITIAL"||t.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(e){t.onparsingerror&&t.onparsingerror(e)}return t.onflush&&t.onflush(),this}}]),n}(),Gw=/\r\n|\n\r|\n|\r/g,Uc=function(i,t){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return i.slice(e,e+t.length)===t},jw=function(i){var t=parseInt(i.slice(-3)),e=parseInt(i.slice(-6,-4)),r=parseInt(i.slice(-9,-7)),a=i.length>9?parseInt(i.substring(0,i.indexOf(":"))):0;if(!ce(t)||!ce(e)||!ce(r)||!ce(a))throw Error("Malformed X-TIMESTAMP-MAP: Local:".concat(i));return t+=1e3*e,t+=60*1e3*r,t+=60*60*1e3*a,t};Hw=function(i,t,e){var r=i[t],a=i[r.prevCC];if(!a||!a.new&&r.new){i.ccOffset=i.presentationOffset=r.start,r.new=!1;return}for(;(s=a)!=null&&s.new;){var s;i.ccOffset+=r.start-a.start,r.new=!1,r=a,a=i[r.prevCC]}i.presentationOffset=e};Bc="stpp.ttml.im1t",lE=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,uE=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Kw={left:"start",center:"center",right:"end",start:"start",end:"end"};So=function(){function n(i,t){k(this,n),this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=i,this.trackName=t}return A(n,[{key:"dispatchCue",value:function(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}},{key:"newCue",value:function(t,e,r){(this.startTime===null||this.startTime>t)&&(this.startTime=t),this.endTime=e,this.screen=r,this.timelineController.createCaptionsTrack(this.trackName)}},{key:"reset",value:function(){this.cueRanges=[],this.startTime=null}}]),n}(),Jw=function(){function n(i){k(this,n),this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=O_(),this.captionsProperties=void 0,this.hls=i,this.config=i.config,this.Cues=i.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}}
1,i.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),i.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(S.MANIFEST_LOADING,this.onManifestLoading,this),i.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),i.on(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),i.on(S.FRAG_LOADING,this.onFragLoading,this),i.on(S.FRAG_LOADED,this.onFragLoaded,this),i.on(S.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),i.on(S.FRAG_DECRYPTED,this.onFragDecrypted,this),i.on(S.INIT_PTS_FOUND,this.onInitPtsFound,this),i.on(S.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),i.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this)}return A(n,[{key:"destroy",value:function(){var t=this.hls;t.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(S.FRAG_LOADING,this.onFragLoading,this),t.off(S.FRAG_LOADED,this.onFragLoaded,this),t.off(S.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.off(S.FRAG_DECRYPTED,this.onFragDecrypted,this),t.off(S.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(S.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}},{key:"initCea608Parsers",value:function(){var t=new So(this,"textTrack1"),e=new So(this,"textTrack2"),r=new So(this,"textTrack3"),a=new So(this,"textTrack4");this.cea608Parser1=new A_(1,t,e),this.cea608Parser2=new A_(3,r,a)}},{key:"addCues",value:function(t,e,r,a,s){for(var o=!1,l=s.length;l--;){var u=s[l],c=Xw(u[0],u[1],e,r);if(c>=0&&(u[0]=Math.min(u[0],e),u[1]=Math.max(u[1],r),o=!0,c/(r-e)>.5))return}if(o||s.push([e,r]),this.config.renderTextTracksNatively){var f=this.captionsTracks[t];this.Cues.newCue(f,e,r,a)}else{var d=this.Cues.newCue(null,e,r,a);this.hls.trigger(S.CUES_PARSED,{type:"captions",cues:d,track:t})}}},{key:"onInitPtsFound",value:function(t,e){var r=this,a=e.frag,s=e.id,o=e.initPTS,l=e.timescale,u=e.trackId,c=this.unparsedVttFrags;s===fe.MAIN&&(this.initPTS[a.cc]={baseTime:o,timescale:l,trackId:u}),c.length&&(this.unparsedVttFrags=[],c.forEach(function(f){r.initPTS[f.frag.cc]?r.onFragLoaded(S.FRAG_LOADED,f):r.hls.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}},{key:"getExistingTrack",value:function(t,e){var r=this.media;if(r)for(var a=0;a<r.textTracks.length;a++){var s=r.textTracks[a];if(R_(s,{name:t,lang:e,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return s}return null}},{key:"createCaptionsTrack",value:function(t){this.config.renderTextTracksNatively?this.createNativeTrack(t):this.createNonNativeTrack(t)}},{key:"createNativeTrack",value:function(t){if(!this.captionsTracks[t]){var e=this.captionsProperties,r=this.captionsTracks,a=this.media,s=e[t],o=s.label,l=s.languageCode,u=this.getExistingTrack(o,l);if(u)r[t]=u,ia(r[t]),eE(r[t],a);else{var c=this.createTextTrack("captions",o,l);c&&(c[t]=!0,r[t]=c)}}}},{key:"createNonNativeTrack",value:function(t){if(!this.nonNativeCaptionsTracks[t]){var e=this.captionsProperties[t];if(e){var r=e.label,a={_id:t,label:r,kind:"captions",default:e.media?!!e.media.default:!1,closedCaptions:e.media};this.nonNativeCaptionsTracks[t]=a,this.hls.trigger(S.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[a]})}}}},{key:"createTextTrack",value:function(t,e,r){var a=this.media;if(a)return a.addTextTrack(t,e,r)}},{key:"onMediaAttaching",value:function(t,e){this.media=e.media,e.mediaSource||this._cleanTracks()}},{key:"onMediaDetaching",value:function(t,e){var r=!!e.transferMedia;if(this.media=null,!r){var a=this.captionsTracks;Object.keys(a).forEach(function(s){ia(a[s]),delete a[s]}),this.nonNativeCaptionsTracks={}}}},{key:"onManifestLoading",value:function(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=O_(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}},{key:"_cleanTracks",value:function(){var t=this.media;if(t){var e=t.textTracks;
1if(e)for(var r=0;r<e.length;r++)ia(e[r])}}},{key:"onSubtitleTracksUpdated",value:function(t,e){var r=this,a=e.subtitleTracks||[],s=a.some(function(d){return d.textCodec===Bc});if(this.config.enableWebVTT||s&&this.config.enableIMSC1){var o=G0(this.tracks,a);if(o){this.tracks=a;return}if(this.textTracks=[],this.tracks=a,this.config.renderTextTracksNatively){var l=this.media,u=l?Oo(l.textTracks):null;if(this.tracks.forEach(function(d,h){var v;if(u){for(var m=null,p=0;p<u.length;p++)if(u[p]&&R_(u[p],d)){m=u[p],u[p]=null;break}m&&(v=m)}if(v)ia(v);else{var g=fE(d);v=r.createTextTrack(g,d.name,d.lang),v&&(v.mode="disabled")}v&&r.textTracks.push(v)}),u!=null&&u.length){var c=u.filter(function(d){return d!==null}).map(function(d){return d.label});c.length&&this.hls.logger.warn("Media element contains unused subtitle tracks: ".concat(c.join(", "),". Replace media element for each source to clear TextTracks and captions menu."))}}else if(this.tracks.length){var f=this.tracks.map(function(d){return{label:d.name,kind:d.type.toLowerCase(),default:d.default,subtitleTrack:d}});this.hls.trigger(S.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:f})}}}},{key:"onManifestLoaded",value:function(t,e){var r=this;this.config.enableCEA708Captions&&e.captions&&e.captions.forEach(function(a){var s=/(?:CC|SERVICE)([1-4])/.exec(a.instreamId);if(s){var o="textTrack".concat(s[1]),l=r.captionsProperties[o];l&&(l.label=a.name,a.lang&&(l.languageCode=a.lang),l.media=a)}})}},{key:"closedCaptionsForLevel",value:function(t){var e=this.hls.levels[t.level];return e==null?void 0:e.attrs["CLOSED-CAPTIONS"]}},{key:"onFragLoading",value:function(t,e){if(this.enabled&&e.frag.type===fe.MAIN){var r,a,s=this.cea608Parser1,o=this.cea608Parser2,l=this.lastSn,u=e.frag,c=u.cc,f=u.sn,d=(r=(a=e.part)==null?void 0:a.index)!=null?r:-1;s&&o&&(f!==l+1||f===l&&d!==this.lastPartIndex+1||c!==this.lastCc)&&(s.reset(),o.reset()),this.lastCc=c,this.lastSn=f,this.lastPartIndex=d}}},{key:"onFragLoaded",value:function(t,e){var r=e.frag,a=e.payload;if(r.type===fe.SUBTITLE)if(a.byteLength){var s=r.decryptdata,o="stats"in e;if(s==null||!s.encrypted||o){var l=this.tracks[r.level],u=this.vttCCs;u[r.cc]||(u[r.cc]={start:r.start,prevCC:this.prevCC,new:!0},this.prevCC=r.cc),l&&l.textCodec===Bc?this._parseIMSC1(r,a):this._parseVTTs(e)}}else this.hls.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:new Error("Empty subtitle payload")})}},{key:"_parseIMSC1",value:function(t,e){var r=this,a=this.hls;I_(e,this.initPTS[t.cc],function(s){r._appendCues(s,t.level),a.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})},function(s){a.logger.log("Failed to parse IMSC1: ".concat(s)),a.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:s})})}},{key:"_parseVTTs",value:function(t){var e=this,r,a=t.frag,s=t.payload,o=this.initPTS,l=this.unparsedVttFrags,u=o.length-1;if(!o[a.cc]&&u===-1){l.push(t);return}var c=this.hls,f=(r=a.initSegment)!=null&&r.data?jr(a.initSegment.data,new Uint8Array(s)).buffer:s;Vw(f,this.initPTS[a.cc],this.vttCCs,a.cc,a.start,function(d){e._appendCues(d,a.level),c.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:a})},function(d){var h=d.message==="Missing initPTS for VTT MPEGTS";h?l.push(t):e._fallbackToIMSC1(a,s),c.logger.log("Failed to parse VTT cue: ".concat(d)),!(h&&u>a.cc)&&c.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:a,error:d})})}},{key:"_fallbackToIMSC1",value:function(t,e){var r=this,a=this.tracks[t.level];a.textCodec||I_(e,this.initPTS[t.cc],function(){a.textCodec=Bc,r._parseIMSC1(t,e)},function(){a.textCodec="wvtt"})}},{key:"_appendCues",value:function(t,e){var r=this.hls;if(this.config.renderTextTracksNatively){var a=this.textTracks[e];if(!a||a.mode==="disabled")return;t.forEach(function(l){return tE(a,l)})}else{var s=this.tracks[e];if(!s)return;var o=s.default?"default":"subtitles"+e;r.trigger(S.CUES_PARSED,{type:"subtitles",cues:t,track:o})}}},{key:"onFragDecrypted",value:function(t,e){var r=e.frag;r.type===fe.SUBTITLE&&this.onFragLoaded(S.FRAG_LOADED,e)}},{key:"onSubtitleTracksCleared",value:function(){this.tracks=[],this.captionsTracks={}}},{key:"onFragParsingUserdata",value:function(t,e){if(!(!this.enabled||!this.config.enableCEA708Captions)){var r=e.frag,a=e.samples;if(!(r.type===fe.MAIN&&this.closedCaptionsForLevel(r)==="NONE"))for(var s=0;s<a.length;s++){var o=a[s].bytes;if(o){this.cea608Parser1||this.initCea608Parsers();var l=this.extractCea608Data(o);this.cea608Parser1.addData(a[s].pts,l[0]),this.cea608Parser2.addData(a[s].pts,l[1])}}}}},{key:"onBufferFlushing",value:function(t,e){var r=e.startOffset,a=e.endOffset,s=e.endOffsetSubtitles,o=e.type,l=this.media;if(!(!l||l.currentTime<a)){if(!o||o==="video"){var u=this.captionsTracks;Object.keys(u).forEach(function(f){return of(u[f],r,a)})}if(this.config.renderTextTracksNatively&&r===0&&s!==void 0){var c=this.textTracks;
1Object.keys(c).forEach(function(f){return of(c[f],r,s)})}}}},{key:"extractCea608Data",value:function(t){for(var e=[[],[]],r=t[0]&31,a=2,s=0;s<r;s++){var o=t[a++],l=127&t[a++],u=127&t[a++];if(!(l===0&&u===0)){var c=(4&o)!==0;if(c){var f=3&o;(f===0||f===1)&&(e[f].push(l),e[f].push(u))}}}return e}}]),n}();Qw=/\s/,$w={newCue:function(i,t,e,r){for(var a=[],s,o,l,u,c,f=self.VTTCue||self.TextTrackCue,d=0;d<r.rows.length;d++)if(s=r.rows[d],l=!0,u=0,c="",!s.isEmpty()){for(var h,v=0;v<s.chars.length;v++)Qw.test(s.chars[v].uchar)&&l?u++:(c+=s.chars[v].uchar,l=!1);s.cueStartTime=t,t===e&&(e+=1e-4),u>=16?u--:u++;var m=oE(c.trim()),p=Pf(t,e,m);i!=null&&(h=i.cues)!=null&&h.getCueById(p)||(o=new f(t,e,m),o.id=p,o.line=d+1,o.align="left",o.position=10+Math.min(80,Math.floor(u*8/32)*10),a.push(o))}return i&&a.length&&(a.sort(function(g,E){return g.line==="auto"||E.line==="auto"?0:g.line>8&&E.line>8?E.line-g.line:g.line-E.line}),a.forEach(function(g){return tE(i,g)})),a}};ex=/(\d+)-(\d+)\/(\d+)/,w_=function(){function n(i){k(this,n),this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=i.fetchSetup||nx,this.controller=new self.AbortController,this.stats=new df}return A(n,[{key:"destroy",value:function(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}},{key:"abortInternal",value:function(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}},{key:"abort",value:function(){var t;this.abortInternal(),(t=this.callbacks)!=null&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}},{key:"load",value:function(t,e,r){var a=this,s=this.stats;if(s.loading.start)throw new Error("Loader can only be used once.");s.loading.start=self.performance.now();var o=tx(t,this.controller.signal),l=t.responseType==="arraybuffer",u=l?"byteLength":"length",c=e.loadPolicy,f=c.maxTimeToFirstByteMs,d=c.maxLoadTimeMs;this.context=t,this.config=e,this.callbacks=r,this.request=this.fetchSetup(t,o),self.clearTimeout(this.requestTimeout),e.timeout=f&&ce(f)?f:d,this.requestTimeout=self.setTimeout(function(){a.callbacks&&(a.abortInternal(),a.callbacks.onTimeout(s,t,a.response))},e.timeout);var h=ts(this.request)?this.request.then(self.fetch):self.fetch(this.request);h.then(function(v){var m;a.response=a.loader=v;var p=Math.max(self.performance.now(),s.loading.start);if(self.clearTimeout(a.requestTimeout),e.timeout=d,a.requestTimeout=self.setTimeout(function(){a.callbacks&&(a.abortInternal(),a.callbacks.onTimeout(s,t,a.response))},d-(p-s.loading.start)),!v.ok){var g=v.status,E=v.statusText;throw new ax(E||"fetch, bad network response",g,v)}s.loading.first=p,s.total=ix(v.headers)||s.total;var y=(m=a.callbacks)==null?void 0:m.onProgress;return y&&ce(e.highWaterMark)?a.loadProgressively(v,s,t,e.highWaterMark,y):l?v.arrayBuffer():t.responseType==="json"?v.json():v.text()}).then(function(v){var m,p,g=a.response;if(!g)throw new Error("loader destroyed");self.clearTimeout(a.requestTimeout),s.loading.end=Math.max(self.performance.now(),s.loading.first);var E=v[u];E&&(s.loaded=s.total=E);var y={url:g.url,data:v,code:g.status},_=(m=a.callbacks)==null?void 0:m.onProgress;_&&!ce(e.highWaterMark)&&_(s,t,v,g),(p=a.callbacks)==null||p.onSuccess(y,s,t,g)}).catch(function(v){var m;if(self.clearTimeout(a.requestTimeout),!s.aborted){var p=v&&v.code||0,g=v?v.message:null;(m=a.callbacks)==null||m.onError({code:p,text:g},t,v?v.details:null,s)}})}},{key:"getCacheAge",value:function(){var t=null;if(this.response){var e=this.response.headers.get("age");t=e?parseFloat(e):null}return t}},{key:"getResponseHeader",value:function(t){return this.response?this.response.headers.get(t):null}},{key:"loadProgressively",value:function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4?arguments[4]:void 0,o=new E0,l=t.body.getReader(),u=function c(){return l.read().then(function(f){if(f.done)return o.dataLength&&s(e,r,o.flush().buffer,t),Promise.resolve(new ArrayBuffer(0));var d=f.value,h=d.length;return e.loaded+=h,h<a||o.dataLength?(o.push(d),o.dataLength>=a&&s(e,r,o.flush().buffer,t)):s(e,r,d.buffer,t),c()}).catch(function(){return Promise.reject()})};return u()}}]),n}();ax=function(n){B(i,n);function i(t,e,r){var a;return k(this,i),a=Xe(this,i,[t]),a.code=void 0,a.details=void 0,a.code=e,a.details=r,a}return A(i)}(Fr(Error)),sx=/^age:\s*[\d.]+\s*$/im,dE=function(){function n(i){k(this,n),this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=i&&i.xhrSetup||null,this.stats=new df,this.retryDelay=0}return A(n,[{key:"destroy",value:function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}},{key:"abortInternal",value:function(){var t=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),t&&(t.onreadystatechange=null,t.onprogress=null,t.readyState!==4&&(this.stats.aborted=!0,t.abort()))}},{key:"abort",value:function(){var t;this.abortInternal(),(t=this.callbacks)!=null&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}},{key:"load",value:function(t,e,r){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=t,this.config=e,this.callbacks=r,this.loadInternal()}},{key:"loadInternal",value:function(){var t=this,e=this.config,r=this.context;if(!(!e||!r)){var a=this.loader=new self.XMLHttpRequest,s=this.stats;s.loading.first=0,s.loaded=0,s.aborted=!1;var o=this.xhrSetup;o?Promise.resolve().then(function(){if(!(t.loader!==a||t.stats.aborted))return o(a,r.url)}).catch(function(l){if(!(t.loader!==a||t.stats.aborted))return a.open("GET",r.url,!0),o(a,r.url)}).then(function(){t.loader!==a||t.stats.aborted||t.openAndSendXhr(a,r,e)}).catch(function(l){var u;(u=t.callbacks)==null||u.onError({code:a.status,text:l.message},r,a,s)}):this.openAndSendXhr(a,r,e)}}},{key:"openAndSendXhr",value:function(t,e,r){t.readyState||t.open("GET",e.url,!0);var a=e.headers,s=r.loadPolicy,o=s.maxTimeToFirstByteMs,l=s.maxLoadTimeMs;
1if(a)for(var u in a)t.setRequestHeader(u,a[u]);e.rangeEnd&&t.setRequestHeader("Range","bytes="+e.rangeStart+"-"+(e.rangeEnd-1)),t.onreadystatechange=this.readystatechange.bind(this),t.onprogress=this.loadprogress.bind(this),t.responseType=e.responseType,self.clearTimeout(this.requestTimeout),r.timeout=o&&ce(o)?o:l,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.timeout),t.send()}},{key:"readystatechange",value:function(){var t=this.context,e=this.loader,r=this.stats;if(!(!t||!e)){var a=e.readyState,s=this.config;if(!r.aborted&&a>=2&&(r.loading.first===0&&(r.loading.first=Math.max(self.performance.now(),r.loading.start),s.timeout!==s.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),s.timeout=s.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.loadPolicy.maxLoadTimeMs-(r.loading.first-r.loading.start)))),a===4)){self.clearTimeout(this.requestTimeout),e.onreadystatechange=null,e.onprogress=null;var o=e.status,l=e.responseType==="text"?e.responseText:null;if(o>=200&&o<300){var u=l!=null?l:e.response;if(u!=null){var c,f;r.loading.end=Math.max(self.performance.now(),r.loading.first);var d=e.responseType==="arraybuffer"?u.byteLength:u.length;r.loaded=r.total=d,r.bwEstimate=r.total*8e3/(r.loading.end-r.loading.first);var h=(c=this.callbacks)==null?void 0:c.onProgress;h&&h(r,t,u,e);var v={url:e.responseURL,data:u,code:o};(f=this.callbacks)==null||f.onSuccess(v,r,t,e);return}}var m=s.loadPolicy.errorRetry,p=r.retry,g={url:t.url,data:void 0,code:o};if(Fo(m,p,!1,g))this.retry(m);else{var E;tt.error("".concat(o," while loading ").concat(t.url)),(E=this.callbacks)==null||E.onError({code:o,text:e.statusText},t,e,r)}}}}},{key:"loadtimeout",value:function(){if(this.config){var t=this.config.loadPolicy.timeoutRetry,e=this.stats.retry;if(Fo(t,e,!0))this.retry(t);else{var r;tt.warn("timeout while loading ".concat((r=this.context)==null?void 0:r.url));var a=this.callbacks;a&&(this.abortInternal(),a.onTimeout(this.stats,this.context,this.loader))}}}},{key:"retry",value:function(t){var e=this.context,r=this.stats;this.retryDelay=mf(t,r.retry),r.retry++,tt.warn("".concat(status?"HTTP Status "+status:"Timeout"," while loading ").concat(e==null?void 0:e.url,", retrying ").concat(r.retry,"/").concat(t.maxNumRetry," in ").concat(this.retryDelay,"ms")),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}},{key:"loadprogress",value:function(t){var e=this.stats;e.loaded=t.loaded,t.lengthComputable&&(e.total=t.total)}},{key:"getCacheAge",value:function(){var t=null;if(this.loader&&sx.test(this.loader.getAllResponseHeaders())){var e=this.loader.getResponseHeader("age");t=e?parseFloat(e):null}return t}},{key:"getResponseHeader",value:function(t){return this.loader&&new RegExp("^".concat(t,":\\s*[\\d.]+\\s*$"),"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(t):null}}]),n}(),ox={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},lx=et(et({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:dE,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:gL,bufferController:lO,capLevelController:cO,errorController:TL,fpsController:fw,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:u0,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoa
1dPolicy:{default:ox},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},ux()),{},{subtitleStreamController:bw,subtitleTrackController:vw,timelineController:Jw,audioStreamController:nO,audioTrackController:aO,emeController:Z0,cmcdController:ow,contentSteeringController:uw,interstitialsController:Tw});wo=2,dx=.1,hx=.05,vx=100,px=function(n){B(i,n);function i(t,e){var r;return k(this,i),r=Xe(this,i,["gap-controller",t.logger]),r.hls=void 0,r.fragmentTracker=void 0,r.media=null,r.mediaSource=void 0,r.nudgeRetry=0,r.stallReported=!1,r.stalled=null,r.moved=!1,r.seeking=!1,r.buffered={},r.lastCurrentTime=0,r.ended=0,r.waiting=0,r.onMediaPlaying=function(){r.ended=0,r.waiting=0},r.onMediaWaiting=function(){var a;(a=r.media)!=null&&a.seeking||(r.waiting=self.performance.now(),r.tick())},r.onMediaEnded=function(){if(r.hls){var a;r.ended=((a=r.media)==null?void 0:a.currentTime)||1,r.hls.trigger(S.MEDIA_ENDED,{stalled:!1})}},r.hls=t,r.fragmentTracker=e,r.registerListeners(),r}return A(i,[{key:"registerListeners",value:function(){var e=this.hls;e&&(e.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(S.BUFFER_APPENDED,this.onBufferAppended,this))}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(e.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(S.BUFFER_APPENDED,this.onBufferAppended,this))}},{key:"destroy",value:function(){Ie(i,"destroy",this,3)([]),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}},{key:"onMediaAttached",value:function(e,r){this.setInterval(vx),this.mediaSource=r.mediaSource;var a=this.media=r.media;vr(a,"playing",this.onMediaPlaying),vr(a,"waiting",this.onMediaWaiting),vr(a,"ended",this.onMediaEnded)}},{key:"onMediaDetaching",value:function(e,r){this.clearInterval();var a=this.media;a&&(Er(a,"playing",this.onMediaPlaying),Er(a,"waiting",this.onMediaWaiting),Er(a,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}},{key:"onBufferAppended",value:function(e,r){this.buffered=r.timeRanges}},{key:"hasBuffered",get:function(){return Object.keys(this.buffered).length>0}},{key:"tick",value:function(){var e;if(!(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)){var r=this.media.currentTime;this.poll(r,this.lastCurrentTime),this.lastCurrentTime=r}}},{key:"poll",value:function(e,r){var a,s,o=(a=this.hls)==null?void 0:a.config;if(o){var l=this.media;if(l){var u=l.seeking,c=this.seeking&&!u,f=!this.seeking&&u,d=l.paused&&!u||l.ended||l.playbackRate===0;if(this.seeking=u,e!==r){r&&(this.ended=0),this.moved=!0,u||(this.nudgeRetry=0,o.nudgeOnVideoHole&&!d&&e>r&&this.nudgeOnVideoHole(e,r)),this.waiting===0&&this.stallResolved(e);return}if(f||c){c&&this.stallResolved(e);return}if(d){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&l.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(S.MEDIA_ENDED,{stalled:!1}));return}if(!Fe.getBuffered(l).length){this.nudgeRetry=0;return}var h=Fe.bufferInfo(l,e,0),v=h.nextStart||0,m=this.fragmentTracker;if(u&&m&&this.hls){var p=x_(this.hls.inFlightFragments,e),g=h.len>wo,E=!v||p||v-e>wo&&!m.getPartialFragment(e);
1if(g||E)return;this.moved=!1}var y=(s=this.hls)==null?void 0:s.latestLevelDetails;if(!this.moved&&this.stalled!==null&&m){var _=h.len>0;if(!_&&!v)return;var b=Math.max(v,h.start||0)-e,C=!!(y!=null&&y.live),R=C?y.targetduration*2:wo,M=To(e,m);if(b>0&&(b<=R||M)){l.paused||this._trySkipBufferHole(M);return}}var D=o.detectStallWithCurrentTimeMs,L=self.performance.now(),O=this.waiting,x=this.stalled;if(x===null)if(O>0&&L-O<D)x=this.stalled=O;else{this.stalled=L;return}var Y=L-x;if(!u&&(Y>=D||O)&&this.hls){var $;if((($=this.mediaSource)==null?void 0:$.readyState)==="ended"&&!(y!=null&&y.live)&&Math.abs(e-((y==null?void 0:y.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(S.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(h),!this.media||!this.hls)return}var Z=Fe.bufferInfo(l,e,o.maxBufferHole);this._tryFixBufferStall(Z,Y,e)}}}},{key:"stallResolved",value:function(e){var r=this.stalled;if(r&&this.hls&&(this.stalled=null,this.stallReported)){var a=self.performance.now()-r;this.log("playback not stuck anymore @".concat(e,", after ").concat(Math.round(a),"ms")),this.stallReported=!1,this.waiting=0,this.hls.trigger(S.STALL_RESOLVED,{})}}},{key:"nudgeOnVideoHole",value:function(e,r){var a,s=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(a=this.buffered.audio)!=null&&a.length&&s&&s.length>1&&e>s.end(0)){var o=Fe.bufferedInfo(Fe.timeRangesToArray(this.buffered.audio),e,0);if(o.len>1&&r>=o.start){var l=Fe.timeRangesToArray(s),u=Fe.bufferedInfo(l,r,0).bufferedIndex;if(u>-1&&u<l.length-1){var c=Fe.bufferedInfo(l,e,0).bufferedIndex,f=l[u].end,d=l[u+1].start;if((c===-1||c>u)&&d-f<1&&e-f<2){var h=new Error("nudging playhead to flush pipeline after video hole. currentTime: ".concat(e," hole: ").concat(f," -> ").concat(d," buffered index: ").concat(c));this.warn(h.message),this.media.currentTime+=1e-6;var v=To(e,this.fragmentTracker);v&&"fragment"in v?v=v.fragment:v||(v=void 0);var m=Fe.bufferInfo(this.media,e,0);this.hls.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:K.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:h,reason:h.message,frag:v,buffer:m.len,bufferInfo:m})}}}}}},{key:"_tryFixBufferStall",value:function(e,r,a){var s,o,l=this.fragmentTracker,u=this.media,c=(s=this.hls)==null?void 0:s.config;if(!(!u||!l||!c)){var f=(o=this.hls)==null?void 0:o.latestLevelDetails,d=To(a,l);if(d||f!=null&&f.live&&a<f.fragmentStart){var h=this._trySkipBufferHole(d);if(h||!this.media)return}var v=e.buffered,m=this.adjacentTraversal(e,a);(v&&v.length>1&&e.len>c.maxBufferHole||e.nextStart&&(e.nextStart-a<c.maxBufferHole||m))&&(r>c.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}}},{key:"adjacentTraversal",value:function(e,r){var a=this.fragmentTracker,s=e.nextStart;if(a&&s){var o=a.getFragAtPos(r,fe.MAIN),l=a.getFragAtPos(s,fe.MAIN);if(o&&l)return l.sn-o.sn<2}return!1}},{key:"_reportStall",value:function(e){var r=this.hls,a=this.media,s=this.stallReported,o=this.stalled;if(!s&&o!==null&&a&&r){this.stallReported=!0;var l=new Error("Playback stalling at @".concat(a.currentTime," due to low buffer (").concat(st(e),")"));this.warn(l.message),r.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:K.BUFFER_STALLED_ERROR,fatal:!1,error:l,buffer:e.len,bufferInfo:e,stalled:{start:o}})}}},{key:"_trySkipBufferHole",value:function(e){var r,a=this.fragmentTracker,s=this.media,o=(r=this.hls)==null?void 0:r.config;if(!s||!a||!o)return 0;var l=s.currentTime,u=Fe.bufferInfo(s,l,0),c=l<u.start?u.start:u.nextStart;if(c&&this.hls){var f=u.len<=o.maxBufferHole,d=u.len>0&&u.len<1&&s.readyState<3,h=c-l;if(h>0&&(f||d)){if(h>o.maxBufferHole){var v=!1;if(l===0){var m=a.getAppendedFrag(0,fe.MAIN);m&&c<m.end&&(v=!0)}if(!v&&e){var p;if(!((p=this.hls.loadLevelObj)!=null&&p.details))return 0;var g=x_(this.hls.inFlightFragments,c);if(g)return 0;for(var E=!1,y=e.end;y<c;){var _=To(y,a);if(_)y+=_.duration;else{E=!0;break}}if(E)return 0}}var b=Math.max(c+hx,l+dx);if(this.warn("skipping hole, adjusting currentTime from ".concat(l," to ").concat(b)),this.moved=!0,s.currentTime=b,!(e!=null&&e.gap)){var C=new Error("fragment loaded with buffer holes, seeking from ".concat(l," to ").concat(b)),R={type:ge.MEDIA_ERROR,details:K.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:C,reason:C.message,buffer:u.len,bufferInfo:u};e&&("fragment"in e?R.part=e:R.frag=e),this.hls.trigger(S.ERROR,R)}return b}}return 0}},{key:"_tryNudgeBuffer",value:function(e){var r=this.hls,a=this.media,s=this.nudgeRetry,o=r==null?void 0:r.config;if(!a||!o)return 0;var l=a.currentTime;if(this.nudgeRetry++,s<o.nudgeMaxRetry){var u=l+(s+1)*o.nudgeOffset,c=new Error("Nudging 'currentTime' from ".concat(l," to ").concat(u));this.warn(c.message),a.currentTime=u,r.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:K.BUFFER_NUDGE_ON_STALL,error:c,fatal:!1,buffer:e.len,bufferInfo:e})}else{var f=new Error("Playhead still not moving while enough data buffered @".concat(l," after ").concat(o.nudgeMaxRetry," nudges"));this.error(f.message),r.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:K.BUFFER_STALLED_ERROR,error:f,fatal:!0,buffer:e.len,bufferInfo:e})}}}]),i}(n0);mx=.25;bo=function(){var n=cf();try{n&&new n(0,Number.POSITIVE_INFINITY,"")}catch(i){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY}(),gx=function(){function n(i){var t=this;k(this,n),this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=function(){t.hls&&t.hls.trigger(S.EVENT_CUE_ENTER,{})},this.hls=i,this._registerListeners()}return A(n,[{key:"destroy",value:function(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}},{key:"_registerListeners",value:function(){var t=this.hls;
1t&&(t.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(S.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(S.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}},{key:"_unregisterListeners",value:function(){var t=this.hls;t&&(t.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(S.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(S.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}},{key:"onMediaAttaching",value:function(t,e){var r;this.media=e.media,((r=e.overrides)==null?void 0:r.cueRemoval)===!1&&(this.removeCues=!1)}},{key:"onMediaAttached",value:function(){var t,e=(t=this.hls)==null?void 0:t.latestLevelDetails;e&&this.updateDateRangeCues(e)}},{key:"onMediaDetaching",value:function(t,e){this.media=null;var r=!!e.transferMedia;r||(this.id3Track&&(this.removeCues&&ia(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}},{key:"onManifestLoading",value:function(){this.dateRangeCuesAppended={}}},{key:"createTrack",value:function(t){var e=this.getID3Track(t.textTracks);return e.mode="hidden",e}},{key:"getID3Track",value:function(t){if(this.media){for(var e=0;e<t.length;e++){var r=t[e];if(r.kind==="metadata"&&r.label==="id3")return eE(r,this.media),r}return this.media.addTextTrack("metadata","id3")}}},{key:"onFragParsingMetadata",value:function(t,e){if(!(!this.media||!this.hls)){var r=this.hls.config,a=r.enableEmsgMetadataCues,s=r.enableID3MetadataCues;if(!(!a&&!s)){var o=e.samples;this.id3Track||(this.id3Track=this.createTrack(this.media));var l=cf();if(l)for(var u=0;u<o.length;u++){var c=o[u].type;if(!(c===Rr.emsg&&!a||!s)){var f=C0(o[u].data),d=o[u].pts,h=d+o[u].duration;h>bo&&(h=bo);var v=h-d;v<=0&&(h=d+mx);for(var m=0;m<f.length;m++){var p=f[m];if(!L0(p)){this.updateId3CueEnds(d,c);var g=Vc(l,d,h,p,c);g&&this.id3Track.addCue(g)}}}}}}}},{key:"updateId3CueEnds",value:function(t,e){var r,a=(r=this.id3Track)==null?void 0:r.cues;if(a)for(var s=a.length;s--;){var o=a[s];o.type===e&&o.startTime<t&&o.endTime===bo&&(o.endTime=t)}}},{key:"onBufferFlushing",value:function(t,e){var r=e.startOffset,a=e.endOffset,s=e.type,o=this.id3Track,l=this.hls;if(l){var u=l.config,c=u.enableEmsgMetadataCues,f=u.enableID3MetadataCues;if(o&&(c||f)){var d;s==="audio"?d=function(v){return v.type===Rr.audioId3&&f}:s==="video"?d=function(v){return v.type===Rr.emsg&&c}:d=function(v){return v.type===Rr.audioId3&&f||v.type===Rr.emsg&&c},of(o,r,a,d)}}}},{key:"onLevelUpdated",value:function(t,e){var r=e.details;this.updateDateRangeCues(r,!0)}},{key:"onLevelPtsUpdated",value:function(t,e){Math.abs(e.drift)>.01&&this.updateDateRangeCues(e.details)}},{key:"updateDateRangeCues",value:function(t,e){var r=this;if(!(!this.hls||!this.media)){var a=this.hls.config,s=a.assetPlayerId,o=a.timelineOffset,l=a.enableDateRangeMetadataCues,u=a.interstitialsController;if(l){var c=cf();if(s&&o&&!u){var f=t.fragmentStart,d=t.fragmentEnd,h=this.assetCue;h?(h.startTime=f,h.endTime=d):c&&(h=this.assetCue=Vc(c,f,d,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),h&&(h.id=s,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(h),h.addEventListener("enter",this.onEventCueEnter)))}if(t.hasProgramDateTime){var v=this.id3Track,m=t.dateRanges,p=Object.keys(m),g=this.dateRangeCuesAppended;if(v&&e){var E;if((E=v.cues)!=null&&E.length)for(var y=Object.keys(g).filter(function(L){return!p.includes(L)}),_=function(){var O=y[C],x=(b=g[O])==null?void 0:b.cues;delete g[O],x&&Object.keys(x).forEach(function(Y){var $=x[Y];if($){$.removeEventListener("enter",r.onEventCueEnter);try{v.removeCue($)}catch(Z){}}})},b,C=y.length;C--;)_();else g=this.dateRangeCuesAppended={}}var R=t.fragments[t.fragments.length-1];if(!(p.length===0||!ce(R==null?void 0:R.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(var M=function(){var O=p[D],x=m[O],Y=x.startTime,$=g[O],Z=($==null?void 0:$.cues)||{}
1,N=($==null?void 0:$.durationKnown)||!1,j=bo,z=x.duration,ee=x.endDate;if(ee&&z!==null)j=Y+z,N=!0;else if(x.endOnNext&&!N){var U=p.reduce(function(Ye,ot){if(ot!==x.id){var Ue=m[ot];if(Ue.class===x.class&&Ue.startDate>x.startDate&&(!Ye||x.startDate<Ye.startDate))return Ue}return Ye},null);U&&(j=U.startTime,N=!0)}for(var F=Object.keys(x.attr),H=0;H<F.length;H++){var G=F[H];if(ML(G)){var ve=Z[G];if(ve)N&&!($!=null&&$.durationKnown)?ve.endTime=j:Math.abs(ve.startTime-Y)>.01&&(ve.startTime=Y,ve.endTime=j);else if(c){var ye=x.attr[G];NL(G)&&(ye=U_(ye));var Ee={key:G,data:ye},Ce=Vc(c,Y,j,Ee,Rr.dateRange);Ce&&(Ce.id=O,r.id3Track.addCue(Ce),Z[G]=Ce,u&&(G==="X-ASSET-LIST"||G==="X-ASSET-URL")&&Ce.addEventListener("enter",r.onEventCueEnter))}}}g[O]={cues:Z,dateRange:x,durationKnown:N}},D=0;D<p.length;D++)M()}}}}}}]),n}(),yx=function(){function n(i){var t=this;k(this,n),this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=function(){var e=t.media,r=t.levelDetails;if(!(!e||!r)){t.currentTime=e.currentTime;var a=t.computeLatency();if(a!==null){t._latency=a;var s=t.config,o=s.lowLatencyMode,l=s.maxLiveSyncPlaybackRate;if(!(!o||l===1||!r.live)){var u=t.targetLatency;if(u!==null){var c=a-u,f=Math.min(t.maxLatency,u+r.targetduration),d=c<f;if(d&&c>.05&&t.forwardBufferLength>1){var h=Math.min(2,Math.max(1,l)),v=Math.round(2/(1+Math.exp(-.75*c-t.edgeStalled))*20)/20,m=Math.min(h,Math.max(1,v));t.changeMediaPlaybackRate(e,m)}else e.playbackRate!==1&&e.playbackRate!==0&&t.changeMediaPlaybackRate(e,1)}}}}},this.hls=i,this.config=i.config,this.registerListeners()}return A(n,[{key:"levelDetails",get:function(){var t;return((t=this.hls)==null?void 0:t.latestLevelDetails)||null}},{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var t=this.config;if(t.liveMaxLatencyDuration!==void 0)return t.liveMaxLatencyDuration;var e=this.levelDetails;return e?t.liveMaxLatencyDurationCount*e.targetduration:0}},{key:"targetLatency",get:function(){var t=this.levelDetails;if(t===null||this.hls===null)return null;var e=t.holdBack,r=t.partHoldBack,a=t.targetduration,s=this.config,o=s.liveSyncDuration,l=s.liveSyncDurationCount,u=s.lowLatencyMode,c=this.hls.userConfig,f=u&&r||e;(this._targetLatencyUpdated||c.liveSyncDuration||c.liveSyncDurationCount||f===0)&&(f=o!==void 0?o:l*a);var d=a;return f+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,d)},set:function(t){this.stallCount=0,this.config.liveSyncDuration=t,this._targetLatencyUpdated=!0}},{key:"liveSyncPosition",get:function(){var t=this.estimateLiveEdge(),e=this.targetLatency;if(t===null||e===null)return null;var r=this.levelDetails;if(r===null)return null;var a=r.edge,s=t-e-this.edgeStalled,o=a-r.totalduration,l=a-(this.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(o,s),l)}},{key:"drift",get:function(){var t=this.levelDetails;return t===null?1:t.drift}},{key:"edgeStalled",get:function(){var t=this.levelDetails;if(t===null)return 0;var e=(this.config.lowLatencyMode&&t.partTarget||t.targetduration)*3;return Math.max(t.age-e,0)}},{key:"forwardBufferLength",get:function(){var t=this.media,e=this.levelDetails;if(!t||!e)return 0;var r=t.buffered.length;return(r?t.buffered.end(r-1):e.edge)-this.currentTime}},{key:"destroy",value:function(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}},{key:"registerListeners",value:function(){var t=this.hls;t&&(t.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(S.ERROR,this.onError,this))}},{key:"unregisterListeners",value:function(){var t=this.hls;t&&(t.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(S.ERROR,this.onError,this))}},{key:"onMediaAttached",value:function(t,e){this.media=e.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}},{key:"onMediaDetaching",value:function(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}},{key:"onManifestLoading",value:function(){this._latency=null,this.stallCount=0}},{key:"onLevelUpdated",value:function(t,e){var r=e.details;r.advanced&&this.onTimeupdate(),!r.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}},{key:"onError",value:function(t,e){var r;e.details===K.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(r=this.levelDetails)!=null&&r.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}},{key:"changeMediaPlaybackRate",value:function(t,e){var r,a;t.playbackRate!==e&&((r=this.hls)==null||r.logger.debug("[latency-controller]: latency=".concat(this.latency.toFixed(3),", targetLatency=").concat((a=this.targetLatency)==null?void 0:a.toFixed(3),", forwardBufferLength=").concat(this.forwardBufferLength.toFixed(3),": adjusting playback rate from ").concat(t.playbackRate," to ").concat(e)),t.playbackRate=e)}},{key:"estimateLiveEdge",value:function(){var t=this.levelDetails;return t===null?null:t.edge+t.age}},{key:"computeLatency",value:function(){var t=this.estimateLiveEdge();return t===null?null:t-this.currentTime}}]),n}(),_x=function(n){B(i,n);function i(t,e){var r;return k(this,i),r=Xe(this,i,[t,"level-controller"]),r._levels=[],r._firstLevel=-1,r._maxAutoLevel=-1,r._startLevel=void 0,r.currentLevel=null,r.currentLevelIndex=-1,r.manualLevelIndex=-1,r.steering=void 0,r.onParsedComplete=void 0,r.steering=e,r._registerListeners(),r}return A(i,[{key:"_registerListeners",value:function(){var e=this.hls;e.on(S.MANIFEST_LOADING,this.onManifestLoading,this),e.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(S.LEVEL_LOADED,this.onLevelLoaded,this),e.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(S.FRAG_BUFFERED,this.onFragBuffered,this),e.on(S.ERROR,this.onError,this)}},{key:"_unregisterListeners",value:function(){var e=this.hls;e.off(S.MANIFEST_LOADING,this.onManifestLoading,this),e.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(S.LEVEL_LOADED,this.onLevelLoaded,this),e.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(S.FRAG_BUFFERED,this.onFragBuffered,this),e.off(S.ERROR,this.onError,this)}},{key:"destroy",value:function(){this._unregisterListeners(),this.steering=null,this.resetLevels(),Ie(i,"destroy",this,3)([])}},{key:"stopLoad",value:function(){var e=this._levels;e.forEach(function(r){r.loadError=0,r.fragmentError=0}
1),Ie(i,"stopLoad",this,3)([])}},{key:"resetLevels",value:function(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}},{key:"onManifestLoading",value:function(e,r){this.resetLevels()}},{key:"onManifestLoaded",value:function(e,r){var a=this,s=this.hls.config.preferManagedMediaSource,o=[],l={},u={},c=!1,f=!1,d=!1;r.levels.forEach(function(h){var v=h.attrs,m=h.audioCodec,p=h.videoCodec;m&&(h.audioCodec=m=Po(m,s)||void 0),p&&(p=h.videoCodec=$C(p));var g=h.width,E=h.height,y=h.unknownCodecs,_=(y==null?void 0:y.length)||0;if(c||(c=!!(g&&E)),f||(f=!!p),d||(d=!!m),_||m&&!a.isAudioSupported(m)||p&&!a.isVideoSupported(p)){a.log('Some or all CODECS not supported "'.concat(v.CODECS,'"'));return}var b=v.CODECS,C=v["FRAME-RATE"],R=v["HDCP-LEVEL"],M=v["PATHWAY-ID"],D=v.RESOLUTION,L=v["VIDEO-RANGE"],O="".concat(M||".","-"),x="".concat(O).concat(h.bitrate,"-").concat(D,"-").concat(C,"-").concat(b,"-").concat(L,"-").concat(R);if(l[x])if(l[x].uri!==h.url&&!h.attrs["PATHWAY-ID"]){var $=u[x]+=1;h.attrs["PATHWAY-ID"]=new Array($+1).join(".");var Z=a.createLevel(h);l[x]=Z,o.push(Z)}else l[x].addGroupId("audio",v.AUDIO),l[x].addGroupId("text",v.SUBTITLES);else{var Y=a.createLevel(h);l[x]=Y,u[x]=1,o.push(Y)}}),this.filterAndSortMediaOptions(o,r,c,f,d)}},{key:"createLevel",value:function(e){var r=new $a(e),a=e.supplemental;if(a!=null&&a.videoCodec&&!this.isVideoSupported(a.videoCodec)){var s=new Error('SUPPLEMENTAL-CODECS not supported "'.concat(a.videoCodec,'"'));this.log(s.message),r.supportedResult=X_(s,[])}return r}},{key:"isAudioSupported",value:function(e){return Xa(e,"audio",this.hls.config.preferManagedMediaSource)}},{key:"isVideoSupported",value:function(e){return Xa(e,"video",this.hls.config.preferManagedMediaSource)}},{key:"filterAndSortMediaOptions",value:function(e,r,a,s,o){var l=this,u,c=[],f=[],d=e,h=((u=r.stats)==null?void 0:u.parsing)||{};if((a||s)&&o&&(d=d.filter(function(L){var O=L.videoCodec,x=L.videoRange,Y=L.width,$=L.height;return(!!O||!!(Y&&$))&&lL(x)})),d.length===0){Promise.resolve().then(function(){if(l.hls){var L="no level with compatible codecs found in manifest",O=L;r.levels.length&&(O="one or more CODECS in variant not supported: ".concat(st(r.levels.map(function(Y){return Y.attrs.CODECS}).filter(function(Y,$,Z){return Z.indexOf(Y)===$}))),l.warn(O),L+=" (".concat(O,")"));var x=new Error(L);l.hls.trigger(S.ERROR,{type:ge.MEDIA_ERROR,details:K.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:r.url,error:x,reason:O})}}),h.end=performance.now();return}r.audioTracks&&(c=r.audioTracks.filter(function(L){return!L.audioCodec||l.isAudioSupported(L.audioCodec)}),D_(c)),r.subtitles&&(f=r.subtitles,D_(f));var v=d.slice(0);d.sort(function(L,O){if(L.attrs["HDCP-LEVEL"]!==O.attrs["HDCP-LEVEL"])return(L.attrs["HDCP-LEVEL"]||"")>(O.attrs["HDCP-LEVEL"]||"")?1:-1;if(a&&L.height!==O.height)return L.height-O.height;if(L.frameRate!==O.frameRate)return L.frameRate-O.frameRate;if(L.videoRange!==O.videoRange)return Do.indexOf(L.videoRange)-Do.indexOf(O.videoRange);if(L.videoCodec!==O.videoCodec){var x=Ay(L.videoCodec),Y=Ay(O.videoCodec);if(x!==Y)return Y-x}if(L.uri===O.uri&&L.codecSet!==O.codecSet){var $=xo(L.codecSet),Z=xo(O.codecSet);if($!==Z)return Z-$}return L.averageBitrate!==O.averageBitrate?L.averageBitrate-O.averageBitrate:0});var m=v[0];if(this.steering&&(d=this.steering.filterParsedLevels(d),d.length!==v.length)){for(var p=0;p<v.length;p++)if(v[p].pathwayId===d[0].pathwayId){m=v[p];break}}this._levels=d;for(var g=0;g<d.length;g++)if(d[g]===m){var E;this._firstLevel=g;var y=m.bitrate,_=this.hls.bandwidthEstimate;if(this.log("manifest loaded, ".concat(d.length," level(s) found, first bitrate: ").concat(y)),((E=this.hls.userConfig)==null?void 0:E.abrEwmaDefaultEstimate)===void 0){var b=Math.min(y,this.hls.config.abrEwmaDefaultEstimateMax);b>_&&_===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=b)}break}var C=o&&!s,R=this.hls.config,M=!!(R.audioStreamController&&R.audioTrackController),D={levels:d,audioTracks:c,subtitleTracks:f,sessionData:r.sessionData,sessionKeys:r.sessionKeys,firstLevel:this._firstLevel,stats:r.stats,audio:o,video:s,altAudio:M&&!C&&c.some(function(L){return!!L.url})};h.end=performance.now(),this.hls.trigger(S.MANIFEST_PARSED,D)}},{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"loadLevelObj",get:function(){return this.currentLevel}},{key:"level",get:function(){return this.currentLevelIndex},set:function(e){var r=this._levels;if(r.length!==0){if(e<0||e>=r.length){var a=new Error("invalid level idx"),s=e<0;if(this.hls.trigger(S.ERROR,{type:ge.OTHER_ERROR,details:K.LEVEL_SWITCH_ERROR,level:e,fatal:s,error:a,reason:a.message}),s)return;e=Math.min(e,r.length-1)}var o=this.currentLevelIndex,l=this.currentLevel,u=l?l.attrs["PATHWAY-ID"]:void 0,c=r[e],f=c.attrs["PATHWAY-ID"];
1if(this.currentLevelIndex=e,this.currentLevel=c,!(o===e&&l&&u===f)){this.log("Switching to level ".concat(e," (").concat(c.height?c.height+"p ":"").concat(c.videoRange?c.videoRange+" ":"").concat(c.codecSet?c.codecSet+" ":"","@").concat(c.bitrate,")").concat(f?" with Pathway "+f:""," from level ").concat(o).concat(u?" with Pathway "+u:""));var d={level:e,attrs:c.attrs,details:c.details,bitrate:c.bitrate,averageBitrate:c.averageBitrate,maxBitrate:c.maxBitrate,realBitrate:c.realBitrate,width:c.width,height:c.height,codecSet:c.codecSet,audioCodec:c.audioCodec,videoCodec:c.videoCodec,audioGroups:c.audioGroups,subtitleGroups:c.subtitleGroups,loaded:c.loaded,loadError:c.loadError,fragmentError:c.fragmentError,name:c.name,id:c.id,uri:c.uri,url:c.url,urlId:0,audioGroupIds:c.audioGroupIds,textGroupIds:c.textGroupIds};this.hls.trigger(S.LEVEL_SWITCHING,d);var h=c.details;if(!h||h.live){var v=this.switchParams(c.uri,l==null?void 0:l.details,h);this.loadPlaylist(v)}}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel},set:function(e){this._startLevel=e}},{key:"pathways",get:function(){return this.steering?this.steering.pathways():[]}},{key:"pathwayPriority",get:function(){return this.steering?this.steering.pathwayPriority:null},set:function(e){if(this.steering){var r=this.steering.pathways(),a=e.filter(function(s){return r.indexOf(s)!==-1});if(e.length<1){this.warn("pathwayPriority ".concat(e," should contain at least one pathway from list: ").concat(r));return}this.steering.pathwayPriority=a}}},{key:"onError",value:function(e,r){r.fatal||!r.context||r.context.type===Be.LEVEL&&r.context.level===this.level&&this.checkRetry(r)}},{key:"onFragBuffered",value:function(e,r){var a=r.frag;if(a!==void 0&&a.type===fe.MAIN){var s=a.elementaryStreams;if(!Object.keys(s).some(function(l){return!!s[l]}))return;var o=this._levels[a.level];o!=null&&o.loadError&&(this.log("Resetting level error count of ".concat(o.loadError," on frag buffered")),o.loadError=0)}}},{key:"onLevelLoaded",value:function(e,r){var a,s=r.level,o=r.details,l=r.levelInfo;if(!l){var u;this.warn("Invalid level index ".concat(s)),(u=r.deliveryDirectives)!=null&&u.skip&&(o.deltaUpdateFailed=!0);return}if(l===this.currentLevel||r.withoutMultiVariant){l.fragmentError===0&&(l.loadError=0);var c=l.details;c===r.details&&c.advanced&&(c=void 0),this.playlistLoaded(s,r,c)}else(a=r.deliveryDirectives)!=null&&a.skip&&(o.deltaUpdateFailed=!0)}},{key:"loadPlaylist",value:function(e){Ie(i,"loadPlaylist",this,3)([]),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}},{key:"loadingPlaylist",value:function(e,r){Ie(i,"loadingPlaylist",this,3)([e,r]);var a=this.getUrlWithDirectives(e.uri,r),s=this.currentLevelIndex,o=e.attrs["PATHWAY-ID"],l=e.details,u=l==null?void 0:l.age;this.log("Loading level index ".concat(s).concat((r==null?void 0:r.msn)!==void 0?" at sn "+r.msn+" part "+r.part:"").concat(o?" Pathway "+o:"").concat(u&&l.live?" age "+u.toFixed(1)+(l.type&&" "+l.type||""):""," ").concat(a)),this.hls.trigger(S.LEVEL_LOADING,{url:a,level:s,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:r||null})}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}},{key:"removeLevel",value:function(e){var r=this,a;if(this._levels.length!==1){var s=this._levels.filter(function(l,u){return u!==e?!0:(r.steering&&r.steering.removeLevel(l),l===r.currentLevel&&(r.currentLevel=null,r.currentLevelIndex=-1,l.details&&l.details.fragments.forEach(function(c){return c.level=-1})),!1)});g0(s),this._levels=s,this.currentLevelIndex>-1&&(a=this.currentLevel)!=null&&a.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);var o=s.length-1;this._firstLevel=Math.min(this._firstLevel,o),this._startLevel&&(this._startLevel=Math.min(this._startLevel,o)),this.hls.trigger(S.LEVELS_UPDATED,{levels:s})}}},{key:"onLevelsUpdated",value:function(e,r){var a=r.levels;this._levels=a}},{key:"checkMaxAutoUpdated",value:function(){var e=this.hls,r=e.autoLevelCapping,a=e.maxAutoLevel,s=e.maxHdcpLevel;this._maxAutoLevel!==a&&(this._maxAutoLevel=a,this.hls.trigger(S.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:r,levels:this.levels,maxAutoLevel:a,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:s}))}}]),i}(Rf);Tx=100,bx=function(n){B(i,n);function i(t,e,r){var a;return k(this,i),a=Xe(this,i,[t,e,r,"stream-controller",fe.MAIN]),a.audioCodecSwap=!1,a.level=-1,a._forceStartLoad=!1,a._hasEnoughToStart=!1,a.altAudio=0,a.audioOnly=!1,a.fragPlaying=null,a.fragLastKbps=0,a.couldBacktrack=!1,a.backtrackFragment=null,a.audioCodecSwitch=!1,a.videoBuffer=null,a.onMediaPlaying=function(){a.tick()},a.onMediaSeeked=function(){var s=a.media,o=s?s.currentTime:null;
1if(!(o===null||!ce(o))&&(a.log("Media seeked to ".concat(o.toFixed(3))),!!a.getBufferedFrag(o))){var l=a.getFwdBufferInfoAtPos(s,o,fe.MAIN,0);if(l===null||l.len===0){a.warn("Main forward buffer length at ".concat(o,' on "seeked" event ').concat(l?l.len:"empty",")"));return}a.tick()}},a.registerListeners(),a}return A(i,[{key:"registerListeners",value:function(){Ie(i,"registerListeners",this,3)([]);var e=this.hls;e.on(S.MANIFEST_PARSED,this.onManifestParsed,this),e.on(S.LEVEL_LOADING,this.onLevelLoading,this),e.on(S.LEVEL_LOADED,this.onLevelLoaded,this),e.on(S.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(S.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(S.BUFFER_CREATED,this.onBufferCreated,this),e.on(S.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(S.FRAG_BUFFERED,this.onFragBuffered,this)}},{key:"unregisterListeners",value:function(){Ie(i,"unregisterListeners",this,3)([]);var e=this.hls;e.off(S.MANIFEST_PARSED,this.onManifestParsed,this),e.off(S.LEVEL_LOADED,this.onLevelLoaded,this),e.off(S.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(S.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(S.BUFFER_CREATED,this.onBufferCreated,this),e.off(S.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(S.FRAG_BUFFERED,this.onFragBuffered,this)}},{key:"onHandlerDestroying",value:function(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),Ie(i,"onHandlerDestroying",this,3)([])}},{key:"startLoad",value:function(e,r){if(this.levels){var a=this.lastCurrentTime,s=this.hls;if(this.stopLoad(),this.setInterval(Tx),this.level=-1,!this.startFragRequested){var o=s.startLevel;o===-1&&(s.config.testBandwidth&&this.levels.length>1?(o=0,this.bitrateTest=!0):o=s.firstAutoLevel),s.nextLoadLevel=o,this.level=s.loadLevel,this._hasEnoughToStart=!!r}a>0&&e===-1&&!r&&(this.log("Override startPosition with lastCurrentTime @".concat(a.toFixed(3))),e=a),this.state=re.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=r?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=re.STOPPED}},{key:"stopLoad",value:function(){this._forceStartLoad=!1,Ie(i,"stopLoad",this,3)([])}},{key:"doTick",value:function(){switch(this.state){case re.WAITING_LEVEL:{var e=this.levels,r=this.level,a=e==null?void 0:e[r],s=a==null?void 0:a.details;if(s&&(!s.live||this.levelLastLoaded===a&&!this.waitForLive(a))){if(this.waitForCdnTuneIn(s))break;this.state=re.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=re.IDLE;break}break}case re.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===re.IDLE&&this.doTickIdle(),this.onTickEnd()}},{key:"onTickEnd",value:function(){var e;Ie(i,"onTickEnd",this,3)([]),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}},{key:"doTickIdle",value:function(){var e=this.hls,r=this.levelLastLoaded,a=this.levels,s=this.media;if(!(r===null||!s&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch))&&!(this.altAudio&&this.audioOnly)){var o=this.buffering?e.nextLoadLevel:e.loadLevel;if(a!=null&&a[o]){var l=a[o],u=this.getMainFwdBufferInfo();if(u!==null){var c=this.getLevelDetails();if(c&&this._streamEnded(u,c)){var f={};this.altAudio===2&&(f.type="video"),this.hls.trigger(S.BUFFER_EOS,f),this.state=re.ENDED;return}if(this.buffering){e.loadLevel!==o&&e.manualLevel===-1&&this.log("Adapting to level ".concat(o," from level ").concat(this.level)),this.level=e.nextLoadLevel=o;var d=l.details;if(!d||this.state===re.WAITING_LEVEL||this.waitForLive(l)){this.level=o,this.state=re.WAITING_LEVEL,this.startFragRequested=!1;return}var h=u.len,v=this.getMaxBufferLength(l.maxBitrate);if(!(h>=v)){this.backtrackFragment&&this.backtrackFragment.start>u.end&&(this.backtrackFragment=null);var m=this.backtrackFragment?this.backtrackFragment.start:u.end,p=this.getNextFragment(m,d);if(this.couldBacktrack&&!this.fragPrevious&&p&&Rt(p)&&this.fragmentTracker.getState(p)!==jt.OK){var g,E=((g=this.backtrackFragment)!=null?g:p).sn,y=E-d.startSN,_=d.fragments[y-1];_&&p.cc===_.cc&&(p=_,this.fragmentTracker.removeFragment(_))}else this.backtrackFragment&&u.len&&(this.backtrackFragment=null);if(p&&this.isLoopLoading(p,m)){var b=p.gap;if(!b){var C=this.audioOnly&&!this.altAudio?at.AUDIO:at.VIDEO,R=(C===at.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;R&&this.afterBufferFlushed(R,C,fe.MAIN)}p=this.getNextFragmentLoopLoading(p,d,u,fe.MAIN,v)}p&&(this.exceedsMaxBuffer(u,v,p)||(p.initSegment&&!p.initSegment.data&&!this.bitrateTest&&(p=p.initSegment),this.loadFragment(p,l,m)))}}}}}}},{key:"loadFragment",value:function(e,r,a){var s=this.fragmentTracker.getState(e);s===jt.NOT_LOADED||s===jt.PARTIAL?Rt(e)?this.bitrateTest?(this.log("Fragment ".concat(e.sn," of level ").concat(e.level," is being downloaded to test bitrate and will not be buffered")),this._loadBitrateTestFrag(e,r)):Ie(i,"loadFragment",this,3)([e,r,a]):this._loadInitSegment(e,r):this.clearTrackerIfNeeded(e)}},{key:"getBufferedFrag",value:function(e){return this.fragmentTracker.getBufferedFrag(e,fe.MAIN)}},{key:"followingBufferedFrag",value:function(e){return e?this.getBufferedFrag(e.end+.5):null}},{key:"immediateLevelSwitch",value:function(){if(this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY),this.altAudio!==0){var e,r=((e=this.getLevelDetails())==null?void 0:e.fragmentStart)||0;r>this.lastCurrentTime&&Ie(i,"flushMainBuffer",this,3)([0,Number.POSITIVE_INFINITY,"audio"])}}},{key:"nextLevelSwitch",value:function(){var e=this.levels,r=this.media;if(r!=null&&r.readyState){var a,s=this.getAppendedFrag(r.currentTime);s&&s.start>1&&this.flushMainBuffer(0,s.start-1);var o=this.getLevelDetails();if(o!=null&&o.live){var l=this.getMainFwdBufferInfo();if(!l||l.len<o.targetduration*2)return}if(!r.paused&&e){var u=this.hls.nextLoadLevel,c=e[u],f=this.fragLastKbps;f&&this.fragCurrent?a=this.fragCurrent.duration*c.maxBitrate/(1e3*f)+1:a=0}else a=0;var d=this.getBufferedFrag(r.currentTime+a);if(d){var h=this.followingBufferedFrag(d);if(h){this.abortCurrentFrag();var v=h.maxStartPTS?h.maxStartPTS:h.start,m=h.duration,p=Math.max(d.end,v+Math.min(Math.max(m-this.config.maxFragLookUpTolerance,m*(this.couldBacktrack?.5:.125)),m*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(p,Number.POSITIVE_INFINITY)}}}}},{key:"abortCurrentFrag",value:function(){var e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case re.KEY_LOADING:case re.FRAG_LOADING:case re.FRAG_LOADING_WAITING_RETRY:case re.PARSING:case re.PARSED:this.state=re.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}},{key:"flushMainBuffer",value:function(e,r){Ie(i,"flushMainBuffer",this,3)([e,r,this.altAudio===2?"video":null])}},{key:"onMediaAttached",value:function(e,r){Ie(i,"onMediaAttached",this,3)([e,r]);var a=r.media;vr(a,"playing",this.onMediaPlaying),vr(a,"seeked",this.onMediaSeeked)}},{key:"onMediaDetaching",value:function(e,r){var a=this.media;a&&(Er(a,"playing",this.onMediaPlaying),Er(a,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,Ie(i,"onMediaDetaching",this,3)([e,r]);var s=!!r.transferMedia;s||(this._hasEnoughToStart=!1)}},{key:"onManifestLoading",value:function(){Ie(i,"onManifestLoading",this,3)([]),this.log("Trigger BUFFER_RESET"),this.hls.trigger(S.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}},{key:"onManifestParsed",value:function(e,r){for(var a=!1,s=!1,o=0;o<r.levels.length;o++){var l=r.levels[o].audioCodec;l&&(a=a||l.indexOf("mp4a.40.2")!==-1,s=s||l.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=a&&s&&!Sx(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=r.levels,this.startFragRequested=!1}},{key:"onLevelLoading",value:function(e,r){var a=this.levels;if(!(!a||this.state!==re.IDLE)){var s=r.levelInfo;(!s.details||s.details.live&&(this.levelLastLoaded!==s||s.details.expired)||this.waitForCdnTuneIn(s.details))&&(this.state=re.WAITING_LEVEL)}}},{key:"onLevelLoaded",value:function(e,r){var a,s=this.levels,o=this.startFragRequested,l=r.level,u=r.details,c=u.totalduration;if(!s){this.warn("Levels were reset while loading level ".concat(l));return}this.log("Level ".concat(l," loaded [").concat(u.startSN,",").concat(u.endSN,"]").concat(u.lastPartSn?"[part-".concat(u.lastPartSn,"-").concat(u.lastPartIndex,"]"):"",", cc [").concat(u.startCC,", ").concat(u.endCC,"] duration:").concat(c));var f=r.levelInfo,d=this.fragCurrent;d&&(this.state===re.FRAG_LOADING||this.state===re.FRAG_LOADING_WAITING_RETRY)&&d.level!==r.level&&d.loader&&this.abortCurrentFrag();var h=0;if(u.live||(a=f.details)!=null&&a.live){var v;if(this.checkLiveUpdate(u),u.deltaUpdateFailed)return;h=this.alignPlaylists(u,f.details,(v=this.levelLastLoaded)==null?void 0:v.details)}if(f.details=u,this.levelLastLoaded=f,o||this.setStartPosition(u,h),this.hls.trigger(S.LEVEL_UPDATED,{details:u,level:l}),this.state===re.WAITING_LEVEL){if(this.waitForCdnTuneIn(u))return;this.state=re.IDLE}o&&u.live&&this.synchronizeToLiveEdge(u),this.tick()}},{key:"synchronizeToLiveEdge",value:function(e){var r=this.config,a=this.media;if(a){var s=this.hls.liveSyncPosition,o=this.getLoadPosition(),l=e.fragmentStart,u=e.edge,c=o>=l-r.maxFragLookUpTolerance&&o<=u;if(s!==null&&a.duration>s&&(o<s||!c)){var f=r.liveMaxLatencyDuration!==void 0?r.liveMaxLatencyDuration:r.liveMaxLatencyDurationCount*e.targetduration;if((!c&&a.readyState<4||o<u-f)&&(this._hasEnoughToStart||(this.nextLoadPosition=s),a.readyState))if(this.warn("Playback: ".concat(o.toFixed(3)," is located too far from the end of live sliding playlist: ").concat(u,", reset currentTime to : ").concat(s.toFixed(3))),this.config.liveSyncMode==="buffered"){var d,h=Fe.bufferInfo(a,s,0);if(!((d=h.buffered)!=null&&d.length)){a.currentTime=s;return}var v=h.start<=o;if(v){a.currentTime=s;return}var m=Fe.bufferedInfo(h.buffered,o,0),p=m.nextStart;p&&(a.currentTime=p)}else a.currentTime=s}}}},{key:"_handleFragmentLoadProgress",value:function(e){var r,a=e.frag,s=e.part,o=e.payload,l=this.levels;if(!l){this.warn("Levels were reset while fragment load was in progress. Fragment ".concat(a.sn," of level ").concat(a.level," will not be buffered"));return}var u=l[a.level];if(!u){this.warn("Level ".concat(a.level," not found on progress"));return}var c=u.details;if(!c){this.warn("Dropping fragment ".concat(a.sn," of level ").concat(a.level," after level details were reset")),this.fragmentTracker.removeFragment(a);return}var f=u.videoCodec,d=c.PTSKnown||!c.live,h=(r=a.initSegment)==null?void 0:r.data,v=this._getAudioCodec(u),m=this.transmuxer=this.transmuxer||new B0(this.hls,fe.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),p=s?s.index:-1,g=p!==-1,E=new yf(a.level,a.sn,a.stats.chunkCount,o.byteLength,p,g),y=this.initPTS[a.cc];m.push(o,h,v,f,a,s,c.totalduration,d,E,y)}},{key:"onAudioTrackSwitching",value:function(e,r){var a=this,s=this.hls,o=this.altAudio!==0,l=Mo(r.url,s);if(l)this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var u=this.fragCurrent;u&&(this.log("Switching to main audio track, cancel main fragment load"),u.abortRequests(),this.fragmentTracker.removeFragment(u)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(o){this.altAudio=0,this.fragmentTracker.removeAllFragments(),s.once(S.BUFFER_FLUSHED,function(){a.hls&&a.hls.trigger(S.AUDIO_TRACK_SWITCHED,r)}),s.trigger(S.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}s.trigger(S.AUDIO_TRACK_SWITCHED,r)}}},{key:"onAudioTrackSwitched",value:function(e,r){var a=Mo(r.url,this.hls);if(a){var s=this.videoBuffer;s&&this.mediaBuffer!==s&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=s)}this.altAudio=a?2:0,this.tick()}},{key:"onBufferCreated",value:function(e,r){var a=r.tracks,s,o,l=!1;for(var u in a){var c=a[u];if(c.id==="main"){if(o=u,s=c,u==="video"){var f=a[u];f&&(this.videoBuffer=f.buffer)}}else l=!0}l&&s?(this.log("Alternate track found, use ".concat(o,".buffered to schedule main fragment loading")),this.mediaBuffer=s.buffer):this.mediaBuffer=this.media}},{key:"onFragBuffered",value:function(e,r){var a=r.frag,s=r.part,o=a.type===fe.MAIN;if(o){if(this.fragContextChanged(a)){this.warn("Fragment ".concat(a.sn).concat(s?" p: "+s.index:""," of level ").concat(a.level," finished buffering, but was aborted. state: ").concat(this.state)),this.state===re.PARSED&&(this.state=re.IDLE);return}var l=s?s.stats:a.stats;this.fragLastKbps=Math.round(8*l.total/(l.buffering.end-l.loading.first)),Rt(a)&&(this.fragPrevious=a),this.fragBufferedComplete(a,s)}var u=this.media;u&&(!this._hasEnoughToStart&&Fe.getBuffered(u).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),o&&this.tick())}},{key:"hasEnoughToStart",get:function(){return this._hasEnoughToStart}},{key:"onError",value:function(e,r){var a;if(r.fatal){this.state=re.ERROR;return}switch(r.details){case K.FRAG_GAP:case K.FRAG_PARSING_ERROR:case K.FRAG_DECRYPT_ERROR:case K.FRAG_LOAD_ERROR:case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_ERROR:case K.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(fe.MAIN,r);break;case K.LEVEL_LOAD_ERROR:case K.LEVEL_LOAD_TIMEOUT:case K.LEVEL_PARSING_ERROR:!r.levelRetry&&this.state===re.WAITING_LEVEL&&((a=r.context)==null?void 0:a.type)===Be.LEVEL&&(this.state=re.IDLE);break;case K.BUFFER_ADD_CODEC_ERROR:case K.BUFFER_APPEND_ERROR:if(r.parent!=="main")return;this.reduceLengthAndFlushBuffer(r)&&this.resetLoadingState();break;case K.BUFFER_FULL_ERROR:if(r.parent!=="main")return;if(this.reduceLengthAndFlushBuffer(r)){var s=!this.config.interstitialsController&&this.config.assetPlayerId;s?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}break;case K.INTERNAL_EXCEPTION:this.recoverWorkerError(r);break}}},{key:"onFragLoadEmergencyAborted",value:function(){this.state=re.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}},{key:"onBufferFlushed",value:function(e,r){var a=r.type;if(a!==at.AUDIO||!this.altAudio){var s=(a===at.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;s&&(this.afterBufferFlushed(s,a,fe.MAIN),this.tick())}}},{key:"onLevelsUpdated",value:function(e,r){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=r.levels}},{key:"swapAudioCodec",value:function(){this.audioCodecSwap=!this.audioCodecSwap}},{key:"seekToStartPos",value:function(){var e=this.media;if(e){var r=e.currentTime,a=this.startPosition;if(a>=0&&r<a){if(e.seeking){this.log("could not seek to ".concat(a,", already seeking at ").concat(r));return}var s=this.timelineOffset;s&&a&&(a+=s);var o=this.getLevelDetails(),l=Fe.getBuffered(e),u=l.length?l.start(0):0,c=u-a,f=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||c>0&&(c<f||this.loadingParts&&c<2*((o==null?void 0:o.partTarget)||0)))&&(this.log("adjusting start position by ".concat(c," to match buffer start")),a+=c,this.startPosition=a),r<a&&(this.log("seek to target start position ".concat(a," from current time ").concat(r," buffer start ").concat(u)),e.currentTime=a)}}}},{key:"_getAudioCodec",value:function(e){var r=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&r&&(this.log("Swapping audio codec"),r.indexOf("mp4a.40.5")!==-1?r="mp4a.40.2":r="mp4a.40.5"),r}},{key:"_loadBitrateTestFrag",value:function(e,r){var a=this;e.bitrateTest=!0,this._doFragLoad(e,r).then(function(s){var o=a.hl
1s,l=s==null?void 0:s.frag;if(!(!l||a.fragContextChanged(l))){r.fragmentError=0,a.state=re.IDLE,a.startFragRequested=!1,a.bitrateTest=!1;var u=l.stats;u.parsing.start=u.parsing.end=u.buffering.start=u.buffering.end=self.performance.now(),o.trigger(S.FRAG_LOADED,s),l.bitrateTest=!1}}).catch(function(s){a.state===re.STOPPED||a.state===re.ERROR||(a.warn(s),a.resetFragmentLoading(e))})}},{key:"_handleTransmuxComplete",value:function(e){var r=this.playlistType,a=this.hls,s=e.remuxResult,o=e.chunkMeta,l=this.getCurrentContext(o);if(!l){this.resetWhenMissingContext(o);return}var u=l.frag,c=l.part,f=l.level,d=s.video,h=s.text,v=s.id3,m=s.initSegment,p=f.details,g=this.altAudio?void 0:s.audio;if(this.fragContextChanged(u)){this.fragmentTracker.removeFragment(u);return}if(this.state=re.PARSING,m){var E=m.tracks;if(E){var y=u.initSegment||u;if(this.unhandledEncryptionError(m,u))return;this._bufferInitSegment(f,E,y,o),a.trigger(S.FRAG_PARSING_INIT_SEGMENT,{frag:y,id:r,tracks:E})}var _=m.initPTS,b=m.timescale,C=this.initPTS[u.cc];if(ce(_)&&(!C||C.baseTime!==_||C.timescale!==b)){var R=m.trackId;this.initPTS[u.cc]={baseTime:_,timescale:b,trackId:R},a.trigger(S.INIT_PTS_FOUND,{frag:u,id:r,initPTS:_,timescale:b,trackId:R})}}if(d&&p){g&&d.type==="audiovideo"&&this.logMuxedErr(u);var M=p.fragments[u.sn-1-p.startSN],D=u.sn===p.startSN,L=!M||u.cc>M.cc;if(s.independent!==!1){var O=d.startPTS,x=d.endPTS,Y=d.startDTS,$=d.endDTS;if(c)c.elementaryStreams[d.type]={startPTS:O,endPTS:x,startDTS:Y,endDTS:$};else if(d.firstKeyFrame&&d.independent&&o.id===1&&!L&&(this.couldBacktrack=!0),d.dropped&&d.independent){var Z=this.getMainFwdBufferInfo(),N=(Z?Z.end:this.getLoadPosition())+this.config.maxBufferHole,j=d.firstKeyFramePTS?d.firstKeyFramePTS:O;if(!D&&N<j-this.config.maxBufferHole&&!L){this.backtrack(u);return}else L&&(u.gap=!0);u.setElementaryStreamInfo(d.type,u.start,x,u.start,$,!0)}else D&&O-(p.appliedTimelineOffset||0)>wo&&(u.gap=!0);u.setElementaryStreamInfo(d.type,O,x,Y,$),this.backtrackFragment&&(this.backtrackFragment=u),this.bufferFragmentData(d,u,c,o,D||L)}else if(D||L)u.gap=!0;else{this.backtrack(u);return}}if(g){var z=g.startPTS,ee=g.endPTS,U=g.startDTS,F=g.endDTS;c&&(c.elementaryStreams[at.AUDIO]={startPTS:z,endPTS:ee,startDTS:U,endDTS:F}),u.setElementaryStreamInfo(at.AUDIO,z,ee,U,F),this.bufferFragmentData(g,u,c,o)}if(p&&v!=null&&v.samples.length){var H={id:r,frag:u,details:p,samples:v.samples};a.trigger(S.FRAG_PARSING_METADATA,H)}if(p&&h){var G={id:r,frag:u,details:p,samples:h.samples};a.trigger(S.FRAG_PARSING_USERDATA,G)}}},{key:"logMuxedErr",value:function(e){this.warn("".concat(Rt(e)?"Media":"Init"," segment with muxed audiovideo where only video expected: ").concat(e.url))}},{key:"_bufferInitSegment",value:function(e,r,a,s){var o=this;if(this.state===re.PARSING){this.audioOnly=!!r.audio&&!r.video,this.altAudio&&!this.audioOnly&&(delete r.audio,r.audiovideo&&this.logMuxedErr(a));var l=r.audio,u=r.video,c=r.audiovideo;if(l){var f=e.audioCodec,d=ko(l.codec,f);d==="mp4a"&&(d="mp4a.40.5");var h=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){d&&(d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5");var v=l.metadata;v&&"channelCount"in v&&(v.channelCount||1)!==1&&h.indexOf("firefox")===-1&&(d="mp4a.40.5")}d&&d.indexOf("mp4a.40.5")!==-1&&h.indexOf("android")!==-1&&l.container!=="audio/mpeg"&&(d="mp4a.40.2",this.log("Android: force audio codec to ".concat(d))),f&&f!==d&&this.log('Swapping manifest audio codec "'.concat(f,'" for "').concat(d,'"')),l.levelCodec=d,l.id=fe.MAIN,this.log("Init audio buffer, container:".concat(l.container,", codecs[selected/level/parsed]=[").concat(d||"","/").concat(f||"","/").concat(l.codec,"]")),delete r.audiovideo}if(u){u.levelCodec=e.videoCodec,u.id=fe.MAIN;var m=u.codec;if((m==null?void 0:m.length)===4)switch(m){case"hvc1":case"hev1":u.codec="hvc1.1.6.L120.90";break;case"av01":u.codec="av01.0.04M.08";break;case"avc1":u.codec="avc1.42e01e";break}this.log("Init video buffer, container:".concat(u.container,", codecs[level/parsed]=[").concat(e.videoCodec||"","/").concat(m,"]").concat(u.codec!==m?" parsed-corrected="+u.codec:"").concat(u.supplemental?" supplemental="+u.supplemental:"")),delete r.audiovideo}c&&(this.log("Init audiovideo buffer, container:".concat(c.container,", codecs[level/parsed]=[").concat(e.codecs,"/").concat(c.co
1dec,"]")),delete r.video,delete r.audio);var p=Object.keys(r);if(p.length){if(this.hls.trigger(S.BUFFER_CODECS,r),!this.hls)return;p.forEach(function(g){var E=r[g],y=E.initSegment;y!=null&&y.byteLength&&o.hls.trigger(S.BUFFER_APPENDING,{type:g,data:y,frag:a,part:null,chunkMeta:s,parent:a.type})})}this.tickImmediate()}}},{key:"getMainFwdBufferInfo",value:function(){var e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,fe.MAIN)}},{key:"maxBufferLength",get:function(){var e=this.levels,r=this.level,a=e==null?void 0:e[r];return a?this.getMaxBufferLength(a.maxBitrate):this.config.maxBufferLength}},{key:"backtrack",value:function(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=re.IDLE}},{key:"checkFragmentChanged",value:function(){var e=this.media,r=null;if(e&&e.readyState>1&&e.seeking===!1){var a=e.currentTime;if(Fe.isBuffered(e,a)?r=this.getAppendedFrag(a):Fe.isBuffered(e,a+.1)&&(r=this.getAppendedFrag(a+.1)),r){this.backtrackFragment=null;var s=this.fragPlaying,o=r.level;(!s||r.sn!==s.sn||s.level!==o)&&(this.fragPlaying=r,this.hls.trigger(S.FRAG_CHANGED,{frag:r}),(!s||s.level!==o)&&this.hls.trigger(S.LEVEL_SWITCHED,{level:o}))}}}},{key:"nextLevel",get:function(){var e=this.nextBufferedFrag;return e?e.level:-1}},{key:"currentFrag",get:function(){var e;if(this.fragPlaying)return this.fragPlaying;var r=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return ce(r)?this.getAppendedFrag(r):null}},{key:"currentProgramDateTime",get:function(){var e,r=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(ce(r)){var a=this.getLevelDetails(),s=this.currentFrag||(a?gn(null,a.fragments,r):null);if(s){var o=s.programDateTime;if(o!==null){var l=o+(r-s.start)*1e3;return new Date(l)}}}return null}},{key:"currentLevel",get:function(){var e=this.currentFrag;return e?e.level:-1}},{key:"nextBufferedFrag",get:function(){var e=this.currentFrag;return e?this.followingBufferedFrag(e):null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),i}(Sf),kx=function(n){B(i,n);function i(t,e){var r;return k(this,i),r=Xe(this,i,["key-loader",e]),r.config=void 0,r.keyIdToKeyInfo={},r.emeController=null,r.config=t,r}return A(i,[{key:"abort",value:function(e){for(var r in this.keyIdToKeyInfo){var a=this.keyIdToKeyInfo[r].loader;if(a){var s;if(e&&e!==((s=a.context)==null?void 0:s.frag.type))return;a.abort()}}}},{key:"detach",value:function(){for(var e in this.keyIdToKeyInfo){var r=this.keyIdToKeyInfo[e];(r.mediaKeySessionContext||r.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}},{key:"destroy",value:function(){this.detach();for(var e in this.keyIdToKeyInfo){var r=this.keyIdToKeyInfo[e].loader;r&&r.destroy()}this.keyIdToKeyInfo={}}},{key:"createKeyLoadError",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:K.KEY_LOAD_ERROR,a=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;return new ki({type:ge.NETWORK_ERROR,details:r,fatal:!1,frag:e,response:o,error:a,networkDetails:s})}},{key:"loadClear",value:function(e,r,a){var s=this;if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(r.length){for(var o=function(){var h=r[u];if(e.cc<=h.cc&&(!Rt(e)||!Rt(h)||e.sn<h.sn)||!a&&u==c-1)return{v:s.emeController.selectKeySystemFormat(h).then(function(v){if(s.emeController){h.setKeyFormat(v);var m=Io(v);if(m)return s.emeController.getKeySystemAccess([m])}})}},l,u=0,c=r.length;u<c;u++)if(l=o(),l)return l.v}if(this.config.requireKeySystemAccessOnStart){var f=Wa(this.config);if(f.length)return this.emeController.getKeySystemAccess(f)}}return null}},{key:"load",value:function(e){var r=this;return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(function(a){return r.loadInternal(e,a)}):this.loadInternal(e)}},{key:"loadInternal",value:function(e,r){var a,s;r&&e.setKeyFormat(r);var o=e.decryptdata;if(!o){var l=new Error(r?"Expected frag.decryptdata to be defined after setting format ".concat(r):"Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ".concat(this.emeController&&this.config.emeEnabled,")"));return Promise.reject(this.createKeyLoadError(e,K.KEY_LOAD_ERROR,l))}var u=o.uri;if(!u)return Promise.reject(this.createKeyLoadError(e,K.KEY_LOAD_ERROR,new Error('Invalid key URI: "'.concat(u,'"'))));var c=Kc(o),f=this.keyIdToKeyInfo[c];if((a=f)!=null&&a.decryptdata.key)return o.key=f.decryptdata.key,Promise.resolve({frag:e,keyInfo:f});if(this.emeController&&(s=f)!=null&&s.keyLoadPromise){var d=this.emeController.getKeyStatus(f.decryptdata);switch(d){case"usable":case"usable-in-future":return f.keyLoadPromise.then(function(h){var v=h.keyInfo;return o.key=v.decryptdata.key,{frag:e,keyInfo:v}})}}switch(this.log("".concat(this.keyIdToKeyInfo[c]?"Rel":"L","oading").concat(o.keyId?" keyId: "+tr(o.keyId):""," URI: ").concat(o.uri," from ").concat(e.type," ").concat(e.level)),f=this.keyIdToKeyInfo[c]={decryptdata:o,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},o.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return o.keyFormat==="identity"?this.loadKeyHTTP(f,e):this.loadKeyEME(f,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(f,e);default:return Promise.reject(this.createKeyLoadError(e,K.KEY_LOAD_ERROR,new Error('Key supplied with unsupported METHOD: "'.concat(o.method,'"'))))}}},{key:"loadKeyEME",value:function(e,r){var a={frag:r,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var s;if(!e.decryptdata.keyId&&(s=r.initSegment)!=null&&s.data){var o=GC(r.initSegment.data);if(o.length){var l=o[0];l.some(function(c){return c!==0})?(this.log("Using keyId found in init segment ".concat(tr(l))),Go.setKeyIdForUri(e.decryptdata.uri,l)):(l=Go.addKeyIdForUri(e.decryptdata.uri),this.log("Generating keyId to patch media ".concat(tr(l)))),e.decryptdata.keyId=l}}if(!e.decryptdata.keyId&&!Rt(r))return Promise.resolve(a);var u=this.emeController.loadKey(a);
1return(e.keyLoadPromise=u.then(function(c){return e.mediaKeySessionContext=c,a})).catch(function(c){throw e.keyLoadPromise=null,"data"in c&&(c.data.frag=r),c})}return Promise.resolve(a)}},{key:"loadKeyHTTP",value:function(e,r){var a=this,s=this.config,o=s.loader,l=new o(s);return r.keyLoader=e.loader=l,e.keyLoadPromise=new Promise(function(u,c){var f={keyInfo:e,frag:r,responseType:"arraybuffer",url:e.decryptdata.uri},d=s.keyLoadPolicy.default,h={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},v={onSuccess:function(p,g,E,y){var _=E.frag,b=E.keyInfo,C=Kc(b.decryptdata);if(!_.decryptdata||b!==a.keyIdToKeyInfo[C])return c(a.createKeyLoadError(_,K.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),y));b.decryptdata.key=_.decryptdata.key=new Uint8Array(p.data),_.keyLoader=null,b.loader=null,u({frag:_,keyInfo:b})},onError:function(p,g,E,y){a.resetLoader(g),c(a.createKeyLoadError(r,K.KEY_LOAD_ERROR,new Error("HTTP Error ".concat(p.code," loading key ").concat(p.text)),E,et({url:f.url,data:void 0},p)))},onTimeout:function(p,g,E){a.resetLoader(g),c(a.createKeyLoadError(r,K.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),E))},onAbort:function(p,g,E){a.resetLoader(g),c(a.createKeyLoadError(r,K.INTERNAL_ABORTED,new Error("key loading aborted"),E))}};l.load(f,h,v)})}},{key:"resetLoader",value:function(e){var r=e.frag,a=e.keyInfo,s=e.url,o=a.loader;r.keyLoader===o&&(r.keyLoader=null,a.loader=null);var l=Kc(a.decryptdata)||s;delete this.keyIdToKeyInfo[l],o&&o.destroy()}}]),i}(Hr);Ax=function(){function n(i){k(this,n),this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=i,this.registerListeners()}return A(n,[{key:"startLoad",value:function(t){}},{key:"stopLoad",value:function(){this.destroyInternalLoaders()}},{key:"registerListeners",value:function(){var t=this.hls;t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.LEVEL_LOADING,this.onLevelLoading,this),t.on(S.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.on(S.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),t.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this)}},{key:"unregisterListeners",value:function(){var t=this.hls;t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.LEVEL_LOADING,this.onLevelLoading,this),t.off(S.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.off(S.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),t.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this)}},{key:"createInternalLoader",value:function(t){var e=this.hls.config,r=e.pLoader,a=e.loader,s=r||a,o=new s(e);return this.loaders[t.type]=o,o}},{key:"getInternalLoader",value:function(t){return this.loaders[t.type]}},{key:"resetInternalLoader",value:function(t){this.loaders[t]&&delete this.loaders[t]}},{key:"destroyInternalLoaders",value:function(){for(var t in this.loaders){var e=this.loaders[t];e&&e.destroy(),this.resetInternalLoader(t)}}},{key:"destroy",value:function(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}},{key:"onManifestLoading",value:function(t,e){var r=e.url;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Be.MANIFEST,url:r,deliveryDirectives:null,levelOrTrack:null})}},{key:"onLevelLoading",value:function(t,e){var r=e.id,a=e.level,s=e.pathwayId,o=e.url,l=e.deliveryDirectives,u=e.levelInfo;this.load({id:r,level:a,pathwayId:s,responseType:"text",type:Be.LEVEL,url:o,deliveryDirectives:l,levelOrTrack:u})}},{key:"onAudioTrackLoading",value:function(t,e){var r=e.id,a=e.groupId,s=e.url,o=e.deliveryDirectives,l=e.track;this.load({id:r,groupId:a,level:null,responseType:"text",type:Be.AUDIO_TRACK,url:s,deliveryDirectives:o,levelOrTrack:l})}},{key:"onSubtitleTrackLoading",value:function(t,e){var r=e.id,a=e.groupId,s=e.url,o=e.deliveryDirectives,l=e.track;this.load({id:r,groupId:a,level:null,responseType:"text",type:Be.SUBTITLE_TRACK,url:s,deliveryDirectives:o,levelOrTrack:l})}},{key:"onLevelsUpdated",value:function(t,e){var r=this.loaders[Be.LEVEL];if(r){var a=r.context;a&&!e.levels.some(function(s){return s===a.levelOrTrack})&&(r.abort(),delete this.loaders[Be.LEVEL])}}},{key:"load",value:function(t){var e=this,r,a=this.hls.config,s=this.getInternalLoader(t);if(s){var o=this.hls.logger,l=s.context;if(l&&l.levelOrTrack===t.levelOrTrack&&(l.url===t.url||l.deliveryDirectives&&!t.deliveryDirectives)){l.url===t.url?o.log("[playlist-loader]: ignore ".concat(t.url," ongoing request")):o.log("[playlist-loader]: ignore ".concat(t.url," in favor of ").concat(l.url));return}o.log("[playlist-loader]: aborting previous loader for type: ".concat(t.type)),s.abort()}var u;if(t.type===Be.MANIFEST?u=a.manifestLoadPolicy.default:u=nt({},a.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),s=this.createInternalLoader(t),ce((r=t.deliveryDirectives)==null?void 0:r.part)){var c;if(t.type===Be.LEVEL&&t.level!==null?c=this.hls.levels[t.level].details:t.type===Be.AUDIO_TRACK&&t.id!==null?c=this.hls.audioTracks[t.id].details:t.type===Be.SUBTITLE_TRACK&&t.id!==null&&(c=this.hls.subtitleTracks[t.id].details),c){var f=c.partTarget,d=c.targetduration;if(f&&d){var h=Math.max(f*3,d*.8)*1e3;u=nt({},u,{maxTimeToFirstByteMs:Math.min(h,u.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(h,u.maxTimeToFirstByteMs)})}}}var v=u.errorRetry||u.timeoutRetry||{},m={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:v.maxNumRetry||0,retryDelay:v.retryDelayMs||0,maxRetryDelay:v.maxRetryDelayMs||0}
1,p={onSuccess:function(E,y,_,b){var C=e.getInternalLoader(_);e.resetInternalLoader(_.type);var R=E.data;y.parsing.start=performance.now(),qa.isMediaPlaylist(R)||_.type!==Be.MANIFEST?e.handleTrackOrLevelPlaylist(E,y,_,b||null,C):e.handleMasterPlaylist(E,y,_,b)},onError:function(E,y,_,b){e.handleNetworkError(y,_,!1,E,b)},onTimeout:function(E,y,_){e.handleNetworkError(y,_,!0,void 0,E)}};s.load(t,m,p)}},{key:"checkAutostartLoad",value:function(){if(this.hls){var t=this.hls,e=t.config,r=e.autoStartLoad,a=e.startPosition,s=t.forceStartLoad;(r||s)&&(this.hls.logger.log("".concat(r?"auto":"force"," startLoad with configured startPosition ").concat(a)),this.hls.startLoad(a))}}},{key:"handleMasterPlaylist",value:function(t,e,r,a){var s=this,o=this.hls,l=t.data,u=Wc(t,r),c=qa.parseMasterPlaylist(l,u);if(c.playlistParsingError){e.parsing.end=performance.now(),this.handleManifestParsingError(t,r,c.playlistParsingError,a,e);return}var f=c.contentSteering,d=c.levels,h=c.sessionData,v=c.sessionKeys,m=c.startTimeOffset,p=c.variableList;this.variableList=p,d.forEach(function(R){var M=R.unknownCodecs;if(M)for(var D=s.hls.config.preferManagedMediaSource,L=R.audioCodec,O=R.videoCodec,x=M.length;x--;){var Y=M[x];Xa(Y,"audio",D)?(R.audioCodec=L=L?"".concat(L,",").concat(Y):Y,oa.audio[L.substring(0,4)]=2,M.splice(x,1)):Xa(Y,"video",D)&&(R.videoCodec=O=O?"".concat(O,",").concat(Y):Y,oa.video[O.substring(0,4)]=2,M.splice(x,1))}});var g=qa.parseMasterPlaylistMedia(l,u,c),E=g.AUDIO,y=E===void 0?[]:E,_=g.SUBTITLES,b=g["CLOSED-CAPTIONS"];if(y.length){var C=y.some(function(R){return!R.url});!C&&d[0].audioCodec&&!d[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),y.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Lt({}),bitrate:0,url:""}))}o.trigger(S.MANIFEST_LOADED,{levels:d,audioTracks:y,subtitles:_,captions:b,contentSteering:f,url:u,stats:e,networkDetails:a,sessionData:h,sessionKeys:v,startTimeOffset:m,variableList:p})}},{key:"handleTrackOrLevelPlaylist",value:function(t,e,r,a,s){var o=this.hls,l=r.id,u=r.level,c=r.type,f=Wc(t,r),d=ce(u)?u:ce(l)?l:0,h=M_(r),v=qa.parseLevelPlaylist(t.data,f,d,h,0,this.variableList);if(c===Be.MANIFEST){var m={attrs:new Lt({}),bitrate:0,details:v,name:"",url:f};v.requestScheduled=e.loading.start+v0(v,0),o.trigger(S.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:f,stats:e,networkDetails:a,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}e.parsing.end=performance.now(),r.levelDetails=v,this.handlePlaylistLoaded(v,t,e,r,a,s)}},{key:"handleManifestParsingError",value:function(t,e,r,a,s){this.hls.trigger(S.ERROR,{type:ge.NETWORK_ERROR,details:K.MANIFEST_PARSING_ERROR,fatal:e.type===Be.MANIFEST,url:t.url,err:r,error:r,reason:r.message,response:t,context:e,networkDetails:a,stats:s})}},{key:"handleNetworkError",value:function(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0,o="A network ".concat(r?"timeout":"error"+(a?" (status "+a.code+")":"")," occurred while loading ").concat(t.type);t.type===Be.LEVEL?o+=": ".concat(t.level," id: ").concat(t.id):(t.type===Be.AUDIO_TRACK||t.type===Be.SUBTITLE_TRACK)&&(o+=" id: ".concat(t.id,' group-id: "').concat(t.groupId,'"'));var l=new Error(o);this.hls.logger.warn("[playlist-loader]: ".concat(o));var u=K.UNKNOWN,c=!1,f=this.getInternalLoader(t);switch(t.type){case Be.MANIFEST:u=r?K.MANIFEST_LOAD_TIMEOUT:K.MANIFEST_LOAD_ERROR,c=!0;break;case Be.LEVEL:u=r?K.LEVEL_LOAD_TIMEOUT:K.LEVEL_LOAD_ERROR,c=!1;break;case Be.AUDIO_TRACK:u=r?K.AUDIO_TRACK_LOAD_TIMEOUT:K.AUDIO_TRACK_LOAD_ERROR,c=!1;break;case Be.SUBTITLE_TRACK:u=r?K.SUBTITLE_TRACK_LOAD_TIMEOUT:K.SUBTITLE_LOAD_ERROR,c=!1;break}f&&this.resetInternalLoader(t.type);var d={type:ge.NETWORK_ERROR,details:u,fatal:c,url:t.url,loader:f,context:t,error:l,networkDetails:e,stats:s};if(a){var h=(e==null?void 0:e.url)||t.url;d.response=et({url:h,data:void 0},a)}this.hls.trigger(S.ERROR,d)}},{key:"handlePlaylistLoaded",value:function(t,e,r,a,s,o){var l=this.hls,u=a.type,c=a.level,f=a.levelOrTrack,d=a.id,h=a.groupId,v=a.deliveryDirectives,m=Wc(e,a),p=M_(a),g=typeof a.level=="number"&&p===fe.MAIN?c:void 0,E=t.playlistParsingError;if(E){if(this.hls.logger.warn("".concat(E," ").concat(t.url)),!l.config.ignorePlaylistParsingErrors){l.trigger(S.ERROR,{type:ge.NETWORK_E
1RROR,details:K.LEVEL_PARSING_ERROR,fatal:!1,url:m,error:E,reason:E.message,response:e,context:a,level:g,parent:p,networkDetails:s,stats:r});return}t.playlistParsingError=null}if(!t.fragments.length){var y=t.playlistParsingError=new Error("No Segments found in Playlist");l.trigger(S.ERROR,{type:ge.NETWORK_ERROR,details:K.LEVEL_EMPTY_ERROR,fatal:!1,url:m,error:y,reason:y.message,response:e,context:a,level:g,parent:p,networkDetails:s,stats:r});return}switch(t.live&&o&&(o.getCacheAge&&(t.ageHeader=o.getCacheAge()||0),(!o.getCacheAge||isNaN(t.ageHeader))&&(t.ageHeader=0)),u){case Be.MANIFEST:case Be.LEVEL:if(g){if(!f)g=0;else if(f!==l.levels[g]){var _=l.levels.indexOf(f);_>-1&&(g=_)}}l.trigger(S.LEVEL_LOADED,{details:t,levelInfo:f||l.levels[0],level:g||0,id:d||0,stats:r,networkDetails:s,deliveryDirectives:v,withoutMultiVariant:u===Be.MANIFEST});break;case Be.AUDIO_TRACK:l.trigger(S.AUDIO_TRACK_LOADED,{details:t,track:f,id:d||0,groupId:h||"",stats:r,networkDetails:s,deliveryDirectives:v});break;case Be.SUBTITLE_TRACK:l.trigger(S.SUBTITLE_TRACK_LOADED,{details:t,track:f,id:d||0,groupId:h||"",stats:r,networkDetails:s,deliveryDirectives:v});break}}}]),n}(),zi=function(){function n(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};k(this,n),this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Tf,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;var t=this.logger=LC(i.debug||!1,"Hls instance",i.assetPlayerId),e=this.config=cx(n.DefaultConfig,i,t);this.userConfig=i,e.progressive&&fx(e,t);var r=e.abrController,a=e.bufferController,s=e.capLevelController,o=e.errorController,l=e.fpsController,u=new o(this),c=this.abrController=new r(this),f=new bL(this),d=e.interstitialsController,h=d?this.interstitialsController=new d(this,n):null,v=this.bufferController=new a(this,f),m=this.capLevelController=new s(this),p=new l(this),g=new Ax(this),E=e.contentSteeringController,y=E?new E(this):null,_=this.levelController=new _x(this,y),b=new gx(this),C=new kx(this.config,this.logger),R=this.streamController=new bx(this,f,C),M=this.gapController=new px(this,f);m.setStreamController(R),p.setStreamController(R);var D=[g,_,R];h&&D.splice(1,0,h),y&&D.splice(1,0,y),this.networkControllers=D;var L=[c,v,M,m,p,b,f];this.audioTrackController=this.createController(e.audioTrackController,D);var O=e.audioStreamController;O&&D.push(this.audioStreamController=new O(this,f,C)),this.subtitleTrackController=this.createController(e.subtitleTrackController,D);var x=e.subtitleStreamController;x&&D.push(this.subtititleStreamController=new x(this,f,C)),this.createController(e.timelineController,L),C.emeController=this.emeController=this.createController(e.emeController,L),this.cmcdController=this.createController(e.cmcdController,L),this.latencyController=this.createController(yx,L),this.coreComponents=L,D.push(u);var Y=u.onErrorOut;typeof Y=="function"&&this.on(S.ERROR,Y,u),this.on(S.MANIFEST_LOADED,g.onManifestLoaded,g)}return A(n,[{key:"createController",value:function(t,e){if(t){var r=new t(this);return e&&e.push(r),r}return null}},{key:"on",value:function(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this;this._emitter.on(t,e,r)}},{key:"once",value:function(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this;this._emitter.once(t,e,r)}},{key:"removeAllListeners",value:function(t){this._emitter.removeAllListeners(t)}},{key:"off",value:function(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this,a=arguments.length>3?arguments[3]:void 0;this._emitter.off(t,e,r,a)}},{key:"listeners",value:function(t){return this._emitter.listeners(t)}},{key:"emit",value:function(t,e,r){return this._emitter.emit(t,e,r)}},{key:"trigger",value:function(t,e){if(this.config.debug)return this.emit
1(t,t,e);try{return this.emit(t,t,e)}catch(a){if(this.logger.error("An internal error happened while handling event "+t+'. Error message: "'+a.message+'". Here is a stacktrace:',a),!this.triggeringException){this.triggeringException=!0;var r=t===S.ERROR;this.trigger(S.ERROR,{type:ge.OTHER_ERROR,details:K.INTERNAL_EXCEPTION,fatal:r,event:t,error:a}),this.triggeringException=!1}}return!1}},{key:"listenerCount",value:function(t){return this._emitter.listenerCount(t)}},{key:"destroy",value:function(){this.logger.log("destroy"),this.trigger(S.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(function(e){return e.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(e){return e.destroy()}),this.coreComponents.length=0;var t=this.config;t.xhrSetup=t.fetchSetup=void 0,this.userConfig=null}},{key:"attachMedia",value:function(t){if(!t||"media"in t&&!t.media){var e=new Error("attachMedia failed: invalid argument (".concat(t,")"));this.trigger(S.ERROR,{type:ge.OTHER_ERROR,details:K.ATTACH_MEDIA_ERROR,fatal:!0,error:e});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());var r="media"in t,a=r?t.media:t,s=r?t:{media:a};this._media=a,this.trigger(S.MEDIA_ATTACHING,s)}},{key:"detachMedia",value:function(){this.logger.log("detachMedia"),this.trigger(S.MEDIA_DETACHING,{}),this._media=null}},{key:"transferMedia",value:function(){this._media=null;var t=this.bufferController.transferMedia();return this.trigger(S.MEDIA_DETACHING,{transferMedia:t}),t}},{key:"loadSource",value:function(t){this.stopLoad();var e=this.media,r=this._url,a=this._url=ff.buildAbsoluteURL(self.location.href,t,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log("loadSource:".concat(a)),e&&r&&(r!==a||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(e)),this.trigger(S.MANIFEST_LOADING,{url:t})}},{key:"url",get:function(){return this._url}},{key:"hasEnoughToStart",get:function(){return this.streamController.hasEnoughToStart}},{key:"startPosition",get:function(){return this.streamController.startPositionValue}},{key:"startLoad",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:-1,e=arguments.length>1?arguments[1]:void 0;this.logger.log("startLoad(".concat(t+(e?", <skip seek to start>":""),")")),this.started=!0,this.resumeBuffering();for(var r=0;r<this.networkControllers.length&&(this.networkControllers[r].startLoad(t,e),!(!this.started||!this.networkControllers));r++);}},{key:"stopLoad",value:function(){this.logger.log("stopLoad"),this.started=!1;for(var t=0;t<this.networkControllers.length&&(this.networkControllers[t].stopLoad(),!(this.started||!this.networkControllers));t++);}},{key:"loadingEnabled",get:function(){return this.started}},{key:"bufferingEnabled",get:function(){return this.streamController.bufferingEnabled}},{key:"resumeBuffering",value:function(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(function(t){t.resumeBuffering&&t.resumeBuffering()}))}},{key:"pauseBuffering",value:function(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(function(t){t.pauseBuffering&&t.pauseBuffering()}))}},{key:"inFlightFragments",get:function(){var t=V({},fe.MAIN,this.streamController.inFlightFrag);return this.audioStreamController&&(t[fe.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(t[fe.SUBTITLE]=this.subtititleStreamController.inFlightFrag),t}},{key:"swapAudioCodec",value:function(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}},{key:"recoverMediaError",value:function(){this.logger.log("recoverMediaError");var t=this._media,e=t==null?void 0:t.currentTime;this.detachMedia(),t&&(this.attachMedia(t),e&&this.startLoad(e))}},{key:"removeLevel",value:function(t){this.levelController.removeLevel(t)}
1},{key:"sessionId",get:function(){var t=this._sessionId;return t||(t=this._sessionId=pw()),t}},{key:"levels",get:function(){var t=this.levelController.levels;return t||[]}},{key:"latestLevelDetails",get:function(){return this.streamController.getLevelDetails()||null}},{key:"loadLevelObj",get:function(){return this.levelController.loadLevelObj}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(t){this.logger.log("set currentLevel:".concat(t)),this.levelController.manualLevel=t,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(t){this.logger.log("set nextLevel:".concat(t)),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(t){this.logger.log("set loadLevel:".concat(t)),this.levelController.manualLevel=t}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(t){this.levelController.nextLoadLevel=t}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(t){this.logger.log("set firstLevel:".concat(t)),this.levelController.firstLevel=t}},{key:"startLevel",get:function(){var t=this.levelController.startLevel;return t===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:t},set:function(t){this.logger.log("set startLevel:".concat(t)),t!==-1&&(t=Math.max(t,this.minAutoLevel)),this.levelController.startLevel=t}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(t){var e=!!t;e!==this.config.capLevelToPlayerSize&&(e?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=e)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(t){this._autoLevelCapping!==t&&(this.logger.log("set autoLevelCapping:".concat(t)),this._autoLevelCapping=t,this.levelController.checkMaxAutoUpdated())}},{key:"bandwidthEstimate",get:function(){var t=this.abrController.bwEstimator;return t?t.getEstimate():NaN},set:function(t){this.abrController.resetEstimator(t)}},{key:"abrEwmaDefaultEstimate",get:function(){var t=this.abrController.bwEstimator;return t?t.defaultEstimate:NaN}},{key:"ttfbEstimate",get:function(){var t=this.abrController.bwEstimator;return t?t.getEstimateTTFB():NaN}},{key:"maxHdcpLevel",get:function(){return this._maxHdcpLevel},set:function(t){oL(t)&&this._maxHdcpLevel!==t&&(this._maxHdcpLevel=t,this.levelController.checkMaxAutoUpdated())}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var t=this.levels,e=this.config.minAutoBitrate;if(!t)return 0;for(var r=t.length,a=0;a<r;a++)if(t[a].maxBitrate>=e)return a;return 0}},{key:"maxAutoLevel",get:function(){var t=this.levels,e=this.autoLevelCapping,r=this.maxHdcpLevel,a;if(e===-1&&t!=null&&t.length?a=t.length-1:a=e,r)for(var s=a;s--;){var o=t[s].attrs["HDCP-LEVEL"];if(o&&o<=r)return s}return a}},{key:"firstAutoLevel",get:function(){return this.abrController.firstAutoLevel}},{key:"nextAutoLevel",get:function(){return this.abrController.nextAutoLevel},set:function(t){this.abrController.nextAutoLevel=t}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"maxBufferLength",get:function(){return this.streamController.maxBufferLength}},{key:"setAudioOption",value:function(t){var e;return((e=this.audioTrackController)==null?void 0:e.setAudioOption(t))||null}},{key:"setSubtitleOption",value:function(t){var e;return((e=this.subtitleTrackController)==null?void 0:e.setSubtitleOption(t))||null}},{key:"allAudioTracks",get:function(){var t=this.audioTrackController;return t?t.allAudioTracks:[]}},{key:"audioTracks",get:function(){var t=this.audioTrackController;return t?t.audioTracks:[]}},{key:"audioTrack",get:function(){var t=this.audioTrackController;return t?t.audioTrack:-1},set:function(t){var e=this.audioTrackController;e&&(e.audioTrack=t)}},{key:"allSubtitleTracks",get:function(){var t=this.subtitleTrackController;return t?t.allSubtitleTracks:[]}},{key:"subtitleTracks",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTrack:-1},set:function(t){var e=this.subtitleTrackController;e&&(e.subtitleTrack=t)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var t=this.subtitleTrackController;return t?t.subtitleDisplay:!1},set:function(t){var e=this.subtitleTrackController;e&&(e.subtitleDisplay=t)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(t){this.config.lowLatencyMode=t}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}
1,set:function(t){this.latencyController.targetLatency=t}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}},{key:"pathways",get:function(){return this.levelController.pathways}},{key:"pathwayPriority",get:function(){return this.levelController.pathwayPriority},set:function(t){this.levelController.pathwayPriority=t}},{key:"bufferedToEnd",get:function(){var t;return!!((t=this.bufferController)!=null&&t.bufferedToEnd)}},{key:"interstitialsManager",get:function(){var t;return((t=this.interstitialsController)==null?void 0:t.interstitialsManager)||null}},{key:"getMediaDecodingInfo",value:function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.allAudioTracks,r=Z_(e);return Q_(t,r,navigator.mediaCapabilities)}}],[{key:"version",get:function(){return Za}},{key:"isMSESupported",value:function(){return vE()}},{key:"isSupported",value:function(){return Ex()}},{key:"getMediaSource",value:function(){return qi()}},{key:"Events",get:function(){return S}},{key:"MetadataSchema",get:function(){return Rr}},{key:"ErrorTypes",get:function(){return ge}},{key:"ErrorDetails",get:function(){return K}},{key:"DefaultConfig",get:function(){return n.defaultConfig?n.defaultConfig:lx},set:function(t){n.defaultConfig=t}}]),n}();zi.defaultConfig=void 0});var Ix,mE,gE=W(function(){T();J();X();Ge();pE();Ix=function(){function n(i){k(this,n),V(this,"hls",null),V(this,"_currentSrc",null),V(this,"_loadPromise",null),this.videoEl=i}return A(n,[{key:"load",value:function(t){var e,r=this;return t===this._currentSrc?(e=this._loadPromise)!==null&&e!==void 0?e:Promise.resolve():(this.destroy(),this._currentSrc=t,this._loadPromise=new Promise(function(a,s){if(zi.isSupported()){var o=new zi;r.hls=o,o.on(zi.Events.MANIFEST_PARSED,function(){return a()}),o.on(zi.Events.ERROR,function(l,u){if(u.fatal)switch(u.type){case zi.ErrorTypes.NETWORK_ERROR:o.startLoad();break;case zi.ErrorTypes.MEDIA_ERROR:o.recoverMediaError();break;default:r.destroy(),s(u);break}}),o.loadSource(t),o.attachMedia(r.videoEl)}else r.videoEl.src=t,a()}),this._loadPromise)}},{key:"destroy",value:function(){var t;(t=this.hls)===null||t===void 0||t.destroy(),this.hls=null,this._currentSrc=null,this._loadPromise=null}}]),n}(),mE=Ix});function Cx(n,i,t){return i=w(i),q(n,_E()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function _E(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(_E=function(){return!!n})()}function yE(n,i,t,e){var r=ar(w(1&e?n.prototype:n),i,t);return 2&e&&typeof r=="function"?function(a){return r.apply(t,a)}:r}function Lx(n){return/\.m3u8(\?|$)/i.test(n)}var Rx,EE,SE=W(function(){T();J();X();ue();Dr();oe();rn();le();Ge();Wu();Ku();gE();ft();Rx=function(n){B(i,n);function i(t,e){var r,a,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=s.loopDuration,l=o===void 0?0:o;k(this,i);var u=t.querySelector("[data-videoslider-item-video]");return a=Cx(this,i,[t,u]),V(qe(a),"_videoLoaded",!1),a.itemEl=t,a.manager=e,a.videoEl=u,a.videoContainer=t.querySelector("[data-videoslider-item-video-container]"),a.infoEl=t.querySelector("[data-videoslider-item-info]"),a.index=parseInt((r=t.dataset.videosliderItemIndex)!==null&&r!==void 0?r:"",10),a._loopDuration=l,a._loadMedia(),a._attachControls(),a}return A(i,[{key:"_loadMedia",value:function(){var e=this.itemEl.dataset.videosliderItemThumbnailSrc;if(e){var r=this.itemEl.querySelector("[data-videoslider-item-thumbnail]"),a=this.itemEl.querySelector("[data-videoslider-item-poster]");r&&r.style.setProperty("--story-image","url('".concat(e,"')")),a&&a.style.setProperty("--story-image","url('".concat(e,"')"))}}},{key:"_loadVideo",value:function(){var e,r=this;if(!this._videoLoaded){this._videoLoaded=!0;var a=(e=this.itemEl.dataset.videosliderItemVideoSrc)!==null&&e!==void 0?e:"";Lx(a)?(this._transcodePlayer=new mE(this.videoEl),this._transcodePlayer.load(a).catch(function(s){return r._handleLoadError(s)})):this.videoEl.src=a}}},{key:"_handleLoadError",value:function(e){this.paused=!0,clearTimeout(this._infoTimer),ae(this.infoEl,!0),ae(this.videoContainer,!1),this.emit
1("error",e)}},{key:"_attachControls",value:function(){var e=this;Fa.onClick({selector:"[data-video-btn]",ancestor:this.itemEl,callback:function(a,s){return e._handleBtn(s)}})}},{key:"_handleBtn",value:function(e){switch(e.dataset.videoBtn){case"play":this.togglePlay();break;case"mute":this.setMuted(!this.videoEl.muted);break}}},{key:"play",value:function(){var e=this,r;this._loadVideo(),this.paused=!1,ae(this.videoContainer,!0),this._infoTimer=setTimeout(function(){return ae(e.infoEl,!1)},2e3),this._playPromise=this.videoEl.play(),(r=this._playPromise)===null||r===void 0||r.catch(function(){})}},{key:"pause",value:function(){var e=this;this.paused=!0,clearTimeout(this._infoTimer),ae(this.infoEl,!0),this._playPromise?(this._playPromise.then(function(){e.paused&&e.videoEl.pause()}).catch(function(){}),this._playPromise=null):this.videoEl.pause(),ae(this.videoContainer,!1)}},{key:"stop",value:function(){var e=this;this.paused=!0,clearTimeout(this._infoTimer),ae(this.infoEl,!0),this._playPromise?(this._playPromise.then(function(){e.paused&&(e.videoEl.pause(),e.videoEl.currentTime=0)}).catch(function(){}),this._playPromise=null):(this.videoEl.pause(),this.videoEl.currentTime=0),ae(this.videoContainer,!1)}},{key:"setMuted",value:function(e){this.videoEl.muted=e,this.itemEl.dataset.muted=String(e);var r=this.manager._iconMuteEl;r&&(r.dataset.status=e?"on":"off")}},{key:"updateTime",value:function(){var e=this,r;if(yE(i,"updateTime",this,3)([]),this._loopDuration&&this.videoEl.currentTime>=this._loopDuration&&(this.videoEl.currentTime=0,clearTimeout(this._infoTimer),ae(this.infoEl,!0),this._infoTimer=setTimeout(function(){return ae(e.infoEl,!1)},2e3)),this===this.manager._activeItem){var a=(r=this.manager._sliderEl)===null||r===void 0?void 0:r.querySelector("[data-videoslider-item-timeline]");a&&a.style.setProperty("--storylinesProgressValue","".concat(this.progress,"%"))}}},{key:"destroy",value:function(){var e;clearTimeout(this._infoTimer),(e=this._transcodePlayer)===null||e===void 0||e.destroy(),yE(i,"destroy",this,3)([])}}]),i}(zs),EE=Rx});var TE,bE=W(function(){T();tn();J();X();pc();ft();TE=function(){function n(i,t){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=e.orientation,a=r===void 0?"horizontal":r,s=e.onNavigate,o=e.playOnSnap,l=o===void 0?!1:o;k(this,n),this._sliderEl=i,this._trackEl=i.querySelector("[data-videoslider-track]"),this._items=t,this._orientation=a,this._onNavigate=s,this._playOnSnap=l,this._currentIndex=1,this._observer=null,this._prevBtn=i.querySelector("[data-videoslider-prev]"),this._nextBtn=i.querySelector("[data-videoslider-next]"),this._initScrollObserver(),this._initButtons(),this._updateButtons()}return A(n,[{key:"goTo",value:function(t){var e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"smooth",a=this._items.get(t);if(a){if(this._orientation==="horizontal"&&this._trackEl){var s=a.itemEl.getBoundingClientRect(),o=this._trackEl.getBoundingClientRect(),l=this._trackEl.scrollLeft+(s.left-o.left);this._trackEl.scrollTo({top:0,left:l,behavior:r})}else if(this._trackEl){var u=a.itemEl.getBoundingClientRect(),c=this._trackEl.getBoundingClientRect(),f=this._trackEl.scrollTop+(u.top-c.top);this._trackEl.scrollTo({top:f,behavior:r})}else Jn(a.itemEl,{scrollMode:"always",behavior:r,block:"start",inline:"nearest"});this._currentIndex=t,this._updateButtons(),this._updateDots(t),this._playOnSnap||(e=this._onNavigate)===null||e===void 0||e.call(this,t)}}},{key:"_initScrollObserver",value:function(){var t=this;if(this._trackEl){this._trackEl.addEventListener("scroll",function(){t._playOnSnap||t._updateButtons()},{passive:!0});var e=new IntersectionObserver(function(r){if(t._playOnSnap){var a=r.filter(function(c){return c.isIntersecting&&c.intersectionRatio>=.5}).sort(function(c,f){return f.intersectionRatio-c.intersectionRatio})[0];if(a){var s,o,l=parseInt((s=a.target.dataset.videosliderItemIndex)!==null&&s!==void 0?s:"",10),u=t._items.get(l);t._currentIndex=l,t._updateButtons(),t._updateDots(l),(o=t._onNavigate)===null||o===void 0||o.call(t,l),u==null||u.play()}r.filter(function(c){return!c.isIntersecting}
1).forEach(function(c){var f,d,h=parseInt((f=c.target.dataset.videosliderItemIndex)!==null&&f!==void 0?f:"",10);h!==t._currentIndex&&((d=t._items.get(h))===null||d===void 0||d.stop())})}},{root:this._trackEl,threshold:.5});this._observer=e,nr(this._items.values()).reverse().forEach(function(r){return e.observe(r.itemEl)})}}},{key:"_initButtons",value:function(){var t,e=this,r;(t=this._prevBtn)===null||t===void 0||t.addEventListener("click",function(s){s.preventDefault(),e.goTo(e._currentIndex-1)}),(r=this._nextBtn)===null||r===void 0||r.addEventListener("click",function(s){s.preventDefault(),e.goTo(e._currentIndex+1)});var a=this._sliderEl.querySelector("[data-videoslider-controls]");a&&this._items.forEach(function(s,o){var l=document.createElement("button");l.className="controls__dot",l.setAttribute("data-status",o===1?"on":"off"),l.addEventListener("click",function(){return e.goTo(o)}),a.appendChild(l),s.dot=l})}},{key:"_updateDots",value:function(t){this._items.forEach(function(e,r){e.dot&&e.dot.setAttribute("data-status",r===t?"on":"off")})}},{key:"_updateButtons",value:function(){if(!this._playOnSnap&&this._trackEl){var t=this._trackEl.scrollLeft<=0,e=Math.ceil(this._trackEl.scrollLeft+this._trackEl.clientWidth)>=this._trackEl.scrollWidth;this._prevBtn&&ae(this._prevBtn,!t),this._nextBtn&&ae(this._nextBtn,!e)}else{var r=this._items.size;this._prevBtn&&ae(this._prevBtn,this._currentIndex>1),this._nextBtn&&ae(this._nextBtn,this._currentIndex<r)}}}]),n}()});var kE,AE=W(function(){T();J();X();Gi();kE=function(){function n(i){k(this,n),this._id=i,this._verticalItemsSeen=new Set,this._hasSwipedInVertical=!1}return A(n,[{key:"onViewableImpression",value:function(){It.getInstance().simpleTrack(["videoSlider","viewableImpression",this._id])}},{key:"onFullscreenOpen",value:function(){this._resetVerticalSession(),It.getInstance().simpleTrack(["videoSlider","fullscreenOpen",this._id])}},{key:"onVerticalNavigate",value:function(t){this._verticalItemsSeen.add(t),this._verticalItemsSeen.size>=2&&!this._hasSwipedInVertical&&(this._hasSwipedInVertical=!0,It.getInstance().simpleTrack(["videoSlider","swipe",this._id]))}},{key:"onVerticalVideoComplete",value:function(t){It.getInstance().simpleTrack(["videoSlider","videoComplete","".concat(this._id,"_item").concat(t)])}},{key:"onFullscreenClose",value:function(){var t=this._verticalItemsSeen.size;t>0&&It.getInstance().simpleTrack(["videoSlider","depth","".concat(this._id,"_").concat(t)]),this._resetVerticalSession()}},{key:"_resetVerticalSession",value:function(){this._verticalItemsSeen.clear(),this._hasSwipedInVertical=!1}}]),n}()});var IE={};Et(IE,{default:function(){return wx}});var Ox,wx,CE=W(function(){T();J();X();SE();bE();AE();ft();Ox=function(){function n(){k(this,n),this._items=new Map,this._nav=null,this._sliderEl=null,this._currentIndex=1,this._activeItem=null,this._verticalMuted=!1,this._metrics=null}return A(n,[{key:"init",value:function(t){var e,r=t.id,a=document.getElementById(r);if(a){this._metrics=new kE(r);var s=(e=a.dataset.videosliderOrientation)!==null&&e!==void 0?e:"horizontal";this._initSlider(a,s)}}},{key:"_initSlider",value:function(t,e){var r=this;this._sliderEl=t;var a=new IntersectionObserver(function(s,o){s[0].isIntersecting&&(r._initItems(t,e),r._nav=new TE(t,r._items,{orientation:e,onNavigate:function(u){return r._onNavigate(u)},playOnSnap:e==="vertical"}),r._attachSharedControls(t),o.disconnect(),r._attachViewportObserver(t))},{rootMargin:"300px"});a.observe(t)}},{key:"_initItems",value:function(t,e){var r=this,a=e==="horizontal"?4:0;t.querySelectorAll("[data-videoslider-item]").forEach(function(s){var o,l=parseInt((o=s.dataset.videosliderItemIndex)!==null&&o!==void 0?o:"",10);if(!r._items.has(l)){var u=new EE(s,r,{loopDuration:a});u.initPlayer(),u.setMuted(!0),u.on("ended",function(){return r._onItemEnded(u)}),r._items.set(l,u)}})}},{key:"_attachSharedControls",value:function(t){var e=this,r,a=t.querySelector("[data-videoslider-item-close]");this._shareBtn=t.querySelector("[data-videoslider-item-share]");var s=t.querySelector("[data-videoslider-item-mute]");this._iconMuteEl=t.querySelector("#iconmute");
1var o=t.querySelector("[data-videoslider-item-timeline]"),l=t.querySelector("[data-videoslider-item-timeline-progress]");a==null||a.addEventListener("click",function(){return e._switchToHorizontal()}),(r=this._shareBtn)===null||r===void 0||r.addEventListener("click",function(){var c,f=(c=e._activeItem)===null||c===void 0?void 0:c.itemEl.dataset.videosliderItemShareurl;if(f)if(navigator.share)navigator.share({url:f});else{var d;(d=navigator.clipboard)===null||d===void 0||d.writeText(f),e._showCopiedTooltip()}}),s==null||s.addEventListener("click",function(){if(e._activeItem){var c=!e._activeItem.videoEl.muted;e._activeItem.setMuted(c),e._verticalMuted=c}});var u=function(f){var d,h;if(!(!e._activeItem||!o)){var v=e._activeItem.videoEl;if(!(!v.duration||!isFinite(v.duration))){var m=o.getBoundingClientRect();if(m.width){var p=(d=f.clientX)!==null&&d!==void 0?d:(h=f.native)===null||h===void 0?void 0:h.clientX,g=Math.max(0,Math.min(1,(p-m.left)/m.width));v.currentTime=v.duration*g,o.style.setProperty("--storylinesProgressValue","".concat(g*100,"%"))}}}};o==null||o.addEventListener("click",u),l==null||l.addEventListener("click",u),this._items.forEach(function(c){c.itemEl.addEventListener("click",function(){e._sliderEl.dataset.videosliderOrientation==="horizontal"?e._switchToVertical(c):c.togglePlay()})})}},{key:"_switchToVertical",value:function(t){var e,r=this;(e=this._metrics)===null||e===void 0||e.onFullscreenOpen(),this._verticalMuted=!1,this._sliderEl.dataset.videosliderOrientation="vertical",this._nav&&(this._nav._orientation="vertical",this._nav._playOnSnap=!1),this._items.forEach(function(a){a._loopDuration=0,a.stop(),a.setMuted(!0)}),this._activeItem=null,this.setActive(t),requestAnimationFrame(function(){requestAnimationFrame(function(){var a;(a=r._nav)===null||a===void 0||a.goTo(t.index,"instant"),r._nav&&(r._nav._playOnSnap=!0,r._nav._updateButtons())})})}},{key:"_switchToHorizontal",value:function(){var t,e,r=this;(t=this._metrics)===null||t===void 0||t.onFullscreenClose(),this._sliderEl.dataset.videosliderOrientation="horizontal",this._nav&&(this._nav._orientation="horizontal",this._nav._playOnSnap=!1),this._items.forEach(function(s){s._loopDuration=4,s.stop(),s.setMuted(!0)});var a=(e=this._activeItem)===null||e===void 0?void 0:e.index;this._activeItem=null,requestAnimationFrame(function(){requestAnimationFrame(function(){var s;(s=r._nav)===null||s===void 0||s.goTo(a,"instant");var o=r._firstVisibleItem();if(o){var l;r._nav&&(r._nav._currentIndex=o.index),(l=r._nav)===null||l===void 0||l._updateDots(o.index)}})})}},{key:"_attachViewportObserver",value:function(t){var e=this,r=new IntersectionObserver(function(a){a[0].isIntersecting?e._restartSlider():e._resetToHorizontal()},{threshold:0});r.observe(t)}},{key:"_resetToHorizontal",value:function(){if(this._sliderEl.dataset.videosliderOrientation==="vertical"){var t;(t=this._metrics)===null||t===void 0||t.onFullscreenClose()}this._items.forEach(function(e){e._loopDuration=4,e.stop(),e.setMuted(!0)}),this._sliderEl.dataset.videosliderOrientation="horizontal",this._nav&&(this._nav._orientation="horizontal",this._nav._currentIndex=1,this._nav._playOnSnap=!0,this._nav.goTo(1,"instant"),this._nav._playOnSnap=!1,this._nav._updateDots(1)),this._activeItem=null,this._currentIndex=1}},{key:"_restartSlider",value:function(){var t,e;(t=this._metrics)===null||t===void 0||t.onViewableImpression(),this._nav&&(this._nav._currentIndex=1),(e=this._nav)===null||e===void 0||e._updateDots(1)}},{key:"_firstVisibleItem",value:function(){var t,e=(t=this._nav)===null||t===void 0?void 0:t._trackEl;if(!e)return null;var r=e.getBoundingClientRect(),a=null,s=1/0;return this._items.forEach(function(o){var l=o.itemEl.getBoundingClientRect().left-r.left;l>=-1&&l<s&&(s=l,a=o)}),a}},{key:"_onItemEnded",value:function(t){var e,r;this._sliderEl.dataset.videosliderOrientation==="vertical"&&t===this._activeItem&&((e=this._metrics)===null||e===void 0||e.onVerticalVideoComplete(t.index),(r=this._nav)===null||r===void 0||r.goTo(this._currentIndex+1))}},{key:"_onNavigate",value:function(t){var e;if(this._currentIndex=t,((e=this._sliderEl)===null||e===void 0?void 0:e.dataset.videosliderOrientation)==="vertical"){var r;(r=this._metrics)===null||r===void 0||r.onVerticalNavigate(t)}this.setActive(this._items.get(t))}},{key:"setActive",value:function(t){if(this._activeItem!==t){this._activeItem&&(this._activeItem.setMuted(!0),this._activeItem.stop()),this._activeItem=t!=null?t:null;var e=this._sliderEl.dataset.videosliderOrientation==="vertical";e&&ae(this._shareBtn,!!(t!=null&&t.itemEl.dataset.videosliderItemShareurl)),t==null||t.setMuted(e?this._verticalMuted:!0),t==null||t.play()}}},{key:"_showCopiedTooltip",value:function(){var t=this;this._copiedTooltipEl&&(clearTimeout(this._copiedTooltipTimeout),this._copiedTooltipEl.remove());var e=document.createElement("div");e.textContent="Enlace copiado",Object.assign(e.style,{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",background:"#000",color:"#fff",padding:"12px 20px",borderRadius:"8px",fontSize:"14px",zIndex:"9999",pointerEvents:"none"}),document.body.appendChild(e),this._copiedTooltipEl=e,this._copiedTooltipTimeout=setTimeout(function(){e.remove(),t._copiedTooltipEl=null},2e3)}}]),n}(),wx=Ox});T();T();vt();Pr();wr();J();X();ue();oe();le();var zf=fr(xr(),1);Oi();Se();ft();ze();Mr();pt();T();J();X();ue();oe();le();mt();T();X();J();ue();oe();le();sr();function wT(n,i,t){return i=w(i),q(n,ph()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function ph(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(ph=function(){return!!n})()}var Nn=function(n){B(i,n);function i(t){return k(this,i),wT(this,i,[t])}return A(i)}(Qe);Nn.ON_SHOW_LOGGER="onShowLogger";function xT(n,i,t){return i=w(i),q(n,mh()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function mh(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(mh=function(){return!!n})()}var Bl=function(n){B(i,n);function i(){return k(this,i),xT(this,i,arguments)}return A(i,[{key:"init",value:function(){var e=this,r=window.location.hash.replace("#",""),a=r.split(",");a.forEach(function(s){switch(s.toUpperCase()){case i.TYPES.LOGGER:e.dispatchEvent(new Nn(Nn.ON_SHOW_LOGGER));break}})}}]),i}(Re);Bl.TYPES={LOGGER:"LOGGER"};T();vt();(function(){"use strict";if((typeof window=="undefined"?"undefined":pe(window))!=="object")return;if("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype){"isIntersecting"in window.IntersectionObserverEntry.prototype||Ob
1ject.defineProperty(window.IntersectionObserverEntry.prototype,"isIntersecting",{get:function(){return this.intersectionRatio>0}});return}function n(y){try{return y.defaultView&&y.defaultView.frameElement||null}catch(_){return null}}var i=function(y){for(var _=y,b=n(_);b;)_=b.ownerDocument,b=n(_);return _}(window.document),t=[],e=null,r=null;function a(y){this.time=y.time,this.target=y.target,this.rootBounds=v(y.rootBounds),this.boundingClientRect=v(y.boundingClientRect),this.intersectionRect=v(y.intersectionRect||h()),this.isIntersecting=!!y.intersectionRect;var _=this.boundingClientRect,b=_.width*_.height,C=this.intersectionRect,R=C.width*C.height;b?this.intersectionRatio=Number((R/b).toFixed(4)):this.intersectionRatio=this.isIntersecting?1:0}function s(y,_){var b=_||{};if(typeof y!="function")throw new Error("callback must be a function");if(b.root&&b.root.nodeType!=1&&b.root.nodeType!=9)throw new Error("root must be a Document or Element");this._checkForIntersections=l(this._checkForIntersections.bind(this),this.THROTTLE_TIMEOUT),this._callback=y,this._observationTargets=[],this._queuedEntries=[],this._rootMarginValues=this._parseRootMargin(b.rootMargin),this.thresholds=this._initThresholds(b.threshold),this.root=b.root||null,this.rootMargin=this._rootMarginValues.map(function(C){return C.value+C.unit}).join(" "),this._monitoringDocuments=[],this._monitoringUnsubscribes=[]}s.prototype.THROTTLE_TIMEOUT=100,s.prototype.POLL_INTERVAL=null,s.prototype.USE_MUTATION_OBSERVER=!0,s._setupCrossOriginUpdater=function(){return e||(e=function(_,b){!_||!b?r=h():r=m(_,b),t.forEach(function(C){C._checkForIntersections()})}),e},s._resetCrossOriginUpdater=function(){e=null,r=null},s.prototype.observe=function(y){var _=this._observationTargets.some(function(b){return b.element==y});if(!_){if(!(y&&y.nodeType==1))throw new Error("target must be an Element");this._registerInstance(),this._observationTargets.push({element:y,entry:null}),this._monitorIntersections(y.ownerDocument),this._checkForIntersections()}},s.prototype.unobserve=function(y){this._observationTargets=this._observationTargets.filter(function(_){return _.element!=y}),this._unmonitorIntersections(y.ownerDocument),this._observationTargets.length==0&&this._unregisterInstance()},s.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorAllIntersections(),this._unregisterInstance()},s.prototype.takeRecords=function(){var y=this._queuedEntries.slice();return this._queuedEntries=[],y},s.prototype._initThresholds=function(y){var _=y||[0];return Array.isArray(_)||(_=[_]),_.sort().filter(function(b,C,R){if(typeof b!="number"||isNaN(b)||b<0||b>1)throw new Error("threshold must be a number between 0 and 1 inclusively");return b!==R[C-1]})},s.prototype._parseRootMargin=function(y){var _=y||"0px",b=_.split(/\s+/).map(function(C){var R=/^(-?\d*\.?\d+)(px|%)$/.exec(C);if(!R)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(R[1]),unit:R[2]}});return b[1]=b[1]||b[0],b[2]=b[2]||b[0],b[3]=b[3]||b[1],b},s.prototype._monitorIntersections=function(y){var _=y.defaultView;if(_&&this._monitoringDocuments.indexOf(y)==-1){var b=this._checkForIntersections,C=null,R=null;this.POLL_INTERVAL?C=_.setInterval(b,this.POLL_INTERVAL):(u(_,"resize",b,!0),u(y,"scroll",b,!0),this.USE_MUTATION_OBSERVER&&"MutationObserver"in _&&(R=new _.MutationObserver(b),R.observe(y,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))),this._monitoringDocuments.push(y),this._monitoringUnsubscribes.push(function(){var L=y.defaultView;L&&(C&&L.clearInterval(C),c(L,"resize",b,!0)),c(y,"scroll",b,!0),R&&R.disconnect()});var M=this.root&&(this.root.ownerDocument||this.root)||i;if(y!=M){var D=n(y);D&&this._monitorIntersections(D.ownerDocument)}}},s.prototype._unmonitorIntersections=function(y){var _=this._monitoringDocuments.indexOf(y);if(_!=-1){var b=this.root&&(this.root.ownerDocument||this.root)||i,C=this._observationTargets.some(function(D){var L=D.element.ownerDocument;if(L==y)return!0;for(;L&&L!=b;){var O=n(L);if(L=O&&O.ownerDocument,L==y)return!0}return!1});if(!C){var R=this._monitoringUnsubscribes[_];if(this._monitoringDocuments.splice(_,1),this._monitoringUnsubscribes.splice(_,1),R(),y!=b){var M=n(y);M&&this._unmonitorIntersections(M.ownerDocument)}}}},s.prototype._unmonitorAllIntersections=function(){var y=this._monitoringUnsubscribes.slice(0);this._monitoringDocuments.length=0,this._monitoringUnsubscribes.length=0;for(var _=0;_<y.length;_++)y[_]()},s.prototype._checkForIntersections=function(){if(!(!this.root&&e&&!r)){var y=this._rootIsInDom(),_=y?this._getRootRect():h();
1this._observationTargets.forEach(function(b){var C=b.element,R=d(C),M=this._rootContainsTarget(C),D=b.entry,L=y&&M&&this._computeTargetAndRootIntersection(C,R,_),O=null;this._rootContainsTarget(C)?(!e||this.root)&&(O=_):O=h();var x=b.entry=new a({time:o(),target:C,boundingClientRect:R,rootBounds:O,intersectionRect:L});D?y&&M?this._hasCrossedThreshold(D,x)&&this._queuedEntries.push(x):D&&D.isIntersecting&&this._queuedEntries.push(x):this._queuedEntries.push(x)},this),this._queuedEntries.length&&this._callback(this.takeRecords(),this)}},s.prototype._computeTargetAndRootIntersection=function(y,_,b){if(window.getComputedStyle(y).display!="none"){for(var C=_,R=g(y),M=!1;!M&&R;){var D=null,L=R.nodeType==1?window.getComputedStyle(R):{};if(L.display=="none")return null;if(R==this.root||R.nodeType==9)if(M=!0,R==this.root||R==i)e&&!this.root?!r||r.width==0&&r.height==0?(R=null,D=null,C=null):D=r:D=b;else{var O=g(R),x=O&&d(O),Y=O&&this._computeTargetAndRootIntersection(O,x,b);x&&Y?(R=O,D=m(x,Y)):(R=null,C=null)}else{var $=R.ownerDocument;R!=$.body&&R!=$.documentElement&&L.overflow!="visible"&&(D=d(R))}if(D&&(C=f(D,C)),!C)break;R=R&&g(R)}return C}},s.prototype._getRootRect=function(){var y;if(this.root&&!E(this.root))y=d(this.root);else{var _=E(this.root)?this.root:i,b=_.documentElement,C=_.body;y={top:0,left:0,right:b.clientWidth||C.clientWidth,width:b.clientWidth||C.clientWidth,bottom:b.clientHeight||C.clientHeight,height:b.clientHeight||C.clientHeight}}return this._expandRectByRootMargin(y)},s.prototype._expandRectByRootMargin=function(y){var _=this._rootMarginValues.map(function(C,R){return C.unit=="px"?C.value:C.value*(R%2?y.width:y.height)/100}),b={top:y.top-_[0],right:y.right+_[1],bottom:y.bottom+_[2],left:y.left-_[3]};return b.width=b.right-b.left,b.height=b.bottom-b.top,b},s.prototype._hasCrossedThreshold=function(y,_){var b=y&&y.isIntersecting?y.intersectionRatio||0:-1,C=_.isIntersecting?_.intersectionRatio||0:-1;if(b!==C)for(var R=0;R<this.thresholds.length;R++){var M=this.thresholds[R];if(M==b||M==C||M<b!=M<C)return!0}},s.prototype._rootIsInDom=function(){return!this.root||p(i,this.root)},s.prototype._rootContainsTarget=function(y){var _=this.root&&(this.root.ownerDocument||this.root)||i;return p(_,y)&&(!this.root||_==y.ownerDocument)},s.prototype._registerInstance=function(){t.indexOf(this)<0&&t.push(this)},s.prototype._unregisterInstance=function(){var y=t.indexOf(this);y!=-1&&t.splice(y,1)};function o(){return window.performance&&performance.now&&performance.now()}function l(y,_){var b=null;return function(){b||(b=setTimeout(function(){y(),b=null},_))}}function u(y,_,b,C){typeof y.addEventListener=="function"?y.addEventListener(_,b,C||!1):typeof y.attachEvent=="function"&&y.attachEvent("on"+_,b)}function c(y,_,b,C){typeof y.removeEventListener=="function"?y.removeEventListener(_,b,C||!1):typeof y.detachEvent=="function"&&y.detachEvent("on"+_,b)}function f(y,_){var b=Math.max(y.top,_.top),C=Math.min(y.bottom,_.bottom),R=Math.max(y.left,_.left),M=Math.min(y.right,_.right),D=M-R,L=C-b;return D>=0&&L>=0&&{top:b,bottom:C,left:R,right:M,width:D,height:L}||null}function d(y){var _;try{_=y.getBoundingClientRect()}catch(b){}return _?(_.width&&_.height||(_={top:_.top,right:_.right,bottom:_.bottom,left:_.left,width:_.right-_.left,height:_.bottom-_.top}),_):h()}function h(){return{top:0,bottom:0,left:0,right:0,width:0,height:0}}function v(y){return!y||"x"in y?y:{top:y.top,y:y.top,bottom:y.bottom,left:y.left,x:y.left,right:y.right,width:y.width,height:y.height}}function m(y,_){var b=_.top-y.top,C=_.left-y.left;return{top:b,left:C,height:_.height,width:_.width,bottom:b+_.height,right:C+_.width}}function p(y,_){for(var b=_;b;){if(b==y)return!0;b=g(b)}return!1}function g(y){var _=y.parentNode;return y.nodeType==9&&y!=i?n(y):(_&&_.assignedSlot&&(_=_.assignedSlot.parentNode),_&&_.nodeType==11&&_.host?_.host:_)}function E(y){return y&&y.nodeType===9}window.IntersectionObserver=s,window.IntersectionObserverEntry=a})();T();J();X();ue();oe();le();Oi();T();X();J();Ge();ft();ze();_e();Aa();Fn();pt();
1var _h=A(function n(i){k(this,n),V(this,"_elementsChild",[]),V(this,"_order",0),V(this,"_lastitem",0),V(this,"_paused",!1),I.alertsCMS.isOkDomains&&(this._timeInterval=i,FT.call(this))});var NT=function(){Ts.call(this),this._timer.listen(hr.ON_TM_TIMER,Ts,this),this._timer.start(),Tt.mobile||ie(window,"click",UT,this)},FT=function(){var i=document.getElementById("alert_container_js");if(i){var t=document.getElementById("alert_container");if(t){this._elementsChild=[],this._container=t;var e=0;if(t.children.length>1){for(var r=0;r<t.children.length;r++){var a=t.children[r];a.getAttribute("data-closed")!=="true"&&(this._elementsChild[e++]=a)}this._order=0,this._lastitem=this._elementsChild.length-1,this._timer=new Pi(this._timeInterval),this._paused=!1,NT.call(this)}else{var s=t.children[0];s.setAttribute("data-status","on")}}}},Ts=function(){var i=this._order;this._elementsChild[i-1]?ae(this._elementsChild[i-1],!1):i===0&&ae(this._elementsChild[this._elementsChild.length-1],!1),this._elementsChild[i]&&ae(this._elementsChild[i],!0),this._elementsC
1hild[i+1]?(this._lastitem=this._order,this._order++):(this._order=0,this._lastitem=this._elementsChild.length-1)},UT=function(i){var t=i.target;if((t==null?void 0:t.getAttribute("data-alert"))==="on"){var e=t.getAttribute("data-mode");if(e)switch(e){case"alert-closer":BT.call(this,i);return;case"alert-player":this._container.getAttribute("data-status")==="off"?(this._timer.start(),this._paused=!1):(this._timer.stop(),this._paused=!0);return;case"alert-previous":HT.call(this);return;case"alert-next":jT.call(this);return}}},BT=function(){ae(this._elementsChild[this._lastitem],!1),this._elementsChild[this._lastitem].setAttribute("data-closed","true"),GT.call(this),this._lastitem>this._elementsChild.length-1&&(this._lastitem=0,this._order=1),ae(this._elementsChild[this._lastitem],!0)},GT=function(){if(this._elementsChild.splice(this._lastitem,1),this._container){var i=0;this._elementsChild=[];for(var t=0;t<this._container.children.length;t++){var e=this._container.children[t];e.getAttribute("data-closed")!=="true"&&(this._elementsC
1hild[i++]=e)}this._elementsChild.length<=1&&(this._elementsChild[0].setAttribute("data-alone","on"),this._timer.stop())}},jT=function(){this._paused?Ts.call(this):(this._timer.stop(),Ts.call(this),this._timer.start())},HT=function(){this._paused||this._timer.stop();var i=this._lastitem;ae(this._elementsChild[i],!1),this._lastitem===0?ae(this._elementsChild[this._elementsChild.length-1],!0):ae(this._elementsChild[this._lastitem-1],!0),this._elementsChild[i-1]?(this._order=this._lastitem,this._lastitem--):(this._lastitem=this._elementsChild.length-1,this._order=0),this._paused||this._timer.start()};Se();mt();ze();Mr();T();J();X();Se();pt();ft();ze();var Gl=null,sn="LAZYLOAD";ne(sn);var Di=function(){function n(){var i=this;k(this,n),P(["jeef.browser.LazyLoad>LazyLoad>","Inicializando clase LazyLoad"],sn),this._offset=n.OFFSET_BASE,this._elements=[],this._refitElements=[],this.optionsObserver={root:null,rootMargin:"300px",threshold:[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1]},this.nativeLazy=this.newImageLoading(),this.nativeLazy||(this.observer=new IntersectionObserver(function(t,e){for(var r in t)if(t[r].isIntersecting===!0&&!i.imgsObserved[t[r].target.id]){var a=WT(t[r].target);VT(t[r].target,a),i.imgsObserved[t[r].target.id]=!0,i.observer.unobserve(t[r].target)}},this.optionsObserver),this.imgsObserved={})}return A(n,[{key:"setOffset",value:function(t){this._offset=t}},{key:"check",value:function(){}},{key:"add",value:function(t){var e=0;if(Object.prototype.toString.call(t)==="[object Array]")for(e;e<t.length;e++)this.addElement(t[e]);else typeof t=="string"&&this.addElement(t)}},{key:"addElement",value:function(t){var e=document.getElementById(t);if(e)if(this.nativeLazy){var r="data-src",a=null;a=e.getAttribute(r),a&&(e.setAttribute("src",JSON.parse(a)[0]),e.removeAttribute(r))}else this.observer.observe(e)}},{key:"fit",value:function(){}},{key:"newImageLoading",value:function(){if(typeof IntersectionObserver=="undefined")return!0;if(!("loading"in HTMLImageElement.prototype))return!1;for(var t=document.getElementsByTagName("img"),e=0;e<t.length;e++)if(t[e].getAttribute("loading"))return!0;return!1}}],[{key:"getInstance",value:function(){return P(["jeef.browser.LazyLoad>getInstance>","Obteniendo Singleton LazyLoad"],sn),Gl||(Gl=new n),Gl}}]),n}();Di.OFFSET_BASE=550;var VT=function(i,t){t&&(i.src=t.src),ie(i,"load",KT,this)},KT=function(i){ae(i.native.target.parentNode,!0),i.native.target.removeAttribute("height"),i.native.target.removeAttribute("width")},WT=function(i){P(["jeef.browser.LazyLoad>_getDataImg>","Obteniendo informaci\xF3n del data-src"],sn);var t,e,r;if(t=i.getAttribute("data-source"),t===null&&(t=i.getAttribute("data-src")),t=JSON.parse(t),t!=null){switch(!0){case t.length===1:P(["jeef.browser.LazyLoad>_getDataImg>","Se ha detectado una \xFAnica resoluci\xF3n"],sn),e=t[0].match(/(\d+)x(\d+)\.[a-z]{3,4}$/i)[0].match(/\d+/g),r=t[0];break;case t.length===2:switch(!0){case(Tt.ua.mobile&&!Tt.ua.tablet):P(["jeef.browser.LazyLoad>_getDataImg>","Se ha detectado m\xE1s de una resoluci\xF3n, aplicando resoluci\xF3n a M\xD3VIL"],sn),e=t[1].match(/(\d+)x(\d+)\.[a-z]{3,4}$/i)[0].match(/\d+/g),r=t[1];break;default:P(["jeef.browser.LazyLoad>_getDataImg>","Se ha detectado m\xE1s de una resoluci\xF3n, aplicando resoluci\xF3n a TABLET/PC"],sn),e=t[0].match(/(\d+)x(\d+)\.[a-z]{3,4}$/i)[0].match(/\d+/g),r=t[0];break}break}return{width:i.parentNode.offsetWidth,height:Math.floor(e[1]/e[0]*i.parentNode.offsetWidth),src:r}}return!1};T();vt();le();An();J();X();Jt();ze();T();J();X();ue();oe();le();mt();ze();Ut();Xt();Bt();_e();function tb(n,i,t){return i=w(i),q(n,Oh()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function Oh(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Oh=function(){return!!n})()}var wh=function(n){B(i,n);function i(){var t;return k(this,i),t=tb(this,i),t._requested={},t}return A(i,[{key:"load",value:function(e){var r,a;if(!this._requested[e.type]){this._requested[e.type]=!0;var s=new Ke;switch(ie(s,he.ON_IO_FINISH,rb,this),e.type){case te.components.OPTA:var o=I.opta.assets.jsV2,l=I.opta.assets.cssV2;switch(e.version){case"3":o=I.opta.assets.jsV3,l=I.opta.assets.cssV3;break}r=[o,i.getStaticUrl("/assets_js/dyn/opta.min.js")],Vl(l);break;case te.components.OPTA_BASKET_LIVE:r=[i.getStaticUrl("/vendor_js/opta/jquery-1.10.2.min.js"),i.getStaticUrl("/vendor_js/opta/widgets-opta-basket-xml.js"),i.getStaticUrl("/vendor_js/opta/widgets-opta-basket-grafico-svg-tiros.js"),i.getStaticUrl("/vendor_js/opta/widgets-opta-basket-grafico-svg-evo.js"),i.getStaticUrl("/vendor_js/opta/widgets-opta-basket.js"),i.getStaticUrl("/assets_js/web/v2/basket.min.js?v1=1")],s.load(r,!1);break;case te.components.OPTA_HANDBALL_LIVE:r=[i.getStaticUrl("/vendor_js/opta/jquery-1.10.2.min.js"),i.getStaticUrl("/vendor_js/opta/widgets-opta-bm.js"),i.getStaticUrl("/vendor_js/opta/widgets-opta-bm-grafico-svg-evo.js"),i.getStaticUrl("/vendor_js/opta/widgets-opta-bm-grafico-svg-tiros.js"),i.getStaticUrl("/vendor_js/opta/widgets-opta-bm-xml.js"),i.getStaticUrl("/assets_js/web/v2/handBall.min.js?v1=1")],a="/assets_css/v1.1/css/widgets-opta-bm-e2t.css",s.load(r,!1);break;case te.components.OPTA_CYCLING_LIVE:r=[i.getStaticUrl("/vendor_js/opta/jquery-1.10.2.min.js"),i.getStaticUrl("/vendor_js/opta/opta-widgets-races-param.js"),i.getStaticUrl("/vendor_js/opta/opta-widgets-races-menu.js"),i.getStaticUrl("/vendor_js/opta/opta-widgets-races-calendario.js"),i.getStaticUrl("/vendor_js/opta/opta-widgets-races-directo-cic.js"),i.getStaticUrl("/vendor_js/opta/opta-widgets-races-clasificacion.js"),i.getStaticUrl("/vendor_js/opta/opta-widgets-races-equipos-cic.js"),i.getStaticUrl("/vendor_js/opta/opta-widgets-races-xml.js"),i.getStaticUrl("/assets_js/web/v2/cycling.min.js")],a="/assets_css/v1.1/css/widgets-opta-ciclismo-e2t.css",s.load(r,!1);break;case te.components.OPTA_TENNIS_LIVE:r=[i.getStaticUrl("/vendor_js/opta/jquery-1.10.2.min.js"),i.getStaticUrl("/vendor_js/opta/widgets-opta-tenis-xml.js"),i.getStaticUrl("/vendor_js/opta/widgets-opta-tenis.js")],s.load(r,!1);break;case te.components.BOLSA_GRAPH:r=i.getStaticUrl("/assets_js/dyn/bolsa-graph.min.js");break;case te.components.BOLSA_MODULE:r=i.getStaticUrl("/assets_js/dyn/bolsa-module.min.js"),a="/assets_css/v1.1/css/widgets-economia-e2t.css";break;case te.components.POLL:r="/assets_js/dyn/poll.min.js";break;case te.components.POP:r="/assets_js/dyn/pop.min.js";break;case te.components.ELECCIONES:r="/assets_js/dyn/elecciones.min.js";break}a&&Vl(i.getStaticUrl(a)),r&&s.load(r,!0)}}},{key:"isLoaded",value:function(e){switch(e){case te.components.PODCAST:case te.components.LOCUTION:case te.components.GALLERY:case te.components.GALLERY_NEWS:case te.data.INFO_EDITIONV2_NEWS:case te.data.COMMENTINFO:case te.components.COUNT_DOWN:case te.data.SOCIAL:case te.data.LAZYLOAD:case te.data.PROMO:case te.data.SOCIAL_FOLLOWERS:case te.components.ADLOAD:case te.data.COMMENTNUM:case te.components.SPOTIM:case te.components.ADVSM_YOUTUBE:case te.components.CAROUSEL_GIFFS:case te.components.OPTA_SCORE:case te.components.SURVEY_TOP_100:case te.components.DARK_MODE:case te.components.FN:return!0;case te.data.INFO:if(jeeiSite.dyn.info)return!0;break;case te.data.INFO_PROMOTIONS:if(jeeiSite.dyn.infoPromotions)return!0;break;case te.data.INFO_SWG:if(jeeiSite.dyn.infoSWG)return!0;break;case te.data.INFO_AD:if(jeeiSite.dyn.info)return!0;break;case te.components.BOLSA_GRAPH:if(jeeiSite.mod&&jeeiSite.mod.bolsa.Graph)return!0;break;case te.components.BOLSA_MODULE:if(jeeiSite.mod&&jeeiSite.mod.bolsa.Module)return!0;break;case te.components.POLL:if(jeeiSite.poll&&jeeiSite.poll.View&&jeeiSite.poll.Model)return!0;break;case te.components.OPTA:if(jeeiSite.mod&&jeeiSite.mod.opta&&jeeiSite.mod.opta.Main)return!0;break;case te.components.OPTA_BASKET_LIVE:if(jeeiSite.mod&&jeeiSite.mod.opta&&jeeiSite.mod.opta.BasketLive)return!0;break;case te.components.OPTA_HANDBALL_LIVE:if(jeeiSite.mod&&jeeiSite.mod.opta&&jeeiSite.mod.opta.HandballLive)return!0;break;case te.components.OPTA_CYCLING_LIVE:if(jeeiSite.mod&&jeeiSite.mod.opta&&jeeiSite.mod.opta.CyclingLive)return!0;break;case te.components.OPTA_TENNIS_LIVE:if(jeeiSite.mod&&jeeiSite.mod.opta&&jeeiSite.mod.opta.TennisLive)return!0;break;case te.components.INVERTIA_COMPANY_QUOTE:case te.components.INVERTIA_COMPANY_FULL_QUOTE:case te.components.INVERTIA_COMPANY_FINANCIAL_DATA:case te.components.INVERTIA_COMPANY_REAL_TIME:case te.components.INVERTIA_COMPANY_MEDIUM_REAL_TIME:case te.components.INVERTIA_COMPANY_TECH_ANALYSIS:case te.components.INVERTIA_INDEXES:case te.components.INVERTIA_TAB_MARKET_OVERVIEW:return!0;case te.components.LIVEBLOG:if(jeeiSite.liveBlog&&jeeiSite.liveBlog.Dyn)return!0;break;case te.components.POP:if(jeeiSite.misc&&jeeiSite.misc.Pop)return!0;break;case te.components.ELECCIONES:if(jeeiSite.mod&&jeeiSite.mod.elecciones)return!0;break}return!1}}],[{key:"getStaticUrl",value:function(e){var r=I.assets?[I.assets]:["/"];return"".concat(r[0]).concat(e).concat("?v=1436")}}]),i}(Re);var rb=function(i){this.dispatchEvent(i)};Se();pt();T();J();X();Ge();$e();Se();dt();_e();un();T();Ge();Pr();J();X();$e();pt();_e();var yu,_u;function Tv(n,i){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);i&&(e=e.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,e)}return t}function bv(n){for(var i=1;i<arguments.length;i++){var t=arguments[i]!=null?arguments[i]:{};
1i%2?Tv(Object(t),!0).forEach(function(e){V(n,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Tv(Object(t)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})}return n}var Qb=[[[1920,0],[[1920,480],[1920,450]]],[[768,0],[[1920,480],[728,90]]],[[320,0],[[320,100],[320,50]]]],kv=[[[1200,0],[[1200,250],[1200,90],[1e3,250],[1e3,90],[990,250],[990,90],[980,250],[980,90],[970,250],[970,90],[728,90]]],[[996,0],[[990,250],[980,250],[980,90],[970,250],[970,90],[728,90]]],[[768,0],[[728,90]]],[[320,0],[[320,100],[320,50]]]],Eu=[[[1060,0],[[1060,250],[1e3,250],[990,250],[980,250],[980,90],[970,250],[970,90],[728,90]]],[[768,0],[[728,90]]],[[320,0],[[320,100],[320,50]]]],Ov=[[[768,0],[[640,90],[640,150],[640,250]]],[[320,0],[[320,100],[320,50]]]],$b=[[120,600],[160,600],[450,1e3],[340,1e3],[120,1e3],[160,1e3]],Zb=[[120,601],[160,601],[450,1001],[340,1001],[120,1001],[160,1001]],ek=[[320,100],[300,100],[300,75],[300,50],[320,75],[320,50],[1,1]],tk=[[728,90],[980,90],[990,90],[970,90],[1,1]],Av=[[[300,0],[[300,600],[300,250]]],[[250,0],[[250,250],[200,200],[160,600],[120,600]]],[[200,0],[[200,200],[160,600],[120,600]]]],rk=[[300,250]],ik=[[300,145]],nk=[[[768,0],[[300,50],[300,75],[300,100],[320,50],[320,75],[320,100],[480,150]]],[[320,0],[[300,50],[300,75],[300,100],[320,50],[320,75],[320,100]]]],Iv=[[1,1]],Cv=[],Ns="home",Fs="interior",Gn=I.ad.gpt.adPaths,ak=(yu=I.ad.gpt.adBidders)!==null&&yu!==void 0?yu:[],sk=(_u=I.ad.gpt.restrictAdServingByPosition)!==null&&_u!==void 0?_u:1,ok=function(){function n(){k(this,n),this.iRoba=1,this.iWaterfallRoba=1,this.iRobamini=1,this.iRoba145=1,this.iParagraph=1,this.iInsur=1,this.i1920=1,this.i970=1,this.i990=1,this.i640=1,this.iSky=1,this.iAutoListContents970=1,this.iAutoListContents640=1,this.iMinimega=1,this.iPrebidRoba=1,this.iPrebid970_990=1,this._home="x",this._interior="x",this._pixelHom="x",this._pixelInt="x",this._stickyHom="x",this._stickyInt="x",this._bidders={},this.roba_home_bd=!1,this.values=null;var i=window,t=document,e=t.documentElement,r=t.getElementsByTagName("body")[0];this.window_width=i.innerWidth||e.clientWidth||r.clientWidth,this.window_height=i.innerHeight||e.clientHeight||r.clientHeight}return A(n,[{key:"getValues",value:function(){var t;if(this.values===null){this.values=!0;var e={id:"default"};this._home=Gn[e.id].home,this._interior=Gn[e.id].interior,this._pixelHom=Gn[e.id].home,this._pixelInt=Gn[e.id].interior,this._stickyHom=Gn[e.id].stickyHom,this._stickyInt=Gn[e.id].stickyInt,this._bidders=(t=ak[e.id])!==null&&t!==void 0?t:[],this.getHashtagParameter("adunit")&&(this._home=this.devChangeAdUnits(this._home),this._interior=this.devChangeAdUnits(this._interior),this._pixelHom=this.devChangeAdUnits(this._pixelHom),this._pixelInt=this.devChangeAdUnits(this._pixelInt),this._stickyHom=this.devChangeAdUnits(this._stickyHom),this._stickyInt=this.devChangeAdUnits(this._stickyInt))}}},{key:"getHashtagParameter",value:function(t){var e=location.href.split("#");if(e[1]){var r=e[1],a=null,s=[];return r.split("&").forEach(function(o){s=o.split("="),s[0]===t&&(a=decodeURIComponent(s[1]))}),a}return!1}},{key:"devChangeAdUnits",value:function(t){var e=t.split("/");return e.pop(),"".concat(e.join("/"),"/").concat(this.getHashtagParameter("adunit"))}},{key:"add",value:function(t){t&&t.container?(t.params||(t.params={}),t.params.lazy===!0?jeef.JeefEvents.emit("ADLAZYADD",t):jeef.JeefEvents.emit("ADADD",t)):console.log("%c **** ERROR, sin informaci\xF3n del componente ","background: #222; color: #bada55")}},{key:"hasBidders",value:function(){var t=this.getHashtagParameter("prebid");if(I.ad.prebid===!1&&t===!1||t==="off")return!1;this.getValues();var e=this.getTypeBiddersPage(Lv());return(this._bidders[e]&&this._bidders[e].active||this._bidders.active||t==="on")&&Object.keys(this.getBidderAdUnits()).length!==0}},{key:"getBidderAdUnits",value:function(){this.getValues();var t=this.getTypeBiddersPage(Lv()),e={};return this._bidders[t]&&this._bidders[t].adUnits?e=this._bidders[t].adUnits:this._bidders.adUnits&&(e=this._bidders.adUnits),e}},{key:"getSlot",value:function(t,e){var r=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;this.adUnitSufix=a;var o,l=I.ad.apsAmazon;
1if(Cv.indexOf(t)===-1){var u;Cv.push(t);var c=this.getSlotData(t,e,s);if(c&&Array.isArray(c.size[0][1])){var f=c.size.concat([[[0,0],[[]]]]).find(function(g){var E=Te(g,2),y=Te(E[0],2),_=y[0],b=y[1],C=E[1];return r.window_width>_&&r.window_height>b}),d=Te(f,2),h=d[0],v=d[1];c.size=v||[]}if(c.size&&Array.isArray(c.size)&&!l.excludedContainers.includes(t)&&(c.apsSize=c.size.filter(function(g){if(g)return l.allowedSizes.some(function(E){return E[0]===g[0]&&E[1]===g[1]})})),c.path&&((u=c.size)===null||u===void 0?void 0:u.length)>0){var m,p=!1;if(JSON.stringify(c.size)==="[[1,1]]"&&(p=!1,I.ad.disableAd1x1.default))return!1;o=bv(bv({path:c.path,size:c.size,container:t,safeFrame:p,restrictAdServingByPosition:c.restrictAdServingByPosition},c.bidders&&{bidders:c.bidders}),((m=c.apsSize)===null||m===void 0?void 0:m.length)>0&&{apsSize:c.apsSize})}else console.log("%c definici\xF3n de slot para ","background: #222; color: #bada55",t);return o}else console.log("%c twice defined ","background: #222; color: #bada55",t);return!1}},{key:"getSlotData",value:function(t,e,r){if(Tk(t))return{path:"".concat(this.getPathGeneric(e)).concat(this.getRoba145()),size:ik};if(Sk(t))return{path:"".concat(this.getPathGeneric(e)).concat(this.getRobaMini()),size:rk,bidders:this.getBidderAdunit("roba",this.iPrebidRoba)};if(lk(t)){var a=this.iRoba;return{path:"".concat(this.getPathGeneric(e)).concat(this.getRoba()),size:Av,bidders:this.getBidderAdunit("roba",this.iPrebidRoba,e,t),restrictAdServingByPosition:a>sk}}if(ck(t))return{path:"".concat(this.getPathGeneric(e)).concat(this.getParagraph()),size:Iv};if(hk(t)){var s={path:"".concat(this.getPathGeneric(e)).concat(this.getInsur()),size:Iv};return s}if(pk(t))return{path:"".concat(this.getPathGeneric(e)).concat(this.get1920()),size:Qb};if(mk(t))return{path:"".concat(this.getPathGeneric(e)).concat(this.get990()),size:e?Eu:kv,bidders:this.getBidderAdunit("970",this.iPrebid970_990)};if(vk(t))return{path:"".concat(this.getPathGeneric(e)).concat(this.get970()),size:e?Eu:kv,bidders:this.getBidderAdunit("970",this.iPrebid970_990)};if(gk(t))return{path:"".concat(this.getPathGeneric(e)).concat(this.get640()),size:Ov};if(yk(t))return{path:"".concat(this.getPathGeneric(e)).concat(this.getSkyIZQ()),size:$b};if(_k(t))return{path:"".concat(this.getPathGeneric(e)).concat(this.getSkyDER()),size:Zb};if(Ek(t)){var o=this.getPathSticky(e),l=Me?"_970x90_1_sticky":"_970x90_1_sticky_desktop",u=Me?ek:tk,c={path:"".concat(o).concat(l),size:u,bidders:this.getBidderAdunit("sticky",2,e,t)};return c}return uk(t)?{path:"".concat(this.getPathGeneric(e)).concat(this.getWaterfallRoba()),size:Av,bidders:this.getBidderAdunit("roba",this.iWaterfallRoba)}:fk(t)?{path:"".concat(this.getPathGeneric()).concat(this.getAutoListContents(t)),size:Rv(t)}:Su(t)?{path:"".concat(this.getPathGeneric()).concat(this.getAutoListContents(t)),size:Rv(t)}:dk(t)?{path:"".concat(this.getPathGeneric(e)).concat(this.getMinimega()),size:nk}:!1}},{key:"getRoba",value:function(){var t;return this.iPrebidRoba++,Q.getMainId()===((t=I.sectionsIds)===null||t===void 0?void 0:t.home)&&(this.adUnitSufix==="BD"&&this.roba_home_bd===!0&&(this.adUnitSufix=!1),!this.roba_home_bd&&this.iRoba===1&&!this.adUnitSufix&&(this.adUnitSufix="BD"),this.adUnitSufix==="BD"&&(this.roba_home_bd=!0)),this.adUnitSufix?"_300x600_".concat(this.adUnitSufix):"_300x600_".concat(this.iRoba++)}},{key:"getWaterfallRoba",value:function(){return"_300x600_".concat(this.iWaterfallRoba++)}},{key:"getRobaMini",value:function(){return this.iPrebidRoba++,this.adUnitSufix?"_300x250_".concat(this.adUnitSufix):"_300x250_".concat(this.iRobamini++)}},{key:"getRoba145",value:function(){return this.adUnitSufix?"_300x145_".concat(this.adUnitSufix):"_300x145_".concat(this.iRoba145++)}},{key:"getParagraph",value:function(){return"_1x1_".concat(this.iParagraph++,"_sunmedia")}},{key:"getInsur",value:function(){return"_1x1_".concat(this.iInsur++)}},{key:"get1920",value:function(){return this.adUnitSufix?(this.i1920++,"_1920x480_".concat(this.adUnitSufix)):"_1920x480_".concat(this.i1920++)}},{key:"get970",value:function(){return this.iPrebid970_990++,this.adUnitSufix?"_970x90_".concat(this.adUnitSufix):"_970x90_".concat(this.i970++)}},{key:"get990",value:function(){return this.iPrebid970_990++,this.adUnitSufix?(this.i990++,"_990x250_".concat(this.adUnitSufix)):"_990x250_".concat(this.i990++)}},{key:"get640",value:function(){return this.adUnitSufix?"_640x90_".concat(this.adUnitSufix):"_640x90_".concat(this.i640++)}},{key:"getSkyIZQ",value:function(){return this.iSky++,"_120x600_Izq"}},{key:"getSkyDER",value:function(){return this.iSky++,"_120x600_Der"}},{key:"getMinimega",value:function(){return this.iMinimega++,"_320x100_1_Patrocinio"}},{key:"getAutoListContents",value:function(t){return Me||Su(t)?"_640x90_".concat(this.iAutoListContents640++):"_990x90_".concat(this.iAutoListContents970++)}},{key:"getTypeAdPage",value:function(t){return this.getValues(t),t?Ns:Fs}},{key:"getTypeBiddersPage",value:function(t){var e=this.getTypeAdPage(t);switch(e){case Ns:return Ns;case Fs:default:return Fs}}},{key:"getPathGeneric",value:function(t){var e=this.getTypeAdPage(t);switch(e){case Ns:return this._home;case Fs:default:return this._interior}}},{key:"getPathSticky",value:function(t){return t?this._stickyHom:this._stickyInt}},{key:"getBidderAdunit",value:function(t,e,r,a){var s=this.getBidderAdUnits()[t],o=Me?"mobile":"desktop";e=e-2;var l=[];
1if(!s)return[];if(s.ogury&&s.ogury.adUnitId[o][e]&&!r&&l.push({bidder:"ogury",params:{assetKey:s.ogury.assetKey,adUnitId:s.ogury.adUnitId[o][e]}}),s.appnexus&&s.appnexus.placementId[o][e]&&l.push({bidder:"appnexus",params:{placementId:s.appnexus.placementId[o][e]}}),s.richaudience&&s.richaudience.pid[o][e]&&l.push({bidder:"richaudience",params:{pid:s.richaudience.pid[o][e],supplyType:"site"}}),s.criteo&&l.push({bidder:"criteo",params:{networkId:s.criteo.networkId[o],pubid:s.criteo.pubid}}),s.nexx360&&s.nexx360.tagId[o]&&s.nexx360.tagId[o][e]&&l.push({bidder:"nexx360",params:{account:s.nexx360.account,tagId:s.nexx360.tagId[o][e]}}),s.rubicon){var u,c,f=s.rubicon,d=f.siteId,h=f.zoneId,v=f.accountId;(u=d[o])!==null&&u!==void 0&&u[e]&&(c=h[o])!==null&&c!==void 0&&c[e]&&l.push({bidder:"rubicon",params:{siteId:d[o][e],zoneId:h[o][e],accountId:v}})}if(s.teads&&s.teads.placementId[o]){var m,p=((m=s.teads)===null||m===void 0?void 0:m.allowedContainers)||[];p.some(function(g){return a==null?void 0:a.startsWith(g)})&&l.push({bidder:"teads",params:{pageId:s.teads.pageId,placementId:s.teads.placementId[o]}})}return l}}]),n}(),Lv=function(){var i=Q.getType();return I.homePagesTypes.indexOf(i)!==-1};function lk(n){return n.search(/^((roba\d{1,3}|robaidealista|robasuperior|roba_)|(roba_mod_))/ig)===0}function uk(n){return n.search(/^(waterfall_robagaleriagrande_\d{1,3})/ig)===0}function ck(n){return n.search(/^adv_paragraph_\d{1}/ig)===0}function fk(n){return n.search(/^mega_portadilla_\d{1}/ig)===0}function Su(n){return n.search(/^cintillo_portadilla_\d{1}/ig)===0}function dk(n){return n.search(/^minimega/ig)===0}function hk(n){return n.search(/^pixel_adv_\d{1}/ig)===0}function vk(n){return!!(n.search(/^(megasuperior|cintilloidealista|cintillodeportes|cintillocorazon|cintillo970_\d{1,3})/ig)===0||n.search(/^megainferior/ig)===0||n.search(/^(eb_tertulias|eb_baloncesto|eb_cantera|eb_topic|eb_deportes|eb_futbol|eb_madridismo)/ig)===0||n.search(/^(o_hardware|o_software|o_tecnologia|o_omicrono)/ig)===0||n.search(/^(cc_recetas|cc_restaurantes|cc_vinos|cc_carne|cc_cocinillas)/ig)===0||n.search(/^(i_america_tech|i_disruptores_e_innovadores|i_autonomias_4-0|i_opinion|i_politica_digital|i_mercados|i_invertia|i_empresas|i_observatorios)/ig)===0||Me&&n.search(/^cintillosharebutton-bottom/ig)===0)}function pk(n){return n.search(/^billboard_mod_|billboardsuperior/ig)===0}function mk(n){return n.search(/^mega_mod_/ig)===0}function gk(n){if(n.search(/^cintillo640_\d{1,2}/ig)===0||n.search(/^cintillo90_nomobile_\d{1,2}/ig)===0)return!0;if(!Me){if(n.search(/^cintillosharebutton-bottom/ig)===0)return!0}return!1}function yk(n){return Me?!1:n.search(/^skyizq/ig)===0}function _k(n){return Me?!1:n.search(/^skyder/ig)===0}function Ek(n){return n.search(/^sticky_content_adv1/ig)===0}function Sk(n){return n.search(/^robamini/ig)===0}function Tk(n){return n.search(/^(roba145_\d{1,3})/ig)===0}function Rv(n){return Me||Su(n)?Ov:Eu}var jn=new ok;pt();T();J();X();var wv=function(){function n(i,t,e,r,a){k(this,n),this.newElementObserver=i,this.referenceElement=t,this.scrollPercentage=e,this.lazyTime=r,this.funcToCall=a,this.promiseObserver=null,this.promiseTime=null}return A(n,[{key:"_insertBefore",value:function(t,e){e.parentNode.insertBefore(t,e)}},{key:"init",value:function(){var t=this;this._insertBefore(this.newElementObserver,this.referenceElement),this.newElementObserver.style.top="".concat(this.scrollPercentage,"%"),this.promiseObserver=new Promise(function(e){var r=new IntersectionObserver(function(a){a[0].intersectionRatio===0&&(e(),r.disconnect())},{threshold:[0,1]});r.observe(document.querySelector(".myObserver"))}),this.promiseTime=new Promise(function(e){setTimeout(e,t.lazyTime)}),Promise.race([this.promiseTime,this.promiseObserver]).then(function(){t.funcToCall()}).catch(function(e){console.error("Error:",e)})}}]),n}(),Bi=function(i,t){var e=t.timeout,r=t.observerConfig,a=r===void 0?{}:r,s=200;return new Promise(function(o,l){i!=null&&i.tagName||l("Error: Not a dom element");var u=null;e&&(u=setTimeout(function(){o({timeout:!0})},e));var c=new IntersectionObserver(function(f,d){f[0].isIntersecting===!0&&(u&&clearTimeout(u),d.unobserve(f[0].target),d.disconnect(),o({timeout:!1,entry:f[0]}))},Object.assign({rootMargin:"".concat(s,"px"),threshold:[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1]},a));c.observe(i)})};ln();T();Pr();J();X();Ge();Xt();Ut();Kn();
1$e();Se();dt();_e();_l();mi();ne("AD");var zr="AD",Bu=["megasuperior","mega_mod_megasuperior"],lA=5e3,Gu=function(){function n(){var i;k(this,n),V(this,"_slots",{}),V(this,"_slotsData",{}),V(this,"_allSlotsData",{}),V(this,"_info",null),V(this,"_enableService",!1),V(this,"_adsWaiting",[]),V(this,"_adsLazyWaiting",[]),V(this,"_resolveBillboardSkinDecision",null),V(this,"_billboardSkinDecisionPromise",null),this.OFFSET_Y=((i=en.LAZYLOAD)===null||i===void 0?void 0:i.OFFSET_Y)||0,window.googletag=window.googletag||{},window.googletag.cmd=window.googletag.cmd||[],this.googletag=window.googletag}return A(n,[{key:"loadGPTScript",value:function(){var t=document.location.protocol==="https:";if(!document.getElementById("criticGPT")){var e=new Ke,r=(t?"https:":"http:")+"//securepubads.g.doubleclick.net/tag/js/gpt.js";e.listen(he.ON_IO_ERROR,function(){return gr.getInstance().trackAdBlockUser(!0)}),e.load(r,!0,!0)}}},{key:"setupGoogleTag",value:function(t,e,r,a){var s=this;this.googletag.cmd.push(function(){s._setupEventListeners(),s._setupTargeting(t,e,r,a),s._configureGPTSettings(),s.googletag.enableServices()})}},{key:"_setupEventListeners",value:function(){var t=this;this.googletag.pubads().addEventListener("slotOnload",function(e){var r=e.slot.getSlotElementId();t._slotsData[r]&&(t._slotsData[r].loaded=!0);var a=document.getElementById(r);a&&a.getAttribute("data-placeholder-fixed")!=="on"&&a.setAttribute("data-status","off")}),this.googletag.pubads().addEventListener("slotRenderEnded",function(e){var r=e.slot.getSlotElementId();if(t._slotsData[r]&&(t._slotsData[r].rendered=!0),Bu.includes(r)){var a,s,o,l,u=I,c=(a=(s=(o=u.ad)===null||o===void 0||(o=o.billboardSkinCampaignIds)===null||o===void 0?void 0:o[Q.getSectionId()])!==null&&s!==void 0?s:(l=u.ad)===null||l===void 0||(l=l.billboardSkinCampaignIds)===null||l===void 0?void 0:l.default)!==null&&a!==void 0?a:[],f=!e.isEmpty&&c.includes(e.campaignId);t._resolveBillboardSkinDecision&&(f&&St(["jeeiSite.ad.GPT>Skin detectado en",r,"(campaignId",e.campaignId,") - se bloquea el sky"],zr),t._resolveBillboardSkinDecision(f),t._resolveBillboardSkinDecision=null,t._billboardSkinDecisionPromise=null)}})}},{key:"_setupTargeting",value:function(t,e,r,a){if(this._info){var s=Q.getMainId();this.googletag.pubads().setTargeting("seccion",[t]),this.googletag.pubads().setTargeting("subseccion",[e]),this.googletag.pubads().setTargeting("subseccion2",[r]),this.googletag.pubads().setTargeting("site",[a||""]),this.googletag.pubads().setTargeting("tipo",[""+Q.getType()]),this.googletag.pubads().setTargeting("etiqueta",Q.getTags().concat(Q.getFilterContentHashTag())),this.googletag.pubads().setTargeting("autor",[Q.getAuthor()||""]),this.googletag.pubads().setTargeting("estructura",[Q.getOpeningStructure()||""]),typeof s=="string"&&this.googletag.pubads().setTargeting("id",s)}else St(["jeeiSite.ad.GPT>> No se encuentra informacion de p\xE1gina"],zr);this._setupCitiserv(),this._setupEnvironmentTargeting()}},{key:"_setupCitiserv",value:function(){var t=decodeURIComponent("; ".concat(document.cookie)),e=t.split("; btrseg=");if(e.length>1){var r=e.pop().split(";").shift().split(",");P(["jeeiSite.ad.GPT>> targeting citiserv",r],zr),Array.isArray(r)&&r.length>0&&this.googletag.pubads().setTargeting("cservi_segments",r)}}},{key:"_setupEnvironmentTargeting",value:function(){var t,e,r=this,a=se.getInstance(),s=I,o=document.documentElement.lang||"es";this.googletag.pubads().setTargeting("environment",s.environmentGPT||""),this.googletag.pubads().setTargeting("device",s.isApp?"app":""),this.googletag.pubads().setTargeting("lang",[o]),this.googletag.pubads().setTargeting("usuario",[((t=s.ad)===null||t===void 0?void 0:t.userRolGPT)||a.getRoleForGpt()||""]);var l=(e=a.dataUser)===null||e===void 0?void 0:e.adAttributes;l&&Object.entries(l).forEach(function(u){var c=Te(u,2),f=c[0],d=c[1];d&&r.googletag.pubads().setTargeting(f,d)})}},{key:"_configureGPTSettings",value:function(){var t,e=en;this.googletag.pubads().disableInitialLoad(),this.googletag.pubads().enableSingleRequest(),n.getLazyType()===((t=e.LAZYLOAD)===null||t===void 0||(t=t.TYPES)===null||t===void 0?void 0:t.GOOGLETAG)&&this.googletag.pubads().enableLazyLoad({fetch
1MarginPercent:100,renderMarginPercent:50,mobileScaling:2})}},{key:"defineSlot",value:function(t,e){this._slots[e]&&(St(["jeeiSite.ad.GPT>defineSlot>DESTROY",t.path,t.size,e],zr),this.googletag.destroySlots([this._slots[e]]));var r=this.googletag.defineSlot(t.path,t.size,e);return r?(r.setTargeting("pos",[e]).setForceSafeFrame(t.safeFrame).addService(this.googletag.pubads()),this._slots[e]=r,this._slotsData[e]=t,P(["jeeiSite.ad.GPT>defineSlot",t.path,t.size,e],zr),r):(St(["jeeiSite.ad.GPT>defineSlot>NULL",t.path,e],zr),null)}},{key:"armBillboardSkinDecision",value:function(){var t=this;return this._billboardSkinDecisionPromise?this._billboardSkinDecisionPromise:(this._billboardSkinDecisionPromise=new Promise(function(e){t._resolveBillboardSkinDecision=e,window.setTimeout(function(){t._resolveBillboardSkinDecision===e&&(St(["jeeiSite.ad.GPT>armBillboardSkinDecision>timeout, GAM no renderiz\xF3 el Billboard a tiempo - se libera el sky"],zr),t._resolveBillboardSkinDecision=null,t._billboardSkinDecisionPromise=null,e(!1))},lA)}),this._billboardSkinDecisionPromise)}},{key:"displayAndRefresh",value:function(t,e){var r=this;this.googletag.cmd.push(function(){r.googletag.display(t),r.refresh(V({},t,e))})}},{key:"processWaitingAds",value:function(t){P(["jeeiSite.ad.GPT>processWaitingAds>"],zr),this._adsWaiting.length&&this._adsWaiting.forEach(function(e){return t(e)})}},{key:"displaySlotsWithoutBidders",value:function(){var t=this,e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];P(["jeeiSite.ad.GPT>displaySlotsWithoutBidders>"],zr);var r=Object.keys(this._slotsData).filter(function(a){return!t._slotsData[a].bidders&&e.indexOf(a)===-1});this._displayContainers(r)}},{key:"_displayContainer",value:function(t){var e=this,r=document.getElementById(t);if(this.googletag.display(t),r&&this.isInViewPort(r,this.OFFSET_Y))return this._slots[t];if(r){var a={timeout:0,observerConfig:{rootMargin:"".concat(this.OFFSET_Y,"px")}};Bi(r,a).then(function(){e.refresh(V({},t,e._slots[t]))})}return null}},{key:"_displayContainers",value:function(t){var e=this,r={};t.forEach(function(a){var s=e._displayContainer(a);s&&(r[a]=s)}),this.refresh(r)}},{key:"blockOrDisplaySlots",value:function(t,e){var r=this;if(e){var a=t.map(function(s){return r._slots[s]}).filter(Boolean);a.length&&(St(["jeeiSite.ad.GPT>blockOrDisplaySlots>DESTROY",t],zr),this.googletag.destroySlots(a));return}this._displayContainers(t)}},{key:"refresh",value:function(t){var e,r,a,s=window.location.hash,o=this._extractHashParameter(s,"gpt.refresh");if(o!=="false"){var l=I,u=(e=(r=l.ad)===null||r===void 0||(r=r.enableRefreshGPT)===null||r===void 0?void 0:r[Q.getSectionId()])!==null&&e!==void 0?e:(a=l.ad)===null||a===void 0||(a=a.enableRefreshGPT)===null||a===void 0?void 0:a.default;u&&(P(["jeeiSite.ad.GPT>refresh","Se visualizan con refresh las posiciones",t],zr),this.googletag.pubads().refresh(Object.values(t)))}}},{key:"_extractHashParameter",value:function(t,e){var r=new URLSearchParams(t.substr(1));return r.get(e)}},{key:"isInViewPort",value:function(t,e,r){var a,s=en;return n.getLazyType()!==((a=s.LAZYLOAD)===null||a===void 0||(a=a.TYPES)===null||a===void 0?void 0:a.NATIVE)||Cs(t,e,r)}},{key:"loadAriScript",value:function(t,e){var r=1e3,a=!1,s=function(){a||(a=!0,e())};setTimeout(s,r);var o=new Ke;o.listen(he.ON_IO_FINISH,s),o.listen(he.ON_IO_ERROR,s),o.load(t,!0,!1)}},{key:"loadScriptsBeforeGpt",value:function(){var t=document.location.protocol==="https:";this._loadCustomScripts(t)}},{key:"_loadCustomScripts",value:function(t){var e,r,a,s=I,o=(e=(r=s.ad)===null||r===void 0||(r=r.scriptsBeforeGPT)===null||r===void 0?void 0:r[Q.getSectionId()])!==null&&e!==void 0?e:(a=s.ad)===null||a===void 0||(a=a.scriptsBeforeGPT)===null||a===void 0?void 0:a.default;if(o){var l,u,c=new Ke,f=((l=s.ad)===null||l===void 0||(l=l.scriptsBeforeGPT)===null||l===void 0?void 0:l[Q.getSectionId()])||((u=s.ad)===null||u===void 0||(u=u.scriptsBeforeGPT)===null||u===void 0?void 0:u.default),d="".concat(t?"https:":"http:").concat(f);c.load(d,!0,!0)}}},{key:"addToWaitingQueue",value:function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;e?this._adsLazyWaiting.push(t):this._adsWaiting.push(t)}},{key:"setServiceEnabled",value:function(t){this._enableService=t}},{key:"getSlots",value:function(){return this._slots}},{key:"getSlotsData",value:function(){return this._slotsData}},{key:"getAllSlotsData",value:function(){return this._allSlotsData}},{key:"setAllSlotsData",value:function(t,e){this._allSlotsData[t]=e}},{key:"getInfo",value:function(){return this._info}},{key:"setInfo",value:function(t){this._info=t}},{key:"isServiceEnabled",value:function(){return this._enableService}},{key:"getAdsWaiting",value:function(){return this._adsWaiting}},{key:"getAdsLazyWaiting",value:function(){return this._adsLazyWaiting}}],[{key:"getLazyType",value:function(){var t,e,r,a=I,s=((t=a.ad)===null||t===void 0||(t=t.gpt)===null||t===void 0||(t=t.lazyload)===null||t===void 0?void 0:t[Q.getSectionId()])||((e
1=a.ad)===null||e===void 0||(e=e.gpt)===null||e===void 0||(e=e.lazyload)===null||e===void 0?void 0:e.default),o=en;if(s===!0){var l;s=(l=o.LAZYLOAD)===null||l===void 0||(l=l.TYPES)===null||l===void 0?void 0:l.GOOGLETAG}else if((r=o.LAZYLOAD)!==null&&r!==void 0&&r.TYPES&&Object.values(o.LAZYLOAD.TYPES).indexOf(s)===-1){var u;s=(u=o.LAZYLOAD)===null||u===void 0||(u=u.TYPES)===null||u===void 0?void 0:u.DISABLED}return s||"disabled"}}]),n}();T();Pr();wr();tn();J();X();Ge();var ju=fr(xr(),1);Xt();Se();_e();Ut();Kn();function Cp(n,i){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);i&&(e=e.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,e)}return t}function Lp(n){for(var i=1;i<arguments.length;i++){var t=arguments[i]!=null?arguments[i]:{};i%2?Cp(Object(t),!0).forEach(function(e){V(n,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Cp(Object(t)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})}return n}function uA(n,i){var t=typeof Symbol!="undefined"&&n[Symbol.iterator]||n["@@iterator"];if(!t){if(Array.isArray(n)||(t=cA(n))||i&&n&&typeof n.length=="number"){t&&(n=t);var e=0,r=function(){};return{s:r,n:function(){return e>=n.length?{done:!0}:{done:!1,value:n[e++]}},e:function(u){throw u},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){t=t.call(n)},n:function(){var u=t.next();return s=u.done,u},e:function(u){o=!0,a=u},f:function(){try{s||t.return==null||t.return()}finally{if(o)throw a}}}}function cA(n,i){if(n){if(typeof n=="string")return Rp(n,i);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Rp(n,i):void 0}}function Rp(n,i){(i==null||i>n.length)&&(i=n.length);for(var t=0,e=Array(i);t<i;t++)e[t]=n[t];return e}ne("AD");var ni="AD",Op=function(){function n(i){k(this,n),V(this,"PREBID_TIMEOUT",1e3),V(this,"APSTAG_TIMEOUT",1e3),V(this,"REFRESH_TIMEOUT",1200),this.gptCore=i,this.pbjs=window.pbjs||{},this.pbjs.que=this.pbjs.que||[],window.pbjs=this.pbjs}return A(n,[{key:"loadPrebid",value:function(){var t=this,e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=jn;if(r.hasBidders()){this._initApsTag();var a=new Ke,s="".concat(I.assets).concat("/assets_js/web/v2/","/vendors/prebid/prebid.js").concat("?v=1436");a.listen(he.ON_IO_ERROR,function(){return gr.getInstance().trackAdBlockUser(!0)}),a.load(s,!0,!0),this.pbjs.que.push(function(){t.pbjs.setConfig({enableSendAllBids:!0,priceGranularity:"dense",consentManagement:{gdpr:{cmpApi:"iab",timeout:8e3,defaultGdprScope:!0}},rubicon:{singleRequest:!0},userSync:{auctionDelay:0,filterSettings:{all:{bidders:"*",filter:"include"}},syncDelay:6e3,syncEnabled:!0,syncPerBidder:5,userIds:[{name:"identityLink",params:{pid:"14277",notUse3P:!1},storage:{type:"html5",name:"idl_env",expires:15,refreshInSeconds:1800}},{name:"pairId",params:{liveramp:{storageKey:"_lr_pairId"}}}]}}),t.pbjs.enableAnalytics([{provider:"atsAnalytics",options:{pid:"14277"}}].concat(nr(e)))})}}},{key:"addAdUnitToPrebid",value:function(t){var e=this;t.bidders&&this.pbjs.que.push(function(){e.pbjs.addAdUnits({code:t.container,mediaTypes:{banner:{sizes:t.size}},bids:t.bidders})})}},{key:"requestPrebid",value:function(){var i=ut(ju.default.mark(function e(){var r,a,s,o,l,u=arguments;return ju.default.wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(r=u.length>0&&u[0]!==void 0?u[0]:null,a=r||this.gptCore.getSlots(),s=this.gptCore.getSlotsData(),o=Object.fromEntries(Object.entries(a).filter(function(d){var h,v=Te(d,1),m=v[0];return(h=s[m])===null||h===void 0?void 0:h.bidders})),!Object.keys(o).length){f.next=8;break}return l=Object.keys(o),f.next=8,Promise.race([this._requestHeaderBids(l),this._refreshTimeoutPrebid(l)]);case 8:this.gptCore.refresh(o);case 9:case"end":return f.stop()}},e,this)}));function t(){return i.apply(this,arguments)}return t}()},{key:"_refreshTimeoutPrebid",value:function(t){var e=this;return new Promise(function(r){window.setTimeout(function(){P(["jeeiSite.ad.GPT>loadGPT> Timeout pbjs y apstag llamamos se resuelve Promesa"],ni),r({layer:t})},e.REFRESH_TIMEOUT)})}},{key:"_requestHeaderBids",value:function(){var t=this,e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return new Promise(function(r){P(["jeeiSite.ad.GPT>_requestHeaderBids>fetchBids AppsTag y pbjs"],ni);var a=function(h,v){return Array.isArray(h)?h.reduce(function(m,p){return m[p]=v[p],m},{}):h?V({},h,v[h]):v},s=a(e,t.gptCore.getSlotsData()),o=a(e,t.gptCore.getSlots()),l=function(h){var v=h.filter(function(m){var p;return(p=s[m])===null||p===void 0?void 0:p.apsSize}).map(function(m){return{slotID:s[m].container,slotName:s[m].path,sizes:s[m].apsSize}});return v.length?new Promise(function(m){window.apstag.fetchBids({slots:v,timeout:t.APSTAG_TIMEOUT},function(p){P(["jeeiSite.ad.GPT>_requestHeaderBids>fetchBids AppsTag completed"],ni),window.apstag.setDisplayBids(),m({layer:h,type:"aps",result:p||[]})})}):Promise.resolve({})},u=function(h,v){return new Promise(function(m){t.pbjs.que.push(function(){t.pbjs.requestBids({bidsBackHandler:function(g){P(["jeeiSite.ad.GPT>_requestHeaderBids>fetchBids pbjs completed"],ni),t.gptCore.googletag.cmd.push(function(){if(v)if(Array.isArray(v)){var E=uA(v),y;try{for(E.s();!(y=E.n()).done;){var _,b=y.value;(_=h[b])===null||_===void 0||_.updateTargetingFromMap(t.pbjs.getAdserverTargetingForAdUnitCode(b))}}catch(R){E.e(R)}finally{E.f()}}else{var C;(C=t.gptCore.getSlots()[v])===null||C===void 0||C.updateTargetingFromMap(t.pbjs.getAdserverTargetingForAdUnitCode(v))}else t.pbjs.setTargetingForGPTAsync();m({layer:v,type:"prebid",result:g||[]})})},timeout:t.PREBID_TIMEOUT})})})},c=u(o,e),f=l(Array.isArray(e)?e:Object.keys(s));return Promise.all([c,f]).then(function(){return r({layer:e})}).catch(function(d){return Dt(d,ni)})})}},{key:"_initApsTag",value:function(){var t=this,e=new Ke;this._implementApsBootstrap(),e.listen(he.ON_IO_FINISH,function(){P(["jeeiSite.ad.GPT>_initApsTag>
1 Scripts APS cargados exitosamente"],ni),t._initializeApstag(),P(["jeeiSite.ad.GPT>_initApsTag> Migraci\xF3n APS completada"],ni)},this),e.listen(he.ON_IO_ERROR,function(){Dt(["jeeiSite.ad.GPT>_initApsTag> Error cargando scripts APS"],ni)},this),e.load(["https://config.aps.amazon-adsystem.com/configs/3753","https://client.aps.amazon-adsystem.com/publisher.js"],!1,!0)}},{key:"_implementApsBootstrap",value:function(){P(["jeeiSite.ad.GPT>_implementApsBootstrap> Implementando bootstrap APS"],ni);var t=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"3753";window._aps=window._aps||new Map,window._aps.has(e)||window._aps.set(e,{queue:[],store:new Map([["listeners",new Map]])});var r={accountID:e,record:function(s,o){var l=this;return new Promise(function(u,c){window._aps.get(l.accountID).queue.push(new CustomEvent(s,{detail:Lp(Lp({},o),{},{resolve:u,reject:c})}))})},read:function(s){return this.record("bootstrap/store/willRead",{name:s}),window._aps.get(this.accountID).store.get(s)},run:function(s,o){var l;(l=window._aps.get("_system"))!==null&&l!==void 0&&l.store.get("listeners").has(s)?this.record(s,o):this.record("bootstrap/run/willDrop",{name:s,detail:o})},react:function(s,o){window._aps.get(this.accountID).store.get("listeners").set(s,o),this.record("bootstrap/react/didExecute",{name:s})}};return r.record("bootstrap/version/declare",{version:5}),r}();window.aps=t,P(["jeeiSite.ad.GPT>_implementApsBootstrap> Bootstrap APS implementado"],ni)}},{key:"_initializeApstag",value:function(){window.apstag&&typeof window.apstag.init=="function"&&window.apstag.init({pubID:"3753",adServer:"googletag"})}}]),n}();Xt();ne("AD");var wp="AD",Hu=["skyizq","skyder"],Br=function(){function n(){if(k(this,n),V(this,"_skinDecision",null),n._instance)return n._instance;this.gptCore=new Gu,this.gptBidding=new Op(this.gptCore),n._instance=this}return A(n,[{key:"_getAriUrl",value:function(){var t,e,r=(t=I.piano)===null||t===void 0?void 0:t.ari;return r!=null&&r.enabled&&(e=r.scriptUrl)!==null&&e!==void 0?e:null}},{key:"addSlot",value:function(t){var e=t.container,r=t.container_for_mobile,a=t.name;if(e.search(/^adv_paragraph_/ig)!==0){if(Me&&r){var s=document.getElementById(r),o=document.getElementById(e);if(s&&this.gptCore.getAllSlotsData()[r]){o==null||o.remove();return}else s&&o&&s.appendChild(o)}var l,u=jn;if(this.gptCore.getAllSlotsData()[e])l=this.gptCore.getAllSlotsData()[e];else{var c=a===void 0?!1:typeof a=="string"?a:!1;l=u.getSlot(e,this._isHome(),c)}if(l&&(this.gptCore.setAllSlotsData(e,l),!this._shouldRestrictSlot(l))){var f=document.getElementById(e);if(f){var d=l.path.search(/_BD/)!==-1||this.gptCore.isInViewPort(f,this.gptCore.OFFSET_Y);d?this._processSlot(l,e):this._setupLazyLoading(f,l,e)}}}}},{key:"_processSlot",value:function(t,e){var r=this;t.bidders&&this.gptBidding.addAdUnitToPrebid(t);var a=this.gptCore.defineSlot(t,e);return this.gptCore.isServiceEnabled()&&(t.bidders?this.gptBidding.requestPrebid(V({},e,a)):this._skinDecision&&Hu.indexOf(e)!==-1?this._skinDecision.then(function(s){return r.gptCore.blockOrDisplaySlots([e],s)}):this.gptCore.displayAndRefresh(e,a)),a}},{key:"_setupLazyLoading",value:function(t,e,r){var a=this,s={timeout:0,observerConfig:{rootMargin:"".concat(this.gptCore.OFFSET_Y,"px")}};Bi(t,s).then(function(){a._processSlot(e,r)})}},{key:"_shouldRestrictSlot",value:function(t){var e=se.getInstance();return!!(t.restrictAdServingByPosition&&!(e!=null&&e.isSubscriber())&&Q.isSuscriberContent()&&!Me)}},{key:"_initializeGPT",value:function(t,e,r,a){var s=this;this.gptCore.setupGoogleTag(t,e,r,a),this.gptCore.googletag.cmd.push(function(){var o;s.gptCore.processWaitingAds(function(u){return s.addSlot(u)});var l=Bu.some(function(u){return!!s.gptCore.getSlotsData()[u]});s._skinDecision=l?s.gptCore.armBillboardSkinDecision():null,s.gptBidding.requestPrebid(),s.gptCore.setServiceEnabled(!0),s.gptCore.displaySlotsWithoutBidders(l?Hu:[]),(o=s._skinDecision)===null||o===void 0||o.then(function(u){return s.gptCore.blockOrDisplaySlots(Hu,u)})})}},{key:"_loadScriptsAfterGpt",value:function(){var t,e=I,r=(t=e.ad)===null||t===void 0?void 0:t.scriptsAfterGPT;if(r){var a=Ar(r,r.default);a&&a.forEach(function(s){s.provider==="yieldbird"&&(window.ybConfiguration=window.ybConfiguration||{},window.ybConfiguration=Object.assign({},window.ybConfiguration,{integrationMethod:"open_tag"}),window.Yieldbird=window.Yieldbird||{},window.Yieldbird.cmd=window.Yieldbird.cmd||[]);var o=new Ke;o.load(s.url,!0,!1)})}}},{key:"_isHome",value:function(){var t,e=I,r=Q.getType();return((t=e.homePagesTypes)===null||t===void 0?void 0:t.indexOf(r))!==-1}},{key:"getSlots",value:function(){return this.gptCore.getSlots()}},{key:"getSlotsData",value:function(){return this.gptCore.getSlotsData()}},{key:"getAllSlotsData",value:function(){return this.gptCore.getAllSlotsData()}},{key:"getOffsetY",value:function(){return this.gptCore.OFFSET_Y}}],[{key:"getInstance",value:function(){return n._instance||(n._instance=new n),n._instance}},{key:"getLazyType",value:function(){return Gu.getLazyType()}},{key:"init",value:function(){var t,e,r,a,s=n.getInstance();P(["jeeiSite.ad.GPT>
1init","Tipo de LAZYLOAD aplicado: ".concat(n.getLazyType())],wp);var o=(t=window.jeef)===null||t===void 0?void 0:t.JeefEvents;o&&(o.on("ADADD",function(p){s.gptCore.isServiceEnabled()?s.addSlot(p):s.gptCore.addToWaitingQueue(p)}),o.on("ADLAZYADD",function(p){s.gptCore.isServiceEnabled()?s.addSlot(p):s.gptCore.addToWaitingQueue(p,!0)}));var l=I,u=or.getInstance();if((e=l.ad)!==null&&e!==void 0&&e.googleGpt&&u.mustHaveAds((r=l.ad)===null||r===void 0||(r=r.formatTypes)===null||r===void 0?void 0:r.GPT)){var c,f=Q.getMain()||{};s.gptCore.setInfo(f);var d=Array.isArray(f.section)&&((c=f.section[0])===null||c===void 0?void 0:c.name)!==""?f.section[0].name.toLowerCase():"general",h=n.getSubsectionName(f),v=h.subsectionName,m=h.subsection2Name;s._initializeGPT(d,v,m)}else P(["jeeiSite.ad.GPT>init> Publicidad desactivada por configuracion"],wp);return te.getInstance().trigger(((a=te.triggers)===null||a===void 0?void 0:a.ON_AD_READY)||"ON_AD_READY"),s._loadScriptsAfterGpt(),s}},{key:"loadGPT",value:function(){var t=n.getInstance();t.gptCore.loadScriptsBeforeGpt();var e=t._getAriUrl();return e?t.gptCore.loadAriScript(e,function(){t.gptCore.loadGPTScript(),t.gptBidding.loadPrebid([{provider:"pianoDmp"}])}):(t.gptCore.loadGPTScript(),t.gptBidding.loadPrebid()),t}},{key:"getSubsectionName",value:function(t){var e="",r="";return Array.isArray(t.section)&&(e=t.section.length>1?t.section[1].name.toLowerCase():"",r=t.section.length>2?t.section[2].name.toLowerCase():""),{subsectionName:e,subsection2Name:r}}},{key:"load",value:function(t,e){}},{key:"refresh",value:function(t){var e=n.getInstance();return e.gptCore.refresh(t)}}]),n}();window.__GPT=Br;Object.defineProperty(window,"__GPT_SLOTS",{get:function(){return Br.getInstance().getSlots()}});Object.defineProperty(window,"__GPT_SLOTSDATA",{get:function(){return Br.getInstance().getSlotsData()}});Object.defineProperty(window,"__GPT_OFFSET_Y",{get:function(){return Br.getInstance().getOffsetY()}});Ut();T();X();J();ue();oe();le();Ge();sr();function fA(n,i,t){return i=w(i),q(n,xp()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function xp(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(xp=function(){return!!n})()}var Ct=function(n){B(i,n);function i(){k(this,i);for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return fA(this,i,[].concat(e))}return A(i)}(Qe);V(Ct,"ON_MAIN_DATA_LOADED","onMainDataLoaded");V(Ct,"ON_DATA_AD_LOADED","onDataAdLoaded");V(Ct,"ON_MAIN_DATA_PROMOTIONS_LOADED","onMainDataPromotionsLoaded");V(Ct,"ON_MAIN_DATA_SWG_LOADED","onMainDataSWGLoaded");$e();Ma();T();Jt();ct("jeeiSite.dyn.DynManager");var Wn={components:{PODCAST:"podcast",LOCUTION:"locution",GALLERY:"gallery",GALLERY_NEWS:"gallerynews",ADLOAD:"adLoad",BOLSA_GRAPH:"bolsa_graph",BOLSA_MODULE:"bolsa_module",OPTA:"opta",COUNT_DOWN:"count_down",SPOTIM:"spot_im",INVERTIA_COMPANY_FINANCIAL_DATA:"invertia_company_financial_data",INVERTIA_COMPANY_REAL_TIME:"invertia_company_real_tiome",INVERTIA_COMPANY_MEDIUM_REAL_TIME:"invertia_company_mediaum_real_tiome",INVERTIA_COMPANY_TECH_ANALYSIS:"invertia_tech_analysis",INVERTIA_INDEXES:"invertia_indexes",INVERTIA_COMPANY_QUOTE:"invertia_quote",INVERTIA_COMPANY_FULL_QUOTE:"invertia_full_quote",INVERTIA_TAB_MARKET_OVERVIEW:"invertia_tab_market_oveview",POLL:"poll",OPTA_CYCLING_LIVE:"opta_cycling_live",OPTA_TENNIS_LIVE:"opta_tennis_live",OPTA_BASKET_LIVE:"opta_basket_live",OPTA_HANDBALL_LIVE:"opta_handball_live",POP:"pop",LIVEBLOG:"liveblog",ELECCIONES:"elecciones 26J",ADVSM_YOUTUBE:"advsm_youtube",CAROUSEL_GIFFS:"carousel_giffs",OPTA_SCORE:"opta_score",SURVEY_TOP_100:"survey_top_100",DARK_MODE:"dark_mode"},data:{SOCIAL:"social",LAZYLOAD:"lazy",INFO:"info",INFO_AD:"infoAd",COMMENTINFO:"commentInfo",COMMENTNUM:"commentNum",SOCIAL_FOLLOWERS:"socialFollowers",INFO_PROMOTIONS:"infoPromotions",INFO_SWG:"infoSWG",INFO_EDITIONV2_NEWS:"infoEditionv2News",FN:"fn"},triggers:{ON_LOAD:"load",ON_DOM_CONTENT_LOADED:"DOMContentLoaded",ON_DOM_CONTENT_LOADED2:"DOMContentLoaded2",ON_DOM_CONTENT_LOADED3:"DOMContentLoaded3",ON_AD_READY:"adReady",ON_WIZARD:"onWizard",ON_BASE_READY:"onBaseReady"}},Pp=Wn.triggers,Dp=Wn.data,Mp=Wn.components;window.jeeiSite.dyn.triggers=Wn.triggers;window.jeeiSite.dyn.data=Wn.data;window.jeeiSite.dyn.components=Wn.components;ft();T();function Ks(n,i){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,e=document.createElement("script");
1if(e.setAttribute("data-gdpr-applies","${gdpr}"),e.setAttribute("data-consent-string","${gdpr_consent}"),e.src=i,e.async=!0,t===!1){var r=document.getElementById(n);r.appendChild(e)}else document.body.appendChild(e)}T();J();X();var dA="taboola-below-article-thumbnails",hA=function(){function n(){k(this,n),this.loaded=!1,this.inFooter=!1,this.inSidebar=!1,this.inText={},this.iInText=1}return A(n,[{key:"putInFooter",value:function(t){if(!this.inFooter){this.inFooter=!0;var e=document.querySelector(".container__outbrain");if(e){var r=document.createElement("div");r.className="OUTBRAIN",r.setAttribute("data-src",window.location.href),r.setAttribute("data-widget-id",t),e.appendChild(r)}this.loadScript()}}},{key:"putInSidebar",value:function(){if(!this.inSidebar){this.inSidebar=!0;var t=document.getElementById("addweb3");if(t){var e=document.createElement("div");e.className="OUTBRAIN",e.setAttribute("data-src",window.location.href),e.setAttribute("data-widget-id","SB_1"),t.appendChild(e)}this.loadScript()}}},{key:"putInInText",value:function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!this.inText[t]){this.inText[t]=!0;var r=document.getElementById(t);if(e===null&&(e="MB_"+this.iInText),r){var a=document.createElement("div");a.className="OUTBRAIN",a.setAttribute("data-src",window.location.href),a.setAttribute("data-widget-id",e),r.appendChild(a),this.iInText++}this.loadScript()}}},{key:"loadScript",value:function(){if(this.loaded){var e;(e=window.OBR)===null||e===void 0||(e=e.extern)===null||e===void 0||e.researchWidget()}else{this.loaded=!0;var t=document.createElement("script");t.async=!0,t.src="https://widgets.outbrain.com/outbrain.js",document.body.appendChild(t)}}}],[{key:"load",value:function(){var t=document.getElementById(dA);if(t){var e=document.createElement("script");e.async=!0,e.src="https://widgets.outbrain.com/outbrain.js";var r=document.createElement("div");r.className="OUTBRAIN",r.setAttribute("data-src",window.location.href),r.setAttribute("data-widget-id","AR_1"),r.setAttribute("data-ob-template","ES_RedesLibre"),t.appendChild(r),document.body.appendChild(e)}}}]),n}(),Ws=new hA;T();$e();_e();pt();Se();var Np=!1,Fp={},Bp="STORYLAZYADS";ne(Bp);function vA(n){var i=I.ad.addoorConfig[n],t=Q.getSectionId();if(i){var e;return(e=i[t])!==null&&e!==void 0?e:i.default}}function pA(){if(!Np){Np=!0;var n=document.createElement("script");n.src="//pubtags.addoor.net/lib/contags/contags.js",document.head.appendChild(n)}}function Up(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,t;if(n instanceof HTMLElement?t=n:t=document.getElementById(n),t){var e=document.createElement("div");e.className="addoor-widget",i||(i=vA(n)),i&&(P(['jeeiSite.ad.addoor>createWidget", "Se crea widget Addoor: '.concat(i)],Bp),e.id="addoor-widget-".concat(i),t.appendChild(e),pA())}}function qs(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!Fp[n]){Fp[n]=!0;var t=Me?"mobile":"desktop";if(i){var e;Up(n,(e=i[t])!==null&&e!==void 0?e:i)}else Up(n)}}T();Ge();Se();function Gp(n,i){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);i&&(e=e.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,e)}return t}function jp(n){for(var i=1;i<arguments.length;i++){var t=arguments[i]!=null?arguments[i]:{};i%2?Gp(Object(t),!0).forEach(function(e){V(n,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Gp(Object(t)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})}return n}var Vu="GOOGLE_CSA";ne(Vu);var Hp=!1,Vp={};function Kp(){if(!Hp){Hp=!0,function(i,t){i[t]=i[t]||function(){(i[t].q=i[t].q||[]).push(arguments)},i[t].t=+new Date}(window,"_googCsa");var n=document.createElement("script");n.async=!0,n.src="https://www.google.com/adsense/search/ads.js",document.head.appendChild(n)}}function Ys(n,i){if(!Vp[n]){Vp[n]=!0;var t=document.getElementById(n);if(!(!t||!i)){Kp();var e=jp(jp({},i),{},{relatedSearchTargeting:"content",resultsPageBaseUrl:"https://www.elespanol.com/buscador/".concat(i.styleId?"?sid=".concat(i.styleId):""),resultsPageQueryParam:"text",hl:i.hl||"es"}),r={container:n,relatedSearches:10};e.styleId||console.warn('[GoogleCSA] styleId no configurado en el CMS para el contenedor "'.concat(n,'"')),P(["jeeiSite.ad.GoogleCSA>renderGoogleCSARelatedSearch>","Render ".concat(n)],Vu),window._googCsa("relatedsearch",e,r)}}}function Wp(n){var i=n==null?void 0:n.container;if(!(!i||!n)){var t=document.getElementById(i);if(t){var e=new URLSearchParams(window.location.search),r=e.get("text")||"";if(r){Kp();var a=e.get("sid")||n.styleId,s={pubId:n.pubId,styleId:a,hl:n.hl||"es",query:r,linkTarget:n.linkTarget||"_top"},o={container:i,width:n.width||"100%",maxTop:n.maxTop||4};a||console.warn('[GoogleCSA] styleId no configurado en el CMS para el contenedor "'.concat(i,'"')),P(["jeeiSite.ad.GoogleCSA>renderGoogleCSAAfs>","Render ".concat(i)],Vu),window._googCsa("ads",s,o)}}}}Oi();un();_e();T();_e();$e();Kn();pt();var mA="ExcoPlayerLoaded",gA=function(i){return i.mobile||i.desktop?Me?i.mobile:i.desktop:i},qp=function(i,t){var e,r=document.getElementById(i),a=gA(t);if(a){r.dataset.ratio=(e=a.ratio)!==null&&e!==void 0?e:"horizontal";var s=document.createElement("script");s.src=a.src,s.async=!0,s.className="exco-player",s.onload=function(){var l=Q.getSectionId(),u=l===I.sectionsIds.cocinillas;u&&gr.getInstance().trackConversion("exco_player_load"),jeef.JeefEvents.persistentEmit(mA,a.id)},r.appendChild(s);var o=document.createElement("div");o.id=a.id,r.appendChild(o)}};function nc(){nc=function(a,s){return new t(a,void 0,s)};var n=RegExp.prototype,i=new WeakMap;function t(r,a,s){var o=RegExp(r,a);return i.set(o,s||i.get(r)),kr(o,t.prototype)}function e(r,a){var s=i.get(a);return Object.keys(s).reduce(function(o,l){var u=s[l];if(typeof u=="number")o[l]=r[u];else{for(var c=0;r[u[c]]===void 0&&c+1<u.length;)c++;o[l]=r[u[c]]}return o},Object.create(null))}return B(t,RegExp),t.prototype.exec=function(r){var a=n.exec.call(this,r);if(a){a.groups=e(a,this);var s=a.indices;s&&(s.groups=e(s,this))}return a}
1,t.prototype[Symbol.replace]=function(r,a){if(typeof a=="string"){var s=i.get(this);return n[Symbol.replace].call(this,r,a.replace(/\$<([^>]+)>/g,function(l,u){var c=s[u];return"$"+(Array.isArray(c)?c.join("$"):c)}))}if(typeof a=="function"){var o=this;return n[Symbol.replace].call(this,r,function(){var l=arguments;return pe(l[l.length-1])!="object"&&(l=[].slice.call(l)).push(e(l,o)),a.apply(this,l)})}return n[Symbol.replace].call(this,r,a)},nc.apply(this,arguments)}ne("DYN");var yr="DYN",io=null;ct("jeeiSite.dyn.DynManager");var te=function(){function n(){k(this,n),this._loaded={},this._heaps={},this._pending=[],this._loader=new wh,this._flagInfoEventDispatched=!1,this._flagInfoPromotionsEventDispatched=!1,this._flagInfoSWGEventDispatched=!1,wg.apply(this,[])}return A(n,[{key:"getDynLoader",value:function(){return this._loader}},{key:"load",value:function(t){if(P(["jeeiSite.dyn.DynManager>loadComponents>",t],yr),Array.isArray(t)){var e=0,r=t.length,a;for(e;e<r;e++)a=t[e].trigger,!a||this._loaded[a]?(P(["jeeiSite.dyn.DynManager>loadComponents> Sin trigger asociado, o trigger ya disparado"],yr),xg.apply(this,[t[e]])):a in this._loaded?(P(["jeeiSite.dyn.DynManager>loadComponents> Encolamos en trigger",a],yr),this._heaps[a].push(t[e])):St(["jeeiSite.dyn.DynManager>loadComponents> Trigger incorrecto"],yr)}}},{key:"trigger",value:function(t){var e=0,r,a;if(t in this._loaded)for(P(["jeeiSite.dyn.DynManager>trigger> Trigger a",t],yr),this._loaded[t]=!0,r=this._heaps[t].length,e;e<r;e++)a=this._heaps[t].shift(),xg.apply(this,[a]);else St(["jeeiSite.dyn.DynManager>trigger> Trigger incorrecto",t],yr),zt(["jeeiSite.dyn.DynManager>trigger>",this._loaded],yr)}}],[{key:"getInstance",value:function(){return io||(P(["jeeiSite.dyn.DynManager>getInstance> Creando instancia por primera vez"],yr),io=new n,wg.apply(io)),io}}]),n}();window.jeeiSite.dyn.DynManager=te;te.triggers=Pp;te.components=Mp;te.data=Dp;var wg=function(){var i;for(i in te.triggers)this._loaded[te.triggers[i]]=!1,this._heaps[te.triggers[i]]=[];ie(this._loader,he.ON_IO_FINISH,UI,this)},xg=function(i){this._loader.isLoaded(i.type)?(P(["_checkToLoadComponent>_checkToLoadComponent> Dependencia encontrada",i.type],yr),Pg.apply(this,[i])):(P(["_checkToLoadComponent>_checkToLoadComponent> Dependencia no encontrada",i.type],yr),this._pending.push(i),this._loader.load(i))},NI=function(i){var t;if(i.search(/^adv_paragraph_/ig)===0){var e,r=Number((e=nc(/adv_paragraph_(\d+)/,{pos:1}).exec(i))===null||e===void 0||(e=e.groups)===null||e===void 0?void 0:e.pos)||1;return I.ad.formats["inText".concat(r)]==null&&(r=1),I.ad.formatTypes["IN_TEXT_".concat(r)]}return i==="relatedsearches1"?(t=I.ad.formatTypes)===null||t===void 0?void 0:t.RELATED_SEARCH:null},FI=function(i,t){var e=NI(i);if(e){var r=document.getElementById(i);Bi(r,{timeout:I.ad.lazyTimeout,observerConfig:{rootMargin:"-100px"}}).then(function(a){var s=a.timeout;s?P(["jeeiSite.ad>loadAd>onLazyLoad>then","".concat(i," se carga porque ha saltado timeout: ").concat(I.ad.lazyTimeout)],yr):P(["jeeiSite.ad>loadAd>onLazyLoad>then","".concat(i," se carga porque ha entrado en view")],yr)}).finally(function(){r==null||r.setAttribute("data-status","off");var a=or.getInstance().mustHaveAds(e);if(!a){r==null||r.remove();return}switch(a.provider){case I.ad.formats.providers.SUNMEDIA:Ks(i,a.conf);break;case I.ad.formats.providers.EXCO:qp(i,a.conf);break;case I.ad.formats.providers.ADDOOR:qs(i);break;case I.ad.formats.providers.OUTBRAIN:Ws.putInInText(i);break;case I.ad.formats.providers.GOOGLE_CSA:Ys(i,a.conf);break;case!1:r==null||r.remove();break}})}else Br.load(i,t)},Pg=function(i){var t=this;P(["_loadComponent>_loadComponent> Se inicia carga de componenete",i],yr);var e;switch(i.type){case te.components.PODCAST:Promise.resolve().then(function(){return Zp(),$p}).then(function(u){var c=u.default;c.createPodcast({id:i.params.id})});break;case te.components.LOCUTION:Promise.resolve().then(function(){return Yu(),qu}).then(function(u){var c=u.default;c.createLocution({id:i.container,url:i.params.url})});break;case te.components.GALLERY:Promise.resolve().then(function(){return km(),bm}).then(function(u){var c=u.default,f=jeeiSite.ui.Gallery.getInstance(),d=f.registerElement("gallery_"+i.params.id);d.init()});break;case te.components.GALLERY_NEWS:Promise.resolve().then(function(){return Rm(),Lm}).then(function(u){var c=u.default,f=jeeiSite.ui.GalleryNews.getInstance(),d=f.registerElement("gallerynews_"+i.params.id);d.init()});break;case te.components.ADLOAD:jn.add(i),Mt(i.params.mobile)||(i.params.mobile=!0),Mt(i.params.desktop)||(i.params.desktop=!0),Mt(i.params.tablet)||(i.params.tablet=!0),Mt(i.params.lazy)||
1(i.params.lazy=null),!i.params.mobile&&Tt.smartphone||!i.params.desktop&&!Me||!i.params.tablet&&Tt.tablet||jeef.JeefEvents.onPersistentEvent(At.ADS_CONSENT_GRANTED,function(){FI(i.container,i.params)});break;case te.components.POLL:var r=new jeeiSite.poll.View(new jeeiSite.poll.Model);r.setParams(i.params),r.init();break;case te.components.POP:var a=new jeeiSite.misc.Pop(i.params.url,i.params.targetID);a.setParams(i.params),a.init();break;case te.components.COUNT_DOWN:Promise.resolve().then(function(){return xm(),wm}).then(function(u){var c=u.default,f=new c(i.container,i.params.highDate,i.params.lessDate);f.setParams(i.params),f.init()});break;case te.components.SPOTIM:Promise.resolve().then(function(){return Hm(),jm}).then(function(u){var c=u.default,f=I.comments.spotIm.elespanol.spotId,d=I.comments.spotIm.elespanol.token;I.sectionsIds.invertia===Q.getSectionId()&&(f=I.comments.spotIm.invertia.spotId,d=I.comments.spotIm.invertia.token),new c().setContainerId(i.container).setSpotId(f).setToken(d).setPostId(i.params.idSpotIm).load()});break;case te.components.INVERTIA_COMPANY_FINANCIAL_DATA:Promise.resolve().then(function(){return Wm(),Km}).then(function(u){var c=u.default;new c(i.container,i.params.data,i.params.config).load()});break;case te.components.INVERTIA_COMPANY_REAL_TIME:Promise.resolve().then(function(){return zm(),Ym}).then(function(u){var c=u.default;new c(i.container,i.params.data,i.params.config).load()});break;case te.components.INVERTIA_COMPANY_TECH_ANALYSIS:Promise.resolve().then(function(){return Qm(),Xm}).then(function(u){var c=u.default;new c(i.container,i.params.data,i.params.config).load()});break;case te.components.INVERTIA_INDEXES:Promise.resolve().then(function(){return eg(),Zm}).then(function(u){var c=u.default;new c(i.container,i.params.data,i.params.config).load()});break;case te.components.INVERTIA_COMPANY_QUOTE:Promise.resolve().then(function(){return ig(),rg}).then(function(u){var c=u.default;new c(i.container,i.params.data,i.params.config).load()});break;case te.components.INVERTIA_COMPANY_FULL_QUOTE:Promise.resolve().then(function(){return sg(),ag}).then(function(u){var c=u.default;new c(i.container,i.params.data,i.params.config).load()});break;case te.components.INVERTIA_TAB_MARKET_OVERVIEW:Promise.resolve().then(function(){return ug(),lg}).then(function(u){var c=u.default;new c(i.container,i.params.data,i.params.config).load()});break;case te.components.INVERTIA_COMPANY_MEDIUM_REAL_TIME:Promise.resolve().then(function(){return dg(),fg}).then(function(u){var c=u.default;new c(i.container,i.params.data,i.params.config).load()});break;case te.components.BOLSA_MODULE:new jeeiSite.mod.bolsa.Module(i.container,i.params.id,i.params.opId,i.params.refresh,i.params.timeRefresh);break;case te.components.BOLSA_GRAPH:new jeeiSite.mod.bolsa.Graph(i.params.arr,i.container,i.params.id,i.params.opId,i.params.refresh,i.params.timeRefresh);break;case te.data.SOCIAL:var s=jeeiSite.social.Count.getInstance();s.setDataSource(jeeiSite.social.Count.DATA_SOURCE_LOCAL),s.add(i.params.data);break;case te.components.OPTA:new jeeiSite.mod.opta.Main(i.container);break;case te.components.OPTA_BASKET_LIVE:new jeeiSite.mod.opta.BasketLive(i.container);break;case te.components.OPTA_HANDBALL_LIVE:new jeeiSite.mod.opta.HandballLive(i.container);break;case te.components.OPTA_CYCLING_LIVE:new jeeiSite.mod.opta.CyclingLive(i.container);break;case te.components.OPTA_TENNIS_LIVE:new jeeiSite.mod.opta.TennisLive(i.container);break;case te.data.LAZYLOAD:Di.getInstance().add(i.params.img),Di.getInstance().fit();break;case te.data.INFO:jeeiSite.dyn.info.add(i.params.elements),jeeiSite.dyn.info.setMainId(i.params.main),setTimeout(function(){t._flagInfoEventDispatched||(t._flagInfoEventDispatched=!0,t._loader.dispatchEvent(new Ct(Ct.ON_MAIN_DATA_LOADED)))},4e3),i.params&&i.params.elements&&i.params.elements.length>0&&i.params.elements[0].data.type!=="tag"&&(this._flagInfoEventDispatched=!0,this._loader.dispatchEvent(new Ct(Ct.ON_MAIN_DATA_LOADED)));break;case te.data.INFO_AD:this._flagInfoEventDispatched=!0;var o=[{id:jeeiSite.dyn.info.getMainId(),data:Object.assign(i.params.elements.data,jeeiSite.dyn.info.getMain())}];
1jeeiSite.dyn.info.add(o),this._loader.dispatchEvent(new Ct(Ct.ON_DATA_AD_LOADED));break;case te.data.COMMENTINFO:var l=jeeiSite.comments.Model.getInstance();l.setComments(i.params.comments),l.setTotalComments(i.params.comments_total);break;case te.data.COMMENTNUM:jeeiSite.comments.Counter.processData(i.params.comments);break;case te.data.SOCIAL_FOLLOWERS:jeeiSite.cabeceras.main.dataFollowers=i.params;break;case te.components.LIVEBLOG:e=new jeeiSite.liveBlog.Dyn(i.params.id),e.init();break;case te.components.ELECCIONES:e=new jeeiSite.mod.elecciones.View(new jeeiSite.mod.elecciones.Model(i.params.wsOld,i.params.wsNew,i.params.refresh)),e.init();break;case te.components.ADVSM_YOUTUBE:Promise.resolve().then(function(){return pg(),vg}).then(function(u){var c=u.default;new c.init(i.params)});break;case te.components.CAROUSEL_GIFFS:Promise.resolve().then(function(){return gg(),mg}).then(function(u){var c=u.default;new c(i.params.id,i.params.paramsConfig).init()});break;case te.data.INFO_PROMOTIONS:jeeiSite.dyn.infoPromotions.add(i.params),setTimeout(function(){t._flagInfoPromotionsEventDispatched||(t._flagInfoPromotionsEventDispatched=!0,t._loader.dispatchEvent(new Ct(Ct.ON_MAIN_DATA_PROMOTIONS_LOADED)))},4e3);break;case te.data.INFO_SWG:jeeiSite.dyn.infoSWG.add(i.params),setTimeout(function(){t._flagInfoSWGEventDispatched||(t._flagInfoSWGEventDispatched=!0,t._loader.dispatchEvent(new Ct(Ct.ON_MAIN_DATA_SWG_LOADED)))},4e3);break;case te.data.INFO_EDITIONV2_NEWS:jeeiSite.dyn.infoEditionV2News=i.params,setTimeout(function(){jeef.JeefEvents.emit(ii.INFO_EDITIONV2_NEWS_COMPLETE)},2e3);break;case te.components.OPTA_SCORE:Promise.resolve().then(function(){return Ag(),kg}).then(function(u){var c=u.default,f=new c(i.params);f.processMetadata()});break;case te.components.SURVEY_TOP_100:Promise.resolve().then(function(){return Og(),Rg}).then(function(u){var c=u.default,f=new c(i.params);f.setContainer(i.container),f.init()});break;case te.components.DARK_MODE:oh(document.getElementById(i.container));break;case te.components.FN:i.function();default:St(["_loadComponent>_loadComponent> Tipo de objeto no encontrado"],yr)}},UI=function(i){var t=0,e=this._pending.length,r;for(t=0;t<e;
1t++)r=this._pending.shift(),this._loader.isLoaded(r.type)?Pg.apply(this,[r]):this._pending.push(r)};ft();T();wr();var ac=fr(xr(),1);Se();T();function Dg(n,i){var t=window.Didomi.getCurrentUserStatus();if(n){var e=t.vendors[n];if(!e||!e.enabled)return console.log("Consentimiento no dado para el vendor: ".concat(n)),!1}for(var r=0;r<i.length;r++){var a=i[r],s=t.purposes[a];if(!s||!s.enabled)return console.log("Consentimiento no dado para el prop\xF3sito: ".concat(a)),!1}return!0}function Mg(n,i){return new Promise(function(t,e){typeof window.Didomi=="undefined"?(window.didomiOnReady=window.didomiOnReady||[],window.didomiOnReady.push(function(r){t(Dg(n,i))})):t(Dg(n,i))})}var sc="lazy";ne(sc);var BI=0;function Ng(n){var i=document.createElement("script");i.type="text/javascript";try{var t,e;(t=(e=i).setHTML)!==null&&t!==void 0&&t.call(e,n.innerHTML)||(i.innerHTML=n.innerHTML)}catch(o){i.innerHTML=n.innerHTML}for(var r=0,a=Array.from(n.attributes);r<a.length;r++){var s=a[r];s.name!=="type"&&i.setAttribute(s.name,s.value)}n.parentNode&&n.parentNode.insertBefore(i,n),n.setAttribute("data-processed","true")}function Fg(){return oc.apply(this,arguments)}function oc(){return oc=ut(ac.default.mark(function n(){var i,t,e,r,a,s,o,l,u,c,f,d,h,v,m,p;return ac.default.wrap(function(E){for(;;)switch(E.prev=E.next){case 0:i=100,t=Array.from(document.querySelectorAll("script[type='lazy/javascript']")),e=0,r=t;case 3:if(!(e<r.length)){E.next=29;break}if(l=r[e],u="lazy_".concat(BI++),l.insertAdjacentHTML("beforebegin",'<div id="'.concat(u,'"></div>')),c=document.getElementById(u),f=((a=l.dataset)===null||a===void 0?void 0:a.lazyRootMargin)||"".concat(i,"px"),P(["CommonBase > _setLazyScripts",f,c],sc),!c){E.next=13;break}return E.next=13,Bi(c,{timeout:(d=l.dataset)!==null&&d!==void 0&&d.timeout?Number(l.dataset.timeout):!1,observerConfig:{rootMargin:f}});case 13:if(P(["CommonBase > _setLazyScripts > detectedIntersection",f,c],sc),!((s=l.dataset)!==null&&s!==void 0&&s.cmpVendor||(o=l.dataset)!==null&&o!==void 0&&o.cmpPurposes)){E.next=23;break}return v=l.dataset.cmpVendor||"",m=((h=l.dataset.cmpPurposes)===null||h===void 0?void 0:h.split(","))||[],E.next=19,Mg(v,m);case 19:p=E.sent,p?Ng(l):console.log("El script o elemento de ".concat(v," para prop\xF3sitos [").concat(m,"] no se ha cargado por falta de consentimiento.")),E.next=24;break;case 23:Ng(l);case 24:return E.next=26,GI();case 26:e++,E.next=3;break;case 29:case"end":return E.stop()}},n)})),oc.apply(this,arguments)}function GI(){return new Promise(function(n){setTimeout(n,0)})}_e();ou();T();vt();An();J();X();ue();oe();le();Se();pt();mt();_e();un();function uc(){uc=function(a,s){return new t(a,void 0,s)};var n=RegExp.prototype,i=new WeakMap;function t(r,a,s){var o=RegExp(r,a);return i.set(o,s||i.get(r)),kr(o,t.prototype)}function e(r,a){var s=i.get(a);return Object.keys(s).reduce(function(o,l){var u=s[l];if(typeof u=="number")o[l]=r[u];else{for(var c=0;r[u[c]]===void 0&&c+1<u.length;)c++;o[l]=r[u[c]]}return o},Object.create(null))}return B(t,RegExp),t.prototype.exec=function(r){var a=n.exec.call(this,r);if(a){a.groups=e(a,this);var s=a.indices;s&&(s.groups=e(s,this))}return a},t.prototype[Symbol.replace]=function(r,a){if(typeof a=="string"){var s=i.get(this);return n[Symbol.replace].call(this,r,a.replace(/\$<([^>]+)>/g,function(l,u){var c=s[u];return"$"+(Array.isArray(c)?c.join("$"):c)}))}if(typeof a=="function"){var o=this;return n[Symbol.replace].call(this,r,function(){var l=arguments;return pe(l[l.length-1])!="object"&&(l=[].slice.call(l)).push(e(l,o)),a.apply(this,l)})}return n[Symbol.replace].call(this,r,a)},uc.apply(this,arguments)}function jI(n,i,t){return i=w(i),q(n,Bg()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function Bg(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(Bg=function(){return!!n})()}var Ba="LAZYADS";ne(Ba);var lc=null,Ug={},Gg=function(n){B(i,n);function i(){var t;return k(this,i),t=jI(this,i),t._offset=i.OFFSET_BASE,t._elements=[],t.disabled=Tt.tablet&&!I.lazyAd.tablet||Tt.smartphone&&!I.lazyAd.mobile||!Me&&!I.lazyAd.desktop,I.ad.lazyTimeout&&setTimeout(function(){t.timeoutShowAds("pixel_adv"),t.timeoutShowAds("adv_paragraph")},I.ad.lazyTimeout),t.optionsObserver={root:null,rootMargin:"300px",threshold:[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1]},t}return A(i,[{key:"setDisabled",value:function(e){return this.disabled=e,this}},{key:"setOffset",value:function(e){this._offset=e}},{key:"add",value:function(e){P(["jeeiSite.ad.LazyAds>add>","Inyectando las dependencias, las im\xE1genes de lazyLoad"],Ba);var r=0;if(Object.prototype.toString.call(e)==="[object Array]")for(r;r<e.length;r++)this.addPush(e[r]);else typeof e=="string"&&this.addPush(e)}},{key:"addPush",value:function(e){var r=document.getElementById(e);if(r){this._elements.push(e);var a=new IntersectionObserver(function(s,o){s[0].isIntersecting===!0&&(o.unobserve(document.getElementById(s[0].target.id)),HI(s,o))},this.optionsObserver);a.observe(r)}}},{key:"timeoutShowAds",value:function(e){if(!this.disabled){var r=0,a=this._elements.length,s=0;for(r;r<a;r++)this._elements[s].search(e)>-1?(P(["jeeiSite.ad.LazyAds>timeoutShowAds>","timeout, mostramos la publi "+this._elements[s]],Ba),jg.apply(this,[this._elements[s]]),this._elements.splice(s,1)):s++}}}],[{key:"getInstance",value:function(){return P(["jeeiSite.ad.LazyAds>getInstance>","Obteniendo Singleton LazyAds"],Ba),lc||(lc=new i),lc}}]),i}(Re);var jg=function(i){if(!Ug[i])if(Ug[i]=!0,i.search(/^adv_paragraph_/ig)===0){var t,e=Number((t=uc(/adv_paragraph_(\d+)/,{pos:1}).exec(i))===null||t===void 0||(t=t.groups)===null||t===void 0?void 0:t.pos)||1;I.ad.formats["inText"+e]==null&&(e=1);var r=or.getInstance().mustHaveAds(I.ad.formatTypes["IN_TEXT_".concat(e)
1]);if(!r){var a;(a=document.getElementById(i))===null||a===void 0||a.remove();return}switch(r.provider){case I.ad.formats.providers.SUNMEDIA:Ks(i,r.conf);break;case I.ad.formats.providers.ADDOOR:qs(i);break;case I.ad.formats.providers.OUTBRAIN:Ws.putInInText(i);break;case I.ad.formats.providers.GOOGLE_CSA:Ys(i,r.conf);break}}else Br.load(i)},HI=function(i,t){i[0].isIntersecting===!0&&i[0].target.getAttribute("data-observer-show")!=="on"&&(i[0].target.setAttribute("data-observer-show","on"),i[0].target.setAttribute("data-status","off"),P(["jeeiSite.ad.LazyAds>intersectionCallback>","IntersectionObserver ".concat(i[0].target.id)],Ba),jg(i[0].target.id))};T();J();X();var cc,Hg=function(){function n(){var i=this;k(this,n);try{var t=window.matchMedia("(max-width: 576px)");t.addEventListener("change",function(a){return i.layout(a,"data-adaptative-mobile")});var e=window.matchMedia("(max-width: 768px)");e.addEventListener("change",function(a){return i.layout(a,"data-adaptative-tablet")});var r=window.matchMedia("(max-width: 1024px)");r.addEventListener("change",function(a){return i.layout(a,"data-adaptative-desktop")})}catch(a){}}return A(n,[{key:"init",value:function(){}},{key:"test",value:function(){var t=document.querySelector("section[class=section-fix-5-a]");t.setAttribute("data-adaptative","true"),t.setAttribute("data-adaptative-desktop","adaptative-desktop"),t.setAttribute("data-adaptative-mobile","adaptative-mobile"),t.setAttribute("data-adaptative-tablet","adaptative-tablet");var e=document.createElement("div");e.id="adaptative-mobile";var r=document.getElementById("home_aperture");r.prepend(e)}},{key:"layout",value:function(t,e){var r=document.querySelectorAll("[data-adaptative=true]");t.matches===!0?r.forEach(function(a){if(a.getAttribute(e)){if(!a.getAttribute("data-adaptative-original")){var s="adaptative_".concat(Math.round(Math.random()*1e7),"_adaptative_").concat(Math.round(Math.random()*1e7)),o=document.createElement("div");o.id=s,a.setAttribute("data-adaptative-original",s),a.parentNode.insertBefore(o,a)}var l=document.getElementById(a.getAttribute(e));l.appendChild(a)}}):r.forEach(function(a){if(a.getAttribute("data-adaptative-original")){var s=document.getElementById(a.getAttribute("data-adaptative-original"));s.parentNode.insertBefore(a,s.nextSibling)}})}}],[{key:"getInstane",value:function(){return cc||(cc=new n),cc}}]),n}();T();Pr();J();X();pc();pt();var mc,gc={scrollMode:"always",behavior:"auto",block:"nearest",inline:"center"},XI=window.scrollY,Xg=function(){function n(){k(this,n);var i=Array.from(document.querySelectorAll("[data-carrusel]"));i.forEach(function(t){new QI(t)})}return A(n,null,[{key:"getInstance",value:function(){return mc||(mc=new n),mc}}]),n}();var QI=function(){function n(i){k(this,n),this.carrousel=i,this.waitForCarruselInViewPort()}return A(n,[{key:"waitForCarruselInViewPort",value:function(){var t=this,e=new IntersectionObserver(function(r,a){r[0].intersectionRatio>.1&&(a.unobserve(t.carrousel),t.initCarrusel())},{threshold:[.1,.2,.3,.4,.5,.6,.7,.8,.9,1]});e.observe(this.carrousel)}},{key:"initCarrusel",value:function(){this.initItems()&&(Me&&this.carrousel.getAttribute("data-type-carousel")==="cards"&&this.initBuzz(),this.initControls()&&(this.initObserver(),this.init()))}},{key:"initForDesktop",value:function(){var t=this.carrousel.querySelector("[data-carrusel-viewport]");t.addEventListener("wheel",function(e){e.preventDefault(),t.scrollLeft+=e.deltaY>0?140:-140})}},{key:"init",value:function(){var t=this;this.items.forEach(function(r){t.observeItem.observe(r)});var e=function(a){return function(s){s.preventDefault();var o=t.getElementsInViewportByPosition();if(o.length!==0){var l,u;if(a==="next"){l=o[o.length-1].element;var c=t.items.indexOf(l);u=c+1}if(a==="previous"){l=o[0].element;var f=t.items.indexOf(l);u=f-1}var d=t.items[u]||null;d&&Jn(d,gc)}}};this.next.onclick=e("next"),this.previous.onclick=e("previous")}},{key:"initItems",value:function(){var t=this;this.items=Array.from(this.carrousel.querySelectorAll("[data-carrusel-item]"));var e=0;return this.items.map(function(r){return r.elespanol={},r.elespanol.firstItem=!1,r.elespanol.lastItem=!1,e===0&&(r.elespanol.firstItem=!0),e===t.items.length-1&&(r.elespanol.lastItem=!0),e++,r}),this.items.length>0}},{key:"initControls",value:function(){this.next=this.carrousel.querySelector("[data-carrusel-next]"),this.previous=this.carrousel.querySelector("[data-carrusel-prev]");
1var t=this.carrousel.querySelector("[data-carrusel-nav-controls]"),e=this.carrousel.getAttribute("data-carousel-type");return!this.next||!this.previous||!t?!1:(t.innerHTML="",e==="trends"||this.items.forEach(function(r){var a=document.createElement("button");a.className="controls__dot",a.onclick=function(){Jn(r,gc)},t.appendChild(a),r.elespanol.dot=a}),!0)}},{key:"getElementsInViewport",value:function(){var t=[];for(var e in this.items)this.items[e].elespanol.dot.getAttribute("data-status")==="on"&&t.push({num:e,element:this.items[e]});return t}},{key:"getElementsInViewportByPosition",value:function(){var t=[],e=this.carrousel.querySelector("[data-carrusel-viewport]"),r=e.getBoundingClientRect();return this.items.forEach(function(a,s){var o=a.getBoundingClientRect();o.left>=r.left&&o.right<=r.right&&t.push({num:s,element:a})}),t}},{key:"initObserver",value:function(){var t=this;this.observeItem=new IntersectionObserver(function(e,r){t.next.setAttribute("data-status","on"),t.previous.setAttribute("data-status","on"),e.forEach(function(a){a.intersectionRatio>.9?(a.target.elespanol.dot&&(a.target.elespanol.dot.setAttribute("data-status","on"),t.isInViewport(a.target.elespanol.dot.getBoundingClientRect())&&Jn(a.target.elespanol.dot,gc)),a.target.elespanol.lastItem&&t.next.setAttribute("data-status","off"),a.target.elespanol.firstItem&&t.previous.setAttribute("data-status","off")):a.target.elespanol.dot&&a.target.elespanol.dot.setAttribute("data-status","off")})},{root:this.carrousel.querySelector("[data-carrusel-viewport]"),threshold:[.9,1]})}},{key:"initBuzz",value:function(){var t={root:null,rootMargin:"50px",threshold:1},e=new IntersectionObserver(function(r,a){var s=Te(r,1),o=s[0];o.isIntersecting&&o.intersectionRatio>0&&window.scrollY>XI+window.innerHeight&&(a.unobserve(o.target),setTimeout(function(){o.target.querySelector("[data-carrusel-viewport]").setAttribute("data-buzz","on")},1e3))},t);e.observe(this.carrousel)}},{key:"isInViewport",value:function(t){var e=t;return e.top>=0&&e.left>=0&&e.right<=window.innerWidth&&e.bottom<=window.innerHeight}}]),n}();T();J();X();var Qg=function(){var i=Array.from(document.querySelectorAll("video[loop]"));i.forEach(function(t){new $I(t)})},$I=function(){function n(i){k(this,n),this.video=i,this.watchForPreload(),this.watchForPlayPlay()}return A(n,[{key:"watchForPreload",value:function(){var t=this,e=new IntersectionObserver(function(r,a){r[0].isIntersecting===!0&&(t.preload(),a.unobserve(t.video))},{rootMargin:"200px"});e.observe(this.video)}},{key:"watchForPlayPlay",value:function(){var t=this,e=new IntersectionObserver(function(r,a){r[0].isIntersecting===!0?t.play():t.pause()},{threshold:[.3,.4,.5,.6,.7,.8,.9,1]});e.observe(this.video)}},{key:"pause",value:function(){this.video.pause()}},{key:"preload",value:function(){this.video.preload=!0}},{key:"play",value:function(){this.video.play()}}]),n}();T();wr();var Ha=fr(xr(),1);ze();Oi();T();J();X();Xt();ze();Ut();_e();T();dt();Se();var ZI=[],eC=10,dn="nav",tC="ind.navTopics",Hi="_",Ga="reg",yc="anon",$g="sus",so=se.getInstance(),ja="SegmentationIndigitall";ne(ja);function rC(n){var i=location.pathname.replace(/\.html/g,"").replace(/\./g,"").split("/").filter(function(t){return t.length>0});return i.length==0||(i=i.map(function(t,e){for(var r=t,a=e-1;a>=0;a--)r=i[a]+Hi+r;return dn+Hi+r}).filter(function(t){return n.includes(t)})),i}function iC(){return location.hostname.replace(/\./g,"")}function nC(){var n=[],i=[],t=so._roles[Ga]!==void 0?Ga:yc,e=t===Ga?yc:Ga;return so.hasAnySubscriptionForThisSite()?(n.push(dn+Hi+$g),i.push(dn+Hi+Ga),i.push(dn+Hi+yc)):(n.push(dn+Hi+t),i.push(dn+Hi+e),i.push(dn+Hi+$g)),{topicsOn:n,topicsOff:i}}function Zg(n,i){var t=i.filter(function(r){return!r.subscribed}).map(function(r){return r.code}),e=n.filter(function(r){return t.includes(r)});return e}function aC(n,i,t){for(var e=[],r=[],a=JSON.parse(localStorage.getItem(i)||"[]"),s=0;s<n.length;s++){var o=n[s];o!==""&&o!=null&&!a.includes(o)&&(a.push(o),a.length>t&&(r.push(a[0]),a.splice(0,1)),localStorage.setItem(i,JSON.stringify(a)),e.push(o))}return{topicsOn:e,topicsOff:r}}function ao(n,i){for(var t={},e=n.length-1;e>=0;--e)t[n[e]]=n[e];for(var e=i.length-1;e>=0;--e)t[i[e]]=i[e];var r=[];for(var a in t)t.hasOwnProperty(a)&&r.push(t[a]);return r}function _c(n,i){n.push=="granted"&&indigitall.topicsList(function(t){var e=t,r=t.map(function(f){return f.code}),a=rC(r);
1a=Zg(a,e);var s=aC(a,tC,eC),o=iC();o=Zg([o],e);var l=nC(),u=ao(s.topicsOn,o);u=ao(u,ZI),u=ao(u,l.topicsOn);var c=ao(s.topicsOff,l.topicsOff);P(["segmentation>onIndigitallInitialized>","Topics a subscribir (topicsOn)",u],ja),P(["segmentation>onIndigitallInitialized>","Topics a desubscribir (topicsOff)",c],ja),c.length>0?indigitall.topicsUnsubscribe(c,function(){u.length>0&&indigitall.topicsSubscribe(u)}):u.length>0&&indigitall.topicsSubscribe(u),so.getUid()&&indigitall.setExternalCode(so.getUid(),function(f){P(["segmentation>onIndigitallInitialized>","C\xF3digo externo asignado correctamente",f],ja)},function(f){P(["segmentation>onIndigitallInitialized>","Error al asignar el c\xF3digo externo",f.message],ja)})})}var sC="".concat(I.assets).concat("/assets_js/web/v2/","/vendors/indigitall/sdk.min.js"),ey=function(){function n(){k(this,n)}return A(n,null,[{key:"load",value:function(){var t=new Ke;t.load(sC,!0),ie(t,he.ON_IO_FINISH,n._onLoad,this)}},{key:"_onLoad",value:function(){var t;(t=I.indigitall)!==null&&t!==void 0&&t.appKey&&indigitall.init({appKey:I.indigitall.appKey,urlDeviceApi:"https://eu2.device-api.indigitall.com/v1",workerPath:"/indigitall/service-worker.js",requestLocation:!0,onInitialized:_c})}}]),n}();yi();_e();Se();su();yl();Os();ne("DIDOMIEE");var ty="DIDOMIEE",oo=!1,ry=te.getInstance().getDynLoader();ie(ry,Ct.ON_DATA_AD_LOADED,function(){oo=!0});ie(ry,Ct.ON_MAIN_DATA_LOADED,function(){oo=!0});function oC(){return Ec.apply(this,arguments)}function Ec(){return Ec=ut(Ha.default.mark(function n(){return Ha.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(oo){t.next=5;break}return t.next=3,iy(30);case 3:t.next=0;break;case 5:return ht.getInstance().loadVSComposerData(),ht.getInstance().load(),t.abrupt("return",!0);case 8:case"end":return t.stop()}},n)})),Ec.apply(this,arguments)}function lC(){return Sc.apply(this,arguments)}function Sc(){return Sc=ut(Ha.default.mark(function n(){return Ha.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(oo){t.next=5;break}return t.next=3,iy(30);case 3:t.next=0;break;case 5:return Br.init(),t.abrupt("return",!0);case 7:case"end":return t.stop()}},n)})),Sc.apply(this,arguments)}function iy(n){return new Promise(function(i){setTimeout(function(){return i(!0)},n)})}function uC(){var n,i=ps(),t=i.prefix,e=window.location.hostname.slice(t.length);(n=I.allowedDomains)!==null&&n!==void 0&&n.some(function(r){return e===r})&&(Qh(!0),cC())}uC();function cC(){var n=!!I.ad.disable;I.ad.disable=!0,jeef.JeefEvents.onPersistentEvent(it.PIANO_LOAD,function(){I.ad.disable=n,I.isApp||(P(["jeeiSite.sec.DidomiEE>init> Piano"],ty),oC())}),jeef.JeefEvents.onPersistentEvent(it.INDIGITALL_LOAD,function(){I.isApp||ey.load()}),jeef.JeefEvents.onPersistentEvent(it.GPT_INIT,function(){I.ad.disable=n,P(["jeeiSite.sec.DidomiEE>init> GPT"],ty),jeef.JeefEvents.onPersistentEvent(At.ADS_CONSENT_GRANTED,function(){lC()})}),jeef.JeefEvents.onPersistentEvent(it.AD_DISABLE,function(){I.ad.disable=!1})}T();Ge();wr();J();X();ue();oe();le();Ms();var Va=fr(xr(),1);T();var ny=function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:30;return new Promise(function(t){setTimeout(function(){t(!0)},i)})};_e();function ay(n,i){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);i&&(e=e.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,e)}return t}function fC(n){for(var i=1;i<arguments.length;i++){var t=arguments[i]!=null?arguments[i]:{};i%2?ay(Object(t),!0).forEach(function(e){V(n,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ay(Object(t)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})}return n}function dC(n,i,t){return i=w(i),q(n,oy()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function oy(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(oy=function(){return!!n})()}window.customElements&&(window.customElements.define("elespanol-pdf-viewer",function(n){B(i,n);function i(){return k(this,i),dC(this,i)}
1return A(i,[{key:"connectedCallback",value:function(){var e=this;if(!this.getAttribute("src"))return!1;var r=document.createElement("script");r.type="text/javascript",typeof globalThis=="undefined"&&(window.globalThis=window),r.src="".concat(I.assets).concat("/assets_js/web/v2/","/vendors/pdf/pdf.js"),this.appendChild(r),setTimeout(function(){new sy(e.getAttribute("src"),e)},0)}}]),i}(Fr(HTMLElement))),sy=function(){function n(i,t){k(this,n),this.url=i,this.mainComponent=t,this.preInit()}return A(n,[{key:"preInit",value:function(){var i=ut(Va.default.mark(function e(){return Va.default.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(!window["pdfjs-dist/build/pdf"]){a.next=4;break}this.init(),a.next=7;break;case 4:return a.next=6,ny(100);case 6:this.preInit();case 7:case"end":return a.stop()}},e,this)}));function t(){return i.apply(this,arguments)}return t}()},{key:"init",value:function(){this.pdfjsLib=window["pdfjs-dist/build/pdf"],this.pdfjsLib.GlobalWorkerOptions.workerSrc="".concat(I.assets).concat("/assets_js/web/v2/","/vendors/pdf/pdf.worker.js"),this.pdfDoc=null,this.renderAll=!1,this.canvasWidth=360,this.observing=!1,this.observed=[],this.totalPages=0,this.createHtml(this.mainComponent),this.getDocument()}},{key:"getDocument",value:function(){var t=this;this.pdfjsLib.getDocument(this.url).promise.then(function(){var e=ut(Va.default.mark(function r(a){var s,o;return Va.default.wrap(function(u){for(;;)switch(u.prev=u.next){case 0:t.pdfDoc=a,s=1;case 2:if(!(s<=t.pdfDoc.numPages)){u.next=14;break}return t.totalPages=s,t.setNumPage(1),o=document.createElement("canvas"),o.setAttribute("data-page",s),o.className="pdf-page-canvas",t.mainDiv.appendChild(o),u.next=11,t.renderPage(s,o);case 11:s++,u.next=2;break;case 14:t.renderAll=!0;case 15:case"end":return u.stop()}},r)}));return function(r){return e.apply(this,arguments)}}())}},{key:"renderPage",value:function(t,e){var r=this;return new Promise(function(a,s){r.pdfDoc.getPage(t).then(function(o){var l=o.getViewport({scale:2});e.height=l.height,e.width=l.width,o.render({canvasContext:e.getContext("2d"),viewport:l}).promise.then(function(u){r.observeCanvas(e),a(!0)})})})}},{key:"observeCanvas",value:function(t){var e=this,r=new IntersectionObserver(function(a,s){a[0].isIntersecting===!0&&(e.observed.push({pageNumber:t.getAttribute("data-page"),intersectionRatio:a[0].intersectionRatio}),e.observing||e.renderAll&&(e.observing=!0,setTimeout(function(){var o={intersectionRatio:0};e.observed.forEach(function(l){l.intersectionRatio>o.intersectionRatio&&(o=fC({},l))}),e.observed=[],e.observing=!1,e.setNumPage(o.pageNumber)},100)))},{root:this.mainDiv,threshold:[.02,.05,.1,.2,.3,.4,.5,.6,.7,.8,.9,1]});r.observe(t)}},{key:"zoomIn",value:function(){var t=this;this.canvasWidth+=200,document.querySelectorAll(".pdf-page-canvas").forEach(function(e){return e.style.width="".concat(t.canvasWidth,"px")})}},{key:"zoomOut",value:function(){var t=this;this.canvasWidth-=200,document.querySelectorAll(".pdf-page-canvas").forEach(function(e){return e.style.width="".concat(t.canvasWidth,"px")})}},{key:"setNumPage",value:function(t){this.numPage.innerHTML="p\xE1gina ".concat(t," / ").concat(this.totalPages)}},{key:"createHtml",value:function(t){var e=this,r=o("div");r.style="height: 500px; width: 100%";var a=o("div",!1,"pdf-nav-row");r.appendChild(a),this.numPage=o("span"),a.appendChild(this.numPage);var s=o("button","Descargar","pdf-nav-button");s.onclick=function(){hC(e.url)},a.appendChild(s),this.mainDiv=o("div",!1,"pdf-viewer"),r.appendChild(this.mainDiv),t.innerHTML="<style>\n .pdf-viewer { width: 100%; height: 100%; background: rgba(0, 0, 0, 0.1); overflow: auto; }\n .pdf-page-canvas { display: block; margin: 5px auto; border: 1px solid rgba(0, 0, 0, 0.2); width: 90%; }\n .pdf-nav-row { font-size: .8em; height: 20px; background-color: aliceblue; margin: 5px; display: flex; flex-flow: row wrap; justify-content: center; justify-content: space-around; }\n .pdf-nav-button { }\n </style>",t.appendChild(r);function o(l){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,f=document.createElement(l);return c&&(f.className=c),u&&(f.innerHTML=u),f}}}]),n}());var sy;function hC(n){fetch(n).then(function(i){return i.blob()}).then(function(i){var t=window.URL.createObjectURL(i),e=document.createElement("a");e.style.display="none",e.href=t,e.download=t.split("/")[t.split("/").length-1],document.body.appendChild(e),e.click(),window.URL.revokeObjectURL(t)}).catch(function(){return console.log("download error")})}function xx(n,i,t){return i=w(i),q(n,LE()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function LE(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(LE=function(){return!!n})()}var RE="COMMONBASE";ne(RE);var OE=function(n){B(i,n);function i(){var t;return k(this,i),t=xx(this,i),ev(),t._domLoad=!1,t._lazy=Di.getInstance(),t._lazyAds=Gg.getInstance(),t._audioManager=null,t}return A(i,[{key:"init",value:function(){var e=this,r,a,s;return this._lazy.setOffset(I.lazyOffset),P(["Cargando la instancia principal"],RE),ie(te.getInstance()._loader,Ct.ON_MAIN_DATA_LOADED,function(){e._onMetadataLoaded()}),ie(te.getInstance()._loader,Ct.ON_DATA_AD_LOADED,function(){e._onMetadataLoaded()}),jeef.JeefEvents.once(At.TRIGGER_DIDOMI,function(){e._onDidomiTrigger()}),window.jeeiSite.dyn.DOMContentLoaded===!0?this._onDOMLoad(this):ie(document,"DOMContentLoaded",function(o){e._onDOMLoad(o)}),this._setupLoadListener(),this._initPlatform(),(r=I.content)!==null&&r!==void 0&&(r=r.data)!==null&&r!==void 0&&r.audio&&Promise.resolve().then(function(){return Yu(),qu}).then(function(o){e._audioManager=o.default}),(a=I.cookiewall)!==null&&a!==void 0&&a.enabled&&((s=I.cookiewall)===null||s===void 0?void 0:s.provider)==="contentPass"&&Promise.resolve().then(function(){return cy(),uy}).then(function(o){var l=o.init,u=I.cookiewall.configuration,c=u.property_id,f=u.baseUrl;l(c,f)}),this}},{key:"_setupLoadListener",value:function(){var e=this;ie(window,"load",function(r){e._onLoad(r)})}},{key:"_initPlatform",value:function(){}},{key:"_onDidomiTrigger",value:function(){}},{key:"_onMetadataLoaded",value:function(){}},{key:"_beforeDOMLoad",value:function(e){}},{key:"_afterDOMLoad",value:function(e){}},{key:"_onClickPlatform",value:function(e,r,a,s){}},{key:"_beforeLoad",value:function(e){}},{key:"_afterLoad",value:function(e){}},{key:"_onDOMLoad",value:function(e){var r=this,a,s;if(this._beforeDOMLoad(e),window.jeeiSite.dyn.toLoad)for(var o in window.jeeiSite.dyn.toLoad)te.getInstance().load(window.jeeiSite.dyn.toLoad[o]);this._domLoad=!0,ie(document,"click",function(c){r._onClick(c)}),this._lazy.fit(),te.getInstance().trigger(te.triggers.ON_DOM_CONTENT_LOADED),te.getInstance().trigger(te.triggers.ON_DOM_CONTENT_LOADED2),te.getInstance().trigger(te.triggers.ON_DOM_CONTENT_LOADED3),e.type=de.ON_DOM_CONTENT_LOADED,this.dispatchEvent(e);var l=document.getElementById("alert_container_js");l&&new _h(I.alertsInterval.home),Fg(),document.getElementById("age_modal")&&Promise.resolve().then(function(){return vy(),hy}).then(function(c){r._ageVerification=new c.default,r._ageVerification.init()}),document.getElementById("slider_header")&&Promise.resolve().then(function(){return yy(),gy}).then(function(c){r._sliderHeader=new c.default,r._sliderHeader.init()});var u=((a=(s=I.content)===null||s===void 0?void 0:s.modules)!==null&&a!==void 0?a:[]).filter(function(c){return c.type==="videoSlider"&&c.id});u.length&&Promise.resolve().then(function(){return CE(),IE}).then(function(c){var f=c.default;u.forEach(function(d){return new f().init({id:d.id})})}),Hg.getInstane().init(),Xg.getInstance(),Qg(),setTimeout(function(){te.getInstance().trigger(te.triggers.ON_BASE_READY)},100),this._afterDOMLoad(e)}},{key:"_onClick",value:function(e){var r=Vt("data-type",e.target,e.currentTarget),a=Vt("data-module-type",e.target,document,"locution"),s="",o="";r&&(s=r[1],o=r[0].getAttribute("data-subtype")),this._onClickPlatform(e,r,s,o)!==!1&&(a[0]&&this._audioManager&&this._audioManager.sendClick(a[0],e),e.type=de.ON_DOM_CLICK,this.dispatchEvent(e))}},{key:"_onLoad",value:function(e){this._beforeLoad(e),e.type=de.ON_DOM_LOAD,this.dispatchEvent(e),this._afterLoad(e)}}]),i}(Re);un();T();J();X();_e();un();var wE=function(){function n(){k(this,n)}return A(n,[{key:"init",value:function(){var t=or.getInstance().mustHaveAds(I.ad.formatTypes.GPT),e=!I.ad.googleGpt||!t;if(e){var r=document.getElementById("fbody");r instanceof HTMLElement&&r.setAttribute("data-ad-gpt","off")}}},{key:"checkLoadAds",value:function(){var t=or.getInstance().mustHaveAds(I.ad.formatTypes.GPT,I.ad.gpt.position.STICKY),e=I.ad.googleGpt&&I.ad.sticky&&t;return!!e}}]),n}();Na();Vn();Au();T();J();X();_e();var xE=!1,PE=function(){function n(){k(this,n)}return A(n,null,[{key:"loadLiveRampScripts",value:function(t){var e=I.stats.liveRamp;if(!xE&&!e.disabled){var r=document.head;if(r){var a=e.preloadSrc,s=e.src;if(a){var o=document.createElement("link");o.rel="preload",o.href=a,o.as="script",r.appendChild(o)}if(s){var l=document.createElement("script");l.src="".concat(s).concat("?v=1436"),l.async=!0,l.defer=!0,l.onload=function(){xE=!0,window.addEventListener("envelopeModuleReady",function(){window.ats&&window.ats.setAdditionalData({type:"emailHashes",id:[t]})})},r.appendChild(l)}}}}}]),n}();
1dt();pi();Ca();yi();Un();zn();En();Rs();T();Ge();wr();var Df=fr(xr(),1);dt();Xt();Ca();$e();pt();_e();Ma();function DE(n,i){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);i&&(e=e.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,e)}return t}function Px(n){for(var i=1;i<arguments.length;i++){var t=arguments[i]!=null?arguments[i]:{};i%2?DE(Object(t),!0).forEach(function(e){V(n,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):DE(Object(t)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})}return n}var ME=I.user.userRoutes.stage||null,Yo={google_credential:null,google_credential_entitlements:null},NE=function(){if(se.getInstance().isAnonymous()===!0&&Fx()&&I.user.googleOneTap.active&&!(Q.isSuscriberContent()&&Me)){var i=new Ke,t="https://accounts.google.com/gsi/client";i.load(t,!0,!0);var e=document.createElement("div");e.id="g_id_onload",e.setAttribute("data-client_id","767219290479-km007m94ujb1ihr2o0jcgjfemll7mbsh.apps.googleusercontent.com"),e.setAttribute("data-context","signin"),e.setAttribute("data-callback","googleLoginEndpoint"),e.setAttribute("data-close_on_tap_outside","false"),e.setAttribute("data-auto_select","true"),e.setAttribute("class","login-google-got"),document.body.appendChild(e),window.googleLoginEndpoint=function(r){Yo.google_credential=r.credential,FE({google_credential:r.credential,scope:I.GoogleRRME.scopeGOT,originLoad:ME})}}};function Dx(n){return Mf.apply(this,arguments)}function Mf(){return Mf=ut(Df.default.mark(function n(i){var t,e,r;return Df.default.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:try{console.log("respuesta de backend",i),i.response.success===!1&&i.response.reason==="complex-credentials"&&Mx(),se.getInstance().refreshUser(),Mi(),i.response.success===!0&&i.response.type==="register"&&(jeef.JeefEvents.emit(ii.ON_REGISTER_COMPLETE),(t=I.user.onboarding)!==null&&t!==void 0&&t.active&&!((e=I.user.onboarding.excludedRegistrationPaths)!==null&&e!==void 0?e:[]).some(function(o){return window.location.pathname.includes(o)})&&(r=new URL(I.user.userRoutes.onBoardingRegister),r.searchParams.set("callback",window.location.href),window.location.href=r.toString()))}catch(o){console.error(o)}case 1:case"end":return s.stop()}},n)})),Mf.apply(this,arguments)}function Mx(){var n=google.accounts.oauth2.initTokenClient({client_id:"767219290479-km007m94ujb1ihr2o0jcgjfemll7mbsh.apps.googleusercontent.com",scope:"https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/subscribewithgoogle.publications.entitlements.readonly",callback:function(t){Yo.google_credential_entitlements=t.access_token,FE({google_credential:Yo.google_credential,google_credential_entitlements:Yo.google_credential_entitlements,grant:"complex",originLoad:ME})}});n.requestAccessToken({prompt:"consent"})}function FE(n){console.log("enviamos token",n),fetch(I.user.userRoutes.gotGae,{method:"POST",body:JSON.stringify(n),credentials:"include",headers:{"X-Requested-With":"XMLHttpRequest"}}).then(function(i){return i.json()}).then(function(i){return Dx({response:Px({},i)})}).catch(function(i){return Nx(i)})}function Nx(n){console.log("got error",n)}function Fx(){return!!(window.location.host.indexOf("seguro")===-1&&I.stats.isOkDomains&&!document.location.href.includes("/usuarios/"))}T();J();X();ue();oe();le();T();wr();J();X();ue();oe();le();var Nf=fr(xr(),1);Zu();Yn();Se();Qr();function Ux(n,i,t){return i=w(i),q(n,UE()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function UE(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(UE=function(){return!!n})()}jeef.JeefEvents||(jeef.JeefEvents=Ht.getInstance());ne("Subscribe");var BE=function(n){B(i,n);function i(){return k(this,i),Ux(this,i)}return A(i,[{key:"showSubscriptionLinkingBox",value:function(){var e=this;(self.SWG=self.SWG||[]).push(function(){var r=ut(Nf.default.mark(function a(s){var o;return Nf.default.wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,s.linkSubscription({publisherProvidedId:e.ppid});case 2:o=u.sent,jeef.JeefEvents.emit(Zt.ON_SUBSCRIPTION_FINISH,o);case 4:case"end":return u.stop()}},a)}));return function(a){return r.apply(this,arguments)}}())}}]),i}(eo);Yn();Se();dt();Bt();Cn();Qr();function Bx(n,i,t){return i=w(i),q(n,jE()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function jE(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(jE=function(){return!!n})()}Ve.JeefEvents||(Ve.JeefEvents=Ht.getInstance());ne("SubscriptionLinking");var GE="SubscriptionLinking",Ff=function(n){B(i,n);function i(){var t;return k(this,i),t=Bx(this,i),t._user=se.getInstance(),t}return A(i,[{key:"checkUser",value:function(e){this.conf=e,this._user.isSubscriber()&&!this._user.getPpid()&&!this.hideSubscriptionLinkingBoxByCookies()&&this.init()}},{key:"init",value:function(){var e=this;Ve.JeefEvents.on(Zt.ON_BASE_LOAD,function(){e.onBaseLoad()}),this.ppid=this._user.getUid(),this.injectJss()}},{key:"onBaseLoad",value:function(){var e=this;Ve.JeefEvents.on(Zt.ON_SUBSCRIPTION_FINISH,function(r){e.onSubscribeFinish(r)}),this.showSubscriptionLinkingBox()}},{key:"hideSubscriptionLinkingBoxByCookies",value:function(){var e=Number(localStorage.getItem("EE_RRME_HIDEDATE")),r=Date.now();return e>r}},{key:"setTsCookie",value:function(){localStorage.setItem("EE_RRME_HIDEDATE",this.getNextWeekTs())}},{key:"getNextWeekTs",value:function(){var e=new Date;return new Date(e.getFullYear(),e.getMonth(),e.getDate()+14).getTime().toString()}},{key:"onSubscribeFinish",value:function(e){if(!e.success){this.setTsCookie();return}this.setPpidRequest(this.conf.subscriptionEndpoint+this.ppid,Wr.POST,this._onPPIDFinishRequest,this._onPPIDErrorRequest)}},{key:"setPpidRequest",value:function(e,r,a,s){var o=this,l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,u=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,c=arguments.length>6&&arguments[6]!==void 0?arguments[6]:"include",f={method:r,credentials:c};l&&(f.headers=l),u&&(f.body=u),fetch(e,f).then(function(d){return d.json()}).catch(function(d){return s.apply(o,[d])}).then(function(d){return a.apply(o,[d])})}},{key:"_onPPIDFinishRequest",value:function(e){P(['jeeiSite.user.googleRRME.SubscriptionLinking>
1_onPPIDFinishRequest", "Respuesta del servicio: '.concat(e)],GE)}},{key:"_onPPIDErrorRequest",value:function(e){P(['jeeiSite.user.googleRRME.SubscriptionLinking>_onPPIDErrorRequest", "Respuesta del servicio: '.concat(e)],GE)}}],[{key:"getInstance",value:function(){return this._instance||(this._instance=new i),this._instance}}]),i}(BE);rc();T();X();J();ue();oe();le();Ge();sr();function Gx(n,i,t){return i=w(i),q(n,HE()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function HE(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(HE=function(){return!!n})()}var Pe=function(n){B(i,n);function i(){var t;k(this,i);for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];return t=Gx(this,i,[].concat(r)),t.data="",t}return A(i)}(Qe);V(Pe,"ON_DOM_AND_USER_READY","onDomAndUserReady");V(Pe,"ON_ANALYTICS_COMSCORE_READY","onAnalyticsComscoreReady");V(Pe,"ON_AD_LAZY_READY","onAdLazyReady");V(Pe,"ON_SCROLLED_TOP","onScrolledTop");V(Pe,"ON_SCROLLED_QUARTER","onScrolledQuarter");V(Pe,"ON_SCROLLED_HALF","onScrolledHalf");V(Pe,"ON_SCROLLED_THREEQUARTERS","onScrolledThreeQuarters");V(Pe,"ON_UNSCROLLED_TOP","onUnscrolledTop");V(Pe,"ON_UNSCROLLED_QUARTER","onUnscrolledQuarter");V(Pe,"ON_UNSCROLLED_HALF","onUnscrolledHalf");V(Pe,"ON_UNSCROLLED_THREEQUARTERS","onUnscrolledThreeQuarters");V(Pe,"ON_SCROLLED_FIRSTVIEWPORT","onScrolledFirstViewport");V(Pe,"ON_UNSCROLLED_FIRSTVIEWPORT","onUnscrolledFirstViewport");V(Pe,"ON_SCROLL","onScroll");Os();T();J();X();mr();ft();dt();Gi();var Uf=null,Bf=function(){function n(){k(this,n)}return A(n,[{key:"toggleElements",value:function(){var t=this.getLS();for(var e in t){var r=document.getElementById(e);r&&(nn(r),It.getInstance().track([e,"hide"]))}}},{key:"toggle",value:function(t){var e=this.getLS();e[t.id]=an(t)?"hide":"",this.saveLS(e)}},{key:"saveLS",value:function(t){var e={};for(var r in t)t[r]&&(e[r]=t[r]);xi(this.getNameLS(),JSON.stringify(e))}},{key:"getLS",value:function(){var t=wi(this.getNameLS());if(!t)return{};try{return JSON.parse(t)}catch(e){return{}}}},{key:"getNameLS",value:function(){return"ee_toggle_sections:".concat(se.getInstance().getUid())}}],[{key:"getInstance",value:function(){return Uf||(Uf=new n),Uf}}]),n}();ti();T();Ge();kn();var Gf=V(V(V(V(V({},He.elespanol,"GTM-KTMLWP"),He.cronicavasca,"GTM-W7NW9LD"),He.cronicaglobal,"GTM-TVXJ4X5"),He.metropoliabierta,"GTM-5TVCFQX"),He.redaccionmedica,"GTM-PDSXHHS");kn();kl();T();J();X();var VE=function(){function n(){k(this,n)}return A(n,null,[{key:"init",value:function(){(function(){var t=window.location.hostname.replace(/^www\./,"").toLowerCase(),e=window.location.href.toLowerCase();if(!t.endsWith("elespanol.com")&&!t.endsWith("redaccionmedica.com")&&!t.endsWith("cronicaglobal.cat")&&!t.endsWith("metropoliabierta.cat")&&!t.endsWith("redaccionmedica.com")&&!e.includes("preview")){document.documentElement.innerHTML="";var r=document.createElement("meta");r.name="robots",r.content="none",document.head&&document.head.insertBefore(r,document.head.firstChild),document.body&&document.body.remove()}})()}}]),n}();Xt();T();J();X();mr();Se();T();var jf={maxLength:9e3,isValid:{didomi_token:!0,"euconsent-v2":!0,__utp:!0,__bid:!0,__tbc:!0,__tac:!0,__tae:!0,__pnahc:!0,xbc:!0,__tpcc_:!0,__adblocker:!0,comScore:!0,_gid:!0,_ga:!0,_gat:!0,"AMP-CONSENT":!0,compass_sid:!0,compass_uid:!0,dvufee:!0,uid:!0,_gat_pianoTracker:!0,juid:!0,"ee-regional":!0,sui:!0,sui_1p:!0,sui_3p:!0,ee_va:!0,ee_vpz:!0,_pc_carrito_abandonado:!0}};ne("COK");var KE="COK",Hf=null,WE=function(){function n(){k(this,n)}return A(n,[{key:"analysCookies",value:function(){try{if(document.cookie.length>jf.maxLength){var t=this.getAllCookies();for(var e in t)jf.isValid[e]||(Vr(e,-1,-1),Vr(e,-1,-1,"elespanol.com"),Vr(e,-1,-1,".elespanol.com"),On(e,window.location.host),On(e,"elespanol.com"),On(e,".elespanol.com"),P(["jeeiSite.browser.CleanCookies>analysCookies> Eliminamos cookie: ".concat(e)],KE))}}catch(r){console.error("ERROR",r)}}},{key:"getAllCookies",value:function(){for(var t=document.cookie.split(";"),e={},r=0;r<t.length;r++){var a,s=t[r].split("="),o=((a=s[0])!==null&&a!==void 0?a:"").trim();e[o]=unescape(s.slice(1).join("="))}return e}}],[{key:"getInstance",value:function(){return Hf||(P(["jeeiSite.browser.CleanCookies>getInstance> Creando instancia por primera vez"],KE),Hf=new n),Hf}}]),n}();T();J();X();ti();dt();$e();Cn();Se();T();J();X();mr();_e();ti();dt();var Vf=null,Ot=function(){function n(){k(this,n),this.lastobject=""}return A(n,[{key:"saveLocalStorage",value:function(t){if(t){var e={tags:[],stories:[]};t=t.data||t.message||t.localstorage,t&&t.localstorageType&&(e.tags=t.localstorageType.tags,e.stories=t.localstorageType.stories),this.getNameLS()&&xi(this.getNameLS(),JSON.stringify(e))}}},{key:"sendAjax",value:function(t,e,r){fetch(t,{method:e,headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}).then(function(a){return a.json()}
1).then(function(a){return jeef.JeefEvents.emit(be.ON_SAVE_USER_FOLLOW_STORY_TAG_OK,a)}).catch(function(a){return jeef.JeefEvents.emit(be.ON_SAVE_USER_FOLLOW_STORY_TAG_NOK,a)})}},{key:"saveUserFollowContent",value:function(t){if(t.sid||t.tid)if(this.getKey(t)){if(t.sid){this.sendAjax("".concat(I.followContent.localstorage.ws.saveStory,"/").concat(t.sid),"DELETE",t);var e=document.querySelectorAll(".save-btn, #guardar-footer, #eliminar-footer, #eliminar-mob, #guardar-mob");e.forEach(function(o){o.setAttribute("data-status","off")})}if(t.tid){this.sendAjax("".concat(I.followContent.localstorage.ws.saveTag,"/").concat(t.tid),"DELETE",t);var r=document.querySelectorAll(".follow-container");r.forEach(function(o){o.setAttribute("data-status","off")})}}else{if(t.sid){this.sendAjax(I.followContent.localstorage.ws.saveStory,"POST",t);var a=document.querySelectorAll(".save-btn, #guardar-footer, #eliminar-footer, #eliminar-mob, #guardar-mob");a.forEach(function(o){o.setAttribute("data-status","on")})}if(t.tid){this.sendAjax(I.followContent.localstorage.ws.saveTag,"POST",t);var s=document.querySelectorAll(".follow-container");s.forEach(function(o){o.setAttribute("data-status","on")})}}}},{key:"getKey",value:function(t){if(t.sid)return this.getKeyStory(t.sid);if(t.tid)return this.getKeyTag(t.tid)}},{key:"getLocalStorageFollowContent",value:function(){var t=wi(this.getNameLS());if(!t)return!1;try{t=JSON.parse(t)}catch(e){return!1}return t}},{key:"getKeyStory",value:function(t){var e=this.getLocalStorageFollowContent(),r;if(!e)return!1;r=e.stories;for(var a in r)if(r[a].id===t)return r[a];return!1}},{key:"getKeyTag",value:function(t){var e=this.getLocalStorageFollowContent(),r;if(!e)return!1;r=e.tags;for(var a in r)if(r[a].id===t)return r[a];return!1}},{key:"getNameLS",value:function(){var t=se.getInstance().getUid();return t?"ee_data_v1:".concat(t):!1}}],[{key:"getInstance",value:function(){return Vf||(Vf=new n),Vf}}]),n}();T();$e();ti();dt();zn();yi();En();function Kf(){var n=document.querySelectorAll(".save-btn, #guardar-footer, #eliminar-footer, #eliminar-mob, #guardar-mob");n.forEach(function(i){i.onclick=function(){var t=se.getInstance().getRoleForGpt();this.userId=se.getInstance().getUid(),console.log(t);var e=Q.getMain(),r={sid:Q.getMainId(),title:e.title,url:location.href,category:"Ordinales"};t!="anonimo"?(jeef.JeefEvents.once(be.ON_CLICK_ELEMENT_FOLLOW_CONTENT,function(){console.log("callback de historias")}),Ot.getInstance().saveUserFollowContent(r)):(Ot.lastobject=r,Gr.showModal(Je.PIANO_SCREEN_LOGIN,Je.PIANO_DISPLAY_MODAL,ht.getInstance().getOriginLoad()))},Ot.getInstance().getKeyStory(Q.getMainId())?i.setAttribute("data-status","on"):i.setAttribute("data-status","off")})}var Wf=function(){if(Q.getType()==="tag"){var i=document.querySelectorAll(".follow-container");i.forEach(function(t){t.onclick=function(){var e=se.getInstance().getRoleForGpt();this.userId=se.getInstance().getUid(),console.log(e);var r=Q.getMain(),a={tid:Q.getMainId(),name:r.hashtags,slug:r.slugHashTags,category:"Ordinales"};e!="anonimo"?(jeef.JeefEvents.once(be.ON_CLICK_ELEMENT_FOLLOW_CONTENT,function(){console.log("callback de tag")}),Ot.getInstance().saveUserFollowContent(a)):(Ot.lastobject=a,Gr.showModal(Je.PIANO_SCREEN_LOGIN,Je.PIANO_DISPLAY_MODAL,ht.getInstance().getOriginLoad()))},Ot.getInstance().getKeyTag(Q.getMainId())&&t.setAttribute("data-status","on")})}};ze();Mr();pi();ft();var qf="FOLLOW-CONTENT";ne("FOLLOW-CONTENT");var Yf=null,qE=function(){function n(){var i=this;k(this,n),this.domAndWizardReady=!1,this.user=se.getInstance(),Ve.JeefEvents.once(be.ON_SORTINGHAT_CODE_103,function(t){P(["sortinghat response 103"],qf),i.domAndWizardReady?Ot.getInstance().saveLocalStorage(t):Ve.JeefEvents.once(be.ON_DOM_AND_USER_READY,function(){Ot.getInstance().saveLocalStorage(t)})}),Ve.JeefEvents.once(be.ON_SORTINGHAT_CODE_104,function(t){P(["sortinghat response 104"],qf)}),Ve.JeefEvents.once(be.ON_DOM_AND_USER_READY,function(){i.domAndWizardReady=!0,i.initUser()}),Ve.JeefEvents.on(be.ON_SAVE_USER_FOLLOW_STORY_TAG_OK,function(t){Ot.getInstance().saveLocalStorage(t),Ve.JeefEvents.emit(be.O
1N_CLICK_ELEMENT_FOLLOW_CONTENT),document.body.innerHTML=document.body.innerHTML+t.modalraw,Kf(),Wf()}),Ve.JeefEvents.on(be.ON_SAVE_USER_FOLLOW_STORY_TAG_NOK,function(){Ve.JeefEvents.emit(be.ON_CLICK_ELEMENT_FOLLOW_CONTENT)}),Ve.JeefEvents.once(be.ON_WIZARD_SYNC_LAYOUT_FINISH,function(t){Ot.getInstance().saveLocalStorage(t)}),ie(this.user,xe.ON_USER_SYNC_LAYOUT_FINISH,this.onChangeViewInWizardLayoutFinish,this)}return A(n,[{key:"initUser",value:function(){se.getInstance().getRoleForGpt(),this.userId=se.getInstance().getUid(),P(["user id ".concat(se.getInstance().getUid())],qf),Kf(),Wf(),ie(document,de.ON_DOM_CLICK,this.onClickButton,this)}},{key:"onClickButton",value:function(t){var e=t.target.getAttribute("data-target");(e==="modal_zonan"||e==="close_modal_zonan")&&document.getElementById("modal_zonan").remove()}},{key:"onChangeViewInWizardLayoutFinish",value:function(){Ot.getInstance().lastobject!==""&&!Ot.getInstance().getKey(Ot.getInstance().lastobject)&&Ot.getInstance().saveUserFollowContent(Ot.getInstance().lastobject),Ot.lastobject="";var t=document.querySelectorAll(".follow-container");t.forEach(function(a){ae(a,Ot.getInstance().getKeyTag(Q.getMainId()))});var e=document.querySelectorAll(".save-btn, #guardar-footer, #eliminar-footer, #eliminar-mob, #guardar-mob");e.forEach(function(a){ae(a,Ot.getInstance().getKeyStory(Q.getMainId()))});var r=document.querySelectorAll('[data-target="add_remove_tag"]');r.forEach(function(a){try{var s=JSON.parse(a.getAttribute("data-object"));Ot.getInstance().getKeyTag(s.id)?a.removeAttribute("checked"):a.setAttribute("checked","true")}catch(o){console.error(o)}})}}],[{key:"getInstance",value:function(){return Yf||(Yf=new n),Yf}}]),n}();T();mr();Se();ne("Regional");var YE="Regional";function zE(n){var i=n.dataset.link;if(!i){Dt(["regional","No URL found in dataset.link"],YE);return}var t=document.getElementById("regional_container");t&&fetch(i).then(function(e){return e.text()}).then(function(e){Vr("ee-regional",window.btoa(i),365),t.innerHTML=e,t.querySelectorAll("script").forEach(function(r){var a=document.createElement("script");r.src&&(a.src=r.src),r.textContent&&(a.textContent=r.textContent),r.parentNode&&r.parentNode.replaceChild(a,r)})}).catch(function(e){Dt(["regional",e],YE)})}$e();T();J();X();_e();var JE=function(){function n(){k(this,n)}return A(n,[{key:"init",value:function(){if(I.ad.vidoomy){var t=document.createElement("script");t.src="https://ads.vidoomy.com/elespanol_22991.js",t.async=!0,document.documentElement.appendChild(t)}}}]),n}();Sn();mi();_e();function jx(n,i,t){return i=w(i),q(n,XE()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function XE(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(XE=function(){return!!n})()}var Jf="COMMON";ne(Jf);function Hx(n){n.forEach(function(i){new Ke().load(i,!0,!0)})}VE.init();Hx((I===null||I===void 0?void 0:I.earlyScripts)||[]);var QE=function(n){B(i,n);function i(){var t;return k(this,i),t=jx(this,i),WE.getInstance().analysCookies(),t._lazyAdFlag=!1,t._wizardLoad=!1,t._comscoreLoad=!1,t._analyticsLoad=!1,t._loadAllAd=!1,t._loadMetadaData=!1,t._flagLayout=!0,t._stickyObject=!1,t._customHeader=!1,t._previousDirection=null,t._lastProp=0,t._user=se.getInstance(),t._adSuscriptorObject=new wE,t._pianoIntegration=new Gr,t._scrollReferences={top_reference:{atScroll:.01,scrollInEvent:Pe.ON_SCROLLED_TOP,scrollOutEvent:Pe.ON_UNSCROLLED_TOP},first_viewport_reference:{insideTagId:"article-body-content",scrollInEvent:Pe.ON_SCROLLED_FIRSTVIEWPORT,scrollOutEvent:Pe.ON_UNSCROLLED_FIRSTVIEWPORT},quarter_reference:{atScroll:.25,scrollInEvent:Pe.ON_SCROLLED_QUARTER,scrollOutEvent:Pe.ON_UNSCROLLED_QUARTER},half_reference:{atScroll:.5,scrollInEvent:Pe.ON_SCROLLED_HALF,scrollOutEvent:Pe.ON_UNSCROLLED_HALF},threequarters_reference:{atScroll:.75,scrollInEvent:Pe.ON_SCROLLED_THREEQUARTERS,scrollOutEvent:Pe.ON_UNSCROLLED_THREEQUARTERS}},window.isMobile=Me,t}return A(i,[{key:"setCustomHeader",value:function(e){return this._customHeader=e,this}},{key:"setPianoIntegration",value:function(e){return this._pianoIntegration=e,this}},{key:"setStaticStickyAd",value:function(e){return this._stickyObject=e.getInstance(),this}},{key:"setStickyAd",value:function(e){return this._stickyObject=e,this}},{key:"enableLayout",value:function(e){return this._flagLayout=e,this}},{key:"_setupLoadListener",value:function(){var e=this;ie(window,"load",function(r){jeef.JeefEvents.once(At.TRIGGER_DIDOMI,function(){e._onLoad(r)})})}},{key:"_initPlatform",value:function(){var e=this,r=new Bl;this._pianoIntegration.init(),ie(r,Nn.ON_SHOW_LOGGER,function(){e._onShowLogger()}
1),ie(window,de.ON_DOM_MESSAGE,function(a){e._onPostMessage(a.native)}),ie(this._user,xe.ON_USERRQ_FINISH,function(a){e._onWizardFinish(a)}),jeef.JeefEvents.onPersistentEvent(it.USER_CMP_RESOLVED,function(){e._onDidomiResolved()}),r.init()}},{key:"_onDidomiTrigger",value:function(){var e=this;this._loadGTM(),ie(Yr.getInstance(),ji.ON_COMSCORE_LOAD,function(){e._onComscoreLoad()}),Ur.init(),this.dispatchEvent(new Pe(Pe.ON_ANALYTICS_COMSCORE_READY),!0),this.dispatchEvent(new Pe(Pe.ON_AD_LAZY_READY),!0)}},{key:"_onMetadataLoaded",value:function(){window.jeeiSite.dyn.loadGPT!==!0&&!or.getInstance().isCriticalTag()&&!or.getInstance().isCriticalTagFromHashTag()&&!or.getInstance().is404Page()&&(window.didomiOnReady=window.didomiOnReady||[],window.didomiOnReady.push(function(){window.Didomi.isConsentRequired()&&Br.loadGPT()})),or.getInstance().is404Page()||this._loadVidoomyAd(),jeef.JeefEvents.onPersistentEvent(it.DIDOMY_LIBRARY_LOADED,function(){Ur.trackMandatoryPixels()})}},{key:"_beforeDOMLoad",value:function(e){try{qE.getInstance()}catch(s){Dt(s)}try{this._setOnScrollEvents(),jeef.JeefEvents.on(Pe.ON_SCROLLED_TOP,function(){document.body.setAttribute("data-scroll","on"),document.body.setAttribute("data-show-header","off")}),jeef.JeefEvents.on(Pe.ON_UNSCROLLED_TOP,function(){document.body.setAttribute("data-scroll","off"),document.body.setAttribute("data-show-header","on")}),jeef.JeefEvents.on(Pe.ON_SCROLLED_FIRSTVIEWPORT,function(){document.body.setAttribute("data-firstviewport","on"),ae(document.getElementById("buttonX"),!0)}),jeef.JeefEvents.on(Pe.ON_UNSCROLLED_FIRSTVIEWPORT,function(){document.body.setAttribute("data-firstviewport","off"),ae(document.getElementById("buttonX"),!1)})}catch(s){console.error(s)}
1var r=document.getElementById("fbody");if(r){var a=new MutationObserver(function(){jeef.JeefEvents.emit(be.ON_FBODY_CHANGE)});a.observe(r,{attributes:!0,childList:!1,characterData:!1})}}},{key:"_afterDOMLoad",value:function(e){var r=document.getElementById("gallerynews_footer");if(r){this._footer=r,this._footerControl();var a=document.getElementById("footer_title");a&&(this._footerTitle=a),this._footersharetools=this._footer.getElementsByClassName("tools-share")[0],this._footertoolssection=this._footer.getElementsByClassName("tools-section")[0],Me&&this._footertoolssection&&this._footersharetools&&(this._footertoolssection.setAttribute("data-swipe","top"),this._footersharetools.setAttribute("data-swipe","middle")),this._previousDirection=null,this._lastProp=0}this._onDomWizardFinish(),this._stickyObject&&(this._stickyObject.setObjectAdSubscriptor(this._adSuscriptorObject),this._stickyObject.init());try{this._checkWebViewCronicas()}catch(s){Dt(s)}}},{key:"_onClickPlatform",value:function(e,r,a,s){var o,l,u,c,f,d=Vt("data-video",e.target,window.document);if(r&&(o=r[0])!==null&&o!==void 0&&(o=o.dataset)!==null&&o!==void 0&&o.track&&(!((l=r[0])!==null&&l!==void 0&&(l=l.dataset)!==null&&l!==void 0&&l.trackEvent)||((u=r[0])===null||u===void 0||(u=u.dataset)===null||u===void 0?void 0:u.trackEvent)==="click")&&(c=r[0])!==null&&c!==void 0&&(c=c.dataset)!==null&&c!==void 0&&c.trackValue&&Ur.trackingHandler(r[0].dataset.track,r[0].dataset.trackValue),((f=r[0])===null||f===void 0||(f=f.dataset)===null||f===void 0?void 0:f.type)==="googleRRME"&&I){var h,v;((h=r[0])===null||h===void 0||(h=h.dataset)===null||h===void 0?void 0:h.subtype)==="subscribe"?Ff.getInstance().checkUser(I.GoogleRRME):((v=r[0])===null||v===void 0||(v=v.dataset)===null||v===void 0?void 0:v.subtype)==="purchase"&&(fn.getInstance().checkUser(I.GoogleRRME),fn.getInstance().showCarrousel())}try{if(d){var m=new VideoAutoplay;m.registerActionSaveCookie(d[1])}}catch(_){P(["Error al cargar la cookie para el autoplay",_],Jf)}if(Pl(e.target),r[0]){if(e.target.className==="main-header__subscribe")return e.type=de.ON_DOM_CLICK,this.dispatchEvent(e),!1;if(r[0].id==="user_login_signin"){if(se.getInstance().getSimpleRole()==="ANON")return r[0].setAttribute("data-type","user"),e.type=de.ON_DOM_CLICK,this.dispatchEvent(e),!1;r[0].setAttribute("data-type","toggler"),a="toggler",s=""}}if(!this._toggleMenu(e,a,r[0]))return!1;switch(a){case"tab":lh(r[0]);break;case"toggler":if(!s)nn(r[0]);else if(s==="ageVerification"){var p;(p=this._ageVerification)===null||p===void 0||p.handleAgeVerification(r[0])}else if(s==="sliderHeader"){var g;(g=this._sliderHeader)===null||g===void 0||g.handleChangeStatusSliderHeader(r[0])}break;case"anchor":sh(r[0]),e.native.preventDefault();break;case"regional":zE(r[0]),e.native.preventDefault();break;case"scroll":this._scrollTo(r[0]),e.native.preventDefault();break}if(!this._checkMenuHam(e,r)||!this._checkMenuHeader(e,r)||!this._checkMenuMySpace(e,r))return!1;if(e.target.id==="header_newsletter_link"){var E;(E=this._analytics)===null||E===void 0||E.getInstance().simpleTrack(I.stats.analytics.events.newsletters.web_ui_header)}if(e.target.getAttribute("data-storage")==="true"&&Bf.getInstance().toggle(e.target),e.target.getAttribute("data-button-register")){var y;Gr.showModal(Je.PIANO_SCREEN_REGISTER,Je.PIANO_DISPLAY_MODAL,(y=I.user)===null||y===void 0||(y=y.wizard)===null||y===void 0?void 0:y.stage)}}},{key:"_afterLoad",value:function(e){var r=this;!Me&&Tt.chrome&&setTimeout(function(){r._deleteFavicon()},2e3)}},{key:"_loadGTM",value:function(){var e,r=(e=Gf[gs])!==null&&e!==void 0?e:Gf[He.elespanol];(function(a,s,o,l,u){a[l]=a[l]||[],a[l].push({"gtm.start":new Date().getTime(),event:"gtm.js"});var c=s.getElementsByTagName(o)[0],f=s.createElement(o),d=l!=="dataLayer"?"&l="+l:"";f.async=!0,f.src="https://www.googletagmanager.com/gtm.js?id="+u+d,c.parentNode.insertBefore(f,c)})(window,document,"script","dataLayer",r)}},{key:"_onComscoreLoad",value:function(){this._comscoreLoad=!0}},{key:"_onShowLogger",value:function(){rh(!0)}},{key:"_onDidomiResolved",value:function(){var e=this;ie(ht.getInstance(),me.ON_TRIGGER_SDK_LOADED,function(){e._user.init()},this)}},{key:"_onWizardFinish",value:function(){var t=ut(zf.default.mark(function r(a){var s,o,l,u;return zf.default.wrap(function(f){for(;;)switch(f.prev=f.next){case 0:this._wizardLoad=!0,te.getInstance().trigger(te.triggers.ON_WIZARD),this._onDomWizardFinish(),gi.isGaa()?gi.getInstance().init():(I.GoogleRRME.active&&(fn.getInstance().checkUser(I.GoogleRRME),Ff.getInstance().checkUser(I.GoogleRRME)),s=document.createElement("div"),s.classList.add("myObserver"),o=document.querySelector("body"),s.style.cssText="opacity: 0; position: absolute; height: 1px; width: 1px; pointer-events: none;",l=I.user.googleOneTap.lazy.scroll,u=I.user.googleOneTap.lazy.time,new wv(s,o,l,u,function(){return NE()}).init()),this.dispatchEvent(a);case 5:case"end":return f.stop()}},r,this)}));function e(r){return t.apply(this,arguments)}return e}()},{key:"_onDomWizardFinish",value:function(){var e=this;this._wizardLoad&&this._domLoad&&(this._onLayoutRefresh(),this._adSuscriptorObject.init(),ie(this._user,xe.ON_LAYOUT_REFRESH,function(){e._onLayoutRefresh()}),this.dispatchEvent(new Pe(Pe.ON_DOM_AND_USER_READY)),jeef.JeefEvents.emit(be.O
1N_DOM_AND_USER_READY),Bf.getInstance().toggleElements(),this._user.isRegisteredEE()&&PE.loadLiveRampScripts(this._user.getHashedEmail()))}},{key:"_onLayoutRefresh",value:function(){this._flagLayout&&Mi()}},{key:"_setOnScrollEvents",value:function(){var e=this._setPageReferences();if(e!=null&&e.length){var r={},a=new IntersectionObserver(function(s){s.forEach(function(o){var l=r[o.target.id]||0;if(o.isIntersecting){if(o.boundingClientRect.top>l){var u;o!=null&&(u=o.target)!==null&&u!==void 0&&(u=u.dataset)!==null&&u!==void 0&&u.scrollOut&&jeef.JeefEvents.emit(o.target.dataset.scrollOut)}}else if(o.boundingClientRect.top<l){var c;o!=null&&(c=o.target)!==null&&c!==void 0&&(c=c.dataset)!==null&&c!==void 0&&c.scrollIn&&jeef.JeefEvents.emit(o.target.dataset.scrollIn)}r[o.target.id]=o.boundingClientRect.top,jeef.JeefEvents.emit(Pe.ON_SCROLL)})},{root:null,rootMargin:"0px",threshold:[0,1]});e.forEach(function(s){var o=document.getElementById(s);o&&a.observe(o)})}}},{key:"_setPageReferences",value:function(){var e=[];return Object.entries(this._scrollReferences).forEach(function(r){var a=Te(r,2),s=a[0],o=a[1],l='<
1div id="'.concat(s,'" data-scroll-in="').concat(o.scrollInEvent,'" data-scroll-out="').concat(o.scrollOutEvent,'"></div>');if(o!=null&&o.insideTagName){var u;(u=document.getElementsByTagName(o.insideTagName))===null||u===void 0||(u=u[0])===null||u===void 0||u.insertAdjacentHTML("afterbegin",l),e.push(s)}else if(o!=null&&o.insideTagId){var c;(c=document.getElementById(o.insideTagId))===null||c===void 0||c.insertAdjacentHTML("afterbegin",l),e.push(s)}else if(o!=null&&o.atScroll){var f=l.replace(">",' style="position: absolute; left: 0; top: '.concat(document.documentElement.scrollHeight*o.atScroll,'px;" >'));document.body.insertAdjacentHTML("afterbegin",f),e.push(s)}}),e}},{key:"_scrollTo",value:function(e){var r,a=e==null||(r=e.dataset)===null||r===void 0?void 0:r.scroll,s=document.getElementById(a);s&&s.scrollIntoView({behavior:"smooth",block:"start"})}},{key:"_toggleMenu",value:function(e,r,a){var s=function(d){var h=[];function v(m){return m.parentNode?(m.parentNode.id&&h.push(m.parentNode.id),v(m.parentNode)):!1}return v(d),h},o=function(){var d=Array.from(document.querySelectorAll('[data-type="toggler"][data-target][data-toggler-type="menu"]'));d.forEach(function(h){var v=h.getAttribute("data-target"),m=[];v&&(m=v.split(","));var p=!1;m.forEach(function(g){if(g&&g!=="self"&&g!=="next"){var E=document.querySelector("#".concat(g,'[data-status="on"]'));E&&c.indexOf(E.id)===-1&&(p=!0)}}),p&&(e.native.preventDefault(),nn(h),u.push(h),l=!1)})},l=!0,u=[],c=s(e.target);return o(),l?!0:(r==="toggler"&&u.indexOf(a)===-1&&nn(a),!1)}},{key:"_checkMenuMySpace",value:function(e,r){var a=document.getElementById("bar_top_user_area"),s=Vt("class",e.target,document,"user-area__profile");if(an(a)&&!s)if(r&&a){var o=r[0].parentNode;if(o&&o.id!==a.id)return ae(a,!1),!1}else return ae(a,!1),!1;return!0}},{key:"_checkMenuHam",value:function(e,r){var a=document.getElementById("site_header_menu"),s=document.getElementById("menu_container"),o=Vt("id",e.target,document,"menu_container"),l=document.getElementById("button_close_ham"),u=document.getElementById("button_open_ham"),c=document.getElementsByTagName("html")[0];if(s&&an(a)){this._putOverflowInMobile(c,"on","Y");var f=r[0].parentNode;if(r&&f&&a&&f.id===a.id||o&&o[0].id===s.id){if(r&&f&&f.id===u)ae(a,!0);else if(r&&r[0].parentNode.id===l)return ae(a,!1),this._putOverflowInMobile(c,"off","Y"),!1}else return ae(a,!1),this._putOverflowInMobile(c,"off","Y"),!1}else this._putOverflowInMobile(c,"off","Y");return!0}},{key:"_checkMenuHeader",value:function(e,r){if(r&&r[0].getAttribute("data-type")==="closer"){var a=Vt("data-action",e.target,e.currentTarget,"toggle");if(a&&a[0].getAttribute("data-status")==="on")return ae(a[0],!1),!1}return!0}},{key:"_putOverflowInMobile",value:function(e,r,a){if(e&&Me)switch(r){case"on":e.style[a==="Y"?"overflowY":"overflowX"]="hidden";break;case"off":e.style[a==="Y"?"overflowY":"overflowX"]="";break}}},{key:"_footerControl",value:function(){var e=this;jeef.JeefEvents.on(Pe.ON_SCROLLED_THREEQUARTERS,function(){e._setFooterPosition(e._footertoolssection,"middle")}),jeef.JeefEvents.on(Pe.ON_UNSCROLLED_THREEQUARTERS,function(){e._setFooterPosition(e._footersharetools,"middle")})}},{key:"_setFooterPosition",value:function(e,r){e.setAttribute("data-swipe",r)}},{key:"_deleteFavicon",value:function(){try{var e=document.querySelector('link[rel="shortcut icon"]');if(e){var r=e.parentNode;r&&r.removeChild(e)}}catch(a){St(["No se ha detectado favicon"],Jf)}}},{key:"_onPostMessage",value:function(e){var r;if(e!=null&&(r=e.data)!==null&&r!==void 0&&(r=r.nhfp)!==null&&r!==void 0&&r.resize){var a,s;if(pe(e==null||(a=e.data)===null||a===void 0||(a=a.nhfp)===null||a===void 0?void 0:a.resize)==="object"&&e!==null&&e!==void 0&&(s=e.data)!==null&&s!==void 0&&(s=s.nhfp)!==null&&s!==void 0&&s.resize.id){var o,l=document.getElementById(e==null||(o=e.data)===null||o===void 0||(o=o.nhfp)===null||o===void 0?void 0:o.resize.id);if(l){var u,c;e!=null&&(u=e.data)!==null&&u!==void 0&&(u=u.nhfp)!==null&&u!==void 0&&u.resize.height&&(l.style.height="".concat(e.data.nhfp.resize.height,"px")),e!=null&&(c=e.data)!==null&&c!==void 0&&(c=c.nhfp)!==null&&c!==void 0&&c.resize.width&&(l.style.width="".concat(e.data.nhfp.resize.width,"px"))}}}}},{key:"_loadVidoomyAd",value:function(){var e=I.ad.enableVidoomySections,r=Q.getSections(),a=Q.getMain().type;if(e){var s=e.default;e.sectionIds&&(s=r.some(function(o){return e.sectionIds[o.id]!==!1})),(a==="homepage"||a==="tag")&&s&&new JE().init()}else console.info("VidoomyConfig is not defined")}},{key:"_checkWebViewCronicas",value:function(){Ld()&&(Bh(document.querySelector("#fbody article header"),"div").style="opacity:1")}}]),i}(OE);Mr();ze();T();J();X();Na();T();J();X();_e();mr();var $E=function(){function n(){k(this,n)}return A(n,[{key:"init",value:function(){var t=document.location.href;Vr("referrer",window.btoa(t),1,I.subDomain)}}]),n}();T();J();X();ue();oe();le();T();X();J();Se();T();J();X();ue();oe();Dr();le();T();J();X();ue();oe();le();mt();T();X();J();ue();oe();le();sr();function Vx(n,i,t){return i=w(i),q(n,ZE()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function ZE(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(ZE=function(){return!!n})()}var zo=function(n){B(i,n);function i(t){var e;return k(this,i),e=Vx(this,i,[t]),e.count=0,e.social="",e}return A(i)}(Qe);zo.ON_SC_COUNT="onScCount";function Kx(n,i,t){return i=w(i),q(n,eS()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function eS(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(eS=function(){return!!n})()}var ur=function(n){B(i,n);function i(){var t;return k(this,i),t=Kx(this,i),t._defaultConfig={url:"",urlCount:"",params:{},count:""},t._request={},t}return A(i,[{key:"_assertUrl",value:function(e){if(e===""||e===void 0||e===null)throw Error("No existen datos v\xE1lidos en la url, reenviarlo de nuevo")}},{key:"_notifyOnCount",value:function(e,r){var a=new zo(zo.ON_SC_COUNT);a.count=e,a.social=r,this.dispatchEvent(a)}}
1,{key:"_getModalParams",value:function(){var e={w:700,h:450};return e.left=screen.width/2-e.w/2,e.rigth=screen.height/2-e.h/2,e}}]),i}(Re);Ut();Se();Bt();function Wx(n,i,t){return i=w(i),q(n,tS()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function tS(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(tS=function(){return!!n})()}var is="JEEF.SOCIAL.FACEBOOK";ne(is);var rS=function(n){B(i,n);function i(){var t;return k(this,i),t=Wx(this,i),t._defaultConfig.url="http://www.facebook.com/sharer.php",t._defaultConfig.urlDialog="http://www.facebook.com/dialog/feed",t._defaultConfig.params={u:""},t._defaultConfig.urlCount="http://graph.facebook.com/?id=",t._request=Nr(Qt.JSON,ei.JSONP),t._request.listen(he.ON_IO_FINISH,qx,qe(t)),t._request.listen(he.ON_IO_ERROR,Yx,qe(t)),t._request.JSONParamName="callback",t}return A(i,[{key:"share",value:function(e){this._assertUrl(e);var r=this._getModalParams();this._defaultConfig.params.u=e,e=this._defaultConfig.url+"?"+bt(this._defaultConfig.params),P(["Fin Proceso compartir url en Facebook ..."],is),window.open(e,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+r.w+", height="+r.h+", top="+r.top+", left="+r.left)}},{key:"count",value:function(e){P(["Haciendo petici\xF3n a la API de Facebook para obtener el conteo de las noticias"],is);var r=this._defaultConfig.urlCount+e;this._request.open(r),this._request.send()}},{key:"dialogShare",value:function(e,r,a,s,o,l,u,c){P(["Proceso compartir url en Facebook"],is),this._assertUrl(r);var f={app_id:e,display:c,caption:a,redirect_uri:s,description:o,link:r,name:l,picture:u},d=this._getModalParams(),h=this._defaultConfig.urlDialog+"?"+bt(f);P(["Fin Proceso compartir url en Facebook ..."],is),window.open(h,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+d.w+", height="+d.h+", top="+d.top+", left="+d.left)}}]),i}(ur);var qx=function(i){var t=i.response.shares===void 0?0:i.response.shares;this._notifyOnCount(t,"facebook")},Yx=function(){this._notifyOnCount("0","facebook")};T();J();X();ue();oe();Dr();le();Bt();Ut();Se();function zx(n,i,t){return i=w(i),q(n,iS()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function iS(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(iS=function(){return!!n})()}var nS="JEEF.SOCIAL.TWITTER";ne(nS);var aS=function(n){B(i,n);function i(){var t;return k(this,i),t=zx(this,i),t._defaultConfig.url="http://twitter.com/share",t._defaultConfig.params={text:"",via:""},t._defaultConfig.urlCount="https://cdn.api.twitter.com/1/urls/count.json?url=",t._request=Nr(Qt.JSON,ei.JSONP),t._request.listen(he.ON_IO_FINISH,Jx,qe(t)),t._request.listen(he.ON_IO_ERROR,Xx,qe(t)),t._request.JSONParamName="callback",t}return A(i,[{key:"share",value:function(e,r,a){this._assertUrl(e);var s=this._getModalParams();this._defaultConfig.params.text=r||"",this._defaultConfig.params.via=a||"",e=this._defaultConfig.url+"?"+bt(this._defaultConfig.params)+"&url="+encodeURIComponent(e),window.open(e,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+s.w+", height="+s.h+", top="+s.top+", left="+s.left)}},{key:"count",value:function(e){var r=this._defaultConfig.urlCount+e;this._request.open(r),this._request.send()}}]),i}(ur);var Jx=function(i){P(["CallBack Twitter, obteniendo el dato de la respuesta ..."],nS);var t=i.response.count===void 0?0:i.response.count;this._notifyOnCount(t,"twitter")},Xx=function(i){this._notifyOnCount("0","twitter")};T();J();X();ue();oe();Dr();le();Ut();Se();Bt();function Qx(n,i,t){return i=w(i),q(n,sS()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function sS(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(sS=function(){return!!n})()}var ns="JEEF.SOCIAL.GPLUS";ne(ns);var oS=function(n){B(i,n);function i(){var t;return k(this,i),t=Qx(this,i),t._defaultConfig.url="https://www.linkedin.com/shareArticle",t._defaultConfig.params={mini:"true",url:""},t._defaultConfig.urlCount="http://www.linkedin.com/countserv/count/share?format=jsonp&url=",t._request=Nr(Qt.JSON,ei.JSONP),t._request.listen(he.ON_IO_FINISH,$x,qe(t)),t._request.listen(he.ON_IO_ERROR,Zx,qe(t)),t._request.JSONParamName="callback",t}return A(i,[{key:"share",value:function(e){P(["Proceso compartir url en Linkedin"],ns),this._assertUrl(e);var r=this._getModalParams();this._defaultConfig.params.url=e,e=this._defaultConfig.url+"?"+bt(this._defaultConfig.params),P(["Fin Proceso compartir url en Linkedin ..."],ns),window.open(e,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+r.w+", height="+r.h+", top="+r.to
1p+", left="+r.left)}},{key:"count",value:function(e){P(["Haciendo petici\xF3n a la API de Linkedin para obtener el conteo de las noticias"],ns);var r=this._defaultConfig.urlCount;r+=e,this._request.open(r),this._request.send()}}]),i}(ur);var $x=function(i){P(["CallBack Linkedin, obteniendo el dato de la respuesta ..."],ns);var t=i.response.count===void 0?0:i.response.count;this._notifyOnCount(t,"linkedin")},Zx=function(i){this._notifyOnCount("0","linkedin")};T();J();X();ue();oe();Dr();le();Se();Ut();Bt();function eP(n,i,t){return i=w(i),q(n,lS()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function lS(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(lS=function(){return!!n})()}var Jo="JEEF.SOCIAL.GPLUS";ne(Jo);var uS=function(n){B(i,n);function i(){var t;return k(this,i),t=eP(this,i),t._defaultConfig.url="https://plus.google.com/share",t._defaultConfig.params={url:"",hl:"es"},t._defaultConfig.urlCount="https://clients6.google.com/rpc",t._request=Nr(Qt.JSON),t._request.listen(he.ON_IO_FINISH,tP,qe(t)),t._request.listen(he.ON_IO_ERROR,rP,qe(t)),t}return A(i,[{key:"share",value:function(e){P(["Proceso compartir url en Gplus"],Jo),this._assertUrl(e);var r=this._getModalParams();this._defaultConfig.params.url=e,e=this._defaultConfig.url+"?"+bt(this._defaultConfig.params),P(["Fin Proceso compartir url en Gplus ..."],Jo),window.open(e,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+r.w+", height="+r.h+", top="+r.top+", left="+r.left)}},{key:"count",value:function(e){P(["Haciendo petici\xF3n POST a la API de Gplus para obtener el conteo de las noticias"],Jo);var r=this._defaultConfig.urlCount,a=JSON.stringify([{apiVersion:"v1",id:"p",jsonrpc:"2.0",key:"p",method:"pos.plusones.get",params:{groupId:"@self",id:e,nolog:!0,source:"widget",userId:"@viewer"}}]);try{this._request.open(r,"post"),this._request.setRequestHeader("content-Type","json"),this._request.send(a)}catch(s){}}}]),i}(ur);var tP=function(i){var t=i.response[0].result.metadata.globalCounts.count===void 0?0:i.response[0].result.metadata.globalCounts.count;this._notifyOnCount(t,"googleplus")},rP=function(i){this._notifyOnCount("0","googleplus")};T();J();X();ue();oe();le();Se();Bt();function iP(n,i,t){return i=w(i),q(n,cS()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function cS(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(cS=function(){return!!n})()}var nP="JEEF.SOCIAL.MENEAME";ne(nP);var fS=function(n){B(i,n);function i(){var t;return k(this,i),t=iP(this,i),t._defaultConfig.url="http://www.meneame.net/submit.php",t._defaultConfig.params={url:""},t}return A(i,[{key:"share",value:function(e){this._assertUrl(e);var r=this._getModalParams();this._defaultConfig.params.url=e,e=this._defaultConfig.url+"?"+bt(this._defaultConfig.params),window.open(e,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+r.w+", height="+r.h+", top="+r.top+", left="+r.left)}}]),i}(ur);T();J();X();ue();oe();le();Se();Bt();function aP(n,i,t){return i=w(i),q(n,dS()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function dS(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(dS=function(){return!!n})()}var Xf="JEEF.SOCIAL.WHATSAPP";ne(Xf);var hS=function(n){B(i,n);function i(){var t;return k(this,i),t=aP(this,i),t._defaultConfig.url="https://api.whatsapp.com/send/",t._defaultConfig.params={text:""},t}return A(i,[{key:"share",value:function(e,r){P(["Proceso compartir url en WhatsApp"],Xf),this._assertUrl(e),this._defaultConfig.params.text=r||"",this._defaultConfig.params.text+=" "+e;var a=bt(this._defaultConfig.params);P(["Fin Proceso compartir url en WhatsApp ..."],Xf),window.open(this._defaultConfig.url+"?"+a,"_blank")}}]),i}(ur);T();J();X();ue();oe();le();Se();Bt();function sP(n,i,t){return i=w(i),q(n,vS()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function vS(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(vS=function(){return!!n})()}var Qf="JEEF.SOCIAL.TELEGRAM";ne(Qf);var pS=function(n){B(i,n);function i(){var t;return k(this,i),t=sP(this,i),t._defaultConfig.url="https://t.me/share/url",t._defaultConfig.params={text:"",url:""},t}return A(i,[{key:"share",value:function(e,r){P(["Proceso compartir url en Telegram"],Qf),this._assertUrl(e),this._defaultConfig.params.text=r||"",this._defaultConfig.params.url=e;var a=bt(this._defaultConfig.params);P(["Fin Proceso compartir url en Telegram ..."],Qf),window.open(this._defaultConfig.url+"?"+a,"_blank")}}]),i}(ur);T();J();X();ue();oe();le();Se();Bt();function oP(n,i,t){return i=w(i),q(n,mS()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function mS(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(mS=function(){return!!n})()}var $f="JEEF.SOCIAL.MAIL";ne($f);var gS=function(n){B(i,n);function i(){var t;return k(this,i),t=oP(this,i),t._defaultConfig.url="mailto:",t._defaultConfig.params={subject:"",body:"",recipient:""},t}return A(i,[{key:"share",value:function(e,r){P(["Proceso compartir url en Mail"],$f),this._assertUrl(e),this._defaultConfig.params.subject=r||"",this._defaultConfig.params.body+=e;var a=bt(this._defaultConfig.params);P(["Fin Proceso compartir url en Mail ..."],$f),window.open(this._defaultConfig.url+"?"+a,"_blank")}}]),i}(ur);var lP="MIXIN_SOCIAL",yS=A(function n(){k(this,n),P(["Instanciamos la integraci\xF3n de la portada ... y todas sus depencias"],lP),this._facebook=new rS,this._linkedin=new oS,this._gplus=new uS,this._twitter=new aS,this._whatsapp=new hS,this._meneame=new fS,this._telegram=new pS,this._mail=new gS});Se();ze();_e();ft();$e();Bt();function uP(n,i,t){return i=w(i),q(n,_S()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function _S(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(_S=function(){return!!n})()}var ua="SOCIAL-INTEGRATION";ne(ua);var ES=function(n){B(i,n);function i(){var t;return k(this,i),t=uP(this,i),t.via=I.sharedConfRRSS.twitter.via[Q.get
1SectionId()]||I.sharedConfRRSS.twitter.via.default,t.url="",t.title="",t.anchor="",t}return A(i,[{key:"init",value:function(){P(["Inicializamos el listener global de clicks para detectar el share en la red social ..."],ua),ie(document,"click",cP,this)}}]),i}(yS);var cP=function(i){var t=dP.apply(this,[i]),e=t.element,r=t.type,a=t.subType;try{fP.apply(this,[e,r,a])}catch(s){Dt(["JEEF.ERROR: "+s.message],ua)}},fP=function(i,t,e){t==="social"&&(P(["Se ha detectado un elemento de red social"],ua),hP.apply(this,[i]),this.url!==null&&pP.apply(this,[e,i]))},dP=function(i){var t=Vt("data-type",i.target,i.currentTarget),e,r;return t&&(e=t[1],r=t[0].getAttribute("data-subtype")),{element:t,type:e,subType:r}},hP=function(i){this.url=xn(i[0]),this.anchor=i[0].getAttribute("data-message");try{this.title=i[0].getAttribute("data-title")||this.url[0].innerHTML,this.title=this.title.replace(/^\s\s*/,"").replace(/\s\s*$/,""),this.url=Dl(this.url[0])||i[0].getAttribute("data-url")}catch(e){var t=Rh();this.title=Pn("og:title")||t.title,this.url=Pn("og:url")||t.url}this.title=this.title.replace(/"/g,'"').replace(/'/g,"'"),this.anchor&&(this.url="".concat(i[0].getAttribute("data-url"),"#").concat(this.anchor))},vP=function(i,t){var e=t.querySelector(".tooltip-link");navigator.clipboard.writeText(i).then(function(){e.setAttribute("data-status","on"),setTimeout(function(){e.setAttribute("data-status","off")},1e3)}).catch(function(r){P(["Error compartiendo en copy link"],ua)})},pP=function(i,t){switch(i){case"facebook":this._facebook.share(this.url);break;case"facebook-custom":gP.apply(this,[t]);break;case"twitter":this._twitter.share(this.url,this.title,this.via);break;case"linkedin":this._linkedin.share(this.url);break;case"tumblr":this._tumblr.share(this.url);break;case"googleplus":this._gplus.share(this.url);break;case"whatsapp":this._whatsapp.share(this.url,this.title);break;case"meneame":this._meneame.share(this.url);break;case"telegram":this._telegram.share(this.url,this.title);break;case"mail":this._mail.share(this.url,this.title);break;case"copylink":vP(this.url,t[0]);break;case"google-news":mP();break}P(["Compartiendo en ".concat(i)],ua)},mP=function(){window.open("https://news.google.com/publications/CAAqBwgKMPGypQswtL29Aw?hl=es&gl=ES&ceid=ES%3Aes","_blank")},gP=function(i){var t=Pn("og:title"),e=I.social.facebook.redirectUri,r=this.title,a=Pn("og:site_name"),s=Pn("og:image"),o=i[0].getAttribute("data-img");o&&(s=o),this._facebook.dialogShare(I.social.facebook.appId,this.url,t,e,r,a,s,"popup")};T();J();X();_e();$e();var SS=function(){function n(){k(this,n)}return A(n,[{key:"init",value:function(){var t=window.location.href;t.indexOf(".com")!==-1&&I.timeRefresh!==!1&&setTimeout(function(){Q.getSectionId()==I.sectionsIds.home?window.location=t:window.location=location.href},I.timeRefresh*1e3)}}]),n}();T();J();X();ue();oe();le();T();J();X();ue();oe();Dr();le();ft();mi();T();J();X();ue();oe();Dr();le();ze();mt();Mr();mi();function yP(n,i,t){return i=w(i),q(n,TS()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function TS(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(TS=function(){return!!n})()}var as=function(n){B(i,n);function i(t){var e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:i.SCROLL_TIME_BASE;return k(this,i),e=yP(this,i),e._htmlElement=t,e._timeOut=0,e._scrollTime=r,e._lastProp=0,e._previousDirection=null,e._tmp=null,_P.apply(qe(e)),e}return A(i,[{key:"stop",value:function(){this._tmp&&ba(this._htmlElement,"scroll",this._tmp)}},{key:"setWatch",value:function(e,r){this.watchElem=e,this.watchPixel=r}},{key:"watch",value:function(e){if(this.watchElem){if(this.watchElem.getBoundingClientRect().top<=this.watchPixel){if(this.lastEventWatch!="greater than"){this.lastEventWatch="greater than",e.type=de.ON_DOM_SCROLL_GREATERTHAN,e.prop={},this.dispatchEvent(e);return}}else if(this.lastEventWatch!="less than"){this.lastEventWatch="less than",e.type=de.ON_DOM_SCROLL_LESSTHAN,e.prop={},this.dispatchEvent(e);return}}}}]),i}(Re);as.SCROLL_TIME_BASE=250;var _P=function(){this._tmp=ie(this._htmlElement,"scroll",EP,this)},EP=function(i){var t=this,e,r;e=Fh(this._htmlElement,i.native.target),i.type=de.ON_DOM_SCROLL,i.prop=e,this.dispatchEvent(i),this.watch(i),r=!1,this._lastProp>e&&(r=!0),this._previousDirection!==r&&(r?i.type=de.ON_DOM_CONTRASCROLL_UP:i.type=de.ON_DOM_CONTRASCROLL_DOWN,this.dispatchEvent(i)),this._previousDirection=r,this._lastProp=e,this._timeOut&&window.cancelAnimationFrame(this._timeOut),this._timeOut=window.requestAnimationFrame(function(){e<=0?i.type=de.ON_DOM_SCROLL_TOP:e>=1?i.type=de.ON_DOM_SCROLL_BOTTOM:(i.type=de.ON_DOM_SCROLL_PROGRESS,i.prop=e),t.dispatchEvent(i);var a=Uh(t._htmlElement,i.native.target);a?(i.type=de.ON_DOM_SCROLL_LEFT_MAX,t.dispatchEvent(i)):(i.type=de.ON_DOM_SCROLL_LEFT_PROGRESS,t.dispatchEvent(i))})};Mr();Ut();mt();Se();Bt();function SP(n,i,t){return i=w(i),q(n,bS()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function bS(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(bS=function(){return!!n})()}ne("BROWSER");var ca="BROWSER",Zf=function(n){B(i,n);function i(t){var e;return k(this,i),e=SP(this,i),e._currentPage=0,e._loading=!1,e._error=document.createElement("div"),e._msgErrorLayer=null,e._element=null,e._offset=i.OFFSET_BASE,t!==document?e._scroll=ne
1w as(document.getElementById(t)):e._scroll=new as(document),TP.apply(qe(e)),e}return A(i,[{key:"enableLimitByElement",value:function(e){this.stop(),this._element=e,this._scroll=new as(document),this._scroll.listen(de.ON_DOM_SCROLL,kP,this)}},{key:"setOffset",value:function(e){this._offset=e}},{key:"enableLimitByContainerEnd",value:function(){this.stop(),this._scroll.listen(de.ON_DOM_SCROLL_PROGRESS,kS,this)}},{key:"enableLimitByBottomDocument",value:function(){this.stop(),this._scroll.listen(de.ON_DOM_SCROLL_BOTTOM,bP,this)}},{key:"loadNextPage",value:function(){if(P(["jeef.browser.IScrollMixin>loadNextPage> Se solicita petici\xF3n a nueva p\xE1gina",this._currentPage],ca),!this._loading){var e=Nr(this.getResponseType());this._loading=!0,ae(this.getLoaderBot(),!0),e.listen(he.ON_IO_FINISH,AP,this),e.listen(he.ON_IO_ERROR,IP,this),e.open(this.getUrl(),Wr.GET,this.getParams(this._currentPage+1)),e.send()}}},{key:"refresh",value:function(){P(["jeef.browser.IScrollMixin>refresh> Reseteamos scroll infinito"],ca),this.getContainer().innerHTML="",this._currentPage=-1,this.loadNextPage(),this.getContainer().appendChild(this.getLoaderBot())}},{key:"stop",value:function(){P(["jeef.browser.IScrollMixin>stop> Se solicita parada servicio"],ca),this._scroll.stop()}},{key:"error",value:function(){P(["jeef.browser.IScrollMixin>error> Error Scroll"],ca)}}]),i}(Re);Zf.OFFSET_BASE=200;var TP=function(){this._scroll.listen(de.ON_DOM_SCROLL,kS,this)},bP=function(i){xl(["jeef.browser.IScrollMixin>_onScrollBot> Detectado scroll inferior",i],ca),this.loadNextPage()},kP=function(i){this._element&&Cs(this._element,-150)&&this.loadNextPage()},kS=function(i){window.innerHeight-this.getContainer().getBoundingClientRect().bottom>0&&this.loadNextPage()},AP=function(i){i.response?(this.getContainer().removeChild(this.getLoaderBot()),this.parse(i.response),ae(this.getLoaderBot(),!1),this.getContainer().appendChild(this.getLoaderBot()),this._error.parentNode===this.getContainer()&&this.getContainer().removeChild(this._error),this.page(this._currentPage),this._currentPage++):(this.stop(),this.getContainer().removeChild(this.getLoaderBot())),this._loading=!1},IP=function(i){St(["jeef.browser.IScrollMixin>_onError> Error al recibir p\xE1gina",i],ca),this._loading=!1,ae(this.getLoaderBot(),!1),this.stop(),this._currentPage===-1&&(this._error.innerHTML="",xl(this._error,"info","0 resultados"),this.getContainer().appendChild(this._error)),this.error()};$e();mi();Vn();Gi();ze();Bt();_e();function CP(n,i,t){return i=w(i),q(n,AS()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function AS(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(AS=function(){return!!n})()}var ed=function(n){B(i,n);function i(){var t;return k(this,i),t=CP(this,i,[document]),t._container=document.getElementById("infinite_scroll_list"),t._loaderBot=document.getElementById("infinite_scroll_loader"),t._infoLayer=null,t._url="",t._text="",t._paths=window.location.pathname.split("/"),t._form=null,t.useRealAppend=!0,t._currentPage=0,t}return A(i,[{key:"init",value:function(){switch(!0){case this._paths[1]==="buscador":this._url=I.infinite.buscador;break;case this._paths[1]==="blogs":this._url=I.infinite.blogs;break;case(Q.getMain().contentType==="LIV"||typeof Q.getMain().bodyliveblog!="undefined"||Q.getMain().contentType===10):var e=typeof Q.getMain().bodyliveblog!="undefined"?Q.getMain().bodyliveblog:Q.getMainId();this._url=I.infinite.liveblog+e+".html",this._currentPage=1;break}var r=/http:\/\/[w]+.elespanol.[a-z]+\/buscador\/\?text=/i,a=window.location.href,s="";this._url===I.infinite.buscador&&(s=a.replace(r,""),s!==a&&(this._text=s),this._text=="",this._form=document.getElementById("search"),this._form&&(this._infoLayer=document.createElement("div"),this._container.parentNode.appendChild(this._infoLayer),ie(this._form,"submit",RP,this)))}},{key:"getContainer",value:function(){return this._container}},{key:"getResponseType",value:function(){return Qt.TEXT}},{key:"getLoaderBot",value:function(){return this._loaderBot}},{key:"getUrl",value:function(){return this._url}},{key:"getParams",value:function(e){return this._url===I.infinite.buscador?{page:e,text:this._text}:this._url===I.infinite.blogs?this._paths.length>3?{page:e,url:window.location.pathname}:{page:e}:this._url.indexOf(I.infinite.liveblog)!=-1?{page:e}:{page:e,url:window.location.pathname}}},{key:"parse",value:function(e){Is(this._container,e,!0,this.useRealAppend)}},{key:"page",value:function(e){LP.apply(this,[e])}},{key:"setRealAppendStatus",value:function(e){this.useRealAppend=!!e}}],[{key:"isAvailable",value:function(){var e=document;return e.getElementById("infinite_scroll_list")!=null}}]),i}(Zf);var LP=function(){Yr.getInstance().pageViewCandidate(),It.getInstance().track(I.stats.analytics.events.infiniteScroll)},RP=function(i){this._text=this._form.elements.text.value,this.refresh(),i.native.preventDefault()};Oi();T();wr();J();X();
1var td=fr(xr(),1);Gi();Vn();Mu();Kn();$e();_e();var IS=function(){function n(){var i,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};k(this,n),this.originalUrl=window.location.href,this.isHomePage=Q.getSectionId()===((i=I.sectionsIds)===null||i===void 0?void 0:i.home),this.observer=new IntersectionObserver(this.handleIntersection.bind(this),{root:null,rootMargin:"0px",threshold:[0]}),this.containers=document.querySelectorAll("#content div[data-section]"),this.isHomePage&&(window.history.replaceState({section:this.originalUrl},document.title,this.originalUrl),this.setupContainerClickHandlers(),this.startObserving()),this.setupPopStateHandler()}return A(n,[{key:"setupPopStateHandler",value:function(){var t=this;window.addEventListener("popstate",function(){var e=ut(td.default.mark(function r(a){return td.default.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:a.state?window.location.href=a.state.section:t.isHomePage&&window.scrollTo({top:0,behavior:"smooth"});case 1:case"end":return o.stop()}},r)}));return function(r){return e.apply(this,arguments)}}())}},{key:"setupContainerClickHandlers",value:function(){var t=this;this.containers.forEach(function(e){e.addEventListener("click",function(r){var a=e.dataset.section;a&&(history.scrollRestoration="auto",window.history.replaceState({section:a},document.title,t.originalUrl))})})}},{key:"startObserving",value:function(){var t=this;this.containers.length&&this.containers.forEach(function(e){return t.observer.observe(e)})}},{key:"handleIntersection",value:function(t){var e=this;t.forEach(function(r){if(r.isIntersecting){var a;history.scrollRestoration="manual";var s=r==null||(a=r.target)===null||a===void 0||(a=a.dataset)===null||a===void 0?void 0:a.section;e._updateUrl(s)}else window.location.href!==e.originalUrl&&(r==null?void 0:r.target)===e.containers[0]&&r.boundingClientRect.top>0&&!r.isIntersecting&&(history.scrollRestoration="auto",e._restoreUrl())})}},{key:"_updateUrl",value:function(t){try{window.history.pushState({section:t},document.title,t),this._sendPixel()}catch(e){console.error("Error al actualizar la URL:",e)}}},{key:"_restoreUrl",value:function(){try{window.history.pushState(null,"",this.originalUrl),this._sendPixel()}catch(t){console.error("Error al restaurar la URL:",t)}}},{key:"_sendPixel",value:function(){try{var t=window.location.href.replace("https://www.elespanol.com",""),e=window.location.pathname.split("/")[1];It.getInstance().pageView(t),Yr.getInstance().pageViewCandidate(),Vs.getInstance().track({},e),gr.getInstance().trackConversion("balcon")}catch(r){console.error("Error al enviar el pixel:",r)}}}]),n}();_e();var CS,LS,rd=function(){function n(){k(this,n)}return A(n,null,[{key:"initOnDomLoad",value:function(){jeef.JeefEvents.onPersistentEvent(At.TRIGGER_DIDOMI,function(){var t;Ur.home=!0;var e=new IS;e.startObserving(),Di.getInstance().fit(),new $E().init(),CS=new ES,CS.init(),OP(),window.location.pathname.startsWith("/buscador")&&(t=I.ad.googleCsaAfs)!==null&&t!==void 0&&t.enabled&&Wp(I.ad.googleCsaAfs)})}},{key:"initOnLoad",value:function(){jeef.JeefEvents.onPersistentEvent(At.TRIGGER_DIDOMI,function(){new SS().init()})}}]),n}();var OP=function(){ed.isAvailable()&&(LS=new ed,LS.init())};T();J();X();ue();oe();le();zn();pi();function wP(n,i,t){return i=w(i),q(n,RS()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function RS(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(RS=function(){return!!n})()}var OS=function(n){B(i,n);function i(){return k(this,i),wP(this,i)}return A(i,[{key:"_doSpecificImplementation",value:function(){}},{key:"_postDispatchLogin",value:function(){this._user.dispatchEvent(new xe(xe.ON_LAYOUT_REFRESH)),this._handleOnboardingRedirect()}}]),i}(Gr);T();Ge();J();X();ue();oe();rn();le();_e();T();J();X();ue();oe();le();T();J();X();var wS=function(){function n(){k(this,n),this.elementContainerId="sticky_container",this.elementChildId="sticky_child_content",this.elementContentAdId="sticky_content_adv1",this.buttonElementId="sticky_close",this.buttonElementClose=null,this.stickyElement=null}return A(n,[{key:"getOutput",value:function(){var t=document.createElement("div"),e=document.createElement("div");return e.setAttribute("id",this.elementContentAdId),this.stickyElement=document.createElement("div"),this.stickyElement.setAttribute("id",this.elementContainerId),this.stickyElement.setAttribute("class","stickycontainer"),this.stickyElement.setAttribute("data-action","toggle"),this.stickyElement.setAttribute("data-swipe","top"),this.buttonElementClose=document.createElement("button"),this.buttonElementClose.setAttribute("id",this.buttonElementId),this.buttonElementClose.setAttribute("class","stickycerrar"),this.stickyElement.appendChild(this.buttonElementClose),t.setAttribute("id",this.elementChildId),t.setAttribute("class","stickyanu
1ncio"),t.appendChild(e),this.stickyElement.appendChild(t),this.stickyElement}},{key:"getElementContainerId",value:function(){return this.elementContainerId}},{key:"getElementContentAdId",value:function(){return this.elementContentAdId}},{key:"getButtonElementClose",value:function(){return this.buttonElementClose}},{key:"getStickyElementContainer",value:function(){return this.stickyElement}},{key:"showSticky",value:function(){this.stickyElement.setAttribute("data-swipe","bottom")}},{key:"hideSticky",value:function(){this.stickyElement.setAttribute("data-swipe","top")}}]),n}();mt();Mr();ze();Se();Gi();_e();kn();$e();pt();T();var ss={ON_STICKY_SHOW:"onStickyShow",ON_STICKY_HIDE:"onStickyHide"};$e();lu();function xP(n,i,t){return i=w(i),q(n,xS()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function xS(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(xS=function(){return!!n})()}var Xo="STICKY-AD-ABSTRACT";ne("STICKY-AD-ABSTRACT");var PS=function(n){B(i,n);function i(){var t;return k(this,i),t=xP(this,i),t.dontOpenAgain=!1,t.containerSticky=new wS,t.objectAppendAdId="article__footer-nav",t.objectAppendAd=null,t.buttonHomeId="gallerynews_home_mobile",t.objectReferenceId=null,t.objectReferenceVP=null,t.objectButtonHome=null,t.pixelsToShowSticky=40,t.objectAdSubscriptor=null,t.componentAd=[{container:t.containerSticky.getElementContentAdId(),type:te.components.ADLOAD,trigger:te.triggers.ON_AD_READY,params:{container:t.containerSticky.getElementContentAdId()}}],t.eventLinks=Tt.iphone||Tt.ios?"touchstart":de.ON_DOM_CLICK,t.flagLoadEvents=!1,t}return A(i,[{key:"init",value:function(){!Q.isSuscriberContent()&&tv()&&(this.searchObjectRefVP(),this.objectReferenceVP&&(jeef.JeefEvents.on(Pe.ON_SCROLLED_TOP,function(){jeef.JeefEvents.emit(ss.ON_STICKY_SHOW)}),jeef.JeefEvents.on(Pe.ON_UNSCROLLED_TOP,function(){jeef.JeefEvents.emit(ss.ON_STICKY_HIDE)})),this.getObjectAdSubscriptor().checkLoadAds()&&(this.loadStickyTemplateInDOM(),this.objectButtonHome=document.getElementById(this.buttonHomeId),this.loadAd(),this.loadEvents()))}},{key:"loadEvents",value:function(){var e=this;this.flagLoadEvents||(this.objectButtonHome&&ie(this.objectButtonHome,this.eventLinks,i._onClickButtonHome),jeef.JeefEvents.on(ss.ON_STICKY_SHOW,function(){if(!e.dontOpenAgain){e.containerSticky.showSticky();var r=[I.sectionsIds.home,I.sectionsIds.mujer,I.sectionsIds.espana,I.sectionsIds.jaleos,I.sectionsIds.sociedad];!r.includes(Q.getSectionId())&&I.site===He.elespanol&&setTimeout(function(){e.containerSticky.hideSticky(),e.dontOpenAgain=!0},1e4)}}),jeef.JeefEvents.on(ss.ON_STICKY_HIDE,function(){e.containerSticky.hideSticky()}),this.flagLoadEvents=!0),ie(this.containerSticky.getButtonElementClose(),this.eventLinks,this._callBackButtonClose,this)}},{key:"loadAd",value:function(){te.getInstance().load(this.componentAd),P(["Cargando publicidad de STICKY"],Xo)}},{key:"searchObjectRefVP",value:function(){try{this.setObjectReferenceVP(document.getElementById(this.objectReferenceId)),P(["Buscamos elemento de referencia para mostrar el STICKY"],Xo)}catch(e){return console.log("searchObjectRefVP",e),!1}}},{key:"loadStickyTemplateInDOM",value:function(){try{this.objectAppendAd=document.getElementById(this.objectAppendAdId),this.objectAppendAd&&this.objectAppendAd.parentNode.insertBefore(this.containerSticky.getOutput(),this.objectAppendAd)}catch(e){return console.log("loadStickyTemplateInDOM",e),!1}}},{key:"_callBackButtonClose",value:function(e){return this.containerSticky.getStickyElementContainer().remove(),P(["Evento click de bot\xF3n de cierre de Sticky",this.containerSticky.getStickyElementContainer()],Xo),console.log("Evento click de bot\xF3n de cierre de Sticky"),e.native.preventDefault(),!1}},{key:"setObjectAdSubscriptor",value:function(e){this.objectAdSubscriptor=e}},{key:"getObjectAdSubscriptor",value:function(){return this.objectAdSubscriptor}},{key:"setIdObjectReferenceVP",value:function(e){this.objectReferenceId=e}},{key:"setIdObjectAppendAd",value:function(e){this.objectAppendAdId=e}},{key:"getIdObjectReferenceVP",value:function(){return this.objectReferenceId}},{key:"getIdObjectAppendAd",value:function(){return this.objectAppendAdId}},{key:"getObjectAppendAd",value:function(){return this.objectAppendAd}},{key:"setObjectAppendAd",value:function(e){this.objectAppendAd=e}},{key:"setObjectReferenceVP",value:function(e){this.objectReferenceVP=e}},{key:"getObjectReferenceVP",value:function(){return this.objectReferenceVP}}],[{key:"_onClickButtonHome",value:function(e){var r=function(){window.location.href=e.currentTarget.getAttribute("href")};return It.getInstance().simpleTrackWithCallback(I.stats.analytics.events.swipeNav.buttonHome,r),P(["Enviando evento Analytics",I.stats.analytics.events.swipeNav.buttonHome,e.currentTarget.getAttribute("href")],Xo),e.native.preventDefault(),!1}},{key:"getIdObjectStickyReferenceContent",value:function(){var e="sticky_reference_"+Q.getMainId();return Q.getStickyId()&&(e=Q.getStickyId()+"_"+Q.getMainId()),e}},{key:"getIdObjectStickyReferenceHome",value:function(){var e="sticky_reference";return Q.getStickyId()&&(e=Q.getStickyId()),e}},{key:"createButtonGoHome",value:function(){var e;document.getElementById("gallerynews_prev_mobile")&&document.getElementById("gallerynews_prev_mobile").remove();var r=((e=data[0])===null||e===void 0||(e=e.params)===null||e===void 0||(e=e.elements[0])===null||e===void 0||(e=e.data)===null||e===void 0?void 0:e.xVersion)||"";if(!document.getElementById("gallerynews_home_mobile")&&r!=="2"){var a=document.createElement("a"),s=document.createElement("strong"),o=document.getElementById("article__footer-nav");a.setAttribute("id","gallerynews_home_mobile"),a.setAttribute("data-type","home"),a.setAttribute("data-target","gallerycontent-mobile"),a.setAttribute("class","footer-nav__button footer-nav__button--prev"),a.setAttribute("data-action","toggle"),a.setAttribute("data-status","on"),a.setAttribute("href",window.location.protocol+"//"+window.location.host),s.innerText="Portada",a.appendChild(s),o&&o.appendChild(a)}}}]),i}(Re);pt();ln();function DS(n,i){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);i&&(e=e.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,e)}return t}function MS(n){for(var i=1;i<arguments.length;i++){var t=arguments[i]!=null?arguments[i]:{};
1i%2?DS(Object(t),!0).forEach(function(e){V(n,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):DS(Object(t)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})}return n}function PP(n,i,t){return i=w(i),q(n,NS()?Reflect.construct(i,t||[],w(n).constructor):i.apply(n,t))}function NS(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(i){}return(NS=function(){return!!n})()}function Qo(n,i,t,e){var r=ar(w(1&e?n.prototype:n),i,t);return 2&e&&typeof r=="function"?function(a){return r.apply(t,a)}:r}var FS=function(n){B(i,n);function i(){var t;return k(this,i),t=PP(this,i),t.alternativeObjectReferenceVP=null,t.alternativeObjectAppendAd=null,t}return A(i,[{key:"init",value:function(){var e=I.ad.stickyConfig,r=MS(MS({},e==null?void 0:e.default),Ar(e,e==null?void 0:e.default));!r.home||!Me&&r.disableDesktop||(this.setIdObjectReferenceVP(i.getIdObjectStickyReferenceHome()),this.setIdAlternativeObjectReferenceVP("megasuperior"),this.setIdObjectAppendAd("sticky_append"),this.setIdAlternativeObjectAppendAd("content_up"),Qo(i,"init",this,3)([]))}},{key:"searchObjectRefVP",value:function(){Qo(i,"searchObjectRefVP",this,3)([]),this.getObjectReferenceVP()||this.setObjectReferenceVP(document.getElementById(this.getIdAlternativeObjectReferenceVP()))}},{key:"loadStickyTemplateInDOM",value:function(){Qo(i,"loadStickyTemplateInDOM",this,3)([]),this.getObjectAppendAd()||(this.setIdObjectAppendAd(this.getIdAlternativeObjectAppendAd()),Qo(i,"loadStickyTemplateInDOM",this,3)([]))}},{key:"setIdAlternativeObjectReferenceVP",value:function(e){this.alternativeObjectReferenceVP=e}},{key:"getIdAlternativeObjectReferenceVP",value:function(){return this.alternativeObjectReferenceVP}},{key:"setIdAlternativeObjectAppendAd",value:function(e){this.alternativeObjectAppendAd=e}},{key:"getIdAlternativeObjectAppendAd",value:function(){return this.alternativeObjectAppendAd}}]),i}(PS);(function(){var n=new QE().setPianoIntegration(new OS).setStickyAd(new FS).init(),i=function(){rd.initOnDomLoad()},t=function(){rd.initOnLoad()};ie(n,de.ON_DOM_CONTENT_LOADED,i),ie(n,de.ON_DOM_LOAD,t)})();})(); 2/*! Bundled license information: 3 4@babel/runtime/helpers/regeneratorRuntime.js: 5 (*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE *) 6*/
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.