/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const t=window,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),s=new WeakMap;let n=class{get styleSheet(){let t=this.o;const i=this.t;if(e&&void 0===t){const e=void 0!==i&&1===i.length;e&&(t=s.get(i)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&s.set(i,t))}return t}toString(){return this.cssText}constructor(t,e,s){if(this._$cssResult$=!0,s!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}};const r=(t,...e)=>{const s=1===t.length?t[0]:e.reduce(((e,i,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[s+1]),t[0]);return new n(s,t,i)},o=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new n("string"==typeof t?t:t+"",void 0,i))(e)})(t):t
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/;var l;const a=window,h=a.trustedTypes,d=h?h.emptyScript:"",c=a.reactiveElementPolyfillSupport,p={toAttribute(t,e){switch(e){case Boolean:t=t?d:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},u=(t,e)=>e!==t&&(e==e||t==t),v={attribute:!0,type:String,converter:p,reflect:!1,hasChanged:u};let y=class extends HTMLElement{static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const s=this._$Ep(i,e);void 0!==s&&(this._$Ev.set(s,i),t.push(s))})),t}static createProperty(t,e=v){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,s=this.getPropertyDescriptor(t,i,e);void 0!==s&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(s){const n=this[t];this[e]=s,this.requestUpdate(t,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||v}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(o(t))}else void 0!==t&&e.push(o(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var i;const s=null!==(i=this.shadowRoot)&&void 0!==i?i:this.attachShadow(this.constructor.shadowRootOptions);return((i,s)=>{e?i.adoptedStyleSheets=s.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):s.forEach((e=>{const s=document.createElement("style"),n=t.litNonce;void 0!==n&&s.setAttribute("nonce",n),s.textContent=e.cssText,i.appendChild(s)}))})(s,this.constructor.elementStyles),s}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=v){var s;const n=this.constructor._$Ep(t,i);if(void 0!==n&&!0===i.reflect){const r=(void 0!==(null===(s=i.converter)||void 0===s?void 0:s.toAttribute)?i.converter:p).toAttribute(e,i.type);this._$El=t,null==r?this.removeAttribute(n):this.setAttribute(n,r),this._$El=null}}_$AK(t,e){var i;const s=this.constructor,n=s._$Ev.get(t);if(void 0!==n&&this._$El!==n){const t=s.getPropertyOptions(n),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:p;this._$El=n,this[n]=r.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let s=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||u)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}};
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var $;y.finalized=!0,y.elementProperties=new Map,y.elementStyles=[],y.shadowRootOptions={mode:"open"},null==c||c({ReactiveElement:y}),(null!==(l=a.reactiveElementVersions)&&void 0!==l?l:a.reactiveElementVersions=[]).push("1.6.1");const _=window,m=_.trustedTypes,g=m?m.createPolicy("lit-html",{createHTML:t=>t}):void 0,f=`lit$${(Math.random()+"").slice(9)}$`,A="?"+f,b=`<${A}>`,E=document,S=(t="")=>E.createComment(t),C=t=>null===t||"object"!=typeof t&&"function"!=typeof t,w=Array.isArray,x=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,P=/-->/g,R=/>/g,U=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),O=/'/g,T=/"/g,k=/^(?:script|style|textarea|title)$/i,N=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),H=Symbol.for("lit-noChange"),I=Symbol.for("lit-nothing"),M=new WeakMap,z=E.createTreeWalker(E,129,null,!1),L=(t,e)=>{const i=t.length-1,s=[];let n,r=2===e?"":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==g?g.createHTML(l):l,s]};class j{static createElement(t,e){const i=E.createElement("template");return i.innerHTML=t,i}constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let n=0,r=0;const o=t.length-1,l=this.parts,[a,h]=L(t,e);if(this.el=j.createElement(a,i),z.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(s=z.nextNode())&&l.length0){s.textContent=m?m.emptyScript:"";for(let i=0;iw(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this.g(t)}O(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}g(t){this._$AH!==I&&C(this._$AH)?this._$AA.nextSibling.data=t:this.T(E.createTextNode(t)),this._$AH=t}$(t){var e;const{values:i,_$litType$:s}=t,n="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=j.createElement(s.h,this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===n)this._$AH.p(i);else{const t=new D(n,this),e=t.v(this.options);t.p(i),this.T(e),this._$AH=t}}_$AC(t){let e=M.get(t.strings);return void 0===e&&M.set(t.strings,e=new j(t)),e}k(t){w(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const n of t)s===e.length?e.push(i=new Y(this.O(S()),this.O(S()),this,this.options)):i=e[s],i._$AI(n),s++;s2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=I}}class V extends W{j(t){this.element[this.name]=t===I?void 0:t}constructor(){super(...arguments),this.type=3}}const q=m?m.emptyScript:"";class Z extends W{j(t){t&&t!==I?this.element.setAttribute(this.name,q):this.element.removeAttribute(this.name)}constructor(){super(...arguments),this.type=4}}class J extends W{_$AI(t,e=this){var i;if((t=null!==(i=B(this,t,e,0))&&void 0!==i?i:I)===H)return;const s=this._$AH,n=t===I&&s!==I||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==I&&(s===I||n);n&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}constructor(t,e,i,s,n){super(t,e,i,s,n),this.type=5}}class K{get _$AU(){return this._$AM._$AU}_$AI(t){B(this,t)}constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}}const Q=_.litHtmlPolyfillSupport;null==Q||Q(j,Y),(null!==($=_.litHtmlVersions)&&void 0!==$?$:_.litHtmlVersions=[]).push("2.6.1");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var G,F;let X=class extends y{createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{var s,n;const r=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:e;let o=r._$litPart$;if(void 0===o){const t=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:null;r._$litPart$=o=new Y(e.insertBefore(S(),t),t,void 0,null!=i?i:{})}return o._$AI(t),o})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return H}constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}};X.finalized=!0,X._$litElement$=!0,null===(G=globalThis.litElementHydrateSupport)||void 0===G||G.call(globalThis,{LitElement:X});const tt=globalThis.litElementPolyfillSupport;null==tt||tt({LitElement:X}),(null!==(F=globalThis.litElementVersions)&&void 0!==F?F:globalThis.litElementVersions=[]).push("3.2.2");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const et=1,it=2,st=t=>(...e)=>({_$litDirective$:t,values:e});let nt=class{get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}constructor(t){}};
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const rt=st(class extends nt{render(t){return Object.keys(t).reduce(((e,i)=>{const s=t[i];return null==s?e:e+`${i=i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`}),"")}update(t,[e]){const{style:i}=t.element;if(void 0===this.vt){this.vt=new Set;for(const t in e)this.vt.add(t);return this.render(e)}this.vt.forEach((t=>{null==e[t]&&(this.vt.delete(t),t.includes("-")?i.removeProperty(t):i[t]="")}));for(const t in e){const s=e[t];null!=s&&(this.vt.add(t),t.includes("-")?i.setProperty(t,s):i[t]=s)}return H}constructor(t){var e;if(super(t),t.type!==et||"style"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}}),ot=t=>null!=t?t:I
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/,lt=(t,e)=>{var i,s;const n=t._$AN;if(void 0===n)return!1;for(const t of n)null===(s=(i=t)._$AO)||void 0===s||s.call(i,e,!1),lt(t,e);return!0},at=t=>{let e,i;do{if(void 0===(e=t._$AM))break;i=e._$AN,i.delete(t),t=e}while(0===(null==i?void 0:i.size))},ht=t=>{for(let e;e=t._$AM;t=e){let i=e._$AN;if(void 0===i)e._$AN=i=new Set;else if(i.has(t))break;i.add(t),pt(e)}};
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/function dt(t){void 0!==this._$AN?(at(this),this._$AM=t,ht(this)):this._$AM=t}function ct(t,e=!1,i=0){const s=this._$AH,n=this._$AN;if(void 0!==n&&0!==n.size)if(e)if(Array.isArray(s))for(let t=i;t{var e,i,s,n;t.type==it&&(null!==(e=(s=t)._$AP)&&void 0!==e||(s._$AP=ct),null!==(i=(n=t)._$AQ)&&void 0!==i||(n._$AQ=dt))};class ut extends nt{_$AT(t,e,i){super._$AT(t,e,i),ht(this),this.isConnected=t._$AU}_$AO(t,e=!0){var i,s;t!==this.isConnected&&(this.isConnected=t,t?null===(i=this.reconnected)||void 0===i||i.call(this):null===(s=this.disconnected)||void 0===s||s.call(this)),e&&(lt(this,t),at(this))}setValue(t){if((t=>void 0===t.strings)
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}constructor(){super(...arguments),this._$AN=void 0}}
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const vt=()=>new yt;class yt{}const $t=new WeakMap,_t=st(class extends ut{render(t){return I}update(t,[e]){var i;const s=e!==this.Y;return s&&void 0!==this.Y&&this.rt(void 0),(s||this.lt!==this.ct)&&(this.Y=e,this.dt=null===(i=t.options)||void 0===i?void 0:i.host,this.rt(this.ct=t.element)),I}rt(t){var e;if("function"==typeof this.Y){const i=null!==(e=this.dt)&&void 0!==e?e:globalThis;let s=$t.get(i);void 0===s&&(s=new WeakMap,$t.set(i,s)),void 0!==s.get(this.Y)&&this.Y.call(this.dt,void 0),s.set(this.Y,t),void 0!==t&&this.Y.call(this.dt,t)}else this.Y.value=t}get lt(){var t,e,i;return"function"==typeof this.Y?null===(e=$t.get(null!==(t=this.dt)&&void 0!==t?t:globalThis))||void 0===e?void 0:e.get(this.Y):null===(i=this.Y)||void 0===i?void 0:i.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});let mt=null;const gt=function(){const{search:t}=window.document.location;return-1!==t.indexOf("glomexPlayerIntegrationEnvironment=local")?"https://localhost:8060/":-1!==t.indexOf("glomexPlayerIntegrationEnvironment=stage")?"https://player-integration.stage.mes.glomex.cloud/":"https://player-integration.mes.glomex.cloud/"}(),ft=(mt||(mt=function(){try{throw new Error}catch(t){const e=`${t.stack}`.match(/(https?|file|ftp|chrome-extension|moz-extension):\/\/[^)\n]+/g);if(e)return`${`${e[0]}`.replace(/^((?:https?|file|ftp|chrome-extension|moz-extension):\/\/.+)\/[^/]+$/,"$1")}/`}return"/"}()),mt),At={isPlaying:!1,isAd:!1,muted:!1,autoplay:!1};function bt(t,e,i){t.customElements.get(e)||t.customElements.define(e,i)}function Et(t){return Object.keys(t).map((e=>({[e]:t[e].value}))).reduce(((t,e)=>({...t,...e})))}function St(t,e,{prefix:i=""}={}){const s=new URL(t);return Object.keys(e).filter((t=>null!=e[t])).forEach((t=>{s.searchParams.append(`${i}${t}`,e[t])})),s.toString()}bt(window,"glomex-integration",class extends X{connectedCallback(){super.connectedCallback(),this._resizeObserver=new window.ResizeObserver((t=>{let e;t.forEach((t=>{e=t.contentBoxSize&&1===t.contentBoxSize.length?t.contentBoxSize[0].blockSize:t.contentBoxSize&&t.contentBoxSize.inlineSize?t.contentBoxSize.blockSize:t.contentRect.height})),this.dispatchEvent(new window.CustomEvent("integrationresize",{detail:{height:e}}))})),this._resizeObserver.observe(this),this._helperSlot=window.document.createElement("div"),this._helperSlot.setAttribute("slot","helper"),this.appendChild(this._helperSlot);const t=window.document.createElement("div");t.setAttribute("slot","innerContainer"),this.appendChild(t),this.origin||(this.origin="glomex-integration"),super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver.disconnect()}static get properties(){return{integrationId:{type:String,attribute:"integration-id"},variant:{type:String},playlistId:{type:String,attribute:"playlist-id"},origin:{type:String,attribute:"origin"},playerConfig:{type:Object,attribute:!1},playerPlaylist:{type:Array,attribute:!1},playerPlaylistContext:{type:Object,attribute:!1},playerEnvironment:{type:Object,attribute:!1},playerContent:{type:Object,attribute:!1},playerRuntime:{type:Object,attribute:!1},playerAd:{type:Object,attribute:!1},cpm:{type:Number,attribute:!1},integrationSettings:{type:Object,attribute:!1},placement:{type:String},utmSource:{type:String,attribute:"utm-source"},utmCampaign:{type:String,attribute:"utm-campaign"},title:{type:String,attribute:"title"},poster:{type:String,attribute:"poster"}}}_connectPlayerEvents(){const{player:t}=this;t.addEventListener("ready",(t=>{this.playerConfig={...t.detail.config},this.playerRuntime={...this.playerRuntime,autoplay:t.detail&&t.detail.player.autoplay||!1,muted:t.detail&&t.detail.player.muted||!1},this.playerEnvironment={...t.detail.environment},this.dispatchEvent(new window.CustomEvent("ready",{detail:{...t.detail}}))})),t.addEventListener("integrationabort",(t=>{this.dispatchEvent(new window.CustomEvent("integrationabort",{detail:{...t.detail}}))})),t.addEventListener("adbreakready",(t=>{this.dispatchEvent(new window.CustomEvent("adbreakready",{detail:{...t.detail}}))})),t.addEventListener("playlistcreate",(t=>{this.playerPlaylist=[...t.detail.playlist],this.playerPlaylistContext={...t.detail.playlistContext},this.playerEnvironment={...t.detail.environment}})),t.addEventListener("playlistitemselect",(t=>{this.playerContent={...t.detail.content},this.playerPlaylistContext={...t.detail.playlistContext}})),t.addEventListener("play",(()=>{this.playerRuntime={...this.playerRuntime,isPlaying:!0}})),t.addEventListener("pause",(()=>{this.playerRuntime={...this.playerRuntime,isPlaying:!1}})),t.addEventListener("volumechange",(t=>{this.playerRuntime={...this.playerRuntime,muted:t.detail&&t.detail.player.muted||!1}})),t.addEventListener("adbegin",(t=>{this.playerAd={...t.detail.ad},this.playerRuntime={...this.playerRuntime,isAd:!0},this.dispatchEvent(new window.CustomEvent("adbegin",{detail:{...t.detail}}))})),t.addEventListener("adcomplete",(()=>{this.playerRuntime={...this.playerRuntime,isAd:!1}})),t.addEventListener("contentbegin",(()=>{this.playerRuntime={...this.playerRuntime,isAd:!1}}))}get variantId(){return this.variant&&this.variant.startsWith("blob:")?"blob":this._variantId}get player(){return this._player}_getTemplateUrl(){const t=`${ft}template/`;if(this.variant&&this.variant.startsWith("blob:"))return this.variant;if(!this.integrationId)return null;let e="";return-1===ft.indexOf("player.glomex.com/integration/1")&&(e=`?baseUrl=${encodeURIComponent(t)}`),`${gt}integration/${this.integrationId}/variant.js${e}`}_getProps(){let t="unknown";return this.playerEnvironment.pageSecondLevelDomain&&(t=this.playerEnvironment.pageSecondLevelDomain.replace(".","-")),{integrationId:this.integrationId,playlistId:this.playlistId,variant:this.variant,playerState:{config:this.playerConfig,playlistContext:this.playerPlaylistContext,playlist:this.playerPlaylist,player:this.playerRuntime,content:this.playerContent,ad:this.playerAd,environment:this.playerEnvironment},utm:{source:this.utmSource||t,medium:`glomex-integration/${this.variantId}`,campaign:this.utmCampaign||this.placement||void 0,content:this.integrationId,term:this.playerPlaylistContext.playlistId||this.playlistId},integrationSettings:this.integrationSettings,integration:this,playerRef:this._playerRef}}async performUpdate(){const t=this._getTemplateUrl();if(!t||this._renderTemplate)return void super.performUpdate();const{render:e,integrationSettings:i,variantId:s,defaultSettings:n}=await import(t);this._renderTemplate=function(...t){return e(...t)},this._variantId=s,this.defaultSettings=n||{},this.integrationSettings=i||{},super.performUpdate()}shouldUpdate(t){return t.has("integrationId")&&(this._helperSlot.innerHTML=""),Boolean(this._renderTemplate)}firstUpdated(){const{document:t,customElements:e}=window,i=this._playerRef.value;if(i){if(!e.get("glomex-player")){const e=t.createElement("script");e.src=`${ft}glomex-player.js`,(t.head||t.body).appendChild(e)}const s=window.document.createElement("link");s.setAttribute("rel","stylesheet"),s.setAttribute("href",`${ft}glomex-player.css`);const{parentNode:n}=i;n.insertBefore(s,n.firstElementChild),i.cpm=this.cpm,this._player=i,this.title&&(this._player.dataset.title=this.title),this.poster&&(this._player.dataset.poster=this.poster),this._player.parentGlomexIntegration=this,this._connectPlayerEvents()}}updated(t){if(t.has("integrationId")){const t=window.document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",`${gt}integration/${this.integrationId}/variant.css`),this.appendChild(t)}(function(t){try{return t.self!==t.top}catch(t){return!0}})(window)&&(this.style.height||(this.style.height="auto",setTimeout((()=>{this.style.height=null}),0)))}render(){return N`
${this._renderTemplate?this._renderTemplate(this._getProps()):null}
`}constructor(){super(),this._renderTemplate=void 0,this.defaultSettings=void 0,this._helperSlot=void 0,this.playerConfig={},this.playerPlaylistContext={},this.playerEnvironment={},this.playerPlaylist=[],this.playerContent={},this.playerAd={},this.playerRuntime={...At},this._playerRef=vt(),this._player=void 0}});export{X as LitElement,St as appendSearchParams,vt as createRef,r as css,Et as flattenDefaultSettings,N as html,ot as ifDefined,_t as ref,bt as registerCustomElementOnce,rt as styleMap};