(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-vendors"],{2877:function(t,e,n){"use strict";function i(t,e,n,i,r,a,s,o){var l,c="function"===typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=n,c._compiled=!0),i&&(c.functional=!0),a&&(c._scopeId="data-v-"+a),s?(l=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},c._ssrRegister=l):r&&(l=o?function(){r.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:r),l)if(c.functional){c._injectStyles=l;var u=c.render;c.render=function(t,e){return l.call(e),u(t,e)}}else{var h=c.beforeCreate;c.beforeCreate=h?[].concat(h,l):[l]}return{exports:t,options:c}}n.d(e,"a",(function(){return i}))},"2b0e":function(t,e,n){"use strict";(function(t){n.d(e,"a",(function(){return $i})); /*! * Vue.js v2.7.10 * (c) 2014-2022 Evan You * Released under the MIT License. */ var i=Object.freeze({}),r=Array.isArray;function a(t){return void 0===t||null===t}function s(t){return void 0!==t&&null!==t}function o(t){return!0===t}function l(t){return!1===t}function c(t){return"string"===typeof t||"number"===typeof t||"symbol"===typeof t||"boolean"===typeof t}function u(t){return"function"===typeof t}function h(t){return null!==t&&"object"===typeof t}var d=Object.prototype.toString;function p(t){return"[object Object]"===d.call(t)}function f(t){return"[object RegExp]"===d.call(t)}function m(t){var e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)}function g(t){return s(t)&&"function"===typeof t.then&&"function"===typeof t.catch}function v(t){return null==t?"":Array.isArray(t)||p(t)&&t.toString===d?JSON.stringify(t,null,2):String(t)}function _(t){var e=parseFloat(t);return isNaN(e)?t:e}function x(t,e){for(var n=Object.create(null),i=t.split(","),r=0;r-1)return t.splice(n,1)}}var M=Object.prototype.hasOwnProperty;function w(t,e){return M.call(t,e)}function S(t){var e=Object.create(null);return function(n){var i=e[n];return i||(e[n]=t(n))}}var T=/-(\w)/g,E=S((function(t){return t.replace(T,(function(t,e){return e?e.toUpperCase():""}))})),A=S((function(t){return t.charAt(0).toUpperCase()+t.slice(1)})),C=/\B([A-Z])/g,L=S((function(t){return t.replace(C,"-$1").toLowerCase()}));function P(t,e){function n(n){var i=arguments.length;return i?i>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n}function D(t,e){return t.bind(e)}var R=Function.prototype.bind?D:P;function I(t,e){e=e||0;var n=t.length-e,i=new Array(n);while(n--)i[n]=t[n+e];return i}function O(t,e){for(var n in e)t[n]=e[n];return t}function N(t){for(var e={},n=0;n0,it=tt&&tt.indexOf("edge/")>0;tt&&tt.indexOf("android");var rt=tt&&/iphone|ipad|ipod|ios/.test(tt);tt&&/chrome\/\d+/.test(tt),tt&&/phantomjs/.test(tt);var at,st=tt&&tt.match(/firefox\/(\d+)/),ot={}.watch,lt=!1;if(Q)try{var ct={};Object.defineProperty(ct,"passive",{get:function(){lt=!0}}),window.addEventListener("test-passive",null,ct)}catch($s){}var ut=function(){return void 0===at&&(at=!Q&&"undefined"!==typeof t&&(t["process"]&&"server"===t["process"].env.VUE_ENV)),at},ht=Q&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function dt(t){return"function"===typeof t&&/native code/.test(t.toString())}var pt,ft="undefined"!==typeof Symbol&&dt(Symbol)&&"undefined"!==typeof Reflect&&dt(Reflect.ownKeys);pt="undefined"!==typeof Set&&dt(Set)?Set:function(){function t(){this.set=Object.create(null)}return t.prototype.has=function(t){return!0===this.set[t]},t.prototype.add=function(t){this.set[t]=!0},t.prototype.clear=function(){this.set=Object.create(null)},t}();var mt=null;function gt(t){void 0===t&&(t=null),t||mt&&mt._scope.off(),mt=t,t&&t._scope.on()}var vt=function(){function t(t,e,n,i,r,a,s,o){this.tag=t,this.data=e,this.children=n,this.text=i,this.elm=r,this.ns=void 0,this.context=a,this.fnContext=void 0,this.fnOptions=void 0,this.fnScopeId=void 0,this.key=e&&e.key,this.componentOptions=s,this.componentInstance=void 0,this.parent=void 0,this.raw=!1,this.isStatic=!1,this.isRootInsert=!0,this.isComment=!1,this.isCloned=!1,this.isOnce=!1,this.asyncFactory=o,this.asyncMeta=void 0,this.isAsyncPlaceholder=!1}return Object.defineProperty(t.prototype,"child",{get:function(){return this.componentInstance},enumerable:!1,configurable:!0}),t}(),_t=function(t){void 0===t&&(t="");var e=new vt;return e.text=t,e.isComment=!0,e};function xt(t){return new vt(void 0,void 0,void 0,String(t))}function yt(t){var e=new vt(t.tag,t.data,t.children&&t.children.slice(),t.text,t.elm,t.context,t.componentOptions,t.asyncFactory);return e.ns=t.ns,e.isStatic=t.isStatic,e.key=t.key,e.isComment=t.isComment,e.fnContext=t.fnContext,e.fnOptions=t.fnOptions,e.fnScopeId=t.fnScopeId,e.asyncMeta=t.asyncMeta,e.isCloned=!0,e}var bt=0,Mt=function(){function t(){this.id=bt++,this.subs=[]}return t.prototype.addSub=function(t){this.subs.push(t)},t.prototype.removeSub=function(t){b(this.subs,t)},t.prototype.depend=function(e){t.target&&t.target.addDep(this)},t.prototype.notify=function(t){var e=this.subs.slice();for(var n=0,i=e.length;n0&&(i=ae(i,"".concat(e||"","_").concat(n)),re(i[0])&&re(u)&&(h[l]=xt(u.text+i[0].text),i.shift()),h.push.apply(h,i)):c(i)?re(u)?h[l]=xt(u.text+i):""!==i&&h.push(xt(i)):re(i)&&re(u)?h[l]=xt(u.text+i.text):(o(t._isVList)&&s(i.tag)&&a(i.key)&&s(e)&&(i.key="__vlist".concat(e,"_").concat(n,"__")),h.push(i)));return h}function se(t,e){var n,i,a,o,l=null;if(r(t)||"string"===typeof t)for(l=new Array(t.length),n=0,i=t.length;n0,o=e?!!e.$stable:!s,l=e&&e.$key;if(e){if(e._normalized)return e._normalized;if(o&&r&&r!==i&&l===r.$key&&!s&&!r.$hasNormal)return r;for(var c in a={},e)e[c]&&"$"!==c[0]&&(a[c]=Te(t,n,c,e[c]))}else a={};for(var u in n)u in a||(a[u]=Ee(n,u));return e&&Object.isExtensible(e)&&(e._normalized=a),Y(a,"$stable",o),Y(a,"$key",l),Y(a,"$hasNormal",s),a}function Te(t,e,n,i){var a=function(){var e=mt;gt(t);var n=arguments.length?i.apply(null,arguments):i({});n=n&&"object"===typeof n&&!r(n)?[n]:ie(n);var a=n&&n[0];return gt(e),n&&(!a||1===n.length&&a.isComment&&!we(a))?void 0:n};return i.proxy&&Object.defineProperty(e,n,{get:a,enumerable:!0,configurable:!0}),a}function Ee(t,e){return function(){return t[e]}}function Ae(t){var e=t.$options,n=e.setup;if(n){var i=t._setupContext=Ce(t);gt(t),St();var r=qe(n,null,[t._props||Bt({}),i],t,"setup");if(Tt(),gt(),u(r))e.render=r;else if(h(r))if(t._setupState=r,r.__sfc){var a=t._setupProxy={};for(var s in r)"__sfc"!==s&&Wt(a,r,s)}else for(var s in r)$(s)||Wt(t,r,s);else 0}}function Ce(t){return{get attrs(){if(!t._attrsProxy){var e=t._attrsProxy={};Y(e,"_v_attr_proxy",!0),Le(e,t.$attrs,i,t,"$attrs")}return t._attrsProxy},get listeners(){if(!t._listenersProxy){var e=t._listenersProxy={};Le(e,t.$listeners,i,t,"$listeners")}return t._listenersProxy},get slots(){return De(t)},emit:R(t.$emit,t),expose:function(e){e&&Object.keys(e).forEach((function(n){return Wt(t,e,n)}))}}}function Le(t,e,n,i,r){var a=!1;for(var s in e)s in t?e[s]!==n[s]&&(a=!0):(a=!0,Pe(t,s,i,r));for(var s in t)s in e||(a=!0,delete t[s]);return a}function Pe(t,e,n,i){Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:function(){return n[i][e]}})}function De(t){return t._slotsProxy||Re(t._slotsProxy={},t.$scopedSlots),t._slotsProxy}function Re(t,e){for(var n in e)t[n]=e[n];for(var n in t)n in e||delete t[n]}function Ie(t){t._vnode=null,t._staticTrees=null;var e=t.$options,n=t.$vnode=e._parentVnode,r=n&&n.context;t.$slots=be(e._renderChildren,r),t.$scopedSlots=n?Se(t.$parent,n.data.scopedSlots,t.$slots):i,t._c=function(e,n,i,r){return He(t,e,n,i,r,!1)},t.$createElement=function(e,n,i,r){return He(t,e,n,i,r,!0)};var a=n&&n.data;Ut(t,"$attrs",a&&a.attrs||i,null,!0),Ut(t,"$listeners",e._parentListeners||i,null,!0)}var Oe=null;function Ne(t){ye(t.prototype),t.prototype.$nextTick=function(t){return sn(t,this)},t.prototype._render=function(){var t,e=this,n=e.$options,i=n.render,a=n._parentVnode;a&&e._isMounted&&(e.$scopedSlots=Se(e.$parent,a.data.scopedSlots,e.$slots,e.$scopedSlots),e._slotsProxy&&Re(e._slotsProxy,e.$scopedSlots)),e.$vnode=a;try{gt(e),Oe=e,t=i.call(e._renderProxy,e.$createElement)}catch($s){Xe($s,e,"render"),t=e._vnode}finally{Oe=null,gt()}return r(t)&&1===t.length&&(t=t[0]),t instanceof vt||(t=_t()),t.parent=a,t}}function Ue(t,e){return(t.__esModule||ft&&"Module"===t[Symbol.toStringTag])&&(t=t.default),h(t)?e.extend(t):t}function ke(t,e,n,i,r){var a=_t();return a.asyncFactory=t,a.asyncMeta={data:e,context:n,children:i,tag:r},a}function ze(t,e){if(o(t.error)&&s(t.errorComp))return t.errorComp;if(s(t.resolved))return t.resolved;var n=Oe;if(n&&s(t.owners)&&-1===t.owners.indexOf(n)&&t.owners.push(n),o(t.loading)&&s(t.loadingComp))return t.loadingComp;if(n&&!s(t.owners)){var i=t.owners=[n],r=!0,l=null,c=null;n.$on("hook:destroyed",(function(){return b(i,n)}));var u=function(t){for(var e=0,n=i.length;e1?I(n):n;for(var i=I(arguments,1),r='event handler for "'.concat(t,'"'),a=0,s=n.length;adocument.createEvent("Event").timeStamp&&(Bn=function(){return Vn.now()})}var Hn=function(t,e){if(t.post){if(!e.post)return 1}else if(e.post)return-1;return t.id-e.id};function Gn(){var t,e;for(Fn=Bn(),Un=!0,Rn.sort(Hn),kn=0;knkn&&Rn[n].id>t.id)n--;Rn.splice(n+1,0,t)}else Rn.push(t);Nn||(Nn=!0,sn(Gn))}}function $n(t){var e=t.$options.provide;if(e){var n=u(e)?e.call(t):e;if(!h(n))return;for(var i=Yt(t),r=ft?Reflect.ownKeys(n):Object.keys(n),a=0;a-1)if(a&&!w(r,"default"))s=!1;else if(""===s||s===L(t)){var l=Ai(String,r.type);(l<0||o-1)return this;var n=I(arguments,1);return n.unshift(this),u(t.install)?t.install.apply(t,n):u(t)&&t.apply(null,n),e.push(t),this}}function Zi(t){t.mixin=function(t){return this.options=yi(this.options,t),this}}function Ki(t){t.cid=0;var e=1;t.extend=function(t){t=t||{};var n=this,i=n.cid,r=t._Ctor||(t._Ctor={});if(r[i])return r[i];var a=ei(t)||ei(n.options);var s=function(t){this._init(t)};return s.prototype=Object.create(n.prototype),s.prototype.constructor=s,s.cid=e++,s.options=yi(n.options,t),s["super"]=n,s.options.props&&Ji(s),s.options.computed&&Qi(s),s.extend=n.extend,s.mixin=n.mixin,s.use=n.use,W.forEach((function(t){s[t]=n[t]})),a&&(s.options.components[a]=s),s.superOptions=n.options,s.extendOptions=t,s.sealedOptions=O({},s.options),r[i]=s,s}}function Ji(t){var e=t.options.props;for(var n in e)Li(t.prototype,"_props",n)}function Qi(t){var e=t.options.computed;for(var n in e)Ui(t.prototype,n,e[n])}function tr(t){W.forEach((function(e){t[e]=function(t,n){return n?("component"===e&&p(n)&&(n.name=n.name||t,n=this.options._base.extend(n)),"directive"===e&&u(n)&&(n={bind:n,update:n}),this.options[e+"s"][t]=n,n):this.options[e+"s"][t]}}))}function er(t){return t&&(ei(t.Ctor.options)||t.tag)}function nr(t,e){return r(t)?t.indexOf(e)>-1:"string"===typeof t?t.split(",").indexOf(e)>-1:!!f(t)&&t.test(e)}function ir(t,e){var n=t.cache,i=t.keys,r=t._vnode;for(var a in n){var s=n[a];if(s){var o=s.name;o&&!e(o)&&rr(n,a,i,r)}}}function rr(t,e,n,i){var r=t[e];!r||i&&r.tag===i.tag||r.componentInstance.$destroy(),t[e]=null,b(n,e)}Wi($i),Hi($i),bn($i),Tn($i),Ne($i);var ar=[String,RegExp,Array],sr={name:"keep-alive",abstract:!0,props:{include:ar,exclude:ar,max:[String,Number]},methods:{cacheVNode:function(){var t=this,e=t.cache,n=t.keys,i=t.vnodeToCache,r=t.keyToCache;if(i){var a=i.tag,s=i.componentInstance,o=i.componentOptions;e[r]={name:er(o),tag:a,componentInstance:s},n.push(r),this.max&&n.length>parseInt(this.max)&&rr(e,n[0],n,this._vnode),this.vnodeToCache=null}}},created:function(){this.cache=Object.create(null),this.keys=[]},destroyed:function(){for(var t in this.cache)rr(this.cache,t,this.keys)},mounted:function(){var t=this;this.cacheVNode(),this.$watch("include",(function(e){ir(t,(function(t){return nr(e,t)}))})),this.$watch("exclude",(function(e){ir(t,(function(t){return!nr(e,t)}))}))},updated:function(){this.cacheVNode()},render:function(){var t=this.$slots.default,e=Fe(t),n=e&&e.componentOptions;if(n){var i=er(n),r=this,a=r.include,s=r.exclude;if(a&&(!i||!nr(a,i))||s&&i&&nr(s,i))return e;var o=this,l=o.cache,c=o.keys,u=null==e.key?n.Ctor.cid+(n.tag?"::".concat(n.tag):""):e.key;l[u]?(e.componentInstance=l[u].componentInstance,b(c,u),c.push(u)):(this.vnodeToCache=e,this.keyToCache=u),e.data.keepAlive=!0}return e||t&&t[0]}},or={KeepAlive:sr};function lr(t){var e={get:function(){return X}};Object.defineProperty(t,"config",e),t.util={warn:ci,extend:O,mergeOptions:yi,defineReactive:Ut},t.set=kt,t.delete=zt,t.nextTick=sn,t.observable=function(t){return Nt(t),t},t.options=Object.create(null),W.forEach((function(e){t.options[e+"s"]=Object.create(null)})),t.options._base=t,O(t.options.components,or),Yi(t),Zi(t),Ki(t),tr(t)}lr($i),Object.defineProperty($i.prototype,"$isServer",{get:ut}),Object.defineProperty($i.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty($i,"FunctionalRenderContext",{value:Kn}),$i.version=cn;var cr=x("style,class"),ur=x("input,textarea,option,select,progress"),hr=function(t,e,n){return"value"===n&&ur(t)&&"button"!==e||"selected"===n&&"option"===t||"checked"===n&&"input"===t||"muted"===n&&"video"===t},dr=x("contenteditable,draggable,spellcheck"),pr=x("events,caret,typing,plaintext-only"),fr=function(t,e){return xr(e)||"false"===e?"false":"contenteditable"===t&&pr(e)?e:"true"},mr=x("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,truespeed,typemustmatch,visible"),gr="http://www.w3.org/1999/xlink",vr=function(t){return":"===t.charAt(5)&&"xlink"===t.slice(0,5)},_r=function(t){return vr(t)?t.slice(6,t.length):""},xr=function(t){return null==t||!1===t};function yr(t){var e=t.data,n=t,i=t;while(s(i.componentInstance))i=i.componentInstance._vnode,i&&i.data&&(e=br(i.data,e));while(s(n=n.parent))n&&n.data&&(e=br(e,n.data));return Mr(e.staticClass,e.class)}function br(t,e){return{staticClass:wr(t.staticClass,e.staticClass),class:s(t.class)?[t.class,e.class]:e.class}}function Mr(t,e){return s(t)||s(e)?wr(t,Sr(e)):""}function wr(t,e){return t?e?t+" "+e:t:e||""}function Sr(t){return Array.isArray(t)?Tr(t):h(t)?Er(t):"string"===typeof t?t:""}function Tr(t){for(var e,n="",i=0,r=t.length;i-1?Rr[t]=e.constructor===window.HTMLUnknownElement||e.constructor===window.HTMLElement:Rr[t]=/HTMLUnknownElement/.test(e.toString())}var Or=x("text,number,password,search,email,tel,url");function Nr(t){if("string"===typeof t){var e=document.querySelector(t);return e||document.createElement("div")}return t}function Ur(t,e){var n=document.createElement(t);return"select"!==t||e.data&&e.data.attrs&&void 0!==e.data.attrs.multiple&&n.setAttribute("multiple","multiple"),n}function kr(t,e){return document.createElementNS(Ar[t],e)}function zr(t){return document.createTextNode(t)}function Fr(t){return document.createComment(t)}function Br(t,e,n){t.insertBefore(e,n)}function Vr(t,e){t.removeChild(e)}function Hr(t,e){t.appendChild(e)}function Gr(t){return t.parentNode}function Wr(t){return t.nextSibling}function jr(t){return t.tagName}function Xr(t,e){t.textContent=e}function qr(t,e){t.setAttribute(e,"")}var $r=Object.freeze({__proto__:null,createElement:Ur,createElementNS:kr,createTextNode:zr,createComment:Fr,insertBefore:Br,removeChild:Vr,appendChild:Hr,parentNode:Gr,nextSibling:Wr,tagName:jr,setTextContent:Xr,setStyleScope:qr}),Yr={create:function(t,e){Zr(e)},update:function(t,e){t.data.ref!==e.data.ref&&(Zr(t,!0),Zr(e))},destroy:function(t){Zr(t,!0)}};function Zr(t,e){var n=t.data.ref;if(s(n)){var i=t.context,a=t.componentInstance||t.elm,o=e?null:a,l=e?void 0:a;if(u(n))qe(n,i,[o],i,"template ref function");else{var c=t.data.refInFor,h="string"===typeof n||"number"===typeof n,d=Gt(n),p=i.$refs;if(h||d)if(c){var f=h?p[n]:n.value;e?r(f)&&b(f,a):r(f)?f.includes(a)||f.push(a):h?(p[n]=[a],Kr(i,n,p[n])):n.value=[a]}else if(h){if(e&&p[n]!==a)return;p[n]=l,Kr(i,n,o)}else if(d){if(e&&n.value!==a)return;n.value=o}else 0}}}function Kr(t,e,n){var i=t._setupState;i&&w(i,e)&&(Gt(i[e])?i[e].value=n:i[e]=n)}var Jr=new vt("",{},[]),Qr=["create","activate","update","remove","destroy"];function ta(t,e){return t.key===e.key&&t.asyncFactory===e.asyncFactory&&(t.tag===e.tag&&t.isComment===e.isComment&&s(t.data)===s(e.data)&&ea(t,e)||o(t.isAsyncPlaceholder)&&a(e.asyncFactory.error))}function ea(t,e){if("input"!==t.tag)return!0;var n,i=s(n=t.data)&&s(n=n.attrs)&&n.type,r=s(n=e.data)&&s(n=n.attrs)&&n.type;return i===r||Or(i)&&Or(r)}function na(t,e,n){var i,r,a={};for(i=e;i<=n;++i)r=t[i].key,s(r)&&(a[r]=i);return a}function ia(t){var e,n,i={},l=t.modules,u=t.nodeOps;for(e=0;em?(h=a(n[_+1])?null:n[_+1].elm,S(t,h,n,p,_,i)):p>_&&E(e,d,m)}function L(t,e,n,i){for(var r=n;r-1?fa(t,e,n):mr(e)?xr(n)?t.removeAttribute(e):(n="allowfullscreen"===e&&"EMBED"===t.tagName?"true":e,t.setAttribute(e,n)):dr(e)?t.setAttribute(e,fr(e,n)):vr(e)?xr(n)?t.removeAttributeNS(gr,_r(e)):t.setAttributeNS(gr,e,n):fa(t,e,n)}function fa(t,e,n){if(xr(n))t.removeAttribute(e);else{if(et&&!nt&&"TEXTAREA"===t.tagName&&"placeholder"===e&&""!==n&&!t.__ieph){var i=function(e){e.stopImmediatePropagation(),t.removeEventListener("input",i)};t.addEventListener("input",i),t.__ieph=!0}t.setAttribute(e,n)}}var ma={create:da,update:da};function ga(t,e){var n=e.elm,i=e.data,r=t.data;if(!(a(i.staticClass)&&a(i.class)&&(a(r)||a(r.staticClass)&&a(r.class)))){var o=yr(e),l=n._transitionClasses;s(l)&&(o=wr(o,Sr(l))),o!==n._prevClass&&(n.setAttribute("class",o),n._prevClass=o)}}var va,_a={create:ga,update:ga},xa="__r",ya="__c";function ba(t){if(s(t[xa])){var e=et?"change":"input";t[e]=[].concat(t[xa],t[e]||[]),delete t[xa]}s(t[ya])&&(t.change=[].concat(t[ya],t.change||[]),delete t[ya])}function Ma(t,e,n){var i=va;return function r(){var a=e.apply(null,arguments);null!==a&&Ta(t,r,n,i)}}var wa=Ke&&!(st&&Number(st[1])<=53);function Sa(t,e,n,i){if(wa){var r=Fn,a=e;e=a._wrapper=function(t){if(t.target===t.currentTarget||t.timeStamp>=r||t.timeStamp<=0||t.target.ownerDocument!==document)return a.apply(this,arguments)}}va.addEventListener(t,e,lt?{capture:n,passive:i}:n)}function Ta(t,e,n,i){(i||va).removeEventListener(t,e._wrapper||e,n)}function Ea(t,e){if(!a(t.data.on)||!a(e.data.on)){var n=e.data.on||{},i=t.data.on||{};va=e.elm||t.elm,ba(n),Jt(n,i,Sa,Ta,Ma,e.context),va=void 0}}var Aa,Ca={create:Ea,update:Ea,destroy:function(t){return Ea(t,Jr)}};function La(t,e){if(!a(t.data.domProps)||!a(e.data.domProps)){var n,i,r=e.elm,l=t.data.domProps||{},c=e.data.domProps||{};for(n in(s(c.__ob__)||o(c._v_attr_proxy))&&(c=e.data.domProps=O({},c)),l)n in c||(r[n]="");for(n in c){if(i=c[n],"textContent"===n||"innerHTML"===n){if(e.children&&(e.children.length=0),i===l[n])continue;1===r.childNodes.length&&r.removeChild(r.childNodes[0])}if("value"===n&&"PROGRESS"!==r.tagName){r._value=i;var u=a(i)?"":String(i);Pa(r,u)&&(r.value=u)}else if("innerHTML"===n&&Lr(r.tagName)&&a(r.innerHTML)){Aa=Aa||document.createElement("div"),Aa.innerHTML="".concat(i,"");var h=Aa.firstChild;while(r.firstChild)r.removeChild(r.firstChild);while(h.firstChild)r.appendChild(h.firstChild)}else if(i!==l[n])try{r[n]=i}catch($s){}}}}function Pa(t,e){return!t.composing&&("OPTION"===t.tagName||Da(t,e)||Ra(t,e))}function Da(t,e){var n=!0;try{n=document.activeElement!==t}catch($s){}return n&&t.value!==e}function Ra(t,e){var n=t.value,i=t._vModifiers;if(s(i)){if(i.number)return _(n)!==_(e);if(i.trim)return n.trim()!==e.trim()}return n!==e}var Ia={create:La,update:La},Oa=S((function(t){var e={},n=/;(?![^(]*\))/g,i=/:(.+)/;return t.split(n).forEach((function(t){if(t){var n=t.split(i);n.length>1&&(e[n[0].trim()]=n[1].trim())}})),e}));function Na(t){var e=Ua(t.style);return t.staticStyle?O(t.staticStyle,e):e}function Ua(t){return Array.isArray(t)?N(t):"string"===typeof t?Oa(t):t}function ka(t,e){var n,i={};if(e){var r=t;while(r.componentInstance)r=r.componentInstance._vnode,r&&r.data&&(n=Na(r.data))&&O(i,n)}(n=Na(t.data))&&O(i,n);var a=t;while(a=a.parent)a.data&&(n=Na(a.data))&&O(i,n);return i}var za,Fa=/^--/,Ba=/\s*!important$/,Va=function(t,e,n){if(Fa.test(e))t.style.setProperty(e,n);else if(Ba.test(n))t.style.setProperty(L(e),n.replace(Ba,""),"important");else{var i=Ga(e);if(Array.isArray(n))for(var r=0,a=n.length;r-1?e.split(Xa).forEach((function(e){return t.classList.add(e)})):t.classList.add(e);else{var n=" ".concat(t.getAttribute("class")||""," ");n.indexOf(" "+e+" ")<0&&t.setAttribute("class",(n+e).trim())}}function $a(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(Xa).forEach((function(e){return t.classList.remove(e)})):t.classList.remove(e),t.classList.length||t.removeAttribute("class");else{var n=" ".concat(t.getAttribute("class")||""," "),i=" "+e+" ";while(n.indexOf(i)>=0)n=n.replace(i," ");n=n.trim(),n?t.setAttribute("class",n):t.removeAttribute("class")}}function Ya(t){if(t){if("object"===typeof t){var e={};return!1!==t.css&&O(e,Za(t.name||"v")),O(e,t),e}return"string"===typeof t?Za(t):void 0}}var Za=S((function(t){return{enterClass:"".concat(t,"-enter"),enterToClass:"".concat(t,"-enter-to"),enterActiveClass:"".concat(t,"-enter-active"),leaveClass:"".concat(t,"-leave"),leaveToClass:"".concat(t,"-leave-to"),leaveActiveClass:"".concat(t,"-leave-active")}})),Ka=Q&&!nt,Ja="transition",Qa="animation",ts="transition",es="transitionend",ns="animation",is="animationend";Ka&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(ts="WebkitTransition",es="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(ns="WebkitAnimation",is="webkitAnimationEnd"));var rs=Q?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(t){return t()};function as(t){rs((function(){rs(t)}))}function ss(t,e){var n=t._transitionClasses||(t._transitionClasses=[]);n.indexOf(e)<0&&(n.push(e),qa(t,e))}function os(t,e){t._transitionClasses&&b(t._transitionClasses,e),$a(t,e)}function ls(t,e,n){var i=us(t,e),r=i.type,a=i.timeout,s=i.propCount;if(!r)return n();var o=r===Ja?es:is,l=0,c=function(){t.removeEventListener(o,u),n()},u=function(e){e.target===t&&++l>=s&&c()};setTimeout((function(){l0&&(n=Ja,u=s,h=a.length):e===Qa?c>0&&(n=Qa,u=c,h=l.length):(u=Math.max(s,c),n=u>0?s>c?Ja:Qa:null,h=n?n===Ja?a.length:l.length:0);var d=n===Ja&&cs.test(i[ts+"Property"]);return{type:n,timeout:u,propCount:h,hasTransform:d}}function hs(t,e){while(t.length1}function vs(t,e){!0!==e.data.show&&ps(e)}var _s=Q?{create:vs,activate:vs,remove:function(t,e){!0!==t.data.show?fs(t,e):e()}}:{},xs=[ma,_a,Ca,Ia,ja,_s],ys=xs.concat(ha),bs=ia({nodeOps:$r,modules:ys});nt&&document.addEventListener("selectionchange",(function(){var t=document.activeElement;t&&t.vmodel&&Ls(t,"input")}));var Ms={inserted:function(t,e,n,i){"select"===n.tag?(i.elm&&!i.elm._vOptions?Qt(n,"postpatch",(function(){Ms.componentUpdated(t,e,n)})):ws(t,e,n.context),t._vOptions=[].map.call(t.options,Es)):("textarea"===n.tag||Or(t.type))&&(t._vModifiers=e.modifiers,e.modifiers.lazy||(t.addEventListener("compositionstart",As),t.addEventListener("compositionend",Cs),t.addEventListener("change",Cs),nt&&(t.vmodel=!0)))},componentUpdated:function(t,e,n){if("select"===n.tag){ws(t,e,n.context);var i=t._vOptions,r=t._vOptions=[].map.call(t.options,Es);if(r.some((function(t,e){return!F(t,i[e])}))){var a=t.multiple?e.value.some((function(t){return Ts(t,r)})):e.value!==e.oldValue&&Ts(e.value,r);a&&Ls(t,"change")}}}};function ws(t,e,n){Ss(t,e,n),(et||it)&&setTimeout((function(){Ss(t,e,n)}),0)}function Ss(t,e,n){var i=e.value,r=t.multiple;if(!r||Array.isArray(i)){for(var a,s,o=0,l=t.options.length;o-1,s.selected!==a&&(s.selected=a);else if(F(Es(s),i))return void(t.selectedIndex!==o&&(t.selectedIndex=o));r||(t.selectedIndex=-1)}}function Ts(t,e){return e.every((function(e){return!F(e,t)}))}function Es(t){return"_value"in t?t._value:t.value}function As(t){t.target.composing=!0}function Cs(t){t.target.composing&&(t.target.composing=!1,Ls(t.target,"input"))}function Ls(t,e){var n=document.createEvent("HTMLEvents");n.initEvent(e,!0,!0),t.dispatchEvent(n)}function Ps(t){return!t.componentInstance||t.data&&t.data.transition?t:Ps(t.componentInstance._vnode)}var Ds={bind:function(t,e,n){var i=e.value;n=Ps(n);var r=n.data&&n.data.transition,a=t.__vOriginalDisplay="none"===t.style.display?"":t.style.display;i&&r?(n.data.show=!0,ps(n,(function(){t.style.display=a}))):t.style.display=i?a:"none"},update:function(t,e,n){var i=e.value,r=e.oldValue;if(!i!==!r){n=Ps(n);var a=n.data&&n.data.transition;a?(n.data.show=!0,i?ps(n,(function(){t.style.display=t.__vOriginalDisplay})):fs(n,(function(){t.style.display="none"}))):t.style.display=i?t.__vOriginalDisplay:"none"}},unbind:function(t,e,n,i,r){r||(t.style.display=t.__vOriginalDisplay)}},Rs={model:Ms,show:Ds},Is={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function Os(t){var e=t&&t.componentOptions;return e&&e.Ctor.options.abstract?Os(Fe(e.children)):t}function Ns(t){var e={},n=t.$options;for(var i in n.propsData)e[i]=t[i];var r=n._parentListeners;for(var i in r)e[E(i)]=r[i];return e}function Us(t,e){if(/\d-keep-alive$/.test(e.tag))return t("keep-alive",{props:e.componentOptions.propsData})}function ks(t){while(t=t.parent)if(t.data.transition)return!0}function zs(t,e){return e.key===t.key&&e.tag===t.tag}var Fs=function(t){return t.tag||we(t)},Bs=function(t){return"show"===t.name},Vs={name:"transition",props:Is,abstract:!0,render:function(t){var e=this,n=this.$slots.default;if(n&&(n=n.filter(Fs),n.length)){0;var i=this.mode;0;var r=n[0];if(ks(this.$vnode))return r;var a=Os(r);if(!a)return r;if(this._leaving)return Us(t,r);var s="__transition-".concat(this._uid,"-");a.key=null==a.key?a.isComment?s+"comment":s+a.tag:c(a.key)?0===String(a.key).indexOf(s)?a.key:s+a.key:a.key;var o=(a.data||(a.data={})).transition=Ns(this),l=this._vnode,u=Os(l);if(a.data.directives&&a.data.directives.some(Bs)&&(a.data.show=!0),u&&u.data&&!zs(a,u)&&!we(u)&&(!u.componentInstance||!u.componentInstance._vnode.isComment)){var h=u.data.transition=O({},o);if("out-in"===i)return this._leaving=!0,Qt(h,"afterLeave",(function(){e._leaving=!1,e.$forceUpdate()})),Us(t,r);if("in-out"===i){if(we(a))return l;var d,p=function(){d()};Qt(o,"afterEnter",p),Qt(o,"enterCancelled",p),Qt(h,"delayLeave",(function(t){d=t}))}}return r}}},Hs=O({tag:String,moveClass:String},Is);delete Hs.mode;var Gs={props:Hs,beforeMount:function(){var t=this,e=this._update;this._update=function(n,i){var r=wn(t);t.__patch__(t._vnode,t.kept,!1,!0),t._vnode=t.kept,r(),e.call(t,n,i)}},render:function(t){for(var e=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),i=this.prevChildren=this.children,r=this.$slots.default||[],a=this.children=[],s=Ns(this),o=0;oMath.PI&&(i-=v),_<-Math.PI?_+=v:_>Math.PI&&(_-=v),u.theta=i<=_?Math.max(i,Math.min(_,u.theta)):u.theta>(i+_)/2?Math.max(i,u.theta):Math.min(_,u.theta)),u.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,u.phi)),u.makeSafe(),u.radius*=d,u.radius=Math.max(n.minDistance,Math.min(n.maxDistance,u.radius)),!0===n.enableDamping?n.target.addScaledVector(p,n.dampingFactor):n.target.add(p),e.setFromSpherical(u),e.applyQuaternion(s),t.copy(n.target).add(e),n.object.lookAt(n.target),!0===n.enableDamping?(h.theta*=1-n.dampingFactor,h.phi*=1-n.dampingFactor,p.multiplyScalar(1-n.dampingFactor)):(h.set(0,0,0),p.set(0,0,0)),d=1,!!(f||m.distanceToSquared(n.object.position)>c||8*(1-g.dot(n.object.quaternion))>c)&&(n.dispatchEvent(r),m.copy(n.object.position),g.copy(n.object.quaternion),f=!1,!0)}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",ct),n.domElement.removeEventListener("pointerdown",Q),n.domElement.removeEventListener("pointercancel",nt),n.domElement.removeEventListener("wheel",at),n.domElement.removeEventListener("pointermove",tt),n.domElement.removeEventListener("pointerup",et),null!==n._domElementKeyEvents&&n._domElementKeyEvents.removeEventListener("keydown",st)};const n=this,o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=o.NONE;const c=1e-6,u=new i["M"],h=new i["M"];let d=1;const p=new i["T"];let f=!1;const m=new i["S"],g=new i["S"],v=new i["S"],_=new i["S"],x=new i["S"],y=new i["S"],b=new i["S"],M=new i["S"],w=new i["S"],S=[],T={};function E(){return 2*Math.PI/60/60*n.autoRotateSpeed}function A(){return Math.pow(.95,n.zoomSpeed)}function C(t){h.theta-=t}function L(t){h.phi-=t}const P=function(){const t=new i["T"];return function(e,n){t.setFromMatrixColumn(n,0),t.multiplyScalar(-e),p.add(t)}}(),D=function(){const t=new i["T"];return function(e,i){!0===n.screenSpacePanning?t.setFromMatrixColumn(i,1):(t.setFromMatrixColumn(i,0),t.crossVectors(n.object.up,t)),t.multiplyScalar(e),p.add(t)}}(),R=function(){const t=new i["T"];return function(e,i){const r=n.domElement;if(n.object.isPerspectiveCamera){const a=n.object.position;t.copy(a).sub(n.target);let s=t.length();s*=Math.tan(n.object.fov/2*Math.PI/180),P(2*e*s/r.clientHeight,n.object.matrix),D(2*i*s/r.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(P(e*(n.object.right-n.object.left)/n.object.zoom/r.clientWidth,n.object.matrix),D(i*(n.object.top-n.object.bottom)/n.object.zoom/r.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function I(t){n.object.isPerspectiveCamera?d/=t:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*t)),n.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function O(t){n.object.isPerspectiveCamera?d*=t:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/t)),n.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function N(t){m.set(t.clientX,t.clientY)}function U(t){b.set(t.clientX,t.clientY)}function k(t){_.set(t.clientX,t.clientY)}function z(t){g.set(t.clientX,t.clientY),v.subVectors(g,m).multiplyScalar(n.rotateSpeed);const e=n.domElement;C(2*Math.PI*v.x/e.clientHeight),L(2*Math.PI*v.y/e.clientHeight),m.copy(g),n.update()}function F(t){M.set(t.clientX,t.clientY),w.subVectors(M,b),w.y>0?I(A()):w.y<0&&O(A()),b.copy(M),n.update()}function B(t){x.set(t.clientX,t.clientY),y.subVectors(x,_).multiplyScalar(n.panSpeed),R(y.x,y.y),_.copy(x),n.update()}function V(t){t.deltaY<0?O(A()):t.deltaY>0&&I(A()),n.update()}function H(t){let e=!1;switch(t.code){case n.keys.UP:R(0,n.keyPanSpeed),e=!0;break;case n.keys.BOTTOM:R(0,-n.keyPanSpeed),e=!0;break;case n.keys.LEFT:R(n.keyPanSpeed,0),e=!0;break;case n.keys.RIGHT:R(-n.keyPanSpeed,0),e=!0;break}e&&(t.preventDefault(),n.update())}function G(){if(1===S.length)m.set(S[0].pageX,S[0].pageY);else{const t=.5*(S[0].pageX+S[1].pageX),e=.5*(S[0].pageY+S[1].pageY);m.set(t,e)}}function W(){if(1===S.length)_.set(S[0].pageX,S[0].pageY);else{const t=.5*(S[0].pageX+S[1].pageX),e=.5*(S[0].pageY+S[1].pageY);_.set(t,e)}}function j(){const t=S[0].pageX-S[1].pageX,e=S[0].pageY-S[1].pageY,n=Math.sqrt(t*t+e*e);b.set(0,n)}function X(){n.enableZoom&&j(),n.enablePan&&W()}function q(){n.enableZoom&&j(),n.enableRotate&&G()}function $(t){if(1==S.length)g.set(t.pageX,t.pageY);else{const e=pt(t),n=.5*(t.pageX+e.x),i=.5*(t.pageY+e.y);g.set(n,i)}v.subVectors(g,m).multiplyScalar(n.rotateSpeed);const e=n.domElement;C(2*Math.PI*v.x/e.clientHeight),L(2*Math.PI*v.y/e.clientHeight),m.copy(g)}function Y(t){if(1===S.length)x.set(t.pageX,t.pageY);else{const e=pt(t),n=.5*(t.pageX+e.x),i=.5*(t.pageY+e.y);x.set(n,i)}y.subVectors(x,_).multiplyScalar(n.panSpeed),R(y.x,y.y),_.copy(x)}function Z(t){const e=pt(t),i=t.pageX-e.x,r=t.pageY-e.y,a=Math.sqrt(i*i+r*r);M.set(0,a),w.set(0,Math.pow(M.y/b.y,n.zoomSpeed)),I(w.y),b.copy(M)}function K(t){n.enableZoom&&Z(t),n.enablePan&&Y(t)}function J(t){n.enableZoom&&Z(t),n.enableRotate&&$(t)}function Q(t){!1!==n.enabled&&(0===S.length&&(n.domElement.setPointerCapture(t.pointerId),n.domElement.addEventListener("pointermove",tt),n.domElement.addEventListener("pointerup",et)),ut(t),"touch"===t.pointerType?ot(t):it(t))}function tt(t){!1!==n.enabled&&("touch"===t.pointerType?lt(t):rt(t))}function et(t){ht(t),0===S.length&&(n.domElement.releasePointerCapture(t.pointerId),n.domElement.removeEventListener("pointermove",tt),n.domElement.removeEventListener("pointerup",et)),n.dispatchEvent(s),l=o.NONE}function nt(t){ht(t)}function it(t){let e;switch(t.button){case 0:e=n.mouseButtons.LEFT;break;case 1:e=n.mouseButtons.MIDDLE;break;case 2:e=n.mouseButtons.RIGHT;break;default:e=-1}switch(e){case i["s"].DOLLY:if(!1===n.enableZoom)return;U(t),l=o.DOLLY;break;case i["s"].ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===n.enablePan)return;k(t),l=o.PAN}else{if(!1===n.enableRotate)return;N(t),l=o.ROTATE}break;case i["s"].PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===n.enableRotate)return;N(t),l=o.ROTATE}else{if(!1===n.enablePan)return;k(t),l=o.PAN}break;default:l=o.NONE}l!==o.NONE&&n.dispatchEvent(a)}function rt(t){switch(l){case o.ROTATE:if(!1===n.enableRotate)return;z(t);break;case o.DOLLY:if(!1===n.enableZoom)return;F(t);break;case o.PAN:if(!1===n.enablePan)return;B(t);break}}function at(t){!1!==n.enabled&&!1!==n.enableZoom&&l===o.NONE&&(t.preventDefault(),n.dispatchEvent(a),V(t),n.dispatchEvent(s))}function st(t){!1!==n.enabled&&!1!==n.enablePan&&H(t)}function ot(t){switch(dt(t),S.length){case 1:switch(n.touches.ONE){case i["O"].ROTATE:if(!1===n.enableRotate)return;G(),l=o.TOUCH_ROTATE;break;case i["O"].PAN:if(!1===n.enablePan)return;W(),l=o.TOUCH_PAN;break;default:l=o.NONE}break;case 2:switch(n.touches.TWO){case i["O"].DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;X(),l=o.TOUCH_DOLLY_PAN;break;case i["O"].DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;q(),l=o.TOUCH_DOLLY_ROTATE;break;default:l=o.NONE}break;default:l=o.NONE}l!==o.NONE&&n.dispatchEvent(a)}function lt(t){switch(dt(t),l){case o.TOUCH_ROTATE:if(!1===n.enableRotate)return;$(t),n.update();break;case o.TOUCH_PAN:if(!1===n.enablePan)return;Y(t),n.update();break;case o.TOUCH_DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;K(t),n.update();break;case o.TOUCH_DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;J(t),n.update();break;default:l=o.NONE}}function ct(t){!1!==n.enabled&&t.preventDefault()}function ut(t){S.push(t)}function ht(t){delete T[t.pointerId];for(let e=0;e>8&255]+De[t>>16&255]+De[t>>24&255]+"-"+De[255&e]+De[e>>8&255]+"-"+De[e>>16&15|64]+De[e>>24&255]+"-"+De[63&n|128]+De[n>>8&255]+"-"+De[n>>16&255]+De[n>>24&255]+De[255&i]+De[i>>8&255]+De[i>>16&255]+De[i>>24&255];return r.toLowerCase()}function Ue(t,e,n){return Math.max(e,Math.min(n,t))}function ke(t,e){return(t%e+e)%e}function ze(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)}function Fe(t,e,n){return t!==e?(n-t)/(e-t):0}function Be(t,e,n){return(1-n)*t+n*e}function Ve(t,e,n,i){return Be(t,e,1-Math.exp(-n*i))}function He(t,e=1){return e-Math.abs(ke(t,2*e)-e)}function Ge(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function We(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(6*t-15)+10))}function je(t,e){return t+Math.floor(Math.random()*(e-t+1))}function Xe(t,e){return t+Math.random()*(e-t)}function qe(t){return t*(.5-Math.random())}function $e(t){void 0!==t&&(Re=t);let e=Re+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}function Ye(t){return t*Ie}function Ze(t){return t*Oe}function Ke(t){return 0===(t&t-1)&&0!==t}function Je(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Qe(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function tn(t,e,n,i,r){const a=Math.cos,s=Math.sin,o=a(n/2),l=s(n/2),c=a((e+i)/2),u=s((e+i)/2),h=a((e-i)/2),d=s((e-i)/2),p=a((i-e)/2),f=s((i-e)/2);switch(r){case"XYX":t.set(o*u,l*h,l*d,o*c);break;case"YZY":t.set(l*d,o*u,l*h,o*c);break;case"ZXZ":t.set(l*h,l*d,o*u,o*c);break;case"XZX":t.set(o*u,l*f,l*p,o*c);break;case"YXY":t.set(l*p,o*u,l*f,o*c);break;case"ZYZ":t.set(l*f,l*p,o*u,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function en(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function nn(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}var rn=Object.freeze({__proto__:null,DEG2RAD:Ie,RAD2DEG:Oe,generateUUID:Ne,clamp:Ue,euclideanModulo:ke,mapLinear:ze,inverseLerp:Fe,lerp:Be,damp:Ve,pingpong:He,smoothstep:Ge,smootherstep:We,randInt:je,randFloat:Xe,randFloatSpread:qe,seededRandom:$e,degToRad:Ye,radToDeg:Ze,isPowerOfTwo:Ke,ceilPowerOfTwo:Je,floorPowerOfTwo:Qe,setQuaternionFromProperEuler:tn,normalize:nn,denormalize:en});class an{constructor(t=0,e=0){an.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){const t=Math.atan2(-this.y,-this.x)+Math.PI;return t}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*n-a*i+t.x,this.y=r*i+a*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class sn{constructor(){sn.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(t,e,n,i,r,a,s,o,l){const c=this.elements;return c[0]=t,c[1]=i,c[2]=s,c[3]=e,c[4]=r,c[5]=o,c[6]=n,c[7]=a,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,a=n[0],s=n[3],o=n[6],l=n[1],c=n[4],u=n[7],h=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],v=i[1],_=i[4],x=i[7],y=i[2],b=i[5],M=i[8];return r[0]=a*f+s*v+o*y,r[3]=a*m+s*_+o*b,r[6]=a*g+s*x+o*M,r[1]=l*f+c*v+u*y,r[4]=l*m+c*_+u*b,r[7]=l*g+c*x+u*M,r[2]=h*f+d*v+p*y,r[5]=h*m+d*_+p*b,r[8]=h*g+d*x+p*M,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],s=t[5],o=t[6],l=t[7],c=t[8];return e*a*c-e*s*l-n*r*c+n*s*o+i*r*l-i*a*o}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],s=t[5],o=t[6],l=t[7],c=t[8],u=c*a-s*l,h=s*o-c*r,d=l*r-a*o,p=e*u+n*h+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=u*f,t[1]=(i*l-c*n)*f,t[2]=(s*n-i*a)*f,t[3]=h*f,t[4]=(c*e-i*o)*f,t[5]=(i*r-s*e)*f,t[6]=d*f,t[7]=(n*o-l*e)*f,t[8]=(a*e-n*r)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,a,s){const o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*a+l*s)+a+t,-i*l,i*o,-i*(-l*a+o*s)+s+e,0,0,1),this}scale(t,e){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),i=this.elements,r=i[0],a=i[3],s=i[6],o=i[1],l=i[4],c=i[7];return i[0]=e*r+n*o,i[3]=e*a+n*l,i[6]=e*s+n*c,i[1]=-n*r+e*o,i[4]=-n*a+e*l,i[7]=-n*s+e*c,this}translate(t,e){const n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this}equals(t){const e=this.elements,n=t.elements;for(let i=0;i<9;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}function on(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;function ln(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function cn(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function un(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const hn={[we]:{[Se]:cn},[Se]:{[we]:un}},dn={legacyMode:!0,get workingColorSpace(){return Se},set workingColorSpace(t){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(t,e,n){if(this.legacyMode||e===n||!e||!n)return t;if(hn[e]&&void 0!==hn[e][n]){const i=hn[e][n];return t.r=i(t.r),t.g=i(t.g),t.b=i(t.b),t}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)}},pn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},fn={r:0,g:0,b:0},mn={h:0,s:0,l:0},gn={h:0,s:0,l:0};function vn(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function _n(t,e){return e.r=t.r,e.g=t.g,e.b=t.b,e}class xn{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}set(t){return t&&t.isColor?this.copy(t):"number"===typeof t?this.setHex(t):"string"===typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=we){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,dn.toWorkingColorSpace(this,e),this}setRGB(t,e,n,i=Se){return this.r=t,this.g=e,this.b=n,dn.toWorkingColorSpace(this,i),this}setHSL(t,e,n,i=Se){if(t=ke(t,1),e=Ue(e,0,1),n=Ue(n,0,1),0===e)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+e):n+e-n*e,r=2*n-i;this.r=vn(r,i,t+1/3),this.g=vn(r,i,t),this.b=vn(r,i,t-1/3)}return dn.toWorkingColorSpace(this,i),this}setStyle(t,e=we){function n(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const r=i[1],a=i[2];switch(r){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,dn.toWorkingColorSpace(this,e),n(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,dn.toWorkingColorSpace(this,e),n(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){const i=parseFloat(t[1])/360,r=parseFloat(t[2])/100,a=parseFloat(t[3])/100;return n(t[4]),this.setHSL(i,r,a,e)}break}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=i[1],n=t.length;if(3===n)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,dn.toWorkingColorSpace(this,e),this;if(6===n)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,dn.toWorkingColorSpace(this,e),this}return t&&t.length>0?this.setColorName(t,e):this}setColorName(t,e=we){const n=pn[t.toLowerCase()];return void 0!==n?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=cn(t.r),this.g=cn(t.g),this.b=cn(t.b),this}copyLinearToSRGB(t){return this.r=un(t.r),this.g=un(t.g),this.b=un(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=we){return dn.fromWorkingColorSpace(_n(this,fn),t),Ue(255*fn.r,0,255)<<16^Ue(255*fn.g,0,255)<<8^Ue(255*fn.b,0,255)<<0}getHexString(t=we){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Se){dn.fromWorkingColorSpace(_n(this,fn),e);const n=fn.r,i=fn.g,r=fn.b,a=Math.max(n,i,r),s=Math.min(n,i,r);let o,l;const c=(s+a)/2;if(s===a)o=0,l=0;else{const t=a-s;switch(l=c<=.5?t/(a+s):t/(2-a-s),a){case n:o=(i-r)/t+(i2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if("undefined"!==typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&t instanceof ImageBitmap){const e=ln("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),r=i.data;for(let t=0;t1)switch(this.wrapS){case st:t.x=t.x-Math.floor(t.x);break;case ot:t.x=t.x<0?0:1;break;case lt:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case st:t.y=t.y-Math.floor(t.y);break;case ot:t.y=t.y<0?0:1;break;case lt:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}}Tn.DEFAULT_IMAGE=null,Tn.DEFAULT_MAPPING=tt;class En{constructor(t=0,e=0,n=0,i=1){En.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}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=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(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}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(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}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*e+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*e+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*e+a[7]*n+a[11]*i+a[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r;const a=.01,s=.1,o=t.elements,l=o[0],c=o[4],u=o[8],h=o[1],d=o[5],p=o[9],f=o[2],m=o[6],g=o[10];if(Math.abs(c-h)o&&t>v?tv?o=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),a=Math.atan2(r,e*n);t=Math.sin(t*a)/r,s=Math.sin(s*a)/r}const r=s*n;if(o=o*t+h*r,l=l*t+d*r,c=c*t+p*r,u=u*t+f*r,t===1-s){const t=1/Math.sqrt(o*o+l*l+c*c+u*u);o*=t,l*=t,c*=t,u*=t}}t[e]=o,t[e+1]=l,t[e+2]=c,t[e+3]=u}static multiplyQuaternionsFlat(t,e,n,i,r,a){const s=n[i],o=n[i+1],l=n[i+2],c=n[i+3],u=r[a],h=r[a+1],d=r[a+2],p=r[a+3];return t[e]=s*p+c*u+o*d-l*h,t[e+1]=o*p+c*h+l*u-s*d,t[e+2]=l*p+c*d+s*h-o*u,t[e+3]=c*p-s*u-o*h-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),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._onChangeCallback(),this}setFromEuler(t,e){const n=t._x,i=t._y,r=t._z,a=t._order,s=Math.cos,o=Math.sin,l=s(n/2),c=s(i/2),u=s(r/2),h=o(n/2),d=o(i/2),p=o(r/2);switch(a){case"XYZ":this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p;break;case"YXZ":this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p;break;case"ZXY":this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p;break;case"ZYX":this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p;break;case"YZX":this._x=h*c*u+l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u-h*d*p;break;case"XZY":this._x=h*c*u-l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],a=e[1],s=e[5],o=e[9],l=e[2],c=e[6],u=e[10],h=n+s+u;if(h>0){const t=.5/Math.sqrt(h+1);this._w=.25/t,this._x=(c-o)*t,this._y=(r-l)*t,this._z=(a-i)*t}else if(n>s&&n>u){const t=2*Math.sqrt(1+n-s-u);this._w=(c-o)/t,this._x=.25*t,this._y=(i+a)/t,this._z=(r+l)/t}else if(s>u){const t=2*Math.sqrt(1+s-n-u);this._w=(r-l)/t,this._x=(i+a)/t,this._y=.25*t,this._z=(o+c)/t}else{const t=2*Math.sqrt(1+u-n-s);this._w=(a-i)/t,this._x=(r+l)/t,this._y=(o+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return nMath.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Ue(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,r=t._z,a=t._w,s=e._x,o=e._y,l=e._z,c=e._w;return this._x=n*c+a*s+i*l-r*o,this._y=i*c+a*o+r*s-n*l,this._z=r*c+a*l+n*o-i*s,this._w=a*c-n*s-i*o-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,a=this._w;let s=a*t._w+n*t._x+i*t._y+r*t._z;if(s<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),s>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;const o=1-s*s;if(o<=Number.EPSILON){const t=1-e;return this._w=t*a+e*this._w,this._x=t*n+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(o),c=Math.atan2(l,s),u=Math.sin((1-e)*c)/l,h=Math.sin(e*c)/l;return this._w=a*u+this._w*h,this._x=n*u+this._x*h,this._y=i*u+this._y*h,this._z=r*u+this._z*h,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=Math.random(),e=Math.sqrt(1-t),n=Math.sqrt(t),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(e*Math.cos(i),n*Math.sin(r),n*Math.cos(r),e*Math.sin(i))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Dn{constructor(t=0,e=0,n=0){Dn.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}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}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(In.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(In.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,a=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,a=t.y,s=t.z,o=t.w,l=o*e+a*i-s*n,c=o*n+s*e-r*i,u=o*i+r*n-a*e,h=-r*e-a*n-s*i;return this.x=l*o+h*-r+c*-s-u*-a,this.y=c*o+h*-a+u*-r-l*-s,this.z=u*o+h*-s+l*-a-c*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,r=t.z,a=e.x,s=e.y,o=e.z;return this.x=i*o-r*s,this.y=r*a-n*o,this.z=n*s-i*a,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Rn.copy(this).projectOnVector(t),this.sub(Rn)}reflect(t){return this.sub(Rn.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Ue(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,n=Math.sqrt(1-t**2);return this.x=n*Math.cos(e),this.y=n*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Rn=new Dn,In=new Pn;class On{constructor(t=new Dn(1/0,1/0,1/0),e=new Dn(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,s=-1/0;for(let o=0,l=t.length;or&&(r=l),c>a&&(a=c),u>s&&(s=u)}return this.min.set(e,n,i),this.max.set(r,a,s),this}setFromBufferAttribute(t){let e=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,s=-1/0;for(let o=0,l=t.count;or&&(r=l),c>a&&(a=c),u>s&&(s=u)}return this.min.set(e,n,i),this.max.set(r,a,s),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Un),Un.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Wn),jn.subVectors(this.max,Wn),zn.subVectors(t.a,Wn),Fn.subVectors(t.b,Wn),Bn.subVectors(t.c,Wn),Vn.subVectors(Fn,zn),Hn.subVectors(Bn,Fn),Gn.subVectors(zn,Bn);let e=[0,-Vn.z,Vn.y,0,-Hn.z,Hn.y,0,-Gn.z,Gn.y,Vn.z,0,-Vn.x,Hn.z,0,-Hn.x,Gn.z,0,-Gn.x,-Vn.y,Vn.x,0,-Hn.y,Hn.x,0,-Gn.y,Gn.x,0];return!!$n(e,zn,Fn,Bn,jn)&&(e=[1,0,0,0,1,0,0,0,1],!!$n(e,zn,Fn,Bn,jn)&&(Xn.crossVectors(Vn,Hn),e=[Xn.x,Xn.y,Xn.z],$n(e,zn,Fn,Bn,jn)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){const e=Un.copy(t).clamp(this.min,this.max);return e.sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(Un).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Nn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Nn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Nn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Nn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Nn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Nn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Nn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Nn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Nn)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Nn=[new Dn,new Dn,new Dn,new Dn,new Dn,new Dn,new Dn,new Dn],Un=new Dn,kn=new On,zn=new Dn,Fn=new Dn,Bn=new Dn,Vn=new Dn,Hn=new Dn,Gn=new Dn,Wn=new Dn,jn=new Dn,Xn=new Dn,qn=new Dn;function $n(t,e,n,i,r){for(let a=0,s=t.length-3;a<=s;a+=3){qn.fromArray(t,a);const s=r.x*Math.abs(qn.x)+r.y*Math.abs(qn.y)+r.z*Math.abs(qn.z),o=e.dot(qn),l=n.dot(qn),c=i.dot(qn);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>s)return!1}return!0}const Yn=new On,Zn=new Dn,Kn=new Dn,Jn=new Dn;class Qn{constructor(t=new Dn,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):Yn.setFromPoints(t).getCenter(n);let i=0;for(let r=0,a=t.length;rthis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){Jn.subVectors(t,this.center);const e=Jn.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.add(Jn.multiplyScalar(n/t)),this.radius+=n}return this}union(t){return!0===this.center.equals(t.center)?Kn.set(0,0,1).multiplyScalar(t.radius):Kn.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(Zn.copy(t.center).add(Kn)),this.expandByPoint(Zn.copy(t.center).sub(Kn)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const ti=new Dn,ei=new Dn,ni=new Dn,ii=new Dn,ri=new Dn,ai=new Dn,si=new Dn;class oi{constructor(t=new Dn,e=new Dn(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,ti)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=ti.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(ti.copy(this.direction).multiplyScalar(e).add(this.origin),ti.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){ei.copy(t).add(e).multiplyScalar(.5),ni.copy(e).sub(t).normalize(),ii.copy(this.origin).sub(ei);const r=.5*t.distanceTo(e),a=-this.direction.dot(ni),s=ii.dot(this.direction),o=-ii.dot(ni),l=ii.lengthSq(),c=Math.abs(1-a*a);let u,h,d,p;if(c>0)if(u=a*o-s,h=a*s-o,p=r*c,u>=0)if(h>=-p)if(h<=p){const t=1/c;u*=t,h*=t,d=u*(u+a*h+2*s)+h*(a*u+h+2*o)+l}else h=r,u=Math.max(0,-(a*h+s)),d=-u*u+h*(h+2*o)+l;else h=-r,u=Math.max(0,-(a*h+s)),d=-u*u+h*(h+2*o)+l;else h<=-p?(u=Math.max(0,-(-a*r+s)),h=u>0?-r:Math.min(Math.max(-r,-o),r),d=-u*u+h*(h+2*o)+l):h<=p?(u=0,h=Math.min(Math.max(-r,-o),r),d=h*(h+2*o)+l):(u=Math.max(0,-(a*r+s)),h=u>0?r:Math.min(Math.max(-r,-o),r),d=-u*u+h*(h+2*o)+l);else h=a>0?-r:r,u=Math.max(0,-(a*h+s)),d=-u*u+h*(h+2*o)+l;return n&&n.copy(this.direction).multiplyScalar(u).add(this.origin),i&&i.copy(ni).multiplyScalar(h).add(ei),d}intersectSphere(t,e){ti.subVectors(t.center,this.origin);const n=ti.dot(this.direction),i=ti.dot(ti)-n*n,r=t.radius*t.radius;if(i>r)return null;const a=Math.sqrt(r-i),s=n-a,o=n+a;return s<0&&o<0?null:s<0?this.at(o,e):this.at(s,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;const n=t.normal.dot(this.direction);return n*e<0}intersectBox(t,e){let n,i,r,a,s,o;const l=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,h=this.origin;return l>=0?(n=(t.min.x-h.x)*l,i=(t.max.x-h.x)*l):(n=(t.max.x-h.x)*l,i=(t.min.x-h.x)*l),c>=0?(r=(t.min.y-h.y)*c,a=(t.max.y-h.y)*c):(r=(t.max.y-h.y)*c,a=(t.min.y-h.y)*c),n>a||r>i?null:((r>n||n!==n)&&(n=r),(a=0?(s=(t.min.z-h.z)*u,o=(t.max.z-h.z)*u):(s=(t.max.z-h.z)*u,o=(t.min.z-h.z)*u),n>o||s>i?null:((s>n||n!==n)&&(n=s),(o=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,ti)}intersectTriangle(t,e,n,i,r){ri.subVectors(e,t),ai.subVectors(n,t),si.crossVectors(ri,ai);let a,s=this.direction.dot(si);if(s>0){if(i)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}ii.subVectors(this.origin,t);const o=a*this.direction.dot(ai.crossVectors(ii,ai));if(o<0)return null;const l=a*this.direction.dot(ri.cross(ii));if(l<0)return null;if(o+l>s)return null;const c=-a*ii.dot(si);return c<0?null:this.at(c/s,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class li{constructor(){li.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(t,e,n,i,r,a,s,o,l,c,u,h,d,p,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=c,g[10]=u,g[14]=h,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new li).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/ci.setFromMatrixColumn(t,0).length(),r=1/ci.setFromMatrixColumn(t,1).length(),a=1/ci.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*a,e[9]=n[9]*a,e[10]=n[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,n=t.x,i=t.y,r=t.z,a=Math.cos(n),s=Math.sin(n),o=Math.cos(i),l=Math.sin(i),c=Math.cos(r),u=Math.sin(r);if("XYZ"===t.order){const t=a*c,n=a*u,i=s*c,r=s*u;e[0]=o*c,e[4]=-o*u,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-s*o,e[2]=r-t*l,e[6]=i+n*l,e[10]=a*o}else if("YXZ"===t.order){const t=o*c,n=o*u,i=l*c,r=l*u;e[0]=t+r*s,e[4]=i*s-n,e[8]=a*l,e[1]=a*u,e[5]=a*c,e[9]=-s,e[2]=n*s-i,e[6]=r+t*s,e[10]=a*o}else if("ZXY"===t.order){const t=o*c,n=o*u,i=l*c,r=l*u;e[0]=t-r*s,e[4]=-a*u,e[8]=i+n*s,e[1]=n+i*s,e[5]=a*c,e[9]=r-t*s,e[2]=-a*l,e[6]=s,e[10]=a*o}else if("ZYX"===t.order){const t=a*c,n=a*u,i=s*c,r=s*u;e[0]=o*c,e[4]=i*l-n,e[8]=t*l+r,e[1]=o*u,e[5]=r*l+t,e[9]=n*l-i,e[2]=-l,e[6]=s*o,e[10]=a*o}else if("YZX"===t.order){const t=a*o,n=a*l,i=s*o,r=s*l;e[0]=o*c,e[4]=r-t*u,e[8]=i*u+n,e[1]=u,e[5]=a*c,e[9]=-s*c,e[2]=-l*c,e[6]=n*u+i,e[10]=t-r*u}else if("XZY"===t.order){const t=a*o,n=a*l,i=s*o,r=s*l;e[0]=o*c,e[4]=-u,e[8]=l*c,e[1]=t*u+r,e[5]=a*c,e[9]=n*u-i,e[2]=i*u-n,e[6]=s*c,e[10]=r*u+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(hi,t,di)}lookAt(t,e,n){const i=this.elements;return mi.subVectors(t,e),0===mi.lengthSq()&&(mi.z=1),mi.normalize(),pi.crossVectors(n,mi),0===pi.lengthSq()&&(1===Math.abs(n.z)?mi.x+=1e-4:mi.z+=1e-4,mi.normalize(),pi.crossVectors(n,mi)),pi.normalize(),fi.crossVectors(mi,pi),i[0]=pi.x,i[4]=fi.x,i[8]=mi.x,i[1]=pi.y,i[5]=fi.y,i[9]=mi.y,i[2]=pi.z,i[6]=fi.z,i[10]=mi.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,a=n[0],s=n[4],o=n[8],l=n[12],c=n[1],u=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],_=n[7],x=n[11],y=n[15],b=i[0],M=i[4],w=i[8],S=i[12],T=i[1],E=i[5],A=i[9],C=i[13],L=i[2],P=i[6],D=i[10],R=i[14],I=i[3],O=i[7],N=i[11],U=i[15];return r[0]=a*b+s*T+o*L+l*I,r[4]=a*M+s*E+o*P+l*O,r[8]=a*w+s*A+o*D+l*N,r[12]=a*S+s*C+o*R+l*U,r[1]=c*b+u*T+h*L+d*I,r[5]=c*M+u*E+h*P+d*O,r[9]=c*w+u*A+h*D+d*N,r[13]=c*S+u*C+h*R+d*U,r[2]=p*b+f*T+m*L+g*I,r[6]=p*M+f*E+m*P+g*O,r[10]=p*w+f*A+m*D+g*N,r[14]=p*S+f*C+m*R+g*U,r[3]=v*b+_*T+x*L+y*I,r[7]=v*M+_*E+x*P+y*O,r[11]=v*w+_*A+x*D+y*N,r[15]=v*S+_*C+x*R+y*U,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],a=t[1],s=t[5],o=t[9],l=t[13],c=t[2],u=t[6],h=t[10],d=t[14],p=t[3],f=t[7],m=t[11],g=t[15];return p*(+r*o*u-i*l*u-r*s*h+n*l*h+i*s*d-n*o*d)+f*(+e*o*d-e*l*h+r*a*h-i*a*d+i*l*c-r*o*c)+m*(+e*l*u-e*s*d-r*a*u+n*a*d+r*s*c-n*l*c)+g*(-i*s*c-e*o*u+e*s*h+i*a*u-n*a*h+n*o*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],s=t[5],o=t[6],l=t[7],c=t[8],u=t[9],h=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],v=u*m*l-f*h*l+f*o*d-s*m*d-u*o*g+s*h*g,_=p*h*l-c*m*l-p*o*d+a*m*d+c*o*g-a*h*g,x=c*f*l-p*u*l+p*s*d-a*f*d-c*s*g+a*u*g,y=p*u*o-c*f*o-p*s*h+a*f*h+c*s*m-a*u*m,b=e*v+n*_+i*x+r*y;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const M=1/b;return t[0]=v*M,t[1]=(f*h*r-u*m*r-f*i*d+n*m*d+u*i*g-n*h*g)*M,t[2]=(s*m*r-f*o*r+f*i*l-n*m*l-s*i*g+n*o*g)*M,t[3]=(u*o*r-s*h*r-u*i*l+n*h*l+s*i*d-n*o*d)*M,t[4]=_*M,t[5]=(c*m*r-p*h*r+p*i*d-e*m*d-c*i*g+e*h*g)*M,t[6]=(p*o*r-a*m*r-p*i*l+e*m*l+a*i*g-e*o*g)*M,t[7]=(a*h*r-c*o*r+c*i*l-e*h*l-a*i*d+e*o*d)*M,t[8]=x*M,t[9]=(p*u*r-c*f*r-p*n*d+e*f*d+c*n*g-e*u*g)*M,t[10]=(a*f*r-p*s*r+p*n*l-e*f*l-a*n*g+e*s*g)*M,t[11]=(c*s*r-a*u*r-c*n*l+e*u*l+a*n*d-e*s*d)*M,t[12]=y*M,t[13]=(c*f*i-p*u*i+p*n*h-e*f*h-c*n*m+e*u*m)*M,t[14]=(p*s*i-a*f*i-p*n*o+e*f*o+a*n*m-e*s*m)*M,t[15]=(a*u*i-c*s*i+c*n*o-e*u*o-a*n*h+e*s*h)*M,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),r=1-n,a=t.x,s=t.y,o=t.z,l=r*a,c=r*s;return this.set(l*a+n,l*s-i*o,l*o+i*s,0,l*s+i*o,c*s+n,c*o-i*a,0,l*o-i*s,c*o+i*a,r*o*o+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,r,a){return this.set(1,n,r,0,t,1,a,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,a=e._y,s=e._z,o=e._w,l=r+r,c=a+a,u=s+s,h=r*l,d=r*c,p=r*u,f=a*c,m=a*u,g=s*u,v=o*l,_=o*c,x=o*u,y=n.x,b=n.y,M=n.z;return i[0]=(1-(f+g))*y,i[1]=(d+x)*y,i[2]=(p-_)*y,i[3]=0,i[4]=(d-x)*b,i[5]=(1-(h+g))*b,i[6]=(m+v)*b,i[7]=0,i[8]=(p+_)*M,i[9]=(m-v)*M,i[10]=(1-(h+f))*M,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let r=ci.set(i[0],i[1],i[2]).length();const a=ci.set(i[4],i[5],i[6]).length(),s=ci.set(i[8],i[9],i[10]).length(),o=this.determinant();o<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],ui.copy(this);const l=1/r,c=1/a,u=1/s;return ui.elements[0]*=l,ui.elements[1]*=l,ui.elements[2]*=l,ui.elements[4]*=c,ui.elements[5]*=c,ui.elements[6]*=c,ui.elements[8]*=u,ui.elements[9]*=u,ui.elements[10]*=u,e.setFromRotationMatrix(ui),n.x=r,n.y=a,n.z=s,this}makePerspective(t,e,n,i,r,a){const s=this.elements,o=2*r/(e-t),l=2*r/(n-i),c=(e+t)/(e-t),u=(n+i)/(n-i),h=-(a+r)/(a-r),d=-2*a*r/(a-r);return s[0]=o,s[4]=0,s[8]=c,s[12]=0,s[1]=0,s[5]=l,s[9]=u,s[13]=0,s[2]=0,s[6]=0,s[10]=h,s[14]=d,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(t,e,n,i,r,a){const s=this.elements,o=1/(e-t),l=1/(n-i),c=1/(a-r),u=(e+t)*o,h=(n+i)*l,d=(a+r)*c;return s[0]=2*o,s[4]=0,s[8]=0,s[12]=-u,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-h,s[2]=0,s[6]=0,s[10]=-2*c,s[14]=-d,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let i=0;i<16;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}const ci=new Dn,ui=new li,hi=new Dn(0,0,0),di=new Dn(1,1,1),pi=new Dn,fi=new Dn,mi=new Dn,gi=new li,vi=new Pn;class _i{constructor(t=0,e=0,n=0,i=_i.DefaultOrder){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const i=t.elements,r=i[0],a=i[4],s=i[8],o=i[1],l=i[5],c=i[9],u=i[2],h=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(Ue(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Ue(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(Ue(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-Ue(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(Ue(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-Ue(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return gi.makeRotationFromQuaternion(t),this.setFromRotationMatrix(gi,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return vi.setFromEuler(this),this.setFromQuaternion(vi,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}toVector3(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")}}_i.DefaultOrder="XYZ",_i.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class xi{constructor(){this.mask=1}set(t){this.mask=(1<>>0}enable(t){this.mask|=1<1){for(let t=0;t1){for(let t=0;t0){i.children=[];for(let e=0;e0){i.animations=[];for(let e=0;e0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),s.length>0&&(n.images=s),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),u.length>0&&(n.nodes=u)}return n.object=i,n;function a(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let n=0;n0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){Oi.subVectors(i,e),Ni.subVectors(n,e),Ui.subVectors(t,e);const a=Oi.dot(Oi),s=Oi.dot(Ni),o=Oi.dot(Ui),l=Ni.dot(Ni),c=Ni.dot(Ui),u=a*l-s*s;if(0===u)return r.set(-2,-1,-1);const h=1/u,d=(l*o-s*c)*h,p=(a*c-s*o)*h;return r.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,ki),ki.x>=0&&ki.y>=0&&ki.x+ki.y<=1}static getUV(t,e,n,i,r,a,s,o){return this.getBarycoord(t,e,n,i,ki),o.set(0,0),o.addScaledVector(r,ki.x),o.addScaledVector(a,ki.y),o.addScaledVector(s,ki.z),o}static isFrontFacing(t,e,n,i){return Oi.subVectors(n,e),Ni.subVectors(t,e),Oi.cross(Ni).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Oi.subVectors(this.c,this.b),Ni.subVectors(this.a,this.b),.5*Oi.cross(Ni).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Wi.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Wi.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,i,r){return Wi.getUV(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return Wi.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Wi.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let a,s;zi.subVectors(i,n),Fi.subVectors(r,n),Vi.subVectors(t,n);const o=zi.dot(Vi),l=Fi.dot(Vi);if(o<=0&&l<=0)return e.copy(n);Hi.subVectors(t,i);const c=zi.dot(Hi),u=Fi.dot(Hi);if(c>=0&&u<=c)return e.copy(i);const h=o*u-c*l;if(h<=0&&o>=0&&c<=0)return a=o/(o-c),e.copy(n).addScaledVector(zi,a);Gi.subVectors(t,r);const d=zi.dot(Gi),p=Fi.dot(Gi);if(p>=0&&d<=p)return e.copy(r);const f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return s=l/(l-p),e.copy(n).addScaledVector(Fi,s);const m=c*p-d*u;if(m<=0&&u-c>=0&&d-p>=0)return Bi.subVectors(r,i),s=(u-c)/(u-c+(d-p)),e.copy(i).addScaledVector(Bi,s);const g=1/(m+f+h);return a=f*g,s=h*g,e.copy(n).addScaledVector(zi,a).addScaledVector(Fi,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let ji=0;class Xi extends Pe{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:ji++}),this.uuid=Ne(),this.name="",this.type="Material",this.blending=g,this.side=d,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=P,this.blendDst=D,this.blendEquation=b,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=B,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Ee,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Te,this.stencilZFail=Te,this.stencilZPass=Te,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!==t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}const i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}}toJSON(t){const e=void 0===t||"string"===typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==g&&(n.blending=this.blending),this.side!==d&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(n.textures=e),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let i=0;i!==t;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}class qi extends Xi{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new xn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=j,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const $i=new Dn,Yi=new an;class Zi{constructor(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.usage=Ae,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;i0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const o in n){const e=n[o];t.data.attributes[o]=e.toJSON(t.data)}const i={};let r=!1;for(const o in this.morphAttributes){const e=this.morphAttributes[o],n=[];for(let i=0,r=e.length;i0&&(i[o]=n,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));const s=this.boundingSphere;return null!==s&&(t.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const i=t.attributes;for(const l in i){const t=i[l];this.setAttribute(l,t.clone(e))}const r=t.morphAttributes;for(const l in r){const t=[],n=r[l];for(let i=0,r=n.length;i0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;en.far?null:{distance:c,point:Sr.clone(),object:t}}function Ar(t,e,n,i,r,a,s,o,l,c,u,h){hr.fromBufferAttribute(r,c),dr.fromBufferAttribute(r,u),pr.fromBufferAttribute(r,h);const d=t.morphTargetInfluences;if(a&&d){vr.set(0,0,0),_r.set(0,0,0),xr.set(0,0,0);for(let t=0,e=a.length;t0?1:-1,c.push(A.x,A.y,A.z),u.push(o/m),u.push(1-s/g),T+=1}}for(let s=0;s0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const i in this.extensions)!0===this.extensions[i]&&(n[i]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}class Ur extends Ii{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new li,this.projectionMatrix=new li,this.projectionMatrixInverse=new li}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}class kr extends Ur{constructor(t=50,e=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*Oe*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*Ie*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*Oe*Math.atan(Math.tan(.5*Ie*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,n,i,r,a){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*Ie*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const a=this.view;if(null!==this.view&&this.view.enabled){const t=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/t,e-=a.offsetY*n/s,i*=a.width/t,n*=a.height/s}const s=this.filmOffset;0!==s&&(r+=t*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const zr=90,Fr=1;class Br extends Ii{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n;const i=new kr(zr,Fr,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new Dn(1,0,0)),this.add(i);const r=new kr(zr,Fr,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new Dn(-1,0,0)),this.add(r);const a=new kr(zr,Fr,t,e);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new Dn(0,1,0)),this.add(a);const s=new kr(zr,Fr,t,e);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(new Dn(0,-1,0)),this.add(s);const o=new kr(zr,Fr,t,e);o.layers=this.layers,o.up.set(0,-1,0),o.lookAt(new Dn(0,0,1)),this.add(o);const l=new kr(zr,Fr,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new Dn(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[i,r,a,s,o,l]=this.children,c=t.getRenderTarget(),u=t.toneMapping,h=t.xr.enabled;t.toneMapping=$,t.xr.enabled=!1;const d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,i),t.setRenderTarget(n,1),t.render(e,r),t.setRenderTarget(n,2),t.render(e,a),t.setRenderTarget(n,3),t.render(e,s),t.setRenderTarget(n,4),t.render(e,o),n.texture.generateMipmaps=d,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(c),t.toneMapping=u,t.xr.enabled=h,n.texture.needsPMREMUpdate=!0}}class Vr extends Tn{constructor(t,e,n,i,r,a,s,o,l,c){t=void 0!==t?t:[],e=void 0!==e?e:et,super(t,e,n,i,r,a,s,o,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class Hr extends An{constructor(t,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const n={width:t,height:t,depth:1},i=[n,n,n,n,n,n];this.texture=new Vr(i,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:dt}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},i=new Cr(5,5,5),r=new Nr({name:"CubemapFromEquirect",uniforms:Lr(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:p,blending:m});r.uniforms.tEquirect.value=e;const a=new Tr(i,r),s=e.minFilter;e.minFilter===ft&&(e.minFilter=dt);const o=new Br(1,10,this);return o.update(t,a),e.minFilter=s,a.geometry.dispose(),a.material.dispose(),this}clear(t,e,n,i){const r=t.getRenderTarget();for(let a=0;a<6;a++)t.setRenderTarget(this,a),t.clear(e,n,i);t.setRenderTarget(r)}}const Gr=new Dn,Wr=new Dn,jr=new sn;class Xr{constructor(t=new Dn(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=Gr.subVectors(n,e).cross(Wr.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){const n=t.delta(Gr),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(n).multiplyScalar(r).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||jr.getNormalMatrix(t),i=this.coplanarPoint(Gr).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const qr=new Qn,$r=new Dn;class Yr{constructor(t=new Xr,e=new Xr,n=new Xr,i=new Xr,r=new Xr,a=new Xr){this.planes=[t,e,n,i,r,a]}set(t,e,n,i,r,a){const s=this.planes;return s[0].copy(t),s[1].copy(e),s[2].copy(n),s[3].copy(i),s[4].copy(r),s[5].copy(a),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t){const e=this.planes,n=t.elements,i=n[0],r=n[1],a=n[2],s=n[3],o=n[4],l=n[5],c=n[6],u=n[7],h=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],v=n[14],_=n[15];return e[0].setComponents(s-i,u-o,f-h,_-m).normalize(),e[1].setComponents(s+i,u+o,f+h,_+m).normalize(),e[2].setComponents(s+r,u+l,f+d,_+g).normalize(),e[3].setComponents(s-r,u-l,f-d,_-g).normalize(),e[4].setComponents(s-a,u-c,f-p,_-v).normalize(),e[5].setComponents(s+a,u+c,f+p,_+v).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),qr.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(qr)}intersectsSprite(t){return qr.center.set(0,0,0),qr.radius=.7071067811865476,qr.applyMatrix4(t.matrixWorld),this.intersectsSphere(qr)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let r=0;r<6;r++){const t=e[r].distanceToPoint(n);if(t0?t.max.x:t.min.x,$r.y=i.normal.y>0?t.max.y:t.min.y,$r.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint($r)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function Zr(){let t=null,e=!1,n=null,i=null;function r(e,a){n(e,a),i=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function Kr(t,e){const n=e.isWebGL2,i=new WeakMap;function r(e,i){const r=e.array,a=e.usage,s=t.createBuffer();let o;if(t.bindBuffer(i,s),t.bufferData(i,r,a),e.onUploadCallback(),r instanceof Float32Array)o=5126;else if(r instanceof Uint16Array)if(e.isFloat16BufferAttribute){if(!n)throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");o=5131}else o=5123;else if(r instanceof Int16Array)o=5122;else if(r instanceof Uint32Array)o=5125;else if(r instanceof Int32Array)o=5124;else if(r instanceof Int8Array)o=5120;else if(r instanceof Uint8Array)o=5121;else{if(!(r instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+r);o=5121}return{buffer:s,type:o,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version}}function a(e,i,r){const a=i.array,s=i.updateRange;t.bindBuffer(r,e),-1===s.count?t.bufferSubData(r,0,a):(n?t.bufferSubData(r,s.offset*a.BYTES_PER_ELEMENT,a,s.offset,s.count):t.bufferSubData(r,s.offset*a.BYTES_PER_ELEMENT,a.subarray(s.offset,s.offset+s.count)),s.count=-1)}function s(t){return t.isInterleavedBufferAttribute&&(t=t.data),i.get(t)}function o(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=i.get(e);n&&(t.deleteBuffer(n.buffer),i.delete(e))}function l(t,e){if(t.isGLBufferAttribute){const e=i.get(t);return void((!e||e.version=0){const e=r[l];let n=a[l];if(void 0===n&&("instanceMatrix"===l&&t.instanceMatrix&&(n=t.instanceMatrix),"instanceColor"===l&&t.instanceColor&&(n=t.instanceColor)),void 0===e)return!0;if(e.attribute!==n)return!0;if(n&&e.data!==n.data)return!0;s++}}return c.attributesNum!==s||c.index!==i}function _(t,e,n,i){const r={},a=e.attributes;let s=0;const o=n.getAttributes();for(const l in o){const e=o[l];if(e.location>=0){let e=a[l];void 0===e&&("instanceMatrix"===l&&t.instanceMatrix&&(e=t.instanceMatrix),"instanceColor"===l&&t.instanceColor&&(e=t.instanceColor));const n={};n.attribute=e,e&&e.data&&(n.data=e.data),r[l]=n,s++}}c.attributes=r,c.attributesNum=s,c.index=i}function x(){const t=c.newAttributes;for(let e=0,n=t.length;e=0){let a=l[e];if(void 0===a&&("instanceMatrix"===e&&r.instanceMatrix&&(a=r.instanceMatrix),"instanceColor"===e&&r.instanceColor&&(a=r.instanceColor)),void 0!==a){const e=a.normalized,s=a.itemSize,l=n.get(a);if(void 0===l)continue;const c=l.buffer,u=l.type,h=l.bytesPerElement;if(a.isInterleavedBufferAttribute){const n=a.data,l=n.stride,d=a.offset;if(n.isInstancedInterleavedBuffer){for(let t=0;t0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const s="undefined"!==typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!==typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let o=void 0!==n.precision?n.precision:"highp";const l=a(o);l!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",l,"instead."),o=l);const c=s||e.has("WEBGL_draw_buffers"),u=!0===n.logarithmicDepthBuffer,h=t.getParameter(34930),d=t.getParameter(35660),p=t.getParameter(3379),f=t.getParameter(34076),m=t.getParameter(34921),g=t.getParameter(36347),v=t.getParameter(36348),_=t.getParameter(36349),x=d>0,y=s||e.has("OES_texture_float"),b=x&&y,M=s?t.getParameter(36183):0;return{isWebGL2:s,drawBuffers:c,getMaxAnisotropy:r,getMaxPrecision:a,precision:o,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:d,maxTextureSize:p,maxCubemapSize:f,maxAttributes:m,maxVertexUniforms:g,maxVaryings:v,maxFragmentUniforms:_,vertexTextures:x,floatFragmentTextures:y,floatVertexTextures:b,maxSamples:M}}function ko(t){const e=this;let n=null,i=0,r=!1,a=!1;const s=new Xr,o=new sn,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(t,n,i,r){const a=null!==t?t.length:0;let c=null;if(0!==a){if(c=l.value,!0!==r||null===c){const e=i+4*a,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===c||c.length0){const s=new Hr(a.height/2);return s.fromEquirectangularTexture(t,i),e.set(i,s),i.addEventListener("dispose",r),n(s.texture,i.mapping)}return null}}}return i}function r(t){const n=t.target;n.removeEventListener("dispose",r);const i=e.get(n);void 0!==i&&(e.delete(n),i.dispose())}function a(){e=new WeakMap}return{get:i,dispose:a}}Ro.physical={uniforms:Pr([Ro.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new an(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new xn(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new an},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new xn(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new xn(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Po.meshphysical_vert,fragmentShader:Po.meshphysical_frag};class Fo extends Ur{constructor(t=-1,e=1,n=1,i=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,n,i,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,a=n+t,s=i+e,o=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,a=r+t*this.view.width,s-=e*this.view.offsetY,o=s-e*this.view.height}this.projectionMatrix.makeOrthographic(r,a,s,o,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}const Bo=4,Vo=[.125,.215,.35,.446,.526,.582],Ho=20,Go=new Fo,Wo=new xn;let jo=null;const Xo=(1+Math.sqrt(5))/2,qo=1/Xo,$o=[new Dn(1,1,1),new Dn(-1,1,1),new Dn(1,1,-1),new Dn(-1,1,-1),new Dn(0,Xo,qo),new Dn(0,Xo,-qo),new Dn(qo,0,Xo),new Dn(-qo,0,Xo),new Dn(Xo,qo,0),new Dn(-Xo,qo,0)];class Yo{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){jo=this._renderer.getRenderTarget(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,n,i,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=el(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=tl(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;t2?n:0,n,n),c.setRenderTarget(i),m&&c.render(f,s),c.render(t,s)}f.geometry.dispose(),f.material.dispose(),c.toneMapping=h,c.autoClear=u,t.background=g}_textureToCubeUV(t,e){const n=this._renderer,i=t.mapping===et||t.mapping===nt;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=el()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=tl());const r=i?this._cubemapMaterial:this._equirectMaterial,a=new Tr(this._lodPlanes[0],r),s=r.uniforms;s["envMap"].value=t;const o=this._cubeSize;Jo(e,0,0,3*o,2*o),n.setRenderTarget(e),n.render(a,Go)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let i=1;iHo&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Ho}`);const g=[];let v=0;for(let M=0;M_-Bo?i-_+Bo:0),b=4*(this._cubeSize-x);Jo(e,y,b,3*x,2*x),o.setRenderTarget(e),o.render(u,Go)}}function Zo(t){const e=[],n=[],i=[];let r=t;const a=t-Bo+1+Vo.length;for(let s=0;st-Bo?o=Vo[s-t+Bo-1]:0===s&&(o=0),i.push(o);const l=1/(a-2),c=-l,u=1+l,h=[c,c,u,c,u,u,c,c,u,u,c,u],d=6,p=6,f=3,m=2,g=1,v=new Float32Array(f*p*d),_=new Float32Array(m*p*d),x=new Float32Array(g*p*d);for(let t=0;t2?0:-1,i=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];v.set(i,f*p*t),_.set(h,m*p*t);const r=[t,t,t,t,t,t];x.set(r,g*p*t)}const y=new or;y.setAttribute("position",new Zi(v,f)),y.setAttribute("uv",new Zi(_,m)),y.setAttribute("faceIndex",new Zi(x,g)),e.push(y),r>Bo&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}function Ko(t,e,n){const i=new An(t,e,n);return i.texture.mapping=at,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Jo(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function Qo(t,e,n){const i=new Float32Array(Ho),r=new Dn(0,1,0),a=new Nr({name:"SphericalGaussianBlur",defines:{n:Ho,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:t+".0"},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:nl(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:m,depthTest:!1,depthWrite:!1});return a}function tl(){return new Nr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:nl(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:m,depthTest:!1,depthWrite:!1})}function el(){return new Nr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:nl(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:m,depthTest:!1,depthWrite:!1})}function nl(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function il(t){let e=new WeakMap,n=null;function i(i){if(i&&i.isTexture){const s=i.mapping,o=s===it||s===rt,l=s===et||s===nt;if(o||l){if(i.isRenderTargetTexture&&!0===i.needsPMREMUpdate){i.needsPMREMUpdate=!1;let r=e.get(i);return null===n&&(n=new Yo(t)),r=o?n.fromEquirectangular(i,r):n.fromCubemap(i,r),e.set(i,r),r.texture}if(e.has(i))return e.get(i).texture;{const s=i.image;if(o&&s&&s.height>0||l&&s&&r(s)){null===n&&(n=new Yo(t));const r=o?n.fromEquirectangular(i):n.fromCubemap(i);return e.set(i,r),i.addEventListener("dispose",a),r.texture}return null}}}return i}function r(t){let e=0;const n=6;for(let i=0;ie.maxTextureSize&&(m=Math.ceil(f/e.maxTextureSize),f=e.maxTextureSize);const g=new Float32Array(f*m*4*r),v=new Cn(g,f,m,r);v.type=bt,v.needsUpdate=!0;const _=4*d;for(let e=0;e0)return t;const r=e*n;let a=gl[r];if(void 0===a&&(a=new Float32Array(r),gl[r]=a),0!==e){i.toArray(a,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(a,r)}return a}function Ml(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n":" "} ${t}: ${n[s]}`)}return i.join("\n")}function bc(t){switch(t){case ve:return["Linear","( value )"];case _e:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}function Mc(t,e,n){const i=t.getShaderParameter(e,35713),r=t.getShaderInfoLog(e).trim();if(i&&""===r)return"";const a=/ERROR: 0:(\d+)/.exec(r);if(a){const i=parseInt(a[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+yc(t.getShaderSource(e),i)}return r}function wc(t,e){const n=bc(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function Sc(t,e){let n;switch(e){case Y:n="Linear";break;case Z:n="Reinhard";break;case K:n="OptimizedCineon";break;case J:n="ACESFilmic";break;case Q:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function Tc(t){const e=[t.extensionDerivatives||t.envMapCubeUVHeight||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""];return e.filter(Cc).join("\n")}function Ec(t){const e=[];for(const n in t){const i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}function Ac(t,e){const n={},i=t.getProgramParameter(e,35721);for(let r=0;r/gm;function Rc(t){return t.replace(Dc,Ic)}function Ic(t,e){const n=Po[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Rc(n)}const Oc=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Nc(t){return t.replace(Oc,Uc)}function Uc(t,e,n,i){let r="";for(let a=parseInt(e);a0&&(g+="\n"),v=[p,f].filter(Cc).join("\n"),v.length>0&&(v+="\n")):(g=[kc(n),"#define SHADER_NAME "+n.shaderName,f,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Cc).join("\n"),v=[p,kc(n),"#define SHADER_NAME "+n.shaderName,f,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+u:"",n.envMap?"#define "+h:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==$?"#define TONE_MAPPING":"",n.toneMapping!==$?Po["tonemapping_pars_fragment"]:"",n.toneMapping!==$?Sc("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Po["encodings_pars_fragment"],wc("linearToOutputTexel",n.outputEncoding),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Cc).join("\n")),s=Rc(s),s=Lc(s,n),s=Pc(s,n),o=Rc(o),o=Lc(o,n),o=Pc(o,n),s=Nc(s),o=Nc(o),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(_="#version 300 es\n",g=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,v=["#define varying in",n.glslVersion===Ce?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Ce?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+v);const x=_+g+s,y=_+v+o,b=_c(r,35633,x),M=_c(r,35632,y);if(r.attachShader(m,b),r.attachShader(m,M),void 0!==n.index0AttributeName?r.bindAttribLocation(m,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(m,0,"position"),r.linkProgram(m),t.debug.checkShaderErrors){const t=r.getProgramInfoLog(m).trim(),e=r.getShaderInfoLog(b).trim(),n=r.getShaderInfoLog(M).trim();let i=!0,a=!0;if(!1===r.getProgramParameter(m,35714)){i=!1;const e=Mc(r,b,"vertex"),n=Mc(r,M,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(m,35715)+"\n\nProgram Info Log: "+t+"\n"+e+"\n"+n)}else""!==t?console.warn("THREE.WebGLProgram: Program Info Log:",t):""!==e&&""!==n||(a=!1);a&&(this.diagnostics={runnable:i,programLog:t,vertexShader:{log:e,prefix:g},fragmentShader:{log:n,prefix:v}})}let w,S;return r.deleteShader(b),r.deleteShader(M),this.getUniforms=function(){return void 0===w&&(w=new vc(r,m)),w},this.getAttributes=function(){return void 0===S&&(S=Ac(r,m)),S},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(m),this.program=void 0},this.name=n.shaderName,this.id=xc++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=b,this.fragmentShader=M,this}let Wc=0;class jc{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,n=t.fragmentShader,i=this._getShaderStage(e),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(t);return!1===a.has(i)&&(a.add(i),i.usedTimes++),!1===a.has(r)&&(a.add(r),r.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const n of e)n.usedTimes--,0===n.usedTimes&&this.shaderCache.delete(n.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let n=e.get(t);return void 0===n&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){const e=this.shaderCache;let n=e.get(t);return void 0===n&&(n=new Xc(t),e.set(t,n)),n}}class Xc{constructor(t){this.id=Wc++,this.code=t,this.usedTimes=0}}function qc(t,e,n,i,r,a,s){const o=new xi,l=new jc,c=[],u=r.isWebGL2,h=r.logarithmicDepthBuffer,d=r.vertexTextures;let m=r.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(a,o,c,_,x){const y=_.fog,b=x.geometry,M=a.isMeshStandardMaterial?_.environment:null,w=(a.isMeshStandardMaterial?n:e).get(a.envMap||M),S=w&&w.mapping===at?w.image.height:null,T=v[a.type];null!==a.precision&&(m=r.getMaxPrecision(a.precision),m!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",m,"instead."));const E=b.morphAttributes.position||b.morphAttributes.normal||b.morphAttributes.color,A=void 0!==E?E.length:0;let C,L,P,D,R=0;if(void 0!==b.morphAttributes.position&&(R=1),void 0!==b.morphAttributes.normal&&(R=2),void 0!==b.morphAttributes.color&&(R=3),T){const t=Ro[T];C=t.vertexShader,L=t.fragmentShader}else C=a.vertexShader,L=a.fragmentShader,l.update(a),P=l.getVertexShaderID(a),D=l.getFragmentShaderID(a);const I=t.getRenderTarget(),O=a.alphaTest>0,N=a.clearcoat>0,U=a.iridescence>0,k={isWebGL2:u,shaderID:T,shaderName:a.type,vertexShader:C,fragmentShader:L,defines:a.defines,customVertexShaderID:P,customFragmentShaderID:D,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:m,instancing:!0===x.isInstancedMesh,instancingColor:!0===x.isInstancedMesh&&null!==x.instanceColor,supportsVertexTextures:d,outputEncoding:null===I?t.outputEncoding:!0===I.isXRRenderTarget?I.texture.encoding:ve,map:!!a.map,matcap:!!a.matcap,envMap:!!w,envMapMode:w&&w.mapping,envMapCubeUVHeight:S,lightMap:!!a.lightMap,aoMap:!!a.aoMap,emissiveMap:!!a.emissiveMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,objectSpaceNormalMap:a.normalMapType===Me,tangentSpaceNormalMap:a.normalMapType===be,decodeVideoTexture:!!a.map&&!0===a.map.isVideoTexture&&a.map.encoding===_e,clearcoat:N,clearcoatMap:N&&!!a.clearcoatMap,clearcoatRoughnessMap:N&&!!a.clearcoatRoughnessMap,clearcoatNormalMap:N&&!!a.clearcoatNormalMap,iridescence:U,iridescenceMap:U&&!!a.iridescenceMap,iridescenceThicknessMap:U&&!!a.iridescenceThicknessMap,displacementMap:!!a.displacementMap,roughnessMap:!!a.roughnessMap,metalnessMap:!!a.metalnessMap,specularMap:!!a.specularMap,specularIntensityMap:!!a.specularIntensityMap,specularColorMap:!!a.specularColorMap,opaque:!1===a.transparent&&a.blending===g,alphaMap:!!a.alphaMap,alphaTest:O,gradientMap:!!a.gradientMap,sheen:a.sheen>0,sheenColorMap:!!a.sheenColorMap,sheenRoughnessMap:!!a.sheenRoughnessMap,transmission:a.transmission>0,transmissionMap:!!a.transmissionMap,thicknessMap:!!a.thicknessMap,combine:a.combine,vertexTangents:!!a.normalMap&&!!b.attributes.tangent,vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!b.attributes.color&&4===b.attributes.color.itemSize,vertexUvs:!!a.map||!!a.bumpMap||!!a.normalMap||!!a.specularMap||!!a.alphaMap||!!a.emissiveMap||!!a.roughnessMap||!!a.metalnessMap||!!a.clearcoatMap||!!a.clearcoatRoughnessMap||!!a.clearcoatNormalMap||!!a.iridescenceMap||!!a.iridescenceThicknessMap||!!a.displacementMap||!!a.transmissionMap||!!a.thicknessMap||!!a.specularIntensityMap||!!a.specularColorMap||!!a.sheenColorMap||!!a.sheenRoughnessMap,uvsVertexOnly:!(a.map||a.bumpMap||a.normalMap||a.specularMap||a.alphaMap||a.emissiveMap||a.roughnessMap||a.metalnessMap||a.clearcoatNormalMap||a.iridescenceMap||a.iridescenceThicknessMap||a.transmission>0||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularColorMap||a.sheen>0||a.sheenColorMap||a.sheenRoughnessMap)&&!!a.displacementMap,fog:!!y,useFog:!0===a.fog,fogExp2:y&&y.isFogExp2,flatShading:!!a.flatShading,sizeAttenuation:a.sizeAttenuation,logarithmicDepthBuffer:h,skinning:!0===x.isSkinnedMesh,morphTargets:void 0!==b.morphAttributes.position,morphNormals:void 0!==b.morphAttributes.normal,morphColors:void 0!==b.morphAttributes.color,morphTargetsCount:A,morphTextureStride:R,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:a.dithering,shadowMapEnabled:t.shadowMap.enabled&&c.length>0,shadowMapType:t.shadowMap.type,toneMapping:a.toneMapped?t.toneMapping:$,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===f,flipSided:a.side===p,useDepthPacking:!!a.depthPacking,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionDerivatives:a.extensions&&a.extensions.derivatives,extensionFragDepth:a.extensions&&a.extensions.fragDepth,extensionDrawBuffers:a.extensions&&a.extensions.drawBuffers,extensionShaderTextureLOD:a.extensions&&a.extensions.shaderTextureLOD,rendererExtensionFragDepth:u||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||i.has("EXT_shader_texture_lod"),customProgramCacheKey:a.customProgramCacheKey()};return k}function x(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.customVertexShaderID),n.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(y(n,e),b(n,e),n.push(t.outputEncoding)),n.push(e.customProgramCacheKey),n.join()}function y(t,e){t.push(e.precision),t.push(e.outputEncoding),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.combine),t.push(e.vertexUvs),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}function b(t,e){o.disableAll(),e.isWebGL2&&o.enable(0),e.supportsVertexTextures&&o.enable(1),e.instancing&&o.enable(2),e.instancingColor&&o.enable(3),e.map&&o.enable(4),e.matcap&&o.enable(5),e.envMap&&o.enable(6),e.lightMap&&o.enable(7),e.aoMap&&o.enable(8),e.emissiveMap&&o.enable(9),e.bumpMap&&o.enable(10),e.normalMap&&o.enable(11),e.objectSpaceNormalMap&&o.enable(12),e.tangentSpaceNormalMap&&o.enable(13),e.clearcoat&&o.enable(14),e.clearcoatMap&&o.enable(15),e.clearcoatRoughnessMap&&o.enable(16),e.clearcoatNormalMap&&o.enable(17),e.iridescence&&o.enable(18),e.iridescenceMap&&o.enable(19),e.iridescenceThicknessMap&&o.enable(20),e.displacementMap&&o.enable(21),e.specularMap&&o.enable(22),e.roughnessMap&&o.enable(23),e.metalnessMap&&o.enable(24),e.gradientMap&&o.enable(25),e.alphaMap&&o.enable(26),e.alphaTest&&o.enable(27),e.vertexColors&&o.enable(28),e.vertexAlphas&&o.enable(29),e.vertexUvs&&o.enable(30),e.vertexTangents&&o.enable(31),e.uvsVertexOnly&&o.enable(32),t.push(o.mask),o.disableAll(),e.fog&&o.enable(0),e.useFog&&o.enable(1),e.flatShading&&o.enable(2),e.logarithmicDepthBuffer&&o.enable(3),e.skinning&&o.enable(4),e.morphTargets&&o.enable(5),e.morphNormals&&o.enable(6),e.morphColors&&o.enable(7),e.premultipliedAlpha&&o.enable(8),e.shadowMapEnabled&&o.enable(9),e.physicallyCorrectLights&&o.enable(10),e.doubleSided&&o.enable(11),e.flipSided&&o.enable(12),e.useDepthPacking&&o.enable(13),e.dithering&&o.enable(14),e.specularIntensityMap&&o.enable(15),e.specularColorMap&&o.enable(16),e.transmission&&o.enable(17),e.transmissionMap&&o.enable(18),e.thicknessMap&&o.enable(19),e.sheen&&o.enable(20),e.sheenColorMap&&o.enable(21),e.sheenRoughnessMap&&o.enable(22),e.decodeVideoTexture&&o.enable(23),e.opaque&&o.enable(24),t.push(o.mask)}function M(t){const e=v[t.type];let n;if(e){const t=Ro[e];n=Rr.clone(t.uniforms)}else n=t.uniforms;return n}function w(e,n){let i;for(let t=0,r=c.length;t0?i.push(u):!0===a.transparent?r.push(u):n.push(u)}function l(t,e,a,o,l,c){const u=s(t,e,a,o,l,c);a.transmission>0?i.unshift(u):!0===a.transparent?r.unshift(u):n.unshift(u)}function c(t,e){n.length>1&&n.sort(t||Yc),i.length>1&&i.sort(e||Zc),r.length>1&&r.sort(e||Zc)}function u(){for(let n=e,i=t.length;n=i.length?(r=new Kc,i.push(r)):r=i[n],r}function n(){t=new WeakMap}return{get:e,dispose:n}}function Qc(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Dn,color:new xn};break;case"SpotLight":n={position:new Dn,direction:new Dn,color:new xn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Dn,color:new xn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Dn,skyColor:new xn,groundColor:new xn};break;case"RectAreaLight":n={color:new xn,position:new Dn,halfWidth:new Dn,halfHeight:new Dn};break}return t[e.id]=n,n}}}function tu(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new an};break;case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new an};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new an,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let eu=0;function nu(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function iu(t,e){const n=new Qc,i=tu(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let u=0;u<9;u++)r.probe.push(new Dn);const a=new Dn,s=new li,o=new li;function l(a,s){let o=0,l=0,c=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let u=0,h=0,d=0,p=0,f=0,m=0,g=0,v=0,_=0,x=0;a.sort(nu);const y=!0!==s?Math.PI:1;for(let t=0,e=a.length;t0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=Do.LTC_FLOAT_1,r.rectAreaLTC2=Do.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=Do.LTC_HALF_1,r.rectAreaLTC2=Do.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=o,r.ambient[1]=l,r.ambient[2]=c;const b=r.hash;b.directionalLength===u&&b.pointLength===h&&b.spotLength===d&&b.rectAreaLength===p&&b.hemiLength===f&&b.numDirectionalShadows===m&&b.numPointShadows===g&&b.numSpotShadows===v&&b.numSpotMaps===_||(r.directional.length=u,r.spot.length=d,r.rectArea.length=p,r.point.length=h,r.hemi.length=f,r.directionalShadow.length=m,r.directionalShadowMap.length=m,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=v,r.spotShadowMap.length=v,r.directionalShadowMatrix.length=m,r.pointShadowMatrix.length=g,r.spotLightMatrix.length=v+_-x,r.spotLightMap.length=_,r.numSpotLightShadowsWithMaps=x,b.directionalLength=u,b.pointLength=h,b.spotLength=d,b.rectAreaLength=p,b.hemiLength=f,b.numDirectionalShadows=m,b.numPointShadows=g,b.numSpotShadows=v,b.numSpotMaps=_,r.version=eu++)}function c(t,e){let n=0,i=0,l=0,c=0,u=0;const h=e.matrixWorldInverse;for(let d=0,p=t.length;d=a.length?(s=new ru(t,e),a.push(s)):s=a[r],s}function r(){n=new WeakMap}return{get:i,dispose:r}}class su extends Xi{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=xe,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class ou extends Xi{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new Dn,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}const lu="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",cu="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}";function uu(t,e,n){let i=new Yr;const r=new an,a=new an,s=new En,o=new su({depthPacking:ye}),l=new ou,u={},g=n.maxTextureSize,v={0:p,1:d,2:f},_=new Nr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new an},radius:{value:4}},vertexShader:lu,fragmentShader:cu}),x=_.clone();x.defines.HORIZONTAL_PASS=1;const y=new or;y.setAttribute("position",new Zi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const b=new Tr(y,_),M=this;function w(n,i){const a=e.update(b);_.defines.VSM_SAMPLES!==n.blurSamples&&(_.defines.VSM_SAMPLES=n.blurSamples,x.defines.VSM_SAMPLES=n.blurSamples,_.needsUpdate=!0,x.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new An(r.x,r.y)),_.uniforms.shadow_pass.value=n.map.texture,_.uniforms.resolution.value=n.mapSize,_.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,a,_,b,null),x.uniforms.shadow_pass.value=n.mapPass.texture,x.uniforms.resolution.value=n.mapSize,x.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,a,x,b,null)}function S(e,n,i,r,a,s){let c=null;const d=!0===i.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(c=void 0!==d?d:!0===i.isPointLight?l:o,t.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0){const t=c.uuid,e=n.uuid;let i=u[t];void 0===i&&(i={},u[t]=i);let r=i[e];void 0===r&&(r=c.clone(),i[e]=r),c=r}return c.visible=n.visible,c.wireframe=n.wireframe,c.side=s===h?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:v[n.side],c.alphaMap=n.alphaMap,c.alphaTest=n.alphaTest,c.clipShadows=n.clipShadows,c.clippingPlanes=n.clippingPlanes,c.clipIntersection=n.clipIntersection,c.displacementMap=n.displacementMap,c.displacementScale=n.displacementScale,c.displacementBias=n.displacementBias,c.wireframeLinewidth=n.wireframeLinewidth,c.linewidth=n.linewidth,!0===i.isPointLight&&!0===c.isMeshDistanceMaterial&&(c.referencePosition.setFromMatrixPosition(i.matrixWorld),c.nearDistance=r,c.farDistance=a),c}function T(n,r,a,s,o){if(!1===n.visible)return;const l=n.layers.test(r.layers);if(l&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&o===h)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);const i=e.update(n),r=n.material;if(Array.isArray(r)){const e=i.groups;for(let l=0,c=e.length;lg||r.y>g)&&(r.x>g&&(a.x=Math.floor(g/u.x),r.x=a.x*u.x,c.mapSize.x=a.x),r.y>g&&(a.y=Math.floor(g/u.y),r.y=a.y*u.y,c.mapSize.y=a.y)),null===c.map){const t=this.type!==h?{minFilter:ct,magFilter:ct}:{};c.map=new An(r.x,r.y,t),c.map.texture.name=l.name+".shadowMap",c.camera.updateProjectionMatrix()}t.setRenderTarget(c.map),t.clear();const f=c.getViewportCount();for(let t=0;t=1):-1!==mt.indexOf("OpenGL ES")&&(ft=parseFloat(/^OpenGL ES (\d)/.exec(mt)[1]),pt=ft>=2);let gt=null,vt={};const _t=t.getParameter(3088),xt=t.getParameter(2978),yt=(new En).fromArray(_t),bt=(new En).fromArray(xt);function Mt(e,n,i){const r=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let s=0;si||t.height>i)&&(r=i/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!==typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&t instanceof ImageBitmap){const i=e?Qe:Math.floor,a=i(r*t.width),s=i(r*t.height);void 0===m&&(m=_(a,s));const o=n?_(a,s):m;o.width=a,o.height=s;const l=o.getContext("2d");return l.drawImage(t,0,0,a,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+a+"x"+s+")."),o}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function y(t){return Ke(t.width)&&Ke(t.height)}function b(t){return!o&&(t.wrapS!==ot||t.wrapT!==ot||t.minFilter!==ct&&t.minFilter!==dt)}function M(t,e){return t.generateMipmaps&&e&&t.minFilter!==ct&&t.minFilter!==dt}function w(e){t.generateMipmap(e)}function S(n,i,r,a,s=!1){if(!1===o)return i;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let l=i;return 6403===i&&(5126===r&&(l=33326),5131===r&&(l=33325),5121===r&&(l=33321)),33319===i&&(5126===r&&(l=33328),5131===r&&(l=33327),5121===r&&(l=33323)),6408===i&&(5126===r&&(l=34836),5131===r&&(l=34842),5121===r&&(l=a===_e&&!1===s?35907:32856),32819===r&&(l=32854),32820===r&&(l=32855)),33325!==l&&33326!==l&&33327!==l&&33328!==l&&34842!==l&&34836!==l||e.get("EXT_color_buffer_float"),l}function T(t,e,n){return!0===M(t,n)||t.isFramebufferTexture&&t.minFilter!==ct&&t.minFilter!==dt?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function E(t){return t===ct||t===ut||t===ht?9728:9729}function A(t){const e=t.target;e.removeEventListener("dispose",A),L(e),e.isVideoTexture&&f.delete(e)}function C(t){const e=t.target;e.removeEventListener("dispose",C),D(e)}function L(t){const e=i.get(t);if(void 0===e.__webglInit)return;const n=t.source,r=g.get(n);if(r){const i=r[e.__cacheKey];i.usedTimes--,0===i.usedTimes&&P(t),0===Object.keys(r).length&&g.delete(n)}i.remove(t)}function P(e){const n=i.get(e);t.deleteTexture(n.__webglTexture);const r=e.source,a=g.get(r);delete a[n.__cacheKey],s.memory.textures--}function D(e){const n=e.texture,r=i.get(e),a=i.get(n);if(void 0!==a.__webglTexture&&(t.deleteTexture(a.__webglTexture),s.memory.textures--),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLCubeRenderTarget)for(let i=0;i<6;i++)t.deleteFramebuffer(r.__webglFramebuffer[i]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[i]);else{if(t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer)for(let e=0;e=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),R+=1,t}function N(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.encoding),e.join()}function U(t,e){const r=i.get(t);if(t.isVideoTexture&&nt(t),!1===t.isRenderTargetTexture&&t.version>0&&r.__version!==t.version){const n=t.image;if(null===n)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==n.complete)return void W(r,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,r.__webglTexture)}function k(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?W(r,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,r.__webglTexture))}function z(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?W(r,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,r.__webglTexture))}function F(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?j(r,t,e):(n.activeTexture(33984+e),n.bindTexture(34067,r.__webglTexture))}const B={[st]:10497,[ot]:33071,[lt]:33648},V={[ct]:9728,[ut]:9984,[ht]:9986,[dt]:9729,[pt]:9985,[ft]:9987};function H(n,a,s){if(s?(t.texParameteri(n,10242,B[a.wrapS]),t.texParameteri(n,10243,B[a.wrapT]),32879!==n&&35866!==n||t.texParameteri(n,32882,B[a.wrapR]),t.texParameteri(n,10240,V[a.magFilter]),t.texParameteri(n,10241,V[a.minFilter])):(t.texParameteri(n,10242,33071),t.texParameteri(n,10243,33071),32879!==n&&35866!==n||t.texParameteri(n,32882,33071),a.wrapS===ot&&a.wrapT===ot||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(n,10240,E(a.magFilter)),t.texParameteri(n,10241,E(a.minFilter)),a.minFilter!==ct&&a.minFilter!==dt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===e.has("EXT_texture_filter_anisotropic")){const s=e.get("EXT_texture_filter_anisotropic");if(a.type===bt&&!1===e.has("OES_texture_float_linear"))return;if(!1===o&&a.type===Mt&&!1===e.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(t.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function G(e,n){let i=!1;void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",A));const r=n.source;let a=g.get(r);void 0===a&&(a={},g.set(r,a));const o=N(n);if(o!==e.__cacheKey){void 0===a[o]&&(a[o]={texture:t.createTexture(),usedTimes:0},s.memory.textures++,i=!0),a[o].usedTimes++;const r=a[e.__cacheKey];void 0!==r&&(a[e.__cacheKey].usedTimes--,0===r.usedTimes&&P(n)),e.__cacheKey=o,e.__webglTexture=a[o].texture}return i}function W(e,i,r){let s=3553;i.isDataArrayTexture&&(s=35866),i.isData3DTexture&&(s=32879);const l=G(e,i),c=i.source;if(n.activeTexture(33984+r),n.bindTexture(s,e.__webglTexture),c.version!==c.__currentVersion||!0===l){t.pixelStorei(37440,i.flipY),t.pixelStorei(37441,i.premultiplyAlpha),t.pixelStorei(3317,i.unpackAlignment),t.pixelStorei(37443,0);const e=b(i)&&!1===y(i.image);let r=x(i.image,e,!1,u);r=it(i,r);const h=y(r)||o,d=a.convert(i.format,i.encoding);let p,f=a.convert(i.type),m=S(i.internalFormat,d,f,i.encoding,i.isVideoTexture);H(s,i,h);const g=i.mipmaps,v=o&&!0!==i.isVideoTexture,_=void 0===c.__currentVersion||!0===l,E=T(i,r,h);if(i.isDepthTexture)m=6402,o?m=i.type===bt?36012:i.type===yt?33190:i.type===Tt?35056:33189:i.type===bt&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===Dt&&6402===m&&i.type!==_t&&i.type!==yt&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=yt,f=a.convert(i.type)),i.format===Rt&&6402===m&&(m=34041,i.type!==Tt&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=Tt,f=a.convert(i.type))),_&&(v?n.texStorage2D(3553,1,m,r.width,r.height):n.texImage2D(3553,0,m,r.width,r.height,0,d,f,null));else if(i.isDataTexture)if(g.length>0&&h){v&&_&&n.texStorage2D(3553,E,m,g[0].width,g[0].height);for(let t=0,e=g.length;t>=1,e>>=1}}else if(g.length>0&&h){v&&_&&n.texStorage2D(3553,E,m,g[0].width,g[0].height);for(let t=0,e=g.length;t0&&b++,n.texStorage2D(34067,b,m,u[0].width,u[0].height));for(let t=0;t<6;t++)if(r){g?n.texSubImage2D(34069+t,0,0,0,u[t].width,u[t].height,p,f,u[t].data):n.texImage2D(34069+t,0,m,u[t].width,u[t].height,0,p,f,u[t].data);for(let e=0;e<_.length;e++){const i=_[e],r=i.image[t].image;g?n.texSubImage2D(34069+t,e+1,0,0,r.width,r.height,p,f,r.data):n.texImage2D(34069+t,e+1,m,r.width,r.height,0,p,f,r.data)}}else{g?n.texSubImage2D(34069+t,0,0,0,p,f,u[t]):n.texImage2D(34069+t,0,m,p,f,u[t]);for(let e=0;e<_.length;e++){const i=_[e];g?n.texSubImage2D(34069+t,e+1,0,0,p,f,i.image[t]):n.texImage2D(34069+t,e+1,m,p,f,i.image[t])}}}M(i,d)&&w(34067),l.__currentVersion=l.version,i.onUpdate&&i.onUpdate(i)}e.__version=i.version}function X(e,r,s,o,l){const c=a.convert(s.format,s.encoding),u=a.convert(s.type),h=S(s.internalFormat,c,u,s.encoding),p=i.get(r);p.__hasExternalTextures||(32879===l||35866===l?n.texImage3D(l,0,h,r.width,r.height,r.depth,0,c,u,null):n.texImage2D(l,0,h,r.width,r.height,0,c,u,null)),n.bindFramebuffer(36160,e),et(r)?d.framebufferTexture2DMultisampleEXT(36160,o,l,i.get(s).__webglTexture,0,tt(r)):t.framebufferTexture2D(36160,o,l,i.get(s).__webglTexture,0),n.bindFramebuffer(36160,null)}function q(e,n,i){if(t.bindRenderbuffer(36161,e),n.depthBuffer&&!n.stencilBuffer){let r=33189;if(i||et(n)){const e=n.depthTexture;e&&e.isDepthTexture&&(e.type===bt?r=36012:e.type===yt&&(r=33190));const i=tt(n);et(n)?d.renderbufferStorageMultisampleEXT(36161,i,r,n.width,n.height):t.renderbufferStorageMultisample(36161,i,r,n.width,n.height)}else t.renderbufferStorage(36161,r,n.width,n.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(n.depthBuffer&&n.stencilBuffer){const r=tt(n);i&&!1===et(n)?t.renderbufferStorageMultisample(36161,r,35056,n.width,n.height):et(n)?d.renderbufferStorageMultisampleEXT(36161,r,35056,n.width,n.height):t.renderbufferStorage(36161,34041,n.width,n.height),t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=!0===n.isWebGLMultipleRenderTargets?n.texture:[n.texture];for(let r=0;r0&&!1===et(e)){const i=d?l:[l];c.__webglMultisampledFramebuffer=t.createFramebuffer(),c.__webglColorRenderbuffer=[],n.bindFramebuffer(36160,c.__webglMultisampledFramebuffer);for(let n=0;n0&&!1===et(e)){const r=e.isWebGLMultipleRenderTargets?e.texture:[e.texture],a=e.width,s=e.height;let o=16384;const l=[],c=e.stencilBuffer?33306:36096,u=i.get(e),h=!0===e.isWebGLMultipleRenderTargets;if(h)for(let e=0;e0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function nt(t){const e=s.render.frame;f.get(t)!==e&&(f.set(t,e),t.update())}function it(t,n){const i=t.encoding,r=t.format,a=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||t.format===Le||i!==ve&&(i===_e?!1===o?!0===e.has("EXT_sRGB")&&r===Ct?(t.format=Le,t.minFilter=dt,t.generateMipmaps=!1):n=bn.sRGBToLinear(n):r===Ct&&a===mt||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",i)),n}this.allocateTextureUnit=O,this.resetTextureUnits=I,this.setTexture2D=U,this.setTexture2DArray=k,this.setTexture3D=z,this.setTextureCube=F,this.rebindTextures=Z,this.setupRenderTarget=K,this.updateRenderTargetMipmap=J,this.updateMultisampleRenderTarget=Q,this.setupDepthRenderbuffer=Y,this.setupFrameBufferTexture=X,this.useMultisampledRTT=et}function pu(t,e,n){const i=n.isWebGL2;function r(n,r=null){let a;if(n===mt)return 5121;if(n===wt)return 32819;if(n===St)return 32820;if(n===gt)return 5120;if(n===vt)return 5122;if(n===_t)return 5123;if(n===xt)return 5124;if(n===yt)return 5125;if(n===bt)return 5126;if(n===Mt)return i?5131:(a=e.get("OES_texture_half_float"),null!==a?a.HALF_FLOAT_OES:null);if(n===Et)return 6406;if(n===Ct)return 6408;if(n===Lt)return 6409;if(n===Pt)return 6410;if(n===Dt)return 6402;if(n===Rt)return 34041;if(n===It)return 6403;if(n===At)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(n===Le)return a=e.get("EXT_sRGB"),null!==a?a.SRGB_ALPHA_EXT:null;if(n===Ot)return 36244;if(n===Nt)return 33319;if(n===Ut)return 33320;if(n===kt)return 36249;if(n===zt||n===Ft||n===Bt||n===Vt)if(r===_e){if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===a)return null;if(n===zt)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Ft)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Bt)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Vt)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(a=e.get("WEBGL_compressed_texture_s3tc"),null===a)return null;if(n===zt)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Ft)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Bt)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Vt)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===Ht||n===Gt||n===Wt||n===jt){if(a=e.get("WEBGL_compressed_texture_pvrtc"),null===a)return null;if(n===Ht)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Gt)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Wt)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===jt)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===Xt)return a=e.get("WEBGL_compressed_texture_etc1"),null!==a?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===qt||n===$t){if(a=e.get("WEBGL_compressed_texture_etc"),null===a)return null;if(n===qt)return r===_e?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(n===$t)return r===_e?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}if(n===Yt||n===Zt||n===Kt||n===Jt||n===Qt||n===te||n===ee||n===ne||n===ie||n===re||n===ae||n===se||n===oe||n===le){if(a=e.get("WEBGL_compressed_texture_astc"),null===a)return null;if(n===Yt)return r===_e?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Zt)return r===_e?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Kt)return r===_e?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Jt)return r===_e?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Qt)return r===_e?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===te)return r===_e?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===ee)return r===_e?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===ne)return r===_e?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ie)return r===_e?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===re)return r===_e?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===ae)return r===_e?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===se)return r===_e?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===oe)return r===_e?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===le)return r===_e?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===ce){if(a=e.get("EXT_texture_compression_bptc"),null===a)return null;if(n===ce)return r===_e?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}return n===Tt?i?34042:(a=e.get("WEBGL_depth_texture"),null!==a?a.UNSIGNED_INT_24_8_WEBGL:null):void 0!==t[n]?t[n]:null}return{convert:r}}class fu extends kr{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}}class mu extends Ii{constructor(){super(),this.isGroup=!0,this.type="Group"}}const gu={type:"move"};class vu{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new mu,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new mu,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Dn,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Dn),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new mu,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Dn,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Dn),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,n){let i=null,r=null,a=null;const s=this._targetRay,o=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(l&&t.hand){a=!0;for(const a of t.hand.values()){const t=e.getJointPose(a,n);if(void 0===l.joints[a.jointName]){const t=new mu;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[a.jointName]=t,l.add(t)}const i=l.joints[a.jointName];null!==t&&(i.matrix.fromArray(t.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.jointRadius=t.radius),i.visible=null!==t}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],s=i.position.distanceTo(r.position),o=.02,c=.005;l.inputState.pinching&&s>o+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&s<=o-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));null!==s&&(i=e.getPose(t.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(gu)))}return null!==s&&(s.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==a),this}}class _u extends Tn{constructor(t,e,n,i,r,a,s,o,l,c){if(c=void 0!==c?c:Dt,c!==Dt&&c!==Rt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Dt&&(n=yt),void 0===n&&c===Rt&&(n=Tt),super(null,i,r,a,s,o,c,n,l),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=void 0!==s?s:ct,this.minFilter=void 0!==o?o:ct,this.flipY=!1,this.generateMipmaps=!1}}class xu extends Pe{constructor(t,e){super();const n=this;let i=null,r=1,a=null,s="local-floor",o=null,l=null,c=null,u=null,h=null,d=null;const p=e.getContextAttributes();let f=null,m=null;const g=[],v=[],_=new kr;_.layers.enable(1),_.viewport=new En;const x=new kr;x.layers.enable(2),x.viewport=new En;const y=[_,x],b=new fu;b.layers.enable(1),b.layers.enable(2);let M=null,w=null;function S(t){const e=v.indexOf(t.inputSource);if(-1===e)return;const n=g[e];void 0!==n&&n.dispatchEvent({type:t.type,data:t.inputSource})}function T(){i.removeEventListener("select",S),i.removeEventListener("selectstart",S),i.removeEventListener("selectend",S),i.removeEventListener("squeeze",S),i.removeEventListener("squeezestart",S),i.removeEventListener("squeezeend",S),i.removeEventListener("end",T),i.removeEventListener("inputsourceschange",E);for(let t=0;t=0&&(v[i]=null,g[i].dispatchEvent({type:"disconnected",data:n}))}for(let e=0;e=v.length){v.push(n),i=t;break}if(null===v[t]){v[t]=n,i=t;break}}if(-1===i)break}const r=g[i];r&&r.dispatchEvent({type:"connected",data:n})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=g[t];return void 0===e&&(e=new vu,g[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=g[t];return void 0===e&&(e=new vu,g[t]=e),e.getGripSpace()},this.getHand=function(t){let e=g[t];return void 0===e&&(e=new vu,g[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){r=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){s=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return o||a},this.setReferenceSpace=function(t){o=t},this.getBaseLayer=function(){return null!==u?u:h},this.getBinding=function(){return c},this.getFrame=function(){return d},this.getSession=function(){return i},this.setSession=async function(l){if(i=l,null!==i){if(f=t.getRenderTarget(),i.addEventListener("select",S),i.addEventListener("selectstart",S),i.addEventListener("selectend",S),i.addEventListener("squeeze",S),i.addEventListener("squeezestart",S),i.addEventListener("squeezeend",S),i.addEventListener("end",T),i.addEventListener("inputsourceschange",E),!0!==p.xrCompatible&&await e.makeXRCompatible(),void 0===i.renderState.layers||!1===t.capabilities.isWebGL2){const n={antialias:void 0!==i.renderState.layers||p.antialias,alpha:p.alpha,depth:p.depth,stencil:p.stencil,framebufferScaleFactor:r};h=new XRWebGLLayer(i,e,n),i.updateRenderState({baseLayer:h}),m=new An(h.framebufferWidth,h.framebufferHeight,{format:Ct,type:mt,encoding:t.outputEncoding,stencilBuffer:p.stencil})}else{let n=null,a=null,s=null;p.depth&&(s=p.stencil?35056:33190,n=p.stencil?Rt:Dt,a=p.stencil?Tt:yt);const o={colorFormat:32856,depthFormat:s,scaleFactor:r};c=new XRWebGLBinding(i,e),u=c.createProjectionLayer(o),i.updateRenderState({layers:[u]}),m=new An(u.textureWidth,u.textureHeight,{format:Ct,type:mt,depthTexture:new _u(u.textureWidth,u.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:p.stencil,encoding:t.outputEncoding,samples:p.antialias?4:0});const l=t.properties.get(m);l.__ignoreDepthValues=u.ignoreDepthValues}m.isXRRenderTarget=!0,this.setFoveation(1),o=null,a=await i.requestReferenceSpace(s),I.setContext(i),I.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};const A=new Dn,C=new Dn;function L(t,e,n){A.setFromMatrixPosition(e.matrixWorld),C.setFromMatrixPosition(n.matrixWorld);const i=A.distanceTo(C),r=e.projectionMatrix.elements,a=n.projectionMatrix.elements,s=r[14]/(r[10]-1),o=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],u=(r[8]-1)/r[0],h=(a[8]+1)/a[0],d=s*u,p=s*h,f=i/(-u+h),m=f*-u;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const g=s+f,v=o+f,_=d-m,x=p+(i-m),y=l*o/v*g,b=c*o/v*g;t.projectionMatrix.makePerspective(_,x,y,b,g,v)}function P(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===i)return;b.near=x.near=_.near=t.near,b.far=x.far=_.far=t.far,M===b.near&&w===b.far||(i.updateRenderState({depthNear:b.near,depthFar:b.far}),M=b.near,w=b.far);const e=t.parent,n=b.cameras;P(b,e);for(let i=0;i0&&(n.alphaTest.value=i.alphaTest);const r=e.get(i).envMap;if(r&&(n.envMap.value=r,n.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,n.reflectivity.value=i.reflectivity,n.ior.value=i.ior,n.refractionRatio.value=i.refractionRatio),i.lightMap){n.lightMap.value=i.lightMap;const e=!0!==t.physicallyCorrectLights?Math.PI:1;n.lightMapIntensity.value=i.lightMapIntensity*e}let a,s;i.aoMap&&(n.aoMap.value=i.aoMap,n.aoMapIntensity.value=i.aoMapIntensity),i.map?a=i.map:i.specularMap?a=i.specularMap:i.displacementMap?a=i.displacementMap:i.normalMap?a=i.normalMap:i.bumpMap?a=i.bumpMap:i.roughnessMap?a=i.roughnessMap:i.metalnessMap?a=i.metalnessMap:i.alphaMap?a=i.alphaMap:i.emissiveMap?a=i.emissiveMap:i.clearcoatMap?a=i.clearcoatMap:i.clearcoatNormalMap?a=i.clearcoatNormalMap:i.clearcoatRoughnessMap?a=i.clearcoatRoughnessMap:i.iridescenceMap?a=i.iridescenceMap:i.iridescenceThicknessMap?a=i.iridescenceThicknessMap:i.specularIntensityMap?a=i.specularIntensityMap:i.specularColorMap?a=i.specularColorMap:i.transmissionMap?a=i.transmissionMap:i.thicknessMap?a=i.thicknessMap:i.sheenColorMap?a=i.sheenColorMap:i.sheenRoughnessMap&&(a=i.sheenRoughnessMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),n.uvTransform.value.copy(a.matrix)),i.aoMap?s=i.aoMap:i.lightMap&&(s=i.lightMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),n.uv2Transform.value.copy(s.matrix))}function a(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}function s(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function o(t,e,n,i){let r;t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*i,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest),e.map?r=e.map:e.alphaMap&&(r=e.alphaMap),void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}function l(t,e){let n;t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest),e.map?n=e.map:e.alphaMap&&(n=e.alphaMap),void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}function c(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}function u(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}function h(t,n){t.roughness.value=n.roughness,t.metalness.value=n.metalness,n.roughnessMap&&(t.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(t.metalnessMap.value=n.metalnessMap);const i=e.get(n).envMap;i&&(t.envMapIntensity.value=n.envMapIntensity)}function d(t,e,n){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap)),e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,e.side===p&&t.clearcoatNormalScale.value.negate())),e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap)),e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=n.texture,t.transmissionSamplerSize.value.set(n.width,n.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor)),t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap)}function f(t,e){e.matcap&&(t.matcap.value=e.matcap)}function m(t,e){t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function bu(t,e,n,i){let r={},a={},s=[];const o=n.isWebGL2?t.getParameter(35375):0;function l(t,e){const n=e.program;i.uniformBlockBinding(t,n)}function c(t,n){let s=r[t.id];void 0===s&&(f(t),s=u(t),r[t.id]=s,t.addEventListener("dispose",g));const o=n.program;i.updateUBOMapping(t,o);const l=e.render.frame;a[t.id]!==l&&(d(t),a[t.id]=l)}function u(e){const n=h();e.__bindingPointIndex=n;const i=t.createBuffer(),r=e.__size,a=e.usage;return t.bindBuffer(35345,i),t.bufferData(35345,r,a),t.bindBuffer(35345,null),t.bindBufferBase(35345,n,i),i}function h(){for(let t=0;t0){r=n%i;const e=i-r;0!==r&&e-s.boundary<0&&(n+=i-r,t.__offset=n)}n+=s.storage}return r=n%i,r>0&&(n+=i-r),t.__size=n,t.__cache={},this}function m(t){const e=t.value,n={boundary:0,storage:0};return"number"===typeof e?(n.boundary=4,n.storage=4):e.isVector2?(n.boundary=8,n.storage=8):e.isVector3||e.isColor?(n.boundary=16,n.storage=12):e.isVector4?(n.boundary=16,n.storage=16):e.isMatrix3?(n.boundary=48,n.storage=48):e.isMatrix4?(n.boundary=64,n.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),n}function g(e){const n=e.target;n.removeEventListener("dispose",g);const i=s.indexOf(n.__bindingPointIndex);s.splice(i,1),t.deleteBuffer(r[n.id]),delete r[n.id],delete a[n.id]}function v(){for(const e in r)t.deleteBuffer(r[e]);s=[],r={},a={}}return{bind:l,update:c,dispose:v}}function Mu(){const t=ln("canvas");return t.style.display="block",t}function wu(t={}){this.isWebGLRenderer=!0;const e=void 0!==t.canvas?t.canvas:Mu(),n=void 0!==t.context?t.context:null,r=void 0===t.depth||t.depth,a=void 0===t.stencil||t.stencil,s=void 0!==t.antialias&&t.antialias,o=void 0===t.premultipliedAlpha||t.premultipliedAlpha,l=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,c=void 0!==t.powerPreference?t.powerPreference:"default",u=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let h;h=null!==n?n.getContextAttributes().alpha:void 0!==t.alpha&&t.alpha;let m=null,g=null;const v=[],_=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=ve,this.physicallyCorrectLights=!1,this.toneMapping=$,this.toneMappingExposure=1,Object.defineProperties(this,{gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}});const x=this;let y=!1,b=0,M=0,w=null,S=-1,T=null;const E=new En,A=new En;let C=null,L=e.width,P=e.height,D=1,R=null,I=null;const O=new En(0,0,L,P),N=new En(0,0,L,P);let U=!1;const k=new Yr;let z=!1,F=!1,B=null;const V=new li,H=new an,G=new Dn,W={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function j(){return null===w?D:1}let X,q,Y,Z,K,J,Q,tt,et,nt,it,rt,at,st,ot,lt,ct,ut,ht,dt,pt,gt,vt,_t,xt=n;function yt(t,n){for(let i=0;i0&&Ft(r,e,n),i&&Y.viewport(E.copy(i)),r.length>0&&Bt(r,e,n),a.length>0&&Bt(a,e,n),s.length>0&&Bt(s,e,n),Y.buffers.depth.setTest(!0),Y.buffers.depth.setMask(!0),Y.buffers.color.setMask(!0),Y.setPolygonOffset(!1)}function Ft(t,e,n){const i=q.isWebGL2;null===B&&(B=new An(1,1,{generateMipmaps:!0,type:X.has("EXT_color_buffer_half_float")?Mt:mt,minFilter:ft,samples:i&&!0===s?4:0})),x.getDrawingBufferSize(H),i?B.setSize(H.x,H.y):B.setSize(Qe(H.x),Qe(H.y));const r=x.getRenderTarget();x.setRenderTarget(B),x.clear();const a=x.toneMapping;x.toneMapping=$,Bt(t,e,n),x.toneMapping=a,J.updateMultisampleRenderTarget(B),J.updateRenderTargetMipmap(B),x.setRenderTarget(r)}function Bt(t,e,n){const i=!0===e.isScene?e.overrideMaterial:null;for(let r=0,a=t.length;r0?_[_.length-1]:null,v.pop(),m=v.length>0?v[v.length-1]:null},this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return M},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(t,e,n){K.get(t.texture).__webglTexture=e,K.get(t.depthTexture).__webglTexture=n;const i=K.get(t);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===X.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(t,e){const n=K.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,n=0){w=t,b=e,M=n;let i=!0;if(t){const e=K.get(t);void 0!==e.__useDefaultFramebuffer?(Y.bindFramebuffer(36160,null),i=!1):void 0===e.__webglFramebuffer?J.setupRenderTarget(t):e.__hasExternalTextures&&J.rebindTextures(t,K.get(t.texture).__webglTexture,K.get(t.depthTexture).__webglTexture)}let r=null,a=!1,s=!1;if(t){const n=t.texture;(n.isData3DTexture||n.isDataArrayTexture)&&(s=!0);const i=K.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=i[e],a=!0):r=q.isWebGL2&&t.samples>0&&!1===J.useMultisampledRTT(t)?K.get(t).__webglMultisampledFramebuffer:i,E.copy(t.viewport),A.copy(t.scissor),C=t.scissorTest}else E.copy(O).multiplyScalar(D).floor(),A.copy(N).multiplyScalar(D).floor(),C=U;const o=Y.bindFramebuffer(36160,r);if(o&&q.drawBuffers&&i&&Y.drawBuffers(t,r),Y.viewport(E),Y.scissor(A),Y.setScissorTest(C),a){const i=K.get(t.texture);xt.framebufferTexture2D(36160,36064,34069+e,i.__webglTexture,n)}else if(s){const i=K.get(t.texture),r=e||0;xt.framebufferTextureLayer(36160,36064,i.__webglTexture,n||0,r)}S=-1},this.readRenderTargetPixels=function(t,e,n,i,r,a,s){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=K.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==s&&(o=o[s]),o){Y.bindFramebuffer(36160,o);try{const s=t.texture,o=s.format,l=s.type;if(o!==Ct&>.convert(o)!==xt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===Mt&&(X.has("EXT_color_buffer_half_float")||q.isWebGL2&&X.has("EXT_color_buffer_float"));if(l!==mt&>.convert(l)!==xt.getParameter(35738)&&(l!==bt||!(q.isWebGL2||X.has("OES_texture_float")||X.has("WEBGL_color_buffer_float")))&&!c)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&xt.readPixels(e,n,i,r,gt.convert(o),gt.convert(l),a)}finally{const t=null!==w?K.get(w).__webglFramebuffer:null;Y.bindFramebuffer(36160,t)}}},this.copyFramebufferToTexture=function(t,e,n=0){const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),a=Math.floor(e.image.height*i);J.setTexture2D(e,0),xt.copyTexSubImage2D(3553,n,0,0,t.x,t.y,r,a),Y.unbindTexture()},this.copyTextureToTexture=function(t,e,n,i=0){const r=e.image.width,a=e.image.height,s=gt.convert(n.format),o=gt.convert(n.type);J.setTexture2D(n,0),xt.pixelStorei(37440,n.flipY),xt.pixelStorei(37441,n.premultiplyAlpha),xt.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?xt.texSubImage2D(3553,i,t.x,t.y,r,a,s,o,e.image.data):e.isCompressedTexture?xt.compressedTexSubImage2D(3553,i,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,s,e.mipmaps[0].data):xt.texSubImage2D(3553,i,t.x,t.y,s,o,e.image),0===i&&n.generateMipmaps&&xt.generateMipmap(3553),Y.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,i,r=0){if(x.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const a=t.max.x-t.min.x+1,s=t.max.y-t.min.y+1,o=t.max.z-t.min.z+1,l=gt.convert(i.format),c=gt.convert(i.type);let u;if(i.isData3DTexture)J.setTexture3D(i,0),u=32879;else{if(!i.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");J.setTexture2DArray(i,0),u=35866}xt.pixelStorei(37440,i.flipY),xt.pixelStorei(37441,i.premultiplyAlpha),xt.pixelStorei(3317,i.unpackAlignment);const h=xt.getParameter(3314),d=xt.getParameter(32878),p=xt.getParameter(3316),f=xt.getParameter(3315),m=xt.getParameter(32877),g=n.isCompressedTexture?n.mipmaps[0]:n.image;xt.pixelStorei(3314,g.width),xt.pixelStorei(32878,g.height),xt.pixelStorei(3316,t.min.x),xt.pixelStorei(3315,t.min.y),xt.pixelStorei(32877,t.min.z),n.isDataTexture||n.isData3DTexture?xt.texSubImage3D(u,r,e.x,e.y,e.z,a,s,o,l,c,g.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),xt.compressedTexSubImage3D(u,r,e.x,e.y,e.z,a,s,o,l,g.data)):xt.texSubImage3D(u,r,e.x,e.y,e.z,a,s,o,l,c,g),xt.pixelStorei(3314,h),xt.pixelStorei(32878,d),xt.pixelStorei(3316,p),xt.pixelStorei(3315,f),xt.pixelStorei(32877,m),0===r&&i.generateMipmaps&&xt.generateMipmap(u),Y.unbindTexture()},this.initTexture=function(t){t.isCubeTexture?J.setTextureCube(t,0):t.isData3DTexture?J.setTexture3D(t,0):t.isDataArrayTexture?J.setTexture2DArray(t,0):J.setTexture2D(t,0),Y.unbindTexture()},this.resetState=function(){b=0,M=0,w=null,Y.reset(),vt.reset()},"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class Su extends wu{}Su.prototype.isWebGL1Renderer=!0;class Tu extends Ii{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(t){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=t}}const Eu=new Dn,Au=new En,Cu=new En,Lu=new Dn,Pu=new li;class Du extends Tr{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new li,this.bindMatrixInverse=new li}copy(t,e){return super.copy(t,e),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new En,e=this.geometry.attributes.skinWeight;for(let n=0,i=e.count;no)continue;h.applyMatrix4(this.matrixWorld);const s=t.ray.origin.distanceTo(h);st.far||e.push({distance:s,point:u.clone().applyMatrix4(this.matrixWorld),index:r,face:null,faceIndex:null,object:this})}}else{const n=Math.max(0,a.start),i=Math.min(m.count,a.start+a.count);for(let r=n,a=i-1;ro)continue;h.applyMatrix4(this.matrixWorld);const i=t.ray.origin.distanceTo(h);it.far||e.push({distance:i,point:u.clone().applyMatrix4(this.matrixWorld),index:r,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry,e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0)){l=i;break}l=i-1}if(i=l,n[i]===a)return i/(r-1);const c=n[i],u=n[i+1],h=u-c,d=(a-c)/h,p=(i+d)/(r-1);return p}getTangent(t,e){const n=1e-4;let i=t-n,r=t+n;i<0&&(i=0),r>1&&(r=1);const a=this.getPoint(i),s=this.getPoint(r),o=e||(a.isVector2?new an:new Dn);return o.copy(s).sub(a).normalize(),o}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new Dn,i=[],r=[],a=[],s=new Dn,o=new li;for(let d=0;d<=t;d++){const e=d/t;i[d]=this.getTangentAt(e,new Dn)}r[0]=new Dn,a[0]=new Dn;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),u=Math.abs(i[0].y),h=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),u<=l&&(l=u,n.set(0,1,0)),h<=l&&n.set(0,0,1),s.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],s),a[0].crossVectors(i[0],r[0]);for(let d=1;d<=t;d++){if(r[d]=r[d-1].clone(),a[d]=a[d-1].clone(),s.crossVectors(i[d-1],i[d]),s.length()>Number.EPSILON){s.normalize();const t=Math.acos(Ue(i[d-1].dot(i[d]),-1,1));r[d].applyMatrix4(o.makeRotationAxis(s,t))}a[d].crossVectors(i[d],r[d])}if(!0===e){let e=Math.acos(Ue(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(s.crossVectors(r[0],r[t]))>0&&(e=-e);for(let n=1;n<=t;n++)r[n].applyMatrix4(o.makeRotationAxis(i[n],e*n)),a[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:a}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class ju extends Xi{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new xn(16777215),this.specular=new xn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=be,this.normalScale=new an(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=j,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Xu extends Xi{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new xn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=be,this.normalScale=new an(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=j,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}function qu(t,e,n){return Yu(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)}function $u(t,e,n){return!t||!n&&t.constructor===e?t:"number"===typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)}function Yu(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Zu(t){function e(e,n){return t[e]-t[n]}const n=t.length,i=new Array(n);for(let r=0;r!==n;++r)i[r]=r;return i.sort(e),i}function Ku(t,e,n){const i=t.length,r=new t.constructor(i);for(let a=0,s=0;s!==i;++a){const i=n[a]*e;for(let n=0;n!==e;++n)r[s++]=t[i+n]}return r}function Ju(t,e,n,i){let r=1,a=t[0];while(void 0!==a&&void 0===a[i])a=t[r++];if(void 0===a)return;let s=a[i];if(void 0!==s)if(Array.isArray(s))do{s=a[i],void 0!==s&&(e.push(a.time),n.push.apply(n,s)),a=t[r++]}while(void 0!==a);else if(void 0!==s.toArray)do{s=a[i],void 0!==s&&(e.push(a.time),s.toArray(n,n.length)),a=t[r++]}while(void 0!==a);else do{s=a[i],void 0!==s&&(e.push(a.time),n.push(s)),a=t[r++]}while(void 0!==a)}class Qu{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{let a;n:{i:if(!(t=r)break t;{const s=e[1];t=r)break e}a=n,n=0}}while(n>>1;te)--a;if(++a,0!==r||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);const t=this.getValueSize();this.times=qu(n,r,a),this.values=qu(this.values,r*t,a*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let a=null;for(let s=0;s!==r;s++){const e=n[s];if("number"===typeof e&&isNaN(e)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,s,e),t=!1;break}if(null!==a&&a>e){console.error("THREE.KeyframeTrack: Out of order keys.",this,s,e,a),t=!1;break}a=e}if(void 0!==i&&Yu(i))for(let s=0,o=i.length;s!==o;++s){const e=i[s];if(isNaN(e)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,s,e),t=!1;break}}return t}optimize(){const t=qu(this.times),e=qu(this.values),n=this.getValueSize(),i=this.getInterpolation()===de,r=t.length-1;let a=1;for(let s=1;s0){t[a]=t[r];for(let t=r*n,i=a*n,s=0;s!==n;++s)e[i+s]=e[t+s];++a}return a!==t.length?(this.times=qu(t,0,a),this.values=qu(e,0,a*n)):(this.times=t,this.values=e),this}clone(){const t=qu(this.times,0),e=qu(this.values,0),n=this.constructor,i=new n(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}ih.prototype.TimeBufferType=Float32Array,ih.prototype.ValueBufferType=Float32Array,ih.prototype.DefaultInterpolation=he;class rh extends ih{}rh.prototype.ValueTypeName="bool",rh.prototype.ValueBufferType=Array,rh.prototype.DefaultInterpolation=ue,rh.prototype.InterpolantFactoryMethodLinear=void 0,rh.prototype.InterpolantFactoryMethodSmooth=void 0;class ah extends ih{}ah.prototype.ValueTypeName="color";class sh extends ih{}sh.prototype.ValueTypeName="number";class oh extends Qu{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(n-e)/(i-e);let l=t*s;for(let c=l+s;l!==c;l+=4)Pn.slerpFlat(r,0,a,l-s,a,l,o);return r}}class lh extends ih{InterpolantFactoryMethodLinear(t){return new oh(this.times,this.values,this.getValueSize(),t)}}lh.prototype.ValueTypeName="quaternion",lh.prototype.DefaultInterpolation=he,lh.prototype.InterpolantFactoryMethodSmooth=void 0;class ch extends ih{}ch.prototype.ValueTypeName="string",ch.prototype.ValueBufferType=Array,ch.prototype.DefaultInterpolation=ue,ch.prototype.InterpolantFactoryMethodLinear=void 0,ch.prototype.InterpolantFactoryMethodSmooth=void 0;class uh extends ih{}uh.prototype.ValueTypeName="vector";class hh{constructor(t,e=-1,n,i=ge){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=Ne(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let a=0,s=n.length;a!==s;++a)e.push(ph(n[a]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let r=0,a=n.length;r!==a;++r)e.push(ih.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(t,e,n,i){const r=e.length,a=[];for(let s=0;s1){const t=n[1];let r=i[t];r||(i[t]=r=[]),r.push(e)}}const a=[];for(const s in i)a.push(this.CreateFromMorphTargetSequence(s,i[s],e,n));return a}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,i,r){if(0!==n.length){const a=[],s=[];Ju(n,a,s,i),0!==a.length&&r.push(new t(e,a,s))}},i=[],r=t.name||"default",a=t.fps||30,s=t.blendMode;let o=t.length||-1;const l=t.hierarchy||[];for(let u=0;u{e&&e(r),this.manager.itemEnd(t)},0),r;if(void 0!==_h[t])return void _h[t].push({onLoad:e,onProgress:n,onError:i});_h[t]=[],_h[t].push({onLoad:e,onProgress:n,onError:i});const a=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),s=this.mimeType,o=this.responseType;fetch(a).then(e=>{if(200===e.status||0===e.status){if(0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"===typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const n=_h[t],i=e.body.getReader(),r=e.headers.get("Content-Length"),a=r?parseInt(r):0,s=0!==a;let o=0;const l=new ReadableStream({start(t){function e(){i.read().then(({done:i,value:r})=>{if(i)t.close();else{o+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:s,loaded:o,total:a});for(let t=0,e=n.length;t{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then(t=>{const e=new DOMParser;return e.parseFromString(t,s)});case"json":return t.json();default:if(void 0===s)return t.text();{const e=/charset="?([^;"\s]*)"?/i,n=e.exec(s),i=n&&n[1]?n[1].toLowerCase():void 0,r=new TextDecoder(i);return t.arrayBuffer().then(t=>r.decode(t))}}}).then(e=>{fh.add(t,e);const n=_h[t];delete _h[t];for(let t=0,i=n.length;t{const n=_h[t];if(void 0===n)throw this.manager.itemError(t),e;delete _h[t];for(let t=0,i=n.length;t{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class bh extends vh{constructor(t){super(t)}load(t,e,n,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,a=fh.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout((function(){e&&e(a),r.manager.itemEnd(t)}),0),a;const s=ln("img");function o(){c(),fh.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){c(),i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}function c(){s.removeEventListener("load",o,!1),s.removeEventListener("error",l,!1)}return s.addEventListener("load",o,!1),s.addEventListener("error",l,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),r.manager.itemStart(t),s.src=t,s}}class Mh extends vh{constructor(t){super(t)}load(t,e,n,i){const r=new Tn,a=new bh(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(t,(function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)}),n,i),r}}class wh extends Ii{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new xn(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}const Sh=new li,Th=new Dn,Eh=new Dn;class Ah{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new an(512,512),this.map=null,this.mapPass=null,this.matrix=new li,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Yr,this._frameExtents=new an(1,1),this._viewportCount=1,this._viewports=[new En(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;Th.setFromMatrixPosition(t.matrixWorld),e.position.copy(Th),Eh.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Eh),e.updateMatrixWorld(),Sh.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Sh),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(e.projectionMatrix),n.multiply(e.matrixWorldInverse)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class Ch extends Ah{constructor(){super(new kr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(t){const e=this.camera,n=2*Oe*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;n===e.fov&&i===e.aspect&&r===e.far||(e.fov=n,e.aspect=i,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}class Lh extends wh{constructor(t,e,n=0,i=Math.PI/3,r=0,a=1){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Ii.DefaultUp),this.updateMatrix(),this.target=new Ii,this.distance=n,this.angle=i,this.penumbra=r,this.decay=a,this.map=null,this.shadow=new Ch}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}const Ph=new li,Dh=new Dn,Rh=new Dn;class Ih extends Ah{constructor(){super(new kr(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new an(4,2),this._viewportCount=6,this._viewports=[new En(2,1,1,1),new En(0,1,1,1),new En(3,1,1,1),new En(1,1,1,1),new En(3,0,1,1),new En(1,0,1,1)],this._cubeDirections=[new Dn(1,0,0),new Dn(-1,0,0),new Dn(0,0,1),new Dn(0,0,-1),new Dn(0,1,0),new Dn(0,-1,0)],this._cubeUps=[new Dn(0,1,0),new Dn(0,1,0),new Dn(0,1,0),new Dn(0,1,0),new Dn(0,0,1),new Dn(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,i=this.matrix,r=t.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Dh.setFromMatrixPosition(t.matrixWorld),n.position.copy(Dh),Rh.copy(n.position),Rh.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(Rh),n.updateMatrixWorld(),i.makeTranslation(-Dh.x,-Dh.y,-Dh.z),Ph.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ph)}}class Oh extends wh{constructor(t,e,n=0,i=1){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Ih}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}class Nh extends Ah{constructor(){super(new Fo(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Uh extends wh{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ii.DefaultUp),this.updateMatrix(),this.target=new Ii,this.shadow=new Nh}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}class kh extends wh{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}}class zh{static decodeText(t){if("undefined"!==typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let i=0,r=t.length;i Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE version 0.6.9 */try{URL.revokeObjectURL(s(""))}catch(un){s=function(t){return"data:application/javascript;charset=UTF-8,"+encodeURI(t)},o=function(t){return new Worker(t,{type:"module"})}}var l=function(t,e,n,i,r){var l=o(a[e]||(a[e]=s(t)));return l.onerror=function(t){return r(t.error,null)},l.onmessage=function(t){return r(null,t.data)},l.postMessage(n,i),l},c=Uint8Array,u=Uint16Array,h=Uint32Array,d=new c([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),p=new c([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),f=new c([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),m=function(t,e){for(var n=new u(31),i=0;i<31;++i)n[i]=e+=1<>>1|(21845&w)<<1;S=(52428&S)>>>2|(13107&S)<<2,S=(61680&S)>>>4|(3855&S)<<4,M[w]=((65280&S)>>>8|(255&S)<<8)>>>1}var T=function(t,e,n){for(var i=t.length,r=0,a=new u(e);r>>l]=c}else for(s=new u(i),r=0;r>>15-t[r]);return s},E=new c(288);for(w=0;w<144;++w)E[w]=8;for(w=144;w<256;++w)E[w]=9;for(w=256;w<280;++w)E[w]=7;for(w=280;w<288;++w)E[w]=8;var A=new c(32);for(w=0;w<32;++w)A[w]=5;var C=T(E,9,0),L=T(E,9,1),P=T(A,5,0),D=T(A,5,1),R=function(t){for(var e=t[0],n=1;ne&&(e=t[n]);return e},I=function(t,e,n){var i=e/8|0;return(t[i]|t[i+1]<<8)>>(7&e)&n},O=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(7&e)},N=function(t){return(t/8|0)+(7&t&&1)},U=function(t,e,n){(null==e||e<0)&&(e=0),(null==n||n>t.length)&&(n=t.length);var i=new(t instanceof u?u:t instanceof h?h:c)(n-e);return i.set(t.subarray(e,n)),i},k=function(t,e,n){var i=t.length;if(!i||n&&!n.l&&i<5)return e||new c(0);var r=!e||n,a=!n||n.i;n||(n={}),e||(e=new c(3*i));var s=function(t){var n=e.length;if(t>n){var i=new c(Math.max(2*n,t));i.set(e),e=i}},o=n.f||0,l=n.p||0,u=n.b||0,h=n.l,m=n.d,g=n.m,_=n.n,x=8*i;do{if(!h){n.f=o=I(t,l,1);var b=I(t,l+1,3);if(l+=3,!b){var M=N(l)+4,w=t[M-4]|t[M-3]<<8,S=M+w;if(S>i){if(a)throw"unexpected EOF";break}r&&s(u+w),e.set(t.subarray(M,S),u),n.b=u+=w,n.p=l=8*S;continue}if(1==b)h=L,m=D,g=9,_=5;else{if(2!=b)throw"invalid block type";var E=I(t,l,31)+257,A=I(t,l+10,15)+4,C=E+I(t,l+5,31)+1;l+=14;for(var P=new c(C),k=new c(19),z=0;z>>4;if(M<16)P[z++]=M;else{var G=0,W=0;16==M?(W=3+I(t,l,3),l+=2,G=P[z-1]):17==M?(W=3+I(t,l,7),l+=3):18==M&&(W=11+I(t,l,127),l+=7);while(W--)P[z++]=G}}var j=P.subarray(0,E),X=P.subarray(E);g=R(j),_=R(X),h=T(j,g,1),m=T(X,_,1)}if(l>x){if(a)throw"unexpected EOF";break}}r&&s(u+131072);for(var q=(1<>>4;if(l+=15&G,l>x){if(a)throw"unexpected EOF";break}if(!G)throw"invalid length/literal";if(Z<256)e[u++]=Z;else{if(256==Z){Y=l,h=null;break}var K=Z-254;if(Z>264){z=Z-257;var J=d[z];K=I(t,l,(1<>>4;if(!Q)throw"invalid distance";l+=15&Q;X=y[tt];if(tt>3){J=p[tt];X+=O(t,l)&(1<x){if(a)throw"unexpected EOF";break}r&&s(u+131072);for(var et=u+K;u>>8},F=function(t,e,n){n<<=7&e;var i=e/8|0;t[i]|=n,t[i+1]|=n>>>8,t[i+2]|=n>>>16},B=function(t,e){for(var n=[],i=0;if&&(f=a[i].s);var m=new u(f+1),g=V(n[d-1],m,0);if(g>e){i=0;var v=0,_=g-e,x=1<<_;for(a.sort((function(t,e){return m[e.s]-m[t.s]||t.f-e.f}));ie))break;v+=x-(1<>>=_;while(v>0){var b=a[i].s;m[b]=0&&v;--i){var M=a[i].s;m[M]==e&&(--m[M],++v)}g=e}return[new c(m),g]},V=function(t,e,n){return-1==t.s?Math.max(V(t.l,e,n+1),V(t.r,e,n+1)):e[t.s]=n},H=function(t){var e=t.length;while(e&&!t[--e]);for(var n=new u(++e),i=0,r=t[0],a=1,s=function(t){n[i++]=t},o=1;o<=e;++o)if(t[o]==r&&o!=e)++a;else{if(!r&&a>2){for(;a>138;a-=138)s(32754);a>2&&(s(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(s(r),--a;a>6;a-=6)s(8304);a>2&&(s(a-3<<5|8208),a=0)}while(a--)s(r);a=1,r=t[o]}return[n.subarray(0,i),e]},G=function(t,e){for(var n=0,i=0;i>>8,t[r+2]=255^t[r],t[r+3]=255^t[r+1];for(var a=0;a4&&!N[f[k-1]];--k);var V,j,X,q,$=c+5<<3,Y=G(r,E)+G(a,A)+s,Z=G(r,g)+G(a,x)+s+14+3*k+G(R,N)+(2*R[16]+3*R[17]+7*R[18]);if($<=Y&&$<=Z)return W(e,h,t.subarray(l,l+c));if(z(e,h,1+(Z15&&(z(e,h,tt[I]>>>5&127),h+=tt[I]>>>12)}}}else V=C,j=E,X=P,q=A;for(I=0;I255){et=i[I]>>>18&31;F(e,h,V[et+257]),h+=j[et+257],et>7&&(z(e,h,i[I]>>>23&31),h+=d[et]);var nt=31&i[I];F(e,h,X[nt]),h+=q[nt],nt>3&&(F(e,h,i[I]>>>5&8191),h+=p[nt])}else F(e,h,V[i[I]]),h+=j[i[I]];return F(e,h,V[256]),h+j[256]},X=new h([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),q=new c(0),$=function(t,e,n,i,r,a){var s=t.length,o=new c(i+s+5*(1+Math.ceil(s/7e3))+r),l=o.subarray(i,o.length-r),f=0;if(!e||s<8)for(var m=0;m<=s;m+=65535){var g=m+65535;g>>13,y=8191&v,M=(1<7e3||I>24576)&&V>423){f=j(t,l,0,C,L,P,R,I,k,m-k,f),I=D=R=0,k=m;for(var H=0;H<286;++H)L[H]=0;for(H=0;H<30;++H)P[H]=0}var G=2,$=0,Y=y,Z=F-B&32767;if(V>2&&z==A(m-Z)){var K=Math.min(x,V)-1,J=Math.min(32767,m),Q=Math.min(258,V);while(Z<=J&&--Y&&F!=B){if(t[m+G]==t[m+G-Z]){for(var tt=0;ttG){if(G=tt,$=Z,tt>K)break;var et=Math.min(Z,tt-2),nt=0;for(H=0;Hnt&&(nt=at,B=it)}}}F=B,B=w[F],Z+=F-B+32768&32767}}if($){C[I++]=268435456|_[G]<<18|b[$];var st=31&_[G],ot=31&b[$];R+=d[st]+p[ot],++L[257+st],++P[ot],O=m+G,++D}else C[I++]=t[m],++L[t[m]]}}f=j(t,l,a,C,L,P,R,I,k,m-k,f),!a&&7&f&&(f=W(l,f+1,q))}return U(o,0,i+N(f)+r)},Y=function(){for(var t=new h(256),e=0;e<256;++e){var n=e,i=9;while(--i)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),Z=function(){var t=-1;return{p:function(e){for(var n=t,i=0;i>>8;t=n},d:function(){return~t}}},K=function(){var t=1,e=0;return{p:function(n){for(var i=t,r=e,a=n.length,s=0;s!=a;){for(var o=Math.min(s+2655,a);s>16),r=(65535&r)+15*(r>>16)}t=i,e=r},d:function(){return t%=65521,e%=65521,(255&t)<<24|t>>>8<<16|(255&e)<<8|e>>>8}}},J=function(t,e,n,i,r){return $(t,null==e.level?6:e.level,null==e.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,n,i,!r)},Q=function(t,e){var n={};for(var i in t)n[i]=t[i];for(var i in e)n[i]=e[i];return n},tt=function(t,e,n){for(var i=t(),r=t.toString(),a=r.slice(r.indexOf("[")+1,r.lastIndexOf("]")).replace(/ /g,"").split(","),s=0;s>>0},vt=function(t,e){return gt(t,e)+4294967296*gt(t,e+4)},_t=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8},xt=function(t,e){var n=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=e.level<2?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&_t(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),n){t[3]=8;for(var i=0;i<=n.length;++i)t[i+10]=n.charCodeAt(i)}},yt=function(t){if(31!=t[0]||139!=t[1]||8!=t[2])throw"invalid gzip data";var e=t[3],n=10;4&e&&(n+=t[10]|2+(t[11]<<8));for(var i=(e>>3&1)+(e>>4&1);i>0;i-=!t[n++]);return n+(2&e)},bt=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},Mt=function(t){return 10+(t.filename&&t.filename.length+1||0)},wt=function(t,e){var n=e.level,i=0==n?0:n<6?1:9==n?3:2;t[0]=120,t[1]=i<<6|(i?32-2*i:1)},St=function(t){if(8!=(15&t[0])||t[0]>>>4>7||(t[0]<<8|t[1])%31)throw"invalid zlib data";if(32&t[1])throw"invalid zlib data: preset dictionaries not supported"};function Tt(t,e){return e||"function"!=typeof t||(e=t,t={}),this.ondata=e,t}var Et=function(){function t(t,e){e||"function"!=typeof t||(e=t,t={}),this.ondata=e,this.o=t||{}}return t.prototype.p=function(t,e){this.ondata(J(t,this.o,0,0,!e),e)},t.prototype.push=function(t,e){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";this.d=e,this.p(t,e||!1)},t}(),At=function(){function t(t,e){ft([at,function(){return[pt,Et]}],this,Tt.call(this,t,e),(function(t){var e=new Et(t.data);onmessage=pt(e)}),6)}return t}();function Ct(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return dt(t,e,[at],(function(t){return ut(Lt(t.data[0],t.data[1]))}),0,n)}function Lt(t,e){return J(t,e||{},0,0)}var Pt=function(){function t(t){this.s={},this.p=new c(0),this.ondata=t}return t.prototype.e=function(t){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";var e=this.p.length,n=new c(e+t.length);n.set(this.p),n.set(t,e),this.p=n},t.prototype.c=function(t){this.d=this.s.i=t||!1;var e=this.s.b,n=k(this.p,this.o,this.s);this.ondata(U(n,e,this.s.b),this.d),this.o=U(n,this.s.b-32768),this.s.b=this.o.length,this.p=U(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(t,e){this.e(t),this.c(e)},t}(),Dt=function(){function t(t){this.ondata=t,ft([rt,function(){return[pt,Pt]}],this,0,(function(){var t=new Pt;onmessage=pt(t)}),7)}return t}();function Rt(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return dt(t,e,[rt],(function(t){return ut(It(t.data[0],ht(t.data[1])))}),1,n)}function It(t,e){return k(t,e)}var Ot=function(){function t(t,e){this.c=Z(),this.l=0,this.v=1,Et.call(this,t,e)}return t.prototype.push=function(t,e){Et.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){this.c.p(t),this.l+=t.length;var n=J(t,this.o,this.v&&Mt(this.o),e&&8,!e);this.v&&(xt(n,this.o),this.v=0),e&&(_t(n,n.length-8,this.c.d()),_t(n,n.length-4,this.l)),this.ondata(n,e)},t}(),Nt=function(){function t(t,e){ft([at,st,function(){return[pt,Et,Ot]}],this,Tt.call(this,t,e),(function(t){var e=new Ot(t.data);onmessage=pt(e)}),8)}return t}();function Ut(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return dt(t,e,[at,st,function(){return[kt]}],(function(t){return ut(kt(t.data[0],t.data[1]))}),2,n)}function kt(t,e){e||(e={});var n=Z(),i=t.length;n.p(t);var r=J(t,e,Mt(e),8),a=r.length;return xt(r,e),_t(r,a-8,n.d()),_t(r,a-4,i),r}var zt=function(){function t(t){this.v=1,Pt.call(this,t)}return t.prototype.push=function(t,e){if(Pt.prototype.e.call(this,t),this.v){var n=this.p.length>3?yt(this.p):4;if(n>=this.p.length&&!e)return;this.p=this.p.subarray(n),this.v=0}if(e){if(this.p.length<8)throw"invalid gzip stream";this.p=this.p.subarray(0,-8)}Pt.prototype.c.call(this,e)},t}(),Ft=function(){function t(t){this.ondata=t,ft([rt,ot,function(){return[pt,Pt,zt]}],this,0,(function(){var t=new zt;onmessage=pt(t)}),9)}return t}();function Bt(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return dt(t,e,[rt,ot,function(){return[Vt]}],(function(t){return ut(Vt(t.data[0]))}),3,n)}function Vt(t,e){return k(t.subarray(yt(t),-8),e||new c(bt(t)))}var Ht=function(){function t(t,e){this.c=K(),this.v=1,Et.call(this,t,e)}return t.prototype.push=function(t,e){Et.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){this.c.p(t);var n=J(t,this.o,this.v&&2,e&&4,!e);this.v&&(wt(n,this.o),this.v=0),e&&_t(n,n.length-4,this.c.d()),this.ondata(n,e)},t}(),Gt=function(){function t(t,e){ft([at,lt,function(){return[pt,Et,Ht]}],this,Tt.call(this,t,e),(function(t){var e=new Ht(t.data);onmessage=pt(e)}),10)}return t}();function Wt(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return dt(t,e,[at,lt,function(){return[jt]}],(function(t){return ut(jt(t.data[0],t.data[1]))}),4,n)}function jt(t,e){e||(e={});var n=K();n.p(t);var i=J(t,e,2,4);return wt(i,e),_t(i,i.length-4,n.d()),i}var Xt=function(){function t(t){this.v=1,Pt.call(this,t)}return t.prototype.push=function(t,e){if(Pt.prototype.e.call(this,t),this.v){if(this.p.length<2&&!e)return;this.p=this.p.subarray(2),this.v=0}if(e){if(this.p.length<4)throw"invalid zlib stream";this.p=this.p.subarray(0,-4)}Pt.prototype.c.call(this,e)},t}(),qt=function(){function t(t){this.ondata=t,ft([rt,ct,function(){return[pt,Pt,Xt]}],this,0,(function(){var t=new Xt;onmessage=pt(t)}),11)}return t}();function $t(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return dt(t,e,[rt,ct,function(){return[Yt]}],(function(t){return ut(Yt(t.data[0],ht(t.data[1])))}),5,n)}function Yt(t,e){return k((St(t),t.subarray(2,-4)),e)}var Zt=function(){function t(t){this.G=zt,this.I=Pt,this.Z=Xt,this.ondata=t}return t.prototype.push=function(t,e){if(!this.ondata)throw"no stream handler";if(this.s)this.s.push(t,e);else{if(this.p&&this.p.length){var n=new c(this.p.length+t.length);n.set(this.p),n.set(t,this.p.length)}else this.p=t;if(this.p.length>2){var i=this,r=function(){i.ondata.apply(i,arguments)};this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(r):8!=(15&this.p[0])||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(r):new this.Z(r),this.s.push(this.p,e),this.p=null}}},t}(),Kt=function(){function t(t){this.G=Ft,this.I=Dt,this.Z=qt,this.ondata=t}return t.prototype.push=function(t,e){Zt.prototype.push.call(this,t,e)},t}();function Jt(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return 31==t[0]&&139==t[1]&&8==t[2]?Bt(t,e,n):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?Rt(t,e,n):$t(t,e,n)}function Qt(t,e){return 31==t[0]&&139==t[1]&&8==t[2]?Vt(t,e):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?It(t,e):Yt(t,e)}var te=function(t,e,n,i){for(var r in t){var a=t[r],s=e+r;a instanceof c?n[s]=[a,i]:Array.isArray(a)?n[s]=[a[0],Q(i,a[1])]:te(a,s+"/",n,i)}},ee="undefined"!=typeof TextEncoder&&new TextEncoder,ne="undefined"!=typeof TextDecoder&&new TextDecoder,ie=0;try{ne.decode(q,{stream:!0}),ie=1}catch(un){}var re=function(t){for(var e="",n=0;;){var i=t[n++],r=(i>127)+(i>223)+(i>239);if(n+r>t.length)return[e,U(t,n-1)];r?3==r?(i=((15&i)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536,e+=String.fromCharCode(55296|i>>10,56320|1023&i)):e+=1&r?String.fromCharCode((31&i)<<6|63&t[n++]):String.fromCharCode((15&i)<<12|(63&t[n++])<<6|63&t[n++]):e+=String.fromCharCode(i)}},ae=function(){function t(t){this.ondata=t,ie?this.t=new TextDecoder:this.p=q}return t.prototype.push=function(t,e){if(!this.ondata)throw"no callback";if(e=!!e,this.t){if(this.ondata(this.t.decode(t,{stream:!0}),e),e){if(this.t.decode().length)throw"invalid utf-8 data";this.t=null}}else{if(!this.p)throw"stream finished";var n=new c(this.p.length+t.length);n.set(this.p),n.set(t,this.p.length);var i=re(n),r=i[0],a=i[1];if(e){if(a.length)throw"invalid utf-8 data";this.p=null}else this.p=a;this.ondata(r,e)}},t}(),se=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,e){if(!this.ondata)throw"no callback";if(this.d)throw"stream finished";this.ondata(oe(t),this.d=e||!1)},t}();function oe(t,e){if(e){for(var n=new c(t.length),i=0;i>1)),s=0,o=function(t){a[s++]=t};for(i=0;ia.length){var l=new c(s+8+(r-i<<1));l.set(a),a=l}var u=t.charCodeAt(i);u<128||e?o(u):u<2048?(o(192|u>>6),o(128|63&u)):u>55295&&u<57344?(u=65536+(1047552&u)|1023&t.charCodeAt(++i),o(240|u>>18),o(128|u>>12&63),o(128|u>>6&63),o(128|63&u)):(o(224|u>>12),o(128|u>>6&63),o(128|63&u))}return U(a,0,s)}function le(t,e){if(e){for(var n="",i=0;i65535)throw"extra field too long";e+=i+4}return e},fe=function(t,e,n,i,r,a,s,o){var l=i.length,c=n.extra,u=o&&o.length,h=pe(c);_t(t,e,null!=s?33639248:67324752),e+=4,null!=s&&(t[e++]=20,t[e++]=n.os),t[e]=20,e+=2,t[e++]=n.flag<<1|(null==a&&8),t[e++]=r&&8,t[e++]=255&n.compression,t[e++]=n.compression>>8;var d=new Date(null==n.mtime?Date.now():n.mtime),p=d.getFullYear()-1980;if(p<0||p>119)throw"date not in range 1980-2099";if(_t(t,e,p<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>>1),e+=4,null!=a&&(_t(t,e,n.crc),_t(t,e+4,a),_t(t,e+8,n.size)),_t(t,e+12,l),_t(t,e+14,h),e+=16,null!=s&&(_t(t,e,u),_t(t,e+6,n.attrs),_t(t,e+10,s),e+=14),t.set(i,e),e+=l,h)for(var f in c){var m=c[f],g=m.length;_t(t,e,+f),_t(t,e+2,g),t.set(m,e+4),e+=4+g}return u&&(t.set(o,e),e+=u),e},me=function(t,e,n,i,r){_t(t,e,101010256),_t(t,e+8,n),_t(t,e+10,n),_t(t,e+12,i),_t(t,e+16,r)},ge=function(){function t(t){this.filename=t,this.c=Z(),this.size=0,this.compression=0}return t.prototype.process=function(t,e){this.ondata(null,t,e)},t.prototype.push=function(t,e){if(!this.ondata)throw"no callback - add to ZIP archive before pushing";this.c.p(t),this.size+=t.length,e&&(this.crc=this.c.d()),this.process(t,e||!1)},t}(),ve=function(){function t(t,e){var n=this;e||(e={}),ge.call(this,t),this.d=new Et(e,(function(t,e){n.ondata(null,t,e)})),this.compression=8,this.flag=ce(e.level)}return t.prototype.process=function(t,e){try{this.d.push(t,e)}catch(un){this.ondata(un,null,e)}},t.prototype.push=function(t,e){ge.prototype.push.call(this,t,e)},t}(),_e=function(){function t(t,e){var n=this;e||(e={}),ge.call(this,t),this.d=new At(e,(function(t,e,i){n.ondata(t,e,i)})),this.compression=8,this.flag=ce(e.level),this.terminate=this.d.terminate}return t.prototype.process=function(t,e){this.d.push(t,e)},t.prototype.push=function(t,e){ge.prototype.push.call(this,t,e)},t}(),xe=function(){function t(t){this.ondata=t,this.u=[],this.d=1}return t.prototype.add=function(t){var e=this;if(2&this.d)throw"stream finished";var n=oe(t.filename),i=n.length,r=t.comment,a=r&&oe(r),s=i!=t.filename.length||a&&r.length!=a.length,o=i+pe(t.extra)+30;if(i>65535)throw"filename too long";var l=new c(o);fe(l,0,t,n,s);var u=[l],h=function(){for(var t=0,n=u;t65535&&S("filename too long",null),w)if(g<16e4)try{S(null,Lt(c,f))}catch(un){S(un,null)}else h.push(Ct(c,f,S));else S(null,c)},m=0;m65535)throw"filename too long";var _=h?Lt(l,u):l,x=_.length,y=Z();y.p(l),i.push(Q(u,{size:l.length,crc:y.d(),c:_,f:d,m:m,u:p!=s.length||m&&f.length!=g,o:r,compression:h})),r+=30+p+v+x,a+=76+2*(p+v)+(g||0)+x}for(var b=new c(a+22),M=r,w=a-r,S=0;S0){var i=Math.min(this.c,t.length),r=t.subarray(0,i);if(this.c-=i,this.d?this.d.push(r,!this.c):this.k[0].push(r),t=t.subarray(i),t.length)return this.push(t,e)}else{var a=0,s=0,o=void 0,l=void 0;this.p.length?t.length?(l=new c(this.p.length+t.length),l.set(this.p),l.set(t,this.p.length)):l=this.p:l=t;for(var u=l.length,h=this.c,d=h&&this.d,p=function(){var t,e=gt(l,s);if(67324752==e){a=1,o=s,f.d=null,f.c=0;var i=mt(l,s+6),r=mt(l,s+8),c=2048&i,d=8&i,p=mt(l,s+26),m=mt(l,s+28);if(u>s+30+p+m){var g=[];f.k.unshift(g),a=2;var v,_=gt(l,s+18),x=gt(l,s+22),y=le(l.subarray(s+30,s+=30+p),!c);4294967295==_?(t=d?[-2]:de(l,s),_=t[0],x=t[1]):d&&(_=-1),s+=m,f.c=_;var b={name:y,compression:r,start:function(){if(!b.ondata)throw"no callback";if(_){var t=n.o[r];if(!t)throw"unknown compression type "+r;v=_<0?new t(y):new t(y,_,x),v.ondata=function(t,e,n){b.ondata(t,e,n)};for(var e=0,i=g;e=0&&(b.size=_,b.originalSize=x),f.onfile(b)}return"break"}if(h){if(134695760==e)return o=s+=12+(-2==h&&8),a=3,f.c=0,"break";if(33639248==e)return o=s-=4,a=3,f.c=0,"break"}},f=this;s65558)return void e("invalid zip file",null);var s=mt(t,a+8);s||e(null,{});var o=s,l=gt(t,a+16),u=4294967295==l;if(u){if(a=gt(t,a-12),101075792!=gt(t,a))return void e("invalid zip file",null);o=s=gt(t,a+32),l=gt(t,a+48)}for(var h=function(o){var h=he(t,l,u),d=h[0],p=h[1],f=h[2],m=h[3],g=h[4],v=h[5],_=ue(t,v);l=g;var x=function(t,n){t?(i(),e(t,null)):(r[m]=n,--s||e(null,r))};if(d)if(8==d){var y=t.subarray(_,_+p);if(p<32e4)try{x(null,It(y,new c(f)))}catch(a){x(a,null)}else n.push(Rt(y,{size:f},x))}else x("unknown compression type "+d,null);else x(null,U(t,_,_+p))},d=0;d65558)throw"invalid zip file";var i=mt(t,n+8);if(!i)return{};var r=gt(t,n+16),a=4294967295==r;if(a){if(n=gt(t,n-12),101075792!=gt(t,n))throw"invalid zip file";i=gt(t,n+32),r=gt(t,n+48)}for(var s=0;s=n[i])return i-1;if(e<=n[t])return t;let r=t,a=i,s=Math.floor((r+a)/2);while(e=n[s+1])e=a&&(r[e][0]=r[t][0]/o[c+1][l],i=r[e][0]*o[l][c]);const u=l>=-1?1:-l,d=h-1<=c?a-1:n-h;for(let n=u;n<=d;++n)r[e][n]=(r[t][n]-r[t][n-1])/o[c+1][l+n],i+=r[e][n]*o[l+n][c];h<=c&&(r[e][a]=-r[t][a-1]/o[c+1][h],i+=r[e][a]*o[h][c]),s[a][h]=i;const p=t;t=e,e=p}}let u=n;for(let h=1;h<=i;++h){for(let t=0;t<=n;++t)s[h][t]*=u;u*=n-h}return s}function Re(t,e,n,i,a){const s=a0,a="string"===typeof r.Content&&""!==r.Content;if(t||a){const t=this.parseImage(n[i]);e[r.RelativeFilename||r.Filename]=t}}}}for(const n in t){const i=t[n];void 0!==e[i]?t[n]=e[i]:t[n]=t[n].split("\\").pop()}return t}parseImage(t){const e=t.Content,n=t.RelativeFilename||t.Filename,i=n.slice(n.lastIndexOf(".")+1).toLowerCase();let r;switch(i){case"bmp":r="image/bmp";break;case"jpg":case"jpeg":r="image/jpeg";break;case"png":r="image/png";break;case"tif":r="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",n),r="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}if("string"===typeof e)return"data:"+r+";base64,"+e;{const t=new Uint8Array(e);return window.URL.createObjectURL(new Blob([t],{type:r}))}}parseTextures(t){const e=new Map;if("Texture"in ke.Objects){const n=ke.Objects.Texture;for(const i in n){const r=this.parseTexture(n[i],t);e.set(parseInt(i),r)}}return e}parseTexture(t,e){const n=this.loadTexture(t,e);n.ID=t.id,n.name=t.attrName;const i=t.WrapModeU,a=t.WrapModeV,s=void 0!==i?i.value:0,o=void 0!==a?a.value:0;if(n.wrapS=0===s?r["I"]:r["e"],n.wrapT=0===o?r["I"]:r["e"],"Scaling"in t){const e=t.Scaling.value;n.repeat.x=e[0],n.repeat.y=e[1]}if("Translation"in t){const e=t.Translation.value;n.offset.x=e[0],n.offset.y=e[1]}return n}loadTexture(t,e){let n;const i=this.textureLoader.path,a=ze.get(t.id).children;let s;void 0!==a&&a.length>0&&void 0!==e[a[0].ID]&&(n=e[a[0].ID],0!==n.indexOf("blob:")&&0!==n.indexOf("data:")||this.textureLoader.setPath(void 0));const o=t.FileName.slice(-3).toLowerCase();if("tga"===o){const e=this.manager.getHandler(".tga");null===e?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",t.RelativeFilename),s=new r["P"]):(e.setPath(this.textureLoader.path),s=e.load(n))}else"psd"===o?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",t.RelativeFilename),s=new r["P"]):s=this.textureLoader.load(n);return this.textureLoader.setPath(i),s}parseMaterials(t){const e=new Map;if("Material"in ke.Objects){const n=ke.Objects.Material;for(const i in n){const r=this.parseMaterial(n[i],t);null!==r&&e.set(parseInt(i),r)}}return e}parseMaterial(t,e){const n=t.id,i=t.attrName;let a=t.ShadingModel;if("object"===typeof a&&(a=a.value),!ze.has(n))return null;const s=this.parseParameters(t,e,n);let o;switch(a.toLowerCase()){case"phong":o=new r["y"];break;case"lambert":o=new r["x"];break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',a),o=new r["y"];break}return o.setValues(s),o.name=i,o}parseParameters(t,e,n){const i={};t.BumpFactor&&(i.bumpScale=t.BumpFactor.value),t.Diffuse?i.color=(new r["f"]).fromArray(t.Diffuse.value):!t.DiffuseColor||"Color"!==t.DiffuseColor.type&&"ColorRGB"!==t.DiffuseColor.type||(i.color=(new r["f"]).fromArray(t.DiffuseColor.value)),t.DisplacementFactor&&(i.displacementScale=t.DisplacementFactor.value),t.Emissive?i.emissive=(new r["f"]).fromArray(t.Emissive.value):!t.EmissiveColor||"Color"!==t.EmissiveColor.type&&"ColorRGB"!==t.EmissiveColor.type||(i.emissive=(new r["f"]).fromArray(t.EmissiveColor.value)),t.EmissiveFactor&&(i.emissiveIntensity=parseFloat(t.EmissiveFactor.value)),t.Opacity&&(i.opacity=parseFloat(t.Opacity.value)),i.opacity<1&&(i.transparent=!0),t.ReflectionFactor&&(i.reflectivity=t.ReflectionFactor.value),t.Shininess&&(i.shininess=t.Shininess.value),t.Specular?i.specular=(new r["f"]).fromArray(t.Specular.value):t.SpecularColor&&"Color"===t.SpecularColor.type&&(i.specular=(new r["f"]).fromArray(t.SpecularColor.value));const a=this;return ze.get(n).children.forEach((function(t){const n=t.relationship;switch(n){case"Bump":i.bumpMap=a.getTexture(e,t.ID);break;case"Maya|TEX_ao_map":i.aoMap=a.getTexture(e,t.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=a.getTexture(e,t.ID),void 0!==i.map&&(i.map.encoding=r["X"]);break;case"DisplacementColor":i.displacementMap=a.getTexture(e,t.ID);break;case"EmissiveColor":i.emissiveMap=a.getTexture(e,t.ID),void 0!==i.emissiveMap&&(i.emissiveMap.encoding=r["X"]);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=a.getTexture(e,t.ID);break;case"ReflectionColor":i.envMap=a.getTexture(e,t.ID),void 0!==i.envMap&&(i.envMap.mapping=r["i"],i.envMap.encoding=r["X"]);break;case"SpecularColor":i.specularMap=a.getTexture(e,t.ID),void 0!==i.specularMap&&(i.specularMap.encoding=r["X"]);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=a.getTexture(e,t.ID),i.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",n);break}})),i}getTexture(t,e){return"LayeredTexture"in ke.Objects&&e in ke.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),e=ze.get(e).children[0].ID),t.get(e)}parseDeformers(){const t={},e={};if("Deformer"in ke.Objects){const n=ke.Objects.Deformer;for(const i in n){const r=n[i],a=ze.get(parseInt(i));if("Skin"===r.attrType){const e=this.parseSkeleton(a,n);e.ID=i,a.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),e.geometryID=a.parents[0].ID,t[i]=e}else if("BlendShape"===r.attrType){const t={id:i};t.rawTargets=this.parseMorphTargets(a,n),t.id=i,a.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),e[i]=t}}}return{skeletons:t,morphTargets:e}}parseSkeleton(t,e){const n=[];return t.children.forEach((function(t){const i=e[t.ID];if("Cluster"!==i.attrType)return;const a={ID:t.ID,indices:[],weights:[],transformLink:(new r["v"]).fromArray(i.TransformLink.a)};"Indexes"in i&&(a.indices=i.Indexes.a,a.weights=i.Weights.a),n.push(a)})),{rawBones:n,bones:[]}}parseMorphTargets(t,e){const n=[];for(let i=0;i1?s=o:o.length>0?s=o[0]:(s=new r["y"]({color:13421772}),o.push(s)),"color"in a.attributes&&o.forEach((function(t){t.vertexColors=!0})),a.FBX_Deformer?(i=new r["L"](a,s),i.normalizeSkinWeights()):i=new r["w"](a,s),i}createCurve(t,e){const n=t.children.reduce((function(t,n){return e.has(n.ID)&&(t=e.get(n.ID)),t}),null),i=new r["p"]({color:3342591,linewidth:1});return new r["o"](n,i)}getTransformData(t,e){const n={};"InheritType"in e&&(n.inheritType=parseInt(e.InheritType.value)),n.eulerOrder="RotationOrder"in e?rn(e.RotationOrder.value):"ZYX","Lcl_Translation"in e&&(n.translation=e.Lcl_Translation.value),"PreRotation"in e&&(n.preRotation=e.PreRotation.value),"Lcl_Rotation"in e&&(n.rotation=e.Lcl_Rotation.value),"PostRotation"in e&&(n.postRotation=e.PostRotation.value),"Lcl_Scaling"in e&&(n.scale=e.Lcl_Scaling.value),"ScalingOffset"in e&&(n.scalingOffset=e.ScalingOffset.value),"ScalingPivot"in e&&(n.scalingPivot=e.ScalingPivot.value),"RotationOffset"in e&&(n.rotationOffset=e.RotationOffset.value),"RotationPivot"in e&&(n.rotationPivot=e.RotationPivot.value),t.userData.transformData=n}setLookAtProperties(t,e){if("LookAtProperty"in e){const e=ze.get(t.ID).children;e.forEach((function(e){if("LookAtProperty"===e.relationship){const n=ke.Objects.Model[e.ID];if("Lcl_Translation"in n){const e=n.Lcl_Translation.value;void 0!==t.target?(t.target.position.fromArray(e),Fe.add(t.target)):t.lookAt((new r["T"]).fromArray(e))}}}))}}bindSkeleton(t,e,n){const i=this.parsePoseNodes();for(const a in t){const s=t[a],o=ze.get(parseInt(s.ID)).parents;o.forEach((function(t){if(e.has(t.ID)){const e=t.ID,a=ze.get(e);a.parents.forEach((function(t){if(n.has(t.ID)){const e=n.get(t.ID);e.bind(new r["K"](s.bones),i[t.ID])}}))}}))}}parsePoseNodes(){const t={};if("Pose"in ke.Objects){const e=ke.Objects.Pose;for(const n in e)if("BindPose"===e[n].attrType&&e[n].NbPoseNodes>0){const i=e[n].PoseNode;Array.isArray(i)?i.forEach((function(e){t[e.Node]=(new r["v"]).fromArray(e.Matrix.a)})):t[i.Node]=(new r["v"]).fromArray(i.Matrix.a)}}return t}createAmbientLight(){if("GlobalSettings"in ke&&"AmbientColor"in ke.GlobalSettings){const t=ke.GlobalSettings.AmbientColor.value,e=t[0],n=t[1],i=t[2];if(0!==e||0!==n||0!==i){const t=new r["f"](e,n,i);Fe.add(new r["a"](t,1))}}}}class He{parse(t){const e=new Map;if("Geometry"in ke.Objects){const n=ke.Objects.Geometry;for(const i in n){const r=ze.get(parseInt(i)),a=this.parseGeometry(r,n[i],t);e.set(parseInt(i),a)}}return e}parseGeometry(t,e,n){switch(e.attrType){case"Mesh":return this.parseMeshGeometry(t,e,n);case"NurbsCurve":return this.parseNurbsGeometry(e)}}parseMeshGeometry(t,e,n){const i=n.skeletons,r=[],a=t.parents.map((function(t){return ke.Objects.Model[t.ID]}));if(0===a.length)return;const s=t.children.reduce((function(t,e){return void 0!==i[e.ID]&&(t=i[e.ID]),t}),null);t.children.forEach((function(t){void 0!==n.morphTargets[t.ID]&&r.push(n.morphTargets[t.ID])}));const o=a[0],l={};"RotationOrder"in o&&(l.eulerOrder=rn(o.RotationOrder.value)),"InheritType"in o&&(l.inheritType=parseInt(o.InheritType.value)),"GeometricTranslation"in o&&(l.translation=o.GeometricTranslation.value),"GeometricRotation"in o&&(l.rotation=o.GeometricRotation.value),"GeometricScaling"in o&&(l.scale=o.GeometricScaling.value);const c=nn(l);return this.genGeometry(e,s,r,c)}genGeometry(t,e,n,i){const a=new r["d"];t.attrName&&(a.name=t.attrName);const s=this.parseGeoNode(t,e),o=this.genBuffers(s),l=new r["m"](o.vertex,3);if(l.applyMatrix4(i),a.setAttribute("position",l),o.colors.length>0&&a.setAttribute("color",new r["m"](o.colors,3)),e&&(a.setAttribute("skinIndex",new r["R"](o.weightsIndices,4)),a.setAttribute("skinWeight",new r["m"](o.vertexWeights,4)),a.FBX_Deformer=e),o.normal.length>0){const t=(new r["u"]).getNormalMatrix(i),e=new r["m"](o.normal,3);e.applyNormalMatrix(t),a.setAttribute("normal",e)}if(o.uvs.forEach((function(t,e){let n="uv"+(e+1).toString();0===e&&(n="uv"),a.setAttribute(n,new r["m"](o.uvs[e],2))})),s.material&&"AllSame"!==s.material.mappingType){let t=o.materialIndex[0],e=0;if(o.materialIndex.forEach((function(n,i){n!==t&&(a.addGroup(e,i-e,t),t=n,e=i)})),a.groups.length>0){const e=a.groups[a.groups.length-1],n=e.start+e.count;n!==o.materialIndex.length&&a.addGroup(n,o.materialIndex.length-n,t)}0===a.groups.length&&a.addGroup(0,o.materialIndex.length,o.materialIndex[0])}return this.addMorphTargets(a,t,n,i),a}parseGeoNode(t,e){const n={};if(n.vertexPositions=void 0!==t.Vertices?t.Vertices.a:[],n.vertexIndices=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],t.LayerElementColor&&(n.color=this.parseVertexColors(t.LayerElementColor[0])),t.LayerElementMaterial&&(n.material=this.parseMaterialIndices(t.LayerElementMaterial[0])),t.LayerElementNormal&&(n.normal=this.parseNormals(t.LayerElementNormal[0])),t.LayerElementUV){n.uv=[];let e=0;while(t.LayerElementUV[e])t.LayerElementUV[e].UV&&n.uv.push(this.parseUVs(t.LayerElementUV[e])),e++}return n.weightTable={},null!==e&&(n.skeleton=e,e.rawBones.forEach((function(t,e){t.indices.forEach((function(i,r){void 0===n.weightTable[i]&&(n.weightTable[i]=[]),n.weightTable[i].push({id:e,weight:t.weights[r]})}))}))),n}genBuffers(t){const e={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,i=0,r=!1,a=[],s=[],o=[],l=[],c=[],u=[];const h=this;return t.vertexIndices.forEach((function(d,p){let f,m=!1;d<0&&(d^=-1,m=!0);let g=[],v=[];if(a.push(3*d,3*d+1,3*d+2),t.color){const e=Qe(p,n,d,t.color);o.push(e[0],e[1],e[2])}if(t.skeleton){if(void 0!==t.weightTable[d]&&t.weightTable[d].forEach((function(t){v.push(t.weight),g.push(t.id)})),v.length>4){r||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),r=!0);const t=[0,0,0,0],e=[0,0,0,0];v.forEach((function(n,i){let r=n,a=g[i];e.forEach((function(e,n,i){if(r>e){i[n]=r,r=e;const s=t[n];t[n]=a,a=s}}))})),g=t,v=e}while(v.length<4)v.push(0),g.push(0);for(let t=0;t<4;++t)c.push(v[t]),u.push(g[t])}if(t.normal){const e=Qe(p,n,d,t.normal);s.push(e[0],e[1],e[2])}t.material&&"AllSame"!==t.material.mappingType&&(f=Qe(p,n,d,t.material)[0],f<0&&(console.warn("THREE.FBXLoader: Invalid material index:",f),f=0)),t.uv&&t.uv.forEach((function(t,e){const i=Qe(p,n,d,t);void 0===l[e]&&(l[e]=[]),l[e].push(i[0]),l[e].push(i[1])})),i++,m&&(h.genFace(e,t,a,f,s,o,l,c,u,i),n++,i=0,a=[],s=[],o=[],l=[],c=[],u=[])})),e}genFace(t,e,n,i,r,a,s,o,l,c){for(let u=2;u1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const a=t.get(r[0].ID);n[i]={name:e[i].attrName,layer:a}}return n}addClip(t){let e=[];const n=this;return t.layer.forEach((function(t){e=e.concat(n.generateTracks(t))})),new r["b"](t.name,-1,e)}generateTracks(t){const e=[];let n=new r["T"],i=new r["G"],a=new r["T"];if(t.transform&&t.transform.decompose(n,i,a),n=n.toArray(),i=(new r["j"]).setFromQuaternion(i,t.eulerOrder).toArray(),a=a.toArray(),void 0!==t.T&&Object.keys(t.T.curves).length>0){const i=this.generateVectorTrack(t.modelName,t.T.curves,n,"position");void 0!==i&&e.push(i)}if(void 0!==t.R&&Object.keys(t.R.curves).length>0){const n=this.generateRotationTrack(t.modelName,t.R.curves,i,t.preRotation,t.postRotation,t.eulerOrder);void 0!==n&&e.push(n)}if(void 0!==t.S&&Object.keys(t.S.curves).length>0){const n=this.generateVectorTrack(t.modelName,t.S.curves,a,"scale");void 0!==n&&e.push(n)}if(void 0!==t.DeformPercent){const n=this.generateMorphTrack(t);void 0!==n&&e.push(n)}return e}generateVectorTrack(t,e,n,i){const a=this.getTimesForAllAxes(e),s=this.getKeyframeTrackValues(a,e,n);return new r["V"](t+"."+i,a,s)}generateRotationTrack(t,e,n,i,a,s){void 0!==e.x&&(this.interpolateRotations(e.x),e.x.values=e.x.values.map(r["t"].degToRad)),void 0!==e.y&&(this.interpolateRotations(e.y),e.y.values=e.y.values.map(r["t"].degToRad)),void 0!==e.z&&(this.interpolateRotations(e.z),e.z.values=e.z.values.map(r["t"].degToRad));const o=this.getTimesForAllAxes(e),l=this.getKeyframeTrackValues(o,e,n);void 0!==i&&(i=i.map(r["t"].degToRad),i.push(s),i=(new r["j"]).fromArray(i),i=(new r["G"]).setFromEuler(i)),void 0!==a&&(a=a.map(r["t"].degToRad),a.push(s),a=(new r["j"]).fromArray(a),a=(new r["G"]).setFromEuler(a).invert());const c=new r["G"],u=new r["j"],h=[];for(let r=0;r1){let t=1,n=e[0];for(let i=1;i=180){const a=r/180,s=i/a;let o=n+s;const l=t.times[e-1],c=t.times[e]-l,u=c/a;let h=l+u;const d=[],p=[];while(h1&&(n=t[1].replace(/^(\w+)::/,""),i=t[2]),{id:e,name:n,type:i}}parseNodeProperty(t,e,n){let i=e[1].replace(/^"/,"").replace(/"$/,"").trim(),r=e[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===i&&","===r&&(r=n.replace(/"/g,"").replace(/,$/,"").trim());const a=this.getCurrentNode(),s=a.name;if("Properties70"!==s){if("C"===i){const t=r.split(",").slice(1),e=parseInt(t[0]),n=parseInt(t[1]);let s=r.split(",").slice(3);s=s.map((function(t){return t.trim().replace(/^"/,"")})),i="connections",r=[e,n],on(r,s),void 0===a[i]&&(a[i]=[])}"Node"===i&&(a.id=r),i in a&&Array.isArray(a[i])?a[i].push(r):"a"!==i?a[i]=r:a.a=r,this.setCurrentProp(a,i),"a"===i&&","!==r.slice(-1)&&(a.a=an(r))}else this.parseNodeSpecialProperty(t,i,r)}parseNodePropertyContinued(t){const e=this.getCurrentNode();e.a+=t,","!==t.slice(-1)&&(e.a=an(e.a))}parseNodeSpecialProperty(t,e,n){const i=n.split('",').map((function(t){return t.trim().replace(/^\"/,"").replace(/\s/,"_")})),r=i[0],a=i[1],s=i[2],o=i[3];let l=i[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":l=parseFloat(l);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":l=an(l);break}this.getPrevNode()[r]={type:a,type2:s,flag:o,value:l},this.setCurrentProp(this.getPrevNode(),r)}}class je{parse(t){const e=new Xe(t);e.skip(23);const n=e.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const i=new qe;while(!this.endOfContent(e)){const t=this.parseNode(e,n);null!==t&&i.add(t.name,t)}return i}endOfContent(t){return t.size()%16===0?(t.getOffset()+160+16&-16)>=t.size():t.getOffset()+160+16>=t.size()}parseNode(t,e){const n={},i=e>=7500?t.getUint64():t.getUint32(),r=e>=7500?t.getUint64():t.getUint32();e>=7500?t.getUint64():t.getUint32();const a=t.getUint8(),s=t.getString(a);if(0===i)return null;const o=[];for(let h=0;h0?o[0]:"",c=o.length>1?o[1]:"",u=o.length>2?o[2]:"";n.singleProperty=1===r&&t.getOffset()===i;while(i>t.getOffset()){const i=this.parseNode(t,e);null!==i&&this.parseSubNode(s,n,i)}return n.propertyList=o,"number"===typeof l&&(n.id=l),""!==c&&(n.attrName=c),""!==u&&(n.attrType=u),""!==s&&(n.name=s),n}parseSubNode(t,e,n){if(!0===n.singleProperty){const t=n.propertyList[0];Array.isArray(t)?(e[n.name]=n,n.a=t):e[n.name]=t}else if("Connections"===t&&"C"===n.name){const t=[];n.propertyList.forEach((function(e,n){0!==n&&t.push(e)})),void 0===e.connections&&(e.connections=[]),e.connections.push(t)}else if("Properties70"===n.name){const t=Object.keys(n);t.forEach((function(t){e[t]=n[t]}))}else if("Properties70"===t&&"P"===n.name){let t=n.propertyList[0],i=n.propertyList[1];const r=n.propertyList[2],a=n.propertyList[3];let s;0===t.indexOf("Lcl ")&&(t=t.replace("Lcl ","Lcl_")),0===i.indexOf("Lcl ")&&(i=i.replace("Lcl ","Lcl_")),s="Color"===i||"ColorRGB"===i||"Vector"===i||"Vector3D"===i||0===i.indexOf("Lcl_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],e[t]={type:i,type2:r,flag:a,value:s}}else void 0===e[n.name]?"number"===typeof n.id?(e[n.name]={},e[n.name][n.id]=n):e[n.name]=n:"PoseNode"===n.name?(Array.isArray(e[n.name])||(e[n.name]=[e[n.name]]),e[n.name].push(n)):void 0===e[n.name][n.id]&&(e[n.name][n.id]=n)}parseProperty(t){const e=t.getString(1);let n;switch(e){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return n=t.getUint32(),t.getArrayBuffer(n);case"S":return n=t.getUint32(),t.getString(n);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const r=t.getUint32(),a=t.getUint32(),s=t.getUint32();if(0===a)switch(e){case"b":case"c":return t.getBooleanArray(r);case"d":return t.getFloat64Array(r);case"f":return t.getFloat32Array(r);case"i":return t.getInt32Array(r);case"l":return t.getInt64Array(r)}"undefined"===typeof i&&console.error("THREE.FBXLoader: External library fflate.min.js required.");const o=Yt(new Uint8Array(t.getArrayBuffer(s))),l=new Xe(o.buffer);switch(e){case"b":case"c":return l.getBooleanArray(r);case"d":return l.getFloat64Array(r);case"f":return l.getFloat32Array(r);case"i":return l.getInt32Array(r);case"l":return l.getInt64Array(r)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+e)}}}class Xe{constructor(t,e){this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===e||e}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(t){this.offset+=t}getBoolean(){return 1===(1&this.getUint8())}getBooleanArray(t){const e=[];for(let n=0;n=0&&(e=e.slice(0,n)),r["r"].decodeText(new Uint8Array(e))}}class qe{add(t,e){this[t]=e}}function $e(t){const e="Kaydara FBX Binary \0";return t.byteLength>=e.length&&e===sn(t,0,e.length)}function Ye(t){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let n=0;function i(e){const i=t[e-1];return t=t.slice(n+e),n++,i}for(let r=0;r