import{n as u,S as i,ad as g,H as h,M as p,i as v,g as b,af as _,f as s,a0 as m,C as x,a5 as k,h as w,ai as C,_ as S,o as z}from"./_plugin-vue_export-helper.js";import{c as L}from"./index.es2.js";import{u as E}from"./index2.js";import"./index3.js";const B={class:"kvass-story-fly"},M=u({__name:"StoryFly.ce",props:{url:{type:String},label:{default:"Interaktiv film",type:String},thumbnail:{type:String},openOnLoad:{type:Boolean}},emits:["open","close"],setup(f,{emit:y}){const o=f,n=y,t=i(),r=i(),a=i(!1),d=E();g(()=>a.value,e=>{d.value.dispatchEvent(new CustomEvent("webcomponent:update",{detail:e,bubbles:!0,composed:!0}))},{deep:!0});function l(){t.value.style.display="flex",setTimeout(()=>{t.value.classList.add("kvass-story-fly__lightbox--show")},10),r.value.src=o.url,a.value=!0,n("open")}function c(e){a.value=!1,(!e||e.target.classList.contains("kvass-story-fly__lightbox-close")||e.target===t.value)&&(t.value.classList.remove("kvass-story-fly__lightbox--show"),setTimeout(()=>{t.value.style.display="none",r.value.src=""},500)),n("close")}return h(()=>{o.openOnLoad&&l()}),(e,F)=>(p(),v("div",B,[a.value?w("",!0):(p(),b(k(L),{key:0,class:"kvass-story-fly__trigger-button",style:x(`background-image: url(${o.thumbnail});`),onClick:l,icon:"fa-pro-solid:play"},{default:_(()=>[s("span",null,m(o.label),1)]),_:1},8,["style"])),s("div",{class:"kvass-story-fly__lightbox",ref_key:"lightbox",ref:t,onClick:c},[s("div",{class:"kvass-story-fly__lightbox-content",onClick:C(()=>"",["stop","prevent"])},[s("span",{class:"kvass-story-fly__lightbox-close",onClick:c},"×"),s("iframe",{ref_key:"iframe",ref:r,src:""},null,512)])],512)]))}}),O=".kvass-story-fly{height:100%}.kvass-story-fly__trigger-button{border:none;border-color:transparent;background-position:center;background-repeat:no-repeat;background-size:cover;aspect-ratio:var(--kvass-story-fly-aspect-ratio, var(--aspect-ratio, 16/9));min-height:var(--kvass-story-fly-min-height, none);height:100%;width:100%;border-radius:var(--kvass-story-fly-border-radius, 0);position:relative}@media screen and (max-width: 680px){.kvass-story-fly__trigger-button{aspect-ratio:var(--kvass-story-fly-aspect-ratio-small-device, var(--aspect-ratio, 16/9))}}.kvass-story-fly__trigger-button .k-button__content{position:absolute;bottom:var(--kvass-story-fly-trigger-bottom-offset, 15px);left:var(--kvass-story-fly-trigger-left-offset, 15px);backdrop-filter:blur(8px);background:#0009;color:#fff;font-size:18px;font-weight:700;padding:8px 20px;border-radius:99px;transition:transform .2s ease-in-out;z-index:10;display:inline-flex;gap:.5rem;align-items:center;cursor:pointer}.kvass-story-fly__trigger-button .k-button__content:hover{transform:scale(1.1)}.kvass-story-fly__lightbox{display:none;position:fixed;top:0;left:0;width:100vw;height:100dvh;background:#000c;justify-content:center;align-items:center;z-index:99999;opacity:0;transition:opacity .5s ease-in-out}@media screen and (min-width: 680px){.kvass-story-fly__lightbox{padding:2rem}}.kvass-story-fly__lightbox--show{display:flex;opacity:1}.kvass-story-fly__lightbox-content{position:relative;padding:0;box-shadow:0 0 10px #0000004d;display:flex;justify-content:center;align-items:center;aspect-ratio:1;flex-grow:1;height:100%}@media screen and (min-width: 680px){.kvass-story-fly__lightbox-content{height:initial;aspect-ratio:4/3}}.kvass-story-fly__lightbox-close{position:absolute;top:10px;right:10px;font-size:23px;cursor:pointer;background:#fff;border-radius:50%;width:30px;height:30px;text-align:center;box-shadow:0 0 5px #00000080;font-weight:700;border:none;z-index:10;display:block;line-height:23px}.kvass-story-fly__lightbox iframe{width:100%;height:100%;border:none}",j=S(M,[["styles",[O]]]);customElements.define("kvass-storyfly",z(j));
