(function(){"use strict";vart={5618:function(t,e,n){vara=n(9242),i=n(3396);functions(t,e,n,a,s,r){consto=(0,i.up)("WaveloversApp");return(0,i.wg)(),(0,i.j4)(o)}constr={class:"wavelovers"},o=(0,i.Uk)("Loading..."),c=(0,i.Uk)("Press any gamepad button or connect a new gamepad to vibrate.");functiond(t,e,n,a,s,d){constp=(0,i.up)("PatternList"),u=(0,i.up)("MessageItem"),h=(0,i.up)("GamepadList");return(0,i.wg)(),(0,i.iD)("div",r,[t.patterns.length>0?((0,i.wg)(),(0,i.j4)(p,{key:0,patterns:t.patterns,mode:t.mode,isActive:t.isActive,onChange:t.change},null,8,["patterns","mode","isActive","onChange"])):((0,i.wg)(),(0,i.j4)(u,{key:1},{default:(0,i.w5)((()=>[o])),_:1})),t.gamepads.length>0?((0,i.wg)(),(0,i.j4)(h,{key:2,gamepads:t.gamepads},null,8,["gamepads"])):((0,i.wg)(),(0,i.j4)(u,{key:3},{default:(0,i.w5)((()=>[c])),_:1}))])}constp={class:"pattern-list"};functionu(t,e,n,a,s,r){consto=(0,i.up)("PatternItem");return(0,i.wg)(),(0,i.iD)("div",p,[((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(t.patterns,((e,n)=>((0,i.wg)(),(0,i.j4)(o,{key:e.name,pattern:e,index:n,mode:t.mode,isActive:t.isActive,onChange:t.change},null,8,["pattern","index","mode","isActive","onChange"])))),128))])}varh=n(7139);constl=["textContent"],m=["textContent"];functionv(t,e,n,a,s,r){return(0,i.wg)(),(0,i.iD)("div",{onClick:e[0]||(e[0]=e=>t.change(t.index)),class:(0,h.C_)(["pattern-item",t.index===t.mode&&!0===t.isActive?"pattern-item_selected":""])},[(0,i._)("span",{class:"pattern-item__icon",textContent:(0,h.zw)(t.pattern.icon)},null,8,l),(0,i._)("span",{class:"pattern-item__name",textContent:(0,h.zw)(t.pattern.name)},null,8,m)],2)}varg=(0,i.aZ)({name:"PatternItem",props:{pattern:{type:Object},index:{type:Number},mode:{type:Number},isActive:{type:Boolean}},methods:{change(t){this.$emit("change",t)}}}),f=n(89);constw=(0,f.Z)(g,[["render",v]]);varb=w,y=(0,i.aZ)({name:"PatternList",props:{patterns:{type:Array},mode:{type:Number},isActive:{type:Boolean}},components:{PatternItem:b},methods:{change(t){this.$emit("change",t)}}});constA=(0,f.Z)(y,[["render",u]]);varZ=A;constj={class:"device-list"};functionx(t,e,n,a,s,r){consto=(0,i.up)("GamepadItem");return(0,i.wg)(),(0,i.iD)("div",j,[((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(t.gamepads,(t=>((0,i.wg)(),(0,i.j4)(o,{key:t.id,textContent:(0,h.zw)(t.unit.id)},null,8,["textContent"])))),128))])}constk={class:"list-item"};functionC(t,e,n,a,s,r){return(0,i.wg)(),(0,i.iD)("div",k)}var_=(0,i.aZ)({name:"GamepadItem"});constO=(0,f.Z)(_,[["render",C]]);varP=O,G=(0,i.aZ)({name:"GamepadList",props:{gamepads:{type:Array}},components:{GamepadItem:P}});constI=(0,f.Z)(G,[["render",x]]);varL=I;constD={class:"message"};functionE(t,e,n,a,s,r){return(0,i.wg)(),(0,i.iD)("div",D,[(0,i._)("span",null,[(0,i.WI)(t.$slots,"default")])])}varV=(0,i.aZ)({name:"MessageItem"});constM=(0,f.Z)(V,[["render",E]]);varW=M,z=n(2482);classN{constructor(t){(0,z.Z)(this,"id",void0),(0,z.Z)(this,"canVibrate",void0),(0,z.Z)(this,"isVibrating",void0),(0,z.Z)(this,"unit",void0),(0,z.Z)(this,"pattern",void0),this.unit=t,this.id=Date.now(),this.canVibrate=!!this.unit.vibrationActuator,this.isVibrating=!1,this.pattern=[]}update(){constt=navigator.getGamepads();this.unit=t[this.unit.index]}reset(){this.isVibrating=!1,this.unit.vibrationActuator.reset()}asyncvibrate(t){this.isVibrating=!0,this.pattern=t;while(!0===this.isVibrating)for(lett=0;t<this.pattern.length;t++){if(!0!==this.isVibrating)return;this.unit.vibrationActuator.playEffect("dual-rumble",this.pattern[t]),awaitthis.sleep(this.pattern[t].startDelay+this.pattern[t].duration)}}sleep(t){returnnewPromise((e=>setTimeout(e,t)))}}varT=N,$=(0,i.aZ)({name:"WaveloversApp",components:{PatternList:Z,GamepadList:L,MessageItem:W},data:()=>({gamepads:[],patterns:[],isActive:!1,mode:0}),methods:{loadPatterns:asyncfunction(){constt="https://wavelovers.ru/assets/patterns.json";try{conste=awaitfetch(t);if(e.ok){lett=awaite.json();this.patterns=t}elseconsole.log("Connect to the Internet for download more patterns...")}catch(e){console.log(e)}},addEventListeners(){window.addEve