(function(){"use strict";var t={3935:function(t,e,n){var a=n(9242),i=n(3396);const r={class:"wavelovers"},s=(0,i.Uk)("Press any gamepad button or connect a new gamepad to vibrate.");function o(t,e,n,a,o,c){const u=(0,i.up)("NavigationList"),d=(0,i.up)("router-view"),p=(0,i.up)("GamepadList"),m=(0,i.up)("MessageItem");return(0,i.wg)(),(0,i.iD)("div",r,[(0,i.Wm)(u),(0,i.Wm)(d),t.gamepads.length>0?((0,i.wg)(),(0,i.j4)(p,{key:0,gamepads:t.gamepads},null,8,["gamepads"])):((0,i.wg)(),(0,i.j4)(m,{key:1},{default:(0,i.w5)((()=>[s])),_:1}))])}var c=n(1746);const u={class:"content-item navigation-list"},d=(0,i.Uk)("Manual"),p=(0,i.Uk)("Patterns");function m(t,e,n,a,r,s){const o=(0,i.up)("router-link");return(0,i.wg)(),(0,i.iD)("div",u,[(0,i.Wm)(o,{to:"/manual",class:"navigation-item"},{default:(0,i.w5)((()=>[d])),_:1}),(0,i.Wm)(o,{to:"/",class:"navigation-item"},{default:(0,i.w5)((()=>[p])),_:1})])}var l=(0,i.aZ)({name:"NavigationList"}),f=n(89);const v=(0,f.Z)(l,[["render",m]]);var g=v,h=n(7139);const w={class:"content-item device-list"};function b(t,e,n,a,r,s){const o=(0,i.up)("GamepadItem");return(0,i.wg)(),(0,i.iD)("div",w,[((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))])}const y={class:"list-item"};function A(t,e,n,a,r,s){return(0,i.wg)(),(0,i.iD)("div",y)}var Z=(0,i.aZ)({name:"GamepadItem"});const C=(0,f.Z)(Z,[["render",A]]);var k=C,P=(0,i.aZ)({name:"GamepadList",props:{gamepads:{type:Array}},components:{GamepadItem:k}});const _=(0,f.Z)(P,[["render",b]]);var E=_;const L={class:"content-item message"};function j(t,e,n,a,r,s){return(0,i.wg)(),(0,i.iD)("div",L,[(0,i._)("span",null,[(0,i.WI)(t.$slots,"default")])])}var I=(0,i.aZ)({name:"MessageItem"});const x=(0,f.Z)(I,[["render",j]]);var G=x,M=(0,i.aZ)({name:"App",components:{NavigationList:g,GamepadList:E,MessageItem:G},computed:{gamepads:function(){return c.Z.getters.gamepads}},methods:{addEventListeners(){window.addEventListener("gamepadconnected",(t=>c.Z.dispatch("addGamepad",t))),window.addEventListener("gamepaddisconnected",(t=>c.Z.dispatch("deleteGamepad",t)))},removeEventListeners(){window.removeEventListener("gamepadconnected",(t=>c.Z.dispatch("addGamepad",t))),window.removeEventListener("gamepaddisconnected",(t=>c.Z.dispatch("deleteGamepad",t)))}},mounted(){this.addEventListeners()},unmounted(){this.removeEventListeners()}});const O=(0,f.Z)(M,[["render",o]]);var D=O,N=n(2483);function T(t,e,n,a,r,s){const o=(0,i.up)("AppPatterns");return(0,i.wg)(),(0,i.j4)(o)}const S={class:"app-patterns"},V=(0,i.Uk)("Loading...");function B(t,e,n,a,r,s){const o=(0,i.up)("PatternList"),c=(0,i.up)("MessageItem");return(0,i.wg)(),(0,i.iD)("div",S,[t.patterns.length>0?((0,i.wg)(),(0,i.j4)(o,{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)(c,{key:1},{default:(0,i.w5)((()=>[V])),_:1}))])}const U={class:"content-item pattern-list"};function W(t,e,n,a,r,s){const o=(0,i.up)("PatternItem");return(0,i.wg)(),(0,i.iD)("div",U,[((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))])}const z=["textContent"],F={class:"pattern-item__info-container"},H=["textContent"],K=["textContent"];function $(t,e,n,a,r,s){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,z),(0,i._)("div",F,[(0,i._)("span",{class:"pattern-item__name",textContent:(0,h.zw)(t.pattern.name)},null,8,H),(0,i._)("span",{class:"pattern-item__type",textContent:(0,h.zw)(t.pattern.type)},null,8,K)])],2)}var q=(0,i.aZ)({name:"PatternItem",props:{pattern:{type:Object},index:{type:Number},mode:{type:Number},isActive:{type:Boolean}},methods:{change:function(t){this.$emit("change",t)}}});const Y=(0,f.Z)(q,[["render",$]]);var J=Y,Q=(0,i.aZ)({name:"PatternList",props:{patterns:{type:Array},mode:{type:Number},isActive:{type:Boolean}},components:{PatternItem:J},methods:{change:function(t){this.$emit("change",t)}}});const R=(0,f.Z)(Q,[["render",W]]);var X=R,tt=(0,i.aZ)({name:"AppPatterns",components:{PatternList:X,MessageItem:G},computed:{patterns:function(){return c.Z.getters.patterns},mode:function(){return c.Z.getters.mode},isActive:function(){return c.Z.getters.isActive}},methods:{change(t){c.Z.dispatch("change",t)}},mounted(){c.Z.dispatch("loadPatterns")}});const et=(0,f.Z)(tt,[["render",B]]);var nt=et,at=(0,i.aZ)({name:"PatternsView",components:{AppPatterns:nt}});const it=(0,f.Z)(at,[["render",T]]);var rt=it;const st=[{path:"/",name:"patterns-view",component:rt},{path:"/manual",name:"manual-view",component:()=>n.e(46).then(n.bind(n,9046))},{path:"/404",name:"404",component:()=>n.e(567).then(n.bind(n,7567))},{path:"/:catchAll(.*)",redirect:"/404"}],ot=(0,N.p7)({history:(0,N.PO)("/"),routes:st});var ct=ot;(0,a.ri)(D).use(c.Z).use(ct).mount("#app")},1746:function(t,e,n){n.d(e,{Z:function(){return m}});var a=n(65),i=n(2482);class r{constructor(t){(0,i.Z)(this,"id",void 0),(0,i.Z)(this,"canVibrate",void 0),(0,i.Z)(this,"isVibrating",void 0),(0,i.Z)(this,"unit",void 0),(0,i.Z)(this,"pattern",void 0),this.unit=t,this.id=Date.now(),this.canVibrate=!!this.unit.vibrationActuator,this.isVibrating=!1,this.pattern=[]}update(){const t=navigator.getGamepads();this.unit=t[this.unit.index]}reset(){this.isVibrating=!1,this.unit.vibrationActuator.reset()}async vibrate(t){this.isVibrating=!0,this.pattern=t;while(!0===this.isVibrating)for(let t=0;tsetTimeout(e,t)))}}var s=r;const o={state:()=>({gamepads:[]}),getters:{gamepads:function(t){return t.gamepads}},mutations:{addGamepad:function(t,e){t.gamepads.push(e)},deleteGamepad:function(t,e){t.gamepads.splice(e,1)}},actions:{addGamepad:function(t,e){const n=e;t.getters.gamepads.length>=1||t.commit("addGamepad",new s(n.gamepad))},deleteGamepad:function(t,e){t.getters.gamepads.forEach(((n,a)=>{n.unit.id===e.gamepad.id&&t.commit("deleteGamepad",a)}))},vibrate:function(t,e){t.getters.gamepads.forEach((t=>{t.vibrate(e)}))},reset:function(t){t.getters.gamepads.forEach((t=>{t.reset()}))}}};var c=o;const u={state:()=>({patterns:[]}),getters:{patterns:function(t){return t.patterns}},mutations:{setPatterns:function(t,e){t.patterns=e}},actions:{loadPatterns:async function(t){const e="https://wavelovers.ru/assets/patterns.json";try{const n=await fetch(e);if(n.ok){const e=await n.json();t.commit("setPatterns",e)}else console.log("Connect to the Internet for download more patterns...")}catch(n){console.log(n)}}}};var d=u;const p=(0,a.MT)({state:()=>({mode:0,isActive:!1}),getters:{mode:function(t){return t.mode},isActive:function(t){return t.isActive}},mutations:{setMode:function(t,e){t.mode=e},setIsActive:function(t,e){t.isActive=e}},actions:{setMode:function(t,e){t.commit("setMode",e)},setIsActive:function(t,e){t.commit("setIsActive",e)},change:function(t,e){t.getters.mode===e?t.dispatch("setIsActive",!t.getters.isActive):(t.dispatch("setIsActive",!0),t.dispatch("setMode",e)),!0===t.getters.isActive?(t.dispatch("reset"),t.dispatch("vibrate",t.getters.patterns[t.getters.mode].pattern)):t.dispatch("reset")},startCustom:function(t,e){t.dispatch("setIsActive",!1),t.dispatch("setMode",0),t.dispatch("reset"),t.dispatch("vibrate",e)}},modules:{MGamepads:c,MPatterns:d}});var m=p}},e={};function n(a){var i=e[a];if(void 0!==i)return i.exports;var r=e[a]={exports:{}};return t[a](r,r.exports,n),r.exports}n.m=t,function(){var t=[];n.O=function(e,a,i,r){if(!a){var s=1/0;for(d=0;d=r)&&Object.keys(n.O).every((function(t){return n.O[t](a[c])}))?a.splice(c--,1):(o=!1,r0&&t[d-1][2]>r;d--)t[d]=t[d-1];t[d]=[a,i,r]}}(),function(){n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,{a:e}),e}}(),function(){n.d=function(t,e){for(var a in e)n.o(e,a)&&!n.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:e[a]})}}(),function(){n.f={},n.e=function(t){return Promise.all(Object.keys(n.f).reduce((function(e,a){return n.f[a](t,e),e}),[]))}}(),function(){n.u=function(t){return"js/"+t+"."+{46:"fc8b758b",567:"a8d77486"}[t]+".js"}}(),function(){n.miniCssF=function(t){return"css/"+t+".30c3638a.css"}}(),function(){n.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"===typeof window)return window}}()}(),function(){n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}}(),function(){var t={},e="wavelovers:";n.l=function(a,i,r,s){if(t[a])t[a].push(i);else{var o,c;if(void 0!==r)for(var u=document.getElementsByTagName("script"),d=0;d