import{d as i}from"./index-DHbaENoy.js";var r=(t=>(t[t.V2=2]="V2",t[t.V3=3]="V3",t[t.SIMULATOR=100]="SIMULATOR",t))(r||{}),o=(t=>(t.DGLAB="DGLab",t.COYOTE_BLE_V2="CoyoteBLEV2",t.COYOTE_BLE_V3="CoyoteBLEV3",t))(o||{});const s=i("coyoteLocalConnStore",{state:()=>({connected:!1,deviceVersion:r.V3,deviceBattery:100,deviceStrengthA:0,deviceStrengthB:0,freqBalance:150,inputLimitA:20,inputLimitB:20,controller:null}),actions:{initConnection(){this.controller&&(this.deviceVersion=this.controller.deviceVersion,this.connected=!0,window.onbeforeunload=t=>(t.preventDefault(),"确定要断开蓝牙连接吗？"),this.controller.on("workerInit",()=>{var t,e,n;(t=this.controller)==null||t.setStrengthLimit(this.inputLimitA,this.inputLimitB),(e=this.controller)==null||e.setFreqBalance(this.freqBalance),(n=this.controller)==null||n.startWs()}),this.controller.on("batteryLevelChange",t=>{this.deviceBattery=t}),this.controller.on("strengthChange",(t,e)=>{this.deviceStrengthA=t,this.deviceStrengthB=e}),this.controller.on("disconnect",()=>{this.connected=!1,window.onbeforeunload=null}))},disconnect(){var t;(t=this.controller)==null||t.cleanup(),this.controller=null,this.connected=!1,window.onbeforeunload=null}},persist:{key:"CoyoteBTStore",pick:["freqBalance","inputLimitA","inputLimitB"]}});export{r as C,o as a,s as u};
