parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;cscreen.availWidth&&!document.body.classList.contains("ignore-landscape-warning"))return e=setInterval(function(){(screen.availHeight0&&t(n.pop())},1e3)},1e4)}else n.push(a)}function a(e){var n=document.createElement("div");n.className="notification-content";var a=document.createElement("p");a.innerHTML=e,n.appendChild(a);var i=document.createElement("i");i.className="alert fas fa-exclamation-triangle",n.appendChild(i),t([i,n])}function i(e){var n=document.createElement("div");n.className="notification-content";var a=document.createElement("p");a.innerHTML=e,n.appendChild(a);var i=document.createElement("i");i.className="warning fas fa-exclamation-triangle",n.appendChild(i),t([i,n])}function c(e){var n=document.createElement("div");n.className="notification-content";var a=document.createElement("p");a.innerHTML=e,n.appendChild(a);var i=document.createElement("i");i.className="info fas fa-info-circle",n.appendChild(i),t([i,n])}function o(e){var n=document.createElement("div");n.className="notification-content";var a=document.createElement("p");a.innerHTML=e,n.appendChild(a);var i=document.createElement("i");i.className="success fas fa-check-circle",n.appendChild(i),t([i,n])} },{}],"COPm":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.uBitBLE=exports.MESEvents=void 0;var e=require("./notification");function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){r(e,t),t.add(e)}function r(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function o(e,t,n){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return n}function i(){i=function(){return e};var e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(C){l=function(e,t,n){return e[t]=n}}function f(e,t,n,r){var i=t&&t.prototype instanceof d?t:d,a=Object.create(i.prototype),c=new T(r||[]);return o(a,"_invoke",{value:S(e,n,c)}),a}function v(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(C){return{type:"throw",arg:C}}}e.wrap=f;var h={};function d(){}function p(){}function y(){}var g={};l(g,c,function(){return this});var b=Object.getPrototypeOf,_=b&&b(b(P([])));_&&_!==n&&r.call(_,c)&&(g=_);var w=y.prototype=d.prototype=Object.create(g);function m(e){["next","throw","return"].forEach(function(t){l(e,t,function(e){return this._invoke(t,e)})})}function E(e,n){var i;o(this,"_invoke",{value:function(o,a){function c(){return new n(function(i,c){!function o(i,a,c,u){var s=v(e[i],e,a);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==t(f)&&r.call(f,"__await")?n.resolve(f.__await).then(function(e){o("next",e,c,u)},function(e){o("throw",e,c,u)}):n.resolve(f).then(function(e){l.value=e,c(l)},function(e){return o("throw",e,c,u)})}u(s.arg)}(o,a,i,c)})}return i=i?i.then(c,c):c()}})}function S(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return U()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var c=x(a,n);if(c){if(c===h)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=v(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function x(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),h;var o=v(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,h;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function D(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(D,this),this.reset(!0)}function P(e){if(e){var t=e[c];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:P(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},e}function a(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(s){return void n(s)}c.done?t(u):Promise.resolve(u).then(r,o)}function c(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(e){a(i,r,o,c,u,"next",e)}function u(e){a(i,r,o,c,u,"throw",e)}c(void 0)})}}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}function s(e,t){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function l(e){var t=h();return function(){var n,r=d(e);if(t){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return f(this,n)}}function f(e,n){if(n&&("object"===t(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return v(e)}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y(e,t){for(var n=0;n1&&void 0!==o[1])||o[1],r=new TextEncoder,e.prev=2,e.next=5,this.uartRx.writeValue(r.encode(t));case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(2),n||console.error(e.t0);case 10:case"end":return e.stop()}},e,this,[[2,7]])}));return function(t){return e.apply(this,arguments)}}()},{key:"onUartTx",value:function(e){this.handlers.push(e)}}],[{key:"getService",value:function(){var e=c(i().mark(function e(t){var n,a,c,u=this;return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return console.debug("Getting UartService"),e.next=3,t.getPrimaryService(r.SERVICE_UUID);case 3:return n=e.sent,console.debug("Getting Uart characteristics"),e.next=7,n.getCharacteristic(E);case 7:return a=e.sent,e.next=10,a.startNotifications();case 10:return e.next=12,a.addEventListener("characteristicvaluechanged",function(e){o(u,N,A).call(u,e)});case 12:return e.next=14,n.getCharacteristic(S);case 14:return c=e.sent,e.abrupt("return",new r(n,a,c));case 16:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()}]),r}();function A(e){for(var t=0;tt.length)&&(e=t.length);for(var i=0,n=new Array(e);i1&&void 0!==arguments[1])||arguments[1];["end","cancel"].includes(t.type)&&this.touchCount--;var i="start"==t.type;i!==this.isActive&&0==this.touchCount&&(this.isActive=i,e&&this.gamepad.handleTouchEventCallbacks(this.createTouchEventObject(this.isActive?"touchstart":"touchend"))),"start"==t.type&&this.touchCount++}},{key:"createTouchEventObject",value:function(t){return{id:this.id,action:t,type:this.type}}}]),i}(),L=function(t){n(i,D);var e=s(i);function i(t){var n;v(this,i);var a=Object.assign({keyboardButton:null,altText:null,altTextAlign:"left",shape:"round"},t);return k(o(n=e.call(this,t)),"shape",void 0),k(o(n),"altText",void 0),k(o(n),"altTextAlign",void 0),k(o(n),"type","GamepadButton"),n.keyboardButton=a.keyboardButton,n.shape=a.shape,n.altText=a.altText,n.altTextAlign=a.altTextAlign,n}return b(i,[{key:"init",value:function(){null!==this.keyboardButton&&this.gamepad.registerKeybinding(this.keyboardButton,this)}},{key:"draw",value:function(t){if(this.path=new Path2D,"round"===this.shape)this.path.arc(this.getX(t),this.getY(t),10*this.getScaleY(t),0,4*Math.PI,!0);else if("square"===this.shape){var e=20*this.getScaleY(t);this.path.rect(this.getX(t)-e/2,this.getY(t)-e/2,e,e)}this.isActive?t.fillStyle="rgba(80, 80, 80, 1)":t.fillStyle="rgba(100, 100, 100, 0.8)",t.fill(this.path);var i="".concat(Math.floor((8*this.getScaleY(t)).toString()),"px 'Press Start 2P'");if(t.font=i,t.textBaseline="middle",t.textAlign="center",t.fillStyle="rgba(255, 255, 255, 1)",t.fillText(this.id,this.getX(t),this.getY(t)),null!==this.altText&&this.gamepad.showAltText){t.beginPath(),t.font="".concat(Math.floor((3*this.getScaleY(t)).toString()),"px 'Press Start 2P'"),t.textBaseline="middle",t.textAlign="center",t.fillStyle="rgba(150, 150, 150, 1)";var n=this.getX(t),a=this.getY(t);switch(this.altTextAlign){case"left":n-=13*this.getScaleY(t);break;case"right":n+=13*this.getScaleY(t);break;case"top":a-=13*this.getScaleY(t);break;case"bottom":a+=13*this.getScaleY(t)}t.fillText(this.altText,n,a)}}}]),i}();exports.GamepadButton=L;var K=new WeakMap,q=new WeakMap,W=new WeakMap,G=function(t){n(a,D);var i=s(a);function a(t){var e;v(this,a);var n=Object.assign({lockX:!1,lockY:!1,autoCenter:!0,bindUp:null,bindLeft:null,bindRight:null,bindDown:null},t);return k(o(e=i.call(this,t)),"type","GamepadJoystick"),k(o(e),"mouseX",0),k(o(e),"mouseY",0),k(o(e),"cR",0),k(o(e),"cX",0),k(o(e),"cY",0),w(o(e),K,{writable:!0,value:void 0}),w(o(e),q,{writable:!0,value:void 0}),w(o(e),W,{writable:!0,value:{}}),X(o(e),K,n.lockX),X(o(e),q,n.lockY),e.bindUp=n.bindUp,e.bindLeft=n.bindLeft,e.bindRight=n.bindRight,e.bindDown=n.bindDown,e}return b(a,[{key:"init",value:function(){null!==this.bindUp&&this.gamepad.registerKeybinding(this.bindUp,this),null!==this.bindLeft&&this.gamepad.registerKeybinding(this.bindLeft,this),null!==this.bindRight&&this.gamepad.registerKeybinding(this.bindRight,this),null!==this.bindDown&&this.gamepad.registerKeybinding(this.bindDown,this)}},{key:"isKeyPressed",value:function(t){return null!==t&&Y(this,W).hasOwnProperty(t)&&Y(this,W)[t]>0}},{key:"createTouchEventObject",value:function(t){return{id:this.id,action:t,type:this.type,x:Math.round(this.mouseX/this.cR*100),y:Math.round(this.mouseY/this.cR*100)}}},{key:"setActive",value:function(t){e(l(a.prototype),"setActive",this).call(this,t,!1),t.hasOwnProperty("key")&&(Y(this,W).hasOwnProperty(t.key)||(Y(this,W)[t.key]=0),["start"].includes(t.type)&&Y(this,W)[t.key]++,["end","cancel"].includes(t.type)&&Y(this,W)[t.key]--);var i=this.cR;Y(this,K)||(t.hasOwnProperty("x")&&(this.mouseX=this.cX-this.gamepad.stage.screenToCanvasX(t.x),this.mouseX=Math.min(Math.abs(this.mouseX),i)*Math.sign(this.mouseX),this.mouseX*=-1),this.isKeyPressed(this.bindLeft)&&(this.mouseX=-i),this.isKeyPressed(this.bindRight)&&(this.mouseX=i),this.isKeyPressed(this.bindLeft)&&this.isKeyPressed(this.bindRight)&&(this.mouseX=0),this.isActive||(this.mouseX=0)),Y(this,q)||(t.hasOwnProperty("y")&&(this.mouseY=this.cY-this.gamepad.stage.screenToCanvasY(t.y),this.mouseY=Math.min(Math.abs(this.mouseY),i)*Math.sign(this.mouseY)),this.isKeyPressed(this.bindUp)&&(this.mouseY=i),this.isKeyPressed(this.bindDown)&&(this.mouseY=-i),this.isKeyPressed(this.bindUp)&&this.isKeyPressed(this.bindDown)&&(this.mouseY=0),this.isActive||(this.mouseY=0));var n="touchmove";this.isActive&&1==this.touchCount&&"start"===t.type&&(n="touchstart"),this.isActive||(n="touchend"),this.gamepad.handleTouchEventCallbacks(this.createTouchEventObject(n))}},{key:"draw",value:function(t){this.cX=this.getX(t),this.cY=this.getY(t),this.cR=25*this.getScaleY(t),this.path=new Path2D,this.path.arc(this.cX,this.cY,this.cR,0,4*Math.PI,!0),this.isActive?t.fillStyle="rgba(85, 85, 85, 0.8)":t.fillStyle="rgba(100, 100, 100, 0.8)",t.fill(this.path),t.beginPath(),t.arc(this.cX+this.mouseX,this.cY-this.mouseY,15*this.getScaleY(t),0,4*Math.PI,!0),t.fillStyle="rgba(130, 130, 130, 1)",t.fill()}}]),a}();exports.GamepadJoystick=G;var U=new WeakMap,_=new WeakMap,z=new WeakMap,V=new WeakMap,J=new WeakMap,H=new WeakMap,N=function(){function t(){v(this,t),k(this,"stage",void 0),w(this,U,{writable:!0,value:void 0}),w(this,_,{writable:!0,value:void 0}),w(this,z,{writable:!0,value:{}}),w(this,V,{writable:!0,value:{}}),w(this,J,{writable:!0,value:{}}),w(this,H,{writable:!0,value:[]}),k(this,"showDebug",!1),k(this,"showAltText",!0),k(this,"enableVibration",!0),this.stage=new I("GamePad",document.querySelector(".gamepad-wrapper")),this.addEventListeners()}return b(t,[{key:"addEventListeners",value:function(){var t=this,e=["keydown","keyup"];for(var i in e)document.addEventListener(e[i],function(e){return t.handleKeyEvent(e)},!1);for(var i in e=["touchstart","touchend","touchcancel","touchmove"])this.stage.canvas.addEventListener(e[i],function(e){return t.handleTouchEvent(e)},!1);for(var i in e=["mousedown","mouseup","mousemove"])this.stage.canvas.addEventListener(e[i],function(e){return t.handleMouseEvent(e)},!1)}},{key:"registerKeybinding",value:function(t,e){Y(this,V)[t]=e}},{key:"handleKeyEvent",value:function(t){if(Y(this,J).hasOwnProperty(t.keyCode)||(Y(this,J)[t.keyCode]={pressed:!1}),Y(this,V).hasOwnProperty(t.key)){var e="Key ".concat(t.key),i=Y(this,V)[t.key],n={touchId:e,key:t.key,type:{keydown:"start",keyup:"end"}[t.type]};switch(t.type){case"keydown":if(Y(this,J)[t.keyCode].pressed)return;Y(this,J)[t.keyCode].pressed=!0,Y(this,z)[e]={},Y(this,z)[e].target=i,Y(this,z)[e].hasOwnProperty("target")&&null!=Y(this,z)[e].target&&Y(this,z)[e].target.setActive(n);break;case"keyup":if(!Y(this,J)[t.keyCode].pressed)return;Y(this,J)[t.keyCode].pressed=!1,Y(this,z)[e].hasOwnProperty("target")&&null!=Y(this,z)[e].target&&Y(this,z)[e].target.setActive(n),delete Y(this,z)[e]}}this.stage.touches=Y(this,z),this.debugTouches()}},{key:"handleMouseEvent",value:function(t){this.processGamepadTouchEvent({x:t.clientX,y:t.clientY,touchId:"mouse",type:{mousedown:"start",mouseup:"end",mousemove:"move"}[t.type]})}},{key:"handleTouchEvent",value:function(t){t.preventDefault();for(var e={touchstart:"start",touchend:"end",touchcancel:"end",touchmove:"move"},i=0;it.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(c&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:P(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function y(t,e,r,n,o,a,i){try{var c=t[a](i),u=c.value}catch(l){return void r(l)}c.done?e(u):Promise.resolve(u).then(n,o)}function p(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){y(a,n,o,i,c,"next",t)}function c(t){y(a,n,o,i,c,"throw",t)}i(void 0)})}}var m="service-worker.js";navigator.serviceWorker&&navigator.serviceWorker.register(m,{scope:"/microbit-gamepad/"}).then(function(t){t.onupdatefound=function(){var r=t.installing;null!=r&&(r.onstatechange=function(){"installed"===r.state&&(navigator.serviceWorker.controller?(0,e.notif_info)("New content is available, relaunch the app to install it."):(0,e.notif_success)("Content is cached for offline use."))})},t.update()}).catch(function(t){(0,e.notif_warn)("Could not install service worker..."),console.error("Error during service worker registration:",t)}),document.getElementById("btn_ignore_landscape_warning").addEventListener("click",function(){document.body.classList.add("ignore-landscape-warning")}),navigator.bluetooth||(console.error("You do not have a bluetooth enabled browser, you need to have a bluetooth enabled browser..."),(0,e.notif_alert)("Your browser does not seem to support bluetooth, try using Google Chrome or Microsoft Edge."));var b=new r.Gamepad;window.gamepad=b;var w=new t.uBitBLE;window.ubit=w,document.querySelector(".settings-dialog #layout").addEventListener("change",function(t){b.setGamepadLayout(t.target.value),localStorage.setItem("gamepadLayout",t.target.value),document.querySelector(".button-states pre").innerHTML="No buttons pressed yet"}),null===localStorage.getItem("gamepadLayout")&&localStorage.setItem("gamepadLayout","1"),b.setGamepadLayout(localStorage.getItem("gamepadLayout")),document.querySelector(".button-states pre").innerHTML="No buttons pressed yet",document.querySelector(".settings-dialog #layout").value=localStorage.getItem("gamepadLayout"),document.querySelector(".settings-dialog #show-touches").addEventListener("change",function(t){b.stage.showTouches=t.target.checked,localStorage.setItem("showTouches",t.target.checked)}),null===localStorage.getItem("showTouches")&&localStorage.setItem("showTouches",!1),b.stage.showTouches="true"==localStorage.getItem("showTouches"),document.querySelector(".settings-dialog #show-touches").checked="true"==localStorage.getItem("showTouches"),document.querySelector(".settings-dialog #show-gamepad-alt-text").addEventListener("change",function(t){b.showAltText=t.target.checked,localStorage.setItem("showAltText",t.target.checked)}),null===localStorage.getItem("showAltText")&&localStorage.setItem("showAltText",!1),b.showAltText="true"==localStorage.getItem("showAltText"),document.querySelector(".settings-dialog #show-gamepad-alt-text").checked="true"==localStorage.getItem("showAltText"),document.querySelector(".settings-dialog #enable-haptic").addEventListener("change",function(t){b.enableVibration=t.target.checked,localStorage.setItem("enableHaptic",t.target.checked)}),null===localStorage.getItem("enableHaptic")&&localStorage.setItem("enableHaptic",!0),b.enableVibration="true"==localStorage.getItem("enableHaptic"),document.querySelector(".settings-dialog #enable-haptic").checked="true"==localStorage.getItem("enableHaptic"),document.querySelector(".settings-dialog #enable-debug").addEventListener("change",function(t){b.showDebug=t.target.checked,t.target.checked?document.body.classList.add("debug"):document.body.classList.remove("debug"),localStorage.setItem("enableDebug",t.target.checked)}),null===localStorage.getItem("enableDebug")&&localStorage.setItem("enableDebug",!1),b.showDebug="true"==localStorage.getItem("enableDebug"),"true"===localStorage.getItem("enableDebug")?document.body.classList.add("debug"):document.body.classList.remove("debug"),document.querySelector(".settings-dialog #enable-debug").checked="true"==localStorage.getItem("enableDebug"),document.querySelector("#btn_show_settings").addEventListener("click",function(){document.querySelector(".settings-dialog").classList.add("shown")}),document.querySelector("#btn_hide_settings").addEventListener("click",function(){document.querySelector(".settings-dialog").classList.remove("shown")}),document.querySelector("#btn_disconnect").addEventListener("click",function(){w.disconnect()}),document.getElementById("btn_connect").addEventListener("click",p(v().mark(function t(){return v().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return navigator.bluetooth||(0,e.notif_alert)("You need a bluetooth enabled browser for this app to work, try chrome."),t.prev=1,t.next=4,w.searchDevice();case 4:t.next=9;break;case 6:t.prev=6,t.t0=t.catch(1),(0,e.notif_alert)("Could not connect to device: ".concat(t.t0,"."));case 9:case"end":return t.stop()}},t,null,[[1,6]])})));var S={};b.onTouchEvent(function(t){["touchstart","touchmove"].includes(t.action)&&(S[t.id]=d({state:!0},t)),["touchend"].includes(t.action)&&(S[t.id]=d({state:!1},t));for(var e="",r=0,n=Object.entries(S);r1&&(E=0)},20); },{"./uBit":"COPm","./notification":"SiMs","./gamepad":"W7Xq"}]},{},["d6sW"], null) //# sourceMappingURL=/microbit-gamepad/main.6a141175.js.map