UNPKG

@animech-public/playcanvas

Version:
9 lines 1.77 MB
/** * @license * PlayCanvas Engine v1.78.0-animech revision e1c6c734d (RELEASE) * Copyright 2011-2025 PlayCanvas Ltd. All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).pc={})}(this,(function(t){"use strict";var e="undefined"!=typeof document?document.currentScript:null;function i(t,e,i){t.prototype[e]||Object.defineProperty(t.prototype,e,{value:i,configurable:!0,enumerable:!1,writable:!0})}i(Array,"fill",(function(t){if(null==this)throw new TypeError("this is null or not defined");for(var e=Object(this),i=e.length>>>0,n=arguments[1]|0,s=n<0?Math.max(i+n,0):Math.min(n,i),r=arguments[2],a=void 0===r?i:r|0,o=a<0?Math.max(i+a,0):Math.min(a,i);s<o;)e[s]=t,s++;return e})),i(Array,"find",(function(t){if(null==this)throw TypeError('"this" is null or not defined');var e=Object(this),i=e.length>>>0;if("function"!=typeof t)throw TypeError("predicate must be a function");for(var n=arguments[1],s=0;s<i;){var r=e[s];if(t.call(n,r,s,e))return r;s++}})),i(Array,"findIndex",(function(t){if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),i=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var n=arguments[1],s=0;s<i;){var r=e[s];if(t.call(n,r,s,e))return s;s++}return-1})),Math.log2=Math.log2||function(t){return Math.log(t)*Math.LOG2E},Math.sign||(Math.sign=function(t){return(t>0)-(t<0)||+t}),void 0===Number.isFinite&&(Number.isFinite=function(t){return"number"==typeof t&&isFinite(t)}),"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(t,e){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var i=Object(t),n=1;n<arguments.length;n++){var s=arguments[n];if(null!=s)for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(i[r]=s[r])}return i},writable:!0,configurable:!0}),Object.fromEntries=Object.fromEntries||function(t){if(!t||!t[Symbol.iterator])throw new Error("Object.fromEntries() requires a single iterable argument");for(var e={},i=0;i<t.length;i++)e[t[i][0]]=t[i][1];return e},Object.entries=Object.entries||function(t){for(var e=Object.keys(t),i=e.length,n=new Array(i);i--;)n[i]=[e[i],t[e[i]]];return n},Object.values=Object.values||function(t){return Object.keys(t).map((function(e){return t[e]}))},function(){if("undefined"!=typeof navigator&&"undefined"!=typeof document){navigator.pointer=navigator.pointer||navigator.webkitPointer||navigator.mozPointer;var t=function(){var t=document.createEvent("CustomEvent");t.initCustomEvent("pointerlockchange",!0,!1,null),document.dispatchEvent(t)},e=function(){var t=document.createEvent("CustomEvent");t.initCustomEvent("pointerlockerror",!0,!1,null),document.dispatchEvent(t)};document.addEventListener("webkitpointerlockchange",t,!1),document.addEventListener("webkitpointerlocklost",t,!1),document.addEventListener("mozpointerlockchange",t,!1),document.addEventListener("mozpointerlocklost",t,!1),document.addEventListener("webkitpointerlockerror",e,!1),document.addEventListener("mozpointerlockerror",e,!1),Element.prototype.mozRequestPointerLock?Element.prototype.requestPointerLock=function(){this.mozRequestPointerLock()}:Element.prototype.requestPointerLock=Element.prototype.requestPointerLock||Element.prototype.webkitRequestPointerLock||Element.prototype.mozRequestPointerLock,!Element.prototype.requestPointerLock&&navigator.pointer&&(Element.prototype.requestPointerLock=function(){document.pointerLockElement=this,navigator.pointer.lock(this,t,e)}),document.exitPointerLock=document.exitPointerLock||document.webkitExitPointerLock||document.mozExitPointerLock,document.exitPointerLock||(document.exitPointerLock=function(){navigator.pointer&&(document.pointerLockElement=null,navigator.pointer.unlock())})}}(),i(String,"endsWith",(function(t,e){return(void 0===e||e>this.length)&&(e=this.length),this.substring(e-t.length,e)===t})),i(String,"includes",(function(t,e){return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&-1!==this.indexOf(t,e)})),i(String,"startsWith",(function(t,e){var i=e>0?0|e:0;return this.substring(i,i+t.length)===t})),i(String,"trimEnd",(function(){return this.replace(new RegExp(/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/.source+"$","g"),"")}));for(var n=0,s=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array];n<s.length;n++){var r=s[n];i(r,"fill",Array.prototype.fill),i(r,"join",Array.prototype.join)}var a="GpuTimings",o="1.78.0-animech",h="e1c6c734d",l=["undefined","number","string","boolean"],c={"[object Array]":"array","[object Object]":"object","[object Function]":"function","[object Date]":"date","[object RegExp]":"regexp","[object Float32Array]":"float32array"};function u(t){if(null===t)return"null";var e=typeof t;return l.includes(e)?e:c[Object.prototype.toString.call(t)]}function d(t,e){for(var i in e){var n=e[i];"object"===u(n)?t[i]=d({},n):"array"===u(n)?t[i]=d([],n):t[i]=n}return t}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function p(t,e,i,n,s,r,a){try{var o=t[r](a),h=o.value}catch(t){return void i(t)}o.done?e(h):Promise.resolve(h).then(n,s)}function m(t){return function(){var e=this,i=arguments;return new Promise((function(n,s){var r=t.apply(e,i);function a(t){p(r,n,s,a,o,"next",t)}function o(t){p(r,n,s,a,o,"throw",t)}a(void 0)}))}}function _(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,T(n.key),n)}}function v(t,e,i){return e&&_(t.prototype,e),i&&_(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function g(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return f(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?f(t,e):void 0}}(t))||e){i&&(t=i);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(){return y=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)({}).hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},y.apply(null,arguments)}function x(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,b(t,e)}function S(){S=function(){return e};var t,e={},i=Object.prototype,n=i.hasOwnProperty,s=Object.defineProperty||function(t,e,i){t[e]=i.value},r="function"==typeof Symbol?Symbol:{},a=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",h=r.toStringTag||"@@toStringTag";function l(t,e,i){return Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,i){return t[e]=i}}function c(t,e,i,n){var r=e&&e.prototype instanceof v?e:v,a=Object.create(r.prototype),o=new I(n||[]);return s(a,"_invoke",{value:C(t,i,o)}),a}function u(t,e,i){try{return{type:"normal",arg:t.call(e,i)}}catch(t){return{type:"throw",arg:t}}}e.wrap=c;var d="suspendedStart",f="suspendedYield",p="executing",m="completed",_={};function v(){}function g(){}function y(){}var x={};l(x,a,(function(){return this}));var b=Object.getPrototypeOf,T=b&&b(b(D([])));T&&T!==i&&n.call(T,a)&&(x=T);var w=y.prototype=v.prototype=Object.create(x);function E(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function i(s,r,a,o){var h=u(t[s],t,r);if("throw"!==h.type){var l=h.arg,c=l.value;return c&&"object"==typeof c&&n.call(c,"__await")?e.resolve(c.__await).then((function(t){i("next",t,a,o)}),(function(t){i("throw",t,a,o)})):e.resolve(c).then((function(t){l.value=t,a(l)}),(function(t){return i("throw",t,a,o)}))}o(h.arg)}var r;s(this,"_invoke",{value:function(t,n){function s(){return new e((function(e,s){i(t,n,e,s)}))}return r=r?r.then(s,s):s()}})}function C(e,i,n){var s=d;return function(r,a){if(s===p)throw Error("Generator is already running");if(s===m){if("throw"===r)throw a;return{value:t,done:!0}}for(n.method=r,n.arg=a;;){var o=n.delegate;if(o){var h=M(o,n);if(h){if(h===_)continue;return h}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(s===d)throw s=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);s=p;var l=u(e,i,n);if("normal"===l.type){if(s=n.done?m:f,l.arg===_)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(s=m,n.method="throw",n.arg=l.arg)}}}function M(e,i){var n=i.method,s=e.iterator[n];if(s===t)return i.delegate=null,"throw"===n&&e.iterator.return&&(i.method="return",i.arg=t,M(e,i),"throw"===i.method)||"return"!==n&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+n+"' method")),_;var r=u(s,e.iterator,i.arg);if("throw"===r.type)return i.method="throw",i.arg=r.arg,i.delegate=null,_;var a=r.arg;return a?a.done?(i[e.resultName]=a.value,i.next=e.nextLoc,"return"!==i.method&&(i.method="next",i.arg=t),i.delegate=null,_):a:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,_)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function R(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function D(e){if(e||""===e){var i=e[a];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var s=-1,r=function i(){for(;++s<e.length;)if(n.call(e,s))return i.value=e[s],i.done=!1,i;return i.value=t,i.done=!0,i};return r.next=r}}throw new TypeError(typeof e+" is not iterable")}return g.prototype=y,s(w,"constructor",{value:y,configurable:!0}),s(y,"constructor",{value:g,configurable:!0}),g.displayName=l(y,h,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,l(t,h,"GeneratorFunction")),t.prototype=Object.create(w),t},e.awrap=function(t){return{__await:t}},E(A.prototype),l(A.prototype,o,(function(){return this})),e.AsyncIterator=A,e.async=function(t,i,n,s,r){void 0===r&&(r=Promise);var a=new A(c(t,i,n,s),r);return e.isGeneratorFunction(i)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(w),l(w,h,"Generator"),l(w,a,(function(){return this})),l(w,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),i=[];for(var n in e)i.push(n);return i.reverse(),function t(){for(;i.length;){var n=i.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=D,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(R),!e)for(var i in this)"t"===i.charAt(0)&&n.call(this,i)&&!isNaN(+i.slice(1))&&(this[i]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var i=this;function s(n,s){return o.type="throw",o.arg=e,i.next=n,s&&(i.method="next",i.arg=t),!!s}for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r],o=a.completion;if("root"===a.tryLoc)return s("end");if(a.tryLoc<=this.prev){var h=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(h&&l){if(this.prev<a.catchLoc)return s(a.catchLoc,!0);if(this.prev<a.finallyLoc)return s(a.finallyLoc)}else if(h){if(this.prev<a.catchLoc)return s(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return s(a.finallyLoc)}}}},abrupt:function(t,e){for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev<s.finallyLoc){var r=s;break}}r&&("break"===t||"continue"===t)&&r.tryLoc<=e&&e<=r.finallyLoc&&(r=null);var a=r?r.completion:{};return a.type=t,a.arg=e,r?(this.method="next",this.next=r.finallyLoc,_):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),_},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.finallyLoc===t)return this.complete(i.completion,i.afterLoc),R(i),_}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.tryLoc===t){var n=i.completion;if("throw"===n.type){var s=n.arg;R(i)}return s}}throw Error("illegal catch attempt")},delegateYield:function(e,i,n){return this.delegate={iterator:D(e),resultName:i,nextLoc:n},"next"===this.method&&(this.arg=t),_}},e}function b(t,e){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},b(t,e)}function T(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:e+""}var w=function(){function t(){}return t.set=function(t,e){},t.get=function(e){return t._traceChannels.has(e)},t}();w._traceChannels=new Set,w.stack=!1;var E,A,C,M=function(){function t(t,e,i,n,s){void 0===s&&(s=!1),this.handler=void 0,this.name=void 0,this.callback=void 0,this.scope=void 0,this._once=void 0,this._removed=!1,this.handler=t,this.name=e,this.callback=i,this.scope=n,this._once=s}var e=t.prototype;return e.off=function(){this._removed||this.handler.offByHandle(this)},e.on=function(t,e,i){return void 0===i&&(i=this),this.handler._addCallback(t,e,i,!1)},e.once=function(t,e,i){return void 0===i&&(i=this),this.handler._addCallback(t,e,i,!0)},v(t,[{key:"removed",get:function(){return this._removed},set:function(t){t&&(this._removed=!0)}}])}(),P=function(){function t(){this._callbacks=new Map,this._callbackActive=new Map}var e=t.prototype;return e.initEventHandler=function(){this._callbacks=new Map,this._callbackActive=new Map},e._addCallback=function(t,e,i,n){if(this._callbacks.has(t)||this._callbacks.set(t,[]),this._callbackActive.has(t)){var s=this._callbackActive.get(t);s&&s===this._callbacks.get(t)&&this._callbackActive.set(t,s.slice())}var r=new M(this,t,e,i,n);return this._callbacks.get(t).push(r),r},e.on=function(t,e,i){return void 0===i&&(i=this),this._addCallback(t,e,i,!1)},e.once=function(t,e,i){return void 0===i&&(i=this),this._addCallback(t,e,i,!0)},e.off=function(t,e,i){if(t)this._callbackActive.has(t)&&this._callbackActive.get(t)===this._callbacks.get(t)&&this._callbackActive.set(t,this._callbackActive.get(t).slice());else for(var n,s=g(this._callbackActive);!(n=s()).done;){var r=n.value,a=r[0],o=r[1];this._callbacks.has(a)&&(this._callbacks.get(a)===o&&this._callbackActive.set(a,o.slice()))}if(t)if(e){var h=this._callbacks.get(t);if(!h)return this;for(var l=0;l<h.length;l++)h[l].callback===e&&(i&&h[l].scope!==i||(h[l].removed=!0,h.splice(l,1),l--));0===h.length&&this._callbacks.delete(t)}else{var c=this._callbacks.get(t);if(c){for(var u=0;u<c.length;u++)c[u].removed=!0;this._callbacks.delete(t)}}else{for(var d,f=g(this._callbacks.values());!(d=f()).done;)for(var p=d.value,m=0;m<p.length;m++)p[m].removed=!0;this._callbacks.clear()}return this},e.offByHandle=function(t){var e=t.name;t.removed=!0,this._callbackActive.has(e)&&this._callbackActive.get(e)===this._callbacks.get(e)&&this._callbackActive.set(e,this._callbackActive.get(e).slice());var i=this._callbacks.get(e);if(!i)return this;var n=i.indexOf(t);return-1!==n&&(i.splice(n,1),0===i.length&&this._callbacks.delete(e)),this},e.fire=function(t,e,i,n,s,r,a,o,h){if(!t)return this;var l,c=this._callbacks.get(t);if(!c)return this;this._callbackActive.has(t)?this._callbackActive.get(t)!==c&&(l=c.slice()):this._callbackActive.set(t,c);for(var u=0;(l||this._callbackActive.get(t))&&u<(l||this._callbackActive.get(t)).length;u++){var d=(l||this._callbackActive.get(t))[u];if(d.callback&&(d.callback.call(d.scope,e,i,n,s,r,a,o,h),d._once)){var f=this._callbacks.get(t),p=f?f.indexOf(d):-1;if(-1!==p){this._callbackActive.get(t)===f&&this._callbackActive.set(t,this._callbackActive.get(t).slice());var m=this._callbacks.get(t);if(!m)continue;m[p].removed=!0,m.splice(p,1),0===m.length&&this._callbacks.delete(t)}}}return l||this._callbackActive.delete(t),this},e.hasEvent=function(t){var e;return!(null==(e=this._callbacks.get(t))||!e.length)},t}(),R={attach:function(t){var e=R;return t._addCallback=e._addCallback,t.on=e.on,t.off=e.off,t.fire=e.fire,t.once=e.once,t.hasEvent=e.hasEvent,P.prototype.initEventHandler.call(t),t},_addCallback:P.prototype._addCallback,on:P.prototype.on,off:P.prototype.off,fire:P.prototype.fire,once:P.prototype.once,hasEvent:P.prototype.hasEvent},I={create:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))}},D={delimiter:"/",join:function(){for(var t=arguments.length<=0?void 0:arguments[0],e=0;e<arguments.length-1;e++){var i=e<0||arguments.length<=e?void 0:arguments[e],n=e+1<0||arguments.length<=e+1?void 0:arguments[e+1];n[0]!==D.delimiter?i&&n&&i[i.length-1]!==D.delimiter&&n[0]!==D.delimiter?t+=D.delimiter+n:t+=n:t=n}return t},normalize:function(t){for(var e=t.startsWith(D.delimiter),i=t.endsWith(D.delimiter),n=t.split("/"),s="",r=[],a=0;a<n.length;a++)""!==n[a]&&"."!==n[a]&&(".."===n[a]&&r.length>0?r=r.slice(0,r.length-2):(a>0&&r.push(D.delimiter),r.push(n[a])));return s=r.join(""),e||s[0]!==D.delimiter||(s=s.slice(1)),i&&s[s.length-1]!==D.delimiter&&(s+=D.delimiter),s},split:function(t){var e=t.lastIndexOf(D.delimiter);return-1!==e?[t.substring(0,e),t.substring(e+1)]:["",t]},getBasename:function(t){return D.split(t)[1]},getDirectory:function(t){return D.split(t)[0]},getExtension:function(t){var e=t.split("?")[0].split(".").pop();return e!==t?"."+e:""},isRelativePath:function(t){return"/"!==t.charAt(0)&&null===t.match(/:\/\//)},extractPath:function(t){var e="",i=t.split("/"),n=0;if(i.length>1)if(D.isRelativePath(t))if("."===i[0])for(n=0;n<i.length-1;++n)e+=0===n?i[n]:"/"+i[n];else if(".."===i[0])for(n=0;n<i.length-1;++n)e+=0===n?i[n]:"/"+i[n];else for(e=".",n=0;n<i.length-1;++n)e+="/"+i[n];else for(n=0;n<i.length-1;++n)e+=0===n?i[n]:"/"+i[n];return e}},L="undefined"!=typeof navigator?navigator.userAgent:"",k="undefined"!=typeof window?"browser":"undefined"!=typeof global?"node":"worker",O=/android/i.test(L)?"android":/ip(?:[ao]d|hone)/i.test(L)?"ios":/windows/i.test(L)?"windows":/mac os/i.test(L)?"osx":/linux/i.test(L)?"linux":/cros/i.test(L)?"cros":null,F="browser"!==k?null:/Chrome\/|Chromium\/|Edg.*\//.test(L)?"chrome":/Safari\//.test(L)?"safari":/Firefox\//.test(L)?"firefox":"other",B=/xbox/i.test(L),N="browser"===k&&("ontouchstart"in window||"maxTouchPoints"in navigator&&navigator.maxTouchPoints>0),U=!("browser"!==k||!navigator.getGamepads&&!navigator.webkitGetGamepads),z="undefined"!=typeof Worker,V=function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){return t=!0,!1}});window.addEventListener("testpassive",null,e),window.removeEventListener("testpassive",null,e)}catch(t){}return t}(),G={name:O,environment:k,global:null!=(E=null!=(A=null!=(C="undefined"!=typeof globalThis&&globalThis)?C:"browser"===k&&window)?A:"node"===k&&global)?E:"worker"===k&&self,browser:"browser"===k,worker:"worker"===k,desktop:["windows","osx","linux","cros"].includes(O),mobile:["android","ios"].includes(O),ios:"ios"===O,android:"android"===O,xbox:B,gamepads:U,touch:N,workers:z,passiveEvents:V,browserName:F},H="abcdefghijklmnopqrstuvwxyz",W="ABCDEFGHIJKLMNOPQRSTUVWXYZ",X=55296,j=127462,q=127487,Y=65024,K=65039;function Z(t,e){void 0===e&&(e=0);var i=t.length;if(e<0||e>=i)return null;var n=t.charCodeAt(e);if(i>1&&n>=X&&n<=56319){var s=t.charCodeAt(e+1);if(s>=56320&&s<=57343)return{code:1024*(n-X)+s-56320+65536,long:!0}}return{code:n,long:!1}}function Q(t,e,i){if(!t)return!1;var n=Z(t);if(n){var s=n.code;return s>=e&&s<=i}return!1}function J(t,e){if(e===t.length-1)return 1;if(Q(t[e],X,56319)){var i=t.substring(e,e+2),n=t.substring(e+2,e+4);return Q(n,127995,127999)||Q(i,j,q)&&Q(n,j,q)?4:Q(n,Y,K)?3:2}return Q(t[e+1],Y,K)?2:1}var $,tt,et,it={ASCII_LOWERCASE:H,ASCII_UPPERCASE:W,ASCII_LETTERS:H+W,format:function(t){for(var e=0;e<(arguments.length<=1?0:arguments.length-1);e++)t=t.replace("{"+e+"}",e+1<1||arguments.length<=e+1?void 0:arguments[e+1]);return t},getCodePoint:function(t,e){var i=Z(t,e);return i&&i.code},getCodePoints:function(t){if("string"!=typeof t)throw new TypeError("Not a string");for(var e,i=0,n=[];e=Z(t,i);)n.push(e.code),i+=e.long?2:1;return n},getSymbols:function(t){if("string"!=typeof t)throw new TypeError("Not a string");for(var e,i=0,n=t.length,s=[],r=0;i<n;)if(Q(e=t[i+(r+=J(t,i+r))],8400,8447)&&(e=t[i+r++]),Q(e,Y,K)&&(e=t[i+r++]),e&&8205===e.charCodeAt(0))e=t[i+r++];else{var a=t.substring(i,i+r);s.push(a),i+=r,r=0}return s},fromCodePoint:function(){for(var t,e,i,n=[],s=0;s<arguments.length;++s)e=(t=Number(arguments[s]))-65536,i=t>65535?[55296+(e>>10),e%1024+56320]:[t],n.push(String.fromCharCode.apply(null,i));return n.join("")}},nt=function(){function t(){this._list=[],this._index={}}var e=t.prototype;return e.push=function(t,e){if(this._index[t])throw Error("Key already in index "+t);var i=this._list.push(e)-1;this._index[t]=i},e.has=function(t){return void 0!==this._index[t]},e.get=function(t){var e=this._index[t];return void 0!==e?this._list[e]:null},e.remove=function(t){var e=this._index[t];if(void 0!==e){for(t in this._list.splice(e,1),delete this._index[t],this._index){var i=this._index[t];i>e&&(this._index[t]=i-1)}return!0}return!1},e.list=function(){return this._list},e.clear=function(){for(var t in this._list.length=0,this._index)delete this._index[t]},t}(),st=function(){function t(){}return t.loadScript=function(t,e){var i=document.createElement("script");i.setAttribute("src",t),i.onload=function(){e(null)},i.onerror=function(){e("Failed to load script='"+t+"'")},document.body.appendChild(i)},t.loadWasm=function(e,i,n){var s=t.wasmSupported()&&i.glueUrl&&i.wasmUrl?i.glueUrl:i.fallbackUrl;s?t.loadScript(s,(function(t){if(t)n(t,null);else{var s=window[e];window[e]=void 0,s({locateFile:function(){return i.wasmUrl},onAbort:function(){n("wasm module aborted.")}}).then((function(t){n(null,t)}))}})):n("No supported wasm modules found.",null)},t.getModule=function(e){return t.modules.hasOwnProperty(e)||(t.modules[e]={config:null,initializing:!1,instance:null,callbacks:[]}),t.modules[e]},t.initialize=function(e,i){if(!i.initializing){var n=i.config;(n.glueUrl||n.wasmUrl||n.fallbackUrl)&&(i.initializing=!0,t.loadWasm(e,n,(function(t,s){t?n.errorHandler?n.errorHandler(t):console.error("failed to initialize module="+e+" error="+t):(i.instance=s,i.callbacks.forEach((function(t){t(s)})))})))}},t}();st.modules={},st.wasmSupported=($=function(){try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){var t=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(t instanceof WebAssembly.Module)return new WebAssembly.Instance(t)instanceof WebAssembly.Instance}}catch(t){}return!1},et=tt={},function(){return et===tt&&(et=$()),et});var rt=function(){function t(){}return t.setConfig=function(t,e){var i=st.getModule(t);i.config=e,i.callbacks.length>0&&st.initialize(t,i)},t.getConfig=function(t){var e;return null==(e=st.modules)||null==(e=e[t])?void 0:e.config},t.getInstance=function(t,e){var i=st.getModule(t);i.instance?e(i.instance):(i.callbacks.push(e),i.config&&st.initialize(t,i))},t}(),at=function(){function t(t){this.arraybuffer=void 0,this.dataView=void 0,this.offset=0,this.arraybuffer=t,this.dataView=new DataView(t)}var e=t.prototype;return e.reset=function(t){void 0===t&&(t=0),this.offset=t},e.skip=function(t){this.offset+=t},e.align=function(t){this.offset=this.offset+t-1&~(t-1)},e._inc=function(t){return this.offset+=t,this.offset-t},e.readChar=function(){return String.fromCharCode(this.dataView.getUint8(this.offset++))},e.readChars=function(t){for(var e="",i=0;i<t;++i)e+=this.readChar();return e},e.readU8=function(){return this.dataView.getUint8(this.offset++)},e.readU16=function(){return this.dataView.getUint16(this._inc(2),!0)},e.readU32=function(){return this.dataView.getUint32(this._inc(4),!0)},e.readU64=function(){return this.readU32()+Math.pow(2,32)*this.readU32()},e.readU32be=function(){return this.dataView.getUint32(this._inc(4),!1)},e.readArray=function(t){for(var e=0;e<t.length;++e)t[e]=this.readU8()},e.readLine=function(){for(var t=this.dataView,e="";!(this.offset>=t.byteLength);){var i=String.fromCharCode(this.readU8());if("\n"===i)break;e+=i}return e},v(t,[{key:"remainingBytes",get:function(){return this.dataView.byteLength-this.offset}}])}(),ot=function(){function t(t){this.items=[],this.length=0,this.loopIndex=-1,this._sortBy=void 0,this._sortHandler=void 0,this._sortBy=t.sortBy,this._sortHandler=this._doSort.bind(this)}var e=t.prototype;return e._binarySearch=function(t){for(var e,i,n=0,s=this.items.length-1,r=t[this._sortBy];n<=s;)e=Math.floor((n+s)/2),(i=this.items[e][this._sortBy])<=r?n=e+1:i>r&&(s=e-1);return n},e._doSort=function(t,e){var i=this._sortBy;return t[i]-e[i]},e.insert=function(t){var e=this._binarySearch(t);this.items.splice(e,0,t),this.length++,this.loopIndex>=e&&this.loopIndex++},e.append=function(t){this.items.push(t),this.length++},e.remove=function(t){var e=this.items.indexOf(t);e<0||(this.items.splice(e,1),this.length--,this.loopIndex>=e&&this.loopIndex--)},e.sort=function(){var t=this.loopIndex>=0?this.items[this.loopIndex]:null;this.items.sort(this._sortHandler),null!==t&&(this.loopIndex=this.items.indexOf(t))},t}(),ht=function(t){function e(e){var i;return(i=t.call(this)||this)._index={},i._list=[],i._parent=e,i}x(e,t);var i=e.prototype;return i.add=function(){for(var t=!1,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];var s=this._processArguments(i,!0);if(!s.length)return t;for(var r=0;r<s.length;r++)this._index[s[r]]||(t=!0,this._index[s[r]]=!0,this._list.push(s[r]),this.fire("add",s[r],this._parent));return t&&this.fire("change",this._parent),t},i.remove=function(){var t=!1;if(!this._list.length)return t;for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];var s=this._processArguments(i,!0);if(!s.length)return t;for(var r=0;r<s.length;r++)this._index[s[r]]&&(t=!0,delete this._index[s[r]],this._list.splice(this._list.indexOf(s[r]),1),this.fire("remove",s[r],this._parent));return t&&this.fire("change",this._parent),t},i.clear=function(){if(this._list.length){var t=this._list.slice(0);this._list=[],this._index={};for(var e=0;e<t.length;e++)this.fire("remove",t[e],this._parent);this.fire("change",this._parent)}},i.has=function(){if(!this._list.length)return!1;for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this._has(this._processArguments(e))},i._has=function(t){if(!this._list.length||!t.length)return!1;for(var e=0;e<t.length;e++)if(1===t[e].length){if(this._index[t[e][0]])return!0}else{for(var i=!0,n=0;n<t[e].length;n++)if(!this._index[t[e][n]]){i=!1;break}if(i)return!0}return!1},i.list=function(){return this._list.slice(0)},i._processArguments=function(t,e){var i=[],n=[];if(!t||!t.length)return i;for(var s=0;s<t.length;s++)if(t[s]instanceof Array){e||(n=[]);for(var r=0;r<t[s].length;r++)"string"==typeof t[s][r]&&(e?i.push(t[s][r]):n.push(t[s][r]));!e&&n.length&&i.push(n)}else"string"==typeof t[s]&&(e?i.push(t[s]):i.push([t[s]]));return i},v(e,[{key:"size",get:function(){return this._list.length}}])}(P);ht.EVENT_ADD="add",ht.EVENT_REMOVE="remove",ht.EVENT_CHANGE="change";var lt="undefined"!=typeof window&&window.performance&&window.performance.now?performance.now.bind(performance):Date.now;var ct,ut=/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,dt=function(){function t(t){this.scheme=void 0,this.authority=void 0,this.path=void 0,this.query=void 0,this.fragment=void 0;var e=t.match(ut);this.scheme=e[2],this.authority=e[4],this.path=e[5],this.query=e[7],this.fragment=e[9]}var e=t.prototype;return e.toString=function(){var t="";return this.scheme&&(t+=this.scheme+":"),this.authority&&(t+="//"+this.authority),t+=this.path,this.query&&(t+="?"+this.query),this.fragment&&(t+="#"+this.fragment),t},e.getQuery=function(){var t={};if(this.query)for(var e,i=g(decodeURIComponent(this.query).split("&"));!(e=i()).done;){var n=e.value.split("=");t[n[0]]=n[1]}return t},e.setQuery=function(t){var e="";for(var i in t)t.hasOwnProperty(i)&&(""!==e&&(e+="&"),e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i]));this.query=e},t}(),ft={DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI,clamp:function(t,e,i){return t>=i?i:t<=e?e:t},intToBytes24:function(t){return[t>>16&255,t>>8&255,255&t]},intToBytes32:function(t){return[t>>24&255,t>>16&255,t>>8&255,255&t]},bytesToInt24:function(t,e,i){return t.length&&(i=t[2],e=t[1],t=t[0]),t<<16|e<<8|i},bytesToInt32:function(t,e,i,n){return t.length&&(n=t[3],i=t[2],e=t[1],t=t[0]),(t<<24|e<<16|i<<8|n)>>>0},lerp:function(t,e,i){return t+(e-t)*ft.clamp(i,0,1)},lerpAngle:function(t,e,i){return e-t>180&&(e-=360),e-t<-180&&(e+=360),ft.lerp(t,e,ft.clamp(i,0,1))},powerOfTwo:function(t){return 0!==t&&!(t&t-1)},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.log(2)))},random:function(t,e){var i=e-t;return Math.random()*i+t},smoothstep:function(t,e,i){return i<=t?0:i>=e?1:(i=(i-t)/(e-t))*i*(3-2*i)},smootherstep:function(t,e,i){return i<=t?0:i>=e?1:(i=(i-t)/(e-t))*i*i*(i*(6*i-15)+10)},roundUp:function(t,e){return 0===e?t:Math.ceil(t/e)*e},between:function(t,e,i,n){var s=Math.min(e,i),r=Math.max(e,i);return n?t>=s&&t<=r:t>s&&t<r}},pt=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),this.r=void 0,this.g=void 0,this.b=void 0,this.a=void 0;var s=t.length;3===s||4===s?(this.r=t[0],this.g=t[1],this.b=t[2],this.a=void 0!==t[3]?t[3]:1):(this.r=t,this.g=e,this.b=i,this.a=n)}var e=t.prototype;return e.clone=function(){return new(0,this.constructor)(this.r,this.g,this.b,this.a)},e.copy=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.equals=function(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a},e.set=function(t,e,i,n){return void 0===n&&(n=1),this.r=t,this.g=e,this.b=i,this.a=n,this},e.lerp=function(t,e,i){return this.r=t.r+i*(e.r-t.r),this.g=t.g+i*(e.g-t.g),this.b=t.b+i*(e.b-t.b),this.a=t.a+i*(e.a-t.a),this},e.fromString=function(t){var e,i=parseInt(t.replace("#","0x"),16);return t.length>7?e=ft.intToBytes32(i):(e=ft.intToBytes24(i))[3]=255,this.set(e[0]/255,e[1]/255,e[2]/255,e[3]/255),this},e.fromArray=function(t,e){var i,n,s,r;return void 0===e&&(e=0),this.r=null!=(i=t[e])?i:this.r,this.g=null!=(n=t[e+1])?n:this.g,this.b=null!=(s=t[e+2])?s:this.b,this.a=null!=(r=t[e+3])?r:this.a,this},e.toString=function(t){var e="#"+((1<<24)+(Math.round(255*this.r)<<16)+(Math.round(255*this.g)<<8)+Math.round(255*this.b)).toString(16).slice(1);if(!0===t){var i=Math.round(255*this.a).toString(16);this.a<16/255?e+="0"+i:e+=i}return e},e.toArray=function(t,e,i){return void 0===t&&(t=[]),void 0===e&&(e=0),void 0===i&&(i=!0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,i&&(t[e+3]=this.a),t},t}();ct=pt,pt.BLACK=Object.freeze(new ct(0,0,0,1)),pt.BLUE=Object.freeze(new ct(0,0,1,1)),pt.CYAN=Object.freeze(new ct(0,1,1,1)),pt.GRAY=Object.freeze(new ct(.5,.5,.5,1)),pt.GREEN=Object.freeze(new ct(0,1,0,1)),pt.MAGENTA=Object.freeze(new ct(1,0,1,1)),pt.RED=Object.freeze(new ct(1,0,0,1)),pt.WHITE=Object.freeze(new ct(1,1,1,1)),pt.YELLOW=Object.freeze(new ct(1,1,0,1));var mt,_t,vt=function(){function t(t,e){void 0===e&&(e=0),this._curve=void 0,this._left=-1/0,this._right=1/0,this._recip=0,this._p0=0,this._p1=0,this._m0=0,this._m1=0,this._curve=t,this._reset(e)}var e=t.prototype;return e.evaluate=function(t,e){var i;void 0===e&&(e=!1),(e||t<this._left||t>=this._right)&&this._reset(t);var n=this._curve.type;if(5===n)i=this._p0;else{var s=0===this._recip?0:(t-this._left)*this._recip;i=0===n?ft.lerp(this._p0,this._p1,s):1===n?ft.lerp(this._p0,this._p1,s*s*(3-2*s)):this._evaluateHermite(this._p0,this._p1,this._m0,this._m1,s)}return i},e._reset=function(t){var e=this._curve.keys,i=e.length;if(i)if(t<e[0][0])this._left=-1/0,this._right=e[0][0],this._recip=0,this._p0=this._p1=e[0][1],this._m0=this._m1=0;else if(t>=e[i-1][0])this._left=e[i-1][0],this._right=1/0,this._recip=0,this._p0=this._p1=e[i-1][1],this._m0=this._m1=0;else{for(var n=0;t>=e[n+1][0];)n++;this._left=e[n][0],this._right=e[n+1][0];var s=1/(this._right-this._left);this._recip=isFinite(s)?s:0,this._p0=e[n][1],this._p1=e[n+1][1],this._isHermite()&&this._calcTangents(e,n)}else this._left=-1/0,this._right=1/0,this._recip=0,this._p0=this._p1=this._m0=this._m1=0},e._isHermite=function(){return 2===this._curve.type||3===this._curve.type||4===this._curve.type},e._calcTangents=function(t,e){var i,n,s=t[e],r=t[e+1];if(i=0===e?[t[0][0]+(t[0][0]-t[1][0]),t[0][1]+(t[0][1]-t[1][1])]:t[e-1],n=e===t.length-2?[t[e+1][0]+(t[e+1][0]-t[e][0]),t[e+1][1]+(t[e+1][1]-t[e][1])]:t[e+2],4===this._curve.type){var a=2*(r[0]-s[0])/(r[0]-i[0]),o=2*(r[0]-s[0])/(n[0]-s[0]);this._m0=this._curve.tension*(isFinite(a)?a:0)*(r[1]-i[1]),this._m1=this._curve.tension*(isFinite(o)?o:0)*(n[1]-s[1])}else{var h=(r[0]-s[0])/(s[0]-i[0]),l=(r[0]-s[0])/(n[0]-r[0]),c=s[1]+(i[1]-s[1])*(isFinite(h)?h:0),u=r[1]+(n[1]-r[1])*(isFinite(l)?l:0),d=2===this._curve.type?.5:this._curve.tension;this._m0=d*(r[1]-c),this._m1=d*(u-s[1])}},e._evaluateHermite=function(t,e,i,n,s){var r=s*s,a=s+s,o=1-s,h=o*o;return t*((1+a)*h)+i*(s*h)+e*(r*(3-a))+n*(r*(s-1))},t}(),gt=function(){function t(t){if(this.keys=[],this.type=1,this.tension=.5,this._eval=new vt(this),t)for(var e=0;e<t.length-1;e+=2)this.keys.push([t[e],t[e+1]]);this.sort()}var e=t.prototype;return e.add=function(t,e){for(var i=this.keys,n=i.length,s=0;s<n&&!(i[s][0]>t);s++);var r=[t,e];return this.keys.splice(s,0,r),r},e.get=function(t){return this.keys[t]},e.sort=function(){this.keys.sort((function(t,e){return t[0]-e[0]}))},e.value=function(t){return this._eval.evaluate(t,!0)},e.closest=function(t){for(var e=this.keys,i=e.length,n=2,s=null,r=0;r<i;r++){var a=Math.abs(t-e[r][0]);if(!(n>=a))break;n=a,s=e[r]}return s},e.clone=function(){var t=new this.constructor;return t.keys=this.keys.map((function(t){return[].concat(t)})),t.type=this.type,t.tension=this.tension,t},e.quantize=function(t){t=Math.max(t,2);var e=new Float32Array(t),i=1/(t-1);e[0]=this._eval.evaluate(0,!0);for(var n=1;n<t;n++)e[n]=this._eval.evaluate(i*n);return e},e.quantizeClamped=function(t,e,i){for(var n=this.quantize(t),s=0;s<n.length;++s)n[s]=Math.min(i,Math.max(e,n[s]));return n},v(t,[{key:"length",get:function(){return this.keys.length}}])}(),yt=function(){function t(){if(this.curves=[],this._type=1,arguments.length>1)for(var t=0;t<arguments.length;t++)this.curves.push(new gt(arguments[t]));else if(0===arguments.length)this.curves.push(new gt);else{var e=arguments[0];if("number"==typeof e)for(var i=0;i<e;i++)this.curves.push(new gt);else for(var n=0;n<e.length;n++)this.curves.push(new gt(e[n]))}}var e=t.prototype;return e.get=function(t){return this.curves[t]},e.value=function(t,e){void 0===e&&(e=[]);var i=this.curves.length;e.length=i;for(var n=0;n<i;n++)e[n]=this.curves[n].value(t);return e},e.clone=function(){var t=new this.constructor;t.curves=[];for(var e=0;e<this.curves.length;e++)t.curves.push(this.curves[e].clone());return t._type=this._type,t},e.quantize=function(t){t=Math.max(t,2);for(var e=this.curves.length,i=new Float32Array(t*e),n=1/(t-1),s=0;s<e;s++)for(var r=new vt(this.curves[s]),a=0;a<t;a++)i[a*e+s]=r.evaluate(n*a);return i},e.quantizeClamped=function(t,e,i){for(var n=this.quantize(t),s=0;s<n.length;++s)n[s]=Math.min(i,Math.max(e,n[s]));return n},v(t,[{key:"length",get:function(){return this.curves.length}},{key:"type",get:function(){return this._type},set:function(t){this._type=t;for(var e=0;e<this.curves.length;e++)this.curves[e].type=t}}])}(),xt=1/255,St=new Float32Array(1),bt=new Int32Array(St.buffer),Tt=function(){function t(){}return t.float2Half=function(t){St[0]=t;var e=bt[0],i=e>>16&32768,n=e>>12&2047,s=e>>23&255;return s<103?i:s>142?(i|=31744,i|=(255===s?0:1)&&8388607&e):s<113?i|=((n|=2048)>>114-s)+(n>>113-s&1):(i|=s-112<<10|n>>1,i+=1&n)},t.float2Bytes=function(t,e,i,n){var s=255*t%1;if(e[i+0]=Math.round(255*(t%1-xt*s)),n>1){var r=65025*t%1;if(e[i+1]=Math.round(255*(s-xt*r)),n>2){var a=16581375*t%1;e[i+2]=Math.round(255*(r-xt*a)),n>3&&(e[i+3]=Math.round(255*a))}}},t.float2BytesRange=function(e,i,n,s,r,a){e=ft.clamp((e-s)/(r-s),0,1),t.float2Bytes(e,i,n,a)},t.float2MantissaExponent=function(e,i,n,s){var r=Math.floor(Math.log2(Math.abs(e)))+1;e/=Math.pow(2,r),t.float2BytesRange(e,i,n,-1,1,s-1),i[n+s-1]=Math.round(r+127)},t}(),wt=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=void 0,this.y=void 0,this.z=void 0,3===t.length?(this.x=t[0],this.y=t[1],this.z=t[2]):(this.x=t,this.y=e,this.z=i)}var e=t.prototype;return e.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},e.add2=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},e.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},e.addScaled=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},e.clone=function(){return new(0,this.constructor)(this.x,this.y,this.z)},e.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.cross=function(t,e){var i=t.x,n=t.y,s=t.z,r=e.x,a=e.y,o=e.z;return this.x=n*o-a*s,this.y=s*r-o*i,this.z=i*a-r*n,this},e.distance=function(t){var e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return Math.sqrt(e*e+i*i+n*n)},e.div=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},e.div2=function(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this.z=t.z/e.z,this},e.divScalar=function(t){return this.x/=t,this.y/=t,this.z/=t,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.equals=function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z},e.equalsApprox=function(t,e){return void 0===e&&(e=1e-6),Math.abs(this.x-t.x)<e&&Math.abs(this.y-t.y)<e&&Math.abs(this.z-t.z)<e},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.lerp=function(t,e,i){return this.x=t.x+i*(e.x-t.x),this.y=t.y+i*(e.y-t.y),this.z=t.z+i*(e.z-t.z),this},e.mul=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this},e.mul2=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},e.mulScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.normalize=function(t){void 0===t&&(t=this);var e=t.x*t.x+t.y*t.y+t.z*t.z;if(e>0){var i=1/Math.sqrt(e);this.x=t.x*i,this.y=t.y*i,this.z=t.z*i}return this},e.floor=function(t){return void 0===t&&(t=this),this.x=Math.floor(t.x),this.y=Math.floor(t.y),this.z=Math.floor(t.z),this},e.ceil=function(t){return void 0===t&&(t=this),this.x=Math.ceil(t.x),this.y=Math.ceil(t.y),this.z=Math.ceil(t.z),this},e.round=function(t){return void 0===t&&(t=this),this.x=Math.round(t.x),this.y=Math.round(t.y),this.z=Math.round(t.z),this},e.min=function(t){return t.x<this.x&&(this.x=t.x),t.y<this.y&&(this.y=t.y),t.z<this.z&&(this.z=t.z),this},e.max=function(t){return t.x>this.x&&(this.x=t.x),t.y>this.y&&(this.y=t.y),t.z>this.z&&(this.z=t.z),this},e.project=function(t){var e=(this.x*t.x+this.y*t.y+this.z*t.z)/(t.x*t.x+t.y*t.y+t.z*t.z);return this.x=t.x*e,this.y=t.y*e,this.z=t.z*e,this},e.set=function(t,e,i){return this.x=t,this.y=e,this.z=i,this},e.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},e.sub2=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},e.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},e.fromArray=function(t,e){var i,n,s;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:this.x,this.y=null!=(n=t[e+1])?n:this.y,this.z=null!=(s=t[e+2])?s:this.z,this},e.toString=function(){return"["+this.x+", "+this.y+", "+this.z+"]"},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},t}();mt=wt,wt.ZERO=Object.freeze(new mt(0,0,0)),wt.ONE=Object.freeze(new mt(1,1,1)),wt.UP=Object.freeze(new mt(0,1,0)),wt.DOWN=Object.freeze(new mt(0,-1,0)),wt.RIGHT=Object.freeze(new mt(1,0,0)),wt.LEFT=Object.freeze(new mt(-1,0,0)),wt.FORWARD=Object.freeze(new mt(0,0,-1)),wt.BACK=Object.freeze(new mt(0,0,1));var Et,At=function(){function t(){this.data=new Float32Array(9),this.data[0]=this.data[4]=this.data[8]=1}var e=t.prototype;return e.clone=function(){return(new(0,this.constructor)).copy(this)},e.copy=function(t){var e=t.data,i=this.data;return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],this},e.set=function(t){var e=this.data;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],this},e.getX=function(t){return void 0===t&&(t=new wt),t.set(this.data[0],this.data[1],this.data[2])},e.getY=function(t){return void 0===t&&(t=new wt),t.set(this.data[3],this.data[4],this.data[5])},e.getZ=function(t){return void 0===t&&(t=new wt),t.set(this.data[6],this.data[7],this.data[8])},e.equals=function(t){var e=this.data,i=t.data;return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]&&e[4]===i[4]&&e[5]===i[5]&&e[6]===i[6]&&e[7]===i[7]&&e[8]===i[8]},e.isIdentity=function(){var t=this.data;return 1===t[0]&&0===t[1]&&0===t[2]&&0===t[3]&&1===t[4]&&0===t[5]&&0===t[6]&&0===t[7]&&1===t[8]},e.setIdentity=function(){var t=this.data;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,this},e.toString=function(){return"["+this.data.join(", ")+"]"},e.transpose=function(t){void 0===t&&(t=this);var e,i=t.data,n=this.data;i===n?(e=i[1],n[1]=i[3],n[3]=e,e=i[2],n[2]=i[6],n[6]=e,e=i[5],n[5]=i[7],n[7]=e):(n[0]=i[0],n[1]=i[3],n[2]=i[6],n[3]=i[1],n[4]=i[4],n[5]=i[7],n[6]=i[2],n[7]=i[5],n[8]=i[8]);return this},e.setFromMat4=function(t){var e=t.data,i=this.data;return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[4],i[4]=e[5],i[5]=e[6],i[6]=e[8],i[7]=e[9],i[8]=e[10],this},e.setFromQuat=function(t){var e=t.x,i=t.y,n=t.z,s=t.w,r=e+e,a=i+i,o=n+n,h=e*r,l=e*a,c=e*o,u=i*a,d=i*o,f=n*o,p=s*r,m=s*a,_=s*o,v=this.data;return v[0]=1-(u+f),v[1]=l+_,v[2]=c-m,v[3]=l-_,v[4]=1-(h+f),v[5]=d+p,v[6]=c+m,v[7]=d-p,v[8]=1-(h+u),this},e.invertMat4=function(t){var e=t.data,i=e[0],n=e[1],s=e[2],r=e[4],a=e[5],o=e[6],h=e[8],l=e[9],c=e[10],u=c*a-o*l,d=-c*n+s*l,f=o*n-s*a,p=-c*r+o*h,m=c*i-s*h,_=-o*i+s*r,v=l*r-a*h,g=-l*i+n*h,y=a*i-n*r,x=i*u+n*p+s*v;if(0===x)this.setIdentity();else{var S=1/x,b=this.data;b[0]=u*S,b[1]=d*S,b[2]=f*S,b[3]=p*S,b[4]=m*S,b[5]=_*S,b[6]=v*S,b[7]=g*S,b[8]=y*S}return this},e.transformVector=function(t,e){void 0===e&&(e=new wt);var i=this.data,n=t.x,s=t.y,r=t.z;return e.x=n*i[0]+s*i[3]+r*i[6],e.y=n*i[1]+s*i[4]+r*i[7],e.z=n*i[2]+s*i[5]+r*i[8],e},t}();_t=At,At.IDENTITY=Object.freeze(new _t),At.ZERO=Object.freeze((new _t).set([0,0,0,0,0,0,0,0,0]));var Ct,Mt=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=void 0,this.y=void 0,2===t.length?(this.x=t[0],this.y=t[1]):(this.x=t,this.y=e)}var e=t.prototype;return e.add=function(t){return this.x+=t.x,this.y+=t.y,this},e.add2=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},e.addScalar=function(t){return this.x+=t,this.y+=t,this},e.addScaled=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},e.clone=function(){return new(0,this.constructor)(this.x,this.y)},e.copy=function(t){return this.x=t.x,this.y=t.y,this},e.cross=function(t){return this.x*t.y-this.y*t.x},e.distance=function(t){var e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)},e.div=function(t){return this.x/=t.x,this.y/=t.y,this},e.div2=function(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this},e.divScalar=function(t){return this.x/=t,this.y/=t,this},e.dot=function(t){return this.x*t.x+this.y*t.y},e.equals=function(t){return this.x===t.x&&this.y===t.y},e.equalsApprox=function(t,e){return void 0===e&&(e=1e-6),Math.abs(this.x-t.x)<e&&Math.abs(this.y-t.y)<e},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.lengthSq=function(){return this.x*this.x+this.y*this.y},e.lerp=function(t,e,i){return this.x=t.x+i*(e.x-t.x),this.y=t.y+i*(e.y-t.y),this},e.mul=function(t){return this.x*=t.x,this.y*=t.y,this},e.mul2=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this},e.mulScalar=function(t){return this.x*=t,this.y*=t,this},e.normalize=function(t){void 0===t&&(t=this);var e=t.x*t.x+t.y*t.y;if(e>0){var i=1/Math.sqrt(e);this.x=t.x*i,this.y=t.y*i}return this},e.rotate=function(t){var e=Math.atan2(this.x,this.y)+t*ft.DEG_TO_RAD,i=Math.sqrt(this.x*this.x+this.y*this.y);return this.x=Math.sin(e)*i,this.y=Math.cos(e)*i,this},e.angle=function(){return Math.atan2(this.x,this.y)*ft.RAD_TO_DEG},e.angleTo=function(t){return Math.atan2(this.x*t.y+this.y*t.x,this.x*t.x+this.y*t.y)*ft.RAD_TO_DEG},e.floor=function(t){return void 0===t&&(t=this),this.x=Math.floor(t.x),this.y=Math.floor(t.y),this},e.ceil=function(t){return void 0===t&&(t=this),this.x=Math.ceil(t.x),this.y=Math.ceil(t.y),this},e.round=function(t){return void 0===t&&(t=this),this.x=Math.round(t.x),this.y=Math.round(t.y),this},e.min=function(t){return t.x<this.x&&(this.x=t.x),t.y<this.y&&(this.y=t.y),this},e.max=function(t){return t.x>this.x&&(this.x=t.x),t.y>this.y&&(this.y=t.y),this},e.set=function(t,e){return this.x=t,this.y=e,this},e.sub=function(t){return this.x-=t.x,this.y-=t.y,this},e.sub2=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},e.subScalar=function(t){return this.x-=t,this.y-=t,this},e.fromArray=function(t,e){var i,n;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:this.x,this.y=null!=(n=t[e+1])?n:this.y,this},e.toString=function(){return"["+this.x+", "+this.y+"]"},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},t.angleRad=function(t,e){return Math.atan2(t.x*e.y-t.y*e.x,t.x*e.x+t.y*e.y)},t}();Et=Mt,Mt.ZERO=Object.freeze(new Et(0,0)),Mt.ONE=Object.freeze(new Et(1,1)),Mt.UP=Object.freeze(new Et(0,1)),Mt.DOWN=Object.freeze(new Et(0,-1)),Mt.RIGHT=Object.freeze(new Et(1,0)),Mt.LEFT=Object.freeze(new Et(-1,0));var Pt,Rt=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=void 0,this.y=void 0,this.z=void 0,this.w=void 0,4===t.length?(this.x=t[0],this.y=t[1],this.z=t[2],this.w=t[3]):(this.x=t,this.y=e,this.z=i,this.w=n)}var e=t.prototype;return e.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this},e.add2=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},e.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},e.addScaled=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},e.clone=function(){return new(0,this.constructor)(this.x,this.y,this.z,this.w)},e.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.div=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this},e.div2=function(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this.z=t.z/e.z,this.w=t.w/e.w,this},e.divScalar=function(t){return this.x/=t,this.y/=t,this.z/=t,this.w/=t,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.equals=function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},e.equalsApprox=function(t,e){return void 0===e&&(e=1e-6),Math.abs(this.x-t.x)<e&&Math.abs(this.y-t.y)<e&&Math.abs(this.z-t.z)<e&&Math.abs(this.w-t.w)<e},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.lerp=function(t,e,i){return this.x=t.x+i*(e.x-t.x),this.y=t.y+i*(e.y-t.y),this.z=t.z+i*(e.z-t.z),this.w=t.w+i*(e.w-t.w),this},e.mul=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this},e.mul2=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this.w=t.w*e.w,this},e.mulScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.normalize=function(t){void 0===t&&(t=this);var e=t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w;if(e>0){var i=1/Math.sqrt(e);this.x=t.x*i,this.y=t.y*i,this.z=t.z*i,this.w=t.w*i}return this},e.floor=function(t){return void 0===t&&(t=this),this.x=Math.floor(t.x),this.y=Math.floor(t.y),this.z=Math.floor(t.z),this.w=Math.floor(t.w),this},e.ceil=function(t){return void 0===t&&(t=this),this.x=Math.ceil(t.x),this.y=Math.ceil(t.y),this.z=Math.ceil(t.z),this.w=Math.ceil(t.w),this},e.round=function(t){return void 0===t&&(t=this),this.x=Math.round(t.x),this.y=Math.round(t.y),this.z=Math.round(t.z),this.w=Math.round(t.w),this},e.min=function(t){return t.x<this.x&&(this.x=t.x),t.y<this.y&&(this.y=t.y),t.z<this.z&&(this.z=t.z),t.w<this.w&&(this.w=t.w),this},e.max=function(t){return t.x>this.x&&(this.x=t.x),t.y>this.y&&(this.y=t.y),t.z>this.z&&(this.z=t.z),t.w>this.w&&(this.w=t.w),this},e.set=function(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this},e.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.