-
Notifications
You must be signed in to change notification settings - Fork 447
/
leap-1.1.1.min.js
9 lines (9 loc) · 98.7 KB
/
leap-1.1.1.min.js
1
2
3
4
5
6
7
8
9
/*!
* LeapJS v1.1.1
* http://github.com/leapmotion/leapjs/
*
* Copyright 2021 Ultraleap, Inc. and other contributors
* Released under the Apache-2.0 license
* http://github.com/leapmotion/leapjs/blob/master/LICENSE
*/
!function r(o,i,a){function s(e,t){if(!i[e]){if(!o[e]){var n="function"==typeof require&&require;if(!t&&n)return n(e,!0);if(u)return u(e,!0);throw(n=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",n}n=i[e]={exports:{}},o[e][0].call(n.exports,function(t){return s(o[e][1][t]||t)},n,n.exports,r,o,i,a)}return i[e].exports}for(var u="function"==typeof require&&require,t=0;t<a.length;t++)s(a[t]);return s}({1:[function(t,e,n){t("./pointable");var t=t("gl-matrix"),r=t.vec3,o=t.mat3,i=t.mat4,e=e.exports=function(t,e){this.finger=t,this._center=null,this._matrix=null,this.type=e.type,this.prevJoint=e.prevJoint,this.nextJoint=e.nextJoint,this.width=e.width;t=new Array(3);r.sub(t,e.nextJoint,e.prevJoint),this.length=r.length(t),this.basis=e.basis};e.prototype.left=function(){return this._left||(this._left=o.determinant(this.basis[0].concat(this.basis[1]).concat(this.basis[2]))<0,this._left)},e.prototype.matrix=function(){if(this._matrix)return this._matrix;var t=this.basis,e=this._matrix=i.create();return e[0]=t[0][0],e[1]=t[0][1],e[2]=t[0][2],e[4]=t[1][0],e[5]=t[1][1],e[6]=t[1][2],e[8]=t[2][0],e[9]=t[2][1],e[10]=t[2][2],e[3]=this.center()[0],e[7]=this.center()[1],e[11]=this.center()[2],this.left()&&(e[0]*=-1,e[1]*=-1,e[2]*=-1),this._matrix},e.prototype.lerp=function(t,e){r.lerp(t,this.prevJoint,this.nextJoint,e)},e.prototype.center=function(){if(this._center)return this._center;var t=r.create();return this.lerp(t,.5),this._center=t},e.prototype.direction=function(){return[-1*this.basis[2][0],-1*this.basis[2][1],-1*this.basis[2][2]]}},{"./pointable":14,"gl-matrix":21}],2:[function(t,e,n){e=e.exports=function(t){this.pos=0,this._buf=[],this.size=t};e.prototype.get=function(t){if(null==t&&(t=0),!(t>=this.size||t>=this._buf.length))return this._buf[(this.pos-t-1)%this.size]},e.prototype.push=function(t){return this._buf[this.pos%this.size]=t,this.pos++}},{}],3:[function(t,e,n){var r=t("../protocol").chooseProtocol,t=t("events").EventEmitter,o=e.exports=function(t){this.opts=Object.assign({host:"127.0.0.1",scheme:this.getScheme(),port:this.getPort(),background:!1,optimizeHMD:!1,requestProtocolVersion:o.defaultProtocolVersion},t||{}),this.host=this.opts.host,this.port=this.opts.port,this.scheme=this.opts.scheme,this.protocolVersionVerified=!1,this.background=null,this.optimizeHMD=null,this.on("ready",function(){this.setBackground(this.opts.background),this.setOptimizeHMD(this.opts.optimizeHMD),this.opts.optimizeHMD?console.log("Optimized for head mounted display usage."):console.log("Optimized for desktop usage.")})};o.defaultProtocolVersion=6,o.prototype.getUrl=function(){return this.scheme+"//"+this.host+":"+this.port+"/v"+this.opts.requestProtocolVersion+".json"},o.prototype.getScheme=function(){return"ws:"},o.prototype.getPort=function(){return 6437},o.prototype.setBackground=function(t){this.opts.background=t,this.protocol&&this.protocol.sendBackground&&this.background!==this.opts.background&&(this.background=this.opts.background,this.protocol.sendBackground(this,this.opts.background))},o.prototype.setOptimizeHMD=function(t){this.opts.optimizeHMD=t,this.protocol&&this.protocol.sendOptimizeHMD&&this.optimizeHMD!==this.opts.optimizeHMD&&(this.optimizeHMD=this.opts.optimizeHMD,this.protocol.sendOptimizeHMD(this,this.opts.optimizeHMD))},o.prototype.handleOpen=function(){this.connected||(this.connected=!0,this.emit("connect"))},o.prototype.handleClose=function(t,e){this.connected&&(this.disconnect(),1001===t&&1<this.opts.requestProtocolVersion&&(this.protocolVersionVerified?this.protocolVersionVerified=!1:this.opts.requestProtocolVersion--),this.startReconnection())},o.prototype.startReconnection=function(){var t=this;this.reconnectionTimer||(this.reconnectionTimer=setInterval(function(){t.reconnect()},500))},o.prototype.stopReconnection=function(){this.reconnectionTimer=clearInterval(this.reconnectionTimer)},o.prototype.disconnect=function(t){if(t||this.stopReconnection(),this.socket)return this.socket.close(),delete this.socket,delete this.protocol,delete this.background,delete this.optimizeHMD,delete this.focusedState,this.connected&&(this.connected=!1,this.emit("disconnect")),!0},o.prototype.reconnect=function(){this.connected?this.stopReconnection():(this.disconnect(!0),this.connect())},o.prototype.handleData=function(t){var e,t=JSON.parse(t);void 0===this.protocol?(e=this.protocol=r(t),this.protocolVersionVerified=!0,this.emit("ready")):e=this.protocol(t),this.emit(e.type,e)},o.prototype.connect=function(){if(!this.socket)return this.socket=this.setupSocket(),!0},o.prototype.send=function(t){this.socket.send(t)},o.prototype.reportFocus=function(t){this.connected&&this.focusedState!==t&&(this.focusedState=t,this.emit(this.focusedState?"focus":"blur"),this.protocol&&this.protocol.sendFocused&&this.protocol.sendFocused(this,this.focusedState))},Object.assign(o.prototype,t.prototype)},{"../protocol":15,events:31}],4:[function(t,e,n){var r=e.exports=t("./base"),e=e.exports=function(t){r.call(this,t);var e=this;this.on("ready",function(){e.startFocusLoop()}),this.on("disconnect",function(){e.stopFocusLoop()})};Object.assign(e.prototype,r.prototype),e.__proto__=r,e.prototype.useSecure=function(){return"https:"===location.protocol},e.prototype.getScheme=function(){return this.useSecure()?"wss:":"ws:"},e.prototype.getPort=function(){return this.useSecure()?6436:6437},e.prototype.setupSocket=function(){var e=this,t=new WebSocket(this.getUrl());return t.onopen=function(){e.handleOpen()},t.onclose=function(t){e.handleClose(t.code,t.reason)},t.onmessage=function(t){e.handleData(t.data)},t.onerror=function(t){e.useSecure()&&"wss:"===e.scheme&&(e.scheme="ws:",e.port=6437,e.disconnect(),e.connect())},t},e.prototype.startFocusLoop=function(){var e,n,t,r,o;this.focusDetectorTimer||(e=this,n=null,n=void 0!==document.hidden?"hidden":void 0!==document.mozHidden?"mozHidden":void 0!==document.msHidden?"msHidden":void 0!==document.webkitHidden?"webkitHidden":void 0,void 0===e.windowVisible&&(e.windowVisible=void 0===n||!1===document[n]),t=window.addEventListener("focus",function(t){e.windowVisible=!0,o()}),r=window.addEventListener("blur",function(t){e.windowVisible=!1,o()}),this.on("disconnect",function(){window.removeEventListener("focus",t),window.removeEventListener("blur",r)}),(o=function(){var t=void 0===n||!1===document[n];e.reportFocus(t&&e.windowVisible)})(),this.focusDetectorTimer=setInterval(o,100))},e.prototype.stopFocusLoop=function(){this.focusDetectorTimer&&(clearTimeout(this.focusDetectorTimer),delete this.focusDetectorTimer)}},{"./base":3}],5:[function(t,e,n){var r=t("ws"),o=t("./base"),e=e.exports=function(t){o.call(this,t);var e=this;this.on("ready",function(){e.reportFocus(!0)})};Object.assign(e.prototype,o.prototype),e.__proto__=o,e.prototype.setupSocket=function(){var n=this,t=new r(this.getUrl());return t.on("open",function(){n.handleOpen()}),t.on("message",function(t){n.handleData(t)}),t.on("close",function(t,e){n.handleClose(t,e)}),t.on("error",function(){n.startReconnection()}),t}},{"./base":3,ws:33}],6:[function(d,e,t){(function(p){(function(){var o=d("./frame"),i=d("./hand"),a=d("./pointable"),s=d("./finger"),r=d("./circular_buffer"),u=d("./pipeline"),t=d("events").EventEmitter,c=d("./dialog"),h=e.exports=function(t){var e=void 0!==p&&p.versions&&p.versions.node,n=this;this.inNode=e,t=Object.assign({inNode:this.inNode,frameEventName:this.useAnimationLoop()?"animationFrame":"deviceFrame",suppressAnimationLoop:!this.useAnimationLoop(),loopWhileDisconnected:!0,useAllPlugins:!1,checkVersion:!0},t||{}),this.animationFrameRequested=!1,this.onAnimationFrame=function(t){n.lastConnectionFrame.valid&&n.emit("animationFrame",n.lastConnectionFrame),n.emit("frameEnd",t),n.loopWhileDisconnected&&(!1!==n.connection.focusedState||n.connection.opts.background)?window.requestAnimationFrame(n.onAnimationFrame):n.animationFrameRequested=!1},this.suppressAnimationLoop=t.suppressAnimationLoop,this.loopWhileDisconnected=t.loopWhileDisconnected,this.frameEventName=t.frameEventName,this.useAllPlugins=t.useAllPlugins,this.history=new r(200),this.lastFrame=o.Invalid,this.lastValidFrame=o.Invalid,this.lastConnectionFrame=o.Invalid,this.checkVersion=t.checkVersion,void 0===t.connectionType?this.connectionType=this.inBrowser()?d("./connection/browser"):d("./connection/node"):this.connectionType=t.connectionType,this.connection=new this.connectionType(t),this.streamingCount=0,this.devices={},this.plugins={},this._pluginPipelineSteps={},this._pluginExtendedMethods={},t.useAllPlugins&&this.useRegisteredPlugins(),this.setupFrameEvents(t),this.setupConnectionEvents(),this.startAnimationLoop()};h.prototype.setBackground=function(t){return this.connection.setBackground(t),this},h.prototype.setOptimizeHMD=function(t){return this.connection.setOptimizeHMD(t),this},h.prototype.inBrowser=function(){return!this.inNode},h.prototype.useAnimationLoop=function(){return this.inBrowser()&&!this.inBackgroundPage()},h.prototype.inBackgroundPage=function(){return"undefined"!=typeof chrome&&chrome.extension&&chrome.extension.getBackgroundPage&&chrome.extension.getBackgroundPage()===window},h.prototype.connect=function(){return this.connection.connect(),this},h.prototype.streaming=function(){return 0<this.streamingCount},h.prototype.connected=function(){return!!this.connection.connected},h.prototype.startAnimationLoop=function(){this.suppressAnimationLoop||this.animationFrameRequested||(this.animationFrameRequested=!0,window.requestAnimationFrame(this.onAnimationFrame))},h.prototype.disconnect=function(){return this.connection.disconnect(),this},h.prototype.frame=function(t){return this.history.get(t)||o.Invalid},h.prototype.loop=function(t){return t&&("function"==typeof t?this.on(this.frameEventName,t):this.setupFrameEvents(t)),this.connect()},h.prototype.addStep=function(t){this.pipeline||(this.pipeline=new u(this)),this.pipeline.addStep(t)},h.prototype.processFrame=function(t){this.lastConnectionFrame=t,this.startAnimationLoop(),this.emit("deviceFrame",t)},h.prototype.processFinishedFrame=function(t){(this.lastFrame=t).valid&&(this.lastValidFrame=t),t.controller=this,t.historyIdx=this.history.push(t),this.pipeline&&(t=(t=this.pipeline.run(t))||o.Invalid),this.emit("frame",t),this.emitHandEvents(t)},h.prototype.emitHandEvents=function(t){for(var e=0;e<t.hands.length;e++)this.emit("hand",t.hands[e])},h.prototype.setupFrameEvents=function(t){t.frame&&this.on("frame",t.frame),t.hand&&this.on("hand",t.hand)},h.prototype.setupConnectionEvents=function(){var i=this;this.connection.on("frame",function(t){i.processFrame(t)}),this.on(this.frameEventName,function(t){i.processFinishedFrame(t)});function e(){if(0<i.streamingCount){for(var t in i.devices)i.emit("deviceStopped",i.devices[t]),i.emit("deviceRemoved",i.devices[t]);for(var t in i.emit("streamingStopped",i.devices[t]),i.streamingCount=0,i.devices)delete i.devices[t]}}var n=function(){var t;i.connection.opts.requestProtocolVersion<5&&0==i.streamingCount&&(i.streamingCount=1,t={attached:!0,streaming:!0,type:"unknown",id:"Lx00000000000"},i.devices[t.id]=t,i.emit("deviceAttached",t),i.emit("deviceStreaming",t),i.emit("streamingStarted",t),i.connection.removeListener("frame",n))};this.connection.on("focus",function(){i.loopWhileDisconnected&&i.startAnimationLoop(),i.emit("focus")}),this.connection.on("blur",function(){i.emit("blur")}),this.connection.on("protocol",function(t){t.on("beforeFrameCreated",function(t){i.emit("beforeFrameCreated",t)}),t.on("afterFrameCreated",function(t,e){i.emit("afterFrameCreated",t,e)}),i.emit("protocol",t)}),this.connection.on("ready",function(){i.checkVersion&&!i.inNode&&i.checkOutOfDate(),i.emit("ready")}),this.connection.on("connect",function(){i.emit("connect"),i.connection.removeListener("frame",n),i.connection.on("frame",n)}),this.connection.on("disconnect",function(){i.emit("disconnect"),e()}),this.connection.on("deviceConnect",function(t){t.state?(i.emit("deviceConnected"),i.connection.removeListener("frame",n),i.connection.on("frame",n)):(i.emit("deviceDisconnected"),e())}),this.connection.on("deviceEvent",function(t){var e,n=t.state,r=i.devices[n.id],o={};for(e in n)r&&r.hasOwnProperty(e)&&r[e]==n[e]||(o[e]=!0);i.devices[n.id]=n,o.attached&&i.emit(n.attached?"deviceAttached":"deviceRemoved",n),o.streaming&&(n.streaming?(i.streamingCount++,i.emit("deviceStreaming",n),1==i.streamingCount&&i.emit("streamingStarted",n),o.attached||i.emit("deviceConnected")):o.attached&&n.attached||(i.streamingCount--,i.emit("deviceStopped",n),0==i.streamingCount&&i.emit("streamingStopped",n),i.emit("deviceDisconnected")))}),this.on("newListener",function(t,e){"deviceConnected"!=t&&"deviceDisconnected"!=t||console.warn(t+" events are deprecated. Consider using 'streamingStarted/streamingStopped' or 'deviceStreaming/deviceStopped' instead")})},h.prototype.checkOutOfDate=function(){console.assert(this.connection&&this.connection.protocol);var t=this.connection.protocol.serviceVersion,e=this.connection.protocol.version,n=this.connectionType.defaultProtocolVersion;return e<n&&(console.warn("Your Protocol Version is v"+e+", this app was designed for v"+n),c.warnOutOfDate({sV:t,pV:e}),!0)},h._pluginFactories={},h.plugin=function(t,e){return this._pluginFactories[t]&&console.warn('Plugin "'+t+'" already registered'),this._pluginFactories[t]=e},h.plugins=function(){return Object.keys(this._pluginFactories)};function l(t,e,n){-1!=["beforeFrameCreated","afterFrameCreated"].indexOf(e)?this.on(e,n):(this.pipeline||(this.pipeline=new u(this)),this._pluginPipelineSteps[t]||(this._pluginPipelineSteps[t]=[]),this._pluginPipelineSteps[t].push(this.pipeline.addWrappedStep(e,n)))}function f(t,e,n){var r;switch(this._pluginExtendedMethods[t]||(this._pluginExtendedMethods[t]=[]),e){case"frame":r=o;break;case"hand":r=i;break;case"pointable":r=a,Object.assign(s.prototype,n),Object.assign(s.Invalid,n);break;case"finger":r=s;break;default:throw t+' specifies invalid object type "'+e+'" for prototypical extension'}Object.assign(r.prototype,n),Object.assign(r.Invalid,n),this._pluginExtendedMethods[t].push([r,n])}h.prototype.use=function(t,e){var n,r,o,i="function"==typeof t?t:h._pluginFactories[t];if(!i)throw"Leap Plugin "+t+" not found.";if(e=e||{},this.plugins[t])return Object.assign(this.plugins[t],e),this;for(r in this.plugins[t]=e,o=i.call(this,e))("function"==typeof(n=o[r])?l:f).call(this,t,r,n);return this},h.prototype.stopUsing=function(t){var e,n=this._pluginPipelineSteps[t],r=this._pluginExtendedMethods[t],o=0;if(this.plugins[t]){if(n)for(o=0;o<n.length;o++)this.pipeline.removeStep(n[o]);if(r)for(o=0;o<r.length;o++)for(var i in e=r[o][0],r[o][1])delete e.prototype[i],delete e.Invalid[i];return delete this.plugins[t],this}},h.prototype.useRegisteredPlugins=function(){for(var t in h._pluginFactories)this.use(t)},Object.assign(h.prototype,t.prototype)}).call(this)}).call(this,d("_process"))},{"./circular_buffer":2,"./connection/browser":4,"./connection/node":5,"./dialog":7,"./finger":8,"./frame":9,"./hand":10,"./pipeline":13,"./pointable":14,_process:32,events:31}],7:[function(t,e,n){(function(t){(function(){var o=e.exports=function(t,e){this.options=e||{},this.message=t,this.createElement()};o.prototype.createElement=function(){this.element=document.createElement("div"),this.element.className="leapjs-dialog",this.element.style.position="fixed",this.element.style.top="8px",this.element.style.left=0,this.element.style.right=0,this.element.style.textAlign="center",this.element.style.zIndex=1e3;var t=document.createElement("div");this.element.appendChild(t),t.style.className="leapjs-dialog",t.style.display="inline-block",t.style.margin="auto",t.style.padding="8px",t.style.color="#222",t.style.background="#eee",t.style.borderRadius="4px",t.style.border="1px solid #999",t.style.textAlign="left",t.style.cursor="pointer",t.style.whiteSpace="nowrap",t.style.transition="box-shadow 1s linear",t.innerHTML=this.message,this.options.onclick&&t.addEventListener("click",this.options.onclick),this.options.onmouseover&&t.addEventListener("mouseover",this.options.onmouseover),this.options.onmouseout&&t.addEventListener("mouseout",this.options.onmouseout),this.options.onmousemove&&t.addEventListener("mousemove",this.options.onmousemove)},o.prototype.show=function(){return document.body.appendChild(this.element),this},o.prototype.hide=function(){return document.body.removeChild(this.element),this},o.warnOutOfDate=function(t){var e,n="http://developer.leapmotion.com?";for(e in(t=t||{}).returnTo=window.location.href,t)n+=e+"="+encodeURIComponent(t[e])+"&";var r=new o("This site requires Leap Motion Tracking V2.<button id='leapjs-accept-upgrade' style='color: #444; transition: box-shadow 100ms linear; cursor: pointer; vertical-align: baseline; margin-left: 16px;'>Upgrade</button><button id='leapjs-decline-upgrade' style='color: #444; transition: box-shadow 100ms linear; cursor: pointer; vertical-align: baseline; margin-left: 8px; '>Not Now</button>",{onclick:function(t){return"leapjs-decline-upgrade"!=t.target.id&&(t=window.open(n,"_blank","height=800,width=1000,location=1,menubar=1,resizable=1,status=1,toolbar=1,scrollbars=1"),window.focus&&t.focus()),r.hide(),!0},onmousemove:function(t){t.target==document.getElementById("leapjs-decline-upgrade")?(document.getElementById("leapjs-decline-upgrade").style.color="#000",document.getElementById("leapjs-decline-upgrade").style.boxShadow="0px 0px 2px #5daa00",document.getElementById("leapjs-accept-upgrade").style.color="#444",document.getElementById("leapjs-accept-upgrade").style.boxShadow="none"):(document.getElementById("leapjs-accept-upgrade").style.color="#000",document.getElementById("leapjs-accept-upgrade").style.boxShadow="0px 0px 2px #5daa00",document.getElementById("leapjs-decline-upgrade").style.color="#444",document.getElementById("leapjs-decline-upgrade").style.boxShadow="none")},onmouseout:function(){document.getElementById("leapjs-decline-upgrade").style.color="#444",document.getElementById("leapjs-decline-upgrade").style.boxShadow="none",document.getElementById("leapjs-accept-upgrade").style.color="#444",document.getElementById("leapjs-accept-upgrade").style.boxShadow="none"}});return r.show()},o.hasWarnedBones=!1,o.warnBones=function(){this.hasWarnedBones||(this.hasWarnedBones=!0,console.warn("Your Leap Service is out of date"),void 0!==t&&t.versions&&t.versions.node||this.warnOutOfDate({reason:"bones"}))}}).call(this)}).call(this,t("_process"))},{_process:32}],8:[function(t,e,n){var r=t("./pointable"),o=t("./bone"),i=t("./dialog"),e=e.exports=function(t){r.call(this,t),this.dipPosition=t.dipPosition,this.pipPosition=t.pipPosition,this.mcpPosition=t.mcpPosition,this.carpPosition=t.carpPosition,this.extended=t.extended,this.type=t.type,this.finger=!0,this.positions=[this.carpPosition,this.mcpPosition,this.pipPosition,this.dipPosition,this.tipPosition],t.bases?this.addBones(t):i.warnBones()};Object.assign(e.prototype,r.prototype),e.prototype.addBones=function(t){this.metacarpal=new o(this,{type:0,width:this.width,prevJoint:this.carpPosition,nextJoint:this.mcpPosition,basis:t.bases[0]}),this.proximal=new o(this,{type:1,width:this.width,prevJoint:this.mcpPosition,nextJoint:this.pipPosition,basis:t.bases[1]}),this.medial=new o(this,{type:2,width:this.width,prevJoint:this.pipPosition,nextJoint:this.dipPosition,basis:t.bases[2]}),this.distal=new o(this,{type:3,width:this.width,prevJoint:this.dipPosition,nextJoint:t.btipPosition,basis:t.bases[3]}),this.bones=[this.metacarpal,this.proximal,this.medial,this.distal]},e.prototype.toString=function(){return"Finger [ id:"+this.id+" "+this.length+"mmx | width:"+this.width+"mm | direction:"+this.direction+" ]"},e.Invalid={valid:!1}},{"./bone":1,"./dialog":7,"./pointable":14}],9:[function(t,e,n){var u=t("./hand"),c=t("./pointable"),r=t("gl-matrix"),o=r.mat3,i=r.vec3,a=t("./interaction_box"),h=t("./finger"),e=e.exports=function(t){this.valid=!0,this.id=t.id,this.timestamp=t.timestamp,this.hands=[],this.handsMap={},this.pointables=[],this.fingers=[],t.interactionBox&&(this.interactionBox=new a(t.interactionBox)),this.pointablesMap={},this._translation=t.t,this._rotation=function n(t){return Array.isArray(t)?t.reduce(function(t,e){return t.concat(n(e))},[]):[t]}(t.r),this._scaleFactor=t.s,this.data=t,this.type="frame",this.currentFrameRate=t.currentFrameRate,this.postprocessData(t)};e.prototype.postprocessData=function(t){for(var e=0,n=(t=t||this.data).hands.length;e!=n;e++){var r=new u(t.hands[e]);(r.frame=this).hands.push(r),this.handsMap[r.id]=r}var o;t.pointables.sort((o="id",function(t,e){return t[o]>e[o]?1:e[o]>t[o]?-1:0}));for(var i=0,a=t.pointables.length;i!=a;i++){var s=t.pointables[i],s=new(s.dipPosition?h:c)(s);(s.frame=this).addPointable(s)}},e.prototype.addPointable=function(t){if(this.pointables.push(t),this.pointablesMap[t.id]=t,this.fingers.push(t),void 0!==t.handId&&this.handsMap.hasOwnProperty(t.handId)){var e=this.handsMap[t.handId];switch(e.pointables.push(t),e.fingers.push(t),t.type){case 0:e.thumb=t;break;case 1:e.indexFinger=t;break;case 2:e.middleFinger=t;break;case 3:e.ringFinger=t;break;case 4:e.pinky=t}}},e.prototype.pointable=function(t){return this.pointablesMap[t]||c.Invalid},e.prototype.finger=function(t){return this.pointable(t)},e.prototype.hand=function(t){return this.handsMap[t]||u.Invalid},e.prototype.rotationAngle=function(t,e){if(!this.valid||!t.valid)return 0;var n=this.rotationMatrix(t),n=.5*(n[0]+n[4]+n[8]-1),n=Math.acos(n),n=isNaN(n)?0:n;return void 0!==e&&(t=this.rotationAxis(t),n*=i.dot(t,i.normalize(i.create(),e))),n},e.prototype.rotationAxis=function(t){return this.valid&&t.valid?i.normalize(i.create(),[this._rotation[7]-t._rotation[5],this._rotation[2]-t._rotation[6],this._rotation[3]-t._rotation[1]]):i.create()},e.prototype.rotationMatrix=function(t){if(!this.valid||!t.valid)return o.create();var e=o.transpose(o.create(),this._rotation);return o.multiply(o.create(),t._rotation,e)},e.prototype.scaleFactor=function(t){return this.valid&&t.valid?Math.exp(this._scaleFactor-t._scaleFactor):1},e.prototype.translation=function(t){return this.valid&&t.valid?i.subtract(i.create(),this._translation,t._translation):i.create()},e.prototype.toString=function(){var t="Frame [ id:"+this.id+" | timestamp:"+this.timestamp+" | Hand count:("+this.hands.length+") | Pointable count:("+this.pointables.length+")";return t+=" ]"},e.prototype.dump=function(){var t="";t+="Frame Info:<br/>",t+=this.toString(),t+="<br/><br/>Hands:<br/>";for(var e=0,n=this.hands.length;e!=n;e++)t+=" "+this.hands[e].toString()+"<br/>";t+="<br/><br/>Pointables:<br/>";for(var r=0,o=this.pointables.length;r!=o;r++)t+=" "+this.pointables[r].toString()+"<br/>";return t+="<br/><br/>Raw JSON:<br/>",t+=JSON.stringify(this.data)},e.Invalid={valid:!1,hands:[],fingers:[],pointables:[],pointable:function(){return c.Invalid},finger:function(){return c.Invalid},hand:function(){return u.Invalid},toString:function(){return"invalid frame"},dump:function(){return this.toString()},rotationAngle:function(){return 0},rotationMatrix:function(){return o.create()},rotationAxis:function(){return i.create()},scaleFactor:function(){return 1},translation:function(){return i.create()}}},{"./finger":8,"./hand":10,"./interaction_box":12,"./pointable":14,"gl-matrix":21}],10:[function(t,e,n){var r=t("./pointable"),o=t("./bone"),t=t("gl-matrix"),i=t.mat3,a=t.vec3,e=e.exports=function(t){this.id=t.id,this.palmPosition=t.palmPosition,this.direction=t.direction,this.palmVelocity=t.palmVelocity,this.palmNormal=t.palmNormal,this.sphereCenter=t.sphereCenter,this.sphereRadius=t.sphereRadius,this.valid=!0,this.pointables=[],this.fingers=[],t.armBasis?this.arm=new o(this,{type:4,width:t.armWidth,prevJoint:t.elbow,nextJoint:t.wrist,basis:t.armBasis}):this.arm=null,this._translation=t.t,this._rotation=function n(t){return Array.isArray(t)?t.reduce(function(t,e){return t.concat(n(e))},[]):[t]}(t.r),this._scaleFactor=t.s,this.timeVisible=t.timeVisible,this.stabilizedPalmPosition=t.stabilizedPalmPosition,this.type=t.type,this.grabStrength=t.grabStrength,this.pinchStrength=t.pinchStrength,this.confidence=t.confidence};e.prototype.finger=function(t){t=this.frame.finger(t);return t&&t.handId==this.id?t:r.Invalid},e.prototype.rotationAngle=function(t,e){if(!this.valid||!t.valid)return 0;if(!t.hand(this.id).valid)return 0;var n=this.rotationMatrix(t),n=.5*(n[0]+n[4]+n[8]-1),n=Math.acos(n),n=isNaN(n)?0:n;return void 0!==e&&(t=this.rotationAxis(t),n*=a.dot(t,a.normalize(a.create(),e))),n},e.prototype.rotationAxis=function(t){if(!this.valid||!t.valid)return a.create();t=t.hand(this.id);return t.valid?a.normalize(a.create(),[this._rotation[7]-t._rotation[5],this._rotation[2]-t._rotation[6],this._rotation[3]-t._rotation[1]]):a.create()},e.prototype.rotationMatrix=function(t){if(!this.valid||!t.valid)return i.create();var e=t.hand(this.id);if(!e.valid)return i.create();t=i.transpose(i.create(),this._rotation);return i.multiply(i.create(),e._rotation,t)},e.prototype.scaleFactor=function(t){if(!this.valid||!t.valid)return 1;t=t.hand(this.id);return t.valid?Math.exp(this._scaleFactor-t._scaleFactor):1},e.prototype.translation=function(t){if(!this.valid||!t.valid)return a.create();t=t.hand(this.id);return t.valid?[this._translation[0]-t._translation[0],this._translation[1]-t._translation[1],this._translation[2]-t._translation[2]]:a.create()},e.prototype.toString=function(){return"Hand ("+this.type+") [ id: "+this.id+" | palm velocity:"+this.palmVelocity+" | sphere center:"+this.sphereCenter+" ] "},e.prototype.pitch=function(){return Math.atan2(this.direction[1],-this.direction[2])},e.prototype.yaw=function(){return Math.atan2(this.direction[0],-this.direction[2])},e.prototype.roll=function(){return Math.atan2(this.palmNormal[0],-this.palmNormal[1])},e.Invalid={valid:!1,fingers:[],pointables:[],left:!1,pointable:function(){return r.Invalid},finger:function(){return r.Invalid},toString:function(){return"invalid frame"},dump:function(){return this.toString()},rotationAngle:function(){return 0},rotationMatrix:function(){return i.create()},rotationAxis:function(){return a.create()},scaleFactor:function(){return 1},translation:function(){return a.create()}}},{"./bone":1,"./pointable":14,"gl-matrix":21}],11:[function(t,e,n){e.exports={Controller:t("./controller"),Frame:t("./frame"),Hand:t("./hand"),Pointable:t("./pointable"),Finger:t("./finger"),InteractionBox:t("./interaction_box"),CircularBuffer:t("./circular_buffer"),UI:t("./ui"),JSONProtocol:t("./protocol").JSONProtocol,glMatrix:t("gl-matrix"),mat3:t("gl-matrix").mat3,vec3:t("gl-matrix").vec3,loopController:void 0,version:t("./version.js"),EventEmitter:t("events").EventEmitter,loop:function(t,e){return t&&void 0===e&&"[object Function]"==={}.toString.call(t)&&(e=t,t={}),this.loopController?t&&this.loopController.setupFrameEvents(t):this.loopController=new this.Controller(t),this.loopController.loop(e),this.loopController},plugin:function(t,e){this.Controller.plugin(t,e)}}},{"./circular_buffer":2,"./controller":6,"./finger":8,"./frame":9,"./hand":10,"./interaction_box":12,"./pointable":14,"./protocol":15,"./ui":16,"./version.js":19,events:31,"gl-matrix":21}],12:[function(t,e,n){var r=t("gl-matrix").vec3,e=e.exports=function(t){this.valid=!0,this.center=t.center,this.size=t.size,this.width=t.size[0],this.height=t.size[1],this.depth=t.size[2]};e.prototype.denormalizePoint=function(t){return r.fromValues((t[0]-.5)*this.size[0]+this.center[0],(t[1]-.5)*this.size[1]+this.center[1],(t[2]-.5)*this.size[2]+this.center[2])},e.prototype.normalizePoint=function(t,e){t=r.fromValues((t[0]-this.center[0])/this.size[0]+.5,(t[1]-this.center[1])/this.size[1]+.5,(t[2]-this.center[2])/this.size[2]+.5);return e&&(t[0]=Math.min(Math.max(t[0],0),1),t[1]=Math.min(Math.max(t[1],0),1),t[2]=Math.min(Math.max(t[2],0),1)),t},e.prototype.toString=function(){return"InteractionBox [ width:"+this.width+" | height:"+this.height+" | depth:"+this.depth+" ]"},e.Invalid={valid:!1}},{"gl-matrix":21}],13:[function(t,e,n){e=e.exports=function(t){this.steps=[],this.controller=t};e.prototype.addStep=function(t){this.steps.push(t)},e.prototype.run=function(t){for(var e=this.steps.length,n=0;n!=e&&t;n++)t=this.steps[n](t);return t},e.prototype.removeStep=function(t){t=this.steps.indexOf(t);if(-1===t)throw"Step not found in pipeline";this.steps.splice(t,1)},e.prototype.addWrappedStep=function(o,i){function t(t){for(var e="frame"==o?[t]:t[o+"s"]||[],n=0,r=e.length;n<r;n++)i.call(a,e[n]);return t}var a=this.controller;return this.addStep(t),t}},{}],14:[function(t,e,n){t("gl-matrix").vec3;e=e.exports=function(t){this.valid=!0,this.id=t.id,this.handId=t.handId,this.length=t.length,this.tool=t.tool,this.width=t.width,this.direction=t.direction,this.stabilizedTipPosition=t.stabilizedTipPosition,this.tipPosition=t.tipPosition,this.tipVelocity=t.tipVelocity,this.touchZone=t.touchZone,this.touchDistance=t.touchDistance,this.timeVisible=t.timeVisible};e.prototype.toString=function(){return"Pointable [ id:"+this.id+" "+this.length+"mmx | width:"+this.width+"mm | direction:"+this.direction+" ]"},e.prototype.hand=function(){return this.frame.hand(this.handId)},e.Invalid={valid:!1}},{"gl-matrix":21}],15:[function(t,e,n){function r(t){this.type=t.type,this.state=t.state}var o=t("./frame"),i=t("events").EventEmitter;n.chooseProtocol=function(t){var n;switch(t.version){case 1:case 2:case 3:case 4:case 5:case 6:(n=a(t)).sendBackground=function(t,e){t.send(n.encode({background:e}))},n.sendFocused=function(t,e){t.send(n.encode({focused:e}))},n.sendOptimizeHMD=function(t,e){t.send(n.encode({optimizeHMD:e}))};break;default:throw"unrecognized version"}return n};var a=n.JSONProtocol=function(t){var n=function(t){if(t.event)return new r(t.event);n.emit("beforeFrameCreated",t);var e=new o(t);return n.emit("afterFrameCreated",e,t),e};return n.encode=function(t){return JSON.stringify(t)},n.version=t.version,n.serviceVersion=t.serviceVersion,n.versionLong="Version "+t.version,n.type="protocol",Object.assign(n,i.prototype),n}},{"./frame":9,events:31}],16:[function(t,e,n){n.UI={Region:t("./ui/region"),Cursor:t("./ui/cursor")}},{"./ui/cursor":17,"./ui/region":18}],17:[function(t,e,n){e.exports=function(){return function(t){var e=t.pointables.sort(function(t,e){return t.z-e.z})[0];return e&&e.valid&&(t.cursorPosition=e.tipPosition),t}}},{}],18:[function(t,e,n){var t=t("events").EventEmitter,r=e.exports=function(t,e){this.start=new Vector(t),this.end=new Vector(e),this.enteredFrame=null};r.prototype.hasPointables=function(t){for(var e=0;e!=t.pointables.length;e++){var n=t.pointables[e].tipPosition;if(n.x>=this.start.x&&n.x<=this.end.x&&n.y>=this.start.y&&n.y<=this.end.y&&n.z>=this.start.z&&n.z<=this.end.z)return!0}return!1},r.prototype.listener=function(t){var e=this;return t&&t.nearThreshold&&this.setupNearRegion(t.nearThreshold),function(t){return e.updatePosition(t)}},r.prototype.clipper=function(){var e=this;return function(t){return e.updatePosition(t),e.enteredFrame?t:null}},r.prototype.setupNearRegion=function(t){var t=this.nearRegion=new r([this.start.x-t,this.start.y-t,this.start.z-t],[this.end.x+t,this.end.y+t,this.end.z+t]),e=this;t.on("enter",function(t){e.emit("near",t)}),t.on("exit",function(t){e.emit("far",t)}),e.on("exit",function(t){e.emit("near",t)})},r.prototype.updatePosition=function(t){return this.nearRegion&&this.nearRegion.updatePosition(t),this.hasPointables(t)&&null==this.enteredFrame?(this.enteredFrame=t,this.emit("enter",this.enteredFrame)):this.hasPointables(t)||null==this.enteredFrame||(this.enteredFrame=null,this.emit("exit",this.enteredFrame)),t},r.prototype.normalize=function(t){return new Vector([(t.x-this.start.x)/(this.end.x-this.start.x),(t.y-this.start.y)/(this.end.y-this.start.y),(t.z-this.start.z)/(this.end.z-this.start.z)])},r.prototype.mapToXY=function(t,e,n){var r=this.normalize(t),o=r.x,t=r.y;return 1<o?o=1:o<-1&&(o=-1),1<t?t=1:t<-1&&(t=-1),[(o+1)/2*e,(1-t)/2*n,r.z]},Object.assign(r.prototype,t.prototype)},{events:31}],19:[function(t,e,n){e.exports={full:"1.1.1",major:1,minor:1,dot:1}},{}],20:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.setMatrixArrayType=function(t){n.ARRAY_TYPE=o=t},n.toRadian=function(t){return t*a},n.equals=function(t,e){return Math.abs(t-e)<=r*Math.max(1,Math.abs(t),Math.abs(e))},n.RANDOM=n.ARRAY_TYPE=n.EPSILON=void 0;var r=1e-6;n.EPSILON=r;var o="undefined"!=typeof Float32Array?Float32Array:Array;n.ARRAY_TYPE=o;var i=Math.random;n.RANDOM=i;var a=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)})},{}],21:[function(t,e,n){"use strict";function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(n,"__esModule",{value:!0}),n.vec4=n.vec3=n.vec2=n.quat2=n.quat=n.mat4=n.mat3=n.mat2d=n.mat2=n.glMatrix=void 0;var r=o(t("./common.js"));n.glMatrix=r;r=o(t("./mat2.js"));n.mat2=r;r=o(t("./mat2d.js"));n.mat2d=r;r=o(t("./mat3.js"));n.mat3=r;r=o(t("./mat4.js"));n.mat4=r;r=o(t("./quat.js"));n.quat=r;r=o(t("./quat2.js"));n.quat2=r;r=o(t("./vec2.js"));n.vec2=r;r=o(t("./vec3.js"));n.vec3=r;t=o(t("./vec4.js"));function s(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return s=function(){return t},t}function o(t){if(t&&t.__esModule)return t;if(null===t||"object"!==a(t)&&"function"!=typeof t)return{default:t};var e=s();if(e&&e.has(t))return e.get(t);var n,r,o={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&((r=i?Object.getOwnPropertyDescriptor(t,n):null)&&(r.get||r.set)?Object.defineProperty(o,n,r):o[n]=t[n]);return o.default=t,e&&e.set(t,o),o}n.vec4=t},{"./common.js":20,"./mat2.js":22,"./mat2d.js":23,"./mat3.js":24,"./mat4.js":25,"./quat.js":26,"./quat2.js":27,"./vec2.js":28,"./vec3.js":29,"./vec4.js":30}],22:[function(t,e,n){"use strict";function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(n,"__esModule",{value:!0}),n.create=function(){var t=new u.ARRAY_TYPE(4);u.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0);return t[0]=1,t[3]=1,t},n.clone=function(t){var e=new u.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},n.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},n.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},n.fromValues=function(t,e,n,r){var o=new u.ARRAY_TYPE(4);return o[0]=t,o[1]=e,o[2]=n,o[3]=r,o},n.set=function(t,e,n,r,o){return t[0]=e,t[1]=n,t[2]=r,t[3]=o,t},n.transpose=function(t,e){{var n;t===e?(n=e[1],t[1]=e[2],t[2]=n):(t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3])}return t},n.invert=function(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],e=n*i-o*r;return e?(e=1/e,t[0]=i*e,t[1]=-r*e,t[2]=-o*e,t[3]=n*e,t):null},n.adjoint=function(t,e){var n=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=n,t},n.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},n.multiply=r,n.rotate=function(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],e=Math.sin(n),n=Math.cos(n);return t[0]=r*n+i*e,t[1]=o*n+a*e,t[2]=r*-e+i*n,t[3]=o*-e+a*n,t},n.scale=function(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],e=n[0],n=n[1];return t[0]=r*e,t[1]=o*e,t[2]=i*n,t[3]=a*n,t},n.fromRotation=function(t,e){var n=Math.sin(e),e=Math.cos(e);return t[0]=e,t[1]=n,t[2]=-n,t[3]=e,t},n.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t},n.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},n.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3])},n.LDU=function(t,e,n,r){return t[2]=r[2]/r[0],n[0]=r[0],n[1]=r[1],n[3]=r[3]-t[2]*n[1],[t,e,n]},n.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t},n.subtract=o,n.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},n.equals=function(t,e){var n=t[0],r=t[1],o=t[2],i=t[3],a=e[0],s=e[1],t=e[2],e=e[3];return Math.abs(n-a)<=u.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-s)<=u.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(o-t)<=u.EPSILON*Math.max(1,Math.abs(o),Math.abs(t))&&Math.abs(i-e)<=u.EPSILON*Math.max(1,Math.abs(i),Math.abs(e))},n.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},n.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t},n.sub=n.mul=void 0;var u=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==a(t)&&"function"!=typeof t)return{default:t};var e=s();if(e&&e.has(t))return e.get(t);var n,r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(n in t){var i;Object.prototype.hasOwnProperty.call(t,n)&&((i=o?Object.getOwnPropertyDescriptor(t,n):null)&&(i.get||i.set)?Object.defineProperty(r,n,i):r[n]=t[n])}r.default=t,e&&e.set(t,r);return r}(t("./common.js"));function s(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return s=function(){return t},t}function r(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=n[0],u=n[1],e=n[2],n=n[3];return t[0]=r*s+i*u,t[1]=o*s+a*u,t[2]=r*e+i*n,t[3]=o*e+a*n,t}function o(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}n.mul=r,n.sub=o},{"./common.js":20}],23:[function(t,e,n){"use strict";function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(n,"__esModule",{value:!0}),n.create=function(){var t=new f.ARRAY_TYPE(6);f.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0);return t[0]=1,t[3]=1,t},n.clone=function(t){var e=new f.ARRAY_TYPE(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},n.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},n.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},n.fromValues=function(t,e,n,r,o,i){var a=new f.ARRAY_TYPE(6);return a[0]=t,a[1]=e,a[2]=n,a[3]=r,a[4]=o,a[5]=i,a},n.set=function(t,e,n,r,o,i,a){return t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=i,t[5]=a,t},n.invert=function(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=e[4],s=e[5],e=n*i-r*o;return e?(e=1/e,t[0]=i*e,t[1]=-r*e,t[2]=-o*e,t[3]=n*e,t[4]=(o*s-i*a)*e,t[5]=(r*a-n*s)*e,t):null},n.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},n.multiply=r,n.rotate=function(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],e=Math.sin(n),n=Math.cos(n);return t[0]=r*n+i*e,t[1]=o*n+a*e,t[2]=r*-e+i*n,t[3]=o*-e+a*n,t[4]=s,t[5]=u,t},n.scale=function(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],e=n[0],n=n[1];return t[0]=r*e,t[1]=o*e,t[2]=i*n,t[3]=a*n,t[4]=s,t[5]=u,t},n.translate=function(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],e=n[0],n=n[1];return t[0]=r,t[1]=o,t[2]=i,t[3]=a,t[4]=r*e+i*n+s,t[5]=o*e+a*n+u,t},n.fromRotation=function(t,e){var n=Math.sin(e),e=Math.cos(e);return t[0]=e,t[1]=n,t[2]=-n,t[3]=e,t[4]=0,t[5]=0,t},n.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t},n.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t},n.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},n.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],1)},n.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t},n.subtract=o,n.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t},n.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t},n.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]},n.equals=function(t,e){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],u=e[0],c=e[1],h=e[2],l=e[3],t=e[4],e=e[5];return Math.abs(n-u)<=f.EPSILON*Math.max(1,Math.abs(n),Math.abs(u))&&Math.abs(r-c)<=f.EPSILON*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(o-h)<=f.EPSILON*Math.max(1,Math.abs(o),Math.abs(h))&&Math.abs(i-l)<=f.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(a-t)<=f.EPSILON*Math.max(1,Math.abs(a),Math.abs(t))&&Math.abs(s-e)<=f.EPSILON*Math.max(1,Math.abs(s),Math.abs(e))},n.sub=n.mul=void 0;var f=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==a(t)&&"function"!=typeof t)return{default:t};var e=s();if(e&&e.has(t))return e.get(t);var n,r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(n in t){var i;Object.prototype.hasOwnProperty.call(t,n)&&((i=o?Object.getOwnPropertyDescriptor(t,n):null)&&(i.get||i.set)?Object.defineProperty(r,n,i):r[n]=t[n])}r.default=t,e&&e.set(t,r);return r}(t("./common.js"));function s(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return s=function(){return t},t}function r(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=n[0],h=n[1],l=n[2],f=n[3],e=n[4],n=n[5];return t[0]=r*c+i*h,t[1]=o*c+a*h,t[2]=r*l+i*f,t[3]=o*l+a*f,t[4]=r*e+i*n+s,t[5]=o*e+a*n+u,t}function o(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t}n.mul=r,n.sub=o},{"./common.js":20}],24:[function(t,e,n){"use strict";function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(n,"__esModule",{value:!0}),n.create=function(){var t=new b.ARRAY_TYPE(9);b.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0);return t[0]=1,t[4]=1,t[8]=1,t},n.fromMat4=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t},n.clone=function(t){var e=new b.ARRAY_TYPE(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},n.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},n.fromValues=function(t,e,n,r,o,i,a,s,u){var c=new b.ARRAY_TYPE(9);return c[0]=t,c[1]=e,c[2]=n,c[3]=r,c[4]=o,c[5]=i,c[6]=a,c[7]=s,c[8]=u,c},n.set=function(t,e,n,r,o,i,a,s,u,c){return t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=i,t[5]=a,t[6]=s,t[7]=u,t[8]=c,t},n.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},n.transpose=function(t,e){{var n,r,o;t===e?(n=e[1],r=e[2],o=e[5],t[1]=e[3],t[2]=e[6],t[3]=n,t[5]=e[7],t[6]=r,t[7]=o):(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8])}return t},n.invert=function(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=e[6],c=e[7],h=e[8],l=h*a-s*c,f=-h*i+s*u,p=c*i-a*u,e=n*l+r*f+o*p;return e?(e=1/e,t[0]=l*e,t[1]=(-h*r+o*c)*e,t[2]=(s*r-o*a)*e,t[3]=f*e,t[4]=(h*n-o*u)*e,t[5]=(-s*n+o*i)*e,t[6]=p*e,t[7]=(-c*n+r*u)*e,t[8]=(a*n-r*i)*e,t):null},n.adjoint=function(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=e[6],c=e[7],e=e[8];return t[0]=a*e-s*c,t[1]=o*c-r*e,t[2]=r*s-o*a,t[3]=s*u-i*e,t[4]=n*e-o*u,t[5]=o*i-n*s,t[6]=i*c-a*u,t[7]=r*u-n*c,t[8]=n*a-r*i,t},n.determinant=function(t){var e=t[0],n=t[1],r=t[2],o=t[3],i=t[4],a=t[5],s=t[6],u=t[7],t=t[8];return e*(t*i-a*u)+n*(-t*o+a*s)+r*(u*o-i*s)},n.multiply=r,n.translate=function(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=e[8],e=n[0],n=n[1];return t[0]=r,t[1]=o,t[2]=i,t[3]=a,t[4]=s,t[5]=u,t[6]=e*r+n*a+c,t[7]=e*o+n*s+h,t[8]=e*i+n*u+l,t},n.rotate=function(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=e[8],e=Math.sin(n),n=Math.cos(n);return t[0]=n*r+e*a,t[1]=n*o+e*s,t[2]=n*i+e*u,t[3]=n*a-e*r,t[4]=n*s-e*o,t[5]=n*u-e*i,t[6]=c,t[7]=h,t[8]=l,t},n.scale=function(t,e,n){var r=n[0],n=n[1];return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=n*e[3],t[4]=n*e[4],t[5]=n*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},n.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t},n.fromRotation=function(t,e){var n=Math.sin(e),e=Math.cos(e);return t[0]=e,t[1]=n,t[2]=0,t[3]=-n,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},n.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},n.fromMat2d=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t},n.fromQuat=function(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=n+n,s=r+r,u=o+o,c=n*a,h=r*a,e=r*s,n=o*a,r=o*s,o=o*u,a=i*a,s=i*s,u=i*u;return t[0]=1-e-o,t[3]=h-u,t[6]=n+s,t[1]=h+u,t[4]=1-c-o,t[7]=r-a,t[2]=n-s,t[5]=r+a,t[8]=1-c-e,t},n.normalFromMat4=function(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=e[6],c=e[7],h=e[8],l=e[9],f=e[10],p=e[11],d=e[12],m=e[13],v=e[14],y=e[15],b=n*s-r*a,M=n*u-o*a,g=n*c-i*a,P=r*u-o*s,w=r*c-i*s,x=o*c-i*u,O=h*m-l*d,S=h*v-f*d,e=h*y-p*d,h=l*v-f*m,l=l*y-p*m,f=f*y-p*v,p=b*f-M*l+g*h+P*e-w*S+x*O;return p?(p=1/p,t[0]=(s*f-u*l+c*h)*p,t[1]=(u*e-a*f-c*S)*p,t[2]=(a*l-s*e+c*O)*p,t[3]=(o*l-r*f-i*h)*p,t[4]=(n*f-o*e+i*S)*p,t[5]=(r*e-n*l-i*O)*p,t[6]=(m*x-v*w+y*P)*p,t[7]=(v*g-d*x-y*M)*p,t[8]=(d*w-m*g+y*b)*p,t):null},n.projection=function(t,e,n){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/n,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t},n.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},n.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},n.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t},n.subtract=o,n.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t},n.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t},n.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},n.equals=function(t,e){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],u=t[6],c=t[7],h=t[8],l=e[0],f=e[1],p=e[2],d=e[3],m=e[4],v=e[5],y=e[6],t=e[7],e=e[8];return Math.abs(n-l)<=b.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(r-f)<=b.EPSILON*Math.max(1,Math.abs(r),Math.abs(f))&&Math.abs(o-p)<=b.EPSILON*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(i-d)<=b.EPSILON*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(a-m)<=b.EPSILON*Math.max(1,Math.abs(a),Math.abs(m))&&Math.abs(s-v)<=b.EPSILON*Math.max(1,Math.abs(s),Math.abs(v))&&Math.abs(u-y)<=b.EPSILON*Math.max(1,Math.abs(u),Math.abs(y))&&Math.abs(c-t)<=b.EPSILON*Math.max(1,Math.abs(c),Math.abs(t))&&Math.abs(h-e)<=b.EPSILON*Math.max(1,Math.abs(h),Math.abs(e))},n.sub=n.mul=void 0;var b=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==a(t)&&"function"!=typeof t)return{default:t};var e=s();if(e&&e.has(t))return e.get(t);var n,r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(n in t){var i;Object.prototype.hasOwnProperty.call(t,n)&&((i=o?Object.getOwnPropertyDescriptor(t,n):null)&&(i.get||i.set)?Object.defineProperty(r,n,i):r[n]=t[n])}r.default=t,e&&e.set(t,r);return r}(t("./common.js"));function s(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return s=function(){return t},t}function r(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=e[8],f=n[0],p=n[1],d=n[2],m=n[3],v=n[4],y=n[5],b=n[6],e=n[7],n=n[8];return t[0]=f*r+p*a+d*c,t[1]=f*o+p*s+d*h,t[2]=f*i+p*u+d*l,t[3]=m*r+v*a+y*c,t[4]=m*o+v*s+y*h,t[5]=m*i+v*u+y*l,t[6]=b*r+e*a+n*c,t[7]=b*o+e*s+n*h,t[8]=b*i+e*u+n*l,t}function o(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t}n.mul=r,n.sub=o},{"./common.js":20}],25:[function(t,e,n){"use strict";function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(n,"__esModule",{value:!0}),n.create=function(){var t=new I.ARRAY_TYPE(16);I.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0);return t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},n.clone=function(t){var e=new I.ARRAY_TYPE(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},n.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},n.fromValues=function(t,e,n,r,o,i,a,s,u,c,h,l,f,p,d,m){var v=new I.ARRAY_TYPE(16);return v[0]=t,v[1]=e,v[2]=n,v[3]=r,v[4]=o,v[5]=i,v[6]=a,v[7]=s,v[8]=u,v[9]=c,v[10]=h,v[11]=l,v[12]=f,v[13]=p,v[14]=d,v[15]=m,v},n.set=function(t,e,n,r,o,i,a,s,u,c,h,l,f,p,d,m,v){return t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=i,t[5]=a,t[6]=s,t[7]=u,t[8]=c,t[9]=h,t[10]=l,t[11]=f,t[12]=p,t[13]=d,t[14]=m,t[15]=v,t},n.identity=d,n.transpose=function(t,e){{var n,r,o,i,a,s;t===e?(n=e[1],r=e[2],o=e[3],i=e[6],a=e[7],s=e[11],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=i,t[11]=e[14],t[12]=o,t[13]=a,t[14]=s):(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15])}return t},n.invert=function(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=e[6],c=e[7],h=e[8],l=e[9],f=e[10],p=e[11],d=e[12],m=e[13],v=e[14],y=e[15],b=n*s-r*a,M=n*u-o*a,g=n*c-i*a,P=r*u-o*s,w=r*c-i*s,x=o*c-i*u,O=h*m-l*d,S=h*v-f*d,_=h*y-p*d,E=l*v-f*m,A=l*y-p*m,j=f*y-p*v,e=b*j-M*A+g*E+P*_-w*S+x*O;return e?(e=1/e,t[0]=(s*j-u*A+c*E)*e,t[1]=(o*A-r*j-i*E)*e,t[2]=(m*x-v*w+y*P)*e,t[3]=(f*w-l*x-p*P)*e,t[4]=(u*_-a*j-c*S)*e,t[5]=(n*j-o*_+i*S)*e,t[6]=(v*g-d*x-y*M)*e,t[7]=(h*x-f*g+p*M)*e,t[8]=(a*A-s*_+c*O)*e,t[9]=(r*_-n*A-i*O)*e,t[10]=(d*w-m*g+y*b)*e,t[11]=(l*g-h*w-p*b)*e,t[12]=(s*S-a*E-u*O)*e,t[13]=(n*E-r*S+o*O)*e,t[14]=(m*M-d*P-v*b)*e,t[15]=(h*P-l*M+f*b)*e,t):null},n.adjoint=function(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=e[6],c=e[7],h=e[8],l=e[9],f=e[10],p=e[11],d=e[12],m=e[13],v=e[14],e=e[15];return t[0]=s*(f*e-p*v)-l*(u*e-c*v)+m*(u*p-c*f),t[1]=-(r*(f*e-p*v)-l*(o*e-i*v)+m*(o*p-i*f)),t[2]=r*(u*e-c*v)-s*(o*e-i*v)+m*(o*c-i*u),t[3]=-(r*(u*p-c*f)-s*(o*p-i*f)+l*(o*c-i*u)),t[4]=-(a*(f*e-p*v)-h*(u*e-c*v)+d*(u*p-c*f)),t[5]=n*(f*e-p*v)-h*(o*e-i*v)+d*(o*p-i*f),t[6]=-(n*(u*e-c*v)-a*(o*e-i*v)+d*(o*c-i*u)),t[7]=n*(u*p-c*f)-a*(o*p-i*f)+h*(o*c-i*u),t[8]=a*(l*e-p*m)-h*(s*e-c*m)+d*(s*p-c*l),t[9]=-(n*(l*e-p*m)-h*(r*e-i*m)+d*(r*p-i*l)),t[10]=n*(s*e-c*m)-a*(r*e-i*m)+d*(r*c-i*s),t[11]=-(n*(s*p-c*l)-a*(r*p-i*l)+h*(r*c-i*s)),t[12]=-(a*(l*v-f*m)-h*(s*v-u*m)+d*(s*f-u*l)),t[13]=n*(l*v-f*m)-h*(r*v-o*m)+d*(r*f-o*l),t[14]=-(n*(s*v-u*m)-a*(r*v-o*m)+d*(r*u-o*s)),t[15]=n*(s*f-u*l)-a*(r*f-o*l)+h*(r*u-o*s),t},n.determinant=function(t){var e=t[0],n=t[1],r=t[2],o=t[3],i=t[4],a=t[5],s=t[6],u=t[7],c=t[8],h=t[9],l=t[10],f=t[11],p=t[12],d=t[13],m=t[14],t=t[15];return(e*a-n*i)*(l*t-f*m)-(e*s-r*i)*(h*t-f*d)+(e*u-o*i)*(h*m-l*d)+(n*s-r*a)*(c*t-f*p)-(n*u-o*a)*(c*m-l*p)+(r*u-o*s)*(c*d-h*p)},n.multiply=r,n.translate=function(t,e,n){var r,o,i,a,s,u,c,h,l,f,p,d=n[0],m=n[1],v=n[2];e===t?(t[12]=e[0]*d+e[4]*m+e[8]*v+e[12],t[13]=e[1]*d+e[5]*m+e[9]*v+e[13],t[14]=e[2]*d+e[6]*m+e[10]*v+e[14],t[15]=e[3]*d+e[7]*m+e[11]*v+e[15]):(r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=e[8],f=e[9],p=e[10],n=e[11],t[0]=r,t[1]=o,t[2]=i,t[3]=a,t[4]=s,t[5]=u,t[6]=c,t[7]=h,t[8]=l,t[9]=f,t[10]=p,t[11]=n,t[12]=r*d+s*m+l*v+e[12],t[13]=o*d+u*m+f*v+e[13],t[14]=i*d+c*m+p*v+e[14],t[15]=a*d+h*m+n*v+e[15]);return t},n.scale=function(t,e,n){var r=n[0],o=n[1],n=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*o,t[5]=e[5]*o,t[6]=e[6]*o,t[7]=e[7]*o,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},n.rotate=function(t,e,n,r){var o,i,a,s,u,c,h,l,f,p,d,m,v,y,b,M,g,P,w,x=r[0],O=r[1],S=r[2],_=Math.hypot(x,O,S);if(_<I.EPSILON)return null;x*=_=1/_,O*=_,S*=_,P=Math.sin(n),w=Math.cos(n),o=1-w,i=e[0],a=e[1],s=e[2],u=e[3],c=e[4],h=e[5],l=e[6],f=e[7],p=e[8],d=e[9],m=e[10],v=e[11],y=x*x*o+w,b=O*x*o+S*P,M=S*x*o-O*P,g=x*O*o-S*P,r=O*O*o+w,_=S*O*o+x*P,n=x*S*o+O*P,P=O*S*o-x*P,w=S*S*o+w,t[0]=i*y+c*b+p*M,t[1]=a*y+h*b+d*M,t[2]=s*y+l*b+m*M,t[3]=u*y+f*b+v*M,t[4]=i*g+c*r+p*_,t[5]=a*g+h*r+d*_,t[6]=s*g+l*r+m*_,t[7]=u*g+f*r+v*_,t[8]=i*n+c*P+p*w,t[9]=a*n+h*P+d*w,t[10]=s*n+l*P+m*w,t[11]=u*n+f*P+v*w,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]);return t},n.rotateX=function(t,e,n){var r=Math.sin(n),o=Math.cos(n),i=e[4],a=e[5],s=e[6],u=e[7],c=e[8],h=e[9],l=e[10],n=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]);return t[4]=i*o+c*r,t[5]=a*o+h*r,t[6]=s*o+l*r,t[7]=u*o+n*r,t[8]=c*o-i*r,t[9]=h*o-a*r,t[10]=l*o-s*r,t[11]=n*o-u*r,t},n.rotateY=function(t,e,n){var r=Math.sin(n),o=Math.cos(n),i=e[0],a=e[1],s=e[2],u=e[3],c=e[8],h=e[9],l=e[10],n=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]);return t[0]=i*o-c*r,t[1]=a*o-h*r,t[2]=s*o-l*r,t[3]=u*o-n*r,t[8]=i*r+c*o,t[9]=a*r+h*o,t[10]=s*r+l*o,t[11]=u*r+n*o,t},n.rotateZ=function(t,e,n){var r=Math.sin(n),o=Math.cos(n),i=e[0],a=e[1],s=e[2],u=e[3],c=e[4],h=e[5],l=e[6],n=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]);return t[0]=i*o+c*r,t[1]=a*o+h*r,t[2]=s*o+l*r,t[3]=u*o+n*r,t[4]=c*o-i*r,t[5]=h*o-a*r,t[6]=l*o-s*r,t[7]=n*o-u*r,t},n.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t},n.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},n.fromRotation=function(t,e,n){var r=n[0],o=n[1],i=n[2],a=Math.hypot(r,o,i);if(a<I.EPSILON)return null;return r*=a=1/a,o*=a,i*=a,n=Math.sin(e),a=Math.cos(e),e=1-a,t[0]=r*r*e+a,t[1]=o*r*e+i*n,t[2]=i*r*e-o*n,t[3]=0,t[4]=r*o*e-i*n,t[5]=o*o*e+a,t[6]=i*o*e+r*n,t[7]=0,t[8]=r*i*e+o*n,t[9]=o*i*e-r*n,t[10]=i*i*e+a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},n.fromXRotation=function(t,e){var n=Math.sin(e),e=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=n,t[7]=0,t[8]=0,t[9]=-n,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},n.fromYRotation=function(t,e){var n=Math.sin(e),e=Math.cos(e);return t[0]=e,t[1]=0,t[2]=-n,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=n,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},n.fromZRotation=function(t,e){var n=Math.sin(e),e=Math.cos(e);return t[0]=e,t[1]=n,t[2]=0,t[3]=0,t[4]=-n,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},n.fromRotationTranslation=f,n.fromQuat2=function(t,e){var n=new I.ARRAY_TYPE(3),r=-e[0],o=-e[1],i=-e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=r*r+o*o+i*i+a*a;0<l?(n[0]=2*(s*a+h*r+u*i-c*o)/l,n[1]=2*(u*a+h*o+c*r-s*i)/l,n[2]=2*(c*a+h*i+s*o-u*r)/l):(n[0]=2*(s*a+h*r+u*i-c*o),n[1]=2*(u*a+h*o+c*r-s*i),n[2]=2*(c*a+h*i+s*o-u*r));return f(t,e,n),t},n.getTranslation=function(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t},n.getScaling=p,n.getRotation=function(t,e){var n=new I.ARRAY_TYPE(3);p(n,e);var r=1/n[0],o=1/n[1],i=1/n[2],a=e[0]*r,s=e[1]*o,u=e[2]*i,c=e[4]*r,h=e[5]*o,l=e[6]*i,n=e[8]*r,r=e[9]*o,o=e[10]*i,e=a+h+o,i=0;0<e?(i=2*Math.sqrt(1+e),t[3]=.25*i,t[0]=(l-r)/i,t[1]=(n-u)/i,t[2]=(s-c)/i):h<a&&o<a?(i=2*Math.sqrt(1+a-h-o),t[3]=(l-r)/i,t[0]=.25*i,t[1]=(s+c)/i,t[2]=(n+u)/i):o<h?(i=2*Math.sqrt(1+h-a-o),t[3]=(n-u)/i,t[0]=(s+c)/i,t[1]=.25*i,t[2]=(l+r)/i):(i=2*Math.sqrt(1+o-a-h),t[3]=(s-c)/i,t[0]=(n+u)/i,t[1]=(l+r)/i,t[2]=.25*i);return t},n.fromRotationTranslationScale=function(t,e,n,r){var o=e[0],i=e[1],a=e[2],s=e[3],u=o+o,c=i+i,h=a+a,l=o*u,f=o*c,p=o*h,e=i*c,o=i*h,i=a*h,a=s*u,u=s*c,c=s*h,s=r[0],h=r[1],r=r[2];return t[0]=(1-(e+i))*s,t[1]=(f+c)*s,t[2]=(p-u)*s,t[3]=0,t[4]=(f-c)*h,t[5]=(1-(l+i))*h,t[6]=(o+a)*h,t[7]=0,t[8]=(p+u)*r,t[9]=(o-a)*r,t[10]=(1-(l+e))*r,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t},n.fromRotationTranslationScaleOrigin=function(t,e,n,r,o){var i=e[0],a=e[1],s=e[2],u=e[3],c=i+i,h=a+a,l=s+s,f=i*c,p=i*h,d=i*l,m=a*h,v=a*l,y=s*l,b=u*c,e=u*h,i=u*l,a=r[0],s=r[1],c=r[2],h=o[0],u=o[1],l=o[2],r=(1-(m+y))*a,o=(p+i)*a,a=(d-e)*a,i=(p-i)*s,y=(1-(f+y))*s,s=(v+b)*s,e=(d+e)*c,b=(v-b)*c,c=(1-(f+m))*c;return t[0]=r,t[1]=o,t[2]=a,t[3]=0,t[4]=i,t[5]=y,t[6]=s,t[7]=0,t[8]=e,t[9]=b,t[10]=c,t[11]=0,t[12]=n[0]+h-(r*h+i*u+e*l),t[13]=n[1]+u-(o*h+y*u+b*l),t[14]=n[2]+l-(a*h+s*u+c*l),t[15]=1,t},n.fromQuat=function(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=n+n,s=r+r,u=o+o,c=n*a,h=r*a,e=r*s,n=o*a,r=o*s,o=o*u,a=i*a,s=i*s,u=i*u;return t[0]=1-e-o,t[1]=h+u,t[2]=n-s,t[3]=0,t[4]=h-u,t[5]=1-c-o,t[6]=r+a,t[7]=0,t[8]=n+s,t[9]=r-a,t[10]=1-c-e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},n.frustum=function(t,e,n,r,o,i,a){var s=1/(n-e),u=1/(o-r),c=1/(i-a);return t[0]=2*i*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*i*u,t[6]=0,t[7]=0,t[8]=(n+e)*s,t[9]=(o+r)*u,t[10]=(a+i)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*i*2*c,t[15]=0,t},n.perspective=function(t,e,n,r,o){e=1/Math.tan(e/2);t[0]=e/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=o&&o!==1/0?(e=1/(r-o),t[10]=(o+r)*e,t[14]=2*o*r*e):(t[10]=-1,t[14]=-2*r);return t},n.perspectiveFromFieldOfView=function(t,e,n,r){var o=Math.tan(e.upDegrees*Math.PI/180),i=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),u=2/(a+s),e=2/(o+i);return t[0]=u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=-(a-s)*u*.5,t[9]=(o-i)*e*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t},n.ortho=function(t,e,n,r,o,i,a){var s=1/(e-n),u=1/(r-o),c=1/(i-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+n)*s,t[13]=(o+r)*u,t[14]=(a+i)*c,t[15]=1,t},n.lookAt=function(t,e,n,r){var o,i=e[0],a=e[1],s=e[2],u=r[0],c=r[1],h=r[2],l=n[0],f=n[1],p=n[2];if(Math.abs(i-l)<I.EPSILON&&Math.abs(a-f)<I.EPSILON&&Math.abs(s-p)<I.EPSILON)return d(t);o=i-l,e=a-f,r=s-p,n=1/Math.hypot(o,e,r),l=c*(r*=n)-h*(e*=n),f=h*(o*=n)-u*r,p=u*e-c*o,(n=Math.hypot(l,f,p))?(l*=n=1/n,f*=n,p*=n):p=f=l=0;h=e*p-r*f,u=r*l-o*p,c=o*f-e*l,(n=Math.hypot(h,u,c))?(h*=n=1/n,u*=n,c*=n):c=u=h=0;return t[0]=l,t[1]=h,t[2]=o,t[3]=0,t[4]=f,t[5]=u,t[6]=e,t[7]=0,t[8]=p,t[9]=c,t[10]=r,t[11]=0,t[12]=-(l*i+f*a+p*s),t[13]=-(h*i+u*a+c*s),t[14]=-(o*i+e*a+r*s),t[15]=1,t},n.targetTo=function(t,e,n,r){var o=e[0],i=e[1],a=e[2],s=r[0],u=r[1],c=r[2],h=o-n[0],l=i-n[1],e=a-n[2],r=h*h+l*l+e*e;0<r&&(r=1/Math.sqrt(r),h*=r,l*=r,e*=r);n=u*e-c*l,c=c*h-s*e,u=s*l-u*h;0<(r=n*n+c*c+u*u)&&(r=1/Math.sqrt(r),n*=r,c*=r,u*=r);return t[0]=n,t[1]=c,t[2]=u,t[3]=0,t[4]=l*u-e*c,t[5]=e*n-h*u,t[6]=h*c-l*n,t[7]=0,t[8]=h,t[9]=l,t[10]=e,t[11]=0,t[12]=o,t[13]=i,t[14]=a,t[15]=1,t},n.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},n.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},n.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t},n.subtract=o,n.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12]*n,t[13]=e[13]*n,t[14]=e[14]*n,t[15]=e[15]*n,t},n.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t[9]=e[9]+n[9]*r,t[10]=e[10]+n[10]*r,t[11]=e[11]+n[11]*r,t[12]=e[12]+n[12]*r,t[13]=e[13]+n[13]*r,t[14]=e[14]+n[14]*r,t[15]=e[15]+n[15]*r,t},n.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},n.equals=function(t,e){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],u=t[6],c=t[7],h=t[8],l=t[9],f=t[10],p=t[11],d=t[12],m=t[13],v=t[14],y=t[15],b=e[0],M=e[1],g=e[2],P=e[3],w=e[4],x=e[5],O=e[6],S=e[7],_=e[8],E=e[9],A=e[10],j=e[11],L=e[12],R=e[13],t=e[14],e=e[15];return Math.abs(n-b)<=I.EPSILON*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(r-M)<=I.EPSILON*Math.max(1,Math.abs(r),Math.abs(M))&&Math.abs(o-g)<=I.EPSILON*Math.max(1,Math.abs(o),Math.abs(g))&&Math.abs(i-P)<=I.EPSILON*Math.max(1,Math.abs(i),Math.abs(P))&&Math.abs(a-w)<=I.EPSILON*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(s-x)<=I.EPSILON*Math.max(1,Math.abs(s),Math.abs(x))&&Math.abs(u-O)<=I.EPSILON*Math.max(1,Math.abs(u),Math.abs(O))&&Math.abs(c-S)<=I.EPSILON*Math.max(1,Math.abs(c),Math.abs(S))&&Math.abs(h-_)<=I.EPSILON*Math.max(1,Math.abs(h),Math.abs(_))&&Math.abs(l-E)<=I.EPSILON*Math.max(1,Math.abs(l),Math.abs(E))&&Math.abs(f-A)<=I.EPSILON*Math.max(1,Math.abs(f),Math.abs(A))&&Math.abs(p-j)<=I.EPSILON*Math.max(1,Math.abs(p),Math.abs(j))&&Math.abs(d-L)<=I.EPSILON*Math.max(1,Math.abs(d),Math.abs(L))&&Math.abs(m-R)<=I.EPSILON*Math.max(1,Math.abs(m),Math.abs(R))&&Math.abs(v-t)<=I.EPSILON*Math.max(1,Math.abs(v),Math.abs(t))&&Math.abs(y-e)<=I.EPSILON*Math.max(1,Math.abs(y),Math.abs(e))},n.sub=n.mul=void 0;var I=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==a(t)&&"function"!=typeof t)return{default:t};var e=s();if(e&&e.has(t))return e.get(t);var n,r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(n in t){var i;Object.prototype.hasOwnProperty.call(t,n)&&((i=o?Object.getOwnPropertyDescriptor(t,n):null)&&(i.get||i.set)?Object.defineProperty(r,n,i):r[n]=t[n])}r.default=t,e&&e.set(t,r);return r}(t("./common.js"));function s(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return s=function(){return t},t}function d(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function r(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=e[8],f=e[9],p=e[10],d=e[11],m=e[12],v=e[13],y=e[14],b=e[15],M=n[0],g=n[1],P=n[2],e=n[3];return t[0]=M*r+g*s+P*l+e*m,t[1]=M*o+g*u+P*f+e*v,t[2]=M*i+g*c+P*p+e*y,t[3]=M*a+g*h+P*d+e*b,M=n[4],g=n[5],P=n[6],e=n[7],t[4]=M*r+g*s+P*l+e*m,t[5]=M*o+g*u+P*f+e*v,t[6]=M*i+g*c+P*p+e*y,t[7]=M*a+g*h+P*d+e*b,M=n[8],g=n[9],P=n[10],e=n[11],t[8]=M*r+g*s+P*l+e*m,t[9]=M*o+g*u+P*f+e*v,t[10]=M*i+g*c+P*p+e*y,t[11]=M*a+g*h+P*d+e*b,M=n[12],g=n[13],P=n[14],e=n[15],t[12]=M*r+g*s+P*l+e*m,t[13]=M*o+g*u+P*f+e*v,t[14]=M*i+g*c+P*p+e*y,t[15]=M*a+g*h+P*d+e*b,t}function f(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=r+r,u=o+o,c=i+i,h=r*s,l=r*u,e=r*c,r=o*u,o=o*c,i=i*c,s=a*s,u=a*u,c=a*c;return t[0]=1-(r+i),t[1]=l+c,t[2]=e-u,t[3]=0,t[4]=l-c,t[5]=1-(h+i),t[6]=o+s,t[7]=0,t[8]=e+u,t[9]=o-s,t[10]=1-(h+r),t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function p(t,e){var n=e[0],r=e[1],o=e[2],i=e[4],a=e[5],s=e[6],u=e[8],c=e[9],e=e[10];return t[0]=Math.hypot(n,r,o),t[1]=Math.hypot(i,a,s),t[2]=Math.hypot(u,c,e),t}function o(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t}n.mul=r,n.sub=o},{"./common.js":20}],26:[function(t,e,n){"use strict";function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(n,"__esModule",{value:!0}),n.create=c,n.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},n.setAxisAngle=h,n.getAxisAngle=function(t,e){var n=2*Math.acos(e[3]),r=Math.sin(n/2);r>p.EPSILON?(t[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r):(t[0]=1,t[1]=0,t[2]=0);return n},n.getAngle=function(t,e){e=b(t,e);return Math.acos(2*e*e-1)},n.multiply=l,n.rotateX=function(t,e,n){n*=.5;var r=e[0],o=e[1],i=e[2],a=e[3],e=Math.sin(n),n=Math.cos(n);return t[0]=r*n+a*e,t[1]=o*n+i*e,t[2]=i*n-o*e,t[3]=a*n-r*e,t},n.rotateY=function(t,e,n){n*=.5;var r=e[0],o=e[1],i=e[2],a=e[3],e=Math.sin(n),n=Math.cos(n);return t[0]=r*n-i*e,t[1]=o*n+a*e,t[2]=i*n+r*e,t[3]=a*n-o*e,t},n.rotateZ=function(t,e,n){n*=.5;var r=e[0],o=e[1],i=e[2],a=e[3],e=Math.sin(n),n=Math.cos(n);return t[0]=r*n+o*e,t[1]=o*n-r*e,t[2]=i*n+a*e,t[3]=a*n-i*e,t},n.calculateW=function(t,e){var n=e[0],r=e[1],e=e[2];return t[0]=n,t[1]=r,t[2]=e,t[3]=Math.sqrt(Math.abs(1-n*n-r*r-e*e)),t},n.exp=f,n.ln=d,n.pow=function(t,e,n){return d(t,e),y(t,t,n),f(t,t),t},n.slerp=m,n.random=function(t){var e=p.RANDOM(),n=p.RANDOM(),r=p.RANDOM(),o=Math.sqrt(1-e),e=Math.sqrt(e);return t[0]=o*Math.sin(2*Math.PI*n),t[1]=o*Math.cos(2*Math.PI*n),t[2]=e*Math.sin(2*Math.PI*r),t[3]=e*Math.cos(2*Math.PI*r),t},n.invert=function(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],e=n*n+r*r+o*o+i*i,e=e?1/e:0;return t[0]=-n*e,t[1]=-r*e,t[2]=-o*e,t[3]=i*e,t},n.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},n.fromMat3=v,n.fromEuler=function(t,e,n,r){var o=.5*Math.PI/180;e*=o,n*=o,r*=o;var i=Math.sin(e),a=Math.cos(e),o=Math.sin(n),e=Math.cos(n),n=Math.sin(r),r=Math.cos(r);return t[0]=i*e*r-a*o*n,t[1]=a*o*r+i*e*n,t[2]=a*e*n-i*o*r,t[3]=a*e*r+i*o*n,t},n.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},n.setAxes=n.sqlerp=n.rotationTo=n.equals=n.exactEquals=n.normalize=n.sqrLen=n.squaredLength=n.len=n.length=n.lerp=n.dot=n.scale=n.mul=n.add=n.set=n.copy=n.fromValues=n.clone=void 0;var p=u(t("./common.js")),r=u(t("./mat3.js")),o=u(t("./vec3.js")),i=u(t("./vec4.js"));function s(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return s=function(){return t},t}function u(t){if(t&&t.__esModule)return t;if(null===t||"object"!==a(t)&&"function"!=typeof t)return{default:t};var e=s();if(e&&e.has(t))return e.get(t);var n,r,o={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&((r=i?Object.getOwnPropertyDescriptor(t,n):null)&&(r.get||r.set)?Object.defineProperty(o,n,r):o[n]=t[n]);return o.default=t,e&&e.set(t,o),o}function c(){var t=new p.ARRAY_TYPE(4);return p.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function h(t,e,n){n*=.5;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function l(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=n[0],u=n[1],e=n[2],n=n[3];return t[0]=r*n+a*s+o*e-i*u,t[1]=o*n+a*u+i*s-r*e,t[2]=i*n+a*e+r*u-o*s,t[3]=a*n-r*s-o*u-i*e,t}function f(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=Math.sqrt(n*n+r*r+o*o),e=Math.exp(i),i=0<a?e*Math.sin(a)/a:0;return t[0]=n*i,t[1]=r*i,t[2]=o*i,t[3]=e*Math.cos(a),t}function d(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],e=Math.sqrt(n*n+r*r+o*o),e=0<e?Math.atan2(e,i)/e:0;return t[0]=n*e,t[1]=r*e,t[2]=o*e,t[3]=.5*Math.log(n*n+r*r+o*o+i*i),t}function m(t,e,n,r){var o,i=e[0],a=e[1],s=e[2],u=e[3],c=n[0],h=n[1],l=n[2],f=n[3],e=i*c+a*h+s*l+u*f;return e<0&&(e=-e,c=-c,h=-h,l=-l,f=-f),r=1-e>p.EPSILON?(n=Math.acos(e),e=Math.sin(n),o=Math.sin((1-r)*n)/e,Math.sin(r*n)/e):(o=1-r,r),t[0]=o*i+r*c,t[1]=o*a+r*h,t[2]=o*s+r*l,t[3]=o*u+r*f,t}function v(t,e){var n,r,o,i=e[0]+e[4]+e[8];return 0<i?(o=Math.sqrt(i+1),t[3]=.5*o,o=.5/o,t[0]=(e[5]-e[7])*o,t[1]=(e[6]-e[2])*o,t[2]=(e[1]-e[3])*o):(n=0,e[4]>e[0]&&(n=1),e[8]>e[3*n+n]&&(n=2),r=(n+1)%3,i=(n+2)%3,o=Math.sqrt(e[3*n+n]-e[3*r+r]-e[3*i+i]+1),t[n]=.5*o,o=.5/o,t[3]=(e[3*r+i]-e[3*i+r])*o,t[r]=(e[3*r+n]+e[3*n+r])*o,t[i]=(e[3*i+n]+e[3*n+i])*o),t}t=i.clone;n.clone=t;t=i.fromValues;n.fromValues=t;t=i.copy;n.copy=t;t=i.set;n.set=t;t=i.add;n.add=t,n.mul=l;var y=i.scale;n.scale=y;var b=i.dot;n.dot=b;t=i.lerp;n.lerp=t;t=i.length;n.length=t,n.len=t;t=i.squaredLength;n.squaredLength=t,n.sqrLen=t;var M=i.normalize;n.normalize=M;t=i.exactEquals;n.exactEquals=t;i=i.equals;n.equals=i;var g,P,w,i=(g=o.create(),P=o.fromValues(1,0,0),w=o.fromValues(0,1,0),function(t,e,n){var r=o.dot(e,n);return r<-.999999?(o.cross(g,P,e),o.len(g)<1e-6&&o.cross(g,w,e),o.normalize(g,g),h(t,g,Math.PI),t):.999999<r?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(o.cross(g,e,n),t[0]=g[0],t[1]=g[1],t[2]=g[2],t[3]=1+r,M(t,t))});n.rotationTo=i;var x,O,i=(x=c(),O=c(),function(t,e,n,r,o,i){return m(x,e,o,i),m(O,n,r,i),m(t,x,O,2*i*(1-i)),t});n.sqlerp=i;var S,r=(S=r.create(),function(t,e,n,r){return S[0]=n[0],S[3]=n[1],S[6]=n[2],S[1]=r[0],S[4]=r[1],S[7]=r[2],S[2]=-e[0],S[5]=-e[1],S[8]=-e[2],M(t,v(t,S))});n.setAxes=r},{"./common.js":20,"./mat3.js":24,"./vec3.js":29,"./vec4.js":30}],27:[function(t,e,n){"use strict";function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(n,"__esModule",{value:!0}),n.create=function(){var t=new v.ARRAY_TYPE(8);v.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0);return t[3]=1,t},n.clone=function(t){var e=new v.ARRAY_TYPE(8);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e},n.fromValues=function(t,e,n,r,o,i,a,s){var u=new v.ARRAY_TYPE(8);return u[0]=t,u[1]=e,u[2]=n,u[3]=r,u[4]=o,u[5]=i,u[6]=a,u[7]=s,u},n.fromRotationTranslationValues=function(t,e,n,r,o,i,a){var s=new v.ARRAY_TYPE(8);s[0]=t,s[1]=e,s[2]=n,s[3]=r;o*=.5,i*=.5,a*=.5;return s[4]=o*r+i*n-a*e,s[5]=i*r+a*t-o*n,s[6]=a*r+o*e-i*t,s[7]=-o*t-i*e-a*n,s},n.fromRotationTranslation=i,n.fromTranslation=function(t,e){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=.5*e[0],t[5]=.5*e[1],t[6]=.5*e[2],t[7]=0,t},n.fromRotation=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=0,t[5]=0,t[6]=0,t[7]=0,t},n.fromMat4=function(t,e){var n=d.create();o.getRotation(n,e);var r=new v.ARRAY_TYPE(3);return o.getTranslation(r,e),i(t,n,r),t},n.copy=h,n.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t},n.set=function(t,e,n,r,o,i,a,s,u){return t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=i,t[5]=a,t[6]=s,t[7]=u,t},n.getDual=function(t,e){return t[0]=e[4],t[1]=e[5],t[2]=e[6],t[3]=e[7],t},n.setDual=function(t,e){return t[4]=e[0],t[5]=e[1],t[6]=e[2],t[7]=e[3],t},n.getTranslation=function(t,e){var n=e[4],r=e[5],o=e[6],i=e[7],a=-e[0],s=-e[1],u=-e[2],e=e[3];return t[0]=2*(n*e+i*a+r*u-o*s),t[1]=2*(r*e+i*s+o*a-n*u),t[2]=2*(o*e+i*u+n*s-r*a),t},n.translate=function(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=.5*n[0],u=.5*n[1],c=.5*n[2],h=e[4],l=e[5],n=e[6],e=e[7];return t[0]=r,t[1]=o,t[2]=i,t[3]=a,t[4]=a*s+o*c-i*u+h,t[5]=a*u+i*s-r*c+l,t[6]=a*c+r*u-o*s+n,t[7]=-r*s-o*u-i*c+e,t},n.rotateX=function(t,e,n){var r=-e[0],o=-e[1],i=-e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=s*a+h*r+u*i-c*o,f=u*a+h*o+c*r-s*i,p=c*a+h*i+s*o-u*r,c=h*a-s*r-u*o-c*i;return d.rotateX(t,e,n),r=t[0],o=t[1],i=t[2],a=t[3],t[4]=l*a+c*r+f*i-p*o,t[5]=f*a+c*o+p*r-l*i,t[6]=p*a+c*i+l*o-f*r,t[7]=c*a-l*r-f*o-p*i,t},n.rotateY=function(t,e,n){var r=-e[0],o=-e[1],i=-e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=s*a+h*r+u*i-c*o,f=u*a+h*o+c*r-s*i,p=c*a+h*i+s*o-u*r,c=h*a-s*r-u*o-c*i;return d.rotateY(t,e,n),r=t[0],o=t[1],i=t[2],a=t[3],t[4]=l*a+c*r+f*i-p*o,t[5]=f*a+c*o+p*r-l*i,t[6]=p*a+c*i+l*o-f*r,t[7]=c*a-l*r-f*o-p*i,t},n.rotateZ=function(t,e,n){var r=-e[0],o=-e[1],i=-e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=s*a+h*r+u*i-c*o,f=u*a+h*o+c*r-s*i,p=c*a+h*i+s*o-u*r,c=h*a-s*r-u*o-c*i;return d.rotateZ(t,e,n),r=t[0],o=t[1],i=t[2],a=t[3],t[4]=l*a+c*r+f*i-p*o,t[5]=f*a+c*o+p*r-l*i,t[6]=p*a+c*i+l*o-f*r,t[7]=c*a-l*r-f*o-p*i,t},n.rotateByQuatAppend=function(t,e,n){var r=n[0],o=n[1],i=n[2],a=n[3],s=e[0],u=e[1],c=e[2],n=e[3];return t[0]=s*a+n*r+u*i-c*o,t[1]=u*a+n*o+c*r-s*i,t[2]=c*a+n*i+s*o-u*r,t[3]=n*a-s*r-u*o-c*i,s=e[4],u=e[5],c=e[6],n=e[7],t[4]=s*a+n*r+u*i-c*o,t[5]=u*a+n*o+c*r-s*i,t[6]=c*a+n*i+s*o-u*r,t[7]=n*a-s*r-u*o-c*i,t},n.rotateByQuatPrepend=function(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=n[0],u=n[1],c=n[2],e=n[3];return t[0]=r*e+a*s+o*c-i*u,t[1]=o*e+a*u+i*s-r*c,t[2]=i*e+a*c+r*u-o*s,t[3]=a*e-r*s-o*u-i*c,s=n[4],u=n[5],c=n[6],e=n[7],t[4]=r*e+a*s+o*c-i*u,t[5]=o*e+a*u+i*s-r*c,t[6]=i*e+a*c+r*u-o*s,t[7]=a*e-r*s-o*u-i*c,t},n.rotateAroundAxis=function(t,e,n,r){if(Math.abs(r)<v.EPSILON)return h(t,e);var o=Math.hypot(n[0],n[1],n[2]);r*=.5;var i=Math.sin(r),a=i*n[0]/o,s=i*n[1]/o,u=i*n[2]/o,c=Math.cos(r),i=e[0],n=e[1],o=e[2],r=e[3];t[0]=i*c+r*a+n*u-o*s,t[1]=n*c+r*s+o*a-i*u,t[2]=o*c+r*u+i*s-n*a,t[3]=r*c-i*a-n*s-o*u;i=e[4],n=e[5],o=e[6],e=e[7];return t[4]=i*c+e*a+n*u-o*s,t[5]=n*c+e*s+o*a-i*u,t[6]=o*c+e*u+i*s-n*a,t[7]=e*c-i*a-n*s-o*u,t},n.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t},n.multiply=u,n.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t},n.lerp=function(t,e,n,r){var o=1-r;c(e,n)<0&&(r=-r);return t[0]=e[0]*o+n[0]*r,t[1]=e[1]*o+n[1]*r,t[2]=e[2]*o+n[2]*r,t[3]=e[3]*o+n[3]*r,t[4]=e[4]*o+n[4]*r,t[5]=e[5]*o+n[5]*r,t[6]=e[6]*o+n[6]*r,t[7]=e[7]*o+n[7]*r,t},n.invert=function(t,e){var n=l(e);return t[0]=-e[0]/n,t[1]=-e[1]/n,t[2]=-e[2]/n,t[3]=e[3]/n,t[4]=-e[4]/n,t[5]=-e[5]/n,t[6]=-e[6]/n,t[7]=e[7]/n,t},n.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=e[7],t},n.normalize=function(t,e){var n=l(e);{var r,o,i,a,s,u,c,h;0<n&&(n=Math.sqrt(n),r=e[0]/n,o=e[1]/n,i=e[2]/n,a=e[3]/n,s=e[4],u=e[5],c=e[6],h=e[7],e=r*s+o*u+i*c+a*h,t[0]=r,t[1]=o,t[2]=i,t[3]=a,t[4]=(s-r*e)/n,t[5]=(u-o*e)/n,t[6]=(c-i*e)/n,t[7]=(h-a*e)/n)}return t},n.str=function(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"},n.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]},n.equals=function(t,e){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],u=t[6],c=t[7],h=e[0],l=e[1],f=e[2],p=e[3],d=e[4],m=e[5],t=e[6],e=e[7];return Math.abs(n-h)<=v.EPSILON*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(r-l)<=v.EPSILON*Math.max(1,Math.abs(r),Math.abs(l))&&Math.abs(o-f)<=v.EPSILON*Math.max(1,Math.abs(o),Math.abs(f))&&Math.abs(i-p)<=v.EPSILON*Math.max(1,Math.abs(i),Math.abs(p))&&Math.abs(a-d)<=v.EPSILON*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(s-m)<=v.EPSILON*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(u-t)<=v.EPSILON*Math.max(1,Math.abs(u),Math.abs(t))&&Math.abs(c-e)<=v.EPSILON*Math.max(1,Math.abs(c),Math.abs(e))},n.sqrLen=n.squaredLength=n.len=n.length=n.dot=n.mul=n.setReal=n.getReal=void 0;var v=r(t("./common.js")),d=r(t("./quat.js")),o=r(t("./mat4.js"));function s(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return s=function(){return t},t}function r(t){if(t&&t.__esModule)return t;if(null===t||"object"!==a(t)&&"function"!=typeof t)return{default:t};var e=s();if(e&&e.has(t))return e.get(t);var n,r,o={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&((r=i?Object.getOwnPropertyDescriptor(t,n):null)&&(r.get||r.set)?Object.defineProperty(o,n,r):o[n]=t[n]);return o.default=t,e&&e.set(t,o),o}function i(t,e,n){var r=.5*n[0],o=.5*n[1],i=.5*n[2],a=e[0],s=e[1],n=e[2],e=e[3];return t[0]=a,t[1]=s,t[2]=n,t[3]=e,t[4]=r*e+o*n-i*s,t[5]=o*e+i*a-r*n,t[6]=i*e+r*s-o*a,t[7]=-r*a-o*s-i*n,t}function h(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t}t=d.copy;n.getReal=t;t=d.copy;function u(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=n[4],u=n[5],c=n[6],h=n[7],l=e[4],f=e[5],p=e[6],d=e[7],m=n[0],v=n[1],e=n[2],n=n[3];return t[0]=r*n+a*m+o*e-i*v,t[1]=o*n+a*v+i*m-r*e,t[2]=i*n+a*e+r*v-o*m,t[3]=a*n-r*m-o*v-i*e,t[4]=r*h+a*s+o*c-i*u+l*n+d*m+f*e-p*v,t[5]=o*h+a*u+i*s-r*c+f*n+d*v+p*m-l*e,t[6]=i*h+a*c+r*u-o*s+p*n+d*e+l*v-f*m,t[7]=a*h-r*s-o*u-i*c+d*n-l*m-f*v-p*e,t}n.setReal=t,n.mul=u;var c=d.dot;n.dot=c;t=d.length;n.length=t,n.len=t;var l=d.squaredLength;n.squaredLength=l,n.sqrLen=l},{"./common.js":20,"./mat4.js":25,"./quat.js":26}],28:[function(t,e,n){"use strict";function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(n,"__esModule",{value:!0}),n.create=r,n.clone=function(t){var e=new o.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},n.fromValues=function(t,e){var n=new o.ARRAY_TYPE(2);return n[0]=t,n[1]=e,n},n.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},n.set=function(t,e,n){return t[0]=e,t[1]=n,t},n.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t},n.subtract=i,n.multiply=u,n.divide=c,n.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},n.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},n.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t},n.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t},n.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},n.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t},n.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t},n.distance=h,n.squaredDistance=l,n.length=f,n.squaredLength=p,n.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},n.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},n.normalize=function(t,e){var n=e[0],r=e[1],r=n*n+r*r;0<r&&(r=1/Math.sqrt(r));return t[0]=e[0]*r,t[1]=e[1]*r,t},n.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},n.cross=function(t,e,n){n=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=n,t},n.lerp=function(t,e,n,r){var o=e[0],e=e[1];return t[0]=o+r*(n[0]-o),t[1]=e+r*(n[1]-e),t},n.random=function(t,e){e=e||1;var n=2*o.RANDOM()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t},n.transformMat2=function(t,e,n){var r=e[0],e=e[1];return t[0]=n[0]*r+n[2]*e,t[1]=n[1]*r+n[3]*e,t},n.transformMat2d=function(t,e,n){var r=e[0],e=e[1];return t[0]=n[0]*r+n[2]*e+n[4],t[1]=n[1]*r+n[3]*e+n[5],t},n.transformMat3=function(t,e,n){var r=e[0],e=e[1];return t[0]=n[0]*r+n[3]*e+n[6],t[1]=n[1]*r+n[4]*e+n[7],t},n.transformMat4=function(t,e,n){var r=e[0],e=e[1];return t[0]=n[0]*r+n[4]*e+n[12],t[1]=n[1]*r+n[5]*e+n[13],t},n.rotate=function(t,e,n,r){var o=e[0]-n[0],i=e[1]-n[1],e=Math.sin(r),r=Math.cos(r);return t[0]=o*r-i*e+n[0],t[1]=o*e+i*r+n[1],t},n.angle=function(t,e){var n=t[0],r=t[1],o=e[0],t=e[1],e=Math.sqrt(n*n+r*r)*Math.sqrt(o*o+t*t),e=e&&(n*o+r*t)/e;return Math.acos(Math.min(Math.max(e,-1),1))},n.zero=function(t){return t[0]=0,t[1]=0,t},n.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},n.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]},n.equals=function(t,e){var n=t[0],r=t[1],t=e[0],e=e[1];return Math.abs(n-t)<=o.EPSILON*Math.max(1,Math.abs(n),Math.abs(t))&&Math.abs(r-e)<=o.EPSILON*Math.max(1,Math.abs(r),Math.abs(e))},n.forEach=n.sqrLen=n.sqrDist=n.dist=n.div=n.mul=n.sub=n.len=void 0;var o=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==a(t)&&"function"!=typeof t)return{default:t};var e=s();if(e&&e.has(t))return e.get(t);var n,r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(n in t){var i;Object.prototype.hasOwnProperty.call(t,n)&&((i=o?Object.getOwnPropertyDescriptor(t,n):null)&&(i.get||i.set)?Object.defineProperty(r,n,i):r[n]=t[n])}r.default=t,e&&e.set(t,r);return r}(t("./common.js"));function s(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return s=function(){return t},t}function r(){var t=new o.ARRAY_TYPE(2);return o.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0),t}function i(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function u(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t}function c(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t}function h(t,e){var n=e[0]-t[0],t=e[1]-t[1];return Math.hypot(n,t)}function l(t,e){var n=e[0]-t[0],t=e[1]-t[1];return n*n+t*t}function f(t){var e=t[0],t=t[1];return Math.hypot(e,t)}function p(t){var e=t[0],t=t[1];return e*e+t*t}n.len=f,n.sub=i,n.mul=u,n.div=c,n.dist=h,n.sqrDist=l,n.sqrLen=p;var d,t=(d=r(),function(t,e,n,r,o,i){var a,s;for(e=e||2,n=n||0,s=r?Math.min(r*e+n,t.length):t.length,a=n;a<s;a+=e)d[0]=t[a],d[1]=t[a+1],o(d,d,i),t[a]=d[0],t[a+1]=d[1];return t});n.forEach=t},{"./common.js":20}],29:[function(t,e,n){"use strict";function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(n,"__esModule",{value:!0}),n.create=r,n.clone=function(t){var e=new s.ARRAY_TYPE(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},n.length=o,n.fromValues=function(t,e,n){var r=new s.ARRAY_TYPE(3);return r[0]=t,r[1]=e,r[2]=n,r},n.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},n.set=function(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t},n.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t},n.subtract=i,n.multiply=c,n.divide=h,n.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t},n.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t},n.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t},n.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t},n.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t},n.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t},n.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t},n.distance=l,n.squaredDistance=f,n.squaredLength=p,n.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t},n.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t},n.normalize=function(t,e){var n=e[0],r=e[1],o=e[2],o=n*n+r*r+o*o;0<o&&(o=1/Math.sqrt(o));return t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t},n.dot=d,n.cross=function(t,e,n){var r=e[0],o=e[1],i=e[2],a=n[0],e=n[1],n=n[2];return t[0]=o*n-i*e,t[1]=i*a-r*n,t[2]=r*e-o*a,t},n.lerp=function(t,e,n,r){var o=e[0],i=e[1],e=e[2];return t[0]=o+r*(n[0]-o),t[1]=i+r*(n[1]-i),t[2]=e+r*(n[2]-e),t},n.hermite=function(t,e,n,r,o,i){var a=i*i,s=a*(2*i-3)+1,u=a*(i-2)+i,c=a*(i-1),i=a*(3-2*i);return t[0]=e[0]*s+n[0]*u+r[0]*c+o[0]*i,t[1]=e[1]*s+n[1]*u+r[1]*c+o[1]*i,t[2]=e[2]*s+n[2]*u+r[2]*c+o[2]*i,t},n.bezier=function(t,e,n,r,o,i){var a=1-i,s=a*a,u=i*i,c=s*a,s=3*i*s,a=3*u*a,i=u*i;return t[0]=e[0]*c+n[0]*s+r[0]*a+o[0]*i,t[1]=e[1]*c+n[1]*s+r[1]*a+o[1]*i,t[2]=e[2]*c+n[2]*s+r[2]*a+o[2]*i,t},n.random=function(t,e){e=e||1;var n=2*s.RANDOM()*Math.PI,r=2*s.RANDOM()-1,o=Math.sqrt(1-r*r)*e;return t[0]=Math.cos(n)*o,t[1]=Math.sin(n)*o,t[2]=r*e,t},n.transformMat4=function(t,e,n){var r=e[0],o=e[1],i=e[2],e=n[3]*r+n[7]*o+n[11]*i+n[15];return e=e||1,t[0]=(n[0]*r+n[4]*o+n[8]*i+n[12])/e,t[1]=(n[1]*r+n[5]*o+n[9]*i+n[13])/e,t[2]=(n[2]*r+n[6]*o+n[10]*i+n[14])/e,t},n.transformMat3=function(t,e,n){var r=e[0],o=e[1],e=e[2];return t[0]=r*n[0]+o*n[3]+e*n[6],t[1]=r*n[1]+o*n[4]+e*n[7],t[2]=r*n[2]+o*n[5]+e*n[8],t},n.transformQuat=function(t,e,n){var r=n[0],o=n[1],i=n[2],a=n[3],s=e[0],u=e[1],c=e[2],h=o*c-i*u,l=i*s-r*c,n=r*u-o*s,e=o*n-i*l,i=i*h-r*n,o=r*l-o*h,a=2*a;return h*=a,l*=a,n*=a,e*=2,i*=2,o*=2,t[0]=s+h+e,t[1]=u+l+i,t[2]=c+n+o,t},n.rotateX=function(t,e,n,r){var o=[],i=[];return o[0]=e[0]-n[0],o[1]=e[1]-n[1],o[2]=e[2]-n[2],i[0]=o[0],i[1]=o[1]*Math.cos(r)-o[2]*Math.sin(r),i[2]=o[1]*Math.sin(r)+o[2]*Math.cos(r),t[0]=i[0]+n[0],t[1]=i[1]+n[1],t[2]=i[2]+n[2],t},n.rotateY=function(t,e,n,r){var o=[],i=[];return o[0]=e[0]-n[0],o[1]=e[1]-n[1],o[2]=e[2]-n[2],i[0]=o[2]*Math.sin(r)+o[0]*Math.cos(r),i[1]=o[1],i[2]=o[2]*Math.cos(r)-o[0]*Math.sin(r),t[0]=i[0]+n[0],t[1]=i[1]+n[1],t[2]=i[2]+n[2],t},n.rotateZ=function(t,e,n,r){var o=[],i=[];return o[0]=e[0]-n[0],o[1]=e[1]-n[1],o[2]=e[2]-n[2],i[0]=o[0]*Math.cos(r)-o[1]*Math.sin(r),i[1]=o[0]*Math.sin(r)+o[1]*Math.cos(r),i[2]=o[2],t[0]=i[0]+n[0],t[1]=i[1]+n[1],t[2]=i[2]+n[2],t},n.angle=function(t,e){var n=t[0],r=t[1],o=t[2],i=e[0],a=e[1],s=e[2],o=Math.sqrt(n*n+r*r+o*o),s=Math.sqrt(i*i+a*a+s*s),s=o*s,s=s&&d(t,e)/s;return Math.acos(Math.min(Math.max(s,-1),1))},n.zero=function(t){return t[0]=0,t[1]=0,t[2]=0,t},n.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},n.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},n.equals=function(t,e){var n=t[0],r=t[1],o=t[2],i=e[0],t=e[1],e=e[2];return Math.abs(n-i)<=s.EPSILON*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(r-t)<=s.EPSILON*Math.max(1,Math.abs(r),Math.abs(t))&&Math.abs(o-e)<=s.EPSILON*Math.max(1,Math.abs(o),Math.abs(e))},n.forEach=n.sqrLen=n.len=n.sqrDist=n.dist=n.div=n.mul=n.sub=void 0;var s=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==a(t)&&"function"!=typeof t)return{default:t};var e=u();if(e&&e.has(t))return e.get(t);var n,r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(n in t){var i;Object.prototype.hasOwnProperty.call(t,n)&&((i=o?Object.getOwnPropertyDescriptor(t,n):null)&&(i.get||i.set)?Object.defineProperty(r,n,i):r[n]=t[n])}r.default=t,e&&e.set(t,r);return r}(t("./common.js"));function u(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return u=function(){return t},t}function r(){var t=new s.ARRAY_TYPE(3);return s.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function o(t){var e=t[0],n=t[1],t=t[2];return Math.hypot(e,n,t)}function i(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function c(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t}function h(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t}function l(t,e){var n=e[0]-t[0],r=e[1]-t[1],t=e[2]-t[2];return Math.hypot(n,r,t)}function f(t,e){var n=e[0]-t[0],r=e[1]-t[1],t=e[2]-t[2];return n*n+r*r+t*t}function p(t){var e=t[0],n=t[1],t=t[2];return e*e+n*n+t*t}function d(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}n.sub=i,n.mul=c,n.div=h,n.dist=l,n.sqrDist=f,n.len=o,n.sqrLen=p;var m,t=(m=r(),function(t,e,n,r,o,i){var a,s;for(e=e||3,n=n||0,s=r?Math.min(r*e+n,t.length):t.length,a=n;a<s;a+=e)m[0]=t[a],m[1]=t[a+1],m[2]=t[a+2],o(m,m,i),t[a]=m[0],t[a+1]=m[1],t[a+2]=m[2];return t});n.forEach=t},{"./common.js":20}],30:[function(t,e,n){"use strict";function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(n,"__esModule",{value:!0}),n.create=r,n.clone=function(t){var e=new c.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},n.fromValues=function(t,e,n,r){var o=new c.ARRAY_TYPE(4);return o[0]=t,o[1]=e,o[2]=n,o[3]=r,o},n.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},n.set=function(t,e,n,r,o){return t[0]=e,t[1]=n,t[2]=r,t[3]=o,t},n.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t},n.subtract=o,n.multiply=i,n.divide=u,n.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t},n.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t},n.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t[3]=Math.min(e[3],n[3]),t},n.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t[3]=Math.max(e[3],n[3]),t},n.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t},n.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},n.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t},n.distance=h,n.squaredDistance=l,n.length=f,n.squaredLength=p,n.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},n.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},n.normalize=function(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],e=n*n+r*r+o*o+i*i;0<e&&(e=1/Math.sqrt(e));return t[0]=n*e,t[1]=r*e,t[2]=o*e,t[3]=i*e,t},n.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},n.cross=function(t,e,n,r){var o=n[0]*r[1]-n[1]*r[0],i=n[0]*r[2]-n[2]*r[0],a=n[0]*r[3]-n[3]*r[0],s=n[1]*r[2]-n[2]*r[1],u=n[1]*r[3]-n[3]*r[1],c=n[2]*r[3]-n[3]*r[2],h=e[0],n=e[1],r=e[2],e=e[3];return t[0]=n*c-r*u+e*s,t[1]=-h*c+r*a-e*i,t[2]=h*u-n*a+e*o,t[3]=-h*s+n*i-r*o,t},n.lerp=function(t,e,n,r){var o=e[0],i=e[1],a=e[2],e=e[3];return t[0]=o+r*(n[0]-o),t[1]=i+r*(n[1]-i),t[2]=a+r*(n[2]-a),t[3]=e+r*(n[3]-e),t},n.random=function(t,e){var n,r,o,i,a,s;e=e||1;for(;n=2*c.RANDOM()-1,r=2*c.RANDOM()-1,a=n*n+r*r,1<=a;);for(;o=2*c.RANDOM()-1,i=2*c.RANDOM()-1,s=o*o+i*i,1<=s;);var u=Math.sqrt((1-a)/s);return t[0]=e*n,t[1]=e*r,t[2]=e*o*u,t[3]=e*i*u,t},n.transformMat4=function(t,e,n){var r=e[0],o=e[1],i=e[2],e=e[3];return t[0]=n[0]*r+n[4]*o+n[8]*i+n[12]*e,t[1]=n[1]*r+n[5]*o+n[9]*i+n[13]*e,t[2]=n[2]*r+n[6]*o+n[10]*i+n[14]*e,t[3]=n[3]*r+n[7]*o+n[11]*i+n[15]*e,t},n.transformQuat=function(t,e,n){var r=e[0],o=e[1],i=e[2],a=n[0],s=n[1],u=n[2],c=n[3],h=c*r+s*i-u*o,l=c*o+u*r-a*i,n=c*i+a*o-s*r,i=-a*r-s*o-u*i;return t[0]=h*c+i*-a+l*-u-n*-s,t[1]=l*c+i*-s+n*-a-h*-u,t[2]=n*c+i*-u+h*-s-l*-a,t[3]=e[3],t},n.zero=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},n.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},n.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},n.equals=function(t,e){var n=t[0],r=t[1],o=t[2],i=t[3],a=e[0],s=e[1],t=e[2],e=e[3];return Math.abs(n-a)<=c.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-s)<=c.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(o-t)<=c.EPSILON*Math.max(1,Math.abs(o),Math.abs(t))&&Math.abs(i-e)<=c.EPSILON*Math.max(1,Math.abs(i),Math.abs(e))},n.forEach=n.sqrLen=n.len=n.sqrDist=n.dist=n.div=n.mul=n.sub=void 0;var c=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==a(t)&&"function"!=typeof t)return{default:t};var e=s();if(e&&e.has(t))return e.get(t);var n,r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(n in t){var i;Object.prototype.hasOwnProperty.call(t,n)&&((i=o?Object.getOwnPropertyDescriptor(t,n):null)&&(i.get||i.set)?Object.defineProperty(r,n,i):r[n]=t[n])}r.default=t,e&&e.set(t,r);return r}(t("./common.js"));function s(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return s=function(){return t},t}function r(){var t=new c.ARRAY_TYPE(4);return c.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function o(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}function i(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t}function u(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t}function h(t,e){var n=e[0]-t[0],r=e[1]-t[1],o=e[2]-t[2],t=e[3]-t[3];return Math.hypot(n,r,o,t)}function l(t,e){var n=e[0]-t[0],r=e[1]-t[1],o=e[2]-t[2],t=e[3]-t[3];return n*n+r*r+o*o+t*t}function f(t){var e=t[0],n=t[1],r=t[2],t=t[3];return Math.hypot(e,n,r,t)}function p(t){var e=t[0],n=t[1],r=t[2],t=t[3];return e*e+n*n+r*r+t*t}n.sub=o,n.mul=i,n.div=u,n.dist=h,n.sqrDist=l,n.len=f,n.sqrLen=p;var d,t=(d=r(),function(t,e,n,r,o,i){var a,s;for(e=e||4,n=n||0,s=r?Math.min(r*e+n,t.length):t.length,a=n;a<s;a+=e)d[0]=t[a],d[1]=t[a+1],d[2]=t[a+2],d[3]=t[a+3],o(d,d,i),t[a]=d[0],t[a+1]=d[1],t[a+2]=d[2],t[a+3]=d[3];return t});n.forEach=t},{"./common.js":20}],31:[function(t,e,n){"use strict";var r,o="object"==typeof Reflect?Reflect:null,u=o&&"function"==typeof o.apply?o.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};r=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var i=Number.isNaN||function(t){return t!=t};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(s,u){return new Promise(function(t,e){function n(t){s.removeListener(u,r),e(t)}function r(){"function"==typeof s.removeListener&&s.removeListener("error",n),t([].slice.call(arguments))}var o,i,a;v(s,u,r,{once:!0}),"error"!==u&&(i=n,a={once:!0},"function"==typeof(o=s).on&&v(o,"error",i,a))})},(a.EventEmitter=a).prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var s=10;function c(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function h(t){return void 0===t._maxListeners?a.defaultMaxListeners:t._maxListeners}function l(t,e,n,r){var o,i;return c(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener||n),o=t._events),i=o[e]),void 0===i?(i=o[e]=n,++t._eventsCount):("function"==typeof i?i=o[e]=r?[n,i]:[i,n]:r?i.unshift(n):i.push(n),0<(n=h(t))&&i.length>n&&!i.warned&&(i.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=t,n.type=e,n.count=i.length,n=n,console&&console.warn&&console.warn(n))),t}function f(t,e,n){t={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},e=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(t);return e.listener=n,t.wrapFn=e}function p(t,e,n){t=t._events;if(void 0===t)return[];e=t[e];return void 0===e?[]:"function"==typeof e?n?[e.listener||e]:[e]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(e):m(e,e.length)}function d(t){var e=this._events;if(void 0!==e){t=e[t];if("function"==typeof t)return 1;if(void 0!==t)return t.length}return 0}function m(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function v(n,r,o,i){if("function"==typeof n.on)i.once?n.once(r,o):n.on(r,o);else{if("function"!=typeof n.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof n);n.addEventListener(r,function t(e){i.once&&n.removeEventListener(r,t),o(e)})}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(t){if("number"!=typeof t||t<0||i(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");s=t}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||i(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},a.prototype.getMaxListeners=function(){return h(this)},a.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r,o="error"===t,i=this._events;if(void 0!==i)o=o&&void 0===i.error;else if(!o)return!1;if(o){if(0<e.length&&(r=e[0]),r instanceof Error)throw r;o=new Error("Unhandled error."+(r?" ("+r.message+")":""));throw o.context=r,o}t=i[t];if(void 0===t)return!1;if("function"==typeof t)u(t,this,e);else for(var a=t.length,s=m(t,a),n=0;n<a;++n)u(s[n],this,e);return!0},a.prototype.addListener=function(t,e){return l(this,t,e,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(t,e){return l(this,t,e,!0)},a.prototype.once=function(t,e){return c(e),this.on(t,f(this,t,e)),this},a.prototype.prependOnceListener=function(t,e){return c(e),this.prependListener(t,f(this,t,e)),this},a.prototype.removeListener=function(t,e){var n,r,o,i,a;if(c(e),void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(o=-1,i=n.length-1;0<=i;i--)if(n[i]===e||n[i].listener===e){a=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,o),1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,a||e)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(t){var e,n=this._events;if(void 0===n)return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){for(var r,o=Object.keys(n),i=0;i<o.length;++i)"removeListener"!==(r=o[i])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(i=e.length-1;0<=i;i--)this.removeListener(t,e[i]);return this},a.prototype.listeners=function(t){return p(this,t,!0)},a.prototype.rawListeners=function(t){return p(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):d.call(t,e)},a.prototype.listenerCount=d,a.prototype.eventNames=function(){return 0<this._eventsCount?r(this._events):[]}},{}],32:[function(t,e,n){var r,o,e=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{o="function"==typeof clearTimeout?clearTimeout:a}catch(t){o=a}}();var u,c=[],h=!1,l=-1;function f(){h&&u&&(h=!1,u.length?c=u.concat(c):l=-1,c.length&&p())}function p(){if(!h){var t=s(f);h=!0;for(var e=c.length;e;){for(u=c,c=[];++l<e;)u&&u[l].run();l=-1,e=c.length}u=null,h=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===a||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function m(){}e.nextTick=function(t){var e=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new d(t,e)),1!==c.length||h||s(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},e.title="browser",e.browser=!0,e.env={},e.argv=[],e.version="",e.versions={},e.on=m,e.addListener=m,e.once=m,e.off=m,e.removeListener=m,e.removeAllListeners=m,e.emit=m,e.prependListener=m,e.prependOnceListener=m,e.listeners=function(t){return[]},e.binding=function(t){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(t){throw new Error("process.chdir is not supported")},e.umask=function(){return 0}},{}],33:[function(t,e,n){"use strict";e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},{}],34:[function(t,e,n){"undefined"!=typeof window?("function"!=typeof window.requestAnimationFrame&&(window.requestAnimationFrame=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,1e3/60)}),window.Leap=t("../lib/index")):Leap=t("../lib/index")},{"../lib/index":11}]},{},[34]);