@viewlift/player-backup 2.0.375-backup → 2.0.376-backup

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.
Files changed (66) hide show
  1. package/cjs/{autoNextVideo-8316b7c4.js → autoNextVideo-d014b6e0.js} +1 -1
  2. package/cjs/bundle.css +428 -428
  3. package/cjs/{features-541cfdcb.js → features-8a3c29d7.js} +1 -1
  4. package/cjs/{generic-ddb9f830.js → generic-4ae5602c.js} +1 -1
  5. package/cjs/{index-91441ebe.js → index-24bf35bd.js} +1 -1
  6. package/cjs/index-774736bd.js +1 -0
  7. package/cjs/index-f3365b73.js +1 -0
  8. package/cjs/{index-7017ec38.js → index-f3d67a94.js} +1 -1
  9. package/cjs/{index-6822b5b5.js → index-f3f48477.js} +1 -1
  10. package/cjs/index.js +1 -1
  11. package/cjs/{multicamv2-e214d56d.js → multicamv2-aebcf40b.js} +1 -1
  12. package/cjs/{multicamv2-f859af0e.js → multicamv2-d8d221dd.js} +1 -1
  13. package/cjs/{nextEpisodeButton-d818eff8.js → nextEpisodeButton-d95e7bdc.js} +1 -1
  14. package/cjs/{playlist-67d74a2b.js → playlist-b2f07413.js} +1 -1
  15. package/cjs/{series-2fbef62b.js → series-7c67fc81.js} +1 -1
  16. package/cjs/{series-v2-0f61d2e5.js → series-v2-3968ecf4.js} +1 -1
  17. package/cjs/{series-v2-663e3ea7.js → series-v2-78f6b95a.js} +1 -1
  18. package/cjs/{skin-7a90fce9.js → skin-0517c551.js} +1 -1
  19. package/cjs/{skin-2db97eac.js → skin-102cabb5.js} +1 -1
  20. package/cjs/{skin-ef4a5769.js → skin-1f210273.js} +1 -1
  21. package/cjs/{skin-ca2b0407.js → skin-3bb8a9bf.js} +1 -1
  22. package/cjs/{skin-1b6bad92.js → skin-3db6272d.js} +1 -1
  23. package/cjs/{skin-730b9c41.js → skin-431b10b8.js} +1 -1
  24. package/cjs/{skin-ecb40ff3.js → skin-6463d5b1.js} +1 -1
  25. package/cjs/{skin-c7284d41.js → skin-65de5d2e.js} +1 -1
  26. package/cjs/{skin-4701bbb1.js → skin-914eb9db.js} +1 -1
  27. package/cjs/{skin-d007d625.js → skin-d519da59.js} +1 -1
  28. package/cjs/{videoSelector-dec6e057.js → videoSelector-b732a762.js} +1 -1
  29. package/cjs/{videoSelector-5b39b88d.js → videoSelector-f43303bd.js} +1 -1
  30. package/esm/{autoNextVideo-d90e89be.js → autoNextVideo-b2ddf881.js} +1 -1
  31. package/esm/bundle.css +428 -428
  32. package/esm/{features-5a73d4fc.js → features-9e2baef8.js} +1 -1
  33. package/esm/{generic-061851d1.js → generic-eb13663c.js} +1 -1
  34. package/esm/index-28ebfa21.js +1 -0
  35. package/esm/{index-7a550e72.js → index-332dbf74.js} +1 -1
  36. package/esm/{index-d120a4cc.js → index-3b81e5fe.js} +1 -1
  37. package/esm/{index-f648e9c2.js → index-a9c6d5d8.js} +1 -1
  38. package/esm/index-cbb86a6c.js +1 -0
  39. package/esm/index.js +1 -1
  40. package/esm/{multicamv2-5b81efa1.js → multicamv2-7d1ffd86.js} +1 -1
  41. package/esm/{multicamv2-baf41d9b.js → multicamv2-e3c0d0d9.js} +1 -1
  42. package/esm/{nextEpisodeButton-f9a2d975.js → nextEpisodeButton-11b1fa06.js} +1 -1
  43. package/esm/{playlist-a47b041e.js → playlist-cb04c889.js} +1 -1
  44. package/esm/{series-1cc84308.js → series-ac134521.js} +1 -1
  45. package/esm/{series-v2-0698df9c.js → series-v2-06f521ce.js} +1 -1
  46. package/esm/{series-v2-f913e362.js → series-v2-37717af4.js} +1 -1
  47. package/esm/{settings-icon-3d9ec523.js → settings-icon-43390aef.js} +1 -1
  48. package/esm/{skin-00d58c5d.js → skin-2afe6ef1.js} +1 -1
  49. package/esm/{skin-c1bd2da5.js → skin-341b9a62.js} +1 -1
  50. package/esm/{skin-d5dea9b2.js → skin-56f99a67.js} +1 -1
  51. package/esm/{skin-84df67c6.js → skin-6e0916ac.js} +1 -1
  52. package/esm/{skin-ff84766b.js → skin-7aa5e4f5.js} +1 -1
  53. package/esm/{skin-426412d0.js → skin-7f5ab942.js} +1 -1
  54. package/esm/{skin-97dde5c6.js → skin-977f1785.js} +1 -1
  55. package/esm/{skin-60971e8f.js → skin-a55e8e1d.js} +1 -1
  56. package/esm/{skin-e0a3db9a.js → skin-ab1fba9b.js} +1 -1
  57. package/esm/{skin-c3aee0cd.js → skin-fd6cbbf4.js} +1 -1
  58. package/esm/{videoSelector-3149d4ee.js → videoSelector-0391e90b.js} +1 -1
  59. package/esm/{videoSelector-3fa509f9.js → videoSelector-6c8f29bd.js} +1 -1
  60. package/package.json +1 -1
  61. package/cjs/_commonjsHelpers-81c4d214.js +0 -1
  62. package/cjs/index-62250ea0.js +0 -1
  63. package/cjs/index-9ff76281.js +0 -1
  64. package/esm/_commonjsHelpers-0307ea52.js +0 -1
  65. package/esm/index-23afe568.js +0 -1
  66. package/esm/index-c4656b30.js +0 -1
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import n from"@babel/runtime/helpers/asyncToGenerator";import t from"@babel/runtime/regenerator";import i from"video.js";import r from"axios";import{p as o}from"./manager-d812dea7.js";import{g as a,t as l,c as s}from"./skin-2a3ee818.js";import{i as d,a as u,d as c}from"./browser-de5f6a74.js";import v from"md5";import f from"js-cookie";import{b as m,a as p}from"./captions-8c8e9f2b.js";import h from"@babel/runtime/helpers/typeof";import g from"@babel/runtime/helpers/toConsumableArray";import y from"@babel/runtime/helpers/slicedToArray";import{destroyComscoreTag as w,formulateComscorePayload as T,createComscoreStreamingTag as _,setComscorePlayerInstance as b}from"@viewlift/comscore/index.js";import I from"@babel/runtime/helpers/classCallCheck";import E from"@babel/runtime/helpers/createClass";import{m as S}from"./playerControlEvents-96ef1a5d.js";function k(){var e,n;null===(e=window)||void 0===e||null===(n=e.dataLayer)||void 0===n||n.push(arguments)}function A(e){window.dataLayer=window.dataLayer||[],k("js",new Date),k("config",e)}function O(e,n){k("event",e,n)}var D={name:"@viewlift/player",version:"2.1.70",main:"dist/bundle.cjs.js",types:"dist/@viewlift/player/esm/index.d.ts",amdName:"_playerCore",scripts:{prepublishOnly:"release-assistant","test:chromecast":"mocha -- 'remote/chromecast/tests/**/*.test.js'","test:airplay":"mocha -- 'remote/airplay/tests/**/*.test.js'"},dependencies:{"@viewlift/sse":"^0.0.3","broadcast-channel":"^7.3.0","@viewlift/comscore":"^1.0.19",axios:"^1.18.1",md5:"^2.3.0",ima:"npm:videojs-ima@2.2.0","js-cookie":"^3.0.5","jwt-decode":"^4.0.0","video.js":"8.22.0","videojs-contrib-ads":"7.5.2","videojs-contrib-eme":"5.5.1","videojs-mux":"^4.21.7","videojs-contrib-quality-menu":"^1.0.3","webcomponents.js":"git+https://git@github.com/webcomponents/webcomponentsjs.git#v0.7.24"},devDependencies:{"expect.js":"^0.3.1",mocha:"^10.8.2",sinon:"^2.4.1"},overrides:{"min-document":"^2.19.1"}},P={apiBaseUrl:"https://prod-api.viewlift.com",getVideoDetails:"/entitlement/video/status",getSeriesDetails:"/entitlement/series/status",saveWatchHistoryV1:"/user/userId/history/video",saveWatchHistoryV2:"/v2/user/history",getVideoInfoV1:"/user/info/video",getVideoInfoV2:"/v2/user/info",getSeriesWatchHistoryV1:"/user/userId/history/video",getSeriesWatchHistoryV2:"/v2/user/history/series",getLinearChannelDetails:"/v3/entitlement/linearchannel",getBeaconUrl:"/analytics/player-beacon"},L=function(e){return!!e&&"drm"===function(e){var n;if(5===Number(null==e?void 0:e.code))return"drm";var t="".concat(null!==(n=null==e?void 0:e.code)&&void 0!==n?n:""," ").concat(function(e){var n,t,i,r,o;return(null==e||null===(n=e.response)||void 0===n||null===(t=n.data)||void 0===t?void 0:t.errorMessage)||(null==e||null===(i=e.response)||void 0===i||null===(r=i.data)||void 0===r?void 0:r.message)||(null==e||null===(o=e.response)||void 0===o?void 0:o.statusText)||(null==e?void 0:e.message)||"unknown_error"}(e)).toLowerCase();return/(drm|license|widevine|playready|fairplay|eme|key|hdcp)/.test(t)?"drm":/(network|manifest|segment|playlist|http|xhr|fetch|timeout)/.test(t)?"network":/(decode|mediaerror|mediasource|appendbuffer|sourcebuffer)/.test(t)?"decode":"player"}(e)},C=function(e,n){var t=String(n||"").toLowerCase();if(t.includes("license"))return"license";if(t.includes("certificate"))return"server_certificate";if(t.includes("manifest"))return"manifest";if(t.includes("key"))return"key";if(t.includes("segment")||t.includes("media"))return"segment";var i=String(e||"").split("?")[0].toLowerCase();return i.endsWith(".mpd")||i.endsWith(".m3u8")||i.endsWith(".ism/manifest")?"manifest":/\.(m4s|mp4|m4a|m4v|ts|aac|webm|cmf[av]|mp4a)$/.test(i)?"segment":/license|widevine|playready|fairplay|drm/.test(i)?"license":/cert|certificate/.test(i)?"server_certificate":/\.key($|\?)/.test(i)||/\/key\//.test(i)?"key":"other"},F=new Set(["license","key","server_certificate"]),j=function(e){return F.has(e)},R=function(e,n){for(var t=0,i=[null==e?void 0:e.statusCode,null==e?void 0:e.status,null==e?void 0:e.code,null==n?void 0:n.statusCode,null==n?void 0:n.status,null==n?void 0:n.code];t<i.length;t++){var r=Number(i[t]);if(Number.isFinite(r)&&r>0)return r}return null},W=function(e){return null==e||e>=200&&e<400};function V(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}var M="asset_not_found",N="geo_blocking_issue",x="entitlement_mismatch",U="DRM/License Failures",B=new Set(["contentgeorestricted","contentgeorestrictedbyhba","content_not_available_for_country"]),H=[/geo[\s_-]?block/i,/geo[\s_-]?restrict/i,/geographic/i,/not available in your/i,/outside.*(?:region|country|territory)/i,/\bcountry\b/i,/\bterritory\b/i],G=[/entitlement/i,/not entitled/i,/subscription/i,/not subscribed/i,/access denied/i,/\bunauthorized\b/i,/\bforbidden\b/i,/\bpremium\b/i,/upgrade required/i,/tv[\s_-]?provider/i,/\bprovider\b/i],q=[/not found/i,/no content/i,/does not exist/i,/\bmissing\b/i,/not available currently/i,/not available/i],z=function(e,n,t,i){var r=Number(e),o=String(n||"");return L(i)?U:B.has(function(e){return String(e||"").toLowerCase().replace(/[\s-]/g,"_")}(t))||H.some((function(e){return e.test(o)}))?N:G.some((function(e){return e.test(o)}))?x:q.some((function(e){return e.test(o)}))||404===r?M:451===r?N:x},Q=function(n,t,i){var r,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};console.log("emitApiErrorEvent",{apiName:n,error:t,errorCategory:i,meta:a});var l,s,d,u,c,v=(null==(c=o.getConfig()||{})?void 0:c.apiErrorCb)||(null==c?void 0:c.onApiError)||(null==c||null===(l=c.customData)||void 0===l?void 0:l.apiErrorCb)||(null==c||null===(s=c.customData)||void 0===s?void 0:s.onApiError)||(null==c||null===(d=c.customData)||void 0===d||null===(u=d.callbacks)||void 0===u?void 0:u.onApiError)||null;if("function"==typeof v){console.log("emitApiErrorEvent",t);var f=(null==t||null===(r=t.response)||void 0===r?void 0:r.status)||(null==t?void 0:t.status)||0,m=function(e){var n,t,i,r,o;return(null==e||null===(n=e.response)||void 0===n||null===(t=n.data)||void 0===t?void 0:t.errorMessage)||(null==e||null===(i=e.response)||void 0===i||null===(r=i.data)||void 0===r?void 0:r.message)||(null==e||null===(o=e.response)||void 0===o?void 0:o.statusText)||(null==e?void 0:e.message)||"unknown_error"}(t),p=function(e){var n,t,i,r,o,a;return(null==e||null===(n=e.response)||void 0===n||null===(t=n.data)||void 0===t?void 0:t.errorCode)||(null==e||null===(i=e.response)||void 0===i||null===(r=i.data)||void 0===r?void 0:r.error_code)||(null==e||null===(o=e.response)||void 0===o||null===(a=o.data)||void 0===a?void 0:a.code)||(null==e?void 0:e.errorCode)||null}(t),h=z(f,m,p,t),g=function(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?V(Object(i),!0).forEach((function(t){e(n,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):V(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}({errorcode:f||p,errormessage:m,errorcategory:i||h},a);n&&(g.apiPath=n);try{v(h,g)}catch(e){console.warn("[VLPlayer] apiError callback failed:",e)}}};function Y(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function K(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Y(Object(i),!0).forEach((function(t){e(n,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):Y(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}var J=D;window.vl_player_version=J.version;var X,$=["videoDetails","linearChannel","series","entitlementData"],Z=function(e,n){var t,i,r;return null!==(t=null==e||null===(i=e.endpoints)||void 0===i||null===(r=i[n])||void 0===r?void 0:r.useGlobal)&&void 0!==t?t:$.includes(n)},ee=function(e){var n,t,i,r=null===(n=o.getConfig())||void 0===n?void 0:n.api;return K(K({},Z(r,e)&&(null==r?void 0:r.headers)),null==r||null===(t=r.endpoints)||void 0===t||null===(i=t[e])||void 0===i?void 0:i.headers)},ne=function(e){var n,t,i,r=null===(n=o.getConfig())||void 0===n?void 0:n.api;return K(K({},Z(r,e)&&(null==r?void 0:r.params)),null==r||null===(t=r.endpoints)||void 0===t||null===(i=t[e])||void 0===i?void 0:i.params)},te=function(){var e,n,t,i;return null!==(e=window)&&void 0!==e&&null!==(n=e.customData)&&void 0!==n&&n.overrideEntitlementBaseUrl?(null===(t=window)||void 0===t||null===(i=t.customData)||void 0===i?void 0:i.overrideEntitlementBaseUrl)+"/video/status":de.get()+"".concat(null==P?void 0:P.getVideoDetails)},ie=function(e,n){var t,i,o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(null!==(t=window)&&void 0!==t&&null!==(i=t.customData)&&void 0!==i&&i.overrideEntitlementResponse)return new Promise((function(e,n){var t,i;return e({data:null===(t=window)||void 0===t||null===(i=t.customData)||void 0===i?void 0:i.overrideEntitlementResponse})}));var a,l,s,d,u=te();return r({url:te(),params:K(K({id:e,deviceType:"web_browser",contentConsumption:"web",ssaiDisable:o},null===(a=window)||void 0===a||null===(l=a.customData)||void 0===l?void 0:l.entitlement),ne("videoDetails")),method:"GET",headers:K({Authorization:n,"Sdk-Version":J.version,"x-player-name":"videojs",adbTempToken:null===(s=window)||void 0===s||null===(d=s.customData)||void 0===d?void 0:d.adbTempToken},ee("videoDetails")),withCredentials:!0}).catch((function(n){throw Q(u,n,"content",{videoId:e}),n}))},re=function(e,n){var t,i,o,a,l,s,d=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(null!==(t=window)&&void 0!==t&&null!==(i=t.customData)&&void 0!==i&&i.overrideEntitlementResponse)return new Promise((function(e,n){var t,i;return e({data:null===(t=window)||void 0===t||null===(i=t.customData)||void 0===i?void 0:i.overrideEntitlementResponse})}));var u=de.get()+P.getLinearChannelDetails;return r({url:u,params:K(K(K(K(K(K({id:null==e?void 0:e.id,deviceType:"web_browser",contentConsumption:"web",ssaiDisable:d},(null==e?void 0:e.channelId)&&{channelId:null==e?void 0:e.channelId}),(null==e?void 0:e.programId)&&{programId:null==e?void 0:e.programId}),(null==e?void 0:e.programTitle)&&{programTitle:null==e?void 0:e.programTitle}),(null==e?void 0:e.programSubType)&&{programSubType:null==e?void 0:e.programSubType}),null===(o=window)||void 0===o||null===(a=o.customData)||void 0===a?void 0:a.entitlement),ne("linearChannel")),method:"GET",headers:K({Authorization:n,hdcp:"HDCP-1.4",sl:"SW_SECURE_CRYPTO",adbTempToken:null===(l=window)||void 0===l||null===(s=l.customData)||void 0===s?void 0:s.adbTempToken},ee("linearChannel"))}).catch((function(n){throw Q(u,n,"content",{videoId:null==e?void 0:e.id,channelId:null==e?void 0:e.channelId,programId:null==e?void 0:e.programId}),n}))},oe=function(e,n){var t,i,o=Se(n),a=(null==o?void 0:o.site)||null;if(null!==(t=window)&&void 0!==t&&null!==(i=t.customData)&&void 0!==i&&i.seriesData)return new Promise((function(e,n){var t,i;return e({data:null===(t=window)||void 0===t||null===(i=t.customData)||void 0===i?void 0:i.seriesData})}));var l=de.get()+"/v3/content/series/".concat(e);return r({url:l,params:K({site:a},ne("series")),method:"GET",headers:K({Authorization:n},ee("series"))}).catch((function(n){throw Q(l,n,"content",{videoId:e}),n}))},ae=function(){var e=n(t.mark((function e(n){var i;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ie();case 2:return i=e.sent,e.abrupt("return",r({url:de.get()+"".concat(null==P?void 0:P.saveWatchHistoryV2),method:"POST",headers:K({Authorization:i},ee("saveWatchHistory")),data:K({},n),params:K(K({},(null==n?void 0:n.profileId)&&{profileId:null==n?void 0:n.profileId}),ne("saveWatchHistory"))}).catch((function(e){throw Q("saveWatchHistory",e,"content",{videoId:null==n?void 0:n.videoId,profileId:null==n?void 0:n.profileId}),e})));case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),le=function(e,n){var t,i,o=window.contentType,a=de.get()+"".concat(null==P?void 0:P.getVideoInfoV2,"/").concat(o,"/").concat(e);return r({method:"GET",url:a,headers:K({Authorization:n,"x-api-key":null===(t=window)||void 0===t||null===(i=t.watchHistory)||void 0===i?void 0:i.xApiKey},ee("videoInfo")),params:ne("videoInfo"),timeout:15e3}).catch((function(n){throw Q(a,n,"content",{videoId:e,contentType:o}),n}))},se=function(e){var n=e.videoId,t=de.get()+"".concat(null==P?void 0:P.getSeriesWatchHistoryV2,"/").concat(n);return r({method:"GET",url:t,headers:K({Authorization:e.token},ee("seriesWatchHistory")),params:ne("seriesWatchHistory"),timeout:15e3}).catch((function(i){throw Q(t,i,"content",{seriesId:n,videoId:null==e?void 0:e.videoId}),i}))},de=(X=null==P?void 0:P.apiBaseUrl,{set:function(e){e&&(X=e)},get:function(){return X}}),ue=function(e,n,t,i){var o,a;return r({url:t,params:K({id:e,deviceType:"web_browser",contentConsumption:"web",latitude:null==i?void 0:i.latitude,longitude:null==i?void 0:i.longitude},ne("entitlementData")),method:"GET",headers:K({Authorization:n,adbTempToken:null===(o=window)||void 0===o||null===(a=o.customData)||void 0===a?void 0:a.adbTempToken},ee("entitlementData")),withCredentials:!0}).catch((function(n){throw Q(t,n,"content",{videoId:e,url:t}),n}))},ce=function(e){var n=JSON.parse(atob(null==e?void 0:e.split(".")[1])),t=null==n?void 0:n.exp;if(new Date(1e3*t).getTime()<(new Date).getTime())return!0},ve=null;function fe(){return{set:function(e){e&&(ve=e)},get:function(){return ve}}}var me,pe,he,ge,ye,we,Te,_e=function(){var e=n(t.mark((function e(){var n,i,o;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=fe().get(),i=de.get(),n){e.next=4;break}throw new Error("Missing refresh token");case 4:return e.prev=4,e.next=7,r({method:"GET",url:"".concat(i,"/identity/refresh/").concat(n),headers:ee("refreshToken"),params:ne("refreshToken")});case 7:return o=e.sent,e.abrupt("return",o);case 11:throw e.prev=11,e.t0=e.catch(4),e.t0;case 14:case"end":return e.stop()}}),e,null,[[4,11]])})));return function(){return e.apply(this,arguments)}}(),be=null,Ie=function(){var e=n(t.mark((function e(){var n;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=sessionStorage.getItem("vlp_token"))||!ce(n)){e.next=6;break}return be||(be=_e().then((function(e){var t,i,r=null==e||null===(t=e.data)||void 0===t?void 0:t.authorizationToken,o=null==e||null===(i=e.data)||void 0===i?void 0:i.refreshToken;return r&&sessionStorage.setItem("vlp_token",r),o&&fe().set(o),r||n})).catch((function(e){return n})).finally((function(){be=null}))),e.abrupt("return",be);case 6:return e.abrupt("return",n);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ee=function(e){var n=!0,t=null==e?void 0:e.videoSourceUrl,i=null==e?void 0:e.asat;return t&&!i&&(n=!1),n},Se=function(e){if(e&&"string"==typeof e)return JSON.parse(atob(e.split(".")[1]))},ke=function(e){e&&"undefined"!=typeof window&&window.sessionStorage&&window.sessionStorage.setItem("uid",e)},Ae=(we=new Map,{set:function(e){var n,t=(null==e||null===(n=e.video)||void 0===n?void 0:n.id)||e||null;we.set(t,(we.get(t)||0)+1)},get:function(e){return we.get(e)},clear:function(){we.clear()}}),Oe=function(e){pe=e},De=function(){return pe},Pe=function(e){me=e},Le=function(){return me},Ce=function(){return he},Fe=function(e){he=e},je=function(){return ye},Re=function(e){ge=new Map,e.map((function(e,n){ge.set(e.id,n)}))},We=function(e){if(ge){var n=ge.get(e);Fe(n+1)}},Ve=(Te=0,{set:function(e){e>=0&&(Te=e)},get:function(){return Te}});function Me(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Ne(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Me(Object(i),!0).forEach((function(t){e(n,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):Me(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}var xe=0,Ue=null,Be=null,He=!1,Ge=!1,qe=[],ze=null;function Qe(e,n,t,i){e&&(i?e.one(n,t):e.on(n,t),qe.push({type:"player",player:e,event:n,handler:t}))}function Ye(e,n,t){if(e){var i=qe.findIndex((function(i){return"player"===i.type&&i.player===e&&i.event===n&&i.handler===t}));-1!==i&&qe.splice(i,1),e.off(n,t)}}function Ke(e,n,t){var i;e&&null!=e&&e.ima&&"function"==typeof(null==e||null===(i=e.ima)||void 0===i?void 0:i.addEventListener)&&(e.ima.addEventListener(n,t),qe.push({type:"ima",player:e,eventType:n,handler:t}))}var Je=function(){if(ze){try{var e=ze,n=e.seekToLive,t=e.originalHandleClick;n&&"function"==typeof t&&(n.handleClick=t)}catch(e){console.error(e)}ze=null}},Xe=function(){qe.forEach((function(e){try{"player"===e.type?e.player.off(e.event,e.handler):"ima"===e.type&&function(e,n,t){if(null!=e&&e.ima){var i=e.ima;if("function"!=typeof i.removeEventListener){var r="function"==typeof i.getAdsManager?i.getAdsManager():null;r&&"function"==typeof r.removeEventListener&&r.removeEventListener(n,t)}else i.removeEventListener(n,t)}}(e.player,e.eventType,e.handler)}catch(e){console.error(e)}})),qe.length=0,Je(),xe=0,Ue=null,Be=null,He=!1,Ge=!1,"function"==typeof window.cleanupTimers&&window.cleanupTimers()},$e=function(){var e,n,t,i,r,o,a,l=De();return"linearchannel"==((null==l?void 0:l.contentType)||"video")?null==l||null===(e=l.linearchannel)||void 0===e||null===(n=e.channels)||void 0===n||null===(t=n.find((function(e){return(null==e?void 0:e.id)===(null==l?void 0:l.channelId)})))||void 0===t||null===(i=t.content)||void 0===i?void 0:i.id:(null==l||null===(r=l.video)||void 0===r||null===(o=r.gist)||void 0===o?void 0:o.id)||(null==l||null===(a=l.video)||void 0===a?void 0:a.id)||(null==l?void 0:l.id)},Ze=null,en=null,nn=function(){var e,n,t=$e();return"linearchannel"===(null===(e=De())||void 0===e?void 0:e.contentType)&&t&&t===en&&Ze||(en=t,Ze=(n=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)})()+n()+"-"+n()+"-"+n()+"-"+n()+"-"+n()+n()+n()),Ze},tn=function(){var e=De(),n=(null==e?void 0:e.contentType)||"video",t="";if("undefined"==typeof window)return"";if("linearchannel"===n){var i,r,o,a;t=null===(i=window)||void 0===i||null===(r=i.customData)||void 0===r||null===(o=r.beacon)||void 0===o||null===(a=o.params)||void 0===a?void 0:a.title}else{var l,s,d,u,c,v,f=null==e||null===(l=e.video)||void 0===l||null===(s=l.gist)||void 0===s?void 0:s.title,m=null===(d=window)||void 0===d||null===(u=d.customData)||void 0===u||null===(c=u.beacon)||void 0===c||null===(v=c.params)||void 0===v?void 0:v.title;t=m||f?m===f?m:f:""}return t};function rn(){return Ue||window.sessionStorage.getItem("uid")}function on(){return an.apply(this,arguments)}function an(){return(an=n(t.mark((function e(){var n,i;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ie();case 2:if(!(n=e.sent)){e.next=10;break}if(null==(i=JSON.parse(atob(n.split(".")[1])))||!i.anonymousId){e.next=9;break}return e.abrupt("return","guest-user");case 9:return e.abrupt("return",null==i?void 0:i.userId);case 10:return e.abrupt("return","guest-user");case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}window.initialise=function(e){window.sid=nn(),window.environment="production",window.platform="WEBSITE",window.failedToStartTimer=null,window.droppedStreamTimer=null,window.firstFrameFired=!1,window.isAdPlaying=!1,window._pingTimes=[],window._pingTimeUpdateHandler=null,streamFailures(e),buffering(e),ads(e),ping(e),ln(e),sn(e)};var ln=function(e){Qe(e,"play",(function(){"pause"!==Be||e.scrubbing()||(Be="play",O("RESUME",{pfm:window.platform,uid:rn(),vid:$e(),videoPosition:Math.floor(e.currentTime())}),fireEvent({eventName:"RESUME",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1}))})),Qe(e,"playing",(function(){window.firstFrameFired&&!e.scrubbing()&&(Be="play")})),Qe(e,"pause",(function(){setTimeout((function(){!He&&window.firstFrameFired&&"play"===Be&&(Be="pause",O("PAUSE",{pfm:window.platform,uid:rn(),vid:$e(),videoPosition:Math.floor(e.currentTime())}),fireEvent({eventName:"PAUSE",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1}))}),50)}))},sn=function(e){if(e){var n=0,t=0,i=0,r=0;Qe(e,"timeupdate",o),Qe(e,"seeking",(function(){He||(He=!0,Ye(e,"timeupdate",o),Qe(e,"seeked",a,!0))})),Qe(e,"seeked",a)}function o(){n=t,t=Math.floor(e.currentTime()),n<t&&(r=n,n=t)}function a(){if(Ge)Ge=!1;else{i=Math.floor(e.currentTime());var n=Math.floor(i-r);if(0!==n&&window.firstFrameFired){var t=n>0?"SEEK_FORWARD":"SEEK_BACKWARD";O(t,{pfm:window.platform,uid:rn(),vid:$e(),videoPosition:Math.floor(e.currentTime())}),fireEvent({eventName:t,videoPosition:Math.floor(e.currentTime()),isAdEvent:!1})}r=Math.floor(e.currentTime()),setTimeout((function(){He=!1}),50),Qe(e,"timeupdate",o)}}};window.cleanupTimers=function(){clearInterval(window.bufferingTimer),clearTimeout(window.failedToStartTimer),clearTimeout(window.droppedStreamTimer),window.failedToStartTimer=null,window.droppedStreamTimer=null},window.fireStreamFailure=function(e){var n,t,i,r=a(),o=null!=r&&r.el_?Math.floor(r.currentTime()):0;window.cleanupTimers(),O(e,Ne({pfm:window.platform,uid:rn(),vid:$e(),videoPosition:o},null===(n=window)||void 0===n||null===(t=n.customData)||void 0===t||null===(i=t.beacon)||void 0===i?void 0:i.params)),fireEvent({eventName:e,videoPosition:o,isAdEvent:!1})},window.streamFailures=function(e){Qe(e,"error",(function(){var e=window.firstFrameFired?"DROPPED_STREAM":"FAILED_TO_START";window.fireStreamFailure(e)}))},window.firstFrame=function(e,n,t){Qe(e,"play",tryCatch((function(){var i,r,o;window.ttFirstFrameStartTime_In_MS=performance.now(),Be="play",window.failedToStartTimer=setTimeout((function(){window.firstFrameFired||window.fireStreamFailure("FAILED_TO_START")}),3e4),O("PLAY",Ne({pfm:window.platform,uid:rn(),vid:$e(),videoPosition:Math.floor(e.currentTime())},null===(i=window)||void 0===i||null===(r=i.customData)||void 0===r||null===(o=r.beacon)||void 0===o?void 0:o.params)),fireEvent({eventName:"PLAY",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1}),n&&n("started_video_playback",Ne({"Video ID":$e(),watchTime:Math.floor(e.currentTime())},t))})),!0)},window.buffering=function(e){Qe(e,"waiting",tryCatch((function(){window.firstFrameFired&&(e.currentTime(),clearInterval(window.bufferingTimer),window.bufferingTimer=setInterval((function(){var n,t;null!=e&&null!==(n=e.el_)&&void 0!==n&&null!==(t=n.className)&&void 0!==t&&t.includes("vjs-waiting")&&!e.paused()?window.totalBufferTime=window.handleBufferTimer?window.handleBufferTimer(window.totalBufferTime,e):null:(clearInterval(window.bufferingTimer),clearTimeout(window.droppedStreamTimer),window.droppedStreamTimer=null)}),100),window.firstFrameFired&&(clearTimeout(window.droppedStreamTimer),window.droppedStreamTimer=setTimeout((function(){var n,t;null!=e&&null!==(n=e.el_)&&void 0!==n&&null!==(t=n.className)&&void 0!==t&&t.includes("vjs-waiting")&&!e.paused()&&window.fireStreamFailure("DROPPED_STREAM")}),45e3)))})))},window.handleBufferTimer=function(e,n){var t,i;if(n.el_){var r,o,a,l=e+.1;if(+l.toFixed(2)%5==0&&null!=n&&null!==(t=n.el_)&&void 0!==t&&null!==(i=t.className)&&void 0!==i&&i.includes("vjs-waiting")&&xe<4)xe++,O("BUFFERING",Ne({pfm:window.platform,uid:rn(),vid:$e(),videoPosition:n.el_&&Math.floor(n.currentTime())},null===(r=window)||void 0===r||null===(o=r.customData)||void 0===o||null===(a=o.beacon)||void 0===a?void 0:a.params)),fireEvent({eventName:"BUFFERING",videoPosition:n.el_&&Math.floor(n.currentTime()),isAdEvent:!1});return l}window.ttFirstFrameStartTime_In_MS=null},window.endFirstFrame=function(e){var n=tryCatch((function(){var t,i,r;if(window.ttFirstFrameStartTime_In_MS&&!window.firstFrameFired)if(window.isAdPlaying)console.log("'playing' event ignored during ad playback.");else{clearInterval(window.bufferingTimer),clearTimeout(window.failedToStartTimer),window.failedToStartTimer=null,window.firstFrameFired=!0;var o=(performance.now()-window.ttFirstFrameStartTime_In_MS)/1e3;window.ttFirstFrameStartTime_In_MS=null,window.totalBufferTime=o||0,O("FIRST_FRAME",Ne({eventName:"FIRST_FRAME",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1,ttFirstFrame:parseFloat(null==o?void 0:o.toFixed(2)),bufferHealth:window.getRemainingBufferTime(e),pfm:window.platform,uid:rn(),vid:$e()},null===(t=window)||void 0===t||null===(i=t.customData)||void 0===i||null===(r=i.beacon)||void 0===r?void 0:r.params)),fireEvent({eventName:"FIRST_FRAME",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1,ttFirstFrame:parseFloat(null==o?void 0:o.toFixed(2)),bufferHealth:window.getRemainingBufferTime(e)}),Ye(e,"timeupdate",n)}}));Qe(e,"timeupdate",n)},window.ads=function(e){function n(){var n,t,i,r,o,a;window.isAdPlaying=!0,!window.firstFrameFired&&window.failedToStartTimer&&clearTimeout(window.failedToStartTimer),O("AD_REQUEST",Ne({eventName:"AD_REQUEST",videoPosition:Math.floor(e.currentTime()),isAdEvent:!0,bufferHealth:window.getRemainingBufferTime(e),pfm:window.platform,uid:rn(),vid:$e(),resHeight:e.videoHeight(),resWidth:e.videoWidth()},null===(n=window)||void 0===n||null===(t=n.customData)||void 0===t||null===(i=t.beacon)||void 0===i?void 0:i.params)),fireEvent({eventName:"AD_REQUEST",videoPosition:Math.ceil(e.currentTime()),isAdEvent:!0,resHeight:e.videoHeight(),resWidth:e.videoWidth(),adPosition:1}),O("AD_IMPRESSION",Ne({eventName:"AD_IMPRESSION",videoPosition:Math.floor(e.currentTime()),isAdEvent:!0,bufferHealth:window.getRemainingBufferTime(e),pfm:window.platform,uid:rn(),resHeight:e.videoHeight(),resWidth:e.videoWidth(),vid:$e()},null===(r=window)||void 0===r||null===(o=r.customData)||void 0===o||null===(a=o.beacon)||void 0===a?void 0:a.params)),fireEvent({eventName:"AD_IMPRESSION",videoPosition:Math.ceil(e.currentTime()),resHeight:e.videoHeight(),resWidth:e.videoWidth(),isAdEvent:!0,adPosition:1})}function t(){window.isAdPlaying=!1,window.firstFrameFired||(window.failedToStartTimer=setTimeout((function(){window.firstFrameFired||window.fireStreamFailure("FAILED_TO_START")}),3e4))}function i(){window.isAdPlaying=!1,window.firstFrameFired||(window.failedToStartTimer=setTimeout((function(){window.firstFrameFired||window.fireStreamFailure("FAILED_TO_START")}),3e4))}var r=!1;function o(){var o,a,l,s;r||null!==(o=window)&&void 0!==o&&null!==(a=o.google)&&void 0!==a&&null!==(l=a.ima)&&void 0!==l&&null!==(s=l.AdEvent)&&void 0!==s&&s.Type&&null!=e&&e.ima&&"function"==typeof e.ima.addEventListener&&("function"==typeof e.ima.getAdsManager?e.ima.getAdsManager():null)&&(Ke(e,window.google.ima.AdEvent.Type.STARTED,n),Ke(e,window.google.ima.AdEvent.Type.SKIPPED,t),Ke(e,window.google.ima.AdEvent.Type.COMPLETE,i),r=!0)}Qe(e,"adsready",o),o()};var dn=function(e,n,t){var i;fireEvent({eventName:"PING",videoPosition:n,isAdEvent:!1,duration:t,resHeight:e.videoHeight(),resWidth:e.videoWidth(),bufferHealth:window.getRemainingBufferTime(e),bitrate:(null===(i=e.tech_)||void 0===i?void 0:i.vhs)&&window.getBitrate(e)})};window.fireExitPing=function(e){if(!window.isAdPlaying){var n=null!=e&&e.el_?Math.floor(e.currentTime()):0;n<=0||dn(e,n,n)}},window.ping=function(e){window._pingTimeUpdateHandler&&(Ye(e,"timeupdate",window._pingTimeUpdateHandler),window._pingTimeUpdateHandler=null),window._pingTimes||(window._pingTimes=[]),window._pingTimeUpdateHandler=function(){var n=Math.floor(e.currentTime());n>=30&&n%30==0&&!window._pingTimes.includes(n)&&(xe=0,window._pingTimes.push(n),dn(e,n,30))},Qe(e,"dispose",tryCatch((function(){console.log('Player DISPOSED >> "dispose" event fired >>> firing exit PING'),window.fireExitPing(e)}))),Qe(e,"timeupdate",window._pingTimeUpdateHandler)},window.getBitrate=function(e){return Math.round(e.tech_.vhs.selectPlaylist().attributes.BANDWIDTH/1e3)},window.getRemainingBufferTime=function(e){return tryCatch((function(){for(var n=e.currentTime(),t=e.duration(),i=e.buffered(),r=0;r<i.length;r++){var o=i.start(r),a=i.end(r);if(un(n,o,a)){var l=Math.round(t-a);if(isFinite(l))return l}}}))()};var un=function(e,n,t){return e>=n&&e<=t};window.fireEvent=function(){var e=n(t.mark((function e(n){var i,o,a,l,s,u,c,v,f,m,p,h,g,y,w,T,_,b,I,E,S,k,A,O;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!d()){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,Ie();case 4:return I=e.sent,E=Se(I),S=null==E?void 0:E.site,k=null==E?void 0:E.siteId,A=tn($e()),e.t0=Ne,e.t1=Ne,e.t2=Ne,e.t3=Ne({aid:S,cid:k,pfm:window.platform},null===(i=window)||void 0===i||null===(o=i.customData)||void 0===o||null===(a=o.beacon)||void 0===a?void 0:a.params),e.t4={},e.t5=rn(),e.t6=$e(),e.t7=n.url||document.location.href,e.t8=n.ref||(null===(l=window)||void 0===l||null===(s=l.location)||void 0===s?void 0:s.ref)||document.referrer,e.t9=n.eventName,e.t10=null!==(u=n.videoPosition)&&void 0!==u?u:null,e.t11=window.environment,e.t12=n.dp1||"",e.t13=n.dp2||"",e.t14=n.dp3||"",e.t15=n.dp4||"",e.t16=n.dp5||"",e.t17=!0===n.isAdEvent?n.videoPosition:null,e.t18=!0===n.isAdEvent?(C=n.adPosition)?String(C):"":"",e.next=30,on();case 30:e.t19=e.sent,e.t20=n.playerType||"native",e.t21=n.mediaType||"VIDEO",e.t22=window.sid,e.t23=null!==(c=n.ttFirstFrame)&&void 0!==c?c:null,e.t24=null!==(v=n.bitrate)&&void 0!==v?v:null,e.t25=null!==(f=n.resHeight)&&void 0!==f?f:null,e.t26=null!==(m=n.resWidth)&&void 0!==m?m:null,e.t27=null!==(p=n.bufferHealth)&&void 0!==p?p:null,e.t28=null!==(t=void 0,D=void 0,L=void 0,D=De(),L=(null==D?void 0:D.contentType)||"video",h=(null==D||null===(t=D[L])||void 0===t?void 0:t.network)||null)&&void 0!==h?h:null,e.t29=null!=S?S:null,e.t30={uid:e.t5,vid:e.t6,url:e.t7,ref:e.t8,pa:e.t9,vpos:e.t10,environment:e.t11,dp1:e.t12,dp2:e.t13,dp3:e.t14,dp4:e.t15,dp5:e.t16,apos:e.t17,apod:e.t18,profid:e.t19,player:e.t20,media_type:e.t21,stream_id:e.t22,embedurl:"",ttfirstframe:e.t23,bitrate:e.t24,connectionspeed:null,resolutionheight:e.t25,resolutionwidth:e.t26,bufferhealth:e.t27,networkname:e.t28,brandname:e.t29},e.t31=(null==n?void 0:n.duration)&&{duration:n.duration},e.t32=(0,e.t2)(e.t3,e.t4,e.t30,e.t31),e.t33=null===(g=window)||void 0===g||null===(y=g.customData)||void 0===y||null===(w=y.beacon)||void 0===w?void 0:w.params,e.t34=(0,e.t1)(e.t32,e.t33),e.t35=A&&{title:A},e.t36=(0,e.t0)(e.t34,e.t35),O=[e.t36],r({url:(null===(T=window)||void 0===T||null===(_=T.customData)||void 0===_||null===(b=_.beacon)||void 0===b?void 0:b.url)||de.get()+P.getBeaconUrl,method:"post",headers:Ne({Authorization:I},ee("beacon")),params:ne("beacon"),contentType:"application/x-www-form-urlencoded",dataType:"text",data:O}).catch((function(e){console.error(e)}));case 50:case"end":return e.stop()}var t,D,L,C}),e)})));return function(n){return e.apply(this,arguments)}}(),window.tryCatch=function(e){return function(){try{return e.apply(window,arguments)}catch(e){return console.error(e),null}}};function cn(e,n){if("localhost"!==location.hostname&&"127.0.0.1"!==location.hostname&&!d()){var t=o.getConfig();if(null==t||!t.disableBeacon){null!=n&&n.userId&&(Ue=n.userId);var i=a(e);window.initialise(i,null==n?void 0:n.analyticsCb),window.firstFrame(i,null==n?void 0:n.analyticsCb,null==n?void 0:n.analyticsEventParams),window.endFirstFrame(i),window.watchLive(i)}}}window.watchLive=function(e){var n;if(e){var t=null==e||null===(n=e.controlBar)||void 0===n?void 0:n.getChild("SeekToLive");if(t){Je();var i=t.handleClick;ze={seekToLive:t,originalHandleClick:i},t.handleClick=function(n){var t,r;return null!==(t=e.liveTracker)&&void 0!==t&&null!==(r=t.atLiveEdge)&&void 0!==r&&r.call(t)||(!function(e){var n,t,i;O("WATCH_LIVE",Ne({eventName:"WATCH_LIVE",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1,bufferHealth:window.getRemainingBufferTime(e),pfm:window.platform,uid:rn(),resHeight:e.videoHeight(),resWidth:e.videoWidth(),vid:$e()},null===(n=window)||void 0===n||null===(t=n.customData)||void 0===t||null===(i=t.beacon)||void 0===i?void 0:i.params)),fireEvent({eventName:"WATCH_LIVE",videoPosition:Math.ceil(e.currentTime()),resHeight:e.videoHeight(),resWidth:e.videoWidth(),isAdEvent:!1})}(e),Ge=!0),i.call(this,n)}}}};var vn=function(e,n){var t=new Map;se({videoId:e,token:n}).then((function(e){e.data.map((function(e){t.set(e.videoId,{t:e.watchedTime,p:e.watchedPercentage})})),ye=t})).catch((function(e){return console.log(e)}))},fn=function(){var e=Ve.get();return e>=0?e+1:1},mn=function(){var e,n,t,i=Le(),r=De(),o=null==r||null===(e=r.video)||void 0===e?void 0:e.id,a=Ve.get(),l=null==i||null===(n=i[a])||void 0===n||null===(t=n.episodes)||void 0===t?void 0:t.findIndex((function(e){return(null==e?void 0:e.id)===o}));return l>=0?l+1:1};function pn(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function hn(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?pn(Object(i),!0).forEach((function(t){e(n,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):pn(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}var gn=v,yn=function(e,n){return e&&n?"".concat(e,"x").concat(n):e>1024?"L":e>768?"M":"S"},wn=function(e){var n=Tn(e,"video.tags",[]),t=Tn(e,"video.gist.primaryCategory.title","VIEWLIFT_CONTENT_GENRE");return n.length>0?n.map((function(e){return e.title})).join(","):t},Tn=function(e,n,t){for(var i=0,r=(n=n.split(".")).length;i<r;i++){var o;e=null===(o=e)||void 0===o?void 0:o[n[i]]}return e||t},_n=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=localStorage.getItem("deviceId")||"VIEWLIFT_DEVICE_ID";return e?n:n.includes("browser-")?n.replace("browser-",""):n},bn=function(){var e,n,t,i,r,o,l,s,d,u,c,v,m,p,h,g,y,w,T,_,b,I,E,S,k,A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",O=arguments.length>1?arguments[1]:void 0,D=arguments.length>2?arguments[2]:void 0;if(null!==(e=window)&&void 0!==e&&null!==(n=e.customData)&&void 0!==n&&n.disableMacros)return A;var P=(null==D?void 0:D.siteName)||(null==D?void 0:D.site)||"",L=(null==D?void 0:D.contentType)||"video",C=(null==D||null===(t=D[L])||void 0===t?void 0:t.metadata)||(null==D||null===(i=D[L])||void 0===i||null===(r=i.gist)||void 0===r?void 0:r.metadata),F=a(O);if(!A.includes("VIEWLIFT_"))return A;var j,R=window.getComputedStyle(document.getElementById(O),null),W=Math.trunc(R.getPropertyValue("height").slice(0,-2)),V=Math.trunc(R.getPropertyValue("width").slice(0,-2)),M="linearchannel"===L?null==D||null===(o=D.linearchannel)||void 0===o||null===(l=o.channels)||void 0===l||null===(s=l.find((function(e){return(null==e?void 0:e.id)===(null==D?void 0:D.channelId)})))||void 0===s||null===(d=s.content)||void 0===d?void 0:d.id:Tn(D,"video.gist.id",""),N="linearchannel"===L?null==D||null===(u=D.linearchannel)||void 0===u||null===(c=u.channels)||void 0===c||null===(v=c.find((function(e){return(null==e?void 0:e.id)===(null==D?void 0:D.channelId)})))||void 0===v?void 0:v.title:Tn(D,"video.gist.title","VIEWLIFT_ENCODED_VIDEO_TITLE"),x=null,U=null;"function"==typeof window.__gpp&&(null===(j=window)||void 0===j||j.__gpp("ping",(function(e){x=null==e?void 0:e.gppString,U=null==e?void 0:e.sectionList[0]})));var B=f.get("us_privacy")||f.get("usprivacy"),H=void 0!==B?B:"1YNN",G=null!==(m=null===(p=JSON.parse(localStorage.getItem("selectedMvpdProvider")||"{}"))||void 0===p?void 0:p.fwIdentifier)&&void 0!==m?m:null,q=hn(hn({},In(C)),{},{VIEWLIFT_WIDTH:V,VIEWLIFT_HEIGHT:W,VIEWLIFT_SIZE:yn(V,W),VIEWLIFT_DOMAIN:window.location.hostname,VIEWLIFT_URL:window.location.href,VIEWLIFT_ENCODED_URL:encodeURIComponent(window.location.href),VIEWLIFT_DOUBLE_ENCODED_URL:encodeURIComponent(encodeURIComponent(window.location.href)),VIEWLIFT_CACHEBUSTER:"3708662946268",VIEWLIFT_TIMESTAMP:Date.now().toString().substring(0,10),VIEWLIFT_TIMESTAMP_MS:Date.now().toString(),VIEWLIFT_IP:(null===(h=window)||void 0===h?void 0:h.ip)||"VIEWLIFT_IP",VIEWLIFT_USER_AGENT:encodeURIComponent(encodeURIComponent(navigator.userAgent)),VIEWLIFT_DNT:"1"===navigator.doNotTrack?"1":"0",VIEWLIFT_DESCRIPTION:Tn(D,"video.gist.description","VIEWLIFT_DESCRIPTION"),VIEWLIFT_DURATION:Tn(D,"video.runtime","VIEWLIFT_DURATION"),VIEWLIFT_MIN_DURATION:0,VIEWLIFT_MAX_DURATION:Tn(D,"video.runtime","VIEWLIFT_DURATION"),VIEWLIFT_AUTOPLAY:(null==F||null===(g=F.options_)||void 0===g?void 0:g.autoplay)||1,VIEWLIFT_MUTE:(null==F||null===(y=F.options_)||void 0===y?void 0:y.autoplay)||0,VIEWLIFT_DEVICE_ID:"spinco"==P||"usanetwork"==P||"golfchannel"==P?"":_n(!1),VIEWLIFT_DID:"spinco"==P||"usanetwork"==P||"golfchannel"==P?"":_n(),VIEWLIFT_DEVICETYPE:"WEB_BROWSER",VIEWLIFT_IDTYPE:"dpid",VIEWLIFT_KEYWORDS:wn(D),VIEWLIFT_MEDIA_ID:M,VIEWLIFT_ENCODED_VIDEO_TITLE:encodeURI(Tn(D,"video.gist.title","VIEWLIFT_ENCODED_VIDEO_TITLE")),VIEWLIFT_VIDEO_ID:M,VIEWLIFT_VIDEO_URL:encodeURI(window.location.origin+Tn(D,"video.gist.permalink","")),VIEWLIFT_CONSENT:f.get("cc")||"VIEWLIFT_CONSENT",VIEWLIFT_COPPA:Tn(null===(w=window)||void 0===w||null===(T=w.app_data)||void 0===T||null===(_=T.site)||void 0===_?void 0:_.settings,"compliance.coppa")?1:0,VIEWLIFT_GDPR_CONSENT:"",VIEWLIFT_ROKU_AD_ID:"",VIEWLIFT_ROKU_AD_KEYS:"",VIEWLIFT_RDID:"",VIEWLIFT_GDPR:"spinco"==P||"usanetwork"==P||"golfchannel"==P?"":Tn(null===(b=window)||void 0===b||null===(I=b.app_data)||void 0===I||null===(E=I.site)||void 0===E?void 0:E.settings,"compliance.gdpr")?1:0,VIEWLIFT_US_PRIVACY:H,VIEWLIFT_TVE_PROVIDER:G?gn(G):"",VIEWLIFT_CONTENT_DURATION_MS:1e3*Tn(D,"video.runtime","VIEWLIFT_DURATION"),VIEWLIFT_CONTENT_DURATION:Tn(D,"video.runtime","VIEWLIFT_DURATION"),VIEWLIFT_CONTENT_ID:M,VIEWLIFT_CONTENT_TITLE:N,VIEWLIFT_CONTENT_SERIES_TITLE:Tn(D,"video.series.gist.title","VIEWLIFT_CONTENT_SERIES_TITLE"),VIEWLIFT_CONTENT_GENRE:Tn(D,"video.gist.primaryCategory.title","VIEWLIFT_CONTENT_GENRE"),VIEWLIFT_USER:sessionStorage.getItem("uid")||"VIEWLIFT_USER",VIEWLIFT_EPISODE_NUMBER:mn(),VIEWLIFT_SEASON_NUMBER:fn(),VIEWLIFT_CONTENT_TAGS:wn(D),VIEWLIFT_GPP_SID:U||"VIEWLIFT_GPP_SID",VIEWLIFT_GPP:x||"VIEWLIFT_GPP",VIEWLIFT_APP_ID:"",VIEWLIFT_APP_STORE_URL:"",VIEWLIFT_LAT:"",VIEWLIFT_APP_BUNDLE:"",VIEWLIFT_ATT_CONSENT:""},null===(S=window)||void 0===S||null===(k=S.customData)||void 0===k?void 0:k.macros);for(var z in q){var Q=new RegExp(z,"g");A=A.replace(Q,q[z])}return A},In=function(e){var n,t,i,r,o,a,l,s,d,c={},v=new Map;(null==e?void 0:e.length)>0&&(null==e||e.map((function(e){v.set(e.name,e.value)})));var f=(null===(n=window)||void 0===n||null===(t=n.customData)||void 0===t||null===(i=t.subscription)||void 0===i?void 0:i.SVOD)||!1,m=(null===(r=window)||void 0===r||null===(o=r.customData)||void 0===o||null===(a=o.subscription)||void 0===a?void 0:a.TVE)||!1;return f||m?(u()?f?c=hn(hn({},c),{},{VIEWLIFT_CSID:v.get("csid.mweb.dtc")||"",VIEWLIFT_CSID_CSAI:v.get("csid.mweb.dtc.csai")||""}):m&&(c=hn(hn({},c),{},{VIEWLIFT_CSID:v.get("csid.mweb.tve")||"",VIEWLIFT_CSID_CSAI:v.get("csid.mweb.tve.csai")||""})):f?c=hn(hn({},c),{},{VIEWLIFT_CSID:v.get("csid.web.dtc")||"",VIEWLIFT_CSID_CSAI:v.get("csid.web.dtc.csai")||""}):m&&(c=hn(hn({},c),{},{VIEWLIFT_CSID:v.get("csid.web.tve")||"",VIEWLIFT_CSID_CSAI:v.get("csid.web.tve.csai")||""})),f?c=hn(hn({},c),{},{VIEWLIFT_SFID:v.get("sfid.dtc")||v.get("sfid.web.dtc")||"",VIEWLIFT_SFID_CSAI:v.get(u()?"sfid.mweb.dtc.csai":"sfid.web.dtc.csai")||""}):m&&(c=hn(hn({},c),{},{VIEWLIFT_SFID:v.get("sfid.tve")||v.get("sfid.web.tve")||"",VIEWLIFT_SFID_CSAI:v.get(u()?"sfid.mweb.tve.csai":"sfid.web.tve.csai")||""})),c=u()?hn(hn({},c),{},{VIEWLIFT_PROF:v.get("prof.mweb")||"",VIEWLIFT_PROF_CSAI:v.get("prof.mweb.csai")||""}):hn(hn({},c),{},{VIEWLIFT_PROF:v.get("prof.web")||"",VIEWLIFT_PROF_CSAI:v.get("prof.web.csai")||""})):(c=hn(hn({},c),{},{VIEWLIFT_SFID:v.get("sfid.dtc")||v.get("sfid.web.dtc")||"",VIEWLIFT_SFID_CSAI:v.get(u()?"sfid.mweb.dtc.csai":"sfid.web.dtc.csai")||""}),c=u()?hn(hn({},c),{},{VIEWLIFT_CSID:v.get("csid.mweb.dtc")||"",VIEWLIFT_PROF:v.get("prof.mweb")||"",VIEWLIFT_CSID_CSAI:v.get("csid.mweb.dtc.csai")||"",VIEWLIFT_PROF_CSAI:v.get("prof.mweb.csai")||""}):hn(hn({},c),{},{VIEWLIFT_CSID:v.get("csid.web.dtc")||"",VIEWLIFT_PROF:v.get("prof.web")||"",VIEWLIFT_CSID_CSAI:v.get("csid.web.dtc.csai")||"",VIEWLIFT_PROF_CSAI:v.get("prof.web.csai")||""})),c=hn(hn({},c),{},{VIEWLIFT_AFID:v.get("afid"),VIEWLIFT_NIELSEN_APP_ID:Tn(null===(l=window)||void 0===l||null===(s=l.app_data)||void 0===s||null===(d=s.appcmsMain)||void 0===d?void 0:d.analytics,"nielsen.id")||v.get("VIEWLIFT_NIELSEN_APP_ID")||"",VIEWLIFT_CHANNEL:v.get("VIEWLIFT_CHANNEL")||"",VIEWLIFT_GRACE_NOTE_ID:v.get("VIEWLIFT_GRACE_NOTE_ID")||"",VIEWLIFT_EXTERNAL_AD_ID:v.get("VIEWLIFT_EXTERNAL_AD_ID")||""})},En=function(e,n){var t,i,r,o,a,l,s,d,u,v,f,m,p,h=(null==e?void 0:e.contentType)||"video",g=null==e||null===(t=e[h])||void 0===t?void 0:t.drmEnabled,y=null==e||null===(i=e[h])||void 0===i||null===(r=i.streamingInfo)||void 0===r?void 0:r.videoAssets,w=null==e||null===(o=e[h])||void 0===o||null===(a=o.streamingInfo)||void 0===a?void 0:a.audioAssets,T=(null==e||null===(l=e[h])||void 0===l||null===(s=l.streamingInfo)||void 0===s||null===(d=s.videoAssets)||void 0===d?void 0:d.hls)||!1;null==e||null===(u=e[h])||void 0===u||null===(v=u.liveDetails)||void 0===v||v.isDvrEnabled;var _=(null==e||null===(f=e[h])||void 0===f||null===(m=f.streamingInfo)||void 0===m||null===(p=m.videoAssets)||void 0===p?void 0:p.dash)||!1;if(null!=e&&e.directPlaybackUrl)return{src:null==e?void 0:e.directPlaybackUrl,type:null};if(null!=e&&e.audioAssetSource&&null!=w&&w.hls)return kn(w);if(g){var b=An(y,n);return b.src=bn(b.src,n,e),b}if("Safari"!==c()&&_)return Sn(y);if(T){var I=kn(y);return I.src=bn(I.src,n,e),I}if(null!=y&&y.mpeg){var E=function(e){var n=null==e?void 0:e.mpeg;return{src:n[n.length-1].url,type:"video/mp4"}}(y);return E.src=bn(E.src,n,e),E}return null},Sn=function(e){var n=null==e?void 0:e.dash;return n?{src:n,type:"application/dash+xml"}:null},kn=function(e){var n=null==e?void 0:e.hls;return n?{src:n,type:"application/x-mpegURL"}:null},An=function(e,n){var t=(null==e?void 0:e.drmProvider)||null,r=e.fairPlayCmaf||e.fairPlay,o=e.widevine,l=e.playReady,s=c();if(a(n),"Safari"===s){var d=function(e){var n=e.url;return{src:n,type:"application/x-mpegURL",__vlLicenseUrl:(null==e?void 0:e.licenseUrl)||"",keySystems:{"com.apple.fps.1_0":{getCertificate:function(n,t){var r={uri:e.certificateUrl,method:"GET",responseType:"arraybuffer"};i.xhr(r,(function(e,n,i){console.log(e),e&&t(e),t(null,new Uint8Array(i))}))},getContentId:function(e,n){if(n){var t=n.indexOf("\0")+1;return n.slice(t)}},getLicense:function(n,t,r,o){var a={uri:e.licenseUrl,method:"POST",responseType:"arraybuffer",body:r,headers:{"Content-type":"application/octet-stream","X-AxDRM-Message":e&&e.licenseToken}};i.xhr(a,(function(e,n,t){console.log(e),e&&o(e),o(null,t)}))}}}}}(r);return On(n),d}var u,v={src:o.url,type:"application/dash+xml"};return"caliente"==(null===(u=window)||void 0===u?void 0:u.siteName)?(On(n),v.keySystems={"com.widevine.alpha":{url:o.licenseUrl,licenseHeaders:{"X-AxDRM-Message":o.licenseToken},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"},"com.microsoft.playready":{url:null==l?void 0:l.licenseUrl,licenseHeaders:{"X-AxDRM-Message":null==l?void 0:l.licenseToken},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"}}):"custom"==t?(v.keySystemOptions=[],v.keySystemOptions.push({name:"com.widevine.alpha",options:{serverURL:o.licenseUrl,httpRequestHeaders:{"Content-Type":"application/octet-stream"},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"}}),v.keySystemOptions.push({name:"com.microsoft.playready",options:{serverURL:null==l?void 0:l.licenseUrl,httpRequestHeaders:{"Content-Type":"application/octet-stream"},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"}})):(v.keySystemOptions=[],v.keySystemOptions.push({name:"com.widevine.alpha",options:{serverURL:o.licenseUrl,httpRequestHeaders:{"X-AxDRM-Message":o.licenseToken},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"}}),v.keySystemOptions.push({name:"com.microsoft.playready",options:{serverURL:null==l?void 0:l.licenseUrl,httpRequestHeaders:{"X-AxDRM-Message":null==l?void 0:l.licenseToken},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"}})),v};var On=function(e){var n=a(e);if("function"==typeof n.eme)try{n.eme(),"Safari"==c()&&n.eme.initLegacyFairplay()}catch(e){console.log("EME ERROR :",e)}},Dn=function(e,n){var t=e.src,i=e.type;if(!t||"string"!=typeof t||!t.includes(".com"))return{src:t,type:i};n=n.replace(/\/$/,"");var r=t.split(".com")[1]||"";return{src:r?"".concat(n).concat(r):t,type:i}},Pn=function(e,n){if(import("./error-2395864b.js").then((function(e){var n=document.createElement("style");n.id="errorblock",n.append("".concat(e.default)),document.head.appendChild(n)})),document.getElementsByClassName("error-container")[0]){var t=document.getElementsByClassName("error-message")[0];t&&(t.innerHTML="".concat(n))}else{var i=document.getElementById(e);if(i){var r=document.createElement("div");r.className="error-container";var o=document.createElement("div");o.className="error-message",o.innerHTML="".concat(n),r.appendChild(o),i.append(r)}}},Ln=function(){document.getElementsByClassName("error-container")[0]&&document.getElementsByClassName("error-container")[0].remove()};var Cn=!1,Fn=function(e,n,t){var i=bn(n,e,t),r=a(e);if(n&&window.google){if("function"!=typeof r.ima&&"object"!==h(r.ima))return;r.ima.initializeAdDisplayContainer&&r.ima.initializeAdDisplayContainer(),function(e,n){var t,i,r,o=a(e);if(null!==o.el_){Cn=!0;var l={id:e,adTagUrl:"".concat(n),adLabel:"Your video will resume after this sponsor message"};o.ima.initializeAdDisplayContainer&&o.ima.initializeAdDisplayContainer(),Cn&&null!==o.el_&&("function"==typeof o.ima?o.ima(l):setTimeout((function(){o.ima.setContentWithAdTag(null,n,!0),o.ima.requestAds()}),1e3));var s=document.getElementById("".concat(e));(navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i))&&s.hasAttribute("controls")&&s.removeAttribute("controls");var d="click",u=!1;(navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i))&&(u=!0,d="touchend"),o.one(d,(function(){u&&o.ima.initializeAdDisplayContainer()})),function(e){if(!e._adVolumeSynced){e._adVolumeSynced=!0;var n=function(){try{var n=e.ima&&e.ima.getAdsManager&&e.ima.getAdsManager();if(!n||"function"!=typeof n.setVolume)return;n.setVolume(e.muted()?0:e.volume())}catch(e){}};e.on(["volumechange","advolumechange"],n),e.on("ads-manager",n)}}(o);var c=(null===(t=window)||void 0===t||null===(i=t.customData)||void 0===i||null===(r=i.ads)||void 0===r?void 0:r.adEventHandler)||null;o.one("ads-ad-started",(function(){c&&c({status:"STARTED",msg:"Advertisement Started"})})),o.one("ads-manager",(function(e){var n=e.adsManager;n.addEventListener(google.ima.AdEvent.Type.COMPLETE,(function(){c&&c({status:"ENDED",msg:"Advertisement Ended"})})),n.addEventListener(google.ima.AdEvent.Type.LOADED,(function(e){c&&c({status:"LOADED",msg:"Advertisement Loaded",data:e})}))})),o.on("adserror",(function(e){c&&c({status:"ERROR",msg:"Advertisement Error"})}))}}(e,i)}};function jn(e,n){var t,i,r,o=a(e),l=null==o||null===(t=o.controlBar)||void 0===t||null===(i=t.playToggle)||void 0===i?void 0:i.el_,s=document.getElementsByTagName("video")[0];null===(r=document)||void 0===r||r.addEventListener("keydown",(function(t){var i,r,a,d,u,c,v,f,m,p,h;if(Wn.enabled&&(!t.metaKey&&!t.ctrlKey&&"input"!=t.target.localName&&"textarea"!=t.target.localName&&!(null===(i=t.target)||void 0===i||null===(r=i.closest)||void 0===r?void 0:r.call(i,'.vjs-control-bar button, .vjs-control-bar [role="button"]')))){var g=t.key,y=!0===n.liveVideo||!0===n.liveui;switch([" ","m","M","f","F","ArrowLeft","ArrowRight"].includes(g)&&(t.preventDefault(),null==s||s.focus()),g){case" ":null==l||l.click();break;case"m":case"M":o.muted(!o.muted());break;case"f":case"F":null===(a=document.querySelector(".vjs-fullscreen-control"))||void 0===a||a.click();break;case"ArrowLeft":y&&!1===n.liveui||ji(e,10);break;case"ArrowRight":if("MEDIA_TAILOR"==(null===(d=window)||void 0===d||null===(u=d.app_data)||void 0===u||null===(c=u.appcmsMain)||void 0===c||null===(v=c.adsConfig)||void 0===v?void 0:v.vodAdSticherProvider)&&null!==(f=window)&&void 0!==f&&null!==(m=f.app_data)&&void 0!==m&&null!==(p=m.appcmsMain)&&void 0!==p&&null!==(h=p.adsConfig)&&void 0!==h&&h.vodAdClientSideTracking)return;y||Fi(e,10)}}}),!0)}var Rn,Wn=(Rn=!0,{enable:function(){Rn=!0},disable:function(){Rn=!1},get enabled(){return Rn}}),Vn="ssai-breakStart",Mn="ssai-adImpression",Nn="ssai-firstQuartile",xn="ssai-midpoint",Un="ssai-thirdQuartile",Bn="ssai-complete",Hn="ssai-breakEnd",Gn={breakStart:Vn,impression:Mn,firstQuartile:Nn,midpoint:xn,thirdQuartile:Un,complete:Bn,breakEnd:Hn};function qn(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=a(e);if(!t)return console.error("[SSAI] Player instance not found"),{};var i=n.eventType,r=Gn[i];r&&t.trigger(r,n)}function zn(e){var n=a(e);if(!n)return console.error("[SSAI] Player instance not found"),{};var t=function(e,t){var i=function(e,n){return t(n)};return n.on(e,i),function(){return n.off(e,i)}};return{adBreakStart:function(e){return t(Vn,e)},adImpression:function(e){return t(Mn,e)},adFirstQuartile:function(e){return t(Nn,e)},adMidpoint:function(e){return t(xn,e)},adThirdQuartile:function(e){return t(Un,e)},adComplete:function(e){return t(Bn,e)},adBreakEnd:function(e){return t(Hn,e)}}}function Qn(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Yn(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Qn(Object(i),!0).forEach((function(t){e(n,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):Qn(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}var Kn,Jn=(Kn={},{get:function(){return Kn},set:function(e){Kn=e}});function Xn(e,n){var t,i,r,o,l,s,d,u,c,v,f,m,p,h,g,y,I,E,S,k,A,O=null==e?void 0:e.playerId,D=a(O);if(null!=e&&null!==(t=e.comscore)&&void 0!==t&&t.enable){var P=De(),L=(null==P||null===(i=P.video)||void 0===i?void 0:i.metadata)||[],C=(null==L?void 0:L.length)&&L.filter((function(e){return"advertisingGenre"===e.name}));if(null!==(r=C)&&void 0!==r&&r.length){var F=C.map((function(e){return e.value}));C=null==F?void 0:F.join(",")}w();var j,R,W,V=null===(o=window)||void 0===o?void 0:o.lcProgrammeDetails,M=Array.isArray(null==V?void 0:V.category)?null==V||null===(l=V.category)||void 0===l?void 0:l.join(","):(null==V?void 0:V.category)||null,N=Yn(Yn(Yn({},null==P?void 0:P.video),null==P?void 0:P.linearchannel),{},{siteName:(null==e||null===(s=e.comscore)||void 0===s?void 0:s.applicationName)||(null==e||null===(d=e.comscore)||void 0===d||null===(u=d.metadata)||void 0===u?void 0:u.siteName)||(null==P?void 0:P.site)||null,programId:(null==V?void 0:V.videotmsid)||null,programTitle:(null==V?void 0:V.lcProgrammeName)||null,episodeId:(null==V?void 0:V.videotmsid)||null,seasonNumber:(null==P||null===(c=P.video)||void 0===c||null===(v=c.series)||void 0===v?void 0:v.seasonNumber)||(null==V||null===(f=V.seriesDetails)||void 0===f?void 0:f.season)||null,episodeNumber:(null==P||null===(m=P.video)||void 0===m||null===(p=m.series)||void 0===p?void 0:p.episodeNumber)||(null==V||null===(h=V.seriesDetails)||void 0===h?void 0:h.episode)||null,episodeTitle:(null==V?void 0:V.lcSubTitle)||null,isCompleteEpisode:!!(null!=P&&null!==(g=P.video)&&void 0!==g&&g.series||null!=V&&null!==(y=V.seriesDetails)&&void 0!==y&&y.episode),genre:C||M,comscoreConfig:{implementationId:(null==e||null===(I=e.comscore)||void 0===I?void 0:I.implementationId)||null,projectId:(null==e||null===(E=e.comscore)||void 0===E?void 0:E.projectId)||null}}),x=null==e||null===(S=e.comscore)||void 0===S||null===(k=S.metadata)||void 0===k?void 0:k.contentType;if(null!=N&&null!==(A=N.streamingInfo)&&void 0!==A&&A.isLiveStream?N.contentType="Live":N.contentType=x||"LongFormOnDemand",null==N||!N.network){var U,B=(null==N?void 0:N.metadata)||[],H=null==B||null===(U=B.find((function(e){return"network"===e.name})))||void 0===U?void 0:U.value;N.network=H||null}null!=N&&N.network&&null!=N&&N.genre&&(N.customGenre="".concat(N.network,"_").concat((null==N?void 0:N.programTitle)||(j=N,null!=j&&j.series?null==j||null===(W=j.series)||void 0===W?void 0:W.title:null==j||null===(R=j.gist)||void 0===R?void 0:R.title),"_").concat(N.genre)),null!=V&&V.airDate&&(N.publishDate=V.airDate),null!=N&&N.runtime&&"function"==typeof D.duration&&(N.runtime=1e3*Math.ceil(D.duration()));var G=T(N,D);console.log("comscoreOptions player data",G),_(Yn({playerName:"Video.js"},G)),b(D)}}function $n(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Zn(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?$n(Object(i),!0).forEach((function(t){e(n,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):$n(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}function et(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return nt(e,n);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?nt(e,n):void 0}}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==t.return||t.return()}finally{if(l)throw o}}}}function nt(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,i=Array(n);t<n;t++)i[t]=e[t];return i}var tt=function(){var e="";return{set:function(n){n&&(e=n)},get:function(){return e}}}();function it(e,n){return rt.apply(this,arguments)}function rt(){return(rt=n(t.mark((function e(n,i){var r,o,l,s,d,u,c,v,f,m,p,h,g,w,T,_,b,I;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a(n),l=En(i,n),s=l.src,d=(null==i?void 0:i.contentType)||"video",null==i||null===(r=i[d])||void 0===r||null===(o=r.streamingInfo)||void 0===o||o.isLiveStream,u=s.replace("/dash/","/session/").replace("/master/","/session/"),u=bn(u,n,i),c=ot(u),v=y(c,2),f=v[0],m=v[1],t=m,E=void 0,S=void 0,S=Object.fromEntries(null==Object||null===(E=Object.entries(t))||void 0===E?void 0:E.map((function(e){var n=y(e,2),t=n[0],i=n[1];return[null==t?void 0:t.replace(/^aws\./,""),String(i)]}))),p=S||{}||{},u=new URL(u.split("?")[0]),Object.keys(m).length>0&&Object.entries(m).forEach((function(e){var n=y(e,2),t=n[0],i=n[1];u.searchParams.set(t,i)})),e.prev=11,e.next=14,fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Zn({adsParams:Zn({},f)},p))});case 14:return h=e.sent,e.next=17,h.json();case 17:return g=e.sent,w="https://"+new URL(u).hostname,T=g.trackingUrl,_=g.manifestUrl,b=w+T,I=w+_,tt.set(b),console.log("%c TRACKING URL","background: #bdf369; color: #000",b),l.src=I,e.abrupt("return",l);case 29:return e.prev=29,e.t0=e.catch(11),e.abrupt("return",l);case 32:case"end":return e.stop()}var t,E,S}),e,null,[[11,29]])})))).apply(this,arguments)}function ot(e){var n={};if(!e.split("?")[1])return[{},{}];var t,i=new URL(e,window.location.origin),r=et((null==i?void 0:i.searchParams)||[]);try{for(r.s();!(t=r.n()).done;){var o=y(t.value,2),a=o[0],l=o[1];n[decodeURIComponent(a)]=decodeURIComponent(l||"")}}catch(e){r.e(e)}finally{r.f()}for(var s={},d={},u=0,c=Object.entries(n);u<c.length;u++){var v=y(c[u],2),f=v[0],m=v[1];if(f.startsWith("ads."))s[f.replace(/^ads\./,"")]=m;else d[f]=m}return[s,d]}var at,lt,st,dt=new Map;function ut(e,n){return ct.apply(this,arguments)}function ct(){return ct=n(t.mark((function e(i,r){var o,s,d,u,c,v,f,m,p,h,y,w,T,_,b,I,E,S,k,A,O,D,P,L,C;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:C=function(e,n,t,r,o,l){var s,d,u=a(i);if(!u.seeking()){var c=n.startTimeInSeconds;n.durationInSeconds,e<P&&D.clear(),P=e;var v=(null==n||null===(s=n.ads)||void 0===s||null===(d=s[r])||void 0===d?void 0:d.adId)||c;Math.floor(u.currentTime());var f,m=et(t);try{for(m.s();!(f=m.n()).done;){var p,h,g,y=f.value,w=y.eventType,T=y.beaconUrls,_=y.startTimeInSeconds,b=y.startTime,I=y.durationInSeconds,E=_||0,S=T,k=(null===(p=window)||void 0===p||null===(h=p.customData)||void 0===h||null===(g=h.ads)||void 0===g?void 0:g.adEventHandler)||null,A="".concat(E,"_").concat(w),O=dt.get("pod-".concat(o))||[];if(console.warn(e,E,"map:",w,"condition1:",e>=E,"map:",dt),e>=E&&!O.includes(A)){O.push(A),dt.set("pod-".concat(o),O);try{L(w,n,S,u)}catch(e){console.error("Error when calling triggerAdBeacon:",e,w,n)}if("function"==typeof k)try{var C,F={eventType:w,startTimeInSeconds:_,startTime:b,durationInSeconds:I,ad:null==n||null===(C=n.ads)||void 0===C?void 0:C[r],adIndex:r};k({adsData:F}),qn(i,F)}catch(e){console.error("Error when calling ads callback:",e)}var j=Jn.get();if(j&&0!==Object.keys(j).length){var R=j.formulateComscoreAdPayload,W=j.startComscoreAdTracking,V=j.finishComscoreAdTracking,M=j.endComscoreAdTracking,N="".concat(E,"_").concat(v,"_").concat(w);if(!D.has(N))if(D.set(N,!0),"impression"===w){var x,U=tt.get();W(R(Zn(Zn({},null==n||null===(x=n.ads)||void 0===x?void 0:x[r]),{},{trackingUrl:U})))}else"complete"===w?V():"breakEnd"===w&&M()}}}}catch(e){m.e(e)}finally{m.f()}}},L=function(e,n,t,i){console.warn("%c SSAI BEACON ","background: #e25822; color: #fff",e,"Fired:".concat(Math.round(i.currentTime())),"AD_POD:",n),console.log("%c SSAI BEACON ","background: #e25822; color: #fff",e,"Fired:".concat(Math.round(i.currentTime())),"AD_POD:",n),null==t||t.forEach((function(e){fetch(e,{mode:"no-cors"}).catch((function(n){console.warn("Beacon failed:",e,n)}))}))},O=function(e){var n=Math.floor(e/60),t=Math.floor(e%60);return"".concat(n,":").concat(t.toString().padStart(2,"0"))},dt.clear(),window.isAdPlaying=!1,p=tt.get(),(h=a(i)).one("loadeddata",(function(){p&&A(p)})),y=new Map,w=new Map,T=-1,_=(null===(o=document)||void 0===o||null===(s=o.getElementsByClassName("tvProviderImage"))||void 0===s?void 0:s[0])||null,b=(null==h||null===(d=h.controlBar)||void 0===d?void 0:d.getChild("videoSelector"))||null,I=(null==h||null===(u=h.controlBar)||void 0===u?void 0:u.getChild("seriesV2"))||null,E=(null==h||null===(c=h.el())||void 0===c||null===(v=c.getElementsByClassName("vjs-button vjs-rewind-button"))||void 0===v?void 0:v[0])||null,S=(null==h||null===(f=h.el())||void 0===f||null===(m=f.getElementsByClassName("vjs-button vjs-skip-button"))||void 0===m?void 0:m[0])||null,k=function(){var e,n,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(0==(null==t?void 0:t.length))return g(i);var r=[],o=null==i?void 0:i.find((function(e){return"breakEnd"===(null==e?void 0:e.eventType)})),a=(null==o||null===(e=o.beaconUrls)||void 0===e?void 0:e.find((function(e){return e.includes("videoView")})))||null,l=(null==t?void 0:t.length)>1?null==t?void 0:t[(null==t?void 0:t.length)-1]:null==t?void 0:t[0],s=null==l||null===(n=l.trackingEvents)||void 0===n?void 0:n.filter((function(e){return["breakEnd"].includes(null==e?void 0:e.eventType)})),d=(null==s?void 0:s.some((function(e){var n;return null==e||null===(n=e.beaconUrls)||void 0===n?void 0:n.some((function(e){return e.includes("videoView")}))})))||!1;if(!d&&a){var u=null==s?void 0:s.map((function(e){return Zn(Zn({},e),{},{eventType:"videoView",beaconUrls:[a]})}));null!=u&&u[0]&&r.push(null==u?void 0:u[0])}return r},A=function(){var e=n(t.mark((function e(n){var o,s,d,u,c,v,f,m,p,h,A,D,P,L,F,j,R,W,V,M,N,x,U,B,H,G;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return x=function(e){document.removeEventListener("pointermove",N),document.removeEventListener("pointerup",x),0===e.button&&W(R)},N=function(e){},M=function(e){if(null!=e){var n,t=null,i=et(m);try{for(i.s();!(n=i.n()).done;){var r=n.value,o=r.startTimeInSeconds,a=r.ads;Array.isArray(a)&&(null==a?void 0:a.length)>0&&(o>e||y.has(o)||(null===t||o>t.startTimeInSeconds)&&(t=r))}}catch(e){i.e(e)}finally{i.f()}t?(console.log("Resume: seeking back to recent ad break:",t.startTimeInSeconds,"then resuming to",e),p={position:e,podStart:t.startTimeInSeconds,podEndTime:t.startTimeInSeconds+t.durationInSeconds,entered:!1},setTimeout((function(){h.currentTime(t.startTimeInSeconds+.4)}),100)):(p=null,h.currentTime(e),V(e))}},V=function(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:h.currentTime(),t=null,i=et(m);try{for(i.s();!(e=i.n()).done;){var r=e.value,o=r.startTimeInSeconds,a=r.durationInSeconds,l=(r.ads,Math.floor(o+a));n>=o&&n<=l&&(t=l,y.set(o,!0))}}catch(e){i.e(e)}finally{i.f()}null!==t&&(console.log("Seeking to end of the ad pod:",t),setTimeout((function(){h.currentTime(t+2.2)}),100))},W=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:h.currentTime();if(!(null==e||e<0||n<=e)){var t,i=null,r=et(m);try{for(r.s();!(t=r.n()).done;){var o=t.value,a=o.startTimeInSeconds,l=o.ads;Array.isArray(l)&&(null==l?void 0:l.length)>0&&(y.has(a)||a>e&&a<=n&&(null===i||a>i.startTimeInSeconds)&&(i=o))}}catch(e){r.e(e)}finally{r.f()}null!==i&&(y.set(i.startTimeInSeconds,!0),w.set(i.startTimeInSeconds,!0),p={position:n,podStart:i.startTimeInSeconds,podEndTime:i.startTimeInSeconds+i.durationInSeconds,entered:!1},console.log("Seeking back to ad pod:",i.startTimeInSeconds,"then resuming to",n),setTimeout((function(){h.currentTime(i.startTimeInSeconds+.4)}),100))}},e.next=8,fetch(n);case 8:return c=e.sent,e.next=11,c.json();case 11:v=e.sent,f=v.avails,m=[],p=null,h=a(i),A=h.controlBar.progressControl,D=A.seekBar.el(),null===(o=document)||void 0===o||o.querySelectorAll(".vjs-seekbar-marker").forEach((function(e){return null==e?void 0:e.remove()})),f.map((function(e,n){var t;0==n&&Array.isArray(null==e?void 0:e.ads)&&(null==e||null===(t=e.ads)||void 0===t||t.length),m.push({ads:null==e?void 0:e.ads,durationInSeconds:null==e?void 0:e.durationInSeconds,startTimeInSeconds:null==e?void 0:e.startTimeInSeconds,markerPositionInSeconds:Math.floor(null==e?void 0:e.startTimeInSeconds),podSlotImpressionBeacon:k(null==e?void 0:e.ads,null==e?void 0:e.adBreakTrackingEvents)})})),r&&M(r),null!=m&&m.length&&(console.log("%c SSAI AD PODS ","background: #bdf369; color: #000",m),window.adsQueueList=m,"function"==typeof(j=(null===(P=window)||void 0===P||null===(L=P.customData)||void 0===L||null===(F=L.ads)||void 0===F?void 0:F.onAdBreaksLoaded)||null)&&j(m)),console.log(m,"data"),m.forEach((function(e){var n=e.markerPositionInSeconds,t=e.ads,i=h.duration();if(!(n>i||Array.isArray(t)&&0==(null==t?void 0:t.length))){var r=n/i*100,o=document.createElement("div");o.className="vjs-seekbar-marker",o.style.left="".concat(r,"%"),o.style.position="absolute",o.style.top="0",o.style.bottom="0",o.style.width="2px",o.style.backgroundColor="#fecc09",o.style.left="".concat(r,"%"),o.style.pointerEvents="none",D.appendChild(o)}})),h._timeUpdateHandler&&h.off("timeupdate",h._timeUpdateHandler),h._timeUpdateHandler=l((function(){var e=h.currentTime();if(e!==T){T=e;for(var n=!1,t=function(){var t=m[i],r=t.startTimeInSeconds,o=t.durationInSeconds,a=t.ads,l=r+o;if(e>=r-1.2&&e<=l+1.2){var s;e>=r&&e<=l&&Array.isArray(a)&&(null==a?void 0:a.length)>0&&(n=!0),e>l&&y.set(r,!0),Wn.disable(),_&&_.classList.add("vjs-hidden"),E&&(E.style.pointerEvents="none",E.classList.add("vjs-hidden")),S&&(S.style.pointerEvents="none",S.classList.add("vjs-hidden")),b&&(b.el().style.pointerEvents="none",b.el().classList.add("vjs-hidden")),I&&(I.el().style.pointerEvents="none",I.el().classList.add("vjs-hidden")),A.el().classList.add("hide-progress-bar");for(var d=e-r,u=0,c=0,v=0;v<a.length;v++){var f,p=null==a||null===(f=a[v])||void 0===f?void 0:f.durationInSeconds;if(d<u+p){c=v;break}u+=p}a[c];var h=Math.max(0,o-d),T=Math.round(h);U.style.display="block",G.textContent="".concat(c+1," of ").concat(a.length," • ").concat(O(T));var k=[];return null==a||a.forEach((function(e){var n=e.trackingEvents.filter((function(e){return["breakStart","breakEnd","firstQuartile","secondQuartile","thirdQuartile","fourthQuartile","midpoint","impression","complete"].includes(e.eventType)}));k.push.apply(k,g(n))})),(null==t||null===(s=t.podSlotImpressionBeacon)||void 0===s?void 0:s.length)>0&&k.push.apply(k,g(null==t?void 0:t.podSlotImpressionBeacon)),C(e,t,k,c,i),"break"}w.delete(r)},i=0;i<m.length;i++){if("break"===t())break}if(window.isAdPlaying=n,p&&!h.seeking()&&(e>=p.podStart&&e<=p.podEndTime&&(p.entered=!0),p.entered&&e>=p.podEndTime)){var r=p.position;p=null,setTimeout((function(){h.currentTime(r),V(r)}),300)}n||(U.style.display="none",A.el().classList.remove("hide-progress-bar"),b&&(b.el().style.pointerEvents="auto",b.el().classList.remove("vjs-hidden")),I&&(I.el().style.pointerEvents="auto",I.el().classList.remove("vjs-hidden")),_&&_.classList.remove("vjs-hidden"),E&&(E.style.pointerEvents="auto",E.classList.remove("vjs-hidden")),S&&(S.style.pointerEvents="auto",S.classList.remove("vjs-hidden")),Wn.enable())}}),1e3),h.on("timeupdate",h._timeUpdateHandler),null===(s=document)||void 0===s||s.addEventListener("keydown",(function(e){if(Wn.enabled&&"ArrowRight"==e.key){var n=h.currentTime();Fi(i,10),W(n,n+10),e.stopPropagation()}})),R=-1,A.el().addEventListener("pointerdown",(function(e){0===e.button&&(R=h.currentTime(),document.addEventListener("pointermove",N),document.addEventListener("pointerup",x))})),null===(d=document)||void 0===d||null===(u=d.querySelectorAll(".ssai-ad-container"))||void 0===u||u.forEach((function(e){return null==e?void 0:e.remove()})),(U=document.createElement("div")).className="ssai-ad-container",(B=document.createElement("div")).className="sponsored-adbox",(H=document.createElement("div")).className="sponsored-text",H.textContent="Sponsored Ad",B.append(H),(G=document.createElement("div")).className="ad-counter",document.createElement("div").className="ad-timer",U.append(B),U.append(G),h.el().appendChild(U);case 47:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),D=new Map,P=-1;case 21:case"end":return e.stop()}}),e)}))),ct.apply(this,arguments)}function vt(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return ft(e,n);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ft(e,n):void 0}}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==t.return||t.return()}finally{if(l)throw o}}}}function ft(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,i=Array(n);t<n;t++)i[t]=e[t];return i}function mt(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function pt(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?mt(Object(i),!0).forEach((function(t){e(n,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):mt(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}var ht={},gt=(null===(at=window)||void 0===at||null===(lt=at.location)||void 0===lt||null===(st=lt.search)||void 0===st?void 0:st.includes("debug=true"))||!1,yt=null;function wt(e){return Tt.apply(this,arguments)}function Tt(){return Tt=n(t.mark((function e(i){var r,o,s,d,u,c,v,f,m,p,h,y,w,T,_,b,I,E,S,k,A,O,D,P,L,C,F;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:F=function(e,n,t,r,o){var l,s,d=a(i);if(!d.seeking()){var u=n.startTimeInSeconds;n.durationInSeconds;var c=(null==n||null===(l=n.ads)||void 0===l||null===(s=l[r])||void 0===s?void 0:s.adId)||u;Math.floor(d.currentTime());var v,f=vt(t);try{for(f.s();!(v=f.n()).done;){var m,p,h,g=v.value,y=g.eventType,w=g.beaconUrls,T=g.startTimeInSeconds,_=g.startTime,b=g.durationInSeconds,I=(g.eventId,T||u),E=w,S=(null===(m=window)||void 0===m||null===(p=m.customData)||void 0===p||null===(h=p.ads)||void 0===h?void 0:h.adEventHandler)||null,k="".concat(c,"_").concat(y),A="pod-".concat(u);P.has(A)||P.set(A,new Set);var O=P.get(A);if(gt&&console.warn(e,I,"map:",y,"condition1:",e>=I,"map:",P),e>=I&&e<=I+L&&!O.has(k)){O.add(k);try{C(y,n,E,d)}catch(e){console.error("Error when calling triggerAdBeacon:",e,y,n)}if("function"==typeof S)try{var D,F={eventType:y,startTimeInSeconds:T,startTime:_,durationInSeconds:b,ad:null==n||null===(D=n.ads)||void 0===D?void 0:D[r],adIndex:r};S({adsData:F}),qn(i,F)}catch(e){console.error("Error when calling ads callback:",e)}var j=Jn.get();if(j&&0!==Object.keys(j).length){var R=j.formulateComscoreAdPayload,W=j.startComscoreAdTracking,V=j.finishComscoreAdTracking,M=j.endComscoreAdTracking;if("impression"===y){var N,x=tt.get();W(R(pt(pt({},null==n||null===(N=n.ads)||void 0===N?void 0:N[r]),{},{trackingUrl:x})))}else"complete"===y?V():"breakEnd"===y&&M()}}}}catch(e){f.e(e)}finally{f.f()}}},C=function(e,n,t,i){var r,o,a;"breakEnd"===e&&(null===(r=ht)||void 0===r?void 0:r.currentAdIndex)+1!=(null===(o=ht)||void 0===o?void 0:o.totalAds)&&(null==n||null===(a=n.ads)||void 0===a?void 0:a.length)>0||(gt&&console.warn("%c SSAI BEACON ","background: #e25822; color: #fff",e,"Fired:".concat(Math.round(i.currentTime())),"AD_POD:",n),null==t||t.forEach((function(e){fetch(e,{mode:"no-cors"}).catch((function(n){console.warn("Beacon failed:",e,n)}))})))},h=function(){yt&&clearInterval(yt)},m=tt.get(),(p=a(i)).one("loadeddata",(function(){h(),yt=setInterval((function(){m&&!p.paused()&&D(m)}),2e3)})),p.on("dispose",(function(){h()})),y=new Map,w=new Map,T=-1,_=null,b=(null===(r=document)||void 0===r||null===(o=r.getElementsByClassName("tvProviderImage"))||void 0===o?void 0:o[0])||null,I=(null==p||null===(s=p.controlBar)||void 0===s?void 0:s.getChild("videoSelector"))||null,E=(null==p||null===(d=p.controlBar)||void 0===d?void 0:d.getChild("seriesV2"))||null,S=(null==p||null===(u=p.el())||void 0===u||null===(c=u.getElementsByClassName("vjs-button vjs-rewind-button"))||void 0===c?void 0:c[0])||null,k=(null==p||null===(v=p.el())||void 0===v||null===(f=v.getElementsByClassName("vjs-button vjs-skip-button"))||void 0===f?void 0:f[0])||null,A=!1,O=function(){var e,n,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(0==(null==t?void 0:t.length))return g(i);var r=[],o=null==i?void 0:i.find((function(e){return"breakEnd"===(null==e?void 0:e.eventType)})),a=(null==o||null===(e=o.beaconUrls)||void 0===e?void 0:e.find((function(e){return e.includes("videoView")})))||null,l=(null==t?void 0:t.length)>1?null==t?void 0:t[(null==t?void 0:t.length)-1]:null==t?void 0:t[0],s=null==l||null===(n=l.trackingEvents)||void 0===n?void 0:n.filter((function(e){return["breakEnd"].includes(null==e?void 0:e.eventType)})),d=(null==s?void 0:s.some((function(e){var n;return null==e||null===(n=e.beaconUrls)||void 0===n?void 0:n.some((function(e){return e.includes("videoView")}))})))||!1;if(!d&&a){var u=null==s?void 0:s.map((function(e){return pt(pt({},e),{},{eventType:"videoView",beaconUrls:[a]})}));null!=u&&u[0]&&r.push(null==u?void 0:u[0])}return r},D=function(){var e=n(t.mark((function e(n){var r,o,s,d,u,c,v,f,m,p,h,D;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d=new URL(n),_&&d.searchParams.append("nextToken",_),e.next=4,fetch(d.toString(),{method:"GET"});case 4:return u=e.sent,e.next=7,u.json();case 7:c=e.sent,v=c.avails,f=c.nextToken||null,_=f,m=[],p=a(i),h=null==p||null===(r=p.controlBar)||void 0===r?void 0:r.progressControl,D=null==h||null===(o=h.seekBar)||void 0===o?void 0:o.el(),null===(s=document)||void 0===s||s.querySelectorAll(".vjs-seekbar-marker").forEach((function(e){return null==e?void 0:e.remove()})),v.map((function(e,n){m.push({ads:null==e?void 0:e.ads,durationInSeconds:null==e?void 0:e.durationInSeconds,startTimeInSeconds:null==e?void 0:e.startTimeInSeconds,markerPositionInSeconds:Math.floor(null==e?void 0:e.startTimeInSeconds),podSlotImpressionBeacon:O(null==e?void 0:e.ads,null==e?void 0:e.adBreakTrackingEvents)})})),gt&&console.log("%c SSAI AD PODS ","background: #bdf369; color: #000",m),null!=m&&m.length&&(window.adsQueueList=m),m.forEach((function(e){var n=e.markerPositionInSeconds,t=e.ads,i=p.duration();if(!(n>i||Array.isArray(t)&&0==(null==t?void 0:t.length))){var r=n/i*100,o=document.createElement("div");o.className="vjs-seekbar-marker",o.style.left="".concat(r,"%"),o.style.position="absolute",o.style.top="0",o.style.bottom="0",o.style.width="2px",o.style.backgroundColor="#fecc09",o.style.left="".concat(r,"%"),o.style.pointerEvents="none",D.appendChild(o)}})),p._timeUpdateHandler&&p.off("timeupdate",null==p?void 0:p._timeUpdateHandler),p._timeUpdateHandler=l((function(){if(Ri(i)){var e=null==p?void 0:p.currentTime();if(e!==T){T=e;for(var n=function(){var n=m[t],i=n.startTimeInSeconds,r=n.durationInSeconds,o=n.ads,a=i+r;if(e>=i-1.2&&e<=a+1.2){var l;A=!!(e>=i&&e<=a&&Array.isArray(o)&&(null==o?void 0:o.length)>0),e>a&&y.set(i,!0),Wn.disable(),b&&b.classList.add("vjs-hidden"),S&&(S.style.pointerEvents="none",S.classList.add("vjs-hidden")),k&&(k.style.pointerEvents="none",k.classList.add("vjs-hidden")),I&&(I.el().style.pointerEvents="none",I.el().classList.add("vjs-hidden")),E&&(E.el().style.pointerEvents="none",E.el().classList.add("vjs-hidden")),h.el().classList.add("hide-progress-bar");for(var s=e-i,d=0,u=0,c=0;c<o.length;c++){var v,f=null==o||null===(v=o[c])||void 0===v?void 0:v.durationInSeconds;if(s<d+f){u=c;break}d+=f}setTimeout((function(){ht.totalAds=null==o?void 0:o.length,ht.currentAdIndex=u}),1e3);var p=[];return null==o||o.forEach((function(e){var n=e.trackingEvents.filter((function(e){return["breakStart","breakEnd","firstQuartile","secondQuartile","thirdQuartile","fourthQuartile","midpoint","impression","complete"].includes(e.eventType)}));p.push.apply(p,g(n))})),(null==n||null===(l=n.podSlotImpressionBeacon)||void 0===l?void 0:l.length)>0&&p.push.apply(p,g(null==n?void 0:n.podSlotImpressionBeacon)),F(e,n,p,u),"break"}w.delete(i)},t=0;t<m.length;t++){if("break"===n())break}A||(ht={},h.el().classList.remove("hide-progress-bar"),I&&(I.el().style.pointerEvents="auto",I.el().classList.remove("vjs-hidden")),E&&(E.el().style.pointerEvents="auto",E.el().classList.remove("vjs-hidden")),b&&b.classList.remove("vjs-hidden"),S&&(S.style.pointerEvents="auto",S.classList.remove("vjs-hidden")),k&&(k.style.pointerEvents="auto",k.classList.remove("vjs-hidden")),Wn.enable())}}}),1e3),p.on("timeupdate",p._timeUpdateHandler);case 23:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),P=new Map,L=2.5;case 22:case"end":return e.stop()}}),e)}))),Tt.apply(this,arguments)}var _t=/(?:(\d{1,}):)?(\d{2}):(\d{2})((\.(\d{1,3})))?/g;function bt(e){return JSON.stringify((e||[]).map((function(e){return{availId:e.availId,startTimeInSeconds:e.startTimeInSeconds,durationInSeconds:e.durationInSeconds,ads:(e.ads||[]).map((function(e){return{adId:e.adId,startTimeInSeconds:e.startTimeInSeconds,durationInSeconds:e.durationInSeconds}}))}})))}var It=function(){function e(n,t,i,r){I(this,e),this.video_=r,this.ad_=n,this.skipOffset_=function(e){if(!e)return null;var n=new RegExp(_t.source,"g");n.lastIndex=0;var t=n.exec(e);if(!t)return null;var i=Number(t[1])||0,r=Number(t[2]),o=Number(t[3]),a=Number(t[6])||0;return r>59||o>59?null:a/1e3+o+60*r+3600*i}(null==n?void 0:n.skipOffset),this.adPosition_=t,this.totalAds_=i,this.isSkipped_=!1}return E(e,[{key:"isClientRendering",value:function(){return!1}},{key:"getDuration",value:function(){var e,n;return null!==(e=null===(n=this.ad_)||void 0===n?void 0:n.durationInSeconds)&&void 0!==e?e:0}},{key:"getRemainingTime",value:function(){var e,n,t,i,r,o;return(null!==(e=null===(n=this.ad_)||void 0===n?void 0:n.startTimeInSeconds)&&void 0!==e?e:0)+(null!==(t=null===(i=this.ad_)||void 0===i?void 0:i.durationInSeconds)&&void 0!==t?t:0)-(null!==(r=null===(o=this.video_)||void 0===o?void 0:o.currentTime)&&void 0!==r?r:0)}},{key:"isSkippable",value:function(){return"number"==typeof this.skipOffset_}},{key:"getTimeUntilSkippable",value:function(){if("number"!=typeof this.skipOffset_)return this.getRemainingTime();var e=this.getRemainingTime()+this.skipOffset_-this.getDuration();return Math.max(e,0)}},{key:"canSkipNow",value:function(){return 0===this.getTimeUntilSkippable()}},{key:"skip",value:function(){this.isSkipped_=!0,this.video_&&(this.video_.currentTime+=this.getRemainingTime())}},{key:"isLinear",value:function(){return!0}},{key:"getSequenceLength",value:function(){return this.totalAds_||1}},{key:"getPositionInSequence",value:function(){return this.adPosition_||1}},{key:"getTitle",value:function(){var e;return(null===(e=this.ad_)||void 0===e?void 0:e.adTitle)||""}},{key:"getVastAdId",value:function(){var e;return(null===(e=this.ad_)||void 0===e?void 0:e.vastAdId)||""}},{key:"getAdId",value:function(){var e;return(null===(e=this.ad_)||void 0===e?void 0:e.adId)||""}},{key:"getCreativeAdId",value:function(){var e;return(null===(e=this.ad_)||void 0===e?void 0:e.creativeId)||""}},{key:"getTimeOffset",value:function(){var e,n;return null!==(e=null===(n=this.ad_)||void 0===n?void 0:n.startTimeInSeconds)&&void 0!==e?e:0}},{key:"release",value:function(){this.ad_=null,this.adPosition_=null,this.totalAds_=null}},{key:"isSkipped",value:function(){return this.isSkipped_}}]),e}(),Et="impression",St="start",kt="mute",At="unmute",Ot="resume",Dt="pause",Pt="firstQuartile",Lt="midpoint",Ct="thirdQuartile",Ft="complete",jt="skip",Rt="breakStart",Wt="breakEnd",Vt="skipStateChanged",Mt="ad_impression",Nt="ad_started",xt="ad_muted",Ut="ad_volume_changed",Bt="ad_resumed",Ht="ad_paused",Gt="ad_first_quartile",qt="ad_midpoint",zt="ad_third_quartile",Qt="ad_complete",Yt="ad_stopped",Kt="ad_skipped",Jt="ad_skip_state_changed",Xt="ad_break_started",$t="ad_break_ended",Zt="ads_loaded",ei="ad_cuepoints_changed";function ni(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function ti(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ni(Object(i),!0).forEach((function(t){e(n,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):ni(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}function ii(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return ri(e,n);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ri(e,n):void 0}}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==t.return||t.return()}finally{if(l)throw o}}}}function ri(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,i=Array(n);t<n;t++)i[t]=e[t];return i}var oi="[Transmit]";function ai(e){var n,t,i;if(null==e)return{avails:[],nextToken:null,dashAvailabilityStartTime:null};var r=null!==(n=e.dashAvailabilityStartTime)&&void 0!==n?n:null,o=null!==(t=e.nextToken)&&void 0!==t?t:null,a=[];if(Array.isArray(e.avails))a=e.avails;else if(Array.isArray(e)){var l,s,d,u,c=e[0];if(c&&Array.isArray(c.avails))a=c.avails,r=null!==(l=null!==(s=r)&&void 0!==s?s:c.dashAvailabilityStartTime)&&void 0!==l?l:null,o=null!==(d=null!==(u=o)&&void 0!==u?u:c.nextToken)&&void 0!==d?d:null;else a=e}else if(Array.isArray(null==e||null===(i=e.data)||void 0===i?void 0:i.avails)){var v,f,m,p;a=e.data.avails,o=null!==(v=null!==(f=o)&&void 0!==f?f:e.data.nextToken)&&void 0!==v?v:null,r=null!==(m=null!==(p=r)&&void 0!==p?p:e.data.dashAvailabilityStartTime)&&void 0!==m?m:null}else Array.isArray(null==e?void 0:e.data)&&(a=e.data);return{avails:a,nextToken:o,dashAvailabilityStartTime:r}}var li=function(){function e(n,t,i){var r=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};I(this,e),this.video_=n,this.player_=t,this.onEvent_="function"==typeof i?i:function(){},this.dashManifestUrl_=o.dashManifestUrl||null,this.config_=null,this.trackingUrl_="",this.firstTrackingRequest_=!0,this.nextToken_=null,this.dashAvailabilityStartTime_=0,this.dashAvailabilityStartTimeResolved_=!1,this.pollIntervalMs_=2e3,this.pollId_=null,this.adBreaks_=[],this.ad_=null,this.transmitAd_=null,this.transmitAdBreak_=null,this.eventsSent_=new Set,this.firedBeacons_=new Set,this.adBreakListenersAttached_=!1,this.globalListeners_=[],this.adListeners_=[],this.videoTimeupdate_=null,this.lastMutedForAd_=null,this.onDispose_=function(){return r.release()},this.apiTimelineAbsolute_=!1}var i,r,o;return E(e,[{key:"configure",value:function(e){this.config_=e}},{key:"addTrackingUrl",value:function(e){this.trackingUrl_=e||"",this.onEvent_({type:Zt,loadTime:0})}},{key:"getCuePoints",value:function(){var e,n=new Map,t=ii(this.adBreaks_);try{for(t.s();!(e=t.n()).done;){var i,r=ii(e.value.ads||[]);try{for(r.s();!(i=r.n()).done;){var o=i.value,a=o.startTimeInSeconds,l=a+o.durationInSeconds;if(isFinite(a)&&isFinite(l)&&!(l<=a)){var s="".concat(a.toFixed(1),"|").concat(l.toFixed(1));n.has(s)||n.set(s,{start:a,end:l})}}}catch(e){r.e(e)}finally{r.f()}}}catch(e){t.e(e)}finally{t.f()}return Array.from(n.values()).sort((function(e,n){return e.start-n.start}))}},{key:"onManifestUpdated",value:function(){this.trackingUrl_&&(this.requestTrackingInfo_(this.firstTrackingRequest_),this.firstTrackingRequest_=!1,this.ensurePolling_())}},{key:"stop",value:function(){this.onEnded_(),this.detachAllListeners_(),this.eventsSent_.clear(),this.firedBeacons_.clear(),this.trackingUrl_="",this.firstTrackingRequest_=!0,this.nextToken_=null,this.dashAvailabilityStartTime_=0,this.dashAvailabilityStartTimeResolved_=!1,this.apiTimelineAbsolute_=!1,this.adBreaks_=[],this.adBreakListenersAttached_=!1,this.pollId_&&(clearInterval(this.pollId_),this.pollId_=null)}},{key:"release",value:function(){this.stop()}},{key:"ensurePolling_",value:function(){var e=this;this.pollId_||(this.pollId_=setInterval((function(){var n,t;e.trackingUrl_&&(null!==(n=e.player_)&&void 0!==n&&null!==(t=n.paused)&&void 0!==t&&t.call(n)||e.requestTrackingInfo_(!1))}),this.pollIntervalMs_))}},{key:"requestTrackingInfo_",value:(o=n(t.mark((function e(n){var i,r,o,a,l,s,d,u,c,v,f,m,p,h,g,y,w;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.prev=0,r=new Map,o=0,a=null;case 4:if(!(o<10)){e.next=25;break}return l=new URL(this.trackingUrl_),this.nextToken_&&l.searchParams.set("nextToken",this.nextToken_),e.next=9,fetch(l.toString(),{method:"GET"});case 9:return s=e.sent,e.next=12,s.json();case 12:d=e.sent,o++,(u=ai(d)).dashAvailabilityStartTime&&!a&&(a=u.dashAvailabilityStartTime),c=ii(u.avails);try{for(c.s();!(v=c.n()).done;)f=v.value,m=(null==f?void 0:f.availId)||"".concat(null==f?void 0:f.startTimeInSeconds),r.set(m,f)}catch(e){c.e(e)}finally{c.f()}if((p=u.nextToken||null)&&p!==this.nextToken_){e.next=22;break}return this.nextToken_=p,e.abrupt("break",25);case 22:this.nextToken_=p,e.next=4;break;case 25:if(h=Array.from(r.values()),this.updateApiTimelineAbsoluteFlag_(h),g=(null==h||null===(i=h[0])||void 0===i?void 0:i.startTimeInSeconds)||0,this.apiTimelineAbsolute_){e.next=33;break}return e.next=31,this.resolveDashAvailabilityStartTime_(a,g);case 31:e.next=35;break;case 33:this.dashAvailabilityStartTimeResolved_=!0,this.dashAvailabilityStartTime_=0;case 35:h.length?(y=this.normalizeAvails_(h),bt(this.adBreaks_)!==bt(y)&&(this.adBreaks_=y,w=this.getCuePoints(),this.onEvent_({type:ei,cuepoints:w}))):this.adBreaks_.length&&(this.onEvent_({type:ei,cuepoints:[]}),this.onEnded_(),this.adBreaks_=[]),n&&this.setupAdBreakListeners_(),e.next=42;break;case 39:e.prev=39,e.t0=e.catch(0),console.warn(oi,"tracking info fetch failed",e.t0);case 42:case"end":return e.stop()}}),e,this,[[0,39]])}))),function(e){return o.apply(this,arguments)})},{key:"updateApiTimelineAbsoluteFlag_",value:function(e){this.apiTimelineAbsolute_=!1;var n,t=1e6,i=ii(e||[]);try{for(i.s();!(n=i.n()).done;){var r,o=n.value;if((null!==(r=null==o?void 0:o.startTimeInSeconds)&&void 0!==r?r:0)>t)return void(this.apiTimelineAbsolute_=!0);var a,l=ii((null==o?void 0:o.ads)||[]);try{for(l.s();!(a=l.n()).done;){var s,d=a.value;if((null!==(s=null==d?void 0:d.startTimeInSeconds)&&void 0!==s?s:0)>t)return void(this.apiTimelineAbsolute_=!0)}}catch(e){l.e(e)}finally{l.f()}}}catch(e){i.e(e)}finally{i.f()}}},{key:"normalizeAvails_",value:function(e){var n=this,t=this.apiTimelineAbsolute_?0:this.dashAvailabilityStartTime_||0;return e.map((function(e){var i=n.resolveAbsoluteStart_(e,t,null);return ti(ti({},e),{},{startTimeInSeconds:i,ads:(e.ads||[]).map((function(r){return ti(ti({},r),{},{startTimeInSeconds:n.resolveAbsoluteStart_(r,t,e,i)})}))})}))}},{key:"resolveAbsoluteStart_",value:function(e,n,t,i){var r=null==e?void 0:e.adProgramDateTime;if(r){var o=new Date(r).getTime()/1e3;if(isFinite(o)&&o>0)return o}return null!=t&&t.adProgramDateTime&&"number"==typeof i?i+((e.startTimeInSeconds||0)-(t.startTimeInSeconds||0)):(e.startTimeInSeconds||0)+n}},{key:"resolveDashAvailabilityStartTime_",value:(r=n(t.mark((function e(n,i){var r,o;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.dashAvailabilityStartTimeResolved_){e.next=2;break}return e.abrupt("return");case 2:if(!n){e.next=8;break}if(r=new Date(n).getTime()/1e3,!(isFinite(r)&&r>0)){e.next=8;break}return this.dashAvailabilityStartTime_=r,this.dashAvailabilityStartTimeResolved_=!0,e.abrupt("return");case 8:if(!(i>0)){e.next=13;break}return e.next=11,this.fetchDashAvailabilityStartTimeFromMpd_();case 11:(o=e.sent)>0&&(this.dashAvailabilityStartTime_=o,this.dashAvailabilityStartTimeResolved_=!0);case 13:case"end":return e.stop()}}),e,this)}))),function(e,n){return r.apply(this,arguments)})},{key:"fetchDashAvailabilityStartTimeFromMpd_",value:(i=n(t.mark((function e(){var n,i,r,o,a,l;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,(i=this.dashManifestUrl_||this.getCurrentSourceUrl_())&&i.includes(".mpd")){e.next=4;break}return e.abrupt("return",0);case 4:return e.next=6,fetch(i);case 6:return r=e.sent,e.next=9,r.text();case 9:return o=e.sent,a=(new DOMParser).parseFromString(o,"application/xml"),l=null===(n=a.querySelector("MPD"))||void 0===n?void 0:n.getAttribute("availabilityStartTime"),e.abrupt("return",l?new Date(l).getTime()/1e3:0);case 15:return e.prev=15,e.t0=e.catch(0),console.warn(oi,"MPD availabilityStartTime parse failed",e.t0),e.abrupt("return",0);case 19:case"end":return e.stop()}}),e,this,[[0,15]])}))),function(){return i.apply(this,arguments)})},{key:"getCurrentSourceUrl_",value:function(){try{var e,n,t,i,r=(null===(e=this.player_)||void 0===e||null===(n=e.currentSrc)||void 0===n?void 0:n.call(e))||(null===(t=this.player_)||void 0===t||null===(i=t.src)||void 0===i?void 0:i.call(t));return"string"==typeof r?r:(null==r?void 0:r.src)||""}catch(e){return""}}},{key:"setupAdBreakListeners_",value:function(){var e=this;if(!this.adBreakListenersAttached_){this.adBreakListenersAttached_=!0,this.onTimeupdate_();this.attachGlobalListener_("timeupdate",(function(){return e.onTimeupdate_()})),this.attachGlobalListener_("dispose",this.onDispose_),this.video_&&(this.videoTimeupdate_=function(){return e.onTimeupdate_()},this.video_.addEventListener("timeupdate",this.videoTimeupdate_))}}},{key:"isHlsSource_",value:function(){var e,n,t=this.getCurrentSourceUrl_().toLowerCase(),i=((null===(e=this.player_)||void 0===e||null===(n=e.currentType)||void 0===n?void 0:n.call(e))||"").toLowerCase();return t.includes(".m3u8")||"application/x-mpegurl"===i||"application/vnd.apple.mpegurl"===i}},{key:"isDashSource_",value:function(){var e,n,t=this.getCurrentSourceUrl_().toLowerCase();return"application/dash+xml"===((null===(e=this.player_)||void 0===e||null===(n=e.currentType)||void 0===n?void 0:n.call(e))||"").toLowerCase()||t.includes(".mpd")}},{key:"getDashMediaPlayerTimelineSeconds_",value:function(){try{var e,n,t=null===(e=this.player_)||void 0===e||null===(n=e.dash)||void 0===n?void 0:n.mediaPlayer;if(!t||"function"!=typeof t.time)return null;var i=t.time();return"number"==typeof i&&isFinite(i)&&i>1e6?i:null}catch(e){return null}}},{key:"getCurrentTime_",value:function(){var e,n,t,i=null!==(e=null===(n=this.video_)||void 0===n?void 0:n.currentTime)&&void 0!==e?e:0,r=c();if(this.isHlsSource_()){var o,a,l=i,s=null===(o=this.player_)||void 0===o||null===(a=o.seekable)||void 0===a?void 0:a.call(o);return s&&s.length>0&&(l=s.end(s.length-1)),Date.now()/1e3-(l-i)}if(this.isDashSource_()){var d,u,v,f=this.getDashMediaPlayerTimelineSeconds_();if(null!=f)return f;var m=null===(d=this.player_)||void 0===d||null===(u=d.seekable)||void 0===u?void 0:u.call(d),p="function"==typeof(null===(v=this.player_)||void 0===v?void 0:v.currentTime)?this.player_.currentTime():i;if(m&&m.length>0){var h=m.start(0);if(h>1e6&&h+p>1e6)return h+p}if(this.apiTimelineAbsolute_&&(this.dashAvailabilityStartTime_||0)>1e9)return(this.dashAvailabilityStartTime_||0)+p}return"Safari"===r?i:"function"==typeof(null===(t=this.player_)||void 0===t?void 0:t.currentTime)?this.player_.currentTime():i}},{key:"onTimeupdate_",value:function(){if(this.ad_||this.adBreaks_.length){var e=this.getCurrentTime_();if(this.ad_){var n,t;this.sendInProgressEvents_(e,this.transmitAd_);var i=this.ad_.getDuration(),r=(null!==(n=null===(t=this.transmitAd_)||void 0===t?void 0:t.startTimeInSeconds)&&void 0!==n?n:0)+i,o=r-e;this.ad_.canSkipNow()&&o>0&&i>0&&this.sendTrackingEvent_(Vt),i>0&&e>=r&&this.onEnded_()}this.ad_||this.checkLinearAds_(e)}}},{key:"sendInProgressEvents_",value:function(e,n){if(n){var t=n.startTimeInSeconds+.25*n.durationInSeconds,i=n.startTimeInSeconds+.5*n.durationInSeconds,r=n.startTimeInSeconds+.75*n.durationInSeconds;e>=t&&!this.eventsSent_.has(Pt)&&(this.eventsSent_.add(Pt),this.sendTrackingEvent_(Pt)),e>=i&&!this.eventsSent_.has(Lt)&&(this.eventsSent_.add(Lt),this.sendTrackingEvent_(Lt)),e>=r&&!this.eventsSent_.has(Ct)&&(this.eventsSent_.add(Ct),this.sendTrackingEvent_(Ct))}}},{key:"flushPendingQuartiles_",value:function(){for(var e=0,n=[Pt,Lt,Ct];e<n.length;e++){var t=n[e];this.eventsSent_.has(t)||(this.eventsSent_.add(t),this.sendTrackingEvent_(t))}}},{key:"checkLinearAds_",value:function(e){var n,t=ii(this.adBreaks_);try{for(t.s();!(n=t.n()).done;){var i=n.value;if(this.ad_)break;for(var r=i.ads||[],o=0;o<r.length;o++){var a=r[o],l=a.startTimeInSeconds,s=l+a.durationInSeconds;if(l<=e&&s>e){this.onEnded_(),this.transmitAdBreak_=i,this.transmitAd_=a,this.ad_=new It(a,o+1,r.length,this.video_),0===o&&this.sendTrackingEvent_(Rt),this.setupCurrentAdListeners_();break}}}}catch(e){t.e(e)}finally{t.f()}}},{key:"onEnded_",value:function(){this.ad_&&this.transmitAd_&&(this.ad_.isSkipped()||this.flushPendingQuartiles_(),this.removeCurrentAdListeners_(this.ad_.isSkipped()),this.ad_.getPositionInSequence()===this.ad_.getSequenceLength()&&this.sendTrackingEvent_(Wt),this.ad_=null,this.transmitAd_=null,this.transmitAdBreak_=null)}},{key:"setupCurrentAdListeners_",value:function(){var e,n,t,i,r,o=this,a=!1;null!==(e=this.player_)&&void 0!==e&&null!==(n=e.paused)&&void 0!==n&&n.call(e)?a=!0:(this.sendTrackingEvent_(Et),this.sendTrackingEvent_(St)),this.lastMutedForAd_=null!==(t=null===(i=this.player_)||void 0===i||null===(r=i.muted)||void 0===r?void 0:r.call(i))&&void 0!==t&&t,this.attachAdListener_("volumechange",(function(){var e,n,t,i=null!==(e=null===(n=o.player_)||void 0===n||null===(t=n.muted)||void 0===t?void 0:t.call(n))&&void 0!==e&&e;i!==o.lastMutedForAd_&&(o.lastMutedForAd_=i,i?o.sendTrackingEvent_(kt):o.sendTrackingEvent_(At))})),this.attachAdListener_("play",(function(){a?(o.sendTrackingEvent_(Et),o.sendTrackingEvent_(St),a=!1):o.sendTrackingEvent_(Ot)})),this.attachAdListener_("pause",(function(){o.sendTrackingEvent_(Dt)}))}},{key:"removeCurrentAdListeners_",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.sendTrackingEvent_(e?jt:Ft),this.detachAdListeners_(),this.eventsSent_.clear()}},{key:"attachGlobalListener_",value:function(e,n){this.player_&&(this.player_.on(e,n),this.globalListeners_.push({event:e,handler:n}))}},{key:"attachAdListener_",value:function(e,n){this.player_&&(this.player_.on(e,n),this.adListeners_.push({event:e,handler:n}))}},{key:"detachAdListeners_",value:function(){var e,n=ii(this.adListeners_);try{for(n.s();!(e=n.n()).done;){var t,i,r,o=e.value,a=o.event,l=o.handler;null===(t=this.player_)||void 0===t||null===(i=(r=t).off)||void 0===i||i.call(r,a,l)}}catch(e){n.e(e)}finally{n.f()}this.adListeners_=[]}},{key:"detachAllListeners_",value:function(){this.detachAdListeners_();var e,n=ii(this.globalListeners_);try{for(n.s();!(e=n.n()).done;){var t,i,r,o=e.value,a=o.event,l=o.handler;null===(t=this.player_)||void 0===t||null===(i=(r=t).off)||void 0===i||i.call(r,a,l)}}catch(e){n.e(e)}finally{n.f()}this.globalListeners_=[],this.video_&&this.videoTimeupdate_&&(this.video_.removeEventListener("timeupdate",this.videoTimeupdate_),this.videoTimeupdate_=null)}},{key:"startComscoreForCurrentAd_",value:function(){try{var e=Jn.get();if(!e||0===Object.keys(e).length)return;var n=e.formulateComscoreAdPayload,t=e.startComscoreAdTracking,i=tt.get();t(n(ti(ti({},this.transmitAd_),{},{trackingUrl:i})))}catch(e){console.warn(oi,"comscore start failed",e)}}},{key:"sendTrackingEvent_",value:function(e){var n,t=this;if(this.transmitAd_&&this.transmitAdBreak_){var i=(this.transmitAd_.trackingEvents||[]).find((function(n){return n.eventType===e}));if(i||(i=(this.transmitAdBreak_.adBreakTrackingEvents||[]).find((function(n){return n.eventType===e}))),i&&(null===(n=this.config_)||void 0===n||!n.disableTrackingEvents)){var r,o,a,l=(null===(r=this.transmitAd_)||void 0===r?void 0:r.adId)||(null===(o=this.transmitAdBreak_)||void 0===o?void 0:o.availId)||"unknown",s=ii(i.beaconUrls||[]);try{var d=function(){var n=a.value;if(!n)return"continue";var i="".concat(l,"|").concat(e,"|").concat(n);if(t.firedBeacons_.has(i))return"continue";t.firedBeacons_.add(i),fetch(n,{mode:"no-cors"}).catch((function(e){console.warn(oi,"beacon failed",n,e)}))};for(s.s();!(a=s.n()).done;)d()}catch(e){s.e(e)}finally{s.f()}}var u=Jn.get(),c=u&&Object.keys(u).length?u:null;switch(e){case Et:this.onEvent_({type:Mt}),this.startComscoreForCurrentAd_();break;case St:this.onEvent_({type:Nt,ad:this.ad_});break;case kt:this.onEvent_({type:xt});break;case At:this.onEvent_({type:Ut});break;case Ot:this.onEvent_({type:Bt});break;case Dt:this.onEvent_({type:Ht});break;case Pt:this.onEvent_({type:Gt});break;case Lt:this.onEvent_({type:qt});break;case Ct:this.onEvent_({type:zt});break;case Ft:this.onEvent_({type:Qt}),this.onEvent_({type:Yt}),null!=c&&c.finishComscoreAdTracking&&c.finishComscoreAdTracking();break;case jt:this.onEvent_({type:Kt}),this.onEvent_({type:Yt});break;case Rt:this.onEvent_({type:Xt});break;case Wt:this.onEvent_({type:$t}),null!=c&&c.endComscoreAdTracking&&c.endComscoreAdTracking();break;case Vt:this.onEvent_({type:Jt})}}else console.warn(oi,"sendTrackingEvent_ skipped — no active ad",{eventType:e})}}]),e}();function si(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function di(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?si(Object(i),!0).forEach((function(t){e(n,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):si(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}var ui={dash:"tracking/initialize/dash",hls:"tracking/initialize/hls"};function ci(e){if(null==e||!e.src)return null;var n=(e.type||"").toLowerCase(),t=String(e.src).toLowerCase();return"application/dash+xml"===n||t.includes(".mpd")?"dash":"application/x-mpegurl"===n||"application/vnd.apple.mpegurl"===n||t.includes(".m3u8")?"hls":null}function vi(e,n,t){return fi.apply(this,arguments)}function fi(){return(fi=n(t.mark((function e(n,i,r){var o,a,l,s,d,u,c,v,f,m,p;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=ci(n)){e.next=3;break}return e.abrupt("return",n);case 3:return a=bn(n.src,r,i),l=a.replace(o,ui[o]),console.log("[Transmit] session init →",l),e.prev=6,e.next=9,fetch(l,{method:"GET",redirect:"follow"});case 9:return s=e.sent,e.next=12,s.json();case 12:if(d=e.sent,console.log("[Transmit] session response",d),u="dash"===o?null==d?void 0:d.dashUrl:null==d?void 0:d.hlsUrl,c=null==d?void 0:d.trackingUrl,u&&c){e.next=18;break}return e.abrupt("return",n);case 18:return v=new URL(l),f=v.hostname,m="https://".concat(f).concat(u),p="https://".concat(f).concat(c),tt.set(p),console.log("[Transmit] session ready",{manifestUrl:m,trackingUrl:p}),e.abrupt("return",di(di({},n),{},{src:m}));case 26:return e.prev=26,e.t0=e.catch(6),console.warn("[Transmit] session init failed",e.t0),e.abrupt("return",n);case 30:case"end":return e.stop()}}),e,null,[[6,26]])})))).apply(this,arguments)}var mi,pi=null;function hi(e,n){var t;if(pi)return console.log("[Transmit] initializeTransmit skipped — manager already initialised"),pi;var i=tt.get();if(!i)return console.warn("[Transmit] initializeTransmit skipped — no tracking URL"),null;var r=a(e);if(!r)return console.warn("[Transmit] initializeTransmit skipped — no player"),null;var o=(null===(t=r.el())||void 0===t?void 0:t.querySelector("video"))||null,l=function(e){try{var n="function"==typeof(null==e?void 0:e.currentSrc)&&e.currentSrc()||"function"==typeof(null==e?void 0:e.src)&&e.src()||"";if("application/dash+xml"===("function"==typeof(null==e?void 0:e.currentType)&&e.currentType()||"")||String(n).includes(".mpd"))return n}catch(e){}return null}(r);return(pi=new li(o,r,(function(e){var t,i;console.log("[Transmit] ad event",e);var r=null==n||null===(t=n.customData)||void 0===t||null===(i=t.ads)||void 0===i?void 0:i.adEventHandler;if("function"==typeof r)try{r(e)}catch(e){console.warn("[Transmit] adEventHandler threw",e)}}),{dashManifestUrl:l})).configure({disableTrackingEvents:!1}),pi.addTrackingUrl(i),pi.onManifestUpdated(),pi}function gi(){pi&&(pi.release(),pi=null)}function yi(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function wi(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?yi(Object(i),!0).forEach((function(t){e(n,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):yi(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}var Ti=[],_i=0,bi=null;function Ii(e,n){var t,i,r;if(null!=n&&null!==(t=n.watchHistory)&&void 0!==t&&t.enable&&null!=n&&null!==(i=n.watchHistory)&&void 0!==i&&i.cb&&"function"==typeof(null==n||null===(r=n.watchHistory)||void 0===r?void 0:r.cb)){var o,a,l,s=(null==n||null===(o=n.watchHistory)||void 0===o?void 0:o.interval)||30,d=(null==n||null===(a=n.watchHistory)||void 0===a?void 0:a.completionThreshold)||95,u=null==n||null===(l=n.watchHistory)||void 0===l?void 0:l.cb,c=-1;e.on("seeked",(function(){if(!window.isAdPlaying){var n=Math.floor(e.currentTime()),t=n-n%s;if(c=t,t>0){var i=Math.floor(n/e.duration()*100);u({watchedTime:n,watchedPercentage:i,doneWatching:i>=d})}}})),e.on("timeupdate",(function(){if(!window.isAdPlaying){var n=Math.floor(e.currentTime()),t=n-n%s;if(n%s==0&&t!==c){c=t;var i=Math.floor(n/e.duration()*100);u({watchedTime:n,watchedPercentage:i,doneWatching:i>=d||!1})}}})),e.on("ended",(function(){u({watchedTime:Math.floor(e.duration()),watchedPercentage:100,doneWatching:!0})}))}}function Ei(e,n,t){var i,r,o;null!=n&&n.series&&null!=n&&null!==(i=n.series)&&void 0!==i&&i.enable&&(bi=null==n||null===(r=n.series)||void 0===r?void 0:r.id),Ti=[],_i=0,mi=t;var l=(null==n||null===(o=n.watchHistory)||void 0===o?void 0:o.interval)||30,s=a(e);s&&(s.on("dispose",Si),s.on("timeupdate",(function(){if(!s.seeking()&&!window.isAdPlaying){var e=Math.floor(s.currentTime());Ti.includes(_i)||(e!=_i||e<l?e>_i&&(_i=e+l):(Ti.push(e),ki(s,n,l)))}})),s.on("seeked",(function(){var e=Math.floor(s.currentTime());_i=e+l,Ti=[]})),s.one("ended",(function(){ki(s,n,l,!0)})))}function Si(){mi=null,Ti=[],_i=0,bi=null}function ki(n,t,i){var r,o,a,l,s,d=arguments.length>3&&void 0!==arguments[3]&&arguments[3];null==t||null===(r=t.watchHistory)||void 0===r||r.apiVersion;var u=null==t||null===(o=t.watchHistory)||void 0===o?void 0:o.profileId,c=Math.floor(n.currentTime()),v=Math.floor(n.duration());null==t||null===(a=t.watchHistory)||void 0===a||a.xapiKey;var f=(null==t||null===(l=t.video)||void 0===l?void 0:l.originalObjectId)||null,m=(null==t||null===(s=t.watchHistory)||void 0===s?void 0:s.saveOffline)||!1,p=Math.floor(n.currentTime()),h=d?100:Math.floor(c/v*100),g={};m?function(n,t,i){var r=t?"watchhistory-data-".concat(t):"watchhistory-data-guest-".concat(i),o=Ai(r),a=(new Date).getTime(),l=De(),s=(null==l?void 0:l.video)||{},d=["id","title","gist","categories","tags","status","publishDate","plans","isVerticalVideo","monetizationBadgeIdentifier","runtime"].reduce((function(n,t){return wi(wi({},n),{},e({},t,s[t]))}),{}),u=o.findIndex((function(e){var n;return(null==e||null===(n=e.content)||void 0===n?void 0:n.id)===mi}));u<0?o.push(wi(wi({content:d},n),{},{addedDate:a,updateDate:a})):o[u]=wi(wi(wi({},o[u]),n),{},{updateDate:a});localStorage.setItem("".concat(r),JSON.stringify(o))}(g={completed:d,watchedTime:p,watchedPercentage:h},u,t.siteOwner):(g=wi(wi({videoId:mi,watchedTime:p,watchedPercentage:h,doneWatching:d,profileId:u},bi&&{seriesId:bi}),f&&{originalObjectId:f}),ae(g).then((function(e){})).catch((function(e){}))),_i=c+i}function Ai(e){var n=[];return e&&(n=JSON.parse(localStorage.getItem("".concat(e))||"[]")),n}function Oi(e,n,t){var i=Ai(e?"watchhistory-data-".concat(e):"watchhistory-data-guest-".concat(t)),r=[];return i&&Array.isArray(i)&&(r=i.filter((function(e){var t;return(null==e||null===(t=e.content)||void 0===t?void 0:t.id)===n}))),r}function Di(e,n){setTimeout((function(){e.currentTime(n)}),0),e.one("playing",(function(){e.currentTime()<n-1&&e.currentTime(n)}))}function Pi(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}var Li=function(e){var n=i(e);n.paused()&&S(e,{play:1}),n.play()},Ci=function(e){var n=i(e);n.paused()||S(e,{pause:1}),n.pause()},Fi=function(e,n){var t=i(e),r=t.currentTime()+n;t.currentTime(r)},ji=function(e,n){var t=i(e),r=t.currentTime(),o=r<=n?0:r-n;t.currentTime(o)},Ri=function(e){return!!i.getPlayer("".concat(e))},Wi=function(e){return i(e).paused()},Vi=function(){var e=n(t.mark((function e(i,r){var l,s,d,u,c=arguments;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=c.length>2&&void 0!==c[2]&&c[2],e.next=3,Ie();case 3:return s=e.sent,d=a(i),u=o.getConfig(),e.abrupt("return",new Promise((function(e,o){re(r,s).then(function(){var o=n(t.mark((function n(o){var a,s,c,v,f,m,p,h,g,y,w;return t.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(gi(),(m=null==o?void 0:o.data).contentType="linearchannel",m.channelId=null==r?void 0:r.channelId,p=(null===(a=window.customData)||void 0===a?void 0:a.ads)||(null===(s=window)||void 0===s||null===(c=s.app_data)||void 0===c||null===(v=c.appcmsMain)||void 0===v?void 0:v.adsConfig)||{},h=!(null==m||null===(f=m.linearchannel)||void 0===f||!f.isSSAIEnabled),g=h&&"MEDIA_TAILOR"==(null==p?void 0:p.vodAdSticherProvider),y=h&&"TRANSMIT"==(null==p?void 0:p.liveAdSticherProvider)&&!(null==p||!p.liveAdClientSideTracking),w=En(m,i),!g){n.next=16;break}return n.next=12,it(i,m);case 12:w=n.sent,l=!0,n.next=21;break;case 16:if(!y){n.next=21;break}return n.next=19,vi(w,m,i);case 19:w=n.sent,l=!0;case 21:Oe(m),w&&l?(Xe(),cn(i,{analyticsCb:null==u?void 0:u.analyticsCb,analyticsEventParams:null==u?void 0:u.analyticsEventParams,userId:null==u?void 0:u.userId}),Bi(i,w),y?hi(i,{customData:window.customData||{ads:p}}):g&&wt(i),d.on("loadstart",(function(){e({status:!0,msg:"Feed authenticated and loaded",response:m})}))):(Jn.get()&&0!==Object.keys(Jn.get()).length&&Xn({playerId:i,comscore:{enable:!0}}),e({status:!0,msg:"Feed authenticated",response:m}));case 23:case"end":return n.stop()}}),n)})));return function(e){return o.apply(this,arguments)}}()).catch((function(e){o({status:!1,msg:"Cannot load feed",response:e})}))})));case 7:case"end":return e.stop()}}),e)})));return function(n,t){return e.apply(this,arguments)}}(),Mi=function(){var e=n(t.mark((function e(i,r,l){var s,d,u,c,v,f,h,g;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ie();case 2:return c=e.sent,v=o.getConfig(),console.log("load video"),(Le()||null)&&We(r),f=0,h=0,g=null,null!==(s=window)&&void 0!==s&&s.watchHistory&&null!==(d=window)&&void 0!==d&&null!==(u=d.watchHistory)&&void 0!==u&&u.enable&&le(r,c).then((function(e){var n,t,i,r,o,a,l,s,d;(null===(n=window)||void 0===n||null===(t=n.watchHistory)||void 0===t||!t.cb||null!==(i=window)&&void 0!==i&&null!==(r=i.watchHistory)&&void 0!==r&&r.isExternal||null===(o=window)||void 0===o||null===(a=o.watchHistory)||void 0===a||a.cb(null==e?void 0:e.data),f=(null==e||null===(l=e.data)||void 0===l?void 0:l.watchedTime)||null,(h=(null==e||null===(s=e.data)||void 0===s?void 0:s.watchedPercentage)||null)<95)&&(g=(null==e||null===(d=e.data)||void 0===d?void 0:d.watchedTime)||null)})).catch((function(){})),e.abrupt("return",new Promise((function(e,o){ie(r,c).then(function(){var r=n(t.mark((function n(r){var l,s,d,u,c,y,w,T,_,b,I,E,S,k,A,O,D,P,L,C,F,j,R,W,V,M,N,x,U,B,H,G,q,z,Q,Y,K,J,X,$,Z;return t.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(O=null==r?void 0:r.data,D=(null==O?void 0:O.contentType)||"video",P=(null===(l=window.customData)||void 0===l?void 0:l.ads)||(null===(s=window)||void 0===s||null===(d=s.app_data)||void 0===d||null===(u=d.appcmsMain)||void 0===u?void 0:u.adsConfig)||{},L=!(null==O||null===(c=O[D])||void 0===c||!c.isSSAIEnabled),C=L&&"MEDIA_TAILOR"==(null==P?void 0:P.vodAdSticherProvider),F=L&&"TRANSMIT"==(null==P?void 0:P.liveAdSticherProvider)&&!(null==P||!P.liveAdClientSideTracking),j=!(null==O||null===(y=O[D])||void 0===y||null===(w=y.streamingInfo)||void 0===w||!w.isLiveStream)||"linearchannel"===D,Oe(r.data),(R=(null==O||null===(T=O.ads)||void 0===T||null===(_=T.preRoll)||void 0===_||null===(b=_.adTags)||void 0===b||null===(I=b.web)||void 0===I?void 0:I.active)&&(null==O||null===(E=O.ads)||void 0===E||null===(S=E.preRoll)||void 0===S||null===(k=S.adTags)||void 0===k||null===(A=k.web)||void 0===A?void 0:A.url))&&Fn(i,R,O),W=En(O,i),!C){n.next=17;break}return n.next=14,it(i,O);case 14:W=n.sent,n.next=22;break;case 17:if(!F||!j){n.next=22;break}return gi(),n.next=21,vi(W,O,i);case 21:W=n.sent;case 22:if(!W){n.next=40;break}if(Q=(null==O||null===(V=O.video)||void 0===V||null===(M=V.gist)||void 0===M?void 0:M.videoImageUrl)||(null==O||null===(N=O.video)||void 0===N||null===(x=N.gist)||void 0===x||null===(U=x.imageGist)||void 0===U?void 0:U.r16x9),Y=a(i)){n.next=28;break}return console.error("[VL][player-core] player not found for id=".concat(i),{player:Y}),n.abrupt("return",o({status:!1,msg:"Player not found",response:{}}));case 28:Y.poster(Q),Xe(),cn(i,{analyticsCb:null==v?void 0:v.analyticsCb,analyticsEventParams:null==v?void 0:v.analyticsEventParams,userId:null==v?void 0:v.userId}),Bi(i,W),F&&j?hi(i,{customData:window.customData||{ads:P}}):C&&ut(i,g),Y.on("loadstart",(function(){j&&e({status:!0,msg:"Video Loaded",response:O})})),Y.on("loadeddata",(function(){Ln(),e({status:!0,msg:"Video Loaded",response:O})})),Y.one("play",(function(){!f||C||F&&j||h<95&&Di(Y,f)})),Y.one("error",(function(){var e;o({status:!1,msg:(null==Y||null===(e=Y.error())||void 0===e?void 0:e.message)||"Some error occured"})})),(null==O||null===(B=O.video)||void 0===B||null===(H=B.contentDetails)||void 0===H||null===(G=H.closedCaptions)||void 0===G?void 0:G.length)>0||(null==O||null===(q=O.video)||void 0===q||null===(z=q.closedCaptions)||void 0===z?void 0:z.length)>0?(Z=(null==O||null===(J=O.video)||void 0===J||null===(X=J.contentDetails)||void 0===X?void 0:X.closedCaptions)||(null==O||null===($=O.video)||void 0===$?void 0:$.closedCaptions),K=Z.filter((function(e){return"VTT"===e.format})),p(i,K)):m(i),n.next=42;break;case 40:Pn(i,"Incompatible Source, only hls,mp4,drm content is allowed"),o("Incompatible Source, only hls,mp4,drm content is allowed");case 42:case"end":return n.stop()}}),n)})));return function(e){return r.apply(this,arguments)}}()).catch((function(e){Hi(e,i,o,r)}))})));case 12:case"end":return e.stop()}}),e)})));return function(n,t,i){return e.apply(this,arguments)}}(),Ni=function(e,n,t){var i=a(e);return i.src(n),new Promise((function(e,n){var r=0;i.one("loadedmetadata",(function(){clearTimeout(r),e({status:!0,msg:"video loaded"})})),i.one("loadstart",(function(e){r=setTimeout((function(){n("FAILED: Took too long to load")}),t)}))}))},xi=function(e){gi();var n=a(e),t=(Jn.get()||{}).destroyComscoreTag;if(Ui(),t&&t(),s(),window.onresize=null,n)n.dispose();else{var i=document.getElementById(e);i&&i.remove()}},Ui=function(){document.getElementById("carousel_homepage")&&document.getElementById("carousel_homepage").remove(),document.getElementById("dvr_skin")&&document.getElementById("dvr_skin").remove(),document.getElementById("nondvr_skin")&&document.getElementById("nondvr_skin").remove(),document.getElementById("multicam")&&document.getElementById("multicam").remove(),document.getElementById("errorblock")&&document.getElementById("errorblock").remove(),document.getElementById("def_skin")&&document.getElementById("def_skin").remove(),document.getElementById("video-selection")&&document.getElementById("video-selection").remove(),document.getElementById("multicam-v2")&&document.getElementById("multicam-v2").remove(),document.getElementById("default_v2")&&document.getElementById("default_v2").remove(),document.getElementById("video-captions")&&document.getElementById("video-captions").remove(),document.getElementById("playlist-selection")&&document.getElementById("playlist-selection").remove(),document.getElementById("multiplayer_css")&&document.getElementById("multiplayer_css").remove(),document.getElementById("chromett")&&document.getElementById("chromett").remove()},Bi=function(e,n){console.log("load video in core",n);var t=a(e);t&&t.src(n)},Hi=function(n,t,i,r){var o,a,l,s,d,u,c=null==n||null===(o=n.response)||void 0===o||null===(a=o.data)||void 0===a?void 0:a.errorCode,v=(null==n||null===(l=n.response)||void 0===l||null===(s=l.data)||void 0===s?void 0:s.errorMessage)||(null==n?void 0:n.message);Ri(t)&&Pn(t,(null===(d=window)||void 0===d?void 0:d.customErrors)&&(null===(u=window)||void 0===u?void 0:u.customErrors[c])||"".concat(v)),i&&i(function(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Pi(Object(i),!0).forEach((function(t){e(n,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):Pi(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}({status:!1,response:n,msg:"".concat(v)},r&&{videoId:r}))},Gi=function(e){var n=document.getElementById(e),t=n.getElementsByClassName("vjs-control-bar")[0];t&&(t.style.visibility="hidden");var i=n.getElementsByClassName("vjs-big-play-button")[0];i&&(i.style.display="none");var r=n.getElementsByClassName("vjs-fullscreen-control")[0];r&&(r.style.display="none")};export{de as $,C as A,j as B,R as C,W as D,Se as E,ie as F,Oi as G,le as H,Hi as I,Ie as J,re as K,oe as L,vn as M,Ve as N,Pe as O,Ni as P,Fi as Q,Li as R,Ci as S,ji as T,Ri as U,Mi as V,Vi as W,xi as X,ue as Y,zn as Z,ke as _,mn as a,Ee as a0,fe as a1,ce as a2,A as a3,dt as a4,jn as a5,Ce as a6,Wi as a7,Fe as a8,hi as a9,wt as aa,ut as ab,se as ac,Re as ad,We as ae,Le as b,Jn as c,fn as d,De as e,En as f,rn as g,Ln as h,Xn as i,Ii as j,Ei as k,Bi as l,Pn as m,Di as n,je as o,Gi as p,vi as q,cn as r,Oe as s,tt as t,Fn as u,Ae as v,Dn as w,it as x,L as y,Q as z};
1
+ import e from"@babel/runtime/helpers/defineProperty";import n from"@babel/runtime/helpers/asyncToGenerator";import t from"@babel/runtime/regenerator";import i from"video.js";import r from"axios";import{p as o}from"./manager-d812dea7.js";import{g as a,t as l,c as s}from"./skin-2a3ee818.js";import{i as d,a as u,d as c}from"./browser-de5f6a74.js";import v from"md5";import f from"js-cookie";import{b as m,a as p}from"./captions-8c8e9f2b.js";import h from"@babel/runtime/helpers/typeof";import g from"@babel/runtime/helpers/toConsumableArray";import y from"@babel/runtime/helpers/slicedToArray";import{destroyComscoreTag as w,formulateComscorePayload as T,createComscoreStreamingTag as _,setComscorePlayerInstance as b}from"@viewlift/comscore/index.js";import I from"@babel/runtime/helpers/classCallCheck";import E from"@babel/runtime/helpers/createClass";import{m as S}from"./playerControlEvents-96ef1a5d.js";function k(){var e,n;null===(e=window)||void 0===e||null===(n=e.dataLayer)||void 0===n||n.push(arguments)}function A(e){window.dataLayer=window.dataLayer||[],k("js",new Date),k("config",e)}function O(e,n){k("event",e,n)}var D={name:"@viewlift/player",version:"2.1.71",main:"dist/bundle.cjs.js",types:"dist/@viewlift/player/esm/index.d.ts",amdName:"_playerCore",scripts:{prepublishOnly:"release-assistant","test:chromecast":"mocha -- 'remote/chromecast/tests/**/*.test.js'","test:airplay":"mocha -- 'remote/airplay/tests/**/*.test.js'"},dependencies:{"@viewlift/sse":"^0.0.3","broadcast-channel":"^7.3.0","@viewlift/comscore":"^1.0.19",axios:"^1.18.1",md5:"^2.3.0",ima:"npm:videojs-ima@2.2.0","js-cookie":"^3.0.5","jwt-decode":"^4.0.0","video.js":"8.22.0","videojs-contrib-ads":"7.5.2","videojs-contrib-eme":"5.5.1","videojs-mux":"^4.21.7","videojs-contrib-quality-menu":"^1.0.3","webcomponents.js":"git+https://git@github.com/webcomponents/webcomponentsjs.git#v0.7.24"},devDependencies:{"expect.js":"^0.3.1",mocha:"^10.8.2",sinon:"^2.4.1"},overrides:{"min-document":"^2.19.1"}},P={apiBaseUrl:"https://prod-api.viewlift.com",getVideoDetails:"/entitlement/video/status",getSeriesDetails:"/entitlement/series/status",saveWatchHistoryV1:"/user/userId/history/video",saveWatchHistoryV2:"/v2/user/history",getVideoInfoV1:"/user/info/video",getVideoInfoV2:"/v2/user/info",getSeriesWatchHistoryV1:"/user/userId/history/video",getSeriesWatchHistoryV2:"/v2/user/history/series",getLinearChannelDetails:"/v3/entitlement/linearchannel",getBeaconUrl:"/analytics/player-beacon"},L=function(e){return!!e&&"drm"===function(e){var n;if(5===Number(null==e?void 0:e.code))return"drm";var t="".concat(null!==(n=null==e?void 0:e.code)&&void 0!==n?n:""," ").concat(function(e){var n,t,i,r,o;return(null==e||null===(n=e.response)||void 0===n||null===(t=n.data)||void 0===t?void 0:t.errorMessage)||(null==e||null===(i=e.response)||void 0===i||null===(r=i.data)||void 0===r?void 0:r.message)||(null==e||null===(o=e.response)||void 0===o?void 0:o.statusText)||(null==e?void 0:e.message)||"unknown_error"}(e)).toLowerCase();return/(drm|license|widevine|playready|fairplay|eme|key|hdcp)/.test(t)?"drm":/(network|manifest|segment|playlist|http|xhr|fetch|timeout)/.test(t)?"network":/(decode|mediaerror|mediasource|appendbuffer|sourcebuffer)/.test(t)?"decode":"player"}(e)},C=function(e,n){var t=String(n||"").toLowerCase();if(t.includes("license"))return"license";if(t.includes("certificate"))return"server_certificate";if(t.includes("manifest"))return"manifest";if(t.includes("key"))return"key";if(t.includes("segment")||t.includes("media"))return"segment";var i=String(e||"").split("?")[0].toLowerCase();return i.endsWith(".mpd")||i.endsWith(".m3u8")||i.endsWith(".ism/manifest")?"manifest":/\.(m4s|mp4|m4a|m4v|ts|aac|webm|cmf[av]|mp4a)$/.test(i)?"segment":/license|widevine|playready|fairplay|drm/.test(i)?"license":/cert|certificate/.test(i)?"server_certificate":/\.key($|\?)/.test(i)||/\/key\//.test(i)?"key":"other"},F=new Set(["license","key","server_certificate"]),j=function(e){return F.has(e)},R=function(e,n){for(var t=0,i=[null==e?void 0:e.statusCode,null==e?void 0:e.status,null==e?void 0:e.code,null==n?void 0:n.statusCode,null==n?void 0:n.status,null==n?void 0:n.code];t<i.length;t++){var r=Number(i[t]);if(Number.isFinite(r)&&r>0)return r}return null},W=function(e){return null==e||e>=200&&e<400};function V(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}var M="asset_not_found",N="geo_blocking_issue",x="entitlement_mismatch",U="DRM/License Failures",B=new Set(["contentgeorestricted","contentgeorestrictedbyhba","content_not_available_for_country"]),H=[/geo[\s_-]?block/i,/geo[\s_-]?restrict/i,/geographic/i,/not available in your/i,/outside.*(?:region|country|territory)/i,/\bcountry\b/i,/\bterritory\b/i],G=[/entitlement/i,/not entitled/i,/subscription/i,/not subscribed/i,/access denied/i,/\bunauthorized\b/i,/\bforbidden\b/i,/\bpremium\b/i,/upgrade required/i,/tv[\s_-]?provider/i,/\bprovider\b/i],q=[/not found/i,/no content/i,/does not exist/i,/\bmissing\b/i,/not available currently/i,/not available/i],z=function(e,n,t,i){var r=Number(e),o=String(n||"");return L(i)?U:B.has(function(e){return String(e||"").toLowerCase().replace(/[\s-]/g,"_")}(t))||H.some((function(e){return e.test(o)}))?N:G.some((function(e){return e.test(o)}))?x:q.some((function(e){return e.test(o)}))||404===r?M:451===r?N:x},Q=function(n,t,i){var r,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};console.log("emitApiErrorEvent",{apiName:n,error:t,errorCategory:i,meta:a});var l,s,d,u,c,v=(null==(c=o.getConfig()||{})?void 0:c.apiErrorCb)||(null==c?void 0:c.onApiError)||(null==c||null===(l=c.customData)||void 0===l?void 0:l.apiErrorCb)||(null==c||null===(s=c.customData)||void 0===s?void 0:s.onApiError)||(null==c||null===(d=c.customData)||void 0===d||null===(u=d.callbacks)||void 0===u?void 0:u.onApiError)||null;if("function"==typeof v){console.log("emitApiErrorEvent",t);var f=(null==t||null===(r=t.response)||void 0===r?void 0:r.status)||(null==t?void 0:t.status)||0,m=function(e){var n,t,i,r,o;return(null==e||null===(n=e.response)||void 0===n||null===(t=n.data)||void 0===t?void 0:t.errorMessage)||(null==e||null===(i=e.response)||void 0===i||null===(r=i.data)||void 0===r?void 0:r.message)||(null==e||null===(o=e.response)||void 0===o?void 0:o.statusText)||(null==e?void 0:e.message)||"unknown_error"}(t),p=function(e){var n,t,i,r,o,a;return(null==e||null===(n=e.response)||void 0===n||null===(t=n.data)||void 0===t?void 0:t.errorCode)||(null==e||null===(i=e.response)||void 0===i||null===(r=i.data)||void 0===r?void 0:r.error_code)||(null==e||null===(o=e.response)||void 0===o||null===(a=o.data)||void 0===a?void 0:a.code)||(null==e?void 0:e.errorCode)||null}(t),h=z(f,m,p,t),g=function(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?V(Object(i),!0).forEach((function(t){e(n,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):V(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}({errorcode:f||p,errormessage:m,errorcategory:i||h},a);n&&(g.apiPath=n);try{v(h,g)}catch(e){console.warn("[VLPlayer] apiError callback failed:",e)}}};function Y(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function K(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Y(Object(i),!0).forEach((function(t){e(n,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):Y(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}var J=D;window.vl_player_version=J.version;var X,$=["videoDetails","linearChannel","series","entitlementData"],Z=function(e,n){var t,i,r;return null!==(t=null==e||null===(i=e.endpoints)||void 0===i||null===(r=i[n])||void 0===r?void 0:r.useGlobal)&&void 0!==t?t:$.includes(n)},ee=function(e){var n,t,i,r=null===(n=o.getConfig())||void 0===n?void 0:n.api;return K(K({},Z(r,e)&&(null==r?void 0:r.headers)),null==r||null===(t=r.endpoints)||void 0===t||null===(i=t[e])||void 0===i?void 0:i.headers)},ne=function(e){var n,t,i,r=null===(n=o.getConfig())||void 0===n?void 0:n.api;return K(K({},Z(r,e)&&(null==r?void 0:r.params)),null==r||null===(t=r.endpoints)||void 0===t||null===(i=t[e])||void 0===i?void 0:i.params)},te=function(){var e,n,t,i;return null!==(e=window)&&void 0!==e&&null!==(n=e.customData)&&void 0!==n&&n.overrideEntitlementBaseUrl?(null===(t=window)||void 0===t||null===(i=t.customData)||void 0===i?void 0:i.overrideEntitlementBaseUrl)+"/video/status":de.get()+"".concat(null==P?void 0:P.getVideoDetails)},ie=function(e,n){var t,i,o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(null!==(t=window)&&void 0!==t&&null!==(i=t.customData)&&void 0!==i&&i.overrideEntitlementResponse)return new Promise((function(e,n){var t,i;return e({data:null===(t=window)||void 0===t||null===(i=t.customData)||void 0===i?void 0:i.overrideEntitlementResponse})}));var a,l,s,d,u=te();return r({url:te(),params:K(K({id:e,deviceType:"web_browser",contentConsumption:"web",ssaiDisable:o},null===(a=window)||void 0===a||null===(l=a.customData)||void 0===l?void 0:l.entitlement),ne("videoDetails")),method:"GET",headers:K({Authorization:n,"Sdk-Version":J.version,"x-player-name":"videojs",adbTempToken:null===(s=window)||void 0===s||null===(d=s.customData)||void 0===d?void 0:d.adbTempToken},ee("videoDetails")),withCredentials:!0}).catch((function(n){throw Q(u,n,"content",{videoId:e}),n}))},re=function(e,n){var t,i,o,a,l,s,d=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(null!==(t=window)&&void 0!==t&&null!==(i=t.customData)&&void 0!==i&&i.overrideEntitlementResponse)return new Promise((function(e,n){var t,i;return e({data:null===(t=window)||void 0===t||null===(i=t.customData)||void 0===i?void 0:i.overrideEntitlementResponse})}));var u=de.get()+P.getLinearChannelDetails;return r({url:u,params:K(K(K(K(K(K({id:null==e?void 0:e.id,deviceType:"web_browser",contentConsumption:"web",ssaiDisable:d},(null==e?void 0:e.channelId)&&{channelId:null==e?void 0:e.channelId}),(null==e?void 0:e.programId)&&{programId:null==e?void 0:e.programId}),(null==e?void 0:e.programTitle)&&{programTitle:null==e?void 0:e.programTitle}),(null==e?void 0:e.programSubType)&&{programSubType:null==e?void 0:e.programSubType}),null===(o=window)||void 0===o||null===(a=o.customData)||void 0===a?void 0:a.entitlement),ne("linearChannel")),method:"GET",headers:K({Authorization:n,hdcp:"HDCP-1.4",sl:"SW_SECURE_CRYPTO",adbTempToken:null===(l=window)||void 0===l||null===(s=l.customData)||void 0===s?void 0:s.adbTempToken},ee("linearChannel"))}).catch((function(n){throw Q(u,n,"content",{videoId:null==e?void 0:e.id,channelId:null==e?void 0:e.channelId,programId:null==e?void 0:e.programId}),n}))},oe=function(e,n){var t,i,o=Se(n),a=(null==o?void 0:o.site)||null;if(null!==(t=window)&&void 0!==t&&null!==(i=t.customData)&&void 0!==i&&i.seriesData)return new Promise((function(e,n){var t,i;return e({data:null===(t=window)||void 0===t||null===(i=t.customData)||void 0===i?void 0:i.seriesData})}));var l=de.get()+"/v3/content/series/".concat(e);return r({url:l,params:K({site:a},ne("series")),method:"GET",headers:K({Authorization:n},ee("series"))}).catch((function(n){throw Q(l,n,"content",{videoId:e}),n}))},ae=function(){var e=n(t.mark((function e(n){var i;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ie();case 2:return i=e.sent,e.abrupt("return",r({url:de.get()+"".concat(null==P?void 0:P.saveWatchHistoryV2),method:"POST",headers:K({Authorization:i},ee("saveWatchHistory")),data:K({},n),params:K(K({},(null==n?void 0:n.profileId)&&{profileId:null==n?void 0:n.profileId}),ne("saveWatchHistory"))}).catch((function(e){throw Q("saveWatchHistory",e,"content",{videoId:null==n?void 0:n.videoId,profileId:null==n?void 0:n.profileId}),e})));case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),le=function(e,n){var t,i,o=window.contentType,a=de.get()+"".concat(null==P?void 0:P.getVideoInfoV2,"/").concat(o,"/").concat(e);return r({method:"GET",url:a,headers:K({Authorization:n,"x-api-key":null===(t=window)||void 0===t||null===(i=t.watchHistory)||void 0===i?void 0:i.xApiKey},ee("videoInfo")),params:ne("videoInfo"),timeout:15e3}).catch((function(n){throw Q(a,n,"content",{videoId:e,contentType:o}),n}))},se=function(e){var n=e.videoId,t=de.get()+"".concat(null==P?void 0:P.getSeriesWatchHistoryV2,"/").concat(n);return r({method:"GET",url:t,headers:K({Authorization:e.token},ee("seriesWatchHistory")),params:ne("seriesWatchHistory"),timeout:15e3}).catch((function(i){throw Q(t,i,"content",{seriesId:n,videoId:null==e?void 0:e.videoId}),i}))},de=(X=null==P?void 0:P.apiBaseUrl,{set:function(e){e&&(X=e)},get:function(){return X}}),ue=function(e,n,t,i){var o,a;return r({url:t,params:K({id:e,deviceType:"web_browser",contentConsumption:"web",latitude:null==i?void 0:i.latitude,longitude:null==i?void 0:i.longitude},ne("entitlementData")),method:"GET",headers:K({Authorization:n,adbTempToken:null===(o=window)||void 0===o||null===(a=o.customData)||void 0===a?void 0:a.adbTempToken},ee("entitlementData")),withCredentials:!0}).catch((function(n){throw Q(t,n,"content",{videoId:e,url:t}),n}))},ce=function(e){var n=JSON.parse(atob(null==e?void 0:e.split(".")[1])),t=null==n?void 0:n.exp;if(new Date(1e3*t).getTime()<(new Date).getTime())return!0},ve=null;function fe(){return{set:function(e){e&&(ve=e)},get:function(){return ve}}}var me,pe,he,ge,ye,we,Te,_e=function(){var e=n(t.mark((function e(){var n,i,o;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=fe().get(),i=de.get(),n){e.next=4;break}throw new Error("Missing refresh token");case 4:return e.prev=4,e.next=7,r({method:"GET",url:"".concat(i,"/identity/refresh/").concat(n),headers:ee("refreshToken"),params:ne("refreshToken")});case 7:return o=e.sent,e.abrupt("return",o);case 11:throw e.prev=11,e.t0=e.catch(4),e.t0;case 14:case"end":return e.stop()}}),e,null,[[4,11]])})));return function(){return e.apply(this,arguments)}}(),be=null,Ie=function(){var e=n(t.mark((function e(){var n;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=sessionStorage.getItem("vlp_token"))||!ce(n)){e.next=6;break}return be||(be=_e().then((function(e){var t,i,r=null==e||null===(t=e.data)||void 0===t?void 0:t.authorizationToken,o=null==e||null===(i=e.data)||void 0===i?void 0:i.refreshToken;return r&&sessionStorage.setItem("vlp_token",r),o&&fe().set(o),r||n})).catch((function(e){return n})).finally((function(){be=null}))),e.abrupt("return",be);case 6:return e.abrupt("return",n);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ee=function(e){var n=!0,t=null==e?void 0:e.videoSourceUrl,i=null==e?void 0:e.asat;return t&&!i&&(n=!1),n},Se=function(e){if(e&&"string"==typeof e)return JSON.parse(atob(e.split(".")[1]))},ke=function(e){e&&"undefined"!=typeof window&&window.sessionStorage&&window.sessionStorage.setItem("uid",e)},Ae=(we=new Map,{set:function(e){var n,t=(null==e||null===(n=e.video)||void 0===n?void 0:n.id)||e||null;we.set(t,(we.get(t)||0)+1)},get:function(e){return we.get(e)},clear:function(){we.clear()}}),Oe=function(e){pe=e},De=function(){return pe},Pe=function(e){me=e},Le=function(){return me},Ce=function(){return he},Fe=function(e){he=e},je=function(){return ye},Re=function(e){ge=new Map,e.map((function(e,n){ge.set(e.id,n)}))},We=function(e){if(ge){var n=ge.get(e);Fe(n+1)}},Ve=(Te=0,{set:function(e){e>=0&&(Te=e)},get:function(){return Te}});function Me(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Ne(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Me(Object(i),!0).forEach((function(t){e(n,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):Me(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}var xe=0,Ue=null,Be=null,He=!1,Ge=!1,qe=[],ze=null;function Qe(e,n,t,i){e&&(i?e.one(n,t):e.on(n,t),qe.push({type:"player",player:e,event:n,handler:t}))}function Ye(e,n,t){if(e){var i=qe.findIndex((function(i){return"player"===i.type&&i.player===e&&i.event===n&&i.handler===t}));-1!==i&&qe.splice(i,1),e.off(n,t)}}function Ke(e,n,t){var i;e&&null!=e&&e.ima&&"function"==typeof(null==e||null===(i=e.ima)||void 0===i?void 0:i.addEventListener)&&(e.ima.addEventListener(n,t),qe.push({type:"ima",player:e,eventType:n,handler:t}))}var Je=function(){if(ze){try{var e=ze,n=e.seekToLive,t=e.originalHandleClick;n&&"function"==typeof t&&(n.handleClick=t)}catch(e){console.error(e)}ze=null}},Xe=function(){qe.forEach((function(e){try{"player"===e.type?e.player.off(e.event,e.handler):"ima"===e.type&&function(e,n,t){if(null!=e&&e.ima){var i=e.ima;if("function"!=typeof i.removeEventListener){var r="function"==typeof i.getAdsManager?i.getAdsManager():null;r&&"function"==typeof r.removeEventListener&&r.removeEventListener(n,t)}else i.removeEventListener(n,t)}}(e.player,e.eventType,e.handler)}catch(e){console.error(e)}})),qe.length=0,Je(),xe=0,Ue=null,Be=null,He=!1,Ge=!1,"function"==typeof window.cleanupTimers&&window.cleanupTimers()},$e=function(){var e,n,t,i,r,o,a,l=De();return"linearchannel"==((null==l?void 0:l.contentType)||"video")?null==l||null===(e=l.linearchannel)||void 0===e||null===(n=e.channels)||void 0===n||null===(t=n.find((function(e){return(null==e?void 0:e.id)===(null==l?void 0:l.channelId)})))||void 0===t||null===(i=t.content)||void 0===i?void 0:i.id:(null==l||null===(r=l.video)||void 0===r||null===(o=r.gist)||void 0===o?void 0:o.id)||(null==l||null===(a=l.video)||void 0===a?void 0:a.id)||(null==l?void 0:l.id)},Ze=null,en=null,nn=function(){var e,n,t=$e();return"linearchannel"===(null===(e=De())||void 0===e?void 0:e.contentType)&&t&&t===en&&Ze||(en=t,Ze=(n=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)})()+n()+"-"+n()+"-"+n()+"-"+n()+"-"+n()+n()+n()),Ze},tn=function(){var e=De(),n=(null==e?void 0:e.contentType)||"video",t="";if("undefined"==typeof window)return"";if("linearchannel"===n){var i,r,o,a;t=null===(i=window)||void 0===i||null===(r=i.customData)||void 0===r||null===(o=r.beacon)||void 0===o||null===(a=o.params)||void 0===a?void 0:a.title}else{var l,s,d,u,c,v,f=null==e||null===(l=e.video)||void 0===l||null===(s=l.gist)||void 0===s?void 0:s.title,m=null===(d=window)||void 0===d||null===(u=d.customData)||void 0===u||null===(c=u.beacon)||void 0===c||null===(v=c.params)||void 0===v?void 0:v.title;t=m||f?m===f?m:f:""}return t};function rn(){return Ue||window.sessionStorage.getItem("uid")}function on(){return an.apply(this,arguments)}function an(){return(an=n(t.mark((function e(){var n,i;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ie();case 2:if(!(n=e.sent)){e.next=10;break}if(null==(i=JSON.parse(atob(n.split(".")[1])))||!i.anonymousId){e.next=9;break}return e.abrupt("return","guest-user");case 9:return e.abrupt("return",null==i?void 0:i.userId);case 10:return e.abrupt("return","guest-user");case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}window.initialise=function(e){window.sid=nn(),window.environment="production",window.platform="WEBSITE",window.failedToStartTimer=null,window.droppedStreamTimer=null,window.firstFrameFired=!1,window.isAdPlaying=!1,window._pingTimes=[],window._pingTimeUpdateHandler=null,streamFailures(e),buffering(e),ads(e),ping(e),ln(e),sn(e)};var ln=function(e){Qe(e,"play",(function(){"pause"!==Be||e.scrubbing()||(Be="play",O("RESUME",{pfm:window.platform,uid:rn(),vid:$e(),videoPosition:Math.floor(e.currentTime())}),fireEvent({eventName:"RESUME",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1}))})),Qe(e,"playing",(function(){window.firstFrameFired&&!e.scrubbing()&&(Be="play")})),Qe(e,"pause",(function(){setTimeout((function(){!He&&window.firstFrameFired&&"play"===Be&&(Be="pause",O("PAUSE",{pfm:window.platform,uid:rn(),vid:$e(),videoPosition:Math.floor(e.currentTime())}),fireEvent({eventName:"PAUSE",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1}))}),50)}))},sn=function(e){if(e){var n=0,t=0,i=0,r=0;Qe(e,"timeupdate",o),Qe(e,"seeking",(function(){He||(He=!0,Ye(e,"timeupdate",o),Qe(e,"seeked",a,!0))})),Qe(e,"seeked",a)}function o(){n=t,t=Math.floor(e.currentTime()),n<t&&(r=n,n=t)}function a(){if(Ge)Ge=!1;else{i=Math.floor(e.currentTime());var n=Math.floor(i-r);if(0!==n&&window.firstFrameFired){var t=n>0?"SEEK_FORWARD":"SEEK_BACKWARD";O(t,{pfm:window.platform,uid:rn(),vid:$e(),videoPosition:Math.floor(e.currentTime())}),fireEvent({eventName:t,videoPosition:Math.floor(e.currentTime()),isAdEvent:!1})}r=Math.floor(e.currentTime()),setTimeout((function(){He=!1}),50),Qe(e,"timeupdate",o)}}};window.cleanupTimers=function(){clearInterval(window.bufferingTimer),clearTimeout(window.failedToStartTimer),clearTimeout(window.droppedStreamTimer),window.failedToStartTimer=null,window.droppedStreamTimer=null},window.fireStreamFailure=function(e){var n,t,i,r=a(),o=null!=r&&r.el_?Math.floor(r.currentTime()):0;window.cleanupTimers(),O(e,Ne({pfm:window.platform,uid:rn(),vid:$e(),videoPosition:o},null===(n=window)||void 0===n||null===(t=n.customData)||void 0===t||null===(i=t.beacon)||void 0===i?void 0:i.params)),fireEvent({eventName:e,videoPosition:o,isAdEvent:!1})},window.streamFailures=function(e){Qe(e,"error",(function(){var e=window.firstFrameFired?"DROPPED_STREAM":"FAILED_TO_START";window.fireStreamFailure(e)}))},window.firstFrame=function(e,n,t){Qe(e,"play",tryCatch((function(){var i,r,o;window.ttFirstFrameStartTime_In_MS=performance.now(),Be="play",window.failedToStartTimer=setTimeout((function(){window.firstFrameFired||window.fireStreamFailure("FAILED_TO_START")}),3e4),O("PLAY",Ne({pfm:window.platform,uid:rn(),vid:$e(),videoPosition:Math.floor(e.currentTime())},null===(i=window)||void 0===i||null===(r=i.customData)||void 0===r||null===(o=r.beacon)||void 0===o?void 0:o.params)),fireEvent({eventName:"PLAY",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1}),n&&n("started_video_playback",Ne({"Video ID":$e(),watchTime:Math.floor(e.currentTime())},t))})),!0)},window.buffering=function(e){Qe(e,"waiting",tryCatch((function(){window.firstFrameFired&&(e.currentTime(),clearInterval(window.bufferingTimer),window.bufferingTimer=setInterval((function(){var n,t;null!=e&&null!==(n=e.el_)&&void 0!==n&&null!==(t=n.className)&&void 0!==t&&t.includes("vjs-waiting")&&!e.paused()?window.totalBufferTime=window.handleBufferTimer?window.handleBufferTimer(window.totalBufferTime,e):null:(clearInterval(window.bufferingTimer),clearTimeout(window.droppedStreamTimer),window.droppedStreamTimer=null)}),100),window.firstFrameFired&&(clearTimeout(window.droppedStreamTimer),window.droppedStreamTimer=setTimeout((function(){var n,t;null!=e&&null!==(n=e.el_)&&void 0!==n&&null!==(t=n.className)&&void 0!==t&&t.includes("vjs-waiting")&&!e.paused()&&window.fireStreamFailure("DROPPED_STREAM")}),45e3)))})))},window.handleBufferTimer=function(e,n){var t,i;if(n.el_){var r,o,a,l=e+.1;if(+l.toFixed(2)%5==0&&null!=n&&null!==(t=n.el_)&&void 0!==t&&null!==(i=t.className)&&void 0!==i&&i.includes("vjs-waiting")&&xe<4)xe++,O("BUFFERING",Ne({pfm:window.platform,uid:rn(),vid:$e(),videoPosition:n.el_&&Math.floor(n.currentTime())},null===(r=window)||void 0===r||null===(o=r.customData)||void 0===o||null===(a=o.beacon)||void 0===a?void 0:a.params)),fireEvent({eventName:"BUFFERING",videoPosition:n.el_&&Math.floor(n.currentTime()),isAdEvent:!1});return l}window.ttFirstFrameStartTime_In_MS=null},window.endFirstFrame=function(e){var n=tryCatch((function(){var t,i,r;if(window.ttFirstFrameStartTime_In_MS&&!window.firstFrameFired)if(window.isAdPlaying)console.log("'playing' event ignored during ad playback.");else{clearInterval(window.bufferingTimer),clearTimeout(window.failedToStartTimer),window.failedToStartTimer=null,window.firstFrameFired=!0;var o=(performance.now()-window.ttFirstFrameStartTime_In_MS)/1e3;window.ttFirstFrameStartTime_In_MS=null,window.totalBufferTime=o||0,O("FIRST_FRAME",Ne({eventName:"FIRST_FRAME",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1,ttFirstFrame:parseFloat(null==o?void 0:o.toFixed(2)),bufferHealth:window.getRemainingBufferTime(e),pfm:window.platform,uid:rn(),vid:$e()},null===(t=window)||void 0===t||null===(i=t.customData)||void 0===i||null===(r=i.beacon)||void 0===r?void 0:r.params)),fireEvent({eventName:"FIRST_FRAME",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1,ttFirstFrame:parseFloat(null==o?void 0:o.toFixed(2)),bufferHealth:window.getRemainingBufferTime(e)}),Ye(e,"timeupdate",n)}}));Qe(e,"timeupdate",n)},window.ads=function(e){function n(){var n,t,i,r,o,a;window.isAdPlaying=!0,!window.firstFrameFired&&window.failedToStartTimer&&clearTimeout(window.failedToStartTimer),O("AD_REQUEST",Ne({eventName:"AD_REQUEST",videoPosition:Math.floor(e.currentTime()),isAdEvent:!0,bufferHealth:window.getRemainingBufferTime(e),pfm:window.platform,uid:rn(),vid:$e(),resHeight:e.videoHeight(),resWidth:e.videoWidth()},null===(n=window)||void 0===n||null===(t=n.customData)||void 0===t||null===(i=t.beacon)||void 0===i?void 0:i.params)),fireEvent({eventName:"AD_REQUEST",videoPosition:Math.ceil(e.currentTime()),isAdEvent:!0,resHeight:e.videoHeight(),resWidth:e.videoWidth(),adPosition:1}),O("AD_IMPRESSION",Ne({eventName:"AD_IMPRESSION",videoPosition:Math.floor(e.currentTime()),isAdEvent:!0,bufferHealth:window.getRemainingBufferTime(e),pfm:window.platform,uid:rn(),resHeight:e.videoHeight(),resWidth:e.videoWidth(),vid:$e()},null===(r=window)||void 0===r||null===(o=r.customData)||void 0===o||null===(a=o.beacon)||void 0===a?void 0:a.params)),fireEvent({eventName:"AD_IMPRESSION",videoPosition:Math.ceil(e.currentTime()),resHeight:e.videoHeight(),resWidth:e.videoWidth(),isAdEvent:!0,adPosition:1})}function t(){window.isAdPlaying=!1,window.firstFrameFired||(window.failedToStartTimer=setTimeout((function(){window.firstFrameFired||window.fireStreamFailure("FAILED_TO_START")}),3e4))}function i(){window.isAdPlaying=!1,window.firstFrameFired||(window.failedToStartTimer=setTimeout((function(){window.firstFrameFired||window.fireStreamFailure("FAILED_TO_START")}),3e4))}var r=!1;function o(){var o,a,l,s;r||null!==(o=window)&&void 0!==o&&null!==(a=o.google)&&void 0!==a&&null!==(l=a.ima)&&void 0!==l&&null!==(s=l.AdEvent)&&void 0!==s&&s.Type&&null!=e&&e.ima&&"function"==typeof e.ima.addEventListener&&("function"==typeof e.ima.getAdsManager?e.ima.getAdsManager():null)&&(Ke(e,window.google.ima.AdEvent.Type.STARTED,n),Ke(e,window.google.ima.AdEvent.Type.SKIPPED,t),Ke(e,window.google.ima.AdEvent.Type.COMPLETE,i),r=!0)}Qe(e,"adsready",o),o()};var dn=function(e,n,t){var i;fireEvent({eventName:"PING",videoPosition:n,isAdEvent:!1,duration:t,resHeight:e.videoHeight(),resWidth:e.videoWidth(),bufferHealth:window.getRemainingBufferTime(e),bitrate:(null===(i=e.tech_)||void 0===i?void 0:i.vhs)&&window.getBitrate(e)})};window.fireExitPing=function(e){if(!window.isAdPlaying){var n=null!=e&&e.el_?Math.floor(e.currentTime()):0;n<=0||dn(e,n,n)}},window.ping=function(e){window._pingTimeUpdateHandler&&(Ye(e,"timeupdate",window._pingTimeUpdateHandler),window._pingTimeUpdateHandler=null),window._pingTimes||(window._pingTimes=[]),window._pingTimeUpdateHandler=function(){var n=Math.floor(e.currentTime());n>=30&&n%30==0&&!window._pingTimes.includes(n)&&(xe=0,window._pingTimes.push(n),dn(e,n,30))},Qe(e,"dispose",tryCatch((function(){console.log('Player DISPOSED >> "dispose" event fired >>> firing exit PING'),window.fireExitPing(e)}))),Qe(e,"timeupdate",window._pingTimeUpdateHandler)},window.getBitrate=function(e){return Math.round(e.tech_.vhs.selectPlaylist().attributes.BANDWIDTH/1e3)},window.getRemainingBufferTime=function(e){return tryCatch((function(){for(var n=e.currentTime(),t=e.duration(),i=e.buffered(),r=0;r<i.length;r++){var o=i.start(r),a=i.end(r);if(un(n,o,a)){var l=Math.round(t-a);if(isFinite(l))return l}}}))()};var un=function(e,n,t){return e>=n&&e<=t};window.fireEvent=function(){var e=n(t.mark((function e(n){var i,o,a,l,s,u,c,v,f,m,p,h,g,y,w,T,_,b,I,E,S,k,A,O;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!d()){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,Ie();case 4:return I=e.sent,E=Se(I),S=null==E?void 0:E.site,k=null==E?void 0:E.siteId,A=tn($e()),e.t0=Ne,e.t1=Ne,e.t2=Ne,e.t3=Ne({aid:S,cid:k,pfm:window.platform},null===(i=window)||void 0===i||null===(o=i.customData)||void 0===o||null===(a=o.beacon)||void 0===a?void 0:a.params),e.t4={},e.t5=rn(),e.t6=$e(),e.t7=n.url||document.location.href,e.t8=n.ref||(null===(l=window)||void 0===l||null===(s=l.location)||void 0===s?void 0:s.ref)||document.referrer,e.t9=n.eventName,e.t10=null!==(u=n.videoPosition)&&void 0!==u?u:null,e.t11=window.environment,e.t12=n.dp1||"",e.t13=n.dp2||"",e.t14=n.dp3||"",e.t15=n.dp4||"",e.t16=n.dp5||"",e.t17=!0===n.isAdEvent?n.videoPosition:null,e.t18=!0===n.isAdEvent?(C=n.adPosition)?String(C):"":"",e.next=30,on();case 30:e.t19=e.sent,e.t20=n.playerType||"native",e.t21=n.mediaType||"VIDEO",e.t22=window.sid,e.t23=null!==(c=n.ttFirstFrame)&&void 0!==c?c:null,e.t24=null!==(v=n.bitrate)&&void 0!==v?v:null,e.t25=null!==(f=n.resHeight)&&void 0!==f?f:null,e.t26=null!==(m=n.resWidth)&&void 0!==m?m:null,e.t27=null!==(p=n.bufferHealth)&&void 0!==p?p:null,e.t28=null!==(t=void 0,D=void 0,L=void 0,D=De(),L=(null==D?void 0:D.contentType)||"video",h=(null==D||null===(t=D[L])||void 0===t?void 0:t.network)||null)&&void 0!==h?h:null,e.t29=null!=S?S:null,e.t30={uid:e.t5,vid:e.t6,url:e.t7,ref:e.t8,pa:e.t9,vpos:e.t10,environment:e.t11,dp1:e.t12,dp2:e.t13,dp3:e.t14,dp4:e.t15,dp5:e.t16,apos:e.t17,apod:e.t18,profid:e.t19,player:e.t20,media_type:e.t21,stream_id:e.t22,embedurl:"",ttfirstframe:e.t23,bitrate:e.t24,connectionspeed:null,resolutionheight:e.t25,resolutionwidth:e.t26,bufferhealth:e.t27,networkname:e.t28,brandname:e.t29},e.t31=(null==n?void 0:n.duration)&&{duration:n.duration},e.t32=(0,e.t2)(e.t3,e.t4,e.t30,e.t31),e.t33=null===(g=window)||void 0===g||null===(y=g.customData)||void 0===y||null===(w=y.beacon)||void 0===w?void 0:w.params,e.t34=(0,e.t1)(e.t32,e.t33),e.t35=A&&{title:A},e.t36=(0,e.t0)(e.t34,e.t35),O=[e.t36],r({url:(null===(T=window)||void 0===T||null===(_=T.customData)||void 0===_||null===(b=_.beacon)||void 0===b?void 0:b.url)||de.get()+P.getBeaconUrl,method:"post",headers:Ne({Authorization:I},ee("beacon")),params:ne("beacon"),contentType:"application/x-www-form-urlencoded",dataType:"text",data:O}).catch((function(e){console.error(e)}));case 50:case"end":return e.stop()}var t,D,L,C}),e)})));return function(n){return e.apply(this,arguments)}}(),window.tryCatch=function(e){return function(){try{return e.apply(window,arguments)}catch(e){return console.error(e),null}}};function cn(e,n){if("localhost"!==location.hostname&&"127.0.0.1"!==location.hostname&&!d()){var t=o.getConfig();if(null==t||!t.disableBeacon){null!=n&&n.userId&&(Ue=n.userId);var i=a(e);window.initialise(i,null==n?void 0:n.analyticsCb),window.firstFrame(i,null==n?void 0:n.analyticsCb,null==n?void 0:n.analyticsEventParams),window.endFirstFrame(i),window.watchLive(i)}}}window.watchLive=function(e){var n;if(e){var t=null==e||null===(n=e.controlBar)||void 0===n?void 0:n.getChild("SeekToLive");if(t){Je();var i=t.handleClick;ze={seekToLive:t,originalHandleClick:i},t.handleClick=function(n){var t,r;return null!==(t=e.liveTracker)&&void 0!==t&&null!==(r=t.atLiveEdge)&&void 0!==r&&r.call(t)||(!function(e){var n,t,i;O("WATCH_LIVE",Ne({eventName:"WATCH_LIVE",videoPosition:Math.floor(e.currentTime()),isAdEvent:!1,bufferHealth:window.getRemainingBufferTime(e),pfm:window.platform,uid:rn(),resHeight:e.videoHeight(),resWidth:e.videoWidth(),vid:$e()},null===(n=window)||void 0===n||null===(t=n.customData)||void 0===t||null===(i=t.beacon)||void 0===i?void 0:i.params)),fireEvent({eventName:"WATCH_LIVE",videoPosition:Math.ceil(e.currentTime()),resHeight:e.videoHeight(),resWidth:e.videoWidth(),isAdEvent:!1})}(e),Ge=!0),i.call(this,n)}}}};var vn=function(e,n){var t=new Map;se({videoId:e,token:n}).then((function(e){e.data.map((function(e){t.set(e.videoId,{t:e.watchedTime,p:e.watchedPercentage})})),ye=t})).catch((function(e){return console.log(e)}))},fn=function(){var e=Ve.get();return e>=0?e+1:1},mn=function(){var e,n,t,i=Le(),r=De(),o=null==r||null===(e=r.video)||void 0===e?void 0:e.id,a=Ve.get(),l=null==i||null===(n=i[a])||void 0===n||null===(t=n.episodes)||void 0===t?void 0:t.findIndex((function(e){return(null==e?void 0:e.id)===o}));return l>=0?l+1:1};function pn(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function hn(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?pn(Object(i),!0).forEach((function(t){e(n,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):pn(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}var gn=v,yn=function(e,n){return e&&n?"".concat(e,"x").concat(n):e>1024?"L":e>768?"M":"S"},wn=function(e){var n=Tn(e,"video.tags",[]),t=Tn(e,"video.gist.primaryCategory.title","VIEWLIFT_CONTENT_GENRE");return n.length>0?n.map((function(e){return e.title})).join(","):t},Tn=function(e,n,t){for(var i=0,r=(n=n.split(".")).length;i<r;i++){var o;e=null===(o=e)||void 0===o?void 0:o[n[i]]}return e||t},_n=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=localStorage.getItem("deviceId")||"VIEWLIFT_DEVICE_ID";return e?n:n.includes("browser-")?n.replace("browser-",""):n},bn=function(){var e,n,t,i,r,o,l,s,d,u,c,v,m,p,h,g,y,w,T,_,b,I,E,S,k,A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",O=arguments.length>1?arguments[1]:void 0,D=arguments.length>2?arguments[2]:void 0;if(null!==(e=window)&&void 0!==e&&null!==(n=e.customData)&&void 0!==n&&n.disableMacros)return A;var P=(null==D?void 0:D.siteName)||(null==D?void 0:D.site)||"",L=(null==D?void 0:D.contentType)||"video",C=(null==D||null===(t=D[L])||void 0===t?void 0:t.metadata)||(null==D||null===(i=D[L])||void 0===i||null===(r=i.gist)||void 0===r?void 0:r.metadata),F=a(O);if(!A.includes("VIEWLIFT_"))return A;var j,R=window.getComputedStyle(document.getElementById(O),null),W=Math.trunc(R.getPropertyValue("height").slice(0,-2)),V=Math.trunc(R.getPropertyValue("width").slice(0,-2)),M="linearchannel"===L?null==D||null===(o=D.linearchannel)||void 0===o||null===(l=o.channels)||void 0===l||null===(s=l.find((function(e){return(null==e?void 0:e.id)===(null==D?void 0:D.channelId)})))||void 0===s||null===(d=s.content)||void 0===d?void 0:d.id:Tn(D,"video.gist.id",""),N="linearchannel"===L?null==D||null===(u=D.linearchannel)||void 0===u||null===(c=u.channels)||void 0===c||null===(v=c.find((function(e){return(null==e?void 0:e.id)===(null==D?void 0:D.channelId)})))||void 0===v?void 0:v.title:Tn(D,"video.gist.title","VIEWLIFT_ENCODED_VIDEO_TITLE"),x=null,U=null;"function"==typeof window.__gpp&&(null===(j=window)||void 0===j||j.__gpp("ping",(function(e){x=null==e?void 0:e.gppString,U=null==e?void 0:e.sectionList[0]})));var B=f.get("us_privacy")||f.get("usprivacy"),H=void 0!==B?B:"1YNN",G=null!==(m=null===(p=JSON.parse(localStorage.getItem("selectedMvpdProvider")||"{}"))||void 0===p?void 0:p.fwIdentifier)&&void 0!==m?m:null,q=hn(hn({},In(C)),{},{VIEWLIFT_WIDTH:V,VIEWLIFT_HEIGHT:W,VIEWLIFT_SIZE:yn(V,W),VIEWLIFT_DOMAIN:window.location.hostname,VIEWLIFT_URL:window.location.href,VIEWLIFT_ENCODED_URL:encodeURIComponent(window.location.href),VIEWLIFT_DOUBLE_ENCODED_URL:encodeURIComponent(encodeURIComponent(window.location.href)),VIEWLIFT_CACHEBUSTER:"3708662946268",VIEWLIFT_TIMESTAMP:Date.now().toString().substring(0,10),VIEWLIFT_TIMESTAMP_MS:Date.now().toString(),VIEWLIFT_IP:(null===(h=window)||void 0===h?void 0:h.ip)||"VIEWLIFT_IP",VIEWLIFT_USER_AGENT:encodeURIComponent(encodeURIComponent(navigator.userAgent)),VIEWLIFT_DNT:"1"===navigator.doNotTrack?"1":"0",VIEWLIFT_DESCRIPTION:Tn(D,"video.gist.description","VIEWLIFT_DESCRIPTION"),VIEWLIFT_DURATION:Tn(D,"video.runtime","VIEWLIFT_DURATION"),VIEWLIFT_MIN_DURATION:0,VIEWLIFT_MAX_DURATION:Tn(D,"video.runtime","VIEWLIFT_DURATION"),VIEWLIFT_AUTOPLAY:(null==F||null===(g=F.options_)||void 0===g?void 0:g.autoplay)||1,VIEWLIFT_MUTE:(null==F||null===(y=F.options_)||void 0===y?void 0:y.autoplay)||0,VIEWLIFT_DEVICE_ID:"spinco"==P||"usanetwork"==P||"golfchannel"==P?"":_n(!1),VIEWLIFT_DID:"spinco"==P||"usanetwork"==P||"golfchannel"==P?"":_n(),VIEWLIFT_DEVICETYPE:"WEB_BROWSER",VIEWLIFT_IDTYPE:"dpid",VIEWLIFT_KEYWORDS:wn(D),VIEWLIFT_MEDIA_ID:M,VIEWLIFT_ENCODED_VIDEO_TITLE:encodeURI(Tn(D,"video.gist.title","VIEWLIFT_ENCODED_VIDEO_TITLE")),VIEWLIFT_VIDEO_ID:M,VIEWLIFT_VIDEO_URL:encodeURI(window.location.origin+Tn(D,"video.gist.permalink","")),VIEWLIFT_CONSENT:f.get("cc")||"VIEWLIFT_CONSENT",VIEWLIFT_COPPA:Tn(null===(w=window)||void 0===w||null===(T=w.app_data)||void 0===T||null===(_=T.site)||void 0===_?void 0:_.settings,"compliance.coppa")?1:0,VIEWLIFT_GDPR_CONSENT:"",VIEWLIFT_ROKU_AD_ID:"",VIEWLIFT_ROKU_AD_KEYS:"",VIEWLIFT_RDID:"",VIEWLIFT_GDPR:"spinco"==P||"usanetwork"==P||"golfchannel"==P?"":Tn(null===(b=window)||void 0===b||null===(I=b.app_data)||void 0===I||null===(E=I.site)||void 0===E?void 0:E.settings,"compliance.gdpr")?1:0,VIEWLIFT_US_PRIVACY:H,VIEWLIFT_TVE_PROVIDER:G?gn(G):"",VIEWLIFT_CONTENT_DURATION_MS:1e3*Tn(D,"video.runtime","VIEWLIFT_DURATION"),VIEWLIFT_CONTENT_DURATION:Tn(D,"video.runtime","VIEWLIFT_DURATION"),VIEWLIFT_CONTENT_ID:M,VIEWLIFT_CONTENT_TITLE:N,VIEWLIFT_CONTENT_SERIES_TITLE:Tn(D,"video.series.gist.title","VIEWLIFT_CONTENT_SERIES_TITLE"),VIEWLIFT_CONTENT_GENRE:Tn(D,"video.gist.primaryCategory.title","VIEWLIFT_CONTENT_GENRE"),VIEWLIFT_USER:sessionStorage.getItem("uid")||"VIEWLIFT_USER",VIEWLIFT_EPISODE_NUMBER:mn(),VIEWLIFT_SEASON_NUMBER:fn(),VIEWLIFT_CONTENT_TAGS:wn(D),VIEWLIFT_GPP_SID:U||"VIEWLIFT_GPP_SID",VIEWLIFT_GPP:x||"VIEWLIFT_GPP",VIEWLIFT_APP_ID:"",VIEWLIFT_APP_STORE_URL:"",VIEWLIFT_LAT:"",VIEWLIFT_APP_BUNDLE:"",VIEWLIFT_ATT_CONSENT:""},null===(S=window)||void 0===S||null===(k=S.customData)||void 0===k?void 0:k.macros);for(var z in q){var Q=new RegExp(z,"g");A=A.replace(Q,q[z])}return A},In=function(e){var n,t,i,r,o,a,l,s,d,c={},v=new Map;(null==e?void 0:e.length)>0&&(null==e||e.map((function(e){v.set(e.name,e.value)})));var f=(null===(n=window)||void 0===n||null===(t=n.customData)||void 0===t||null===(i=t.subscription)||void 0===i?void 0:i.SVOD)||!1,m=(null===(r=window)||void 0===r||null===(o=r.customData)||void 0===o||null===(a=o.subscription)||void 0===a?void 0:a.TVE)||!1;return f||m?(u()?f?c=hn(hn({},c),{},{VIEWLIFT_CSID:v.get("csid.mweb.dtc")||"",VIEWLIFT_CSID_CSAI:v.get("csid.mweb.dtc.csai")||""}):m&&(c=hn(hn({},c),{},{VIEWLIFT_CSID:v.get("csid.mweb.tve")||"",VIEWLIFT_CSID_CSAI:v.get("csid.mweb.tve.csai")||""})):f?c=hn(hn({},c),{},{VIEWLIFT_CSID:v.get("csid.web.dtc")||"",VIEWLIFT_CSID_CSAI:v.get("csid.web.dtc.csai")||""}):m&&(c=hn(hn({},c),{},{VIEWLIFT_CSID:v.get("csid.web.tve")||"",VIEWLIFT_CSID_CSAI:v.get("csid.web.tve.csai")||""})),f?c=hn(hn({},c),{},{VIEWLIFT_SFID:v.get("sfid.dtc")||v.get("sfid.web.dtc")||"",VIEWLIFT_SFID_CSAI:v.get(u()?"sfid.mweb.dtc.csai":"sfid.web.dtc.csai")||""}):m&&(c=hn(hn({},c),{},{VIEWLIFT_SFID:v.get("sfid.tve")||v.get("sfid.web.tve")||"",VIEWLIFT_SFID_CSAI:v.get(u()?"sfid.mweb.tve.csai":"sfid.web.tve.csai")||""})),c=u()?hn(hn({},c),{},{VIEWLIFT_PROF:v.get("prof.mweb")||"",VIEWLIFT_PROF_CSAI:v.get("prof.mweb.csai")||""}):hn(hn({},c),{},{VIEWLIFT_PROF:v.get("prof.web")||"",VIEWLIFT_PROF_CSAI:v.get("prof.web.csai")||""})):(c=hn(hn({},c),{},{VIEWLIFT_SFID:v.get("sfid.dtc")||v.get("sfid.web.dtc")||"",VIEWLIFT_SFID_CSAI:v.get(u()?"sfid.mweb.dtc.csai":"sfid.web.dtc.csai")||""}),c=u()?hn(hn({},c),{},{VIEWLIFT_CSID:v.get("csid.mweb.dtc")||"",VIEWLIFT_PROF:v.get("prof.mweb")||"",VIEWLIFT_CSID_CSAI:v.get("csid.mweb.dtc.csai")||"",VIEWLIFT_PROF_CSAI:v.get("prof.mweb.csai")||""}):hn(hn({},c),{},{VIEWLIFT_CSID:v.get("csid.web.dtc")||"",VIEWLIFT_PROF:v.get("prof.web")||"",VIEWLIFT_CSID_CSAI:v.get("csid.web.dtc.csai")||"",VIEWLIFT_PROF_CSAI:v.get("prof.web.csai")||""})),c=hn(hn({},c),{},{VIEWLIFT_AFID:v.get("afid"),VIEWLIFT_NIELSEN_APP_ID:Tn(null===(l=window)||void 0===l||null===(s=l.app_data)||void 0===s||null===(d=s.appcmsMain)||void 0===d?void 0:d.analytics,"nielsen.id")||v.get("VIEWLIFT_NIELSEN_APP_ID")||"",VIEWLIFT_CHANNEL:v.get("VIEWLIFT_CHANNEL")||"",VIEWLIFT_GRACE_NOTE_ID:v.get("VIEWLIFT_GRACE_NOTE_ID")||"",VIEWLIFT_EXTERNAL_AD_ID:v.get("VIEWLIFT_EXTERNAL_AD_ID")||""})},En=function(e,n){var t,i,r,o,a,l,s,d,u,v,f,m,p,h=(null==e?void 0:e.contentType)||"video",g=null==e||null===(t=e[h])||void 0===t?void 0:t.drmEnabled,y=null==e||null===(i=e[h])||void 0===i||null===(r=i.streamingInfo)||void 0===r?void 0:r.videoAssets,w=null==e||null===(o=e[h])||void 0===o||null===(a=o.streamingInfo)||void 0===a?void 0:a.audioAssets,T=(null==e||null===(l=e[h])||void 0===l||null===(s=l.streamingInfo)||void 0===s||null===(d=s.videoAssets)||void 0===d?void 0:d.hls)||!1;null==e||null===(u=e[h])||void 0===u||null===(v=u.liveDetails)||void 0===v||v.isDvrEnabled;var _=(null==e||null===(f=e[h])||void 0===f||null===(m=f.streamingInfo)||void 0===m||null===(p=m.videoAssets)||void 0===p?void 0:p.dash)||!1;if(null!=e&&e.directPlaybackUrl)return{src:null==e?void 0:e.directPlaybackUrl,type:null};if(null!=e&&e.audioAssetSource&&null!=w&&w.hls)return kn(w);if(g){var b=An(y,n);return b.src=bn(b.src,n,e),b}if("Safari"!==c()&&_)return Sn(y);if(T){var I=kn(y);return I.src=bn(I.src,n,e),I}if(null!=y&&y.mpeg){var E=function(e){var n=null==e?void 0:e.mpeg;return{src:n[n.length-1].url,type:"video/mp4"}}(y);return E.src=bn(E.src,n,e),E}return null},Sn=function(e){var n=null==e?void 0:e.dash;return n?{src:n,type:"application/dash+xml"}:null},kn=function(e){var n=null==e?void 0:e.hls;return n?{src:n,type:"application/x-mpegURL"}:null},An=function(e,n){var t=(null==e?void 0:e.drmProvider)||null,r=e.fairPlayCmaf||e.fairPlay,o=e.widevine,l=e.playReady,s=c();if(a(n),"Safari"===s){var d=function(e){var n=e.url;return{src:n,type:"application/x-mpegURL",__vlLicenseUrl:(null==e?void 0:e.licenseUrl)||"",keySystems:{"com.apple.fps.1_0":{getCertificate:function(n,t){var r={uri:e.certificateUrl,method:"GET",responseType:"arraybuffer"};i.xhr(r,(function(e,n,i){console.log(e),e&&t(e),t(null,new Uint8Array(i))}))},getContentId:function(e,n){if(n){var t=n.indexOf("\0")+1;return n.slice(t)}},getLicense:function(n,t,r,o){var a={uri:e.licenseUrl,method:"POST",responseType:"arraybuffer",body:r,headers:{"Content-type":"application/octet-stream","X-AxDRM-Message":e&&e.licenseToken}};i.xhr(a,(function(e,n,t){console.log(e),e&&o(e),o(null,t)}))}}}}}(r);return On(n),d}var u,v={src:o.url,type:"application/dash+xml"};return"caliente"==(null===(u=window)||void 0===u?void 0:u.siteName)?(On(n),v.keySystems={"com.widevine.alpha":{url:o.licenseUrl,licenseHeaders:{"X-AxDRM-Message":o.licenseToken},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"},"com.microsoft.playready":{url:null==l?void 0:l.licenseUrl,licenseHeaders:{"X-AxDRM-Message":null==l?void 0:l.licenseToken},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"}}):"custom"==t?(v.keySystemOptions=[],v.keySystemOptions.push({name:"com.widevine.alpha",options:{serverURL:o.licenseUrl,httpRequestHeaders:{"Content-Type":"application/octet-stream"},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"}}),v.keySystemOptions.push({name:"com.microsoft.playready",options:{serverURL:null==l?void 0:l.licenseUrl,httpRequestHeaders:{"Content-Type":"application/octet-stream"},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"}})):(v.keySystemOptions=[],v.keySystemOptions.push({name:"com.widevine.alpha",options:{serverURL:o.licenseUrl,httpRequestHeaders:{"X-AxDRM-Message":o.licenseToken},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"}}),v.keySystemOptions.push({name:"com.microsoft.playready",options:{serverURL:null==l?void 0:l.licenseUrl,httpRequestHeaders:{"X-AxDRM-Message":null==l?void 0:l.licenseToken},videoRobustness:"SW_SECURE_CRYPTO",audioRobustness:"SW_SECURE_CRYPTO"}})),v};var On=function(e){var n=a(e);if("function"==typeof n.eme)try{n.eme(),"Safari"==c()&&n.eme.initLegacyFairplay()}catch(e){console.log("EME ERROR :",e)}},Dn=function(e,n){var t=e.src,i=e.type;if(!t||"string"!=typeof t||!t.includes(".com"))return{src:t,type:i};n=n.replace(/\/$/,"");var r=t.split(".com")[1]||"";return{src:r?"".concat(n).concat(r):t,type:i}},Pn=function(e,n){if(import("./error-2395864b.js").then((function(e){var n=document.createElement("style");n.id="errorblock",n.append("".concat(e.default)),document.head.appendChild(n)})),document.getElementsByClassName("error-container")[0]){var t=document.getElementsByClassName("error-message")[0];t&&(t.innerHTML="".concat(n))}else{var i=document.getElementById(e);if(i){var r=document.createElement("div");r.className="error-container";var o=document.createElement("div");o.className="error-message",o.innerHTML="".concat(n),r.appendChild(o),i.append(r)}}},Ln=function(){document.getElementsByClassName("error-container")[0]&&document.getElementsByClassName("error-container")[0].remove()};var Cn=!1,Fn=function(e,n,t){var i=bn(n,e,t),r=a(e);if(n&&window.google){if("function"!=typeof r.ima&&"object"!==h(r.ima))return;r.ima.initializeAdDisplayContainer&&r.ima.initializeAdDisplayContainer(),function(e,n){var t,i,r,o=a(e);if(null!==o.el_){Cn=!0;var l={id:e,adTagUrl:"".concat(n),adLabel:"Your video will resume after this sponsor message"};o.ima.initializeAdDisplayContainer&&o.ima.initializeAdDisplayContainer(),Cn&&null!==o.el_&&("function"==typeof o.ima?o.ima(l):setTimeout((function(){o.ima.setContentWithAdTag(null,n,!0),o.ima.requestAds()}),1e3));var s=document.getElementById("".concat(e));(navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i))&&s.hasAttribute("controls")&&s.removeAttribute("controls");var d="click",u=!1;(navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i))&&(u=!0,d="touchend"),o.one(d,(function(){u&&o.ima.initializeAdDisplayContainer()})),function(e){if(!e._adVolumeSynced){e._adVolumeSynced=!0;var n=function(){try{var n=e.ima&&e.ima.getAdsManager&&e.ima.getAdsManager();if(!n||"function"!=typeof n.setVolume)return;n.setVolume(e.muted()?0:e.volume())}catch(e){}};e.on(["volumechange","advolumechange"],n),e.on("ads-manager",n)}}(o);var c=(null===(t=window)||void 0===t||null===(i=t.customData)||void 0===i||null===(r=i.ads)||void 0===r?void 0:r.adEventHandler)||null;o.one("ads-ad-started",(function(){c&&c({status:"STARTED",msg:"Advertisement Started"})})),o.one("ads-manager",(function(e){var n=e.adsManager;n.addEventListener(google.ima.AdEvent.Type.COMPLETE,(function(){c&&c({status:"ENDED",msg:"Advertisement Ended"})})),n.addEventListener(google.ima.AdEvent.Type.LOADED,(function(e){c&&c({status:"LOADED",msg:"Advertisement Loaded",data:e})}))})),o.on("adserror",(function(e){c&&c({status:"ERROR",msg:"Advertisement Error"})}))}}(e,i)}};function jn(e,n){var t,i,r,o=a(e),l=null==o||null===(t=o.controlBar)||void 0===t||null===(i=t.playToggle)||void 0===i?void 0:i.el_,s=document.getElementsByTagName("video")[0];null===(r=document)||void 0===r||r.addEventListener("keydown",(function(t){var i,r,a,d,u,c,v,f,m,p,h;if(Wn.enabled&&(!t.metaKey&&!t.ctrlKey&&"input"!=t.target.localName&&"textarea"!=t.target.localName&&!(null===(i=t.target)||void 0===i||null===(r=i.closest)||void 0===r?void 0:r.call(i,'.vjs-control-bar button, .vjs-control-bar [role="button"]')))){var g=t.key,y=!0===n.liveVideo||!0===n.liveui;switch([" ","m","M","f","F","ArrowLeft","ArrowRight"].includes(g)&&(t.preventDefault(),null==s||s.focus()),g){case" ":null==l||l.click();break;case"m":case"M":o.muted(!o.muted());break;case"f":case"F":null===(a=document.querySelector(".vjs-fullscreen-control"))||void 0===a||a.click();break;case"ArrowLeft":y&&!1===n.liveui||ji(e,10);break;case"ArrowRight":if("MEDIA_TAILOR"==(null===(d=window)||void 0===d||null===(u=d.app_data)||void 0===u||null===(c=u.appcmsMain)||void 0===c||null===(v=c.adsConfig)||void 0===v?void 0:v.vodAdSticherProvider)&&null!==(f=window)&&void 0!==f&&null!==(m=f.app_data)&&void 0!==m&&null!==(p=m.appcmsMain)&&void 0!==p&&null!==(h=p.adsConfig)&&void 0!==h&&h.vodAdClientSideTracking)return;y||Fi(e,10)}}}),!0)}var Rn,Wn=(Rn=!0,{enable:function(){Rn=!0},disable:function(){Rn=!1},get enabled(){return Rn}}),Vn="ssai-breakStart",Mn="ssai-adImpression",Nn="ssai-firstQuartile",xn="ssai-midpoint",Un="ssai-thirdQuartile",Bn="ssai-complete",Hn="ssai-breakEnd",Gn={breakStart:Vn,impression:Mn,firstQuartile:Nn,midpoint:xn,thirdQuartile:Un,complete:Bn,breakEnd:Hn};function qn(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=a(e);if(!t)return console.error("[SSAI] Player instance not found"),{};var i=n.eventType,r=Gn[i];r&&t.trigger(r,n)}function zn(e){var n=a(e);if(!n)return console.error("[SSAI] Player instance not found"),{};var t=function(e,t){var i=function(e,n){return t(n)};return n.on(e,i),function(){return n.off(e,i)}};return{adBreakStart:function(e){return t(Vn,e)},adImpression:function(e){return t(Mn,e)},adFirstQuartile:function(e){return t(Nn,e)},adMidpoint:function(e){return t(xn,e)},adThirdQuartile:function(e){return t(Un,e)},adComplete:function(e){return t(Bn,e)},adBreakEnd:function(e){return t(Hn,e)}}}function Qn(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Yn(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Qn(Object(i),!0).forEach((function(t){e(n,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):Qn(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}var Kn,Jn=(Kn={},{get:function(){return Kn},set:function(e){Kn=e}});function Xn(e,n){var t,i,r,o,l,s,d,u,c,v,f,m,p,h,g,y,I,E,S,k,A,O=null==e?void 0:e.playerId,D=a(O);if(null!=e&&null!==(t=e.comscore)&&void 0!==t&&t.enable){var P=De(),L=(null==P||null===(i=P.video)||void 0===i?void 0:i.metadata)||[],C=(null==L?void 0:L.length)&&L.filter((function(e){return"advertisingGenre"===e.name}));if(null!==(r=C)&&void 0!==r&&r.length){var F=C.map((function(e){return e.value}));C=null==F?void 0:F.join(",")}w();var j,R,W,V=null===(o=window)||void 0===o?void 0:o.lcProgrammeDetails,M=Array.isArray(null==V?void 0:V.category)?null==V||null===(l=V.category)||void 0===l?void 0:l.join(","):(null==V?void 0:V.category)||null,N=Yn(Yn(Yn({},null==P?void 0:P.video),null==P?void 0:P.linearchannel),{},{siteName:(null==e||null===(s=e.comscore)||void 0===s?void 0:s.applicationName)||(null==e||null===(d=e.comscore)||void 0===d||null===(u=d.metadata)||void 0===u?void 0:u.siteName)||(null==P?void 0:P.site)||null,programId:(null==V?void 0:V.videotmsid)||null,programTitle:(null==V?void 0:V.lcProgrammeName)||null,episodeId:(null==V?void 0:V.videotmsid)||null,seasonNumber:(null==P||null===(c=P.video)||void 0===c||null===(v=c.series)||void 0===v?void 0:v.seasonNumber)||(null==V||null===(f=V.seriesDetails)||void 0===f?void 0:f.season)||null,episodeNumber:(null==P||null===(m=P.video)||void 0===m||null===(p=m.series)||void 0===p?void 0:p.episodeNumber)||(null==V||null===(h=V.seriesDetails)||void 0===h?void 0:h.episode)||null,episodeTitle:(null==V?void 0:V.lcSubTitle)||null,isCompleteEpisode:!!(null!=P&&null!==(g=P.video)&&void 0!==g&&g.series||null!=V&&null!==(y=V.seriesDetails)&&void 0!==y&&y.episode),genre:C||M,comscoreConfig:{implementationId:(null==e||null===(I=e.comscore)||void 0===I?void 0:I.implementationId)||null,projectId:(null==e||null===(E=e.comscore)||void 0===E?void 0:E.projectId)||null}}),x=null==e||null===(S=e.comscore)||void 0===S||null===(k=S.metadata)||void 0===k?void 0:k.contentType;if(null!=N&&null!==(A=N.streamingInfo)&&void 0!==A&&A.isLiveStream?N.contentType="Live":N.contentType=x||"LongFormOnDemand",null==N||!N.network){var U,B=(null==N?void 0:N.metadata)||[],H=null==B||null===(U=B.find((function(e){return"network"===e.name})))||void 0===U?void 0:U.value;N.network=H||null}null!=N&&N.network&&null!=N&&N.genre&&(N.customGenre="".concat(N.network,"_").concat((null==N?void 0:N.programTitle)||(j=N,null!=j&&j.series?null==j||null===(W=j.series)||void 0===W?void 0:W.title:null==j||null===(R=j.gist)||void 0===R?void 0:R.title),"_").concat(N.genre)),null!=V&&V.airDate&&(N.publishDate=V.airDate),null!=N&&N.runtime&&"function"==typeof D.duration&&(N.runtime=1e3*Math.ceil(D.duration()));var G=T(N,D);console.log("comscoreOptions player data",G),_(Yn({playerName:"Video.js"},G)),b(D)}}function $n(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function Zn(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?$n(Object(i),!0).forEach((function(t){e(n,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):$n(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}function et(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return nt(e,n);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?nt(e,n):void 0}}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==t.return||t.return()}finally{if(l)throw o}}}}function nt(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,i=Array(n);t<n;t++)i[t]=e[t];return i}var tt=function(){var e="";return{set:function(n){n&&(e=n)},get:function(){return e}}}();function it(e,n){return rt.apply(this,arguments)}function rt(){return(rt=n(t.mark((function e(n,i){var r,o,l,s,d,u,c,v,f,m,p,h,g,w,T,_,b,I;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a(n),l=En(i,n),s=l.src,d=(null==i?void 0:i.contentType)||"video",null==i||null===(r=i[d])||void 0===r||null===(o=r.streamingInfo)||void 0===o||o.isLiveStream,u=s.replace("/dash/","/session/").replace("/master/","/session/"),u=bn(u,n,i),c=ot(u),v=y(c,2),f=v[0],m=v[1],t=m,E=void 0,S=void 0,S=Object.fromEntries(null==Object||null===(E=Object.entries(t))||void 0===E?void 0:E.map((function(e){var n=y(e,2),t=n[0],i=n[1];return[null==t?void 0:t.replace(/^aws\./,""),String(i)]}))),p=S||{}||{},u=new URL(u.split("?")[0]),Object.keys(m).length>0&&Object.entries(m).forEach((function(e){var n=y(e,2),t=n[0],i=n[1];u.searchParams.set(t,i)})),e.prev=11,e.next=14,fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Zn({adsParams:Zn({},f)},p))});case 14:return h=e.sent,e.next=17,h.json();case 17:return g=e.sent,w="https://"+new URL(u).hostname,T=g.trackingUrl,_=g.manifestUrl,b=w+T,I=w+_,tt.set(b),console.log("%c TRACKING URL","background: #bdf369; color: #000",b),l.src=I,e.abrupt("return",l);case 29:return e.prev=29,e.t0=e.catch(11),e.abrupt("return",l);case 32:case"end":return e.stop()}var t,E,S}),e,null,[[11,29]])})))).apply(this,arguments)}function ot(e){var n={};if(!e.split("?")[1])return[{},{}];var t,i=new URL(e,window.location.origin),r=et((null==i?void 0:i.searchParams)||[]);try{for(r.s();!(t=r.n()).done;){var o=y(t.value,2),a=o[0],l=o[1];n[decodeURIComponent(a)]=decodeURIComponent(l||"")}}catch(e){r.e(e)}finally{r.f()}for(var s={},d={},u=0,c=Object.entries(n);u<c.length;u++){var v=y(c[u],2),f=v[0],m=v[1];if(f.startsWith("ads."))s[f.replace(/^ads\./,"")]=m;else d[f]=m}return[s,d]}var at,lt,st,dt=new Map;function ut(e,n){return ct.apply(this,arguments)}function ct(){return ct=n(t.mark((function e(i,r){var o,s,d,u,c,v,f,m,p,h,y,w,T,_,b,I,E,S,k,A,O,D,P,L,C;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:C=function(e,n,t,r,o,l){var s,d,u=a(i);if(!u.seeking()){var c=n.startTimeInSeconds;n.durationInSeconds,e<P&&D.clear(),P=e;var v=(null==n||null===(s=n.ads)||void 0===s||null===(d=s[r])||void 0===d?void 0:d.adId)||c;Math.floor(u.currentTime());var f,m=et(t);try{for(m.s();!(f=m.n()).done;){var p,h,g,y=f.value,w=y.eventType,T=y.beaconUrls,_=y.startTimeInSeconds,b=y.startTime,I=y.durationInSeconds,E=_||0,S=T,k=(null===(p=window)||void 0===p||null===(h=p.customData)||void 0===h||null===(g=h.ads)||void 0===g?void 0:g.adEventHandler)||null,A="".concat(E,"_").concat(w),O=dt.get("pod-".concat(o))||[];if(console.warn(e,E,"map:",w,"condition1:",e>=E,"map:",dt),e>=E&&!O.includes(A)){O.push(A),dt.set("pod-".concat(o),O);try{L(w,n,S,u)}catch(e){console.error("Error when calling triggerAdBeacon:",e,w,n)}if("function"==typeof k)try{var C,F={eventType:w,startTimeInSeconds:_,startTime:b,durationInSeconds:I,ad:null==n||null===(C=n.ads)||void 0===C?void 0:C[r],adIndex:r};k({adsData:F}),qn(i,F)}catch(e){console.error("Error when calling ads callback:",e)}var j=Jn.get();if(j&&0!==Object.keys(j).length){var R=j.formulateComscoreAdPayload,W=j.startComscoreAdTracking,V=j.finishComscoreAdTracking,M=j.endComscoreAdTracking,N="".concat(E,"_").concat(v,"_").concat(w);if(!D.has(N))if(D.set(N,!0),"impression"===w){var x,U=tt.get();W(R(Zn(Zn({},null==n||null===(x=n.ads)||void 0===x?void 0:x[r]),{},{trackingUrl:U})))}else"complete"===w?V():"breakEnd"===w&&M()}}}}catch(e){m.e(e)}finally{m.f()}}},L=function(e,n,t,i){console.warn("%c SSAI BEACON ","background: #e25822; color: #fff",e,"Fired:".concat(Math.round(i.currentTime())),"AD_POD:",n),console.log("%c SSAI BEACON ","background: #e25822; color: #fff",e,"Fired:".concat(Math.round(i.currentTime())),"AD_POD:",n),null==t||t.forEach((function(e){fetch(e,{mode:"no-cors"}).catch((function(n){console.warn("Beacon failed:",e,n)}))}))},O=function(e){var n=Math.floor(e/60),t=Math.floor(e%60);return"".concat(n,":").concat(t.toString().padStart(2,"0"))},dt.clear(),window.isAdPlaying=!1,p=tt.get(),(h=a(i)).one("loadeddata",(function(){p&&A(p)})),y=new Map,w=new Map,T=-1,_=(null===(o=document)||void 0===o||null===(s=o.getElementsByClassName("tvProviderImage"))||void 0===s?void 0:s[0])||null,b=(null==h||null===(d=h.controlBar)||void 0===d?void 0:d.getChild("videoSelector"))||null,I=(null==h||null===(u=h.controlBar)||void 0===u?void 0:u.getChild("seriesV2"))||null,E=(null==h||null===(c=h.el())||void 0===c||null===(v=c.getElementsByClassName("vjs-button vjs-rewind-button"))||void 0===v?void 0:v[0])||null,S=(null==h||null===(f=h.el())||void 0===f||null===(m=f.getElementsByClassName("vjs-button vjs-skip-button"))||void 0===m?void 0:m[0])||null,k=function(){var e,n,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(0==(null==t?void 0:t.length))return g(i);var r=[],o=null==i?void 0:i.find((function(e){return"breakEnd"===(null==e?void 0:e.eventType)})),a=(null==o||null===(e=o.beaconUrls)||void 0===e?void 0:e.find((function(e){return e.includes("videoView")})))||null,l=(null==t?void 0:t.length)>1?null==t?void 0:t[(null==t?void 0:t.length)-1]:null==t?void 0:t[0],s=null==l||null===(n=l.trackingEvents)||void 0===n?void 0:n.filter((function(e){return["breakEnd"].includes(null==e?void 0:e.eventType)})),d=(null==s?void 0:s.some((function(e){var n;return null==e||null===(n=e.beaconUrls)||void 0===n?void 0:n.some((function(e){return e.includes("videoView")}))})))||!1;if(!d&&a){var u=null==s?void 0:s.map((function(e){return Zn(Zn({},e),{},{eventType:"videoView",beaconUrls:[a]})}));null!=u&&u[0]&&r.push(null==u?void 0:u[0])}return r},A=function(){var e=n(t.mark((function e(n){var o,s,d,u,c,v,f,m,p,h,A,D,P,L,F,j,R,W,V,M,N,x,U,B,H,G;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return x=function(e){document.removeEventListener("pointermove",N),document.removeEventListener("pointerup",x),0===e.button&&W(R)},N=function(e){},M=function(e){if(null!=e){var n,t=null,i=et(m);try{for(i.s();!(n=i.n()).done;){var r=n.value,o=r.startTimeInSeconds,a=r.ads;Array.isArray(a)&&(null==a?void 0:a.length)>0&&(o>e||y.has(o)||(null===t||o>t.startTimeInSeconds)&&(t=r))}}catch(e){i.e(e)}finally{i.f()}t?(console.log("Resume: seeking back to recent ad break:",t.startTimeInSeconds,"then resuming to",e),p={position:e,podStart:t.startTimeInSeconds,podEndTime:t.startTimeInSeconds+t.durationInSeconds,entered:!1},setTimeout((function(){h.currentTime(t.startTimeInSeconds+.4)}),100)):(p=null,h.currentTime(e),V(e))}},V=function(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:h.currentTime(),t=null,i=et(m);try{for(i.s();!(e=i.n()).done;){var r=e.value,o=r.startTimeInSeconds,a=r.durationInSeconds,l=(r.ads,Math.floor(o+a));n>=o&&n<=l&&(t=l,y.set(o,!0))}}catch(e){i.e(e)}finally{i.f()}null!==t&&(console.log("Seeking to end of the ad pod:",t),setTimeout((function(){h.currentTime(t+2.2)}),100))},W=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:h.currentTime();if(!(null==e||e<0||n<=e)){var t,i=null,r=et(m);try{for(r.s();!(t=r.n()).done;){var o=t.value,a=o.startTimeInSeconds,l=o.ads;Array.isArray(l)&&(null==l?void 0:l.length)>0&&(y.has(a)||a>e&&a<=n&&(null===i||a>i.startTimeInSeconds)&&(i=o))}}catch(e){r.e(e)}finally{r.f()}null!==i&&(y.set(i.startTimeInSeconds,!0),w.set(i.startTimeInSeconds,!0),p={position:n,podStart:i.startTimeInSeconds,podEndTime:i.startTimeInSeconds+i.durationInSeconds,entered:!1},console.log("Seeking back to ad pod:",i.startTimeInSeconds,"then resuming to",n),setTimeout((function(){h.currentTime(i.startTimeInSeconds+.4)}),100))}},e.next=8,fetch(n);case 8:return c=e.sent,e.next=11,c.json();case 11:v=e.sent,f=v.avails,m=[],p=null,h=a(i),A=h.controlBar.progressControl,D=A.seekBar.el(),null===(o=document)||void 0===o||o.querySelectorAll(".vjs-seekbar-marker").forEach((function(e){return null==e?void 0:e.remove()})),f.map((function(e,n){var t;0==n&&Array.isArray(null==e?void 0:e.ads)&&(null==e||null===(t=e.ads)||void 0===t||t.length),m.push({ads:null==e?void 0:e.ads,durationInSeconds:null==e?void 0:e.durationInSeconds,startTimeInSeconds:null==e?void 0:e.startTimeInSeconds,markerPositionInSeconds:Math.floor(null==e?void 0:e.startTimeInSeconds),podSlotImpressionBeacon:k(null==e?void 0:e.ads,null==e?void 0:e.adBreakTrackingEvents)})})),r&&M(r),null!=m&&m.length&&(console.log("%c SSAI AD PODS ","background: #bdf369; color: #000",m),window.adsQueueList=m,"function"==typeof(j=(null===(P=window)||void 0===P||null===(L=P.customData)||void 0===L||null===(F=L.ads)||void 0===F?void 0:F.onAdBreaksLoaded)||null)&&j(m)),console.log(m,"data"),m.forEach((function(e){var n=e.markerPositionInSeconds,t=e.ads,i=h.duration();if(!(n>i||Array.isArray(t)&&0==(null==t?void 0:t.length))){var r=n/i*100,o=document.createElement("div");o.className="vjs-seekbar-marker",o.style.left="".concat(r,"%"),o.style.position="absolute",o.style.top="0",o.style.bottom="0",o.style.width="2px",o.style.backgroundColor="#fecc09",o.style.left="".concat(r,"%"),o.style.pointerEvents="none",D.appendChild(o)}})),h._timeUpdateHandler&&h.off("timeupdate",h._timeUpdateHandler),h._timeUpdateHandler=l((function(){var e=h.currentTime();if(e!==T){T=e;for(var n=!1,t=function(){var t=m[i],r=t.startTimeInSeconds,o=t.durationInSeconds,a=t.ads,l=r+o;if(e>=r-1.2&&e<=l+1.2){var s;e>=r&&e<=l&&Array.isArray(a)&&(null==a?void 0:a.length)>0&&(n=!0),e>l&&y.set(r,!0),Wn.disable(),_&&_.classList.add("vjs-hidden"),E&&(E.style.pointerEvents="none",E.classList.add("vjs-hidden")),S&&(S.style.pointerEvents="none",S.classList.add("vjs-hidden")),b&&(b.el().style.pointerEvents="none",b.el().classList.add("vjs-hidden")),I&&(I.el().style.pointerEvents="none",I.el().classList.add("vjs-hidden")),A.el().classList.add("hide-progress-bar");for(var d=e-r,u=0,c=0,v=0;v<a.length;v++){var f,p=null==a||null===(f=a[v])||void 0===f?void 0:f.durationInSeconds;if(d<u+p){c=v;break}u+=p}a[c];var h=Math.max(0,o-d),T=Math.round(h);U.style.display="block",G.textContent="".concat(c+1," of ").concat(a.length," • ").concat(O(T));var k=[];return null==a||a.forEach((function(e){var n=e.trackingEvents.filter((function(e){return["breakStart","breakEnd","firstQuartile","secondQuartile","thirdQuartile","fourthQuartile","midpoint","impression","complete"].includes(e.eventType)}));k.push.apply(k,g(n))})),(null==t||null===(s=t.podSlotImpressionBeacon)||void 0===s?void 0:s.length)>0&&k.push.apply(k,g(null==t?void 0:t.podSlotImpressionBeacon)),C(e,t,k,c,i),"break"}w.delete(r)},i=0;i<m.length;i++){if("break"===t())break}if(window.isAdPlaying=n,p&&!h.seeking()&&(e>=p.podStart&&e<=p.podEndTime&&(p.entered=!0),p.entered&&e>=p.podEndTime)){var r=p.position;p=null,setTimeout((function(){h.currentTime(r),V(r)}),300)}n||(U.style.display="none",A.el().classList.remove("hide-progress-bar"),b&&(b.el().style.pointerEvents="auto",b.el().classList.remove("vjs-hidden")),I&&(I.el().style.pointerEvents="auto",I.el().classList.remove("vjs-hidden")),_&&_.classList.remove("vjs-hidden"),E&&(E.style.pointerEvents="auto",E.classList.remove("vjs-hidden")),S&&(S.style.pointerEvents="auto",S.classList.remove("vjs-hidden")),Wn.enable())}}),1e3),h.on("timeupdate",h._timeUpdateHandler),null===(s=document)||void 0===s||s.addEventListener("keydown",(function(e){if(Wn.enabled&&"ArrowRight"==e.key){var n=h.currentTime();Fi(i,10),W(n,n+10),e.stopPropagation()}})),R=-1,A.el().addEventListener("pointerdown",(function(e){0===e.button&&(R=h.currentTime(),document.addEventListener("pointermove",N),document.addEventListener("pointerup",x))})),null===(d=document)||void 0===d||null===(u=d.querySelectorAll(".ssai-ad-container"))||void 0===u||u.forEach((function(e){return null==e?void 0:e.remove()})),(U=document.createElement("div")).className="ssai-ad-container",(B=document.createElement("div")).className="sponsored-adbox",(H=document.createElement("div")).className="sponsored-text",H.textContent="Sponsored Ad",B.append(H),(G=document.createElement("div")).className="ad-counter",document.createElement("div").className="ad-timer",U.append(B),U.append(G),h.el().appendChild(U);case 47:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),D=new Map,P=-1;case 21:case"end":return e.stop()}}),e)}))),ct.apply(this,arguments)}function vt(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return ft(e,n);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ft(e,n):void 0}}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==t.return||t.return()}finally{if(l)throw o}}}}function ft(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,i=Array(n);t<n;t++)i[t]=e[t];return i}function mt(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function pt(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?mt(Object(i),!0).forEach((function(t){e(n,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):mt(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}var ht={},gt=(null===(at=window)||void 0===at||null===(lt=at.location)||void 0===lt||null===(st=lt.search)||void 0===st?void 0:st.includes("debug=true"))||!1,yt=null;function wt(e){return Tt.apply(this,arguments)}function Tt(){return Tt=n(t.mark((function e(i){var r,o,s,d,u,c,v,f,m,p,h,y,w,T,_,b,I,E,S,k,A,O,D,P,L,C,F;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:F=function(e,n,t,r,o){var l,s,d=a(i);if(!d.seeking()){var u=n.startTimeInSeconds;n.durationInSeconds;var c=(null==n||null===(l=n.ads)||void 0===l||null===(s=l[r])||void 0===s?void 0:s.adId)||u;Math.floor(d.currentTime());var v,f=vt(t);try{for(f.s();!(v=f.n()).done;){var m,p,h,g=v.value,y=g.eventType,w=g.beaconUrls,T=g.startTimeInSeconds,_=g.startTime,b=g.durationInSeconds,I=(g.eventId,T||u),E=w,S=(null===(m=window)||void 0===m||null===(p=m.customData)||void 0===p||null===(h=p.ads)||void 0===h?void 0:h.adEventHandler)||null,k="".concat(c,"_").concat(y),A="pod-".concat(u);P.has(A)||P.set(A,new Set);var O=P.get(A);if(gt&&console.warn(e,I,"map:",y,"condition1:",e>=I,"map:",P),e>=I&&e<=I+L&&!O.has(k)){O.add(k);try{C(y,n,E,d)}catch(e){console.error("Error when calling triggerAdBeacon:",e,y,n)}if("function"==typeof S)try{var D,F={eventType:y,startTimeInSeconds:T,startTime:_,durationInSeconds:b,ad:null==n||null===(D=n.ads)||void 0===D?void 0:D[r],adIndex:r};S({adsData:F}),qn(i,F)}catch(e){console.error("Error when calling ads callback:",e)}var j=Jn.get();if(j&&0!==Object.keys(j).length){var R=j.formulateComscoreAdPayload,W=j.startComscoreAdTracking,V=j.finishComscoreAdTracking,M=j.endComscoreAdTracking;if("impression"===y){var N,x=tt.get();W(R(pt(pt({},null==n||null===(N=n.ads)||void 0===N?void 0:N[r]),{},{trackingUrl:x})))}else"complete"===y?V():"breakEnd"===y&&M()}}}}catch(e){f.e(e)}finally{f.f()}}},C=function(e,n,t,i){var r,o,a;"breakEnd"===e&&(null===(r=ht)||void 0===r?void 0:r.currentAdIndex)+1!=(null===(o=ht)||void 0===o?void 0:o.totalAds)&&(null==n||null===(a=n.ads)||void 0===a?void 0:a.length)>0||(gt&&console.warn("%c SSAI BEACON ","background: #e25822; color: #fff",e,"Fired:".concat(Math.round(i.currentTime())),"AD_POD:",n),null==t||t.forEach((function(e){fetch(e,{mode:"no-cors"}).catch((function(n){console.warn("Beacon failed:",e,n)}))})))},h=function(){yt&&clearInterval(yt)},m=tt.get(),(p=a(i)).one("loadeddata",(function(){h(),yt=setInterval((function(){m&&!p.paused()&&D(m)}),2e3)})),p.on("dispose",(function(){h()})),y=new Map,w=new Map,T=-1,_=null,b=(null===(r=document)||void 0===r||null===(o=r.getElementsByClassName("tvProviderImage"))||void 0===o?void 0:o[0])||null,I=(null==p||null===(s=p.controlBar)||void 0===s?void 0:s.getChild("videoSelector"))||null,E=(null==p||null===(d=p.controlBar)||void 0===d?void 0:d.getChild("seriesV2"))||null,S=(null==p||null===(u=p.el())||void 0===u||null===(c=u.getElementsByClassName("vjs-button vjs-rewind-button"))||void 0===c?void 0:c[0])||null,k=(null==p||null===(v=p.el())||void 0===v||null===(f=v.getElementsByClassName("vjs-button vjs-skip-button"))||void 0===f?void 0:f[0])||null,A=!1,O=function(){var e,n,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(0==(null==t?void 0:t.length))return g(i);var r=[],o=null==i?void 0:i.find((function(e){return"breakEnd"===(null==e?void 0:e.eventType)})),a=(null==o||null===(e=o.beaconUrls)||void 0===e?void 0:e.find((function(e){return e.includes("videoView")})))||null,l=(null==t?void 0:t.length)>1?null==t?void 0:t[(null==t?void 0:t.length)-1]:null==t?void 0:t[0],s=null==l||null===(n=l.trackingEvents)||void 0===n?void 0:n.filter((function(e){return["breakEnd"].includes(null==e?void 0:e.eventType)})),d=(null==s?void 0:s.some((function(e){var n;return null==e||null===(n=e.beaconUrls)||void 0===n?void 0:n.some((function(e){return e.includes("videoView")}))})))||!1;if(!d&&a){var u=null==s?void 0:s.map((function(e){return pt(pt({},e),{},{eventType:"videoView",beaconUrls:[a]})}));null!=u&&u[0]&&r.push(null==u?void 0:u[0])}return r},D=function(){var e=n(t.mark((function e(n){var r,o,s,d,u,c,v,f,m,p,h,D;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d=new URL(n),_&&d.searchParams.append("nextToken",_),e.next=4,fetch(d.toString(),{method:"GET"});case 4:return u=e.sent,e.next=7,u.json();case 7:c=e.sent,v=c.avails,f=c.nextToken||null,_=f,m=[],p=a(i),h=null==p||null===(r=p.controlBar)||void 0===r?void 0:r.progressControl,D=null==h||null===(o=h.seekBar)||void 0===o?void 0:o.el(),null===(s=document)||void 0===s||s.querySelectorAll(".vjs-seekbar-marker").forEach((function(e){return null==e?void 0:e.remove()})),v.map((function(e,n){m.push({ads:null==e?void 0:e.ads,durationInSeconds:null==e?void 0:e.durationInSeconds,startTimeInSeconds:null==e?void 0:e.startTimeInSeconds,markerPositionInSeconds:Math.floor(null==e?void 0:e.startTimeInSeconds),podSlotImpressionBeacon:O(null==e?void 0:e.ads,null==e?void 0:e.adBreakTrackingEvents)})})),gt&&console.log("%c SSAI AD PODS ","background: #bdf369; color: #000",m),null!=m&&m.length&&(window.adsQueueList=m),m.forEach((function(e){var n=e.markerPositionInSeconds,t=e.ads,i=p.duration();if(!(n>i||Array.isArray(t)&&0==(null==t?void 0:t.length))){var r=n/i*100,o=document.createElement("div");o.className="vjs-seekbar-marker",o.style.left="".concat(r,"%"),o.style.position="absolute",o.style.top="0",o.style.bottom="0",o.style.width="2px",o.style.backgroundColor="#fecc09",o.style.left="".concat(r,"%"),o.style.pointerEvents="none",D.appendChild(o)}})),p._timeUpdateHandler&&p.off("timeupdate",null==p?void 0:p._timeUpdateHandler),p._timeUpdateHandler=l((function(){if(Ri(i)){var e=null==p?void 0:p.currentTime();if(e!==T){T=e;for(var n=function(){var n=m[t],i=n.startTimeInSeconds,r=n.durationInSeconds,o=n.ads,a=i+r;if(e>=i-1.2&&e<=a+1.2){var l;A=!!(e>=i&&e<=a&&Array.isArray(o)&&(null==o?void 0:o.length)>0),e>a&&y.set(i,!0),Wn.disable(),b&&b.classList.add("vjs-hidden"),S&&(S.style.pointerEvents="none",S.classList.add("vjs-hidden")),k&&(k.style.pointerEvents="none",k.classList.add("vjs-hidden")),I&&(I.el().style.pointerEvents="none",I.el().classList.add("vjs-hidden")),E&&(E.el().style.pointerEvents="none",E.el().classList.add("vjs-hidden")),h.el().classList.add("hide-progress-bar");for(var s=e-i,d=0,u=0,c=0;c<o.length;c++){var v,f=null==o||null===(v=o[c])||void 0===v?void 0:v.durationInSeconds;if(s<d+f){u=c;break}d+=f}setTimeout((function(){ht.totalAds=null==o?void 0:o.length,ht.currentAdIndex=u}),1e3);var p=[];return null==o||o.forEach((function(e){var n=e.trackingEvents.filter((function(e){return["breakStart","breakEnd","firstQuartile","secondQuartile","thirdQuartile","fourthQuartile","midpoint","impression","complete"].includes(e.eventType)}));p.push.apply(p,g(n))})),(null==n||null===(l=n.podSlotImpressionBeacon)||void 0===l?void 0:l.length)>0&&p.push.apply(p,g(null==n?void 0:n.podSlotImpressionBeacon)),F(e,n,p,u),"break"}w.delete(i)},t=0;t<m.length;t++){if("break"===n())break}A||(ht={},h.el().classList.remove("hide-progress-bar"),I&&(I.el().style.pointerEvents="auto",I.el().classList.remove("vjs-hidden")),E&&(E.el().style.pointerEvents="auto",E.el().classList.remove("vjs-hidden")),b&&b.classList.remove("vjs-hidden"),S&&(S.style.pointerEvents="auto",S.classList.remove("vjs-hidden")),k&&(k.style.pointerEvents="auto",k.classList.remove("vjs-hidden")),Wn.enable())}}}),1e3),p.on("timeupdate",p._timeUpdateHandler);case 23:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),P=new Map,L=2.5;case 22:case"end":return e.stop()}}),e)}))),Tt.apply(this,arguments)}var _t=/(?:(\d{1,}):)?(\d{2}):(\d{2})((\.(\d{1,3})))?/g;function bt(e){return JSON.stringify((e||[]).map((function(e){return{availId:e.availId,startTimeInSeconds:e.startTimeInSeconds,durationInSeconds:e.durationInSeconds,ads:(e.ads||[]).map((function(e){return{adId:e.adId,startTimeInSeconds:e.startTimeInSeconds,durationInSeconds:e.durationInSeconds}}))}})))}var It=function(){function e(n,t,i,r){I(this,e),this.video_=r,this.ad_=n,this.skipOffset_=function(e){if(!e)return null;var n=new RegExp(_t.source,"g");n.lastIndex=0;var t=n.exec(e);if(!t)return null;var i=Number(t[1])||0,r=Number(t[2]),o=Number(t[3]),a=Number(t[6])||0;return r>59||o>59?null:a/1e3+o+60*r+3600*i}(null==n?void 0:n.skipOffset),this.adPosition_=t,this.totalAds_=i,this.isSkipped_=!1}return E(e,[{key:"isClientRendering",value:function(){return!1}},{key:"getDuration",value:function(){var e,n;return null!==(e=null===(n=this.ad_)||void 0===n?void 0:n.durationInSeconds)&&void 0!==e?e:0}},{key:"getRemainingTime",value:function(){var e,n,t,i,r,o;return(null!==(e=null===(n=this.ad_)||void 0===n?void 0:n.startTimeInSeconds)&&void 0!==e?e:0)+(null!==(t=null===(i=this.ad_)||void 0===i?void 0:i.durationInSeconds)&&void 0!==t?t:0)-(null!==(r=null===(o=this.video_)||void 0===o?void 0:o.currentTime)&&void 0!==r?r:0)}},{key:"isSkippable",value:function(){return"number"==typeof this.skipOffset_}},{key:"getTimeUntilSkippable",value:function(){if("number"!=typeof this.skipOffset_)return this.getRemainingTime();var e=this.getRemainingTime()+this.skipOffset_-this.getDuration();return Math.max(e,0)}},{key:"canSkipNow",value:function(){return 0===this.getTimeUntilSkippable()}},{key:"skip",value:function(){this.isSkipped_=!0,this.video_&&(this.video_.currentTime+=this.getRemainingTime())}},{key:"isLinear",value:function(){return!0}},{key:"getSequenceLength",value:function(){return this.totalAds_||1}},{key:"getPositionInSequence",value:function(){return this.adPosition_||1}},{key:"getTitle",value:function(){var e;return(null===(e=this.ad_)||void 0===e?void 0:e.adTitle)||""}},{key:"getVastAdId",value:function(){var e;return(null===(e=this.ad_)||void 0===e?void 0:e.vastAdId)||""}},{key:"getAdId",value:function(){var e;return(null===(e=this.ad_)||void 0===e?void 0:e.adId)||""}},{key:"getCreativeAdId",value:function(){var e;return(null===(e=this.ad_)||void 0===e?void 0:e.creativeId)||""}},{key:"getTimeOffset",value:function(){var e,n;return null!==(e=null===(n=this.ad_)||void 0===n?void 0:n.startTimeInSeconds)&&void 0!==e?e:0}},{key:"release",value:function(){this.ad_=null,this.adPosition_=null,this.totalAds_=null}},{key:"isSkipped",value:function(){return this.isSkipped_}}]),e}(),Et="impression",St="start",kt="mute",At="unmute",Ot="resume",Dt="pause",Pt="firstQuartile",Lt="midpoint",Ct="thirdQuartile",Ft="complete",jt="skip",Rt="breakStart",Wt="breakEnd",Vt="skipStateChanged",Mt="ad_impression",Nt="ad_started",xt="ad_muted",Ut="ad_volume_changed",Bt="ad_resumed",Ht="ad_paused",Gt="ad_first_quartile",qt="ad_midpoint",zt="ad_third_quartile",Qt="ad_complete",Yt="ad_stopped",Kt="ad_skipped",Jt="ad_skip_state_changed",Xt="ad_break_started",$t="ad_break_ended",Zt="ads_loaded",ei="ad_cuepoints_changed";function ni(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function ti(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ni(Object(i),!0).forEach((function(t){e(n,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):ni(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}function ii(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return ri(e,n);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ri(e,n):void 0}}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==t.return||t.return()}finally{if(l)throw o}}}}function ri(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,i=Array(n);t<n;t++)i[t]=e[t];return i}var oi="[Transmit]";function ai(e){var n,t,i;if(null==e)return{avails:[],nextToken:null,dashAvailabilityStartTime:null};var r=null!==(n=e.dashAvailabilityStartTime)&&void 0!==n?n:null,o=null!==(t=e.nextToken)&&void 0!==t?t:null,a=[];if(Array.isArray(e.avails))a=e.avails;else if(Array.isArray(e)){var l,s,d,u,c=e[0];if(c&&Array.isArray(c.avails))a=c.avails,r=null!==(l=null!==(s=r)&&void 0!==s?s:c.dashAvailabilityStartTime)&&void 0!==l?l:null,o=null!==(d=null!==(u=o)&&void 0!==u?u:c.nextToken)&&void 0!==d?d:null;else a=e}else if(Array.isArray(null==e||null===(i=e.data)||void 0===i?void 0:i.avails)){var v,f,m,p;a=e.data.avails,o=null!==(v=null!==(f=o)&&void 0!==f?f:e.data.nextToken)&&void 0!==v?v:null,r=null!==(m=null!==(p=r)&&void 0!==p?p:e.data.dashAvailabilityStartTime)&&void 0!==m?m:null}else Array.isArray(null==e?void 0:e.data)&&(a=e.data);return{avails:a,nextToken:o,dashAvailabilityStartTime:r}}var li=function(){function e(n,t,i){var r=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};I(this,e),this.video_=n,this.player_=t,this.onEvent_="function"==typeof i?i:function(){},this.dashManifestUrl_=o.dashManifestUrl||null,this.config_=null,this.trackingUrl_="",this.firstTrackingRequest_=!0,this.nextToken_=null,this.dashAvailabilityStartTime_=0,this.dashAvailabilityStartTimeResolved_=!1,this.pollIntervalMs_=2e3,this.pollId_=null,this.adBreaks_=[],this.ad_=null,this.transmitAd_=null,this.transmitAdBreak_=null,this.eventsSent_=new Set,this.firedBeacons_=new Set,this.adBreakListenersAttached_=!1,this.globalListeners_=[],this.adListeners_=[],this.videoTimeupdate_=null,this.lastMutedForAd_=null,this.onDispose_=function(){return r.release()},this.apiTimelineAbsolute_=!1}var i,r,o;return E(e,[{key:"configure",value:function(e){this.config_=e}},{key:"addTrackingUrl",value:function(e){this.trackingUrl_=e||"",this.onEvent_({type:Zt,loadTime:0})}},{key:"getCuePoints",value:function(){var e,n=new Map,t=ii(this.adBreaks_);try{for(t.s();!(e=t.n()).done;){var i,r=ii(e.value.ads||[]);try{for(r.s();!(i=r.n()).done;){var o=i.value,a=o.startTimeInSeconds,l=a+o.durationInSeconds;if(isFinite(a)&&isFinite(l)&&!(l<=a)){var s="".concat(a.toFixed(1),"|").concat(l.toFixed(1));n.has(s)||n.set(s,{start:a,end:l})}}}catch(e){r.e(e)}finally{r.f()}}}catch(e){t.e(e)}finally{t.f()}return Array.from(n.values()).sort((function(e,n){return e.start-n.start}))}},{key:"onManifestUpdated",value:function(){this.trackingUrl_&&(this.requestTrackingInfo_(this.firstTrackingRequest_),this.firstTrackingRequest_=!1,this.ensurePolling_())}},{key:"stop",value:function(){this.onEnded_(),this.detachAllListeners_(),this.eventsSent_.clear(),this.firedBeacons_.clear(),this.trackingUrl_="",this.firstTrackingRequest_=!0,this.nextToken_=null,this.dashAvailabilityStartTime_=0,this.dashAvailabilityStartTimeResolved_=!1,this.apiTimelineAbsolute_=!1,this.adBreaks_=[],this.adBreakListenersAttached_=!1,this.pollId_&&(clearInterval(this.pollId_),this.pollId_=null)}},{key:"release",value:function(){this.stop()}},{key:"ensurePolling_",value:function(){var e=this;this.pollId_||(this.pollId_=setInterval((function(){var n,t;e.trackingUrl_&&(null!==(n=e.player_)&&void 0!==n&&null!==(t=n.paused)&&void 0!==t&&t.call(n)||e.requestTrackingInfo_(!1))}),this.pollIntervalMs_))}},{key:"requestTrackingInfo_",value:(o=n(t.mark((function e(n){var i,r,o,a,l,s,d,u,c,v,f,m,p,h,g,y,w;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.prev=0,r=new Map,o=0,a=null;case 4:if(!(o<10)){e.next=25;break}return l=new URL(this.trackingUrl_),this.nextToken_&&l.searchParams.set("nextToken",this.nextToken_),e.next=9,fetch(l.toString(),{method:"GET"});case 9:return s=e.sent,e.next=12,s.json();case 12:d=e.sent,o++,(u=ai(d)).dashAvailabilityStartTime&&!a&&(a=u.dashAvailabilityStartTime),c=ii(u.avails);try{for(c.s();!(v=c.n()).done;)f=v.value,m=(null==f?void 0:f.availId)||"".concat(null==f?void 0:f.startTimeInSeconds),r.set(m,f)}catch(e){c.e(e)}finally{c.f()}if((p=u.nextToken||null)&&p!==this.nextToken_){e.next=22;break}return this.nextToken_=p,e.abrupt("break",25);case 22:this.nextToken_=p,e.next=4;break;case 25:if(h=Array.from(r.values()),this.updateApiTimelineAbsoluteFlag_(h),g=(null==h||null===(i=h[0])||void 0===i?void 0:i.startTimeInSeconds)||0,this.apiTimelineAbsolute_){e.next=33;break}return e.next=31,this.resolveDashAvailabilityStartTime_(a,g);case 31:e.next=35;break;case 33:this.dashAvailabilityStartTimeResolved_=!0,this.dashAvailabilityStartTime_=0;case 35:h.length?(y=this.normalizeAvails_(h),bt(this.adBreaks_)!==bt(y)&&(this.adBreaks_=y,w=this.getCuePoints(),this.onEvent_({type:ei,cuepoints:w}))):this.adBreaks_.length&&(this.onEvent_({type:ei,cuepoints:[]}),this.onEnded_(),this.adBreaks_=[]),n&&this.setupAdBreakListeners_(),e.next=42;break;case 39:e.prev=39,e.t0=e.catch(0),console.warn(oi,"tracking info fetch failed",e.t0);case 42:case"end":return e.stop()}}),e,this,[[0,39]])}))),function(e){return o.apply(this,arguments)})},{key:"updateApiTimelineAbsoluteFlag_",value:function(e){this.apiTimelineAbsolute_=!1;var n,t=1e6,i=ii(e||[]);try{for(i.s();!(n=i.n()).done;){var r,o=n.value;if((null!==(r=null==o?void 0:o.startTimeInSeconds)&&void 0!==r?r:0)>t)return void(this.apiTimelineAbsolute_=!0);var a,l=ii((null==o?void 0:o.ads)||[]);try{for(l.s();!(a=l.n()).done;){var s,d=a.value;if((null!==(s=null==d?void 0:d.startTimeInSeconds)&&void 0!==s?s:0)>t)return void(this.apiTimelineAbsolute_=!0)}}catch(e){l.e(e)}finally{l.f()}}}catch(e){i.e(e)}finally{i.f()}}},{key:"normalizeAvails_",value:function(e){var n=this,t=this.apiTimelineAbsolute_?0:this.dashAvailabilityStartTime_||0;return e.map((function(e){var i=n.resolveAbsoluteStart_(e,t,null);return ti(ti({},e),{},{startTimeInSeconds:i,ads:(e.ads||[]).map((function(r){return ti(ti({},r),{},{startTimeInSeconds:n.resolveAbsoluteStart_(r,t,e,i)})}))})}))}},{key:"resolveAbsoluteStart_",value:function(e,n,t,i){var r=null==e?void 0:e.adProgramDateTime;if(r){var o=new Date(r).getTime()/1e3;if(isFinite(o)&&o>0)return o}return null!=t&&t.adProgramDateTime&&"number"==typeof i?i+((e.startTimeInSeconds||0)-(t.startTimeInSeconds||0)):(e.startTimeInSeconds||0)+n}},{key:"resolveDashAvailabilityStartTime_",value:(r=n(t.mark((function e(n,i){var r,o;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.dashAvailabilityStartTimeResolved_){e.next=2;break}return e.abrupt("return");case 2:if(!n){e.next=8;break}if(r=new Date(n).getTime()/1e3,!(isFinite(r)&&r>0)){e.next=8;break}return this.dashAvailabilityStartTime_=r,this.dashAvailabilityStartTimeResolved_=!0,e.abrupt("return");case 8:if(!(i>0)){e.next=13;break}return e.next=11,this.fetchDashAvailabilityStartTimeFromMpd_();case 11:(o=e.sent)>0&&(this.dashAvailabilityStartTime_=o,this.dashAvailabilityStartTimeResolved_=!0);case 13:case"end":return e.stop()}}),e,this)}))),function(e,n){return r.apply(this,arguments)})},{key:"fetchDashAvailabilityStartTimeFromMpd_",value:(i=n(t.mark((function e(){var n,i,r,o,a,l;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,(i=this.dashManifestUrl_||this.getCurrentSourceUrl_())&&i.includes(".mpd")){e.next=4;break}return e.abrupt("return",0);case 4:return e.next=6,fetch(i);case 6:return r=e.sent,e.next=9,r.text();case 9:return o=e.sent,a=(new DOMParser).parseFromString(o,"application/xml"),l=null===(n=a.querySelector("MPD"))||void 0===n?void 0:n.getAttribute("availabilityStartTime"),e.abrupt("return",l?new Date(l).getTime()/1e3:0);case 15:return e.prev=15,e.t0=e.catch(0),console.warn(oi,"MPD availabilityStartTime parse failed",e.t0),e.abrupt("return",0);case 19:case"end":return e.stop()}}),e,this,[[0,15]])}))),function(){return i.apply(this,arguments)})},{key:"getCurrentSourceUrl_",value:function(){try{var e,n,t,i,r=(null===(e=this.player_)||void 0===e||null===(n=e.currentSrc)||void 0===n?void 0:n.call(e))||(null===(t=this.player_)||void 0===t||null===(i=t.src)||void 0===i?void 0:i.call(t));return"string"==typeof r?r:(null==r?void 0:r.src)||""}catch(e){return""}}},{key:"setupAdBreakListeners_",value:function(){var e=this;if(!this.adBreakListenersAttached_){this.adBreakListenersAttached_=!0,this.onTimeupdate_();this.attachGlobalListener_("timeupdate",(function(){return e.onTimeupdate_()})),this.attachGlobalListener_("dispose",this.onDispose_),this.video_&&(this.videoTimeupdate_=function(){return e.onTimeupdate_()},this.video_.addEventListener("timeupdate",this.videoTimeupdate_))}}},{key:"isHlsSource_",value:function(){var e,n,t=this.getCurrentSourceUrl_().toLowerCase(),i=((null===(e=this.player_)||void 0===e||null===(n=e.currentType)||void 0===n?void 0:n.call(e))||"").toLowerCase();return t.includes(".m3u8")||"application/x-mpegurl"===i||"application/vnd.apple.mpegurl"===i}},{key:"isDashSource_",value:function(){var e,n,t=this.getCurrentSourceUrl_().toLowerCase();return"application/dash+xml"===((null===(e=this.player_)||void 0===e||null===(n=e.currentType)||void 0===n?void 0:n.call(e))||"").toLowerCase()||t.includes(".mpd")}},{key:"getDashMediaPlayerTimelineSeconds_",value:function(){try{var e,n,t=null===(e=this.player_)||void 0===e||null===(n=e.dash)||void 0===n?void 0:n.mediaPlayer;if(!t||"function"!=typeof t.time)return null;var i=t.time();return"number"==typeof i&&isFinite(i)&&i>1e6?i:null}catch(e){return null}}},{key:"getCurrentTime_",value:function(){var e,n,t,i=null!==(e=null===(n=this.video_)||void 0===n?void 0:n.currentTime)&&void 0!==e?e:0,r=c();if(this.isHlsSource_()){var o,a,l=i,s=null===(o=this.player_)||void 0===o||null===(a=o.seekable)||void 0===a?void 0:a.call(o);return s&&s.length>0&&(l=s.end(s.length-1)),Date.now()/1e3-(l-i)}if(this.isDashSource_()){var d,u,v,f=this.getDashMediaPlayerTimelineSeconds_();if(null!=f)return f;var m=null===(d=this.player_)||void 0===d||null===(u=d.seekable)||void 0===u?void 0:u.call(d),p="function"==typeof(null===(v=this.player_)||void 0===v?void 0:v.currentTime)?this.player_.currentTime():i;if(m&&m.length>0){var h=m.start(0);if(h>1e6&&h+p>1e6)return h+p}if(this.apiTimelineAbsolute_&&(this.dashAvailabilityStartTime_||0)>1e9)return(this.dashAvailabilityStartTime_||0)+p}return"Safari"===r?i:"function"==typeof(null===(t=this.player_)||void 0===t?void 0:t.currentTime)?this.player_.currentTime():i}},{key:"onTimeupdate_",value:function(){if(this.ad_||this.adBreaks_.length){var e=this.getCurrentTime_();if(this.ad_){var n,t;this.sendInProgressEvents_(e,this.transmitAd_);var i=this.ad_.getDuration(),r=(null!==(n=null===(t=this.transmitAd_)||void 0===t?void 0:t.startTimeInSeconds)&&void 0!==n?n:0)+i,o=r-e;this.ad_.canSkipNow()&&o>0&&i>0&&this.sendTrackingEvent_(Vt),i>0&&e>=r&&this.onEnded_()}this.ad_||this.checkLinearAds_(e)}}},{key:"sendInProgressEvents_",value:function(e,n){if(n){var t=n.startTimeInSeconds+.25*n.durationInSeconds,i=n.startTimeInSeconds+.5*n.durationInSeconds,r=n.startTimeInSeconds+.75*n.durationInSeconds;e>=t&&!this.eventsSent_.has(Pt)&&(this.eventsSent_.add(Pt),this.sendTrackingEvent_(Pt)),e>=i&&!this.eventsSent_.has(Lt)&&(this.eventsSent_.add(Lt),this.sendTrackingEvent_(Lt)),e>=r&&!this.eventsSent_.has(Ct)&&(this.eventsSent_.add(Ct),this.sendTrackingEvent_(Ct))}}},{key:"flushPendingQuartiles_",value:function(){for(var e=0,n=[Pt,Lt,Ct];e<n.length;e++){var t=n[e];this.eventsSent_.has(t)||(this.eventsSent_.add(t),this.sendTrackingEvent_(t))}}},{key:"checkLinearAds_",value:function(e){var n,t=ii(this.adBreaks_);try{for(t.s();!(n=t.n()).done;){var i=n.value;if(this.ad_)break;for(var r=i.ads||[],o=0;o<r.length;o++){var a=r[o],l=a.startTimeInSeconds,s=l+a.durationInSeconds;if(l<=e&&s>e){this.onEnded_(),this.transmitAdBreak_=i,this.transmitAd_=a,this.ad_=new It(a,o+1,r.length,this.video_),0===o&&this.sendTrackingEvent_(Rt),this.setupCurrentAdListeners_();break}}}}catch(e){t.e(e)}finally{t.f()}}},{key:"onEnded_",value:function(){this.ad_&&this.transmitAd_&&(this.ad_.isSkipped()||this.flushPendingQuartiles_(),this.removeCurrentAdListeners_(this.ad_.isSkipped()),this.ad_.getPositionInSequence()===this.ad_.getSequenceLength()&&this.sendTrackingEvent_(Wt),this.ad_=null,this.transmitAd_=null,this.transmitAdBreak_=null)}},{key:"setupCurrentAdListeners_",value:function(){var e,n,t,i,r,o=this,a=!1;null!==(e=this.player_)&&void 0!==e&&null!==(n=e.paused)&&void 0!==n&&n.call(e)?a=!0:(this.sendTrackingEvent_(Et),this.sendTrackingEvent_(St)),this.lastMutedForAd_=null!==(t=null===(i=this.player_)||void 0===i||null===(r=i.muted)||void 0===r?void 0:r.call(i))&&void 0!==t&&t,this.attachAdListener_("volumechange",(function(){var e,n,t,i=null!==(e=null===(n=o.player_)||void 0===n||null===(t=n.muted)||void 0===t?void 0:t.call(n))&&void 0!==e&&e;i!==o.lastMutedForAd_&&(o.lastMutedForAd_=i,i?o.sendTrackingEvent_(kt):o.sendTrackingEvent_(At))})),this.attachAdListener_("play",(function(){a?(o.sendTrackingEvent_(Et),o.sendTrackingEvent_(St),a=!1):o.sendTrackingEvent_(Ot)})),this.attachAdListener_("pause",(function(){o.sendTrackingEvent_(Dt)}))}},{key:"removeCurrentAdListeners_",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.sendTrackingEvent_(e?jt:Ft),this.detachAdListeners_(),this.eventsSent_.clear()}},{key:"attachGlobalListener_",value:function(e,n){this.player_&&(this.player_.on(e,n),this.globalListeners_.push({event:e,handler:n}))}},{key:"attachAdListener_",value:function(e,n){this.player_&&(this.player_.on(e,n),this.adListeners_.push({event:e,handler:n}))}},{key:"detachAdListeners_",value:function(){var e,n=ii(this.adListeners_);try{for(n.s();!(e=n.n()).done;){var t,i,r,o=e.value,a=o.event,l=o.handler;null===(t=this.player_)||void 0===t||null===(i=(r=t).off)||void 0===i||i.call(r,a,l)}}catch(e){n.e(e)}finally{n.f()}this.adListeners_=[]}},{key:"detachAllListeners_",value:function(){this.detachAdListeners_();var e,n=ii(this.globalListeners_);try{for(n.s();!(e=n.n()).done;){var t,i,r,o=e.value,a=o.event,l=o.handler;null===(t=this.player_)||void 0===t||null===(i=(r=t).off)||void 0===i||i.call(r,a,l)}}catch(e){n.e(e)}finally{n.f()}this.globalListeners_=[],this.video_&&this.videoTimeupdate_&&(this.video_.removeEventListener("timeupdate",this.videoTimeupdate_),this.videoTimeupdate_=null)}},{key:"startComscoreForCurrentAd_",value:function(){try{var e=Jn.get();if(!e||0===Object.keys(e).length)return;var n=e.formulateComscoreAdPayload,t=e.startComscoreAdTracking,i=tt.get();t(n(ti(ti({},this.transmitAd_),{},{trackingUrl:i})))}catch(e){console.warn(oi,"comscore start failed",e)}}},{key:"sendTrackingEvent_",value:function(e){var n,t=this;if(this.transmitAd_&&this.transmitAdBreak_){var i=(this.transmitAd_.trackingEvents||[]).find((function(n){return n.eventType===e}));if(i||(i=(this.transmitAdBreak_.adBreakTrackingEvents||[]).find((function(n){return n.eventType===e}))),i&&(null===(n=this.config_)||void 0===n||!n.disableTrackingEvents)){var r,o,a,l=(null===(r=this.transmitAd_)||void 0===r?void 0:r.adId)||(null===(o=this.transmitAdBreak_)||void 0===o?void 0:o.availId)||"unknown",s=ii(i.beaconUrls||[]);try{var d=function(){var n=a.value;if(!n)return"continue";var i="".concat(l,"|").concat(e,"|").concat(n);if(t.firedBeacons_.has(i))return"continue";t.firedBeacons_.add(i),fetch(n,{mode:"no-cors"}).catch((function(e){console.warn(oi,"beacon failed",n,e)}))};for(s.s();!(a=s.n()).done;)d()}catch(e){s.e(e)}finally{s.f()}}var u=Jn.get(),c=u&&Object.keys(u).length?u:null;switch(e){case Et:this.onEvent_({type:Mt}),this.startComscoreForCurrentAd_();break;case St:this.onEvent_({type:Nt,ad:this.ad_});break;case kt:this.onEvent_({type:xt});break;case At:this.onEvent_({type:Ut});break;case Ot:this.onEvent_({type:Bt});break;case Dt:this.onEvent_({type:Ht});break;case Pt:this.onEvent_({type:Gt});break;case Lt:this.onEvent_({type:qt});break;case Ct:this.onEvent_({type:zt});break;case Ft:this.onEvent_({type:Qt}),this.onEvent_({type:Yt}),null!=c&&c.finishComscoreAdTracking&&c.finishComscoreAdTracking();break;case jt:this.onEvent_({type:Kt}),this.onEvent_({type:Yt});break;case Rt:this.onEvent_({type:Xt});break;case Wt:this.onEvent_({type:$t}),null!=c&&c.endComscoreAdTracking&&c.endComscoreAdTracking();break;case Vt:this.onEvent_({type:Jt})}}else console.warn(oi,"sendTrackingEvent_ skipped — no active ad",{eventType:e})}}]),e}();function si(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function di(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?si(Object(i),!0).forEach((function(t){e(n,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):si(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}var ui={dash:"tracking/initialize/dash",hls:"tracking/initialize/hls"};function ci(e){if(null==e||!e.src)return null;var n=(e.type||"").toLowerCase(),t=String(e.src).toLowerCase();return"application/dash+xml"===n||t.includes(".mpd")?"dash":"application/x-mpegurl"===n||"application/vnd.apple.mpegurl"===n||t.includes(".m3u8")?"hls":null}function vi(e,n,t){return fi.apply(this,arguments)}function fi(){return(fi=n(t.mark((function e(n,i,r){var o,a,l,s,d,u,c,v,f,m,p;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=ci(n)){e.next=3;break}return e.abrupt("return",n);case 3:return a=bn(n.src,r,i),l=a.replace(o,ui[o]),console.log("[Transmit] session init →",l),e.prev=6,e.next=9,fetch(l,{method:"GET",redirect:"follow"});case 9:return s=e.sent,e.next=12,s.json();case 12:if(d=e.sent,console.log("[Transmit] session response",d),u="dash"===o?null==d?void 0:d.dashUrl:null==d?void 0:d.hlsUrl,c=null==d?void 0:d.trackingUrl,u&&c){e.next=18;break}return e.abrupt("return",n);case 18:return v=new URL(l),f=v.hostname,m="https://".concat(f).concat(u),p="https://".concat(f).concat(c),tt.set(p),console.log("[Transmit] session ready",{manifestUrl:m,trackingUrl:p}),e.abrupt("return",di(di({},n),{},{src:m}));case 26:return e.prev=26,e.t0=e.catch(6),console.warn("[Transmit] session init failed",e.t0),e.abrupt("return",n);case 30:case"end":return e.stop()}}),e,null,[[6,26]])})))).apply(this,arguments)}var mi,pi=null;function hi(e,n){var t;if(pi)return console.log("[Transmit] initializeTransmit skipped — manager already initialised"),pi;var i=tt.get();if(!i)return console.warn("[Transmit] initializeTransmit skipped — no tracking URL"),null;var r=a(e);if(!r)return console.warn("[Transmit] initializeTransmit skipped — no player"),null;var o=(null===(t=r.el())||void 0===t?void 0:t.querySelector("video"))||null,l=function(e){try{var n="function"==typeof(null==e?void 0:e.currentSrc)&&e.currentSrc()||"function"==typeof(null==e?void 0:e.src)&&e.src()||"";if("application/dash+xml"===("function"==typeof(null==e?void 0:e.currentType)&&e.currentType()||"")||String(n).includes(".mpd"))return n}catch(e){}return null}(r);return(pi=new li(o,r,(function(e){var t,i;console.log("[Transmit] ad event",e);var r=null==n||null===(t=n.customData)||void 0===t||null===(i=t.ads)||void 0===i?void 0:i.adEventHandler;if("function"==typeof r)try{r(e)}catch(e){console.warn("[Transmit] adEventHandler threw",e)}}),{dashManifestUrl:l})).configure({disableTrackingEvents:!1}),pi.addTrackingUrl(i),pi.onManifestUpdated(),pi}function gi(){pi&&(pi.release(),pi=null)}function yi(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function wi(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?yi(Object(i),!0).forEach((function(t){e(n,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):yi(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}var Ti=[],_i=0,bi=null;function Ii(e,n){var t,i,r;if(null!=n&&null!==(t=n.watchHistory)&&void 0!==t&&t.enable&&null!=n&&null!==(i=n.watchHistory)&&void 0!==i&&i.cb&&"function"==typeof(null==n||null===(r=n.watchHistory)||void 0===r?void 0:r.cb)){var o,a,l,s=(null==n||null===(o=n.watchHistory)||void 0===o?void 0:o.interval)||30,d=(null==n||null===(a=n.watchHistory)||void 0===a?void 0:a.completionThreshold)||95,u=null==n||null===(l=n.watchHistory)||void 0===l?void 0:l.cb,c=-1;e.on("seeked",(function(){if(!window.isAdPlaying){var n=Math.floor(e.currentTime()),t=n-n%s;if(c=t,t>0){var i=Math.floor(n/e.duration()*100);u({watchedTime:n,watchedPercentage:i,doneWatching:i>=d})}}})),e.on("timeupdate",(function(){if(!window.isAdPlaying){var n=Math.floor(e.currentTime()),t=n-n%s;if(n%s==0&&t!==c){c=t;var i=Math.floor(n/e.duration()*100);u({watchedTime:n,watchedPercentage:i,doneWatching:i>=d||!1})}}})),e.on("ended",(function(){u({watchedTime:Math.floor(e.duration()),watchedPercentage:100,doneWatching:!0})}))}}function Ei(e,n,t){var i,r,o;null!=n&&n.series&&null!=n&&null!==(i=n.series)&&void 0!==i&&i.enable&&(bi=null==n||null===(r=n.series)||void 0===r?void 0:r.id),Ti=[],_i=0,mi=t;var l=(null==n||null===(o=n.watchHistory)||void 0===o?void 0:o.interval)||30,s=a(e);s&&(s.on("dispose",Si),s.on("timeupdate",(function(){if(!s.seeking()&&!window.isAdPlaying){var e=Math.floor(s.currentTime());Ti.includes(_i)||(e!=_i||e<l?e>_i&&(_i=e+l):(Ti.push(e),ki(s,n,l)))}})),s.on("seeked",(function(){var e=Math.floor(s.currentTime());_i=e+l,Ti=[]})),s.one("ended",(function(){ki(s,n,l,!0)})))}function Si(){mi=null,Ti=[],_i=0,bi=null}function ki(n,t,i){var r,o,a,l,s,d=arguments.length>3&&void 0!==arguments[3]&&arguments[3];null==t||null===(r=t.watchHistory)||void 0===r||r.apiVersion;var u=null==t||null===(o=t.watchHistory)||void 0===o?void 0:o.profileId,c=Math.floor(n.currentTime()),v=Math.floor(n.duration());null==t||null===(a=t.watchHistory)||void 0===a||a.xapiKey;var f=(null==t||null===(l=t.video)||void 0===l?void 0:l.originalObjectId)||null,m=(null==t||null===(s=t.watchHistory)||void 0===s?void 0:s.saveOffline)||!1,p=Math.floor(n.currentTime()),h=d?100:Math.floor(c/v*100),g={};m?function(n,t,i){var r=t?"watchhistory-data-".concat(t):"watchhistory-data-guest-".concat(i),o=Ai(r),a=(new Date).getTime(),l=De(),s=(null==l?void 0:l.video)||{},d=["id","title","gist","categories","tags","status","publishDate","plans","isVerticalVideo","monetizationBadgeIdentifier","runtime"].reduce((function(n,t){return wi(wi({},n),{},e({},t,s[t]))}),{}),u=o.findIndex((function(e){var n;return(null==e||null===(n=e.content)||void 0===n?void 0:n.id)===mi}));u<0?o.push(wi(wi({content:d},n),{},{addedDate:a,updateDate:a})):o[u]=wi(wi(wi({},o[u]),n),{},{updateDate:a});localStorage.setItem("".concat(r),JSON.stringify(o))}(g={completed:d,watchedTime:p,watchedPercentage:h},u,t.siteOwner):(g=wi(wi({videoId:mi,watchedTime:p,watchedPercentage:h,doneWatching:d,profileId:u},bi&&{seriesId:bi}),f&&{originalObjectId:f}),ae(g).then((function(e){})).catch((function(e){}))),_i=c+i}function Ai(e){var n=[];return e&&(n=JSON.parse(localStorage.getItem("".concat(e))||"[]")),n}function Oi(e,n,t){var i=Ai(e?"watchhistory-data-".concat(e):"watchhistory-data-guest-".concat(t)),r=[];return i&&Array.isArray(i)&&(r=i.filter((function(e){var t;return(null==e||null===(t=e.content)||void 0===t?void 0:t.id)===n}))),r}function Di(e,n){setTimeout((function(){e.currentTime(n)}),0),e.one("playing",(function(){e.currentTime()<n-1&&e.currentTime(n)}))}function Pi(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}var Li=function(e){var n=i(e);n.paused()&&S(e,{play:1}),n.play()},Ci=function(e){var n=i(e);n.paused()||S(e,{pause:1}),n.pause()},Fi=function(e,n){var t=i(e),r=t.currentTime()+n;t.currentTime(r)},ji=function(e,n){var t=i(e),r=t.currentTime(),o=r<=n?0:r-n;t.currentTime(o)},Ri=function(e){return!!i.getPlayer("".concat(e))},Wi=function(e){return i(e).paused()},Vi=function(){var e=n(t.mark((function e(i,r){var l,s,d,u,c=arguments;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=c.length>2&&void 0!==c[2]&&c[2],e.next=3,Ie();case 3:return s=e.sent,d=a(i),u=o.getConfig(),e.abrupt("return",new Promise((function(e,o){re(r,s).then(function(){var o=n(t.mark((function n(o){var a,s,c,v,f,m,p,h,g,y,w;return t.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(gi(),(m=null==o?void 0:o.data).contentType="linearchannel",m.channelId=null==r?void 0:r.channelId,p=(null===(a=window.customData)||void 0===a?void 0:a.ads)||(null===(s=window)||void 0===s||null===(c=s.app_data)||void 0===c||null===(v=c.appcmsMain)||void 0===v?void 0:v.adsConfig)||{},h=!(null==m||null===(f=m.linearchannel)||void 0===f||!f.isSSAIEnabled),g=h&&"MEDIA_TAILOR"==(null==p?void 0:p.vodAdSticherProvider),y=h&&"TRANSMIT"==(null==p?void 0:p.liveAdSticherProvider)&&!(null==p||!p.liveAdClientSideTracking),w=En(m,i),!g){n.next=16;break}return n.next=12,it(i,m);case 12:w=n.sent,l=!0,n.next=21;break;case 16:if(!y){n.next=21;break}return n.next=19,vi(w,m,i);case 19:w=n.sent,l=!0;case 21:Oe(m),w&&l?(Xe(),cn(i,{analyticsCb:null==u?void 0:u.analyticsCb,analyticsEventParams:null==u?void 0:u.analyticsEventParams,userId:null==u?void 0:u.userId}),Bi(i,w),y?hi(i,{customData:window.customData||{ads:p}}):g&&wt(i),d.on("loadstart",(function(){e({status:!0,msg:"Feed authenticated and loaded",response:m})}))):(Jn.get()&&0!==Object.keys(Jn.get()).length&&Xn({playerId:i,comscore:{enable:!0}}),e({status:!0,msg:"Feed authenticated",response:m}));case 23:case"end":return n.stop()}}),n)})));return function(e){return o.apply(this,arguments)}}()).catch((function(e){o({status:!1,msg:"Cannot load feed",response:e})}))})));case 7:case"end":return e.stop()}}),e)})));return function(n,t){return e.apply(this,arguments)}}(),Mi=function(){var e=n(t.mark((function e(i,r,l){var s,d,u,c,v,f,h,g;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ie();case 2:return c=e.sent,v=o.getConfig(),console.log("load video"),(Le()||null)&&We(r),f=0,h=0,g=null,null!==(s=window)&&void 0!==s&&s.watchHistory&&null!==(d=window)&&void 0!==d&&null!==(u=d.watchHistory)&&void 0!==u&&u.enable&&le(r,c).then((function(e){var n,t,i,r,o,a,l,s,d;(null===(n=window)||void 0===n||null===(t=n.watchHistory)||void 0===t||!t.cb||null!==(i=window)&&void 0!==i&&null!==(r=i.watchHistory)&&void 0!==r&&r.isExternal||null===(o=window)||void 0===o||null===(a=o.watchHistory)||void 0===a||a.cb(null==e?void 0:e.data),f=(null==e||null===(l=e.data)||void 0===l?void 0:l.watchedTime)||null,(h=(null==e||null===(s=e.data)||void 0===s?void 0:s.watchedPercentage)||null)<95)&&(g=(null==e||null===(d=e.data)||void 0===d?void 0:d.watchedTime)||null)})).catch((function(){})),e.abrupt("return",new Promise((function(e,o){ie(r,c).then(function(){var r=n(t.mark((function n(r){var l,s,d,u,c,y,w,T,_,b,I,E,S,k,A,O,D,P,L,C,F,j,R,W,V,M,N,x,U,B,H,G,q,z,Q,Y,K,J,X,$,Z;return t.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(O=null==r?void 0:r.data,D=(null==O?void 0:O.contentType)||"video",P=(null===(l=window.customData)||void 0===l?void 0:l.ads)||(null===(s=window)||void 0===s||null===(d=s.app_data)||void 0===d||null===(u=d.appcmsMain)||void 0===u?void 0:u.adsConfig)||{},L=!(null==O||null===(c=O[D])||void 0===c||!c.isSSAIEnabled),C=L&&"MEDIA_TAILOR"==(null==P?void 0:P.vodAdSticherProvider),F=L&&"TRANSMIT"==(null==P?void 0:P.liveAdSticherProvider)&&!(null==P||!P.liveAdClientSideTracking),j=!(null==O||null===(y=O[D])||void 0===y||null===(w=y.streamingInfo)||void 0===w||!w.isLiveStream)||"linearchannel"===D,Oe(r.data),(R=(null==O||null===(T=O.ads)||void 0===T||null===(_=T.preRoll)||void 0===_||null===(b=_.adTags)||void 0===b||null===(I=b.web)||void 0===I?void 0:I.active)&&(null==O||null===(E=O.ads)||void 0===E||null===(S=E.preRoll)||void 0===S||null===(k=S.adTags)||void 0===k||null===(A=k.web)||void 0===A?void 0:A.url))&&Fn(i,R,O),W=En(O,i),!C){n.next=17;break}return n.next=14,it(i,O);case 14:W=n.sent,n.next=22;break;case 17:if(!F||!j){n.next=22;break}return gi(),n.next=21,vi(W,O,i);case 21:W=n.sent;case 22:if(!W){n.next=40;break}if(Q=(null==O||null===(V=O.video)||void 0===V||null===(M=V.gist)||void 0===M?void 0:M.videoImageUrl)||(null==O||null===(N=O.video)||void 0===N||null===(x=N.gist)||void 0===x||null===(U=x.imageGist)||void 0===U?void 0:U.r16x9),Y=a(i)){n.next=28;break}return console.error("[VL][player-core] player not found for id=".concat(i),{player:Y}),n.abrupt("return",o({status:!1,msg:"Player not found",response:{}}));case 28:Y.poster(Q),Xe(),cn(i,{analyticsCb:null==v?void 0:v.analyticsCb,analyticsEventParams:null==v?void 0:v.analyticsEventParams,userId:null==v?void 0:v.userId}),Bi(i,W),F&&j?hi(i,{customData:window.customData||{ads:P}}):C&&ut(i,g),Y.on("loadstart",(function(){j&&e({status:!0,msg:"Video Loaded",response:O})})),Y.on("loadeddata",(function(){Ln(),e({status:!0,msg:"Video Loaded",response:O})})),Y.one("play",(function(){!f||C||F&&j||h<95&&Di(Y,f)})),Y.one("error",(function(){var e;o({status:!1,msg:(null==Y||null===(e=Y.error())||void 0===e?void 0:e.message)||"Some error occured"})})),(null==O||null===(B=O.video)||void 0===B||null===(H=B.contentDetails)||void 0===H||null===(G=H.closedCaptions)||void 0===G?void 0:G.length)>0||(null==O||null===(q=O.video)||void 0===q||null===(z=q.closedCaptions)||void 0===z?void 0:z.length)>0?(Z=(null==O||null===(J=O.video)||void 0===J||null===(X=J.contentDetails)||void 0===X?void 0:X.closedCaptions)||(null==O||null===($=O.video)||void 0===$?void 0:$.closedCaptions),K=Z.filter((function(e){return"VTT"===e.format})),p(i,K)):m(i),n.next=42;break;case 40:Pn(i,"Incompatible Source, only hls,mp4,drm content is allowed"),o("Incompatible Source, only hls,mp4,drm content is allowed");case 42:case"end":return n.stop()}}),n)})));return function(e){return r.apply(this,arguments)}}()).catch((function(e){Hi(e,i,o,r)}))})));case 12:case"end":return e.stop()}}),e)})));return function(n,t,i){return e.apply(this,arguments)}}(),Ni=function(e,n,t){var i=a(e);return i.src(n),new Promise((function(e,n){var r=0;i.one("loadedmetadata",(function(){clearTimeout(r),e({status:!0,msg:"video loaded"})})),i.one("loadstart",(function(e){r=setTimeout((function(){n("FAILED: Took too long to load")}),t)}))}))},xi=function(e){gi();var n=a(e),t=(Jn.get()||{}).destroyComscoreTag;if(Ui(),t&&t(),s(),window.onresize=null,n)n.dispose();else{var i=document.getElementById(e);i&&i.remove()}},Ui=function(){document.getElementById("carousel_homepage")&&document.getElementById("carousel_homepage").remove(),document.getElementById("dvr_skin")&&document.getElementById("dvr_skin").remove(),document.getElementById("nondvr_skin")&&document.getElementById("nondvr_skin").remove(),document.getElementById("multicam")&&document.getElementById("multicam").remove(),document.getElementById("errorblock")&&document.getElementById("errorblock").remove(),document.getElementById("def_skin")&&document.getElementById("def_skin").remove(),document.getElementById("video-selection")&&document.getElementById("video-selection").remove(),document.getElementById("multicam-v2")&&document.getElementById("multicam-v2").remove(),document.getElementById("default_v2")&&document.getElementById("default_v2").remove(),document.getElementById("video-captions")&&document.getElementById("video-captions").remove(),document.getElementById("playlist-selection")&&document.getElementById("playlist-selection").remove(),document.getElementById("multiplayer_css")&&document.getElementById("multiplayer_css").remove(),document.getElementById("chromett")&&document.getElementById("chromett").remove()},Bi=function(e,n){console.log("load video in core",n);var t=a(e);t&&t.src(n)},Hi=function(n,t,i,r){var o,a,l,s,d,u,c=null==n||null===(o=n.response)||void 0===o||null===(a=o.data)||void 0===a?void 0:a.errorCode,v=(null==n||null===(l=n.response)||void 0===l||null===(s=l.data)||void 0===s?void 0:s.errorMessage)||(null==n?void 0:n.message);Ri(t)&&Pn(t,(null===(d=window)||void 0===d?void 0:d.customErrors)&&(null===(u=window)||void 0===u?void 0:u.customErrors[c])||"".concat(v)),i&&i(function(n){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Pi(Object(i),!0).forEach((function(t){e(n,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):Pi(Object(i)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))}))}return n}({status:!1,response:n,msg:"".concat(v)},r&&{videoId:r}))},Gi=function(e){var n=document.getElementById(e),t=n.getElementsByClassName("vjs-control-bar")[0];t&&(t.style.visibility="hidden");var i=n.getElementsByClassName("vjs-big-play-button")[0];i&&(i.style.display="none");var r=n.getElementsByClassName("vjs-fullscreen-control")[0];r&&(r.style.display="none")};export{de as $,C as A,j as B,R as C,W as D,Se as E,ie as F,Oi as G,le as H,Hi as I,Ie as J,re as K,oe as L,vn as M,Ve as N,Pe as O,Ni as P,Fi as Q,Li as R,Ci as S,ji as T,Ri as U,Mi as V,Vi as W,xi as X,ue as Y,zn as Z,ke as _,mn as a,Ee as a0,fe as a1,ce as a2,A as a3,dt as a4,jn as a5,Ce as a6,Wi as a7,Fe as a8,hi as a9,wt as aa,ut as ab,se as ac,Re as ad,We as ae,Le as b,Jn as c,fn as d,De as e,En as f,rn as g,Ln as h,Xn as i,Ii as j,Ei as k,Bi as l,Pn as m,Di as n,je as o,Gi as p,vi as q,cn as r,Oe as s,tt as t,Fn as u,Ae as v,Dn as w,it as x,L as y,Q as z};