import{r as x}from"./request-CEvu378m.js";import{ax as E,r as i,w as V,j as B,X as K,B as f,z as d,D as g,I as C,W as h,H as L,u as n,K as $}from"./vue-BJk78QHK.js";import{_ as j}from"./index-M_JNBppB.js";import"./element-3_pOinej.js";import"./utils-YI6ye1sf.js";import"./threejs-BafxXW5-.js";import"./vxe-Dx3zSILm.js";const A="/assets/620-CHQcoMIn.mp3",I="/assets/5051-Cy7v4bhF.mp3",O="/assets/14016-C0AByTvy.mp3",T="/assets/14141-D6r7665J.mp3",z="/assets/14184-BkpCiM53.mp3",M={class:"contant"},N=["muted"],D=["src"],F=Object.assign({name:"Alarm"},{__name:"Alarm",props:{propValue:{type:Object,default:()=>({})},request:{type:Object,default:()=>({})},element:{type:Object,default:()=>({})}},setup(l){const e=l,c=E(),s=i(null),t=i(!1),b=i(!0),a=i(null),q=i([A,I,O,T,z]),m=i(!1);V(()=>e.propValue,r=>{r.config.ifCanPlay||a.value&&a.value.pause(),setTimeout(()=>{v()},100)},{deep:!0}),V(()=>m.value,()=>{e.propValue.config.ifCanPlay&&setTimeout(()=>{b.value=!1,v()},1e3)},{deep:!0}),B(()=>{var r,u;document.addEventListener("click",o,{once:!0}),document.addEventListener("touchstart",o,{once:!0}),e.request&&(s.value=x(e.request,e.propValue,"data")),((u=(r=e.request)==null?void 0:r.global)==null?void 0:u.length)>0&&V(()=>c.state.globalKey,()=>{e.request.global.forEach(w=>{const y=c.state.globalKey.findIndex(p=>p.globalKey===w);if(y>-1){const p=[c.state.globalKey[y].globalKey,c.state.globalKey[y].globalValue],k=e.request.data.findIndex(P=>P[0]===p[0]);k>-1?e.request.data[k][1]=p[1]:e.request.data.push(p)}}),s.value&&s.value(),s.value=x(e.request,e.propValue,"data")},{deep:!0}),e.propValue.config.ifCanPlay||v()}),K(()=>{e.request&&s.value&&s.value(),document.removeEventListener("click",o),document.removeEventListener("touchstart",o)});function o(){m.value||(m.value=!0,document.removeEventListener("click",o),document.removeEventListener("touchstart",o))}function v(){switch(e.propValue.config.type){case">":e.propValue.data>e.propValue.config.alarmValue?(e.propValue.config.ifCanPlay&&a.value&&a.value.play(),t.value=!0):(a.value&&a.value.pause(),t.value=!1);break;case">=":e.propValue.data>=e.propValue.config.alarmValue?(e.propValue.config.ifCanPlay&&a.value&&a.value.play(),t.value=!0):(a.value&&a.value.pause(),t.value=!1);break;case"=":e.propValue.data==e.propValue.config.alarmValue?(e.propValue.config.ifCanPlay&&a.value&&a.value.play(),t.value=!0):(a.value&&a.value.pause(),t.value=!1);break;case"<=":e.propValue.data<=e.propValue.config.alarmValue?(e.propValue.config.ifCanPlay&&a.value&&a.value.play(),t.value=!0):(a.value&&a.value.pause(),t.value=!1);break;case"<":e.propValue.data<e.propValue.config.alarmValue?(e.propValue.config.ifCanPlay&&a.value&&a.value.play(),t.value=!0):(a.value&&a.value.pause(),t.value=!1);break}}return(r,u)=>(d(),f("div",M,[g("div",{class:L({dot:n(t),dot2:!n(t)}),style:h({width:`${l.element.style.width/2}px`,height:`${l.element.style.width/2}px`})},null,6),n(t)?(d(),f("div",{key:0,class:"pulse",style:h({width:`${l.element.style.width*2}px`,height:`${l.element.style.width*2}px`})},null,4)):C("",!0),n(t)?(d(),f("div",{key:1,class:"pulse-big",style:h({width:`${l.element.style.width*2}px`,height:`${l.element.style.width*2}px`})},null,4)):C("",!0),(d(),f("audio",{key:l.propValue.config.mp3,ref_key:"audio",ref:a,loop:"",muted:n(b)},[g("source",{src:n(q)[l.propValue.config.mp3],type:"audio/mp3"},null,8,D),u[0]||(u[0]=g("track",{kind:"captions"},null,-1)),u[1]||(u[1]=$(" 浏览器不支持该音频格式 "))],8,N))]))}}),R=j(F,[["__scopeId","data-v-67450c00"]]);export{R as default};
