import{_ as h}from"./icon.js";import{o as r,c as s,a as e,F as _,i as d,t as l,e as g,d as u,n as p,_ as v}from"./index.js";const b={class:"gang-timer__content"},f=e("div",{class:"gang-timer__content-gradient"},null,-1),T=e("img",{class:"gang-timer__icon",src:h},null,-1),x={class:"gang-timer__timer"},y=["innerHTML"];function C(t,m,c,L,a,i){return r(),s("div",{class:p(["gang-timer",{"gang-timer_mobile":i.isMobile}])},[e("div",b,[f,T,e("div",x,[(r(!0),s(_,null,d(i.formatedTimer[0],(n,o)=>(r(),s("div",{class:"gang-timer__timer-char",key:o},l(n),1))),128)),g(":"),(r(!0),s(_,null,d(i.formatedTimer[1],(n,o)=>(r(),s("div",{class:"gang-timer__timer-char",key:o},l(n),1))),128))]),e("div",{class:"gang-timer__label",style:u({color:a.labelColor})},l(a.label),5),e("div",{class:"gang-timer__text",innerHTML:a.text},null,8,y)])],2)}const I={props:["openParams"],data(){return{label:"Radmir Gang",labelColor:"#65C466",text:"Проводит захват особняка",timer:30*1e3,timerInterval:null}},computed:{formatedTimer(){const t=this.timer/1e3,m=Math.floor(t/60).toString().padStart(2,"0"),c=Math.floor(t%60).toString().padStart(2,"0");return[Array.from(m),Array.from(c)]},isMobile(){return this.$root.isMobile}},created(){this.$data.noAdaptation=!0,this.openParams&&(this.setLabel(this.openParams[0]),this.setLabelColor(this.openParams[1]),this.setText(this.openParams[2]),this.setTimer(this.openParams[3]*1e3-Date.now())),this.startTimer()},methods:{setLabel(t){this.label=t},setLabelColor(t){this.labelColor=t},setText(t){this.text=t},setTimer(t){this.timer=t},startTimer(){clearInterval(this.timerInterval),this.timerInterval=setInterval(()=>{if(this.timer<=0)return clearInterval(this.timerInterval);this.timer-=1e3},1e3)}}},P=v(I,[["render",C]]);export{P as default};
