@animech-public/playcanvas
Version:
PlayCanvas WebGL game engine
69 lines (39 loc) • 1.71 MB
JavaScript
/**
* @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.
*/
const e$2B="RenderFrame",l$R="RenderFrameTime",r$1l="RenderPass",n$1O="RenderPassDetail",o$1e="RenderAction",i$1x="RenderTargetAlloc",A$g="TextureAlloc",d$P="ShaderAlloc",t$27="ShaderCompile",R$g="VRAM.Texture",a$1r="VRAM.Vb",c$19="VRAM.Ib",u$M="VRAM.Sb",p$I="BindGroupAlloc",m$I="BindGroupFormatAlloc",s$1R="RenderPipelineAlloc",T$i="ComputePipelineAlloc",P$g="PipelineLayoutAlloc",V$9="Element",x$s="Textures",M$i="RenderQueue",b$m="GpuTimings";
const t$26="1.78.0-animech",e$2A="e1c6c734d",n$1N={},o$1d={},c$18={},r$1k={},a$1q=["undefined","number","string","boolean"],b$l={"[object Array]":"array","[object Object]":"object","[object Function]":"function","[object Date]":"date","[object RegExp]":"regexp","[object Float32Array]":"float32array"};function u$L(t){if(null===t)return "null";const e=typeof t;return a$1q.includes(e)?e:b$l[Object.prototype.toString.call(t)]}function i$1w(t,e){for(const n in e){const o=e[n];"object"===u$L(o)?t[n]=i$1w({},o):"array"===u$L(o)?t[n]=i$1w([],o):t[n]=o;}return t}
let e$2z = class e{constructor(e,t,s,h,i=!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=e,this.name=t,this.callback=s,this.scope=h,this._once=i;}off(){this._removed||this.handler.offByHandle(this);}on(e,t,s=this){return this.handler._addCallback(e,t,s,!1)}once(e,t,s=this){return this.handler._addCallback(e,t,s,!0)}set removed(e){e&&(this._removed=!0);}get removed(){return this._removed}};
let c$17 = class c{constructor(){this._callbacks=new Map,this._callbackActive=new Map;}initEventHandler(){this._callbacks=new Map,this._callbackActive=new Map;}_addCallback(c,l,e,a){if(this._callbacks.has(c)||this._callbacks.set(c,[]),this._callbackActive.has(c)){const t=this._callbackActive.get(c);t&&t===this._callbacks.get(c)&&this._callbackActive.set(c,t.slice());}const s=new e$2z(this,c,l,e,a);return this._callbacks.get(c).push(s),s}on(t,c,l=this){return this._addCallback(t,c,l,!1)}once(t,c,l=this){return this._addCallback(t,c,l,!0)}off(t,c,l){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(const[t,c]of this._callbackActive)this._callbacks.has(t)&&this._callbacks.get(t)===c&&this._callbackActive.set(t,c.slice());if(t)if(c){const e=this._callbacks.get(t);if(!e)return this;for(let t=0;t<e.length;t++)e[t].callback===c&&(l&&e[t].scope!==l||(e[t].removed=!0,e.splice(t,1),t--));0===e.length&&this._callbacks.delete(t);}else {const c=this._callbacks.get(t);if(c){for(let t=0;t<c.length;t++)c[t].removed=!0;this._callbacks.delete(t);}}else {for(const t of this._callbacks.values())for(let c=0;c<t.length;c++)t[c].removed=!0;this._callbacks.clear();}return this}offByHandle(t){const c=t.name;t.removed=!0,this._callbackActive.has(c)&&this._callbackActive.get(c)===this._callbacks.get(c)&&this._callbackActive.set(c,this._callbackActive.get(c).slice());const l=this._callbacks.get(c);if(!l)return this;const e=l.indexOf(t);return -1!==e&&(l.splice(e,1),0===l.length&&this._callbacks.delete(c)),this}fire(t,c,l,e,a,s,i,h,b){if(!t)return this;const k=this._callbacks.get(t);if(!k)return this;let n;this._callbackActive.has(t)?this._callbackActive.get(t)!==k&&(n=k.slice()):this._callbackActive.set(t,k);for(let k=0;(n||this._callbackActive.get(t))&&k<(n||this._callbackActive.get(t)).length;k++){const _=(n||this._callbackActive.get(t))[k];if(_.callback&&(_.callback.call(_.scope,c,l,e,a,s,i,h,b),_._once)){const c=this._callbacks.get(t),l=c?c.indexOf(_):-1;if(-1!==l){this._callbackActive.get(t)===c&&this._callbackActive.set(t,this._callbackActive.get(t).slice());const e=this._callbacks.get(t);if(!e)continue;e[l].removed=!0,e.splice(l,1),0===e.length&&this._callbacks.delete(t);}}}return n||this._callbackActive.delete(t),this}hasEvent(t){var c;return !(null==(c=this._callbacks.get(t))||!c.length)}};
const t$25={attach(e){const a=t$25;return e._addCallback=a._addCallback,e.on=a.on,e.off=a.off,e.fire=a.fire,e.once=a.once,e.hasEvent=a.hasEvent,c$17.prototype.initEventHandler.call(e),e},_addCallback:c$17.prototype._addCallback,on:c$17.prototype.on,off:c$17.prototype.off,fire:c$17.prototype.fire,once:c$17.prototype.once,hasEvent:c$17.prototype.hasEvent};
const x$r={create:()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(x=>{const t=16*Math.random()|0;return ("x"===x?t:3&t|8).toString(16)}))};
const e$2y={delimiter:"/",join(...t){let i=t[0];for(let l=0;l<t.length-1;l++){const r=t[l],n=t[l+1];n[0]!==e$2y.delimiter?r&&n&&r[r.length-1]!==e$2y.delimiter&&n[0]!==e$2y.delimiter?i+=e$2y.delimiter+n:i+=n:i=n;}return i},normalize(t){const i=t.startsWith(e$2y.delimiter),l=t.endsWith(e$2y.delimiter),r=t.split("/");let n="",s=[];for(let t=0;t<r.length;t++)""!==r[t]&&"."!==r[t]&&(".."===r[t]&&s.length>0?s=s.slice(0,s.length-2):(t>0&&s.push(e$2y.delimiter),s.push(r[t])));return n=s.join(""),i||n[0]!==e$2y.delimiter||(n=n.slice(1)),l&&n[n.length-1]!==e$2y.delimiter&&(n+=e$2y.delimiter),n},split(t){const i=t.lastIndexOf(e$2y.delimiter);return -1!==i?[t.substring(0,i),t.substring(i+1)]:["",t]},getBasename:t=>e$2y.split(t)[1],getDirectory:t=>e$2y.split(t)[0],getExtension(e){const t=e.split("?")[0].split(".").pop();return t!==e?`.${t}`:""},isRelativePath:e=>"/"!==e.charAt(0)&&null===e.match(/:\/\//),extractPath(t){let i="";const l=t.split("/");let r=0;if(l.length>1)if(e$2y.isRelativePath(t))if("."===l[0])for(r=0;r<l.length-1;++r)i+=0===r?l[r]:`/${l[r]}`;else if(".."===l[0])for(r=0;r<l.length-1;++r)i+=0===r?l[r]:`/${l[r]}`;else for(i=".",r=0;r<l.length-1;++r)i+=`/${l[r]}`;else for(r=0;r<l.length-1;++r)i+=0===r?l[r]:`/${l[r]}`;return i}};
var e$2x,o$1c,n$1M;const r$1j="undefined"!=typeof navigator?navigator.userAgent:"",t$24="undefined"!=typeof window?"browser":"undefined"!=typeof global?"node":"worker",i$1v=/android/i.test(r$1j)?"android":/ip(?:[ao]d|hone)/i.test(r$1j)?"ios":/windows/i.test(r$1j)?"windows":/mac os/i.test(r$1j)?"osx":/linux/i.test(r$1j)?"linux":/cros/i.test(r$1j)?"cros":null,s$1Q="browser"!==t$24?null:/Chrome\/|Chromium\/|Edg.*\//.test(r$1j)?"chrome":/Safari\//.test(r$1j)?"safari":/Firefox\//.test(r$1j)?"firefox":"other",a$1p=/xbox/i.test(r$1j),d$O="browser"===t$24&&("ontouchstart"in window||"maxTouchPoints"in navigator&&navigator.maxTouchPoints>0),l$Q=!("browser"!==t$24||!navigator.getGamepads&&!navigator.webkitGetGamepads),w$l="undefined"!=typeof Worker,u$K=(()=>{let e=!1;try{const o=Object.defineProperty({},"passive",{get:function(){return e=!0,!1}});window.addEventListener("testpassive",null,o),window.removeEventListener("testpassive",null,o);}catch(e){}return e})(),b$k={name:i$1v,environment:t$24,global:null!=(e$2x=null!=(o$1c=null!=(n$1M="undefined"!=typeof globalThis&&globalThis)?n$1M:"browser"===t$24&&window)?o$1c:"node"===t$24&&global)?e$2x:"worker"===t$24&&self,browser:"browser"===t$24,worker:"worker"===t$24,desktop:["windows","osx","linux","cros"].includes(i$1v),mobile:["android","ios"].includes(i$1v),ios:"ios"===i$1v,android:"android"===i$1v,xbox:a$1p,gamepads:l$Q,touch:d$O,workers:w$l,passiveEvents:u$K,browserName:s$1Q};
const t$23="abcdefghijklmnopqrstuvwxyz",n$1L="ABCDEFGHIJKLMNOPQRSTUVWXYZ",r$1i=55296,o$1b=127462,e$2w=127487,s$1P=65024,u$J=65039;function c$16(t,n=0){const o=t.length;if(n<0||n>=o)return null;const e=t.charCodeAt(n);if(o>1&&e>=r$1i&&e<=56319){const o=t.charCodeAt(n+1);if(o>=56320&&o<=57343)return {code:1024*(e-r$1i)+o-56320+65536,long:!0}}return {code:e,long:!1}}function i$1u(t,n,r){if(!t)return !1;const o=c$16(t);if(o){const t=o.code;return t>=n&&t<=r}return !1}function f$C(t,n){if(n===t.length-1)return 1;if(i$1u(t[n],r$1i,56319)){const r=t.substring(n,n+2),c=t.substring(n+2,n+4);return i$1u(c,127995,127999)||i$1u(r,o$1b,e$2w)&&i$1u(c,o$1b,e$2w)?4:i$1u(c,s$1P,u$J)?3:2}return i$1u(t[n+1],s$1P,u$J)?2:1}const l$P={ASCII_LOWERCASE:t$23,ASCII_UPPERCASE:n$1L,ASCII_LETTERS:t$23+n$1L,format(t,...n){for(let r=0;r<n.length;r++)t=t.replace(`{${r}}`,n[r]);return t},getCodePoint(t,n){const r=c$16(t,n);return r&&r.code},getCodePoints(t){if("string"!=typeof t)throw new TypeError("Not a string");let n=0;const r=[];let o;for(;o=c$16(t,n);)r.push(o.code),n+=o.long?2:1;return r},getSymbols(t){if("string"!=typeof t)throw new TypeError("Not a string");let n=0;const r=t.length,o=[];let e,c=0;for(;n<r;){if(c+=f$C(t,n+c),e=t[n+c],i$1u(e,8400,8447)&&(e=t[n+c++]),i$1u(e,s$1P,u$J)&&(e=t[n+c++]),e&&8205===e.charCodeAt(0)){e=t[n+c++];continue}const r=t.substring(n,n+c);o.push(r),n+=c,c=0;}return o},fromCodePoint(){const t=[];let n,r,o;for(let e=0;e<arguments.length;++e)n=Number(arguments[e]),r=n-65536,o=n>65535?[55296+(r>>10),r%1024+56320]:[n],t.push(String.fromCharCode.apply(null,o));return t.join("")}};
let i$1t = class i{constructor(){this._list=[],this._index={};}push(i,t){if(this._index[i])throw Error(`Key already in index ${i}`);const s=this._list.push(t)-1;this._index[i]=s;}has(i){return void 0!==this._index[i]}get(i){const t=this._index[i];return void 0!==t?this._list[t]:null}remove(i){const t=this._index[i];if(void 0!==t){for(i in this._list.splice(t,1),delete this._index[i],this._index){const s=this._index[i];s>t&&(this._index[i]=s-1);}return !0}return !1}list(){return this._list}clear(){this._list.length=0;for(const i in this._index)delete this._index[i];}};
let e$2v = class e{static loadScript(e,l){const t=document.createElement("script");t.setAttribute("src",e),t.onload=()=>{l(null);},t.onerror=()=>{l(`Failed to load script='${e}'`);},document.body.appendChild(t);}static loadWasm(l,t,n){const i=e.wasmSupported()&&t.glueUrl&&t.wasmUrl?t.glueUrl:t.fallbackUrl;i?e.loadScript(i,(e=>{if(e)n(e,null);else {const e=window[l];window[l]=void 0,e({locateFile:()=>t.wasmUrl,onAbort:()=>{n("wasm module aborted.");}}).then((e=>{n(null,e);}));}})):n("No supported wasm modules found.",null);}static getModule(l){return e.modules.hasOwnProperty(l)||(e.modules[l]={config:null,initializing:!1,instance:null,callbacks:[]}),e.modules[l]}static initialize(l,t){if(t.initializing)return;const n=t.config;(n.glueUrl||n.wasmUrl||n.fallbackUrl)&&(t.initializing=!0,e.loadWasm(l,n,((e,i)=>{e?n.errorHandler?n.errorHandler(e):console.error(`failed to initialize module=${l} error=${e}`):(t.instance=i,t.callbacks.forEach((e=>{e(i);})));})));}};e$2v.modules={},e$2v.wasmSupported=(e=>{const l={};let t=l;return ()=>(t===l&&(t=e()),t)})((()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}return !1}));let l$O = class l{static setConfig(l,t){const n=e$2v.getModule(l);n.config=t,n.callbacks.length>0&&e$2v.initialize(l,n);}static getConfig(l){var t;return null==(t=e$2v.modules)||null==(t=t[l])?void 0:t.config}static getInstance(l,t){const n=e$2v.getModule(l);n.instance?t(n.instance):(n.callbacks.push(t),n.config&&e$2v.initialize(l,n));}};
let t$22 = class t{constructor(t){this.arraybuffer=void 0,this.dataView=void 0,this.offset=0,this.arraybuffer=t,this.dataView=new DataView(t);}get remainingBytes(){return this.dataView.byteLength-this.offset}reset(t=0){this.offset=t;}skip(t){this.offset+=t;}align(t){this.offset=this.offset+t-1&~(t-1);}_inc(t){return this.offset+=t,this.offset-t}readChar(){return String.fromCharCode(this.dataView.getUint8(this.offset++))}readChars(t){let e="";for(let r=0;r<t;++r)e+=this.readChar();return e}readU8(){return this.dataView.getUint8(this.offset++)}readU16(){return this.dataView.getUint16(this._inc(2),!0)}readU32(){return this.dataView.getUint32(this._inc(4),!0)}readU64(){return this.readU32()+2**32*this.readU32()}readU32be(){return this.dataView.getUint32(this._inc(4),!1)}readArray(t){for(let e=0;e<t.length;++e)t[e]=this.readU8();}readLine(){const t=this.dataView;let e="";for(;!(this.offset>=t.byteLength);){const t=String.fromCharCode(this.readU8());if("\n"===t)break;e+=t;}return e}};
let t$21 = class t{constructor(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);}_binarySearch(t){let s=0,i=this.items.length-1;const o=t[this._sortBy];let h,e;for(;s<=i;)h=Math.floor((s+i)/2),e=this.items[h][this._sortBy],e<=o?s=h+1:e>o&&(i=h-1);return s}_doSort(t,s){const i=this._sortBy;return t[i]-s[i]}insert(t){const s=this._binarySearch(t);this.items.splice(s,0,t),this.length++,this.loopIndex>=s&&this.loopIndex++;}append(t){this.items.push(t),this.length++;}remove(t){const s=this.items.indexOf(t);s<0||(this.items.splice(s,1),this.length--,this.loopIndex>=s&&this.loopIndex--);}sort(){const t=this.loopIndex>=0?this.items[this.loopIndex]:null;this.items.sort(this._sortHandler),null!==t&&(this.loopIndex=this.items.indexOf(t));}};
let e$2u = class e extends c$17{constructor(t){super(),this._index={},this._list=[],this._parent=t;}add(...t){let e=!1;const s=this._processArguments(t,!0);if(!s.length)return e;for(let t=0;t<s.length;t++)this._index[s[t]]||(e=!0,this._index[s[t]]=!0,this._list.push(s[t]),this.fire("add",s[t],this._parent));return e&&this.fire("change",this._parent),e}remove(...t){let e=!1;if(!this._list.length)return e;const s=this._processArguments(t,!0);if(!s.length)return e;for(let t=0;t<s.length;t++)this._index[s[t]]&&(e=!0,delete this._index[s[t]],this._list.splice(this._list.indexOf(s[t]),1),this.fire("remove",s[t],this._parent));return e&&this.fire("change",this._parent),e}clear(){if(!this._list.length)return;const t=this._list.slice(0);this._list=[],this._index={};for(let e=0;e<t.length;e++)this.fire("remove",t[e],this._parent);this.fire("change",this._parent);}has(...t){return !!this._list.length&&this._has(this._processArguments(t))}_has(t){if(!this._list.length||!t.length)return !1;for(let e=0;e<t.length;e++)if(1===t[e].length){if(this._index[t[e][0]])return !0}else {let s=!0;for(let i=0;i<t[e].length;i++)if(!this._index[t[e][i]]){s=!1;break}if(s)return !0}return !1}list(){return this._list.slice(0)}_processArguments(t,e){const s=[];let i=[];if(!t||!t.length)return s;for(let r=0;r<t.length;r++)if(t[r]instanceof Array){e||(i=[]);for(let h=0;h<t[r].length;h++)"string"==typeof t[r][h]&&(e?s.push(t[r][h]):i.push(t[r][h]));!e&&i.length&&s.push(i);}else "string"==typeof t[r]&&(e?s.push(t[r]):s.push([t[r]]));return s}get size(){return this._list.length}};e$2u.EVENT_ADD="add",e$2u.EVENT_REMOVE="remove",e$2u.EVENT_CHANGE="change";
const n$1K="undefined"!=typeof window&&window.performance&&window.performance.now?performance.now.bind(performance):Date.now;
function t$20(t){let h="";if((t.authority||t.scheme)&&(t.host||t.hostpath))throw new Error("Can't have 'scheme' or 'authority' and 'host' or 'hostpath' option");if(t.host&&t.hostpath)throw new Error("Can't have 'host' and 'hostpath' option");if(t.path&&t.hostpath)throw new Error("Can't have 'path' and 'hostpath' option");return t.scheme&&(h+=`${t.scheme}:`),t.authority&&(h+=`//${t.authority}`),t.host&&(h+=t.host),t.path&&(h+=t.path),t.hostpath&&(h+=t.hostpath),t.query&&(h+=`?${t.query}`),t.fragment&&(h+=`#${t.fragment}`),h}const h$N=/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;let o$1a = class o{constructor(t){this.scheme=void 0,this.authority=void 0,this.path=void 0,this.query=void 0,this.fragment=void 0;const o=t.match(h$N);this.scheme=o[2],this.authority=o[4],this.path=o[5],this.query=o[7],this.fragment=o[9];}toString(){let 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}getQuery(){const t={};if(this.query){const h=decodeURIComponent(this.query).split("&");for(const o of h){const h=o.split("=");t[h[0]]=h[1];}}return t}setQuery(t){let h="";for(const o in t)t.hasOwnProperty(o)&&(""!==h&&(h+="&"),h+=`${encodeURIComponent(o)}=${encodeURIComponent(t[o])}`);this.query=h;}};
let t$1$ = class t{static set(t,e=!0){}static get(e){return t._traceChannels.has(e)}};t$1$._traceChannels=new Set,t$1$.stack=!1;
const o$19=0,t$1_=1,c$15=2,e$2t=3,n$1J=4,p$H=5;
const t$1Z={DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI,clamp:(t,e,o)=>t>=o?o:t<=e?e:t,intToBytes24:t=>[t>>16&255,t>>8&255,255&t],intToBytes32:t=>[t>>24&255,t>>16&255,t>>8&255,255&t],bytesToInt24:(t,e,o)=>(t.length&&(o=t[2],e=t[1],t=t[0]),t<<16|e<<8|o),bytesToInt32:(t,e,o,n)=>(t.length&&(n=t[3],o=t[2],e=t[1],t=t[0]),(t<<24|e<<16|o<<8|n)>>>0),lerp:(e,o,n)=>e+(o-e)*t$1Z.clamp(n,0,1),lerpAngle:(e,o,n)=>(o-e>180&&(o-=360),o-e<-180&&(o+=360),t$1Z.lerp(e,o,t$1Z.clamp(n,0,1))),powerOfTwo:t=>0!==t&&!(t&t-1),nextPowerOfTwo:t=>(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t),nearestPowerOfTwo:t=>Math.pow(2,Math.round(Math.log(t)/Math.log(2))),random(t,e){const o=e-t;return Math.random()*o+t},smoothstep:(t,e,o)=>o<=t?0:o>=e?1:(o=(o-t)/(e-t))*o*(3-2*o),smootherstep:(t,e,o)=>o<=t?0:o>=e?1:(o=(o-t)/(e-t))*o*o*(o*(6*o-15)+10),roundUp:(t,e)=>0===e?t:Math.ceil(t/e)*e,between(t,e,o,n){const a=Math.min(e,o),r=Math.max(e,o);return n?t>=a&&t<=r:t>a&&t<r}};
var e$2s;let s$1O = class s{constructor(t=0,e=0,s=0,i=1){this.r=void 0,this.g=void 0,this.b=void 0,this.a=void 0;const r=t.length;3===r||4===r?(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=s,this.a=i);}clone(){return new(this.constructor)(this.r,this.g,this.b,this.a)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this}equals(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a}set(t,e,s,i=1){return this.r=t,this.g=e,this.b=s,this.a=i,this}lerp(t,e,s){return this.r=t.r+s*(e.r-t.r),this.g=t.g+s*(e.g-t.g),this.b=t.b+s*(e.b-t.b),this.a=t.a+s*(e.a-t.a),this}fromString(e){const s=parseInt(e.replace("#","0x"),16);let i;return e.length>7?i=t$1Z.intToBytes32(s):(i=t$1Z.intToBytes24(s),i[3]=255),this.set(i[0]/255,i[1]/255,i[2]/255,i[3]/255),this}fromArray(t,e=0){var s,i,r,h;return this.r=null!=(s=t[e])?s:this.r,this.g=null!=(i=t[e+1])?i:this.g,this.b=null!=(r=t[e+2])?r:this.b,this.a=null!=(h=t[e+3])?h:this.a,this}toString(t){let 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){const t=Math.round(255*this.a).toString(16);this.a<16/255?e+=`0${t}`:e+=t;}return e}toArray(t=[],e=0,s=!0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,s&&(t[e+3]=this.a),t}};e$2s=s$1O,s$1O.BLACK=Object.freeze(new e$2s(0,0,0,1)),s$1O.BLUE=Object.freeze(new e$2s(0,0,1,1)),s$1O.CYAN=Object.freeze(new e$2s(0,1,1,1)),s$1O.GRAY=Object.freeze(new e$2s(.5,.5,.5,1)),s$1O.GREEN=Object.freeze(new e$2s(0,1,0,1)),s$1O.MAGENTA=Object.freeze(new e$2s(1,0,1,1)),s$1O.RED=Object.freeze(new e$2s(1,0,0,1)),s$1O.WHITE=Object.freeze(new e$2s(1,1,1,1)),s$1O.YELLOW=Object.freeze(new e$2s(1,1,0,1));
let c$14 = class c{constructor(t,i=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(i);}evaluate(e,h=!1){let _;(h||e<this._left||e>=this._right)&&this._reset(e);const c=this._curve.type;if(c===p$H)_=this._p0;else {const t=0===this._recip?0:(e-this._left)*this._recip;_=c===o$19?t$1Z.lerp(this._p0,this._p1,t):c===t$1_?t$1Z.lerp(this._p0,this._p1,t*t*(3-2*t)):this._evaluateHermite(this._p0,this._p1,this._m0,this._m1,t);}return _}_reset(t){const i=this._curve.keys,s=i.length;if(s)if(t<i[0][0])this._left=-1/0,this._right=i[0][0],this._recip=0,this._p0=this._p1=i[0][1],this._m0=this._m1=0;else if(t>=i[s-1][0])this._left=i[s-1][0],this._right=1/0,this._recip=0,this._p0=this._p1=i[s-1][1],this._m0=this._m1=0;else {let s=0;for(;t>=i[s+1][0];)s++;this._left=i[s][0],this._right=i[s+1][0];const e=1/(this._right-this._left);this._recip=isFinite(e)?e:0,this._p0=i[s][1],this._p1=i[s+1][1],this._isHermite()&&this._calcTangents(i,s);}else this._left=-1/0,this._right=1/0,this._recip=0,this._p0=this._p1=this._m0=this._m1=0;}_isHermite(){return this._curve.type===c$15||this._curve.type===e$2t||this._curve.type===n$1J}_calcTangents(t,i){let s;const h=t[i],r=t[i+1];let c;if(s=0===i?[t[0][0]+(t[0][0]-t[1][0]),t[0][1]+(t[0][1]-t[1][1])]:t[i-1],c=i===t.length-2?[t[i+1][0]+(t[i+1][0]-t[i][0]),t[i+1][1]+(t[i+1][1]-t[i][1])]:t[i+2],this._curve.type===n$1J){const t=2*(r[0]-h[0])/(r[0]-s[0]),i=2*(r[0]-h[0])/(c[0]-h[0]);this._m0=this._curve.tension*(isFinite(t)?t:0)*(r[1]-s[1]),this._m1=this._curve.tension*(isFinite(i)?i:0)*(c[1]-h[1]);}else {const t=(r[0]-h[0])/(h[0]-s[0]),i=(r[0]-h[0])/(c[0]-r[0]),_=h[1]+(s[1]-h[1])*(isFinite(t)?t:0),p=r[1]+(c[1]-r[1])*(isFinite(i)?i:0),n=this._curve.type===c$15?.5:this._curve.tension;this._m0=n*(r[1]-_),this._m1=n*(p-h[1]);}}_evaluateHermite(t,i,s,e,h){const _=h*h,r=h+h,c=1-h,p=c*c;return t*((1+r)*p)+s*(h*p)+i*(_*(3-r))+e*(_*(h-1))}};
let s$1N = class s{constructor(s){if(this.keys=[],this.type=t$1_,this.tension=.5,this._eval=new c$14(this),s)for(let t=0;t<s.length-1;t+=2)this.keys.push([s[t],s[t+1]]);this.sort();}get length(){return this.keys.length}add(t,e){const s=this.keys,n=s.length;let r=0;for(;r<n&&!(s[r][0]>t);r++);const i=[t,e];return this.keys.splice(r,0,i),i}get(t){return this.keys[t]}sort(){this.keys.sort(((t,e)=>t[0]-e[0]));}value(t){return this._eval.evaluate(t,!0)}closest(t){const e=this.keys,s=e.length;let n=2,r=null;for(let i=0;i<s;i++){const s=Math.abs(t-e[i][0]);if(!(n>=s))break;n=s,r=e[i];}return r}clone(){const t=new this.constructor;return t.keys=this.keys.map((t=>[...t])),t.type=this.type,t.tension=this.tension,t}quantize(t){t=Math.max(t,2);const e=new Float32Array(t),s=1/(t-1);e[0]=this._eval.evaluate(0,!0);for(let n=1;n<t;n++)e[n]=this._eval.evaluate(s*n);return e}quantizeClamped(t,e,s){const n=this.quantize(t);for(let t=0;t<n.length;++t)n[t]=Math.min(s,Math.max(e,n[t]));return n}};
let r$1h = class r{constructor(){if(this.curves=[],this._type=t$1_,arguments.length>1)for(let t=0;t<arguments.length;t++)this.curves.push(new s$1N(arguments[t]));else if(0===arguments.length)this.curves.push(new s$1N);else {const t=arguments[0];if("number"==typeof t)for(let s=0;s<t;s++)this.curves.push(new s$1N);else for(let s=0;s<t.length;s++)this.curves.push(new s$1N(t[s]));}}get length(){return this.curves.length}set type(t){this._type=t;for(let e=0;e<this.curves.length;e++)this.curves[e].type=t;}get type(){return this._type}get(t){return this.curves[t]}value(t,e=[]){const s=this.curves.length;e.length=s;for(let r=0;r<s;r++)e[r]=this.curves[r].value(t);return e}clone(){const t=new this.constructor;t.curves=[];for(let e=0;e<this.curves.length;e++)t.curves.push(this.curves[e].clone());return t._type=this._type,t}quantize(t){t=Math.max(t,2);const e=this.curves.length,r=new Float32Array(t*e),n=1/(t-1);for(let h=0;h<e;h++){const u=new c$14(this.curves[h]);for(let s=0;s<t;s++)r[s*e+h]=u.evaluate(n*s);}return r}quantizeClamped(t,e,s){const r=this.quantize(t);for(let t=0;t<r.length;++t)r[t]=Math.min(s,Math.max(e,r[t]));return r}};
const a$1o=1/255,o$18=new Float32Array(1),n$1I=new Int32Array(o$18.buffer);let s$1M = class s{static float2Half(t){o$18[0]=t;const a=n$1I[0];let s=a>>16&32768,r=a>>12&2047;const c=a>>23&255;return c<103?s:c>142?(s|=31744,s|=(255===c?0:1)&&8388607&a,s):c<113?(r|=2048,s|=(r>>114-c)+(r>>113-c&1),s):(s|=c-112<<10|r>>1,s+=1&r,s)}static float2Bytes(t,o,n,s){const r=255*t%1;if(o[n+0]=Math.round(255*(t%1-a$1o*r)),s>1){const c=65025*t%1;if(o[n+1]=Math.round(255*(r-a$1o*c)),s>2){const r=16581375*t%1;o[n+2]=Math.round(255*(c-a$1o*r)),s>3&&(o[n+3]=Math.round(255*r));}}}static float2BytesRange(a,o,n,r,c,e){a=t$1Z.clamp((a-r)/(c-r),0,1),s.float2Bytes(a,o,n,e);}static float2MantissaExponent(t,a,o,n){const r=Math.floor(Math.log2(Math.abs(t)))+1;t/=Math.pow(2,r),s.float2BytesRange(t,a,o,-1,1,n-1),a[o+n-1]=Math.round(r+127);}};
var t$1Y;let s$1L = class s{constructor(t=0,s=0,h=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=s,this.z=h);}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}add2(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this.z=t.z+s.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addScaled(t,s){return this.x+=t.x*s,this.y+=t.y*s,this.z+=t.z*s,this}clone(){return new(this.constructor)(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}cross(t,s){const h=t.x,i=t.y,r=t.z,e=s.x,z=s.y,x=s.z;return this.x=i*x-z*r,this.y=r*e-x*h,this.z=h*z-e*i,this}distance(t){const s=this.x-t.x,h=this.y-t.y,i=this.z-t.z;return Math.sqrt(s*s+h*h+i*i)}div(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}div2(t,s){return this.x=t.x/s.x,this.y=t.y/s.y,this.z=t.z/s.z,this}divScalar(t){return this.x/=t,this.y/=t,this.z/=t,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}equals(t){return this.x===t.x&&this.y===t.y&&this.z===t.z}equalsApprox(t,s=1e-6){return Math.abs(this.x-t.x)<s&&Math.abs(this.y-t.y)<s&&Math.abs(this.z-t.z)<s}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}lerp(t,s,h){return this.x=t.x+h*(s.x-t.x),this.y=t.y+h*(s.y-t.y),this.z=t.z+h*(s.z-t.z),this}mul(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}mul2(t,s){return this.x=t.x*s.x,this.y=t.y*s.y,this.z=t.z*s.z,this}mulScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}normalize(t=this){const s=t.x*t.x+t.y*t.y+t.z*t.z;if(s>0){const h=1/Math.sqrt(s);this.x=t.x*h,this.y=t.y*h,this.z=t.z*h;}return this}floor(t=this){return this.x=Math.floor(t.x),this.y=Math.floor(t.y),this.z=Math.floor(t.z),this}ceil(t=this){return this.x=Math.ceil(t.x),this.y=Math.ceil(t.y),this.z=Math.ceil(t.z),this}round(t=this){return this.x=Math.round(t.x),this.y=Math.round(t.y),this.z=Math.round(t.z),this}min(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}max(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}project(t){const s=(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*s,this.y=t.y*s,this.z=t.z*s,this}set(t,s,h){return this.x=t,this.y=s,this.z=h,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}sub2(t,s){return this.x=t.x-s.x,this.y=t.y-s.y,this.z=t.z-s.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}fromArray(t,s=0){var h,i,r;return this.x=null!=(h=t[s])?h:this.x,this.y=null!=(i=t[s+1])?i:this.y,this.z=null!=(r=t[s+2])?r:this.z,this}toString(){return `[${this.x}, ${this.y}, ${this.z}]`}toArray(t=[],s=0){return t[s]=this.x,t[s+1]=this.y,t[s+2]=this.z,t}};t$1Y=s$1L,s$1L.ZERO=Object.freeze(new t$1Y(0,0,0)),s$1L.ONE=Object.freeze(new t$1Y(1,1,1)),s$1L.UP=Object.freeze(new t$1Y(0,1,0)),s$1L.DOWN=Object.freeze(new t$1Y(0,-1,0)),s$1L.RIGHT=Object.freeze(new t$1Y(1,0,0)),s$1L.LEFT=Object.freeze(new t$1Y(-1,0,0)),s$1L.FORWARD=Object.freeze(new t$1Y(0,0,-1)),s$1L.BACK=Object.freeze(new t$1Y(0,0,1));
var a$1n;let s$1K = class s{constructor(){this.data=new Float32Array(9),this.data[0]=this.data[4]=this.data[8]=1;}clone(){return (new(this.constructor)).copy(this)}copy(t){const a=t.data,s=this.data;return s[0]=a[0],s[1]=a[1],s[2]=a[2],s[3]=a[3],s[4]=a[4],s[5]=a[5],s[6]=a[6],s[7]=a[7],s[8]=a[8],this}set(t){const a=this.data;return a[0]=t[0],a[1]=t[1],a[2]=t[2],a[3]=t[3],a[4]=t[4],a[5]=t[5],a[6]=t[6],a[7]=t[7],a[8]=t[8],this}getX(a=new s$1L){return a.set(this.data[0],this.data[1],this.data[2])}getY(a=new s$1L){return a.set(this.data[3],this.data[4],this.data[5])}getZ(a=new s$1L){return a.set(this.data[6],this.data[7],this.data[8])}equals(t){const a=this.data,s=t.data;return a[0]===s[0]&&a[1]===s[1]&&a[2]===s[2]&&a[3]===s[3]&&a[4]===s[4]&&a[5]===s[5]&&a[6]===s[6]&&a[7]===s[7]&&a[8]===s[8]}isIdentity(){const 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]}setIdentity(){const 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}toString(){return `[${this.data.join(", ")}]`}transpose(t=this){const a=t.data,s=this.data;if(a===s){let t;t=a[1],s[1]=a[3],s[3]=t,t=a[2],s[2]=a[6],s[6]=t,t=a[5],s[5]=a[7],s[7]=t;}else s[0]=a[0],s[1]=a[3],s[2]=a[6],s[3]=a[1],s[4]=a[4],s[5]=a[7],s[6]=a[2],s[7]=a[5],s[8]=a[8];return this}setFromMat4(t){const a=t.data,s=this.data;return s[0]=a[0],s[1]=a[1],s[2]=a[2],s[3]=a[4],s[4]=a[5],s[5]=a[6],s[6]=a[8],s[7]=a[9],s[8]=a[10],this}setFromQuat(t){const a=t.x,s=t.y,e=t.z,r=t.w,i=a+a,n=s+s,h=e+e,d=a*i,o=a*n,c=a*h,u=s*n,w=s*h,y=e*h,l=r*i,f=r*n,m=r*h,p=this.data;return p[0]=1-(u+y),p[1]=o+m,p[2]=c-f,p[3]=o-m,p[4]=1-(d+y),p[5]=w+l,p[6]=c+f,p[7]=w-l,p[8]=1-(d+u),this}invertMat4(t){const a=t.data,s=a[0],e=a[1],r=a[2],i=a[4],n=a[5],h=a[6],d=a[8],o=a[9],c=a[10],u=c*n-h*o,w=-c*e+r*o,y=h*e-r*n,l=-c*i+h*d,f=c*s-r*d,m=-h*s+r*i,p=o*i-n*d,z=-o*s+e*d,I=n*s-e*i,g=s*u+e*l+r*p;if(0===g)this.setIdentity();else {const t=1/g,a=this.data;a[0]=u*t,a[1]=w*t,a[2]=y*t,a[3]=l*t,a[4]=f*t,a[5]=m*t,a[6]=p*t,a[7]=z*t,a[8]=I*t;}return this}transformVector(a,s=new s$1L){const e=this.data,{x:r,y:i,z:n}=a;return s.x=r*e[0]+i*e[3]+n*e[6],s.y=r*e[1]+i*e[4]+n*e[7],s.z=r*e[2]+i*e[5]+n*e[8],s}};a$1n=s$1K,s$1K.IDENTITY=Object.freeze(new a$1n),s$1K.ZERO=Object.freeze((new a$1n).set([0,0,0,0,0,0,0,0,0]));
var s$1J;let h$M = class h{constructor(t=0,s=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=s);}add(t){return this.x+=t.x,this.y+=t.y,this}add2(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addScaled(t,s){return this.x+=t.x*s,this.y+=t.y*s,this}clone(){return new(this.constructor)(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}cross(t){return this.x*t.y-this.y*t.x}distance(t){const s=this.x-t.x,h=this.y-t.y;return Math.sqrt(s*s+h*h)}div(t){return this.x/=t.x,this.y/=t.y,this}div2(t,s){return this.x=t.x/s.x,this.y=t.y/s.y,this}divScalar(t){return this.x/=t,this.y/=t,this}dot(t){return this.x*t.x+this.y*t.y}equals(t){return this.x===t.x&&this.y===t.y}equalsApprox(t,s=1e-6){return Math.abs(this.x-t.x)<s&&Math.abs(this.y-t.y)<s}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSq(){return this.x*this.x+this.y*this.y}lerp(t,s,h){return this.x=t.x+h*(s.x-t.x),this.y=t.y+h*(s.y-t.y),this}mul(t){return this.x*=t.x,this.y*=t.y,this}mul2(t,s){return this.x=t.x*s.x,this.y=t.y*s.y,this}mulScalar(t){return this.x*=t,this.y*=t,this}normalize(t=this){const s=t.x*t.x+t.y*t.y;if(s>0){const h=1/Math.sqrt(s);this.x=t.x*h,this.y=t.y*h;}return this}rotate(s){const h=Math.atan2(this.x,this.y)+s*t$1Z.DEG_TO_RAD,i=Math.sqrt(this.x*this.x+this.y*this.y);return this.x=Math.sin(h)*i,this.y=Math.cos(h)*i,this}angle(){return Math.atan2(this.x,this.y)*t$1Z.RAD_TO_DEG}angleTo(s){return Math.atan2(this.x*s.y+this.y*s.x,this.x*s.x+this.y*s.y)*t$1Z.RAD_TO_DEG}floor(t=this){return this.x=Math.floor(t.x),this.y=Math.floor(t.y),this}ceil(t=this){return this.x=Math.ceil(t.x),this.y=Math.ceil(t.y),this}round(t=this){return this.x=Math.round(t.x),this.y=Math.round(t.y),this}min(t){return t.x<this.x&&(this.x=t.x),t.y<this.y&&(this.y=t.y),this}max(t){return t.x>this.x&&(this.x=t.x),t.y>this.y&&(this.y=t.y),this}set(t,s){return this.x=t,this.y=s,this}sub(t){return this.x-=t.x,this.y-=t.y,this}sub2(t,s){return this.x=t.x-s.x,this.y=t.y-s.y,this}subScalar(t){return this.x-=t,this.y-=t,this}fromArray(t,s=0){var h,i;return this.x=null!=(h=t[s])?h:this.x,this.y=null!=(i=t[s+1])?i:this.y,this}toString(){return `[${this.x}, ${this.y}]`}toArray(t=[],s=0){return t[s]=this.x,t[s+1]=this.y,t}static angleRad(t,s){return Math.atan2(t.x*s.y-t.y*s.x,t.x*s.x+t.y*s.y)}};s$1J=h$M,h$M.ZERO=Object.freeze(new s$1J(0,0)),h$M.ONE=Object.freeze(new s$1J(1,1)),h$M.UP=Object.freeze(new s$1J(0,1)),h$M.DOWN=Object.freeze(new s$1J(0,-1)),h$M.RIGHT=Object.freeze(new s$1J(1,0)),h$M.LEFT=Object.freeze(new s$1J(-1,0));
var t$1X;let h$L = class h{constructor(t=0,h=0,s=0,i=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=h,this.z=s,this.w=i);}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}add2(t,h){return this.x=t.x+h.x,this.y=t.y+h.y,this.z=t.z+h.z,this.w=t.w+h.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addScaled(t,h){return this.x+=t.x*h,this.y+=t.y*h,this.z+=t.z*h,this.w+=t.w*h,this}clone(){return new(this.constructor)(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this}div(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}div2(t,h){return this.x=t.x/h.x,this.y=t.y/h.y,this.z=t.z/h.z,this.w=t.w/h.w,this}divScalar(t){return this.x/=t,this.y/=t,this.z/=t,this.w/=t,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}equals(t){return this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w}equalsApprox(t,h=1e-6){return Math.abs(this.x-t.x)<h&&Math.abs(this.y-t.y)<h&&Math.abs(this.z-t.z)<h&&Math.abs(this.w-t.w)<h}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}lerp(t,h,s){return this.x=t.x+s*(h.x-t.x),this.y=t.y+s*(h.y-t.y),this.z=t.z+s*(h.z-t.z),this.w=t.w+s*(h.w-t.w),this}mul(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}mul2(t,h){return this.x=t.x*h.x,this.y=t.y*h.y,this.z=t.z*h.z,this.w=t.w*h.w,this}mulScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}normalize(t=this){const h=t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w;if(h>0){const s=1/Math.sqrt(h);this.x=t.x*s,this.y=t.y*s,this.z=t.z*s,this.w=t.w*s;}return this}floor(t=this){return 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}ceil(t=this){return 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}round(t=this){return 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}min(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}max(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}set(t,h,s,i){return this.x=t,this.y=h,this.z=s,this.w=i,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}sub2(t,h){return this.x=t.x-h.x,this.y=t.y-h.y,this.z=t.z-h.z,this.w=t.w-h.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}fromArray(t,h=0){var s,i,r,w;return this.x=null!=(s=t[h])?s:this.x,this.y=null!=(i=t[h+1])?i:this.y,this.z=null!=(r=t[h+2])?r:this.z,this.w=null!=(w=t[h+3])?w:this.w,this}toString(){return `[${this.x}, ${this.y}, ${this.z}, ${this.w}]`}toArray(t=[],h=0){return t[h]=this.x,t[h+1]=this.y,t[h+2]=this.z,t[h+3]=this.w,t}};t$1X=h$L,h$L.ZERO=Object.freeze(new t$1X(0,0,0,0)),h$L.ONE=Object.freeze(new t$1X(1,1,1,1));
var n$1H;const r$1g=new h$M,i$1s=new s$1L,h$K=new s$1L,o$17=new s$1L,d$N=new s$1L;let c$13 = class c{constructor(){this.data=new Float32Array(16),this.data[0]=this.data[5]=this.data[10]=this.data[15]=1;}static _getPerspectiveHalfSize(t,s,a,e,n){n?(t.x=e*Math.tan(s*Math.PI/360),t.y=t.x/a):(t.y=e*Math.tan(s*Math.PI/360),t.x=t.y*a);}add2(t,s){const a=t.data,e=s.data,n=this.data;return n[0]=a[0]+e[0],n[1]=a[1]+e[1],n[2]=a[2]+e[2],n[3]=a[3]+e[3],n[4]=a[4]+e[4],n[5]=a[5]+e[5],n[6]=a[6]+e[6],n[7]=a[7]+e[7],n[8]=a[8]+e[8],n[9]=a[9]+e[9],n[10]=a[10]+e[10],n[11]=a[11]+e[11],n[12]=a[12]+e[12],n[13]=a[13]+e[13],n[14]=a[14]+e[14],n[15]=a[15]+e[15],this}add(t){return this.add2(this,t)}clone(){return (new(this.constructor)).copy(this)}copy(t){const s=t.data,a=this.data;return a[0]=s[0],a[1]=s[1],a[2]=s[2],a[3]=s[3],a[4]=s[4],a[5]=s[5],a[6]=s[6],a[7]=s[7],a[8]=s[8],a[9]=s[9],a[10]=s[10],a[11]=s[11],a[12]=s[12],a[13]=s[13],a[14]=s[14],a[15]=s[15],this}equals(t){const s=this.data,a=t.data;return s[0]===a[0]&&s[1]===a[1]&&s[2]===a[2]&&s[3]===a[3]&&s[4]===a[4]&&s[5]===a[5]&&s[6]===a[6]&&s[7]===a[7]&&s[8]===a[8]&&s[9]===a[9]&&s[10]===a[10]&&s[11]===a[11]&&s[12]===a[12]&&s[13]===a[13]&&s[14]===a[14]&&s[15]===a[15]}isIdentity(){const t=this.data;return 1===t[0]&&0===t[1]&&0===t[2]&&0===t[3]&&0===t[4]&&1===t[5]&&0===t[6]&&0===t[7]&&0===t[8]&&0===t[9]&&1===t[10]&&0===t[11]&&0===t[12]&&0===t[13]&&0===t[14]&&1===t[15]}mul2(t,s){const a=t.data,e=s.data,n=this.data,r=a[0],i=a[1],h=a[2],o=a[3],d=a[4],c=a[5],u=a[6],l=a[7],y=a[8],g=a[9],m=a[10],x=a[11],z=a[12],w=a[13],M=a[14],f=a[15];let p,A,_,D;return p=e[0],A=e[1],_=e[2],D=e[3],n[0]=r*p+d*A+y*_+z*D,n[1]=i*p+c*A+g*_+w*D,n[2]=h*p+u*A+m*_+M*D,n[3]=o*p+l*A+x*_+f*D,p=e[4],A=e[5],_=e[6],D=e[7],n[4]=r*p+d*A+y*_+z*D,n[5]=i*p+c*A+g*_+w*D,n[6]=h*p+u*A+m*_+M*D,n[7]=o*p+l*A+x*_+f*D,p=e[8],A=e[9],_=e[10],D=e[11],n[8]=r*p+d*A+y*_+z*D,n[9]=i*p+c*A+g*_+w*D,n[10]=h*p+u*A+m*_+M*D,n[11]=o*p+l*A+x*_+f*D,p=e[12],A=e[13],_=e[14],D=e[15],n[12]=r*p+d*A+y*_+z*D,n[13]=i*p+c*A+g*_+w*D,n[14]=h*p+u*A+m*_+M*D,n[15]=o*p+l*A+x*_+f*D,this}mulAffine2(t,s){const a=t.data,e=s.data,n=this.data,r=a[0],i=a[1],h=a[2],o=a[4],d=a[5],c=a[6],u=a[8],l=a[9],y=a[10],g=a[12],m=a[13],x=a[14];let z,w,M;return z=e[0],w=e[1],M=e[2],n[0]=r*z+o*w+u*M,n[1]=i*z+d*w+l*M,n[2]=h*z+c*w+y*M,n[3]=0,z=e[4],w=e[5],M=e[6],n[4]=r*z+o*w+u*M,n[5]=i*z+d*w+l*M,n[6]=h*z+c*w+y*M,n[7]=0,z=e[8],w=e[9],M=e[10],n[8]=r*z+o*w+u*M,n[9]=i*z+d*w+l*M,n[10]=h*z+c*w+y*M,n[11]=0,z=e[12],w=e[13],M=e[14],n[12]=r*z+o*w+u*M+g,n[13]=i*z+d*w+l*M+m,n[14]=h*z+c*w+y*M+x,n[15]=1,this}mul(t){return this.mul2(this,t)}transformPoint(t,s=new s$1L){const e=this.data,{x:n,y:r,z:i}=t;return s.x=n*e[0]+r*e[4]+i*e[8]+e[12],s.y=n*e[1]+r*e[5]+i*e[9]+e[13],s.z=n*e[2]+r*e[6]+i*e[10]+e[14],s}transformVector(t,s=new s$1L){const e=this.data,{x:n,y:r,z:i}=t;return s.x=n*e[0]+r*e[4]+i*e[8],s.y=n*e[1]+r*e[5]+i*e[9],s.z=n*e[2]+r*e[6]+i*e[10],s}transformVec4(t,s=new h$L){const a=this.data,{x:n,y:r,z:i,w:h}=t;return s.x=n*a[0]+r*a[4]+i*a[8]+h*a[12],s.y=n*a[1]+r*a[5]+i*a[9]+h*a[13],s.z=n*a[2]+r*a[6]+i*a[10]+h*a[14],s.w=n*a[3]+r*a[7]+i*a[11]+h*a[15],s}setLookAt(t,s,a){o$17.sub2(t,s).normalize(),h$K.copy(a).normalize(),i$1s.cross(h$K,o$17).normalize(),h$K.cross(o$17,i$1s);const e=this.data;return e[0]=i$1s.x,e[1]=i$1s.y,e[2]=i$1s.z,e[3]=0,e[4]=h$K.x,e[5]=h$K.y,e[6]=h$K.z,e[7]=0,e[8]=o$17.x,e[9]=o$17.y,e[10]=o$17.z,e[11]=0,e[12]=t.x,e[13]=t.y,e[14]=t.z,e[15]=1,this}setFrustum(t,s,a,e,n,r){const i=2*n,h=s-t,o=e-a,d=r-n,c=this.data;return c[0]=i/h,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=i/o,c[6]=0,c[7]=0,c[8]=(s+t)/h,c[9]=(e+a)/o,c[10]=(-r-n)/d,c[11]=-1,c[12]=0,c[13]=0,c[14]=-i*r/d,c[15]=0,this}setPerspective(t,s,a,e,n){return c._getPerspectiveHalfSize(r$1g,t,s,a,n),this.setFrustum(-r$1g.x,r$1g.x,-r$1g.y,r$1g.y,a,e)}setOrtho(t,s,a,e,n,r){const i=this.data;return i[0]=2/(s-t),i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=2/(e-a),i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=-2/(r-n),i[11]=0,i[12]=-(s+t)/(s-t),i[13]=-(e+a)/(e-a),i[14]=-(r+n)/(r-n),i[15]=1,this}setFromAxisAngle(s,a){a*=t$1Z.DEG_TO_RAD;const{x:e,y:n,z:r}=s,i=Math.cos(a),h=Math.sin(a),o=1-i,d=o*e,c=o*n,u=this.data;return u[0]=d*e+i,u[1]=d*n+h*r,u[2]=d*r-h*n,u[3]=0,u[4]=d*n-h*r,u[5]=c*n+i,u[6]=c*r+h*e,u[7]=0,u[8]=d*r+h*n,u[9]=c*r-e*h,u[10]=o*r*r+i,u[11]=0,u[12]=0,u[13]=0,u[14]=0,u[15]=1,this}setTranslate(t,s,a){const e=this.data;return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t,e[13]=s,e[14]=a,e[15]=1,this}setScale(t,s,a){const e=this.data;return e[0]=t,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}setViewport(t,s,a,e){const n=this.data;return n[0]=.5*a,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=.5*e,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=.5,n[11]=0,n[12]=t+.5*a,n[13]=s+.5*e,n[14]=.5,n[15]=1,this}setReflection(t,s){const a=t.x,e=t.y,n=t.z,r=this.data;return r[0]=1-2*a*a,r[1]=-2*a*e,r[2]=-2*a*n,r[3]=0,r[4]=-2*a*e,r[5]=1-2*e*e,r[6]=-2*e*n,r[7]=0,r[8]=-2*a*n,r[9]=-2*e*n,r[10]=1-2*n*n,r[11]=0,r[12]=-2*a*s,r[13]=-2*e*s,r[14]=-2*n*s,r[15]=1,this}invert(t=this){const s=t.data,a=s[0],e=s[1],n=s[2],r=s[3],i=s[4],h=s[5],o=s[6],d=s[7],c=s[8],u=s[9],l=s[10],y=s[11],g=s[12],m=s[13],x=s[14],z=s[15],w=a*h-e*i,M=a*o-n*i,f=a*d-r*i,p=e*o-n*h,A=e*d-r*h,_=n*d-r*o,D=c*m-u*g,T=c*x-l*g,E=c*z-y*g,O=u*x-l*m,S=u*z-y*m,v=l*z-y*x,I=w*v-M*S+f*O+p*E-A*T+_*D;if(0===I)this.setIdentity();else {const t=1/I,s=this.data;s[0]=(h*v-o*S+d*O)*t,s[1]=(-e*v+n*S-r*O)*t,s[2]=(m*_-x*A+z*p)*t,s[3]=(-u*_+l*A-y*p)*t,s[4]=(-i*v+o*E-d*T)*t,s[5]=(a*v-n*E+r*T)*t,s[6]=(-g*_+x*f-z*M)*t,s[7]=(c*_-l*f+y*M)*t,s[8]=(i*S-h*E+d*D)*t,s[9]=(-a*S+e*E-r*D)*t,s[10]=(g*A-m*f+z*w)*t,s[11]=(-c*A+u*f-y*w)*t,s[12]=(-i*O+h*T-o*D)*t,s[13]=(a*O-e*T+n*D)*t,s[14]=(-g*p+m*M-x*w)*t,s[15]=(c*p-u*M+l*w)*t;}return this}set(t){const s=this.data;return s[0]=t[0],s[1]=t[1],s[2]=t[2],s[3]=t[3],s[4]=t[4],s[5]=t[5],s[6]=t[6],s[7]=t[7],s[8]=t[8],s[9]=t[9],s[10]=t[10],s[11]=t[11],s[12]=t[12],s[13]=t[13],s[14]=t[14],s[15]=t[15],this}setIdentity(){const t=this.data;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,this}setTRS(t,s,a){const e=s.x,n=s.y,r=s.z,i=s.w,h=a.x,o=a.y,d=a.z,c=e+e,u=n+n,l=r+r,y=e*c,g=e*u,m=e*l,x=n*u,z=n*l,w=r*l,M=i*c,f=i*u,p=i*l,A=this.data;return A[0]=(1-(x+w))*h,A[1]=(g+p)*h,A[2]=(m-f)*h,A[3]=0,A[4]=(g-p)*o,A[5]=(1-(y+w))*o,A[6]=(z+M)*o,A[7]=0,A[8]=(m+f)*d,A[9]=(z-M)*d,A[10]=(1-(y+x))*d,A[11]=0,A[12]=t.x,A[13]=t.y,A[14]=t.z,A[15]=1,this}transpose(t=this){const s=t.data,a=this.data;if(s===a){let t;t=s[1],a[1]=s[4],a[4]=t,t=s[2],a[2]=s[8],a[8]=t,t=s[3],a[3]=s[12],a[12]=t,t=s[6],a[6]=s[9],a[9]=t,t=s[7],a[7]=s[13],a[13]=t,t=s[11],a[11]=s[14],a[14]=t;}else a[0]=s[0],a[1]=s[4],a[2]=s[8],a[3]=s[12],a[4]=s[1],a[5]=s[5],a[6]=s[9],a[7]=s[13],a[8]=s[2],a[9]=s[6],a[10]=s[10],a[11]=s[14],a[12]=s[3],a[13]=s[7],a[14]=s[11],a[15]=s[15];return this}getTranslation(t=new s$1L){return t.set(this.data[12],this.data[13],this.data[14])}getX(t=new s$1L){return t.set(this.data[0],this.data[1],this.data[2])}getY(t=new s$1L){return t.set(this.data[4],this.data[5],this.data[6])}getZ(t=new s$1L){return t.set(this.data[8],this.data[9],this.data[10])}getScale(t=new s$1L){return this.getX(i$1s),this.getY(h$K),this.getZ(o$17),t.set(i$1s.length(),h$K.length(),o$17.length()),t}get scaleSign(){return this.getX(i$1s),this.getY(h$K),this.getZ(o$17),i$1s.cross(i$1s,h$K),i$1s.dot(o$17)<0?-1:1}setFromEulerAngles(s,a,e){s*=t$1Z.DEG_TO_RAD,a*=t$1Z.DEG_TO_RAD,e*=t$1Z.DEG_TO_RAD;const n=Math.sin(-s),r=Math.cos(-s),i=Math.sin(-a),h=Math.cos(-a),o=Math.sin(-e),d=Math.cos(-e),c=this.data;return c[0]=h*d,c[1]=-h*o,c[2]=i,c[3]=0,c[4]=r*o+d*n*i,c[5]=r*d-n*i*o,c[6]=-h*n,c[7]=0,c[8]=n*o-r*d*i,c[9]=d*n+r*i*o,c[10]=r*h,c[11]=0,c[12]=0,c[13]=0,c[14]=0,c[15]=1,this}getEulerAngles(s=new s$1L){this.getScale(d$N);const e=d$N.x,n=d$N.y,r=d$N.z;if(0===e||0===n||0===r)return s.set(0,0,0);const i=this.data,h=Math.asin(-i[2]/e),o=.5*Math.PI;let c,u;return h<o?h>-o?(c=Math.atan2(i[6]/n,i[10]/r),u=Math.atan2(i[1]/e,i[0]/e)):(u=0,c=-Math.atan2(i[4]/n,i[5]/n)):(u=0,c=Math.atan2(i[4]/n,i[5]/n)),s.set(c,h,u).mulScalar(t$1Z.RAD_TO_DEG)}toString(){return `[${this.data.join(", ")}]`}};n$1H=c$13,c$13.IDENTITY=Object.freeze(new n$1H),c$13.ZERO=Object.freeze((new n$1H).set([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]));
var h$J;let i$1r = class i{constructor(t=0,s=0,h=0,i=1){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=s,this.z=h,this.w=i);}clone(){return new(this.constructor)(this.x,this.y,this.z,this.w)}conjugate(t=this){return this.x=-1*t.x,this.y=-1*t.y,this.z=-1*t.z,this.w=t.w,this}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this}equals(t){return this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w}equalsApprox(t,s=1e-6){return Math.abs(this.x-t.x)<s&&Math.abs(this.y-t.y)<s&&Math.abs(this.z-t.z)<s&&Math.abs(this.w-t.w)<s}getAxisAngle(s){let h=2*Math.acos(this.w);const i=Math.sin(h/2);return 0!==i?(s.x=this.x/i,s.y=this.y/i,s.z=this.z/i,(s.x<0||s.y<0||s.z<0)&&(s.x*=-1,s.y*=-1,s.z*=-1,h*=-1)):(s.x=1,s.y=0,s.z=0),h*t$1Z.RAD_TO_DEG}getEulerAngles(h=new s$1L){let i,e,r;const n=this.x,a=this.y,z=this.z,x=this.w,y=2*(x*a-n*z);return y<=-.99999?(i=2*Math.atan2(n,x),e=-Math.PI/2,r=0):y>=.99999?(i=2*Math.atan2(n,x),e=Math.PI/2,r=0):(i=Math.atan2(2*(x*n+a*z),1-2*(n*n+a*a)),e=Math.asin(y),r=Math.atan2(2*(x*z+n*a),1-2*(a*a+z*z))),h.set(i,e,r).mulScalar(t$1Z.RAD_TO_DEG)}invert(t=this){return this.conjugate(t).normalize()}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}mul(t){const s=this.x,h=this.y,i=this.z,e=this.w,r=t.x,n=t.y,a=t.z,z=t.w;return this.x=e*r+s*z+h*a-i*n,this.y=e*n+h*z+i*r-s*a,this.z=e*a+i*z+s*n-h*r,this.w=e*z-s*r-h*n-i*a,this}mulScalar(t,s=this){return this.x=s.x*t,this.y=s.y*t,this.z=s.z*t,this.w=s.w*t,this}mul2(t,s){const h=t.x,i=t.y,e=t.z,r=t.w,n=s.x,a=s.y,z=s.z,x=s.w;return this.x=r*n+h*x+i*z-e*a,this.y=r*a+i*x+e*n-h*z,this.z=r*z+e*x+h*a-i*n,this.w=r*x-h*n-i*a-e*z,this}normalize(t=this){let s=t.length();return 0===s?(this.x=this.y=this.z=0,this.w=1):(s=1/s,this.x=t.x*s,this.y=t.y*s,this.z=t.z*s,this.w=t.w*s),this}set(t,s,h,i){return this.x=t,this.y=s,this.z=h,this.w=i,this}setFromAxisAngle(s,h){h*=.5*t$1Z.DEG_TO_RAD;const i=Math.sin(h),e=Math.cos(h);return this.x=i*s.x,this.y=i*s.y,this.z=i*s.z,this.w=e,this}setFromEulerAngles(h,i,e){if(h instanceof s$1L){const t=h;h=t.x,i=t.y,e=t.z;}const r=.5*t$1Z.DEG_TO_RAD;h*=r,i*=r,e*=r;const n=Math.sin(h),a=Math.cos(h),z=Math.sin(i),x=Math.cos(i),y=Math.sin(e),o=Math.cos(e);return this.x=n*x*o-a*z*y,this.y=a*z*o+n*x*y,this.z=a*x*y-n*z*o,this.w=a*x*o+n*z*y,this}setFromMat4(t){const s=t.data;let h=s[0],i=s[1],e=s[2],r=s[4],n=s[5],a=s[6],z=s[8],x=s[9],y=s[10];let o;return h*(n*y-a*x)-i*(r*y-a*z)+e*(r*x-n*z)<0&&(h=-h,i=-i,e=-e),o=h*h+i*i+e*e,0===o?this.set(0,0,0,1):(o=1/Math.sqrt(o),h*=o,i*=o,e*=o,o=r*r+n*n+a*a,0===o?this.set(0,0,0,1):(o=1/Math.sqrt(o),r*=o,n*=o,a*=o,o=z*z+x*x+y*y,0===o?this.set(0,0,0,1):(o=1/Math.sqrt(o),z*=o,x*=o,y*=o,y<0?h>n?this.set(1+h-n-y,i+r,z+e,a-x):this.set(i+r,1-h+n-y,a+x,z-e):h<-n?this.set(z+e,a+x,1-h-n+y,i-r):this.set(a-x,z-e,i-r,1+h+n+y),this.mulScalar(1/this.length()))))}setFromDirections(t,s){const h=1+t.dot(s);return h<Number.EPSILON?Math.abs(t.x)>Math.abs(t.y)?(this.x=-t.z,this.y=0,this.z=t.x,this.w=0):(this.x=0,this.y=-t.z,this.z=t.y,this.w=0):(this.x=t.y*s.z-t.z*s.y,this.y=t.z*s.x-t.x*s.z,this.z=t.x*s.y-t.y*s.x,this.w=h),this.normalize()}slerp(t,s,h){const i=t.x,e=t.y,r=t.z,n=t.w;let a=s.x,z=s.y,x=s.z,y=s.w,o=n*y+i*a+e*z+r*x;if(o<0&&(y=-y,a=-a,z=-z,x=-x,o=-o),Math.abs(o)>=1)return this.w=n,this.x=i,this.y=e,this.z=r,this;const w=Math.acos(o),c=Math.sqrt(1-o*o);if(Math.abs(c)<.001)return this.w=.5*n+.5*y,this.x=.5*i+.5*a,this.y=.5*e+.5*z,this.z=.5*r+.5*x,this;const u=Math.sin((1-h)*w)/c,M=Math.sin(h*w)/c;return this.w=n*u+y*M,this.x=i*u+a*M,this.y=e*u+z*M,this.z=r*u+x*M,this}transformVector(t,h=new s$1L){const i=t.x,e=t.y,r=t.z,n=this.x,a=this.y,z=this.z,x=this.w,y=x*i+a*r-z*e,o=x*e+z*i-n*r,w=x*r+n*e-a*i,c=-n*i-a*e-z*r;return h.x=y*x+c*-n+o*-z-w*-a,h.y=o*x+c*-a+w*-n-y*-z,h.z=w*x+c*-z+y*-a-o*-n,h}toString(){return `[${this.x}, ${this.y}, ${this.z}, ${this.w}]`}};h$J=i$1r,i$1r.IDENTITY=Object.freeze(new h$J(0,0,0,1)),i$1r.ZERO=Object.freeze(new h$J(0,0,0,0));
const e$2r=new s$1L,s$1I=new s$1L,n$1G=new s$1L,a$1m=new s$1L,h$I=new s$1L;let i$1q = class i{constructor(e=new s$1L,s=new s$1L(.5,.5,.5)){this.center=void 0,this.halfExtents=void 0,this._min=new s$1L,this._max=new s$1L,this.center=e,this.halfExtents=s;}add(t){const e=this.center,s=e.x,n=e.y,a=e.z,h=this.halfExtents,i=h.x,x=h.y,r=h.z;let c=s-i,M=s+i,y=n-x,o=n+x,z=a-r,l=a+r;const u=t.center,m=u.x,b=u.y,E=u.z,f=t.halfExtents,d=f.x,A=f.y,_=f.z,g=m-d,p=m+d,L=b-A,N=b+A,U=E-_,V=E+_;g<c&&(c=g),p>M&&(M=p),L<y&&(y=L),N>o&&(o=N),U<z&&(z=U),V>l&&(l=V),e.x=.5*(c+M),e.y=.5*(y+o),e.z=.5*(z+l),h.x=.5*(M-c),h.y=.5*(o-y),h.z=.5*(l-z);}copy(t){this.center.copy(t.center),this.halfExtents.copy(t.halfExtents);}clone(){return new i(this.center.clone(),this.halfExtents.clone())}intersects(t){const e=this.getMax(),s=this.getMin(),n=t.getMax(),a=t.getMin();return s.x<=n.x&&e.x>=a.x&&s.y<=n.y&&e.y>=a.y&&s.z<=n.z&&e.z>=a.z}_intersectsRay(t,h){const i=e$2r.copy(this.getMin()).sub(t.origin),x=s$1I.copy(this.getMax()).sub(t.origin),r=t.direction;0===r.x?(i.x=i.x<0?-Number.MAX_VALUE:Number.MAX_VALUE,x.x=x.x<0?-Number.MAX_VALUE:Number.MAX_VALUE):(i.x/=r.x,x.x/=r.x),0===r.y?(i.y=i.y<0?-Number.MAX_VALUE:Number.MAX_VALUE,x.y=x.y<0?-Number.MAX_VALUE:Number.MAX_VALUE):(i.y/=r.y,x.y/=r.y),0===r.z?(i.z=i.z<0?-Number.MAX_VALUE:Number.MAX_VALUE,x.z=x.z<0?-Number.MAX_VALUE:Number.MAX_VALUE):(i.z/=r.z,x.z/=r.z);const c=n$1G.set(Math.min(i.x,x.x),Math.min(i.y,x.y),Math.min(i.z,x.z)),M=a$1m.set(Math.max(i.x,x.x),Math.max(i.y,x.y),Math.max(i.z,x.z)),y=Math.min(Math.min(M.x,M.y),M.z),o=Math.max(Math.max(c.x,c.y),c.z),z=y>=o&&o>=0;return z&&h.copy(t.direction).mulScalar(o).add(t.origin),z}_fastIntersectsRay(t){const i=e$2r,x=s$1I,r=n$1G,c=a$1m,M=h$I,y=t.direction;return i.sub2(t.origin,this.center),c.set(Math.abs(i.x),Math.abs(i.y),Math.abs(i.z)),r.mul2(i,y),!(c.x>this.halfExtents.x&&r.x>=0)&&(!(c.y>this.halfExtents.y&&r.y>=0)&&(!(c.z>this.halfExtents.z&&r.z>=0)&&(M.set(Math.abs(y.x),Math.abs(y.y),Math.abs(y.z)),x.cross(y,i),x.set(Math.abs(x.x),Math.abs(x.y),Math.abs(x.z)),!(x.x>this.halfExtents.y*M.z+this.halfExtents.z*M.y)&&(!(x.y>this.halfExtents.x*M.z+this.halfExtents.z*M.x)&&!(x.z>this.halfExtents.x*M.y+this.halfExtents.y*M.x)))))}intersectsRay(t,e){return e?this._intersectsRay(t,e):this._fastIntersectsRay(t)}setMinMax(t,e){this.center.add2(e,t).mulScalar(.5),this.halfExtents.sub2(e,t).mulScalar(.5);}getMin(){return this._min.copy(this.center).sub(this.halfExtents)}getMax(){return this._max.copy(this.center).add(this.halfExtents)}containsPoint(t){co