import{o as c,c as d,a as t,e as p,t as h,f as x,n as k,_ as g,d as y,Q as A,r as M,b as T,w as B,h as H,T as S,y as b,R as C}from"./index.js";import{_ as G,a as N,b as I,c as V,d as $}from"./time.js";const P=t("div",{class:"helloween-chase-alert__light"},null,-1),z={class:"helloween-chase-alert__label"},j={key:0,class:"helloween-chase-alert__glitch"},D={class:"helloween-chase-alert__text"},E=t("div",{class:"helloween-chase-alert__text__particle"},null,-1),Q={class:"helloween-chase-alert__text__value"},R=t("div",{class:"helloween-chase-alert__text__particle"},null,-1);function U(l,s,e,a,o,i){return c(),d("div",{class:k(["helloween-chase-alert",[`helloween-chase-alert_color-${e.color}`,{"helloween-chase-alert_mobile":e.isMobile}]])},[P,t("div",z,[p(h(e.label),1),e.useGlitch?(c(),d("div",j)):x("",!0)]),t("div",D,[E,t("div",Q,h(e.text),1),R])],2)}const q={props:{isMobile:Boolean,label:String,text:String,useGlitch:Boolean,color:Number},setup(){}},F=g(q,[["render",U]]),J={class:"helloween-chase-bar__text"},K={key:0,class:"helloween-chase-bar__glitch",src:G},L={key:1,class:"helloween-chase-bar__glitch",src:N},O={class:"helloween-chase-bar__bar"},W={class:"helloween-chase-bar__indicator"},X=t("img",{src:I},null,-1),Y=t("img",{class:"helloween-chase-bar__bar__marking",src:V},null,-1),Z={class:"helloween-chase-bar__indicator"},ee=t("img",{src:$},null,-1);function ae(l,s,e,a,o,i){return c(),d("div",{class:k(["helloween-chase-bar",{"helloween-chase-bar_mobile":e.isMobile}])},[t("div",J,"Погоня за "+h(e.data.name.split("_").join(" ")),1),e.isMobile?(c(),d("img",K)):(c(),d("img",L)),t("div",O,[t("div",W,[X,p(h(e.data.hp),1)]),Y,t("div",{class:"helloween-chase-bar__bar__fill",style:y({width:`${e.data.hp/e.data.maxHp*100}%`})},null,4),t("div",{class:"helloween-chase-bar__bar__gap",style:y({width:`${e.data.initialHp/e.data.maxHp*100}%`})},null,4),t("div",Z,[ee,p(h(a.formatedTime.m)+":"+h(a.formatedTime.s),1)])])],2)}const te={props:["data","isMobile"],setup(l){return{formatedTime:A(()=>{const e=Math.floor(l.data.time/3600),a=Math.floor(l.data.time%3600/60),o=Math.floor(l.data.time%3600%60);return{h:e.toString().padStart(2,"0"),m:a.toString().padStart(2,"0"),s:o.toString().padStart(2,"0")}})}}},le=g(te,[["render",ae]]),se={class:"helloween-chase iface-container"};function oe(l,s,e,a,o,i){const u=M("Alert"),m=M("Bar");return c(),d("div",se,[T(S,{name:"scale",appear:""},{default:B(()=>[a.alert?(c(),H(u,{key:0,isMobile:i.isMobile,label:a.alert.label,text:a.alert.text,useGlitch:a.alert.useGlitch,color:a.alert.color},null,8,["isMobile","label","text","useGlitch","color"])):x("",!0)]),_:1}),T(S,{name:"fade",appear:""},{default:B(()=>[a.bar?(c(),H(m,{key:0,isMobile:i.isMobile,data:a.bar},null,8,["isMobile","data"])):x("",!0)]),_:1})])}const ie={props:["openParams"],components:{Alert:F,Bar:le},data:()=>({noAdaptation:!0}),setup(l){const s=b(!1),e=b(!1),a=b(null),o=b(null),i=()=>clearTimeout(a.value),u=r=>{if(i(),!r){s.value=null;return}const[n,f,w,_,v]=r;s.value={label:n,text:f,useGlitch:w,color:_},a.value=setTimeout(()=>{s.value=null,i()},v)},m=r=>{if(!r){e.value=null;return}let[n,f,w,_]=r;(!e.value||e.value.initialTime!=_)&&(clearInterval(o.value),o.value=setInterval(()=>{e.value.time--<=0&&clearInterval(o.value)},1e3));let v=n;e.value&&e.value.initialTime===_&&(_=e.value.time),e.value&&e.value.initialHp!==n&&(v=e.value.initialHp),e.value={hp:n,maxHp:f,name:w,time:_,initialTime:_,initialHp:v},setTimeout(()=>{e.value.initialHp=n},500)};if(l.openParams){const[r,n]=l.openParams;u(r),m(n)}return C(()=>i()),{alert:s,bar:e,setBar:m,setAlert:u}},computed:{isMobile(){return this.$root.isMobile}}},re=g(ie,[["render",oe]]);export{re as default};
