@golstats/gsc-landing 1.0.181 → 1.0.182

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -64,4 +64,4 @@
64
64
  `),c=[],h=e?WN(e.baseTime,e.timescale):0;let u="00:00.000",f=0,g=0,m,p=!0;l.oncue=function(y){const b=t[a];let S=t.ccOffset;const w=(f-h)/9e4;if(b!=null&&b.new&&(g!==void 0?S=t.ccOffset=b.start:AD(t,a,w)),w){if(!e){m=new Error("Missing initPTS for VTT MPEGTS");return}S=w-t.presentationOffset}const x=y.endTime-y.startTime,E=Tt((y.startTime+S-g)*9e4,i*9e4)/9e4;y.startTime=Math.max(E,0),y.endTime=Math.max(E+x,0);const v=y.text.trim();y.text=decodeURIComponent(encodeURIComponent(v)),y.id||(y.id=zl(y.startTime,y.endTime,v)),y.endTime>0&&c.push(y)},l.onparsingerror=function(y){m=y},l.onflush=function(){if(m){r(m);return}o(c)},d.forEach(y=>{if(p)if(Vl(y,"X-TIMESTAMP-MAP=")){p=!1,y.slice(16).split(",").forEach(b=>{Vl(b,"LOCAL:")?u=b.slice(6):Vl(b,"MPEGTS:")&&(f=parseInt(b.slice(7)))});try{g=vD(u)/1e3}catch(b){m=b}return}else y===""&&(p=!1);l.parse(y+`
65
65
  `)}),l.flush()}const Ul="stpp.ttml.im1t",Jp=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Xp=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,ID={left:"start",center:"center",right:"end",start:"start",end:"end"};function Zp(s,e,t,a){const i=Se(new Uint8Array(s),["mdat"]);if(i.length===0){a(new Error("Could not parse IMSC1 mdat"));return}const o=i.map(l=>Ut(l)),r=HN(e.baseTime,1,e.timescale);try{o.forEach(l=>t(RD(l,r)))}catch(l){a(l)}}function RD(s,e){const i=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("tt")[0];if(!i)throw new Error("Invalid ttml");const o={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},r=Object.keys(o).reduce((u,f)=>(u[f]=i.getAttribute(`ttp:${f}`)||o[f],u),{}),l=i.getAttribute("xml:space")!=="preserve",d=Qp(Gl(i,"styling","style")),c=Qp(Gl(i,"layout","region")),h=Gl(i,"body","[begin]");return[].map.call(h,u=>{const f=eg(u,l);if(!f||!u.hasAttribute("begin"))return null;const g=Hl(u.getAttribute("begin"),r),m=Hl(u.getAttribute("dur"),r);let p=Hl(u.getAttribute("end"),r);if(g===null)throw tg(u);if(p===null){if(m===null)throw tg(u);p=g+m}const y=new Fl(g-e,p-e,f);y.id=zl(y.startTime,y.endTime,y.text);const b=c[u.getAttribute("region")],S=d[u.getAttribute("style")],w=BD(b,S,d),{textAlign:x}=w;if(x){const E=ID[x];E&&(y.lineAlign=E),y.align=x}return je(y,w),y}).filter(u=>u!==null)}function Gl(s,e,t){const a=s.getElementsByTagName(e)[0];return a?[].slice.call(a.querySelectorAll(t)):[]}function Qp(s){return s.reduce((e,t)=>{const a=t.getAttribute("xml:id");return a&&(e[a]=t),e},{})}function eg(s,e){return[].slice.call(s.childNodes).reduce((t,a,i)=>{var o;return a.nodeName==="br"&&i?t+`
66
66
  `:(o=a.childNodes)!=null&&o.length?eg(a,e):e?t+a.textContent.trim().replace(/\s+/g," "):t+a.textContent},"")}function BD(s,e,t){const a="http://www.w3.org/ns/ttml#styling";let i=null;const o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],r=s!=null&&s.hasAttribute("style")?s.getAttribute("style"):null;return r&&t.hasOwnProperty(r)&&(i=t[r]),o.reduce((l,d)=>{const c=jl(e,a,d)||jl(s,a,d)||jl(i,a,d);return c&&(l[d]=c),l},{})}function jl(s,e,t){return s&&s.hasAttributeNS(e,t)?s.getAttributeNS(e,t):null}function tg(s){return new Error(`Could not parse ttml timestamp ${s}`)}function Hl(s,e){if(!s)return null;let t=Kp(s);return t===null&&(Jp.test(s)?t=ND(s,e):Xp.test(s)&&(t=DD(s,e))),t}function ND(s,e){const t=Jp.exec(s),a=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+a/e.frameRate}function DD(s,e){const t=Xp.exec(s),a=Number(t[1]);switch(t[2]){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/e.frameRate;case"t":return a/e.tickRate}return a}class PD{constructor(e){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=ng(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.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}},e.on(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(_.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(_.FRAG_LOADING,this.onFragLoading,this),e.on(_.FRAG_LOADED,this.onFragLoaded,this),e.on(_.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(_.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(_.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(_.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(_.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(_.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(_.FRAG_LOADING,this.onFragLoading,this),e.off(_.FRAG_LOADED,this.onFragLoaded,this),e.off(_.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(_.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(_.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(_.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(_.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){const e=new _i(this,"textTrack1"),t=new _i(this,"textTrack2"),a=new _i(this,"textTrack3"),i=new _i(this,"textTrack4");this.cea608Parser1=new Wp(1,e,t),this.cea608Parser2=new Wp(3,a,i)}}addCues(e,t,a,i,o){let r=!1;for(let l=o.length;l--;){const d=o[l],c=OD(d[0],d[1],t,a);if(c>=0&&(d[0]=Math.min(d[0],t),d[1]=Math.max(d[1],a),r=!0,c/(a-t)>.5))return}if(r||o.push([t,a]),this.config.renderTextTracksNatively){const l=this.captionsTracks[e];this.Cues.newCue(l,t,a,i)}else{const l=this.Cues.newCue(null,t,a,i);this.hls.trigger(_.CUES_PARSED,{type:"captions",cues:l,track:e})}}onInitPtsFound(e,{frag:t,id:a,initPTS:i,timescale:o}){const{unparsedVttFrags:r}=this;a==="main"&&(this.initPTS[t.cc]={baseTime:i,timescale:o}),r.length&&(this.unparsedVttFrags=[],r.forEach(l=>{this.onFragLoaded(_.FRAG_LOADED,l)}))}getExistingTrack(e,t){const{media:a}=this;if(a)for(let i=0;i<a.textTracks.length;i++){const o=a.textTracks[i];if(ag(o,{name:e,lang:t,attrs:{}}))return o}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:a,media:i}=this,{label:o,languageCode:r}=t[e],l=this.getExistingTrack(o,r);if(l)a[e]=l,Hs(a[e]),Kf(a[e],i);else{const d=this.createTextTrack("captions",o,r);d&&(d[e]=!0,a[e]=d)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const a=t.label,i={_id:e,label:a,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=i,this.hls.trigger(_.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}createTextTrack(e,t,a){const i=this.media;if(i)return i.addTextTrack(e,t,a)}onMediaAttaching(e,t){this.media=t.media,this._cleanTracks()}onMediaDetaching(){const{captionsTracks:e}=this;Object.keys(e).forEach(t=>{Hs(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=ng(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let a=0;a<t.length;a++)Hs(t[a])}onSubtitleTracksUpdated(e,t){const a=t.subtitleTracks||[],i=a.some(o=>o.textCodec===Ul);if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(Mp(this.tracks,a)){this.tracks=a;return}if(this.textTracks=[],this.tracks=a,this.config.renderTextTracksNatively){const r=this.media,l=r?si(r.textTracks):null;if(this.tracks.forEach((d,c)=>{let h;if(l){let u=null;for(let f=0;f<l.length;f++)if(l[f]&&ag(l[f],d)){u=l[f],l[f]=null;break}u&&(h=u)}if(h)Hs(h);else{const u=sg(d);h=this.createTextTrack(u,d.name,d.lang),h&&(h.mode="disabled")}h&&this.textTracks.push(h)}),l!=null&&l.length){const d=l.filter(c=>c!==null).map(c=>c.label);d.length&&A.warn(`Media element contains unused subtitle tracks: ${d.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const r=this.tracks.map(l=>({label:l.name,kind:l.type.toLowerCase(),default:l.default,subtitleTrack:l}));this.hls.trigger(_.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:r})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(a=>{const i=/(?:CC|SERVICE)([1-4])/.exec(a.instreamId);if(!i)return;const o=`textTrack${i[1]}`,r=this.captionsProperties[o];r&&(r.label=a.name,a.lang&&(r.languageCode=a.lang),r.media=a)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===ce.MAIN){var a,i;const{cea608Parser1:o,cea608Parser2:r,lastSn:l}=this,{cc:d,sn:c}=t.frag,h=(a=(i=t.part)==null?void 0:i.index)!=null?a:-1;o&&r&&(c!==l+1||c===l&&h!==this.lastPartIndex+1||d!==this.lastCc)&&(o.reset(),r.reset()),this.lastCc=d,this.lastSn=c,this.lastPartIndex=h}}onFragLoaded(e,t){const{frag:a,payload:i}=t;if(a.type===ce.SUBTITLE)if(i.byteLength){const o=a.decryptdata,r="stats"in t;if(o==null||!o.encrypted||r){const l=this.tracks[a.level],d=this.vttCCs;d[a.cc]||(d[a.cc]={start:a.start,prevCC:this.prevCC,new:!0},this.prevCC=a.cc),l&&l.textCodec===Ul?this._parseIMSC1(a,i):this._parseVTTs(t)}}else this.hls.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:a,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const a=this.hls;Zp(t,this.initPTS[e.cc],i=>{this._appendCues(i,e.level),a.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},i=>{A.log(`Failed to parse IMSC1: ${i}`),a.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:i})})}_parseVTTs(e){var t;const{frag:a,payload:i}=e,{initPTS:o,unparsedVttFrags:r}=this,l=o.length-1;if(!o[a.cc]&&l===-1){r.push(e);return}const d=this.hls,c=(t=a.initSegment)!=null&&t.data?Et(a.initSegment.data,new Uint8Array(i)):i;LD(c,this.initPTS[a.cc],this.vttCCs,a.cc,a.start,h=>{this._appendCues(h,a.level),d.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:a})},h=>{const u=h.message==="Missing initPTS for VTT MPEGTS";u?r.push(e):this._fallbackToIMSC1(a,i),A.log(`Failed to parse VTT cue: ${h}`),!(u&&l>a.cc)&&d.trigger(_.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:a,error:h})})}_fallbackToIMSC1(e,t){const a=this.tracks[e.level];a.textCodec||Zp(t,this.initPTS[e.cc],()=>{a.textCodec=Ul,this._parseIMSC1(e,t)},()=>{a.textCodec="wvtt"})}_appendCues(e,t){const a=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[t];if(!i||i.mode==="disabled")return;e.forEach(o=>qf(i,o))}else{const i=this.tracks[t];if(!i)return;const o=i.default?"default":"subtitles"+t;a.trigger(_.CUES_PARSED,{type:"subtitles",cues:e,track:o})}}onFragDecrypted(e,t){const{frag:a}=t;a.type===ce.SUBTITLE&&this.onFragLoaded(_.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();const{cea608Parser1:a,cea608Parser2:i}=this;if(!this.enabled||!a||!i)return;const{frag:o,samples:r}=t;if(!(o.type===ce.MAIN&&this.closedCaptionsForLevel(o)==="NONE"))for(let l=0;l<r.length;l++){const d=r[l].bytes;if(d){const c=this.extractCea608Data(d);a.addData(r[l].pts,c[0]),i.addData(r[l].pts,c[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:a,endOffsetSubtitles:i,type:o}){const{media:r}=this;if(!(!r||r.currentTime<a)){if(!o||o==="video"){const{captionsTracks:l}=this;Object.keys(l).forEach(d=>fl(l[d],t,a))}if(this.config.renderTextTracksNatively&&t===0&&i!==void 0){const{textTracks:l}=this;Object.keys(l).forEach(d=>fl(l[d],t,i))}}}extractCea608Data(e){const t=[[],[]],a=e[0]&31;let i=2;for(let o=0;o<a;o++){const r=e[i++],l=127&e[i++],d=127&e[i++];if(l===0&&d===0)continue;if((4&r)!==0){const h=3&r;(h===0||h===1)&&(t[h].push(l),t[h].push(d))}}return t}}function sg(s){return s.characteristics&&/transcribes-spoken-dialog/gi.test(s.characteristics)&&/describes-music-and-sound/gi.test(s.characteristics)?"captions":"subtitles"}function ag(s,e){return!!s&&s.kind===sg(e)&&Pl(e,s)}function OD(s,e,t,a){return Math.min(e,a)-Math.max(s,t)}function ng(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class Wl{constructor(e){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=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(_.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.BUFFER_CODECS,this.onBufferCodecs,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(_.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.BUFFER_CODECS,this.onBufferCodecs,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const a=this.hls.levels[t.droppedLevel];this.isLevelAllowed(a)&&this.restrictedLevels.push({bitrate:a.bitrate,height:a.height,width:a.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const a=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,a.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&ae(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,a=this.getMaxLevel(e.length-1);a!==this.autoLevelCapping&&A.log(`Setting autoLevelCapping to ${a}: ${e[a].height}p@${e[a].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=a,t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const a=t.filter((i,o)=>this.isLevelAllowed(i)&&o<=e);return this.clientRect=null,Wl.getMaxLevelByMediaSize(a,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const a=e.getBoundingClientRect();t.width=a.width,t.height=a.height,!t.width&&!t.height&&(t.width=a.right-a.left||e.width||0,t.height=a.bottom-a.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return e}isLevelAllowed(e){return!this.restrictedLevels.some(a=>e.bitrate===a.bitrate&&e.width===a.width&&e.height===a.height)}static getMaxLevelByMediaSize(e,t,a){if(!(e!=null&&e.length))return-1;const i=(l,d)=>d?l.width!==d.width||l.height!==d.height:!0;let o=e.length-1;const r=Math.max(t,a);for(let l=0;l<e.length;l+=1){const d=e[l];if((d.width>=r||d.height>=r)&&i(d,e[l+1])){o=l;break}}return o}}class FD{constructor(e){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=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(_.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(_.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const a=this.hls.config;if(a.capLevelOnFPSDrop){const i=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=i,i&&typeof i.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),a.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,a){const i=performance.now();if(t){if(this.lastTime){const o=i-this.lastTime,r=a-this.lastDroppedFrames,l=t-this.lastDecodedFrames,d=1e3*r/o,c=this.hls;if(c.trigger(_.FPS_DROP,{currentDropped:r,currentDecoded:l,totalDroppedFrames:a}),d>0&&r>c.config.fpsDroppedMonitoringThreshold*l){let h=c.currentLevel;A.warn("drop FPS ratio greater than max allowed value for currentLevel: "+h),h>0&&(c.autoLevelCapping===-1||c.autoLevelCapping>=h)&&(h=h-1,c.trigger(_.FPS_DROP_LEVEL_CAPPING,{level:h,droppedLevel:c.currentLevel}),c.autoLevelCapping=h,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=a,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}const ki="[eme]";class ea{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=ea.CDMCleanupPromise?[ea.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=A.debug.bind(A,ki),this.log=A.log.bind(A,ki),this.warn=A.warn.bind(A,ki),this.error=A.error.bind(A,ki),this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null}registerListeners(){this.hls.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(_.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(_.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(_.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(_.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(_.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(_.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:a}=this.config,i=t[e];if(i)return i.licenseUrl;if(e===De.WIDEVINE&&a)return a;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,a=t[e];if(a)return a.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,a=(r,l,d)=>!!r&&d.indexOf(r)===l,i=t.map(r=>r.audioCodec).filter(a),o=t.map(r=>r.videoCodec).filter(a);return i.length+o.length===0&&o.push("avc1.42e01e"),new Promise((r,l)=>{const d=c=>{const h=c.shift();this.getMediaKeysPromise(h,i,o).then(u=>r({keySystem:h,mediaKeys:u})).catch(u=>{c.length?d(c):u instanceof Ct?l(u):l(new Ct({type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_NO_ACCESS,error:u,fatal:!0},u.message))})};d(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:a}=this.config;if(typeof a!="function"){let i=`Configured requestMediaKeySystemAccess is not a function ${a}`;return bf===null&&self.location.protocol==="http:"&&(i=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(i))}return a(e,t)}getMediaKeysPromise(e,t,a){const i=G3(e,t,a,this.config.drmSystemOptions),o=this.keySystemAccessPromises[e];let r=o==null?void 0:o.keySystemAccess;if(!r){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(i)}`),r=this.requestMediaKeySystemAccess(e,i);const l=this.keySystemAccessPromises[e]={keySystemAccess:r};return r.catch(d=>{this.log(`Failed to obtain access to key-system "${e}": ${d}`)}),r.then(d=>{this.log(`Access for key-system "${d.keySystem}" obtained`);const c=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),l.mediaKeys=d.createMediaKeys().then(h=>(this.log(`Media-keys created for "${e}"`),c.then(u=>u?this.setMediaKeysServerCertificate(h,e,u):h))),l.mediaKeys.catch(h=>{this.error(`Failed to create media-keys for "${e}"}: ${h}`)}),l.mediaKeys})}return r.then(()=>o.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:a}){this.log(`Creating key-system session "${t}" keyId: ${Gt.hexDump(e.keyId||[])}`);const i=a.createSession(),o={decryptdata:e,keySystem:t,mediaKeys:a,mediaKeysSession:i,keyStatus:"status-pending"};return this.mediaKeySessions.push(o),o}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const a=this.createMediaKeySessionContext(e),i=this.getKeyIdString(t),o="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(a,o,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return Gt.hexDump(e.keyId)}updateKeySession(e,t){var a;const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyID ${Gt.hexDump(((a=e.decryptdata)==null?void 0:a.keyId)||[])}
67
- } (data length: ${t&&t.byteLength})`),i.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise((t,a)=>{const i=nl(this.config),o=e.map(pf).filter(r=>!!r&&i.indexOf(r)!==-1);return this.getKeySystemSelectionPromise(o).then(({keySystem:r})=>{const l=yf(r);l?t(l):a(new Error(`Unable to find format for key-system "${r}"`))}).catch(a)})}loadKey(e){const t=e.keyInfo.decryptdata,a=this.getKeyIdString(t),i=`(keyId: ${a} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${i}`);let o=this.keyIdToKeySessionPromise[a];return o||(o=this.keyIdToKeySessionPromise[a]=this.getKeySystemForKeyPromise(t).then(({keySystem:r,mediaKeys:l})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${i}`),this.attemptSetMediaKeys(r,l).then(()=>{this.throwIfDestroyed();const d=this.createMediaKeySessionContext({keySystem:r,mediaKeys:l,decryptdata:t});return this.generateRequestWithPreferredKeySession(d,"cenc",t.pssh,"playlist-key")}))),o.catch(r=>this.handleError(r))),o}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Ct?this.hls.trigger(_.ERROR,e.data):this.hls.trigger(_.ERROR,{type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),a=this.keyIdToKeySessionPromise[t];if(!a){const i=pf(e.keyFormat),o=i?[i]:nl(this.config);return this.attemptKeySystemAccess(o)}return a}getKeySystemSelectionPromise(e){if(e.length||(e=nl(this.config)),e.length===0)throw new Ct({type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}_onMediaEncrypted(e){const{initDataType:t,initData:a}=e,i=`"${e.type}" event: init data type: "${t}"`;if(this.debug(i),a===null)return;let o,r;if(t==="sinf"&&this.config.drmSystems[De.FAIRPLAY]){const u=qe(new Uint8Array(a));try{const f=sl(JSON.parse(u).sinf),g=vf(new Uint8Array(f));if(!g)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");o=g.subarray(8,24),r=De.FAIRPLAY}catch(f){this.warn(`${i} Failed to parse sinf: ${f}`);return}}else{const u=f6(a),f=u.filter(g=>g.systemId===Ia.WIDEVINE)[0];if(!f){u.length===0||u.some(g=>!g.systemId)?this.warn(`${i} contains incomplete or invalid pssh data`):this.log(`ignoring ${i} for ${u.map(g=>gf(g.systemId)).join(",")} pssh data in favor of playlist keys`);return}if(r=gf(f.systemId),f.version===0&&f.data){const g=f.data.length-22;o=f.data.subarray(g,g+16)}}if(!r||!o)return;const l=Gt.hexDump(o),{keyIdToKeySessionPromise:d,mediaKeySessions:c}=this;let h=d[l];for(let u=0;u<c.length;u++){const f=c[u],g=f.decryptdata;if(!g.keyId)continue;const m=Gt.hexDump(g.keyId);if(l===m||g.uri.replace(/-/g,"").indexOf(l)!==-1){if(h=d[m],g.pssh)break;delete d[m],g.pssh=new Uint8Array(a),g.keyId=o,h=d[l]=h.then(()=>this.generateRequestWithPreferredKeySession(f,t,a,"encrypted-event-key-match"));break}}h||(h=d[l]=this.getKeySystemSelectionPromise([r]).then(({keySystem:u,mediaKeys:f})=>{var g;this.throwIfDestroyed();const m=new Ba("ISO-23001-7",l,(g=yf(u))!=null?g:"");return m.pssh=new Uint8Array(a),m.keyId=o,this.attemptSetMediaKeys(u,f).then(()=>{this.throwIfDestroyed();const p=this.createMediaKeySessionContext({decryptdata:m,keySystem:u,mediaKeys:f});return this.generateRequestWithPreferredKeySession(p,t,a,"encrypted-event-no-match")})})),h.catch(u=>this.handleError(u))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const a=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const i=Promise.all(a).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(i),i.then(()=>{this.log(`Media-keys set for "${e}"`),a.push(i),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(o=>a.indexOf(o)===-1)})}generateRequestWithPreferredKeySession(e,t,a,i){var o,r;const l=(o=this.config.drmSystems)==null||(r=o[e.keySystem])==null?void 0:r.generateRequest;if(l)try{const m=l.call(this.hls,t,a,e);if(!m)throw new Error("Invalid response from configured generateRequest filter");t=m.initDataType,a=e.decryptdata.pssh=m.initData?new Uint8Array(m.initData):null}catch(m){var d;if(this.warn(m.message),(d=this.hls)!=null&&d.config.debug)throw m}if(a===null)return this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(e);const c=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${i}": ${c} (init data type: ${t} length: ${a?a.byteLength:null})`);const h=new Dl,u=e._onmessage=m=>{const p=e.mediaKeysSession;if(!p){h.emit("error",new Error("invalid state"));return}const{messageType:y,message:b}=m;this.log(`"${y}" message event for session "${p.sessionId}" message size: ${b.byteLength}`),y==="license-request"||y==="license-renewal"?this.renewLicense(e,b).catch(S=>{this.handleError(S),h.emit("error",S)}):y==="license-release"?e.keySystem===De.FAIRPLAY&&(this.updateKeySession(e,al("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${y}"`)},f=e._onkeystatuseschange=m=>{if(!e.mediaKeysSession){h.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const y=e.keyStatus;h.emit("keyStatus",y),y==="expired"&&(this.warn(`${e.keySystem} expired for key ${c}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",u),e.mediaKeysSession.addEventListener("keystatuseschange",f);const g=new Promise((m,p)=>{h.on("error",p),h.on("keyStatus",y=>{y.startsWith("usable")?m():y==="output-restricted"?p(new Ct({type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):y==="internal-error"?p(new Ct({type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${y}"`)):y==="expired"?p(new Error("key expired while generating request")):this.warn(`unhandled key status change "${y}"`)})});return e.mediaKeysSession.generateRequest(t,a).then(()=>{var m;this.log(`Request generated for key-session "${(m=e.mediaKeysSession)==null?void 0:m.sessionId}" keyId: ${c}`)}).catch(m=>{throw new Ct({type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_NO_SESSION,error:m,fatal:!1},`Error generating key-session request: ${m}`)}).then(()=>g).catch(m=>{throw h.removeAllListeners(),this.removeSession(e),m}).then(()=>(h.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,a)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${Gt.hexDump("buffer"in a?new Uint8Array(a.buffer,a.byteOffset,a.byteLength):new Uint8Array(a))} session keyId: ${Gt.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,a=t.loader,i=new a(t),o=this.getServerCertificateUrl(e);return o?(this.log(`Fetching server certificate for "${e}"`),new Promise((r,l)=>{const d={responseType:"arraybuffer",url:o},c=t.certLoadPolicy.default,h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(f,g,m,p)=>{r(f.data)},onError:(f,g,m,p)=>{l(new Ct({type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:et({url:d.url,data:void 0},f)},`"${e}" certificate request failed (${o}). Status: ${f.code} (${f.text})`))},onTimeout:(f,g,m)=>{l(new Ct({type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:{url:d.url,data:void 0}},`"${e}" certificate request timed out (${o})`))},onAbort:(f,g,m)=>{l(new Error("aborted"))}};i.load(d,h,u)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,a){return new Promise((i,o)=>{e.setServerCertificate(a).then(r=>{this.log(`setServerCertificate ${r?"success":"not supported by CDM"} (${a==null?void 0:a.byteLength}) on "${t}"`),i(e)}).catch(r=>{o(new Ct({type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:r,fatal:!0},r.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(a=>this.updateKeySession(e,new Uint8Array(a)).catch(i=>{throw new Ct({type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:i,fatal:!0},i.message)}))}unpackPlayReadyKeyMessage(e,t){const a=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!a.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const i=new DOMParser().parseFromString(a,"application/xml"),o=i.querySelectorAll("HttpHeader");if(o.length>0){let h;for(let u=0,f=o.length;u<f;u++){var r,l;h=o[u];const g=(r=h.querySelector("name"))==null?void 0:r.textContent,m=(l=h.querySelector("value"))==null?void 0:l.textContent;g&&m&&e.setRequestHeader(g,m)}}const d=i.querySelector("Challenge"),c=d==null?void 0:d.textContent;if(!c)throw new Error("Cannot find <Challenge> in key message");return al(atob(c))}setupLicenseXHR(e,t,a,i){const o=this.config.licenseXhrSetup;return o?Promise.resolve().then(()=>{if(!a.decryptdata)throw new Error("Key removed");return o.call(this.hls,e,t,a,i)}).catch(r=>{if(!a.decryptdata)throw r;return e.open("POST",t,!0),o.call(this.hls,e,t,a,i)}).then(r=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:r||i})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:i}))}requestLicense(e,t){const a=this.config.keyLoadPolicy.default;return new Promise((i,o)=>{const r=this.getLicenseServerUrl(e.keySystem);this.log(`Sending license request to URL: ${r}`);const l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return o(new Error("invalid state"));if(l.readyState===4)if(l.status===200){this._requestLicenseFailureCount=0;let d=l.response;this.log(`License received ${d instanceof ArrayBuffer?d.byteLength:d}`);const c=this.config.licenseResponseCallback;if(c)try{d=c.call(this.hls,l,r,e)}catch(h){this.error(h)}i(d)}else{const d=a.errorRetry,c=d?d.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>c||l.status>=400&&l.status<500)o(new Ct({type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:l,response:{url:r,data:void 0,code:l.status,text:l.statusText}},`License Request XHR failed (${r}). Status: ${l.status} (${l.statusText})`));else{const h=c-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${h} attempts left`),this.requestLicense(e,t).then(i,o)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=l,this.setupLicenseXHR(l,r,e,t).then(({xhr:d,licenseChallenge:c})=>{e.keySystem==De.PLAYREADY&&(c=this.unpackPlayReadyKeyMessage(d,c)),d.send(c)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const a=t.media;this.media=a,a.addEventListener("encrypted",this.onMediaEncrypted),a.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Ba.clearKeyUriToKeyIdMap();const a=t.length;ea.CDMCleanupPromise=Promise.all(t.map(i=>this.removeSession(i)).concat(e==null?void 0:e.setMediaKeys(null).catch(i=>{this.log(`Could not clear media keys: ${i}`)}))).then(()=>{a&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(i=>{this.log(`Could not close sessions and clear media keys: ${i}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const a=t.reduce((i,o)=>(i.indexOf(o.keyFormat)===-1&&i.push(o.keyFormat),i),[]);this.log(`Selecting key-system from session-keys ${a.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(a)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:a}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),a&&a.readyState!==XMLHttpRequest.DONE&&a.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const i=this.mediaKeySessions.indexOf(e);return i>-1&&this.mediaKeySessions.splice(i,1),t.remove().catch(o=>{this.log(`Could not remove session: ${o}`)}).then(()=>t.close()).catch(o=>{this.log(`Could not close session: ${o}`)})}}}ea.CDMCleanupPromise=void 0;class Ct extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}var ht;(function(s){s.MANIFEST="m",s.AUDIO="a",s.VIDEO="v",s.MUXED="av",s.INIT="i",s.CAPTION="c",s.TIMED_TEXT="tt",s.KEY="k",s.OTHER="o"})(ht||(ht={}));var Kl;(function(s){s.DASH="d",s.HLS="h",s.SMOOTH="s",s.OTHER="o"})(Kl||(Kl={}));var Is;(function(s){s.OBJECT="CMCD-Object",s.REQUEST="CMCD-Request",s.SESSION="CMCD-Session",s.STATUS="CMCD-Status"})(Is||(Is={}));const MD={[Is.OBJECT]:["br","d","ot","tb"],[Is.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[Is.SESSION]:["cid","pr","sf","sid","st","v"],[Is.STATUS]:["bs","rtp"]};class ta{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(a=>a instanceof ta?a:new ta(a))),this.value=e,this.params=t}}class ig{constructor(e){this.description=void 0,this.description=e}}const VD="Dict";function $D(s){return Array.isArray(s)?JSON.stringify(s):s instanceof Map?"Map{}":s instanceof Set?"Set{}":typeof s=="object"?JSON.stringify(s):String(s)}function zD(s,e,t,a){return new Error(`failed to ${s} "${$D(e)}" as ${t}`,{cause:a})}const og="Bare Item",UD="Boolean",GD="Byte Sequence",jD="Decimal",HD="Integer";function WD(s){return s<-999999999999999||999999999999999<s}const KD=/[\x00-\x1f\x7f]+/,qD="Token",YD="Key";function qt(s,e,t){return zD("serialize",s,e,t)}function JD(s){if(typeof s!="boolean")throw qt(s,UD);return s?"?1":"?0"}function XD(s){return btoa(String.fromCharCode(...s))}function ZD(s){if(ArrayBuffer.isView(s)===!1)throw qt(s,GD);return`:${XD(s)}:`}function rg(s){if(WD(s))throw qt(s,HD);return s.toString()}function QD(s){return`@${rg(s.getTime()/1e3)}`}function lg(s,e){if(s<0)return-lg(-s,e);const t=Math.pow(10,e);if(Math.abs(s*t%1-.5)<Number.EPSILON){const i=Math.floor(s*t);return(i%2===0?i:i+1)/t}else return Math.round(s*t)/t}function eP(s){const e=lg(s,3);if(Math.floor(Math.abs(e)).toString().length>12)throw qt(s,jD);const t=e.toString();return t.includes(".")?t:`${t}.0`}const tP="String";function sP(s){if(KD.test(s))throw qt(s,tP);return`"${s.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function aP(s){return s.description||s.toString().slice(7,-1)}function cg(s){const e=aP(s);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw qt(e,qD);return e}function ql(s){switch(typeof s){case"number":if(!ae(s))throw qt(s,og);return Number.isInteger(s)?rg(s):eP(s);case"string":return sP(s);case"symbol":return cg(s);case"boolean":return JD(s);case"object":if(s instanceof Date)return QD(s);if(s instanceof Uint8Array)return ZD(s);if(s instanceof ig)return cg(s);default:throw qt(s,og)}}function Yl(s){if(/^[a-z*][a-z0-9\-_.*]*$/.test(s)===!1)throw qt(s,YD);return s}function Jl(s){return s==null?"":Object.entries(s).map(([e,t])=>t===!0?`;${Yl(e)}`:`;${Yl(e)}=${ql(t)}`).join("")}function dg(s){return s instanceof ta?`${ql(s.value)}${Jl(s.params)}`:ql(s)}function nP(s){return`(${s.value.map(dg).join(" ")})${Jl(s.params)}`}function iP(s,e={whitespace:!0}){if(typeof s!="object")throw qt(s,VD);const t=s instanceof Map?s.entries():Object.entries(s),a=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([i,o])=>{o instanceof ta||(o=new ta(o));let r=Yl(i);return o.value===!0?r+=Jl(o.params):(r+="=",Array.isArray(o.value)?r+=nP(o):r+=dg(o)),r}).join(`,${a}`)}function oP(s,e){return iP(s,e)}const rP=s=>s==="ot"||s==="sf"||s==="st",lP=s=>typeof s=="number"?ae(s):s!=null&&s!==""&&s!==!1;function cP(s,e){const t=new URL(s),a=new URL(e);if(t.origin!==a.origin)return s;const i=t.pathname.split("/").slice(1),o=a.pathname.split("/").slice(1,-1);for(;i[0]===o[0];)i.shift(),o.shift();for(;o.length;)o.shift(),i.unshift("..");return i.join("/")}function dP(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,i=>{const o=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(i=="x"?o:o&3|8).toString(16)})}}}const Ei=s=>Math.round(s),hP=(s,e)=>(e!=null&&e.baseUrl&&(s=cP(s,e.baseUrl)),encodeURIComponent(s)),Ti=s=>Ei(s/100)*100,uP={br:Ei,d:Ei,bl:Ti,dl:Ti,mtp:Ti,nor:hP,rtp:Ti,tb:Ei};function mP(s,e){const t={};if(s==null||typeof s!="object")return t;const a=Object.keys(s).sort(),i=je({},uP,e==null?void 0:e.formatters),o=e==null?void 0:e.filter;return a.forEach(r=>{if(o!=null&&o(r))return;let l=s[r];const d=i[r];d&&(l=d(l,e)),!(r==="v"&&l===1)&&(r=="pr"&&l===1||lP(l)&&(rP(r)&&typeof l=="string"&&(l=new ig(l)),t[r]=l))}),t}function hg(s,e={}){return s?oP(mP(s,e),je({whitespace:!1},e)):""}function fP(s,e={}){if(!s)return{};const t=Object.entries(s),a=Object.entries(MD).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),i=t.reduce((o,r)=>{var l,d;const[c,h]=r,u=((l=a.find(f=>f[1].includes(c)))==null?void 0:l[0])||Is.REQUEST;return(d=o[u])!=null||(o[u]={}),o[u][c]=h,o},{});return Object.entries(i).reduce((o,[r,l])=>(o[r]=hg(l,e),o),{})}function pP(s,e,t){return je(s,fP(e,t))}const gP="CMCD";function yP(s,e={}){if(!s)return"";const t=hg(s,e);return`${gP}=${encodeURIComponent(t)}`}const ug=/CMCD=[^&#]+/;function bP(s,e,t){const a=yP(e,t);if(!a)return s;if(ug.test(s))return s.replace(ug,a);const i=s.includes("?")?"&":"?";return`${s}${i}${a}`}class SP{constructor(e){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=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=i=>{try{this.apply(i,{ot:ht.MANIFEST,su:!this.initialized})}catch(o){A.warn("Could not generate manifest CMCD data.",o)}},this.applyFragmentData=i=>{try{const o=i.frag,r=this.hls.levels[o.level],l=this.getObjectType(o),d={d:o.duration*1e3,ot:l};(l===ht.VIDEO||l===ht.AUDIO||l==ht.MUXED)&&(d.br=r.bitrate/1e3,d.tb=this.getTopBandwidth(l)/1e3,d.bl=this.getBufferLength(l)),this.apply(i,d)}catch(o){A.warn("Could not generate segment CMCD data.",o)}},this.hls=e;const t=this.config=e.config,{cmcd:a}=t;a!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=a.sessionId||dP(),this.cid=a.contentId,this.useHeaders=a.useHeaders===!0,this.includeKeys=a.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHED,this.onMediaDetached,this),e.on(_.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHED,this.onMediaDetached,this),e.off(_.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var a,i;this.audioBuffer=(a=t.tracks.audio)==null?void 0:a.buffer,this.videoBuffer=(i=t.tracks.video)==null?void 0:i.buffer}createData(){var e;return{v:1,sf:Kl.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){je(t,this.createData());const a=t.ot===ht.INIT||t.ot===ht.VIDEO||t.ot===ht.MUXED;this.starved&&a&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:i}=this;i&&(t=Object.keys(t).reduce((o,r)=>(i.includes(r)&&(o[r]=t[r]),o),{})),this.useHeaders?(e.headers||(e.headers={}),pP(e.headers,t)):e.url=bP(e.url,t)}getObjectType(e){const{type:t}=e;if(t==="subtitle")return ht.TIMED_TEXT;if(e.sn==="initSegment")return ht.INIT;if(t==="audio")return ht.AUDIO;if(t==="main")return this.hls.audioTracks.length?ht.VIDEO:ht.MUXED}getTopBandwidth(e){let t=0,a;const i=this.hls;if(e===ht.AUDIO)a=i.audioTracks;else{const o=i.maxAutoLevel,r=o>-1?o+1:i.levels.length;a=i.levels.slice(0,r)}for(const o of a)o.bitrate>t&&(t=o.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.hls.media,a=e===ht.AUDIO?this.audioBuffer:this.videoBuffer;return!a||!t?NaN:Pe.bufferInfo(a,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,a=e||this.config.loader;return class{constructor(o){this.loader=void 0,this.loader=new a(o)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(o,r,l){t(o),this.loader.load(o,r,l)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,a=e||this.config.loader;return class{constructor(o){this.loader=void 0,this.loader=new a(o)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(o,r,l){t(o),this.loader.load(o,r,l)}}}}const _P=3e5;class wP{constructor(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=A.log.bind(A,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(a=>a!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:a}=t;a!==null&&(this.pathwayId=a.pathwayId,this.uri=a.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:a}=t;if((a==null?void 0:a.action)===rt.SendAlternateToPenaltyBox&&a.flags===Ft.MoveAllAlternatesMatchingHost){const i=this.levels;let o=this.pathwayPriority,r=this.pathwayId;if(t.context){const{groupId:l,pathwayId:d,type:c}=t.context;l&&i?r=this.getPathwayForGroupId(l,c,r):d&&(r=d)}r in this.penalizedPathways||(this.penalizedPathways[r]=performance.now()),!o&&i&&(o=i.reduce((l,d)=>(l.indexOf(d.pathwayId)===-1&&l.push(d.pathwayId),l),[])),o&&o.length>1&&(this.updatePathwayPriority(o),a.resolved=this.pathwayId!==r),a.resolved||A.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${r} levels: ${i&&i.length} priorities: ${JSON.stringify(o)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const a=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${a}"`),t=this.getLevelsForPathway(a),this.pathwayId=a}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this.pathwayPriority=e;let t;const a=this.penalizedPathways,i=performance.now();Object.keys(a).forEach(o=>{i-a[o]>_P&&delete a[o]});for(let o=0;o<e.length;o++){const r=e[o];if(r in a)continue;if(r===this.pathwayId)return;const l=this.hls.nextLoadLevel,d=this.hls.levels[l];if(t=this.getLevelsForPathway(r),t.length>0){this.log(`Setting Pathway to "${r}"`),this.pathwayId=r,ap(t),this.hls.trigger(_.LEVELS_UPDATED,{levels:t});const c=this.hls.levels[l];d&&c&&this.levels&&(c.attrs["STABLE-VARIANT-ID"]!==d.attrs["STABLE-VARIANT-ID"]&&c.bitrate!==d.bitrate&&this.log(`Unstable Pathways change from bitrate ${d.bitrate} to ${c.bitrate}`),this.hls.nextLoadLevel=l);break}}}getPathwayForGroupId(e,t,a){const i=this.getLevelsForPathway(a).concat(this.levels||[]);for(let o=0;o<i.length;o++)if(t===ve.AUDIO_TRACK&&i[o].hasAudioGroup(e)||t===ve.SUBTITLE_TRACK&&i[o].hasSubtitleGroup(e))return i[o].pathwayId;return a}clonePathways(e){const t=this.levels;if(!t)return;const a={},i={};e.forEach(o=>{const{ID:r,"BASE-ID":l,"URI-REPLACEMENT":d}=o;if(t.some(h=>h.pathwayId===r))return;const c=this.getLevelsForPathway(l).map(h=>{const u=new Me(h.attrs);u["PATHWAY-ID"]=r;const f=u.AUDIO&&`${u.AUDIO}_clone_${r}`,g=u.SUBTITLES&&`${u.SUBTITLES}_clone_${r}`;f&&(a[u.AUDIO]=f,u.AUDIO=f),g&&(i[u.SUBTITLES]=g,u.SUBTITLES=g);const m=fg(h.uri,u["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",d),p=new Ws({attrs:u,audioCodec:h.audioCodec,bitrate:h.bitrate,height:h.height,name:h.name,url:m,videoCodec:h.videoCodec,width:h.width});if(h.audioGroups)for(let y=1;y<h.audioGroups.length;y++)p.addGroupId("audio",`${h.audioGroups[y]}_clone_${r}`);if(h.subtitleGroups)for(let y=1;y<h.subtitleGroups.length;y++)p.addGroupId("text",`${h.subtitleGroups[y]}_clone_${r}`);return p});t.push(...c),mg(this.audioTracks,a,d,r),mg(this.subtitleTracks,i,d,r)})}loadSteeringManifest(e){const t=this.hls.config,a=t.loader;this.loader&&this.loader.destroy(),this.loader=new a(t);let i;try{i=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(i.protocol!=="data:"){const h=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;i.searchParams.set("_HLS_pathway",this.pathwayId),i.searchParams.set("_HLS_throughput",""+h)}const o={responseType:"json",url:i.href},r=t.steeringManifestLoadPolicy.default,l=r.errorRetry||r.timeoutRetry||{},d={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:l.maxNumRetry||0,retryDelay:l.retryDelayMs||0,maxRetryDelay:l.maxRetryDelayMs||0},c={onSuccess:(h,u,f,g)=>{this.log(`Loaded steering manifest: "${i}"`);const m=h.data;if(m.VERSION!==1){this.log(`Steering VERSION ${m.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=m.TTL;const{"RELOAD-URI":p,"PATHWAY-CLONES":y,"PATHWAY-PRIORITY":b}=m;if(p)try{this.uri=new self.URL(p,i).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${p}`);return}this.scheduleRefresh(this.uri||f.url),y&&this.clonePathways(y);const S={steeringManifest:m,url:i.toString()};this.hls.trigger(_.STEERING_MANIFEST_LOADED,S),b&&this.updatePathwayPriority(b)},onError:(h,u,f,g)=>{if(this.log(`Error loading steering manifest: ${h.code} ${h.text} (${u.url})`),this.stopLoad(),h.code===410){this.enabled=!1,this.log(`Steering manifest ${u.url} no longer available`);return}let m=this.timeToLoad*1e3;if(h.code===429){const p=this.loader;if(typeof(p==null?void 0:p.getResponseHeader)=="function"){const y=p.getResponseHeader("Retry-After");y&&(m=parseFloat(y)*1e3)}this.log(`Steering manifest ${u.url} rate limited`);return}this.scheduleRefresh(this.uri||u.url,m)},onTimeout:(h,u,f)=>{this.log(`Timeout loading steering manifest (${u.url})`),this.scheduleRefresh(this.uri||u.url)}};this.log(`Requesting steering manifest: ${i}`),this.loader.load(o,d,c)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var a;const i=(a=this.hls)==null?void 0:a.media;if(i&&!i.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function mg(s,e,t,a){s&&Object.keys(e).forEach(i=>{const o=s.filter(r=>r.groupId===i).map(r=>{const l=je({},r);return l.details=void 0,l.attrs=new Me(l.attrs),l.url=l.attrs.URI=fg(r.url,r.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),l.groupId=l.attrs["GROUP-ID"]=e[i],l.attrs["PATHWAY-ID"]=a,l});s.push(...o)})}function fg(s,e,t,a){const{HOST:i,PARAMS:o,[t]:r}=a;let l;e&&(l=r==null?void 0:r[e],l&&(s=l));const d=new self.URL(s);return i&&!l&&(d.host=i),o&&Object.keys(o).sort().forEach(c=>{c&&d.searchParams.set(c,o[c])}),d.href}const kP=/^age:\s*[\d.]+\s*$/im;class pg{constructor(e){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=e&&e.xhrSetup||null,this.stats=new qn,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,a){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=a,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const a=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=!1;const o=this.xhrSetup;o?Promise.resolve().then(()=>{if(!(this.loader!==a||this.stats.aborted))return o(a,t.url)}).catch(r=>{if(!(this.loader!==a||this.stats.aborted))return a.open("GET",t.url,!0),o(a,t.url)}).then(()=>{this.loader!==a||this.stats.aborted||this.openAndSendXhr(a,t,e)}).catch(r=>{this.callbacks.onError({code:a.status,text:r.message},t,a,i)}):this.openAndSendXhr(a,t,e)}openAndSendXhr(e,t,a){e.readyState||e.open("GET",t.url,!0);const i=t.headers,{maxTimeToFirstByteMs:o,maxLoadTimeMs:r}=a.loadPolicy;if(i)for(const l in i)e.setRequestHeader(l,i[l]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),a.timeout=o&&ae(o)?o:r,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),a.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:a}=this;if(!e||!t)return;const i=t.readyState,o=this.config;if(!a.aborted&&i>=2&&(a.loading.first===0&&(a.loading.first=Math.max(self.performance.now(),a.loading.start),o.timeout!==o.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),o.timeout=o.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),o.loadPolicy.maxLoadTimeMs-(a.loading.first-a.loading.start)))),i===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const r=t.status,l=t.responseType!=="text";if(r>=200&&r<300&&(l&&t.response||t.responseText!==null)){a.loading.end=Math.max(self.performance.now(),a.loading.first);const d=l?t.response:t.responseText,c=t.responseType==="arraybuffer"?d.byteLength:d.length;if(a.loaded=a.total=c,a.bwEstimate=a.total*8e3/(a.loading.end-a.loading.first),!this.callbacks)return;const h=this.callbacks.onProgress;if(h&&h(a,e,d,t),!this.callbacks)return;const u={url:t.responseURL,data:d,code:r};this.callbacks.onSuccess(u,a,e,t)}else{const d=o.loadPolicy.errorRetry,c=a.retry,h={url:e.url,data:void 0,code:r};ri(d,c,!1,h)?this.retry(d):(A.error(`${r} while loading ${e.url}`),this.callbacks.onError({code:r,text:t.statusText},e,t,a))}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(ri(e,t,!0))this.retry(e);else{var a;A.warn(`timeout while loading ${(a=this.context)==null?void 0:a.url}`);const i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:a}=this;this.retryDelay=_l(e,a.retry),a.retry++,A.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${a.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&kP.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}function EP(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const TP=/(\d+)-(\d+)\/(\d+)/;class gg{constructor(e){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=e.fetchSetup||AP,this.controller=new self.AbortController,this.stats=new qn}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,a){const i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now();const o=CP(e,this.controller.signal),r=a.onProgress,l=e.responseType==="arraybuffer",d=l?"byteLength":"length",{maxTimeToFirstByteMs:c,maxLoadTimeMs:h}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=a,this.request=this.fetchSetup(e,o),self.clearTimeout(this.requestTimeout),t.timeout=c&&ae(c)?c:h,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),a.onTimeout(i,e,this.response)},t.timeout),self.fetch(this.request).then(u=>{this.response=this.loader=u;const f=Math.max(self.performance.now(),i.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=h,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),a.onTimeout(i,e,this.response)},h-(f-i.loading.start)),!u.ok){const{status:g,statusText:m}=u;throw new LP(m||"fetch, bad network response",g,u)}return i.loading.first=f,i.total=vP(u.headers)||i.total,r&&ae(t.highWaterMark)?this.loadProgressively(u,i,e,t.highWaterMark,r):l?u.arrayBuffer():e.responseType==="json"?u.json():u.text()}).then(u=>{const f=this.response;if(!f)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),i.loading.end=Math.max(self.performance.now(),i.loading.first);const g=u[d];g&&(i.loaded=i.total=g);const m={url:f.url,data:u,code:f.status};r&&!ae(t.highWaterMark)&&r(i,e,u,f),a.onSuccess(m,i,e,f)}).catch(u=>{if(self.clearTimeout(this.requestTimeout),i.aborted)return;const f=u&&u.code||0,g=u?u.message:null;a.onError({code:f,text:g},e,u?u.details:null,i)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,a,i=0,o){const r=new pp,l=e.body.getReader(),d=()=>l.read().then(c=>{if(c.done)return r.dataLength&&o(t,a,r.flush(),e),Promise.resolve(new ArrayBuffer(0));const h=c.value,u=h.length;return t.loaded+=u,u<i||r.dataLength?(r.push(h),r.dataLength>=i&&o(t,a,r.flush(),e)):o(t,a,h,e),d()}).catch(()=>Promise.reject());return d()}}function CP(s,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(je({},s.headers))};return s.rangeEnd&&t.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),t}function xP(s){const e=TP.exec(s);if(e)return parseInt(e[2])-parseInt(e[1])+1}function vP(s){const e=s.get("Content-Range");if(e){const a=xP(e);if(ae(a))return a}const t=s.get("Content-Length");if(t)return parseInt(t)}function AP(s,e){return new self.Request(s.url,e)}class LP extends Error{constructor(e,t,a){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=a}}const IP=/\s/,RP={newCue(s,e,t,a){const i=[];let o,r,l,d,c;const h=self.VTTCue||self.TextTrackCue;for(let f=0;f<a.rows.length;f++)if(o=a.rows[f],l=!0,d=0,c="",!o.isEmpty()){var u;for(let p=0;p<o.chars.length;p++)IP.test(o.chars[p].uchar)&&l?d++:(c+=o.chars[p].uchar,l=!1);o.cueStartTime=e,e===t&&(t+=1e-4),d>=16?d--:d++;const g=Yp(c.trim()),m=zl(e,t,g);s!=null&&(u=s.cues)!=null&&u.getCueById(m)||(r=new h(e,t,g),r.id=m,r.line=f+1,r.align="left",r.position=10+Math.min(80,Math.floor(d*8/32)*10),i.push(r))}return s&&i.length&&(i.sort((f,g)=>f.line==="auto"||g.line==="auto"?0:f.line>8&&g.line>8?g.line-f.line:f.line-g.line),i.forEach(f=>qf(s,f))),i}},BP={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},yg=et(et({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,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,loader:pg,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:iN,bufferController:cD,capLevelController:Wl,errorController:K6,fpsController:FD,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:bf,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:BP},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}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},NP()),{},{subtitleStreamController:iD,subtitleTrackController:rD,timelineController:PD,audioStreamController:aD,audioTrackController:nD,emeController:ea,cmcdController:SP,contentSteeringController:wP});function NP(){return{cueHandler:RP,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 DP(s,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const t=Xl(s),a=["manifest","level","frag"],i=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return a.forEach(o=>{const r=`${o==="level"?"playlist":o}LoadPolicy`,l=e[r]===void 0,d=[];i.forEach(c=>{const h=`${o}Loading${c}`,u=e[h];if(u!==void 0&&l){d.push(h);const f=t[r].default;switch(e[r]={default:f},c){case"TimeOut":f.maxLoadTimeMs=u,f.maxTimeToFirstByteMs=u;break;case"MaxRetry":f.errorRetry.maxNumRetry=u,f.timeoutRetry.maxNumRetry=u;break;case"RetryDelay":f.errorRetry.retryDelayMs=u,f.timeoutRetry.retryDelayMs=u;break;case"MaxRetryTimeout":f.errorRetry.maxRetryDelayMs=u,f.timeoutRetry.maxRetryDelayMs=u;break}}}),d.length&&A.warn(`hls.js config: "${d.join('", "')}" setting(s) are deprecated, use "${r}": ${JSON.stringify(e[r])}`)}),et(et({},t),e)}function Xl(s){return s&&typeof s=="object"?Array.isArray(s)?s.map(Xl):Object.keys(s).reduce((e,t)=>(e[t]=Xl(s[t]),e),{}):s}function PP(s){const e=s.loader;e!==gg&&e!==pg?(A.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1):EP()&&(s.loader=gg,s.progressive=!0,s.enableSoftwareAES=!0,A.log("[config]: Progressive streaming enabled, using FetchLoader"))}let Zl;class OP extends kl{constructor(e,t){super(e,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this),e.on(_.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this),e.off(_.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const a=this.hls.config.preferManagedMediaSource,i=[],o={},r={};let l=!1,d=!1,c=!1;t.levels.forEach(h=>{var u,f;const g=h.attrs;let{audioCodec:m,videoCodec:p}=h;((u=m)==null?void 0:u.indexOf("mp4a.40.34"))!==-1&&(Zl||(Zl=/chrome|firefox/i.test(navigator.userAgent)),Zl&&(h.audioCodec=m=void 0)),m&&(h.audioCodec=m=ti(m,a)),((f=p)==null?void 0:f.indexOf("avc1"))===0&&(p=h.videoCodec=k6(p));const{width:y,height:b,unknownCodecs:S}=h;if(l||(l=!!(y&&b)),d||(d=!!p),c||(c=!!m),S!=null&&S.length||m&&!hl(m,"audio",a)||p&&!hl(p,"video",a))return;const{CODECS:w,"FRAME-RATE":x,"HDCP-LEVEL":E,"PATHWAY-ID":v,RESOLUTION:T,"VIDEO-RANGE":R}=g,B=`${`${v||"."}-`}${h.bitrate}-${T}-${x}-${w}-${R}-${E}`;if(o[B])if(o[B].uri!==h.url&&!h.attrs["PATHWAY-ID"]){const M=r[B]+=1;h.attrs["PATHWAY-ID"]=new Array(M+1).join(".");const W=new Ws(h);o[B]=W,i.push(W)}else o[B].addGroupId("audio",g.AUDIO),o[B].addGroupId("text",g.SUBTITLES);else{const M=new Ws(h);o[B]=M,r[B]=1,i.push(M)}}),this.filterAndSortMediaOptions(i,t,l,d,c)}filterAndSortMediaOptions(e,t,a,i,o){let r=[],l=[],d=e;if((a||i)&&o&&(d=d.filter(({videoCodec:m,videoRange:p,width:y,height:b})=>(!!m||!!(y&&b))&&P6(p))),d.length===0){Promise.resolve().then(()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);const m=new Error("no level with compatible codecs found in manifest");this.hls.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:m,reason:m.message})}});return}if(t.audioTracks){const{preferManagedMediaSource:m}=this.hls.config;r=t.audioTracks.filter(p=>!p.audioCodec||hl(p.audioCodec,"audio",m)),bg(r)}t.subtitles&&(l=t.subtitles,bg(l));const c=d.slice(0);d.sort((m,p)=>{if(m.attrs["HDCP-LEVEL"]!==p.attrs["HDCP-LEVEL"])return(m.attrs["HDCP-LEVEL"]||"")>(p.attrs["HDCP-LEVEL"]||"")?1:-1;if(a&&m.height!==p.height)return m.height-p.height;if(m.frameRate!==p.frameRate)return m.frameRate-p.frameRate;if(m.videoRange!==p.videoRange)return ni.indexOf(m.videoRange)-ni.indexOf(p.videoRange);if(m.videoCodec!==p.videoCodec){const y=Pf(m.videoCodec),b=Pf(p.videoCodec);if(y!==b)return b-y}if(m.uri===p.uri&&m.codecSet!==p.codecSet){const y=ei(m.codecSet),b=ei(p.codecSet);if(y!==b)return b-y}return m.averageBitrate!==p.averageBitrate?m.averageBitrate-p.averageBitrate:0});let h=c[0];if(this.steering&&(d=this.steering.filterParsedLevels(d),d.length!==c.length)){for(let m=0;m<c.length;m++)if(c[m].pathwayId===d[0].pathwayId){h=c[m];break}}this._levels=d;for(let m=0;m<d.length;m++)if(d[m]===h){var u;this._firstLevel=m;const p=h.bitrate,y=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${d.length} level(s) found, first bitrate: ${p}`),((u=this.hls.userConfig)==null?void 0:u.abrEwmaDefaultEstimate)===void 0){const b=Math.min(p,this.hls.config.abrEwmaDefaultEstimateMax);b>y&&y===yg.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=b)}break}const f=o&&!i,g={levels:d,audioTracks:r,subtitleTracks:l,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:o,video:i,altAudio:!f&&r.some(m=>!!m.url)};this.hls.trigger(_.MANIFEST_PARSED,g),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return this._levels.length===0?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const h=new Error("invalid level idx"),u=e<0;if(this.hls.trigger(_.ERROR,{type:pe.OTHER_ERROR,details:N.LEVEL_SWITCH_ERROR,level:e,fatal:u,error:h,reason:h.message}),u)return;e=Math.min(e,t.length-1)}const a=this.currentLevelIndex,i=this.currentLevel,o=i?i.attrs["PATHWAY-ID"]:void 0,r=t[e],l=r.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=r,a===e&&r.details&&i&&o===l)return;this.log(`Switching to level ${e} (${r.height?r.height+"p ":""}${r.videoRange?r.videoRange+" ":""}${r.codecSet?r.codecSet+" ":""}@${r.bitrate})${l?" with Pathway "+l:""} from level ${a}${o?" with Pathway "+o:""}`);const d={level:e,attrs:r.attrs,details:r.details,bitrate:r.bitrate,averageBitrate:r.averageBitrate,maxBitrate:r.maxBitrate,realBitrate:r.realBitrate,width:r.width,height:r.height,codecSet:r.codecSet,audioCodec:r.audioCodec,videoCodec:r.videoCodec,audioGroups:r.audioGroups,subtitleGroups:r.subtitleGroups,loaded:r.loaded,loadError:r.loadError,fragmentError:r.fragmentError,name:r.name,id:r.id,uri:r.uri,url:r.url,urlId:0,audioGroupIds:r.audioGroupIds,textGroupIds:r.textGroupIds};this.hls.trigger(_.LEVEL_SWITCHING,d);const c=r.details;if(!c||c.live){const h=this.switchParams(r.uri,i==null?void 0:i.details,c);this.loadPlaylist(h)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){t.fatal||!t.context||t.context.type===ve.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===ce.MAIN){const a=t.elementaryStreams;if(!Object.keys(a).some(o=>!!a[o]))return;const i=this._levels[t.level];i!=null&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var a;const{level:i,details:o}=t,r=this._levels[i];if(!r){var l;this.warn(`Invalid level index ${i}`),(l=t.deliveryDirectives)!=null&&l.skip&&(o.deltaUpdateFailed=!0);return}i===this.currentLevelIndex?(r.fragmentError===0&&(r.loadError=0),this.playlistLoaded(i,t,r.details)):(a=t.deliveryDirectives)!=null&&a.skip&&(o.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,a=this.currentLevel;if(a&&this.shouldLoadPlaylist(a)){let i=a.uri;if(e)try{i=e.addDirectives(i)}catch(r){this.warn(`Could not construct new URL with HLS Delivery Directives: ${r}`)}const o=a.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${(e==null?void 0:e.msn)!==void 0?" at sn "+e.msn+" part "+e.part:""} with${o?" Pathway "+o:""} ${i}`),this.clearTimer(),this.hls.trigger(_.LEVEL_LOADING,{url:i,level:t,pathwayId:a.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;const a=this._levels.filter((i,o)=>o!==e?!0:(this.steering&&this.steering.removeLevel(i),i===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,i.details&&i.details.fragments.forEach(r=>r.level=-1)),!1));ap(a),this._levels=a,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(_.LEVELS_UPDATED,{levels:a})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:a}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(_.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:a}))}}function bg(s){const e={};s.forEach(t=>{const a=t.groupId||"";t.id=e[a]=e[a]||0,e[a]++})}class FP{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const a in this.keyUriToKeyInfo){const i=this.keyUriToKeyInfo[a].loader;if(i){var t;if(e&&e!==((t=i.context)==null?void 0:t.frag.type))return;i.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=N.KEY_LOAD_ERROR,a,i,o){return new Zt({type:pe.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:o,error:a,networkDetails:i})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:a,cc:i}=e;for(let o=0;o<t.length;o++){const r=t[o];if(i<=r.cc&&(a==="initSegment"||r.sn==="initSegment"||a<r.sn)){this.emeController.selectKeySystemFormat(r).then(l=>{r.setKeyFormat(l)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var a,i;t&&e.setKeyFormat(t);const o=e.decryptdata;if(!o){const c=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,N.KEY_LOAD_ERROR,c))}const r=o.uri;if(!r)return Promise.reject(this.createKeyLoadError(e,N.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${r}"`)));let l=this.keyUriToKeyInfo[r];if((a=l)!=null&&a.decryptdata.key)return o.key=l.decryptdata.key,Promise.resolve({frag:e,keyInfo:l});if((i=l)!=null&&i.keyLoadPromise){var d;switch((d=l.mediaKeySessionContext)==null?void 0:d.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return l.keyLoadPromise.then(c=>(o.key=c.keyInfo.decryptdata.key,{frag:e,keyInfo:l}))}}switch(l=this.keyUriToKeyInfo[r]={decryptdata:o,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},o.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return o.keyFormat==="identity"?this.loadKeyHTTP(l,e):this.loadKeyEME(l,e);case"AES-128":return this.loadKeyHTTP(l,e);default:return Promise.reject(this.createKeyLoadError(e,N.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${o.method}"`)))}}loadKeyEME(e,t){const a={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const i=this.emeController.loadKey(a);if(i)return(e.keyLoadPromise=i.then(o=>(e.mediaKeySessionContext=o,a))).catch(o=>{throw e.keyLoadPromise=null,o})}return Promise.resolve(a)}loadKeyHTTP(e,t){const a=this.config,i=a.loader,o=new i(a);return t.keyLoader=e.loader=o,e.keyLoadPromise=new Promise((r,l)=>{const d={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},c=a.keyLoadPolicy.default,h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(f,g,m,p)=>{const{frag:y,keyInfo:b,url:S}=m;if(!y.decryptdata||b!==this.keyUriToKeyInfo[S])return l(this.createKeyLoadError(y,N.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),p));b.decryptdata.key=y.decryptdata.key=new Uint8Array(f.data),y.keyLoader=null,b.loader=null,r({frag:y,keyInfo:b})},onError:(f,g,m,p)=>{this.resetLoader(g),l(this.createKeyLoadError(t,N.KEY_LOAD_ERROR,new Error(`HTTP Error ${f.code} loading key ${f.text}`),m,et({url:d.url,data:void 0},f)))},onTimeout:(f,g,m)=>{this.resetLoader(g),l(this.createKeyLoadError(t,N.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),m))},onAbort:(f,g,m)=>{this.resetLoader(g),l(this.createKeyLoadError(t,N.INTERNAL_ABORTED,new Error("key loading aborted"),m))}};o.load(d,h,u)})}resetLoader(e){const{frag:t,keyInfo:a,url:i}=e,o=a.loader;t.keyLoader===o&&(t.keyLoader=null,a.loader=null),delete this.keyUriToKeyInfo[i],o&&o.destroy()}}function Sg(){return self.SourceBuffer||self.WebKitSourceBuffer}function _g(){if(!As())return!1;const e=Sg();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function MP(){if(!_g())return!1;const s=As();return typeof(s==null?void 0:s.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>s.isTypeSupported(Na(e,"video")))||["mp4a.40.2","fLaC"].some(e=>s.isTypeSupported(Na(e,"audio"))))}function VP(){var s;const e=Sg();return typeof(e==null||(s=e.prototype)==null?void 0:s.changeType)=="function"}const $P=250,Ci=2,zP=.1,UP=.05;class GP{constructor(e,t,a,i){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=a,this.hls=i}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:a,media:i,stalled:o}=this;if(i===null)return;const{currentTime:r,seeking:l}=i,d=this.seeking&&!l,c=!this.seeking&&l;if(this.seeking=l,r!==e){if(this.moved=!0,l||(this.nudgeRetry=0),o!==null){if(this.stallReported){const y=self.performance.now()-o;A.warn(`playback not stuck anymore @${r}, after ${Math.round(y)}ms`),this.stallReported=!1}this.stalled=null}return}if(c||d){this.stalled=null;return}if(i.paused&&!l||i.ended||i.playbackRate===0||!Pe.getBuffered(i).length){this.nudgeRetry=0;return}const h=Pe.bufferInfo(i,r,0),u=h.nextStart||0;if(l){const y=h.len>Ci,b=!u||t&&t.start<=r||u-r>Ci&&!this.fragmentTracker.getPartialFragment(r);if(y||b)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var f;if(!(h.len>0)&&!u)return;const b=Math.max(u,h.start||0)-r,S=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,x=(S==null||(f=S.details)==null?void 0:f.live)?S.details.targetduration*2:Ci,E=this.fragmentTracker.getPartialFragment(r);if(b>0&&(b<=x||E)){i.paused||this._trySkipBufferHole(E);return}}const g=self.performance.now();if(o===null){this.stalled=g;return}const m=g-o;if(!l&&m>=$P&&(this._reportStall(h),!this.media))return;const p=Pe.bufferInfo(i,r,a.maxBufferHole);this._tryFixBufferStall(p,m)}_tryFixBufferStall(e,t){const{config:a,fragmentTracker:i,media:o}=this;if(o===null)return;const r=o.currentTime,l=i.getPartialFragment(r);l&&(this._trySkipBufferHole(l)||!this.media)||(e.len>a.maxBufferHole||e.nextStart&&e.nextStart-r<a.maxBufferHole)&&t>a.highBufferWatchdogPeriod*1e3&&(A.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:a,stallReported:i}=this;if(!i&&a){this.stallReported=!0;const o=new Error(`Playback stalling at @${a.currentTime} due to low buffer (${JSON.stringify(e)})`);A.warn(o.message),t.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.BUFFER_STALLED_ERROR,fatal:!1,error:o,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:a,media:i}=this;if(i===null)return 0;const o=i.currentTime,r=Pe.bufferInfo(i,o,0),l=o<r.start?r.start:r.nextStart;if(l){const d=r.len<=t.maxBufferHole,c=r.len>0&&r.len<1&&i.readyState<3,h=l-o;if(h>0&&(d||c)){if(h>t.maxBufferHole){const{fragmentTracker:f}=this;let g=!1;if(o===0){const m=f.getAppendedFrag(0,ce.MAIN);m&&l<m.end&&(g=!0)}if(!g){const m=e||f.getAppendedFrag(o,ce.MAIN);if(m){let p=!1,y=m.end;for(;y<l;){const b=f.getPartialFragment(y);if(b)y+=b.duration;else{p=!0;break}}if(p)return 0}}}const u=Math.max(l+UP,o+zP);if(A.warn(`skipping hole, adjusting currentTime from ${o} to ${u}`),this.moved=!0,this.stalled=null,i.currentTime=u,e&&!e.gap){const f=new Error(`fragment loaded with buffer holes, seeking from ${o} to ${u}`);a.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:f,reason:f.message,frag:e})}return u}}return 0}_tryNudgeBuffer(){const{config:e,hls:t,media:a,nudgeRetry:i}=this;if(a===null)return;const o=a.currentTime;if(this.nudgeRetry++,i<e.nudgeMaxRetry){const r=o+(i+1)*e.nudgeOffset,l=new Error(`Nudging 'currentTime' from ${o} to ${r}`);A.warn(l.message),a.currentTime=r,t.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.BUFFER_NUDGE_ON_STALL,error:l,fatal:!1})}else{const r=new Error(`Playhead still not moving while enough data buffered @${o} after ${e.nudgeMaxRetry} nudges`);A.error(r.message),t.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.BUFFER_STALLED_ERROR,error:r,fatal:!0})}}}const jP=100;class HP extends Cl{constructor(e,t,a){super(e,t,a,"[stream-controller]",ce.MAIN),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.LEVEL_LOADING,this.onLevelLoading,this),e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(_.ERROR,this.onError,this),e.on(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(_.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(_.BUFFER_CREATED,this.onBufferCreated,this),e.on(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(_.ERROR,this.onError,this),e.off(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(_.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(_.BUFFER_CREATED,this.onBufferCreated,this),e.off(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(e){if(this.levels){const{lastCurrentTime:t,hls:a}=this;if(this.stopLoad(),this.setInterval(jP),this.level=-1,!this.startFragRequested){let i=a.startLevel;i===-1&&(a.config.testBandwidth&&this.levels.length>1?(i=0,this.bitrateTest=!0):i=a.firstAutoLevel),a.nextLoadLevel=i,this.level=a.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=$.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=$.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case $.WAITING_LEVEL:{const{levels:t,level:a}=this,i=t==null?void 0:t[a],o=i==null?void 0:i.details;if(o&&(!o.live||this.levelLastLoaded===i)){if(this.waitForCdnTuneIn(o))break;this.state=$.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=$.IDLE;break}break}case $.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),a=this.retryDate;if(!a||t>=a||(e=this.media)!=null&&e.seeking){const{levels:i,level:o}=this,r=i==null?void 0:i[o];this.resetStartWhenNotLoaded(r||null),this.state=$.IDLE}}break}this.state===$.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:a,media:i}=this;if(t===null||!i&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const o=e.nextLoadLevel;if(!(a!=null&&a[o]))return;const r=a[o],l=this.getMainFwdBufferInfo();if(l===null)return;const d=this.getLevelDetails();if(d&&this._streamEnded(l,d)){const p={};this.altAudio&&(p.type="video"),this.hls.trigger(_.BUFFER_EOS,p),this.state=$.ENDED;return}e.loadLevel!==o&&e.manualLevel===-1&&this.log(`Adapting to level ${o} from level ${this.level}`),this.level=e.nextLoadLevel=o;const c=r.details;if(!c||this.state===$.WAITING_LEVEL||c.live&&this.levelLastLoaded!==r){this.level=o,this.state=$.WAITING_LEVEL;return}const h=l.len,u=this.getMaxBufferLength(r.maxBitrate);if(h>=u)return;this.backtrackFragment&&this.backtrackFragment.start>l.end&&(this.backtrackFragment=null);const f=this.backtrackFragment?this.backtrackFragment.start:l.end;let g=this.getNextFragment(f,c);if(this.couldBacktrack&&!this.fragPrevious&&g&&g.sn!=="initSegment"&&this.fragmentTracker.getState(g)!==tt.OK){var m;const y=((m=this.backtrackFragment)!=null?m:g).sn-c.startSN,b=c.fragments[y-1];b&&g.cc===b.cc&&(g=b,this.fragmentTracker.removeFragment(b))}else this.backtrackFragment&&l.len&&(this.backtrackFragment=null);if(g&&this.isLoopLoading(g,f)){if(!g.gap){const y=this.audioOnly&&!this.altAudio?Be.AUDIO:Be.VIDEO,b=(y===Be.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;b&&this.afterBufferFlushed(b,y,ce.MAIN)}g=this.getNextFragmentLoopLoading(g,c,l,ce.MAIN,u)}g&&(g.initSegment&&!g.initSegment.data&&!this.bitrateTest&&(g=g.initSegment),this.loadFragment(g,r,f))}loadFragment(e,t,a){const i=this.fragmentTracker.getState(e);this.fragCurrent=e,i===tt.NOT_LOADED||i===tt.PARTIAL?e.sn==="initSegment"?this._loadInitSegment(e,t):this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):(this.startFragRequested=!0,super.loadFragment(e,t,a)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,ce.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let a;const i=this.getAppendedFrag(t.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);const o=this.getLevelDetails();if(o!=null&&o.live){const l=this.getMainFwdBufferInfo();if(!l||l.len<o.targetduration*2)return}if(!t.paused&&e){const l=this.hls.nextLoadLevel,d=e[l],c=this.fragLastKbps;c&&this.fragCurrent?a=this.fragCurrent.duration*d.maxBitrate/(1e3*c)+1:a=0}else a=0;const r=this.getBufferedFrag(t.currentTime+a);if(r){const l=this.followingBufferedFrag(r);if(l){this.abortCurrentFrag();const d=l.maxStartPTS?l.maxStartPTS:l.start,c=l.duration,h=Math.max(r.end,d+Math.min(Math.max(c-this.config.maxFragLookUpTolerance,c*(this.couldBacktrack?.5:.125)),c*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(h,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case $.KEY_LOADING:case $.FRAG_LOADING:case $.FRAG_LOADING_WAITING_RETRY:case $.PARSING:case $.PARSED:this.state=$.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const a=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new GP(this.config,a,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const e=this.media,t=e?e.currentTime:null;ae(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const a=this.getMainFwdBufferInfo();if(a===null||a.len===0){this.warn(`Main forward buffer length on "seeked" event ${a?a.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(_.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(e,t){let a=!1,i=!1;t.levels.forEach(o=>{const r=o.audioCodec;r&&(a=a||r.indexOf("mp4a.40.2")!==-1,i=i||r.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=a&&i&&!VP(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:a}=this;if(!a||this.state!==$.IDLE)return;const i=a[t.level];(!i.details||i.details.live&&this.levelLastLoaded!==i||this.waitForCdnTuneIn(i.details))&&(this.state=$.WAITING_LEVEL)}onLevelLoaded(e,t){var a;const{levels:i}=this,o=t.level,r=t.details,l=r.totalduration;if(!i){this.warn(`Levels were reset while loading level ${o}`);return}this.log(`Level ${o} loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""}, cc [${r.startCC}, ${r.endCC}] duration:${l}`);const d=i[o],c=this.fragCurrent;c&&(this.state===$.FRAG_LOADING||this.state===$.FRAG_LOADING_WAITING_RETRY)&&c.level!==t.level&&c.loader&&this.abortCurrentFrag();let h=0;if(r.live||(a=d.details)!=null&&a.live){var u;if(this.checkLiveUpdate(r),r.deltaUpdateFailed)return;h=this.alignPlaylists(r,d.details,(u=this.levelLastLoaded)==null?void 0:u.details)}if(d.details=r,this.levelLastLoaded=d,this.hls.trigger(_.LEVEL_UPDATED,{details:r,level:o}),this.state===$.WAITING_LEVEL){if(this.waitForCdnTuneIn(r))return;this.state=$.IDLE}this.startFragRequested?r.live&&this.synchronizeToLiveEdge(r):this.setStartPosition(r,h),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:a,part:i,payload:o}=e,{levels:r}=this;if(!r){this.warn(`Levels were reset while fragment load was in progress. Fragment ${a.sn} of level ${a.level} will not be buffered`);return}const l=r[a.level],d=l.details;if(!d){this.warn(`Dropping fragment ${a.sn} of level ${a.level} after level details were reset`),this.fragmentTracker.removeFragment(a);return}const c=l.videoCodec,h=d.PTSKnown||!d.live,u=(t=a.initSegment)==null?void 0:t.data,f=this._getAudioCodec(l),g=this.transmuxer=this.transmuxer||new Fp(this.hls,ce.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),m=i?i.index:-1,p=m!==-1,y=new El(a.level,a.sn,a.stats.chunkCount,o.byteLength,m,p),b=this.initPTS[a.cc];g.push(o,u,f,c,a,i,d.totalduration,h,y,b)}onAudioTrackSwitching(e,t){const a=this.altAudio;if(!!!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const r=this.fragCurrent;r&&(this.log("Switching to main audio track, cancel main fragment load"),r.abortRequests(),this.fragmentTracker.removeFragment(r)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const o=this.hls;a&&(o.trigger(_.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),o.trigger(_.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const a=t.id,i=!!this.hls.audioTracks[a].url;if(i){const o=this.videoBuffer;o&&this.mediaBuffer!==o&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=o)}this.altAudio=i,this.tick()}onBufferCreated(e,t){const a=t.tracks;let i,o,r=!1;for(const l in a){const d=a[l];if(d.id==="main"){if(o=l,i=d,l==="video"){const c=a[l];c&&(this.videoBuffer=c.buffer)}}else r=!0}r&&i?(this.log(`Alternate track found, use ${o}.buffered to schedule main fragment loading`),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:a,part:i}=t;if(a&&a.type!==ce.MAIN)return;if(this.fragContextChanged(a)){this.warn(`Fragment ${a.sn}${i?" p: "+i.index:""} of level ${a.level} finished buffering, but was aborted. state: ${this.state}`),this.state===$.PARSED&&(this.state=$.IDLE);return}const o=i?i.stats:a.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,i)}onError(e,t){var a;if(t.fatal){this.state=$.ERROR;return}switch(t.details){case N.FRAG_GAP:case N.FRAG_PARSING_ERROR:case N.FRAG_DECRYPT_ERROR:case N.FRAG_LOAD_ERROR:case N.FRAG_LOAD_TIMEOUT:case N.KEY_LOAD_ERROR:case N.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ce.MAIN,t);break;case N.LEVEL_LOAD_ERROR:case N.LEVEL_LOAD_TIMEOUT:case N.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===$.WAITING_LEVEL&&((a=t.context)==null?void 0:a.type)===ve.LEVEL&&(this.state=$.IDLE);break;case N.BUFFER_APPEND_ERROR:case N.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===N.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case N.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!Pe.getBuffered(e).length){const a=this.state!==$.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,a)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=$.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==Be.AUDIO||this.audioOnly&&!this.altAudio){const a=(t===Be.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(a,t,ce.MAIN),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let a=this.startPosition;if(a>=0&&t<a){if(e.seeking){this.log(`could not seek to ${a}, already seeking at ${t}`);return}const i=Pe.getBuffered(e),r=(i.length?i.start(0):0)-a;r>0&&(r<this.config.maxBufferHole||r<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${r} to match buffer start`),a+=r,this.startPosition=a),this.log(`seek to target start position ${a} from current time ${t}`),e.currentTime=a}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(a=>{const{hls:i}=this;if(!a||this.fragContextChanged(e))return;t.fragmentError=0,this.state=$.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const o=e.stats;o.parsing.start=o.parsing.end=o.buffering.start=o.buffering.end=self.performance.now(),i.trigger(_.FRAG_LOADED,a),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const a="main",{hls:i}=this,{remuxResult:o,chunkMeta:r}=e,l=this.getCurrentContext(r);if(!l){this.resetWhenMissingContext(r);return}const{frag:d,part:c,level:h}=l,{video:u,text:f,id3:g,initSegment:m}=o,{details:p}=h,y=this.altAudio?void 0:o.audio;if(this.fragContextChanged(d)){this.fragmentTracker.removeFragment(d);return}if(this.state=$.PARSING,m){if(m!=null&&m.tracks){const w=d.initSegment||d;this._bufferInitSegment(h,m.tracks,w,r),i.trigger(_.FRAG_PARSING_INIT_SEGMENT,{frag:w,id:a,tracks:m.tracks})}const b=m.initPTS,S=m.timescale;ae(b)&&(this.initPTS[d.cc]={baseTime:b,timescale:S},i.trigger(_.INIT_PTS_FOUND,{frag:d,id:a,initPTS:b,timescale:S}))}if(u&&p&&d.sn!=="initSegment"){const b=p.fragments[d.sn-1-p.startSN],S=d.sn===p.startSN,w=!b||d.cc>b.cc;if(o.independent!==!1){const{startPTS:x,endPTS:E,startDTS:v,endDTS:T}=u;if(c)c.elementaryStreams[u.type]={startPTS:x,endPTS:E,startDTS:v,endDTS:T};else if(u.firstKeyFrame&&u.independent&&r.id===1&&!w&&(this.couldBacktrack=!0),u.dropped&&u.independent){const R=this.getMainFwdBufferInfo(),L=(R?R.end:this.getLoadPosition())+this.config.maxBufferHole,B=u.firstKeyFramePTS?u.firstKeyFramePTS:x;if(!S&&L<B-this.config.maxBufferHole&&!w){this.backtrack(d);return}else w&&(d.gap=!0);d.setElementaryStreamInfo(u.type,d.start,E,d.start,T,!0)}else S&&x>Ci&&(d.gap=!0);d.setElementaryStreamInfo(u.type,x,E,v,T),this.backtrackFragment&&(this.backtrackFragment=d),this.bufferFragmentData(u,d,c,r,S||w)}else if(S||w)d.gap=!0;else{this.backtrack(d);return}}if(y){const{startPTS:b,endPTS:S,startDTS:w,endDTS:x}=y;c&&(c.elementaryStreams[Be.AUDIO]={startPTS:b,endPTS:S,startDTS:w,endDTS:x}),d.setElementaryStreamInfo(Be.AUDIO,b,S,w,x),this.bufferFragmentData(y,d,c,r)}if(p&&g!=null&&(t=g.samples)!=null&&t.length){const b={id:a,frag:d,details:p,samples:g.samples};i.trigger(_.FRAG_PARSING_METADATA,b)}if(p&&f){const b={id:a,frag:d,details:p,samples:f.samples};i.trigger(_.FRAG_PARSING_USERDATA,b)}}_bufferInitSegment(e,t,a,i){if(this.state!==$.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:o,video:r,audiovideo:l}=t;if(o){let d=e.audioCodec;const c=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){d&&(d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5");const h=o.metadata;h&&"channelCount"in h&&(h.channelCount||1)!==1&&c.indexOf("firefox")===-1&&(d="mp4a.40.5")}d&&d.indexOf("mp4a.40.5")!==-1&&c.indexOf("android")!==-1&&o.container!=="audio/mpeg"&&(d="mp4a.40.2",this.log(`Android: force audio codec to ${d}`)),e.audioCodec&&e.audioCodec!==d&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${d}"`),o.levelCodec=d,o.id="main",this.log(`Init audio buffer, container:${o.container}, codecs[selected/level/parsed]=[${d||""}/${e.audioCodec||""}/${o.codec}]`)}r&&(r.levelCodec=e.videoCodec,r.id="main",this.log(`Init video buffer, container:${r.container}, codecs[level/parsed]=[${e.videoCodec||""}/${r.codec}]`)),l&&this.log(`Init audiovideo buffer, container:${l.container}, codecs[level/parsed]=[${e.codecs}/${l.codec}]`),this.hls.trigger(_.BUFFER_CODECS,t),Object.keys(t).forEach(d=>{const h=t[d].initSegment;h!=null&&h.byteLength&&this.hls.trigger(_.BUFFER_APPENDING,{type:d,data:h,frag:a,part:null,chunkMeta:i,parent:a.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,ce.MAIN)}backtrack(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=$.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const a=e.currentTime;if(Pe.isBuffered(e,a)?t=this.getAppendedFrag(a):Pe.isBuffered(e,a+.1)&&(t=this.getAppendedFrag(a+.1)),t){this.backtrackFragment=null;const i=this.fragPlaying,o=t.level;(!i||t.sn!==i.sn||i.level!==o)&&(this.fragPlaying=t,this.hls.trigger(_.FRAG_CHANGED,{frag:t}),(!i||i.level!==o)&&this.hls.trigger(_.LEVEL_SWITCHED,{level:o}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,a=this.currentFrag;if(a&&ae(t)&&ae(a.programDateTime)){const i=a.programDateTime+(t-a.start)*1e3;return new Date(i)}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class ds{static get version(){return"1.5.17"}static isMSESupported(){return _g()}static isSupported(){return MP()}static getMediaSource(){return As()}static get Events(){return _}static get ErrorTypes(){return pe}static get ErrorDetails(){return N}static get DefaultConfig(){return ds.defaultConfig?ds.defaultConfig:yg}static set DefaultConfig(e){ds.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new Dl,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.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,N3(e.debug||!1,"Hls instance");const t=this.config=DP(ds.DefaultConfig,e);this.userConfig=e,t.progressive&&PP(t);const{abrController:a,bufferController:i,capLevelController:o,errorController:r,fpsController:l}=t,d=new r(this),c=this.abrController=new a(this),h=this.bufferController=new i(this),u=this.capLevelController=new o(this),f=new l(this),g=new v6(this),m=new B6(this),p=t.contentSteeringController,y=p?new p(this):null,b=this.levelController=new OP(this,y),S=new rN(this),w=new FP(this.config),x=this.streamController=new HP(this,S,w);u.setStreamController(x),f.setStreamController(x);const E=[g,b,x];y&&E.splice(1,0,y),this.networkControllers=E;const v=[c,h,u,f,m,S];this.audioTrackController=this.createController(t.audioTrackController,E);const T=t.audioStreamController;T&&E.push(new T(this,S,w)),this.subtitleTrackController=this.createController(t.subtitleTrackController,E);const R=t.subtitleStreamController;R&&E.push(new R(this,S,w)),this.createController(t.timelineController,v),w.emeController=this.emeController=this.createController(t.emeController,v),this.cmcdController=this.createController(t.cmcdController,v),this.latencyController=this.createController(N6,v),this.coreComponents=v,E.push(d);const L=d.onErrorOut;typeof L=="function"&&this.on(_.ERROR,L,d)}createController(e,t){if(e){const a=new e(this);return t&&t.push(a),a}return null}on(e,t,a=this){this._emitter.on(e,t,a)}once(e,t,a=this){this._emitter.once(e,t,a)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,a=this,i){this._emitter.off(e,t,a,i)}listeners(e){return this._emitter.listeners(e)}emit(e,t,a){return this._emitter.emit(e,t,a)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(a){if(A.error("An internal error happened while handling event "+e+'. Error message: "'+a.message+'". Here is a stacktrace:',a),!this.triggeringException){this.triggeringException=!0;const i=e===_.ERROR;this.trigger(_.ERROR,{type:pe.OTHER_ERROR,details:N.INTERNAL_EXCEPTION,fatal:i,event:e,error:a}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){A.log("destroy"),this.trigger(_.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){A.log("attachMedia"),this._media=e,this.trigger(_.MEDIA_ATTACHING,{media:e})}detachMedia(){A.log("detachMedia"),this.trigger(_.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,a=this.url,i=this.url=Qr.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,A.log(`loadSource:${i}`),t&&a&&(a!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(_.MANIFEST_LOADING,{url:e})}startLoad(e=-1){A.log(`startLoad(${e})`),this.started=!0,this.networkControllers.forEach(t=>{t.startLoad(e)})}stopLoad(){A.log("stopLoad"),this.started=!1,this.networkControllers.forEach(e=>{e.stopLoad()})}resumeBuffering(){this.started&&this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.startLoad(-1)})}pauseBuffering(){this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.stopLoad()})}swapAudioCodec(){A.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){A.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){A.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){A.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){A.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){A.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){A.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(A.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){D6(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const a=e.length;for(let i=0;i<a;i++)if(e[i].maxBitrate>=t)return i;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:a}=this;let i;if(t===-1&&e!=null&&e.length?i=e.length-1:i=t,a)for(let o=i;o--;){const r=e[o].attrs["HDCP-LEVEL"];if(r&&r<=a)return o}return i}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(e){var t;return(t=this.audioTrackController)==null?void 0:t.setAudioOption(e)}setSubtitleOption(e){var t;return(t=this.subtitleTrackController)==null||t.setSubtitleOption(e),null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}ds.defaultConfig=void 0;const WP=[(s=>(n.pushScopeId("data-v-bf69d301"),s=s(),n.popScopeId(),s))(()=>n.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},[n.createElementVNode("path",{d:"M5 15L15 5",stroke:"white","stroke-width":"1.7","stroke-miterlimit":"10","stroke-linecap":"round","stroke-linejoin":"round"}),n.createElementVNode("path",{d:"M15 15L5 5",stroke:"white","stroke-width":"1.7","stroke-miterlimit":"10","stroke-linecap":"round","stroke-linejoin":"round"})],-1))],KP={class:"stories__content"},qP={class:"story-container-game"},YP={class:"story-circle"},JP={class:"story-result"},XP={class:"stories__content__stories-bar"},ZP={class:"stories__content__video"},QP={class:"stories__content__video__info__date"},eO={class:"stories__content__video__info__data"},tO=Xe({__name:"GameStories",props:{stories:{type:Array,default:()=>[]},startStoryIndex:{type:Number,default:0},isFirstGameStories:{type:Boolean,default:!1},isLastGameStories:{type:Boolean,default:!1}},emits:["close","last-story-index","swipe","video-play","video-next-back"],setup(s,{emit:e}){const t=s;n.useCssVars(ee=>({f47bb864:y.value,"875f549a":b.value,"3a0e3be2":v.value}));const a=eu(),o=[{ids:[607,608],name:"Oportunidad de Gol"},{ids:[12,55],name:"Gol"},{ids:[54,35],name:"Autogol"},{ids:[14,52],name:"Tarjeta Amarilla"},{ids:[15,53],name:"Tarjeta Roja"},{ids:[466,477],name:"Penal Recibido"}].reduce((ee,Ce)=>(Ce.ids.forEach(Te=>{ee.set(Te,Ce.name)}),ee),new Map),r=n.ref(null),l=n.ref(null),d=n.ref([]),c=n.ref(0),h=n.ref(null),u=n.ref(0),f=n.ref(0),g=n.ref(0),m=n.ref(!1),p=n.ref(0),y=n.ref("auto"),b=n.ref("100%"),S=n.ref(null),w=n.ref(0),x=n.ref(null),E=n.ref(null),v=n.computed(()=>X()?"7vw":"16px"),T=n.computed(()=>d.value[c.value]),R=n.computed(()=>({"--icon-play":`url(${a}/icnplay1.svg)`}));function L(){l.value.muted=!1,l.value.play()}const B=n.computed(()=>!T.value.isHls&&["ios"].includes(Qo()));n.watch(()=>T.value,ee=>{ee&&W()}),n.watch(()=>t.stories,ee=>{if(ee.length){c.value=0,g.value=0;const Ce=ee.map(Te=>({...Te,progress:0,isHls:Te.url.includes(".m3u8"),date:`${Te.date.getDate()}, ${du[Te.date.getMonth()]} ${Te.date.getFullYear()}`,data:`${o.get(Te.categoryId)} ${dv(Te.player.player_name)}`})).sort((Te,Fe)=>Te.startTime-Fe.startTime);t.startStoryIndex>0&&t.startStoryIndex<Ce.length-1&&(Ce.forEach((Te,Fe)=>{Fe<=t.startStoryIndex&&(Te.progress=100)}),c.value=t.startStoryIndex+1,g.value=c.value),d.value=[...Ce]}},{immediate:!0}),n.watch(()=>r.value,ee=>{ee&&M()},{flush:"post"}),n.watch(()=>h.value,ee=>{ee&&(cv()?(ee.addEventListener("touchstart",ue),ee.addEventListener("touchend",Y)):(ee.addEventListener("mousedown",ue),ee.addEventListener("mouseup",Y)))},{flush:"post"});function M(){l.value=new zs("#video-plyr",{controls:[],autoplay:!0,playsinline:!0}),l.value.on("loadeddata",se(l.value)),l.value.on("timeupdate",oe()),W(T.value),l.value.isDestroyed=!1}function W(){T.value.isHls?j(T.value):l.value&&(l.value.source={type:"video",sources:[{src:T.value.url,type:"video/mp4"}]})}function j(ee){if(r.value)if(ds.isSupported()){r.value.src=null;let Ce=new ds;Ce.loadSource(ee.url),Ce.attachMedia(r.value)}else l.value.source={type:"video",sources:[{src:ee.url,type:"video/mp4"}]}}function se(){const ee=document.querySelector(".plyr__video-wrapper");return ee&&(w.value=ee.getBoundingClientRect()),()=>{l.value.duration>0&&(l.value.currentTime=T.value.startTime||0,l.value.muted=!1,l.value.play(),e("video-play",T.value))}}function oe(){return xe(),()=>{T.value.currentTime=l.value.currentTime,T.value.progress=(l.value.currentTime-T.value.startTime)/T.value.duration*100,(l.value.currentTime-T.value.startTime)/T.value.duration*100===0?X()&&(m.value=!0):X()&&(m.value=!1),(l.value.currentTime-T.value.startTime)/T.value.duration*100<0?E.value&&!X()&&(E.value.style="display: none",b.value="100%"):E.value&&!X()&&(E.value.style="display: block",b.value="auto"),l.value.currentTime>=T.value.endTime&&(l.value.pause(),ne())}}function ne(ee=1){const Ce=c.value+ee;Ce<0?t.isFirstGameStories?l.value&&(l.value.currentTime=T.value.startTime):he("right",T.value):Ce===d.value.length?t.isLastGameStories?K():he("left",T.value):(c.value=Ce,ee===1&&(g.value=c.value))}function de(){u.value>f.value?he("left",T.value):u.value<f.value?he("right",T.value):J()}function he(ee,Ce){e("last-story-index",g.value),e("swipe",{direction:ee,currentPlay:Ce})}function J(){const ee=window.innerWidth/2,Ce=u.value<ee,Te=T.value.progress;T.value.progress=Ce?0:100,l.value.pause(),e("video-next-back",{eventName:Ce?"stories_video_anterior":"stories_video_siguiente",currentPlay:{...T.value,progress:Te}}),ne(Ce?-1:1)}function K(){l.value.pause(),l.value.muted=!0,e("last-story-index",g.value),e("close",T.value)}function ue(ee){u.value=ee.changedTouches?ee.changedTouches[0].clientX:ee.clientX}function Y(ee){f.value=ee.changedTouches?ee.changedTouches[0].clientX:ee.clientX,de()}function X(){return/iPhone|iPad/i.test(navigator.userAgent)}function re(){window.scrollTo(0,100)}function ye(){if(window.scrollTo(0,100),Qo()=="android"){const ee=document.querySelector("#stories");ee.requestFullscreen(ee)}}function xe(){if(window.ResizeObserver)S.value=new window.ResizeObserver(()=>{x.value&&w.value.height>0&&(x.value.getBoundingClientRect().height>610?y.value="auto":y.value="100dvh",x.value.getBoundingClientRect().height>610?b.value="100%":b.value="auto")}),S.value.observe(x.value);else throw new Error("Resize observer not supported!")}return n.onMounted(()=>{p.value=document.documentElement.scrollTop||document.body.scrollTop,window.scrollTo(0,100),X()?(window.addEventListener("resize",re),re()):(window.addEventListener("orientationchange",ye),ye()),setTimeout(()=>{xe()},500)}),n.onBeforeUnmount(()=>{window.scrollTo(0,p.value),X()?window.removeEventListener("resize",re):(Qo()=="android"&&document.exitFullscreen(),window.removeEventListener("orientationchange",ye)),S.value&&(S.value.disconnect(),S.value=null)}),(ee,Ce)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["stories",X()?"stories-safe-areas-iphone":""]),id:"stories",ref_key:"eStories",ref:x,style:n.normalizeStyle(R.value)},[n.createElementVNode("div",{class:n.normalizeClass(["stories__close",X()?"stories-safe-areas-iphone":""]),onClick:K},WP,2),n.createElementVNode("div",KP,[n.createElementVNode("div",qP,[n.createElementVNode("div",YP,[n.createElementVNode("div",{class:"circle-item-home",style:n.normalizeStyle(`background-image: url(${T.value.thumbnail.logoHomeTeam})`)},null,4),n.createElementVNode("div",{class:"circle-item-away",style:n.normalizeStyle(`background-image: url(${T.value.thumbnail.logoAwayTeam})`)},null,4)]),n.createElementVNode("div",JP,n.toDisplayString(T.value.header.label),1)]),n.createElementVNode("div",{ref_key:"overlay",ref:h,class:"stories__content__overlay"},null,512),n.createElementVNode("div",XP,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,(Te,Fe)=>(n.openBlock(),n.createElementBlock("div",{key:Fe,class:"stories__content__stories-bar__item"},[n.createElementVNode("div",{class:"stories__content__stories-bar__item__progress",style:n.normalizeStyle({width:`${Te.progress}%`})},null,4)]))),128))]),n.createElementVNode("div",ZP,[n.createElementVNode("div",{class:"stories__content__video__info",ref_key:"videoInfo",ref:E},[n.createElementVNode("div",QP,n.toDisplayString(T.value.date),1),n.createElementVNode("div",eO,n.toDisplayString(T.value.data),1)],512),n.createElementVNode("video",{ref_key:"player",ref:r,id:"video-plyr",controls:"",preload:"auto","data-setup":"{}",playsinline:""},null,512)])]),B.value?(n.openBlock(),n.createElementBlock("button",{key:0,id:"btn_play_ios",style:n.normalizeStyle(m.value?"display:block":"display:none"),onClick:L},null,4)):n.createCommentVNode("",!0)],6))}},[["__scopeId","data-v-bf69d301"]]),sO={playlist_id:"GPI_default2022-12-08T02:51:56.334+00:00-PI-0",last_played_index:0,group_id:"1",total_plays:55,playlist_type:"1",group_playlist_id:"GPI_default2022-12-08T02:51:56.334+00:00",user_id:"goltesting",created_at:"2023-03-30T15:42:36.402+00:00",playlist:[[136731235,"Liga MX","Apertura 2022",69929,"Aldrete Rodriguez, Adrian","Quintero Huitron, Daniel","Estadio Ol&iacute;mpico Universitario, Ciudad de M&eacute;xico.","1 - 0","1 - 0","2022-07-17T05:00:00.000Z","Universidad Nacional","https://az755631.vo.msecnd.net/teams-80/11.png","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png",12,"Goals",1259,1278,20,1266,"https://golstatsbets.blob.core.windows.net/video-player/69929_1.mp4"],[139820484,"Liga MX","Apertura 2022",70042,"Davila Zavala, Victor","Mejia, Oscar ","Estadio Nuevo Monumental, Rafaela.","3 - 1","1 - 0","2022-09-18T05:00:00.000Z","Leon","https://az755631.vo.msecnd.net/teams-80/173.png","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png",12,"Goals",1501,1524,24,1512,"https://golstatsbets.blob.core.windows.net/video-player/70042_1.mp4"],[139566427,"Liga MX","Apertura 2022",69989,"Zaldivar Caviedes, Angel","Guerrero Ramirez, Fernando","Estadio Akron, Zapopan.","1 - 4","1 - 0","2022-09-13T05:00:00.000Z","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png",12,"Goals",6569,6588,108,6576,"https://golstatsbets.blob.core.windows.net/video-player/69989_1.mp4"],[139441913,"Liga MX","Apertura 2022",70031,"Vega Rojas, Alexis","Quintero Huitron, Daniel","Estadio Akron, Zapopan.","1 - 0","1 - 0","2022-09-10T05:00:00.000Z","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png","Puebla FC","https://az755631.vo.msecnd.net/teams-80/10.png",12,"Goals",6207,6237,103,6225,"https://golstatsbets.blob.core.windows.net/video-player/70031_1.mp4"],[139566063,"Liga MX","Apertura 2022",69989,"Guzman Palomeque, Nahuel","Guerrero Ramirez, Fernando","Estadio Akron, Zapopan.","1 - 4","0 - 0","2022-09-13T05:00:00.000Z","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png",39,"Saves",2554,2573,41,2561,"https://golstatsbets.blob.core.windows.net/video-player/69989_1.mp4"],[138276096,"Liga MX","Apertura 2022",69983,"Cortizo de la Piedra, Jordi","Guerrero Ramirez, Fernando","Estadio Cuauhtemoc, Puebla.","2 - 2","1 - 0","2022-08-16T05:00:00.000Z","Puebla FC","https://az755631.vo.msecnd.net/teams-80/10.png","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png",12,"Goals",5020,5046,83,5034,"https://golstatsbets.blob.core.windows.net/video-player/69983_1.mp4"],[139285589,"Liga MX","Apertura 2022",70021,"Cortizo de la Piedra, Jordi","Escobedo, Adonai","Estadio Cuauhtemoc, Puebla.","2 - 2","1 - 0","2022-09-07T05:00:00.000Z","Puebla FC","https://az755631.vo.msecnd.net/teams-80/10.png","Pachuca","https://az755631.vo.msecnd.net/teams-80/9.png",12,"Goals",1123,1152,18,1140,"https://golstatsbets.blob.core.windows.net/video-player/70021_1.mp4"],[139294964,"Liga MX","Apertura 2022",70022,"Cordova Reyes, Francisco","Ortiz Nava, Marco Antonio","Estadio Universitario, San Nicol&aacute;s de los Garza.","3 - 1","1 - 0","2022-09-07T05:00:00.000Z","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png",12,"Goals",2564,2583,41,2571,"https://golstatsbets.blob.core.windows.net/video-player/70022_1.mp4"],[137782451,"Liga MX","Apertura 2022",69968,"Orrantia Trevino, Carlos","Macias Romo, Oscar","Estadio TSM Corona, Torre&oacute;n.","4 - 0","1 - 0","2022-08-06T05:00:00.000Z","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png",12,"Goals",4662,4693,77,4681,"https://golstatsbets.blob.core.windows.net/video-player/69968_1.mp4"],[136551560,"Liga MX","Apertura 2022",69924,"Sanchez Guerrero, Richard","Escobedo, Adonai","Estadio Azteca, Ciudad de M&eacute;xico.","1 - 0","1 - 0","2022-07-13T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png",12,"Goals",7032,7064,116,7052,"https://golstatsbets.blob.core.windows.net/video-player/69924_1.mp4"],[136391881,"Liga MX","Apertura 2022",69914,"Hurtado Herrera, Aviles","Ramos Palazuelos, Cesar","Estadio Hidalgo, Pachuca.","2 - 0","1 - 0","2022-07-04T05:00:00.000Z","Pachuca","https://az755631.vo.msecnd.net/teams-80/9.png","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png",12,"Goals",4903,4937,81,4925,"https://golstatsbets.blob.core.windows.net/video-player/69914_1.mp4"],[138158049,"Liga MX","Apertura 2022",69979,"Volpi, Tiago Luis","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de M&eacute;xico.","2 - 3","0 - 1","2022-08-14T05:00:00.000Z","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png",39,"Saves",7207,7226,119,7214,"https://golstatsbets.blob.core.windows.net/video-player/69979_1.mp4"],[138124884,"Liga MX","Apertura 2022",69978,"Vargas Gil, Camilo","Ortiz Nava, Marco Antonio","Default","1 - 1","0 - 0","2022-08-13T05:00:00.000Z","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png",39,"Saves",6080,6099,100,6087,"https://golstatsbets.blob.core.windows.net/video-player/69978_1.mp4"],[139635463,"Liga MX","Apertura 2022",69950,"Fidalgo Fernandez, Alvaro","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de M&eacute;xico.","3 - 3","0 - 2","2022-09-14T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",10,"Assists",7096,7123,118,7111,"https://golstatsbets.blob.core.windows.net/video-player/69950_1.mp4"],[139769221,"Liga MX","Apertura 2022",70039,"Ochoa Magana, Guillermo","Escobedo, Adonai","Estadio Azteca, Ciudad de M&eacute;xico.","2 - 1","0 - 0","2022-09-17T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png",39,"Saves",4567,4586,76,4574,"https://golstatsbets.blob.core.windows.net/video-player/70039_1.mp4"],[139405626,"Liga MX","Apertura 2022",70028,"Acevedo Lopez, Carlos","Santander, Luis Enrique","Estadio La Corregidora, Quer&eacute;taro.","3 - 3","0 - 2","2022-09-10T05:00:00.000Z","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",55,"Goals",7452,7471,124,7459,"https://golstatsbets.blob.core.windows.net/video-player/70028_1.mp4"],[139410464,"Liga MX","Apertura 2022",70030,"Gonzalez Vela Alvizu, Julio","Hernandez Gomez, Fernando","Estadio Nemesio Diez, Toluca.","2 - 2","0 - 1","2022-09-10T05:00:00.000Z","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png","Universidad Nacional","https://az755631.vo.msecnd.net/teams-80/11.png",55,"Goals",7467,7486,124,7474,"https://golstatsbets.blob.core.windows.net/video-player/70030_1.mp4"],[139902797,"Liga MX","Apertura 2022",70038,"Quinones Quinones, Julian","Ortiz Nava, Marco Antonio","Estadio BBVA Bancomer, Guadalupe","2 - 0","0 - 0","2022-09-17T05:00:00.000Z","Rayados de Monterrey","https://az755631.vo.msecnd.net/teams-80/7.png","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png",702,"Con enfrentamiento",2334,2353,38,2341,"https://golstatsbets.blob.core.windows.net/video-player/70038_1.mp4"],[139771860,"Liga MX","Apertura 2022",70038,"Andrada, Esteban ","Ortiz Nava, Marco Antonio","Estadio BBVA Bancomer, Guadalupe","2 - 0","0 - 0","2022-09-17T05:00:00.000Z","Rayados de Monterrey","https://az755631.vo.msecnd.net/teams-80/7.png","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png",39,"Saves",6859,6878,113,6866,"https://golstatsbets.blob.core.windows.net/video-player/70038_1.mp4"],[136392028,"Liga MX","Apertura 2022",69914,"Hurtado Herrera, Aviles","Ramos Palazuelos, Cesar","Estadio Hidalgo, Pachuca.","2 - 0","0 - 0","2022-07-04T05:00:00.000Z","Pachuca","https://az755631.vo.msecnd.net/teams-80/9.png","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png",607,"Oportunidad de gol",335,374,5,342,"https://golstatsbets.blob.core.windows.net/video-player/69914_1.mp4"],[136467302,"Liga MX","Apertura 2022",69909,"Jurado Roca, Sebastian","Mejia, Oscar ","Estadio Universitario, San Nicol&aacute;s de los Garza.","2 - 3","0 - 0","2022-07-02T05:00:00.000Z","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png",39,"Saves",879,898,14,886,"https://golstatsbets.blob.core.windows.net/video-player/69909_1.mp4"],[138402354,"Liga MX","Apertura 2022",69990,"Beltran Cruz, Fernando","Mejia, Oscar ","Estadio Victoria, Aguascalientes.","0 - 4","0 - 1","2022-08-19T05:00:00.000Z","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png",12,"Goals",4517,4551,75,4539,"https://golstatsbets.blob.core.windows.net/video-player/69990_1.mp4"],[138157481,"Liga MX","Apertura 2022",69979,"Meneses Villarroel, Jean","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de M&eacute;xico.","2 - 3","0 - 1","2022-08-14T05:00:00.000Z","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png",12,"Goals",1900,1925,31,1913,"https://golstatsbets.blob.core.windows.net/video-player/69979_1.mp4"],[140106188,"Liga MX","Apertura 2022",69964,"Cortizo de la Piedra, Jordi","Escobedo, Adonai","Estadio Cuauhtemoc, Puebla.","2 - 1","1 - 0","2022-09-23T05:00:00.000Z","Puebla FC","https://az755631.vo.msecnd.net/teams-80/10.png","Universidad Nacional","https://az755631.vo.msecnd.net/teams-80/11.png",12,"Goals",461,484,7,472,"https://golstatsbets.blob.core.windows.net/video-player/69964_1.mp4"],[139839994,"Liga MX","Apertura 2022",70043,"Garcia Carpizo, Brian","Montano Robles, Diego","Estadio Caliente, Tijuana.","1 - 1","0 - 1","2022-09-18T05:00:00.000Z","Club Tijuana","https://az755631.vo.msecnd.net/teams-80/17.png","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png",12,"Goals",2112,2133,34,2121,"https://golstatsbets.blob.core.windows.net/video-player/70043_1.mp4"],[139403868,"Liga MX","Apertura 2022",70028,"Suarez, Leonardo Gabriel","Santander, Luis Enrique","Estadio La Corregidora, Quer&eacute;taro.","3 - 3","0 - 1","2022-09-10T05:00:00.000Z","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",12,"Goals",4296,4315,71,4303,"https://golstatsbets.blob.core.windows.net/video-player/70028_1.mp4"],[139371616,"Liga MX","Apertura 2022",70027,"Gallardo Vasconcelos, Jesus","Montano Robles, Diego","Estadio Olimpico Benito Juarez, Ciudad Juarez.","0 - 1","0 - 1","2022-09-09T05:00:00.000Z","FC Juarez","https://az755631.vo.msecnd.net/teams-80/3014.png","Rayados de Monterrey","https://az755631.vo.msecnd.net/teams-80/7.png",12,"Goals",5724,5750,94,5738,"https://golstatsbets.blob.core.windows.net/video-player/70027_1.mp4"],[139294028,"Liga MX","Apertura 2022",70022,"Thauvin, Florian","Ortiz Nava, Marco Antonio","Estadio Universitario, San Nicol&aacute;s de los Garza.","3 - 1","2 - 0","2022-09-07T05:00:00.000Z","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png",12,"Goals",6011,6030,99,6018,"https://golstatsbets.blob.core.windows.net/video-player/70022_1.mp4"],[137023432,"Liga MX","Apertura 2022",69939,"Gignac, Andre Pierre","Ortiz Nava, Marco Antonio","Estadio Universitario, San Nicol&aacute;s de los Garza.","2 - 0","1 - 0","2022-07-23T05:00:00.000Z","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png",12,"Goals",2829,2854,47,2842,"https://golstatsbets.blob.core.windows.net/video-player/69939_1.mp4"],[139303531,"Liga MX","Apertura 2022",70023,"Alves da Silva, Daniel","Ramos Palazuelos, Cesar","Estadio Ol&iacute;mpico Universitario, Ciudad de M&eacute;xico.","4 - 1","0 - 0","2022-09-07T05:00:00.000Z","Universidad Nacional","https://az755631.vo.msecnd.net/teams-80/11.png","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png",702,"Con enfrentamiento",262,293,3,278,"https://golstatsbets.blob.core.windows.net/video-player/70023_1.mp4"],[139303334,"Liga MX","Apertura 2022",70023,"Alves da Silva, Daniel","Ramos Palazuelos, Cesar","Estadio Ol&iacute;mpico Universitario, Ciudad de M&eacute;xico.","4 - 1","0 - 0","2022-09-07T05:00:00.000Z","Universidad Nacional","https://az755631.vo.msecnd.net/teams-80/11.png","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png",10,"Assists",5256,5283,87,5271,"https://golstatsbets.blob.core.windows.net/video-player/70023_1.mp4"],[139633795,"Liga MX","Apertura 2022",69950,"Valdes Contreras, Diego","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de M&eacute;xico.","3 - 3","0 - 1","2022-09-14T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",607,"Oportunidad de gol",675,701,10,689,"https://golstatsbets.blob.core.windows.net/video-player/69950_1.mp4"],[139242728,"Liga MX","Apertura 2022",70020,"Valdes Contreras, Diego","Caceres Hernandez, Victor Alfonso","Estadio Azteca, Ciudad de M&eacute;xico.","3 - 0","0 - 0","2022-09-06T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","CA San Luis","https://az755631.vo.msecnd.net/teams-80/13.png",10,"Assists",2841,2861,46,2849,"https://golstatsbets.blob.core.windows.net/video-player/70020_1.mp4"],[138747150,"Liga MX","Apertura 2022",7e4,"Valdes Contreras, Diego","Miranda Galindo, Erick Yair","Default","1 - 3","0 - 1","2022-08-26T05:00:00.000Z","Mazatlan FC","https://az755631.vo.msecnd.net/teams-80/8.png","America","https://az755631.vo.msecnd.net/teams-80/2.png",12,"Goals",2425,2448,39,2436,"https://golstatsbets.blob.core.windows.net/video-player/70000_1.mp4"],[138462163,"Liga MX","Apertura 2022",69995,"Valdes Contreras, Diego","Santander, Luis Enrique","Estadio Azteca, Ciudad de M&eacute;xico.","7 - 0","1 - 0","2022-08-20T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png",12,"Goals",3424,3443,56,3431,"https://golstatsbets.blob.core.windows.net/video-player/69995_1.mp4"],[138832474,"Liga MX","Apertura 2022",70005,"Sambueza, Rubens Oscar","Guerrero Ramirez, Fernando","Estadio TSM Corona, Torre&oacute;n.","4 - 1","1 - 1","2022-08-28T05:00:00.000Z","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png","CA San Luis","https://az755631.vo.msecnd.net/teams-80/13.png",12,"Goals",6830,6859,113,6847,"https://golstatsbets.blob.core.windows.net/video-player/70005_1.mp4"],[137178428,"Liga MX","Apertura 2022",69942,"Ibarra Mina, Alex Renato","Montano Robles, Diego","Estadio Jalisco, Guadalajara.","1 - 2","0 - 1","2022-07-26T05:00:00.000Z","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png","Club Tijuana","https://az755631.vo.msecnd.net/teams-80/17.png",12,"Goals",2786,2811,45,2799,"https://golstatsbets.blob.core.windows.net/video-player/69942_1.mp4"],[138339473,"Liga MX","Apertura 2022",69985,"Canelo, Pedro Alexis","Referee 1","Azteca","1 - 2","0 - 0","2022-08-17T05:00:00.000Z","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png","Club Tijuana","https://az755631.vo.msecnd.net/teams-80/17.png",10,"Assists",5133,5159,85,5147,"https://golstatsbets.blob.core.windows.net/video-player/69985_1.mp4"],[136701989,"Liga MX","Apertura 2022",69927,"Gimenez, Santiago Tomas","Macias Romo, Oscar","Estadio Jalisco, Guadalajara.","3 - 2","0 - 1","2022-07-16T05:00:00.000Z","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png",12,"Goals",1374,1397,22,1385,"https://golstatsbets.blob.core.windows.net/video-player/69927_1.mp4"],[139678329,"Liga MX","Apertura 2022",70049,"Antuna Romero, Carlos","Ortiz Nava, Marco Antonio","Estadio Azteca, Ciudad de M&eacute;xico.","2 - 1","0 - 0","2022-09-15T05:00:00.000Z","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png","Leon","https://az755631.vo.msecnd.net/teams-80/173.png",10,"Assists",6728,6752,111,6740,"https://golstatsbets.blob.core.windows.net/video-player/70049_1.mp4"],[139054131,"Liga MX","Apertura 2022",70010,"Davila Zavala, Victor","Ortiz Nava, Marco Antonio","Estadio Victoria, Aguascalientes.","3 - 2","1 - 1","2022-09-02T05:00:00.000Z","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png","Leon","https://az755631.vo.msecnd.net/teams-80/173.png",12,"Goals",6636,6661,110,6649,"https://golstatsbets.blob.core.windows.net/video-player/70010_1.mp4"],[137503273,"Liga MX","Apertura 2022",69962,"Davila Zavala, Victor","Macias Romo, Oscar","Estadio Nou Camp, Le&ocuate;n.","3 - 2","1 - 0","2022-07-31T05:00:00.000Z","Leon","https://az755631.vo.msecnd.net/teams-80/173.png","America","https://az755631.vo.msecnd.net/teams-80/2.png",12,"Goals",1940,1965,31,1953,"https://golstatsbets.blob.core.windows.net/video-player/69962_1.mp4"],[139308851,"Liga MX","Apertura 2022",70025,"Benedetti Roa, Nicolas","Hernandez Gomez, Fernando","Default","1 - 0","1 - 0","2022-09-07T05:00:00.000Z","Mazatlan FC","https://az755631.vo.msecnd.net/teams-80/8.png","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png",12,"Goals",1867,1891,31,1879,"https://golstatsbets.blob.core.windows.net/video-player/70025_1.mp4"],[138116335,"Liga MX","Apertura 2022",69976,"Benedetti Roa, Nicolas","Galvan Basulto, Eduardo","Estadio Nou Camp, Le&ocuate;n.","0 - 3","0 - 1","2022-08-13T05:00:00.000Z","Leon","https://az755631.vo.msecnd.net/teams-80/173.png","Mazatlan FC","https://az755631.vo.msecnd.net/teams-80/8.png",12,"Goals",591,629,9,617,"https://golstatsbets.blob.core.windows.net/video-player/69976_1.mp4"],[136791022,"Liga MX","Apertura 2022",69932,"Benedetti Roa, Nicolas","Camacho Peregrina, Jorge","Estadio Hidalgo, Pachuca.","1 - 1","0 - 1","2022-07-18T05:00:00.000Z","Pachuca","https://az755631.vo.msecnd.net/teams-80/9.png","Mazatlan FC","https://az755631.vo.msecnd.net/teams-80/8.png",12,"Goals",4284,4315,71,4303,"https://golstatsbets.blob.core.windows.net/video-player/69932_1.mp4"],[139414938,"Liga MX","Apertura 2022",70026,"Batista Ochoa, Facundo","Guerrero Ramirez, Fernando","Estadio Victoria, Aguascalientes.","1 - 2","1 - 0","2022-09-10T05:00:00.000Z","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png","America","https://az755631.vo.msecnd.net/teams-80/2.png",12,"Goals",461,490,7,478,"https://golstatsbets.blob.core.windows.net/video-player/70026_1.mp4"],[139051051,"Liga MX","Apertura 2022",70010,"Batista Ochoa, Facundo","Ortiz Nava, Marco Antonio","Estadio Victoria, Aguascalientes.","3 - 2","1 - 0","2022-09-02T05:00:00.000Z","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png","Leon","https://az755631.vo.msecnd.net/teams-80/173.png",12,"Goals",2731,2750,45,2738,"https://golstatsbets.blob.core.windows.net/video-player/70010_1.mp4"],[137828273,"Liga MX","Apertura 2022",69970,"Batista Ochoa, Facundo","Galvan Basulto, Eduardo","Estadio Alfonso Lastras Ram&iacute;rez, San Luis Potos&iacute;.","1 - 2","0 - 1","2022-08-07T05:00:00.000Z","CA San Luis","https://az755631.vo.msecnd.net/teams-80/13.png","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png",12,"Goals",849,870,13,858,"https://golstatsbets.blob.core.windows.net/video-player/69970_1.mp4"],[139025773,"Liga MX","Apertura 2022",70009,"Nahuelpan Osten, Ariel","Lopez Penuelas, Ismael","Estadio La Corregidora, Quer&eacute;taro.","1 - 1","1 - 0","2022-09-01T05:00:00.000Z","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png","Puebla FC","https://az755631.vo.msecnd.net/teams-80/10.png",12,"Goals",1454,1481,24,1472,"https://golstatsbets.blob.core.windows.net/video-player/70009_1.mp4"],[138063913,"Liga MX","Apertura 2022",69973,"Gonzalez Gonzalez, Arturo","Pacheco Larios, Guillermo","Estadio Victoria, Aguascalientes.","1 - 2","0 - 1","2022-08-12T05:00:00.000Z","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png","Rayados de Monterrey","https://az755631.vo.msecnd.net/teams-80/7.png",12,"Goals",6119,6138,101,6126,"https://golstatsbets.blob.core.windows.net/video-player/69973_1.mp4"],[137780455,"Liga MX","Apertura 2022",69966,"Gonzalez Gonzalez, Arturo","Ortiz Nava, Marco Antonio","Estadio BBVA Bancomer, Guadalupe","5 - 1","1 - 0","2022-08-06T05:00:00.000Z","Rayados de Monterrey","https://az755631.vo.msecnd.net/teams-80/7.png","Leon","https://az755631.vo.msecnd.net/teams-80/173.png",12,"Goals",2292,2321,38,2309,"https://golstatsbets.blob.core.windows.net/video-player/69966_1.mp4"],[140090831,"Liga MX","Apertura 2022",69950,"Suarez, Leonardo Gabriel","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de M&eacute;xico.","3 - 3","0 - 1","2022-09-14T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",12,"Goals",585,612,9,600,"https://golstatsbets.blob.core.windows.net/video-player/69950_1.mp4"],[140090832,"Liga MX","Apertura 2022",69950,"Suarez, Leonardo Gabriel","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de M&eacute;xico.","3 - 3","0 - 2","2022-09-14T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",12,"Goals",1175,1197,18,1182,"https://golstatsbets.blob.core.windows.net/video-player/69950_1.mp4"],[139227464,"Liga MX","Apertura 2022",70018,"Suarez, Leonardo Gabriel","Quintero Huitron, Daniel","Estadio TSM Corona, Torre&oacute;n.","3 - 1","1 - 0","2022-09-06T05:00:00.000Z","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png",12,"Goals",7011,7034,116,7022,"https://golstatsbets.blob.core.windows.net/video-player/70018_1.mp4"],[138830649,"Liga MX","Apertura 2022",70005,"Suarez, Leonardo Gabriel","Guerrero Ramirez, Fernando","Estadio TSM Corona, Torre&oacute;n.","4 - 1","1 - 0","2022-08-28T05:00:00.000Z","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png","CA San Luis","https://az755631.vo.msecnd.net/teams-80/13.png",12,"Goals",4297,4380,71,4304,"https://golstatsbets.blob.core.windows.net/video-player/70005_1.mp4"]]},aO=new Map([[1,45],[2,90],[3,105],[4,120]]),nO=[{id:12,name:"Gol"},{id:55,name:"Gol"},{id:39,name:"Atajada"},{id:10,name:"Asistencia"},{id:702,name:"1vs1 exitoso ofensivo"},{id:607,name:"Oportunidad de gol"}].reduce((s,e)=>(s.set(e.id,e.name),s),new Map);let Pa=null,xi=null,vi="";const Vt=T3(),iO={components:{GSCSeasonSelect:EI,GSCTournamentSelect:eI,GSCGames:Pv,GSCSlider:ra,GSCGridTeamsMatches:vy,GSCPlayersLanding:Sy,GSCTops:DA,GSCTableCalendar:ZC,DiscoverVideos:k3,CarouselFullScreen:xL,Stories:tO},setup(){const s=n.ref("landingref"),{elementSize:e}=sy(s);return{landingref:s,elementSize:e}},props:{currentSeasonId:{type:Number,default:0},isFemale:{type:Boolean,default:!1},showStories:{type:Boolean,default:!0},season:{type:Number,default:1772},isplayer:{type:Boolean,default:!1},user:{type:Object,default:()=>{}},privileges:{type:Object,default:()=>{}},team:{type:Number,default:0},player:{type:Number,default:0},gamesPerMatchDay:{type:Number,default:0,validator(s){return!Number.isNaN(s)&&s>=0}},token:{type:String,default:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MCwibmFtZSI6IlVzdWFyaW8gRnJlZSIsInVzZXJuYW1lIjoiZnJlZUBnb2xzdGF0cy5jb20iLCJlbWFpbCI6ImZyZWVAZ29sc3RhdHMuY29tIiwiaWF0IjoxNjA2NzU4Nzk1LCJleHAiOjE2MzgyOTQ3OTV9.kPNmP7yDtk38cAXrUyc7OHRh6J25VFqy-XUNzbK-4YE"},tournamentsApiUrl:{type:String,default:""},defaultMediaPlayerSeason:{type:Number,default:0},checkLiveGamesIntervalMinutes:{type:Number,default:2}},data(){return{isPreviousDataLoaded:!1,imagesUrl:eu(),roundAbbreviationByGameId:new Map,isCarouselFullScreenVisible:!1,isPlaySeeker:!1,keyupdate:0,carouselPlayerQueue:[],gameEventsUrl:"https://al2nv2dmkc.execute-api.us-west-2.amazonaws.com/prod/mxm/",defaultGameId:0,lastSeasonsIds:[],arrayGamesAdd:[],gamesPages:new Map,show_stories:!0,selectedRoundKeyIndex:0,currentStoriesLastIndex:0,selectedRoundKeyIndexVideo:0,selectedRound:"0",selectedRoundVideos:"0",isLeagueSelected:!0,fullTournamentScheduleFull:[],fullTournamentScheduleFullGoals:[],defaultMatchDayKey:null,isCupTournament:!1,retries:3,userTeamGames:[],userTeamGamesForVideos:[],isCupLegacyTournament:!1,tournamentScheduleKeys:[],tournamentScheduleKeysByKey:new Map,tournamentScheduleKeysGoals:[],currentTournamentGames:null,currentTournamentTeams:null,gamesUrl:"https://qyyibs1w0d.execute-api.us-west-2.amazonaws.com/prod/calendar/gamesBySeason/",gamesUrl2:"https://qyyibs1w0d.execute-api.us-west-2.amazonaws.com/prod/calendar/gamesBySeason?",seasonSelected:{},seasonSelectedDropDowns:{},seasonsSelected:[],gamesAllStories:[],fullTournamentSchedule:{},tournamentSelected:{id:0},tournamentType:0,tournamentSelectedDropDowns:{seasons:[]},playersLength:0,playersLengthRival:0,nextRivalId:0,updateTableCalendar:0,loadDiscover:!1,hasNextRival:!1,resumeType:1,goalsType:2,is_public:!1,seasonsGamesMap:new Map,gamesOfTheDayPreMatchIds:new Set,seasonsForLiveGames:[],allLiveGames:[],storiesItems:[],currentStories:[],currentStoryIndex:null,isStoriesVisible:!1,seasonPlayersMap:new Map,currentTournaments:[]}},computed:{teamSelected(){return this.user.is_generic||this.tournamentSelected.id!==this.user.tournament?0:this.user.team},teamRival(){return Object.keys(this.fullTournamentSchedule).length>0?this.user.team==this.fullTournamentSchedule.data.prematch.home_team?this.fullTournamentSchedule.data.prematch.visiting_team:this.fullTournamentSchedule.data.prematch.home_team:0},isGenericLike(){return this.user.is_generic||this.tournamentSelected.id!==this.user.tournament},isPlaySeekerAvailable(){return[34230,34178,34201].includes(this.user.id)},games(){if(!this.isGenericLike&&!this.isLeagueSelected)return this.fullTournamentSchedule;{const s=this.gamesPages.get(this.selectedRound);return s&&s[0]?s[0].sort((e,t)=>{let a=e.dateTimeMillis,i=t.dateTimeMillis;return e.is_live&&(a-=1e9),t.is_live&&(i-=1e9),a-i}):[]}},latestRound(){return this.userTeamGames&&this.userTeamGames.length&&this.fullTournamentScheduleFullGoals&&this.fullTournamentScheduleFullGoals.length?this.getUserTeamClosestRound(this.fullTournamentScheduleFullGoals):this.getNormalClosestRound(this.fullTournamentScheduleFullGoals)},closestRound(){return this.userTeamGames&&this.userTeamGames.length?this.getUserTeamClosestRound(this.fullTournamentScheduleFull):this.getNormalClosestRound(this.fullTournamentScheduleFull)},closestRoundVideos(){return this.userTeamGames&&this.userTeamGames.length?this.getUserTeamClosestRound(this.fullTournamentScheduleFullGoals,!0):this.getNormalClosestRound(this.fullTournamentScheduleFullGoals,!0)},containerGridCalendarTable(){return this.elementSize.width<=1e3?"container-grid-calendar-table-mobile":"container-grid-calendar-table"},containerbackground(){return this.elementSize.width<=680?"container-background-movil":"container-background"},containerdata(){return this.elementSize.width<=680?"container-data-movil":"container-data"}},watch:{games:{immediate:!0,deep:!0,async handler(s){if(s&&s.length>0){if(!this.seasonsSelected.length)return;for(let t=0;t<s.length;t++){const a=this.gamesAllStories.findIndex(i=>i.game_id===s[t].game_id);a!==-1&&(this.gamesAllStories[a].is_live=s[t].is_live,this.gamesAllStories[a].game_status=s[t].game_status)}const e=s.filter(t=>t.is_live);for(let t=0;t<e.length;t++){const a=this.gamesAllStories.findIndex(i=>i.game_id===e[t].game_id);if(a!==-1)this.gamesAllStories[a].score=e[t].score;else{this.gamesAllStories.push(e[t]),this.gamesAllStories=this.ordenarYFiltrarPartidos(this.gamesAllStories);let i=[];for(let o=0;o<this.gamesAllStories.length;o++)this.arrayGamesAdd.findIndex(r=>r.game_id===this.gamesAllStories[o].game_id)===-1?i.push({game_id:this.gamesAllStories[o].game_id,last_index:0,status:1}):i.push({game_id:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(r=>r.game_id===this.gamesAllStories[o].game_id)].game_id,last_index:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(r=>r.game_id===this.gamesAllStories[o].game_id)].last_index,status:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(r=>r.game_id===this.gamesAllStories[o].game_id)].status});this.arrayGamesAdd=i,await Ae.post(vi,{stories:this.arrayGamesAdd},{headers:{Authorization:`${this.token}`,"Content-Type":"application/json"}});for(let o=0;o<this.arrayGamesAdd.length;o++)this.gamesAllStories.findIndex(r=>r.game_id===this.arrayGamesAdd[o].game_id)!==-1&&(this.gamesAllStories[this.gamesAllStories.findIndex(r=>r.game_id===this.arrayGamesAdd[o].game_id)].index=this.arrayGamesAdd[o].last_index,this.gamesAllStories[this.gamesAllStories.findIndex(r=>r.game_id===this.arrayGamesAdd[o].game_id)].status_storie=this.arrayGamesAdd[o].status)}}}}},"allLiveGames.length":{handler(s){s.length===0&&this.resetGamesLiveInterval()}},privileges:{immediate:!0,deep:!0,async handler(s){this.is_public=s!==null}},team:{immediate:!0,deep:!0,async handler(s){s&&this.seasonsSelected.length&&setTimeout(()=>{this.fetchGames(s,this.seasonsSelected)},1e3)}},closestRound(s){this.selectedRoundKeyIndex=this.tournamentScheduleKeys.findIndex(e=>e===s),this.selectedRound=s},latestRound(s){this.selectedRoundKeyIndexVideo=this.tournamentScheduleKeysGoals.findIndex(e=>e===s),this.selectedRoundVideos=s},isCarouselFullScreenVisible:{handler(s){document.getElementsByTagName("html")[0].style.overflow=s?"hidden":"auto"},immediate:!0}},methods:{getOnlyGamesWithGoals(s){return Object.entries(s).reduce((e,[t,a])=>{const i=a.reduce((o,r)=>{const l=r.games.filter(d=>(d.is_live||d.game_status!==4)&&d.score[0]+d.score[1]>0);return l.length&&o.push({...r,games:l}),o},[]);return i.length&&(e[t]=i),e},{})},async onClickPlaySeeker(){try{const e=await(await fetch("https://rhev2kbe0a.execute-api.us-east-2.amazonaws.com/qa/demo/playseeker")).json();this.formatPlaySeekerPlays(e.data||sO)}catch(s){console.error(s)}},formatPlaySeekerPlays(s){let e=[];s&&s.playlist&&s.playlist.length&&(e=s.playlist.reduce((a,i,o)=>{const l={...Object.entries(Vt).reduce((f,[g,m])=>(f[g]=i[m],f),{}),isPlaySeeker:!0,startSeconds:i[Vt.startTime],endSeconds:i[Vt.endTime],totalSeconds:Math.floor(i[Vt.endTime]-i[Vt.startTime]),payloadData:{play_id:i[Vt.playId],total_plays:s.total_plays,play_number:o+1,group_playlist_id:s.group_playlist_id,playlist_id:s.playlist_id,group_id:s.group_id,moment_of_play:i[Vt.momentOfPlay],play_type:i[Vt.categoryId],viewer_second_start:Math.floor(i[Vt.startTime]),intended_second_start:Math.floor(i[Vt.startTime]),intended_second_end:Math.floor(i[Vt.endTime]),latitude_of_user:null,longitude_of_user:null}},[d,c]=l.playerName.split(","),h=d.split(" ");let u="";for(const f of h)if(u+=` ${f}`,f.length>3)break;if(l.playerShortName=c&&d?`${c.trim().charAt(0)}.${u}`:"",!l.mainCategoryName){const[f,g]=l.finalScore.split(" - ");l.arrayScore=[Number(f),Number(g)]}return l.categoryName=nO.get(l.categoryId),a.push(l),a},[]));let t=[];t=e,this.carouselPlayerQueue=t,this.isPlaySeeker=!0,this.isCarouselFullScreenVisible=!0},formatUsername(s){const e=s.split(",");let t="",a="";return e[1]?(a=e[1].trim().split(" "),a[0]?t=a[0]:t=e[1]):e[0]&&(a=e[0].trim().split(" "),a[0]?t=a[0]:t=e[0]),t.trim()},async fetchGameEvents(s){try{return(await Ae.get(`${this.gameEventsUrl}${s}`,{headers:{Authorization:`${this.token}`}})).data}catch(e){throw new Error(e)}},async fetchLiveGames(){try{if(this.seasonsForLiveGames.length===0)return[];const s=this.seasonsForLiveGames.reduce((a,i)=>`${a}seasons=${i}&`,""),e=Ae.create({headers:{Authorization:`${this.token}`}}),{data:t}=await e.get(`https://qyyibs1w0d.execute-api.us-west-2.amazonaws.com/prod/calendar/gamesBySeason/lives?${s}`);return t}catch(s){throw new Error(s)}},async onClickOpenCarouselVideos(s){try{this.isPlaySeeker=!1;const t=(await this.fetchGameEvents(s)).plays;this.carouselPlayerQueue=t.filter(a=>a.event_type_id===1&&a.video_link!=="-"),this.isCarouselFullScreenVisible=!0}catch(e){throw new Error(e)}},onChangeMatchDayGames(s){this.selectedRound!==s.key&&(this.selectedRound=s.key)},onClickStory({item:s,index:e}){this.openStory(e),this.onClickStories(s)},onClickLive(){const s=this.allLiveGames[0];if(s){const e=this.seasonsGamesMap.get(s.game_id);e&&(this.selectedRound=e.roundAbbreviationV2)}},onClickCloseCarousel(){this.carouselPlayerQueue=[],this.isPlaySeeker=!1,this.isCarouselFullScreenVisible=!1},onChangeIsLeagueSelected(s){console.log("holala isLeagueSelected",s),this.isLeagueSelected=s},onAction(s){this.$emit("action",s)},onOpenMedia(s){s.type===1&&s.gameIds&&s.gameIds.length>0?this.onClickOpenCarouselVideos(s.gameIds[0]):this.$emit("openmedia",s)},onOpenProfile(s){this.$emit("onOpenProfile",s)},onClickMatch(s){this.$emit("openGame",s)},onClickCalendar(){const s={type:this.isGenericLike||this.isLeagueSelected?0:1,team:this.team,season:this.seasonSelected.id};this.$emit("onClickMyCalendar",s)},moreTops(){const s={team:this.team,season:this.seasonSelected.id};this.$emit("openTops",s)},clickProfileBtn(s){this.$emit("openProfile",s)},viewAllRival(){const s={team:Object.keys(this.fullTournamentSchedule).length>0?this.user.team==this.fullTournamentSchedule.data.prematch.home_team?this.fullTournamentSchedule.data.prematch.visiting_team:this.fullTournamentSchedule.data.prematch.home_team:0,season:this.seasonSelected.id};this.$emit("openAllPlayers",s)},viewAll(){const s={team:this.team,season:this.seasonSelected.id};this.$emit("openAllPlayers",s)},getTotalPlayers(s){this.playersLength=s},getTotalPlayersRival(s){this.playersLengthRival=s},clickCard(s){const e={data:s,isPlayer:this.isplayer};this.$emit("clickOnMainCards",e)},async fetchGames(s,e){const t=e.map(i=>`seasons=${i.id}`).join("&"),a=Ae.create({headers:{Authorization:`${this.token}`}});this.fullTournamentSchedule=await a.get(this.gamesUrl+s+"?"+t),this.fullTournamentSchedule.data&&this.fullTournamentSchedule.data.prematch&&(this.fullTournamentSchedule.data.prematch.roundAbbreviationV2=this.roundAbbreviationByGameId.get(this.fullTournamentSchedule.data.prematch.game_id)),this.fullTournamentSchedule.data&&this.fullTournamentSchedule.data.postmatch&&(this.fullTournamentSchedule.data.postmatch.roundAbbreviationV2=this.roundAbbreviationByGameId.get(this.fullTournamentSchedule.data.postmatch.game_id)),this.nextRivalId=Object.keys(this.fullTournamentSchedule).length>0?this.user.team==this.fullTournamentSchedule.data.prematch.home_team?this.fullTournamentSchedule.data.prematch.visiting_team:this.fullTournamentSchedule.data.prematch.home_team:0,this.loadDiscover=!0},generateSeasons(s){const e=[{id:s.id,type:s.type}];return s.related_seasons&&s.related_seasons.length&&e.push(...s.related_seasons.map(t=>({id:t.id,type:t.type}))),e},async onInputTournament(s){this.tournamentSelected=s,this.tournamentType=s.tournament_type,this.tournamentSelected.id&&this.tournamentSelected.id!==s.id&&(this.updateTableCalendar+=1),this.tournamentSelectedDropDowns.id!==s.id&&(this.tournamentSelectedDropDowns=s)},getSeasonDependentPromises({season:s,seasons:e}){const t={headers:{Authorization:`${this.token}`}},a=[Ae.get(`https://ts7thxzaik.execute-api.us-west-2.amazonaws.com/prod/players/seasons/${s.id}`,t)];a.push(this.fetchSeasonsGamesAndTeams(e.map(o=>o.id),3)),a.push(this.fetchStoriesPlays(s));const i=`https://ssh88fgvll.execute-api.us-east-2.amazonaws.com/prod/users/${this.user.id}/seasons/${s.id}/stories`;return i!==vi&&(vi=i,a.push(Ae.get(vi,t))),a},async onInputSeason(s){this.isLeagueSelected=!0;try{if(this.seasonSelected.id!==s.id){this.isPreviousDataLoaded=!1,this.seasonSelected=s,this.seasonsSelected=this.generateSeasons(s);const e=this.getSeasonDependentPromises({season:s,seasons:this.seasonsSelected,retries:3,createdUrl:""}),[t,a,i,o]=await Promise.all(e);this.seasonPlayersMap=new Map,t.data&&t.data.players&&t.data.players.forEach(r=>{this.seasonPlayersMap.set(r.player_id,r)}),o&&o.data?this.arrayGamesAdd=o.data.stories.stories:this.arrayGamesAdd=[],this.resetGamesLiveInterval(),this.seasonSelected=s,this.show_stories=!!s.show_stories,this.seasonsForLiveGames=[s.id,...s.related_seasons.map(r=>r.id)],this.$emit("change-season-id",s.id),this.fillStoriesData(i,a.seasonsAndGames),await this.createFullTournamentScheme({seasons:this.seasonsSelected,seasonsAndGames:a.seasonsAndGames,seasonsAndTeams:a.seasonsAndTeams,applySeasonsValidation:!1}),this.team&&await this.fetchGames(this.team,this.seasonsSelected),this.keyupdate+=1}}catch(e){throw new Error(e)}},ordenarYFiltrarPartidos(s){const e=s.filter(t=>t.game_status===1||t.is_live==1||t.game_status==0);return e.sort((t,a)=>new Date(a.date_time_utc)-new Date(t.date_time_utc)),e.slice(0,18)},async fetchSeasonsGamesAndTeams(s,e,t=""){let a=t;try{const i=Ae.create({headers:{Authorization:`${this.token}`}});a||(a=this.gamesUrl2,s.forEach((l,d)=>{a+=`${d===0?"":"&"}seasons=${l}`}));const{data:{data:o,teams:r}}=await i.get(a);return{seasonsAndGames:o,seasonsAndTeams:r}}catch(i){if(e>0)return this.fetchSeasonsGamesAndTeams(s,e-1,a);throw new Error(i)}},async fetchStoriesPlays(s){try{return await Ae.create({headers:{Authorization:`${this.token}`}}).get("https://cpj4073446.execute-api.us-east-2.amazonaws.com/prod/videos/plays/seasons/"+s.id+"?categories=607&categories=608&categories=12&categories=55&categories=54&categories=35&categories=15&categories=53&type=1")}catch(e){throw new Error(e)}},fillStoriesData(s,e){let t=s.data?s.data.plays:[];this.gamesAllStories=[];for(let i=0;i<e.length;i++)this.gamesAllStories=this.gamesAllStories.concat(e[i].games);this.gamesAllStories=this.ordenarYFiltrarPartidos(this.gamesAllStories);let a=[];for(let i=0;i<this.gamesAllStories.length;i++)this.arrayGamesAdd.findIndex(o=>o.game_id===this.gamesAllStories[i].game_id)===-1?a.push({game_id:this.gamesAllStories[i].game_id,last_index:0,status:1}):a.push({game_id:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(o=>o.game_id===this.gamesAllStories[i].game_id)].game_id,last_index:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(o=>o.game_id===this.gamesAllStories[i].game_id)].last_index,status:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(o=>o.game_id===this.gamesAllStories[i].game_id)].status});this.arrayGamesAdd=a;for(let i=0;i<this.arrayGamesAdd.length;i++)this.gamesAllStories.findIndex(o=>o.game_id===this.arrayGamesAdd[i].game_id)!==-1&&(this.gamesAllStories[this.gamesAllStories.findIndex(o=>o.game_id===this.arrayGamesAdd[i].game_id)].index=this.arrayGamesAdd[i].last_index,this.gamesAllStories[this.gamesAllStories.findIndex(o=>o.game_id===this.arrayGamesAdd[i].game_id)].status_storie=this.arrayGamesAdd[i].status);this.storiesItems=this.getStoriesStructureVideos(t),setTimeout(()=>{this.sendStoriesData()},1e3)},sendStoriesData(){Ae.post(`https://ssh88fgvll.execute-api.us-east-2.amazonaws.com/prod/users/${this.user.id}/seasons/${this.seasonsSelected[0].id}/stories`,{stories:this.arrayGamesAdd},{headers:{Authorization:`${this.token}`,"Content-Type":"application/json"}})},getTimeSeconds(s){const[e,t]=s.split(":"),[a,i]=t.split(".");return parseInt(e)*60+parseInt(a)+parseInt(i)/1e3},getPlayTime(s,e){let t="",a=0;switch(s[7]){case 1:t=s[11];break;case 2:t=s[13],a=45;break;case 3:t=s[15],a=90;break;case 4:t=s[17],a=105;break;case 5:t=s[19],a=120;break}return(!t||t==="0")&&(t="00:00"),this.getTimeToSeconds(t)+(this.getTimeToSeconds(s[e])-a*60)},abrirNuevaVentana(){window.open("https://goltipster.com/view-all#golTipster","_blank")},getTimeToSeconds(s){const t=s.indexOf(".")>-1?s.substring(0,s.indexOf(".")):s,[a,i,o]=t.split(":").reverse();return(o?Number(o)*60*60:0)+Number(i)*60+Number(a)},getStoriesStructureVideos(s){let e=[];for(let t=0;t<this.gamesAllStories.length;t++){let a=s.filter(r=>r[3]===this.gamesAllStories[t].game_id).map(r=>({playId:r[29],gameId:r[3],player:this.seasonPlayersMap.get(r[1]),categoryId:r[0],date:new Date(r[4]+"T"+r[5]),url:r[35]==2?"https://daijvvc13prpy.cloudfront.net/golstats-videos/"+this.gamesAllStories[t].game_id+"_1/"+this.gamesAllStories[t].game_id+"_1.m3u8":"https://golstatsbets.blob.core.windows.net/video-player/"+this.gamesAllStories[t].game_id+"_1.mp4",type:"video",thumbnail:{logoHomeTeam:"https://az755631.vo.msecnd.net/teams-80/"+this.gamesAllStories[t].home_team+".png",logoAwayTeam:"https://az755631.vo.msecnd.net/teams-80/"+this.gamesAllStories[t].visiting_team+".png"},header:{label:this.gamesAllStories[t].home_team_acronym+" "+this.gamesAllStories[t].score[0]+":"+this.gamesAllStories[t].score[1]+" "+this.gamesAllStories[t].visiting_team_acronym+" "+this.gamesAllStories[t].matchday_name.replace("Matchday","JOR").replace("de Final","").replace("Playoffs 1","CFI").replace("Playoffs 2","CFV").replace("Playoffs 3","SFI").replace("Playoffs 4","SFV").replace("Playoffs 5","FI").replace("Playoffs 6","FV")},startTime:this.getPlayTime(r,9),endTime:this.getPlayTime(r,10),duration:Math.floor(this.getTimeSeconds(r[10])-this.getTimeSeconds(r[9]))}));const i={},o=a.filter(r=>i[r.playId]?!1:(i[r.playId]=!0,!0));e.push({game_id:this.gamesAllStories[t].game_id,stories:o})}return e},areSeasonsDifferent(s){for(const e of s)if(!this.lastSeasonsIds.includes(e.season_id))return!0;return!1},async createFullTournamentScheme({seasons:s,seasonsAndGames:e,seasonsAndTeams:t,applySeasonsValidation:a}){try{this.seasonsGamesMap=new Map,this.userTeamGames=[],this.userTeamGamesForVideos=[],this.gamesOfTheDayPreMatchIds.clear();let i=0;if(a&&this.areSeasonsDifferent(e))return;e.forEach(l=>{const d=s.find(c=>c.id===l.season_id);d&&(l.type=d.type,l.games.forEach(c=>{c.season_id=l.season_id}),d.type===0&&(i=l.season_id))});const o={seasonsGames:e},r=t.find(l=>l.season_id===i);if(r){const l=r.teams,d=[...o.seasonsGames],c=o&&o.seasonsGames?o.seasonsGames.map(u=>{const f=u.games.reduce((g,m)=>{const p={...m},y=new Date,[b,S,w]=p.date.split("-"),[x,E,v]=p.schedule.split(":"),T=new Date(Number(b),Number(S)-1,Number(w),Number(x),Number(E),Number(v));return p.dateTimeMillis=T.valueOf(),p.home_team=l.find(R=>R.team_id===m.home_team),p.visiting_team=l.find(R=>R.team_id===m.visiting_team),p.game_status===4&&y.getFullYear()===T.getFullYear()&&y.getMonth()===T.getMonth()&&y.getDate()===T.getDate()&&this.gamesOfTheDayPreMatchIds.add(p.game_id),this.seasonsGamesMap.set(p.game_id,p),g[m.matchday_abbreviation]?g[m.matchday_abbreviation][m.game_status===3?"canceled":m.date]?g[m.matchday_abbreviation][m.game_status===3?"canceled":m.date].push(p):g[m.matchday_abbreviation][m.game_status===3?"canceled":m.date]=[p]:g[m.matchday_abbreviation]={[m.game_status===3?"canceled":m.date]:[p]},this.gsData&&this.gsData.teamId&&p.game_status===4&&(p.home_team.team_id===this.gsData.teamId||p.visiting_team.team_id===this.gsData.teamId)&&(this.userTeamGames.push(p),p.score&&p.score[0]+p.score[1]>0&&this.userTeamGamesForVideos.push(p)),g},{});this.userTeamGames.sort((g,m)=>g.dateTimeMillis-m.dateTimeMillis);for(let[g,m]of Object.entries(f))f[g]=Object.entries(m).map(([p,y])=>({date:p,games:y.sort((b,S)=>b.dateTimeMillis-S.dateTimeMillis)})),f[g].sort((p,y)=>p.date<y.date?-1:p.date>y.date?1:0);return{type:u.type,weight:u.type===0?0:u.type===2?1:2,schedule:f}}):[],h=o&&o.seasonsGames?d.map(u=>{const f=u.games.reduce((g,m)=>{const p={...m};return p.dateTimeMillis=new Date(p.date_time_utc).valueOf(),p.home_team=l.find(y=>y.team_id===m.home_team),p.visiting_team=l.find(y=>y.team_id===m.visiting_team),g[m.matchday_abbreviation]?g[m.matchday_abbreviation][m.game_status===3?"canceled":m.date]?(p.game_status!=4||p.is_live==1)&&(p.score[0]!=0||p.score[1]!=0)&&g[m.matchday_abbreviation][m.game_status===3?"canceled":m.date].push(p):(p.game_status!=4||p.is_live==1)&&(p.score[0]!=0||p.score[1]!=0)&&(g[m.matchday_abbreviation][m.game_status===3?"canceled":m.date]=[p]):(p.game_status!=4||p.is_live==1)&&(p.score[0]!=0||p.score[1]!=0)&&(g[m.matchday_abbreviation]={[m.game_status===3?"canceled":m.date]:[p]}),g},{});this.userTeamGames.sort((g,m)=>g.dateTimeMillis-m.dateTimeMillis);for(let[g,m]of Object.entries(f))f[g]=Object.entries(m).map(([p,y])=>({date:p,games:y.sort((b,S)=>b.dateTimeMillis-S.dateTimeMillis)})),f[g].sort((p,y)=>p.date<y.date?-1:p.date>y.date?1:0);return{type:u.type,weight:u.type===0?0:u.type===2?1:2,schedule:f}}):[];c.sort((u,f)=>u.weight-f.weight),this.fullTournamentScheduleFull=c.reduce((u,f)=>{for(const[g,m]of Object.entries(f.schedule))if(f.type===0)if([1,2].includes(this.tournamentType)){const p=qu.get(this.tournamentType);if(p){const y=p.get(g);y&&(u[y.matchDayAbbreviation]=m)}}else if(this.isCup){const p=g.replace("M",""),y=`Jornada ${p}`;this.isCupLegacy?u[Ku[p]||y]=m:u[Wu[g]||y]=m}else u[Number(g.replace("M","")).toString()]=m;else f.type===2?["PI1","PI2"].includes(g)?u[g]=m:u[`R${Number(g.replace("PO",""))}`]=m:f.type===1&&(u[Hu[g]]=m);return u},{}),this.fullTournamentScheduleFullGoals=h.reduce((u,f)=>{for(const[g,m]of Object.entries(f.schedule))if(f.type===0)if([1,2].includes(this.tournamentType)){const p=qu.get(this.tournamentType);if(p){const y=p.get(g);y&&(u[y.matchDayAbbreviation]=m)}}else if(this.isCup){const p=g.replace("M",""),y=`Jornada ${p}`;this.isCupLegacy?u[Ku[p]||y]=m:u[Wu[g]||y]=[]}else u[Number(g.replace("M","")).toString()]=m;else f.type===2?["PI1","PI2"].includes(g)?u[g]=m:u[`R${Number(g.replace("PO",""))}`]=m:f.type===1&&(u[Hu[g]]=m);return u},{}),this.roundAbbreviationByGameId=new Map,this.tournamentScheduleKeysByKey.clear(),this.tournamentScheduleKeys=Array.from(Object.entries(this.fullTournamentScheduleFull).reduce((u,[f,g],m)=>{const p=Number(f);let y="";Number.isNaN(p)?y=f:y=p<10?`0${p}`:f;let b=!1,S=null;const w={key:f,value:p,valueText:y,avaible:b,matchDayId:S,index:m,liveGamesIds:new Set};this.tournamentScheduleKeysByKey.set(f,w);const x=g.reduce((v,T)=>(!S&&T&&T.games&&T.games.length&&(w.matchDayId=T.games[0].matchday_id),T.games.forEach(R=>{this.roundAbbreviationByGameId.set(R.game_id,f),R.roundAbbreviation=Number.isNaN(p)?p:`J ${p}`,R.roundAbbreviationV2=f,R.scheduleKey=w}),v=v.concat(T.games),v),[]);for(const v of x)(v.game_status!==4||v.is_live)&&(v.score[0]!==0||v.score[1]!==0)&&(w.avaible=!0);u.set(f,w);const E=this.getPages(x);return this.gamesPages.set(f,E),u},new Map).values()),this.tournamentScheduleKeysGoals=Array.from(Object.entries(this.fullTournamentScheduleFullGoals).reduce((u,[f,g])=>{const m=Number(f);let p="";Number.isNaN(m)?p=f:p=m<10?`0${m}`:f;let y=!1;const b=g.reduce((S,w)=>(w.games.forEach(x=>{x.roundAbbreviation=Number.isNaN(m)?m:`J ${m}`}),S=S.concat(w.games),S),[]);for(let S=0;S<b.length;S++)(b[S].game_status!=4||b[S].is_live&&(b[S].score[0]!=0||b[S].score[1]!=0))&&(y=!0);return u.set(f,{key:f,value:m,valueText:p,avaible:y}),u},new Map).values())}setTimeout(()=>{this.isPreviousDataLoaded=!0,this.checkLiveGames(),this.gamesOfTheDayPreMatchIds.size&&this.createGameOfTheDayTimeouts()},500)}catch(i){throw new Error(i)}finally{this.loadingFlag=!1}},createGameOfTheDayTimeouts(){this.gamesOfTheDayPreMatchIds.size&&this.gamesOfTheDayPreMatchIds.forEach(s=>{const e=this.seasonsGamesMap.get(s);if(e){const t=new Date().valueOf();if(60*1e3*30+e.dateTimeMillis-t>0){const i=e.dateTimeMillis-t-3e5;setTimeout(()=>{this.createCheckLiveGamesInterval()},i>0?i:0)}}})},resetCheckGamesLiveInterval(){clearInterval(xi),xi=null},createCheckLiveGamesInterval(){this.resetCheckGamesLiveInterval(),xi||(xi=setInterval(()=>{this.checkLiveGames()},this.checkLiveGamesIntervalMinutes*60*1e3))},async checkLiveGames(){try{const s=await this.fetchLiveGames(),e=new Set;if(this.allLiveGames=s.data.reduce((t,a)=>(a.games.forEach(i=>{e.add(i.game_id),t.push(i)}),t),[]),this.allLiveGames.length){Pa||await this.fillGameEvents();const t=[];this.gamesOfTheDayPreMatchIds.forEach(a=>{const i=this.seasonsGamesMap.get(a);i&&new Date().valueOf()>i.dateTimeMillis&&t.push(a)}),t.length&&t.every(i=>this.seasonsGamesMap.get(i).isLiveTracked)&&this.resetCheckGamesLiveInterval()}}catch(s){throw new Error(s)}},createGamesEventsInterval(){this.resetGamesLiveInterval(),Pa=setInterval(()=>{this.fillGameEvents()},6e4)},resetGamesLiveInterval(){clearInterval(Pa),Pa=null},removeGameIfFinished(s,e,t=!1){for(const a of e)if(a.category_id===0&&a.game_status_id===13)if(t)this.fetchGames(this.team,this.seasonsSelected);else{const i=this.seasonsGamesMap.get(a.game_id);this.allLiveGames=this.allLiveGames.filter(o=>o.game_id!==s.game_id),i.is_live=0,i.game_status=0,i.scheduleKey&&i.scheduleKey.liveGamesIds.delete(s.game_id)}},async fillGameEvents(){try{const s=[];let e=null;for(const a of this.allLiveGames){a.isLiveTracked=!0,this.gamesOfTheDayPreMatchIds.size&&this.gamesOfTheDayPreMatchIds.delete(a.game_id);const i=this.seasonsGamesMap.get(a.game_id);i&&(i.is_live=1,i.game_status=4,i.scheduleKey&&i.scheduleKey.liveGamesIds.add(a.game_id)),e=this.fullTournamentSchedule&&this.fullTournamentSchedule.data&&this.fullTournamentSchedule.data.prematch?this.fullTournamentSchedule.data.prematch:null,e&&e.game_id===a.game_id&&(e.is_live=1,e.game_status=4),s.push(this.fetchGameEvents(a.game_id))}const t=await Promise.all(s);for(const a of t){const i=this.seasonsGamesMap.get(a.game_id);if(i){const o=aO.get(a.recent_lapse);i.currentTimeLive=o&&o<a.minute?`${o}' + ${a.minute-o}'`:`${a.minute}'`;const r=[Number(a.score[i.home_team.team_id.toString()])+Number(a.score[`own_${i.visiting_team.team_id.toString()}`]),Number(a.score[i.visiting_team.team_id.toString()])+Number(a.score[`own_${i.home_team.team_id.toString()}`])],l=r[0],d=r[1];i.score=[Number.isNaN(l)?0:l,Number.isNaN(d)?0:d],this.removeGameIfFinished(i,a.plays),e&&e.game_id===i.game_id&&(e.currentTimeLive=i.currentTimeLive,e.score=i.score,this.removeGameIfFinished(e,a.plays,!0))}}Pa||this.createGamesEventsInterval()}catch(s){throw new Error(s)}},getPages(s){const e=[];if(this.gamesPerMatchDay>0){let t=[];s.forEach((a,i)=>{t.push(a),(i+1)%this.gamesPerMatchDay===0&&(e.push([...t]),t=[])}),t.length&&e.push([...t])}else e.push(s);return e},getNormalClosestRound(s,e=!1){const t=new Date().valueOf(),a=e?this.getOnlyGamesWithGoals(s):s,i=Object.entries(Object.entries(a).reduce((r,[l,d])=>(r[l]=null,d.forEach(c=>{c.games.forEach(h=>{if([1,0].includes(h.game_status)||h.is_live){const u=t-h.dateTimeMillis;(r[l]===null||u<r[l])&&(r[l]=u)}})}),r),{}));if(!i.length)return"1";const o=i.reduce((r,[l,d])=>{if(d!==null){const c=this.tournamentScheduleKeysByKey.get(l);(r.shortestMillisToNow===null||d<r.shortestMillisToNow&&c.index>=r.scheduleKey.index)&&(r.shortestMillisToNow=d,r.round=l,r.scheduleKey=c)}return r},{round:"",shortestMillisToNow:null,scheduleKey:null});return o.shortestMillisToNow!==null?o.round:i[i.length-1][0]},getUserTeamClosestRound(s,e=!1){let t=1;const a=e?this.userTeamGamesForVideos:this.userTeamGames;if(a.length){const i=a[0];for(const[o,r]of Object.entries(s))for(const l of r)if(l.games.find(c=>c.game_id===i.game_id))return o}return t},async changeIndexStory(s){if(this.arrayGamesAdd.length>0){let e=-1,t=-1,a=-1;this.arrayGamesAdd.findIndex(i=>i.game_id===this.currentStories[0].gameId)!=-1&&(e=this.arrayGamesAdd.findIndex(i=>i.game_id===this.currentStories[0].gameId)),this.gamesAllStories.findIndex(i=>i.game_id===this.currentStories[0].gameId)!=-1&&(t=this.gamesAllStories.findIndex(i=>i.game_id===this.currentStories[0].gameId)),this.storiesItems.findIndex(i=>i.game_id===this.currentStories[0].gameId)!=-1&&(a=this.storiesItems.findIndex(i=>i.game_id===this.currentStories[0].gameId)),e!=-1&&(this.gamesAllStories[t].is_live===1?this.storiesItems[a].stories.length-1==s&&this.storiesItems[a].stories.length>1?this.arrayGamesAdd[e].last_index=s-1:this.arrayGamesAdd[e].last_index=s:this.arrayGamesAdd[e].last_index=s),a!=-1&&this.arrayGamesAdd[e].status>0&&(this.arrayGamesAdd[e].status=s>=this.storiesItems[a].stories.length-1?0:1)}else{this.arrayGamesAdd=[];for(let e=0;e<this.storiesItems.length;e++)this.arrayGamesAdd.push({game_id:this.storiesItems[e].game_id,last_index:this.currentStories[0].gameId==this.storiesItems[e].game_id?s:0,status:this.currentStories[0].gameId==this.storiesItems[e].game_id&&s>=this.storiesItems[e].stories.length-1?0:1})}await Ae.post(`https://ssh88fgvll.execute-api.us-east-2.amazonaws.com/prod/users/${this.user.id}/seasons/${this.seasonsSelected[0].id}/stories`,{stories:this.arrayGamesAdd},{headers:{Authorization:`${this.token}`,"Content-Type":"application/json"}});for(let e=0;e<this.arrayGamesAdd.length;e++)this.gamesAllStories.findIndex(t=>t.game_id===this.arrayGamesAdd[e].game_id)!=-1&&(this.gamesAllStories[this.gamesAllStories.findIndex(t=>t.game_id===this.arrayGamesAdd[e].game_id)].index=this.arrayGamesAdd[e].last_index,this.gamesAllStories[this.gamesAllStories.findIndex(t=>t.game_id===this.arrayGamesAdd[e].game_id)].status_storie=this.arrayGamesAdd[e].status)},async getLiveGamePlays(s){var a=(await Ae.create({headers:{Authorization:`${this.token}`}}).get("https://cpj4073446.execute-api.us-east-2.amazonaws.com/prod/live/videos/plays/seasons/"+this.gamesAllStories[s].season_id+"/games/"+this.gamesAllStories[s].game_id)).data.plays.filter(l=>l[0]===607||l[0]===608||l[0]===12||l[0]===55||l[0]===54||l[0]===35||l[0]===15||l[0]===53);let i=a.map(l=>({playId:l[29],gameId:l[3],player:this.seasonPlayersMap.get(l[1]),categoryId:l[0],date:new Date(l[4]+"T"+l[5]),url:"https://falconvideolive.blob.core.windows.net/video-hls-live/"+this.gamesAllStories[s].game_id+"/"+this.gamesAllStories[s].game_id+".m3u8",type:"video",thumbnail:{logoHomeTeam:"https://az755631.vo.msecnd.net/teams-80/"+this.gamesAllStories[s].home_team+".png",logoAwayTeam:"https://az755631.vo.msecnd.net/teams-80/"+this.gamesAllStories[s].visiting_team+".png"},header:{label:this.gamesAllStories[s].home_team_acronym+" "+this.gamesAllStories[s].score[0]+":"+this.gamesAllStories[s].score[1]+" "+this.gamesAllStories[s].visiting_team_acronym+" "+this.gamesAllStories[s].matchday_name.replace("Matchday","JOR").replace("de Final","").replace("Playoffs 1","CFI").replace("Playoffs 2","CFV").replace("Playoffs 3","SFI").replace("Playoffs 4","SFV").replace("Playoffs 5","FI").replace("Playoffs 6","FV")},startTime:this.getPlayTime(l,9),endTime:this.getPlayTime(l,10),duration:Math.floor(this.getTimeSeconds(l[10])-this.getTimeSeconds(l[9]))}));const o={},r=i.filter(l=>o[l.playId]?!1:(o[l.playId]=!0,!0));this.storiesItems[s]={game_id:this.gamesAllStories[s].game_id,stories:r}},async openStory(s){const e={headers:{Authorization:`${this.token}`}},[t]=await Promise.all([Ae.get(`https://ts7thxzaik.execute-api.us-west-2.amazonaws.com/prod/players/games/${this.gamesAllStories[s].game_id}`,e)]);t.data&&t.data.players.forEach(a=>{this.seasonPlayersMap.set(a.player_id,{dob:a.dob,first_name:a.first_name,jersey:a.jersey,last_name:a.last_name,name:a.name,player_name:a.name,nationality:a.nationality,nationality_id:a.nationality_id,nationality_photo:a.nationality_photo,photo:a.photo,player_id:a.player_id,position_id:a.position_id,short_name:a.short_name,team_id:a.team_id})}),this.gamesAllStories[s].is_live==1||this.gamesAllStories[s].game_status==0?(await this.getLiveGamePlays(s),setTimeout(()=>{this.currentStoryIndex=s,this.currentStories=this.storiesItems[s].stories,this.currentStoriesLastIndex=this.gamesAllStories[s].index},100)):(this.currentStoryIndex=s,this.currentStories=this.storiesItems[s].stories,this.currentStoriesLastIndex=this.gamesAllStories[s].index),setTimeout(()=>{this.isStoriesVisible=!0},150)},onCloseStories(s){this.currentStoriesLastIndex=0,this.isStoriesVisible=!1,this.$emit("event-posthog-stories",{event:"stories_cerrar",properties:{play_id:s?s.playId:null,game_id:s?s.gameId:null,category_id:s?s.categoryId:null,start_time:s?s.startTime:null,end_time:s?parseInt(s.currentTime):null,percentage_viewed:s?parseInt(s.progress):null}})},closeStories(){this.currentStoriesLastIndex=0,this.currentStoryIndex=null,this.currentStories=[]},onSwipeStories({direction:s,currentPlay:e}){s==="right"?(this.$emit("event-posthog-stories",{event:"stories_video_siguiente_partido",properties:{play_id:e?e.playId:null,game_id:e?e.gameId:null,category_id:e?e.categoryId:null,start_time:e?e.startTime:null,end_time:e?parseInt(e.currentTime):null,percentage_viewed:e?parseInt(e.progress):null}}),this.currentStoryIndex>0&&this.openStory(this.currentStoryIndex-1)):(this.$emit("event-posthog-stories",{event:"stories_video_anterior_partido",properties:{play_id:e?e.playId:null,game_id:e?e.gameId:null,category_id:e?e.categoryId:null,start_time:e?e.startTime:null,end_time:e?parseInt(e.currentTime):null,percentage_viewed:e?parseInt(e.progress):null}}),this.currentStoryIndex<this.storiesItems.length-1&&this.openStory(this.currentStoryIndex+1))},onClickNextBackVideo({eventName:s,currentPlay:e}){this.$emit("event-posthog-stories",{event:s,properties:{play_id:e?e.playId:null,game_id:e?e.gameId:null,category_id:e?e.categoryId:null,start_time:e?e.startTime:null,end_time:e?parseInt(e.currentTime):null,percentage_viewed:e?parseInt(e.progress):null}})},onChangeTournaments(s){this.currentTournaments=s},onClickStories(s){this.$emit("event-posthog-stories",{event:"stories_ver_play",properties:{game_id:s.game_id}})},onVideoPlay(s){this.$emit("event-posthog-stories",{event:"stories_play",properties:{play_id:s.playId,game_id:s.gameId,category_id:s.categoryId,start_time:s.startTime,end_time:s.endTime,percentage_viewed:0}})}},async created(){},beforeUnmount(){this.resetGamesLiveInterval()}},hs=s=>(n.pushScopeId("data-v-a6bd2464"),s=s(),n.popScopeId(),s),oO={class:"gsclanding",ref:"landingref"},rO={key:2,class:"play-seeker-image"},lO={class:"play-seeker-image__info"},cO=hs(()=>n.createElementVNode("div",{class:"play-seeker-image__info__ai"},"Inteligencia Artificial",-1)),dO={class:"play-seeker-image__info__legends-and-button"},hO=hs(()=>n.createElementVNode("div",{class:"play-seeker-image__info__legends-and-button__legends"},"LEYENDAS PARA TI",-1)),uO={class:"play-icon"},mO=["src"],fO=hs(()=>n.createElementVNode("div",{class:"text"},"Explora videos",-1)),pO={class:"play-seeker-image__players"},gO=["src"],yO={key:3,class:"container-selectors-mobile"},bO={class:"container-selectors-mobile-tournament"},SO={class:"container-selectors-mobile-season"},_O={key:0,class:"home-item-movil"},wO=hs(()=>n.createElementVNode("div",{class:"home-movil"},"Inicio",-1)),kO={class:"name-user-movil"},EO={key:1,class:"home-item"},TO={key:2,class:"bar-settings"},CO={class:"name-user"},xO={class:"container-selectors"},vO={class:"selector-tournament"},AO={class:"selector-seasons"},LO={key:0,class:"container-games"},IO={key:0,class:"container-games"},RO={key:7,class:"container-players-myteam"},BO=["onClick"],NO={class:"story-result"},DO={key:0,class:"font-bold"},PO={key:1,class:"font-bold"},OO={class:"story-match"},FO={key:2,class:"play-seeker-image"},MO={class:"play-seeker-image__info"},VO=hs(()=>n.createElementVNode("div",{class:"play-seeker-image__info__ai"},"Inteligencia Artificial",-1)),$O={class:"play-seeker-image__info__legends-and-button"},zO=hs(()=>n.createElementVNode("div",{class:"play-seeker-image__info__legends-and-button__legends"},"LEYENDAS PARA TI",-1)),UO={class:"play-icon"},GO=["src"],jO=hs(()=>n.createElementVNode("div",{class:"text"},"Explora videos",-1)),HO={class:"play-seeker-image__players"},WO=["src"],KO={key:3,class:"container-selectors-mobile"},qO={class:"container-selectors-mobile-tournament"},YO={class:"container-selectors-mobile-season"},JO={key:0,class:"home-item-movil"},XO=hs(()=>n.createElementVNode("div",{class:"home-movil"},"Inicio",-1)),ZO={class:"name-user-movil"},QO={key:1,class:"home-item"},e8={key:2,class:"bar-settings"},t8={class:"name-user"},s8={class:"container-selectors"},a8={class:"selector-tournament"},n8={class:"selector-seasons"},i8={key:3,class:"container-games"},o8={key:5,class:"container-players"},r8={key:6,class:"stories-circle-wrapper"},l8=["onClick"],c8={class:"story-result"},d8={key:0,class:"font-bold"},h8={key:1,class:"font-bold"},u8={class:"story-match"};function m8(s,e,t,a,i,o){const r=n.resolveComponent("Stories"),l=n.resolveComponent("CarouselFullScreen"),d=n.resolveComponent("GSCTournamentSelect"),c=n.resolveComponent("GSCSeasonSelect"),h=n.resolveComponent("GSCGridTeamsMatches"),u=n.resolveComponent("GSCTableCalendar"),f=n.resolveComponent("GSCGames");n.resolveComponent("DiscoverVideos");const g=n.resolveComponent("GSCPlayersLanding"),m=n.resolveComponent("GSCTops"),p=n.resolveComponent("GSCSlider");return n.openBlock(),n.createElementBlock("div",oO,[t.isplayer?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[i.isStoriesVisible&&t.showStories?(n.openBlock(),n.createBlock(r,{key:0,stories:i.currentStories,"start-story-index":i.currentStoriesLastIndex,"is-first-game-stories":i.currentStoryIndex===0,"is-last-game-stories":i.currentStoryIndex===i.storiesItems.length-1,onLastStoryIndex:o.changeIndexStory,onClose:o.onCloseStories,onSwipe:o.onSwipeStories,onVideoNextBack:o.onClickNextBackVideo,onVideoPlay:o.onVideoPlay},null,8,["stories","start-story-index","is-first-game-stories","is-last-game-stories","onLastStoryIndex","onClose","onSwipe","onVideoNextBack","onVideoPlay"])):n.createCommentVNode("",!0),i.isCarouselFullScreenVisible?(n.openBlock(),n.createBlock(l,{key:1,"player-queue":i.carouselPlayerQueue,"is-play-seeker":i.isPlaySeeker,"playlist-index":0,onClose:o.onClickCloseCarousel},null,8,["player-queue","is-play-seeker","onClose"])):n.createCommentVNode("",!0),o.isPlaySeekerAvailable?(n.openBlock(),n.createElementBlock("div",rO,[n.createElementVNode("div",lO,[cO,n.createElementVNode("div",dO,[hO,n.createElementVNode("div",{role:"button",class:"play-seeker-image__info__legends-and-button__button",onClick:e[0]||(e[0]=(...y)=>o.onClickPlaySeeker&&o.onClickPlaySeeker(...y))},[n.createElementVNode("div",uO,[n.createElementVNode("img",{src:`${i.imagesUrl}icn-play.svg`,alt:""},null,8,mO)]),fO])])]),n.createElementVNode("div",pO,[n.createElementVNode("img",{src:`${i.imagesUrl}players@2x.png`,alt:""},null,8,gO)])])):n.createCommentVNode("",!0),a.elementSize.width<=680&&a.elementSize.width>0?(n.openBlock(),n.createElementBlock("div",yO,[n.createElementVNode("div",bO,[n.createVNode(d,{"current-season-id":t.currentSeasonId,width:"100%","api-url":t.tournamentsApiUrl,onInput:o.onInputTournament,onChangeTournaments:o.onChangeTournaments},null,8,["current-season-id","api-url","onInput","onChangeTournaments"])]),n.createElementVNode("div",SO,[n.createVNode(c,{"current-season-id":t.currentSeasonId,width:"100%",seasons:i.tournamentSelectedDropDowns.seasons,onInput:o.onInputSeason},null,8,["current-season-id","seasons","onInput"])])])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(o.containerbackground)},[n.createElementVNode("div",{class:n.normalizeClass(o.containerdata)},[a.elementSize.width<=680?(n.openBlock(),n.createElementBlock("div",_O,[wO,n.createElementVNode("div",kO,[t.isFemale?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode("Bienvenida ")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode("Bienvenido ")],64)),i.is_public?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createTextVNode("a GolStats ")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createTextVNode(n.toDisplayString(o.formatUsername(t.user.name)),1)],64))])])):n.createCommentVNode("",!0),a.elementSize.width>680?(n.openBlock(),n.createElementBlock("div",EO,"Inicio")):n.createCommentVNode("",!0),a.elementSize.width>680?(n.openBlock(),n.createElementBlock("div",TO,[n.createElementVNode("div",CO,[t.isFemale?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode("Bienvenida ")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode("Bienvenido ")],64)),i.is_public?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createTextVNode("a GolStats ")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createTextVNode(n.toDisplayString(o.formatUsername(t.user.name)),1)],64))]),n.createElementVNode("div",xO,[n.createElementVNode("div",vO,[n.createVNode(d,{"current-season-id":t.currentSeasonId,"api-url":t.tournamentsApiUrl,onInput:o.onInputTournament,onChangeTournaments:o.onChangeTournaments},null,8,["current-season-id","api-url","onInput","onChangeTournaments"])]),n.createElementVNode("div",AO,[n.createVNode(c,{"current-season-id":t.currentSeasonId,seasons:i.tournamentSelectedDropDowns.seasons,onInput:o.onInputSeason},null,8,["current-season-id","seasons","onInput"])])])])):n.createCommentVNode("",!0),t.user.tournament===i.tournamentSelected.id?(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createElementVNode("div",{class:n.normalizeClass(o.containerGridCalendarTable)},[n.createElementVNode("div",{class:"container-grid",style:n.normalizeStyle([a.elementSize.width<=1e3?"width: 100%; ":"",!(t.isplayer&&!o.isGenericLike)&&o.isGenericLike?"max-height: 380px !important;":"max-height: 480px !important; margin-top: 15px !important;"])},[a.elementSize.width>1e3?(n.openBlock(),n.createBlock(h,{key:0,isPlayer:t.isplayer&&!o.isGenericLike,"player-id":t.user.player,"team-id":t.user.team,"is-female":i.tournamentSelected.is_female==1,"tournament-selected":i.tournamentSelected,"is-public":i.is_public,"season-selected":i.seasonSelected.id,"next-rival-id":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?i.fullTournamentSchedule.data.prematch.visiting_team:i.fullTournamentSchedule.data.prematch.home_team:0,"team-img":"https://az755631.vo.msecnd.net/teams-150/"+t.user.team+".png","player-img":"https://az755631.vo.msecnd.net/players-profile/"+t.user.player+".png","rival-img":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.visiting_team+".png":"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.home_team+".png":"","has-team":!o.isGenericLike,"component-width":a.elementSize.width,onAction:o.clickCard},null,8,["isPlayer","player-id","team-id","is-female","tournament-selected","is-public","season-selected","next-rival-id","team-img","player-img","rival-img","has-team","component-width","onAction"])):(n.openBlock(),n.createBlock(h,{key:1,isPlayer:!1,"player-id":t.user.player,"is-female":i.tournamentSelected.is_female==1,"team-id":t.user.team,"is-player-mobile1":t.isplayer&&!o.isGenericLike,"tournament-selected":i.tournamentSelected,"is-public":i.is_public,"season-selected":i.seasonSelected.id,"next-rival-id":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?i.fullTournamentSchedule.data.prematch.visiting_team:i.fullTournamentSchedule.data.prematch.home_team:0,"team-img":"https://az755631.vo.msecnd.net/teams-150/"+t.user.team+".png","player-img":"https://az755631.vo.msecnd.net/players-profile/"+t.user.player+".png","rival-img":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.visiting_team+".png":"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.home_team+".png":"","has-team":!1,"component-width":a.elementSize.width,onAction:o.clickCard},null,8,["player-id","is-female","team-id","is-player-mobile1","tournament-selected","is-public","season-selected","next-rival-id","team-img","player-img","rival-img","component-width","onAction"]))],4),n.withDirectives(n.createElementVNode("div",{class:"container-calendar-table",style:n.normalizeStyle(a.elementSize.width<1e3?"width: 100%; margin-top: 30px;":"")},[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(u,{season:i.seasonSelected,seasons:i.seasonsSelected,"tournament-type":i.tournamentType,tournament:i.tournamentSelected.id,privileges:t.privileges,"is-public":i.is_public,"is-player":t.isplayer,"is-player-tournament":t.user.tournament===i.tournamentSelected.id,"is-generic":o.isGenericLike,key:i.updateTableCalendar,"team-id":o.teamSelected,componentWidth:a.elementSize&&a.elementSize.width?a.elementSize.width:0,tournaments:i.currentTournaments,onAction:o.onAction,onOnOpenProfile:o.onOpenProfile,onOpenmedia:o.onOpenMedia},null,8,["season","seasons","tournament-type","tournament","privileges","is-public","is-player","is-player-tournament","is-generic","team-id","componentWidth","tournaments","onAction","onOnOpenProfile","onOpenmedia"])):n.createCommentVNode("",!0)],4),[[n.vShow,a.elementSize.width>1e3]])],2),Object.keys(i.tournamentSelected).length>0?(n.openBlock(),n.createElementBlock("div",LO,[n.createVNode(f,{"component-width":a.elementSize.width,isplayer:t.isplayer,"is-full":o.isGenericLike,data:o.games,"tournament-schedule-keys":i.tournamentScheduleKeys,"default-match-day-key":i.selectedRound,user:t.user,"current-tournament":i.tournamentSelected,"is-live-button-visible":!!i.allLiveGames.length,onClickCalendar:o.onClickCalendar,onClickMatch:o.onClickMatch,onChangeMatchDay:o.onChangeMatchDayGames,onChangeIsLeagueSelected:o.onChangeIsLeagueSelected,onClickLive:o.onClickLive},null,8,["component-width","isplayer","is-full","data","tournament-schedule-keys","default-match-day-key","user","current-tournament","is-live-button-visible","onClickCalendar","onClickMatch","onChangeMatchDay","onChangeIsLeagueSelected","onClickLive"])])):n.createCommentVNode("",!0)],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:4},[Object.keys(i.tournamentSelected).length>0?(n.openBlock(),n.createElementBlock("div",IO,[n.createVNode(f,{"component-width":a.elementSize.width,isplayer:t.isplayer,"is-full":o.isGenericLike,data:o.games,"tournament-schedule-keys":i.tournamentScheduleKeys,"default-match-day-key":i.selectedRound,user:t.user,"current-tournament":i.tournamentSelected,"is-live-button-visible":!!i.allLiveGames.length,onClickCalendar:o.onClickCalendar,onClickMatch:o.onClickMatch,onChangeMatchDay:o.onChangeMatchDayGames,onChangeIsLeagueSelected:o.onChangeIsLeagueSelected,onClickLive:o.onClickLive},null,8,["component-width","isplayer","is-full","data","tournament-schedule-keys","default-match-day-key","user","current-tournament","is-live-button-visible","onClickCalendar","onClickMatch","onChangeMatchDay","onChangeIsLeagueSelected","onClickLive"])])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(o.containerGridCalendarTable)},[n.createElementVNode("div",{class:"container-grid",style:n.normalizeStyle([a.elementSize.width<=1e3?"width: 100%; ":"",!(t.isplayer&&!o.isGenericLike)&&o.isGenericLike?"max-height: 380px !important;":"max-height: 480px !important; margin-top: 15px !important;"])},[n.createVNode(h,{isPlayer:t.isplayer&&!o.isGenericLike,"player-id":t.user.player,"team-id":t.user.team,"tournament-selected":i.tournamentSelected,"is-public":i.is_public,"is-female":i.tournamentSelected.is_female==1,"season-selected":i.seasonSelected.id,"next-rival-id":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?i.fullTournamentSchedule.data.prematch.visiting_team:i.fullTournamentSchedule.data.prematch.home_team:0,"team-img":"https://az755631.vo.msecnd.net/teams-150/"+t.user.team+".png","player-img":"https://az755631.vo.msecnd.net/players-profile/"+t.user.player+".png","rival-img":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.visiting_team+".png":"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.home_team+".png":"","has-team":!o.isGenericLike,"component-width":a.elementSize.width,onAction:o.clickCard},null,8,["isPlayer","player-id","team-id","tournament-selected","is-public","is-female","season-selected","next-rival-id","team-img","player-img","rival-img","has-team","component-width","onAction"])],4),n.withDirectives(n.createElementVNode("div",{class:"container-calendar-table",style:n.normalizeStyle(a.elementSize.width<=1e3?"width: 100%; margin-top: 30px;":"")},[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(u,{season:i.seasonSelected,seasons:i.seasonsSelected,"tournament-type":i.tournamentType,tournament:i.tournamentSelected.id,privileges:t.privileges,"is-public":i.is_public,"is-player":t.isplayer,"is-player-tournament":t.user.tournament===i.tournamentSelected.id,"is-generic":o.isGenericLike,key:i.updateTableCalendar,"team-id":o.teamSelected,componentWidth:a.elementSize&&a.elementSize.width?a.elementSize.width:0,tournaments:i.currentTournaments,onAction:o.onAction,onOnOpenProfile:o.onOpenProfile,onOpenmedia:o.onOpenMedia},null,8,["season","seasons","tournament-type","tournament","privileges","is-public","is-player","is-player-tournament","is-generic","team-id","componentWidth","tournaments","onAction","onOnOpenProfile","onOpenmedia"])):n.createCommentVNode("",!0)],4),[[n.vShow,a.elementSize.width>1e3]])],2)],64)),n.createCommentVNode("",!0),o.isGenericLike?n.createCommentVNode("",!0):n.withDirectives((n.openBlock(),n.createElementBlock("div",{key:o.teamRival,class:"container-players"},[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(g,{key:o.teamRival,"tournament-selected":i.tournamentSelected,onClickProfileBtn:o.clickProfileBtn,onViewAll:o.viewAllRival,"is-rival":!0,onTotalPlayers:o.getTotalPlayersRival,"team-id":o.teamRival,"season-id":i.seasonSelected.id,"is-player":!0},null,8,["tournament-selected","onClickProfileBtn","onViewAll","onTotalPlayers","team-id","season-id"])):n.createCommentVNode("",!0)])),[[n.vShow,i.playersLengthRival>0&&o.teamRival>0]]),o.isGenericLike?n.createCommentVNode("",!0):n.withDirectives((n.openBlock(),n.createElementBlock("div",RO,[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(g,{key:0,"tournament-selected":i.tournamentSelected,onClickProfileBtn:o.clickProfileBtn,onViewAll:o.viewAll,onTotalPlayers:o.getTotalPlayers,"team-id":t.user.team,"season-id":i.seasonSelected.id,"is-player":!!t.user.player},null,8,["tournament-selected","onClickProfileBtn","onViewAll","onTotalPlayers","team-id","season-id","is-player"])):n.createCommentVNode("",!0)],512)),[[n.vShow,i.playersLength>0]]),a.elementSize.width<1e3&&t.isplayer&&!o.isGenericLike?(n.openBlock(),n.createElementBlock("div",{key:8,class:n.normalizeClass(o.containerGridCalendarTable)},[n.createElementVNode("div",{class:"container-grid",style:n.normalizeStyle([a.elementSize.width<=1e3?"width: 100%; ":"",!(t.isplayer&&!o.isGenericLike)&&o.isGenericLike?"max-height: 380px !important;":"max-height: 480px !important; margin-top: 65px !important;"])},[a.elementSize.width<1e3?(n.openBlock(),n.createBlock(h,{key:0,isPlayer:!1,"player-id":t.user.player,"team-id":t.user.team,"is-player-mobile2":t.isplayer&&!o.isGenericLike,"tournament-selected":i.tournamentSelected,"is-public":i.is_public,"is-female":i.tournamentSelected.is_female==1,"season-selected":i.seasonSelected.id,"next-rival-id":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?i.fullTournamentSchedule.data.prematch.visiting_team:i.fullTournamentSchedule.data.prematch.home_team:0,"team-img":"https://az755631.vo.msecnd.net/teams-150/"+t.user.team+".png","player-img":"https://az755631.vo.msecnd.net/players-profile/"+t.user.player+".png","rival-img":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.visiting_team+".png":"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.home_team+".png":"","has-team":!1,"component-width":a.elementSize.width,onAction:o.clickCard},null,8,["player-id","team-id","is-player-mobile2","tournament-selected","is-public","is-female","season-selected","next-rival-id","team-img","player-img","rival-img","component-width","onAction"])):n.createCommentVNode("",!0)],4)],2)):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(["container-tops",t.user.tournament===i.tournamentSelected.id?"tops-player":""]),style:n.normalizeStyle(t.isplayer&&!o.isGenericLike&&a.elementSize.width<1e3?"margin-top: 35px !important;":"")},[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(m,{key:0,"tournament-selected":i.tournamentSelected,onMore:o.moreTops,"show-switch":!o.isGenericLike,season:i.seasonSelected.id,"show-more":!i.is_public,"team-id":t.user.team,"active-videos":i.is_public?t.privileges.vr_privileges:!0,onOpenmedia:o.onOpenMedia},null,8,["tournament-selected","onMore","show-switch","season","show-more","team-id","active-videos","onOpenmedia"])):n.createCommentVNode("",!0)],6),i.gamesAllStories.length>0&&!i.is_public&&i.show_stories&&t.showStories?(n.openBlock(),n.createElementBlock("div",{key:9,class:n.normalizeClass(["stories-circle-wrapper",t.user.tournament===i.tournamentSelected.id?"":"marginsep"])},[(n.openBlock(),n.createBlock(p,{key:i.keyupdate,height:"130px",pxScroll:86,scrollColor:"none",arrowsPosition:"absolute","background-color":"none",arrowsScrollHide:!0,arrowsHideOnNoScroll:!0,arrowsBackground:"rgba(255,255,255,.16)",arrowsContainerBgL:"linear-gradient(270deg, rgba(13,29,42,0.1) 0%, rgba(13,29,42,1) 70%)",arrowsContainerBgR:"linear-gradient(90deg, rgba(13,29,42,0.1) 0%, rgba(13,29,42,1) 70%)",arrowsMargin:0,arrowsRadius:"50%",arrowsBorder:"#ddd"},{default:n.withCtx(()=>[n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.gamesAllStories,(y,b)=>(n.openBlock(),n.createElementBlock("div",{key:b,class:"story-container-game",onClick:S=>o.onClickStory({item:y,index:b})},[n.createElementVNode("div",{class:"story-circle",style:n.normalizeStyle(y.is_live==1?(y.status_storie==1,"border: 2px solid #cbee6b !important;"):y.status_storie==1?"border: 2px solid #2248a2 !important;":"border: 2px solid #41485B !important;")},[n.createElementVNode("div",{class:"circle-item-home",style:n.normalizeStyle("background-image: url(https://az755631.vo.msecnd.net/teams-80/"+y.home_team+".png)")},null,4),n.createElementVNode("div",{class:"circle-item-away",style:n.normalizeStyle("background-image: url(https://az755631.vo.msecnd.net/teams-80/"+y.visiting_team+".png)")},null,4)],4),n.createElementVNode("div",NO,[n.createTextVNode(n.toDisplayString(y.home_team_acronym)+"  ",1),y.score.length>0?(n.openBlock(),n.createElementBlock("span",DO,n.toDisplayString(isNaN(y.score[0])?0:y.score[0]),1)):n.createCommentVNode("",!0),n.createTextVNode(":"),y.score.length>0?(n.openBlock(),n.createElementBlock("span",PO,n.toDisplayString(isNaN(y.score[1])?0:y.score[1]),1)):n.createCommentVNode("",!0),n.createTextVNode("  "+n.toDisplayString(y.visiting_team_acronym),1)]),n.createElementVNode("div",OO,n.toDisplayString(y.matchday_name.replace("Matchday","JOR").replace("de Final","").replace("Playoffs 1","CFI").replace("Playoffs 2","CFV").replace("Playoffs 3","SFI").replace("Playoffs 4","SFV").replace("Playoffs 5","FI").replace("Playoffs 6","FV")),1)],8,BO))),128))]),_:1}))],2)):n.createCommentVNode("",!0),n.withDirectives(n.createElementVNode("div",{class:"container-calendar-table",style:n.normalizeStyle(a.elementSize.width<1e3?"width: 100%; margin-top: 30px;":"")},[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(u,{season:i.seasonSelected,seasons:i.seasonsSelected,"tournament-type":i.tournamentType,tournament:i.tournamentSelected.id,privileges:t.privileges,"is-public":i.is_public,"is-player":t.isplayer,"is-player-tournament":t.user.tournament===i.tournamentSelected.id,"is-generic":o.isGenericLike,key:i.updateTableCalendar,"team-id":o.teamSelected,componentWidth:a.elementSize&&a.elementSize.width?a.elementSize.width:0,tournaments:i.currentTournaments,onAction:o.onAction,onOnOpenProfile:o.onOpenProfile,onOpenmedia:o.onOpenMedia},null,8,["season","seasons","tournament-type","tournament","privileges","is-public","is-player","is-player-tournament","is-generic","team-id","componentWidth","tournaments","onAction","onOnOpenProfile","onOpenmedia"])):n.createCommentVNode("",!0)],4),[[n.vShow,a.elementSize.width<1e3]]),i.is_public?(n.openBlock(),n.createElementBlock("div",{key:10,class:"b2c-image",onClick:e[1]||(e[1]=(...y)=>o.abrirNuevaVentana&&o.abrirNuevaVentana(...y))})):n.createCommentVNode("",!0)],2)],2)],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[i.isStoriesVisible&&t.showStories?(n.openBlock(),n.createBlock(r,{key:0,stories:i.currentStories,"start-story-index":i.currentStoriesLastIndex,"is-first-game-stories":i.currentStoryIndex===0,"is-last-game-stories":i.currentStoryIndex===i.storiesItems.length-1,onLastStoryIndex:o.changeIndexStory,onClose:o.onCloseStories,onSwipe:o.onSwipeStories,onVideoNextBack:o.onClickNextBackVideo,onVideoPlay:o.onVideoPlay},null,8,["stories","start-story-index","is-first-game-stories","is-last-game-stories","onLastStoryIndex","onClose","onSwipe","onVideoNextBack","onVideoPlay"])):n.createCommentVNode("",!0),i.isCarouselFullScreenVisible?(n.openBlock(),n.createBlock(l,{key:1,"player-queue":i.carouselPlayerQueue,"is-play-seeker":i.isPlaySeeker,"playlist-index":0,onClose:o.onClickCloseCarousel},null,8,["player-queue","is-play-seeker","onClose"])):n.createCommentVNode("",!0),o.isPlaySeekerAvailable?(n.openBlock(),n.createElementBlock("div",FO,[n.createElementVNode("div",MO,[VO,n.createElementVNode("div",$O,[zO,n.createElementVNode("div",{role:"button",class:"play-seeker-image__info__legends-and-button__button",onClick:e[2]||(e[2]=(...y)=>o.onClickPlaySeeker&&o.onClickPlaySeeker(...y))},[n.createElementVNode("div",UO,[n.createElementVNode("img",{src:`${i.imagesUrl}icn-play.svg`,alt:""},null,8,GO)]),jO])])]),n.createElementVNode("div",HO,[n.createElementVNode("img",{src:`${i.imagesUrl}players@2x.png`,alt:""},null,8,WO)])])):n.createCommentVNode("",!0),a.elementSize.width<=680&&a.elementSize.width>0?(n.openBlock(),n.createElementBlock("div",KO,[n.createElementVNode("div",qO,[n.createVNode(d,{"current-season-id":t.currentSeasonId,width:"100%","api-url":t.tournamentsApiUrl,onInput:o.onInputTournament,onChangeTournaments:o.onChangeTournaments},null,8,["current-season-id","api-url","onInput","onChangeTournaments"])]),n.createElementVNode("div",YO,[n.createVNode(c,{"current-season-id":t.currentSeasonId,width:"100%",seasons:i.tournamentSelectedDropDowns.seasons,onInput:o.onInputSeason},null,8,["current-season-id","seasons","onInput"])])])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(o.containerbackground)},[n.createElementVNode("div",{class:n.normalizeClass(o.containerdata)},[a.elementSize.width<=680?(n.openBlock(),n.createElementBlock("div",JO,[XO,n.createElementVNode("div",ZO,[t.isFemale?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode("Bienvenida ")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode("Bienvenido ")],64)),i.is_public?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createTextVNode("a GolStats ")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createTextVNode(n.toDisplayString(o.formatUsername(t.user.name)),1)],64))])])):n.createCommentVNode("",!0),a.elementSize.width>680?(n.openBlock(),n.createElementBlock("div",QO,"Inicio")):n.createCommentVNode("",!0),a.elementSize.width>680?(n.openBlock(),n.createElementBlock("div",e8,[n.createElementVNode("div",t8,[t.isFemale?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode("Bienvenida ")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode("Bienvenido ")],64)),i.is_public?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createTextVNode("a GolStats ")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createTextVNode(n.toDisplayString(o.formatUsername(t.user.name)),1)],64))]),n.createElementVNode("div",s8,[n.createElementVNode("div",a8,[n.createVNode(d,{"current-season-id":t.currentSeasonId,"api-url":t.tournamentsApiUrl,onInput:o.onInputTournament,onChangeTournaments:o.onChangeTournaments},null,8,["current-season-id","api-url","onInput","onChangeTournaments"])]),n.createElementVNode("div",n8,[n.createVNode(c,{"current-season-id":t.currentSeasonId,seasons:i.tournamentSelectedDropDowns.seasons,onInput:o.onInputSeason},null,8,["current-season-id","seasons","onInput"])])])])):n.createCommentVNode("",!0),Object.keys(i.tournamentSelected).length>0?(n.openBlock(),n.createElementBlock("div",i8,[n.createVNode(f,{"component-width":a.elementSize.width,isplayer:t.isplayer,"is-full":o.isGenericLike,data:o.games,"tournament-schedule-keys":i.tournamentScheduleKeys,"default-match-day-key":i.selectedRound,user:t.user,"current-tournament":i.tournamentSelected,"is-live-button-visible":!!i.allLiveGames.length,onClickCalendar:o.onClickCalendar,onClickMatch:o.onClickMatch,onChangeMatchDay:o.onChangeMatchDayGames,onChangeIsLeagueSelected:o.onChangeIsLeagueSelected,onClickLive:o.onClickLive},null,8,["component-width","isplayer","is-full","data","tournament-schedule-keys","default-match-day-key","user","current-tournament","is-live-button-visible","onClickCalendar","onClickMatch","onChangeMatchDay","onChangeIsLeagueSelected","onClickLive"])])):n.createCommentVNode("",!0),n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(o.containerGridCalendarTable)},[n.createElementVNode("div",{class:"container-grid",style:n.normalizeStyle([a.elementSize.width<=1e3?"width: 100%; ":"",!(t.isplayer&&!o.isGenericLike)&&o.isGenericLike?"max-height: 380px !important;":"max-height: 480px !important; margin-top: 15px !important;"])},[n.createVNode(h,{isPlayer:t.isplayer&&!o.isGenericLike,"player-id":t.user.player,"team-id":t.user.team,"is-female":i.tournamentSelected.is_female==1,"tournament-selected":i.tournamentSelected,"is-public":i.is_public,"season-selected":i.seasonSelected.id,"next-rival-id":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?i.fullTournamentSchedule.data.prematch.visiting_team:i.fullTournamentSchedule.data.prematch.home_team:0,"team-img":"https://az755631.vo.msecnd.net/teams-150/"+t.user.team+".png","player-img":"https://az755631.vo.msecnd.net/players-profile/"+t.user.player+".png","rival-img":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.visiting_team+".png":"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.home_team+".png":"","has-team":!o.isGenericLike,"component-width":a.elementSize.width,onAction:o.clickCard},null,8,["isPlayer","player-id","team-id","is-female","tournament-selected","is-public","season-selected","next-rival-id","team-img","player-img","rival-img","has-team","component-width","onAction"])],4),n.withDirectives(n.createElementVNode("div",{class:"container-calendar-table",style:n.normalizeStyle(a.elementSize.width<=1e3?"width: 100%; margin-top: 30px;":"")},[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(u,{season:i.seasonSelected,seasons:i.seasonsSelected,"tournament-type":i.tournamentType,tournament:i.tournamentSelected.id,privileges:t.privileges,"is-public":i.is_public,"is-player":t.isplayer,"is-player-tournament":t.user.tournament===i.tournamentSelected.id,"is-generic":o.isGenericLike,key:i.updateTableCalendar,"team-id":o.teamSelected,componentWidth:a.elementSize&&a.elementSize.width?a.elementSize.width:0,tournaments:i.currentTournaments,onAction:o.onAction,onOnOpenProfile:o.onOpenProfile,onOpenmedia:o.onOpenMedia},null,8,["season","seasons","tournament-type","tournament","privileges","is-public","is-player","is-player-tournament","is-generic","team-id","componentWidth","tournaments","onAction","onOnOpenProfile","onOpenmedia"])):n.createCommentVNode("",!0)],4),[[n.vShow,a.elementSize.width>1e3]])],2),o.isGenericLike?n.createCommentVNode("",!0):n.withDirectives((n.openBlock(),n.createElementBlock("div",o8,[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(g,{key:0,"tournament-selected":i.tournamentSelected,onClickProfileBtn:o.clickProfileBtn,onViewAll:o.viewAll,onTotalPlayers:o.getTotalPlayers,"team-id":t.user.team,"season-id":i.seasonSelected.id,"is-player":!!t.user.player},null,8,["tournament-selected","onClickProfileBtn","onViewAll","onTotalPlayers","team-id","season-id","is-player"])):n.createCommentVNode("",!0)],512)),[[n.vShow,i.playersLength>0]]),n.createElementVNode("div",{class:n.normalizeClass(["container-tops",t.user.tournament===i.tournamentSelected.id&&!i.is_public&&!o.isGenericLike?"tops-team":""]),style:n.normalizeStyle(!(t.isplayer&&!o.isGenericLike)&&o.isGenericLike&&a.elementSize.width<=1e3?"margin-top: 25px !important;":"hola")},[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(m,{key:0,"tournament-selected":i.tournamentSelected,onMore:o.moreTops,"show-switch":!o.isGenericLike,season:i.seasonSelected.id,"show-more":!i.is_public,"team-id":t.user.team,"active-videos":i.is_public?t.privileges.vr_privileges:!0,onOpenmedia:o.onOpenMedia},null,8,["tournament-selected","onMore","show-switch","season","show-more","team-id","active-videos","onOpenmedia"])):n.createCommentVNode("",!0)],6),i.gamesAllStories.length>0&&!i.is_public&&i.show_stories&&t.showStories?(n.openBlock(),n.createElementBlock("div",r8,[(n.openBlock(),n.createBlock(p,{key:i.keyupdate,height:"130px",pxScroll:86,scrollColor:"none",arrowsPosition:"absolute","background-color":"none",arrowsScrollHide:!0,arrowsHideOnNoScroll:!0,arrowsBackground:"rgba(255,255,255,.16)",arrowsContainerBgL:"linear-gradient(270deg, rgba(13,29,42,0.1) 0%, rgba(13,29,42,1) 70%)",arrowsContainerBgR:"linear-gradient(90deg, rgba(13,29,42,0.1) 0%, rgba(13,29,42,1) 70%)",arrowsMargin:0,arrowsRadius:"50%",arrowsBorder:"#ddd"},{default:n.withCtx(()=>[n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.gamesAllStories,(y,b)=>(n.openBlock(),n.createElementBlock("div",{key:b,class:"story-container-game",onClick:S=>o.onClickStory({item:y,index:b})},[n.createElementVNode("div",{class:"story-circle",style:n.normalizeStyle(y.is_live==1?(y.status_storie==1,"border: 2px solid #cbee6b !important;"):y.status_storie==1?"border: 2px solid #2248a2 !important;":"border: 2px solid #41485B !important;")},[n.createElementVNode("div",{class:"circle-item-home",style:n.normalizeStyle("background-image: url(https://az755631.vo.msecnd.net/teams-80/"+y.home_team+".png)")},null,4),n.createElementVNode("div",{class:"circle-item-away",style:n.normalizeStyle("background-image: url(https://az755631.vo.msecnd.net/teams-80/"+y.visiting_team+".png)")},null,4)],4),n.createElementVNode("div",c8,[n.createTextVNode(n.toDisplayString(y.home_team_acronym)+"  ",1),y.score.length>0?(n.openBlock(),n.createElementBlock("span",d8,n.toDisplayString(isNaN(y.score[0])?0:y.score[0]),1)):n.createCommentVNode("",!0),n.createTextVNode(":"),y.score.length>0?(n.openBlock(),n.createElementBlock("span",h8,n.toDisplayString(isNaN(y.score[1])?0:y.score[1]),1)):n.createCommentVNode("",!0),n.createTextVNode("  "+n.toDisplayString(y.visiting_team_acronym),1)]),n.createElementVNode("div",u8,n.toDisplayString(y.matchday_name.replace("Matchday","JOR").replace("de Final","").replace("Playoffs 1","CFI").replace("Playoffs 2","CFV").replace("Playoffs 3","SFI").replace("Playoffs 4","SFV").replace("Playoffs 5","FI").replace("Playoffs 6","FV")),1)],8,l8))),128))]),_:1}))])):n.createCommentVNode("",!0),n.withDirectives(n.createElementVNode("div",{class:"container-calendar-table",style:n.normalizeStyle(a.elementSize.width<=1e3?"width: 100%; ":"")},[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(u,{season:i.seasonSelected,seasons:i.seasonsSelected,"tournament-type":i.tournamentType,tournament:i.tournamentSelected.id,privileges:t.privileges,"is-public":i.is_public,"is-player":t.isplayer,"is-player-tournament":t.user.tournament===i.tournamentSelected.id,"is-generic":o.isGenericLike,key:i.updateTableCalendar,"team-id":o.teamSelected,componentWidth:a.elementSize&&a.elementSize.width?a.elementSize.width:0,tournaments:i.currentTournaments,onAction:o.onAction,onOnOpenProfile:o.onOpenProfile,onOpenmedia:o.onOpenMedia},null,8,["season","seasons","tournament-type","tournament","privileges","is-public","is-player","is-player-tournament","is-generic","team-id","componentWidth","tournaments","onAction","onOnOpenProfile","onOpenmedia"])):n.createCommentVNode("",!0)],4),[[n.vShow,a.elementSize.width<1e3]]),i.is_public?(n.openBlock(),n.createElementBlock("div",{key:7,class:"b2c-image",onClick:e[3]||(e[3]=(...y)=>o.abrirNuevaVentana&&o.abrirNuevaVentana(...y))})):n.createCommentVNode("",!0)],2)],2)],64))],512)}const f8=Xe(iO,[["render",m8],["__scopeId","data-v-a6bd2464"]]);ms.GSCLanding=f8,Object.defineProperty(ms,Symbol.toStringTag,{value:"Module"})});
67
+ } (data length: ${t&&t.byteLength})`),i.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise((t,a)=>{const i=nl(this.config),o=e.map(pf).filter(r=>!!r&&i.indexOf(r)!==-1);return this.getKeySystemSelectionPromise(o).then(({keySystem:r})=>{const l=yf(r);l?t(l):a(new Error(`Unable to find format for key-system "${r}"`))}).catch(a)})}loadKey(e){const t=e.keyInfo.decryptdata,a=this.getKeyIdString(t),i=`(keyId: ${a} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${i}`);let o=this.keyIdToKeySessionPromise[a];return o||(o=this.keyIdToKeySessionPromise[a]=this.getKeySystemForKeyPromise(t).then(({keySystem:r,mediaKeys:l})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${i}`),this.attemptSetMediaKeys(r,l).then(()=>{this.throwIfDestroyed();const d=this.createMediaKeySessionContext({keySystem:r,mediaKeys:l,decryptdata:t});return this.generateRequestWithPreferredKeySession(d,"cenc",t.pssh,"playlist-key")}))),o.catch(r=>this.handleError(r))),o}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Ct?this.hls.trigger(_.ERROR,e.data):this.hls.trigger(_.ERROR,{type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),a=this.keyIdToKeySessionPromise[t];if(!a){const i=pf(e.keyFormat),o=i?[i]:nl(this.config);return this.attemptKeySystemAccess(o)}return a}getKeySystemSelectionPromise(e){if(e.length||(e=nl(this.config)),e.length===0)throw new Ct({type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}_onMediaEncrypted(e){const{initDataType:t,initData:a}=e,i=`"${e.type}" event: init data type: "${t}"`;if(this.debug(i),a===null)return;let o,r;if(t==="sinf"&&this.config.drmSystems[De.FAIRPLAY]){const u=qe(new Uint8Array(a));try{const f=sl(JSON.parse(u).sinf),g=vf(new Uint8Array(f));if(!g)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");o=g.subarray(8,24),r=De.FAIRPLAY}catch(f){this.warn(`${i} Failed to parse sinf: ${f}`);return}}else{const u=f6(a),f=u.filter(g=>g.systemId===Ia.WIDEVINE)[0];if(!f){u.length===0||u.some(g=>!g.systemId)?this.warn(`${i} contains incomplete or invalid pssh data`):this.log(`ignoring ${i} for ${u.map(g=>gf(g.systemId)).join(",")} pssh data in favor of playlist keys`);return}if(r=gf(f.systemId),f.version===0&&f.data){const g=f.data.length-22;o=f.data.subarray(g,g+16)}}if(!r||!o)return;const l=Gt.hexDump(o),{keyIdToKeySessionPromise:d,mediaKeySessions:c}=this;let h=d[l];for(let u=0;u<c.length;u++){const f=c[u],g=f.decryptdata;if(!g.keyId)continue;const m=Gt.hexDump(g.keyId);if(l===m||g.uri.replace(/-/g,"").indexOf(l)!==-1){if(h=d[m],g.pssh)break;delete d[m],g.pssh=new Uint8Array(a),g.keyId=o,h=d[l]=h.then(()=>this.generateRequestWithPreferredKeySession(f,t,a,"encrypted-event-key-match"));break}}h||(h=d[l]=this.getKeySystemSelectionPromise([r]).then(({keySystem:u,mediaKeys:f})=>{var g;this.throwIfDestroyed();const m=new Ba("ISO-23001-7",l,(g=yf(u))!=null?g:"");return m.pssh=new Uint8Array(a),m.keyId=o,this.attemptSetMediaKeys(u,f).then(()=>{this.throwIfDestroyed();const p=this.createMediaKeySessionContext({decryptdata:m,keySystem:u,mediaKeys:f});return this.generateRequestWithPreferredKeySession(p,t,a,"encrypted-event-no-match")})})),h.catch(u=>this.handleError(u))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const a=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const i=Promise.all(a).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(i),i.then(()=>{this.log(`Media-keys set for "${e}"`),a.push(i),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(o=>a.indexOf(o)===-1)})}generateRequestWithPreferredKeySession(e,t,a,i){var o,r;const l=(o=this.config.drmSystems)==null||(r=o[e.keySystem])==null?void 0:r.generateRequest;if(l)try{const m=l.call(this.hls,t,a,e);if(!m)throw new Error("Invalid response from configured generateRequest filter");t=m.initDataType,a=e.decryptdata.pssh=m.initData?new Uint8Array(m.initData):null}catch(m){var d;if(this.warn(m.message),(d=this.hls)!=null&&d.config.debug)throw m}if(a===null)return this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(e);const c=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${i}": ${c} (init data type: ${t} length: ${a?a.byteLength:null})`);const h=new Dl,u=e._onmessage=m=>{const p=e.mediaKeysSession;if(!p){h.emit("error",new Error("invalid state"));return}const{messageType:y,message:b}=m;this.log(`"${y}" message event for session "${p.sessionId}" message size: ${b.byteLength}`),y==="license-request"||y==="license-renewal"?this.renewLicense(e,b).catch(S=>{this.handleError(S),h.emit("error",S)}):y==="license-release"?e.keySystem===De.FAIRPLAY&&(this.updateKeySession(e,al("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${y}"`)},f=e._onkeystatuseschange=m=>{if(!e.mediaKeysSession){h.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const y=e.keyStatus;h.emit("keyStatus",y),y==="expired"&&(this.warn(`${e.keySystem} expired for key ${c}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",u),e.mediaKeysSession.addEventListener("keystatuseschange",f);const g=new Promise((m,p)=>{h.on("error",p),h.on("keyStatus",y=>{y.startsWith("usable")?m():y==="output-restricted"?p(new Ct({type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):y==="internal-error"?p(new Ct({type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${y}"`)):y==="expired"?p(new Error("key expired while generating request")):this.warn(`unhandled key status change "${y}"`)})});return e.mediaKeysSession.generateRequest(t,a).then(()=>{var m;this.log(`Request generated for key-session "${(m=e.mediaKeysSession)==null?void 0:m.sessionId}" keyId: ${c}`)}).catch(m=>{throw new Ct({type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_NO_SESSION,error:m,fatal:!1},`Error generating key-session request: ${m}`)}).then(()=>g).catch(m=>{throw h.removeAllListeners(),this.removeSession(e),m}).then(()=>(h.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,a)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${Gt.hexDump("buffer"in a?new Uint8Array(a.buffer,a.byteOffset,a.byteLength):new Uint8Array(a))} session keyId: ${Gt.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,a=t.loader,i=new a(t),o=this.getServerCertificateUrl(e);return o?(this.log(`Fetching server certificate for "${e}"`),new Promise((r,l)=>{const d={responseType:"arraybuffer",url:o},c=t.certLoadPolicy.default,h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(f,g,m,p)=>{r(f.data)},onError:(f,g,m,p)=>{l(new Ct({type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:et({url:d.url,data:void 0},f)},`"${e}" certificate request failed (${o}). Status: ${f.code} (${f.text})`))},onTimeout:(f,g,m)=>{l(new Ct({type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:{url:d.url,data:void 0}},`"${e}" certificate request timed out (${o})`))},onAbort:(f,g,m)=>{l(new Error("aborted"))}};i.load(d,h,u)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,a){return new Promise((i,o)=>{e.setServerCertificate(a).then(r=>{this.log(`setServerCertificate ${r?"success":"not supported by CDM"} (${a==null?void 0:a.byteLength}) on "${t}"`),i(e)}).catch(r=>{o(new Ct({type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:r,fatal:!0},r.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(a=>this.updateKeySession(e,new Uint8Array(a)).catch(i=>{throw new Ct({type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:i,fatal:!0},i.message)}))}unpackPlayReadyKeyMessage(e,t){const a=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!a.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const i=new DOMParser().parseFromString(a,"application/xml"),o=i.querySelectorAll("HttpHeader");if(o.length>0){let h;for(let u=0,f=o.length;u<f;u++){var r,l;h=o[u];const g=(r=h.querySelector("name"))==null?void 0:r.textContent,m=(l=h.querySelector("value"))==null?void 0:l.textContent;g&&m&&e.setRequestHeader(g,m)}}const d=i.querySelector("Challenge"),c=d==null?void 0:d.textContent;if(!c)throw new Error("Cannot find <Challenge> in key message");return al(atob(c))}setupLicenseXHR(e,t,a,i){const o=this.config.licenseXhrSetup;return o?Promise.resolve().then(()=>{if(!a.decryptdata)throw new Error("Key removed");return o.call(this.hls,e,t,a,i)}).catch(r=>{if(!a.decryptdata)throw r;return e.open("POST",t,!0),o.call(this.hls,e,t,a,i)}).then(r=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:r||i})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:i}))}requestLicense(e,t){const a=this.config.keyLoadPolicy.default;return new Promise((i,o)=>{const r=this.getLicenseServerUrl(e.keySystem);this.log(`Sending license request to URL: ${r}`);const l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return o(new Error("invalid state"));if(l.readyState===4)if(l.status===200){this._requestLicenseFailureCount=0;let d=l.response;this.log(`License received ${d instanceof ArrayBuffer?d.byteLength:d}`);const c=this.config.licenseResponseCallback;if(c)try{d=c.call(this.hls,l,r,e)}catch(h){this.error(h)}i(d)}else{const d=a.errorRetry,c=d?d.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>c||l.status>=400&&l.status<500)o(new Ct({type:pe.KEY_SYSTEM_ERROR,details:N.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:l,response:{url:r,data:void 0,code:l.status,text:l.statusText}},`License Request XHR failed (${r}). Status: ${l.status} (${l.statusText})`));else{const h=c-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${h} attempts left`),this.requestLicense(e,t).then(i,o)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=l,this.setupLicenseXHR(l,r,e,t).then(({xhr:d,licenseChallenge:c})=>{e.keySystem==De.PLAYREADY&&(c=this.unpackPlayReadyKeyMessage(d,c)),d.send(c)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const a=t.media;this.media=a,a.addEventListener("encrypted",this.onMediaEncrypted),a.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Ba.clearKeyUriToKeyIdMap();const a=t.length;ea.CDMCleanupPromise=Promise.all(t.map(i=>this.removeSession(i)).concat(e==null?void 0:e.setMediaKeys(null).catch(i=>{this.log(`Could not clear media keys: ${i}`)}))).then(()=>{a&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(i=>{this.log(`Could not close sessions and clear media keys: ${i}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const a=t.reduce((i,o)=>(i.indexOf(o.keyFormat)===-1&&i.push(o.keyFormat),i),[]);this.log(`Selecting key-system from session-keys ${a.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(a)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:a}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),a&&a.readyState!==XMLHttpRequest.DONE&&a.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const i=this.mediaKeySessions.indexOf(e);return i>-1&&this.mediaKeySessions.splice(i,1),t.remove().catch(o=>{this.log(`Could not remove session: ${o}`)}).then(()=>t.close()).catch(o=>{this.log(`Could not close session: ${o}`)})}}}ea.CDMCleanupPromise=void 0;class Ct extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}var ht;(function(s){s.MANIFEST="m",s.AUDIO="a",s.VIDEO="v",s.MUXED="av",s.INIT="i",s.CAPTION="c",s.TIMED_TEXT="tt",s.KEY="k",s.OTHER="o"})(ht||(ht={}));var Kl;(function(s){s.DASH="d",s.HLS="h",s.SMOOTH="s",s.OTHER="o"})(Kl||(Kl={}));var Is;(function(s){s.OBJECT="CMCD-Object",s.REQUEST="CMCD-Request",s.SESSION="CMCD-Session",s.STATUS="CMCD-Status"})(Is||(Is={}));const MD={[Is.OBJECT]:["br","d","ot","tb"],[Is.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[Is.SESSION]:["cid","pr","sf","sid","st","v"],[Is.STATUS]:["bs","rtp"]};class ta{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(a=>a instanceof ta?a:new ta(a))),this.value=e,this.params=t}}class ig{constructor(e){this.description=void 0,this.description=e}}const VD="Dict";function $D(s){return Array.isArray(s)?JSON.stringify(s):s instanceof Map?"Map{}":s instanceof Set?"Set{}":typeof s=="object"?JSON.stringify(s):String(s)}function zD(s,e,t,a){return new Error(`failed to ${s} "${$D(e)}" as ${t}`,{cause:a})}const og="Bare Item",UD="Boolean",GD="Byte Sequence",jD="Decimal",HD="Integer";function WD(s){return s<-999999999999999||999999999999999<s}const KD=/[\x00-\x1f\x7f]+/,qD="Token",YD="Key";function qt(s,e,t){return zD("serialize",s,e,t)}function JD(s){if(typeof s!="boolean")throw qt(s,UD);return s?"?1":"?0"}function XD(s){return btoa(String.fromCharCode(...s))}function ZD(s){if(ArrayBuffer.isView(s)===!1)throw qt(s,GD);return`:${XD(s)}:`}function rg(s){if(WD(s))throw qt(s,HD);return s.toString()}function QD(s){return`@${rg(s.getTime()/1e3)}`}function lg(s,e){if(s<0)return-lg(-s,e);const t=Math.pow(10,e);if(Math.abs(s*t%1-.5)<Number.EPSILON){const i=Math.floor(s*t);return(i%2===0?i:i+1)/t}else return Math.round(s*t)/t}function eP(s){const e=lg(s,3);if(Math.floor(Math.abs(e)).toString().length>12)throw qt(s,jD);const t=e.toString();return t.includes(".")?t:`${t}.0`}const tP="String";function sP(s){if(KD.test(s))throw qt(s,tP);return`"${s.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function aP(s){return s.description||s.toString().slice(7,-1)}function cg(s){const e=aP(s);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw qt(e,qD);return e}function ql(s){switch(typeof s){case"number":if(!ae(s))throw qt(s,og);return Number.isInteger(s)?rg(s):eP(s);case"string":return sP(s);case"symbol":return cg(s);case"boolean":return JD(s);case"object":if(s instanceof Date)return QD(s);if(s instanceof Uint8Array)return ZD(s);if(s instanceof ig)return cg(s);default:throw qt(s,og)}}function Yl(s){if(/^[a-z*][a-z0-9\-_.*]*$/.test(s)===!1)throw qt(s,YD);return s}function Jl(s){return s==null?"":Object.entries(s).map(([e,t])=>t===!0?`;${Yl(e)}`:`;${Yl(e)}=${ql(t)}`).join("")}function dg(s){return s instanceof ta?`${ql(s.value)}${Jl(s.params)}`:ql(s)}function nP(s){return`(${s.value.map(dg).join(" ")})${Jl(s.params)}`}function iP(s,e={whitespace:!0}){if(typeof s!="object")throw qt(s,VD);const t=s instanceof Map?s.entries():Object.entries(s),a=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([i,o])=>{o instanceof ta||(o=new ta(o));let r=Yl(i);return o.value===!0?r+=Jl(o.params):(r+="=",Array.isArray(o.value)?r+=nP(o):r+=dg(o)),r}).join(`,${a}`)}function oP(s,e){return iP(s,e)}const rP=s=>s==="ot"||s==="sf"||s==="st",lP=s=>typeof s=="number"?ae(s):s!=null&&s!==""&&s!==!1;function cP(s,e){const t=new URL(s),a=new URL(e);if(t.origin!==a.origin)return s;const i=t.pathname.split("/").slice(1),o=a.pathname.split("/").slice(1,-1);for(;i[0]===o[0];)i.shift(),o.shift();for(;o.length;)o.shift(),i.unshift("..");return i.join("/")}function dP(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,i=>{const o=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(i=="x"?o:o&3|8).toString(16)})}}}const Ei=s=>Math.round(s),hP=(s,e)=>(e!=null&&e.baseUrl&&(s=cP(s,e.baseUrl)),encodeURIComponent(s)),Ti=s=>Ei(s/100)*100,uP={br:Ei,d:Ei,bl:Ti,dl:Ti,mtp:Ti,nor:hP,rtp:Ti,tb:Ei};function mP(s,e){const t={};if(s==null||typeof s!="object")return t;const a=Object.keys(s).sort(),i=je({},uP,e==null?void 0:e.formatters),o=e==null?void 0:e.filter;return a.forEach(r=>{if(o!=null&&o(r))return;let l=s[r];const d=i[r];d&&(l=d(l,e)),!(r==="v"&&l===1)&&(r=="pr"&&l===1||lP(l)&&(rP(r)&&typeof l=="string"&&(l=new ig(l)),t[r]=l))}),t}function hg(s,e={}){return s?oP(mP(s,e),je({whitespace:!1},e)):""}function fP(s,e={}){if(!s)return{};const t=Object.entries(s),a=Object.entries(MD).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),i=t.reduce((o,r)=>{var l,d;const[c,h]=r,u=((l=a.find(f=>f[1].includes(c)))==null?void 0:l[0])||Is.REQUEST;return(d=o[u])!=null||(o[u]={}),o[u][c]=h,o},{});return Object.entries(i).reduce((o,[r,l])=>(o[r]=hg(l,e),o),{})}function pP(s,e,t){return je(s,fP(e,t))}const gP="CMCD";function yP(s,e={}){if(!s)return"";const t=hg(s,e);return`${gP}=${encodeURIComponent(t)}`}const ug=/CMCD=[^&#]+/;function bP(s,e,t){const a=yP(e,t);if(!a)return s;if(ug.test(s))return s.replace(ug,a);const i=s.includes("?")?"&":"?";return`${s}${i}${a}`}class SP{constructor(e){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=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=i=>{try{this.apply(i,{ot:ht.MANIFEST,su:!this.initialized})}catch(o){A.warn("Could not generate manifest CMCD data.",o)}},this.applyFragmentData=i=>{try{const o=i.frag,r=this.hls.levels[o.level],l=this.getObjectType(o),d={d:o.duration*1e3,ot:l};(l===ht.VIDEO||l===ht.AUDIO||l==ht.MUXED)&&(d.br=r.bitrate/1e3,d.tb=this.getTopBandwidth(l)/1e3,d.bl=this.getBufferLength(l)),this.apply(i,d)}catch(o){A.warn("Could not generate segment CMCD data.",o)}},this.hls=e;const t=this.config=e.config,{cmcd:a}=t;a!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=a.sessionId||dP(),this.cid=a.contentId,this.useHeaders=a.useHeaders===!0,this.includeKeys=a.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHED,this.onMediaDetached,this),e.on(_.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHED,this.onMediaDetached,this),e.off(_.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var a,i;this.audioBuffer=(a=t.tracks.audio)==null?void 0:a.buffer,this.videoBuffer=(i=t.tracks.video)==null?void 0:i.buffer}createData(){var e;return{v:1,sf:Kl.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){je(t,this.createData());const a=t.ot===ht.INIT||t.ot===ht.VIDEO||t.ot===ht.MUXED;this.starved&&a&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:i}=this;i&&(t=Object.keys(t).reduce((o,r)=>(i.includes(r)&&(o[r]=t[r]),o),{})),this.useHeaders?(e.headers||(e.headers={}),pP(e.headers,t)):e.url=bP(e.url,t)}getObjectType(e){const{type:t}=e;if(t==="subtitle")return ht.TIMED_TEXT;if(e.sn==="initSegment")return ht.INIT;if(t==="audio")return ht.AUDIO;if(t==="main")return this.hls.audioTracks.length?ht.VIDEO:ht.MUXED}getTopBandwidth(e){let t=0,a;const i=this.hls;if(e===ht.AUDIO)a=i.audioTracks;else{const o=i.maxAutoLevel,r=o>-1?o+1:i.levels.length;a=i.levels.slice(0,r)}for(const o of a)o.bitrate>t&&(t=o.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.hls.media,a=e===ht.AUDIO?this.audioBuffer:this.videoBuffer;return!a||!t?NaN:Pe.bufferInfo(a,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,a=e||this.config.loader;return class{constructor(o){this.loader=void 0,this.loader=new a(o)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(o,r,l){t(o),this.loader.load(o,r,l)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,a=e||this.config.loader;return class{constructor(o){this.loader=void 0,this.loader=new a(o)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(o,r,l){t(o),this.loader.load(o,r,l)}}}}const _P=3e5;class wP{constructor(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=A.log.bind(A,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(a=>a!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:a}=t;a!==null&&(this.pathwayId=a.pathwayId,this.uri=a.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:a}=t;if((a==null?void 0:a.action)===rt.SendAlternateToPenaltyBox&&a.flags===Ft.MoveAllAlternatesMatchingHost){const i=this.levels;let o=this.pathwayPriority,r=this.pathwayId;if(t.context){const{groupId:l,pathwayId:d,type:c}=t.context;l&&i?r=this.getPathwayForGroupId(l,c,r):d&&(r=d)}r in this.penalizedPathways||(this.penalizedPathways[r]=performance.now()),!o&&i&&(o=i.reduce((l,d)=>(l.indexOf(d.pathwayId)===-1&&l.push(d.pathwayId),l),[])),o&&o.length>1&&(this.updatePathwayPriority(o),a.resolved=this.pathwayId!==r),a.resolved||A.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${r} levels: ${i&&i.length} priorities: ${JSON.stringify(o)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const a=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${a}"`),t=this.getLevelsForPathway(a),this.pathwayId=a}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this.pathwayPriority=e;let t;const a=this.penalizedPathways,i=performance.now();Object.keys(a).forEach(o=>{i-a[o]>_P&&delete a[o]});for(let o=0;o<e.length;o++){const r=e[o];if(r in a)continue;if(r===this.pathwayId)return;const l=this.hls.nextLoadLevel,d=this.hls.levels[l];if(t=this.getLevelsForPathway(r),t.length>0){this.log(`Setting Pathway to "${r}"`),this.pathwayId=r,ap(t),this.hls.trigger(_.LEVELS_UPDATED,{levels:t});const c=this.hls.levels[l];d&&c&&this.levels&&(c.attrs["STABLE-VARIANT-ID"]!==d.attrs["STABLE-VARIANT-ID"]&&c.bitrate!==d.bitrate&&this.log(`Unstable Pathways change from bitrate ${d.bitrate} to ${c.bitrate}`),this.hls.nextLoadLevel=l);break}}}getPathwayForGroupId(e,t,a){const i=this.getLevelsForPathway(a).concat(this.levels||[]);for(let o=0;o<i.length;o++)if(t===ve.AUDIO_TRACK&&i[o].hasAudioGroup(e)||t===ve.SUBTITLE_TRACK&&i[o].hasSubtitleGroup(e))return i[o].pathwayId;return a}clonePathways(e){const t=this.levels;if(!t)return;const a={},i={};e.forEach(o=>{const{ID:r,"BASE-ID":l,"URI-REPLACEMENT":d}=o;if(t.some(h=>h.pathwayId===r))return;const c=this.getLevelsForPathway(l).map(h=>{const u=new Me(h.attrs);u["PATHWAY-ID"]=r;const f=u.AUDIO&&`${u.AUDIO}_clone_${r}`,g=u.SUBTITLES&&`${u.SUBTITLES}_clone_${r}`;f&&(a[u.AUDIO]=f,u.AUDIO=f),g&&(i[u.SUBTITLES]=g,u.SUBTITLES=g);const m=fg(h.uri,u["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",d),p=new Ws({attrs:u,audioCodec:h.audioCodec,bitrate:h.bitrate,height:h.height,name:h.name,url:m,videoCodec:h.videoCodec,width:h.width});if(h.audioGroups)for(let y=1;y<h.audioGroups.length;y++)p.addGroupId("audio",`${h.audioGroups[y]}_clone_${r}`);if(h.subtitleGroups)for(let y=1;y<h.subtitleGroups.length;y++)p.addGroupId("text",`${h.subtitleGroups[y]}_clone_${r}`);return p});t.push(...c),mg(this.audioTracks,a,d,r),mg(this.subtitleTracks,i,d,r)})}loadSteeringManifest(e){const t=this.hls.config,a=t.loader;this.loader&&this.loader.destroy(),this.loader=new a(t);let i;try{i=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(i.protocol!=="data:"){const h=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;i.searchParams.set("_HLS_pathway",this.pathwayId),i.searchParams.set("_HLS_throughput",""+h)}const o={responseType:"json",url:i.href},r=t.steeringManifestLoadPolicy.default,l=r.errorRetry||r.timeoutRetry||{},d={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:l.maxNumRetry||0,retryDelay:l.retryDelayMs||0,maxRetryDelay:l.maxRetryDelayMs||0},c={onSuccess:(h,u,f,g)=>{this.log(`Loaded steering manifest: "${i}"`);const m=h.data;if(m.VERSION!==1){this.log(`Steering VERSION ${m.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=m.TTL;const{"RELOAD-URI":p,"PATHWAY-CLONES":y,"PATHWAY-PRIORITY":b}=m;if(p)try{this.uri=new self.URL(p,i).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${p}`);return}this.scheduleRefresh(this.uri||f.url),y&&this.clonePathways(y);const S={steeringManifest:m,url:i.toString()};this.hls.trigger(_.STEERING_MANIFEST_LOADED,S),b&&this.updatePathwayPriority(b)},onError:(h,u,f,g)=>{if(this.log(`Error loading steering manifest: ${h.code} ${h.text} (${u.url})`),this.stopLoad(),h.code===410){this.enabled=!1,this.log(`Steering manifest ${u.url} no longer available`);return}let m=this.timeToLoad*1e3;if(h.code===429){const p=this.loader;if(typeof(p==null?void 0:p.getResponseHeader)=="function"){const y=p.getResponseHeader("Retry-After");y&&(m=parseFloat(y)*1e3)}this.log(`Steering manifest ${u.url} rate limited`);return}this.scheduleRefresh(this.uri||u.url,m)},onTimeout:(h,u,f)=>{this.log(`Timeout loading steering manifest (${u.url})`),this.scheduleRefresh(this.uri||u.url)}};this.log(`Requesting steering manifest: ${i}`),this.loader.load(o,d,c)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var a;const i=(a=this.hls)==null?void 0:a.media;if(i&&!i.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function mg(s,e,t,a){s&&Object.keys(e).forEach(i=>{const o=s.filter(r=>r.groupId===i).map(r=>{const l=je({},r);return l.details=void 0,l.attrs=new Me(l.attrs),l.url=l.attrs.URI=fg(r.url,r.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),l.groupId=l.attrs["GROUP-ID"]=e[i],l.attrs["PATHWAY-ID"]=a,l});s.push(...o)})}function fg(s,e,t,a){const{HOST:i,PARAMS:o,[t]:r}=a;let l;e&&(l=r==null?void 0:r[e],l&&(s=l));const d=new self.URL(s);return i&&!l&&(d.host=i),o&&Object.keys(o).sort().forEach(c=>{c&&d.searchParams.set(c,o[c])}),d.href}const kP=/^age:\s*[\d.]+\s*$/im;class pg{constructor(e){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=e&&e.xhrSetup||null,this.stats=new qn,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,a){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=a,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const a=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=!1;const o=this.xhrSetup;o?Promise.resolve().then(()=>{if(!(this.loader!==a||this.stats.aborted))return o(a,t.url)}).catch(r=>{if(!(this.loader!==a||this.stats.aborted))return a.open("GET",t.url,!0),o(a,t.url)}).then(()=>{this.loader!==a||this.stats.aborted||this.openAndSendXhr(a,t,e)}).catch(r=>{this.callbacks.onError({code:a.status,text:r.message},t,a,i)}):this.openAndSendXhr(a,t,e)}openAndSendXhr(e,t,a){e.readyState||e.open("GET",t.url,!0);const i=t.headers,{maxTimeToFirstByteMs:o,maxLoadTimeMs:r}=a.loadPolicy;if(i)for(const l in i)e.setRequestHeader(l,i[l]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),a.timeout=o&&ae(o)?o:r,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),a.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:a}=this;if(!e||!t)return;const i=t.readyState,o=this.config;if(!a.aborted&&i>=2&&(a.loading.first===0&&(a.loading.first=Math.max(self.performance.now(),a.loading.start),o.timeout!==o.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),o.timeout=o.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),o.loadPolicy.maxLoadTimeMs-(a.loading.first-a.loading.start)))),i===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const r=t.status,l=t.responseType!=="text";if(r>=200&&r<300&&(l&&t.response||t.responseText!==null)){a.loading.end=Math.max(self.performance.now(),a.loading.first);const d=l?t.response:t.responseText,c=t.responseType==="arraybuffer"?d.byteLength:d.length;if(a.loaded=a.total=c,a.bwEstimate=a.total*8e3/(a.loading.end-a.loading.first),!this.callbacks)return;const h=this.callbacks.onProgress;if(h&&h(a,e,d,t),!this.callbacks)return;const u={url:t.responseURL,data:d,code:r};this.callbacks.onSuccess(u,a,e,t)}else{const d=o.loadPolicy.errorRetry,c=a.retry,h={url:e.url,data:void 0,code:r};ri(d,c,!1,h)?this.retry(d):(A.error(`${r} while loading ${e.url}`),this.callbacks.onError({code:r,text:t.statusText},e,t,a))}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(ri(e,t,!0))this.retry(e);else{var a;A.warn(`timeout while loading ${(a=this.context)==null?void 0:a.url}`);const i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:a}=this;this.retryDelay=_l(e,a.retry),a.retry++,A.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${a.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&kP.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}function EP(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const TP=/(\d+)-(\d+)\/(\d+)/;class gg{constructor(e){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=e.fetchSetup||AP,this.controller=new self.AbortController,this.stats=new qn}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,a){const i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now();const o=CP(e,this.controller.signal),r=a.onProgress,l=e.responseType==="arraybuffer",d=l?"byteLength":"length",{maxTimeToFirstByteMs:c,maxLoadTimeMs:h}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=a,this.request=this.fetchSetup(e,o),self.clearTimeout(this.requestTimeout),t.timeout=c&&ae(c)?c:h,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),a.onTimeout(i,e,this.response)},t.timeout),self.fetch(this.request).then(u=>{this.response=this.loader=u;const f=Math.max(self.performance.now(),i.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=h,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),a.onTimeout(i,e,this.response)},h-(f-i.loading.start)),!u.ok){const{status:g,statusText:m}=u;throw new LP(m||"fetch, bad network response",g,u)}return i.loading.first=f,i.total=vP(u.headers)||i.total,r&&ae(t.highWaterMark)?this.loadProgressively(u,i,e,t.highWaterMark,r):l?u.arrayBuffer():e.responseType==="json"?u.json():u.text()}).then(u=>{const f=this.response;if(!f)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),i.loading.end=Math.max(self.performance.now(),i.loading.first);const g=u[d];g&&(i.loaded=i.total=g);const m={url:f.url,data:u,code:f.status};r&&!ae(t.highWaterMark)&&r(i,e,u,f),a.onSuccess(m,i,e,f)}).catch(u=>{if(self.clearTimeout(this.requestTimeout),i.aborted)return;const f=u&&u.code||0,g=u?u.message:null;a.onError({code:f,text:g},e,u?u.details:null,i)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,a,i=0,o){const r=new pp,l=e.body.getReader(),d=()=>l.read().then(c=>{if(c.done)return r.dataLength&&o(t,a,r.flush(),e),Promise.resolve(new ArrayBuffer(0));const h=c.value,u=h.length;return t.loaded+=u,u<i||r.dataLength?(r.push(h),r.dataLength>=i&&o(t,a,r.flush(),e)):o(t,a,h,e),d()}).catch(()=>Promise.reject());return d()}}function CP(s,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(je({},s.headers))};return s.rangeEnd&&t.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),t}function xP(s){const e=TP.exec(s);if(e)return parseInt(e[2])-parseInt(e[1])+1}function vP(s){const e=s.get("Content-Range");if(e){const a=xP(e);if(ae(a))return a}const t=s.get("Content-Length");if(t)return parseInt(t)}function AP(s,e){return new self.Request(s.url,e)}class LP extends Error{constructor(e,t,a){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=a}}const IP=/\s/,RP={newCue(s,e,t,a){const i=[];let o,r,l,d,c;const h=self.VTTCue||self.TextTrackCue;for(let f=0;f<a.rows.length;f++)if(o=a.rows[f],l=!0,d=0,c="",!o.isEmpty()){var u;for(let p=0;p<o.chars.length;p++)IP.test(o.chars[p].uchar)&&l?d++:(c+=o.chars[p].uchar,l=!1);o.cueStartTime=e,e===t&&(t+=1e-4),d>=16?d--:d++;const g=Yp(c.trim()),m=zl(e,t,g);s!=null&&(u=s.cues)!=null&&u.getCueById(m)||(r=new h(e,t,g),r.id=m,r.line=f+1,r.align="left",r.position=10+Math.min(80,Math.floor(d*8/32)*10),i.push(r))}return s&&i.length&&(i.sort((f,g)=>f.line==="auto"||g.line==="auto"?0:f.line>8&&g.line>8?g.line-f.line:f.line-g.line),i.forEach(f=>qf(s,f))),i}},BP={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},yg=et(et({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,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,loader:pg,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:iN,bufferController:cD,capLevelController:Wl,errorController:K6,fpsController:FD,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:bf,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:BP},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}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},NP()),{},{subtitleStreamController:iD,subtitleTrackController:rD,timelineController:PD,audioStreamController:aD,audioTrackController:nD,emeController:ea,cmcdController:SP,contentSteeringController:wP});function NP(){return{cueHandler:RP,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 DP(s,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const t=Xl(s),a=["manifest","level","frag"],i=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return a.forEach(o=>{const r=`${o==="level"?"playlist":o}LoadPolicy`,l=e[r]===void 0,d=[];i.forEach(c=>{const h=`${o}Loading${c}`,u=e[h];if(u!==void 0&&l){d.push(h);const f=t[r].default;switch(e[r]={default:f},c){case"TimeOut":f.maxLoadTimeMs=u,f.maxTimeToFirstByteMs=u;break;case"MaxRetry":f.errorRetry.maxNumRetry=u,f.timeoutRetry.maxNumRetry=u;break;case"RetryDelay":f.errorRetry.retryDelayMs=u,f.timeoutRetry.retryDelayMs=u;break;case"MaxRetryTimeout":f.errorRetry.maxRetryDelayMs=u,f.timeoutRetry.maxRetryDelayMs=u;break}}}),d.length&&A.warn(`hls.js config: "${d.join('", "')}" setting(s) are deprecated, use "${r}": ${JSON.stringify(e[r])}`)}),et(et({},t),e)}function Xl(s){return s&&typeof s=="object"?Array.isArray(s)?s.map(Xl):Object.keys(s).reduce((e,t)=>(e[t]=Xl(s[t]),e),{}):s}function PP(s){const e=s.loader;e!==gg&&e!==pg?(A.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1):EP()&&(s.loader=gg,s.progressive=!0,s.enableSoftwareAES=!0,A.log("[config]: Progressive streaming enabled, using FetchLoader"))}let Zl;class OP extends kl{constructor(e,t){super(e,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this),e.on(_.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this),e.off(_.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const a=this.hls.config.preferManagedMediaSource,i=[],o={},r={};let l=!1,d=!1,c=!1;t.levels.forEach(h=>{var u,f;const g=h.attrs;let{audioCodec:m,videoCodec:p}=h;((u=m)==null?void 0:u.indexOf("mp4a.40.34"))!==-1&&(Zl||(Zl=/chrome|firefox/i.test(navigator.userAgent)),Zl&&(h.audioCodec=m=void 0)),m&&(h.audioCodec=m=ti(m,a)),((f=p)==null?void 0:f.indexOf("avc1"))===0&&(p=h.videoCodec=k6(p));const{width:y,height:b,unknownCodecs:S}=h;if(l||(l=!!(y&&b)),d||(d=!!p),c||(c=!!m),S!=null&&S.length||m&&!hl(m,"audio",a)||p&&!hl(p,"video",a))return;const{CODECS:w,"FRAME-RATE":x,"HDCP-LEVEL":E,"PATHWAY-ID":v,RESOLUTION:T,"VIDEO-RANGE":R}=g,B=`${`${v||"."}-`}${h.bitrate}-${T}-${x}-${w}-${R}-${E}`;if(o[B])if(o[B].uri!==h.url&&!h.attrs["PATHWAY-ID"]){const M=r[B]+=1;h.attrs["PATHWAY-ID"]=new Array(M+1).join(".");const W=new Ws(h);o[B]=W,i.push(W)}else o[B].addGroupId("audio",g.AUDIO),o[B].addGroupId("text",g.SUBTITLES);else{const M=new Ws(h);o[B]=M,r[B]=1,i.push(M)}}),this.filterAndSortMediaOptions(i,t,l,d,c)}filterAndSortMediaOptions(e,t,a,i,o){let r=[],l=[],d=e;if((a||i)&&o&&(d=d.filter(({videoCodec:m,videoRange:p,width:y,height:b})=>(!!m||!!(y&&b))&&P6(p))),d.length===0){Promise.resolve().then(()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);const m=new Error("no level with compatible codecs found in manifest");this.hls.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:m,reason:m.message})}});return}if(t.audioTracks){const{preferManagedMediaSource:m}=this.hls.config;r=t.audioTracks.filter(p=>!p.audioCodec||hl(p.audioCodec,"audio",m)),bg(r)}t.subtitles&&(l=t.subtitles,bg(l));const c=d.slice(0);d.sort((m,p)=>{if(m.attrs["HDCP-LEVEL"]!==p.attrs["HDCP-LEVEL"])return(m.attrs["HDCP-LEVEL"]||"")>(p.attrs["HDCP-LEVEL"]||"")?1:-1;if(a&&m.height!==p.height)return m.height-p.height;if(m.frameRate!==p.frameRate)return m.frameRate-p.frameRate;if(m.videoRange!==p.videoRange)return ni.indexOf(m.videoRange)-ni.indexOf(p.videoRange);if(m.videoCodec!==p.videoCodec){const y=Pf(m.videoCodec),b=Pf(p.videoCodec);if(y!==b)return b-y}if(m.uri===p.uri&&m.codecSet!==p.codecSet){const y=ei(m.codecSet),b=ei(p.codecSet);if(y!==b)return b-y}return m.averageBitrate!==p.averageBitrate?m.averageBitrate-p.averageBitrate:0});let h=c[0];if(this.steering&&(d=this.steering.filterParsedLevels(d),d.length!==c.length)){for(let m=0;m<c.length;m++)if(c[m].pathwayId===d[0].pathwayId){h=c[m];break}}this._levels=d;for(let m=0;m<d.length;m++)if(d[m]===h){var u;this._firstLevel=m;const p=h.bitrate,y=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${d.length} level(s) found, first bitrate: ${p}`),((u=this.hls.userConfig)==null?void 0:u.abrEwmaDefaultEstimate)===void 0){const b=Math.min(p,this.hls.config.abrEwmaDefaultEstimateMax);b>y&&y===yg.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=b)}break}const f=o&&!i,g={levels:d,audioTracks:r,subtitleTracks:l,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:o,video:i,altAudio:!f&&r.some(m=>!!m.url)};this.hls.trigger(_.MANIFEST_PARSED,g),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return this._levels.length===0?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const h=new Error("invalid level idx"),u=e<0;if(this.hls.trigger(_.ERROR,{type:pe.OTHER_ERROR,details:N.LEVEL_SWITCH_ERROR,level:e,fatal:u,error:h,reason:h.message}),u)return;e=Math.min(e,t.length-1)}const a=this.currentLevelIndex,i=this.currentLevel,o=i?i.attrs["PATHWAY-ID"]:void 0,r=t[e],l=r.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=r,a===e&&r.details&&i&&o===l)return;this.log(`Switching to level ${e} (${r.height?r.height+"p ":""}${r.videoRange?r.videoRange+" ":""}${r.codecSet?r.codecSet+" ":""}@${r.bitrate})${l?" with Pathway "+l:""} from level ${a}${o?" with Pathway "+o:""}`);const d={level:e,attrs:r.attrs,details:r.details,bitrate:r.bitrate,averageBitrate:r.averageBitrate,maxBitrate:r.maxBitrate,realBitrate:r.realBitrate,width:r.width,height:r.height,codecSet:r.codecSet,audioCodec:r.audioCodec,videoCodec:r.videoCodec,audioGroups:r.audioGroups,subtitleGroups:r.subtitleGroups,loaded:r.loaded,loadError:r.loadError,fragmentError:r.fragmentError,name:r.name,id:r.id,uri:r.uri,url:r.url,urlId:0,audioGroupIds:r.audioGroupIds,textGroupIds:r.textGroupIds};this.hls.trigger(_.LEVEL_SWITCHING,d);const c=r.details;if(!c||c.live){const h=this.switchParams(r.uri,i==null?void 0:i.details,c);this.loadPlaylist(h)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){t.fatal||!t.context||t.context.type===ve.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===ce.MAIN){const a=t.elementaryStreams;if(!Object.keys(a).some(o=>!!a[o]))return;const i=this._levels[t.level];i!=null&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var a;const{level:i,details:o}=t,r=this._levels[i];if(!r){var l;this.warn(`Invalid level index ${i}`),(l=t.deliveryDirectives)!=null&&l.skip&&(o.deltaUpdateFailed=!0);return}i===this.currentLevelIndex?(r.fragmentError===0&&(r.loadError=0),this.playlistLoaded(i,t,r.details)):(a=t.deliveryDirectives)!=null&&a.skip&&(o.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,a=this.currentLevel;if(a&&this.shouldLoadPlaylist(a)){let i=a.uri;if(e)try{i=e.addDirectives(i)}catch(r){this.warn(`Could not construct new URL with HLS Delivery Directives: ${r}`)}const o=a.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${(e==null?void 0:e.msn)!==void 0?" at sn "+e.msn+" part "+e.part:""} with${o?" Pathway "+o:""} ${i}`),this.clearTimer(),this.hls.trigger(_.LEVEL_LOADING,{url:i,level:t,pathwayId:a.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;const a=this._levels.filter((i,o)=>o!==e?!0:(this.steering&&this.steering.removeLevel(i),i===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,i.details&&i.details.fragments.forEach(r=>r.level=-1)),!1));ap(a),this._levels=a,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(_.LEVELS_UPDATED,{levels:a})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:a}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(_.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:a}))}}function bg(s){const e={};s.forEach(t=>{const a=t.groupId||"";t.id=e[a]=e[a]||0,e[a]++})}class FP{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const a in this.keyUriToKeyInfo){const i=this.keyUriToKeyInfo[a].loader;if(i){var t;if(e&&e!==((t=i.context)==null?void 0:t.frag.type))return;i.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=N.KEY_LOAD_ERROR,a,i,o){return new Zt({type:pe.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:o,error:a,networkDetails:i})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:a,cc:i}=e;for(let o=0;o<t.length;o++){const r=t[o];if(i<=r.cc&&(a==="initSegment"||r.sn==="initSegment"||a<r.sn)){this.emeController.selectKeySystemFormat(r).then(l=>{r.setKeyFormat(l)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var a,i;t&&e.setKeyFormat(t);const o=e.decryptdata;if(!o){const c=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,N.KEY_LOAD_ERROR,c))}const r=o.uri;if(!r)return Promise.reject(this.createKeyLoadError(e,N.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${r}"`)));let l=this.keyUriToKeyInfo[r];if((a=l)!=null&&a.decryptdata.key)return o.key=l.decryptdata.key,Promise.resolve({frag:e,keyInfo:l});if((i=l)!=null&&i.keyLoadPromise){var d;switch((d=l.mediaKeySessionContext)==null?void 0:d.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return l.keyLoadPromise.then(c=>(o.key=c.keyInfo.decryptdata.key,{frag:e,keyInfo:l}))}}switch(l=this.keyUriToKeyInfo[r]={decryptdata:o,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},o.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return o.keyFormat==="identity"?this.loadKeyHTTP(l,e):this.loadKeyEME(l,e);case"AES-128":return this.loadKeyHTTP(l,e);default:return Promise.reject(this.createKeyLoadError(e,N.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${o.method}"`)))}}loadKeyEME(e,t){const a={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const i=this.emeController.loadKey(a);if(i)return(e.keyLoadPromise=i.then(o=>(e.mediaKeySessionContext=o,a))).catch(o=>{throw e.keyLoadPromise=null,o})}return Promise.resolve(a)}loadKeyHTTP(e,t){const a=this.config,i=a.loader,o=new i(a);return t.keyLoader=e.loader=o,e.keyLoadPromise=new Promise((r,l)=>{const d={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},c=a.keyLoadPolicy.default,h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(f,g,m,p)=>{const{frag:y,keyInfo:b,url:S}=m;if(!y.decryptdata||b!==this.keyUriToKeyInfo[S])return l(this.createKeyLoadError(y,N.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),p));b.decryptdata.key=y.decryptdata.key=new Uint8Array(f.data),y.keyLoader=null,b.loader=null,r({frag:y,keyInfo:b})},onError:(f,g,m,p)=>{this.resetLoader(g),l(this.createKeyLoadError(t,N.KEY_LOAD_ERROR,new Error(`HTTP Error ${f.code} loading key ${f.text}`),m,et({url:d.url,data:void 0},f)))},onTimeout:(f,g,m)=>{this.resetLoader(g),l(this.createKeyLoadError(t,N.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),m))},onAbort:(f,g,m)=>{this.resetLoader(g),l(this.createKeyLoadError(t,N.INTERNAL_ABORTED,new Error("key loading aborted"),m))}};o.load(d,h,u)})}resetLoader(e){const{frag:t,keyInfo:a,url:i}=e,o=a.loader;t.keyLoader===o&&(t.keyLoader=null,a.loader=null),delete this.keyUriToKeyInfo[i],o&&o.destroy()}}function Sg(){return self.SourceBuffer||self.WebKitSourceBuffer}function _g(){if(!As())return!1;const e=Sg();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function MP(){if(!_g())return!1;const s=As();return typeof(s==null?void 0:s.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>s.isTypeSupported(Na(e,"video")))||["mp4a.40.2","fLaC"].some(e=>s.isTypeSupported(Na(e,"audio"))))}function VP(){var s;const e=Sg();return typeof(e==null||(s=e.prototype)==null?void 0:s.changeType)=="function"}const $P=250,Ci=2,zP=.1,UP=.05;class GP{constructor(e,t,a,i){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=a,this.hls=i}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:a,media:i,stalled:o}=this;if(i===null)return;const{currentTime:r,seeking:l}=i,d=this.seeking&&!l,c=!this.seeking&&l;if(this.seeking=l,r!==e){if(this.moved=!0,l||(this.nudgeRetry=0),o!==null){if(this.stallReported){const y=self.performance.now()-o;A.warn(`playback not stuck anymore @${r}, after ${Math.round(y)}ms`),this.stallReported=!1}this.stalled=null}return}if(c||d){this.stalled=null;return}if(i.paused&&!l||i.ended||i.playbackRate===0||!Pe.getBuffered(i).length){this.nudgeRetry=0;return}const h=Pe.bufferInfo(i,r,0),u=h.nextStart||0;if(l){const y=h.len>Ci,b=!u||t&&t.start<=r||u-r>Ci&&!this.fragmentTracker.getPartialFragment(r);if(y||b)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var f;if(!(h.len>0)&&!u)return;const b=Math.max(u,h.start||0)-r,S=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,x=(S==null||(f=S.details)==null?void 0:f.live)?S.details.targetduration*2:Ci,E=this.fragmentTracker.getPartialFragment(r);if(b>0&&(b<=x||E)){i.paused||this._trySkipBufferHole(E);return}}const g=self.performance.now();if(o===null){this.stalled=g;return}const m=g-o;if(!l&&m>=$P&&(this._reportStall(h),!this.media))return;const p=Pe.bufferInfo(i,r,a.maxBufferHole);this._tryFixBufferStall(p,m)}_tryFixBufferStall(e,t){const{config:a,fragmentTracker:i,media:o}=this;if(o===null)return;const r=o.currentTime,l=i.getPartialFragment(r);l&&(this._trySkipBufferHole(l)||!this.media)||(e.len>a.maxBufferHole||e.nextStart&&e.nextStart-r<a.maxBufferHole)&&t>a.highBufferWatchdogPeriod*1e3&&(A.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:a,stallReported:i}=this;if(!i&&a){this.stallReported=!0;const o=new Error(`Playback stalling at @${a.currentTime} due to low buffer (${JSON.stringify(e)})`);A.warn(o.message),t.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.BUFFER_STALLED_ERROR,fatal:!1,error:o,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:a,media:i}=this;if(i===null)return 0;const o=i.currentTime,r=Pe.bufferInfo(i,o,0),l=o<r.start?r.start:r.nextStart;if(l){const d=r.len<=t.maxBufferHole,c=r.len>0&&r.len<1&&i.readyState<3,h=l-o;if(h>0&&(d||c)){if(h>t.maxBufferHole){const{fragmentTracker:f}=this;let g=!1;if(o===0){const m=f.getAppendedFrag(0,ce.MAIN);m&&l<m.end&&(g=!0)}if(!g){const m=e||f.getAppendedFrag(o,ce.MAIN);if(m){let p=!1,y=m.end;for(;y<l;){const b=f.getPartialFragment(y);if(b)y+=b.duration;else{p=!0;break}}if(p)return 0}}}const u=Math.max(l+UP,o+zP);if(A.warn(`skipping hole, adjusting currentTime from ${o} to ${u}`),this.moved=!0,this.stalled=null,i.currentTime=u,e&&!e.gap){const f=new Error(`fragment loaded with buffer holes, seeking from ${o} to ${u}`);a.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:f,reason:f.message,frag:e})}return u}}return 0}_tryNudgeBuffer(){const{config:e,hls:t,media:a,nudgeRetry:i}=this;if(a===null)return;const o=a.currentTime;if(this.nudgeRetry++,i<e.nudgeMaxRetry){const r=o+(i+1)*e.nudgeOffset,l=new Error(`Nudging 'currentTime' from ${o} to ${r}`);A.warn(l.message),a.currentTime=r,t.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.BUFFER_NUDGE_ON_STALL,error:l,fatal:!1})}else{const r=new Error(`Playhead still not moving while enough data buffered @${o} after ${e.nudgeMaxRetry} nudges`);A.error(r.message),t.trigger(_.ERROR,{type:pe.MEDIA_ERROR,details:N.BUFFER_STALLED_ERROR,error:r,fatal:!0})}}}const jP=100;class HP extends Cl{constructor(e,t,a){super(e,t,a,"[stream-controller]",ce.MAIN),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(_.MANIFEST_LOADING,this.onManifestLoading,this),e.on(_.MANIFEST_PARSED,this.onManifestParsed,this),e.on(_.LEVEL_LOADING,this.onLevelLoading,this),e.on(_.LEVEL_LOADED,this.onLevelLoaded,this),e.on(_.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(_.ERROR,this.onError,this),e.on(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(_.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(_.BUFFER_CREATED,this.onBufferCreated,this),e.on(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(_.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(_.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(_.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(_.MANIFEST_LOADING,this.onManifestLoading,this),e.off(_.MANIFEST_PARSED,this.onManifestParsed,this),e.off(_.LEVEL_LOADED,this.onLevelLoaded,this),e.off(_.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(_.ERROR,this.onError,this),e.off(_.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(_.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(_.BUFFER_CREATED,this.onBufferCreated,this),e.off(_.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(_.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(_.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(e){if(this.levels){const{lastCurrentTime:t,hls:a}=this;if(this.stopLoad(),this.setInterval(jP),this.level=-1,!this.startFragRequested){let i=a.startLevel;i===-1&&(a.config.testBandwidth&&this.levels.length>1?(i=0,this.bitrateTest=!0):i=a.firstAutoLevel),a.nextLoadLevel=i,this.level=a.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=$.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=$.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case $.WAITING_LEVEL:{const{levels:t,level:a}=this,i=t==null?void 0:t[a],o=i==null?void 0:i.details;if(o&&(!o.live||this.levelLastLoaded===i)){if(this.waitForCdnTuneIn(o))break;this.state=$.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=$.IDLE;break}break}case $.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),a=this.retryDate;if(!a||t>=a||(e=this.media)!=null&&e.seeking){const{levels:i,level:o}=this,r=i==null?void 0:i[o];this.resetStartWhenNotLoaded(r||null),this.state=$.IDLE}}break}this.state===$.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:a,media:i}=this;if(t===null||!i&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const o=e.nextLoadLevel;if(!(a!=null&&a[o]))return;const r=a[o],l=this.getMainFwdBufferInfo();if(l===null)return;const d=this.getLevelDetails();if(d&&this._streamEnded(l,d)){const p={};this.altAudio&&(p.type="video"),this.hls.trigger(_.BUFFER_EOS,p),this.state=$.ENDED;return}e.loadLevel!==o&&e.manualLevel===-1&&this.log(`Adapting to level ${o} from level ${this.level}`),this.level=e.nextLoadLevel=o;const c=r.details;if(!c||this.state===$.WAITING_LEVEL||c.live&&this.levelLastLoaded!==r){this.level=o,this.state=$.WAITING_LEVEL;return}const h=l.len,u=this.getMaxBufferLength(r.maxBitrate);if(h>=u)return;this.backtrackFragment&&this.backtrackFragment.start>l.end&&(this.backtrackFragment=null);const f=this.backtrackFragment?this.backtrackFragment.start:l.end;let g=this.getNextFragment(f,c);if(this.couldBacktrack&&!this.fragPrevious&&g&&g.sn!=="initSegment"&&this.fragmentTracker.getState(g)!==tt.OK){var m;const y=((m=this.backtrackFragment)!=null?m:g).sn-c.startSN,b=c.fragments[y-1];b&&g.cc===b.cc&&(g=b,this.fragmentTracker.removeFragment(b))}else this.backtrackFragment&&l.len&&(this.backtrackFragment=null);if(g&&this.isLoopLoading(g,f)){if(!g.gap){const y=this.audioOnly&&!this.altAudio?Be.AUDIO:Be.VIDEO,b=(y===Be.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;b&&this.afterBufferFlushed(b,y,ce.MAIN)}g=this.getNextFragmentLoopLoading(g,c,l,ce.MAIN,u)}g&&(g.initSegment&&!g.initSegment.data&&!this.bitrateTest&&(g=g.initSegment),this.loadFragment(g,r,f))}loadFragment(e,t,a){const i=this.fragmentTracker.getState(e);this.fragCurrent=e,i===tt.NOT_LOADED||i===tt.PARTIAL?e.sn==="initSegment"?this._loadInitSegment(e,t):this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):(this.startFragRequested=!0,super.loadFragment(e,t,a)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,ce.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let a;const i=this.getAppendedFrag(t.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);const o=this.getLevelDetails();if(o!=null&&o.live){const l=this.getMainFwdBufferInfo();if(!l||l.len<o.targetduration*2)return}if(!t.paused&&e){const l=this.hls.nextLoadLevel,d=e[l],c=this.fragLastKbps;c&&this.fragCurrent?a=this.fragCurrent.duration*d.maxBitrate/(1e3*c)+1:a=0}else a=0;const r=this.getBufferedFrag(t.currentTime+a);if(r){const l=this.followingBufferedFrag(r);if(l){this.abortCurrentFrag();const d=l.maxStartPTS?l.maxStartPTS:l.start,c=l.duration,h=Math.max(r.end,d+Math.min(Math.max(c-this.config.maxFragLookUpTolerance,c*(this.couldBacktrack?.5:.125)),c*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(h,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case $.KEY_LOADING:case $.FRAG_LOADING:case $.FRAG_LOADING_WAITING_RETRY:case $.PARSING:case $.PARSED:this.state=$.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const a=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new GP(this.config,a,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const e=this.media,t=e?e.currentTime:null;ae(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const a=this.getMainFwdBufferInfo();if(a===null||a.len===0){this.warn(`Main forward buffer length on "seeked" event ${a?a.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(_.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(e,t){let a=!1,i=!1;t.levels.forEach(o=>{const r=o.audioCodec;r&&(a=a||r.indexOf("mp4a.40.2")!==-1,i=i||r.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=a&&i&&!VP(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:a}=this;if(!a||this.state!==$.IDLE)return;const i=a[t.level];(!i.details||i.details.live&&this.levelLastLoaded!==i||this.waitForCdnTuneIn(i.details))&&(this.state=$.WAITING_LEVEL)}onLevelLoaded(e,t){var a;const{levels:i}=this,o=t.level,r=t.details,l=r.totalduration;if(!i){this.warn(`Levels were reset while loading level ${o}`);return}this.log(`Level ${o} loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""}, cc [${r.startCC}, ${r.endCC}] duration:${l}`);const d=i[o],c=this.fragCurrent;c&&(this.state===$.FRAG_LOADING||this.state===$.FRAG_LOADING_WAITING_RETRY)&&c.level!==t.level&&c.loader&&this.abortCurrentFrag();let h=0;if(r.live||(a=d.details)!=null&&a.live){var u;if(this.checkLiveUpdate(r),r.deltaUpdateFailed)return;h=this.alignPlaylists(r,d.details,(u=this.levelLastLoaded)==null?void 0:u.details)}if(d.details=r,this.levelLastLoaded=d,this.hls.trigger(_.LEVEL_UPDATED,{details:r,level:o}),this.state===$.WAITING_LEVEL){if(this.waitForCdnTuneIn(r))return;this.state=$.IDLE}this.startFragRequested?r.live&&this.synchronizeToLiveEdge(r):this.setStartPosition(r,h),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:a,part:i,payload:o}=e,{levels:r}=this;if(!r){this.warn(`Levels were reset while fragment load was in progress. Fragment ${a.sn} of level ${a.level} will not be buffered`);return}const l=r[a.level],d=l.details;if(!d){this.warn(`Dropping fragment ${a.sn} of level ${a.level} after level details were reset`),this.fragmentTracker.removeFragment(a);return}const c=l.videoCodec,h=d.PTSKnown||!d.live,u=(t=a.initSegment)==null?void 0:t.data,f=this._getAudioCodec(l),g=this.transmuxer=this.transmuxer||new Fp(this.hls,ce.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),m=i?i.index:-1,p=m!==-1,y=new El(a.level,a.sn,a.stats.chunkCount,o.byteLength,m,p),b=this.initPTS[a.cc];g.push(o,u,f,c,a,i,d.totalduration,h,y,b)}onAudioTrackSwitching(e,t){const a=this.altAudio;if(!!!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const r=this.fragCurrent;r&&(this.log("Switching to main audio track, cancel main fragment load"),r.abortRequests(),this.fragmentTracker.removeFragment(r)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const o=this.hls;a&&(o.trigger(_.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),o.trigger(_.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const a=t.id,i=!!this.hls.audioTracks[a].url;if(i){const o=this.videoBuffer;o&&this.mediaBuffer!==o&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=o)}this.altAudio=i,this.tick()}onBufferCreated(e,t){const a=t.tracks;let i,o,r=!1;for(const l in a){const d=a[l];if(d.id==="main"){if(o=l,i=d,l==="video"){const c=a[l];c&&(this.videoBuffer=c.buffer)}}else r=!0}r&&i?(this.log(`Alternate track found, use ${o}.buffered to schedule main fragment loading`),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:a,part:i}=t;if(a&&a.type!==ce.MAIN)return;if(this.fragContextChanged(a)){this.warn(`Fragment ${a.sn}${i?" p: "+i.index:""} of level ${a.level} finished buffering, but was aborted. state: ${this.state}`),this.state===$.PARSED&&(this.state=$.IDLE);return}const o=i?i.stats:a.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,i)}onError(e,t){var a;if(t.fatal){this.state=$.ERROR;return}switch(t.details){case N.FRAG_GAP:case N.FRAG_PARSING_ERROR:case N.FRAG_DECRYPT_ERROR:case N.FRAG_LOAD_ERROR:case N.FRAG_LOAD_TIMEOUT:case N.KEY_LOAD_ERROR:case N.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ce.MAIN,t);break;case N.LEVEL_LOAD_ERROR:case N.LEVEL_LOAD_TIMEOUT:case N.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===$.WAITING_LEVEL&&((a=t.context)==null?void 0:a.type)===ve.LEVEL&&(this.state=$.IDLE);break;case N.BUFFER_APPEND_ERROR:case N.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===N.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case N.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!Pe.getBuffered(e).length){const a=this.state!==$.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,a)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=$.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==Be.AUDIO||this.audioOnly&&!this.altAudio){const a=(t===Be.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(a,t,ce.MAIN),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let a=this.startPosition;if(a>=0&&t<a){if(e.seeking){this.log(`could not seek to ${a}, already seeking at ${t}`);return}const i=Pe.getBuffered(e),r=(i.length?i.start(0):0)-a;r>0&&(r<this.config.maxBufferHole||r<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${r} to match buffer start`),a+=r,this.startPosition=a),this.log(`seek to target start position ${a} from current time ${t}`),e.currentTime=a}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(a=>{const{hls:i}=this;if(!a||this.fragContextChanged(e))return;t.fragmentError=0,this.state=$.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const o=e.stats;o.parsing.start=o.parsing.end=o.buffering.start=o.buffering.end=self.performance.now(),i.trigger(_.FRAG_LOADED,a),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const a="main",{hls:i}=this,{remuxResult:o,chunkMeta:r}=e,l=this.getCurrentContext(r);if(!l){this.resetWhenMissingContext(r);return}const{frag:d,part:c,level:h}=l,{video:u,text:f,id3:g,initSegment:m}=o,{details:p}=h,y=this.altAudio?void 0:o.audio;if(this.fragContextChanged(d)){this.fragmentTracker.removeFragment(d);return}if(this.state=$.PARSING,m){if(m!=null&&m.tracks){const w=d.initSegment||d;this._bufferInitSegment(h,m.tracks,w,r),i.trigger(_.FRAG_PARSING_INIT_SEGMENT,{frag:w,id:a,tracks:m.tracks})}const b=m.initPTS,S=m.timescale;ae(b)&&(this.initPTS[d.cc]={baseTime:b,timescale:S},i.trigger(_.INIT_PTS_FOUND,{frag:d,id:a,initPTS:b,timescale:S}))}if(u&&p&&d.sn!=="initSegment"){const b=p.fragments[d.sn-1-p.startSN],S=d.sn===p.startSN,w=!b||d.cc>b.cc;if(o.independent!==!1){const{startPTS:x,endPTS:E,startDTS:v,endDTS:T}=u;if(c)c.elementaryStreams[u.type]={startPTS:x,endPTS:E,startDTS:v,endDTS:T};else if(u.firstKeyFrame&&u.independent&&r.id===1&&!w&&(this.couldBacktrack=!0),u.dropped&&u.independent){const R=this.getMainFwdBufferInfo(),L=(R?R.end:this.getLoadPosition())+this.config.maxBufferHole,B=u.firstKeyFramePTS?u.firstKeyFramePTS:x;if(!S&&L<B-this.config.maxBufferHole&&!w){this.backtrack(d);return}else w&&(d.gap=!0);d.setElementaryStreamInfo(u.type,d.start,E,d.start,T,!0)}else S&&x>Ci&&(d.gap=!0);d.setElementaryStreamInfo(u.type,x,E,v,T),this.backtrackFragment&&(this.backtrackFragment=d),this.bufferFragmentData(u,d,c,r,S||w)}else if(S||w)d.gap=!0;else{this.backtrack(d);return}}if(y){const{startPTS:b,endPTS:S,startDTS:w,endDTS:x}=y;c&&(c.elementaryStreams[Be.AUDIO]={startPTS:b,endPTS:S,startDTS:w,endDTS:x}),d.setElementaryStreamInfo(Be.AUDIO,b,S,w,x),this.bufferFragmentData(y,d,c,r)}if(p&&g!=null&&(t=g.samples)!=null&&t.length){const b={id:a,frag:d,details:p,samples:g.samples};i.trigger(_.FRAG_PARSING_METADATA,b)}if(p&&f){const b={id:a,frag:d,details:p,samples:f.samples};i.trigger(_.FRAG_PARSING_USERDATA,b)}}_bufferInitSegment(e,t,a,i){if(this.state!==$.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:o,video:r,audiovideo:l}=t;if(o){let d=e.audioCodec;const c=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){d&&(d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5");const h=o.metadata;h&&"channelCount"in h&&(h.channelCount||1)!==1&&c.indexOf("firefox")===-1&&(d="mp4a.40.5")}d&&d.indexOf("mp4a.40.5")!==-1&&c.indexOf("android")!==-1&&o.container!=="audio/mpeg"&&(d="mp4a.40.2",this.log(`Android: force audio codec to ${d}`)),e.audioCodec&&e.audioCodec!==d&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${d}"`),o.levelCodec=d,o.id="main",this.log(`Init audio buffer, container:${o.container}, codecs[selected/level/parsed]=[${d||""}/${e.audioCodec||""}/${o.codec}]`)}r&&(r.levelCodec=e.videoCodec,r.id="main",this.log(`Init video buffer, container:${r.container}, codecs[level/parsed]=[${e.videoCodec||""}/${r.codec}]`)),l&&this.log(`Init audiovideo buffer, container:${l.container}, codecs[level/parsed]=[${e.codecs}/${l.codec}]`),this.hls.trigger(_.BUFFER_CODECS,t),Object.keys(t).forEach(d=>{const h=t[d].initSegment;h!=null&&h.byteLength&&this.hls.trigger(_.BUFFER_APPENDING,{type:d,data:h,frag:a,part:null,chunkMeta:i,parent:a.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,ce.MAIN)}backtrack(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=$.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const a=e.currentTime;if(Pe.isBuffered(e,a)?t=this.getAppendedFrag(a):Pe.isBuffered(e,a+.1)&&(t=this.getAppendedFrag(a+.1)),t){this.backtrackFragment=null;const i=this.fragPlaying,o=t.level;(!i||t.sn!==i.sn||i.level!==o)&&(this.fragPlaying=t,this.hls.trigger(_.FRAG_CHANGED,{frag:t}),(!i||i.level!==o)&&this.hls.trigger(_.LEVEL_SWITCHED,{level:o}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,a=this.currentFrag;if(a&&ae(t)&&ae(a.programDateTime)){const i=a.programDateTime+(t-a.start)*1e3;return new Date(i)}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class ds{static get version(){return"1.5.17"}static isMSESupported(){return _g()}static isSupported(){return MP()}static getMediaSource(){return As()}static get Events(){return _}static get ErrorTypes(){return pe}static get ErrorDetails(){return N}static get DefaultConfig(){return ds.defaultConfig?ds.defaultConfig:yg}static set DefaultConfig(e){ds.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new Dl,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.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,N3(e.debug||!1,"Hls instance");const t=this.config=DP(ds.DefaultConfig,e);this.userConfig=e,t.progressive&&PP(t);const{abrController:a,bufferController:i,capLevelController:o,errorController:r,fpsController:l}=t,d=new r(this),c=this.abrController=new a(this),h=this.bufferController=new i(this),u=this.capLevelController=new o(this),f=new l(this),g=new v6(this),m=new B6(this),p=t.contentSteeringController,y=p?new p(this):null,b=this.levelController=new OP(this,y),S=new rN(this),w=new FP(this.config),x=this.streamController=new HP(this,S,w);u.setStreamController(x),f.setStreamController(x);const E=[g,b,x];y&&E.splice(1,0,y),this.networkControllers=E;const v=[c,h,u,f,m,S];this.audioTrackController=this.createController(t.audioTrackController,E);const T=t.audioStreamController;T&&E.push(new T(this,S,w)),this.subtitleTrackController=this.createController(t.subtitleTrackController,E);const R=t.subtitleStreamController;R&&E.push(new R(this,S,w)),this.createController(t.timelineController,v),w.emeController=this.emeController=this.createController(t.emeController,v),this.cmcdController=this.createController(t.cmcdController,v),this.latencyController=this.createController(N6,v),this.coreComponents=v,E.push(d);const L=d.onErrorOut;typeof L=="function"&&this.on(_.ERROR,L,d)}createController(e,t){if(e){const a=new e(this);return t&&t.push(a),a}return null}on(e,t,a=this){this._emitter.on(e,t,a)}once(e,t,a=this){this._emitter.once(e,t,a)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,a=this,i){this._emitter.off(e,t,a,i)}listeners(e){return this._emitter.listeners(e)}emit(e,t,a){return this._emitter.emit(e,t,a)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(a){if(A.error("An internal error happened while handling event "+e+'. Error message: "'+a.message+'". Here is a stacktrace:',a),!this.triggeringException){this.triggeringException=!0;const i=e===_.ERROR;this.trigger(_.ERROR,{type:pe.OTHER_ERROR,details:N.INTERNAL_EXCEPTION,fatal:i,event:e,error:a}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){A.log("destroy"),this.trigger(_.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){A.log("attachMedia"),this._media=e,this.trigger(_.MEDIA_ATTACHING,{media:e})}detachMedia(){A.log("detachMedia"),this.trigger(_.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,a=this.url,i=this.url=Qr.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,A.log(`loadSource:${i}`),t&&a&&(a!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(_.MANIFEST_LOADING,{url:e})}startLoad(e=-1){A.log(`startLoad(${e})`),this.started=!0,this.networkControllers.forEach(t=>{t.startLoad(e)})}stopLoad(){A.log("stopLoad"),this.started=!1,this.networkControllers.forEach(e=>{e.stopLoad()})}resumeBuffering(){this.started&&this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.startLoad(-1)})}pauseBuffering(){this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.stopLoad()})}swapAudioCodec(){A.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){A.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){A.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){A.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){A.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){A.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){A.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(A.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){D6(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const a=e.length;for(let i=0;i<a;i++)if(e[i].maxBitrate>=t)return i;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:a}=this;let i;if(t===-1&&e!=null&&e.length?i=e.length-1:i=t,a)for(let o=i;o--;){const r=e[o].attrs["HDCP-LEVEL"];if(r&&r<=a)return o}return i}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(e){var t;return(t=this.audioTrackController)==null?void 0:t.setAudioOption(e)}setSubtitleOption(e){var t;return(t=this.subtitleTrackController)==null||t.setSubtitleOption(e),null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}ds.defaultConfig=void 0;const WP=[(s=>(n.pushScopeId("data-v-bf69d301"),s=s(),n.popScopeId(),s))(()=>n.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},[n.createElementVNode("path",{d:"M5 15L15 5",stroke:"white","stroke-width":"1.7","stroke-miterlimit":"10","stroke-linecap":"round","stroke-linejoin":"round"}),n.createElementVNode("path",{d:"M15 15L5 5",stroke:"white","stroke-width":"1.7","stroke-miterlimit":"10","stroke-linecap":"round","stroke-linejoin":"round"})],-1))],KP={class:"stories__content"},qP={class:"story-container-game"},YP={class:"story-circle"},JP={class:"story-result"},XP={class:"stories__content__stories-bar"},ZP={class:"stories__content__video"},QP={class:"stories__content__video__info__date"},eO={class:"stories__content__video__info__data"},tO=Xe({__name:"GameStories",props:{stories:{type:Array,default:()=>[]},startStoryIndex:{type:Number,default:0},isFirstGameStories:{type:Boolean,default:!1},isLastGameStories:{type:Boolean,default:!1}},emits:["close","last-story-index","swipe","video-play","video-next-back"],setup(s,{emit:e}){const t=s;n.useCssVars(ee=>({f47bb864:y.value,"875f549a":b.value,"3a0e3be2":v.value}));const a=eu(),o=[{ids:[607,608],name:"Oportunidad de Gol"},{ids:[12,55],name:"Gol"},{ids:[54,35],name:"Autogol"},{ids:[14,52],name:"Tarjeta Amarilla"},{ids:[15,53],name:"Tarjeta Roja"},{ids:[466,477],name:"Penal Recibido"}].reduce((ee,Ce)=>(Ce.ids.forEach(Te=>{ee.set(Te,Ce.name)}),ee),new Map),r=n.ref(null),l=n.ref(null),d=n.ref([]),c=n.ref(0),h=n.ref(null),u=n.ref(0),f=n.ref(0),g=n.ref(0),m=n.ref(!1),p=n.ref(0),y=n.ref("auto"),b=n.ref("100%"),S=n.ref(null),w=n.ref(0),x=n.ref(null),E=n.ref(null),v=n.computed(()=>X()?"7vw":"16px"),T=n.computed(()=>d.value[c.value]),R=n.computed(()=>({"--icon-play":`url(${a}/icnplay1.svg)`}));function L(){l.value.muted=!1,l.value.play()}const B=n.computed(()=>!T.value.isHls&&["ios"].includes(Qo()));n.watch(()=>T.value,ee=>{ee&&W()}),n.watch(()=>t.stories,ee=>{if(ee.length){c.value=0,g.value=0;const Ce=ee.map(Te=>({...Te,progress:0,isHls:Te.url.includes(".m3u8"),date:`${Te.date.getDate()}, ${du[Te.date.getMonth()]} ${Te.date.getFullYear()}`,data:`${o.get(Te.categoryId)} ${dv(Te.player.player_name)}`})).sort((Te,Fe)=>Te.startTime-Fe.startTime);t.startStoryIndex>0&&t.startStoryIndex<Ce.length-1&&(Ce.forEach((Te,Fe)=>{Fe<=t.startStoryIndex&&(Te.progress=100)}),c.value=t.startStoryIndex+1,g.value=c.value),d.value=[...Ce]}},{immediate:!0}),n.watch(()=>r.value,ee=>{ee&&M()},{flush:"post"}),n.watch(()=>h.value,ee=>{ee&&(cv()?(ee.addEventListener("touchstart",ue),ee.addEventListener("touchend",Y)):(ee.addEventListener("mousedown",ue),ee.addEventListener("mouseup",Y)))},{flush:"post"});function M(){l.value=new zs("#video-plyr",{controls:[],autoplay:!0,playsinline:!0}),l.value.on("loadeddata",se(l.value)),l.value.on("timeupdate",oe()),W(T.value),l.value.isDestroyed=!1}function W(){T.value.isHls?j(T.value):l.value&&(l.value.source={type:"video",sources:[{src:T.value.url,type:"video/mp4"}]})}function j(ee){if(r.value)if(ds.isSupported()){r.value.src=null;let Ce=new ds;Ce.loadSource(ee.url),Ce.attachMedia(r.value)}else l.value.source={type:"video",sources:[{src:ee.url,type:"video/mp4"}]}}function se(){const ee=document.querySelector(".plyr__video-wrapper");return ee&&(w.value=ee.getBoundingClientRect()),()=>{l.value.duration>0&&(l.value.currentTime=T.value.startTime||0,l.value.muted=!1,l.value.play(),e("video-play",T.value))}}function oe(){return xe(),()=>{T.value.currentTime=l.value.currentTime,T.value.progress=(l.value.currentTime-T.value.startTime)/T.value.duration*100,(l.value.currentTime-T.value.startTime)/T.value.duration*100===0?X()&&(m.value=!0):X()&&(m.value=!1),(l.value.currentTime-T.value.startTime)/T.value.duration*100<0?E.value&&!X()&&(E.value.style="display: none",b.value="100%"):E.value&&!X()&&(E.value.style="display: block",b.value="auto"),l.value.currentTime>=T.value.endTime&&(l.value.pause(),ne())}}function ne(ee=1){const Ce=c.value+ee;Ce<0?t.isFirstGameStories?l.value&&(l.value.currentTime=T.value.startTime):he("right",T.value):Ce===d.value.length?t.isLastGameStories?K():he("left",T.value):(c.value=Ce,ee===1&&(g.value=c.value))}function de(){u.value>f.value?he("left",T.value):u.value<f.value?he("right",T.value):J()}function he(ee,Ce){e("last-story-index",g.value),e("swipe",{direction:ee,currentPlay:Ce})}function J(){const ee=window.innerWidth/2,Ce=u.value<ee,Te=T.value.progress;T.value.progress=Ce?0:100,l.value.pause(),e("video-next-back",{eventName:Ce?"stories_video_anterior":"stories_video_siguiente",currentPlay:{...T.value,progress:Te}}),ne(Ce?-1:1)}function K(){l.value.pause(),l.value.muted=!0,e("last-story-index",g.value),e("close",T.value)}function ue(ee){u.value=ee.changedTouches?ee.changedTouches[0].clientX:ee.clientX}function Y(ee){f.value=ee.changedTouches?ee.changedTouches[0].clientX:ee.clientX,de()}function X(){return/iPhone|iPad/i.test(navigator.userAgent)}function re(){window.scrollTo(0,100)}function ye(){if(window.scrollTo(0,100),Qo()=="android"){const ee=document.querySelector("#stories");ee.requestFullscreen(ee)}}function xe(){if(window.ResizeObserver)S.value=new window.ResizeObserver(()=>{x.value&&w.value.height>0&&(x.value.getBoundingClientRect().height>610?y.value="auto":y.value="100dvh",x.value.getBoundingClientRect().height>610?b.value="100%":b.value="auto")}),S.value.observe(x.value);else throw new Error("Resize observer not supported!")}return n.onMounted(()=>{p.value=document.documentElement.scrollTop||document.body.scrollTop,window.scrollTo(0,100),X()?(window.addEventListener("resize",re),re()):(window.addEventListener("orientationchange",ye),ye()),setTimeout(()=>{xe()},500)}),n.onBeforeUnmount(()=>{window.scrollTo(0,p.value),X()?window.removeEventListener("resize",re):(Qo()=="android"&&document.exitFullscreen(),window.removeEventListener("orientationchange",ye)),S.value&&(S.value.disconnect(),S.value=null)}),(ee,Ce)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["stories",X()?"stories-safe-areas-iphone":""]),id:"stories",ref_key:"eStories",ref:x,style:n.normalizeStyle(R.value)},[n.createElementVNode("div",{class:n.normalizeClass(["stories__close",X()?"stories-safe-areas-iphone":""]),onClick:K},WP,2),n.createElementVNode("div",KP,[n.createElementVNode("div",qP,[n.createElementVNode("div",YP,[n.createElementVNode("div",{class:"circle-item-home",style:n.normalizeStyle(`background-image: url(${T.value.thumbnail.logoHomeTeam})`)},null,4),n.createElementVNode("div",{class:"circle-item-away",style:n.normalizeStyle(`background-image: url(${T.value.thumbnail.logoAwayTeam})`)},null,4)]),n.createElementVNode("div",JP,n.toDisplayString(T.value.header.label),1)]),n.createElementVNode("div",{ref_key:"overlay",ref:h,class:"stories__content__overlay"},null,512),n.createElementVNode("div",XP,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,(Te,Fe)=>(n.openBlock(),n.createElementBlock("div",{key:Fe,class:"stories__content__stories-bar__item"},[n.createElementVNode("div",{class:"stories__content__stories-bar__item__progress",style:n.normalizeStyle({width:`${Te.progress}%`})},null,4)]))),128))]),n.createElementVNode("div",ZP,[n.createElementVNode("div",{class:"stories__content__video__info",ref_key:"videoInfo",ref:E},[n.createElementVNode("div",QP,n.toDisplayString(T.value.date),1),n.createElementVNode("div",eO,n.toDisplayString(T.value.data),1)],512),n.createElementVNode("video",{ref_key:"player",ref:r,id:"video-plyr",controls:"",preload:"auto","data-setup":"{}",playsinline:""},null,512)])]),B.value?(n.openBlock(),n.createElementBlock("button",{key:0,id:"btn_play_ios",style:n.normalizeStyle(m.value?"display:block":"display:none"),onClick:L},null,4)):n.createCommentVNode("",!0)],6))}},[["__scopeId","data-v-bf69d301"]]),sO={playlist_id:"GPI_default2022-12-08T02:51:56.334+00:00-PI-0",last_played_index:0,group_id:"1",total_plays:55,playlist_type:"1",group_playlist_id:"GPI_default2022-12-08T02:51:56.334+00:00",user_id:"goltesting",created_at:"2023-03-30T15:42:36.402+00:00",playlist:[[136731235,"Liga MX","Apertura 2022",69929,"Aldrete Rodriguez, Adrian","Quintero Huitron, Daniel","Estadio Ol&iacute;mpico Universitario, Ciudad de M&eacute;xico.","1 - 0","1 - 0","2022-07-17T05:00:00.000Z","Universidad Nacional","https://az755631.vo.msecnd.net/teams-80/11.png","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png",12,"Goals",1259,1278,20,1266,"https://golstatsbets.blob.core.windows.net/video-player/69929_1.mp4"],[139820484,"Liga MX","Apertura 2022",70042,"Davila Zavala, Victor","Mejia, Oscar ","Estadio Nuevo Monumental, Rafaela.","3 - 1","1 - 0","2022-09-18T05:00:00.000Z","Leon","https://az755631.vo.msecnd.net/teams-80/173.png","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png",12,"Goals",1501,1524,24,1512,"https://golstatsbets.blob.core.windows.net/video-player/70042_1.mp4"],[139566427,"Liga MX","Apertura 2022",69989,"Zaldivar Caviedes, Angel","Guerrero Ramirez, Fernando","Estadio Akron, Zapopan.","1 - 4","1 - 0","2022-09-13T05:00:00.000Z","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png",12,"Goals",6569,6588,108,6576,"https://golstatsbets.blob.core.windows.net/video-player/69989_1.mp4"],[139441913,"Liga MX","Apertura 2022",70031,"Vega Rojas, Alexis","Quintero Huitron, Daniel","Estadio Akron, Zapopan.","1 - 0","1 - 0","2022-09-10T05:00:00.000Z","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png","Puebla FC","https://az755631.vo.msecnd.net/teams-80/10.png",12,"Goals",6207,6237,103,6225,"https://golstatsbets.blob.core.windows.net/video-player/70031_1.mp4"],[139566063,"Liga MX","Apertura 2022",69989,"Guzman Palomeque, Nahuel","Guerrero Ramirez, Fernando","Estadio Akron, Zapopan.","1 - 4","0 - 0","2022-09-13T05:00:00.000Z","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png",39,"Saves",2554,2573,41,2561,"https://golstatsbets.blob.core.windows.net/video-player/69989_1.mp4"],[138276096,"Liga MX","Apertura 2022",69983,"Cortizo de la Piedra, Jordi","Guerrero Ramirez, Fernando","Estadio Cuauhtemoc, Puebla.","2 - 2","1 - 0","2022-08-16T05:00:00.000Z","Puebla FC","https://az755631.vo.msecnd.net/teams-80/10.png","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png",12,"Goals",5020,5046,83,5034,"https://golstatsbets.blob.core.windows.net/video-player/69983_1.mp4"],[139285589,"Liga MX","Apertura 2022",70021,"Cortizo de la Piedra, Jordi","Escobedo, Adonai","Estadio Cuauhtemoc, Puebla.","2 - 2","1 - 0","2022-09-07T05:00:00.000Z","Puebla FC","https://az755631.vo.msecnd.net/teams-80/10.png","Pachuca","https://az755631.vo.msecnd.net/teams-80/9.png",12,"Goals",1123,1152,18,1140,"https://golstatsbets.blob.core.windows.net/video-player/70021_1.mp4"],[139294964,"Liga MX","Apertura 2022",70022,"Cordova Reyes, Francisco","Ortiz Nava, Marco Antonio","Estadio Universitario, San Nicol&aacute;s de los Garza.","3 - 1","1 - 0","2022-09-07T05:00:00.000Z","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png",12,"Goals",2564,2583,41,2571,"https://golstatsbets.blob.core.windows.net/video-player/70022_1.mp4"],[137782451,"Liga MX","Apertura 2022",69968,"Orrantia Trevino, Carlos","Macias Romo, Oscar","Estadio TSM Corona, Torre&oacute;n.","4 - 0","1 - 0","2022-08-06T05:00:00.000Z","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png",12,"Goals",4662,4693,77,4681,"https://golstatsbets.blob.core.windows.net/video-player/69968_1.mp4"],[136551560,"Liga MX","Apertura 2022",69924,"Sanchez Guerrero, Richard","Escobedo, Adonai","Estadio Azteca, Ciudad de M&eacute;xico.","1 - 0","1 - 0","2022-07-13T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png",12,"Goals",7032,7064,116,7052,"https://golstatsbets.blob.core.windows.net/video-player/69924_1.mp4"],[136391881,"Liga MX","Apertura 2022",69914,"Hurtado Herrera, Aviles","Ramos Palazuelos, Cesar","Estadio Hidalgo, Pachuca.","2 - 0","1 - 0","2022-07-04T05:00:00.000Z","Pachuca","https://az755631.vo.msecnd.net/teams-80/9.png","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png",12,"Goals",4903,4937,81,4925,"https://golstatsbets.blob.core.windows.net/video-player/69914_1.mp4"],[138158049,"Liga MX","Apertura 2022",69979,"Volpi, Tiago Luis","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de M&eacute;xico.","2 - 3","0 - 1","2022-08-14T05:00:00.000Z","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png",39,"Saves",7207,7226,119,7214,"https://golstatsbets.blob.core.windows.net/video-player/69979_1.mp4"],[138124884,"Liga MX","Apertura 2022",69978,"Vargas Gil, Camilo","Ortiz Nava, Marco Antonio","Default","1 - 1","0 - 0","2022-08-13T05:00:00.000Z","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png",39,"Saves",6080,6099,100,6087,"https://golstatsbets.blob.core.windows.net/video-player/69978_1.mp4"],[139635463,"Liga MX","Apertura 2022",69950,"Fidalgo Fernandez, Alvaro","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de M&eacute;xico.","3 - 3","0 - 2","2022-09-14T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",10,"Assists",7096,7123,118,7111,"https://golstatsbets.blob.core.windows.net/video-player/69950_1.mp4"],[139769221,"Liga MX","Apertura 2022",70039,"Ochoa Magana, Guillermo","Escobedo, Adonai","Estadio Azteca, Ciudad de M&eacute;xico.","2 - 1","0 - 0","2022-09-17T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png",39,"Saves",4567,4586,76,4574,"https://golstatsbets.blob.core.windows.net/video-player/70039_1.mp4"],[139405626,"Liga MX","Apertura 2022",70028,"Acevedo Lopez, Carlos","Santander, Luis Enrique","Estadio La Corregidora, Quer&eacute;taro.","3 - 3","0 - 2","2022-09-10T05:00:00.000Z","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",55,"Goals",7452,7471,124,7459,"https://golstatsbets.blob.core.windows.net/video-player/70028_1.mp4"],[139410464,"Liga MX","Apertura 2022",70030,"Gonzalez Vela Alvizu, Julio","Hernandez Gomez, Fernando","Estadio Nemesio Diez, Toluca.","2 - 2","0 - 1","2022-09-10T05:00:00.000Z","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png","Universidad Nacional","https://az755631.vo.msecnd.net/teams-80/11.png",55,"Goals",7467,7486,124,7474,"https://golstatsbets.blob.core.windows.net/video-player/70030_1.mp4"],[139902797,"Liga MX","Apertura 2022",70038,"Quinones Quinones, Julian","Ortiz Nava, Marco Antonio","Estadio BBVA Bancomer, Guadalupe","2 - 0","0 - 0","2022-09-17T05:00:00.000Z","Rayados de Monterrey","https://az755631.vo.msecnd.net/teams-80/7.png","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png",702,"Con enfrentamiento",2334,2353,38,2341,"https://golstatsbets.blob.core.windows.net/video-player/70038_1.mp4"],[139771860,"Liga MX","Apertura 2022",70038,"Andrada, Esteban ","Ortiz Nava, Marco Antonio","Estadio BBVA Bancomer, Guadalupe","2 - 0","0 - 0","2022-09-17T05:00:00.000Z","Rayados de Monterrey","https://az755631.vo.msecnd.net/teams-80/7.png","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png",39,"Saves",6859,6878,113,6866,"https://golstatsbets.blob.core.windows.net/video-player/70038_1.mp4"],[136392028,"Liga MX","Apertura 2022",69914,"Hurtado Herrera, Aviles","Ramos Palazuelos, Cesar","Estadio Hidalgo, Pachuca.","2 - 0","0 - 0","2022-07-04T05:00:00.000Z","Pachuca","https://az755631.vo.msecnd.net/teams-80/9.png","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png",607,"Oportunidad de gol",335,374,5,342,"https://golstatsbets.blob.core.windows.net/video-player/69914_1.mp4"],[136467302,"Liga MX","Apertura 2022",69909,"Jurado Roca, Sebastian","Mejia, Oscar ","Estadio Universitario, San Nicol&aacute;s de los Garza.","2 - 3","0 - 0","2022-07-02T05:00:00.000Z","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png",39,"Saves",879,898,14,886,"https://golstatsbets.blob.core.windows.net/video-player/69909_1.mp4"],[138402354,"Liga MX","Apertura 2022",69990,"Beltran Cruz, Fernando","Mejia, Oscar ","Estadio Victoria, Aguascalientes.","0 - 4","0 - 1","2022-08-19T05:00:00.000Z","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png","Guadalajara","https://az755631.vo.msecnd.net/teams-80/1.png",12,"Goals",4517,4551,75,4539,"https://golstatsbets.blob.core.windows.net/video-player/69990_1.mp4"],[138157481,"Liga MX","Apertura 2022",69979,"Meneses Villarroel, Jean","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de M&eacute;xico.","2 - 3","0 - 1","2022-08-14T05:00:00.000Z","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png",12,"Goals",1900,1925,31,1913,"https://golstatsbets.blob.core.windows.net/video-player/69979_1.mp4"],[140106188,"Liga MX","Apertura 2022",69964,"Cortizo de la Piedra, Jordi","Escobedo, Adonai","Estadio Cuauhtemoc, Puebla.","2 - 1","1 - 0","2022-09-23T05:00:00.000Z","Puebla FC","https://az755631.vo.msecnd.net/teams-80/10.png","Universidad Nacional","https://az755631.vo.msecnd.net/teams-80/11.png",12,"Goals",461,484,7,472,"https://golstatsbets.blob.core.windows.net/video-player/69964_1.mp4"],[139839994,"Liga MX","Apertura 2022",70043,"Garcia Carpizo, Brian","Montano Robles, Diego","Estadio Caliente, Tijuana.","1 - 1","0 - 1","2022-09-18T05:00:00.000Z","Club Tijuana","https://az755631.vo.msecnd.net/teams-80/17.png","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png",12,"Goals",2112,2133,34,2121,"https://golstatsbets.blob.core.windows.net/video-player/70043_1.mp4"],[139403868,"Liga MX","Apertura 2022",70028,"Suarez, Leonardo Gabriel","Santander, Luis Enrique","Estadio La Corregidora, Quer&eacute;taro.","3 - 3","0 - 1","2022-09-10T05:00:00.000Z","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",12,"Goals",4296,4315,71,4303,"https://golstatsbets.blob.core.windows.net/video-player/70028_1.mp4"],[139371616,"Liga MX","Apertura 2022",70027,"Gallardo Vasconcelos, Jesus","Montano Robles, Diego","Estadio Olimpico Benito Juarez, Ciudad Juarez.","0 - 1","0 - 1","2022-09-09T05:00:00.000Z","FC Juarez","https://az755631.vo.msecnd.net/teams-80/3014.png","Rayados de Monterrey","https://az755631.vo.msecnd.net/teams-80/7.png",12,"Goals",5724,5750,94,5738,"https://golstatsbets.blob.core.windows.net/video-player/70027_1.mp4"],[139294028,"Liga MX","Apertura 2022",70022,"Thauvin, Florian","Ortiz Nava, Marco Antonio","Estadio Universitario, San Nicol&aacute;s de los Garza.","3 - 1","2 - 0","2022-09-07T05:00:00.000Z","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png","Toluca","https://az755631.vo.msecnd.net/teams-80/18.png",12,"Goals",6011,6030,99,6018,"https://golstatsbets.blob.core.windows.net/video-player/70022_1.mp4"],[137023432,"Liga MX","Apertura 2022",69939,"Gignac, Andre Pierre","Ortiz Nava, Marco Antonio","Estadio Universitario, San Nicol&aacute;s de los Garza.","2 - 0","1 - 0","2022-07-23T05:00:00.000Z","Tigres de la UANL","https://az755631.vo.msecnd.net/teams-80/16.png","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png",12,"Goals",2829,2854,47,2842,"https://golstatsbets.blob.core.windows.net/video-player/69939_1.mp4"],[139303531,"Liga MX","Apertura 2022",70023,"Alves da Silva, Daniel","Ramos Palazuelos, Cesar","Estadio Ol&iacute;mpico Universitario, Ciudad de M&eacute;xico.","4 - 1","0 - 0","2022-09-07T05:00:00.000Z","Universidad Nacional","https://az755631.vo.msecnd.net/teams-80/11.png","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png",702,"Con enfrentamiento",262,293,3,278,"https://golstatsbets.blob.core.windows.net/video-player/70023_1.mp4"],[139303334,"Liga MX","Apertura 2022",70023,"Alves da Silva, Daniel","Ramos Palazuelos, Cesar","Estadio Ol&iacute;mpico Universitario, Ciudad de M&eacute;xico.","4 - 1","0 - 0","2022-09-07T05:00:00.000Z","Universidad Nacional","https://az755631.vo.msecnd.net/teams-80/11.png","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png",10,"Assists",5256,5283,87,5271,"https://golstatsbets.blob.core.windows.net/video-player/70023_1.mp4"],[139633795,"Liga MX","Apertura 2022",69950,"Valdes Contreras, Diego","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de M&eacute;xico.","3 - 3","0 - 1","2022-09-14T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",607,"Oportunidad de gol",675,701,10,689,"https://golstatsbets.blob.core.windows.net/video-player/69950_1.mp4"],[139242728,"Liga MX","Apertura 2022",70020,"Valdes Contreras, Diego","Caceres Hernandez, Victor Alfonso","Estadio Azteca, Ciudad de M&eacute;xico.","3 - 0","0 - 0","2022-09-06T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","CA San Luis","https://az755631.vo.msecnd.net/teams-80/13.png",10,"Assists",2841,2861,46,2849,"https://golstatsbets.blob.core.windows.net/video-player/70020_1.mp4"],[138747150,"Liga MX","Apertura 2022",7e4,"Valdes Contreras, Diego","Miranda Galindo, Erick Yair","Default","1 - 3","0 - 1","2022-08-26T05:00:00.000Z","Mazatlan FC","https://az755631.vo.msecnd.net/teams-80/8.png","America","https://az755631.vo.msecnd.net/teams-80/2.png",12,"Goals",2425,2448,39,2436,"https://golstatsbets.blob.core.windows.net/video-player/70000_1.mp4"],[138462163,"Liga MX","Apertura 2022",69995,"Valdes Contreras, Diego","Santander, Luis Enrique","Estadio Azteca, Ciudad de M&eacute;xico.","7 - 0","1 - 0","2022-08-20T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png",12,"Goals",3424,3443,56,3431,"https://golstatsbets.blob.core.windows.net/video-player/69995_1.mp4"],[138832474,"Liga MX","Apertura 2022",70005,"Sambueza, Rubens Oscar","Guerrero Ramirez, Fernando","Estadio TSM Corona, Torre&oacute;n.","4 - 1","1 - 1","2022-08-28T05:00:00.000Z","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png","CA San Luis","https://az755631.vo.msecnd.net/teams-80/13.png",12,"Goals",6830,6859,113,6847,"https://golstatsbets.blob.core.windows.net/video-player/70005_1.mp4"],[137178428,"Liga MX","Apertura 2022",69942,"Ibarra Mina, Alex Renato","Montano Robles, Diego","Estadio Jalisco, Guadalajara.","1 - 2","0 - 1","2022-07-26T05:00:00.000Z","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png","Club Tijuana","https://az755631.vo.msecnd.net/teams-80/17.png",12,"Goals",2786,2811,45,2799,"https://golstatsbets.blob.core.windows.net/video-player/69942_1.mp4"],[138339473,"Liga MX","Apertura 2022",69985,"Canelo, Pedro Alexis","Referee 1","Azteca","1 - 2","0 - 0","2022-08-17T05:00:00.000Z","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png","Club Tijuana","https://az755631.vo.msecnd.net/teams-80/17.png",10,"Assists",5133,5159,85,5147,"https://golstatsbets.blob.core.windows.net/video-player/69985_1.mp4"],[136701989,"Liga MX","Apertura 2022",69927,"Gimenez, Santiago Tomas","Macias Romo, Oscar","Estadio Jalisco, Guadalajara.","3 - 2","0 - 1","2022-07-16T05:00:00.000Z","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png",12,"Goals",1374,1397,22,1385,"https://golstatsbets.blob.core.windows.net/video-player/69927_1.mp4"],[139678329,"Liga MX","Apertura 2022",70049,"Antuna Romero, Carlos","Ortiz Nava, Marco Antonio","Estadio Azteca, Ciudad de M&eacute;xico.","2 - 1","0 - 0","2022-09-15T05:00:00.000Z","Cruz Azul","https://az755631.vo.msecnd.net/teams-80/5.png","Leon","https://az755631.vo.msecnd.net/teams-80/173.png",10,"Assists",6728,6752,111,6740,"https://golstatsbets.blob.core.windows.net/video-player/70049_1.mp4"],[139054131,"Liga MX","Apertura 2022",70010,"Davila Zavala, Victor","Ortiz Nava, Marco Antonio","Estadio Victoria, Aguascalientes.","3 - 2","1 - 1","2022-09-02T05:00:00.000Z","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png","Leon","https://az755631.vo.msecnd.net/teams-80/173.png",12,"Goals",6636,6661,110,6649,"https://golstatsbets.blob.core.windows.net/video-player/70010_1.mp4"],[137503273,"Liga MX","Apertura 2022",69962,"Davila Zavala, Victor","Macias Romo, Oscar","Estadio Nou Camp, Le&ocuate;n.","3 - 2","1 - 0","2022-07-31T05:00:00.000Z","Leon","https://az755631.vo.msecnd.net/teams-80/173.png","America","https://az755631.vo.msecnd.net/teams-80/2.png",12,"Goals",1940,1965,31,1953,"https://golstatsbets.blob.core.windows.net/video-player/69962_1.mp4"],[139308851,"Liga MX","Apertura 2022",70025,"Benedetti Roa, Nicolas","Hernandez Gomez, Fernando","Default","1 - 0","1 - 0","2022-09-07T05:00:00.000Z","Mazatlan FC","https://az755631.vo.msecnd.net/teams-80/8.png","Atlas","https://az755631.vo.msecnd.net/teams-80/4.png",12,"Goals",1867,1891,31,1879,"https://golstatsbets.blob.core.windows.net/video-player/70025_1.mp4"],[138116335,"Liga MX","Apertura 2022",69976,"Benedetti Roa, Nicolas","Galvan Basulto, Eduardo","Estadio Nou Camp, Le&ocuate;n.","0 - 3","0 - 1","2022-08-13T05:00:00.000Z","Leon","https://az755631.vo.msecnd.net/teams-80/173.png","Mazatlan FC","https://az755631.vo.msecnd.net/teams-80/8.png",12,"Goals",591,629,9,617,"https://golstatsbets.blob.core.windows.net/video-player/69976_1.mp4"],[136791022,"Liga MX","Apertura 2022",69932,"Benedetti Roa, Nicolas","Camacho Peregrina, Jorge","Estadio Hidalgo, Pachuca.","1 - 1","0 - 1","2022-07-18T05:00:00.000Z","Pachuca","https://az755631.vo.msecnd.net/teams-80/9.png","Mazatlan FC","https://az755631.vo.msecnd.net/teams-80/8.png",12,"Goals",4284,4315,71,4303,"https://golstatsbets.blob.core.windows.net/video-player/69932_1.mp4"],[139414938,"Liga MX","Apertura 2022",70026,"Batista Ochoa, Facundo","Guerrero Ramirez, Fernando","Estadio Victoria, Aguascalientes.","1 - 2","1 - 0","2022-09-10T05:00:00.000Z","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png","America","https://az755631.vo.msecnd.net/teams-80/2.png",12,"Goals",461,490,7,478,"https://golstatsbets.blob.core.windows.net/video-player/70026_1.mp4"],[139051051,"Liga MX","Apertura 2022",70010,"Batista Ochoa, Facundo","Ortiz Nava, Marco Antonio","Estadio Victoria, Aguascalientes.","3 - 2","1 - 0","2022-09-02T05:00:00.000Z","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png","Leon","https://az755631.vo.msecnd.net/teams-80/173.png",12,"Goals",2731,2750,45,2738,"https://golstatsbets.blob.core.windows.net/video-player/70010_1.mp4"],[137828273,"Liga MX","Apertura 2022",69970,"Batista Ochoa, Facundo","Galvan Basulto, Eduardo","Estadio Alfonso Lastras Ram&iacute;rez, San Luis Potos&iacute;.","1 - 2","0 - 1","2022-08-07T05:00:00.000Z","CA San Luis","https://az755631.vo.msecnd.net/teams-80/13.png","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png",12,"Goals",849,870,13,858,"https://golstatsbets.blob.core.windows.net/video-player/69970_1.mp4"],[139025773,"Liga MX","Apertura 2022",70009,"Nahuelpan Osten, Ariel","Lopez Penuelas, Ismael","Estadio La Corregidora, Quer&eacute;taro.","1 - 1","1 - 0","2022-09-01T05:00:00.000Z","Queretaro","https://az755631.vo.msecnd.net/teams-80/12.png","Puebla FC","https://az755631.vo.msecnd.net/teams-80/10.png",12,"Goals",1454,1481,24,1472,"https://golstatsbets.blob.core.windows.net/video-player/70009_1.mp4"],[138063913,"Liga MX","Apertura 2022",69973,"Gonzalez Gonzalez, Arturo","Pacheco Larios, Guillermo","Estadio Victoria, Aguascalientes.","1 - 2","0 - 1","2022-08-12T05:00:00.000Z","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png","Rayados de Monterrey","https://az755631.vo.msecnd.net/teams-80/7.png",12,"Goals",6119,6138,101,6126,"https://golstatsbets.blob.core.windows.net/video-player/69973_1.mp4"],[137780455,"Liga MX","Apertura 2022",69966,"Gonzalez Gonzalez, Arturo","Ortiz Nava, Marco Antonio","Estadio BBVA Bancomer, Guadalupe","5 - 1","1 - 0","2022-08-06T05:00:00.000Z","Rayados de Monterrey","https://az755631.vo.msecnd.net/teams-80/7.png","Leon","https://az755631.vo.msecnd.net/teams-80/173.png",12,"Goals",2292,2321,38,2309,"https://golstatsbets.blob.core.windows.net/video-player/69966_1.mp4"],[140090831,"Liga MX","Apertura 2022",69950,"Suarez, Leonardo Gabriel","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de M&eacute;xico.","3 - 3","0 - 1","2022-09-14T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",12,"Goals",585,612,9,600,"https://golstatsbets.blob.core.windows.net/video-player/69950_1.mp4"],[140090832,"Liga MX","Apertura 2022",69950,"Suarez, Leonardo Gabriel","Hernandez Gomez, Fernando","Estadio Azteca, Ciudad de M&eacute;xico.","3 - 3","0 - 2","2022-09-14T05:00:00.000Z","America","https://az755631.vo.msecnd.net/teams-80/2.png","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png",12,"Goals",1175,1197,18,1182,"https://golstatsbets.blob.core.windows.net/video-player/69950_1.mp4"],[139227464,"Liga MX","Apertura 2022",70018,"Suarez, Leonardo Gabriel","Quintero Huitron, Daniel","Estadio TSM Corona, Torre&oacute;n.","3 - 1","1 - 0","2022-09-06T05:00:00.000Z","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png","Necaxa","https://az755631.vo.msecnd.net/teams-80/205.png",12,"Goals",7011,7034,116,7022,"https://golstatsbets.blob.core.windows.net/video-player/70018_1.mp4"],[138830649,"Liga MX","Apertura 2022",70005,"Suarez, Leonardo Gabriel","Guerrero Ramirez, Fernando","Estadio TSM Corona, Torre&oacute;n.","4 - 1","1 - 0","2022-08-28T05:00:00.000Z","Santos Laguna","https://az755631.vo.msecnd.net/teams-80/14.png","CA San Luis","https://az755631.vo.msecnd.net/teams-80/13.png",12,"Goals",4297,4380,71,4304,"https://golstatsbets.blob.core.windows.net/video-player/70005_1.mp4"]]},aO=new Map([[1,45],[2,90],[3,105],[4,120]]),nO=[{id:12,name:"Gol"},{id:55,name:"Gol"},{id:39,name:"Atajada"},{id:10,name:"Asistencia"},{id:702,name:"1vs1 exitoso ofensivo"},{id:607,name:"Oportunidad de gol"}].reduce((s,e)=>(s.set(e.id,e.name),s),new Map);let Pa=null,xi=null,vi="";const Vt=T3(),iO={components:{GSCSeasonSelect:EI,GSCTournamentSelect:eI,GSCGames:Pv,GSCSlider:ra,GSCGridTeamsMatches:vy,GSCPlayersLanding:Sy,GSCTops:DA,GSCTableCalendar:ZC,DiscoverVideos:k3,CarouselFullScreen:xL,Stories:tO},setup(){const s=n.ref("landingref"),{elementSize:e}=sy(s);return{landingref:s,elementSize:e}},props:{currentSeasonId:{type:Number,default:0},isFemale:{type:Boolean,default:!1},showStories:{type:Boolean,default:!0},season:{type:Number,default:1772},isplayer:{type:Boolean,default:!1},user:{type:Object,default:()=>{}},privileges:{type:Object,default:()=>{}},team:{type:Number,default:0},player:{type:Number,default:0},gamesPerMatchDay:{type:Number,default:0,validator(s){return!Number.isNaN(s)&&s>=0}},token:{type:String,default:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MCwibmFtZSI6IlVzdWFyaW8gRnJlZSIsInVzZXJuYW1lIjoiZnJlZUBnb2xzdGF0cy5jb20iLCJlbWFpbCI6ImZyZWVAZ29sc3RhdHMuY29tIiwiaWF0IjoxNjA2NzU4Nzk1LCJleHAiOjE2MzgyOTQ3OTV9.kPNmP7yDtk38cAXrUyc7OHRh6J25VFqy-XUNzbK-4YE"},tournamentsApiUrl:{type:String,default:""},defaultMediaPlayerSeason:{type:Number,default:0},checkLiveGamesIntervalMinutes:{type:Number,default:2}},data(){return{isPreviousDataLoaded:!1,imagesUrl:eu(),roundAbbreviationByGameId:new Map,isCarouselFullScreenVisible:!1,isPlaySeeker:!1,keyupdate:0,carouselPlayerQueue:[],gameEventsUrl:"https://al2nv2dmkc.execute-api.us-west-2.amazonaws.com/prod/mxm/",defaultGameId:0,lastSeasonsIds:[],arrayGamesAdd:[],gamesPages:new Map,show_stories:!0,selectedRoundKeyIndex:0,currentStoriesLastIndex:0,selectedRoundKeyIndexVideo:0,selectedRound:"0",selectedRoundVideos:"0",isLeagueSelected:!0,fullTournamentScheduleFull:[],fullTournamentScheduleFullGoals:[],defaultMatchDayKey:null,isCupTournament:!1,retries:3,userTeamGames:[],userTeamGamesForVideos:[],isCupLegacyTournament:!1,tournamentScheduleKeys:[],tournamentScheduleKeysByKey:new Map,tournamentScheduleKeysGoals:[],currentTournamentGames:null,currentTournamentTeams:null,gamesUrl:"https://qyyibs1w0d.execute-api.us-west-2.amazonaws.com/prod/calendar/gamesBySeason/",gamesUrl2:"https://qyyibs1w0d.execute-api.us-west-2.amazonaws.com/prod/calendar/gamesBySeason?",seasonSelected:{},seasonSelectedDropDowns:{},seasonsSelected:[],gamesAllStories:[],fullTournamentSchedule:{},tournamentSelected:{id:0},tournamentType:0,tournamentSelectedDropDowns:{seasons:[]},playersLength:0,playersLengthRival:0,nextRivalId:0,updateTableCalendar:0,loadDiscover:!1,hasNextRival:!1,resumeType:1,goalsType:2,is_public:!1,seasonsGamesMap:new Map,gamesOfTheDayPreMatchIds:new Set,seasonsForLiveGames:[],allLiveGames:[],storiesItems:[],currentStories:[],currentStoryIndex:null,isStoriesVisible:!1,seasonPlayersMap:new Map,currentTournaments:[]}},computed:{teamSelected(){return this.user.is_generic||this.tournamentSelected.id!==this.user.tournament?0:this.user.team},teamRival(){return Object.keys(this.fullTournamentSchedule).length>0?this.user.team==this.fullTournamentSchedule.data.prematch.home_team?this.fullTournamentSchedule.data.prematch.visiting_team:this.fullTournamentSchedule.data.prematch.home_team:0},isGenericLike(){return this.user.is_generic||this.tournamentSelected.id!==this.user.tournament},isPlaySeekerAvailable(){return[34230,34178,34201].includes(this.user.id)},games(){if(!this.isGenericLike&&!this.isLeagueSelected)return this.fullTournamentSchedule;{const s=this.gamesPages.get(this.selectedRound);return s&&s[0]?s[0].sort((e,t)=>{let a=e.dateTimeMillis,i=t.dateTimeMillis;return e.is_live&&(a-=1e9),t.is_live&&(i-=1e9),a-i}):[]}},latestRound(){return this.userTeamGames&&this.userTeamGames.length&&this.fullTournamentScheduleFullGoals&&this.fullTournamentScheduleFullGoals.length?this.getUserTeamClosestRound(this.fullTournamentScheduleFullGoals):this.getNormalClosestRound(this.fullTournamentScheduleFullGoals)},closestRound(){return this.userTeamGames&&this.userTeamGames.length?this.getUserTeamClosestRound(this.fullTournamentScheduleFull):this.getNormalClosestRound(this.fullTournamentScheduleFull)},closestRoundVideos(){return this.userTeamGames&&this.userTeamGames.length?this.getUserTeamClosestRound(this.fullTournamentScheduleFullGoals,!0):this.getNormalClosestRound(this.fullTournamentScheduleFullGoals,!0)},containerGridCalendarTable(){return this.elementSize.width<=1e3?"container-grid-calendar-table-mobile":"container-grid-calendar-table"},containerbackground(){return this.elementSize.width<=680?"container-background-movil":"container-background"},containerdata(){return this.elementSize.width<=680?"container-data-movil":"container-data"}},watch:{games:{immediate:!0,deep:!0,async handler(s){if(s&&s.length>0){if(!this.seasonsSelected.length)return;for(let t=0;t<s.length;t++){const a=this.gamesAllStories.findIndex(i=>i.game_id===s[t].game_id);a!==-1&&(this.gamesAllStories[a].is_live=s[t].is_live,this.gamesAllStories[a].game_status=s[t].game_status)}const e=s.filter(t=>t.is_live);for(let t=0;t<e.length;t++){const a=this.gamesAllStories.findIndex(i=>i.game_id===e[t].game_id);if(a!==-1)this.gamesAllStories[a].score=e[t].score;else{this.gamesAllStories.push(e[t]),this.gamesAllStories=this.ordenarYFiltrarPartidos(this.gamesAllStories);let i=[];for(let o=0;o<this.gamesAllStories.length;o++)this.arrayGamesAdd.findIndex(r=>r.game_id===this.gamesAllStories[o].game_id)===-1?i.push({game_id:this.gamesAllStories[o].game_id,last_index:0,status:1}):i.push({game_id:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(r=>r.game_id===this.gamesAllStories[o].game_id)].game_id,last_index:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(r=>r.game_id===this.gamesAllStories[o].game_id)].last_index,status:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(r=>r.game_id===this.gamesAllStories[o].game_id)].status});this.arrayGamesAdd=i,await Ae.post(vi,{stories:this.arrayGamesAdd},{headers:{Authorization:`${this.token}`,"Content-Type":"application/json"}});for(let o=0;o<this.arrayGamesAdd.length;o++)this.gamesAllStories.findIndex(r=>r.game_id===this.arrayGamesAdd[o].game_id)!==-1&&(this.gamesAllStories[this.gamesAllStories.findIndex(r=>r.game_id===this.arrayGamesAdd[o].game_id)].index=this.arrayGamesAdd[o].last_index,this.gamesAllStories[this.gamesAllStories.findIndex(r=>r.game_id===this.arrayGamesAdd[o].game_id)].status_storie=this.arrayGamesAdd[o].status)}}}}},"allLiveGames.length":{handler(s){s.length===0&&this.resetGamesLiveInterval()}},privileges:{immediate:!0,deep:!0,async handler(s){this.is_public=s!==null}},team:{immediate:!0,deep:!0,async handler(s){s&&this.seasonsSelected.length&&setTimeout(()=>{this.fetchGames(s,this.seasonsSelected)},1e3)}},closestRound(s){this.selectedRoundKeyIndex=this.tournamentScheduleKeys.findIndex(e=>e===s),this.selectedRound=s},latestRound(s){this.selectedRoundKeyIndexVideo=this.tournamentScheduleKeysGoals.findIndex(e=>e===s),this.selectedRoundVideos=s},isCarouselFullScreenVisible:{handler(s){document.getElementsByTagName("html")[0].style.overflow=s?"hidden":"auto"},immediate:!0}},methods:{getOnlyGamesWithGoals(s){return Object.entries(s).reduce((e,[t,a])=>{const i=a.reduce((o,r)=>{const l=r.games.filter(d=>(d.is_live||d.game_status!==4)&&d.score[0]+d.score[1]>0);return l.length&&o.push({...r,games:l}),o},[]);return i.length&&(e[t]=i),e},{})},async onClickPlaySeeker(){try{const e=await(await fetch("https://rhev2kbe0a.execute-api.us-east-2.amazonaws.com/qa/demo/playseeker")).json();this.formatPlaySeekerPlays(e.data||sO)}catch(s){console.error(s)}},formatPlaySeekerPlays(s){let e=[];s&&s.playlist&&s.playlist.length&&(e=s.playlist.reduce((a,i,o)=>{const l={...Object.entries(Vt).reduce((f,[g,m])=>(f[g]=i[m],f),{}),isPlaySeeker:!0,startSeconds:i[Vt.startTime],endSeconds:i[Vt.endTime],totalSeconds:Math.floor(i[Vt.endTime]-i[Vt.startTime]),payloadData:{play_id:i[Vt.playId],total_plays:s.total_plays,play_number:o+1,group_playlist_id:s.group_playlist_id,playlist_id:s.playlist_id,group_id:s.group_id,moment_of_play:i[Vt.momentOfPlay],play_type:i[Vt.categoryId],viewer_second_start:Math.floor(i[Vt.startTime]),intended_second_start:Math.floor(i[Vt.startTime]),intended_second_end:Math.floor(i[Vt.endTime]),latitude_of_user:null,longitude_of_user:null}},[d,c]=l.playerName.split(","),h=d.split(" ");let u="";for(const f of h)if(u+=` ${f}`,f.length>3)break;if(l.playerShortName=c&&d?`${c.trim().charAt(0)}.${u}`:"",!l.mainCategoryName){const[f,g]=l.finalScore.split(" - ");l.arrayScore=[Number(f),Number(g)]}return l.categoryName=nO.get(l.categoryId),a.push(l),a},[]));let t=[];t=e,this.carouselPlayerQueue=t,this.isPlaySeeker=!0,this.isCarouselFullScreenVisible=!0},formatUsername(s){const e=s.split(",");let t="",a="";return e[1]?(a=e[1].trim().split(" "),a[0]?t=a[0]:t=e[1]):e[0]&&(a=e[0].trim().split(" "),a[0]?t=a[0]:t=e[0]),t.trim()},async fetchGameEvents(s){try{return(await Ae.get(`${this.gameEventsUrl}${s}`,{headers:{Authorization:`${this.token}`}})).data}catch(e){throw new Error(e)}},async fetchLiveGames(){try{if(this.seasonsForLiveGames.length===0)return[];const s=this.seasonsForLiveGames.reduce((a,i)=>`${a}seasons=${i}&`,""),e=Ae.create({headers:{Authorization:`${this.token}`}}),{data:t}=await e.get(`https://qyyibs1w0d.execute-api.us-west-2.amazonaws.com/prod/calendar/gamesBySeason/lives?${s}`);return t}catch(s){throw new Error(s)}},async onClickOpenCarouselVideos(s){try{this.isPlaySeeker=!1;const t=(await this.fetchGameEvents(s)).plays;this.carouselPlayerQueue=t.filter(a=>a.event_type_id===1&&a.video_link!=="-"),this.isCarouselFullScreenVisible=!0}catch(e){throw new Error(e)}},onChangeMatchDayGames(s){this.selectedRound!==s.key&&(this.selectedRound=s.key)},onClickStory({item:s,index:e}){this.openStory(e),this.onClickStories(s)},onClickLive(){const s=this.allLiveGames[0];if(s){const e=this.seasonsGamesMap.get(s.game_id);e&&(this.selectedRound=e.roundAbbreviationV2)}},onClickCloseCarousel(){this.carouselPlayerQueue=[],this.isPlaySeeker=!1,this.isCarouselFullScreenVisible=!1},onChangeIsLeagueSelected(s){console.log("holala isLeagueSelected",s),this.isLeagueSelected=s},onAction(s){this.$emit("action",s)},onOpenMedia(s){s.type===1&&s.gameIds&&s.gameIds.length>0?this.onClickOpenCarouselVideos(s.gameIds[0]):this.$emit("openmedia",s)},onOpenProfile(s){this.$emit("onOpenProfile",s)},onClickMatch(s){this.$emit("openGame",s)},onClickCalendar(){const s={type:this.isGenericLike||this.isLeagueSelected?0:1,team:this.team,season:this.seasonSelected.id};this.$emit("onClickMyCalendar",s)},moreTops(){const s={team:this.team,season:this.seasonSelected.id};this.$emit("openTops",s)},clickProfileBtn(s){this.$emit("openProfile",s)},viewAllRival(){const s={team:Object.keys(this.fullTournamentSchedule).length>0?this.user.team==this.fullTournamentSchedule.data.prematch.home_team?this.fullTournamentSchedule.data.prematch.visiting_team:this.fullTournamentSchedule.data.prematch.home_team:0,season:this.seasonSelected.id};this.$emit("openAllPlayers",s)},viewAll(){const s={team:this.team,season:this.seasonSelected.id};this.$emit("openAllPlayers",s)},getTotalPlayers(s){this.playersLength=s},getTotalPlayersRival(s){this.playersLengthRival=s},clickCard(s){const e={data:s,isPlayer:this.isplayer};this.$emit("clickOnMainCards",e)},async fetchGames(s,e){const t=e.map(i=>`seasons=${i.id}`).join("&"),a=Ae.create({headers:{Authorization:`${this.token}`}});this.fullTournamentSchedule=await a.get(this.gamesUrl+s+"?"+t),this.fullTournamentSchedule.data&&this.fullTournamentSchedule.data.prematch&&(this.fullTournamentSchedule.data.prematch.roundAbbreviationV2=this.roundAbbreviationByGameId.get(this.fullTournamentSchedule.data.prematch.game_id)),this.fullTournamentSchedule.data&&this.fullTournamentSchedule.data.postmatch&&(this.fullTournamentSchedule.data.postmatch.roundAbbreviationV2=this.roundAbbreviationByGameId.get(this.fullTournamentSchedule.data.postmatch.game_id)),this.nextRivalId=Object.keys(this.fullTournamentSchedule).length>0?this.user.team==this.fullTournamentSchedule.data.prematch.home_team?this.fullTournamentSchedule.data.prematch.visiting_team:this.fullTournamentSchedule.data.prematch.home_team:0,this.loadDiscover=!0},generateSeasons(s){const e=[{id:s.id,type:s.type}];return s.related_seasons&&s.related_seasons.length&&e.push(...s.related_seasons.map(t=>({id:t.id,type:t.type}))),e},async onInputTournament(s){this.tournamentSelected=s,this.tournamentType=s.tournament_type,this.tournamentSelected.id&&this.tournamentSelected.id!==s.id&&(this.updateTableCalendar+=1),this.tournamentSelectedDropDowns.id!==s.id&&(this.tournamentSelectedDropDowns=s)},getSeasonDependentPromises({season:s,seasons:e}){const t={headers:{Authorization:`${this.token}`}},a=[Ae.get(`https://ts7thxzaik.execute-api.us-west-2.amazonaws.com/prod/players/seasons/${s.id}`,t)];a.push(this.fetchSeasonsGamesAndTeams(e.map(o=>o.id),3)),a.push(this.fetchStoriesPlays(s));const i=`https://ssh88fgvll.execute-api.us-east-2.amazonaws.com/prod/users/${this.user.id}/seasons/${s.id}/stories`;return i!==vi&&(vi=i,a.push(Ae.get(vi,t))),a},async onInputSeason(s){this.isLeagueSelected=!0;try{if(this.seasonSelected.id!==s.id){this.isPreviousDataLoaded=!1,this.seasonSelected=s,this.seasonsSelected=this.generateSeasons(s);const e=this.getSeasonDependentPromises({season:s,seasons:this.seasonsSelected,retries:3,createdUrl:""}),[t,a,i,o]=await Promise.all(e);this.seasonPlayersMap=new Map,t.data&&t.data.players&&t.data.players.forEach(r=>{this.seasonPlayersMap.set(r.player_id,r)}),o&&o.data?this.arrayGamesAdd=o.data.stories.stories:this.arrayGamesAdd=[],this.resetGamesLiveInterval(),this.seasonSelected=s,this.show_stories=!!s.show_stories,this.seasonsForLiveGames=[s.id,...s.related_seasons.map(r=>r.id)],this.$emit("change-season-id",s.id),this.fillStoriesData(i,a.seasonsAndGames),await this.createFullTournamentScheme({seasons:this.seasonsSelected,seasonsAndGames:a.seasonsAndGames,seasonsAndTeams:a.seasonsAndTeams,applySeasonsValidation:!1}),this.team&&await this.fetchGames(this.team,this.seasonsSelected),this.keyupdate+=1}}catch(e){throw new Error(e)}},ordenarYFiltrarPartidos(s){const e=s.filter(t=>t.game_status===1||t.is_live==1||t.game_status==0);return e.sort((t,a)=>new Date(a.date_time_utc)-new Date(t.date_time_utc)),e.slice(0,18)},async fetchSeasonsGamesAndTeams(s,e,t=""){let a=t;try{const i=Ae.create({headers:{Authorization:`${this.token}`}});a||(a=this.gamesUrl2,s.forEach((l,d)=>{a+=`${d===0?"":"&"}seasons=${l}`}));const{data:{data:o,teams:r}}=await i.get(a);return{seasonsAndGames:o,seasonsAndTeams:r}}catch(i){if(e>0)return this.fetchSeasonsGamesAndTeams(s,e-1,a);throw new Error(i)}},async fetchStoriesPlays(s){try{return await Ae.create({headers:{Authorization:`${this.token}`}}).get("https://cpj4073446.execute-api.us-east-2.amazonaws.com/prod/videos/plays/seasons/"+s.id+"?categories=607&categories=608&categories=12&categories=55&categories=54&categories=35&categories=15&categories=53&type=1")}catch(e){throw new Error(e)}},fillStoriesData(s,e){let t=s.data?s.data.plays:[];this.gamesAllStories=[];for(let i=0;i<e.length;i++)this.gamesAllStories=this.gamesAllStories.concat(e[i].games);this.gamesAllStories=this.ordenarYFiltrarPartidos(this.gamesAllStories);let a=[];for(let i=0;i<this.gamesAllStories.length;i++)this.arrayGamesAdd.findIndex(o=>o.game_id===this.gamesAllStories[i].game_id)===-1?a.push({game_id:this.gamesAllStories[i].game_id,last_index:0,status:1}):a.push({game_id:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(o=>o.game_id===this.gamesAllStories[i].game_id)].game_id,last_index:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(o=>o.game_id===this.gamesAllStories[i].game_id)].last_index,status:this.arrayGamesAdd[this.arrayGamesAdd.findIndex(o=>o.game_id===this.gamesAllStories[i].game_id)].status});this.arrayGamesAdd=a;for(let i=0;i<this.arrayGamesAdd.length;i++)this.gamesAllStories.findIndex(o=>o.game_id===this.arrayGamesAdd[i].game_id)!==-1&&(this.gamesAllStories[this.gamesAllStories.findIndex(o=>o.game_id===this.arrayGamesAdd[i].game_id)].index=this.arrayGamesAdd[i].last_index,this.gamesAllStories[this.gamesAllStories.findIndex(o=>o.game_id===this.arrayGamesAdd[i].game_id)].status_storie=this.arrayGamesAdd[i].status);this.storiesItems=this.getStoriesStructureVideos(t),setTimeout(()=>{this.sendStoriesData()},1e3)},sendStoriesData(){Ae.post(`https://ssh88fgvll.execute-api.us-east-2.amazonaws.com/prod/users/${this.user.id}/seasons/${this.seasonsSelected[0].id}/stories`,{stories:this.arrayGamesAdd},{headers:{Authorization:`${this.token}`,"Content-Type":"application/json"}})},getTimeSeconds(s){const[e,t]=s.split(":"),[a,i]=t.split(".");return parseInt(e)*60+parseInt(a)+parseInt(i)/1e3},getPlayTime(s,e){let t="",a=0;switch(s[7]){case 1:t=s[11];break;case 2:t=s[13],a=45;break;case 3:t=s[15],a=90;break;case 4:t=s[17],a=105;break;case 5:t=s[19],a=120;break}return(!t||t==="0")&&(t="00:00"),this.getTimeToSeconds(t)+(this.getTimeToSeconds(s[e])-a*60)},abrirNuevaVentana(){window.open("https://goltipster.com/view-all#golTipster","_blank")},getTimeToSeconds(s){const t=s.indexOf(".")>-1?s.substring(0,s.indexOf(".")):s,[a,i,o]=t.split(":").reverse();return(o?Number(o)*60*60:0)+Number(i)*60+Number(a)},getStoriesStructureVideos(s){let e=[];for(let t=0;t<this.gamesAllStories.length;t++){let a=s.filter(r=>r[3]===this.gamesAllStories[t].game_id).map(r=>({playId:r[29],gameId:r[3],player:this.seasonPlayersMap.get(r[1]),categoryId:r[0],date:new Date(r[4]+"T"+r[5]),url:r[35]==2?"https://daijvvc13prpy.cloudfront.net/golstats-videos/"+this.gamesAllStories[t].game_id+"_1/"+this.gamesAllStories[t].game_id+"_1.m3u8":"https://golstatsbets.blob.core.windows.net/video-player/"+this.gamesAllStories[t].game_id+"_1.mp4",type:"video",thumbnail:{logoHomeTeam:"https://az755631.vo.msecnd.net/teams-80/"+this.gamesAllStories[t].home_team+".png",logoAwayTeam:"https://az755631.vo.msecnd.net/teams-80/"+this.gamesAllStories[t].visiting_team+".png"},header:{label:this.gamesAllStories[t].home_team_acronym+" "+this.gamesAllStories[t].score[0]+":"+this.gamesAllStories[t].score[1]+" "+this.gamesAllStories[t].visiting_team_acronym+" "+this.gamesAllStories[t].matchday_name.replace("Matchday","JOR").replace("de Final","").replace("Playoffs 1","CFI").replace("Playoffs 2","CFV").replace("Playoffs 3","SFI").replace("Playoffs 4","SFV").replace("Playoffs 5","FI").replace("Playoffs 6","FV")},startTime:this.getPlayTime(r,9),endTime:this.getPlayTime(r,10),duration:Math.floor(this.getTimeSeconds(r[10])-this.getTimeSeconds(r[9]))}));const i={},o=a.filter(r=>i[r.playId]?!1:(i[r.playId]=!0,!0));e.push({game_id:this.gamesAllStories[t].game_id,stories:o})}return e},areSeasonsDifferent(s){for(const e of s)if(!this.lastSeasonsIds.includes(e.season_id))return!0;return!1},async createFullTournamentScheme({seasons:s,seasonsAndGames:e,seasonsAndTeams:t,applySeasonsValidation:a}){try{this.seasonsGamesMap=new Map,this.userTeamGames=[],this.userTeamGamesForVideos=[],this.gamesOfTheDayPreMatchIds.clear();let i=0;if(a&&this.areSeasonsDifferent(e))return;e.forEach(l=>{const d=s.find(c=>c.id===l.season_id);d&&(l.type=d.type,l.games.forEach(c=>{c.season_id=l.season_id}),d.type===0&&(i=l.season_id))});const o={seasonsGames:e},r=t.find(l=>l.season_id===i);if(r){const l=r.teams,d=[...o.seasonsGames],c=o&&o.seasonsGames?o.seasonsGames.map(u=>{const f=u.games.reduce((g,m)=>{const p={...m},y=new Date,[b,S,w]=p.date.split("-"),[x,E,v]=p.schedule.split(":"),T=new Date(Number(b),Number(S)-1,Number(w),Number(x),Number(E),Number(v));return p.dateTimeMillis=T.valueOf(),p.home_team=l.find(R=>R.team_id===m.home_team),p.visiting_team=l.find(R=>R.team_id===m.visiting_team),p.game_status===4&&y.getFullYear()===T.getFullYear()&&y.getMonth()===T.getMonth()&&y.getDate()===T.getDate()&&this.gamesOfTheDayPreMatchIds.add(p.game_id),this.seasonsGamesMap.set(p.game_id,p),g[m.matchday_abbreviation]?g[m.matchday_abbreviation][m.game_status===3?"canceled":m.date]?g[m.matchday_abbreviation][m.game_status===3?"canceled":m.date].push(p):g[m.matchday_abbreviation][m.game_status===3?"canceled":m.date]=[p]:g[m.matchday_abbreviation]={[m.game_status===3?"canceled":m.date]:[p]},this.gsData&&this.gsData.teamId&&p.game_status===4&&(p.home_team.team_id===this.gsData.teamId||p.visiting_team.team_id===this.gsData.teamId)&&(this.userTeamGames.push(p),p.score&&p.score[0]+p.score[1]>0&&this.userTeamGamesForVideos.push(p)),g},{});this.userTeamGames.sort((g,m)=>g.dateTimeMillis-m.dateTimeMillis);for(let[g,m]of Object.entries(f))f[g]=Object.entries(m).map(([p,y])=>({date:p,games:y.sort((b,S)=>b.dateTimeMillis-S.dateTimeMillis)})),f[g].sort((p,y)=>p.date<y.date?-1:p.date>y.date?1:0);return{type:u.type,weight:u.type===0?0:u.type===2?1:2,schedule:f}}):[],h=o&&o.seasonsGames?d.map(u=>{const f=u.games.reduce((g,m)=>{const p={...m};return p.dateTimeMillis=new Date(p.date_time_utc).valueOf(),p.home_team=l.find(y=>y.team_id===m.home_team),p.visiting_team=l.find(y=>y.team_id===m.visiting_team),g[m.matchday_abbreviation]?g[m.matchday_abbreviation][m.game_status===3?"canceled":m.date]?(p.game_status!=4||p.is_live==1)&&(p.score[0]!=0||p.score[1]!=0)&&g[m.matchday_abbreviation][m.game_status===3?"canceled":m.date].push(p):(p.game_status!=4||p.is_live==1)&&(p.score[0]!=0||p.score[1]!=0)&&(g[m.matchday_abbreviation][m.game_status===3?"canceled":m.date]=[p]):(p.game_status!=4||p.is_live==1)&&(p.score[0]!=0||p.score[1]!=0)&&(g[m.matchday_abbreviation]={[m.game_status===3?"canceled":m.date]:[p]}),g},{});this.userTeamGames.sort((g,m)=>g.dateTimeMillis-m.dateTimeMillis);for(let[g,m]of Object.entries(f))f[g]=Object.entries(m).map(([p,y])=>({date:p,games:y.sort((b,S)=>b.dateTimeMillis-S.dateTimeMillis)})),f[g].sort((p,y)=>p.date<y.date?-1:p.date>y.date?1:0);return{type:u.type,weight:u.type===0?0:u.type===2?1:2,schedule:f}}):[];c.sort((u,f)=>u.weight-f.weight),this.fullTournamentScheduleFull=c.reduce((u,f)=>{for(const[g,m]of Object.entries(f.schedule))if(f.type===0)if([1,2].includes(this.tournamentType)){const p=qu.get(this.tournamentType);if(p){const y=p.get(g);y&&(u[y.matchDayAbbreviation]=m)}}else if(this.isCup){const p=g.replace("M",""),y=`Jornada ${p}`;this.isCupLegacy?u[Ku[p]||y]=m:u[Wu[g]||y]=m}else u[Number(g.replace("M","")).toString()]=m;else f.type===2?["PI1","PI2"].includes(g)?u[g]=m:u[`R${Number(g.replace("PO",""))}`]=m:f.type===1&&(u[Hu[g]]=m);return u},{}),this.fullTournamentScheduleFullGoals=h.reduce((u,f)=>{for(const[g,m]of Object.entries(f.schedule))if(f.type===0)if([1,2].includes(this.tournamentType)){const p=qu.get(this.tournamentType);if(p){const y=p.get(g);y&&(u[y.matchDayAbbreviation]=m)}}else if(this.isCup){const p=g.replace("M",""),y=`Jornada ${p}`;this.isCupLegacy?u[Ku[p]||y]=m:u[Wu[g]||y]=[]}else u[Number(g.replace("M","")).toString()]=m;else f.type===2?["PI1","PI2"].includes(g)?u[g]=m:u[`R${Number(g.replace("PO",""))}`]=m:f.type===1&&(u[Hu[g]]=m);return u},{}),this.roundAbbreviationByGameId=new Map,this.tournamentScheduleKeysByKey.clear(),this.tournamentScheduleKeys=Array.from(Object.entries(this.fullTournamentScheduleFull).reduce((u,[f,g],m)=>{const p=Number(f);let y="";Number.isNaN(p)?y=f:y=p<10?`0${p}`:f;let b=!1,S=null;const w={key:f,value:p,valueText:y,avaible:b,matchDayId:S,index:m,liveGamesIds:new Set};this.tournamentScheduleKeysByKey.set(f,w);const x=g.reduce((v,T)=>(!S&&T&&T.games&&T.games.length&&(w.matchDayId=T.games[0].matchday_id),T.games.forEach(R=>{this.roundAbbreviationByGameId.set(R.game_id,f),R.roundAbbreviation=Number.isNaN(p)?p:`J ${p}`,R.roundAbbreviationV2=f,R.scheduleKey=w}),v=v.concat(T.games),v),[]);for(const v of x)(v.game_status!==4||v.is_live)&&(v.score[0]!==0||v.score[1]!==0)&&(w.avaible=!0);u.set(f,w);const E=this.getPages(x);return this.gamesPages.set(f,E),u},new Map).values()),this.tournamentScheduleKeysGoals=Array.from(Object.entries(this.fullTournamentScheduleFullGoals).reduce((u,[f,g])=>{const m=Number(f);let p="";Number.isNaN(m)?p=f:p=m<10?`0${m}`:f;let y=!1;const b=g.reduce((S,w)=>(w.games.forEach(x=>{x.roundAbbreviation=Number.isNaN(m)?m:`J ${m}`}),S=S.concat(w.games),S),[]);for(let S=0;S<b.length;S++)(b[S].game_status!=4||b[S].is_live&&(b[S].score[0]!=0||b[S].score[1]!=0))&&(y=!0);return u.set(f,{key:f,value:m,valueText:p,avaible:y}),u},new Map).values())}setTimeout(()=>{this.isPreviousDataLoaded=!0,this.checkLiveGames(),this.gamesOfTheDayPreMatchIds.size&&this.createGameOfTheDayTimeouts()},500)}catch(i){throw new Error(i)}finally{this.loadingFlag=!1}},createGameOfTheDayTimeouts(){this.gamesOfTheDayPreMatchIds.size&&this.gamesOfTheDayPreMatchIds.forEach(s=>{const e=this.seasonsGamesMap.get(s);if(e){const t=new Date().valueOf();if(60*1e3*30+e.dateTimeMillis-t>0){const i=e.dateTimeMillis-t-3e5;setTimeout(()=>{this.createCheckLiveGamesInterval()},i>0?i:0)}}})},resetCheckGamesLiveInterval(){clearInterval(xi),xi=null},createCheckLiveGamesInterval(){this.resetCheckGamesLiveInterval(),xi||(xi=setInterval(()=>{this.checkLiveGames()},this.checkLiveGamesIntervalMinutes*60*1e3))},async checkLiveGames(){try{const s=await this.fetchLiveGames(),e=new Set;if(this.allLiveGames=s.data.reduce((t,a)=>(a.games.forEach(i=>{e.add(i.game_id),t.push(i)}),t),[]),this.allLiveGames.length){Pa||await this.fillGameEvents();const t=[];this.gamesOfTheDayPreMatchIds.forEach(a=>{const i=this.seasonsGamesMap.get(a);i&&new Date().valueOf()>i.dateTimeMillis&&t.push(a)}),t.length&&t.every(i=>this.seasonsGamesMap.get(i).isLiveTracked)&&this.resetCheckGamesLiveInterval()}}catch(s){throw new Error(s)}},createGamesEventsInterval(){this.resetGamesLiveInterval(),Pa=setInterval(()=>{this.fillGameEvents()},6e4)},resetGamesLiveInterval(){clearInterval(Pa),Pa=null},removeGameIfFinished(s,e,t=!1){for(const a of e)if(a.category_id===0&&a.game_status_id===13)if(t)this.fetchGames(this.team,this.seasonsSelected);else{const i=this.seasonsGamesMap.get(a.game_id);this.allLiveGames=this.allLiveGames.filter(o=>o.game_id!==s.game_id),i.is_live=0,i.game_status=0,i.scheduleKey&&i.scheduleKey.liveGamesIds.delete(s.game_id)}},async fillGameEvents(){try{const s=[];let e=null;for(const a of this.allLiveGames){a.isLiveTracked=!0,this.gamesOfTheDayPreMatchIds.size&&this.gamesOfTheDayPreMatchIds.delete(a.game_id);const i=this.seasonsGamesMap.get(a.game_id);i&&(i.is_live=1,i.game_status=4,i.scheduleKey&&i.scheduleKey.liveGamesIds.add(a.game_id)),e=this.fullTournamentSchedule&&this.fullTournamentSchedule.data&&this.fullTournamentSchedule.data.prematch?this.fullTournamentSchedule.data.prematch:null,e&&e.game_id===a.game_id&&(e.is_live=1,e.game_status=4),s.push(this.fetchGameEvents(a.game_id))}const t=await Promise.all(s);for(const a of t){const i=this.seasonsGamesMap.get(a.game_id);if(i){const o=aO.get(a.recent_lapse);i.currentTimeLive=o&&o<a.minute?`${o}' + ${a.minute-o}'`:`${a.minute}'`;const r=[Number(a.score[i.home_team.team_id.toString()])+Number(a.score[`own_${i.visiting_team.team_id.toString()}`]),Number(a.score[i.visiting_team.team_id.toString()])+Number(a.score[`own_${i.home_team.team_id.toString()}`])],l=r[0],d=r[1];i.score=[Number.isNaN(l)?0:l,Number.isNaN(d)?0:d],this.removeGameIfFinished(i,a.plays),e&&e.game_id===i.game_id&&(e.currentTimeLive=i.currentTimeLive,e.score=i.score,this.removeGameIfFinished(e,a.plays,!0))}}Pa||this.createGamesEventsInterval()}catch(s){throw new Error(s)}},getPages(s){const e=[];if(this.gamesPerMatchDay>0){let t=[];s.forEach((a,i)=>{t.push(a),(i+1)%this.gamesPerMatchDay===0&&(e.push([...t]),t=[])}),t.length&&e.push([...t])}else e.push(s);return e},getNormalClosestRound(s,e=!1){const t=new Date().valueOf(),a=e?this.getOnlyGamesWithGoals(s):s,i=Object.entries(Object.entries(a).reduce((r,[l,d])=>(r[l]=null,d.forEach(c=>{c.games.forEach(h=>{if([1,0].includes(h.game_status)||h.is_live){const u=t-h.dateTimeMillis;(r[l]===null||u<r[l])&&(r[l]=u)}})}),r),{}));if(!i.length)return"1";const o=i.reduce((r,[l,d])=>{if(d!==null){const c=this.tournamentScheduleKeysByKey.get(l);(r.shortestMillisToNow===null||d<r.shortestMillisToNow&&c.index>=r.scheduleKey.index)&&(r.shortestMillisToNow=d,r.round=l,r.scheduleKey=c)}return r},{round:"",shortestMillisToNow:null,scheduleKey:null});return o.shortestMillisToNow!==null?o.round:i[i.length-1][0]},getUserTeamClosestRound(s,e=!1){let t=1;const a=e?this.userTeamGamesForVideos:this.userTeamGames;if(a.length){const i=a[0];for(const[o,r]of Object.entries(s))for(const l of r)if(l.games.find(c=>c.game_id===i.game_id))return o}return t},async changeIndexStory(s){if(this.arrayGamesAdd.length>0){let e=-1,t=-1,a=-1;this.arrayGamesAdd.findIndex(i=>i.game_id===this.currentStories[0].gameId)!=-1&&(e=this.arrayGamesAdd.findIndex(i=>i.game_id===this.currentStories[0].gameId)),this.gamesAllStories.findIndex(i=>i.game_id===this.currentStories[0].gameId)!=-1&&(t=this.gamesAllStories.findIndex(i=>i.game_id===this.currentStories[0].gameId)),this.storiesItems.findIndex(i=>i.game_id===this.currentStories[0].gameId)!=-1&&(a=this.storiesItems.findIndex(i=>i.game_id===this.currentStories[0].gameId)),e!=-1&&(this.gamesAllStories[t].is_live===1?this.storiesItems[a].stories.length-1==s&&this.storiesItems[a].stories.length>1?this.arrayGamesAdd[e].last_index=s-1:this.arrayGamesAdd[e].last_index=s:this.arrayGamesAdd[e].last_index=s),a!=-1&&this.arrayGamesAdd[e].status>0&&(this.arrayGamesAdd[e].status=s>=this.storiesItems[a].stories.length-1?0:1)}else{this.arrayGamesAdd=[];for(let e=0;e<this.storiesItems.length;e++)this.arrayGamesAdd.push({game_id:this.storiesItems[e].game_id,last_index:this.currentStories[0].gameId==this.storiesItems[e].game_id?s:0,status:this.currentStories[0].gameId==this.storiesItems[e].game_id&&s>=this.storiesItems[e].stories.length-1?0:1})}await Ae.post(`https://ssh88fgvll.execute-api.us-east-2.amazonaws.com/prod/users/${this.user.id}/seasons/${this.seasonsSelected[0].id}/stories`,{stories:this.arrayGamesAdd},{headers:{Authorization:`${this.token}`,"Content-Type":"application/json"}});for(let e=0;e<this.arrayGamesAdd.length;e++)this.gamesAllStories.findIndex(t=>t.game_id===this.arrayGamesAdd[e].game_id)!=-1&&(this.gamesAllStories[this.gamesAllStories.findIndex(t=>t.game_id===this.arrayGamesAdd[e].game_id)].index=this.arrayGamesAdd[e].last_index,this.gamesAllStories[this.gamesAllStories.findIndex(t=>t.game_id===this.arrayGamesAdd[e].game_id)].status_storie=this.arrayGamesAdd[e].status)},async getLiveGamePlays(s){var a=(await Ae.create({headers:{Authorization:`${this.token}`}}).get("https://cpj4073446.execute-api.us-east-2.amazonaws.com/prod/live/videos/plays/seasons/"+this.gamesAllStories[s].season_id+"/games/"+this.gamesAllStories[s].game_id)).data.plays.filter(l=>l[0]===607||l[0]===608||l[0]===12||l[0]===55||l[0]===54||l[0]===35||l[0]===15||l[0]===53);let i=a.map(l=>({playId:l[29],gameId:l[3],player:this.seasonPlayersMap.get(l[1]),categoryId:l[0],date:new Date(l[4]+"T"+l[5]),url:"https://falconvideolive.blob.core.windows.net/video-hls-live/"+this.gamesAllStories[s].game_id+"/"+this.gamesAllStories[s].game_id+".m3u8",type:"video",thumbnail:{logoHomeTeam:"https://az755631.vo.msecnd.net/teams-80/"+this.gamesAllStories[s].home_team+".png",logoAwayTeam:"https://az755631.vo.msecnd.net/teams-80/"+this.gamesAllStories[s].visiting_team+".png"},header:{label:this.gamesAllStories[s].home_team_acronym+" "+this.gamesAllStories[s].score[0]+":"+this.gamesAllStories[s].score[1]+" "+this.gamesAllStories[s].visiting_team_acronym+" "+this.gamesAllStories[s].matchday_name.replace("Matchday","JOR").replace("de Final","").replace("Playoffs 1","CFI").replace("Playoffs 2","CFV").replace("Playoffs 3","SFI").replace("Playoffs 4","SFV").replace("Playoffs 5","FI").replace("Playoffs 6","FV")},startTime:this.getPlayTime(l,9),endTime:this.getPlayTime(l,10),duration:Math.floor(this.getTimeSeconds(l[10])-this.getTimeSeconds(l[9]))}));const o={},r=i.filter(l=>o[l.playId]?!1:(o[l.playId]=!0,!0));this.storiesItems[s]={game_id:this.gamesAllStories[s].game_id,stories:r}},async openStory(s){const e={headers:{Authorization:`${this.token}`}},[t]=await Promise.all([Ae.get(`https://ts7thxzaik.execute-api.us-west-2.amazonaws.com/prod/players/games/${this.gamesAllStories[s].game_id}`,e)]);t.data&&t.data.players.forEach(a=>{this.seasonPlayersMap.set(a.player_id,{dob:a.dob,first_name:a.first_name,jersey:a.jersey,last_name:a.last_name,name:a.name,player_name:a.name,nationality:a.nationality,nationality_id:a.nationality_id,nationality_photo:a.nationality_photo,photo:a.photo,player_id:a.player_id,position_id:a.position_id,short_name:a.short_name,team_id:a.team_id})}),this.gamesAllStories[s].is_live==1||this.gamesAllStories[s].game_status==0?(await this.getLiveGamePlays(s),setTimeout(()=>{this.currentStoryIndex=s,this.currentStories=this.storiesItems[s].stories,this.currentStoriesLastIndex=this.gamesAllStories[s].index},100)):(this.currentStoryIndex=s,this.currentStories=this.storiesItems[s].stories,this.currentStoriesLastIndex=this.gamesAllStories[s].index),setTimeout(()=>{this.isStoriesVisible=!0},150)},onCloseStories(s){this.currentStoriesLastIndex=0,this.isStoriesVisible=!1,this.$emit("event-posthog-stories",{event:"stories_cerrar",properties:{play_id:s?s.playId:null,game_id:s?s.gameId:null,category_id:s?s.categoryId:null,start_time:s?s.startTime:null,end_time:s?parseInt(s.currentTime):null,percentage_viewed:s?parseInt(s.progress):null}})},closeStories(){this.currentStoriesLastIndex=0,this.currentStoryIndex=null,this.currentStories=[]},onSwipeStories({direction:s,currentPlay:e}){s==="right"?(this.$emit("event-posthog-stories",{event:"stories_video_siguiente_partido",properties:{play_id:e?e.playId:null,game_id:e?e.gameId:null,category_id:e?e.categoryId:null,start_time:e?e.startTime:null,end_time:e?parseInt(e.currentTime):null,percentage_viewed:e?parseInt(e.progress):null}}),this.currentStoryIndex>0&&this.openStory(this.currentStoryIndex-1)):(this.$emit("event-posthog-stories",{event:"stories_video_anterior_partido",properties:{play_id:e?e.playId:null,game_id:e?e.gameId:null,category_id:e?e.categoryId:null,start_time:e?e.startTime:null,end_time:e?parseInt(e.currentTime):null,percentage_viewed:e?parseInt(e.progress):null}}),this.currentStoryIndex<this.storiesItems.length-1&&this.openStory(this.currentStoryIndex+1))},onClickNextBackVideo({eventName:s,currentPlay:e}){this.$emit("event-posthog-stories",{event:s,properties:{play_id:e?e.playId:null,game_id:e?e.gameId:null,category_id:e?e.categoryId:null,start_time:e?e.startTime:null,end_time:e?parseInt(e.currentTime):null,percentage_viewed:e?parseInt(e.progress):null}})},onChangeTournaments(s){this.currentTournaments=s},onClickStories(s){this.$emit("event-posthog-stories",{event:"stories_ver_play",properties:{game_id:s.game_id}})},onVideoPlay(s){this.$emit("event-posthog-stories",{event:"stories_play",properties:{play_id:s.playId,game_id:s.gameId,category_id:s.categoryId,start_time:s.startTime,end_time:s.endTime,percentage_viewed:0}})}},async created(){},beforeUnmount(){this.resetGamesLiveInterval()}},hs=s=>(n.pushScopeId("data-v-10136421"),s=s(),n.popScopeId(),s),oO={class:"gsclanding",ref:"landingref"},rO={key:2,class:"play-seeker-image"},lO={class:"play-seeker-image__info"},cO=hs(()=>n.createElementVNode("div",{class:"play-seeker-image__info__ai"},"Inteligencia Artificial",-1)),dO={class:"play-seeker-image__info__legends-and-button"},hO=hs(()=>n.createElementVNode("div",{class:"play-seeker-image__info__legends-and-button__legends"},"LEYENDAS PARA TI",-1)),uO={class:"play-icon"},mO=["src"],fO=hs(()=>n.createElementVNode("div",{class:"text"},"Explora videos",-1)),pO={class:"play-seeker-image__players"},gO=["src"],yO={key:3,class:"container-selectors-mobile"},bO={class:"container-selectors-mobile-tournament"},SO={class:"container-selectors-mobile-season"},_O={key:0,class:"home-item-movil"},wO=hs(()=>n.createElementVNode("div",{class:"home-movil"},"Inicio",-1)),kO={class:"name-user-movil"},EO={key:1,class:"home-item"},TO={key:2,class:"bar-settings"},CO={class:"name-user"},xO={class:"container-selectors"},vO={class:"selector-tournament"},AO={class:"selector-seasons"},LO={key:0,class:"container-games"},IO={key:0,class:"container-games"},RO={key:7,class:"container-players-myteam"},BO=["onClick"],NO={class:"story-result"},DO={key:0,class:"font-bold"},PO={key:1,class:"font-bold"},OO={class:"story-match"},FO={key:2,class:"play-seeker-image"},MO={class:"play-seeker-image__info"},VO=hs(()=>n.createElementVNode("div",{class:"play-seeker-image__info__ai"},"Inteligencia Artificial",-1)),$O={class:"play-seeker-image__info__legends-and-button"},zO=hs(()=>n.createElementVNode("div",{class:"play-seeker-image__info__legends-and-button__legends"},"LEYENDAS PARA TI",-1)),UO={class:"play-icon"},GO=["src"],jO=hs(()=>n.createElementVNode("div",{class:"text"},"Explora videos",-1)),HO={class:"play-seeker-image__players"},WO=["src"],KO={key:3,class:"container-selectors-mobile"},qO={class:"container-selectors-mobile-tournament"},YO={class:"container-selectors-mobile-season"},JO={key:0,class:"home-item-movil"},XO=hs(()=>n.createElementVNode("div",{class:"home-movil"},"Inicio",-1)),ZO={class:"name-user-movil"},QO={key:1,class:"home-item"},e8={key:2,class:"bar-settings"},t8={class:"name-user"},s8={class:"container-selectors"},a8={class:"selector-tournament"},n8={class:"selector-seasons"},i8={key:3,class:"container-games"},o8={key:5,class:"container-players"},r8={key:6,class:"stories-circle-wrapper"},l8=["onClick"],c8={class:"story-result"},d8={key:0,class:"font-bold"},h8={key:1,class:"font-bold"},u8={class:"story-match"};function m8(s,e,t,a,i,o){const r=n.resolveComponent("Stories"),l=n.resolveComponent("CarouselFullScreen"),d=n.resolveComponent("GSCTournamentSelect"),c=n.resolveComponent("GSCSeasonSelect"),h=n.resolveComponent("GSCGridTeamsMatches"),u=n.resolveComponent("GSCTableCalendar"),f=n.resolveComponent("GSCGames");n.resolveComponent("DiscoverVideos");const g=n.resolveComponent("GSCPlayersLanding"),m=n.resolveComponent("GSCTops"),p=n.resolveComponent("GSCSlider");return n.openBlock(),n.createElementBlock("div",oO,[t.isplayer?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[i.isStoriesVisible&&t.showStories?(n.openBlock(),n.createBlock(r,{key:0,stories:i.currentStories,"start-story-index":i.currentStoriesLastIndex,"is-first-game-stories":i.currentStoryIndex===0,"is-last-game-stories":i.currentStoryIndex===i.storiesItems.length-1,onLastStoryIndex:o.changeIndexStory,onClose:o.onCloseStories,onSwipe:o.onSwipeStories,onVideoNextBack:o.onClickNextBackVideo,onVideoPlay:o.onVideoPlay},null,8,["stories","start-story-index","is-first-game-stories","is-last-game-stories","onLastStoryIndex","onClose","onSwipe","onVideoNextBack","onVideoPlay"])):n.createCommentVNode("",!0),i.isCarouselFullScreenVisible?(n.openBlock(),n.createBlock(l,{key:1,"player-queue":i.carouselPlayerQueue,"is-play-seeker":i.isPlaySeeker,"playlist-index":0,onClose:o.onClickCloseCarousel},null,8,["player-queue","is-play-seeker","onClose"])):n.createCommentVNode("",!0),o.isPlaySeekerAvailable?(n.openBlock(),n.createElementBlock("div",rO,[n.createElementVNode("div",lO,[cO,n.createElementVNode("div",dO,[hO,n.createElementVNode("div",{role:"button",class:"play-seeker-image__info__legends-and-button__button",onClick:e[0]||(e[0]=(...y)=>o.onClickPlaySeeker&&o.onClickPlaySeeker(...y))},[n.createElementVNode("div",uO,[n.createElementVNode("img",{src:`${i.imagesUrl}icn-play.svg`,alt:""},null,8,mO)]),fO])])]),n.createElementVNode("div",pO,[n.createElementVNode("img",{src:`${i.imagesUrl}players@2x.png`,alt:""},null,8,gO)])])):n.createCommentVNode("",!0),a.elementSize.width<=680&&a.elementSize.width>0?(n.openBlock(),n.createElementBlock("div",yO,[n.createElementVNode("div",bO,[n.createVNode(d,{"current-season-id":t.currentSeasonId,width:"100%","api-url":t.tournamentsApiUrl,onInput:o.onInputTournament,onChangeTournaments:o.onChangeTournaments},null,8,["current-season-id","api-url","onInput","onChangeTournaments"])]),n.createElementVNode("div",SO,[n.createVNode(c,{"current-season-id":t.currentSeasonId,width:"100%",seasons:i.tournamentSelectedDropDowns.seasons,onInput:o.onInputSeason},null,8,["current-season-id","seasons","onInput"])])])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(o.containerbackground)},[n.createElementVNode("div",{class:n.normalizeClass(o.containerdata)},[a.elementSize.width<=680?(n.openBlock(),n.createElementBlock("div",_O,[wO,n.createElementVNode("div",kO,[t.isFemale?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode("Bienvenida ")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode("Bienvenido ")],64)),i.is_public?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createTextVNode("a GolStats ")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createTextVNode(n.toDisplayString(o.formatUsername(t.user.name)),1)],64))])])):n.createCommentVNode("",!0),a.elementSize.width>680?(n.openBlock(),n.createElementBlock("div",EO,"Inicio")):n.createCommentVNode("",!0),a.elementSize.width>680?(n.openBlock(),n.createElementBlock("div",TO,[n.createElementVNode("div",CO,[t.isFemale?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode("Bienvenida ")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode("Bienvenido ")],64)),i.is_public?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createTextVNode("a GolStats ")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createTextVNode(n.toDisplayString(o.formatUsername(t.user.name)),1)],64))]),n.createElementVNode("div",xO,[n.createElementVNode("div",vO,[n.createVNode(d,{"current-season-id":t.currentSeasonId,"api-url":t.tournamentsApiUrl,onInput:o.onInputTournament,onChangeTournaments:o.onChangeTournaments},null,8,["current-season-id","api-url","onInput","onChangeTournaments"])]),n.createElementVNode("div",AO,[n.createVNode(c,{"current-season-id":t.currentSeasonId,seasons:i.tournamentSelectedDropDowns.seasons,onInput:o.onInputSeason},null,8,["current-season-id","seasons","onInput"])])])])):n.createCommentVNode("",!0),t.user.tournament===i.tournamentSelected.id?(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createElementVNode("div",{class:n.normalizeClass(o.containerGridCalendarTable)},[n.createElementVNode("div",{class:"container-grid",style:n.normalizeStyle([a.elementSize.width<=1e3?"width: 100%; ":"",!(t.isplayer&&!o.isGenericLike)&&o.isGenericLike?"max-height: 380px !important;":"max-height: 480px !important; margin-top: 15px !important;"])},[a.elementSize.width>1e3?(n.openBlock(),n.createBlock(h,{key:0,isPlayer:t.isplayer&&!o.isGenericLike,"player-id":t.user.player,"team-id":t.user.team,"is-female":i.tournamentSelected.is_female==1,"tournament-selected":i.tournamentSelected,"is-public":i.is_public,"season-selected":i.seasonSelected.id,"next-rival-id":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?i.fullTournamentSchedule.data.prematch.visiting_team:i.fullTournamentSchedule.data.prematch.home_team:0,"team-img":"https://az755631.vo.msecnd.net/teams-150/"+t.user.team+".png","player-img":"https://az755631.vo.msecnd.net/players-profile/"+t.user.player+".png","rival-img":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.visiting_team+".png":"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.home_team+".png":"","has-team":!o.isGenericLike,"component-width":a.elementSize.width,onAction:o.clickCard},null,8,["isPlayer","player-id","team-id","is-female","tournament-selected","is-public","season-selected","next-rival-id","team-img","player-img","rival-img","has-team","component-width","onAction"])):(n.openBlock(),n.createBlock(h,{key:1,isPlayer:!1,"player-id":t.user.player,"is-female":i.tournamentSelected.is_female==1,"team-id":t.user.team,"is-player-mobile1":t.isplayer&&!o.isGenericLike,"tournament-selected":i.tournamentSelected,"is-public":i.is_public,"season-selected":i.seasonSelected.id,"next-rival-id":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?i.fullTournamentSchedule.data.prematch.visiting_team:i.fullTournamentSchedule.data.prematch.home_team:0,"team-img":"https://az755631.vo.msecnd.net/teams-150/"+t.user.team+".png","player-img":"https://az755631.vo.msecnd.net/players-profile/"+t.user.player+".png","rival-img":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.visiting_team+".png":"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.home_team+".png":"","has-team":!1,"component-width":a.elementSize.width,onAction:o.clickCard},null,8,["player-id","is-female","team-id","is-player-mobile1","tournament-selected","is-public","season-selected","next-rival-id","team-img","player-img","rival-img","component-width","onAction"]))],4),n.withDirectives(n.createElementVNode("div",{class:"container-calendar-table",style:n.normalizeStyle(a.elementSize.width<1e3?"width: 100%;":"")},[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(u,{season:i.seasonSelected,seasons:i.seasonsSelected,"tournament-type":i.tournamentType,tournament:i.tournamentSelected.id,privileges:t.privileges,"is-public":i.is_public,"is-player":t.isplayer,"is-player-tournament":t.user.tournament===i.tournamentSelected.id,"is-generic":o.isGenericLike,key:i.updateTableCalendar,"team-id":o.teamSelected,componentWidth:a.elementSize&&a.elementSize.width?a.elementSize.width:0,tournaments:i.currentTournaments,onAction:o.onAction,onOnOpenProfile:o.onOpenProfile,onOpenmedia:o.onOpenMedia},null,8,["season","seasons","tournament-type","tournament","privileges","is-public","is-player","is-player-tournament","is-generic","team-id","componentWidth","tournaments","onAction","onOnOpenProfile","onOpenmedia"])):n.createCommentVNode("",!0)],4),[[n.vShow,a.elementSize.width>1e3]])],2),Object.keys(i.tournamentSelected).length>0?(n.openBlock(),n.createElementBlock("div",LO,[n.createVNode(f,{"component-width":a.elementSize.width,isplayer:t.isplayer,"is-full":o.isGenericLike,data:o.games,"tournament-schedule-keys":i.tournamentScheduleKeys,"default-match-day-key":i.selectedRound,user:t.user,"current-tournament":i.tournamentSelected,"current-season":i.seasonSelected.id,"is-live-button-visible":!!i.allLiveGames.length,onClickCalendar:o.onClickCalendar,onClickMatch:o.onClickMatch,onChangeMatchDay:o.onChangeMatchDayGames,onChangeIsLeagueSelected:o.onChangeIsLeagueSelected,onClickLive:o.onClickLive},null,8,["component-width","isplayer","is-full","data","tournament-schedule-keys","default-match-day-key","user","current-tournament","current-season","is-live-button-visible","onClickCalendar","onClickMatch","onChangeMatchDay","onChangeIsLeagueSelected","onClickLive"])])):n.createCommentVNode("",!0)],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:4},[Object.keys(i.tournamentSelected).length>0?(n.openBlock(),n.createElementBlock("div",IO,[n.createVNode(f,{"component-width":a.elementSize.width,isplayer:t.isplayer,"is-full":o.isGenericLike,data:o.games,"tournament-schedule-keys":i.tournamentScheduleKeys,"default-match-day-key":i.selectedRound,user:t.user,"current-tournament":i.tournamentSelected,"current-season":i.seasonSelected.id,"is-live-button-visible":!!i.allLiveGames.length,onClickCalendar:o.onClickCalendar,onClickMatch:o.onClickMatch,onChangeMatchDay:o.onChangeMatchDayGames,onChangeIsLeagueSelected:o.onChangeIsLeagueSelected,onClickLive:o.onClickLive},null,8,["component-width","isplayer","is-full","data","tournament-schedule-keys","default-match-day-key","user","current-tournament","current-season","is-live-button-visible","onClickCalendar","onClickMatch","onChangeMatchDay","onChangeIsLeagueSelected","onClickLive"])])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(o.containerGridCalendarTable)},[n.createElementVNode("div",{class:"container-grid",style:n.normalizeStyle([a.elementSize.width<=1e3?"width: 100%; ":"",!(t.isplayer&&!o.isGenericLike)&&o.isGenericLike?"max-height: 380px !important;":"max-height: 480px !important; margin-top: 15px !important;"])},[n.createVNode(h,{isPlayer:t.isplayer&&!o.isGenericLike,"player-id":t.user.player,"team-id":t.user.team,"tournament-selected":i.tournamentSelected,"is-public":i.is_public,"is-female":i.tournamentSelected.is_female==1,"season-selected":i.seasonSelected.id,"next-rival-id":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?i.fullTournamentSchedule.data.prematch.visiting_team:i.fullTournamentSchedule.data.prematch.home_team:0,"team-img":"https://az755631.vo.msecnd.net/teams-150/"+t.user.team+".png","player-img":"https://az755631.vo.msecnd.net/players-profile/"+t.user.player+".png","rival-img":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.visiting_team+".png":"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.home_team+".png":"","has-team":!o.isGenericLike,"component-width":a.elementSize.width,onAction:o.clickCard},null,8,["isPlayer","player-id","team-id","tournament-selected","is-public","is-female","season-selected","next-rival-id","team-img","player-img","rival-img","has-team","component-width","onAction"])],4),n.withDirectives(n.createElementVNode("div",{class:"container-calendar-table",style:n.normalizeStyle(a.elementSize.width<=1e3?"width: 100%; margin-top: 30px;":"")},[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(u,{season:i.seasonSelected,seasons:i.seasonsSelected,"tournament-type":i.tournamentType,tournament:i.tournamentSelected.id,privileges:t.privileges,"is-public":i.is_public,"is-player":t.isplayer,"is-player-tournament":t.user.tournament===i.tournamentSelected.id,"is-generic":o.isGenericLike,key:i.updateTableCalendar,"team-id":o.teamSelected,componentWidth:a.elementSize&&a.elementSize.width?a.elementSize.width:0,tournaments:i.currentTournaments,onAction:o.onAction,onOnOpenProfile:o.onOpenProfile,onOpenmedia:o.onOpenMedia},null,8,["season","seasons","tournament-type","tournament","privileges","is-public","is-player","is-player-tournament","is-generic","team-id","componentWidth","tournaments","onAction","onOnOpenProfile","onOpenmedia"])):n.createCommentVNode("",!0)],4),[[n.vShow,a.elementSize.width>1e3]])],2)],64)),n.createCommentVNode("",!0),o.isGenericLike?n.createCommentVNode("",!0):n.withDirectives((n.openBlock(),n.createElementBlock("div",{key:o.teamRival,class:"container-players"},[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(g,{key:o.teamRival,"tournament-selected":i.tournamentSelected,onClickProfileBtn:o.clickProfileBtn,onViewAll:o.viewAllRival,"is-rival":!0,onTotalPlayers:o.getTotalPlayersRival,"team-id":o.teamRival,"season-id":i.seasonSelected.id,"is-player":!0},null,8,["tournament-selected","onClickProfileBtn","onViewAll","onTotalPlayers","team-id","season-id"])):n.createCommentVNode("",!0)])),[[n.vShow,i.playersLengthRival>0&&o.teamRival>0]]),o.isGenericLike?n.createCommentVNode("",!0):n.withDirectives((n.openBlock(),n.createElementBlock("div",RO,[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(g,{key:0,"tournament-selected":i.tournamentSelected,onClickProfileBtn:o.clickProfileBtn,onViewAll:o.viewAll,onTotalPlayers:o.getTotalPlayers,"team-id":t.user.team,"season-id":i.seasonSelected.id,"is-player":!!t.user.player},null,8,["tournament-selected","onClickProfileBtn","onViewAll","onTotalPlayers","team-id","season-id","is-player"])):n.createCommentVNode("",!0)],512)),[[n.vShow,i.playersLength>0]]),a.elementSize.width<1e3&&t.isplayer&&!o.isGenericLike?(n.openBlock(),n.createElementBlock("div",{key:8,class:n.normalizeClass(o.containerGridCalendarTable)},[n.createElementVNode("div",{class:"container-grid",style:n.normalizeStyle([a.elementSize.width<=1e3?"width: 100%; ":"",!(t.isplayer&&!o.isGenericLike)&&o.isGenericLike?"max-height: 380px !important;":"max-height: 480px !important; margin-top: 65px !important;"])},[a.elementSize.width<1e3?(n.openBlock(),n.createBlock(h,{key:0,isPlayer:!1,"player-id":t.user.player,"team-id":t.user.team,"is-player-mobile2":t.isplayer&&!o.isGenericLike,"tournament-selected":i.tournamentSelected,"is-public":i.is_public,"is-female":i.tournamentSelected.is_female==1,"season-selected":i.seasonSelected.id,"next-rival-id":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?i.fullTournamentSchedule.data.prematch.visiting_team:i.fullTournamentSchedule.data.prematch.home_team:0,"team-img":"https://az755631.vo.msecnd.net/teams-150/"+t.user.team+".png","player-img":"https://az755631.vo.msecnd.net/players-profile/"+t.user.player+".png","rival-img":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.visiting_team+".png":"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.home_team+".png":"","has-team":!1,"component-width":a.elementSize.width,onAction:o.clickCard},null,8,["player-id","team-id","is-player-mobile2","tournament-selected","is-public","is-female","season-selected","next-rival-id","team-img","player-img","rival-img","component-width","onAction"])):n.createCommentVNode("",!0)],4)],2)):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(["container-tops",t.user.tournament===i.tournamentSelected.id?"tops-player":""]),style:n.normalizeStyle(t.isplayer&&!o.isGenericLike&&a.elementSize.width<1e3?"margin-top: 35px !important;":"")},[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(m,{key:0,"tournament-selected":i.tournamentSelected,onMore:o.moreTops,"show-switch":!o.isGenericLike,season:i.seasonSelected.id,"show-more":!i.is_public,"team-id":t.user.team,"active-videos":i.is_public?t.privileges.vr_privileges:!0,onOpenmedia:o.onOpenMedia},null,8,["tournament-selected","onMore","show-switch","season","show-more","team-id","active-videos","onOpenmedia"])):n.createCommentVNode("",!0)],6),i.gamesAllStories.length>0&&!i.is_public&&i.show_stories&&t.showStories?(n.openBlock(),n.createElementBlock("div",{key:9,class:n.normalizeClass(["stories-circle-wrapper",t.user.tournament===i.tournamentSelected.id?"":"marginsep"])},[(n.openBlock(),n.createBlock(p,{key:i.keyupdate,height:"130px",pxScroll:86,scrollColor:"none",arrowsPosition:"absolute","background-color":"none",arrowsScrollHide:!0,arrowsHideOnNoScroll:!0,arrowsBackground:"rgba(255,255,255,.16)",arrowsContainerBgL:"linear-gradient(270deg, rgba(13,29,42,0.1) 0%, rgba(13,29,42,1) 70%)",arrowsContainerBgR:"linear-gradient(90deg, rgba(13,29,42,0.1) 0%, rgba(13,29,42,1) 70%)",arrowsMargin:0,arrowsRadius:"50%",arrowsBorder:"#ddd"},{default:n.withCtx(()=>[n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.gamesAllStories,(y,b)=>(n.openBlock(),n.createElementBlock("div",{key:b,class:"story-container-game",onClick:S=>o.onClickStory({item:y,index:b})},[n.createElementVNode("div",{class:"story-circle",style:n.normalizeStyle(y.is_live==1?(y.status_storie==1,"border: 2px solid #cbee6b !important;"):y.status_storie==1?"border: 2px solid #2248a2 !important;":"border: 2px solid #41485B !important;")},[n.createElementVNode("div",{class:"circle-item-home",style:n.normalizeStyle("background-image: url(https://az755631.vo.msecnd.net/teams-80/"+y.home_team+".png)")},null,4),n.createElementVNode("div",{class:"circle-item-away",style:n.normalizeStyle("background-image: url(https://az755631.vo.msecnd.net/teams-80/"+y.visiting_team+".png)")},null,4)],4),n.createElementVNode("div",NO,[n.createTextVNode(n.toDisplayString(y.home_team_acronym)+"  ",1),y.score.length>0?(n.openBlock(),n.createElementBlock("span",DO,n.toDisplayString(isNaN(y.score[0])?0:y.score[0]),1)):n.createCommentVNode("",!0),n.createTextVNode(":"),y.score.length>0?(n.openBlock(),n.createElementBlock("span",PO,n.toDisplayString(isNaN(y.score[1])?0:y.score[1]),1)):n.createCommentVNode("",!0),n.createTextVNode("  "+n.toDisplayString(y.visiting_team_acronym),1)]),n.createElementVNode("div",OO,n.toDisplayString(y.matchday_name.replace("Matchday","JOR").replace("de Final","").replace("Playoffs 1","CFI").replace("Playoffs 2","CFV").replace("Playoffs 3","SFI").replace("Playoffs 4","SFV").replace("Playoffs 5","FI").replace("Playoffs 6","FV")),1)],8,BO))),128))]),_:1}))],2)):n.createCommentVNode("",!0),n.withDirectives(n.createElementVNode("div",{class:"container-calendar-table",style:n.normalizeStyle(a.elementSize.width<1e3?"width: 100%; ":"")},[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(u,{season:i.seasonSelected,seasons:i.seasonsSelected,"tournament-type":i.tournamentType,tournament:i.tournamentSelected.id,privileges:t.privileges,"is-public":i.is_public,"is-player":t.isplayer,"is-player-tournament":t.user.tournament===i.tournamentSelected.id,"is-generic":o.isGenericLike,key:i.updateTableCalendar,"team-id":o.teamSelected,componentWidth:a.elementSize&&a.elementSize.width?a.elementSize.width:0,tournaments:i.currentTournaments,onAction:o.onAction,onOnOpenProfile:o.onOpenProfile,onOpenmedia:o.onOpenMedia},null,8,["season","seasons","tournament-type","tournament","privileges","is-public","is-player","is-player-tournament","is-generic","team-id","componentWidth","tournaments","onAction","onOnOpenProfile","onOpenmedia"])):n.createCommentVNode("",!0)],4),[[n.vShow,a.elementSize.width<1e3]]),i.is_public?(n.openBlock(),n.createElementBlock("div",{key:10,class:"b2c-image",onClick:e[1]||(e[1]=(...y)=>o.abrirNuevaVentana&&o.abrirNuevaVentana(...y))})):n.createCommentVNode("",!0)],2)],2)],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[i.isStoriesVisible&&t.showStories?(n.openBlock(),n.createBlock(r,{key:0,stories:i.currentStories,"start-story-index":i.currentStoriesLastIndex,"is-first-game-stories":i.currentStoryIndex===0,"is-last-game-stories":i.currentStoryIndex===i.storiesItems.length-1,onLastStoryIndex:o.changeIndexStory,onClose:o.onCloseStories,onSwipe:o.onSwipeStories,onVideoNextBack:o.onClickNextBackVideo,onVideoPlay:o.onVideoPlay},null,8,["stories","start-story-index","is-first-game-stories","is-last-game-stories","onLastStoryIndex","onClose","onSwipe","onVideoNextBack","onVideoPlay"])):n.createCommentVNode("",!0),i.isCarouselFullScreenVisible?(n.openBlock(),n.createBlock(l,{key:1,"player-queue":i.carouselPlayerQueue,"is-play-seeker":i.isPlaySeeker,"playlist-index":0,onClose:o.onClickCloseCarousel},null,8,["player-queue","is-play-seeker","onClose"])):n.createCommentVNode("",!0),o.isPlaySeekerAvailable?(n.openBlock(),n.createElementBlock("div",FO,[n.createElementVNode("div",MO,[VO,n.createElementVNode("div",$O,[zO,n.createElementVNode("div",{role:"button",class:"play-seeker-image__info__legends-and-button__button",onClick:e[2]||(e[2]=(...y)=>o.onClickPlaySeeker&&o.onClickPlaySeeker(...y))},[n.createElementVNode("div",UO,[n.createElementVNode("img",{src:`${i.imagesUrl}icn-play.svg`,alt:""},null,8,GO)]),jO])])]),n.createElementVNode("div",HO,[n.createElementVNode("img",{src:`${i.imagesUrl}players@2x.png`,alt:""},null,8,WO)])])):n.createCommentVNode("",!0),a.elementSize.width<=680&&a.elementSize.width>0?(n.openBlock(),n.createElementBlock("div",KO,[n.createElementVNode("div",qO,[n.createVNode(d,{"current-season-id":t.currentSeasonId,width:"100%","api-url":t.tournamentsApiUrl,onInput:o.onInputTournament,onChangeTournaments:o.onChangeTournaments},null,8,["current-season-id","api-url","onInput","onChangeTournaments"])]),n.createElementVNode("div",YO,[n.createVNode(c,{"current-season-id":t.currentSeasonId,width:"100%",seasons:i.tournamentSelectedDropDowns.seasons,onInput:o.onInputSeason},null,8,["current-season-id","seasons","onInput"])])])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(o.containerbackground)},[n.createElementVNode("div",{class:n.normalizeClass(o.containerdata)},[a.elementSize.width<=680?(n.openBlock(),n.createElementBlock("div",JO,[XO,n.createElementVNode("div",ZO,[t.isFemale?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode("Bienvenida ")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode("Bienvenido ")],64)),i.is_public?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createTextVNode("a GolStats ")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createTextVNode(n.toDisplayString(o.formatUsername(t.user.name)),1)],64))])])):n.createCommentVNode("",!0),a.elementSize.width>680?(n.openBlock(),n.createElementBlock("div",QO,"Inicio")):n.createCommentVNode("",!0),a.elementSize.width>680?(n.openBlock(),n.createElementBlock("div",e8,[n.createElementVNode("div",t8,[t.isFemale?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode("Bienvenida ")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode("Bienvenido ")],64)),i.is_public?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[n.createTextVNode("a GolStats ")],64)):(n.openBlock(),n.createElementBlock(n.Fragment,{key:3},[n.createTextVNode(n.toDisplayString(o.formatUsername(t.user.name)),1)],64))]),n.createElementVNode("div",s8,[n.createElementVNode("div",a8,[n.createVNode(d,{"current-season-id":t.currentSeasonId,"api-url":t.tournamentsApiUrl,onInput:o.onInputTournament,onChangeTournaments:o.onChangeTournaments},null,8,["current-season-id","api-url","onInput","onChangeTournaments"])]),n.createElementVNode("div",n8,[n.createVNode(c,{"current-season-id":t.currentSeasonId,seasons:i.tournamentSelectedDropDowns.seasons,onInput:o.onInputSeason},null,8,["current-season-id","seasons","onInput"])])])])):n.createCommentVNode("",!0),Object.keys(i.tournamentSelected).length>0?(n.openBlock(),n.createElementBlock("div",i8,[n.createVNode(f,{"component-width":a.elementSize.width,isplayer:t.isplayer,"is-full":o.isGenericLike,data:o.games,"tournament-schedule-keys":i.tournamentScheduleKeys,"default-match-day-key":i.selectedRound,user:t.user,"current-tournament":i.tournamentSelected,"current-season":i.seasonSelected.id,"is-live-button-visible":!!i.allLiveGames.length,onClickCalendar:o.onClickCalendar,onClickMatch:o.onClickMatch,onChangeMatchDay:o.onChangeMatchDayGames,onChangeIsLeagueSelected:o.onChangeIsLeagueSelected,onClickLive:o.onClickLive},null,8,["component-width","isplayer","is-full","data","tournament-schedule-keys","default-match-day-key","user","current-tournament","current-season","is-live-button-visible","onClickCalendar","onClickMatch","onChangeMatchDay","onChangeIsLeagueSelected","onClickLive"])])):n.createCommentVNode("",!0),n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(o.containerGridCalendarTable)},[n.createElementVNode("div",{class:"container-grid",style:n.normalizeStyle([a.elementSize.width<=1e3?"width: 100%; ":"",!(t.isplayer&&!o.isGenericLike)&&o.isGenericLike?"max-height: 380px !important;":"max-height: 480px !important; margin-top: 15px !important;"])},[n.createVNode(h,{isPlayer:t.isplayer&&!o.isGenericLike,"player-id":t.user.player,"team-id":t.user.team,"is-female":i.tournamentSelected.is_female==1,"tournament-selected":i.tournamentSelected,"is-public":i.is_public,"season-selected":i.seasonSelected.id,"next-rival-id":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?i.fullTournamentSchedule.data.prematch.visiting_team:i.fullTournamentSchedule.data.prematch.home_team:0,"team-img":"https://az755631.vo.msecnd.net/teams-150/"+t.user.team+".png","player-img":"https://az755631.vo.msecnd.net/players-profile/"+t.user.player+".png","rival-img":Object.keys(i.fullTournamentSchedule).length>0?t.user.team==i.fullTournamentSchedule.data.prematch.home_team?"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.visiting_team+".png":"https://az755631.vo.msecnd.net/teams-150/"+i.fullTournamentSchedule.data.prematch.home_team+".png":"","has-team":!o.isGenericLike,"component-width":a.elementSize.width,onAction:o.clickCard},null,8,["isPlayer","player-id","team-id","is-female","tournament-selected","is-public","season-selected","next-rival-id","team-img","player-img","rival-img","has-team","component-width","onAction"])],4),n.withDirectives(n.createElementVNode("div",{class:"container-calendar-table",style:n.normalizeStyle(a.elementSize.width<=1e3?"width: 100%; margin-top: 30px;":"")},[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(u,{season:i.seasonSelected,seasons:i.seasonsSelected,"tournament-type":i.tournamentType,tournament:i.tournamentSelected.id,privileges:t.privileges,"is-public":i.is_public,"is-player":t.isplayer,"is-player-tournament":t.user.tournament===i.tournamentSelected.id,"is-generic":o.isGenericLike,key:i.updateTableCalendar,"team-id":o.teamSelected,componentWidth:a.elementSize&&a.elementSize.width?a.elementSize.width:0,tournaments:i.currentTournaments,onAction:o.onAction,onOnOpenProfile:o.onOpenProfile,onOpenmedia:o.onOpenMedia},null,8,["season","seasons","tournament-type","tournament","privileges","is-public","is-player","is-player-tournament","is-generic","team-id","componentWidth","tournaments","onAction","onOnOpenProfile","onOpenmedia"])):n.createCommentVNode("",!0)],4),[[n.vShow,a.elementSize.width>1e3]])],2),o.isGenericLike?n.createCommentVNode("",!0):n.withDirectives((n.openBlock(),n.createElementBlock("div",o8,[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(g,{key:0,"tournament-selected":i.tournamentSelected,onClickProfileBtn:o.clickProfileBtn,onViewAll:o.viewAll,onTotalPlayers:o.getTotalPlayers,"team-id":t.user.team,"season-id":i.seasonSelected.id,"is-player":!!t.user.player},null,8,["tournament-selected","onClickProfileBtn","onViewAll","onTotalPlayers","team-id","season-id","is-player"])):n.createCommentVNode("",!0)],512)),[[n.vShow,i.playersLength>0]]),n.createElementVNode("div",{class:n.normalizeClass(["container-tops",t.user.tournament===i.tournamentSelected.id&&!i.is_public&&!o.isGenericLike?"tops-team":""]),style:n.normalizeStyle(!(t.isplayer&&!o.isGenericLike)&&o.isGenericLike&&a.elementSize.width<=1e3?"margin-top: 25px !important;":"hola")},[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(m,{key:0,"tournament-selected":i.tournamentSelected,onMore:o.moreTops,"show-switch":!o.isGenericLike,season:i.seasonSelected.id,"show-more":!i.is_public,"team-id":t.user.team,"active-videos":i.is_public?t.privileges.vr_privileges:!0,onOpenmedia:o.onOpenMedia},null,8,["tournament-selected","onMore","show-switch","season","show-more","team-id","active-videos","onOpenmedia"])):n.createCommentVNode("",!0)],6),i.gamesAllStories.length>0&&!i.is_public&&i.show_stories&&t.showStories?(n.openBlock(),n.createElementBlock("div",r8,[(n.openBlock(),n.createBlock(p,{key:i.keyupdate,height:"130px",pxScroll:86,scrollColor:"none",arrowsPosition:"absolute","background-color":"none",arrowsScrollHide:!0,arrowsHideOnNoScroll:!0,arrowsBackground:"rgba(255,255,255,.16)",arrowsContainerBgL:"linear-gradient(270deg, rgba(13,29,42,0.1) 0%, rgba(13,29,42,1) 70%)",arrowsContainerBgR:"linear-gradient(90deg, rgba(13,29,42,0.1) 0%, rgba(13,29,42,1) 70%)",arrowsMargin:0,arrowsRadius:"50%",arrowsBorder:"#ddd"},{default:n.withCtx(()=>[n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.gamesAllStories,(y,b)=>(n.openBlock(),n.createElementBlock("div",{key:b,class:"story-container-game",onClick:S=>o.onClickStory({item:y,index:b})},[n.createElementVNode("div",{class:"story-circle",style:n.normalizeStyle(y.is_live==1?(y.status_storie==1,"border: 2px solid #cbee6b !important;"):y.status_storie==1?"border: 2px solid #2248a2 !important;":"border: 2px solid #41485B !important;")},[n.createElementVNode("div",{class:"circle-item-home",style:n.normalizeStyle("background-image: url(https://az755631.vo.msecnd.net/teams-80/"+y.home_team+".png)")},null,4),n.createElementVNode("div",{class:"circle-item-away",style:n.normalizeStyle("background-image: url(https://az755631.vo.msecnd.net/teams-80/"+y.visiting_team+".png)")},null,4)],4),n.createElementVNode("div",c8,[n.createTextVNode(n.toDisplayString(y.home_team_acronym)+"  ",1),y.score.length>0?(n.openBlock(),n.createElementBlock("span",d8,n.toDisplayString(isNaN(y.score[0])?0:y.score[0]),1)):n.createCommentVNode("",!0),n.createTextVNode(":"),y.score.length>0?(n.openBlock(),n.createElementBlock("span",h8,n.toDisplayString(isNaN(y.score[1])?0:y.score[1]),1)):n.createCommentVNode("",!0),n.createTextVNode("  "+n.toDisplayString(y.visiting_team_acronym),1)]),n.createElementVNode("div",u8,n.toDisplayString(y.matchday_name.replace("Matchday","JOR").replace("de Final","").replace("Playoffs 1","CFI").replace("Playoffs 2","CFV").replace("Playoffs 3","SFI").replace("Playoffs 4","SFV").replace("Playoffs 5","FI").replace("Playoffs 6","FV")),1)],8,l8))),128))]),_:1}))])):n.createCommentVNode("",!0),n.withDirectives(n.createElementVNode("div",{class:"container-calendar-table",style:n.normalizeStyle(a.elementSize.width<=1e3?"width: 100%; ":"")},[i.isPreviousDataLoaded?(n.openBlock(),n.createBlock(u,{season:i.seasonSelected,seasons:i.seasonsSelected,"tournament-type":i.tournamentType,tournament:i.tournamentSelected.id,privileges:t.privileges,"is-public":i.is_public,"is-player":t.isplayer,"is-player-tournament":t.user.tournament===i.tournamentSelected.id,"is-generic":o.isGenericLike,key:i.updateTableCalendar,"team-id":o.teamSelected,componentWidth:a.elementSize&&a.elementSize.width?a.elementSize.width:0,tournaments:i.currentTournaments,onAction:o.onAction,onOnOpenProfile:o.onOpenProfile,onOpenmedia:o.onOpenMedia},null,8,["season","seasons","tournament-type","tournament","privileges","is-public","is-player","is-player-tournament","is-generic","team-id","componentWidth","tournaments","onAction","onOnOpenProfile","onOpenmedia"])):n.createCommentVNode("",!0)],4),[[n.vShow,a.elementSize.width<1e3]]),i.is_public?(n.openBlock(),n.createElementBlock("div",{key:7,class:"b2c-image",onClick:e[3]||(e[3]=(...y)=>o.abrirNuevaVentana&&o.abrirNuevaVentana(...y))})):n.createCommentVNode("",!0)],2)],2)],64))],512)}const f8=Xe(iO,[["render",m8],["__scopeId","data-v-10136421"]]);ms.GSCLanding=f8,Object.defineProperty(ms,Symbol.toStringTag,{value:"Module"})});