fyogametable
Version:
Fyo Game Table API
2 lines • 74.4 kB
JavaScript
var FYO=FYO||{};!function(){"use strict";function A(A,e){e=e||{},this.connector=A,this.element=null,this.camera=null,this.scene=null,this.renderer=null,this.mouseX=0,this.mouseY=0,this.windowHalfX=window.innerWidth/2,this.windowHalfY=window.innerHeight/2,this.thumbObj=null,this.events=new FYO.EventManager,e.ondown&&this.events.on("down",e.ondown),e.onup&&this.events.on("up",e.onup),navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate||function(){},this.Init(e||{color:2236962})}A.prototype={element:null,camera:null,scene:null,renderer:null,mouseX:0,mouseY:0,windowHalfX:window.innerWidth/2,windowHalfY:window.innerHeight/2,thumbObj:null,events:null,on:function(A,e){return this.events.on(A,e)},remove:function(A,e){return this.events.remove(A,e)},clear:function(A){return this.events.clear(A)},Set:function(A,e,t,n){this.positioner.Set(A,e,t,n),this.onWindowResize()},SetAlign:function(A,e){this.positioner.align.horizontal=A,this.positioner.align.vertical=e},Reposition:function(A,e,t,n){this.onWindowResize(A,e,t,n)},Init:function(A){var e=this;this.element=document.createElement("div"),this.positioner=new FYO.Positioner(this.element),this.element.setAttribute("style","position: absolute; top: 0; left: 0; right: 100%; bottom: 0;");var t=document.body;A.container&&(t=document.getElementById(A.container)),t.appendChild(this.element),this.image=document.createElement("div");var n="background: url('"+(A.image||"/fyogametable/imgs/Red_A.png")+"') no-repeat center center;";n+="background-size: contain; width: 100%; height: 100%;",this.image.setAttribute("style",n),this.element.appendChild(this.image),this.element.addEventListener("mousemove",function(A){e.onMouseMove(A)},!1),this.element.addEventListener("mousedown",function(A){e.onMouseDown(A)},!1),this.element.addEventListener("mouseup",function(A){e.onMouseUp(A)},!1),this.element.addEventListener("mouseleave",function(A){e.onMouseLeave(A)},!1),this.element.addEventListener("touchmove",function(A){e.onTouchMove(A)},!1),this.element.addEventListener("touchstart",function(A){e.onTouchStart(A)},!1),this.element.addEventListener("touchend",function(A){e.onTouchDone(A)},!1),window.addEventListener("resize",function(A){e.onWindowResize(A)},!1)},onWindowResize:function(){this.elementHalfX=this.element.clientWidth/2,this.elementHalfY=this.element.clientHeight/2},onMouseMove:function(A){A.preventDefault(),this.mouseX=A.offsetX,this.mouseY=A.offsetY},onMouseDown:function(A){A.preventDefault(),this.mouseDown=!0,this.events.trigger("down",!0)},onMouseUp:function(A){A.preventDefault(),this.mouseDown=!1,this.events.trigger("up",!0)},onMouseLeave:function(A){A.preventDefault(),this.mouseX=this.elementHalfX,this.mouseY=this.elementHalfY},onTouchStart:function(){navigator.vibrate(10),this.mouseDown=!0,this.events.trigger("down",!0)},onTouchMove:function(A){A.preventDefault();for(var e=this.element.getBoundingClientRect(),t=0;t<A.touches.length;t++){var n=A.touches[t];n.pageX>=e.left&&n.pageX<=e.right&&n.pageY>=e.top&&n.pageY<=e.bottom&&(this.mouseX=n.pageX-e.left,this.mouseY=n.pageY-e.top)}},onTouchDone:function(A){A.preventDefault(),this.mouseX=this.elementHalfX,this.mouseY=this.elementHalfY,this.mouseDown=!1,this.events.trigger("up",!0)}},FYO.Button2D=A}();var FYO=FYO||{};!function(){"use strict";function A(A,e){e=e||{},this.connector=A,this.element=null,this.camera=null,this.scene=null,this.renderer=null,this.mouseX=0,this.mouseY=0,this.windowHalfX=window.innerWidth/2,this.windowHalfY=window.innerHeight/2,this.thumbObj=null,this.events=new FYO.EventManager,e.ondown&&this.events.on("down",e.ondown),e.onup&&this.events.on("up",e.onup),navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate||function(){},this.Init(e||{color:2236962})}A.prototype={element:null,camera:null,scene:null,renderer:null,mouseX:0,mouseY:0,windowHalfX:window.innerWidth/2,windowHalfY:window.innerHeight/2,thumbObj:null,events:null,on:function(A,e){return this.events.on(A,e)},remove:function(A,e){return this.events.remove(A,e)},clear:function(A){return this.events.clear(A)},Set:function(A,e,t,n){this.positioner.Set(A,e,t,n),this.onWindowResize()},SetAlign:function(A,e){this.positioner.align.horizontal=A,this.positioner.align.vertical=e},Reposition:function(A,e,t,n){this.onWindowResize(A,e,t,n)},Init:function(A){var e=this;this.element=document.createElement("div"),this.positioner=new FYO.Positioner(this.element),this.element.setAttribute("style","position: absolute; top: 0; left: 0; right: 100%; bottom: 0;");var t=document.body;A.container&&(t=document.getElementById(A.container)),t.appendChild(this.element),this.scene=new THREE.Scene;var n=new THREE.AmbientLight(1052720);this.scene.add(n);var i=new THREE.DirectionalLight(16772829);i.position.set(1,10,1),this.scene.add(i),this.camera=new THREE.PerspectiveCamera(45,this.element.clientWidth/this.element.clientHeight,1,2e3),this.camera.position.y=3.3,this.camera.position.z=1,this.camera.lookAt(this.scene.position);var o=new THREE.LoadingManager;o.onProgress=function(){};var s=function(){},a=function(){},r=new THREE.OBJLoader(o);if(A.color)r.load(A.model||"/fyogametable/assets/objs/Button.obj",function(t){t.traverse(function(e){console.log(e),e instanceof THREE.Mesh&&(e.material.color=new THREE.Color(A.color||2232593))}),t.position.y=0,e.thumbObj=t,e.scene.add(t),e.Render()},s,a);else if(A.image){var l=new THREE.Texture,h=new THREE.ImageLoader(o);h.load(A.image||"/fyogametable/imgs/Red_A.png",function(A){l.image=A,l.needsUpdate=!0,e.Render()}),r.load(A.model||"/fyogametable/assets/objs/ButtonTex.obj",function(A){A.traverse(function(A){A instanceof THREE.Mesh&&(A.material.map=l)}),A.position.y=0,e.thumbObj=A,e.scene.add(A),e.Render()},s,a)}this.renderer=new THREE.WebGLRenderer({alpha:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(this.element.clientWidth,this.element.clientHeight),this.renderer.setClearColor(0,0),this.element.appendChild(this.renderer.domElement),this.element.addEventListener("mousemove",function(A){e.onMouseMove(A)},!1),this.element.addEventListener("mousedown",function(A){e.onMouseDown(A)},!1),this.element.addEventListener("mouseup",function(A){e.onMouseUp(A)},!1),this.element.addEventListener("mouseleave",function(A){e.onMouseLeave(A)},!1),this.element.addEventListener("touchmove",function(A){e.onTouchMove(A)},!1),this.element.addEventListener("touchstart",function(A){e.onTouchStart(A)},!1),this.element.addEventListener("touchend",function(A){e.onTouchDone(A)},!1),window.addEventListener("resize",function(A){e.onWindowResize(A)},!1),this.Render()},onWindowResize:function(){this.elementHalfX=this.element.clientWidth/2,this.elementHalfY=this.element.clientHeight/2,this.camera.aspect=this.elementHalfX/this.elementHalfY,this.camera.updateProjectionMatrix(),this.renderer.setSize(this.element.clientWidth,this.element.clientHeight),this.Render()},onMouseMove:function(A){A.preventDefault(),this.mouseX=A.offsetX,this.mouseY=A.offsetY,this.Render()},onMouseDown:function(A){A.preventDefault(),this.mouseDown=!0,this.events.trigger("down",!0),this.Render()},onMouseUp:function(A){A.preventDefault(),this.mouseDown=!1,this.events.trigger("up",!0),this.Render()},onMouseLeave:function(A){A.preventDefault(),this.mouseX=this.elementHalfX,this.mouseY=this.elementHalfY,this.Render()},onTouchStart:function(){navigator.vibrate(10),this.mouseDown=!0,this.events.trigger("down",!0),this.Render()},onTouchMove:function(A){A.preventDefault();for(var e=this.element.getBoundingClientRect(),t=0;t<A.touches.length;t++){var n=A.touches[t];n.pageX>=e.left&&n.pageX<=e.right&&n.pageY>=e.top&&n.pageY<=e.bottom&&(this.mouseX=n.pageX-e.left,this.mouseY=n.pageY-e.top)}this.Render()},onTouchDone:function(A){A.preventDefault(),this.mouseX=this.elementHalfX,this.mouseY=this.elementHalfY,this.mouseDown=!1,this.events.trigger("up",!0),this.Render()},Render:function(){null!==this.thumbObj&&(this.thumbObj.scale.y=this.mouseDown?.75:1),this.renderer.render(this.scene,this.camera)}},FYO.Button3D=A}();var FYO=FYO||{};!function(){"use strict";function A(A,e){e=e||{},this.connector=A,this.element=null,this.camera=null,this.scene=null,this.renderer=null,this.mouseX=0,this.mouseY=0,this.windowHalfX=window.innerWidth/2,this.windowHalfY=window.innerHeight/2,this.thumbObj=null,this.x=0,this.y=0,this.events=new FYO.EventManager,e.onmoved&&this.events.on("moved",e.onmoved),navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate||function(){},this.Init(e)}A.prototype={element:null,camera:null,scene:null,renderer:null,mouseX:0,mouseY:0,windowHalfX:window.innerWidth/2,windowHalfY:window.innerHeight/2,thumbObj:null,events:null,on:function(A,e){return this.events.on(A,e)},remove:function(A,e){return this.events.remove(A,e)},clear:function(A){return this.events.clear(A)},Reposition:function(A,e,t,n){var i="position: absolute; top: "+e+"px;";i+="left: "+A+"px;",i+="right: "+(A+t)+"px;",i+="bottom: "+(e+n)+"px;",i+="width: "+t+"px;",i+="height: "+n+"px;",i+="padding: 30px;",this.element.setAttribute("style",i),this.onWindowResize()},Init:function(A){var e=this;this.element=document.createElement("div"),A.side?this.element.setAttribute("style","padding: 30px; position: absolute; top: 0; left: 50%; right: 0; bottom: 30%;"):this.element.setAttribute("style","padding: 30px; position: absolute; top: 0; left: 0; right: 50%; bottom: 0;");var t=document.body;A.container&&(t=document.getElementById(A.container)),t.appendChild(this.element),this.elementHalfX=this.element.clientWidth/2,this.elementHalfY=this.element.clientHeight/2,this.image=document.createElement("div");var n="background: url('"+(A.image||"/fyogametable/assets/imgs/DPad_2D.png")+"') no-repeat center center;";n+="background-size: contain; width: 100%; height: 100%;",this.image.setAttribute("style",n),this.element.appendChild(this.image),this.element.addEventListener("mousemove",function(A){e.onMouseMove(A)},!1),this.element.addEventListener("mouseleave",function(A){e.onMouseLeave(A)},!1),this.element.addEventListener("touchmove",function(A){e.onTouchMove(A)},!1),this.element.addEventListener("touchstart",function(A){e.onTouchStart(A)},!1),this.element.addEventListener("touchend",function(A){e.onTouchDone(A)},!1),window.addEventListener("resize",function(A){e.onWindowResize(A)},!1)},onWindowResize:function(){this.elementHalfX=this.element.clientWidth/2,this.elementHalfY=this.element.clientHeight/2},onMouseMove:function(A){A.preventDefault(),this.mouseX=A.offsetX,this.mouseY=A.offsetY,this._update()},onMouseLeave:function(A){A.preventDefault(),this.mouseX=this.elementHalfX,this.mouseY=this.elementHalfY,this._update()},onTouchStart:function(A){A.preventDefault(),navigator.vibrate(10);for(var e=this.element.getBoundingClientRect(),t=0;t<A.touches.length;t++){var n=A.touches[t];n.pageX>=e.left&&n.pageX<=e.right&&n.pageY>=e.top&&n.pageY<=e.bottom&&(this.mouseX=n.pageX-e.left,this.mouseY=n.pageY-e.top,this._update())}},onTouchMove:function(A){A.preventDefault();for(var e=this.element.getBoundingClientRect(),t=0;t<A.touches.length;t++){var n=A.touches[t];n.pageX>=e.left&&n.pageX<=e.right&&n.pageY>=e.top&&n.pageY<=e.bottom&&(this.mouseX=n.pageX-e.left,this.mouseY=n.pageY-e.top,this._update())}},onTouchDone:function(A){A.preventDefault(),this.mouseX=this.elementHalfX,this.mouseY=this.elementHalfY,this._update(),navigator.vibrate(10)},_update:function(){var A=this.x,e=this.y,t=(this.mouseY-this.elementHalfY)/this.elementHalfY,n=(this.mouseX-this.elementHalfX)/this.elementHalfX;this.x=-Math.sin(n),this.y=Math.sin(t);var i=Math.sqrt(this.x*this.x+this.y*this.y);i>1&&(this.x/=i,this.y/=i),Math.abs(this.y)>Math.abs(this.x)?(this.y=this.y>0?1:-1,this.x=0):Math.abs(this.x)>Math.abs(this.y)?(this.x=this.x>0?1:-1,this.y=0):(this.x=0,this.y=0),A==this.x&&e==this.y||navigator.vibrate(10),this.events.trigger("moved",{x:-this.x,y:-this.y})}},FYO.DPad2D=A}();var FYO=FYO||{};!function(){"use strict";function A(A,e){e=e||{},this.connector=A,this.element=null,this.camera=null,this.scene=null,this.renderer=null,this.mouseX=0,this.mouseY=0,this.windowHalfX=window.innerWidth/2,this.windowHalfY=window.innerHeight/2,this.thumbObj=null,this.x=0,this.y=0,this.events=new FYO.EventManager,e.onmoved&&this.events.on("moved",e.onmoved),navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate||function(){},this.Init(e)}A.prototype={element:null,camera:null,scene:null,renderer:null,mouseX:0,mouseY:0,windowHalfX:window.innerWidth/2,windowHalfY:window.innerHeight/2,thumbObj:null,events:null,on:function(A,e){return this.events.on(A,e)},remove:function(A,e){return this.events.remove(A,e)},clear:function(A){return this.events.clear(A)},Reposition:function(A,e,t,n){var i="position: absolute; top: "+e+"px;";i+="left: "+A+"px;",i+="right: "+(A+t)+"px;",i+="bottom: "+(e+n)+"px;",i+="width: "+t+"px;",i+="height: "+n+"px;",this.element.setAttribute("style",i),this.onWindowResize()},Init:function(A){var e=this;this.element=document.createElement("div"),A.side?this.element.setAttribute("style","position: absolute; top: 0; left: 50%; right: 0; bottom: 30%;"):this.element.setAttribute("style","position: absolute; top: 0; left: 0; right: 50%; bottom: 0;");var t=document.body;A.container&&(t=document.getElementById(A.container)),t.appendChild(this.element),this.scene=new THREE.Scene;var n=new THREE.AmbientLight(1052720);this.scene.add(n);var i=new THREE.DirectionalLight(16772829);i.position.set(1,10,1),this.scene.add(i),this.camera=new THREE.PerspectiveCamera(45,this.element.clientWidth/this.element.clientHeight,1,2e3),this.camera.position.y=7,this.camera.position.z=1,this.camera.lookAt(this.scene.position);var o=new THREE.LoadingManager;o.onProgress=function(A,e,t){console.log(A,e,t)};var s=function(){},a=function(A){console.log(A)};new THREE.OBJLoader(o).load("/fyogametable/assets/objs/DPad.obj",function(A){A.traverse(function(A){A instanceof THREE.Mesh&&(A.material.materials?(A.material.materials[0].color=new THREE.Color(13421772),A.material.materials[1].color=new THREE.Color(2236962)):A.material.color=new THREE.Color(2236962))}),A.position.y=0,e.thumbObj=A,e.scene.add(A),e.Render()},s,a),this.elementHalfX=this.element.clientWidth/2,this.elementHalfY=this.element.clientHeight/2,this.renderer=new THREE.WebGLRenderer({alpha:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(this.element.clientWidth,this.element.clientHeight),this.renderer.setClearColor(0,0),this.element.appendChild(this.renderer.domElement),this.element.addEventListener("mousemove",function(A){e.onMouseMove(A)},!1),this.element.addEventListener("mouseleave",function(A){e.onMouseLeave(A)},!1),this.element.addEventListener("touchmove",function(A){e.onTouchMove(A)},!1),this.element.addEventListener("touchstart",function(A){e.onTouchStart(A)},!1),this.element.addEventListener("touchend",function(A){e.onTouchDone(A)},!1),window.addEventListener("resize",function(A){e.onWindowResize(A)},!1),this.Render()},onWindowResize:function(){this.elementHalfX=this.element.clientWidth/2,this.elementHalfY=this.element.clientHeight/2,this.camera.aspect=this.elementHalfX/this.elementHalfY,this.camera.updateProjectionMatrix(),this.renderer.setSize(this.element.clientWidth,this.element.clientHeight),this.Render()},onMouseMove:function(A){A.preventDefault(),this.mouseX=A.offsetX,this.mouseY=A.offsetY,this._update(),this.Render()},onMouseLeave:function(A){A.preventDefault(),this.mouseX=this.elementHalfX,this.mouseY=this.elementHalfY,this._update(),this.Render()},onTouchStart:function(A){A.preventDefault(),navigator.vibrate(10);for(var e=this.element.getBoundingClientRect(),t=0;t<A.touches.length;t++){var n=A.touches[t];n.pageX>=e.left&&n.pageX<=e.right&&n.pageY>=e.top&&n.pageY<=e.bottom&&(this.mouseX=n.pageX-e.left,this.mouseY=n.pageY-e.top,this._update())}this.Render()},onTouchMove:function(A){A.preventDefault();for(var e=this.element.getBoundingClientRect(),t=0;t<A.touches.length;t++){var n=A.touches[t];n.pageX>=e.left&&n.pageX<=e.right&&n.pageY>=e.top&&n.pageY<=e.bottom&&(this.mouseX=n.pageX-e.left,this.mouseY=n.pageY-e.top,this._update())}this.Render()},onTouchDone:function(A){A.preventDefault(),this.mouseX=this.elementHalfX,this.mouseY=this.elementHalfY,this._update(),navigator.vibrate(10),this.Render()},_update:function(){var A=this.x,e=this.y,t=(this.mouseY-this.elementHalfY)/this.elementHalfY,n=(this.mouseX-this.elementHalfX)/this.elementHalfX;this.x=-Math.sin(n),this.y=Math.sin(t);var i=Math.sqrt(this.x*this.x+this.y*this.y);i>1&&(this.x/=i,this.y/=i),Math.abs(this.y)>Math.abs(this.x)?(this.y=this.y>0?1:-1,this.x=0):Math.abs(this.x)>Math.abs(this.y)?(this.x=this.x>0?1:-1,this.y=0):(this.x=0,this.y=0),A==this.x&&e==this.y||navigator.vibrate(10),this.events.trigger("moved",{x:-this.x,y:-this.y})},Render:function(){null!==this.thumbObj&&(this.thumbObj.rotation.x=this.y/4,this.thumbObj.rotation.z=this.x/4),this.renderer.render(this.scene,this.camera)}},FYO.DPad3D=A}();var FYO=FYO||{};!function(){"use strict";function A(){this.onEvents={}}A.prototype={onEvents:{},on:function(A,e){this.onEvents[A]||(this.onEvents[A]=[]),this.onEvents[A].push(e)},remove:function(A,e){if(this.onEvents[A]){for(var t=0;t<this.onEvents[A].length;t++)if(this.onEvents[A][t]===e)return this.onEvents[A].splice(t,1),!0;return!1}},clear:function(A){delete this.onEvents[A]},trigger:function(A,e){if(this.onEvents[A])for(var t=0;t<this.onEvents[A].length;t++)this.onEvents[A][t](e)}},FYO.EventManager=A}();var FYO=FYO||{};!function(){"use strict";function A(A,e,t){var n=this;if(!A)return void alert("Controller must be specified");e=e||{},this.controller=A,this.socket=io(),this.socket.on("connect",function(){n.OnConnect()}),this.input=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.events=new FYO.EventManager,this.IOHelper=new FYO.IOHelper({orientation:function(A,e,t){n.events.trigger("orientation",{gamma:A,beta:e,alpha:t})},motion:function(A,e,t){n.events.trigger("acceleration",{x:A,y:e,z:t})}});var i=document.createElement("img");i.setAttribute("class","fyo-fullscreen"),i.setAttribute("src",e.fullscreenImage||"/fyogametable/assets/imgs/fullscreen-128.png"),i.onmouseup=FYO.IOHelper.FullScreen,document.body.appendChild(i);var o=document.createElement("img");o.setAttribute("class","fyo-settings"),o.setAttribute("src",e.settingsImage||"/fyogametable/assets/imgs/settings-128.png");var s=document.createElement("div");s.setAttribute("class","fyo-settings-window"),s.setAttribute("style","display: none");var a=document.createElement("div");a.setAttribute("class","fyo-settings-window-inner");var r=document.createElement("h1");r.innerText="SETTINGS",a.appendChild(r);var l=document.createElement("div");l.setAttribute("class","fyo-settings-window-options");var h=document.createElement("div");h.setAttribute("class","fyo-settings-window-option"),h.innerText="Close Game",h.onmouseup=function(){n.Send("AppEndMsg")},l.appendChild(h),a.appendChild(l);var u=document.createElement("img");u.setAttribute("class","fyo-settings-close"),u.setAttribute("src",e.closeImage||"/fyogametable/assets/imgs/close.png"),u.onmouseup=function(){s.setAttribute("style","display: none")},a.appendChild(u),s.appendChild(a),document.body.appendChild(s),o.onmouseup=function(){s.setAttribute("style","")},document.body.appendChild(o),this.IOHelper.GetDeviceInfo(function(A){n.info=A,n.events.trigger("info")})}A.prototype={alphabet:"abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",OnConnect:function(){var A=this;this.IOHelper.GetDeviceInfo(function(e){console.log(e),A.info=e,A.socket.emit("SGHandshakeIdentMsg",{DeviceId:A.GetClientId(),Controller:A.controller,Info:e}),A.events.trigger("connected")}),this.socket.on("SGRedirectMsg",function(A){A!=this.controller&&(window.location="/"+A)}),this.socket.on("SGUpdateMsg",function(e){A.events.trigger("SGUpdateMsg",e),A.events.trigger(e.MessageType,e.data)}),this.socket.on("app-ping",function(e){A.socket.emit("app-pong",e)}),this.socket.on("app-latency",function(e){A.events.trigger("app-latency",e)})},GetClientId:function(){var A=window.localStorage.getItem("clientId");return A||(A=this.GenUniqueId(),window.localStorage.setItem("clientId",A)),A},GenUniqueId:function(){for(var A="",e=0;e<24;e++)A+=this.alphabet[Math.floor(Math.random()*(this.alphabet.length-1))];return A},Send:function(A,e){this.socket.emit("SGUpdateMsg",{MessageType:A,data:e})},SendInput:function(){this.Send("Input",{"button 0":this.input[0]>0,"button 1":this.input[1]>0,"button 2":this.input[2]>0,"button 3":this.input[3]>0,"button 4":this.input[4]>0,"button 5":this.input[5]>0,"button 6":this.input[6]>0,"button 7":this.input[7]>0,"button 8":this.input[8]>0,"button 9":this.input[9]>0,"axis 0":this.input[10],"axis 1":this.input[11],"axis 2":this.input[12],"axis 3":this.input[13],"axis 4":this.input[14],"axis 5":this.input[15],"axis 6":this.input[16],"axis 7":this.input[17]})},SetAxis:function(A,e,t,n){this.input[A]=e,t&&(this.input[t]=n),this.SendInput()},SetButton:function(A,e){this.input[A]=e,this.SendInput()},SetButtonOn:function(A){this.SetButton(A,1)},SetButtonOff:function(A){this.SetButton(A,0)},AddVisualLatency:function(){var A=document.createElement("h3");A.setAttribute("id","ping-message"),document.body.appendChild(A),this.on("app-latency",function(e){A.innerText=Math.floor(e.average)})},TakePicture:function(A){var e=this;new FYO.Picture(function(t){e.Send(A||"Picture",t)})},on:function(A,e){return this.events.on(A,e)},remove:function(A,e){return this.events.remove(A,e)}},FYO.FyoConnection=A,FYO.BUTTON=[0,1,2,3,4,5,6,7,8,9],FYO.AXIS=[10,11,12,13,14,15,16,17]}();var FYO=FYO||{};!function(){"use strict";function A(A){A=A||{},window.DeviceOrientationEvent&&window.addEventListener("deviceorientation",function(e){A&&A.orientation&&A.orientation(e.gamma,e.beta,e.alpha)},!1),window.DeviceMotionEvent&&window.addEventListener("devicemotion",function(e){A&&A.motion&&A.motion(e.acceleration.x,e.acceleration.y,e.acceleration.z)},!1)}A.FullScreen=function(){var A=document.body.requestFullScreen||document.body.webkitRequestFullScreen||document.body.mozRequestFullScreen||document.body.msRequestFullScreen,e=document.exitFullscreen||document.webkitExitFullscreen||document.mozCancelFullScreen||document.msExitFullscreen;if(A)document.fullscreenElement?(e.call(document),document.fullscreenElement=null):(A.call(document.body),document.fullscreenElement=document.body);else if(void 0!==window.ActiveXObject){var t=new ActiveXObject("WScript.Shell");null!==t&&t.SendKeys("{F11}")}},A.GetDevices=function(A){navigator.mediaDevices?navigator.mediaDevices.enumerateDevices().then(function(e){for(var t={audioInput:[],audioOutput:[],videoInput:[]},n=0;n<e.length;n++)switch(e[n].kind){case"audioinput":t.audioInput.push({deviceId:e[n].deviceId,groupId:e[n].groupId,label:e[n].label});break;case"videoinput":t.videoInput.push({deviceId:e[n].deviceId,groupId:e[n].groupId,label:e[n].label});break;case"audiooutput":t.audioOutput.push({deviceId:e[n].deviceId,groupId:e[n].groupId,label:e[n].label})}A&&A(t)}):A&&A(null)},A.prototype={_getBattery:function(A){navigator.getBattery?navigator.getBattery().then(function(e){e?A&&A({charging:e.charging,chargingTime:e.chargingTime,dischargingTime:e.dischargingTime,level:e.level}):A&&A(null)}):A&&A(null)},GetDeviceInfo:function(e){var t={browser:platform.name,version:platform.version,manufacturer:platform.manufacturer,product:platform.product,os:{family:platform.os.family,version:platform.os.version,architecture:platform.os.architecture},description:platform.description,layout:platform.layout,ua:platform.ua,resolution:{width:window.screen.width,height:window.screen.height,pixelRatio:window.devicePixelRatio},orientation:window.innerHeight>window.innerWidth?"portrait":"landscape"};t.capabilities={deviceorientation:Modernizr.deviceorientation,devicemotion:Modernizr.devicemotion,ambientlight:Modernizr.ambientlight,applicationcache:Modernizr.applicationcache,audiopreload:Modernizr.audiopreload,batteryapi:Modernizr.batteryapi,canvas:Modernizr.canvas,cors:Modernizr.cors,cssanimations:Modernizr.cssanimations,emoji:Modernizr.emoji,forcetouch:Modernizr.forcetouch,fullscreen:Modernizr.fullscreen,gamepads:Modernizr.gamepads,geolocation:Modernizr.geolocation,getusermedia:Modernizr.getusermedia,localstorage:Modernizr.localstorage,lowbattery:Modernizr.lowbattery,notification:Modernizr.notification,pointerlock:Modernizr.pointerlock,proximity:Modernizr.proximity,requestanimationframe:Modernizr.requestanimationframe,sessionstorage:Modernizr.sessionstorage,speechrecognition:Modernizr.speechrecognition,speechsynthesis:Modernizr.speechsynthesis,svg:Modernizr.svg,touchevents:Modernizr.touchevents,vibrate:Modernizr.vibrate,webanimations:Modernizr.webanimations,webaudio:Modernizr.webaudio,webgl:Modernizr.webgl,websockets:Modernizr.websockets,webworkers:Modernizr.webworkers,video:1==Modernizr.video,audio:1==Modernizr.audio},this._getBattery(function(n){t.isDesktop=!n||n.charging&&0==n.chargingTime,n&&(t.battery={charging:n.charging,chargingTime:n.chargingTime,dischargingTime:n.dischargingTime,level:n.level}),A.GetDevices(function(A){t.devices=A,e&&e(t)})})}},FYO.IOHelper=A}();var FYO=FYO||{};!function(){"use strict";function A(A){this.width=320,this.height=0,this.streaming=!1,this.video=null,this.canvas=null,this.photo=null,this.startbutton=null,this._resultCB=A,this.Init()}A.prototype={Init:function(){function A(A){t.height=t.video.videoHeight/(t.video.videoWidth/t.width),t.video.setAttribute("width",t.width),t.video.setAttribute("height",t.height),t.canvas.setAttribute("width",t.width),t.canvas.setAttribute("height",t.height),t.streaming=!0}function e(){t._orientationChange()}var t=this;this.container=document.createElement("div"),this.container.setAttribute("class","fyo-container"),this.photoContainer=document.createElement("div"),this.photoContainer.setAttribute("class","fyo-picture"),this.video=document.createElement("video"),this.canvas=document.createElement("canvas"),this.canvas.setAttribute("style","display:none"),this.photo=document.createElement("img"),this.photo.setAttribute("style","display:none"),this.startbutton=document.createElement("a"),this.startbutton.setAttribute("href","javascript:void(0);"),this.startbutton.setAttribute("class","btn btn-primary"),this.startbutton.innerText="Take Picture",this.cancelbutton=document.createElement("a"),this.cancelbutton.setAttribute("href","javascript:void(0);"),this.cancelbutton.setAttribute("class","btn btn-primary"),this.cancelbutton.innerText="Cancel",this.flipbutton=document.createElement("a"),this.flipbutton.setAttribute("href","javascript:void(0);"),this.flipbutton.setAttribute("class","btn btn-primary"),this.flipbutton.innerText="Flip Camera",this.photoContainer.appendChild(this.video),this.photoContainer.appendChild(this.canvas),this.photoContainer.appendChild(this.photo),this.photoContainer.appendChild(this.startbutton),this.photoContainer.appendChild(this.cancelbutton),this.photoContainer.appendChild(this.flipbutton),this.container.appendChild(this.photoContainer),document.body.appendChild(this.container),this.video.addEventListener("canplay",A,!1),window.addEventListener("orientationchange",e),this.__cleanup=function(){window.removeEventListener("orientationchange",e),t.video.removeEventListener("canplay",A),t.video.srcObject=null,t.video.src=null},FYO.IOHelper.GetDevices(function(A){console.log(A),t.devices=A.videoInput,t.currDevice=0,0==t.devices.length&&alert("no camera"),1==t.devices.length&&t.photoContainer.removeChild(t.flipbutton),t.devices.length>2&&(t.flipbutton.innerText="Next Camera"),t._startVideo()}),this.startbutton.addEventListener("click",function(A){t.Take(),A.preventDefault()},!1),this.cancelbutton.addEventListener("click",function(A){t.Cancel(),A.preventDefault()},!1),this.flipbutton.addEventListener("click",function(A){t.currDevice++,t._startVideo(),A.preventDefault()},!1)},_orientationChange:function(){this._startVideo()},_startVideo:function(){var A=this;navigator.mediaDevices.getUserMedia({video:{deviceId:{exact:A.devices[A.currDevice%A.devices.length].deviceId}},audio:!1}).then(function(e){A.video.srcObject=e,A.video.play()}).catch(function(A){console.log("An error occured! "+A)})},Clear:function(){var A=this.canvas.getContext("2d");A.fillStyle="#AAA",A.fillRect(0,0,canvas.width,canvas.height);var e=canvas.toDataURL("image/png");this.photo.setAttribute("src",e)},Take:function(){var A=this.canvas.getContext("2d");if(this.width&&this.height){this.canvas.width=this.width,this.canvas.height=this.height,A.drawImage(this.video,0,0,this.width,this.height);var e=this.canvas.toDataURL("image/png");this._resultCB&&this._resultCB(e),this._cleanup()}else this.Clear()},Cancel:function(){this._cleanup()},_cleanup:function(){document.body.removeChild(this.container),this.__cleanup&&this.__cleanup()}},FYO.Picture=A}();var FYO=FYO||{};!function(){"use strict";function A(A,e){this.container=e||window,this.element=A,this.align={horizontal:1,vertical:1},this.x=0,this.y=0,this.w=0,this.h=0;var t=this;window.addEventListener("resize",function(){t.Set(t.x,t.y,t.w,t.h)},!1)}A.prototype={Set:function(A,e,t,n){this.x=A,this.y=e,this.w=t,this.h=n;var i=0;if(this.isPercentage(A))switch(this.align.horizontal){case 0:i=this.container.innerWidth*this.getPercentage(A);break;case 1:i=this.container.innerWidth*this.getPercentage(A)-t/2;break;case 2:i=this.container.innerWidth*this.getPercentage(A)-t}else i=this.number(A);var o=0;if(this.isPercentage(e))switch(this.align.vertical){case 0:o=this.container.innerHeight*this.getPercentage(e);break;case 1:o=this.container.innerHeight*this.getPercentage(e)-n/2;break;case 2:o=this.container.innerHeight*this.getPercentage(e)-n}else o=this.number(e);this.element.setAttribute("style","position: absolute; top: "+o+"px; left: "+i+"px; right: "+(i+t)+"px; bottom: "+(o+n)+"px; width: "+t+"px; height: "+n+"px;")},isPercentage:function(A){return A.indexOf("%")>-1},getPercentage:function(A){return parseFloat(this.number(A))/100},number:function(A){return A.split("%")[0].split("px")[0]}},FYO.Positioner=A}();var FYO=FYO||{};!function(){"use strict";function A(A,e){e=e||{},this.connector=A,this.element=null,this.camera=null,this.scene=null,this.renderer=null,this.mouseX=0,this.mouseY=0,this.windowHalfX=window.innerWidth/2,this.windowHalfY=window.innerHeight/2,this.thumbObj=null,this.x=0,this.y=0,this.events=new FYO.EventManager,e.onmoved&&this.events.on("moved",e.onmoved),navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate||function(){},this.Init(e)}A.prototype={element:null,camera:null,scene:null,renderer:null,mouseX:0,mouseY:0,windowHalfX:window.innerWidth/2,windowHalfY:window.innerHeight/2,thumbObj:null,events:null,on:function(A,e){return this.events.on(A,e)},remove:function(A,e){return this.events.remove(A,e)},clear:function(A){return this.events.clear(A)},Reposition:function(A,e,t,n){var i="position: absolute; top: "+e+"px;";i+="left: "+A+"px;",i+="right: "+(A+t)+"px;",i+="bottom: "+(e+n)+"px;",i+="width: "+t+"px;",i+="height: "+n+"px;",this.element.setAttribute("style",i),this.onWindowResize()},Init:function(A){var e=this;this.element=document.createElement("div"),A.side?this.element.setAttribute("style","position: absolute; top: 0; left: 50%; right: 0; bottom: 30%;"):this.element.setAttribute("style","position: absolute; top: 0; left: 0; right: 50%; bottom: 0;");var t=document.body;A.container&&(t=document.getElementById(A.container)),t.appendChild(this.element),this.elementHalfX=this.element.clientWidth/2,this.elementHalfY=this.element.clientHeight/2,this.image=document.createElement("div");var n="background: url('"+(A.image||"/fyogametable/assets/imgs/Thumbstick2D.png")+"') no-repeat center center;";n+="background-size: contain; width: 100%; height: 100%;",this.image.setAttribute("style",n),this.element.appendChild(this.image),
this.element.addEventListener("mousemove",function(A){e.onMouseMove(A)},!1),this.element.addEventListener("mouseleave",function(A){e.onMouseLeave(A)},!1),this.element.addEventListener("touchmove",function(A){e.onTouchMove(A)},!1),this.element.addEventListener("touchstart",function(A){e.onTouchStart(A)},!1),this.element.addEventListener("touchend",function(A){e.onTouchDone(A)},!1),window.addEventListener("resize",function(A){e.onWindowResize(A)},!1)},onWindowResize:function(){this.elementHalfX=this.element.clientWidth/2,this.elementHalfY=this.element.clientHeight/2},onMouseMove:function(A){A.preventDefault(),this.mouseX=A.offsetX,this.mouseY=A.offsetY,this._update()},onMouseLeave:function(A){A.preventDefault(),this.mouseX=this.elementHalfX,this.mouseY=this.elementHalfY,this._update()},onTouchStart:function(A){navigator.vibrate(10);for(var e=this.element.getBoundingClientRect(),t=0;t<A.touches.length;t++){var n=A.touches[t];n.pageX>=e.left&&n.pageX<=e.right&&n.pageY>=e.top&&n.pageY<=e.bottom&&(this.mouseX=n.pageX-e.left,this.mouseY=n.pageY-e.top,this._update())}},onTouchMove:function(A){A.preventDefault();for(var e=this.element.getBoundingClientRect(),t=0;t<A.touches.length;t++){var n=A.touches[t];n.pageX>=e.left&&n.pageX<=e.right&&n.pageY>=e.top&&n.pageY<=e.bottom&&(this.mouseX=n.pageX-e.left,this.mouseY=n.pageY-e.top,this._update())}},onTouchDone:function(A){A.preventDefault(),this.mouseX=this.elementHalfX,this.mouseY=this.elementHalfY,this._update(),navigator.vibrate(10)},_update:function(){var A=(this.mouseY-this.elementHalfY)/this.elementHalfY,e=(this.mouseX-this.elementHalfX)/this.elementHalfX;this.x=-Math.sin(e),this.y=Math.sin(A);var t=Math.sqrt(this.x*this.x+this.y*this.y);t>1&&(this.x/=t,this.y/=t),this.events.trigger("moved",{x:-this.x,y:-this.y})}},FYO.ThumbStick2D=A}();var FYO=FYO||{};!function(){"use strict";function A(A,e){e=e||{},this.connector=A,this.element=null,this.camera=null,this.scene=null,this.renderer=null,this.mouseX=0,this.mouseY=0,this.windowHalfX=window.innerWidth/2,this.windowHalfY=window.innerHeight/2,this.thumbObj=null,this.x=0,this.y=0,this.events=new FYO.EventManager,e.onmoved&&this.events.on("moved",e.onmoved),navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate||function(){},this.Init(e)}A.prototype={element:null,camera:null,scene:null,renderer:null,mouseX:0,mouseY:0,windowHalfX:window.innerWidth/2,windowHalfY:window.innerHeight/2,thumbObj:null,events:null,on:function(A,e){return this.events.on(A,e)},remove:function(A,e){return this.events.remove(A,e)},clear:function(A){return this.events.clear(A)},Reposition:function(A,e,t,n){var i="position: absolute; top: "+e+"px;";i+="left: "+A+"px;",i+="right: "+(A+t)+"px;",i+="bottom: "+(e+n)+"px;",i+="width: "+t+"px;",i+="height: "+n+"px;",this.element.setAttribute("style",i),this.onWindowResize()},Init:function(A){var e=this;this.element=document.createElement("div"),A.side?this.element.setAttribute("style","position: absolute; top: 0; left: 50%; right: 0; bottom: 30%;"):this.element.setAttribute("style","position: absolute; top: 0; left: 0; right: 50%; bottom: 0;");var t=document.body;A.container&&(t=document.getElementById(A.container)),t.appendChild(this.element),this.scene=new THREE.Scene;var n=new THREE.AmbientLight(1052720);this.scene.add(n);var i=new THREE.DirectionalLight(16772829);i.position.set(1,10,1),this.scene.add(i),this.camera=new THREE.PerspectiveCamera(45,this.element.clientWidth/this.element.clientHeight,1,2e3),this.camera.position.y=5,this.camera.position.z=1,this.camera.lookAt(this.scene.position);var o=new THREE.LoadingManager;o.onProgress=function(A,e,t){console.log(A,e,t)};var s=function(){},a=function(A){console.log(A)},r=new THREE.OBJLoader(o);r.load("/fyogametable/assets/objs/LeftThumb.obj",function(A){A.traverse(function(A){A instanceof THREE.Mesh&&(A.material.materials?(A.material.materials[0].color=new THREE.Color(13421772),A.material.materials[1].color=new THREE.Color(2236962)):A.material.color=new THREE.Color(2236962))}),A.position.y=0,e.thumbObj=A,e.scene.add(A),e.Render()},s,a),r.load("/fyogametable/assets/objs/LeftThumbBase.obj",function(A){A.traverse(function(A){A instanceof THREE.Mesh&&(A.material.color=new THREE.Color(2236962))}),A.position.y=0,e.scene.add(A),e.Render()},s,a),this.elementHalfX=this.element.clientWidth/2,this.elementHalfY=this.element.clientHeight/2,this.renderer=new THREE.WebGLRenderer({alpha:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(this.element.clientWidth,this.element.clientHeight),this.renderer.setClearColor(0,0),this.element.appendChild(this.renderer.domElement),this.element.addEventListener("mousemove",function(A){e.onMouseMove(A)},!1),this.element.addEventListener("mouseleave",function(A){e.onMouseLeave(A)},!1),this.element.addEventListener("touchmove",function(A){e.onTouchMove(A)},!1),this.element.addEventListener("touchstart",function(A){e.onTouchStart(A)},!1),this.element.addEventListener("touchend",function(A){e.onTouchDone(A)},!1),window.addEventListener("resize",function(A){e.onWindowResize(A)},!1),this.Render()},onWindowResize:function(){this.elementHalfX=this.element.clientWidth/2,this.elementHalfY=this.element.clientHeight/2,this.camera.aspect=this.elementHalfX/this.elementHalfY,this.camera.updateProjectionMatrix(),this.renderer.setSize(this.element.clientWidth,this.element.clientHeight),this.Render()},onMouseMove:function(A){A.preventDefault(),this.mouseX=A.offsetX,this.mouseY=A.offsetY,this._update(),this.Render()},onMouseLeave:function(A){A.preventDefault(),this.mouseX=this.elementHalfX,this.mouseY=this.elementHalfY,this._update(),this.Render()},onTouchStart:function(A){navigator.vibrate(10);for(var e=this.element.getBoundingClientRect(),t=0;t<A.touches.length;t++){var n=A.touches[t];n.pageX>=e.left&&n.pageX<=e.right&&n.pageY>=e.top&&n.pageY<=e.bottom&&(this.mouseX=n.pageX-e.left,this.mouseY=n.pageY-e.top,this._update())}this.Render()},onTouchMove:function(A){A.preventDefault();for(var e=this.element.getBoundingClientRect(),t=0;t<A.touches.length;t++){var n=A.touches[t];n.pageX>=e.left&&n.pageX<=e.right&&n.pageY>=e.top&&n.pageY<=e.bottom&&(this.mouseX=n.pageX-e.left,this.mouseY=n.pageY-e.top,this._update())}this.Render()},onTouchDone:function(A){A.preventDefault(),this.mouseX=this.elementHalfX,this.mouseY=this.elementHalfY,this._update(),navigator.vibrate(10),this.Render()},_update:function(){var A=(this.mouseY-this.elementHalfY)/this.elementHalfY,e=(this.mouseX-this.elementHalfX)/this.elementHalfX;this.x=-Math.sin(e),this.y=Math.sin(A);var t=Math.sqrt(this.x*this.x+this.y*this.y);t>1&&(this.x/=t,this.y/=t),this.events.trigger("moved",{x:-this.x,y:-this.y})},Render:function(){null!==this.thumbObj&&(this.thumbObj.rotation.x=this.y/2,this.thumbObj.rotation.z=this.x/2),this.renderer.render(this.scene,this.camera)}},FYO.ThumbStick3D=A}(),function(A,e,t){function n(A,e){return typeof A===e}function i(A){var e=Q.className,t=b._config.classPrefix||"";if(C&&(e=e.baseVal),b._config.enableJSClass){var n=new RegExp("(^|\\s)"+t+"no-js(\\s|$)");e=e.replace(n,"$1"+t+"js$2")}b._config.enableClasses&&(e+=" "+t+A.join(" "+t),C?Q.className.baseVal=e:Q.className=e)}function o(){return"function"!=typeof e.createElement?e.createElement(arguments[0]):C?e.createElementNS.call(e,"http://www.w3.org/2000/svg",arguments[0]):e.createElement.apply(e,arguments)}function s(A){return A.replace(/([a-z])-([a-z])/g,function(A,e,t){return e+t.toUpperCase()}).replace(/^-/,"")}function a(A,e){if("object"==typeof A)for(var t in A)M(A,t)&&a(t,A[t]);else{A=A.toLowerCase();var n=A.split("."),o=b[n[0]];if(2==n.length&&(o=o[n[1]]),void 0!==o)return b;e="function"==typeof e?e():e,1==n.length?b[n[0]]=e:(!b[n[0]]||b[n[0]]instanceof Boolean||(b[n[0]]=new Boolean(b[n[0]])),b[n[0]][n[1]]=e),i([(e&&0!=e?"":"no-")+n.join("-")]),b._trigger(A,e)}return b}function r(){var A=e.body;return A||(A=o(C?"svg":"body"),A.fake=!0),A}function l(A,t,n,i){var s,a,l,h,u="modernizr",c=o("div"),d=r();if(parseInt(n,10))for(;n--;)l=o("div"),l.id=i?i[n]:u+(n+1),c.appendChild(l);return s=o("style"),s.type="text/css",s.id="s"+u,(d.fake?d:c).appendChild(s),d.appendChild(c),s.styleSheet?s.styleSheet.cssText=A:s.appendChild(e.createTextNode(A)),c.id=u,d.fake&&(d.style.background="",d.style.overflow="hidden",h=Q.style.overflow,Q.style.overflow="hidden",Q.appendChild(d)),a=t(c,A),d.fake?(d.parentNode.removeChild(d),Q.style.overflow=h,Q.offsetHeight):c.parentNode.removeChild(c),!!a}function h(A,e){return!!~(""+A).indexOf(e)}function u(A,e){return function(){return A.apply(e,arguments)}}function c(A,e,t){var i;for(var o in A)if(A[o]in e)return!1===t?A[o]:(i=e[A[o]],n(i,"function")?u(i,t||e):i);return!1}function d(A){return A.replace(/([A-Z])/g,function(A,e){return"-"+e.toLowerCase()}).replace(/^ms-/,"-ms-")}function m(e,t,n){var i;if("getComputedStyle"in A){i=getComputedStyle.call(A,e,t);var o=A.console;if(null!==i)n&&(i=i.getPropertyValue(n));else if(o){var s=o.error?"error":"log";o[s].call(o,"getComputedStyle returning null, its possible modernizr test results are inaccurate")}}else i=!t&&e.currentStyle&&e.currentStyle[n];return i}function w(e,n){var i=e.length;if("CSS"in A&&"supports"in A.CSS){for(;i--;)if(A.CSS.supports(d(e[i]),n))return!0;return!1}if("CSSSupportsRule"in A){for(var o=[];i--;)o.push("("+d(e[i])+":"+n+")");return o=o.join(" or "),l("@supports ("+o+") { #modernizr { position: absolute; } }",function(A){return"absolute"==m(A,null,"position")})}return t}function v(A,e,i,a){function r(){u&&(delete S.style,delete S.modElem)}if(a=!n(a,"undefined")&&a,!n(i,"undefined")){var l=w(A,i);if(!n(l,"undefined"))return l}for(var u,c,d,m,v,g=["modernizr","tspan","samp"];!S.style&&g.length;)u=!0,S.modElem=o(g.shift()),S.style=S.modElem.style;for(d=A.length,c=0;d>c;c++)if(m=A[c],v=S.style[m],h(m,"-")&&(m=s(m)),S.style[m]!==t){if(a||n(i,"undefined"))return r(),"pfx"!=e||m;try{S.style[m]=i}catch(A){}if(S.style[m]!=v)return r(),"pfx"!=e||m}return r(),!1}function g(A,e,t,i,o){var s=A.charAt(0).toUpperCase()+A.slice(1),a=(A+" "+x.join(s+" ")+s).split(" ");return n(e,"string")||n(e,"undefined")?v(a,e,i,o):(a=(A+" "+H.join(s+" ")+s).split(" "),c(a,e,t))}function f(A,e){var t=A.deleteDatabase(e);t.onsuccess=function(){a("indexeddb.deletedatabase",!0)},t.onerror=function(){a("indexeddb.deletedatabase",!1)}}function p(A,e,n){return g(A,t,t,e,n)}var D=[],E=[],P={_version:"3.5.0",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(A,e){var t=this;setTimeout(function(){e(t[A])},0)},addTest:function(A,e,t){E.push({name:A,fn:e,options:t})},addAsyncTest:function(A){E.push({name:null,fn:A})}},b=function(){};b.prototype=P,b=new b,b.addTest("applicationcache","applicationCache"in A),b.addTest("blobconstructor",function(){try{return!!new Blob}catch(A){return!1}},{aliases:["blob-constructor"]}),b.addTest("cors","XMLHttpRequest"in A&&"withCredentials"in new XMLHttpRequest),b.addTest("eventlistener","addEventListener"in A),b.addTest("geolocation","geolocation"in navigator),b.addTest("json","JSON"in A&&"parse"in JSON&&"stringify"in JSON),b.addTest("messagechannel","MessageChannel"in A),b.addTest("notification",function(){if(!A.Notification||!A.Notification.requestPermission)return!1;if("granted"===A.Notification.permission)return!0;try{new A.Notification("")}catch(A){if("TypeError"===A.name)return!1}return!0}),b.addTest("svg",!!e.createElementNS&&!!e.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect),b.addTest("cookies",function(){try{e.cookie="cookietest=1";var A=-1!=e.cookie.indexOf("cookietest=");return e.cookie="cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT",A}catch(A){return!1}});var B=!1;try{B="WebSocket"in A&&2===A.WebSocket.CLOSING}catch(A){}b.addTest("websockets",B),b.addTest("webaudio",function(){var e="webkitAudioContext"in A,t="AudioContext"in A;return b._config.usePrefixes?e||t:t}),b.addTest("devicemotion","DeviceMotionEvent"in A),b.addTest("deviceorientation","DeviceOrientationEvent"in A),b.addTest("filereader",!!(A.File&&A.FileList&&A.FileReader)),b.addTest("speechsynthesis","SpeechSynthesisUtterance"in A),b.addTest("localstorage",function(){var A="modernizr";try{return localStorage.setItem(A,A),localStorage.removeItem(A),!0}catch(A){return!1}}),b.addTest("sessionstorage",function(){var A="modernizr";try{return sessionStorage.setItem(A,A),sessionStorage.removeItem(A),!0}catch(A){return!1}}),b.addTest("websqldatabase","openDatabase"in A),b.addTest("atobbtoa","atob"in A&&"btoa"in A,{aliases:["atob-btoa"]}),b.addTest("webworkers","Worker"in A);var Q=e.documentElement;b.addTest("contextmenu","contextMenu"in Q&&"HTMLMenuItemElement"in A);var C="svg"===Q.nodeName.toLowerCase();b.addTest("audio",function(){var A=o("audio"),e=!1;try{(e=!!A.canPlayType)&&(e=new Boolean(e),e.ogg=A.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),e.mp3=A.canPlayType('audio/mpeg; codecs="mp3"').replace(/^no$/,""),e.opus=A.canPlayType('audio/ogg; codecs="opus"')||A.canPlayType('audio/webm; codecs="opus"').replace(/^no$/,""),e.wav=A.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),e.m4a=(A.canPlayType("audio/x-m4a;")||A.canPlayType("audio/aac;")).replace(/^no$/,""))}catch(A){}return e}),b.addTest("canvas",function(){var A=o("canvas");return!(!A.getContext||!A.getContext("2d"))}),b.addTest("canvastext",function(){return!1!==b.canvas&&"function"==typeof o("canvas").getContext("2d").fillText}),b.addTest("contenteditable",function(){if("contentEditable"in Q){var A=o("div");return A.contentEditable=!0,"true"===A.contentEditable}}),b.addTest("emoji",function(){if(!b.canvastext)return!1;var e=A.devicePixelRatio||1,t=12*e,n=o("canvas"),i=n.getContext("2d");return i.fillStyle="#f00",i.textBaseline="top",i.font="32px Arial",i.fillText("🐨",0,0),0!==i.getImageData(t,t,1,1).data[0]}),b.addTest("video",function(){var A=o("video"),e=!1;try{(e=!!A.canPlayType)&&(e=new Boolean(e),e.ogg=A.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),e.h264=A.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),e.webm=A.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,""),e.vp9=A.canPlayType('video/webm; codecs="vp9"').replace(/^no$/,""),e.hls=A.canPlayType('application/x-mpegURL; codecs="avc1.42E01E"').replace(/^no$/,""))}catch(A){}return e}),b.addTest("webanimations","animate"in o("div")),b.addTest("webgl",function(){var e=o("canvas"),t="probablySupportsContext"in e?"probablySupportsContext":"supportsContext";return t in e?e[t]("webgl")||e[t]("experimental-webgl"):"WebGLRenderingContext"in A}),b.addAsyncTest(function(){if(b.webglextensions=!1,b.webgl){var A,e,n;try{A=o("canvas"),e=A.getContext("webgl")||A.getContext("experimental-webgl"),n=e.getSupportedExtensions()}catch(A){return}e!==t&&(b.webglextensions=new Boolean(!0));for(var i=-1,s=n.length;++i<s;)b.webglextensions[n[i]]=!0;A=t}});var y=function(){function A(A,e){var i;return!!A&&(e&&"string"!=typeof e||(e=o(e||"div")),A="on"+A,i=A in e,!i&&n&&(e.setAttribute||(e=o("div")),e.setAttribute(A,""),i="function"==typeof e[A],e[A]!==t&&(e[A]=t),e.removeAttribute(A)),i)}var n=!("onblur"in e.documentElement);return A}();P.hasEvent=y,b.addTest("ambientlight",y("devicelight",A));var R=P._config.usePrefixes?" -webkit- -moz- -o- -ms- ".split(" "):["",""];P._prefixes=R;var M;!function(){var A={}.hasOwnProperty;M=n(A,"undefined")||n(A.call,"undefined")?function(A,e){return e in A&&n(A.constructor.prototype[e],"undefined")}:function(e,t){return A.call(e,t)}}(),P._l={},P.on=function(A,e){this._l[A]||(this._l[A]=[]),this._l[A].push(e),b.hasOwnProperty(A)&&setTimeout(function(){b._trigger(A,b[A])},0)},P._trigger=function(A,e){if(this._l[A]){var t=this._l[A];setTimeout(function(){var A;for(A=0;A<t.length;A++)(0,t[A])(e)},0),delete this._l[A]}},b._q.push(function(){P.addTest=a}),b.addAsyncTest(function(){function e(){clearTimeout(t),A.removeEventListener("deviceproximity",e),a("proximity",!0)}var t;"ondeviceproximity"in A&&"onuserproximity"in A?(A.addEventListener("deviceproximity",e),t=setTimeout(function(){A.removeEventListener("deviceproximity",e),a("proximity",!1)},300)):a("proximity",!1)}),b.addAsyncTest(function(){function A(i){clearTimeout(e);var o=i!==t&&"loadeddata"===i.type;n.removeEventListener("loadeddata",A,!1),a("audiopreload",o),n.parentNode.removeChild(n)}var e,n=o("audio"),i=n.style;if(!(b.audio&&"preload"in n))return void a("audiopreload",!1);i.position="absolute",i.height=0,i.width=0;try{if(b.audio.mp3)n.src="data:audio/mpeg;base64,//MUxAAB6AXgAAAAAPP+c6nf//yi/6f3//MUxAMAAAIAAAjEcH//0fTX6C9Lf//0//MUxA4BeAIAAAAAAKX2/6zv//+IlR4f//MUxBMCMAH8AAAAABYWalVMQU1FMy45//MUxBUB0AH0AAAAADkuM1VVVVVVVVVV//MUxBgBUATowAAAAFVVVVVVVVVVVVVV";else if(b.audio.m4a)n.src="data:audio/x-m4a;base64,AAAAGGZ0eXBNNEEgAAACAGlzb21pc28yAAAACGZyZWUAAAAfbWRhdN4EAABsaWJmYWFjIDEuMjgAAAFoAQBHAAACiG1vb3YAAABsbXZoZAAAAAB8JbCAfCWwgAAAA+gAAAAYAAEAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAG0dHJhawAAAFx0a2hkAAAAD3wlsIB8JbCAAAAAAQAAAAAAAAAYAAAAAAAAAAAAAAAAAQAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAABUG1kaWEAAAAgbWRoZAAAAAB8JbCAfCWwgAAArEQAAAQAVcQAAAAAAC1oZGxyAAAAAAAAAABzb3VuAAAAAAAAAAAAAAAAU291bmRIYW5kbGVyAAAAAPttaW5mAAAAEHNtaGQAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAL9zdGJsAAAAW3N0c2QAAAAAAAAAAQAAAEttcDRhAAAAAAAAAAEAAAAAAAAAAAACABAAAAAArEQAAAAAACdlc2RzAAAAAAMZAAEABBFAFQAAAAABftAAAAAABQISCAYBAgAAABhzdHRzAAAAAAAAAAEAAAABAAAEAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAAUc3RzegAAAAAAAAAXAAAAAQAAABRzdGNvAAAAAAAAAAEAAAAoAAAAYHVkdGEAAABYbWV0YQAAAAAAAAAhaGRscgAAAAAAAAAAbWRpcmFwcGwAAAAAAAAAAAAAAAAraWxzdAAAACOpdG9vAAAAG2RhdGEAAAABAAAAAExhdmY1Mi42NC4y";else if(b.audio.ogg)n.src="data:audio/ogg;base64,T2dnUwACAAAAAAAAAAD/QwAAAAAAAM2LVKsBHgF2b3JiaXMAAAAAAUSsAAAAAAAAgLsAAAAAAAC4AU9nZ1MAAAAAAAAAAAAA/0MAAAEAAADmvOe6Dy3/////////////////MgN2b3JiaXMdAAAAWGlwaC5PcmcgbGliVm9yYmlzIEkgMjAwNzA2MjIAAAAAAQV2b3JiaXMfQkNWAQAAAQAYY1QpRplS0kqJGXOUMUaZYpJKiaWEFkJ