import{u as I,s as V,r as u,o as A,k as j,c as l,a as g,b as i,d as o,w as c,e as m,v as R,f as _,t as y,n as x,T as h,F as k,l as N,i as $,h as b,_ as C,m as z,j as s}from"./index-DsXh811X.js";const G=["src"],L={class:"p-3 flex gap-2 justify-around items-center w-1/2 transition-all"},U={key:0},E=["src"],H={key:1,class:"grow bg-cover flex flex-col justify-around items-center",appear:""},K={__name:"SimpleView",setup(M){const e=I(),{story:D}=V(e),r=u(e.naturalFlow),p=u(0),v=u(0),d=u(e.currentRoute.buttonDelay),f=u(e.currentRoute.textDelay),F=z("getCurrentGlobalAudio");A(()=>{r.value&&e.currentRoute.buttonDelay&&(v.value=setTimeout(()=>{d.value=!1},parseFloat(e.currentRoute.buttonDelay))),r.value&&e.currentRoute.textDelay&&(p.value=setTimeout(()=>{f.value=!1},parseFloat(e.currentRoute.textDelay))),e.flagTriggerCheck()});function w(a){!r.value&&e.currentRoute.buttonDelay&&(v.value=setTimeout(()=>{d.value=!1},parseFloat(e.currentRoute.buttonDelay))),!r.value&&e.currentRoute.textDelay&&(p.value=setTimeout(()=>{f.value=!1},parseFloat(e.currentRoute.textDelay))),F(),r.value=a}function S(a){a?.targetFlag&&e.triggerFlagById(a?.targetFlag),a?.targetScene&&e.selectNextRoute(a?.targetScene)}function T(a){let n=!0;for(var t=0;t<a.flagCondition.length;t++)if(e.getFlagById(a.flagCondition[t].flagId)?.value!=a.flagCondition[t].condition){n=!1;break}return n}return j(a=>{console.log("onbeforeRouteUpdate")}),(a,n)=>r.value?(s(),l("section",{key:0,class:x(["grow bg-cover flex flex-col justify-center items-center",o(e).displayedRoute?.buttonsVAlign]),style:$({backgroundImage:`url(${o(e).displayedRoute?.bgImage})`})},[o(e).displayedRoute?.bgVideo?(s(),l("video",{key:0,class:"absolute w-full h-full top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 pointer-events-none",muted:"",src:o(e).displayedRoute?.bgVideo,autoplay:"",loop:""},null,8,G)):g("",!0),i(h,{appear:""},{default:c(()=>[m(_("p",{class:x(["font-secondary",o(D)?.style.textBox])},y(o(e).displayedRoute?.text),3),[[R,o(e).displayedRoute?.text&&!f.value]])]),_:1}),i(h,{appear:""},{default:c(()=>[m(_("ul",L,[(s(!0),l(k,null,N(o(e).displayedRoute?.buttons,(t,B)=>(s(),l(k,{key:B},[t.flagCondition==null||T(t)?(s(),l("li",U,[i(C,{image:t?.image,audio:t?.audio,"label-hide":t?.labelHide,onClick:q=>S(t)},{default:c(()=>[b(y(t.label),1)]),_:2},1032,["image","audio","label-hide","onClick"])])):g("",!0)],64))),128))],512),[[R,!d.value]])]),_:1}),o(e).displayedRoute?.bgAudio?(s(),l("audio",{key:1,src:o(e).displayedRoute.bgAudio,autoplay:""},null,8,E)):g("",!0)],6)):(s(),l("section",H,[i(C,{onClick:n[0]||(n[0]=t=>w(!0))},{default:c(()=>[b("Lancer la scene -> "+y(o(e).currentRoute.id),1)]),_:1})]))}};export{K as default};
