1import{_ as B}from"./chunk-CXQCcojo.js";import{m as W,p as j,al as q,q as D,d as F,r,c as m,o as I,a7 as J,a as y,b as S,f as b,h as G,a8 as K,n as N,t as x,P as E,l as k,O as L,D as Q,e as C}from"./index.js";const X=W("takeover",{state:()=>({takeover:{}}),getters:{getTakeover:p=>p.takeover},actions:{async fetchTakeover(p){if(p){const l=await j.get(`takeover?id=${p}`);l&&(this.takeover=l);return}const d=await q.get("takeovers")??[];if(!d?.length)return;const w=D().getSelectedCinemas,_=d.filter(l=>{let i=null;try{i=JSON.parse(l.rules)}catch{}if(!i?.length)return!0;const c=i.filter(n=>n.Type==="Cinemas");if(!c?.length)return!0;const v=c.flatMap(n=>n.Value.replace(/ /g,"").split(","));return v?.length?w?.length?v.some(n=>w.some(u=>u.id===n)):!1:!0}),[h]=_;h&&(this.takeover=h)}}}),Y={class:"takeover__container"},Z={class:"takeover__overflow"},ee={key:0,class:"takeover__hotspot-label"},te=["loop"],ae=["type","src"],ne=F({__name:"App",setup(p){const d=X(),f=r(),w=r({w:0,h:0}),_=r(""),h=r(""),l=r(window.innerWidth>=640),i=r(!1),c=r(!1),v=r(!1),n=r(!1),u=r(!1),e=m(()=>d.getTakeover),M=m(()=>`takeover-${e.value.id}-viewed`),g=m(()=>{const o=l.value?A.value?e.value.appleVideo:e.value.video:A.value?e.value.mobileAppleVideo:e.value.mobileVideo;return o?"/content/"+o:null}),R=m(()=>{const o={},t=a=>{const s=Number(a);return Number.isFinite(s)&&s>0?s:null};if(l.value){const a=t(e.value.hotspotWidth),s=t(e.value.hotspotHeight);a&&(o.width=`calc(max(100vw, 100vh * (1920 / 1080)) * (${a} / 1920))`),s&&(o.height=`calc(max(100vh, 100vw * (1080 / 1920)) * (${s} / 1080))`)}else{const a=t(e.value.mobileHotspotWidth),s=t(e.value.mobileHotspotHeight);a&&(o.width=`calc(max(100vw, 100vh * (1080 / 2340)) * (${a} / 1080))`),s&&(o.height=`calc(max(100vh, 100vw * (2340 / 1080)) * (${s} / 2340))`)}return o}),T=m(()=>{const{w:o,h:t}=w.value;if(!o||!t)return null;const a=window.innerWidth,s=window.innerHeight;return l.value?{w:Math.round(o*1920/Math.max(a,s*(1920/1080))),h:Math.round(t*1080/Math.max(s,a*(1080/1920)))}:{w:Math.round(o*1080/Math.max(a,s*(1080/2340))),h:Math.round(t*2340/Math.max(s,a*(2340/1080)))}}),A=m(()=>Q.isApple()),O=()=>{i.value||(i.value=!0,E.trackEvent("close_takeover_web",{takeover_id:e.value.id,takeover_name:e.value.name}),H())},U=()=>{i.value||n.value||(i.value=!0,k.set("takeover-attribution",e.value,86400),E.trackEvent("hide_takeover_web",{takeover_id:e.value.id,takeover_name:e.value.name}),H())},$=()=>{!e.value.link||u.value||(k.set("takeover-attribution",e.value,86400),E.trackEvent("click_takeover_web",{takeover_id:e.value.id,takeover_name:e.value.name}),setTimeout(()=>window.location.href=e.value.link,100))},z=()=>u.value=!u.value,H=()=>{document.documentElement.classList.remove("is-takeover-active"),c.value=!1,L.unlock(),setTimeout(()=>v.value=!1,400)},P=async o=>{if(await d.fetchTakeover(o),!!g.value){try{const t=await fetch(g.value);if(!t.ok)return;const a=await t.blob();_.value=URL.createObjectURL(a),h.value=a.type}catch{return}document.documentElement.classList.add("is-takeover-active"),v.value=n.value=!0,L.lock(),window.requestAnimationFrame(()=>{c.value=!0,f.value&&(Object.entries(R.value).forEach(([t,a])=>f.value.style.setProperty(t,a)),new ResizeObserver(([t])=>{t&&(w.value={w:t.contentRect.width,h:t.contentRect.height})}).observe(f.value))})}},V=async()=>{if(!(e.value.id||k.get("takeover-viewed")===!0)&&(await d.fetchTakeover(),!!g.value&&k.get(M.value)!==!0)){try{const t=await fetch(g.value);if(!t.ok)return;const a=await t.blob();_.value=URL.createObjectURL(a),h.value=a.type}catch{return}document.documentElement.classList.add("is-takeover-active"),v.value=!0,L.lock(),window.requestAnimationFrame(()=>{c.value=!0,k.set("takeover-viewed",!0,86400),k.set(M.value,!0),E.trackEvent("view_takeover_web",{takeover_id:e.value.id,takeover_name:e.value.name})})}};return I(async()=>{const o=document.getElementById("takeover-id")?.getAttribute("value");if(o){await P(o);return}document.addEventListener("selected-cinemas-loaded",V,{once:!0}),document.addEventListener("selected-cinemas-saved",V)}),J(()=>document.removeEventListener("selected-cinemas-saved",V)),(o,t)=>v.value?(C(),y("div",{key:0,class:N(["takeover",{"is-active":c.value}])},[b("div",Y,[b("div",Z,[b("button",{class:"takeover__close",type:"button",onClick:O},[G(B,{id:"circular-cross",class:"takeover__close-icon",width:"32",height:"32",title:"Close Takeover"})]),e.value.link?(C(),y("button",{key:0,ref_key:"hotspot",ref:f,class:N(["takeover__hotspot",[l.value?"is-desktop":"is-mobile",{"is-visible":u.value}]]),style:K(n.value?null:R.value),type:"button",onClick:$},[u.value&&T.value?(C(),y("label",ee,x(T.value.w)+" Ã "+x(T.value.h),1)):S("",!0)],6)):S("",!0),e.value.link&&n.value?(C(),y("button",{key:1,class:"takeover__hotspot-toggle",type:"button",onClick:z},x(u.value?"Hide":"Show")+" Hotspot",1)):S("",!0),b("video",{class:"takeover__video",width:"100%",height:"100%",loop:n.value,autoplay:"",muted:"",playsinline:"",disablePictureInPicture:"",onEnded:U},[b("source",{type:h.value,src:_.value},null,8,ae)],40,te)])])],2)):S("",!0)}});
1export{ne as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.