/*! For license information please see disney-plus-page.js.LICENSE.txt */ (()=>{var t={3452:(t,e,i)=>{var s;s="undefined"!=typeof window?window:void 0!==i.g?i.g:"undefined"!=typeof self?self:{},t.exports=s}},e={};function i(s){var r=e[s];if(void 0!==r)return r.exports;var a=e[s]={exports:{}};return t[s](a,a.exports,i),a.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";var t=function(){function t(){this.listeners={}}var e=t.prototype;return e.on=function(t,e){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e)},e.off=function(t,e){if(!this.listeners[t])return!1;var i=this.listeners[t].indexOf(e);return this.listeners[t]=this.listeners[t].slice(0),this.listeners[t].splice(i,1),i>-1},e.trigger=function(t){var e=this.listeners[t];if(e)if(2===arguments.length)for(var i=e.length,s=0;s-1;e=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,e)),this.buffer=this.buffer.substring(e+1)}}const o=String.fromCharCode(9),u=function(t){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(t||""),i={};return e[1]&&(i.length=parseInt(e[1],10)),e[2]&&(i.offset=parseInt(e[2],10)),i},g=function(t){const e={};if(!t)return e;const i=t.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))'));let s,r=i.length;for(;r--;)""!==i[r]&&(s=/([^=]*)=(.*)/.exec(i[r]).slice(1),s[0]=s[0].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^['"](.*)['"]$/g,"$1"),e[s[0]]=s[1]);return e};class c extends t{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(t){let i,s;0!==(t=t.trim()).length&&("#"===t[0]?this.tagMappers.reduce(((e,i)=>{const s=i(t);return s===t?e:e.concat([s])}),[t]).forEach((t=>{for(let e=0;et),this.customParsers.push((r=>{if(t.exec(r))return this.trigger("data",{type:"custom",data:i(r),customType:e,segment:s}),!0}))}addTagMapper({expression:t,map:e}){this.tagMappers.push((i=>t.test(i)?e(i):i))}}const p=function(t){const e={};return Object.keys(t).forEach((function(i){var s;e[(s=i,s.toLowerCase().replace(/-(\w)/g,(t=>t[1].toUpperCase())))]=t[i]})),e},d=function(t){const{serverControl:e,targetDuration:i,partTargetDuration:s}=t;if(!e)return;const r="#EXT-X-SERVER-CONTROL",a="holdBack",n="partHoldBack",o=i&&3*i,u=s&&2*s;i&&!e.hasOwnProperty(a)&&(e[a]=o,this.trigger("info",{message:`${r} defaulting HOLD-BACK to targetDuration * 3 (${o}).`})),o&&e[a]{o.uri||!o.parts&&!o.preloadHints||(!o.map&&s&&(o.map=s),!o.key&&r&&(o.key=r),o.timeline||"number"!=typeof f||(o.timeline=f),this.manifest.preloadSegment=o)})),this.parseStream.on("data",(function(n){let c,m;({tag(){({version(){n.version&&(this.manifest.version=n.version)},"allow-cache"(){this.manifest.allowCache=n.allowed,"allowed"in n||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const t={};"length"in n&&(o.byterange=t,t.length=n.length,"offset"in n||(n.offset=l)),"offset"in n&&(o.byterange=t,t.offset=n.offset),l=t.offset+t.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),n.duration>0&&(o.duration=n.duration),0===n.duration&&(o.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=i},key(){if(n.attributes)if("NONE"!==n.attributes.METHOD)if(n.attributes.URI){if("com.apple.streamingkeydelivery"===n.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:n.attributes});if("com.microsoft.playready"===n.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.microsoft.playready"]={uri:n.attributes.URI});if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===n.attributes.KEYFORMAT)return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(n.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===n.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==n.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):n.attributes.KEYID&&"0x"===n.attributes.KEYID.substring(0,2)?(this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:n.attributes.KEYFORMAT,keyId:n.attributes.KEYID.substring(2)},pssh:a(n.attributes.URI.split(",")[1])})):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}));n.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),r={method:n.attributes.METHOD||"AES-128",uri:n.attributes.URI},void 0!==n.attributes.IV&&(r.iv=n.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else r=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence"(){isFinite(n.number)?this.manifest.mediaSequence=n.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+n.number})},"discontinuity-sequence"(){isFinite(n.number)?(this.manifest.discontinuitySequence=n.number,f=n.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+n.number})},"playlist-type"(){/VOD|EVENT/.test(n.playlistType)?this.manifest.playlistType=n.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+n.playlist})},map(){s={},n.uri&&(s.uri=n.uri),n.byterange&&(s.byterange=n.byterange),r&&(s.key=r)},"stream-inf"(){this.manifest.playlists=i,this.manifest.mediaGroups=this.manifest.mediaGroups||h,n.attributes?(o.attributes||(o.attributes={}),e(o.attributes,n.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||h,!(n.attributes&&n.attributes.TYPE&&n.attributes["GROUP-ID"]&&n.attributes.NAME))return void this.trigger("warn",{message:"ignoring incomplete or missing media group"});const t=this.manifest.mediaGroups[n.attributes.TYPE];t[n.attributes["GROUP-ID"]]=t[n.attributes["GROUP-ID"]]||{},c=t[n.attributes["GROUP-ID"]],m={default:/yes/i.test(n.attributes.DEFAULT)},m.default?m.autoselect=!0:m.autoselect=/yes/i.test(n.attributes.AUTOSELECT),n.attributes.LANGUAGE&&(m.language=n.attributes.LANGUAGE),n.attributes.URI&&(m.uri=n.attributes.URI),n.attributes["INSTREAM-ID"]&&(m.instreamId=n.attributes["INSTREAM-ID"]),n.attributes.CHARACTERISTICS&&(m.characteristics=n.attributes.CHARACTERISTICS),n.attributes.FORCED&&(m.forced=/yes/i.test(n.attributes.FORCED)),c[n.attributes.NAME]=m},discontinuity(){f+=1,o.discontinuity=!0,this.manifest.discontinuityStarts.push(i.length)},"program-date-time"(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=n.dateTimeString,this.manifest.dateTimeObject=n.dateTimeObject),o.dateTimeString=n.dateTimeString,o.dateTimeObject=n.dateTimeObject},targetduration(){!isFinite(n.duration)||n.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+n.duration}):(this.manifest.targetDuration=n.duration,d.call(this,this.manifest))},start(){n.attributes&&!isNaN(n.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:n.attributes["TIME-OFFSET"],precise:n.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out"(){o.cueOut=n.data},"cue-out-cont"(){o.cueOutCont=n.data},"cue-in"(){o.cueIn=n.data},skip(){this.manifest.skip=p(n.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",n.attributes,["SKIPPED-SEGMENTS"])},part(){u=!0;const t=this.manifest.segments.length,e=p(n.attributes);o.parts=o.parts||[],o.parts.push(e),e.byterange&&(e.byterange.hasOwnProperty("offset")||(e.byterange.offset=b),b=e.byterange.offset+e.byterange.length);const i=o.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${i} for segment #${t}`,n.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach(((t,e)=>{t.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${e} lacks required attribute(s): LAST-PART`})}))},"server-control"(){const t=this.manifest.serverControl=p(n.attributes);t.hasOwnProperty("canBlockReload")||(t.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),d.call(this,this.manifest),t.canSkipDateranges&&!t.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const t=this.manifest.segments.length,e=p(n.attributes),i=e.type&&"PART"===e.type;o.preloadHints=o.preloadHints||[],o.preloadHints.push(e),e.byterange&&(e.byterange.hasOwnProperty("offset")||(e.byterange.offset=i?b:0,i&&(b=e.byterange.offset+e.byterange.length)));const s=o.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${s} for segment #${t}`,n.attributes,["TYPE","URI"]),e.type)for(let i=0;i{async function t(e){const i=function(){const t=document.getElementsByClassName("title-field"),e=document.getElementsByClassName("subtitle-field");let i=null,s=null;return t.length>0&&(i=t[0].textContent),e.length>0&&(s=e[0].textContent),null===i?"":null===s?i:`${i} ${s}`}();return 0===e?i:""===i?new Promise(((i,s)=>{setTimeout((async()=>i(await t(e-1))),1e3)})):i}function e(t){return t.substring(0,t.lastIndexOf("/"))}let i;const s=JSON.parse;JSON.parse=function(){const t=s.apply(this,arguments);if(t?.stream?.sources instanceof Array&&t.stream.sources.length>0){const s=t.stream.sources[0].complete?.url;s&&(i=function(t){return new Promise(((i,s)=>{setTimeout((async()=>{try{const r=await function(t){return new Promise(((e,i)=>{setTimeout((()=>{fetch(t).then((t=>t.text())).then((t=>{const i=new h;i.push(t),i.end(),e(i.manifest)})).catch(i)}),0)}))}(t);if(r.playlists instanceof Array&&r.playlists.length>0){const s=r.mediaGroups?.SUBTITLES;if(s&&s["sub-main"]){const r=s["sub-main"],a=[];for(const i of Object.keys(r)){const s=r[i];if(s&&"string"==typeof s.language&&"string"==typeof s.uri){const r=`${e(t)}/${s.uri}`;a.push({label:i,language:s.language,url:r,m3U8BaseUrl:e(r),extension:"m3u8"})}}return void i(a)}}s(new Error("Subtitles not found."))}catch(t){s(t)}}),0)}))}(s))}return t},document.addEventListener("asbplayer-get-synced-data",(async()=>{if(i)try{const e=await i;i=void 0,e.sort(((t,e)=>t.labele.label?1:0)),document.dispatchEvent(new CustomEvent("asbplayer-synced-data",{detail:{error:"",basename:await t(10)??"",extension:"m3u8",subtitles:e}}))}catch(t){document.dispatchEvent(new CustomEvent("asbplayer-synced-data",{detail:{error:t instanceof Error?t.message:String(t),basename:"",extension:"m3u8",subtitles:[]}}))}else document.dispatchEvent(new CustomEvent("asbplayer-synced-data",{detail:{error:"Could not extract subtitle track information.",basename:"",subtitles:[]}}))}),!1)}),0)})()})();