import{d as N,e as L,f as T,g as V}from"./bg.js";import{o as a,h as S,w as f,c as _,n as h,a as B,b as l,T as m,f as d,_ as p,Q as b,t as C,r as v,y,J as w,H as $,I as O}from"./index.js";import{B as U}from"./Button3.js";const K=["src"],A=["src"],D=["src"];function E(i,s,t,e,o,c){return a(),S(m,{name:"scale-vertical",appear:"",onAfterLeave:s[0]||(s[0]=n=>i.$emit("after-leave"))},{default:f(()=>[t.visible?(a(),_("div",{key:0,class:h(["game-notifications__line",{"game-notifications__line_fail":!t.isSuccess}])},[B("img",{class:"game-notifications__line-bg",src:e.bgImage},null,8,K),l(m,{name:"slide-bottom",mode:"out-in",appear:""},{default:f(()=>[(a(),_("img",{class:"game-notifications__line-bottom",key:t.animationKey,src:e.animationImage},null,8,A))]),_:1}),l(m,{name:"slide-top",mode:"out-in",appear:""},{default:f(()=>[(a(),_("img",{class:"game-notifications__line-top",key:t.animationKey,src:e.animationImage},null,8,D))]),_:1})],2)):d("",!0)]),_:1})}const G={props:{visible:{type:Boolean,default:!1},animationKey:{type:Number,default:0},isSuccess:{type:Boolean,default:!0}},emits:["after-leave"],setup(i){const s=Object.assign({"/src/assets/images/game-notifications/animation-effect-fail.png":N,"/src/assets/images/game-notifications/animation-effect.png":L,"/src/assets/images/game-notifications/bg-fail.png":T,"/src/assets/images/game-notifications/bg.png":V}),t=b(()=>{var n;const c=`/src/assets/images/game-notifications/${i.isSuccess?"bg.png":"bg-fail.png"}`;return(n=s[c])==null?void 0:n.default}),e=b(()=>{var n;const c=`/src/assets/images/game-notifications/${i.isSuccess?"animation-effect.png":"animation-effect-fail.png"}`;return(n=s[c])==null?void 0:n.default});return{bgImage:t,animationImage:e}}},R=p(G,[["render",E],["__scopeId","data-v-0c25f31c"]]);function F(i,s,t,e,o,c){return a(),S(m,{name:"scale-title",appear:""},{default:f(()=>[t.visible?(a(),_("div",{key:0,class:h(["game-notifications__title",{"game-notifications__title_fail":!t.isSuccess}])},C(t.isSuccess?"УСПЕХ!":"ПРОВАЛ"),3)):d("",!0)]),_:1})}const M={props:{visible:{type:Boolean,default:!1},isSuccess:{type:Boolean,default:!0}}},j=p(M,[["render",F],["__scopeId","data-v-2cfc248e"]]),q={key:0,class:"game-notifications__info"},z={class:"game-notifications__info-text"};function H(i,s,t,e,o,c){const n=v("Button");return a(),S(m,{name:"slide-down-fade",appear:""},{default:f(()=>[t.visible?(a(),_("div",q,[B("div",z,C(t.text),1),l(n,{class:"game-notifications__info-button",text:"продолжить",type:"white",onClick:s[0]||(s[0]=r=>i.$emit("close-info"))})])):d("",!0)]),_:1})}const J={props:{visible:{type:Boolean,default:!1},text:{type:String,required:!1,default:""}},components:{Button:U}},Q=p(J,[["render",H],["__scopeId","data-v-d42c8fd2"]]),P={key:0,class:"game-notifications"},W={key:0,class:"game-notifications__overlay"},X={key:0,class:"game-notifications__container"};function Y(i,s,t,e,o,c){const n=v("Line"),r=v("Title"),u=v("Info");return e.isOverlayVisible?(a(),_("div",P,[l(m,{name:"fade",appear:""},{default:f(()=>[e.isOverlayVisible?(a(),_("div",W)):d("",!0)]),_:1}),l(m,{name:"fade",appear:""},{default:f(()=>[e.isOverlayVisible?(a(),_("div",X,[l(n,{visible:e.isContentVisible,animationKey:e.animationKey,isSuccess:t.isSuccess,onAfterLeave:e.onContentLeave},null,8,["visible","animationKey","isSuccess","onAfterLeave"]),l(r,{visible:e.isContentVisible,isSuccess:t.isSuccess},null,8,["visible","isSuccess"])])):d("",!0)]),_:1}),l(u,{visible:e.isContentVisible,text:t.text,onCloseInfo:e.handleButtonClick},null,8,["visible","text","onCloseInfo"])])):d("",!0)}const Z="UI/sfx_succes_minigame.mp3",ee="UI/sfx_fail_minigame.mp3",te={name:"GameNotifications",props:{visible:{type:Boolean,default:!1},isSuccess:{type:Boolean,default:!1},text:{type:String,default:""},sound:{type:String,default:""}},emits:["close"],components:{Info:Q,Title:j,Line:R},setup(i,{emit:s}){const t=y(0),e=y(!1),o=y(!1),c=b(()=>i.sound&&i.sound.length?i.sound:i.isSuccess?Z:ee),n=()=>{window.playSound(c.value);let g=performance.now()+3e3;const x=()=>{t.value++,g+=3e3;const k=g-performance.now();setTimeout(x,Math.max(0,k))};setTimeout(x,3e3)},r=()=>{u()},u=()=>{o.value=!1},I=()=>{e.value=!1,s("close")};return w(()=>i.visible,g=>{g?(e.value=!0,o.value=!0,n()):u()},{immediate:!0}),$(()=>{i.visible&&n()}),O(()=>{}),{animationKey:t,isOverlayVisible:e,isContentVisible:o,handleButtonClick:r,onContentLeave:I}}},ae=p(te,[["render",Y],["__scopeId","data-v-102a2edf"]]);export{ae as G};
