@design-llm/motion 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +127 -105
- package/dist/index.cjs +385 -193
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8725 -7150
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/dist/index.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Pc=Object.create;var da=Object.defineProperty;var Lc=Object.getOwnPropertyDescriptor;var Fc=Object.getOwnPropertyNames;var Ic=Object.getPrototypeOf,Uc=Object.prototype.hasOwnProperty;var Nc=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Fc(e))!Uc.call(i,r)&&r!==t&&da(i,r,{get:()=>e[r],enumerable:!(n=Lc(e,r))||n.enumerable});return i};var Oc=(i,e,t)=>(t=i!=null?Pc(Ic(i)):{},Nc(e||!i||!i.__esModule?da(t,"default",{value:i,enumerable:!0}):t,i));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const de=require("react"),Mt=require("framer-motion"),Is=require("gsap");var qi={exports:{}},yi={};var fa;function Bc(){if(fa)return yi;fa=1;var i=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(n,r,s){var a=null;if(s!==void 0&&(a=""+s),r.key!==void 0&&(a=""+r.key),"key"in r){s={};for(var o in r)o!=="key"&&(s[o]=r[o])}else s=r;return r=s.ref,{$$typeof:i,type:n,key:a,ref:r!==void 0?r:null,props:s}}return yi.Fragment=e,yi.jsx=t,yi.jsxs=t,yi}var Ei={};var pa;function zc(){return pa||(pa=1,process.env.NODE_ENV!=="production"&&(function(){function i(N){if(N==null)return null;if(typeof N=="function")return N.$$typeof===F?null:N.displayName||N.name||null;if(typeof N=="string")return N;switch(N){case m:return"Fragment";case E:return"Profiler";case p:return"StrictMode";case T:return"Suspense";case A:return"SuspenseList";case M:return"Activity"}if(typeof N=="object")switch(typeof N.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),N.$$typeof){case _:return"Portal";case b:return N.displayName||"Context";case v:return(N._context.displayName||"Context")+".Consumer";case R:var ee=N.render;return N=N.displayName,N||(N=ee.displayName||ee.name||"",N=N!==""?"ForwardRef("+N+")":"ForwardRef"),N;case P:return ee=N.displayName||null,ee!==null?ee:i(N.type)||"Memo";case y:ee=N._payload,N=N._init;try{return i(N(ee))}catch{}}return null}function e(N){return""+N}function t(N){try{e(N);var ee=!1}catch{ee=!0}if(ee){ee=console;var me=ee.error,O=typeof Symbol=="function"&&Symbol.toStringTag&&N[Symbol.toStringTag]||N.constructor.name||"Object";return me.call(ee,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",O),e(N)}}function n(N){if(N===m)return"<>";if(typeof N=="object"&&N!==null&&N.$$typeof===y)return"<...>";try{var ee=i(N);return ee?"<"+ee+">":"<...>"}catch{return"<...>"}}function r(){var N=L.A;return N===null?null:N.getOwner()}function s(){return Error("react-stack-top-frame")}function a(N){if(C.call(N,"key")){var ee=Object.getOwnPropertyDescriptor(N,"key").get;if(ee&&ee.isReactWarning)return!1}return N.key!==void 0}function o(N,ee){function me(){Y||(Y=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",ee))}me.isReactWarning=!0,Object.defineProperty(N,"key",{get:me,configurable:!0})}function l(){var N=i(this.type);return J[N]||(J[N]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),N=this.props.ref,N!==void 0?N:null}function c(N,ee,me,O,Q,ce){var ne=me.ref;return N={$$typeof:g,type:N,key:ee,props:me,_owner:O},(ne!==void 0?ne:null)!==null?Object.defineProperty(N,"ref",{enumerable:!1,get:l}):Object.defineProperty(N,"ref",{enumerable:!1,value:null}),N._store={},Object.defineProperty(N._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(N,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(N,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Q}),Object.defineProperty(N,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ce}),Object.freeze&&(Object.freeze(N.props),Object.freeze(N)),N}function u(N,ee,me,O,Q,ce){var ne=ee.children;if(ne!==void 0)if(O)if(U(ne)){for(O=0;O<ne.length;O++)d(ne[O]);Object.freeze&&Object.freeze(ne)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else d(ne);if(C.call(ee,"key")){ne=i(N);var ve=Object.keys(ee).filter(function(Ce){return Ce!=="key"});O=0<ve.length?"{key: someKey, "+ve.join(": ..., ")+": ...}":"{key: someKey}",$[ne+O]||(ve=0<ve.length?"{"+ve.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,
|
|
7
|
-
`)),
|
|
8
|
-
`&&((h=L.previousSibling)==null||h.remove(),kn(document.createElement("br"),i,L),j=j.slice(1)),!_&&j==="")kn(T,i,L);else if(j===" ")i.insertBefore(document.createTextNode(" "),L);else{if(P&&j.charAt(0)===" "&&kn(" ",i,L),x&&C===1&&!N&&D.indexOf(x.parentNode)>-1?(M=D[D.length-1],M.appendChild(document.createTextNode(n?"":j))):(M=t(n?"":j),kn(M,i,L),x&&C===1&&!N&&M.insertBefore(x,M.firstChild)),n)for(V=aa?ua([...aa.segment(j)].map(pe=>pe.segment),l):j.match(o)||ws,Q=0;Q<V.length;Q++)M.appendChild(V[Q]===" "?document.createTextNode(" "):n(V[Q]));if(s&&c){if($=L.textContent=$.substring(j.length+1,$.length),z=M.getBoundingClientRect(),z.top>f.top&&z.left<=f.left){for(q=i.cloneNode(),ee=i.childNodes[0];ee&&ee!==M;)B=ee,ee=ee.nextSibling,q.appendChild(B);i.parentNode.insertBefore(q,i),r&&ha(q)}f=z}(C<E.length||I)&&kn(C>=E.length?" ":P&&j.slice(-1)===" "?" "+T:T,i,L)}i.removeChild(L),x=0}else L.nodeType===1&&(a&&a.indexOf(L)>-1?(D.indexOf(L.previousSibling)>-1&&D[D.length-1].appendChild(L),x=L):(Ko(L,e,t,n,r,s,a,o,l,!0),x=0),r&&ha(L))};const Zo=class Jo{constructor(e,t){this.isSplit=!1,hc(),this.elements=oa(e),this.chars=[],this.words=[],this.lines=[],this.masks=[],this.vars=t,this.elements.forEach(a=>{var o;t.overwrite!==!1&&((o=a[sa])==null||o._data.orig.filter(({element:l})=>l===a).forEach(ca)),a[sa]=this}),this._split=()=>this.isSplit&&this.split(this.vars);let n=[],r,s=()=>{let a=n.length,o;for(;a--;){o=n[a];let l=o.element.offsetWidth;if(l!==o.width){o.width=l,this._split();return}}};this._data={orig:n,obs:typeof ResizeObserver<"u"&&new ResizeObserver(()=>{clearTimeout(r),r=setTimeout(s,200)})},Vr(this),this.split(t)}split(e){return(this._ctx||dc).add(()=>{this.isSplit&&this.revert(),this.vars=e=e||this.vars||{};let{type:t="chars,words,lines",aria:n="auto",deepSlice:r=!0,smartWrap:s,onSplit:a,autoSplit:o=!1,specialChars:l,mask:c}=this.vars,h=t.indexOf("lines")>-1,d=t.indexOf("chars")>-1,u=t.indexOf("words")>-1,p=d&&!u&&!h,_=l&&("push"in l?new RegExp("(?:"+l.join("|")+")","gu"):l),v=_?new RegExp(_.source+"|"+la.source,"gu"):la,m=!!e.ignore&&oa(e.ignore),{orig:f,animTime:b,obs:x}=this._data,D;(d||u||h)&&(this.elements.forEach((P,T)=>{f[T]={element:P,html:P.innerHTML,ariaL:P.getAttribute("aria-label"),ariaH:P.getAttribute("aria-hidden")},n==="auto"?P.setAttribute("aria-label",(P.textContent||"").trim()):n==="hidden"&&P.setAttribute("aria-hidden","true");let w=[],L=[],E=[],M=d?Cs("char",e,w):null,N=Cs("word",e,L),I,C,z,V;if(Ko(P,e,N,M,p,r&&(h||p),m,v,_,!1),h){let q=Li(P.childNodes),ee=mc(P,q,e,E),B,$=[],j=0,F=q.map(U=>U.nodeType===1?U.getBoundingClientRect():yr),Q=yr,pe;for(I=0;I<q.length;I++)B=q[I],B.nodeType===1&&(B.nodeName==="BR"?((!I||q[I-1].nodeName!=="BR")&&($.push(B),ee(j,I+1)),j=I+1,Q=pc(F,I)):(pe=F[I],I&&pe.top>Q.top&&pe.left<Q.left+Q.width-1&&(ee(j,I),j=I),Q=pe));j<I&&ee(j,I),$.forEach(U=>{var J;return(J=U.parentNode)==null?void 0:J.removeChild(U)})}if(!u){for(I=0;I<L.length;I++)if(C=L[I],d||!C.nextSibling||C.nextSibling.nodeType!==3)if(s&&!h){for(z=document.createElement("span"),z.style.whiteSpace="nowrap";C.firstChild;)z.appendChild(C.firstChild);C.replaceWith(z)}else C.replaceWith(...C.childNodes);else V=C.nextSibling,V&&V.nodeType===3&&(V.textContent=(C.textContent||"")+(V.textContent||""),C.remove());L.length=0,P.normalize()}this.lines.push(...E),this.words.push(...L),this.chars.push(...w)}),c&&this[c]&&this.masks.push(...this[c].map(P=>{let T=P.cloneNode();return P.replaceWith(T),T.appendChild(P),P.className&&(T.className=P.className.trim()+"-mask"),T.style.overflow="clip",T}))),this.isSplit=!0,zn&&h&&(o?zn.addEventListener("loadingdone",this._split):zn.status==="loading"&&console.warn("SplitText called before fonts loaded")),(D=a&&a(this))&&D.totalTime&&(this._data.anim=b?D.totalTime(b):D),h&&o&&this.elements.forEach((P,T)=>{f[T].width=P.offsetWidth,x&&x.observe(P)})}),this}kill(){let{obs:e}=this._data;e&&e.disconnect(),zn?.removeEventListener("loadingdone",this._split)}revert(){var e,t;if(this.isSplit){let{orig:n,anim:r}=this._data;this.kill(),n.forEach(ca),this.chars.length=this.words.length=this.lines.length=n.length=this.masks.length=0,this.isSplit=!1,r&&(this._data.animTime=r.totalTime(),r.revert()),(t=(e=this.vars).onRevert)==null||t.call(e,this)}return this}static create(e,t){return new Jo(e,t)}static register(e){yi=yi||e||window.gsap,yi&&(Li=yi.utils.toArray,Vr=yi.core.context||Vr),!As&&window.innerWidth>0&&(zn=document.fonts,As=!0)}};Zo.version="3.14.2";let ks=Zo;var gc=/(?:^\s+|\s+$)/g,_c=/([\uD800-\uDBFF][\uDC00-\uDFFF](?:[\u200D\uFE0F][\uD800-\uDBFF][\uDC00-\uDFFF]){2,}|\uD83D\uDC69(?:\u200D(?:(?:\uD83D\uDC69\u200D)?\uD83D\uDC67|(?:\uD83D\uDC69\u200D)?\uD83D\uDC66)|\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D(?:\uD83D\uDC69\u200D)?\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D(?:\uD83D\uDC69\u200D)?\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2642\u2640]\uFE0F|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDD27\uDCBC\uDD2C\uDE80\uDE92])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC6F\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3C-\uDD3E\uDDD6-\uDDDF])\u200D[\u2640\u2642]\uFE0F|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|(?:\u26F9|\uD83C[\uDFCC\uDFCB]|\uD83D\uDD75)(?:\uFE0F\u200D[\u2640\u2642]|(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642])\uFE0F|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\uD83D\uDC69\u200D[\u2695\u2696\u2708]|\uD83D\uDC68(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708]))\uFE0F|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83D\uDC69\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|\uD83D\uDC68(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC66\u200D\uD83D\uDC66|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92])|(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]))|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDD1-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\u200D(?:(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC67|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC66)|\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC69\uDC6E\uDC70-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD26\uDD30-\uDD39\uDD3D\uDD3E\uDDD1-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])?|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDEEB\uDEEC\uDEF4-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267B\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])\uFE0F)/;function Hs(i){var e=i.nodeType,t="";if(e===1||e===9||e===11){if(typeof i.textContent=="string")return i.textContent;for(i=i.firstChild;i;i=i.nextSibling)t+=Hs(i)}else if(e===3||e===4)return i.nodeValue;return t}function Vt(i,e,t,n,r){if(i+="",t&&(i=i.trim?i.trim():i.replace(gc,"")),e&&e!=="")return i.replace(/>/g,">").replace(/</g,"<").split(e);for(var s=[],a=i.length,o=0,l,c;o<a;o++)c=i.charAt(o),(c.charCodeAt(0)>=55296&&c.charCodeAt(0)<=56319||i.charCodeAt(o+1)>=65024&&i.charCodeAt(o+1)<=65039)&&(l=((i.substr(o,12).split(_c)||[])[1]||"").length||2,c=i.substr(o,l),s.emoji=1,o+=l-1),s.push(r?c:c===">"?">":c==="<"?"<":n&&c===" "&&(i.charAt(o-1)===" "||i.charAt(o+1)===" ")?" ":c);return s}var Sr=(function(){function i(t){this.chars=Vt(t),this.sets=[],this.length=50;for(var n=0;n<20;n++)this.sets[n]=fa(80,this.chars)}var e=i.prototype;return e.grow=function(n){for(var r=0;r<20;r++)this.sets[r]+=fa(n-this.length,this.chars);this.length=n},i})(),Pn,Qo,el=function(){return Pn||typeof window<"u"&&(Pn=window.gsap)&&Pn.registerPlugin&&Pn},vc=1,da=/\s+/g,fa=function(e,t){for(var n=t.length,r="";--e>-1;)r+=t[~~(Math.random()*n)];return r},Rs="ABCDEFGHIJKLMNOPQRSTUVWXYZ",pa=Rs.toLowerCase(),xc={upperCase:new Sr(Rs),lowerCase:new Sr(pa),upperAndLowerCase:new Sr(Rs+pa)},ma=function(){Qo=Pn=el()},Pr={version:"3.14.2",name:"scrambleText",register:function(e,t,n){Pn=e,ma()},init:function(e,t,n,r,s){if(Qo||ma(),this.prop="innerHTML"in e?"innerHTML":"textContent"in e?"textContent":0,!!this.prop){this.target=e,typeof t!="object"&&(t={text:t});var a=t.text||t.value||"",o=t.trim!==!1,l=this,c,h,d,u;return l.delimiter=c=t.delimiter||"",l.original=Vt(Hs(e).replace(da," ").split(" ").join(""),c,o),(a==="{original}"||a===!0||a==null)&&(a=l.original.join(c)),l.text=Vt((a||"").replace(da," "),c,o),l.hasClass=!!(t.newClass||t.oldClass),l.newClass=t.newClass,l.oldClass=t.oldClass,u=c==="",l.textHasEmoji=u&&!!l.text.emoji,l.charsHaveEmoji=!!t.chars&&!!Vt(t.chars).emoji,l.length=u?l.original.length:l.original.join(c).length,l.lengthDif=(u?l.text.length:l.text.join(c).length)-l.length,l.fillChar=t.fillChar||t.chars&&~t.chars.indexOf(" ")?" ":"",l.charSet=d=xc[t.chars||"upperCase"]||new Sr(t.chars),l.speed=.05/(t.speed||1),l.prevScrambleTime=0,l.setIndex=Math.random()*20|0,h=l.length+Math.max(l.lengthDif,0),h>d.length&&d.grow(h),l.chars=d.sets[l.setIndex],l.revealDelay=t.revealDelay||0,l.tweenLength=t.tweenLength!==!1,l.tween=n,l.rightToLeft=!!t.rightToLeft,l._props.push("scrambleText","text"),vc}},render:function(e,t){var n=t.target,r=t.prop,s=t.text,a=t.delimiter,o=t.tween,l=t.prevScrambleTime,c=t.revealDelay,h=t.setIndex,d=t.chars,u=t.charSet,p=t.length,_=t.textHasEmoji,v=t.charsHaveEmoji,m=t.lengthDif,f=t.tweenLength,b=t.oldClass,x=t.newClass,D=t.rightToLeft,P=t.fillChar,T=t.speed,w=t.original,L=t.hasClass,E=s.length,M=o._time,N=M-l,I,C,z,V,q,ee,B,$,j,F,Q;c&&(o._from&&(M=o._dur-M),e=M===0?0:M<c?1e-6:M===o._dur?1:o._ease((M-c)/(o._dur-c))),e<0?e=0:e>1&&(e=1),D&&(e=1-e),I=~~(e*E+.5),e?((N>T||N<-T)&&(t.setIndex=h=(h+(Math.random()*19|0))%20,t.chars=u.sets[h],t.prevScrambleTime+=N),V=d):V=w.join(a),Q=o._from?e:1-e,F=p+(f?o._from?Q*Q*Q:1-Q*Q*Q:1)*m,D?e===1&&(o._from||o.data==="isFromStart")?(z="",V=w.join(a)):(B=s.slice(I).join(a),v?z=Vt(V).slice(0,F-(_?Vt(B):B).length+.5|0).join(""):z=V.substr(0,F-(_?Vt(B):B).length+.5|0),V=B):(z=s.slice(0,I).join(a),C=(_?Vt(z):z).length,v?V=Vt(V).slice(C,F+.5|0).join(""):V=V.substr(C,F-C+.5|0)),L?($=D?b:x,j=D?x:b,q=$&&I!==0,ee=j&&I!==E,B=(q?"<span class='"+$+"'>":"")+z+(q?"</span>":"")+(ee?"<span class='"+j+"'>":"")+a+V+(ee?"</span>":"")):B=z+a+V,n[r]=P===" "&&~B.indexOf(" ")?B.split(" ").join(" "):B}};Pr.emojiSafeSplit=Vt;Pr.getText=Hs;el()&&Pn.registerPlugin(Pr);Ts.gsap.registerPlugin(ks,Pr);const Mc=({radius:i=100,duration:e=1.2,speed:t=.5,scrambleChars:n=".:",className:r="",style:s={},children:a,fontSize:o,fontFamily:l,color:c})=>{const h=me.useRef(null);me.useEffect(()=>{if(!h.current)return;const u=ks.create(h.current.querySelector("p"),{type:"chars",charsClass:"inline-block will-change-transform"});u.chars.forEach(v=>{const m=v;Ts.gsap.set(m,{attr:{"data-content":m.innerHTML}})});const p=v=>{u.chars.forEach(m=>{const f=m,{left:b,top:x,width:D,height:P}=f.getBoundingClientRect(),T=v.clientX-(b+D/2),w=v.clientY-(x+P/2),L=Math.hypot(T,w);L<i&&Ts.gsap.to(f,{overwrite:!0,duration:e*(1-L/i),scrambleText:{text:f.dataset.content||"",chars:n,speed:t},ease:"none"})})},_=h.current;return _.addEventListener("pointermove",p),()=>{_.removeEventListener("pointermove",p),u.revert()}},[i,e,t,n]);const d={...s,...o&&{fontSize:o},...l&&{fontFamily:l},...c&&{color:c}};return ce.jsx("div",{ref:h,className:`m-[7vw] max-w-[800px] font-mono text-[clamp(14px,4vw,32px)] text-white ${r}`,style:d,children:ce.jsx("p",{children:a})})},Sc=({direction:i="clockwise",speed:e=.5,color:t="#71717a",dashLength:n=10,gapLength:r=5,width:s=300,height:a=200,strokeWidth:o=1,borderRadius:l=0})=>{const c=me.useRef(null);return me.useEffect(()=>{if(!c.current)return;const h=c.current,d=h.getTotalLength();h.style.strokeDasharray=`${n} ${r}`,h.style.strokeDashoffset=i==="clockwise"?d:0;let u,p=i==="clockwise"?d:0;const _=i==="clockwise"?-e:e,v=()=>{p+=_,i==="clockwise"?p<=-(n+r)&&(p=0):p>=n+r&&(p=0),h.style.strokeDashoffset=p,u=requestAnimationFrame(v)};return u=requestAnimationFrame(v),()=>{u&&cancelAnimationFrame(u)}},[i,e,n,r]),ce.jsx("svg",{width:s+o*2,height:a+o*2,className:"overflow-visible",children:ce.jsx(Et.motion.rect,{ref:c,x:o,y:o,width:s,height:a,rx:l,ry:l,fill:"transparent",stroke:t,strokeWidth:o,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.5}})})},Ec=({color:i="var(--primary)",backgroundColor:e="var(--background)",duration:t=150,blurIntensity:n="1em",density:r=1,className:s})=>{const a=()=>[`radial-gradient(4px 100px at 0px 235px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 235px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 117.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 252px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 252px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 126px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 150px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 150px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 75px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 253px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 253px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 126.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 204px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 204px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 102px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 134px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 134px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 67px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 179px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 179px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 89.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 299px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 299px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 149.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 215px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 215px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 107.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 281px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 281px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 140.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 158px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 158px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 79px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 210px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 210px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 105px, ${i} 100%, transparent 150%)`].join(", "),o=["300px 235px","300px 235px","300px 235px","300px 252px","300px 252px","300px 252px","300px 150px","300px 150px","300px 150px","300px 253px","300px 253px","300px 253px","300px 204px","300px 204px","300px 204px","300px 134px","300px 134px","300px 134px","300px 179px","300px 179px","300px 179px","300px 299px","300px 299px","300px 299px","300px 215px","300px 215px","300px 215px","300px 281px","300px 281px","300px 281px","300px 158px","300px 158px","300px 158px","300px 210px","300px 210px"].join(", "),l="0px 220px, 3px 220px, 151.5px 337.5px, 25px 24px, 28px 24px, 176.5px 150px, 50px 16px, 53px 16px, 201.5px 91px, 75px 224px, 78px 224px, 226.5px 230.5px, 100px 19px, 103px 19px, 251.5px 121px, 125px 120px, 128px 120px, 276.5px 187px, 150px 31px, 153px 31px, 301.5px 120.5px, 175px 235px, 178px 235px, 326.5px 384.5px, 200px 121px, 203px 121px, 351.5px 228.5px, 225px 224px, 228px 224px, 376.5px 364.5px, 250px 26px, 253px 26px, 401.5px 105px, 275px 75px, 278px 75px, 426.5px 180px";return ce.jsxs("div",{className:Yl("relative h-full w-full p-1",s),children:[ce.jsx(Et.motion.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},className:"size-full",children:ce.jsx(Et.motion.div,{className:"relative size-full z-0",style:{backgroundColor:e,backgroundImage:a(),backgroundSize:o},variants:{initial:{backgroundPosition:l},animate:{backgroundPosition:[l,"0px 6800px, 3px 6800px, 151.5px 6917.5px, 25px 13632px, 28px 13632px, 176.5px 13758px, 50px 5416px, 53px 5416px, 201.5px 5491px, 75px 17175px, 78px 17175px, 226.5px 17301.5px, 100px 5119px, 103px 5119px, 251.5px 5221px, 125px 8428px, 128px 8428px, 276.5px 8495px, 150px 9876px, 153px 9876px, 301.5px 9965.5px, 175px 13391px, 178px 13391px, 326.5px 13540.5px, 200px 14741px, 203px 14741px, 351.5px 14848.5px, 225px 18770px, 228px 18770px, 376.5px 18910.5px, 250px 5082px, 253px 5082px, 401.5px 5161px, 275px 6375px, 278px 6375px, 426.5px 6480px"],transition:{duration:t,ease:"linear",repeat:Number.POSITIVE_INFINITY}}},initial:"initial",animate:"animate"})}),ce.jsx("div",{className:"absolute inset-0 z-1 dark:brightness-600",style:{backdropFilter:`blur(${n})`,backgroundImage:`radial-gradient(circle at 50% 50%, transparent 0, transparent 2px, ${e} 2px)`,backgroundSize:`${8*r}px ${8*r}px`}})]})},yc=({text:i,disabled:e=!1,speed:t=2,className:n="",color:r="#b5b5b5",shineColor:s="#ffffff",spread:a=120,yoyo:o=!1,pauseOnHover:l=!1,direction:c="left",delay:h=0,fontSize:d,fontFamily:u})=>{const[p,_]=me.useState(!1),v=Et.useMotionValue(0),m=me.useRef(0),f=me.useRef(null),b=me.useRef(c==="left"?1:-1),x=t*1e3,D=h*1e3;Et.useAnimationFrame(M=>{if(e||p){f.current=null;return}if(f.current===null){f.current=M;return}const N=M-f.current;if(f.current=M,m.current+=N,o){const I=x+D,C=I*2,z=m.current%C;if(z<x){const V=z/x*100;v.set(b.current===1?V:100-V)}else if(z<I)v.set(b.current===1?100:0);else if(z<I+x){const q=100-(z-I)/x*100;v.set(b.current===1?q:100-q)}else v.set(b.current===1?0:100)}else{const I=x+D,C=m.current%I;if(C<x){const z=C/x*100;v.set(b.current===1?z:100-z)}else v.set(b.current===1?100:0)}}),me.useEffect(()=>{b.current=c==="left"?1:-1,m.current=0,v.set(0)},[c]);const P=Et.useTransform(v,M=>`${150-M*2}% center`),T=me.useCallback(()=>{l&&_(!0)},[l]),w=me.useCallback(()=>{l&&_(!1)},[l]),E={...{backgroundImage:`linear-gradient(${a}deg, ${r} 0%, ${r} 35%, ${s} 50%, ${r} 65%, ${r} 100%)`,backgroundSize:"200% auto",WebkitBackgroundClip:"text",backgroundClip:"text",WebkitTextFillColor:"transparent"},backgroundPosition:P,...d&&{fontSize:d},...u&&{fontFamily:u}};return ce.jsx(Et.motion.span,{className:`inline-block ${n}`,style:E,onMouseEnter:T,onMouseLeave:w,children:i})};const Vs="163",Hn={ROTATE:0,DOLLY:1,PAN:2},Vn={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},bc=0,ga=1,Dc=2,tl=1,Tc=2,Jt=3,vn=0,Mt=1,Wt=2,en=0,li=1,ci=2,_a=3,va=4,Ac=5,Cn=100,wc=101,Cc=102,Rc=103,Pc=104,Lc=200,Fc=201,Uc=202,Nc=203,Ps=204,Ls=205,Ic=206,Oc=207,Bc=208,zc=209,kc=210,Hc=211,Vc=212,Gc=213,Wc=214,Xc=0,Yc=1,jc=2,br=3,qc=4,$c=5,Kc=6,Zc=7,nl=0,Jc=1,Qc=2,mn=0,eu=1,tu=2,nu=3,Gs=4,iu=5,ru=6,su=7,il=300,fi=301,pi=302,Fs=303,Us=304,Lr=306,Ns=1e3,Ln=1001,Is=1002,Nt=1003,au=1004,Wi=1005,zt=1006,Gr=1007,Fn=1008,gn=1009,ou=1010,lu=1011,rl=1012,sl=1013,mi=1014,pn=1015,_n=1016,al=1017,ol=1018,Ii=1020,cu=35902,uu=1021,hu=1022,Xt=1023,du=1024,fu=1025,ui=1026,Fi=1027,pu=1028,ll=1029,mu=1030,cl=1031,ul=1033,Wr=33776,Xr=33777,Yr=33778,jr=33779,xa=35840,Ma=35841,Sa=35842,Ea=35843,hl=36196,ya=37492,ba=37496,Da=37808,Ta=37809,Aa=37810,wa=37811,Ca=37812,Ra=37813,Pa=37814,La=37815,Fa=37816,Ua=37817,Na=37818,Ia=37819,Oa=37820,Ba=37821,qr=36492,za=36494,ka=36495,gu=36283,Ha=36284,Va=36285,Ga=36286,_u=3200,vu=3201,xu=0,Mu=1,fn="",Ut="srgb",xn="srgb-linear",Ws="display-p3",Fr="display-p3-linear",Dr="linear",Ke="srgb",Tr="rec709",Ar="p3",Gn=7680,Wa=519,Su=512,Eu=513,yu=514,dl=515,bu=516,Du=517,Tu=518,Au=519,Xa=35044,Ya="300 es",Qt=2e3,wr=2001;class In{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const mt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let ja=1234567;const hi=Math.PI/180,Ui=180/Math.PI;function _i(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(mt[i&255]+mt[i>>8&255]+mt[i>>16&255]+mt[i>>24&255]+"-"+mt[e&255]+mt[e>>8&255]+"-"+mt[e>>16&15|64]+mt[e>>24&255]+"-"+mt[t&63|128]+mt[t>>8&255]+"-"+mt[t>>16&255]+mt[t>>24&255]+mt[n&255]+mt[n>>8&255]+mt[n>>16&255]+mt[n>>24&255]).toLowerCase()}function ht(i,e,t){return Math.max(e,Math.min(t,i))}function Xs(i,e){return(i%e+e)%e}function wu(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function Cu(i,e,t){return i!==e?(t-i)/(e-i):0}function Ci(i,e,t){return(1-t)*i+t*e}function Ru(i,e,t,n){return Ci(i,e,1-Math.exp(-t*n))}function Pu(i,e=1){return e-Math.abs(Xs(i,e*2)-e)}function Lu(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function Fu(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Uu(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Nu(i,e){return i+Math.random()*(e-i)}function Iu(i){return i*(.5-Math.random())}function Ou(i){i!==void 0&&(ja=i);let e=ja+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Bu(i){return i*hi}function zu(i){return i*Ui}function ku(i){return(i&i-1)===0&&i!==0}function Hu(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Vu(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function Gu(i,e,t,n,r){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+n)/2),h=a((e+n)/2),d=s((e-n)/2),u=a((e-n)/2),p=s((n-e)/2),_=a((n-e)/2);switch(r){case"XYX":i.set(o*h,l*d,l*u,o*c);break;case"YZY":i.set(l*u,o*h,l*d,o*c);break;case"ZXZ":i.set(l*d,l*u,o*h,o*c);break;case"XZX":i.set(o*h,l*_,l*p,o*c);break;case"YXY":i.set(l*p,o*h,l*_,o*c);break;case"ZYZ":i.set(l*_,l*p,o*h,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function ai(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function vt(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const fl={DEG2RAD:hi,RAD2DEG:Ui,generateUUID:_i,clamp:ht,euclideanModulo:Xs,mapLinear:wu,inverseLerp:Cu,lerp:Ci,damp:Ru,pingpong:Pu,smoothstep:Lu,smootherstep:Fu,randInt:Uu,randFloat:Nu,randFloatSpread:Iu,seededRandom:Ou,degToRad:Bu,radToDeg:zu,isPowerOfTwo:ku,ceilPowerOfTwo:Hu,floorPowerOfTwo:Vu,setQuaternionFromProperEuler:Gu,normalize:vt,denormalize:ai};class ue{constructor(e=0,t=0){ue.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,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=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(ht(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*r+e.x,this.y=s*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Be{constructor(e,t,n,r,s,a,o,l,c){Be.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c)}set(e,t,n,r,s,a,o,l,c){const h=this.elements;return h[0]=e,h[1]=r,h[2]=o,h[3]=t,h[4]=s,h[5]=l,h[6]=n,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],h=n[4],d=n[7],u=n[2],p=n[5],_=n[8],v=r[0],m=r[3],f=r[6],b=r[1],x=r[4],D=r[7],P=r[2],T=r[5],w=r[8];return s[0]=a*v+o*b+l*P,s[3]=a*m+o*x+l*T,s[6]=a*f+o*D+l*w,s[1]=c*v+h*b+d*P,s[4]=c*m+h*x+d*T,s[7]=c*f+h*D+d*w,s[2]=u*v+p*b+_*P,s[5]=u*m+p*x+_*T,s[8]=u*f+p*D+_*w,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8];return t*a*h-t*o*c-n*s*h+n*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],d=h*a-o*c,u=o*l-h*s,p=c*s-a*l,_=t*d+n*u+r*p;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/_;return e[0]=d*v,e[1]=(r*c-h*n)*v,e[2]=(o*n-r*a)*v,e[3]=u*v,e[4]=(h*t-r*l)*v,e[5]=(r*s-o*t)*v,e[6]=p*v,e[7]=(n*l-c*t)*v,e[8]=(a*t-n*s)*v,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply($r.makeScale(e,t)),this}rotate(e){return this.premultiply($r.makeRotation(-e)),this}translate(e,t){return this.premultiply($r.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const $r=new Be;function pl(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Cr(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Wu(){const i=Cr("canvas");return i.style.display="block",i}const qa={};function Xu(i){i in qa||(qa[i]=!0,console.warn(i))}const $a=new Be().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Ka=new Be().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Xi={[xn]:{transfer:Dr,primaries:Tr,toReference:i=>i,fromReference:i=>i},[Ut]:{transfer:Ke,primaries:Tr,toReference:i=>i.convertSRGBToLinear(),fromReference:i=>i.convertLinearToSRGB()},[Fr]:{transfer:Dr,primaries:Ar,toReference:i=>i.applyMatrix3(Ka),fromReference:i=>i.applyMatrix3($a)},[Ws]:{transfer:Ke,primaries:Ar,toReference:i=>i.convertSRGBToLinear().applyMatrix3(Ka),fromReference:i=>i.applyMatrix3($a).convertLinearToSRGB()}},Yu=new Set([xn,Fr]),$e={enabled:!0,_workingColorSpace:xn,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(i){if(!Yu.has(i))throw new Error(`Unsupported working color space, "${i}".`);this._workingColorSpace=i},convert:function(i,e,t){if(this.enabled===!1||e===t||!e||!t)return i;const n=Xi[e].toReference,r=Xi[t].fromReference;return r(n(i))},fromWorkingColorSpace:function(i,e){return this.convert(i,this._workingColorSpace,e)},toWorkingColorSpace:function(i,e){return this.convert(i,e,this._workingColorSpace)},getPrimaries:function(i){return Xi[i].primaries},getTransfer:function(i){return i===fn?Dr:Xi[i].transfer}};function di(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Kr(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let Wn;class ju{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Wn===void 0&&(Wn=Cr("canvas")),Wn.width=e.width,Wn.height=e.height;const n=Wn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Wn}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Cr("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=di(s[a]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(di(t[n]/255)*255):t[n]=di(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let qu=0;class ml{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:qu++}),this.uuid=_i(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(Zr(r[a].image)):s.push(Zr(r[a]))}else s=Zr(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function Zr(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?ju.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let $u=0;class Dt extends In{constructor(e=Dt.DEFAULT_IMAGE,t=Dt.DEFAULT_MAPPING,n=Ln,r=Ln,s=zt,a=Fn,o=Xt,l=gn,c=Dt.DEFAULT_ANISOTROPY,h=fn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:$u++}),this.uuid=_i(),this.name="",this.source=new ml(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new ue(0,0),this.repeat=new ue(1,1),this.center=new ue(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Be,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==il)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ns:e.x=e.x-Math.floor(e.x);break;case Ln:e.x=e.x<0?0:1;break;case Is:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Ns:e.y=e.y-Math.floor(e.y);break;case Ln:e.y=e.y<0?0:1;break;case Is:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Dt.DEFAULT_IMAGE=null;Dt.DEFAULT_MAPPING=il;Dt.DEFAULT_ANISOTROPY=1;class dt{constructor(e=0,t=0,n=0,r=1){dt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){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: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s;const l=e.elements,c=l[0],h=l[4],d=l[8],u=l[1],p=l[5],_=l[9],v=l[2],m=l[6],f=l[10];if(Math.abs(h-u)<.01&&Math.abs(d-v)<.01&&Math.abs(_-m)<.01){if(Math.abs(h+u)<.1&&Math.abs(d+v)<.1&&Math.abs(_+m)<.1&&Math.abs(c+p+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const x=(c+1)/2,D=(p+1)/2,P=(f+1)/2,T=(h+u)/4,w=(d+v)/4,L=(_+m)/4;return x>D&&x>P?x<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(x),r=T/n,s=w/n):D>P?D<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(D),n=T/r,s=L/r):P<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(P),n=w/s,r=L/s),this.set(n,r,s,t),this}let b=Math.sqrt((m-_)*(m-_)+(d-v)*(d-v)+(u-h)*(u-h));return Math.abs(b)<.001&&(b=1),this.x=(m-_)/b,this.y=(d-v)/b,this.z=(u-h)/b,this.w=Math.acos((c+p+f-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Ku extends In{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new dt(0,0,e,t),this.scissorTest=!1,this.viewport=new dt(0,0,e,t);const r={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:zt,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},n);const s=new Dt(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,r=e.textures.length;n<r;n++)this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new ml(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ht extends Ku{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class gl extends Dt{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Nt,this.minFilter=Nt,this.wrapR=Ln,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Zu extends Dt{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Nt,this.minFilter=Nt,this.wrapR=Ln,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Un{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,a,o){let l=n[r+0],c=n[r+1],h=n[r+2],d=n[r+3];const u=s[a+0],p=s[a+1],_=s[a+2],v=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=d;return}if(o===1){e[t+0]=u,e[t+1]=p,e[t+2]=_,e[t+3]=v;return}if(d!==v||l!==u||c!==p||h!==_){let m=1-o;const f=l*u+c*p+h*_+d*v,b=f>=0?1:-1,x=1-f*f;if(x>Number.EPSILON){const P=Math.sqrt(x),T=Math.atan2(P,f*b);m=Math.sin(m*T)/P,o=Math.sin(o*T)/P}const D=o*b;if(l=l*m+u*D,c=c*m+p*D,h=h*m+_*D,d=d*m+v*D,m===1-o){const P=1/Math.sqrt(l*l+c*c+h*h+d*d);l*=P,c*=P,h*=P,d*=P}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=d}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],h=n[r+3],d=s[a],u=s[a+1],p=s[a+2],_=s[a+3];return e[t]=o*_+h*d+l*p-c*u,e[t+1]=l*_+h*u+c*d-o*p,e[t+2]=c*_+h*p+o*u-l*d,e[t+3]=h*_-o*d-l*u-c*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(r/2),d=o(s/2),u=l(n/2),p=l(r/2),_=l(s/2);switch(a){case"XYZ":this._x=u*h*d+c*p*_,this._y=c*p*d-u*h*_,this._z=c*h*_+u*p*d,this._w=c*h*d-u*p*_;break;case"YXZ":this._x=u*h*d+c*p*_,this._y=c*p*d-u*h*_,this._z=c*h*_-u*p*d,this._w=c*h*d+u*p*_;break;case"ZXY":this._x=u*h*d-c*p*_,this._y=c*p*d+u*h*_,this._z=c*h*_+u*p*d,this._w=c*h*d-u*p*_;break;case"ZYX":this._x=u*h*d-c*p*_,this._y=c*p*d+u*h*_,this._z=c*h*_-u*p*d,this._w=c*h*d+u*p*_;break;case"YZX":this._x=u*h*d+c*p*_,this._y=c*p*d+u*h*_,this._z=c*h*_-u*p*d,this._w=c*h*d-u*p*_;break;case"XZY":this._x=u*h*d-c*p*_,this._y=c*p*d-u*h*_,this._z=c*h*_+u*p*d,this._w=c*h*d+u*p*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],h=t[6],d=t[10],u=n+o+d;if(u>0){const p=.5/Math.sqrt(u+1);this._w=.25/p,this._x=(h-l)*p,this._y=(s-c)*p,this._z=(a-r)*p}else if(n>o&&n>d){const p=2*Math.sqrt(1+n-o-d);this._w=(h-l)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(s+c)/p}else if(o>d){const p=2*Math.sqrt(1+o-n-d);this._w=(s-c)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(l+h)/p}else{const p=2*Math.sqrt(1+d-n-o);this._w=(a-r)/p,this._x=(s+c)/p,this._y=(l+h)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ht(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,h=t._w;return this._x=n*h+a*o+r*c-s*l,this._y=r*h+a*l+s*o-n*c,this._z=s*h+a*c+n*l-r*o,this._w=a*h-n*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+n*e._x+r*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const p=1-t;return this._w=p*a+t*this._w,this._x=p*n+t*this._x,this._y=p*r+t*this._y,this._z=p*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,o),d=Math.sin((1-t)*h)/c,u=Math.sin(t*h)/c;return this._w=a*d+this._w*u,this._x=n*d+this._x*u,this._y=r*d+this._y*u,this._z=s*d+this._z*u,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class R{constructor(e=0,t=0,n=0){R.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Za.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Za.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*n),h=2*(o*t-s*r),d=2*(s*n-a*t);return this.x=t+l*c+a*d-o*h,this.y=n+l*h+o*c-s*d,this.z=r+l*d+s*h-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-n*l,this.z=n*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Jr.copy(this).projectOnVector(e),this.sub(Jr)}reflect(e){return this.sub(Jr.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(ht(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Jr=new R,Za=new Un;class Oi{constructor(e=new R(1/0,1/0,1/0),t=new R(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(It.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(It.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=It.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,It):It.fromBufferAttribute(s,a),It.applyMatrix4(e.matrixWorld),this.expandByPoint(It);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Yi.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Yi.copy(n.boundingBox)),Yi.applyMatrix4(e.matrixWorld),this.union(Yi)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,It),It.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(bi),ji.subVectors(this.max,bi),Xn.subVectors(e.a,bi),Yn.subVectors(e.b,bi),jn.subVectors(e.c,bi),an.subVectors(Yn,Xn),on.subVectors(jn,Yn),En.subVectors(Xn,jn);let t=[0,-an.z,an.y,0,-on.z,on.y,0,-En.z,En.y,an.z,0,-an.x,on.z,0,-on.x,En.z,0,-En.x,-an.y,an.x,0,-on.y,on.x,0,-En.y,En.x,0];return!Qr(t,Xn,Yn,jn,ji)||(t=[1,0,0,0,1,0,0,0,1],!Qr(t,Xn,Yn,jn,ji))?!1:(qi.crossVectors(an,on),t=[qi.x,qi.y,qi.z],Qr(t,Xn,Yn,jn,ji))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,It).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(It).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(jt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),jt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),jt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),jt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),jt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),jt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),jt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),jt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(jt),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const jt=[new R,new R,new R,new R,new R,new R,new R,new R],It=new R,Yi=new Oi,Xn=new R,Yn=new R,jn=new R,an=new R,on=new R,En=new R,bi=new R,ji=new R,qi=new R,yn=new R;function Qr(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){yn.fromArray(i,s);const o=r.x*Math.abs(yn.x)+r.y*Math.abs(yn.y)+r.z*Math.abs(yn.z),l=e.dot(yn),c=t.dot(yn),h=n.dot(yn);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const Ju=new Oi,Di=new R,es=new R;class Bi{constructor(e=new R,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):Ju.setFromPoints(e).getCenter(n);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Di.subVectors(e,this.center);const t=Di.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(Di,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(es.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Di.copy(e.center).add(es)),this.expandByPoint(Di.copy(e.center).sub(es))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const qt=new R,ts=new R,$i=new R,ln=new R,ns=new R,Ki=new R,is=new R;class Ur{constructor(e=new R,t=new R(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,qt)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=qt.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(qt.copy(this.origin).addScaledVector(this.direction,t),qt.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){ts.copy(e).add(t).multiplyScalar(.5),$i.copy(t).sub(e).normalize(),ln.copy(this.origin).sub(ts);const s=e.distanceTo(t)*.5,a=-this.direction.dot($i),o=ln.dot(this.direction),l=-ln.dot($i),c=ln.lengthSq(),h=Math.abs(1-a*a);let d,u,p,_;if(h>0)if(d=a*l-o,u=a*o-l,_=s*h,d>=0)if(u>=-_)if(u<=_){const v=1/h;d*=v,u*=v,p=d*(d+a*u+2*o)+u*(a*d+u+2*l)+c}else u=s,d=Math.max(0,-(a*u+o)),p=-d*d+u*(u+2*l)+c;else u=-s,d=Math.max(0,-(a*u+o)),p=-d*d+u*(u+2*l)+c;else u<=-_?(d=Math.max(0,-(-a*s+o)),u=d>0?-s:Math.min(Math.max(-s,-l),s),p=-d*d+u*(u+2*l)+c):u<=_?(d=0,u=Math.min(Math.max(-s,-l),s),p=u*(u+2*l)+c):(d=Math.max(0,-(a*s+o)),u=d>0?s:Math.min(Math.max(-s,-l),s),p=-d*d+u*(u+2*l)+c);else u=a>0?-s:s,d=Math.max(0,-(a*u+o)),p=-d*d+u*(u+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,d),r&&r.copy(ts).addScaledVector($i,u),p}intersectSphere(e,t){qt.subVectors(e.center,this.origin);const n=qt.dot(this.direction),r=qt.dot(qt)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,a,o,l;const c=1/this.direction.x,h=1/this.direction.y,d=1/this.direction.z,u=this.origin;return c>=0?(n=(e.min.x-u.x)*c,r=(e.max.x-u.x)*c):(n=(e.max.x-u.x)*c,r=(e.min.x-u.x)*c),h>=0?(s=(e.min.y-u.y)*h,a=(e.max.y-u.y)*h):(s=(e.max.y-u.y)*h,a=(e.min.y-u.y)*h),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),d>=0?(o=(e.min.z-u.z)*d,l=(e.max.z-u.z)*d):(o=(e.max.z-u.z)*d,l=(e.min.z-u.z)*d),n>l||o>r)||((o>n||n!==n)&&(n=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,qt)!==null}intersectTriangle(e,t,n,r,s){ns.subVectors(t,e),Ki.subVectors(n,e),is.crossVectors(ns,Ki);let a=this.direction.dot(is),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;ln.subVectors(this.origin,e);const l=o*this.direction.dot(Ki.crossVectors(ln,Ki));if(l<0)return null;const c=o*this.direction.dot(ns.cross(ln));if(c<0||l+c>a)return null;const h=-o*ln.dot(is);return h<0?null:this.at(h/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class et{constructor(e,t,n,r,s,a,o,l,c,h,d,u,p,_,v,m){et.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c,h,d,u,p,_,v,m)}set(e,t,n,r,s,a,o,l,c,h,d,u,p,_,v,m){const f=this.elements;return f[0]=e,f[4]=t,f[8]=n,f[12]=r,f[1]=s,f[5]=a,f[9]=o,f[13]=l,f[2]=c,f[6]=h,f[10]=d,f[14]=u,f[3]=p,f[7]=_,f[11]=v,f[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 et().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,r=1/qn.setFromMatrixColumn(e,0).length(),s=1/qn.setFromMatrixColumn(e,1).length(),a=1/qn.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(r),c=Math.sin(r),h=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const u=a*h,p=a*d,_=o*h,v=o*d;t[0]=l*h,t[4]=-l*d,t[8]=c,t[1]=p+_*c,t[5]=u-v*c,t[9]=-o*l,t[2]=v-u*c,t[6]=_+p*c,t[10]=a*l}else if(e.order==="YXZ"){const u=l*h,p=l*d,_=c*h,v=c*d;t[0]=u+v*o,t[4]=_*o-p,t[8]=a*c,t[1]=a*d,t[5]=a*h,t[9]=-o,t[2]=p*o-_,t[6]=v+u*o,t[10]=a*l}else if(e.order==="ZXY"){const u=l*h,p=l*d,_=c*h,v=c*d;t[0]=u-v*o,t[4]=-a*d,t[8]=_+p*o,t[1]=p+_*o,t[5]=a*h,t[9]=v-u*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const u=a*h,p=a*d,_=o*h,v=o*d;t[0]=l*h,t[4]=_*c-p,t[8]=u*c+v,t[1]=l*d,t[5]=v*c+u,t[9]=p*c-_,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const u=a*l,p=a*c,_=o*l,v=o*c;t[0]=l*h,t[4]=v-u*d,t[8]=_*d+p,t[1]=d,t[5]=a*h,t[9]=-o*h,t[2]=-c*h,t[6]=p*d+_,t[10]=u-v*d}else if(e.order==="XZY"){const u=a*l,p=a*c,_=o*l,v=o*c;t[0]=l*h,t[4]=-d,t[8]=c*h,t[1]=u*d+v,t[5]=a*h,t[9]=p*d-_,t[2]=_*d-p,t[6]=o*h,t[10]=v*d+u}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Qu,e,eh)}lookAt(e,t,n){const r=this.elements;return wt.subVectors(e,t),wt.lengthSq()===0&&(wt.z=1),wt.normalize(),cn.crossVectors(n,wt),cn.lengthSq()===0&&(Math.abs(n.z)===1?wt.x+=1e-4:wt.z+=1e-4,wt.normalize(),cn.crossVectors(n,wt)),cn.normalize(),Zi.crossVectors(wt,cn),r[0]=cn.x,r[4]=Zi.x,r[8]=wt.x,r[1]=cn.y,r[5]=Zi.y,r[9]=wt.y,r[2]=cn.z,r[6]=Zi.z,r[10]=wt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],h=n[1],d=n[5],u=n[9],p=n[13],_=n[2],v=n[6],m=n[10],f=n[14],b=n[3],x=n[7],D=n[11],P=n[15],T=r[0],w=r[4],L=r[8],E=r[12],M=r[1],N=r[5],I=r[9],C=r[13],z=r[2],V=r[6],q=r[10],ee=r[14],B=r[3],$=r[7],j=r[11],F=r[15];return s[0]=a*T+o*M+l*z+c*B,s[4]=a*w+o*N+l*V+c*$,s[8]=a*L+o*I+l*q+c*j,s[12]=a*E+o*C+l*ee+c*F,s[1]=h*T+d*M+u*z+p*B,s[5]=h*w+d*N+u*V+p*$,s[9]=h*L+d*I+u*q+p*j,s[13]=h*E+d*C+u*ee+p*F,s[2]=_*T+v*M+m*z+f*B,s[6]=_*w+v*N+m*V+f*$,s[10]=_*L+v*I+m*q+f*j,s[14]=_*E+v*C+m*ee+f*F,s[3]=b*T+x*M+D*z+P*B,s[7]=b*w+x*N+D*V+P*$,s[11]=b*L+x*I+D*q+P*j,s[15]=b*E+x*C+D*ee+P*F,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],h=e[2],d=e[6],u=e[10],p=e[14],_=e[3],v=e[7],m=e[11],f=e[15];return _*(+s*l*d-r*c*d-s*o*u+n*c*u+r*o*p-n*l*p)+v*(+t*l*p-t*c*u+s*a*u-r*a*p+r*c*h-s*l*h)+m*(+t*c*d-t*o*p-s*a*d+n*a*p+s*o*h-n*c*h)+f*(-r*o*h-t*l*d+t*o*u+r*a*d-n*a*u+n*l*h)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],d=e[9],u=e[10],p=e[11],_=e[12],v=e[13],m=e[14],f=e[15],b=d*m*c-v*u*c+v*l*p-o*m*p-d*l*f+o*u*f,x=_*u*c-h*m*c-_*l*p+a*m*p+h*l*f-a*u*f,D=h*v*c-_*d*c+_*o*p-a*v*p-h*o*f+a*d*f,P=_*d*l-h*v*l-_*o*u+a*v*u+h*o*m-a*d*m,T=t*b+n*x+r*D+s*P;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/T;return e[0]=b*w,e[1]=(v*u*s-d*m*s-v*r*p+n*m*p+d*r*f-n*u*f)*w,e[2]=(o*m*s-v*l*s+v*r*c-n*m*c-o*r*f+n*l*f)*w,e[3]=(d*l*s-o*u*s-d*r*c+n*u*c+o*r*p-n*l*p)*w,e[4]=x*w,e[5]=(h*m*s-_*u*s+_*r*p-t*m*p-h*r*f+t*u*f)*w,e[6]=(_*l*s-a*m*s-_*r*c+t*m*c+a*r*f-t*l*f)*w,e[7]=(a*u*s-h*l*s+h*r*c-t*u*c-a*r*p+t*l*p)*w,e[8]=D*w,e[9]=(_*d*s-h*v*s-_*n*p+t*v*p+h*n*f-t*d*f)*w,e[10]=(a*v*s-_*o*s+_*n*c-t*v*c-a*n*f+t*o*f)*w,e[11]=(h*o*s-a*d*s-h*n*c+t*d*c+a*n*p-t*o*p)*w,e[12]=P*w,e[13]=(h*v*r-_*d*r+_*n*u-t*v*u-h*n*m+t*d*m)*w,e[14]=(_*o*r-a*v*r-_*n*l+t*v*l+a*n*m-t*o*m)*w,e[15]=(a*d*r-h*o*r+h*n*l-t*d*l-a*n*u+t*o*u)*w,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,h=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,h*o+n,h*l-r*a,0,c*l-r*o,h*l+r*a,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,a){return this.set(1,n,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,h=a+a,d=o+o,u=s*c,p=s*h,_=s*d,v=a*h,m=a*d,f=o*d,b=l*c,x=l*h,D=l*d,P=n.x,T=n.y,w=n.z;return r[0]=(1-(v+f))*P,r[1]=(p+D)*P,r[2]=(_-x)*P,r[3]=0,r[4]=(p-D)*T,r[5]=(1-(u+f))*T,r[6]=(m+b)*T,r[7]=0,r[8]=(_+x)*w,r[9]=(m-b)*w,r[10]=(1-(u+v))*w,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let s=qn.set(r[0],r[1],r[2]).length();const a=qn.set(r[4],r[5],r[6]).length(),o=qn.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Ot.copy(this);const c=1/s,h=1/a,d=1/o;return Ot.elements[0]*=c,Ot.elements[1]*=c,Ot.elements[2]*=c,Ot.elements[4]*=h,Ot.elements[5]*=h,Ot.elements[6]*=h,Ot.elements[8]*=d,Ot.elements[9]*=d,Ot.elements[10]*=d,t.setFromRotationMatrix(Ot),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,r,s,a,o=Qt){const l=this.elements,c=2*s/(t-e),h=2*s/(n-r),d=(t+e)/(t-e),u=(n+r)/(n-r);let p,_;if(o===Qt)p=-(a+s)/(a-s),_=-2*a*s/(a-s);else if(o===wr)p=-a/(a-s),_=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=h,l[9]=u,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=_,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=Qt){const l=this.elements,c=1/(t-e),h=1/(n-r),d=1/(a-s),u=(t+e)*c,p=(n+r)*h;let _,v;if(o===Qt)_=(a+s)*d,v=-2*d;else if(o===wr)_=s*d,v=-1*d;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-u,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=v,l[14]=-_,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const qn=new R,Ot=new et,Qu=new R(0,0,0),eh=new R(1,1,1),cn=new R,Zi=new R,wt=new R,Ja=new et,Qa=new Un;class tn{constructor(e=0,t=0,n=0,r=tn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],h=r[9],d=r[2],u=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(ht(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(u,c),this._z=0);break;case"YXZ":this._x=Math.asin(-ht(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(ht(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-d,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-ht(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(u,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(ht(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-ht(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(u,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Ja.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ja,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Qa.setFromEuler(this),this.setFromQuaternion(Qa,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}tn.DEFAULT_ORDER="XYZ";class _l{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let th=0;const eo=new R,$n=new Un,$t=new et,Ji=new R,Ti=new R,nh=new R,ih=new Un,to=new R(1,0,0),no=new R(0,1,0),io=new R(0,0,1),ro={type:"added"},rh={type:"removed"},Kn={type:"childadded",child:null},rs={type:"childremoved",child:null};class St extends In{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:th++}),this.uuid=_i(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=St.DEFAULT_UP.clone();const e=new R,t=new tn,n=new Un,r=new R(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new et},normalMatrix:{value:new Be}}),this.matrix=new et,this.matrixWorld=new et,this.matrixAutoUpdate=St.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=St.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new _l,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return $n.setFromAxisAngle(e,t),this.quaternion.multiply($n),this}rotateOnWorldAxis(e,t){return $n.setFromAxisAngle(e,t),this.quaternion.premultiply($n),this}rotateX(e){return this.rotateOnAxis(to,e)}rotateY(e){return this.rotateOnAxis(no,e)}rotateZ(e){return this.rotateOnAxis(io,e)}translateOnAxis(e,t){return eo.copy(e).applyQuaternion(this.quaternion),this.position.add(eo.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(to,e)}translateY(e){return this.translateOnAxis(no,e)}translateZ(e){return this.translateOnAxis(io,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4($t.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Ji.copy(e):Ji.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),Ti.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?$t.lookAt(Ti,Ji,this.up):$t.lookAt(Ji,Ti,this.up),this.quaternion.setFromRotationMatrix($t),r&&($t.extractRotation(r.matrixWorld),$n.setFromRotationMatrix($t),this.quaternion.premultiply($n.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(ro),Kn.child=e,this.dispatchEvent(Kn),Kn.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(rh),rs.child=e,this.dispatchEvent(rs),rs.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),$t.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),$t.multiply(e.parent.matrixWorld)),e.applyMatrix4($t),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(ro),Kn.child=e,this.dispatchEvent(Kn),Kn.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ti,e,nh),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ti,ih,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++){const s=t[n];(s.matrixWorldAutoUpdate===!0||e===!0)&&s.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.matrixWorldAutoUpdate===!0&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++){const o=r[s];o.matrixWorldAutoUpdate===!0&&o.updateWorldMatrix(!1,!0)}}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),r.maxGeometryCount=this._maxGeometryCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){const d=l[c];s(e.shapes,d)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),h=a(e.images),d=a(e.shapes),u=a(e.skeletons),p=a(e.animations),_=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),d.length>0&&(n.shapes=d),u.length>0&&(n.skeletons=u),p.length>0&&(n.animations=p),_.length>0&&(n.nodes=_)}return n.object=r,n;function a(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const r=e.children[n];this.add(r.clone())}return this}}St.DEFAULT_UP=new R(0,1,0);St.DEFAULT_MATRIX_AUTO_UPDATE=!0;St.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Bt=new R,Kt=new R,ss=new R,Zt=new R,Zn=new R,Jn=new R,so=new R,as=new R,os=new R,ls=new R;class kt{constructor(e=new R,t=new R,n=new R){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Bt.subVectors(e,t),r.cross(Bt);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Bt.subVectors(r,t),Kt.subVectors(n,t),ss.subVectors(e,t);const a=Bt.dot(Bt),o=Bt.dot(Kt),l=Bt.dot(ss),c=Kt.dot(Kt),h=Kt.dot(ss),d=a*c-o*o;if(d===0)return s.set(0,0,0),null;const u=1/d,p=(c*l-o*h)*u,_=(a*h-o*l)*u;return s.set(1-p-_,_,p)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Zt)===null?!1:Zt.x>=0&&Zt.y>=0&&Zt.x+Zt.y<=1}static getInterpolation(e,t,n,r,s,a,o,l){return this.getBarycoord(e,t,n,r,Zt)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Zt.x),l.addScaledVector(a,Zt.y),l.addScaledVector(o,Zt.z),l)}static isFrontFacing(e,t,n,r){return Bt.subVectors(n,t),Kt.subVectors(e,t),Bt.cross(Kt).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Bt.subVectors(this.c,this.b),Kt.subVectors(this.a,this.b),Bt.cross(Kt).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return kt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return kt.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return kt.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return kt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return kt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let a,o;Zn.subVectors(r,n),Jn.subVectors(s,n),as.subVectors(e,n);const l=Zn.dot(as),c=Jn.dot(as);if(l<=0&&c<=0)return t.copy(n);os.subVectors(e,r);const h=Zn.dot(os),d=Jn.dot(os);if(h>=0&&d<=h)return t.copy(r);const u=l*d-h*c;if(u<=0&&l>=0&&h<=0)return a=l/(l-h),t.copy(n).addScaledVector(Zn,a);ls.subVectors(e,s);const p=Zn.dot(ls),_=Jn.dot(ls);if(_>=0&&p<=_)return t.copy(s);const v=p*c-l*_;if(v<=0&&c>=0&&_<=0)return o=c/(c-_),t.copy(n).addScaledVector(Jn,o);const m=h*_-p*d;if(m<=0&&d-h>=0&&p-_>=0)return so.subVectors(s,r),o=(d-h)/(d-h+(p-_)),t.copy(r).addScaledVector(so,o);const f=1/(m+v+u);return a=v*f,o=u*f,t.copy(n).addScaledVector(Zn,a).addScaledVector(Jn,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const vl={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},un={h:0,s:0,l:0},Qi={h:0,s:0,l:0};function cs(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}class be{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ut){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,$e.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=$e.workingColorSpace){return this.r=e,this.g=t,this.b=n,$e.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=$e.workingColorSpace){if(e=Xs(e,1),t=ht(t,0,1),n=ht(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=cs(a,s,e+1/3),this.g=cs(a,s,e),this.b=cs(a,s,e-1/3)}return $e.toWorkingColorSpace(this,r),this}setStyle(e,t=Ut){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ut){const n=vl[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=di(e.r),this.g=di(e.g),this.b=di(e.b),this}copyLinearToSRGB(e){return this.r=Kr(e.r),this.g=Kr(e.g),this.b=Kr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ut){return $e.fromWorkingColorSpace(gt.copy(this),e),Math.round(ht(gt.r*255,0,255))*65536+Math.round(ht(gt.g*255,0,255))*256+Math.round(ht(gt.b*255,0,255))}getHexString(e=Ut){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=$e.workingColorSpace){$e.fromWorkingColorSpace(gt.copy(this),t);const n=gt.r,r=gt.g,s=gt.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let l,c;const h=(o+a)/2;if(o===a)l=0,c=0;else{const d=a-o;switch(c=h<=.5?d/(a+o):d/(2-a-o),a){case n:l=(r-s)/d+(r<s?6:0);break;case r:l=(s-n)/d+2;break;case s:l=(n-r)/d+4;break}l/=6}return e.h=l,e.s=c,e.l=h,e}getRGB(e,t=$e.workingColorSpace){return $e.fromWorkingColorSpace(gt.copy(this),t),e.r=gt.r,e.g=gt.g,e.b=gt.b,e}getStyle(e=Ut){$e.fromWorkingColorSpace(gt.copy(this),e);const t=gt.r,n=gt.g,r=gt.b;return e!==Ut?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(un),this.setHSL(un.h+e,un.s+t,un.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(un),e.getHSL(Qi);const n=Ci(un.h,Qi.h,t),r=Ci(un.s,Qi.s,t),s=Ci(un.l,Qi.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const gt=new be;be.NAMES=vl;let sh=0;class vi extends In{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:sh++}),this.uuid=_i(),this.name="",this.type="Material",this.blending=li,this.side=vn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Ps,this.blendDst=Ls,this.blendEquation=Cn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new be(0,0,0),this.blendAlpha=0,this.depthFunc=br,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Wa,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Gn,this.stencilZFail=Gn,this.stencilZPass=Gn,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.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==li&&(n.blending=this.blending),this.side!==vn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Ps&&(n.blendSrc=this.blendSrc),this.blendDst!==Ls&&(n.blendDst=this.blendDst),this.blendEquation!==Cn&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==br&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Wa&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Gn&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Gn&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Gn&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class zi extends vi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new be(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.envMapRotation=new tn,this.combine=nl,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const st=new R,er=new ue;class yt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Xa,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=pn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return Xu("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)er.fromBufferAttribute(this,t),er.applyMatrix3(e),this.setXY(t,er.x,er.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)st.fromBufferAttribute(this,t),st.applyMatrix3(e),this.setXYZ(t,st.x,st.y,st.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)st.fromBufferAttribute(this,t),st.applyMatrix4(e),this.setXYZ(t,st.x,st.y,st.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)st.fromBufferAttribute(this,t),st.applyNormalMatrix(e),this.setXYZ(t,st.x,st.y,st.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)st.fromBufferAttribute(this,t),st.transformDirection(e),this.setXYZ(t,st.x,st.y,st.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=ai(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=vt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=ai(t,this.array)),t}setX(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=ai(t,this.array)),t}setY(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=ai(t,this.array)),t}setZ(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=ai(t,this.array)),t}setW(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),r=vt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),r=vt(r,this.array),s=vt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Xa&&(e.usage=this.usage),e}}class xl extends yt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Ml extends yt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class nt extends yt{constructor(e,t,n){super(new Float32Array(e),t,n)}}let ah=0;const Ft=new et,us=new St,Qn=new R,Ct=new Oi,Ai=new Oi,ut=new R;class _t extends In{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:ah++}),this.uuid=_i(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(pl(e)?Ml:xl)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Be().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ft.makeRotationFromQuaternion(e),this.applyMatrix4(Ft),this}rotateX(e){return Ft.makeRotationX(e),this.applyMatrix4(Ft),this}rotateY(e){return Ft.makeRotationY(e),this.applyMatrix4(Ft),this}rotateZ(e){return Ft.makeRotationZ(e),this.applyMatrix4(Ft),this}translate(e,t,n){return Ft.makeTranslation(e,t,n),this.applyMatrix4(Ft),this}scale(e,t,n){return Ft.makeScale(e,t,n),this.applyMatrix4(Ft),this}lookAt(e){return us.lookAt(e),us.updateMatrix(),this.applyMatrix4(us.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Qn).negate(),this.translate(Qn.x,Qn.y,Qn.z),this}setFromPoints(e){const t=[];for(let n=0,r=e.length;n<r;n++){const s=e[n];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new nt(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Oi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new R(-1/0,-1/0,-1/0),new R(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const s=t[n];Ct.setFromBufferAttribute(s),this.morphTargetsRelative?(ut.addVectors(this.boundingBox.min,Ct.min),this.boundingBox.expandByPoint(ut),ut.addVectors(this.boundingBox.max,Ct.max),this.boundingBox.expandByPoint(ut)):(this.boundingBox.expandByPoint(Ct.min),this.boundingBox.expandByPoint(Ct.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Bi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new R,1/0);return}if(e){const n=this.boundingSphere.center;if(Ct.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];Ai.setFromBufferAttribute(o),this.morphTargetsRelative?(ut.addVectors(Ct.min,Ai.min),Ct.expandByPoint(ut),ut.addVectors(Ct.max,Ai.max),Ct.expandByPoint(ut)):(Ct.expandByPoint(Ai.min),Ct.expandByPoint(Ai.max))}Ct.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)ut.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(ut));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)ut.fromBufferAttribute(o,c),l&&(Qn.fromBufferAttribute(e,c),ut.add(Qn)),r=Math.max(r,n.distanceToSquared(ut))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new yt(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let L=0;L<n.count;L++)o[L]=new R,l[L]=new R;const c=new R,h=new R,d=new R,u=new ue,p=new ue,_=new ue,v=new R,m=new R;function f(L,E,M){c.fromBufferAttribute(n,L),h.fromBufferAttribute(n,E),d.fromBufferAttribute(n,M),u.fromBufferAttribute(s,L),p.fromBufferAttribute(s,E),_.fromBufferAttribute(s,M),h.sub(c),d.sub(c),p.sub(u),_.sub(u);const N=1/(p.x*_.y-_.x*p.y);isFinite(N)&&(v.copy(h).multiplyScalar(_.y).addScaledVector(d,-p.y).multiplyScalar(N),m.copy(d).multiplyScalar(p.x).addScaledVector(h,-_.x).multiplyScalar(N),o[L].add(v),o[E].add(v),o[M].add(v),l[L].add(m),l[E].add(m),l[M].add(m))}let b=this.groups;b.length===0&&(b=[{start:0,count:e.count}]);for(let L=0,E=b.length;L<E;++L){const M=b[L],N=M.start,I=M.count;for(let C=N,z=N+I;C<z;C+=3)f(e.getX(C+0),e.getX(C+1),e.getX(C+2))}const x=new R,D=new R,P=new R,T=new R;function w(L){P.fromBufferAttribute(r,L),T.copy(P);const E=o[L];x.copy(E),x.sub(P.multiplyScalar(P.dot(E))).normalize(),D.crossVectors(T,E);const N=D.dot(l[L])<0?-1:1;a.setXYZW(L,x.x,x.y,x.z,N)}for(let L=0,E=b.length;L<E;++L){const M=b[L],N=M.start,I=M.count;for(let C=N,z=N+I;C<z;C+=3)w(e.getX(C+0)),w(e.getX(C+1)),w(e.getX(C+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new yt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let u=0,p=n.count;u<p;u++)n.setXYZ(u,0,0,0);const r=new R,s=new R,a=new R,o=new R,l=new R,c=new R,h=new R,d=new R;if(e)for(let u=0,p=e.count;u<p;u+=3){const _=e.getX(u+0),v=e.getX(u+1),m=e.getX(u+2);r.fromBufferAttribute(t,_),s.fromBufferAttribute(t,v),a.fromBufferAttribute(t,m),h.subVectors(a,s),d.subVectors(r,s),h.cross(d),o.fromBufferAttribute(n,_),l.fromBufferAttribute(n,v),c.fromBufferAttribute(n,m),o.add(h),l.add(h),c.add(h),n.setXYZ(_,o.x,o.y,o.z),n.setXYZ(v,l.x,l.y,l.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let u=0,p=t.count;u<p;u+=3)r.fromBufferAttribute(t,u+0),s.fromBufferAttribute(t,u+1),a.fromBufferAttribute(t,u+2),h.subVectors(a,s),d.subVectors(r,s),h.cross(d),n.setXYZ(u+0,h.x,h.y,h.z),n.setXYZ(u+1,h.x,h.y,h.z),n.setXYZ(u+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)ut.fromBufferAttribute(e,t),ut.normalize(),e.setXYZ(t,ut.x,ut.y,ut.z)}toNonIndexed(){function e(o,l){const c=o.array,h=o.itemSize,d=o.normalized,u=new c.constructor(l.length*h);let p=0,_=0;for(let v=0,m=l.length;v<m;v++){o.isInterleavedBufferAttribute?p=l[v]*o.data.stride+o.offset:p=l[v]*h;for(let f=0;f<h;f++)u[_++]=c[p++]}return new yt(u,h,d)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new _t,n=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let h=0,d=c.length;h<d;h++){const u=c[h],p=e(u,n);l.push(p)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let d=0,u=c.length;d<u;d++){const p=c[d];h.push(p.toJSON(e.data))}h.length>0&&(r[l]=h,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const r=e.attributes;for(const c in r){const h=r[c];this.setAttribute(c,h.clone(t))}const s=e.morphAttributes;for(const c in s){const h=[],d=s[c];for(let u=0,p=d.length;u<p;u++)h.push(d[u].clone(t));this.morphAttributes[c]=h}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,h=a.length;c<h;c++){const d=a[c];this.addGroup(d.start,d.count,d.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const ao=new et,bn=new Ur,tr=new Bi,oo=new R,ei=new R,ti=new R,ni=new R,hs=new R,nr=new R,ir=new ue,rr=new ue,sr=new ue,lo=new R,co=new R,uo=new R,ar=new R,or=new R;class bt extends St{constructor(e=new _t,t=new zi){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){nr.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const h=o[l],d=s[l];h!==0&&(hs.fromBufferAttribute(d,e),a?nr.addScaledVector(hs,h):nr.addScaledVector(hs.sub(t),h))}t.add(nr)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),tr.copy(n.boundingSphere),tr.applyMatrix4(s),bn.copy(e.ray).recast(e.near),!(tr.containsPoint(bn.origin)===!1&&(bn.intersectSphere(tr,oo)===null||bn.origin.distanceToSquared(oo)>(e.far-e.near)**2))&&(ao.copy(s).invert(),bn.copy(e.ray).applyMatrix4(ao),!(n.boundingBox!==null&&bn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,bn)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,d=s.attributes.normal,u=s.groups,p=s.drawRange;if(o!==null)if(Array.isArray(a))for(let _=0,v=u.length;_<v;_++){const m=u[_],f=a[m.materialIndex],b=Math.max(m.start,p.start),x=Math.min(o.count,Math.min(m.start+m.count,p.start+p.count));for(let D=b,P=x;D<P;D+=3){const T=o.getX(D),w=o.getX(D+1),L=o.getX(D+2);r=lr(this,f,e,n,c,h,d,T,w,L),r&&(r.faceIndex=Math.floor(D/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const _=Math.max(0,p.start),v=Math.min(o.count,p.start+p.count);for(let m=_,f=v;m<f;m+=3){const b=o.getX(m),x=o.getX(m+1),D=o.getX(m+2);r=lr(this,a,e,n,c,h,d,b,x,D),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let _=0,v=u.length;_<v;_++){const m=u[_],f=a[m.materialIndex],b=Math.max(m.start,p.start),x=Math.min(l.count,Math.min(m.start+m.count,p.start+p.count));for(let D=b,P=x;D<P;D+=3){const T=D,w=D+1,L=D+2;r=lr(this,f,e,n,c,h,d,T,w,L),r&&(r.faceIndex=Math.floor(D/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const _=Math.max(0,p.start),v=Math.min(l.count,p.start+p.count);for(let m=_,f=v;m<f;m+=3){const b=m,x=m+1,D=m+2;r=lr(this,a,e,n,c,h,d,b,x,D),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}}}function oh(i,e,t,n,r,s,a,o){let l;if(e.side===Mt?l=n.intersectTriangle(a,s,r,!0,o):l=n.intersectTriangle(r,s,a,e.side===vn,o),l===null)return null;or.copy(o),or.applyMatrix4(i.matrixWorld);const c=t.ray.origin.distanceTo(or);return c<t.near||c>t.far?null:{distance:c,point:or.clone(),object:i}}function lr(i,e,t,n,r,s,a,o,l,c){i.getVertexPosition(o,ei),i.getVertexPosition(l,ti),i.getVertexPosition(c,ni);const h=oh(i,e,t,n,ei,ti,ni,ar);if(h){r&&(ir.fromBufferAttribute(r,o),rr.fromBufferAttribute(r,l),sr.fromBufferAttribute(r,c),h.uv=kt.getInterpolation(ar,ei,ti,ni,ir,rr,sr,new ue)),s&&(ir.fromBufferAttribute(s,o),rr.fromBufferAttribute(s,l),sr.fromBufferAttribute(s,c),h.uv1=kt.getInterpolation(ar,ei,ti,ni,ir,rr,sr,new ue)),a&&(lo.fromBufferAttribute(a,o),co.fromBufferAttribute(a,l),uo.fromBufferAttribute(a,c),h.normal=kt.getInterpolation(ar,ei,ti,ni,lo,co,uo,new R),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const d={a:o,b:l,c,normal:new R,materialIndex:0};kt.getNormal(ei,ti,ni,d.normal),h.face=d}return h}class ki extends _t{constructor(e=1,t=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],h=[],d=[];let u=0,p=0;_("z","y","x",-1,-1,n,t,e,a,s,0),_("z","y","x",1,-1,n,t,-e,a,s,1),_("x","z","y",1,1,e,n,t,r,a,2),_("x","z","y",1,-1,e,n,-t,r,a,3),_("x","y","z",1,-1,e,t,n,r,s,4),_("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new nt(c,3)),this.setAttribute("normal",new nt(h,3)),this.setAttribute("uv",new nt(d,2));function _(v,m,f,b,x,D,P,T,w,L,E){const M=D/w,N=P/L,I=D/2,C=P/2,z=T/2,V=w+1,q=L+1;let ee=0,B=0;const $=new R;for(let j=0;j<q;j++){const F=j*N-C;for(let Q=0;Q<V;Q++){const pe=Q*M-I;$[v]=pe*b,$[m]=F*x,$[f]=z,c.push($.x,$.y,$.z),$[v]=0,$[m]=0,$[f]=T>0?1:-1,h.push($.x,$.y,$.z),d.push(Q/w),d.push(1-j/L),ee+=1}}for(let j=0;j<L;j++)for(let F=0;F<w;F++){const Q=u+F+V*j,pe=u+F+V*(j+1),U=u+(F+1)+V*(j+1),J=u+(F+1)+V*j;l.push(Q,pe,J),l.push(pe,U,J),B+=6}o.addGroup(p,B,E),p+=B,u+=ee}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ki(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function gi(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone():Array.isArray(r)?e[t][n]=r.slice():e[t][n]=r}}return e}function xt(i){const e={};for(let t=0;t<i.length;t++){const n=gi(i[t]);for(const r in n)e[r]=n[r]}return e}function lh(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function Sl(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:$e.workingColorSpace}const Rr={clone:gi,merge:xt};var ch=`void main() {
|
|
6
|
+
<%s key={someKey} {...props} />`,O,ne,ve,ne),$[ne+O]=!0)}if(ne=null,me!==void 0&&(t(me),ne=""+me),a(ee)&&(t(ee.key),ne=""+ee.key),"key"in ee){me={};for(var Te in ee)Te!=="key"&&(me[Te]=ee[Te])}else me=ee;return ne&&o(me,typeof N=="function"?N.displayName||N.name||"Unknown":N),c(N,ne,me,r(),Q,ce)}function d(N){h(N)?N._store&&(N._store.validated=1):typeof N=="object"&&N!==null&&N.$$typeof===y&&(N._payload.status==="fulfilled"?h(N._payload.value)&&N._payload.value._store&&(N._payload.value._store.validated=1):N._store&&(N._store.validated=1))}function h(N){return typeof N=="object"&&N!==null&&N.$$typeof===g}var f=de,g=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),b=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),F=Symbol.for("react.client.reference"),L=f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,C=Object.prototype.hasOwnProperty,U=Array.isArray,H=console.createTask?console.createTask:function(){return null};f={react_stack_bottom_frame:function(N){return N()}};var Y,J={},z=f.react_stack_bottom_frame.bind(f,s)(),j=H(n(s)),$={};Ei.Fragment=m,Ei.jsx=function(N,ee,me){var O=1e4>L.recentlyCreatedOwnerStacks++;return u(N,ee,me,!1,O?Error("react-stack-top-frame"):z,O?H(n(N)):j)},Ei.jsxs=function(N,ee,me){var O=1e4>L.recentlyCreatedOwnerStacks++;return u(N,ee,me,!0,O?Error("react-stack-top-frame"):z,O?H(n(N)):j)}})()),Ei}var ma;function kc(){return ma||(ma=1,process.env.NODE_ENV==="production"?qi.exports=Bc():qi.exports=zc()),qi.exports}var oe=kc();const Hc=(i,e)=>{const t=new Set([...Object.keys(i),...e.flatMap(r=>Object.keys(r))]),n={};return t.forEach(r=>{n[r]=[i[r],...e.map(s=>s[r])]}),n},Vc=({text:i="",delay:e=200,className:t="",animateBy:n="words",direction:r="top",threshold:s=.1,rootMargin:a="0px",animationFrom:o,animationTo:l,easing:c=_=>_,onAnimationComplete:u,stepDuration:d=.35,fontSize:h,fontFamily:f,color:g})=>{const _=n==="words"?i.split(" "):i.split(""),[m,p]=de.useState(!1),E=de.useRef(null);de.useEffect(()=>{if(!E.current)return;const F=new IntersectionObserver(([L])=>{L.isIntersecting&&(p(!0),F.unobserve(E.current))},{threshold:s,rootMargin:a});return F.observe(E.current),()=>F.disconnect()},[s,a]);const v=de.useMemo(()=>r==="top"?{filter:"blur(10px)",opacity:0,y:-50}:{filter:"blur(10px)",opacity:0,y:50},[r]),b=de.useMemo(()=>[{filter:"blur(5px)",opacity:.5,y:r==="top"?5:-5},{filter:"blur(0px)",opacity:1,y:0}],[r]),R=o??v,T=l??b,A=T.length+1,P=d*(A-1),y=Array.from({length:A},(F,L)=>A===1?0:L/(A-1)),M={...h&&{fontSize:h},...f&&{fontFamily:f},...g&&{color:g}};return oe.jsx("p",{ref:E,className:`blur-text ${t} flex flex-wrap`,style:M,children:_.map((F,L)=>{const C=Hc(R,T),U={duration:P,times:y,delay:L*e/1e3};return U.ease=c,oe.jsxs(Mt.motion.span,{className:"inline-block will-change-[transform,filter,opacity]",initial:R,animate:m?C:R,transition:U,onAnimationComplete:L===_.length-1?u:void 0,children:[F===" "?" ":F,n==="words"&&L<_.length-1&&" "]},L)})})},Gc=(i,e,t=!0)=>({from:e,to:e+360,ease:"linear",duration:i,type:"tween",repeat:t?1/0:0}),Bn=(i,e)=>({rotate:Gc(i,e),scale:{type:"spring",damping:20,stiffness:300}}),Wc=({text:i,spinDuration:e=20,onHover:t="speedUp",className:n="",fontSize:r,fontFamily:s,color:a})=>{const o=Array.from(i),l=Mt.useAnimation(),c=Mt.useMotionValue(0);de.useEffect(()=>{const f=c.get();l.start({rotate:f+360,scale:1,transition:Bn(e,f)})},[e,i,t,l,c]);const u=()=>{const f=c.get();if(!t)return;let g,_=1;switch(t){case"slowDown":g=Bn(e*2,f);break;case"speedUp":g=Bn(e/4,f);break;case"pause":g={rotate:{type:"spring",damping:20,stiffness:300},scale:{type:"spring",damping:20,stiffness:300}},_=1;break;case"goBonkers":g=Bn(e/20,f),_=.8;break;default:g=Bn(e,f)}l.start({rotate:f+360,scale:_,transition:g})},d=()=>{const f=c.get();l.start({rotate:f+360,scale:1,transition:Bn(e,f)})},h={...r&&{fontSize:r},...s&&{fontFamily:s},...a&&{color:a}};return oe.jsx(Mt.motion.div,{className:`m-0 mx-auto rounded-full w-[200px] h-[200px] relative text-white font-black text-center cursor-pointer origin-center ${n}`,style:{rotate:c,...h},initial:{rotate:0},animate:l,onMouseEnter:u,onMouseLeave:d,children:o.map((f,g)=>{const _=360/o.length*g,m=Math.PI/o.length,p=m*g,E=m*g,v=`rotateZ(${_}deg) translate3d(${p}px, ${E}px, 0)`;return oe.jsx("span",{className:"absolute inline-block inset-0 text-2xl transition-all duration-500 ease-[cubic-bezier(0,0,0,1)]",style:{transform:v,WebkitTransform:v,...h},children:f},g)})})};let bi,zn,ga=typeof Symbol=="function"?Symbol():"_split",Us,Xc=()=>Us||Ks.register(window.gsap),_a=typeof Intl<"u"&&"Segmenter"in Intl?new Intl.Segmenter:0,Ui=i=>typeof i=="string"?Ui(document.querySelectorAll(i)):"length"in i?Array.from(i).reduce((e,t)=>(typeof t=="string"?e.push(...Ui(t)):e.push(t),e),[]):[i],xa=i=>Ui(i).filter(e=>e instanceof HTMLElement),Ns=[],qr=function(){},qc={add:i=>i()},Yc=/\s+/g,va=new RegExp("\\p{RI}\\p{RI}|\\p{Emoji}(\\p{EMod}|\\u{FE0F}\\u{20E3}?|[\\u{E0020}-\\u{E007E}]+\\u{E007F})?(\\u{200D}\\p{Emoji}(\\p{EMod}|\\u{FE0F}\\u{20E3}?|[\\u{E0020}-\\u{E007E}]+\\u{E007F})?)*|.","gu"),Dr={left:0,top:0,width:0,height:0},$c=(i,e)=>{for(;++e<i.length&&i[e]===Dr;);return i[e]||Dr},Ma=({element:i,html:e,ariaL:t,ariaH:n})=>{i.innerHTML=e,t?i.setAttribute("aria-label",t):i.removeAttribute("aria-label"),n?i.setAttribute("aria-hidden",n):i.removeAttribute("aria-hidden")},Sa=(i,e)=>{if(e){let t=new Set(i.join("").match(e)||Ns),n=i.length,r,s,a,o;if(t.size)for(;--n>-1;){s=i[n];for(a of t)if(a.startsWith(s)&&a.length>s.length){for(r=0,o=s;a.startsWith(o+=i[n+ ++r])&&o.length<a.length;);if(r&&o.length===a.length){i[n]=a,i.splice(n+1,r);break}}}}return i},ya=i=>window.getComputedStyle(i).display==="inline"&&(i.style.display="inline-block"),kn=(i,e,t)=>e.insertBefore(typeof i=="string"?document.createTextNode(i):i,t),Os=(i,e,t)=>{let n=e[i+"sClass"]||"",{tag:r="div",aria:s="auto",propIndex:a=!1}=e,o=i==="line"?"block":"inline-block",l=n.indexOf("++")>-1,c=u=>{let d=document.createElement(r),h=t.length+1;return n&&(d.className=n+(l?" "+n+h:"")),a&&d.style.setProperty("--"+i,h+""),s!=="none"&&d.setAttribute("aria-hidden","true"),r!=="span"&&(d.style.position="relative",d.style.display=o),d.textContent=u,t.push(d),d};return l&&(n=n.replace("++","")),c.collection=t,c},jc=(i,e,t,n)=>{let r=Os("line",t,n),s=window.getComputedStyle(i).textAlign||"left";return(a,o)=>{let l=r("");for(l.style.textAlign=s,i.insertBefore(l,e[a]);a<o;a++)l.appendChild(e[a]);l.normalize()}},Dl=(i,e,t,n,r,s,a,o,l,c)=>{var u;let d=Array.from(i.childNodes),h=0,{wordDelimiter:f,reduceWhiteSpace:g=!0,prepareText:_}=e,m=i.getBoundingClientRect(),p=m,E=!g&&window.getComputedStyle(i).whiteSpace.substring(0,3)==="pre",v=0,b=t.collection,R,T,A,P,y,M,F,L,C,U,H,Y,J,z,j,$,N,ee;for(typeof f=="object"?(A=f.delimiter||f,T=f.replaceWith||""):T=f===""?"":f||" ",R=T!==" ";h<d.length;h++)if(P=d[h],P.nodeType===3){for(j=P.textContent||"",g?j=j.replace(Yc," "):E&&(j=j.replace(/\n/g,T+`
|
|
7
|
+
`)),_&&(j=_(j,i)),P.textContent=j,y=T||A?j.split(A||T):j.match(o)||Ns,N=y[y.length-1],L=R?N.slice(-1)===" ":!N,N||y.pop(),p=m,F=R?y[0].charAt(0)===" ":!y[0],F&&kn(" ",i,P),y[0]||y.shift(),Sa(y,l),s&&c||(P.textContent=""),C=1;C<=y.length;C++)if($=y[C-1],!g&&E&&$.charAt(0)===`
|
|
8
|
+
`&&((u=P.previousSibling)==null||u.remove(),kn(document.createElement("br"),i,P),$=$.slice(1)),!g&&$==="")kn(T,i,P);else if($===" ")i.insertBefore(document.createTextNode(" "),P);else{if(R&&$.charAt(0)===" "&&kn(" ",i,P),v&&C===1&&!F&&b.indexOf(v.parentNode)>-1?(M=b[b.length-1],M.appendChild(document.createTextNode(n?"":$))):(M=t(n?"":$),kn(M,i,P),v&&C===1&&!F&&M.insertBefore(v,M.firstChild)),n)for(H=_a?Sa([..._a.segment($)].map(me=>me.segment),l):$.match(o)||Ns,ee=0;ee<H.length;ee++)M.appendChild(H[ee]===" "?document.createTextNode(" "):n(H[ee]));if(s&&c){if(j=P.textContent=j.substring($.length+1,j.length),U=M.getBoundingClientRect(),U.top>p.top&&U.left<=p.left){for(Y=i.cloneNode(),J=i.childNodes[0];J&&J!==M;)z=J,J=J.nextSibling,Y.appendChild(z);i.parentNode.insertBefore(Y,i),r&&ya(Y)}p=U}(C<y.length||L)&&kn(C>=y.length?" ":R&&$.slice(-1)===" "?" "+T:T,i,P)}i.removeChild(P),v=0}else P.nodeType===1&&(a&&a.indexOf(P)>-1?(b.indexOf(P.previousSibling)>-1&&b[b.length-1].appendChild(P),v=P):(Dl(P,e,t,n,r,s,a,o,l,!0),v=0),r&&ya(P))};const Al=class wl{constructor(e,t){this.isSplit=!1,Xc(),this.elements=xa(e),this.chars=[],this.words=[],this.lines=[],this.masks=[],this.vars=t,this.elements.forEach(a=>{var o;t.overwrite!==!1&&((o=a[ga])==null||o._data.orig.filter(({element:l})=>l===a).forEach(Ma)),a[ga]=this}),this._split=()=>this.isSplit&&this.split(this.vars);let n=[],r,s=()=>{let a=n.length,o;for(;a--;){o=n[a];let l=o.element.offsetWidth;if(l!==o.width){o.width=l,this._split();return}}};this._data={orig:n,obs:typeof ResizeObserver<"u"&&new ResizeObserver(()=>{clearTimeout(r),r=setTimeout(s,200)})},qr(this),this.split(t)}split(e){return(this._ctx||qc).add(()=>{this.isSplit&&this.revert(),this.vars=e=e||this.vars||{};let{type:t="chars,words,lines",aria:n="auto",deepSlice:r=!0,smartWrap:s,onSplit:a,autoSplit:o=!1,specialChars:l,mask:c}=this.vars,u=t.indexOf("lines")>-1,d=t.indexOf("chars")>-1,h=t.indexOf("words")>-1,f=d&&!h&&!u,g=l&&("push"in l?new RegExp("(?:"+l.join("|")+")","gu"):l),_=g?new RegExp(g.source+"|"+va.source,"gu"):va,m=!!e.ignore&&xa(e.ignore),{orig:p,animTime:E,obs:v}=this._data,b;(d||h||u)&&(this.elements.forEach((R,T)=>{p[T]={element:R,html:R.innerHTML,ariaL:R.getAttribute("aria-label"),ariaH:R.getAttribute("aria-hidden")},n==="auto"?R.setAttribute("aria-label",(R.textContent||"").trim()):n==="hidden"&&R.setAttribute("aria-hidden","true");let A=[],P=[],y=[],M=d?Os("char",e,A):null,F=Os("word",e,P),L,C,U,H;if(Dl(R,e,F,M,f,r&&(u||f),m,_,g,!1),u){let Y=Ui(R.childNodes),J=jc(R,Y,e,y),z,j=[],$=0,N=Y.map(O=>O.nodeType===1?O.getBoundingClientRect():Dr),ee=Dr,me;for(L=0;L<Y.length;L++)z=Y[L],z.nodeType===1&&(z.nodeName==="BR"?((!L||Y[L-1].nodeName!=="BR")&&(j.push(z),J($,L+1)),$=L+1,ee=$c(N,L)):(me=N[L],L&&me.top>ee.top&&me.left<ee.left+ee.width-1&&(J($,L),$=L),ee=me));$<L&&J($,L),j.forEach(O=>{var Q;return(Q=O.parentNode)==null?void 0:Q.removeChild(O)})}if(!h){for(L=0;L<P.length;L++)if(C=P[L],d||!C.nextSibling||C.nextSibling.nodeType!==3)if(s&&!u){for(U=document.createElement("span"),U.style.whiteSpace="nowrap";C.firstChild;)U.appendChild(C.firstChild);C.replaceWith(U)}else C.replaceWith(...C.childNodes);else H=C.nextSibling,H&&H.nodeType===3&&(H.textContent=(C.textContent||"")+(H.textContent||""),C.remove());P.length=0,R.normalize()}this.lines.push(...y),this.words.push(...P),this.chars.push(...A)}),c&&this[c]&&this.masks.push(...this[c].map(R=>{let T=R.cloneNode();return R.replaceWith(T),T.appendChild(R),R.className&&(T.className=R.className.trim()+"-mask"),T.style.overflow="clip",T}))),this.isSplit=!0,zn&&u&&(o?zn.addEventListener("loadingdone",this._split):zn.status==="loading"&&console.warn("SplitText called before fonts loaded")),(b=a&&a(this))&&b.totalTime&&(this._data.anim=E?b.totalTime(E):b),u&&o&&this.elements.forEach((R,T)=>{p[T].width=R.offsetWidth,v&&v.observe(R)})}),this}kill(){let{obs:e}=this._data;e&&e.disconnect(),zn?.removeEventListener("loadingdone",this._split)}revert(){var e,t;if(this.isSplit){let{orig:n,anim:r}=this._data;this.kill(),n.forEach(Ma),this.chars.length=this.words.length=this.lines.length=n.length=this.masks.length=0,this.isSplit=!1,r&&(this._data.animTime=r.totalTime(),r.revert()),(t=(e=this.vars).onRevert)==null||t.call(e,this)}return this}static create(e,t){return new wl(e,t)}static register(e){bi=bi||e||window.gsap,bi&&(Ui=bi.utils.toArray,qr=bi.core.context||qr),!Us&&window.innerWidth>0&&(zn=document.fonts,Us=!0)}};Al.version="3.14.2";let Ks=Al;var Kc=/(?:^\s+|\s+$)/g,Zc=/([\uD800-\uDBFF][\uDC00-\uDFFF](?:[\u200D\uFE0F][\uD800-\uDBFF][\uDC00-\uDFFF]){2,}|\uD83D\uDC69(?:\u200D(?:(?:\uD83D\uDC69\u200D)?\uD83D\uDC67|(?:\uD83D\uDC69\u200D)?\uD83D\uDC66)|\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D(?:\uD83D\uDC69\u200D)?\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D(?:\uD83D\uDC69\u200D)?\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2642\u2640]\uFE0F|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDD27\uDCBC\uDD2C\uDE80\uDE92])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC6F\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3C-\uDD3E\uDDD6-\uDDDF])\u200D[\u2640\u2642]\uFE0F|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|(?:\u26F9|\uD83C[\uDFCC\uDFCB]|\uD83D\uDD75)(?:\uFE0F\u200D[\u2640\u2642]|(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642])\uFE0F|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\uD83D\uDC69\u200D[\u2695\u2696\u2708]|\uD83D\uDC68(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708]))\uFE0F|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83D\uDC69\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|\uD83D\uDC68(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC66\u200D\uD83D\uDC66|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92])|(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]))|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDD1-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\u200D(?:(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC67|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC66)|\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC69\uDC6E\uDC70-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD26\uDD30-\uDD39\uDD3D\uDD3E\uDDD1-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])?|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDEEB\uDEEC\uDEF4-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267B\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])\uFE0F)/;function Zs(i){var e=i.nodeType,t="";if(e===1||e===9||e===11){if(typeof i.textContent=="string")return i.textContent;for(i=i.firstChild;i;i=i.nextSibling)t+=Zs(i)}else if(e===3||e===4)return i.nodeValue;return t}function Vt(i,e,t,n,r){if(i+="",t&&(i=i.trim?i.trim():i.replace(Kc,"")),e&&e!=="")return i.replace(/>/g,">").replace(/</g,"<").split(e);for(var s=[],a=i.length,o=0,l,c;o<a;o++)c=i.charAt(o),(c.charCodeAt(0)>=55296&&c.charCodeAt(0)<=56319||i.charCodeAt(o+1)>=65024&&i.charCodeAt(o+1)<=65039)&&(l=((i.substr(o,12).split(Zc)||[])[1]||"").length||2,c=i.substr(o,l),s.emoji=1,o+=l-1),s.push(r?c:c===">"?">":c==="<"?"<":n&&c===" "&&(i.charAt(o-1)===" "||i.charAt(o+1)===" ")?" ":c);return s}var br=(function(){function i(t){this.chars=Vt(t),this.sets=[],this.length=50;for(var n=0;n<20;n++)this.sets[n]=ba(80,this.chars)}var e=i.prototype;return e.grow=function(n){for(var r=0;r<20;r++)this.sets[r]+=ba(n-this.length,this.chars);this.length=n},i})(),Rn,Cl,Rl=function(){return Rn||typeof window<"u"&&(Rn=window.gsap)&&Rn.registerPlugin&&Rn},Jc=1,Ea=/\s+/g,ba=function(e,t){for(var n=t.length,r="";--e>-1;)r+=t[~~(Math.random()*n)];return r},Bs="ABCDEFGHIJKLMNOPQRSTUVWXYZ",Ta=Bs.toLowerCase(),Qc={upperCase:new br(Bs),lowerCase:new br(Ta),upperAndLowerCase:new br(Bs+Ta)},Da=function(){Cl=Rn=Rl()},Ur={version:"3.14.2",name:"scrambleText",register:function(e,t,n){Rn=e,Da()},init:function(e,t,n,r,s){if(Cl||Da(),this.prop="innerHTML"in e?"innerHTML":"textContent"in e?"textContent":0,!!this.prop){this.target=e,typeof t!="object"&&(t={text:t});var a=t.text||t.value||"",o=t.trim!==!1,l=this,c,u,d,h;return l.delimiter=c=t.delimiter||"",l.original=Vt(Zs(e).replace(Ea," ").split(" ").join(""),c,o),(a==="{original}"||a===!0||a==null)&&(a=l.original.join(c)),l.text=Vt((a||"").replace(Ea," "),c,o),l.hasClass=!!(t.newClass||t.oldClass),l.newClass=t.newClass,l.oldClass=t.oldClass,h=c==="",l.textHasEmoji=h&&!!l.text.emoji,l.charsHaveEmoji=!!t.chars&&!!Vt(t.chars).emoji,l.length=h?l.original.length:l.original.join(c).length,l.lengthDif=(h?l.text.length:l.text.join(c).length)-l.length,l.fillChar=t.fillChar||t.chars&&~t.chars.indexOf(" ")?" ":"",l.charSet=d=Qc[t.chars||"upperCase"]||new br(t.chars),l.speed=.05/(t.speed||1),l.prevScrambleTime=0,l.setIndex=Math.random()*20|0,u=l.length+Math.max(l.lengthDif,0),u>d.length&&d.grow(u),l.chars=d.sets[l.setIndex],l.revealDelay=t.revealDelay||0,l.tweenLength=t.tweenLength!==!1,l.tween=n,l.rightToLeft=!!t.rightToLeft,l._props.push("scrambleText","text"),Jc}},render:function(e,t){var n=t.target,r=t.prop,s=t.text,a=t.delimiter,o=t.tween,l=t.prevScrambleTime,c=t.revealDelay,u=t.setIndex,d=t.chars,h=t.charSet,f=t.length,g=t.textHasEmoji,_=t.charsHaveEmoji,m=t.lengthDif,p=t.tweenLength,E=t.oldClass,v=t.newClass,b=t.rightToLeft,R=t.fillChar,T=t.speed,A=t.original,P=t.hasClass,y=s.length,M=o._time,F=M-l,L,C,U,H,Y,J,z,j,$,N,ee;c&&(o._from&&(M=o._dur-M),e=M===0?0:M<c?1e-6:M===o._dur?1:o._ease((M-c)/(o._dur-c))),e<0?e=0:e>1&&(e=1),b&&(e=1-e),L=~~(e*y+.5),e?((F>T||F<-T)&&(t.setIndex=u=(u+(Math.random()*19|0))%20,t.chars=h.sets[u],t.prevScrambleTime+=F),H=d):H=A.join(a),ee=o._from?e:1-e,N=f+(p?o._from?ee*ee*ee:1-ee*ee*ee:1)*m,b?e===1&&(o._from||o.data==="isFromStart")?(U="",H=A.join(a)):(z=s.slice(L).join(a),_?U=Vt(H).slice(0,N-(g?Vt(z):z).length+.5|0).join(""):U=H.substr(0,N-(g?Vt(z):z).length+.5|0),H=z):(U=s.slice(0,L).join(a),C=(g?Vt(U):U).length,_?H=Vt(H).slice(C,N+.5|0).join(""):H=H.substr(C,N-C+.5|0)),P?(j=b?E:v,$=b?v:E,Y=j&&L!==0,J=$&&L!==y,z=(Y?"<span class='"+j+"'>":"")+U+(Y?"</span>":"")+(J?"<span class='"+$+"'>":"")+a+H+(J?"</span>":"")):z=U+a+H,n[r]=R===" "&&~z.indexOf(" ")?z.split(" ").join(" "):z}};Ur.emojiSafeSplit=Vt;Ur.getText=Zs;Rl()&&Rn.registerPlugin(Ur);Is.gsap.registerPlugin(Ks,Ur);const eu=({radius:i=100,duration:e=1.2,speed:t=.5,scrambleChars:n=".:",className:r="",style:s={},children:a,fontSize:o,fontFamily:l,color:c})=>{const u=de.useRef(null);de.useEffect(()=>{if(!u.current)return;const h=Ks.create(u.current.querySelector("p"),{type:"chars",charsClass:"inline-block will-change-transform"});h.chars.forEach(_=>{const m=_;Is.gsap.set(m,{attr:{"data-content":m.innerHTML}})});const f=_=>{h.chars.forEach(m=>{const p=m,{left:E,top:v,width:b,height:R}=p.getBoundingClientRect(),T=_.clientX-(E+b/2),A=_.clientY-(v+R/2),P=Math.hypot(T,A);P<i&&Is.gsap.to(p,{overwrite:!0,duration:e*(1-P/i),scrambleText:{text:p.dataset.content||"",chars:n,speed:t},ease:"none"})})},g=u.current;return g.addEventListener("pointermove",f),()=>{g.removeEventListener("pointermove",f),h.revert()}},[i,e,t,n]);const d={...s,...o&&{fontSize:o},...l&&{fontFamily:l},...c&&{color:c}};return oe.jsx("div",{ref:u,className:`m-[7vw] max-w-[800px] font-mono text-[clamp(14px,4vw,32px)] text-white ${r}`,style:d,children:oe.jsx("p",{children:a})})},tu=({direction:i="clockwise",speed:e=.5,color:t="#71717a",dashLength:n=10,gapLength:r=5,width:s=300,height:a=200,strokeWidth:o=1,borderRadius:l=0})=>{const c=de.useRef(null);return de.useEffect(()=>{if(!c.current)return;const u=c.current,d=u.getTotalLength();u.style.strokeDasharray=`${n} ${r}`,u.style.strokeDashoffset=i==="clockwise"?d:0;let h,f=i==="clockwise"?d:0;const g=i==="clockwise"?-e:e,_=()=>{f+=g,i==="clockwise"?f<=-(n+r)&&(f=0):f>=n+r&&(f=0),u.style.strokeDashoffset=f,h=requestAnimationFrame(_)};return h=requestAnimationFrame(_),()=>{h&&cancelAnimationFrame(h)}},[i,e,n,r]),oe.jsx("svg",{width:s+o*2,height:a+o*2,className:"overflow-visible",children:oe.jsx(Mt.motion.rect,{ref:c,x:o,y:o,width:s,height:a,rx:l,ry:l,fill:"transparent",stroke:t,strokeWidth:o,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.5}})})},nu=({color:i="var(--primary)",backgroundColor:e="var(--background)",duration:t=150,blurIntensity:n="1em",density:r=1,className:s})=>{const a=()=>[`radial-gradient(4px 100px at 0px 235px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 235px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 117.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 252px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 252px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 126px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 150px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 150px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 75px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 253px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 253px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 126.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 204px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 204px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 102px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 134px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 134px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 67px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 179px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 179px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 89.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 299px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 299px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 149.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 215px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 215px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 107.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 281px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 281px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 140.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 158px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 158px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 79px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 210px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 210px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 105px, ${i} 100%, transparent 150%)`].join(", "),o=["300px 235px","300px 235px","300px 235px","300px 252px","300px 252px","300px 252px","300px 150px","300px 150px","300px 150px","300px 253px","300px 253px","300px 253px","300px 204px","300px 204px","300px 204px","300px 134px","300px 134px","300px 134px","300px 179px","300px 179px","300px 179px","300px 299px","300px 299px","300px 299px","300px 215px","300px 215px","300px 215px","300px 281px","300px 281px","300px 281px","300px 158px","300px 158px","300px 158px","300px 210px","300px 210px"].join(", "),l="0px 220px, 3px 220px, 151.5px 337.5px, 25px 24px, 28px 24px, 176.5px 150px, 50px 16px, 53px 16px, 201.5px 91px, 75px 224px, 78px 224px, 226.5px 230.5px, 100px 19px, 103px 19px, 251.5px 121px, 125px 120px, 128px 120px, 276.5px 187px, 150px 31px, 153px 31px, 301.5px 120.5px, 175px 235px, 178px 235px, 326.5px 384.5px, 200px 121px, 203px 121px, 351.5px 228.5px, 225px 224px, 228px 224px, 376.5px 364.5px, 250px 26px, 253px 26px, 401.5px 105px, 275px 75px, 278px 75px, 426.5px 180px";return oe.jsxs("div",{className:aa("relative h-full w-full p-1",s),children:[oe.jsx(Mt.motion.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},className:"size-full",children:oe.jsx(Mt.motion.div,{className:"relative size-full z-0",style:{backgroundColor:e,backgroundImage:a(),backgroundSize:o},variants:{initial:{backgroundPosition:l},animate:{backgroundPosition:[l,"0px 6800px, 3px 6800px, 151.5px 6917.5px, 25px 13632px, 28px 13632px, 176.5px 13758px, 50px 5416px, 53px 5416px, 201.5px 5491px, 75px 17175px, 78px 17175px, 226.5px 17301.5px, 100px 5119px, 103px 5119px, 251.5px 5221px, 125px 8428px, 128px 8428px, 276.5px 8495px, 150px 9876px, 153px 9876px, 301.5px 9965.5px, 175px 13391px, 178px 13391px, 326.5px 13540.5px, 200px 14741px, 203px 14741px, 351.5px 14848.5px, 225px 18770px, 228px 18770px, 376.5px 18910.5px, 250px 5082px, 253px 5082px, 401.5px 5161px, 275px 6375px, 278px 6375px, 426.5px 6480px"],transition:{duration:t,ease:"linear",repeat:Number.POSITIVE_INFINITY}}},initial:"initial",animate:"animate"})}),oe.jsx("div",{className:"absolute inset-0 z-1 dark:brightness-600",style:{backdropFilter:`blur(${n})`,backgroundImage:`radial-gradient(circle at 50% 50%, transparent 0, transparent 2px, ${e} 2px)`,backgroundSize:`${8*r}px ${8*r}px`}})]})},iu=({text:i,disabled:e=!1,speed:t=2,className:n="",color:r="#b5b5b5",shineColor:s="#ffffff",spread:a=120,yoyo:o=!1,pauseOnHover:l=!1,direction:c="left",delay:u=0,fontSize:d,fontFamily:h})=>{const[f,g]=de.useState(!1),_=Mt.useMotionValue(0),m=de.useRef(0),p=de.useRef(null),E=de.useRef(c==="left"?1:-1),v=t*1e3,b=u*1e3;Mt.useAnimationFrame(M=>{if(e||f){p.current=null;return}if(p.current===null){p.current=M;return}const F=M-p.current;if(p.current=M,m.current+=F,o){const L=v+b,C=L*2,U=m.current%C;if(U<v){const H=U/v*100;_.set(E.current===1?H:100-H)}else if(U<L)_.set(E.current===1?100:0);else if(U<L+v){const Y=100-(U-L)/v*100;_.set(E.current===1?Y:100-Y)}else _.set(E.current===1?0:100)}else{const L=v+b,C=m.current%L;if(C<v){const U=C/v*100;_.set(E.current===1?U:100-U)}else _.set(E.current===1?100:0)}}),de.useEffect(()=>{E.current=c==="left"?1:-1,m.current=0,_.set(0)},[c]);const R=Mt.useTransform(_,M=>`${150-M*2}% center`),T=de.useCallback(()=>{l&&g(!0)},[l]),A=de.useCallback(()=>{l&&g(!1)},[l]),y={...{backgroundImage:`linear-gradient(${a}deg, ${r} 0%, ${r} 35%, ${s} 50%, ${r} 65%, ${r} 100%)`,backgroundSize:"200% auto",WebkitBackgroundClip:"text",backgroundClip:"text",WebkitTextFillColor:"transparent"},backgroundPosition:R,...d&&{fontSize:d},...h&&{fontFamily:h}};return oe.jsx(Mt.motion.span,{className:`inline-block ${n}`,style:y,onMouseEnter:T,onMouseLeave:A,children:i})};const Js="163",Hn={ROTATE:0,DOLLY:1,PAN:2},Vn={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ru=0,Aa=1,su=2,Pl=1,au=2,Jt=3,_n=0,St=1,Wt=2,en=0,ci=1,ui=2,wa=3,Ca=4,ou=5,wn=100,lu=101,cu=102,uu=103,hu=104,du=200,fu=201,pu=202,mu=203,zs=204,ks=205,gu=206,_u=207,xu=208,vu=209,Mu=210,Su=211,yu=212,Eu=213,bu=214,Tu=0,Du=1,Au=2,Ar=3,wu=4,Cu=5,Ru=6,Pu=7,Ll=0,Lu=1,Fu=2,pn=0,Iu=1,Uu=2,Nu=3,Qs=4,Ou=5,Bu=6,zu=7,Fl=300,pi=301,mi=302,Hs=303,Vs=304,Nr=306,Gs=1e3,Pn=1001,Ws=1002,Ut=1003,ku=1004,Yi=1005,zt=1006,Yr=1007,Ln=1008,mn=1009,Hu=1010,Vu=1011,Il=1012,Ul=1013,gi=1014,fn=1015,gn=1016,Nl=1017,Ol=1018,zi=1020,Gu=35902,Wu=1021,Xu=1022,Xt=1023,qu=1024,Yu=1025,hi=1026,Ni=1027,$u=1028,Bl=1029,ju=1030,zl=1031,kl=1033,$r=33776,jr=33777,Kr=33778,Zr=33779,Ra=35840,Pa=35841,La=35842,Fa=35843,Hl=36196,Ia=37492,Ua=37496,Na=37808,Oa=37809,Ba=37810,za=37811,ka=37812,Ha=37813,Va=37814,Ga=37815,Wa=37816,Xa=37817,qa=37818,Ya=37819,$a=37820,ja=37821,Jr=36492,Ka=36494,Za=36495,Ku=36283,Ja=36284,Qa=36285,eo=36286,Zu=3200,Ju=3201,Qu=0,eh=1,dn="",It="srgb",xn="srgb-linear",ea="display-p3",Or="display-p3-linear",wr="linear",Ke="srgb",Cr="rec709",Rr="p3",Gn=7680,to=519,th=512,nh=513,ih=514,Vl=515,rh=516,sh=517,ah=518,oh=519,no=35044,io="300 es",Qt=2e3,Pr=2001;class Nn{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const mt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let ro=1234567;const di=Math.PI/180,Oi=180/Math.PI;function xi(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(mt[i&255]+mt[i>>8&255]+mt[i>>16&255]+mt[i>>24&255]+"-"+mt[e&255]+mt[e>>8&255]+"-"+mt[e>>16&15|64]+mt[e>>24&255]+"-"+mt[t&63|128]+mt[t>>8&255]+"-"+mt[t>>16&255]+mt[t>>24&255]+mt[n&255]+mt[n>>8&255]+mt[n>>16&255]+mt[n>>24&255]).toLowerCase()}function ht(i,e,t){return Math.max(e,Math.min(t,i))}function ta(i,e){return(i%e+e)%e}function lh(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function ch(i,e,t){return i!==e?(t-i)/(e-i):0}function Pi(i,e,t){return(1-t)*i+t*e}function uh(i,e,t,n){return Pi(i,e,1-Math.exp(-t*n))}function hh(i,e=1){return e-Math.abs(ta(i,e*2)-e)}function dh(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function fh(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function ph(i,e){return i+Math.floor(Math.random()*(e-i+1))}function mh(i,e){return i+Math.random()*(e-i)}function gh(i){return i*(.5-Math.random())}function _h(i){i!==void 0&&(ro=i);let e=ro+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function xh(i){return i*di}function vh(i){return i*Oi}function Mh(i){return(i&i-1)===0&&i!==0}function Sh(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function yh(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function Eh(i,e,t,n,r){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+n)/2),u=a((e+n)/2),d=s((e-n)/2),h=a((e-n)/2),f=s((n-e)/2),g=a((n-e)/2);switch(r){case"XYX":i.set(o*u,l*d,l*h,o*c);break;case"YZY":i.set(l*h,o*u,l*d,o*c);break;case"ZXZ":i.set(l*d,l*h,o*u,o*c);break;case"XZX":i.set(o*u,l*g,l*f,o*c);break;case"YXY":i.set(l*f,o*u,l*g,o*c);break;case"ZYZ":i.set(l*g,l*f,o*u,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function ai(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function xt(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const Gl={DEG2RAD:di,RAD2DEG:Oi,generateUUID:xi,clamp:ht,euclideanModulo:ta,mapLinear:lh,inverseLerp:ch,lerp:Pi,damp:uh,pingpong:hh,smoothstep:dh,smootherstep:fh,randInt:ph,randFloat:mh,randFloatSpread:gh,seededRandom:_h,degToRad:xh,radToDeg:vh,isPowerOfTwo:Mh,ceilPowerOfTwo:Sh,floorPowerOfTwo:yh,setQuaternionFromProperEuler:Eh,normalize:xt,denormalize:ai};class ue{constructor(e=0,t=0){ue.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,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=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(ht(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*r+e.x,this.y=s*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Be{constructor(e,t,n,r,s,a,o,l,c){Be.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c)}set(e,t,n,r,s,a,o,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=o,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],u=n[4],d=n[7],h=n[2],f=n[5],g=n[8],_=r[0],m=r[3],p=r[6],E=r[1],v=r[4],b=r[7],R=r[2],T=r[5],A=r[8];return s[0]=a*_+o*E+l*R,s[3]=a*m+o*v+l*T,s[6]=a*p+o*b+l*A,s[1]=c*_+u*E+d*R,s[4]=c*m+u*v+d*T,s[7]=c*p+u*b+d*A,s[2]=h*_+f*E+g*R,s[5]=h*m+f*v+g*T,s[8]=h*p+f*b+g*A,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8];return t*a*u-t*o*c-n*s*u+n*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],d=u*a-o*c,h=o*l-u*s,f=c*s-a*l,g=t*d+n*h+r*f;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return e[0]=d*_,e[1]=(r*c-u*n)*_,e[2]=(o*n-r*a)*_,e[3]=h*_,e[4]=(u*t-r*l)*_,e[5]=(r*s-o*t)*_,e[6]=f*_,e[7]=(n*l-c*t)*_,e[8]=(a*t-n*s)*_,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Qr.makeScale(e,t)),this}rotate(e){return this.premultiply(Qr.makeRotation(-e)),this}translate(e,t){return this.premultiply(Qr.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Qr=new Be;function Wl(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Lr(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function bh(){const i=Lr("canvas");return i.style.display="block",i}const so={};function Th(i){i in so||(so[i]=!0,console.warn(i))}const ao=new Be().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),oo=new Be().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),$i={[xn]:{transfer:wr,primaries:Cr,toReference:i=>i,fromReference:i=>i},[It]:{transfer:Ke,primaries:Cr,toReference:i=>i.convertSRGBToLinear(),fromReference:i=>i.convertLinearToSRGB()},[Or]:{transfer:wr,primaries:Rr,toReference:i=>i.applyMatrix3(oo),fromReference:i=>i.applyMatrix3(ao)},[ea]:{transfer:Ke,primaries:Rr,toReference:i=>i.convertSRGBToLinear().applyMatrix3(oo),fromReference:i=>i.applyMatrix3(ao).convertLinearToSRGB()}},Dh=new Set([xn,Or]),je={enabled:!0,_workingColorSpace:xn,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(i){if(!Dh.has(i))throw new Error(`Unsupported working color space, "${i}".`);this._workingColorSpace=i},convert:function(i,e,t){if(this.enabled===!1||e===t||!e||!t)return i;const n=$i[e].toReference,r=$i[t].fromReference;return r(n(i))},fromWorkingColorSpace:function(i,e){return this.convert(i,this._workingColorSpace,e)},toWorkingColorSpace:function(i,e){return this.convert(i,e,this._workingColorSpace)},getPrimaries:function(i){return $i[i].primaries},getTransfer:function(i){return i===dn?wr:$i[i].transfer}};function fi(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function es(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let Wn;class Ah{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Wn===void 0&&(Wn=Lr("canvas")),Wn.width=e.width,Wn.height=e.height;const n=Wn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Wn}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Lr("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=fi(s[a]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(fi(t[n]/255)*255):t[n]=fi(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let wh=0;class Xl{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:wh++}),this.uuid=xi(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(ts(r[a].image)):s.push(ts(r[a]))}else s=ts(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function ts(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?Ah.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Ch=0;class Tt extends Nn{constructor(e=Tt.DEFAULT_IMAGE,t=Tt.DEFAULT_MAPPING,n=Pn,r=Pn,s=zt,a=Ln,o=Xt,l=mn,c=Tt.DEFAULT_ANISOTROPY,u=dn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Ch++}),this.uuid=xi(),this.name="",this.source=new Xl(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new ue(0,0),this.repeat=new ue(1,1),this.center=new ue(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Be,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Fl)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Gs:e.x=e.x-Math.floor(e.x);break;case Pn:e.x=e.x<0?0:1;break;case Ws:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Gs:e.y=e.y-Math.floor(e.y);break;case Pn:e.y=e.y<0?0:1;break;case Ws:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Tt.DEFAULT_IMAGE=null;Tt.DEFAULT_MAPPING=Fl;Tt.DEFAULT_ANISOTROPY=1;class dt{constructor(e=0,t=0,n=0,r=1){dt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){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: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s;const l=e.elements,c=l[0],u=l[4],d=l[8],h=l[1],f=l[5],g=l[9],_=l[2],m=l[6],p=l[10];if(Math.abs(u-h)<.01&&Math.abs(d-_)<.01&&Math.abs(g-m)<.01){if(Math.abs(u+h)<.1&&Math.abs(d+_)<.1&&Math.abs(g+m)<.1&&Math.abs(c+f+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const v=(c+1)/2,b=(f+1)/2,R=(p+1)/2,T=(u+h)/4,A=(d+_)/4,P=(g+m)/4;return v>b&&v>R?v<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(v),r=T/n,s=A/n):b>R?b<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(b),n=T/r,s=P/r):R<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(R),n=A/s,r=P/s),this.set(n,r,s,t),this}let E=Math.sqrt((m-g)*(m-g)+(d-_)*(d-_)+(h-u)*(h-u));return Math.abs(E)<.001&&(E=1),this.x=(m-g)/E,this.y=(d-_)/E,this.z=(h-u)/E,this.w=Math.acos((c+f+p-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Rh extends Nn{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new dt(0,0,e,t),this.scissorTest=!1,this.viewport=new dt(0,0,e,t);const r={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:zt,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},n);const s=new Tt(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,r=e.textures.length;n<r;n++)this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Xl(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ht extends Rh{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class ql extends Tt{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Ut,this.minFilter=Ut,this.wrapR=Pn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Ph extends Tt{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Ut,this.minFilter=Ut,this.wrapR=Pn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Fn{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,a,o){let l=n[r+0],c=n[r+1],u=n[r+2],d=n[r+3];const h=s[a+0],f=s[a+1],g=s[a+2],_=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=d;return}if(o===1){e[t+0]=h,e[t+1]=f,e[t+2]=g,e[t+3]=_;return}if(d!==_||l!==h||c!==f||u!==g){let m=1-o;const p=l*h+c*f+u*g+d*_,E=p>=0?1:-1,v=1-p*p;if(v>Number.EPSILON){const R=Math.sqrt(v),T=Math.atan2(R,p*E);m=Math.sin(m*T)/R,o=Math.sin(o*T)/R}const b=o*E;if(l=l*m+h*b,c=c*m+f*b,u=u*m+g*b,d=d*m+_*b,m===1-o){const R=1/Math.sqrt(l*l+c*c+u*u+d*d);l*=R,c*=R,u*=R,d*=R}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=d}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],u=n[r+3],d=s[a],h=s[a+1],f=s[a+2],g=s[a+3];return e[t]=o*g+u*d+l*f-c*h,e[t+1]=l*g+u*h+c*d-o*f,e[t+2]=c*g+u*f+o*h-l*d,e[t+3]=u*g-o*d-l*h-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),u=o(r/2),d=o(s/2),h=l(n/2),f=l(r/2),g=l(s/2);switch(a){case"XYZ":this._x=h*u*d+c*f*g,this._y=c*f*d-h*u*g,this._z=c*u*g+h*f*d,this._w=c*u*d-h*f*g;break;case"YXZ":this._x=h*u*d+c*f*g,this._y=c*f*d-h*u*g,this._z=c*u*g-h*f*d,this._w=c*u*d+h*f*g;break;case"ZXY":this._x=h*u*d-c*f*g,this._y=c*f*d+h*u*g,this._z=c*u*g+h*f*d,this._w=c*u*d-h*f*g;break;case"ZYX":this._x=h*u*d-c*f*g,this._y=c*f*d+h*u*g,this._z=c*u*g-h*f*d,this._w=c*u*d+h*f*g;break;case"YZX":this._x=h*u*d+c*f*g,this._y=c*f*d+h*u*g,this._z=c*u*g-h*f*d,this._w=c*u*d-h*f*g;break;case"XZY":this._x=h*u*d-c*f*g,this._y=c*f*d-h*u*g,this._z=c*u*g+h*f*d,this._w=c*u*d+h*f*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],u=t[6],d=t[10],h=n+o+d;if(h>0){const f=.5/Math.sqrt(h+1);this._w=.25/f,this._x=(u-l)*f,this._y=(s-c)*f,this._z=(a-r)*f}else if(n>o&&n>d){const f=2*Math.sqrt(1+n-o-d);this._w=(u-l)/f,this._x=.25*f,this._y=(r+a)/f,this._z=(s+c)/f}else if(o>d){const f=2*Math.sqrt(1+o-n-d);this._w=(s-c)/f,this._x=(r+a)/f,this._y=.25*f,this._z=(l+u)/f}else{const f=2*Math.sqrt(1+d-n-o);this._w=(a-r)/f,this._x=(s+c)/f,this._y=(l+u)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ht(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+a*o+r*c-s*l,this._y=r*u+a*l+s*o-n*c,this._z=s*u+a*c+n*l-r*o,this._w=a*u-n*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+n*e._x+r*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const f=1-t;return this._w=f*a+t*this._w,this._x=f*n+t*this._x,this._y=f*r+t*this._y,this._z=f*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,o),d=Math.sin((1-t)*u)/c,h=Math.sin(t*u)/c;return this._w=a*d+this._w*h,this._x=n*d+this._x*h,this._y=r*d+this._y*h,this._z=s*d+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class I{constructor(e=0,t=0,n=0){I.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(lo.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(lo.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*n),u=2*(o*t-s*r),d=2*(s*n-a*t);return this.x=t+l*c+a*d-o*u,this.y=n+l*u+o*c-s*d,this.z=r+l*d+s*u-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-n*l,this.z=n*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return ns.copy(this).projectOnVector(e),this.sub(ns)}reflect(e){return this.sub(ns.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(ht(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const ns=new I,lo=new Fn;class ki{constructor(e=new I(1/0,1/0,1/0),t=new I(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Nt.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Nt.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Nt.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Nt):Nt.fromBufferAttribute(s,a),Nt.applyMatrix4(e.matrixWorld),this.expandByPoint(Nt);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),ji.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),ji.copy(n.boundingBox)),ji.applyMatrix4(e.matrixWorld),this.union(ji)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Nt),Nt.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ti),Ki.subVectors(this.max,Ti),Xn.subVectors(e.a,Ti),qn.subVectors(e.b,Ti),Yn.subVectors(e.c,Ti),sn.subVectors(qn,Xn),an.subVectors(Yn,qn),Sn.subVectors(Xn,Yn);let t=[0,-sn.z,sn.y,0,-an.z,an.y,0,-Sn.z,Sn.y,sn.z,0,-sn.x,an.z,0,-an.x,Sn.z,0,-Sn.x,-sn.y,sn.x,0,-an.y,an.x,0,-Sn.y,Sn.x,0];return!is(t,Xn,qn,Yn,Ki)||(t=[1,0,0,0,1,0,0,0,1],!is(t,Xn,qn,Yn,Ki))?!1:(Zi.crossVectors(sn,an),t=[Zi.x,Zi.y,Zi.z],is(t,Xn,qn,Yn,Ki))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Nt).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Nt).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Yt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Yt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Yt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Yt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Yt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Yt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Yt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Yt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Yt),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Yt=[new I,new I,new I,new I,new I,new I,new I,new I],Nt=new I,ji=new ki,Xn=new I,qn=new I,Yn=new I,sn=new I,an=new I,Sn=new I,Ti=new I,Ki=new I,Zi=new I,yn=new I;function is(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){yn.fromArray(i,s);const o=r.x*Math.abs(yn.x)+r.y*Math.abs(yn.y)+r.z*Math.abs(yn.z),l=e.dot(yn),c=t.dot(yn),u=n.dot(yn);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>o)return!1}return!0}const Lh=new ki,Di=new I,rs=new I;class Hi{constructor(e=new I,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):Lh.setFromPoints(e).getCenter(n);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Di.subVectors(e,this.center);const t=Di.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(Di,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(rs.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Di.copy(e.center).add(rs)),this.expandByPoint(Di.copy(e.center).sub(rs))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const $t=new I,ss=new I,Ji=new I,on=new I,as=new I,Qi=new I,os=new I;class Br{constructor(e=new I,t=new I(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,$t)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=$t.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):($t.copy(this.origin).addScaledVector(this.direction,t),$t.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){ss.copy(e).add(t).multiplyScalar(.5),Ji.copy(t).sub(e).normalize(),on.copy(this.origin).sub(ss);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Ji),o=on.dot(this.direction),l=-on.dot(Ji),c=on.lengthSq(),u=Math.abs(1-a*a);let d,h,f,g;if(u>0)if(d=a*l-o,h=a*o-l,g=s*u,d>=0)if(h>=-g)if(h<=g){const _=1/u;d*=_,h*=_,f=d*(d+a*h+2*o)+h*(a*d+h+2*l)+c}else h=s,d=Math.max(0,-(a*h+o)),f=-d*d+h*(h+2*l)+c;else h=-s,d=Math.max(0,-(a*h+o)),f=-d*d+h*(h+2*l)+c;else h<=-g?(d=Math.max(0,-(-a*s+o)),h=d>0?-s:Math.min(Math.max(-s,-l),s),f=-d*d+h*(h+2*l)+c):h<=g?(d=0,h=Math.min(Math.max(-s,-l),s),f=h*(h+2*l)+c):(d=Math.max(0,-(a*s+o)),h=d>0?s:Math.min(Math.max(-s,-l),s),f=-d*d+h*(h+2*l)+c);else h=a>0?-s:s,d=Math.max(0,-(a*h+o)),f=-d*d+h*(h+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,d),r&&r.copy(ss).addScaledVector(Ji,h),f}intersectSphere(e,t){$t.subVectors(e.center,this.origin);const n=$t.dot(this.direction),r=$t.dot($t)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,a,o,l;const c=1/this.direction.x,u=1/this.direction.y,d=1/this.direction.z,h=this.origin;return c>=0?(n=(e.min.x-h.x)*c,r=(e.max.x-h.x)*c):(n=(e.max.x-h.x)*c,r=(e.min.x-h.x)*c),u>=0?(s=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(s=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),d>=0?(o=(e.min.z-h.z)*d,l=(e.max.z-h.z)*d):(o=(e.max.z-h.z)*d,l=(e.min.z-h.z)*d),n>l||o>r)||((o>n||n!==n)&&(n=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,$t)!==null}intersectTriangle(e,t,n,r,s){as.subVectors(t,e),Qi.subVectors(n,e),os.crossVectors(as,Qi);let a=this.direction.dot(os),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;on.subVectors(this.origin,e);const l=o*this.direction.dot(Qi.crossVectors(on,Qi));if(l<0)return null;const c=o*this.direction.dot(as.cross(on));if(c<0||l+c>a)return null;const u=-o*on.dot(os);return u<0?null:this.at(u/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class et{constructor(e,t,n,r,s,a,o,l,c,u,d,h,f,g,_,m){et.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c,u,d,h,f,g,_,m)}set(e,t,n,r,s,a,o,l,c,u,d,h,f,g,_,m){const p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=r,p[1]=s,p[5]=a,p[9]=o,p[13]=l,p[2]=c,p[6]=u,p[10]=d,p[14]=h,p[3]=f,p[7]=g,p[11]=_,p[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 et().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,r=1/$n.setFromMatrixColumn(e,0).length(),s=1/$n.setFromMatrixColumn(e,1).length(),a=1/$n.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const h=a*u,f=a*d,g=o*u,_=o*d;t[0]=l*u,t[4]=-l*d,t[8]=c,t[1]=f+g*c,t[5]=h-_*c,t[9]=-o*l,t[2]=_-h*c,t[6]=g+f*c,t[10]=a*l}else if(e.order==="YXZ"){const h=l*u,f=l*d,g=c*u,_=c*d;t[0]=h+_*o,t[4]=g*o-f,t[8]=a*c,t[1]=a*d,t[5]=a*u,t[9]=-o,t[2]=f*o-g,t[6]=_+h*o,t[10]=a*l}else if(e.order==="ZXY"){const h=l*u,f=l*d,g=c*u,_=c*d;t[0]=h-_*o,t[4]=-a*d,t[8]=g+f*o,t[1]=f+g*o,t[5]=a*u,t[9]=_-h*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const h=a*u,f=a*d,g=o*u,_=o*d;t[0]=l*u,t[4]=g*c-f,t[8]=h*c+_,t[1]=l*d,t[5]=_*c+h,t[9]=f*c-g,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const h=a*l,f=a*c,g=o*l,_=o*c;t[0]=l*u,t[4]=_-h*d,t[8]=g*d+f,t[1]=d,t[5]=a*u,t[9]=-o*u,t[2]=-c*u,t[6]=f*d+g,t[10]=h-_*d}else if(e.order==="XZY"){const h=a*l,f=a*c,g=o*l,_=o*c;t[0]=l*u,t[4]=-d,t[8]=c*u,t[1]=h*d+_,t[5]=a*u,t[9]=f*d-g,t[2]=g*d-f,t[6]=o*u,t[10]=_*d+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Fh,e,Ih)}lookAt(e,t,n){const r=this.elements;return wt.subVectors(e,t),wt.lengthSq()===0&&(wt.z=1),wt.normalize(),ln.crossVectors(n,wt),ln.lengthSq()===0&&(Math.abs(n.z)===1?wt.x+=1e-4:wt.z+=1e-4,wt.normalize(),ln.crossVectors(n,wt)),ln.normalize(),er.crossVectors(wt,ln),r[0]=ln.x,r[4]=er.x,r[8]=wt.x,r[1]=ln.y,r[5]=er.y,r[9]=wt.y,r[2]=ln.z,r[6]=er.z,r[10]=wt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],u=n[1],d=n[5],h=n[9],f=n[13],g=n[2],_=n[6],m=n[10],p=n[14],E=n[3],v=n[7],b=n[11],R=n[15],T=r[0],A=r[4],P=r[8],y=r[12],M=r[1],F=r[5],L=r[9],C=r[13],U=r[2],H=r[6],Y=r[10],J=r[14],z=r[3],j=r[7],$=r[11],N=r[15];return s[0]=a*T+o*M+l*U+c*z,s[4]=a*A+o*F+l*H+c*j,s[8]=a*P+o*L+l*Y+c*$,s[12]=a*y+o*C+l*J+c*N,s[1]=u*T+d*M+h*U+f*z,s[5]=u*A+d*F+h*H+f*j,s[9]=u*P+d*L+h*Y+f*$,s[13]=u*y+d*C+h*J+f*N,s[2]=g*T+_*M+m*U+p*z,s[6]=g*A+_*F+m*H+p*j,s[10]=g*P+_*L+m*Y+p*$,s[14]=g*y+_*C+m*J+p*N,s[3]=E*T+v*M+b*U+R*z,s[7]=E*A+v*F+b*H+R*j,s[11]=E*P+v*L+b*Y+R*$,s[15]=E*y+v*C+b*J+R*N,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],u=e[2],d=e[6],h=e[10],f=e[14],g=e[3],_=e[7],m=e[11],p=e[15];return g*(+s*l*d-r*c*d-s*o*h+n*c*h+r*o*f-n*l*f)+_*(+t*l*f-t*c*h+s*a*h-r*a*f+r*c*u-s*l*u)+m*(+t*c*d-t*o*f-s*a*d+n*a*f+s*o*u-n*c*u)+p*(-r*o*u-t*l*d+t*o*h+r*a*d-n*a*h+n*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],d=e[9],h=e[10],f=e[11],g=e[12],_=e[13],m=e[14],p=e[15],E=d*m*c-_*h*c+_*l*f-o*m*f-d*l*p+o*h*p,v=g*h*c-u*m*c-g*l*f+a*m*f+u*l*p-a*h*p,b=u*_*c-g*d*c+g*o*f-a*_*f-u*o*p+a*d*p,R=g*d*l-u*_*l-g*o*h+a*_*h+u*o*m-a*d*m,T=t*E+n*v+r*b+s*R;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const A=1/T;return e[0]=E*A,e[1]=(_*h*s-d*m*s-_*r*f+n*m*f+d*r*p-n*h*p)*A,e[2]=(o*m*s-_*l*s+_*r*c-n*m*c-o*r*p+n*l*p)*A,e[3]=(d*l*s-o*h*s-d*r*c+n*h*c+o*r*f-n*l*f)*A,e[4]=v*A,e[5]=(u*m*s-g*h*s+g*r*f-t*m*f-u*r*p+t*h*p)*A,e[6]=(g*l*s-a*m*s-g*r*c+t*m*c+a*r*p-t*l*p)*A,e[7]=(a*h*s-u*l*s+u*r*c-t*h*c-a*r*f+t*l*f)*A,e[8]=b*A,e[9]=(g*d*s-u*_*s-g*n*f+t*_*f+u*n*p-t*d*p)*A,e[10]=(a*_*s-g*o*s+g*n*c-t*_*c-a*n*p+t*o*p)*A,e[11]=(u*o*s-a*d*s-u*n*c+t*d*c+a*n*f-t*o*f)*A,e[12]=R*A,e[13]=(u*_*r-g*d*r+g*n*h-t*_*h-u*n*m+t*d*m)*A,e[14]=(g*o*r-a*_*r-g*n*l+t*_*l+a*n*m-t*o*m)*A,e[15]=(a*d*r-u*o*r+u*n*l-t*d*l-a*n*h+t*o*h)*A,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,u=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,u*o+n,u*l-r*a,0,c*l-r*o,u*l+r*a,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,a){return this.set(1,n,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,u=a+a,d=o+o,h=s*c,f=s*u,g=s*d,_=a*u,m=a*d,p=o*d,E=l*c,v=l*u,b=l*d,R=n.x,T=n.y,A=n.z;return r[0]=(1-(_+p))*R,r[1]=(f+b)*R,r[2]=(g-v)*R,r[3]=0,r[4]=(f-b)*T,r[5]=(1-(h+p))*T,r[6]=(m+E)*T,r[7]=0,r[8]=(g+v)*A,r[9]=(m-E)*A,r[10]=(1-(h+_))*A,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let s=$n.set(r[0],r[1],r[2]).length();const a=$n.set(r[4],r[5],r[6]).length(),o=$n.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Ot.copy(this);const c=1/s,u=1/a,d=1/o;return Ot.elements[0]*=c,Ot.elements[1]*=c,Ot.elements[2]*=c,Ot.elements[4]*=u,Ot.elements[5]*=u,Ot.elements[6]*=u,Ot.elements[8]*=d,Ot.elements[9]*=d,Ot.elements[10]*=d,t.setFromRotationMatrix(Ot),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,r,s,a,o=Qt){const l=this.elements,c=2*s/(t-e),u=2*s/(n-r),d=(t+e)/(t-e),h=(n+r)/(n-r);let f,g;if(o===Qt)f=-(a+s)/(a-s),g=-2*a*s/(a-s);else if(o===Pr)f=-a/(a-s),g=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=u,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=f,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=Qt){const l=this.elements,c=1/(t-e),u=1/(n-r),d=1/(a-s),h=(t+e)*c,f=(n+r)*u;let g,_;if(o===Qt)g=(a+s)*d,_=-2*d;else if(o===Pr)g=s*d,_=-1*d;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-h,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-f,l[2]=0,l[6]=0,l[10]=_,l[14]=-g,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const $n=new I,Ot=new et,Fh=new I(0,0,0),Ih=new I(1,1,1),ln=new I,er=new I,wt=new I,co=new et,uo=new Fn;let In=class Yl{constructor(e=0,t=0,n=0,r=Yl.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],u=r[9],d=r[2],h=r[6],f=r[10];switch(t){case"XYZ":this._y=Math.asin(ht(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-ht(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(ht(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-d,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-ht(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(h,f),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(ht(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-ht(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return co.makeRotationFromQuaternion(e),this.setFromRotationMatrix(co,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return uo.setFromEuler(this),this.setFromQuaternion(uo,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};In.DEFAULT_ORDER="XYZ";class $l{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Uh=0;const ho=new I,jn=new Fn,jt=new et,tr=new I,Ai=new I,Nh=new I,Oh=new Fn,fo=new I(1,0,0),po=new I(0,1,0),mo=new I(0,0,1),go={type:"added"},Bh={type:"removed"},Kn={type:"childadded",child:null},ls={type:"childremoved",child:null};class yt extends Nn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Uh++}),this.uuid=xi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=yt.DEFAULT_UP.clone();const e=new I,t=new In,n=new Fn,r=new I(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new et},normalMatrix:{value:new Be}}),this.matrix=new et,this.matrixWorld=new et,this.matrixAutoUpdate=yt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=yt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new $l,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return jn.setFromAxisAngle(e,t),this.quaternion.multiply(jn),this}rotateOnWorldAxis(e,t){return jn.setFromAxisAngle(e,t),this.quaternion.premultiply(jn),this}rotateX(e){return this.rotateOnAxis(fo,e)}rotateY(e){return this.rotateOnAxis(po,e)}rotateZ(e){return this.rotateOnAxis(mo,e)}translateOnAxis(e,t){return ho.copy(e).applyQuaternion(this.quaternion),this.position.add(ho.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(fo,e)}translateY(e){return this.translateOnAxis(po,e)}translateZ(e){return this.translateOnAxis(mo,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(jt.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?tr.copy(e):tr.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),Ai.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?jt.lookAt(Ai,tr,this.up):jt.lookAt(tr,Ai,this.up),this.quaternion.setFromRotationMatrix(jt),r&&(jt.extractRotation(r.matrixWorld),jn.setFromRotationMatrix(jt),this.quaternion.premultiply(jn.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(go),Kn.child=e,this.dispatchEvent(Kn),Kn.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Bh),ls.child=e,this.dispatchEvent(ls),ls.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),jt.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),jt.multiply(e.parent.matrixWorld)),e.applyMatrix4(jt),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(go),Kn.child=e,this.dispatchEvent(Kn),Kn.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ai,e,Nh),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ai,Oh,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++){const s=t[n];(s.matrixWorldAutoUpdate===!0||e===!0)&&s.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.matrixWorldAutoUpdate===!0&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++){const o=r[s];o.matrixWorldAutoUpdate===!0&&o.updateWorldMatrix(!1,!0)}}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),r.maxGeometryCount=this._maxGeometryCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const d=l[c];s(e.shapes,d)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),u=a(e.images),d=a(e.shapes),h=a(e.skeletons),f=a(e.animations),g=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),d.length>0&&(n.shapes=d),h.length>0&&(n.skeletons=h),f.length>0&&(n.animations=f),g.length>0&&(n.nodes=g)}return n.object=r,n;function a(o){const l=[];for(const c in o){const u=o[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const r=e.children[n];this.add(r.clone())}return this}}yt.DEFAULT_UP=new I(0,1,0);yt.DEFAULT_MATRIX_AUTO_UPDATE=!0;yt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Bt=new I,Kt=new I,cs=new I,Zt=new I,Zn=new I,Jn=new I,_o=new I,us=new I,hs=new I,ds=new I;let Ci=class oi{constructor(e=new I,t=new I,n=new I){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Bt.subVectors(e,t),r.cross(Bt);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Bt.subVectors(r,t),Kt.subVectors(n,t),cs.subVectors(e,t);const a=Bt.dot(Bt),o=Bt.dot(Kt),l=Bt.dot(cs),c=Kt.dot(Kt),u=Kt.dot(cs),d=a*c-o*o;if(d===0)return s.set(0,0,0),null;const h=1/d,f=(c*l-o*u)*h,g=(a*u-o*l)*h;return s.set(1-f-g,g,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Zt)===null?!1:Zt.x>=0&&Zt.y>=0&&Zt.x+Zt.y<=1}static getInterpolation(e,t,n,r,s,a,o,l){return this.getBarycoord(e,t,n,r,Zt)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Zt.x),l.addScaledVector(a,Zt.y),l.addScaledVector(o,Zt.z),l)}static isFrontFacing(e,t,n,r){return Bt.subVectors(n,t),Kt.subVectors(e,t),Bt.cross(Kt).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Bt.subVectors(this.c,this.b),Kt.subVectors(this.a,this.b),Bt.cross(Kt).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return oi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return oi.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return oi.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return oi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return oi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let a,o;Zn.subVectors(r,n),Jn.subVectors(s,n),us.subVectors(e,n);const l=Zn.dot(us),c=Jn.dot(us);if(l<=0&&c<=0)return t.copy(n);hs.subVectors(e,r);const u=Zn.dot(hs),d=Jn.dot(hs);if(u>=0&&d<=u)return t.copy(r);const h=l*d-u*c;if(h<=0&&l>=0&&u<=0)return a=l/(l-u),t.copy(n).addScaledVector(Zn,a);ds.subVectors(e,s);const f=Zn.dot(ds),g=Jn.dot(ds);if(g>=0&&f<=g)return t.copy(s);const _=f*c-l*g;if(_<=0&&c>=0&&g<=0)return o=c/(c-g),t.copy(n).addScaledVector(Jn,o);const m=u*g-f*d;if(m<=0&&d-u>=0&&f-g>=0)return _o.subVectors(s,r),o=(d-u)/(d-u+(f-g)),t.copy(r).addScaledVector(_o,o);const p=1/(m+_+h);return a=_*p,o=h*p,t.copy(n).addScaledVector(Zn,a).addScaledVector(Jn,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};const jl={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},cn={h:0,s:0,l:0},nr={h:0,s:0,l:0};function fs(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}let be=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=It){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,je.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=je.workingColorSpace){return this.r=e,this.g=t,this.b=n,je.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=je.workingColorSpace){if(e=ta(e,1),t=ht(t,0,1),n=ht(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=fs(a,s,e+1/3),this.g=fs(a,s,e),this.b=fs(a,s,e-1/3)}return je.toWorkingColorSpace(this,r),this}setStyle(e,t=It){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=It){const n=jl[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=fi(e.r),this.g=fi(e.g),this.b=fi(e.b),this}copyLinearToSRGB(e){return this.r=es(e.r),this.g=es(e.g),this.b=es(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=It){return je.fromWorkingColorSpace(gt.copy(this),e),Math.round(ht(gt.r*255,0,255))*65536+Math.round(ht(gt.g*255,0,255))*256+Math.round(ht(gt.b*255,0,255))}getHexString(e=It){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=je.workingColorSpace){je.fromWorkingColorSpace(gt.copy(this),t);const n=gt.r,r=gt.g,s=gt.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let l,c;const u=(o+a)/2;if(o===a)l=0,c=0;else{const d=a-o;switch(c=u<=.5?d/(a+o):d/(2-a-o),a){case n:l=(r-s)/d+(r<s?6:0);break;case r:l=(s-n)/d+2;break;case s:l=(n-r)/d+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=je.workingColorSpace){return je.fromWorkingColorSpace(gt.copy(this),t),e.r=gt.r,e.g=gt.g,e.b=gt.b,e}getStyle(e=It){je.fromWorkingColorSpace(gt.copy(this),e);const t=gt.r,n=gt.g,r=gt.b;return e!==It?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(cn),this.setHSL(cn.h+e,cn.s+t,cn.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(cn),e.getHSL(nr);const n=Pi(cn.h,nr.h,t),r=Pi(cn.s,nr.s,t),s=Pi(cn.l,nr.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};const gt=new be;be.NAMES=jl;let zh=0;class vi extends Nn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:zh++}),this.uuid=xi(),this.name="",this.type="Material",this.blending=ci,this.side=_n,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=zs,this.blendDst=ks,this.blendEquation=wn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new be(0,0,0),this.blendAlpha=0,this.depthFunc=Ar,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=to,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Gn,this.stencilZFail=Gn,this.stencilZPass=Gn,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.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==ci&&(n.blending=this.blending),this.side!==_n&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==zs&&(n.blendSrc=this.blendSrc),this.blendDst!==ks&&(n.blendDst=this.blendDst),this.blendEquation!==wn&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Ar&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==to&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Gn&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Gn&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Gn&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Vi extends vi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new be(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.envMapRotation=new In,this.combine=Ll,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const st=new I,ir=new ue;class Et{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=no,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=fn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return Th("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)ir.fromBufferAttribute(this,t),ir.applyMatrix3(e),this.setXY(t,ir.x,ir.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)st.fromBufferAttribute(this,t),st.applyMatrix3(e),this.setXYZ(t,st.x,st.y,st.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)st.fromBufferAttribute(this,t),st.applyMatrix4(e),this.setXYZ(t,st.x,st.y,st.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)st.fromBufferAttribute(this,t),st.applyNormalMatrix(e),this.setXYZ(t,st.x,st.y,st.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)st.fromBufferAttribute(this,t),st.transformDirection(e),this.setXYZ(t,st.x,st.y,st.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=ai(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=xt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=ai(t,this.array)),t}setX(e,t){return this.normalized&&(t=xt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=ai(t,this.array)),t}setY(e,t){return this.normalized&&(t=xt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=ai(t,this.array)),t}setZ(e,t){return this.normalized&&(t=xt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=ai(t,this.array)),t}setW(e,t){return this.normalized&&(t=xt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=xt(t,this.array),n=xt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=xt(t,this.array),n=xt(n,this.array),r=xt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=xt(t,this.array),n=xt(n,this.array),r=xt(r,this.array),s=xt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==no&&(e.usage=this.usage),e}}class Kl extends Et{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Zl extends Et{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class nt extends Et{constructor(e,t,n){super(new Float32Array(e),t,n)}}let kh=0;const Ft=new et,ps=new yt,Qn=new I,Ct=new ki,wi=new ki,ut=new I;class _t extends Nn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:kh++}),this.uuid=xi(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Wl(e)?Zl:Kl)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Be().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ft.makeRotationFromQuaternion(e),this.applyMatrix4(Ft),this}rotateX(e){return Ft.makeRotationX(e),this.applyMatrix4(Ft),this}rotateY(e){return Ft.makeRotationY(e),this.applyMatrix4(Ft),this}rotateZ(e){return Ft.makeRotationZ(e),this.applyMatrix4(Ft),this}translate(e,t,n){return Ft.makeTranslation(e,t,n),this.applyMatrix4(Ft),this}scale(e,t,n){return Ft.makeScale(e,t,n),this.applyMatrix4(Ft),this}lookAt(e){return ps.lookAt(e),ps.updateMatrix(),this.applyMatrix4(ps.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Qn).negate(),this.translate(Qn.x,Qn.y,Qn.z),this}setFromPoints(e){const t=[];for(let n=0,r=e.length;n<r;n++){const s=e[n];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new nt(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ki);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new I(-1/0,-1/0,-1/0),new I(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const s=t[n];Ct.setFromBufferAttribute(s),this.morphTargetsRelative?(ut.addVectors(this.boundingBox.min,Ct.min),this.boundingBox.expandByPoint(ut),ut.addVectors(this.boundingBox.max,Ct.max),this.boundingBox.expandByPoint(ut)):(this.boundingBox.expandByPoint(Ct.min),this.boundingBox.expandByPoint(Ct.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Hi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new I,1/0);return}if(e){const n=this.boundingSphere.center;if(Ct.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];wi.setFromBufferAttribute(o),this.morphTargetsRelative?(ut.addVectors(Ct.min,wi.min),Ct.expandByPoint(ut),ut.addVectors(Ct.max,wi.max),Ct.expandByPoint(ut)):(Ct.expandByPoint(wi.min),Ct.expandByPoint(wi.max))}Ct.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)ut.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(ut));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,u=o.count;c<u;c++)ut.fromBufferAttribute(o,c),l&&(Qn.fromBufferAttribute(e,c),ut.add(Qn)),r=Math.max(r,n.distanceToSquared(ut))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Et(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let P=0;P<n.count;P++)o[P]=new I,l[P]=new I;const c=new I,u=new I,d=new I,h=new ue,f=new ue,g=new ue,_=new I,m=new I;function p(P,y,M){c.fromBufferAttribute(n,P),u.fromBufferAttribute(n,y),d.fromBufferAttribute(n,M),h.fromBufferAttribute(s,P),f.fromBufferAttribute(s,y),g.fromBufferAttribute(s,M),u.sub(c),d.sub(c),f.sub(h),g.sub(h);const F=1/(f.x*g.y-g.x*f.y);isFinite(F)&&(_.copy(u).multiplyScalar(g.y).addScaledVector(d,-f.y).multiplyScalar(F),m.copy(d).multiplyScalar(f.x).addScaledVector(u,-g.x).multiplyScalar(F),o[P].add(_),o[y].add(_),o[M].add(_),l[P].add(m),l[y].add(m),l[M].add(m))}let E=this.groups;E.length===0&&(E=[{start:0,count:e.count}]);for(let P=0,y=E.length;P<y;++P){const M=E[P],F=M.start,L=M.count;for(let C=F,U=F+L;C<U;C+=3)p(e.getX(C+0),e.getX(C+1),e.getX(C+2))}const v=new I,b=new I,R=new I,T=new I;function A(P){R.fromBufferAttribute(r,P),T.copy(R);const y=o[P];v.copy(y),v.sub(R.multiplyScalar(R.dot(y))).normalize(),b.crossVectors(T,y);const F=b.dot(l[P])<0?-1:1;a.setXYZW(P,v.x,v.y,v.z,F)}for(let P=0,y=E.length;P<y;++P){const M=E[P],F=M.start,L=M.count;for(let C=F,U=F+L;C<U;C+=3)A(e.getX(C+0)),A(e.getX(C+1)),A(e.getX(C+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Et(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let h=0,f=n.count;h<f;h++)n.setXYZ(h,0,0,0);const r=new I,s=new I,a=new I,o=new I,l=new I,c=new I,u=new I,d=new I;if(e)for(let h=0,f=e.count;h<f;h+=3){const g=e.getX(h+0),_=e.getX(h+1),m=e.getX(h+2);r.fromBufferAttribute(t,g),s.fromBufferAttribute(t,_),a.fromBufferAttribute(t,m),u.subVectors(a,s),d.subVectors(r,s),u.cross(d),o.fromBufferAttribute(n,g),l.fromBufferAttribute(n,_),c.fromBufferAttribute(n,m),o.add(u),l.add(u),c.add(u),n.setXYZ(g,o.x,o.y,o.z),n.setXYZ(_,l.x,l.y,l.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let h=0,f=t.count;h<f;h+=3)r.fromBufferAttribute(t,h+0),s.fromBufferAttribute(t,h+1),a.fromBufferAttribute(t,h+2),u.subVectors(a,s),d.subVectors(r,s),u.cross(d),n.setXYZ(h+0,u.x,u.y,u.z),n.setXYZ(h+1,u.x,u.y,u.z),n.setXYZ(h+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)ut.fromBufferAttribute(e,t),ut.normalize(),e.setXYZ(t,ut.x,ut.y,ut.z)}toNonIndexed(){function e(o,l){const c=o.array,u=o.itemSize,d=o.normalized,h=new c.constructor(l.length*u);let f=0,g=0;for(let _=0,m=l.length;_<m;_++){o.isInterleavedBufferAttribute?f=l[_]*o.data.stride+o.offset:f=l[_]*u;for(let p=0;p<u;p++)h[g++]=c[f++]}return new Et(h,u,d)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new _t,n=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let u=0,d=c.length;u<d;u++){const h=c[u],f=e(h,n);l.push(f)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let d=0,h=c.length;d<h;d++){const f=c[d];u.push(f.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],d=s[c];for(let h=0,f=d.length;h<f;h++)u.push(d[h].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,u=a.length;c<u;c++){const d=a[c];this.addGroup(d.start,d.count,d.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const xo=new et,En=new Br,rr=new Hi,vo=new I,ei=new I,ti=new I,ni=new I,ms=new I,sr=new I,ar=new ue,or=new ue,lr=new ue,Mo=new I,So=new I,yo=new I,cr=new I,ur=new I;let bt=class extends yt{constructor(e=new _t,t=new Vi){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){sr.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=o[l],d=s[l];u!==0&&(ms.fromBufferAttribute(d,e),a?sr.addScaledVector(ms,u):sr.addScaledVector(ms.sub(t),u))}t.add(sr)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),rr.copy(n.boundingSphere),rr.applyMatrix4(s),En.copy(e.ray).recast(e.near),!(rr.containsPoint(En.origin)===!1&&(En.intersectSphere(rr,vo)===null||En.origin.distanceToSquared(vo)>(e.far-e.near)**2))&&(xo.copy(s).invert(),En.copy(e.ray).applyMatrix4(xo),!(n.boundingBox!==null&&En.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,En)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,d=s.attributes.normal,h=s.groups,f=s.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,_=h.length;g<_;g++){const m=h[g],p=a[m.materialIndex],E=Math.max(m.start,f.start),v=Math.min(o.count,Math.min(m.start+m.count,f.start+f.count));for(let b=E,R=v;b<R;b+=3){const T=o.getX(b),A=o.getX(b+1),P=o.getX(b+2);r=hr(this,p,e,n,c,u,d,T,A,P),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const g=Math.max(0,f.start),_=Math.min(o.count,f.start+f.count);for(let m=g,p=_;m<p;m+=3){const E=o.getX(m),v=o.getX(m+1),b=o.getX(m+2);r=hr(this,a,e,n,c,u,d,E,v,b),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let g=0,_=h.length;g<_;g++){const m=h[g],p=a[m.materialIndex],E=Math.max(m.start,f.start),v=Math.min(l.count,Math.min(m.start+m.count,f.start+f.count));for(let b=E,R=v;b<R;b+=3){const T=b,A=b+1,P=b+2;r=hr(this,p,e,n,c,u,d,T,A,P),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const g=Math.max(0,f.start),_=Math.min(l.count,f.start+f.count);for(let m=g,p=_;m<p;m+=3){const E=m,v=m+1,b=m+2;r=hr(this,a,e,n,c,u,d,E,v,b),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}}};function Hh(i,e,t,n,r,s,a,o){let l;if(e.side===St?l=n.intersectTriangle(a,s,r,!0,o):l=n.intersectTriangle(r,s,a,e.side===_n,o),l===null)return null;ur.copy(o),ur.applyMatrix4(i.matrixWorld);const c=t.ray.origin.distanceTo(ur);return c<t.near||c>t.far?null:{distance:c,point:ur.clone(),object:i}}function hr(i,e,t,n,r,s,a,o,l,c){i.getVertexPosition(o,ei),i.getVertexPosition(l,ti),i.getVertexPosition(c,ni);const u=Hh(i,e,t,n,ei,ti,ni,cr);if(u){r&&(ar.fromBufferAttribute(r,o),or.fromBufferAttribute(r,l),lr.fromBufferAttribute(r,c),u.uv=Ci.getInterpolation(cr,ei,ti,ni,ar,or,lr,new ue)),s&&(ar.fromBufferAttribute(s,o),or.fromBufferAttribute(s,l),lr.fromBufferAttribute(s,c),u.uv1=Ci.getInterpolation(cr,ei,ti,ni,ar,or,lr,new ue)),a&&(Mo.fromBufferAttribute(a,o),So.fromBufferAttribute(a,l),yo.fromBufferAttribute(a,c),u.normal=Ci.getInterpolation(cr,ei,ti,ni,Mo,So,yo,new I),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const d={a:o,b:l,c,normal:new I,materialIndex:0};Ci.getNormal(ei,ti,ni,d.normal),u.face=d}return u}class Gi extends _t{constructor(e=1,t=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],u=[],d=[];let h=0,f=0;g("z","y","x",-1,-1,n,t,e,a,s,0),g("z","y","x",1,-1,n,t,-e,a,s,1),g("x","z","y",1,1,e,n,t,r,a,2),g("x","z","y",1,-1,e,n,-t,r,a,3),g("x","y","z",1,-1,e,t,n,r,s,4),g("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new nt(c,3)),this.setAttribute("normal",new nt(u,3)),this.setAttribute("uv",new nt(d,2));function g(_,m,p,E,v,b,R,T,A,P,y){const M=b/A,F=R/P,L=b/2,C=R/2,U=T/2,H=A+1,Y=P+1;let J=0,z=0;const j=new I;for(let $=0;$<Y;$++){const N=$*F-C;for(let ee=0;ee<H;ee++){const me=ee*M-L;j[_]=me*E,j[m]=N*v,j[p]=U,c.push(j.x,j.y,j.z),j[_]=0,j[m]=0,j[p]=T>0?1:-1,u.push(j.x,j.y,j.z),d.push(ee/A),d.push(1-$/P),J+=1}}for(let $=0;$<P;$++)for(let N=0;N<A;N++){const ee=h+N+H*$,me=h+N+H*($+1),O=h+(N+1)+H*($+1),Q=h+(N+1)+H*$;l.push(ee,me,Q),l.push(me,O,Q),z+=6}o.addGroup(f,z,y),f+=z,h+=J}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Gi(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function _i(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone():Array.isArray(r)?e[t][n]=r.slice():e[t][n]=r}}return e}function vt(i){const e={};for(let t=0;t<i.length;t++){const n=_i(i[t]);for(const r in n)e[r]=n[r]}return e}function Vh(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function Jl(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:je.workingColorSpace}const Fr={clone:_i,merge:vt};var Gh=`void main() {
|
|
9
9
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
10
|
-
}`,
|
|
10
|
+
}`,Wh=`void main() {
|
|
11
11
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
12
|
-
}`;class ft extends vi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=
|
|
12
|
+
}`;class ft extends vi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Gh,this.fragmentShader=Wh,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=_i(e.uniforms),this.uniformsGroups=Vh(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Ql extends yt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new et,this.projectionMatrix=new et,this.projectionMatrixInverse=new et,this.coordinateSystem=Qt}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const un=new I,Eo=new ue,bo=new ue;class Rt extends Ql{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Oi*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(di*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Oi*2*Math.atan(Math.tan(di*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){un.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(un.x,un.y).multiplyScalar(-e/un.z),un.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(un.x,un.y).multiplyScalar(-e/un.z)}getViewSize(e,t){return this.getViewBounds(e,Eo,bo),t.subVectors(bo,Eo)}setViewOffset(e,t,n,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(di*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*n/c,r*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const ii=-90,ri=1;class Xh extends yt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Rt(ii,ri,e,t);r.layers=this.layers,this.add(r);const s=new Rt(ii,ri,e,t);s.layers=this.layers,this.add(s);const a=new Rt(ii,ri,e,t);a.layers=this.layers,this.add(a);const o=new Rt(ii,ri,e,t);o.layers=this.layers,this.add(o);const l=new Rt(ii,ri,e,t);l.layers=this.layers,this.add(l);const c=new Rt(ii,ri,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===Qt)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Pr)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,u]=this.children,d=e.getRenderTarget(),h=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;const _=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,s),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,o),e.setRenderTarget(n,3,r),e.render(t,l),e.setRenderTarget(n,4,r),e.render(t,c),n.texture.generateMipmaps=_,e.setRenderTarget(n,5,r),e.render(t,u),e.setRenderTarget(d,h,f),e.xr.enabled=g,n.texture.needsPMREMUpdate=!0}}class ec extends Tt{constructor(e,t,n,r,s,a,o,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:pi,super(e,t,n,r,s,a,o,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class qh extends Ht{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new ec(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:zt}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
|
|
13
13
|
|
|
14
14
|
varying vec3 vWorldDirection;
|
|
15
15
|
|
|
@@ -44,9 +44,9 @@ React keys must be passed directly to JSX without using spread:
|
|
|
44
44
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
45
45
|
|
|
46
46
|
}
|
|
47
|
-
`},r=new
|
|
47
|
+
`},r=new Gi(5,5,5),s=new ft({name:"CubemapFromEquirect",uniforms:_i(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:St,blending:en});s.uniforms.tEquirect.value=t;const a=new bt(r,s),o=t.minFilter;return t.minFilter===Ln&&(t.minFilter=zt),new Xh(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,r){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(s)}}const gs=new I,Yh=new I,$h=new Be;class hn{constructor(e=new I(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=gs.subVectors(n,t).cross(Yh.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(gs),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||$h.getNormalMatrix(e),r=this.coplanarPoint(gs).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const bn=new Hi,dr=new I;class tc{constructor(e=new hn,t=new hn,n=new hn,r=new hn,s=new hn,a=new hn){this.planes=[e,t,n,r,s,a]}set(e,t,n,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Qt){const n=this.planes,r=e.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],u=r[5],d=r[6],h=r[7],f=r[8],g=r[9],_=r[10],m=r[11],p=r[12],E=r[13],v=r[14],b=r[15];if(n[0].setComponents(l-s,h-c,m-f,b-p).normalize(),n[1].setComponents(l+s,h+c,m+f,b+p).normalize(),n[2].setComponents(l+a,h+u,m+g,b+E).normalize(),n[3].setComponents(l-a,h-u,m-g,b-E).normalize(),n[4].setComponents(l-o,h-d,m-_,b-v).normalize(),t===Qt)n[5].setComponents(l+o,h+d,m+_,b+v).normalize();else if(t===Pr)n[5].setComponents(o,d,_,v).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),bn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),bn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(bn)}intersectsSprite(e){return bn.center.set(0,0,0),bn.radius=.7071067811865476,bn.applyMatrix4(e.matrixWorld),this.intersectsSphere(bn)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(dr.x=r.normal.x>0?e.max.x:e.min.x,dr.y=r.normal.y>0?e.max.y:e.min.y,dr.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(dr)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function nc(){let i=null,e=!1,t=null,n=null;function r(s,a){t(s,a),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function jh(i){const e=new WeakMap;function t(o,l){const c=o.array,u=o.usage,d=c.byteLength,h=i.createBuffer();i.bindBuffer(l,h),i.bufferData(l,c,u),o.onUploadCallback();let f;if(c instanceof Float32Array)f=i.FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?f=i.HALF_FLOAT:f=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)f=i.SHORT;else if(c instanceof Uint32Array)f=i.UNSIGNED_INT;else if(c instanceof Int32Array)f=i.INT;else if(c instanceof Int8Array)f=i.BYTE;else if(c instanceof Uint8Array)f=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)f=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:h,type:f,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:d}}function n(o,l,c){const u=l.array,d=l._updateRange,h=l.updateRanges;if(i.bindBuffer(c,o),d.count===-1&&h.length===0&&i.bufferSubData(c,0,u),h.length!==0){for(let f=0,g=h.length;f<g;f++){const _=h[f];i.bufferSubData(c,_.start*u.BYTES_PER_ELEMENT,u,_.start,_.count)}l.clearUpdateRanges()}d.count!==-1&&(i.bufferSubData(c,d.offset*u.BYTES_PER_ELEMENT,u,d.offset,d.count),d.count=-1),l.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(i.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isGLBufferAttribute){const u=e.get(o);(!u||u.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}o.isInterleavedBufferAttribute&&(o=o.data);const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,o,l),c.version=o.version}}return{get:r,remove:s,update:a}}class zr extends _t{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(n),l=Math.floor(r),c=o+1,u=l+1,d=e/o,h=t/l,f=[],g=[],_=[],m=[];for(let p=0;p<u;p++){const E=p*h-a;for(let v=0;v<c;v++){const b=v*d-s;g.push(b,-E,0),_.push(0,0,1),m.push(v/o),m.push(1-p/l)}}for(let p=0;p<l;p++)for(let E=0;E<o;E++){const v=E+c*p,b=E+c*(p+1),R=E+1+c*(p+1),T=E+1+c*p;f.push(v,b,T),f.push(b,R,T)}this.setIndex(f),this.setAttribute("position",new nt(g,3)),this.setAttribute("normal",new nt(_,3)),this.setAttribute("uv",new nt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new zr(e.width,e.height,e.widthSegments,e.heightSegments)}}var Kh=`#ifdef USE_ALPHAHASH
|
|
48
48
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
49
|
-
#endif`,
|
|
49
|
+
#endif`,Zh=`#ifdef USE_ALPHAHASH
|
|
50
50
|
const float ALPHA_HASH_SCALE = 0.05;
|
|
51
51
|
float hash2D( vec2 value ) {
|
|
52
52
|
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
|
|
@@ -81,20 +81,20 @@ React keys must be passed directly to JSX without using spread:
|
|
|
81
81
|
: cases.z;
|
|
82
82
|
return clamp( threshold , 1.0e-6, 1.0 );
|
|
83
83
|
}
|
|
84
|
-
#endif`,
|
|
84
|
+
#endif`,Jh=`#ifdef USE_ALPHAMAP
|
|
85
85
|
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
|
|
86
|
-
#endif`,
|
|
86
|
+
#endif`,Qh=`#ifdef USE_ALPHAMAP
|
|
87
87
|
uniform sampler2D alphaMap;
|
|
88
|
-
#endif`,
|
|
88
|
+
#endif`,ed=`#ifdef USE_ALPHATEST
|
|
89
89
|
#ifdef ALPHA_TO_COVERAGE
|
|
90
90
|
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
|
|
91
91
|
if ( diffuseColor.a == 0.0 ) discard;
|
|
92
92
|
#else
|
|
93
93
|
if ( diffuseColor.a < alphaTest ) discard;
|
|
94
94
|
#endif
|
|
95
|
-
#endif`,
|
|
95
|
+
#endif`,td=`#ifdef USE_ALPHATEST
|
|
96
96
|
uniform float alphaTest;
|
|
97
|
-
#endif`,
|
|
97
|
+
#endif`,nd=`#ifdef USE_AOMAP
|
|
98
98
|
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
|
|
99
99
|
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
|
100
100
|
#if defined( USE_CLEARCOAT )
|
|
@@ -107,10 +107,10 @@ React keys must be passed directly to JSX without using spread:
|
|
|
107
107
|
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
|
|
108
108
|
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
|
|
109
109
|
#endif
|
|
110
|
-
#endif`,
|
|
110
|
+
#endif`,id=`#ifdef USE_AOMAP
|
|
111
111
|
uniform sampler2D aoMap;
|
|
112
112
|
uniform float aoMapIntensity;
|
|
113
|
-
#endif`,
|
|
113
|
+
#endif`,rd=`#ifdef USE_BATCHING
|
|
114
114
|
attribute float batchId;
|
|
115
115
|
uniform highp sampler2D batchingTexture;
|
|
116
116
|
mat4 getBatchingMatrix( const in float i ) {
|
|
@@ -124,15 +124,15 @@ React keys must be passed directly to JSX without using spread:
|
|
|
124
124
|
vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
|
|
125
125
|
return mat4( v1, v2, v3, v4 );
|
|
126
126
|
}
|
|
127
|
-
#endif`,
|
|
127
|
+
#endif`,sd=`#ifdef USE_BATCHING
|
|
128
128
|
mat4 batchingMatrix = getBatchingMatrix( batchId );
|
|
129
|
-
#endif`,
|
|
129
|
+
#endif`,ad=`vec3 transformed = vec3( position );
|
|
130
130
|
#ifdef USE_ALPHAHASH
|
|
131
131
|
vPosition = vec3( position );
|
|
132
|
-
#endif`,
|
|
132
|
+
#endif`,od=`vec3 objectNormal = vec3( normal );
|
|
133
133
|
#ifdef USE_TANGENT
|
|
134
134
|
vec3 objectTangent = vec3( tangent.xyz );
|
|
135
|
-
#endif`,
|
|
135
|
+
#endif`,ld=`float G_BlinnPhong_Implicit( ) {
|
|
136
136
|
return 0.25;
|
|
137
137
|
}
|
|
138
138
|
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
|
@@ -146,7 +146,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
146
146
|
float G = G_BlinnPhong_Implicit( );
|
|
147
147
|
float D = D_BlinnPhong( shininess, dotNH );
|
|
148
148
|
return F * ( G * D );
|
|
149
|
-
} // validated`,
|
|
149
|
+
} // validated`,cd=`#ifdef USE_IRIDESCENCE
|
|
150
150
|
const mat3 XYZ_TO_REC709 = mat3(
|
|
151
151
|
3.2404542, -0.9692660, 0.0556434,
|
|
152
152
|
-1.5371385, 1.8760108, -0.2040259,
|
|
@@ -209,7 +209,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
209
209
|
}
|
|
210
210
|
return max( I, vec3( 0.0 ) );
|
|
211
211
|
}
|
|
212
|
-
#endif`,
|
|
212
|
+
#endif`,ud=`#ifdef USE_BUMPMAP
|
|
213
213
|
uniform sampler2D bumpMap;
|
|
214
214
|
uniform float bumpScale;
|
|
215
215
|
vec2 dHdxy_fwd() {
|
|
@@ -230,7 +230,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
230
230
|
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
|
231
231
|
return normalize( abs( fDet ) * surf_norm - vGrad );
|
|
232
232
|
}
|
|
233
|
-
#endif`,
|
|
233
|
+
#endif`,hd=`#if NUM_CLIPPING_PLANES > 0
|
|
234
234
|
vec4 plane;
|
|
235
235
|
#ifdef ALPHA_TO_COVERAGE
|
|
236
236
|
float distanceToPlane, distanceGradient;
|
|
@@ -276,26 +276,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
276
276
|
if ( clipped ) discard;
|
|
277
277
|
#endif
|
|
278
278
|
#endif
|
|
279
|
-
#endif`,
|
|
279
|
+
#endif`,dd=`#if NUM_CLIPPING_PLANES > 0
|
|
280
280
|
varying vec3 vClipPosition;
|
|
281
281
|
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
|
282
|
-
#endif`,
|
|
282
|
+
#endif`,fd=`#if NUM_CLIPPING_PLANES > 0
|
|
283
283
|
varying vec3 vClipPosition;
|
|
284
|
-
#endif`,
|
|
284
|
+
#endif`,pd=`#if NUM_CLIPPING_PLANES > 0
|
|
285
285
|
vClipPosition = - mvPosition.xyz;
|
|
286
|
-
#endif`,
|
|
286
|
+
#endif`,md=`#if defined( USE_COLOR_ALPHA )
|
|
287
287
|
diffuseColor *= vColor;
|
|
288
288
|
#elif defined( USE_COLOR )
|
|
289
289
|
diffuseColor.rgb *= vColor;
|
|
290
|
-
#endif`,
|
|
290
|
+
#endif`,gd=`#if defined( USE_COLOR_ALPHA )
|
|
291
291
|
varying vec4 vColor;
|
|
292
292
|
#elif defined( USE_COLOR )
|
|
293
293
|
varying vec3 vColor;
|
|
294
|
-
#endif`,
|
|
294
|
+
#endif`,_d=`#if defined( USE_COLOR_ALPHA )
|
|
295
295
|
varying vec4 vColor;
|
|
296
296
|
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
|
|
297
297
|
varying vec3 vColor;
|
|
298
|
-
#endif`,
|
|
298
|
+
#endif`,xd=`#if defined( USE_COLOR_ALPHA )
|
|
299
299
|
vColor = vec4( 1.0 );
|
|
300
300
|
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
|
|
301
301
|
vColor = vec3( 1.0 );
|
|
@@ -305,7 +305,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
305
305
|
#endif
|
|
306
306
|
#ifdef USE_INSTANCING_COLOR
|
|
307
307
|
vColor.xyz *= instanceColor.xyz;
|
|
308
|
-
#endif`,
|
|
308
|
+
#endif`,vd=`#define PI 3.141592653589793
|
|
309
309
|
#define PI2 6.283185307179586
|
|
310
310
|
#define PI_HALF 1.5707963267948966
|
|
311
311
|
#define RECIPROCAL_PI 0.3183098861837907
|
|
@@ -383,7 +383,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
|
|
|
383
383
|
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
|
|
384
384
|
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
|
385
385
|
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
|
386
|
-
} // validated`,
|
|
386
|
+
} // validated`,Md=`#ifdef ENVMAP_TYPE_CUBE_UV
|
|
387
387
|
#define cubeUV_minMipLevel 4.0
|
|
388
388
|
#define cubeUV_minTileSize 16.0
|
|
389
389
|
float getFace( vec3 direction ) {
|
|
@@ -476,7 +476,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
|
|
|
476
476
|
return vec4( mix( color0, color1, mipF ), 1.0 );
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
|
-
#endif`,
|
|
479
|
+
#endif`,Sd=`vec3 transformedNormal = objectNormal;
|
|
480
480
|
#ifdef USE_TANGENT
|
|
481
481
|
vec3 transformedTangent = objectTangent;
|
|
482
482
|
#endif
|
|
@@ -505,18 +505,18 @@ transformedNormal = normalMatrix * transformedNormal;
|
|
|
505
505
|
#ifdef FLIP_SIDED
|
|
506
506
|
transformedTangent = - transformedTangent;
|
|
507
507
|
#endif
|
|
508
|
-
#endif`,
|
|
508
|
+
#endif`,yd=`#ifdef USE_DISPLACEMENTMAP
|
|
509
509
|
uniform sampler2D displacementMap;
|
|
510
510
|
uniform float displacementScale;
|
|
511
511
|
uniform float displacementBias;
|
|
512
|
-
#endif`,
|
|
512
|
+
#endif`,Ed=`#ifdef USE_DISPLACEMENTMAP
|
|
513
513
|
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
|
|
514
|
-
#endif`,
|
|
514
|
+
#endif`,bd=`#ifdef USE_EMISSIVEMAP
|
|
515
515
|
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
|
|
516
516
|
totalEmissiveRadiance *= emissiveColor.rgb;
|
|
517
|
-
#endif`,
|
|
517
|
+
#endif`,Td=`#ifdef USE_EMISSIVEMAP
|
|
518
518
|
uniform sampler2D emissiveMap;
|
|
519
|
-
#endif`,
|
|
519
|
+
#endif`,Dd="gl_FragColor = linearToOutputTexel( gl_FragColor );",Ad=`
|
|
520
520
|
const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
|
|
521
521
|
vec3( 0.8224621, 0.177538, 0.0 ),
|
|
522
522
|
vec3( 0.0331941, 0.9668058, 0.0 ),
|
|
@@ -544,7 +544,7 @@ vec4 LinearToLinear( in vec4 value ) {
|
|
|
544
544
|
}
|
|
545
545
|
vec4 LinearTosRGB( in vec4 value ) {
|
|
546
546
|
return sRGBTransferOETF( value );
|
|
547
|
-
}`,
|
|
547
|
+
}`,wd=`#ifdef USE_ENVMAP
|
|
548
548
|
#ifdef ENV_WORLDPOS
|
|
549
549
|
vec3 cameraToFrag;
|
|
550
550
|
if ( isOrthographic ) {
|
|
@@ -573,7 +573,7 @@ vec4 LinearTosRGB( in vec4 value ) {
|
|
|
573
573
|
#elif defined( ENVMAP_BLENDING_ADD )
|
|
574
574
|
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
|
575
575
|
#endif
|
|
576
|
-
#endif
|
|
576
|
+
#endif`,Cd=`#ifdef USE_ENVMAP
|
|
577
577
|
uniform float envMapIntensity;
|
|
578
578
|
uniform float flipEnvMap;
|
|
579
579
|
uniform mat3 envMapRotation;
|
|
@@ -583,7 +583,7 @@ vec4 LinearTosRGB( in vec4 value ) {
|
|
|
583
583
|
uniform sampler2D envMap;
|
|
584
584
|
#endif
|
|
585
585
|
|
|
586
|
-
#endif`,
|
|
586
|
+
#endif`,Rd=`#ifdef USE_ENVMAP
|
|
587
587
|
uniform float reflectivity;
|
|
588
588
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
589
589
|
#define ENV_WORLDPOS
|
|
@@ -594,7 +594,7 @@ vec4 LinearTosRGB( in vec4 value ) {
|
|
|
594
594
|
#else
|
|
595
595
|
varying vec3 vReflect;
|
|
596
596
|
#endif
|
|
597
|
-
#endif`,
|
|
597
|
+
#endif`,Pd=`#ifdef USE_ENVMAP
|
|
598
598
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
599
599
|
#define ENV_WORLDPOS
|
|
600
600
|
#endif
|
|
@@ -605,7 +605,7 @@ vec4 LinearTosRGB( in vec4 value ) {
|
|
|
605
605
|
varying vec3 vReflect;
|
|
606
606
|
uniform float refractionRatio;
|
|
607
607
|
#endif
|
|
608
|
-
#endif`,
|
|
608
|
+
#endif`,Ld=`#ifdef USE_ENVMAP
|
|
609
609
|
#ifdef ENV_WORLDPOS
|
|
610
610
|
vWorldPosition = worldPosition.xyz;
|
|
611
611
|
#else
|
|
@@ -622,18 +622,18 @@ vec4 LinearTosRGB( in vec4 value ) {
|
|
|
622
622
|
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
|
|
623
623
|
#endif
|
|
624
624
|
#endif
|
|
625
|
-
#endif`,
|
|
625
|
+
#endif`,Fd=`#ifdef USE_FOG
|
|
626
626
|
vFogDepth = - mvPosition.z;
|
|
627
|
-
#endif`,
|
|
627
|
+
#endif`,Id=`#ifdef USE_FOG
|
|
628
628
|
varying float vFogDepth;
|
|
629
|
-
#endif`,
|
|
629
|
+
#endif`,Ud=`#ifdef USE_FOG
|
|
630
630
|
#ifdef FOG_EXP2
|
|
631
631
|
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
|
|
632
632
|
#else
|
|
633
633
|
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
|
|
634
634
|
#endif
|
|
635
635
|
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
|
|
636
|
-
#endif`,
|
|
636
|
+
#endif`,Nd=`#ifdef USE_FOG
|
|
637
637
|
uniform vec3 fogColor;
|
|
638
638
|
varying float vFogDepth;
|
|
639
639
|
#ifdef FOG_EXP2
|
|
@@ -642,7 +642,7 @@ vec4 LinearTosRGB( in vec4 value ) {
|
|
|
642
642
|
uniform float fogNear;
|
|
643
643
|
uniform float fogFar;
|
|
644
644
|
#endif
|
|
645
|
-
#endif`,
|
|
645
|
+
#endif`,Od=`#ifdef USE_GRADIENTMAP
|
|
646
646
|
uniform sampler2D gradientMap;
|
|
647
647
|
#endif
|
|
648
648
|
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
@@ -654,16 +654,16 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
|
654
654
|
vec2 fw = fwidth( coord ) * 0.5;
|
|
655
655
|
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
|
|
656
656
|
#endif
|
|
657
|
-
}`,
|
|
657
|
+
}`,Bd=`#ifdef USE_LIGHTMAP
|
|
658
658
|
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
|
659
659
|
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
|
660
660
|
reflectedLight.indirectDiffuse += lightMapIrradiance;
|
|
661
|
-
#endif`,
|
|
661
|
+
#endif`,zd=`#ifdef USE_LIGHTMAP
|
|
662
662
|
uniform sampler2D lightMap;
|
|
663
663
|
uniform float lightMapIntensity;
|
|
664
|
-
#endif`,
|
|
664
|
+
#endif`,kd=`LambertMaterial material;
|
|
665
665
|
material.diffuseColor = diffuseColor.rgb;
|
|
666
|
-
material.specularStrength = specularStrength;`,
|
|
666
|
+
material.specularStrength = specularStrength;`,Hd=`varying vec3 vViewPosition;
|
|
667
667
|
struct LambertMaterial {
|
|
668
668
|
vec3 diffuseColor;
|
|
669
669
|
float specularStrength;
|
|
@@ -677,7 +677,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
|
|
|
677
677
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
678
678
|
}
|
|
679
679
|
#define RE_Direct RE_Direct_Lambert
|
|
680
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,
|
|
680
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Vd=`uniform bool receiveShadow;
|
|
681
681
|
uniform vec3 ambientLightColor;
|
|
682
682
|
#if defined( USE_LIGHT_PROBES )
|
|
683
683
|
uniform vec3 lightProbe[ 9 ];
|
|
@@ -800,7 +800,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
|
|
|
800
800
|
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
|
|
801
801
|
return irradiance;
|
|
802
802
|
}
|
|
803
|
-
#endif`,
|
|
803
|
+
#endif`,Gd=`#ifdef USE_ENVMAP
|
|
804
804
|
vec3 getIBLIrradiance( const in vec3 normal ) {
|
|
805
805
|
#ifdef ENVMAP_TYPE_CUBE_UV
|
|
806
806
|
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
@@ -833,8 +833,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
|
|
|
833
833
|
#endif
|
|
834
834
|
}
|
|
835
835
|
#endif
|
|
836
|
-
#endif`,
|
|
837
|
-
material.diffuseColor = diffuseColor.rgb;`,
|
|
836
|
+
#endif`,Wd=`ToonMaterial material;
|
|
837
|
+
material.diffuseColor = diffuseColor.rgb;`,Xd=`varying vec3 vViewPosition;
|
|
838
838
|
struct ToonMaterial {
|
|
839
839
|
vec3 diffuseColor;
|
|
840
840
|
};
|
|
@@ -846,11 +846,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
|
|
|
846
846
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
847
847
|
}
|
|
848
848
|
#define RE_Direct RE_Direct_Toon
|
|
849
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,
|
|
849
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,qd=`BlinnPhongMaterial material;
|
|
850
850
|
material.diffuseColor = diffuseColor.rgb;
|
|
851
851
|
material.specularColor = specular;
|
|
852
852
|
material.specularShininess = shininess;
|
|
853
|
-
material.specularStrength = specularStrength;`,
|
|
853
|
+
material.specularStrength = specularStrength;`,Yd=`varying vec3 vViewPosition;
|
|
854
854
|
struct BlinnPhongMaterial {
|
|
855
855
|
vec3 diffuseColor;
|
|
856
856
|
vec3 specularColor;
|
|
@@ -867,7 +867,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
|
|
|
867
867
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
868
868
|
}
|
|
869
869
|
#define RE_Direct RE_Direct_BlinnPhong
|
|
870
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong
|
|
870
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,$d=`PhysicalMaterial material;
|
|
871
871
|
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
|
|
872
872
|
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
|
|
873
873
|
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
|
|
@@ -950,7 +950,7 @@ material.roughness = min( material.roughness, 1.0 );
|
|
|
950
950
|
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
|
|
951
951
|
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
|
|
952
952
|
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
|
|
953
|
-
#endif`,
|
|
953
|
+
#endif`,jd=`struct PhysicalMaterial {
|
|
954
954
|
vec3 diffuseColor;
|
|
955
955
|
float roughness;
|
|
956
956
|
vec3 specularColor;
|
|
@@ -1250,7 +1250,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
|
|
|
1250
1250
|
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
|
|
1251
1251
|
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
|
|
1252
1252
|
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
|
|
1253
|
-
}`,
|
|
1253
|
+
}`,Kd=`
|
|
1254
1254
|
vec3 geometryPosition = - vViewPosition;
|
|
1255
1255
|
vec3 geometryNormal = normal;
|
|
1256
1256
|
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
|
@@ -1365,7 +1365,7 @@ IncidentLight directLight;
|
|
|
1365
1365
|
#if defined( RE_IndirectSpecular )
|
|
1366
1366
|
vec3 radiance = vec3( 0.0 );
|
|
1367
1367
|
vec3 clearcoatRadiance = vec3( 0.0 );
|
|
1368
|
-
#endif`,
|
|
1368
|
+
#endif`,Zd=`#if defined( RE_IndirectDiffuse )
|
|
1369
1369
|
#ifdef USE_LIGHTMAP
|
|
1370
1370
|
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
|
1371
1371
|
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
|
@@ -1384,33 +1384,33 @@ IncidentLight directLight;
|
|
|
1384
1384
|
#ifdef USE_CLEARCOAT
|
|
1385
1385
|
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
|
|
1386
1386
|
#endif
|
|
1387
|
-
#endif`,
|
|
1387
|
+
#endif`,Jd=`#if defined( RE_IndirectDiffuse )
|
|
1388
1388
|
RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1389
1389
|
#endif
|
|
1390
1390
|
#if defined( RE_IndirectSpecular )
|
|
1391
1391
|
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1392
|
-
#endif`,
|
|
1392
|
+
#endif`,Qd=`#if defined( USE_LOGDEPTHBUF )
|
|
1393
1393
|
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
|
1394
|
-
#endif`,
|
|
1394
|
+
#endif`,ef=`#if defined( USE_LOGDEPTHBUF )
|
|
1395
1395
|
uniform float logDepthBufFC;
|
|
1396
1396
|
varying float vFragDepth;
|
|
1397
1397
|
varying float vIsPerspective;
|
|
1398
|
-
#endif`,
|
|
1398
|
+
#endif`,tf=`#ifdef USE_LOGDEPTHBUF
|
|
1399
1399
|
varying float vFragDepth;
|
|
1400
1400
|
varying float vIsPerspective;
|
|
1401
|
-
#endif`,
|
|
1401
|
+
#endif`,nf=`#ifdef USE_LOGDEPTHBUF
|
|
1402
1402
|
vFragDepth = 1.0 + gl_Position.w;
|
|
1403
1403
|
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
|
1404
|
-
#endif`,
|
|
1404
|
+
#endif`,rf=`#ifdef USE_MAP
|
|
1405
1405
|
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
|
|
1406
1406
|
#ifdef DECODE_VIDEO_TEXTURE
|
|
1407
1407
|
sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
|
|
1408
1408
|
|
|
1409
1409
|
#endif
|
|
1410
1410
|
diffuseColor *= sampledDiffuseColor;
|
|
1411
|
-
#endif`,
|
|
1411
|
+
#endif`,sf=`#ifdef USE_MAP
|
|
1412
1412
|
uniform sampler2D map;
|
|
1413
|
-
#endif`,
|
|
1413
|
+
#endif`,af=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
1414
1414
|
#if defined( USE_POINTS_UV )
|
|
1415
1415
|
vec2 uv = vUv;
|
|
1416
1416
|
#else
|
|
@@ -1422,7 +1422,7 @@ IncidentLight directLight;
|
|
|
1422
1422
|
#endif
|
|
1423
1423
|
#ifdef USE_ALPHAMAP
|
|
1424
1424
|
diffuseColor.a *= texture2D( alphaMap, uv ).g;
|
|
1425
|
-
#endif`,
|
|
1425
|
+
#endif`,of=`#if defined( USE_POINTS_UV )
|
|
1426
1426
|
varying vec2 vUv;
|
|
1427
1427
|
#else
|
|
1428
1428
|
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
@@ -1434,19 +1434,19 @@ IncidentLight directLight;
|
|
|
1434
1434
|
#endif
|
|
1435
1435
|
#ifdef USE_ALPHAMAP
|
|
1436
1436
|
uniform sampler2D alphaMap;
|
|
1437
|
-
#endif`,
|
|
1437
|
+
#endif`,lf=`float metalnessFactor = metalness;
|
|
1438
1438
|
#ifdef USE_METALNESSMAP
|
|
1439
1439
|
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
|
|
1440
1440
|
metalnessFactor *= texelMetalness.b;
|
|
1441
|
-
#endif`,
|
|
1441
|
+
#endif`,cf=`#ifdef USE_METALNESSMAP
|
|
1442
1442
|
uniform sampler2D metalnessMap;
|
|
1443
|
-
#endif`,
|
|
1443
|
+
#endif`,uf=`#ifdef USE_INSTANCING_MORPH
|
|
1444
1444
|
float morphTargetInfluences[MORPHTARGETS_COUNT];
|
|
1445
1445
|
float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
|
|
1446
1446
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1447
1447
|
morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
|
|
1448
1448
|
}
|
|
1449
|
-
#endif`,
|
|
1449
|
+
#endif`,hf=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
|
|
1450
1450
|
vColor *= morphTargetBaseInfluence;
|
|
1451
1451
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1452
1452
|
#if defined( USE_COLOR_ALPHA )
|
|
@@ -1455,7 +1455,7 @@ IncidentLight directLight;
|
|
|
1455
1455
|
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
|
|
1456
1456
|
#endif
|
|
1457
1457
|
}
|
|
1458
|
-
#endif`,
|
|
1458
|
+
#endif`,df=`#ifdef USE_MORPHNORMALS
|
|
1459
1459
|
objectNormal *= morphTargetBaseInfluence;
|
|
1460
1460
|
#ifdef MORPHTARGETS_TEXTURE
|
|
1461
1461
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
@@ -1467,7 +1467,7 @@ IncidentLight directLight;
|
|
|
1467
1467
|
objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
|
|
1468
1468
|
objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
|
|
1469
1469
|
#endif
|
|
1470
|
-
#endif`,
|
|
1470
|
+
#endif`,ff=`#ifdef USE_MORPHTARGETS
|
|
1471
1471
|
#ifndef USE_INSTANCING_MORPH
|
|
1472
1472
|
uniform float morphTargetBaseInfluence;
|
|
1473
1473
|
#endif
|
|
@@ -1491,7 +1491,7 @@ IncidentLight directLight;
|
|
|
1491
1491
|
uniform float morphTargetInfluences[ 4 ];
|
|
1492
1492
|
#endif
|
|
1493
1493
|
#endif
|
|
1494
|
-
#endif`,
|
|
1494
|
+
#endif`,pf=`#ifdef USE_MORPHTARGETS
|
|
1495
1495
|
transformed *= morphTargetBaseInfluence;
|
|
1496
1496
|
#ifdef MORPHTARGETS_TEXTURE
|
|
1497
1497
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
@@ -1509,7 +1509,7 @@ IncidentLight directLight;
|
|
|
1509
1509
|
transformed += morphTarget7 * morphTargetInfluences[ 7 ];
|
|
1510
1510
|
#endif
|
|
1511
1511
|
#endif
|
|
1512
|
-
#endif`,
|
|
1512
|
+
#endif`,mf=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
|
|
1513
1513
|
#ifdef FLAT_SHADED
|
|
1514
1514
|
vec3 fdx = dFdx( vViewPosition );
|
|
1515
1515
|
vec3 fdy = dFdy( vViewPosition );
|
|
@@ -1550,7 +1550,7 @@ IncidentLight directLight;
|
|
|
1550
1550
|
tbn2[1] *= faceDirection;
|
|
1551
1551
|
#endif
|
|
1552
1552
|
#endif
|
|
1553
|
-
vec3 nonPerturbedNormal = normal;`,
|
|
1553
|
+
vec3 nonPerturbedNormal = normal;`,gf=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
1554
1554
|
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1555
1555
|
#ifdef FLIP_SIDED
|
|
1556
1556
|
normal = - normal;
|
|
@@ -1565,25 +1565,25 @@ vec3 nonPerturbedNormal = normal;`,Nd=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1565
1565
|
normal = normalize( tbn * mapN );
|
|
1566
1566
|
#elif defined( USE_BUMPMAP )
|
|
1567
1567
|
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
|
|
1568
|
-
#endif`,
|
|
1568
|
+
#endif`,_f=`#ifndef FLAT_SHADED
|
|
1569
1569
|
varying vec3 vNormal;
|
|
1570
1570
|
#ifdef USE_TANGENT
|
|
1571
1571
|
varying vec3 vTangent;
|
|
1572
1572
|
varying vec3 vBitangent;
|
|
1573
1573
|
#endif
|
|
1574
|
-
#endif`,
|
|
1574
|
+
#endif`,xf=`#ifndef FLAT_SHADED
|
|
1575
1575
|
varying vec3 vNormal;
|
|
1576
1576
|
#ifdef USE_TANGENT
|
|
1577
1577
|
varying vec3 vTangent;
|
|
1578
1578
|
varying vec3 vBitangent;
|
|
1579
1579
|
#endif
|
|
1580
|
-
#endif`,
|
|
1580
|
+
#endif`,vf=`#ifndef FLAT_SHADED
|
|
1581
1581
|
vNormal = normalize( transformedNormal );
|
|
1582
1582
|
#ifdef USE_TANGENT
|
|
1583
1583
|
vTangent = normalize( transformedTangent );
|
|
1584
1584
|
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
|
1585
1585
|
#endif
|
|
1586
|
-
#endif`,
|
|
1586
|
+
#endif`,Mf=`#ifdef USE_NORMALMAP
|
|
1587
1587
|
uniform sampler2D normalMap;
|
|
1588
1588
|
uniform vec2 normalScale;
|
|
1589
1589
|
#endif
|
|
@@ -1605,13 +1605,13 @@ vec3 nonPerturbedNormal = normal;`,Nd=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1605
1605
|
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
|
|
1606
1606
|
return mat3( T * scale, B * scale, N );
|
|
1607
1607
|
}
|
|
1608
|
-
#endif`,
|
|
1608
|
+
#endif`,Sf=`#ifdef USE_CLEARCOAT
|
|
1609
1609
|
vec3 clearcoatNormal = nonPerturbedNormal;
|
|
1610
|
-
#endif`,
|
|
1610
|
+
#endif`,yf=`#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1611
1611
|
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1612
1612
|
clearcoatMapN.xy *= clearcoatNormalScale;
|
|
1613
1613
|
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
|
|
1614
|
-
#endif`,
|
|
1614
|
+
#endif`,Ef=`#ifdef USE_CLEARCOATMAP
|
|
1615
1615
|
uniform sampler2D clearcoatMap;
|
|
1616
1616
|
#endif
|
|
1617
1617
|
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
@@ -1620,18 +1620,18 @@ vec3 nonPerturbedNormal = normal;`,Nd=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1620
1620
|
#endif
|
|
1621
1621
|
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
1622
1622
|
uniform sampler2D clearcoatRoughnessMap;
|
|
1623
|
-
#endif`,
|
|
1623
|
+
#endif`,bf=`#ifdef USE_IRIDESCENCEMAP
|
|
1624
1624
|
uniform sampler2D iridescenceMap;
|
|
1625
1625
|
#endif
|
|
1626
1626
|
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
1627
1627
|
uniform sampler2D iridescenceThicknessMap;
|
|
1628
|
-
#endif`,
|
|
1628
|
+
#endif`,Tf=`#ifdef OPAQUE
|
|
1629
1629
|
diffuseColor.a = 1.0;
|
|
1630
1630
|
#endif
|
|
1631
1631
|
#ifdef USE_TRANSMISSION
|
|
1632
1632
|
diffuseColor.a *= material.transmissionAlpha;
|
|
1633
1633
|
#endif
|
|
1634
|
-
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,
|
|
1634
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Df=`vec3 packNormalToRGB( const in vec3 normal ) {
|
|
1635
1635
|
return normalize( normal ) * 0.5 + 0.5;
|
|
1636
1636
|
}
|
|
1637
1637
|
vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
|
@@ -1672,9 +1672,9 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const
|
|
|
1672
1672
|
}
|
|
1673
1673
|
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
|
|
1674
1674
|
return ( near * far ) / ( ( far - near ) * depth - far );
|
|
1675
|
-
}`,
|
|
1675
|
+
}`,Af=`#ifdef PREMULTIPLIED_ALPHA
|
|
1676
1676
|
gl_FragColor.rgb *= gl_FragColor.a;
|
|
1677
|
-
#endif`,
|
|
1677
|
+
#endif`,wf=`vec4 mvPosition = vec4( transformed, 1.0 );
|
|
1678
1678
|
#ifdef USE_BATCHING
|
|
1679
1679
|
mvPosition = batchingMatrix * mvPosition;
|
|
1680
1680
|
#endif
|
|
@@ -1682,22 +1682,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
|
|
|
1682
1682
|
mvPosition = instanceMatrix * mvPosition;
|
|
1683
1683
|
#endif
|
|
1684
1684
|
mvPosition = modelViewMatrix * mvPosition;
|
|
1685
|
-
gl_Position = projectionMatrix * mvPosition;`,
|
|
1685
|
+
gl_Position = projectionMatrix * mvPosition;`,Cf=`#ifdef DITHERING
|
|
1686
1686
|
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
|
1687
|
-
#endif
|
|
1687
|
+
#endif`,Rf=`#ifdef DITHERING
|
|
1688
1688
|
vec3 dithering( vec3 color ) {
|
|
1689
1689
|
float grid_position = rand( gl_FragCoord.xy );
|
|
1690
1690
|
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
|
|
1691
1691
|
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
|
|
1692
1692
|
return color + dither_shift_RGB;
|
|
1693
1693
|
}
|
|
1694
|
-
#endif`,
|
|
1694
|
+
#endif`,Pf=`float roughnessFactor = roughness;
|
|
1695
1695
|
#ifdef USE_ROUGHNESSMAP
|
|
1696
1696
|
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
|
|
1697
1697
|
roughnessFactor *= texelRoughness.g;
|
|
1698
|
-
#endif`,
|
|
1698
|
+
#endif`,Lf=`#ifdef USE_ROUGHNESSMAP
|
|
1699
1699
|
uniform sampler2D roughnessMap;
|
|
1700
|
-
#endif`,
|
|
1700
|
+
#endif`,Ff=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
1701
1701
|
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
1702
1702
|
#endif
|
|
1703
1703
|
#if NUM_SPOT_LIGHT_MAPS > 0
|
|
@@ -1880,7 +1880,7 @@ gl_Position = projectionMatrix * mvPosition;`,qd=`#ifdef DITHERING
|
|
|
1880
1880
|
}
|
|
1881
1881
|
return shadow;
|
|
1882
1882
|
}
|
|
1883
|
-
#endif`,
|
|
1883
|
+
#endif`,If=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
1884
1884
|
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
|
|
1885
1885
|
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
1886
1886
|
#endif
|
|
@@ -1918,7 +1918,7 @@ gl_Position = projectionMatrix * mvPosition;`,qd=`#ifdef DITHERING
|
|
|
1918
1918
|
};
|
|
1919
1919
|
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1920
1920
|
#endif
|
|
1921
|
-
#endif`,
|
|
1921
|
+
#endif`,Uf=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
|
|
1922
1922
|
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
|
1923
1923
|
vec4 shadowWorldPosition;
|
|
1924
1924
|
#endif
|
|
@@ -1950,7 +1950,7 @@ gl_Position = projectionMatrix * mvPosition;`,qd=`#ifdef DITHERING
|
|
|
1950
1950
|
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
|
|
1951
1951
|
}
|
|
1952
1952
|
#pragma unroll_loop_end
|
|
1953
|
-
#endif`,
|
|
1953
|
+
#endif`,Nf=`float getShadowMask() {
|
|
1954
1954
|
float shadow = 1.0;
|
|
1955
1955
|
#ifdef USE_SHADOWMAP
|
|
1956
1956
|
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
@@ -1982,12 +1982,12 @@ gl_Position = projectionMatrix * mvPosition;`,qd=`#ifdef DITHERING
|
|
|
1982
1982
|
#endif
|
|
1983
1983
|
#endif
|
|
1984
1984
|
return shadow;
|
|
1985
|
-
}`,
|
|
1985
|
+
}`,Of=`#ifdef USE_SKINNING
|
|
1986
1986
|
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
|
1987
1987
|
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
|
1988
1988
|
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
|
1989
1989
|
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
|
1990
|
-
#endif`,
|
|
1990
|
+
#endif`,Bf=`#ifdef USE_SKINNING
|
|
1991
1991
|
uniform mat4 bindMatrix;
|
|
1992
1992
|
uniform mat4 bindMatrixInverse;
|
|
1993
1993
|
uniform highp sampler2D boneTexture;
|
|
@@ -2002,7 +2002,7 @@ gl_Position = projectionMatrix * mvPosition;`,qd=`#ifdef DITHERING
|
|
|
2002
2002
|
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
|
|
2003
2003
|
return mat4( v1, v2, v3, v4 );
|
|
2004
2004
|
}
|
|
2005
|
-
#endif`,
|
|
2005
|
+
#endif`,zf=`#ifdef USE_SKINNING
|
|
2006
2006
|
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
|
|
2007
2007
|
vec4 skinned = vec4( 0.0 );
|
|
2008
2008
|
skinned += boneMatX * skinVertex * skinWeight.x;
|
|
@@ -2010,7 +2010,7 @@ gl_Position = projectionMatrix * mvPosition;`,qd=`#ifdef DITHERING
|
|
|
2010
2010
|
skinned += boneMatZ * skinVertex * skinWeight.z;
|
|
2011
2011
|
skinned += boneMatW * skinVertex * skinWeight.w;
|
|
2012
2012
|
transformed = ( bindMatrixInverse * skinned ).xyz;
|
|
2013
|
-
#endif`,
|
|
2013
|
+
#endif`,kf=`#ifdef USE_SKINNING
|
|
2014
2014
|
mat4 skinMatrix = mat4( 0.0 );
|
|
2015
2015
|
skinMatrix += skinWeight.x * boneMatX;
|
|
2016
2016
|
skinMatrix += skinWeight.y * boneMatY;
|
|
@@ -2021,17 +2021,17 @@ gl_Position = projectionMatrix * mvPosition;`,qd=`#ifdef DITHERING
|
|
|
2021
2021
|
#ifdef USE_TANGENT
|
|
2022
2022
|
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
2023
2023
|
#endif
|
|
2024
|
-
#endif`,
|
|
2024
|
+
#endif`,Hf=`float specularStrength;
|
|
2025
2025
|
#ifdef USE_SPECULARMAP
|
|
2026
2026
|
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
|
|
2027
2027
|
specularStrength = texelSpecular.r;
|
|
2028
2028
|
#else
|
|
2029
2029
|
specularStrength = 1.0;
|
|
2030
|
-
#endif`,
|
|
2030
|
+
#endif`,Vf=`#ifdef USE_SPECULARMAP
|
|
2031
2031
|
uniform sampler2D specularMap;
|
|
2032
|
-
#endif`,
|
|
2032
|
+
#endif`,Gf=`#if defined( TONE_MAPPING )
|
|
2033
2033
|
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
|
2034
|
-
#endif`,
|
|
2034
|
+
#endif`,Wf=`#ifndef saturate
|
|
2035
2035
|
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|
2036
2036
|
#endif
|
|
2037
2037
|
uniform float toneMappingExposure;
|
|
@@ -2128,7 +2128,7 @@ vec3 NeutralToneMapping( vec3 color ) {
|
|
|
2128
2128
|
float g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);
|
|
2129
2129
|
return mix(color, newPeak * vec3(1, 1, 1), g);
|
|
2130
2130
|
}
|
|
2131
|
-
vec3 CustomToneMapping( vec3 color ) { return color; }`,
|
|
2131
|
+
vec3 CustomToneMapping( vec3 color ) { return color; }`,Xf=`#ifdef USE_TRANSMISSION
|
|
2132
2132
|
material.transmission = transmission;
|
|
2133
2133
|
material.transmissionAlpha = 1.0;
|
|
2134
2134
|
material.thickness = thickness;
|
|
@@ -2149,7 +2149,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,hf=`#ifdef USE_TRANSMISS
|
|
|
2149
2149
|
material.attenuationColor, material.attenuationDistance );
|
|
2150
2150
|
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
|
|
2151
2151
|
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
|
|
2152
|
-
#endif`,
|
|
2152
|
+
#endif`,qf=`#ifdef USE_TRANSMISSION
|
|
2153
2153
|
uniform float transmission;
|
|
2154
2154
|
uniform float thickness;
|
|
2155
2155
|
uniform float attenuationDistance;
|
|
@@ -2255,7 +2255,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,hf=`#ifdef USE_TRANSMISS
|
|
|
2255
2255
|
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
|
|
2256
2256
|
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
|
|
2257
2257
|
}
|
|
2258
|
-
#endif`,
|
|
2258
|
+
#endif`,Yf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2259
2259
|
varying vec2 vUv;
|
|
2260
2260
|
#endif
|
|
2261
2261
|
#ifdef USE_MAP
|
|
@@ -2325,7 +2325,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,hf=`#ifdef USE_TRANSMISS
|
|
|
2325
2325
|
#ifdef USE_THICKNESSMAP
|
|
2326
2326
|
uniform mat3 thicknessMapTransform;
|
|
2327
2327
|
varying vec2 vThicknessMapUv;
|
|
2328
|
-
#endif
|
|
2328
|
+
#endif`,$f=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2329
2329
|
varying vec2 vUv;
|
|
2330
2330
|
#endif
|
|
2331
2331
|
#ifdef USE_MAP
|
|
@@ -2419,7 +2419,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,hf=`#ifdef USE_TRANSMISS
|
|
|
2419
2419
|
#ifdef USE_THICKNESSMAP
|
|
2420
2420
|
uniform mat3 thicknessMapTransform;
|
|
2421
2421
|
varying vec2 vThicknessMapUv;
|
|
2422
|
-
#endif`,
|
|
2422
|
+
#endif`,jf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2423
2423
|
vUv = vec3( uv, 1 ).xy;
|
|
2424
2424
|
#endif
|
|
2425
2425
|
#ifdef USE_MAP
|
|
@@ -2490,7 +2490,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,hf=`#ifdef USE_TRANSMISS
|
|
|
2490
2490
|
#endif
|
|
2491
2491
|
#ifdef USE_THICKNESSMAP
|
|
2492
2492
|
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
|
|
2493
|
-
#endif`,
|
|
2493
|
+
#endif`,Kf=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
|
|
2494
2494
|
vec4 worldPosition = vec4( transformed, 1.0 );
|
|
2495
2495
|
#ifdef USE_BATCHING
|
|
2496
2496
|
worldPosition = batchingMatrix * worldPosition;
|
|
@@ -2499,12 +2499,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,hf=`#ifdef USE_TRANSMISS
|
|
|
2499
2499
|
worldPosition = instanceMatrix * worldPosition;
|
|
2500
2500
|
#endif
|
|
2501
2501
|
worldPosition = modelMatrix * worldPosition;
|
|
2502
|
-
#endif`;const
|
|
2502
|
+
#endif`;const Zf=`varying vec2 vUv;
|
|
2503
2503
|
uniform mat3 uvTransform;
|
|
2504
2504
|
void main() {
|
|
2505
2505
|
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
2506
2506
|
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
|
2507
|
-
}`,
|
|
2507
|
+
}`,Jf=`uniform sampler2D t2D;
|
|
2508
2508
|
uniform float backgroundIntensity;
|
|
2509
2509
|
varying vec2 vUv;
|
|
2510
2510
|
void main() {
|
|
@@ -2516,14 +2516,14 @@ void main() {
|
|
|
2516
2516
|
gl_FragColor = texColor;
|
|
2517
2517
|
#include <tonemapping_fragment>
|
|
2518
2518
|
#include <colorspace_fragment>
|
|
2519
|
-
}`,
|
|
2519
|
+
}`,Qf=`varying vec3 vWorldDirection;
|
|
2520
2520
|
#include <common>
|
|
2521
2521
|
void main() {
|
|
2522
2522
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2523
2523
|
#include <begin_vertex>
|
|
2524
2524
|
#include <project_vertex>
|
|
2525
2525
|
gl_Position.z = gl_Position.w;
|
|
2526
|
-
}`,
|
|
2526
|
+
}`,ep=`#ifdef ENVMAP_TYPE_CUBE
|
|
2527
2527
|
uniform samplerCube envMap;
|
|
2528
2528
|
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|
2529
2529
|
uniform sampler2D envMap;
|
|
@@ -2546,14 +2546,14 @@ void main() {
|
|
|
2546
2546
|
gl_FragColor = texColor;
|
|
2547
2547
|
#include <tonemapping_fragment>
|
|
2548
2548
|
#include <colorspace_fragment>
|
|
2549
|
-
}`,
|
|
2549
|
+
}`,tp=`varying vec3 vWorldDirection;
|
|
2550
2550
|
#include <common>
|
|
2551
2551
|
void main() {
|
|
2552
2552
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2553
2553
|
#include <begin_vertex>
|
|
2554
2554
|
#include <project_vertex>
|
|
2555
2555
|
gl_Position.z = gl_Position.w;
|
|
2556
|
-
}`,
|
|
2556
|
+
}`,np=`uniform samplerCube tCube;
|
|
2557
2557
|
uniform float tFlip;
|
|
2558
2558
|
uniform float opacity;
|
|
2559
2559
|
varying vec3 vWorldDirection;
|
|
@@ -2563,7 +2563,7 @@ void main() {
|
|
|
2563
2563
|
gl_FragColor.a *= opacity;
|
|
2564
2564
|
#include <tonemapping_fragment>
|
|
2565
2565
|
#include <colorspace_fragment>
|
|
2566
|
-
}`,
|
|
2566
|
+
}`,ip=`#include <common>
|
|
2567
2567
|
#include <batching_pars_vertex>
|
|
2568
2568
|
#include <uv_pars_vertex>
|
|
2569
2569
|
#include <displacementmap_pars_vertex>
|
|
@@ -2590,7 +2590,7 @@ void main() {
|
|
|
2590
2590
|
#include <logdepthbuf_vertex>
|
|
2591
2591
|
#include <clipping_planes_vertex>
|
|
2592
2592
|
vHighPrecisionZW = gl_Position.zw;
|
|
2593
|
-
}`,
|
|
2593
|
+
}`,rp=`#if DEPTH_PACKING == 3200
|
|
2594
2594
|
uniform float opacity;
|
|
2595
2595
|
#endif
|
|
2596
2596
|
#include <common>
|
|
@@ -2620,7 +2620,7 @@ void main() {
|
|
|
2620
2620
|
#elif DEPTH_PACKING == 3201
|
|
2621
2621
|
gl_FragColor = packDepthToRGBA( fragCoordZ );
|
|
2622
2622
|
#endif
|
|
2623
|
-
}`,
|
|
2623
|
+
}`,sp=`#define DISTANCE
|
|
2624
2624
|
varying vec3 vWorldPosition;
|
|
2625
2625
|
#include <common>
|
|
2626
2626
|
#include <batching_pars_vertex>
|
|
@@ -2647,7 +2647,7 @@ void main() {
|
|
|
2647
2647
|
#include <worldpos_vertex>
|
|
2648
2648
|
#include <clipping_planes_vertex>
|
|
2649
2649
|
vWorldPosition = worldPosition.xyz;
|
|
2650
|
-
}`,
|
|
2650
|
+
}`,ap=`#define DISTANCE
|
|
2651
2651
|
uniform vec3 referencePosition;
|
|
2652
2652
|
uniform float nearDistance;
|
|
2653
2653
|
uniform float farDistance;
|
|
@@ -2671,13 +2671,13 @@ void main () {
|
|
|
2671
2671
|
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
|
|
2672
2672
|
dist = saturate( dist );
|
|
2673
2673
|
gl_FragColor = packDepthToRGBA( dist );
|
|
2674
|
-
}`,
|
|
2674
|
+
}`,op=`varying vec3 vWorldDirection;
|
|
2675
2675
|
#include <common>
|
|
2676
2676
|
void main() {
|
|
2677
2677
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2678
2678
|
#include <begin_vertex>
|
|
2679
2679
|
#include <project_vertex>
|
|
2680
|
-
}`,
|
|
2680
|
+
}`,lp=`uniform sampler2D tEquirect;
|
|
2681
2681
|
varying vec3 vWorldDirection;
|
|
2682
2682
|
#include <common>
|
|
2683
2683
|
void main() {
|
|
@@ -2686,7 +2686,7 @@ void main() {
|
|
|
2686
2686
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
2687
2687
|
#include <tonemapping_fragment>
|
|
2688
2688
|
#include <colorspace_fragment>
|
|
2689
|
-
}`,
|
|
2689
|
+
}`,cp=`uniform float scale;
|
|
2690
2690
|
attribute float lineDistance;
|
|
2691
2691
|
varying float vLineDistance;
|
|
2692
2692
|
#include <common>
|
|
@@ -2708,7 +2708,7 @@ void main() {
|
|
|
2708
2708
|
#include <logdepthbuf_vertex>
|
|
2709
2709
|
#include <clipping_planes_vertex>
|
|
2710
2710
|
#include <fog_vertex>
|
|
2711
|
-
}`,
|
|
2711
|
+
}`,up=`uniform vec3 diffuse;
|
|
2712
2712
|
uniform float opacity;
|
|
2713
2713
|
uniform float dashSize;
|
|
2714
2714
|
uniform float totalSize;
|
|
@@ -2736,7 +2736,7 @@ void main() {
|
|
|
2736
2736
|
#include <colorspace_fragment>
|
|
2737
2737
|
#include <fog_fragment>
|
|
2738
2738
|
#include <premultiplied_alpha_fragment>
|
|
2739
|
-
}`,
|
|
2739
|
+
}`,hp=`#include <common>
|
|
2740
2740
|
#include <batching_pars_vertex>
|
|
2741
2741
|
#include <uv_pars_vertex>
|
|
2742
2742
|
#include <envmap_pars_vertex>
|
|
@@ -2768,7 +2768,7 @@ void main() {
|
|
|
2768
2768
|
#include <worldpos_vertex>
|
|
2769
2769
|
#include <envmap_vertex>
|
|
2770
2770
|
#include <fog_vertex>
|
|
2771
|
-
}`,
|
|
2771
|
+
}`,dp=`uniform vec3 diffuse;
|
|
2772
2772
|
uniform float opacity;
|
|
2773
2773
|
#ifndef FLAT_SHADED
|
|
2774
2774
|
varying vec3 vNormal;
|
|
@@ -2816,7 +2816,7 @@ void main() {
|
|
|
2816
2816
|
#include <fog_fragment>
|
|
2817
2817
|
#include <premultiplied_alpha_fragment>
|
|
2818
2818
|
#include <dithering_fragment>
|
|
2819
|
-
}`,
|
|
2819
|
+
}`,fp=`#define LAMBERT
|
|
2820
2820
|
varying vec3 vViewPosition;
|
|
2821
2821
|
#include <common>
|
|
2822
2822
|
#include <batching_pars_vertex>
|
|
@@ -2855,7 +2855,7 @@ void main() {
|
|
|
2855
2855
|
#include <envmap_vertex>
|
|
2856
2856
|
#include <shadowmap_vertex>
|
|
2857
2857
|
#include <fog_vertex>
|
|
2858
|
-
}`,
|
|
2858
|
+
}`,pp=`#define LAMBERT
|
|
2859
2859
|
uniform vec3 diffuse;
|
|
2860
2860
|
uniform vec3 emissive;
|
|
2861
2861
|
uniform float opacity;
|
|
@@ -2912,7 +2912,7 @@ void main() {
|
|
|
2912
2912
|
#include <fog_fragment>
|
|
2913
2913
|
#include <premultiplied_alpha_fragment>
|
|
2914
2914
|
#include <dithering_fragment>
|
|
2915
|
-
}`,
|
|
2915
|
+
}`,mp=`#define MATCAP
|
|
2916
2916
|
varying vec3 vViewPosition;
|
|
2917
2917
|
#include <common>
|
|
2918
2918
|
#include <batching_pars_vertex>
|
|
@@ -2946,7 +2946,7 @@ void main() {
|
|
|
2946
2946
|
#include <clipping_planes_vertex>
|
|
2947
2947
|
#include <fog_vertex>
|
|
2948
2948
|
vViewPosition = - mvPosition.xyz;
|
|
2949
|
-
}`,
|
|
2949
|
+
}`,gp=`#define MATCAP
|
|
2950
2950
|
uniform vec3 diffuse;
|
|
2951
2951
|
uniform float opacity;
|
|
2952
2952
|
uniform sampler2D matcap;
|
|
@@ -2992,7 +2992,7 @@ void main() {
|
|
|
2992
2992
|
#include <fog_fragment>
|
|
2993
2993
|
#include <premultiplied_alpha_fragment>
|
|
2994
2994
|
#include <dithering_fragment>
|
|
2995
|
-
}`,
|
|
2995
|
+
}`,_p=`#define NORMAL
|
|
2996
2996
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
2997
2997
|
varying vec3 vViewPosition;
|
|
2998
2998
|
#endif
|
|
@@ -3025,7 +3025,7 @@ void main() {
|
|
|
3025
3025
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3026
3026
|
vViewPosition = - mvPosition.xyz;
|
|
3027
3027
|
#endif
|
|
3028
|
-
}`,
|
|
3028
|
+
}`,xp=`#define NORMAL
|
|
3029
3029
|
uniform float opacity;
|
|
3030
3030
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3031
3031
|
varying vec3 vViewPosition;
|
|
@@ -3047,7 +3047,7 @@ void main() {
|
|
|
3047
3047
|
#ifdef OPAQUE
|
|
3048
3048
|
gl_FragColor.a = 1.0;
|
|
3049
3049
|
#endif
|
|
3050
|
-
}`,
|
|
3050
|
+
}`,vp=`#define PHONG
|
|
3051
3051
|
varying vec3 vViewPosition;
|
|
3052
3052
|
#include <common>
|
|
3053
3053
|
#include <batching_pars_vertex>
|
|
@@ -3086,7 +3086,7 @@ void main() {
|
|
|
3086
3086
|
#include <envmap_vertex>
|
|
3087
3087
|
#include <shadowmap_vertex>
|
|
3088
3088
|
#include <fog_vertex>
|
|
3089
|
-
}`,
|
|
3089
|
+
}`,Mp=`#define PHONG
|
|
3090
3090
|
uniform vec3 diffuse;
|
|
3091
3091
|
uniform vec3 emissive;
|
|
3092
3092
|
uniform vec3 specular;
|
|
@@ -3145,7 +3145,7 @@ void main() {
|
|
|
3145
3145
|
#include <fog_fragment>
|
|
3146
3146
|
#include <premultiplied_alpha_fragment>
|
|
3147
3147
|
#include <dithering_fragment>
|
|
3148
|
-
}`,
|
|
3148
|
+
}`,Sp=`#define STANDARD
|
|
3149
3149
|
varying vec3 vViewPosition;
|
|
3150
3150
|
#ifdef USE_TRANSMISSION
|
|
3151
3151
|
varying vec3 vWorldPosition;
|
|
@@ -3188,7 +3188,7 @@ void main() {
|
|
|
3188
3188
|
#ifdef USE_TRANSMISSION
|
|
3189
3189
|
vWorldPosition = worldPosition.xyz;
|
|
3190
3190
|
#endif
|
|
3191
|
-
}`,
|
|
3191
|
+
}`,yp=`#define STANDARD
|
|
3192
3192
|
#ifdef PHYSICAL
|
|
3193
3193
|
#define IOR
|
|
3194
3194
|
#define USE_SPECULAR
|
|
@@ -3310,7 +3310,7 @@ void main() {
|
|
|
3310
3310
|
#include <fog_fragment>
|
|
3311
3311
|
#include <premultiplied_alpha_fragment>
|
|
3312
3312
|
#include <dithering_fragment>
|
|
3313
|
-
}`,
|
|
3313
|
+
}`,Ep=`#define TOON
|
|
3314
3314
|
varying vec3 vViewPosition;
|
|
3315
3315
|
#include <common>
|
|
3316
3316
|
#include <batching_pars_vertex>
|
|
@@ -3347,7 +3347,7 @@ void main() {
|
|
|
3347
3347
|
#include <worldpos_vertex>
|
|
3348
3348
|
#include <shadowmap_vertex>
|
|
3349
3349
|
#include <fog_vertex>
|
|
3350
|
-
}`,
|
|
3350
|
+
}`,bp=`#define TOON
|
|
3351
3351
|
uniform vec3 diffuse;
|
|
3352
3352
|
uniform vec3 emissive;
|
|
3353
3353
|
uniform float opacity;
|
|
@@ -3400,7 +3400,7 @@ void main() {
|
|
|
3400
3400
|
#include <fog_fragment>
|
|
3401
3401
|
#include <premultiplied_alpha_fragment>
|
|
3402
3402
|
#include <dithering_fragment>
|
|
3403
|
-
}`,
|
|
3403
|
+
}`,Tp=`uniform float size;
|
|
3404
3404
|
uniform float scale;
|
|
3405
3405
|
#include <common>
|
|
3406
3406
|
#include <color_pars_vertex>
|
|
@@ -3431,7 +3431,7 @@ void main() {
|
|
|
3431
3431
|
#include <clipping_planes_vertex>
|
|
3432
3432
|
#include <worldpos_vertex>
|
|
3433
3433
|
#include <fog_vertex>
|
|
3434
|
-
}`,
|
|
3434
|
+
}`,Dp=`uniform vec3 diffuse;
|
|
3435
3435
|
uniform float opacity;
|
|
3436
3436
|
#include <common>
|
|
3437
3437
|
#include <color_pars_fragment>
|
|
@@ -3456,7 +3456,7 @@ void main() {
|
|
|
3456
3456
|
#include <colorspace_fragment>
|
|
3457
3457
|
#include <fog_fragment>
|
|
3458
3458
|
#include <premultiplied_alpha_fragment>
|
|
3459
|
-
}`,
|
|
3459
|
+
}`,Ap=`#include <common>
|
|
3460
3460
|
#include <batching_pars_vertex>
|
|
3461
3461
|
#include <fog_pars_vertex>
|
|
3462
3462
|
#include <morphtarget_pars_vertex>
|
|
@@ -3479,7 +3479,7 @@ void main() {
|
|
|
3479
3479
|
#include <worldpos_vertex>
|
|
3480
3480
|
#include <shadowmap_vertex>
|
|
3481
3481
|
#include <fog_vertex>
|
|
3482
|
-
}`,
|
|
3482
|
+
}`,wp=`uniform vec3 color;
|
|
3483
3483
|
uniform float opacity;
|
|
3484
3484
|
#include <common>
|
|
3485
3485
|
#include <packing>
|
|
@@ -3495,7 +3495,7 @@ void main() {
|
|
|
3495
3495
|
#include <tonemapping_fragment>
|
|
3496
3496
|
#include <colorspace_fragment>
|
|
3497
3497
|
#include <fog_fragment>
|
|
3498
|
-
}
|
|
3498
|
+
}`,Cp=`uniform float rotation;
|
|
3499
3499
|
uniform vec2 center;
|
|
3500
3500
|
#include <common>
|
|
3501
3501
|
#include <uv_pars_vertex>
|
|
@@ -3521,7 +3521,7 @@ void main() {
|
|
|
3521
3521
|
#include <logdepthbuf_vertex>
|
|
3522
3522
|
#include <clipping_planes_vertex>
|
|
3523
3523
|
#include <fog_vertex>
|
|
3524
|
-
}`,
|
|
3524
|
+
}`,Rp=`uniform vec3 diffuse;
|
|
3525
3525
|
uniform float opacity;
|
|
3526
3526
|
#include <common>
|
|
3527
3527
|
#include <uv_pars_fragment>
|
|
@@ -3546,7 +3546,7 @@ void main() {
|
|
|
3546
3546
|
#include <tonemapping_fragment>
|
|
3547
3547
|
#include <colorspace_fragment>
|
|
3548
3548
|
#include <fog_fragment>
|
|
3549
|
-
}`,Oe={alphahash_fragment:gh,alphahash_pars_fragment:_h,alphamap_fragment:vh,alphamap_pars_fragment:xh,alphatest_fragment:Mh,alphatest_pars_fragment:Sh,aomap_fragment:Eh,aomap_pars_fragment:yh,batching_pars_vertex:bh,batching_vertex:Dh,begin_vertex:Th,beginnormal_vertex:Ah,bsdfs:wh,iridescence_fragment:Ch,bumpmap_pars_fragment:Rh,clipping_planes_fragment:Ph,clipping_planes_pars_fragment:Lh,clipping_planes_pars_vertex:Fh,clipping_planes_vertex:Uh,color_fragment:Nh,color_pars_fragment:Ih,color_pars_vertex:Oh,color_vertex:Bh,common:zh,cube_uv_reflection_fragment:kh,defaultnormal_vertex:Hh,displacementmap_pars_vertex:Vh,displacementmap_vertex:Gh,emissivemap_fragment:Wh,emissivemap_pars_fragment:Xh,colorspace_fragment:Yh,colorspace_pars_fragment:jh,envmap_fragment:qh,envmap_common_pars_fragment:$h,envmap_pars_fragment:Kh,envmap_pars_vertex:Zh,envmap_physical_pars_fragment:cd,envmap_vertex:Jh,fog_vertex:Qh,fog_pars_vertex:ed,fog_fragment:td,fog_pars_fragment:nd,gradientmap_pars_fragment:id,lightmap_fragment:rd,lightmap_pars_fragment:sd,lights_lambert_fragment:ad,lights_lambert_pars_fragment:od,lights_pars_begin:ld,lights_toon_fragment:ud,lights_toon_pars_fragment:hd,lights_phong_fragment:dd,lights_phong_pars_fragment:fd,lights_physical_fragment:pd,lights_physical_pars_fragment:md,lights_fragment_begin:gd,lights_fragment_maps:_d,lights_fragment_end:vd,logdepthbuf_fragment:xd,logdepthbuf_pars_fragment:Md,logdepthbuf_pars_vertex:Sd,logdepthbuf_vertex:Ed,map_fragment:yd,map_pars_fragment:bd,map_particle_fragment:Dd,map_particle_pars_fragment:Td,metalnessmap_fragment:Ad,metalnessmap_pars_fragment:wd,morphinstance_vertex:Cd,morphcolor_vertex:Rd,morphnormal_vertex:Pd,morphtarget_pars_vertex:Ld,morphtarget_vertex:Fd,normal_fragment_begin:Ud,normal_fragment_maps:Nd,normal_pars_fragment:Id,normal_pars_vertex:Od,normal_vertex:Bd,normalmap_pars_fragment:zd,clearcoat_normal_fragment_begin:kd,clearcoat_normal_fragment_maps:Hd,clearcoat_pars_fragment:Vd,iridescence_pars_fragment:Gd,opaque_fragment:Wd,packing:Xd,premultiplied_alpha_fragment:Yd,project_vertex:jd,dithering_fragment:qd,dithering_pars_fragment:$d,roughnessmap_fragment:Kd,roughnessmap_pars_fragment:Zd,shadowmap_pars_fragment:Jd,shadowmap_pars_vertex:Qd,shadowmap_vertex:ef,shadowmask_pars_fragment:tf,skinbase_vertex:nf,skinning_pars_vertex:rf,skinning_vertex:sf,skinnormal_vertex:af,specularmap_fragment:of,specularmap_pars_fragment:lf,tonemapping_fragment:cf,tonemapping_pars_fragment:uf,transmission_fragment:hf,transmission_pars_fragment:df,uv_pars_fragment:ff,uv_pars_vertex:pf,uv_vertex:mf,worldpos_vertex:gf,background_vert:_f,background_frag:vf,backgroundCube_vert:xf,backgroundCube_frag:Mf,cube_vert:Sf,cube_frag:Ef,depth_vert:yf,depth_frag:bf,distanceRGBA_vert:Df,distanceRGBA_frag:Tf,equirect_vert:Af,equirect_frag:wf,linedashed_vert:Cf,linedashed_frag:Rf,meshbasic_vert:Pf,meshbasic_frag:Lf,meshlambert_vert:Ff,meshlambert_frag:Uf,meshmatcap_vert:Nf,meshmatcap_frag:If,meshnormal_vert:Of,meshnormal_frag:Bf,meshphong_vert:zf,meshphong_frag:kf,meshphysical_vert:Hf,meshphysical_frag:Vf,meshtoon_vert:Gf,meshtoon_frag:Wf,points_vert:Xf,points_frag:Yf,shadow_vert:jf,shadow_frag:qf,sprite_vert:$f,sprite_frag:Kf},oe={common:{diffuse:{value:new be(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Be},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Be}},envmap:{envMap:{value:null},envMapRotation:{value:new Be},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Be}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Be}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Be},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Be},normalScale:{value:new ue(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Be},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Be}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Be}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Be}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new be(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new be(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0},uvTransform:{value:new Be}},sprite:{diffuse:{value:new be(16777215)},opacity:{value:1},center:{value:new ue(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Be},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0}}},Gt={basic:{uniforms:xt([oe.common,oe.specularmap,oe.envmap,oe.aomap,oe.lightmap,oe.fog]),vertexShader:Oe.meshbasic_vert,fragmentShader:Oe.meshbasic_frag},lambert:{uniforms:xt([oe.common,oe.specularmap,oe.envmap,oe.aomap,oe.lightmap,oe.emissivemap,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.fog,oe.lights,{emissive:{value:new be(0)}}]),vertexShader:Oe.meshlambert_vert,fragmentShader:Oe.meshlambert_frag},phong:{uniforms:xt([oe.common,oe.specularmap,oe.envmap,oe.aomap,oe.lightmap,oe.emissivemap,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.fog,oe.lights,{emissive:{value:new be(0)},specular:{value:new be(1118481)},shininess:{value:30}}]),vertexShader:Oe.meshphong_vert,fragmentShader:Oe.meshphong_frag},standard:{uniforms:xt([oe.common,oe.envmap,oe.aomap,oe.lightmap,oe.emissivemap,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.roughnessmap,oe.metalnessmap,oe.fog,oe.lights,{emissive:{value:new be(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Oe.meshphysical_vert,fragmentShader:Oe.meshphysical_frag},toon:{uniforms:xt([oe.common,oe.aomap,oe.lightmap,oe.emissivemap,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.gradientmap,oe.fog,oe.lights,{emissive:{value:new be(0)}}]),vertexShader:Oe.meshtoon_vert,fragmentShader:Oe.meshtoon_frag},matcap:{uniforms:xt([oe.common,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.fog,{matcap:{value:null}}]),vertexShader:Oe.meshmatcap_vert,fragmentShader:Oe.meshmatcap_frag},points:{uniforms:xt([oe.points,oe.fog]),vertexShader:Oe.points_vert,fragmentShader:Oe.points_frag},dashed:{uniforms:xt([oe.common,oe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Oe.linedashed_vert,fragmentShader:Oe.linedashed_frag},depth:{uniforms:xt([oe.common,oe.displacementmap]),vertexShader:Oe.depth_vert,fragmentShader:Oe.depth_frag},normal:{uniforms:xt([oe.common,oe.bumpmap,oe.normalmap,oe.displacementmap,{opacity:{value:1}}]),vertexShader:Oe.meshnormal_vert,fragmentShader:Oe.meshnormal_frag},sprite:{uniforms:xt([oe.sprite,oe.fog]),vertexShader:Oe.sprite_vert,fragmentShader:Oe.sprite_frag},background:{uniforms:{uvTransform:{value:new Be},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Oe.background_vert,fragmentShader:Oe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Be}},vertexShader:Oe.backgroundCube_vert,fragmentShader:Oe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Oe.cube_vert,fragmentShader:Oe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Oe.equirect_vert,fragmentShader:Oe.equirect_frag},distanceRGBA:{uniforms:xt([oe.common,oe.displacementmap,{referencePosition:{value:new R},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Oe.distanceRGBA_vert,fragmentShader:Oe.distanceRGBA_frag},shadow:{uniforms:xt([oe.lights,oe.fog,{color:{value:new be(0)},opacity:{value:1}}]),vertexShader:Oe.shadow_vert,fragmentShader:Oe.shadow_frag}};Gt.physical={uniforms:xt([Gt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Be},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Be},clearcoatNormalScale:{value:new ue(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Be},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Be},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Be},sheen:{value:0},sheenColor:{value:new be(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Be},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Be},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Be},transmissionSamplerSize:{value:new ue},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Be},attenuationDistance:{value:0},attenuationColor:{value:new be(0)},specularColor:{value:new be(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Be},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Be},anisotropyVector:{value:new ue},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Be}}]),vertexShader:Oe.meshphysical_vert,fragmentShader:Oe.meshphysical_frag};const ur={r:0,b:0,g:0},Tn=new tn,Zf=new et;function Jf(i,e,t,n,r,s,a){const o=new be(0);let l=s===!0?0:1,c,h,d=null,u=0,p=null;function _(m,f){let b=!1,x=f.isScene===!0?f.background:null;x&&x.isTexture&&(x=(f.backgroundBlurriness>0?t:e).get(x)),x===null?v(o,l):x&&x.isColor&&(v(x,1),b=!0);const D=i.xr.getEnvironmentBlendMode();D==="additive"?n.buffers.color.setClear(0,0,0,1,a):D==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||b)&&i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil),x&&(x.isCubeTexture||x.mapping===Lr)?(h===void 0&&(h=new bt(new ki(1,1,1),new ft({name:"BackgroundCubeMaterial",uniforms:gi(Gt.backgroundCube.uniforms),vertexShader:Gt.backgroundCube.vertexShader,fragmentShader:Gt.backgroundCube.fragmentShader,side:Mt,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(P,T,w){this.matrixWorld.copyPosition(w.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(h)),Tn.copy(f.backgroundRotation),Tn.x*=-1,Tn.y*=-1,Tn.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(Tn.y*=-1,Tn.z*=-1),h.material.uniforms.envMap.value=x,h.material.uniforms.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=f.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=f.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(Zf.makeRotationFromEuler(Tn)),h.material.toneMapped=$e.getTransfer(x.colorSpace)!==Ke,(d!==x||u!==x.version||p!==i.toneMapping)&&(h.material.needsUpdate=!0,d=x,u=x.version,p=i.toneMapping),h.layers.enableAll(),m.unshift(h,h.geometry,h.material,0,0,null)):x&&x.isTexture&&(c===void 0&&(c=new bt(new Nr(2,2),new ft({name:"BackgroundMaterial",uniforms:gi(Gt.background.uniforms),vertexShader:Gt.background.vertexShader,fragmentShader:Gt.background.fragmentShader,side:vn,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=x,c.material.uniforms.backgroundIntensity.value=f.backgroundIntensity,c.material.toneMapped=$e.getTransfer(x.colorSpace)!==Ke,x.matrixAutoUpdate===!0&&x.updateMatrix(),c.material.uniforms.uvTransform.value.copy(x.matrix),(d!==x||u!==x.version||p!==i.toneMapping)&&(c.material.needsUpdate=!0,d=x,u=x.version,p=i.toneMapping),c.layers.enableAll(),m.unshift(c,c.geometry,c.material,0,0,null))}function v(m,f){m.getRGB(ur,Sl(i)),n.buffers.color.setClear(ur.r,ur.g,ur.b,f,a)}return{getClearColor:function(){return o},setClearColor:function(m,f=1){o.set(m),l=f,v(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(m){l=m,v(o,l)},render:_}}function Qf(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=u(null);let s=r,a=!1;function o(M,N,I,C,z){let V=!1;const q=d(C,I,N);s!==q&&(s=q,c(s.object)),V=p(M,C,I,z),V&&_(M,C,I,z),z!==null&&e.update(z,i.ELEMENT_ARRAY_BUFFER),(V||a)&&(a=!1,D(M,N,I,C),z!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(z).buffer))}function l(){return i.createVertexArray()}function c(M){return i.bindVertexArray(M)}function h(M){return i.deleteVertexArray(M)}function d(M,N,I){const C=I.wireframe===!0;let z=n[M.id];z===void 0&&(z={},n[M.id]=z);let V=z[N.id];V===void 0&&(V={},z[N.id]=V);let q=V[C];return q===void 0&&(q=u(l()),V[C]=q),q}function u(M){const N=[],I=[],C=[];for(let z=0;z<t;z++)N[z]=0,I[z]=0,C[z]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:N,enabledAttributes:I,attributeDivisors:C,object:M,attributes:{},index:null}}function p(M,N,I,C){const z=s.attributes,V=N.attributes;let q=0;const ee=I.getAttributes();for(const B in ee)if(ee[B].location>=0){const j=z[B];let F=V[B];if(F===void 0&&(B==="instanceMatrix"&&M.instanceMatrix&&(F=M.instanceMatrix),B==="instanceColor"&&M.instanceColor&&(F=M.instanceColor)),j===void 0||j.attribute!==F||F&&j.data!==F.data)return!0;q++}return s.attributesNum!==q||s.index!==C}function _(M,N,I,C){const z={},V=N.attributes;let q=0;const ee=I.getAttributes();for(const B in ee)if(ee[B].location>=0){let j=V[B];j===void 0&&(B==="instanceMatrix"&&M.instanceMatrix&&(j=M.instanceMatrix),B==="instanceColor"&&M.instanceColor&&(j=M.instanceColor));const F={};F.attribute=j,j&&j.data&&(F.data=j.data),z[B]=F,q++}s.attributes=z,s.attributesNum=q,s.index=C}function v(){const M=s.newAttributes;for(let N=0,I=M.length;N<I;N++)M[N]=0}function m(M){f(M,0)}function f(M,N){const I=s.newAttributes,C=s.enabledAttributes,z=s.attributeDivisors;I[M]=1,C[M]===0&&(i.enableVertexAttribArray(M),C[M]=1),z[M]!==N&&(i.vertexAttribDivisor(M,N),z[M]=N)}function b(){const M=s.newAttributes,N=s.enabledAttributes;for(let I=0,C=N.length;I<C;I++)N[I]!==M[I]&&(i.disableVertexAttribArray(I),N[I]=0)}function x(M,N,I,C,z,V,q){q===!0?i.vertexAttribIPointer(M,N,I,z,V):i.vertexAttribPointer(M,N,I,C,z,V)}function D(M,N,I,C){v();const z=C.attributes,V=I.getAttributes(),q=N.defaultAttributeValues;for(const ee in V){const B=V[ee];if(B.location>=0){let $=z[ee];if($===void 0&&(ee==="instanceMatrix"&&M.instanceMatrix&&($=M.instanceMatrix),ee==="instanceColor"&&M.instanceColor&&($=M.instanceColor)),$!==void 0){const j=$.normalized,F=$.itemSize,Q=e.get($);if(Q===void 0)continue;const pe=Q.buffer,U=Q.type,J=Q.bytesPerElement,le=U===i.INT||U===i.UNSIGNED_INT||$.gpuType===sl;if($.isInterleavedBufferAttribute){const ne=$.data,xe=ne.stride,De=$.offset;if(ne.isInstancedInterleavedBuffer){for(let Ce=0;Ce<B.locationSize;Ce++)f(B.location+Ce,ne.meshPerAttribute);M.isInstancedMesh!==!0&&C._maxInstanceCount===void 0&&(C._maxInstanceCount=ne.meshPerAttribute*ne.count)}else for(let Ce=0;Ce<B.locationSize;Ce++)m(B.location+Ce);i.bindBuffer(i.ARRAY_BUFFER,pe);for(let Ce=0;Ce<B.locationSize;Ce++)x(B.location+Ce,F/B.locationSize,U,j,xe*J,(De+F/B.locationSize*Ce)*J,le)}else{if($.isInstancedBufferAttribute){for(let ne=0;ne<B.locationSize;ne++)f(B.location+ne,$.meshPerAttribute);M.isInstancedMesh!==!0&&C._maxInstanceCount===void 0&&(C._maxInstanceCount=$.meshPerAttribute*$.count)}else for(let ne=0;ne<B.locationSize;ne++)m(B.location+ne);i.bindBuffer(i.ARRAY_BUFFER,pe);for(let ne=0;ne<B.locationSize;ne++)x(B.location+ne,F/B.locationSize,U,j,F*J,F/B.locationSize*ne*J,le)}}else if(q!==void 0){const j=q[ee];if(j!==void 0)switch(j.length){case 2:i.vertexAttrib2fv(B.location,j);break;case 3:i.vertexAttrib3fv(B.location,j);break;case 4:i.vertexAttrib4fv(B.location,j);break;default:i.vertexAttrib1fv(B.location,j)}}}}b()}function P(){L();for(const M in n){const N=n[M];for(const I in N){const C=N[I];for(const z in C)h(C[z].object),delete C[z];delete N[I]}delete n[M]}}function T(M){if(n[M.id]===void 0)return;const N=n[M.id];for(const I in N){const C=N[I];for(const z in C)h(C[z].object),delete C[z];delete N[I]}delete n[M.id]}function w(M){for(const N in n){const I=n[N];if(I[M.id]===void 0)continue;const C=I[M.id];for(const z in C)h(C[z].object),delete C[z];delete I[M.id]}}function L(){E(),a=!0,s!==r&&(s=r,c(s.object))}function E(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:L,resetDefaultState:E,dispose:P,releaseStatesOfGeometry:T,releaseStatesOfProgram:w,initAttributes:v,enableAttribute:m,disableUnusedAttributes:b}}function ep(i,e,t){let n;function r(l){n=l}function s(l,c){i.drawArrays(n,l,c),t.update(c,n,1)}function a(l,c,h){h!==0&&(i.drawArraysInstanced(n,l,c,h),t.update(c,n,h))}function o(l,c,h){if(h===0)return;const d=e.get("WEBGL_multi_draw");if(d===null)for(let u=0;u<h;u++)this.render(l[u],c[u]);else{d.multiDrawArraysWEBGL(n,l,0,c,0,h);let u=0;for(let p=0;p<h;p++)u+=c[p];t.update(u,n,1)}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o}function tp(i,e,t){let n;function r(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const x=e.get("EXT_texture_filter_anisotropic");n=i.getParameter(x.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function s(x){if(x==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";x="mediump"}return x==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let a=t.precision!==void 0?t.precision:"highp";const o=s(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);const l=t.logarithmicDepthBuffer===!0,c=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),h=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=i.getParameter(i.MAX_TEXTURE_SIZE),u=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),p=i.getParameter(i.MAX_VERTEX_ATTRIBS),_=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),v=i.getParameter(i.MAX_VARYING_VECTORS),m=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),f=h>0,b=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:u,maxAttributes:p,maxVertexUniforms:_,maxVaryings:v,maxFragmentUniforms:m,vertexTextures:f,maxSamples:b}}function np(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new dn,o=new Be,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,u){const p=d.length!==0||u||n!==0||r;return r=u,n=d.length,p},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,u){t=h(d,u,0)},this.setState=function(d,u,p){const _=d.clippingPlanes,v=d.clipIntersection,m=d.clipShadows,f=i.get(d);if(!r||_===null||_.length===0||s&&!m)s?h(null):c();else{const b=s?0:n,x=b*4;let D=f.clippingState||null;l.value=D,D=h(_,u,x,p);for(let P=0;P!==x;++P)D[P]=t[P];f.clippingState=D,this.numIntersection=v?this.numPlanes:0,this.numPlanes+=b}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(d,u,p,_){const v=d!==null?d.length:0;let m=null;if(v!==0){if(m=l.value,_!==!0||m===null){const f=p+v*4,b=u.matrixWorldInverse;o.getNormalMatrix(b),(m===null||m.length<f)&&(m=new Float32Array(f));for(let x=0,D=p;x!==v;++x,D+=4)a.copy(d[x]).applyMatrix4(b,o),a.normal.toArray(m,D),m[D+3]=a.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=v,e.numIntersection=0,m}}function ip(i){let e=new WeakMap;function t(a,o){return o===Fs?a.mapping=fi:o===Us&&(a.mapping=pi),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===Fs||o===Us)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new dh(l.height);return c.fromEquirectangularTexture(i,a),e.set(a,c),a.addEventListener("dispose",r),t(c.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class Tl extends El{constructor(e=-1,t=1,n=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=h*this.view.offsetY,l=o-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const oi=4,po=[.125,.215,.35,.446,.526,.582],Rn=20,fs=new Tl,mo=new be;let ps=null,ms=0,gs=0,_s=!1;const wn=(1+Math.sqrt(5))/2,si=1/wn,go=[new R(1,1,1),new R(-1,1,1),new R(1,1,-1),new R(-1,1,-1),new R(0,wn,si),new R(0,wn,-si),new R(si,0,wn),new R(-si,0,wn),new R(wn,si,0),new R(-wn,si,0)];class _o{constructor(e){this._renderer=e,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(e,t=0,n=.1,r=100){ps=this._renderer.getRenderTarget(),ms=this._renderer.getActiveCubeFace(),gs=this._renderer.getActiveMipmapLevel(),_s=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Mo(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=xo(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(ps,ms,gs),this._renderer.xr.enabled=_s,e.scissorTest=!1,hr(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===fi||e.mapping===pi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),ps=this._renderer.getRenderTarget(),ms=this._renderer.getActiveCubeFace(),gs=this._renderer.getActiveMipmapLevel(),_s=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:zt,minFilter:zt,generateMipmaps:!1,type:_n,format:Xt,colorSpace:xn,depthBuffer:!1},r=vo(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=vo(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=rp(s)),this._blurMaterial=sp(s,e,t)}return r}_compileMaterial(e){const t=new bt(this._lodPlanes[0],e);this._renderer.compile(t,fs)}_sceneToCubeUV(e,t,n,r){const o=new Rt(90,1,t,n),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],h=this._renderer,d=h.autoClear,u=h.toneMapping;h.getClearColor(mo),h.toneMapping=mn,h.autoClear=!1;const p=new zi({name:"PMREM.Background",side:Mt,depthWrite:!1,depthTest:!1}),_=new bt(new ki,p);let v=!1;const m=e.background;m?m.isColor&&(p.color.copy(m),e.background=null,v=!0):(p.color.copy(mo),v=!0);for(let f=0;f<6;f++){const b=f%3;b===0?(o.up.set(0,l[f],0),o.lookAt(c[f],0,0)):b===1?(o.up.set(0,0,l[f]),o.lookAt(0,c[f],0)):(o.up.set(0,l[f],0),o.lookAt(0,0,c[f]));const x=this._cubeSize;hr(r,b*x,f>2?x:0,x,x),h.setRenderTarget(r),v&&h.render(_,o),h.render(e,o)}_.geometry.dispose(),_.material.dispose(),h.toneMapping=u,h.autoClear=d,e.background=m}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===fi||e.mapping===pi;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Mo()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=xo());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new bt(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;hr(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,fs)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let r=1;r<this._lodPlanes.length;r++){const s=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),a=go[(r-1)%go.length];this._blur(e,r-1,r,s,a)}t.autoClear=n}_blur(e,t,n,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",s),this._halfBlur(a,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,d=new bt(this._lodPlanes[r],c),u=c.uniforms,p=this._sizeLods[n]-1,_=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*Rn-1),v=s/_,m=isFinite(s)?1+Math.floor(h*v):Rn;m>Rn&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Rn}`);const f=[];let b=0;for(let w=0;w<Rn;++w){const L=w/v,E=Math.exp(-L*L/2);f.push(E),w===0?b+=E:w<m&&(b+=2*E)}for(let w=0;w<f.length;w++)f[w]=f[w]/b;u.envMap.value=e.texture,u.samples.value=m,u.weights.value=f,u.latitudinal.value=a==="latitudinal",o&&(u.poleAxis.value=o);const{_lodMax:x}=this;u.dTheta.value=_,u.mipInt.value=x-n;const D=this._sizeLods[r],P=3*D*(r>x-oi?r-x+oi:0),T=4*(this._cubeSize-D);hr(t,P,T,3*D,2*D),l.setRenderTarget(t),l.render(d,fs)}}function rp(i){const e=[],t=[],n=[];let r=i;const s=i-oi+1+po.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);t.push(o);let l=1/o;a>i-oi?l=po[a-i+oi-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),h=-c,d=1+c,u=[h,h,d,h,d,d,h,h,d,d,h,d],p=6,_=6,v=3,m=2,f=1,b=new Float32Array(v*_*p),x=new Float32Array(m*_*p),D=new Float32Array(f*_*p);for(let T=0;T<p;T++){const w=T%3*2/3-1,L=T>2?0:-1,E=[w,L,0,w+2/3,L,0,w+2/3,L+1,0,w,L,0,w+2/3,L+1,0,w,L+1,0];b.set(E,v*_*T),x.set(u,m*_*T);const M=[T,T,T,T,T,T];D.set(M,f*_*T)}const P=new _t;P.setAttribute("position",new yt(b,v)),P.setAttribute("uv",new yt(x,m)),P.setAttribute("faceIndex",new yt(D,f)),e.push(P),r>oi&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function vo(i,e,t){const n=new Ht(i,e,t);return n.texture.mapping=Lr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function hr(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function sp(i,e,t){const n=new Float32Array(Rn),r=new R(0,1,0);return new ft({name:"SphericalGaussianBlur",defines:{n:Rn,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Ys(),fragmentShader:`
|
|
3549
|
+
}`,Oe={alphahash_fragment:Kh,alphahash_pars_fragment:Zh,alphamap_fragment:Jh,alphamap_pars_fragment:Qh,alphatest_fragment:ed,alphatest_pars_fragment:td,aomap_fragment:nd,aomap_pars_fragment:id,batching_pars_vertex:rd,batching_vertex:sd,begin_vertex:ad,beginnormal_vertex:od,bsdfs:ld,iridescence_fragment:cd,bumpmap_pars_fragment:ud,clipping_planes_fragment:hd,clipping_planes_pars_fragment:dd,clipping_planes_pars_vertex:fd,clipping_planes_vertex:pd,color_fragment:md,color_pars_fragment:gd,color_pars_vertex:_d,color_vertex:xd,common:vd,cube_uv_reflection_fragment:Md,defaultnormal_vertex:Sd,displacementmap_pars_vertex:yd,displacementmap_vertex:Ed,emissivemap_fragment:bd,emissivemap_pars_fragment:Td,colorspace_fragment:Dd,colorspace_pars_fragment:Ad,envmap_fragment:wd,envmap_common_pars_fragment:Cd,envmap_pars_fragment:Rd,envmap_pars_vertex:Pd,envmap_physical_pars_fragment:Gd,envmap_vertex:Ld,fog_vertex:Fd,fog_pars_vertex:Id,fog_fragment:Ud,fog_pars_fragment:Nd,gradientmap_pars_fragment:Od,lightmap_fragment:Bd,lightmap_pars_fragment:zd,lights_lambert_fragment:kd,lights_lambert_pars_fragment:Hd,lights_pars_begin:Vd,lights_toon_fragment:Wd,lights_toon_pars_fragment:Xd,lights_phong_fragment:qd,lights_phong_pars_fragment:Yd,lights_physical_fragment:$d,lights_physical_pars_fragment:jd,lights_fragment_begin:Kd,lights_fragment_maps:Zd,lights_fragment_end:Jd,logdepthbuf_fragment:Qd,logdepthbuf_pars_fragment:ef,logdepthbuf_pars_vertex:tf,logdepthbuf_vertex:nf,map_fragment:rf,map_pars_fragment:sf,map_particle_fragment:af,map_particle_pars_fragment:of,metalnessmap_fragment:lf,metalnessmap_pars_fragment:cf,morphinstance_vertex:uf,morphcolor_vertex:hf,morphnormal_vertex:df,morphtarget_pars_vertex:ff,morphtarget_vertex:pf,normal_fragment_begin:mf,normal_fragment_maps:gf,normal_pars_fragment:_f,normal_pars_vertex:xf,normal_vertex:vf,normalmap_pars_fragment:Mf,clearcoat_normal_fragment_begin:Sf,clearcoat_normal_fragment_maps:yf,clearcoat_pars_fragment:Ef,iridescence_pars_fragment:bf,opaque_fragment:Tf,packing:Df,premultiplied_alpha_fragment:Af,project_vertex:wf,dithering_fragment:Cf,dithering_pars_fragment:Rf,roughnessmap_fragment:Pf,roughnessmap_pars_fragment:Lf,shadowmap_pars_fragment:Ff,shadowmap_pars_vertex:If,shadowmap_vertex:Uf,shadowmask_pars_fragment:Nf,skinbase_vertex:Of,skinning_pars_vertex:Bf,skinning_vertex:zf,skinnormal_vertex:kf,specularmap_fragment:Hf,specularmap_pars_fragment:Vf,tonemapping_fragment:Gf,tonemapping_pars_fragment:Wf,transmission_fragment:Xf,transmission_pars_fragment:qf,uv_pars_fragment:Yf,uv_pars_vertex:$f,uv_vertex:jf,worldpos_vertex:Kf,background_vert:Zf,background_frag:Jf,backgroundCube_vert:Qf,backgroundCube_frag:ep,cube_vert:tp,cube_frag:np,depth_vert:ip,depth_frag:rp,distanceRGBA_vert:sp,distanceRGBA_frag:ap,equirect_vert:op,equirect_frag:lp,linedashed_vert:cp,linedashed_frag:up,meshbasic_vert:hp,meshbasic_frag:dp,meshlambert_vert:fp,meshlambert_frag:pp,meshmatcap_vert:mp,meshmatcap_frag:gp,meshnormal_vert:_p,meshnormal_frag:xp,meshphong_vert:vp,meshphong_frag:Mp,meshphysical_vert:Sp,meshphysical_frag:yp,meshtoon_vert:Ep,meshtoon_frag:bp,points_vert:Tp,points_frag:Dp,shadow_vert:Ap,shadow_frag:wp,sprite_vert:Cp,sprite_frag:Rp},le={common:{diffuse:{value:new be(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Be},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Be}},envmap:{envMap:{value:null},envMapRotation:{value:new Be},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Be}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Be}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Be},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Be},normalScale:{value:new ue(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Be},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Be}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Be}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Be}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new be(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new be(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0},uvTransform:{value:new Be}},sprite:{diffuse:{value:new be(16777215)},opacity:{value:1},center:{value:new ue(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Be},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0}}},Gt={basic:{uniforms:vt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.fog]),vertexShader:Oe.meshbasic_vert,fragmentShader:Oe.meshbasic_frag},lambert:{uniforms:vt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.fog,le.lights,{emissive:{value:new be(0)}}]),vertexShader:Oe.meshlambert_vert,fragmentShader:Oe.meshlambert_frag},phong:{uniforms:vt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.fog,le.lights,{emissive:{value:new be(0)},specular:{value:new be(1118481)},shininess:{value:30}}]),vertexShader:Oe.meshphong_vert,fragmentShader:Oe.meshphong_frag},standard:{uniforms:vt([le.common,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.roughnessmap,le.metalnessmap,le.fog,le.lights,{emissive:{value:new be(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Oe.meshphysical_vert,fragmentShader:Oe.meshphysical_frag},toon:{uniforms:vt([le.common,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.gradientmap,le.fog,le.lights,{emissive:{value:new be(0)}}]),vertexShader:Oe.meshtoon_vert,fragmentShader:Oe.meshtoon_frag},matcap:{uniforms:vt([le.common,le.bumpmap,le.normalmap,le.displacementmap,le.fog,{matcap:{value:null}}]),vertexShader:Oe.meshmatcap_vert,fragmentShader:Oe.meshmatcap_frag},points:{uniforms:vt([le.points,le.fog]),vertexShader:Oe.points_vert,fragmentShader:Oe.points_frag},dashed:{uniforms:vt([le.common,le.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Oe.linedashed_vert,fragmentShader:Oe.linedashed_frag},depth:{uniforms:vt([le.common,le.displacementmap]),vertexShader:Oe.depth_vert,fragmentShader:Oe.depth_frag},normal:{uniforms:vt([le.common,le.bumpmap,le.normalmap,le.displacementmap,{opacity:{value:1}}]),vertexShader:Oe.meshnormal_vert,fragmentShader:Oe.meshnormal_frag},sprite:{uniforms:vt([le.sprite,le.fog]),vertexShader:Oe.sprite_vert,fragmentShader:Oe.sprite_frag},background:{uniforms:{uvTransform:{value:new Be},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Oe.background_vert,fragmentShader:Oe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Be}},vertexShader:Oe.backgroundCube_vert,fragmentShader:Oe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Oe.cube_vert,fragmentShader:Oe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Oe.equirect_vert,fragmentShader:Oe.equirect_frag},distanceRGBA:{uniforms:vt([le.common,le.displacementmap,{referencePosition:{value:new I},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Oe.distanceRGBA_vert,fragmentShader:Oe.distanceRGBA_frag},shadow:{uniforms:vt([le.lights,le.fog,{color:{value:new be(0)},opacity:{value:1}}]),vertexShader:Oe.shadow_vert,fragmentShader:Oe.shadow_frag}};Gt.physical={uniforms:vt([Gt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Be},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Be},clearcoatNormalScale:{value:new ue(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Be},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Be},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Be},sheen:{value:0},sheenColor:{value:new be(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Be},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Be},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Be},transmissionSamplerSize:{value:new ue},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Be},attenuationDistance:{value:0},attenuationColor:{value:new be(0)},specularColor:{value:new be(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Be},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Be},anisotropyVector:{value:new ue},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Be}}]),vertexShader:Oe.meshphysical_vert,fragmentShader:Oe.meshphysical_frag};const fr={r:0,b:0,g:0},Tn=new In,Pp=new et;function Lp(i,e,t,n,r,s,a){const o=new be(0);let l=s===!0?0:1,c,u,d=null,h=0,f=null;function g(m,p){let E=!1,v=p.isScene===!0?p.background:null;v&&v.isTexture&&(v=(p.backgroundBlurriness>0?t:e).get(v)),v===null?_(o,l):v&&v.isColor&&(_(v,1),E=!0);const b=i.xr.getEnvironmentBlendMode();b==="additive"?n.buffers.color.setClear(0,0,0,1,a):b==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||E)&&i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil),v&&(v.isCubeTexture||v.mapping===Nr)?(u===void 0&&(u=new bt(new Gi(1,1,1),new ft({name:"BackgroundCubeMaterial",uniforms:_i(Gt.backgroundCube.uniforms),vertexShader:Gt.backgroundCube.vertexShader,fragmentShader:Gt.backgroundCube.fragmentShader,side:St,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(R,T,A){this.matrixWorld.copyPosition(A.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),Tn.copy(p.backgroundRotation),Tn.x*=-1,Tn.y*=-1,Tn.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(Tn.y*=-1,Tn.z*=-1),u.material.uniforms.envMap.value=v,u.material.uniforms.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=p.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(Pp.makeRotationFromEuler(Tn)),u.material.toneMapped=je.getTransfer(v.colorSpace)!==Ke,(d!==v||h!==v.version||f!==i.toneMapping)&&(u.material.needsUpdate=!0,d=v,h=v.version,f=i.toneMapping),u.layers.enableAll(),m.unshift(u,u.geometry,u.material,0,0,null)):v&&v.isTexture&&(c===void 0&&(c=new bt(new zr(2,2),new ft({name:"BackgroundMaterial",uniforms:_i(Gt.background.uniforms),vertexShader:Gt.background.vertexShader,fragmentShader:Gt.background.fragmentShader,side:_n,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=v,c.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,c.material.toneMapped=je.getTransfer(v.colorSpace)!==Ke,v.matrixAutoUpdate===!0&&v.updateMatrix(),c.material.uniforms.uvTransform.value.copy(v.matrix),(d!==v||h!==v.version||f!==i.toneMapping)&&(c.material.needsUpdate=!0,d=v,h=v.version,f=i.toneMapping),c.layers.enableAll(),m.unshift(c,c.geometry,c.material,0,0,null))}function _(m,p){m.getRGB(fr,Jl(i)),n.buffers.color.setClear(fr.r,fr.g,fr.b,p,a)}return{getClearColor:function(){return o},setClearColor:function(m,p=1){o.set(m),l=p,_(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(m){l=m,_(o,l)},render:g}}function Fp(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=h(null);let s=r,a=!1;function o(M,F,L,C,U){let H=!1;const Y=d(C,L,F);s!==Y&&(s=Y,c(s.object)),H=f(M,C,L,U),H&&g(M,C,L,U),U!==null&&e.update(U,i.ELEMENT_ARRAY_BUFFER),(H||a)&&(a=!1,b(M,F,L,C),U!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(U).buffer))}function l(){return i.createVertexArray()}function c(M){return i.bindVertexArray(M)}function u(M){return i.deleteVertexArray(M)}function d(M,F,L){const C=L.wireframe===!0;let U=n[M.id];U===void 0&&(U={},n[M.id]=U);let H=U[F.id];H===void 0&&(H={},U[F.id]=H);let Y=H[C];return Y===void 0&&(Y=h(l()),H[C]=Y),Y}function h(M){const F=[],L=[],C=[];for(let U=0;U<t;U++)F[U]=0,L[U]=0,C[U]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:F,enabledAttributes:L,attributeDivisors:C,object:M,attributes:{},index:null}}function f(M,F,L,C){const U=s.attributes,H=F.attributes;let Y=0;const J=L.getAttributes();for(const z in J)if(J[z].location>=0){const $=U[z];let N=H[z];if(N===void 0&&(z==="instanceMatrix"&&M.instanceMatrix&&(N=M.instanceMatrix),z==="instanceColor"&&M.instanceColor&&(N=M.instanceColor)),$===void 0||$.attribute!==N||N&&$.data!==N.data)return!0;Y++}return s.attributesNum!==Y||s.index!==C}function g(M,F,L,C){const U={},H=F.attributes;let Y=0;const J=L.getAttributes();for(const z in J)if(J[z].location>=0){let $=H[z];$===void 0&&(z==="instanceMatrix"&&M.instanceMatrix&&($=M.instanceMatrix),z==="instanceColor"&&M.instanceColor&&($=M.instanceColor));const N={};N.attribute=$,$&&$.data&&(N.data=$.data),U[z]=N,Y++}s.attributes=U,s.attributesNum=Y,s.index=C}function _(){const M=s.newAttributes;for(let F=0,L=M.length;F<L;F++)M[F]=0}function m(M){p(M,0)}function p(M,F){const L=s.newAttributes,C=s.enabledAttributes,U=s.attributeDivisors;L[M]=1,C[M]===0&&(i.enableVertexAttribArray(M),C[M]=1),U[M]!==F&&(i.vertexAttribDivisor(M,F),U[M]=F)}function E(){const M=s.newAttributes,F=s.enabledAttributes;for(let L=0,C=F.length;L<C;L++)F[L]!==M[L]&&(i.disableVertexAttribArray(L),F[L]=0)}function v(M,F,L,C,U,H,Y){Y===!0?i.vertexAttribIPointer(M,F,L,U,H):i.vertexAttribPointer(M,F,L,C,U,H)}function b(M,F,L,C){_();const U=C.attributes,H=L.getAttributes(),Y=F.defaultAttributeValues;for(const J in H){const z=H[J];if(z.location>=0){let j=U[J];if(j===void 0&&(J==="instanceMatrix"&&M.instanceMatrix&&(j=M.instanceMatrix),J==="instanceColor"&&M.instanceColor&&(j=M.instanceColor)),j!==void 0){const $=j.normalized,N=j.itemSize,ee=e.get(j);if(ee===void 0)continue;const me=ee.buffer,O=ee.type,Q=ee.bytesPerElement,ce=O===i.INT||O===i.UNSIGNED_INT||j.gpuType===Ul;if(j.isInterleavedBufferAttribute){const ne=j.data,ve=ne.stride,Te=j.offset;if(ne.isInstancedInterleavedBuffer){for(let Ce=0;Ce<z.locationSize;Ce++)p(z.location+Ce,ne.meshPerAttribute);M.isInstancedMesh!==!0&&C._maxInstanceCount===void 0&&(C._maxInstanceCount=ne.meshPerAttribute*ne.count)}else for(let Ce=0;Ce<z.locationSize;Ce++)m(z.location+Ce);i.bindBuffer(i.ARRAY_BUFFER,me);for(let Ce=0;Ce<z.locationSize;Ce++)v(z.location+Ce,N/z.locationSize,O,$,ve*Q,(Te+N/z.locationSize*Ce)*Q,ce)}else{if(j.isInstancedBufferAttribute){for(let ne=0;ne<z.locationSize;ne++)p(z.location+ne,j.meshPerAttribute);M.isInstancedMesh!==!0&&C._maxInstanceCount===void 0&&(C._maxInstanceCount=j.meshPerAttribute*j.count)}else for(let ne=0;ne<z.locationSize;ne++)m(z.location+ne);i.bindBuffer(i.ARRAY_BUFFER,me);for(let ne=0;ne<z.locationSize;ne++)v(z.location+ne,N/z.locationSize,O,$,N*Q,N/z.locationSize*ne*Q,ce)}}else if(Y!==void 0){const $=Y[J];if($!==void 0)switch($.length){case 2:i.vertexAttrib2fv(z.location,$);break;case 3:i.vertexAttrib3fv(z.location,$);break;case 4:i.vertexAttrib4fv(z.location,$);break;default:i.vertexAttrib1fv(z.location,$)}}}}E()}function R(){P();for(const M in n){const F=n[M];for(const L in F){const C=F[L];for(const U in C)u(C[U].object),delete C[U];delete F[L]}delete n[M]}}function T(M){if(n[M.id]===void 0)return;const F=n[M.id];for(const L in F){const C=F[L];for(const U in C)u(C[U].object),delete C[U];delete F[L]}delete n[M.id]}function A(M){for(const F in n){const L=n[F];if(L[M.id]===void 0)continue;const C=L[M.id];for(const U in C)u(C[U].object),delete C[U];delete L[M.id]}}function P(){y(),a=!0,s!==r&&(s=r,c(s.object))}function y(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:P,resetDefaultState:y,dispose:R,releaseStatesOfGeometry:T,releaseStatesOfProgram:A,initAttributes:_,enableAttribute:m,disableUnusedAttributes:E}}function Ip(i,e,t){let n;function r(l){n=l}function s(l,c){i.drawArrays(n,l,c),t.update(c,n,1)}function a(l,c,u){u!==0&&(i.drawArraysInstanced(n,l,c,u),t.update(c,n,u))}function o(l,c,u){if(u===0)return;const d=e.get("WEBGL_multi_draw");if(d===null)for(let h=0;h<u;h++)this.render(l[h],c[h]);else{d.multiDrawArraysWEBGL(n,l,0,c,0,u);let h=0;for(let f=0;f<u;f++)h+=c[f];t.update(h,n,1)}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o}function Up(i,e,t){let n;function r(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const v=e.get("EXT_texture_filter_anisotropic");n=i.getParameter(v.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function s(v){if(v==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";v="mediump"}return v==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let a=t.precision!==void 0?t.precision:"highp";const o=s(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);const l=t.logarithmicDepthBuffer===!0,c=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),u=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=i.getParameter(i.MAX_TEXTURE_SIZE),h=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),f=i.getParameter(i.MAX_VERTEX_ATTRIBS),g=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),_=i.getParameter(i.MAX_VARYING_VECTORS),m=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),p=u>0,E=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:h,maxAttributes:f,maxVertexUniforms:g,maxVaryings:_,maxFragmentUniforms:m,vertexTextures:p,maxSamples:E}}function Np(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new hn,o=new Be,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,h){const f=d.length!==0||h||n!==0||r;return r=h,n=d.length,f},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,h){t=u(d,h,0)},this.setState=function(d,h,f){const g=d.clippingPlanes,_=d.clipIntersection,m=d.clipShadows,p=i.get(d);if(!r||g===null||g.length===0||s&&!m)s?u(null):c();else{const E=s?0:n,v=E*4;let b=p.clippingState||null;l.value=b,b=u(g,h,v,f);for(let R=0;R!==v;++R)b[R]=t[R];p.clippingState=b,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=E}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(d,h,f,g){const _=d!==null?d.length:0;let m=null;if(_!==0){if(m=l.value,g!==!0||m===null){const p=f+_*4,E=h.matrixWorldInverse;o.getNormalMatrix(E),(m===null||m.length<p)&&(m=new Float32Array(p));for(let v=0,b=f;v!==_;++v,b+=4)a.copy(d[v]).applyMatrix4(E,o),a.normal.toArray(m,b),m[b+3]=a.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,m}}function Op(i){let e=new WeakMap;function t(a,o){return o===Hs?a.mapping=pi:o===Vs&&(a.mapping=mi),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===Hs||o===Vs)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new qh(l.height);return c.fromEquirectangularTexture(i,a),e.set(a,c),a.addEventListener("dispose",r),t(c.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class ic extends Ql{constructor(e=-1,t=1,n=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=u*this.view.offsetY,l=o-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const li=4,To=[.125,.215,.35,.446,.526,.582],Cn=20,_s=new ic,Do=new be;let xs=null,vs=0,Ms=0,Ss=!1;const An=(1+Math.sqrt(5))/2,si=1/An,Ao=[new I(1,1,1),new I(-1,1,1),new I(1,1,-1),new I(-1,1,-1),new I(0,An,si),new I(0,An,-si),new I(si,0,An),new I(-si,0,An),new I(An,si,0),new I(-An,si,0)];class wo{constructor(e){this._renderer=e,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(e,t=0,n=.1,r=100){xs=this._renderer.getRenderTarget(),vs=this._renderer.getActiveCubeFace(),Ms=this._renderer.getActiveMipmapLevel(),Ss=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Po(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Ro(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(xs,vs,Ms),this._renderer.xr.enabled=Ss,e.scissorTest=!1,pr(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===pi||e.mapping===mi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),xs=this._renderer.getRenderTarget(),vs=this._renderer.getActiveCubeFace(),Ms=this._renderer.getActiveMipmapLevel(),Ss=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:zt,minFilter:zt,generateMipmaps:!1,type:gn,format:Xt,colorSpace:xn,depthBuffer:!1},r=Co(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Co(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Bp(s)),this._blurMaterial=zp(s,e,t)}return r}_compileMaterial(e){const t=new bt(this._lodPlanes[0],e);this._renderer.compile(t,_s)}_sceneToCubeUV(e,t,n,r){const o=new Rt(90,1,t,n),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,d=u.autoClear,h=u.toneMapping;u.getClearColor(Do),u.toneMapping=pn,u.autoClear=!1;const f=new Vi({name:"PMREM.Background",side:St,depthWrite:!1,depthTest:!1}),g=new bt(new Gi,f);let _=!1;const m=e.background;m?m.isColor&&(f.color.copy(m),e.background=null,_=!0):(f.color.copy(Do),_=!0);for(let p=0;p<6;p++){const E=p%3;E===0?(o.up.set(0,l[p],0),o.lookAt(c[p],0,0)):E===1?(o.up.set(0,0,l[p]),o.lookAt(0,c[p],0)):(o.up.set(0,l[p],0),o.lookAt(0,0,c[p]));const v=this._cubeSize;pr(r,E*v,p>2?v:0,v,v),u.setRenderTarget(r),_&&u.render(g,o),u.render(e,o)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=h,u.autoClear=d,e.background=m}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===pi||e.mapping===mi;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Po()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Ro());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new bt(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;pr(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,_s)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let r=1;r<this._lodPlanes.length;r++){const s=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),a=Ao[(r-1)%Ao.length];this._blur(e,r-1,r,s,a)}t.autoClear=n}_blur(e,t,n,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",s),this._halfBlur(a,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,d=new bt(this._lodPlanes[r],c),h=c.uniforms,f=this._sizeLods[n]-1,g=isFinite(s)?Math.PI/(2*f):2*Math.PI/(2*Cn-1),_=s/g,m=isFinite(s)?1+Math.floor(u*_):Cn;m>Cn&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Cn}`);const p=[];let E=0;for(let A=0;A<Cn;++A){const P=A/_,y=Math.exp(-P*P/2);p.push(y),A===0?E+=y:A<m&&(E+=2*y)}for(let A=0;A<p.length;A++)p[A]=p[A]/E;h.envMap.value=e.texture,h.samples.value=m,h.weights.value=p,h.latitudinal.value=a==="latitudinal",o&&(h.poleAxis.value=o);const{_lodMax:v}=this;h.dTheta.value=g,h.mipInt.value=v-n;const b=this._sizeLods[r],R=3*b*(r>v-li?r-v+li:0),T=4*(this._cubeSize-b);pr(t,R,T,3*b,2*b),l.setRenderTarget(t),l.render(d,_s)}}function Bp(i){const e=[],t=[],n=[];let r=i;const s=i-li+1+To.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);t.push(o);let l=1/o;a>i-li?l=To[a-i+li-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),u=-c,d=1+c,h=[u,u,d,u,d,d,u,u,d,d,u,d],f=6,g=6,_=3,m=2,p=1,E=new Float32Array(_*g*f),v=new Float32Array(m*g*f),b=new Float32Array(p*g*f);for(let T=0;T<f;T++){const A=T%3*2/3-1,P=T>2?0:-1,y=[A,P,0,A+2/3,P,0,A+2/3,P+1,0,A,P,0,A+2/3,P+1,0,A,P+1,0];E.set(y,_*g*T),v.set(h,m*g*T);const M=[T,T,T,T,T,T];b.set(M,p*g*T)}const R=new _t;R.setAttribute("position",new Et(E,_)),R.setAttribute("uv",new Et(v,m)),R.setAttribute("faceIndex",new Et(b,p)),e.push(R),r>li&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Co(i,e,t){const n=new Ht(i,e,t);return n.texture.mapping=Nr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function pr(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function zp(i,e,t){const n=new Float32Array(Cn),r=new I(0,1,0);return new ft({name:"SphericalGaussianBlur",defines:{n:Cn,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:na(),fragmentShader:`
|
|
3550
3550
|
|
|
3551
3551
|
precision mediump float;
|
|
3552
3552
|
precision mediump int;
|
|
@@ -3606,7 +3606,7 @@ void main() {
|
|
|
3606
3606
|
}
|
|
3607
3607
|
|
|
3608
3608
|
}
|
|
3609
|
-
`,blending:en,depthTest:!1,depthWrite:!1})}function
|
|
3609
|
+
`,blending:en,depthTest:!1,depthWrite:!1})}function Ro(){return new ft({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:na(),fragmentShader:`
|
|
3610
3610
|
|
|
3611
3611
|
precision mediump float;
|
|
3612
3612
|
precision mediump int;
|
|
@@ -3625,7 +3625,7 @@ void main() {
|
|
|
3625
3625
|
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
|
3626
3626
|
|
|
3627
3627
|
}
|
|
3628
|
-
`,blending:en,depthTest:!1,depthWrite:!1})}function
|
|
3628
|
+
`,blending:en,depthTest:!1,depthWrite:!1})}function Po(){return new ft({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:na(),fragmentShader:`
|
|
3629
3629
|
|
|
3630
3630
|
precision mediump float;
|
|
3631
3631
|
precision mediump int;
|
|
@@ -3641,7 +3641,7 @@ void main() {
|
|
|
3641
3641
|
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
|
|
3642
3642
|
|
|
3643
3643
|
}
|
|
3644
|
-
`,blending:en,depthTest:!1,depthWrite:!1})}function
|
|
3644
|
+
`,blending:en,depthTest:!1,depthWrite:!1})}function na(){return`
|
|
3645
3645
|
|
|
3646
3646
|
precision mediump float;
|
|
3647
3647
|
precision mediump int;
|
|
@@ -3696,15 +3696,15 @@ void main() {
|
|
|
3696
3696
|
gl_Position = vec4( position, 1.0 );
|
|
3697
3697
|
|
|
3698
3698
|
}
|
|
3699
|
-
`}function ap(i){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===Fs||l===Us,h=l===fi||l===pi;if(c||h){let d=e.get(o);const u=d!==void 0?d.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==u)return t===null&&(t=new _o(i)),d=c?t.fromEquirectangular(o,d):t.fromCubemap(o,d),d.texture.pmremVersion=o.pmremVersion,e.set(o,d),d.texture;if(d!==void 0)return d.texture;{const p=o.image;return c&&p&&p.height>0||h&&p&&r(p)?(t===null&&(t=new _o(i)),d=c?t.fromEquirectangular(o):t.fromCubemap(o),d.texture.pmremVersion=o.pmremVersion,e.set(o,d),o.addEventListener("dispose",s),d.texture):null}}}return o}function r(o){let l=0;const c=6;for(let h=0;h<c;h++)o[h]!==void 0&&l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function op(i){const e={};function t(n){if(e[n]!==void 0)return e[n];let r;switch(n){case"WEBGL_depth_texture":r=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=i.getExtension(n)}return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const r=t(n);return r===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function lp(i,e,t,n){const r={},s=new WeakMap;function a(d){const u=d.target;u.index!==null&&e.remove(u.index);for(const _ in u.attributes)e.remove(u.attributes[_]);for(const _ in u.morphAttributes){const v=u.morphAttributes[_];for(let m=0,f=v.length;m<f;m++)e.remove(v[m])}u.removeEventListener("dispose",a),delete r[u.id];const p=s.get(u);p&&(e.remove(p),s.delete(u)),n.releaseStatesOfGeometry(u),u.isInstancedBufferGeometry===!0&&delete u._maxInstanceCount,t.memory.geometries--}function o(d,u){return r[u.id]===!0||(u.addEventListener("dispose",a),r[u.id]=!0,t.memory.geometries++),u}function l(d){const u=d.attributes;for(const _ in u)e.update(u[_],i.ARRAY_BUFFER);const p=d.morphAttributes;for(const _ in p){const v=p[_];for(let m=0,f=v.length;m<f;m++)e.update(v[m],i.ARRAY_BUFFER)}}function c(d){const u=[],p=d.index,_=d.attributes.position;let v=0;if(p!==null){const b=p.array;v=p.version;for(let x=0,D=b.length;x<D;x+=3){const P=b[x+0],T=b[x+1],w=b[x+2];u.push(P,T,T,w,w,P)}}else if(_!==void 0){const b=_.array;v=_.version;for(let x=0,D=b.length/3-1;x<D;x+=3){const P=x+0,T=x+1,w=x+2;u.push(P,T,T,w,w,P)}}else return;const m=new(pl(u)?Ml:xl)(u,1);m.version=v;const f=s.get(d);f&&e.remove(f),s.set(d,m)}function h(d){const u=s.get(d);if(u){const p=d.index;p!==null&&u.version<p.version&&c(d)}else c(d);return s.get(d)}return{get:o,update:l,getWireframeAttribute:h}}function cp(i,e,t){let n;function r(d){n=d}let s,a;function o(d){s=d.type,a=d.bytesPerElement}function l(d,u){i.drawElements(n,u,s,d*a),t.update(u,n,1)}function c(d,u,p){p!==0&&(i.drawElementsInstanced(n,u,s,d*a,p),t.update(u,n,p))}function h(d,u,p){if(p===0)return;const _=e.get("WEBGL_multi_draw");if(_===null)for(let v=0;v<p;v++)this.render(d[v]/a,u[v]);else{_.multiDrawElementsWEBGL(n,u,0,s,d,0,p);let v=0;for(let m=0;m<p;m++)v+=u[m];t.update(v,n,1)}}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=h}function up(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case i.TRIANGLES:t.triangles+=o*(s/3);break;case i.LINES:t.lines+=o*(s/2);break;case i.LINE_STRIP:t.lines+=o*(s-1);break;case i.LINE_LOOP:t.lines+=o*s;break;case i.POINTS:t.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function hp(i,e,t){const n=new WeakMap,r=new dt;function s(a,o,l){const c=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,d=h!==void 0?h.length:0;let u=n.get(o);if(u===void 0||u.count!==d){let E=function(){w.dispose(),n.delete(o),o.removeEventListener("dispose",E)};u!==void 0&&u.texture.dispose();const p=o.morphAttributes.position!==void 0,_=o.morphAttributes.normal!==void 0,v=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],f=o.morphAttributes.normal||[],b=o.morphAttributes.color||[];let x=0;p===!0&&(x=1),_===!0&&(x=2),v===!0&&(x=3);let D=o.attributes.position.count*x,P=1;D>e.maxTextureSize&&(P=Math.ceil(D/e.maxTextureSize),D=e.maxTextureSize);const T=new Float32Array(D*P*4*d),w=new gl(T,D,P,d);w.type=pn,w.needsUpdate=!0;const L=x*4;for(let M=0;M<d;M++){const N=m[M],I=f[M],C=b[M],z=D*P*4*M;for(let V=0;V<N.count;V++){const q=V*L;p===!0&&(r.fromBufferAttribute(N,V),T[z+q+0]=r.x,T[z+q+1]=r.y,T[z+q+2]=r.z,T[z+q+3]=0),_===!0&&(r.fromBufferAttribute(I,V),T[z+q+4]=r.x,T[z+q+5]=r.y,T[z+q+6]=r.z,T[z+q+7]=0),v===!0&&(r.fromBufferAttribute(C,V),T[z+q+8]=r.x,T[z+q+9]=r.y,T[z+q+10]=r.z,T[z+q+11]=C.itemSize===4?r.w:1)}}u={count:d,texture:w,size:new ue(D,P)},n.set(o,u),o.addEventListener("dispose",E)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let p=0;for(let v=0;v<c.length;v++)p+=c[v];const _=o.morphTargetsRelative?1:1-p;l.getUniforms().setValue(i,"morphTargetBaseInfluence",_),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",u.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",u.size)}return{update:s}}function dp(i,e,t,n){let r=new WeakMap;function s(l){const c=n.render.frame,h=l.geometry,d=e.get(l,h);if(r.get(d)!==c&&(e.update(d),r.set(d,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),r.get(l)!==c&&(t.update(l.instanceMatrix,i.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,i.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const u=l.skeleton;r.get(u)!==c&&(u.update(),r.set(u,c))}return d}function a(){r=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:a}}class Al extends Dt{constructor(e,t,n,r,s,a,o,l,c,h){if(h=h!==void 0?h:ui,h!==ui&&h!==Fi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&h===ui&&(n=mi),n===void 0&&h===Fi&&(n=Ii),super(null,r,s,a,o,l,h,n,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:Nt,this.minFilter=l!==void 0?l:Nt,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const wl=new Dt,Cl=new Al(1,1);Cl.compareFunction=dl;const Rl=new gl,Pl=new Zu,Ll=new yl,So=[],Eo=[],yo=new Float32Array(16),bo=new Float32Array(9),Do=new Float32Array(4);function xi(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=So[r];if(s===void 0&&(s=new Float32Array(r),So[r]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,i[a].toArray(s,o)}return s}function at(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function ot(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function Ir(i,e){let t=Eo[e];t===void 0&&(t=new Int32Array(e),Eo[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function fp(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function pp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(at(t,e))return;i.uniform2fv(this.addr,e),ot(t,e)}}function mp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(at(t,e))return;i.uniform3fv(this.addr,e),ot(t,e)}}function gp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(at(t,e))return;i.uniform4fv(this.addr,e),ot(t,e)}}function _p(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(at(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),ot(t,e)}else{if(at(t,n))return;Do.set(n),i.uniformMatrix2fv(this.addr,!1,Do),ot(t,n)}}function vp(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(at(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),ot(t,e)}else{if(at(t,n))return;bo.set(n),i.uniformMatrix3fv(this.addr,!1,bo),ot(t,n)}}function xp(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(at(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),ot(t,e)}else{if(at(t,n))return;yo.set(n),i.uniformMatrix4fv(this.addr,!1,yo),ot(t,n)}}function Mp(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function Sp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(at(t,e))return;i.uniform2iv(this.addr,e),ot(t,e)}}function Ep(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(at(t,e))return;i.uniform3iv(this.addr,e),ot(t,e)}}function yp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(at(t,e))return;i.uniform4iv(this.addr,e),ot(t,e)}}function bp(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function Dp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(at(t,e))return;i.uniform2uiv(this.addr,e),ot(t,e)}}function Tp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(at(t,e))return;i.uniform3uiv(this.addr,e),ot(t,e)}}function Ap(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(at(t,e))return;i.uniform4uiv(this.addr,e),ot(t,e)}}function wp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);const s=this.type===i.SAMPLER_2D_SHADOW?Cl:wl;t.setTexture2D(e||s,r)}function Cp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||Pl,r)}function Rp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||Ll,r)}function Pp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||Rl,r)}function Lp(i){switch(i){case 5126:return fp;case 35664:return pp;case 35665:return mp;case 35666:return gp;case 35674:return _p;case 35675:return vp;case 35676:return xp;case 5124:case 35670:return Mp;case 35667:case 35671:return Sp;case 35668:case 35672:return Ep;case 35669:case 35673:return yp;case 5125:return bp;case 36294:return Dp;case 36295:return Tp;case 36296:return Ap;case 35678:case 36198:case 36298:case 36306:case 35682:return wp;case 35679:case 36299:case 36307:return Cp;case 35680:case 36300:case 36308:case 36293:return Rp;case 36289:case 36303:case 36311:case 36292:return Pp}}function Fp(i,e){i.uniform1fv(this.addr,e)}function Up(i,e){const t=xi(e,this.size,2);i.uniform2fv(this.addr,t)}function Np(i,e){const t=xi(e,this.size,3);i.uniform3fv(this.addr,t)}function Ip(i,e){const t=xi(e,this.size,4);i.uniform4fv(this.addr,t)}function Op(i,e){const t=xi(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function Bp(i,e){const t=xi(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function zp(i,e){const t=xi(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function kp(i,e){i.uniform1iv(this.addr,e)}function Hp(i,e){i.uniform2iv(this.addr,e)}function Vp(i,e){i.uniform3iv(this.addr,e)}function Gp(i,e){i.uniform4iv(this.addr,e)}function Wp(i,e){i.uniform1uiv(this.addr,e)}function Xp(i,e){i.uniform2uiv(this.addr,e)}function Yp(i,e){i.uniform3uiv(this.addr,e)}function jp(i,e){i.uniform4uiv(this.addr,e)}function qp(i,e,t){const n=this.cache,r=e.length,s=Ir(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTexture2D(e[a]||wl,s[a])}function $p(i,e,t){const n=this.cache,r=e.length,s=Ir(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||Pl,s[a])}function Kp(i,e,t){const n=this.cache,r=e.length,s=Ir(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||Ll,s[a])}function Zp(i,e,t){const n=this.cache,r=e.length,s=Ir(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||Rl,s[a])}function Jp(i){switch(i){case 5126:return Fp;case 35664:return Up;case 35665:return Np;case 35666:return Ip;case 35674:return Op;case 35675:return Bp;case 35676:return zp;case 5124:case 35670:return kp;case 35667:case 35671:return Hp;case 35668:case 35672:return Vp;case 35669:case 35673:return Gp;case 5125:return Wp;case 36294:return Xp;case 36295:return Yp;case 36296:return jp;case 35678:case 36198:case 36298:case 36306:case 35682:return qp;case 35679:case 36299:case 36307:return $p;case 35680:case 36300:case 36308:case 36293:return Kp;case 36289:case 36303:case 36311:case 36292:return Zp}}class Qp{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=Lp(t.type)}}class em{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Jp(t.type)}}class tm{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,t[o.id],n)}}}const vs=/(\w+)(\])?(\[|\.)?/g;function To(i,e){i.seq.push(e),i.map[e.id]=e}function nm(i,e,t){const n=i.name,r=n.length;for(vs.lastIndex=0;;){const s=vs.exec(n),a=vs.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){To(t,c===void 0?new Qp(o,i,e):new em(o,i,e));break}else{let d=t.map[o];d===void 0&&(d=new tm(o),To(t,d)),t=d}}}class Er{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){const s=e.getActiveUniform(t,r),a=e.getUniformLocation(t,s.name);nm(s,a,this)}}setValue(e,t,n,r){const s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=n[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&n.push(a)}return n}}function Ao(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const im=37297;let rm=0;function sm(i,e){const t=i.split(`
|
|
3699
|
+
`}function kp(i){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===Hs||l===Vs,u=l===pi||l===mi;if(c||u){let d=e.get(o);const h=d!==void 0?d.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==h)return t===null&&(t=new wo(i)),d=c?t.fromEquirectangular(o,d):t.fromCubemap(o,d),d.texture.pmremVersion=o.pmremVersion,e.set(o,d),d.texture;if(d!==void 0)return d.texture;{const f=o.image;return c&&f&&f.height>0||u&&f&&r(f)?(t===null&&(t=new wo(i)),d=c?t.fromEquirectangular(o):t.fromCubemap(o),d.texture.pmremVersion=o.pmremVersion,e.set(o,d),o.addEventListener("dispose",s),d.texture):null}}}return o}function r(o){let l=0;const c=6;for(let u=0;u<c;u++)o[u]!==void 0&&l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function Hp(i){const e={};function t(n){if(e[n]!==void 0)return e[n];let r;switch(n){case"WEBGL_depth_texture":r=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=i.getExtension(n)}return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const r=t(n);return r===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function Vp(i,e,t,n){const r={},s=new WeakMap;function a(d){const h=d.target;h.index!==null&&e.remove(h.index);for(const g in h.attributes)e.remove(h.attributes[g]);for(const g in h.morphAttributes){const _=h.morphAttributes[g];for(let m=0,p=_.length;m<p;m++)e.remove(_[m])}h.removeEventListener("dispose",a),delete r[h.id];const f=s.get(h);f&&(e.remove(f),s.delete(h)),n.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,t.memory.geometries--}function o(d,h){return r[h.id]===!0||(h.addEventListener("dispose",a),r[h.id]=!0,t.memory.geometries++),h}function l(d){const h=d.attributes;for(const g in h)e.update(h[g],i.ARRAY_BUFFER);const f=d.morphAttributes;for(const g in f){const _=f[g];for(let m=0,p=_.length;m<p;m++)e.update(_[m],i.ARRAY_BUFFER)}}function c(d){const h=[],f=d.index,g=d.attributes.position;let _=0;if(f!==null){const E=f.array;_=f.version;for(let v=0,b=E.length;v<b;v+=3){const R=E[v+0],T=E[v+1],A=E[v+2];h.push(R,T,T,A,A,R)}}else if(g!==void 0){const E=g.array;_=g.version;for(let v=0,b=E.length/3-1;v<b;v+=3){const R=v+0,T=v+1,A=v+2;h.push(R,T,T,A,A,R)}}else return;const m=new(Wl(h)?Zl:Kl)(h,1);m.version=_;const p=s.get(d);p&&e.remove(p),s.set(d,m)}function u(d){const h=s.get(d);if(h){const f=d.index;f!==null&&h.version<f.version&&c(d)}else c(d);return s.get(d)}return{get:o,update:l,getWireframeAttribute:u}}function Gp(i,e,t){let n;function r(d){n=d}let s,a;function o(d){s=d.type,a=d.bytesPerElement}function l(d,h){i.drawElements(n,h,s,d*a),t.update(h,n,1)}function c(d,h,f){f!==0&&(i.drawElementsInstanced(n,h,s,d*a,f),t.update(h,n,f))}function u(d,h,f){if(f===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let _=0;_<f;_++)this.render(d[_]/a,h[_]);else{g.multiDrawElementsWEBGL(n,h,0,s,d,0,f);let _=0;for(let m=0;m<f;m++)_+=h[m];t.update(_,n,1)}}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=u}function Wp(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case i.TRIANGLES:t.triangles+=o*(s/3);break;case i.LINES:t.lines+=o*(s/2);break;case i.LINE_STRIP:t.lines+=o*(s-1);break;case i.LINE_LOOP:t.lines+=o*s;break;case i.POINTS:t.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function Xp(i,e,t){const n=new WeakMap,r=new dt;function s(a,o,l){const c=a.morphTargetInfluences,u=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,d=u!==void 0?u.length:0;let h=n.get(o);if(h===void 0||h.count!==d){let y=function(){A.dispose(),n.delete(o),o.removeEventListener("dispose",y)};h!==void 0&&h.texture.dispose();const f=o.morphAttributes.position!==void 0,g=o.morphAttributes.normal!==void 0,_=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],p=o.morphAttributes.normal||[],E=o.morphAttributes.color||[];let v=0;f===!0&&(v=1),g===!0&&(v=2),_===!0&&(v=3);let b=o.attributes.position.count*v,R=1;b>e.maxTextureSize&&(R=Math.ceil(b/e.maxTextureSize),b=e.maxTextureSize);const T=new Float32Array(b*R*4*d),A=new ql(T,b,R,d);A.type=fn,A.needsUpdate=!0;const P=v*4;for(let M=0;M<d;M++){const F=m[M],L=p[M],C=E[M],U=b*R*4*M;for(let H=0;H<F.count;H++){const Y=H*P;f===!0&&(r.fromBufferAttribute(F,H),T[U+Y+0]=r.x,T[U+Y+1]=r.y,T[U+Y+2]=r.z,T[U+Y+3]=0),g===!0&&(r.fromBufferAttribute(L,H),T[U+Y+4]=r.x,T[U+Y+5]=r.y,T[U+Y+6]=r.z,T[U+Y+7]=0),_===!0&&(r.fromBufferAttribute(C,H),T[U+Y+8]=r.x,T[U+Y+9]=r.y,T[U+Y+10]=r.z,T[U+Y+11]=C.itemSize===4?r.w:1)}}h={count:d,texture:A,size:new ue(b,R)},n.set(o,h),o.addEventListener("dispose",y)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let f=0;for(let _=0;_<c.length;_++)f+=c[_];const g=o.morphTargetsRelative?1:1-f;l.getUniforms().setValue(i,"morphTargetBaseInfluence",g),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",h.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",h.size)}return{update:s}}function qp(i,e,t,n){let r=new WeakMap;function s(l){const c=n.render.frame,u=l.geometry,d=e.get(l,u);if(r.get(d)!==c&&(e.update(d),r.set(d,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),r.get(l)!==c&&(t.update(l.instanceMatrix,i.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,i.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const h=l.skeleton;r.get(h)!==c&&(h.update(),r.set(h,c))}return d}function a(){r=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:a}}class rc extends Tt{constructor(e,t,n,r,s,a,o,l,c,u){if(u=u!==void 0?u:hi,u!==hi&&u!==Ni)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&u===hi&&(n=gi),n===void 0&&u===Ni&&(n=zi),super(null,r,s,a,o,l,u,n,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:Ut,this.minFilter=l!==void 0?l:Ut,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const sc=new Tt,ac=new rc(1,1);ac.compareFunction=Vl;const oc=new ql,lc=new Ph,cc=new ec,Lo=[],Fo=[],Io=new Float32Array(16),Uo=new Float32Array(9),No=new Float32Array(4);function Mi(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=Lo[r];if(s===void 0&&(s=new Float32Array(r),Lo[r]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,i[a].toArray(s,o)}return s}function at(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function ot(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function kr(i,e){let t=Fo[e];t===void 0&&(t=new Int32Array(e),Fo[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function Yp(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function $p(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(at(t,e))return;i.uniform2fv(this.addr,e),ot(t,e)}}function jp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(at(t,e))return;i.uniform3fv(this.addr,e),ot(t,e)}}function Kp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(at(t,e))return;i.uniform4fv(this.addr,e),ot(t,e)}}function Zp(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(at(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),ot(t,e)}else{if(at(t,n))return;No.set(n),i.uniformMatrix2fv(this.addr,!1,No),ot(t,n)}}function Jp(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(at(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),ot(t,e)}else{if(at(t,n))return;Uo.set(n),i.uniformMatrix3fv(this.addr,!1,Uo),ot(t,n)}}function Qp(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(at(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),ot(t,e)}else{if(at(t,n))return;Io.set(n),i.uniformMatrix4fv(this.addr,!1,Io),ot(t,n)}}function em(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function tm(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(at(t,e))return;i.uniform2iv(this.addr,e),ot(t,e)}}function nm(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(at(t,e))return;i.uniform3iv(this.addr,e),ot(t,e)}}function im(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(at(t,e))return;i.uniform4iv(this.addr,e),ot(t,e)}}function rm(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function sm(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(at(t,e))return;i.uniform2uiv(this.addr,e),ot(t,e)}}function am(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(at(t,e))return;i.uniform3uiv(this.addr,e),ot(t,e)}}function om(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(at(t,e))return;i.uniform4uiv(this.addr,e),ot(t,e)}}function lm(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);const s=this.type===i.SAMPLER_2D_SHADOW?ac:sc;t.setTexture2D(e||s,r)}function cm(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||lc,r)}function um(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||cc,r)}function hm(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||oc,r)}function dm(i){switch(i){case 5126:return Yp;case 35664:return $p;case 35665:return jp;case 35666:return Kp;case 35674:return Zp;case 35675:return Jp;case 35676:return Qp;case 5124:case 35670:return em;case 35667:case 35671:return tm;case 35668:case 35672:return nm;case 35669:case 35673:return im;case 5125:return rm;case 36294:return sm;case 36295:return am;case 36296:return om;case 35678:case 36198:case 36298:case 36306:case 35682:return lm;case 35679:case 36299:case 36307:return cm;case 35680:case 36300:case 36308:case 36293:return um;case 36289:case 36303:case 36311:case 36292:return hm}}function fm(i,e){i.uniform1fv(this.addr,e)}function pm(i,e){const t=Mi(e,this.size,2);i.uniform2fv(this.addr,t)}function mm(i,e){const t=Mi(e,this.size,3);i.uniform3fv(this.addr,t)}function gm(i,e){const t=Mi(e,this.size,4);i.uniform4fv(this.addr,t)}function _m(i,e){const t=Mi(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function xm(i,e){const t=Mi(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function vm(i,e){const t=Mi(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function Mm(i,e){i.uniform1iv(this.addr,e)}function Sm(i,e){i.uniform2iv(this.addr,e)}function ym(i,e){i.uniform3iv(this.addr,e)}function Em(i,e){i.uniform4iv(this.addr,e)}function bm(i,e){i.uniform1uiv(this.addr,e)}function Tm(i,e){i.uniform2uiv(this.addr,e)}function Dm(i,e){i.uniform3uiv(this.addr,e)}function Am(i,e){i.uniform4uiv(this.addr,e)}function wm(i,e,t){const n=this.cache,r=e.length,s=kr(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTexture2D(e[a]||sc,s[a])}function Cm(i,e,t){const n=this.cache,r=e.length,s=kr(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||lc,s[a])}function Rm(i,e,t){const n=this.cache,r=e.length,s=kr(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||cc,s[a])}function Pm(i,e,t){const n=this.cache,r=e.length,s=kr(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||oc,s[a])}function Lm(i){switch(i){case 5126:return fm;case 35664:return pm;case 35665:return mm;case 35666:return gm;case 35674:return _m;case 35675:return xm;case 35676:return vm;case 5124:case 35670:return Mm;case 35667:case 35671:return Sm;case 35668:case 35672:return ym;case 35669:case 35673:return Em;case 5125:return bm;case 36294:return Tm;case 36295:return Dm;case 36296:return Am;case 35678:case 36198:case 36298:case 36306:case 35682:return wm;case 35679:case 36299:case 36307:return Cm;case 35680:case 36300:case 36308:case 36293:return Rm;case 36289:case 36303:case 36311:case 36292:return Pm}}class Fm{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=dm(t.type)}}class Im{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Lm(t.type)}}class Um{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,t[o.id],n)}}}const ys=/(\w+)(\])?(\[|\.)?/g;function Oo(i,e){i.seq.push(e),i.map[e.id]=e}function Nm(i,e,t){const n=i.name,r=n.length;for(ys.lastIndex=0;;){const s=ys.exec(n),a=ys.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){Oo(t,c===void 0?new Fm(o,i,e):new Im(o,i,e));break}else{let d=t.map[o];d===void 0&&(d=new Um(o),Oo(t,d)),t=d}}}class Tr{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){const s=e.getActiveUniform(t,r),a=e.getUniformLocation(t,s.name);Nm(s,a,this)}}setValue(e,t,n,r){const s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=n[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&n.push(a)}return n}}function Bo(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const Om=37297;let Bm=0;function zm(i,e){const t=i.split(`
|
|
3700
3700
|
`),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=r;a<s;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(`
|
|
3701
|
-
`)}function
|
|
3701
|
+
`)}function km(i){const e=je.getPrimaries(je.workingColorSpace),t=je.getPrimaries(i);let n;switch(e===t?n="":e===Rr&&t===Cr?n="LinearDisplayP3ToLinearSRGB":e===Cr&&t===Rr&&(n="LinearSRGBToLinearDisplayP3"),i){case xn:case Or:return[n,"LinearTransferOETF"];case It:case ea:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",i),[n,"LinearTransferOETF"]}}function zo(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),r=i.getShaderInfoLog(e).trim();if(n&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return t.toUpperCase()+`
|
|
3702
3702
|
|
|
3703
3703
|
`+r+`
|
|
3704
3704
|
|
|
3705
|
-
`+
|
|
3706
|
-
`)}function
|
|
3707
|
-
`)}function
|
|
3705
|
+
`+zm(i.getShaderSource(e),a)}else return r}function Hm(i,e){const t=km(e);return`vec4 ${i}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function Vm(i,e){let t;switch(e){case Iu:t="Linear";break;case Uu:t="Reinhard";break;case Nu:t="OptimizedCineon";break;case Qs:t="ACESFilmic";break;case Bu:t="AgX";break;case zu:t="Neutral";break;case Ou:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function Gm(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Ri).join(`
|
|
3706
|
+
`)}function Wm(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
|
|
3707
|
+
`)}function Xm(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const s=i.getActiveAttrib(e,r),a=s.name;let o=1;s.type===i.FLOAT_MAT2&&(o=2),s.type===i.FLOAT_MAT3&&(o=3),s.type===i.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:i.getAttribLocation(e,a),locationSize:o}}return t}function Ri(i){return i!==""}function ko(i,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Ho(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const qm=/^[ \t]*#include +<([\w\d./]+)>/gm;function Xs(i){return i.replace(qm,$m)}const Ym=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function $m(i,e){let t=Oe[e];if(t===void 0){const n=Ym.get(e);if(n!==void 0)t=Oe[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Xs(t)}const jm=/#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 Vo(i){return i.replace(jm,Km)}function Km(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function Go(i){let e=`precision ${i.precision} float;
|
|
3708
3708
|
precision ${i.precision} int;
|
|
3709
3709
|
precision ${i.precision} sampler2D;
|
|
3710
3710
|
precision ${i.precision} samplerCube;
|
|
@@ -3724,30 +3724,30 @@ void main() {
|
|
|
3724
3724
|
`;return i.precision==="highp"?e+=`
|
|
3725
3725
|
#define HIGH_PRECISION`:i.precision==="mediump"?e+=`
|
|
3726
3726
|
#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=`
|
|
3727
|
-
#define LOW_PRECISION`),e}function
|
|
3728
|
-
`:"";t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,
|
|
3727
|
+
#define LOW_PRECISION`),e}function Zm(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===Pl?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===au?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===Jt&&(e="SHADOWMAP_TYPE_VSM"),e}function Jm(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case pi:case mi:e="ENVMAP_TYPE_CUBE";break;case Nr:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Qm(i){let e="ENVMAP_MODE_REFLECTION";return i.envMap&&i.envMapMode===mi&&(e="ENVMAP_MODE_REFRACTION"),e}function e0(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case Ll:e="ENVMAP_BLENDING_MULTIPLY";break;case Lu:e="ENVMAP_BLENDING_MIX";break;case Fu:e="ENVMAP_BLENDING_ADD";break}return e}function t0(i){const e=i.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function n0(i,e,t,n){const r=i.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=Zm(t),c=Jm(t),u=Qm(t),d=e0(t),h=t0(t),f=Gm(t),g=Wm(s),_=r.createProgram();let m,p,E=t.glslVersion?"#version "+t.glslVersion+`
|
|
3728
|
+
`:"";t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Ri).join(`
|
|
3729
3729
|
`),m.length>0&&(m+=`
|
|
3730
|
-
`),
|
|
3731
|
-
`),
|
|
3732
|
-
`)):(m=[
|
|
3733
|
-
`].filter(
|
|
3734
|
-
`),
|
|
3735
|
-
`].filter(
|
|
3736
|
-
`)),a=
|
|
3737
|
-
`,m=[
|
|
3730
|
+
`),p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Ri).join(`
|
|
3731
|
+
`),p.length>0&&(p+=`
|
|
3732
|
+
`)):(m=[Go(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
|
|
3733
|
+
`].filter(Ri).join(`
|
|
3734
|
+
`),p=[Go(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+d:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==pn?"#define TONE_MAPPING":"",t.toneMapping!==pn?Oe.tonemapping_pars_fragment:"",t.toneMapping!==pn?Vm("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Oe.colorspace_pars_fragment,Hm("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
|
|
3735
|
+
`].filter(Ri).join(`
|
|
3736
|
+
`)),a=Xs(a),a=ko(a,t),a=Ho(a,t),o=Xs(o),o=ko(o,t),o=Ho(o,t),a=Vo(a),o=Vo(o),t.isRawShaderMaterial!==!0&&(E=`#version 300 es
|
|
3737
|
+
`,m=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(`
|
|
3738
3738
|
`)+`
|
|
3739
|
-
`+m,
|
|
3739
|
+
`+m,p=["#define varying in",t.glslVersion===io?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===io?"":"#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(`
|
|
3740
3740
|
`)+`
|
|
3741
|
-
`+
|
|
3741
|
+
`+p);const v=E+m+a,b=E+p+o,R=Bo(r,r.VERTEX_SHADER,v),T=Bo(r,r.FRAGMENT_SHADER,b);r.attachShader(_,R),r.attachShader(_,T),t.index0AttributeName!==void 0?r.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(_,0,"position"),r.linkProgram(_);function A(F){if(i.debug.checkShaderErrors){const L=r.getProgramInfoLog(_).trim(),C=r.getShaderInfoLog(R).trim(),U=r.getShaderInfoLog(T).trim();let H=!0,Y=!0;if(r.getProgramParameter(_,r.LINK_STATUS)===!1)if(H=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,_,R,T);else{const J=zo(r,R,"vertex"),z=zo(r,T,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(_,r.VALIDATE_STATUS)+`
|
|
3742
3742
|
|
|
3743
|
-
Material Name: `+
|
|
3744
|
-
Material Type: `+
|
|
3743
|
+
Material Name: `+F.name+`
|
|
3744
|
+
Material Type: `+F.type+`
|
|
3745
3745
|
|
|
3746
|
-
Program Info Log: `+
|
|
3747
|
-
`+
|
|
3748
|
-
`+B)}else I!==""?console.warn("THREE.WebGLProgram: Program Info Log:",I):(C===""||z==="")&&(q=!1);q&&(N.diagnostics={runnable:V,programLog:I,vertexShader:{log:C,prefix:m},fragmentShader:{log:z,prefix:f}})}r.deleteShader(P),r.deleteShader(T),L=new Er(r,v),E=hm(r,v)}let L;this.getUniforms=function(){return L===void 0&&w(this),L};let E;this.getAttributes=function(){return E===void 0&&w(this),E};let M=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=r.getProgramParameter(v,im)),M},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(v),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=rm++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=P,this.fragmentShader=T,this}let ym=0;class bm{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new Dm(e),t.set(e,n)),n}}class Dm{constructor(e){this.id=ym++,this.code=e,this.usedTimes=0}}function Tm(i,e,t,n,r,s,a){const o=new _l,l=new bm,c=new Set,h=[],d=r.logarithmicDepthBuffer,u=r.vertexTextures;let p=r.precision;const _={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 v(E){return c.add(E),E===0?"uv":`uv${E}`}function m(E,M,N,I,C){const z=I.fog,V=C.geometry,q=E.isMeshStandardMaterial?I.environment:null,ee=(E.isMeshStandardMaterial?t:e).get(E.envMap||q),B=ee&&ee.mapping===Lr?ee.image.height:null,$=_[E.type];E.precision!==null&&(p=r.getMaxPrecision(E.precision),p!==E.precision&&console.warn("THREE.WebGLProgram.getParameters:",E.precision,"not supported, using",p,"instead."));const j=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,F=j!==void 0?j.length:0;let Q=0;V.morphAttributes.position!==void 0&&(Q=1),V.morphAttributes.normal!==void 0&&(Q=2),V.morphAttributes.color!==void 0&&(Q=3);let pe,U,J,le;if($){const lt=Gt[$];pe=lt.vertexShader,U=lt.fragmentShader}else pe=E.vertexShader,U=E.fragmentShader,l.update(E),J=l.getVertexShaderID(E),le=l.getFragmentShaderID(E);const ne=i.getRenderTarget(),xe=C.isInstancedMesh===!0,De=C.isBatchedMesh===!0,Ce=!!E.map,k=!!E.matcap,Fe=!!ee,ve=!!E.aoMap,Ge=!!E.lightMap,ye=!!E.bumpMap,We=!!E.normalMap,A=!!E.displacementMap,S=!!E.emissiveMap,Y=!!E.metalnessMap,Z=!!E.roughnessMap,te=E.anisotropy>0,ie=E.clearcoat>0,Te=E.iridescence>0,re=E.sheen>0,Ee=E.transmission>0,Ae=te&&!!E.anisotropyMap,ae=ie&&!!E.clearcoatMap,de=ie&&!!E.clearcoatNormalMap,Re=ie&&!!E.clearcoatRoughnessMap,ge=Te&&!!E.iridescenceMap,_e=Te&&!!E.iridescenceThicknessMap,ke=re&&!!E.sheenColorMap,He=re&&!!E.sheenRoughnessMap,Ye=!!E.specularMap,Xe=!!E.specularColorMap,je=!!E.specularIntensityMap,Me=Ee&&!!E.transmissionMap,g=Ee&&!!E.thicknessMap,H=!!E.gradientMap,K=!!E.alphaMap,se=E.alphaTest>0,fe=!!E.alphaHash,Ve=!!E.extensions;let ze=mn;E.toneMapped&&(ne===null||ne.isXRRenderTarget===!0)&&(ze=i.toneMapping);const Ze={shaderID:$,shaderType:E.type,shaderName:E.name,vertexShader:pe,fragmentShader:U,defines:E.defines,customVertexShaderID:J,customFragmentShaderID:le,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:p,batching:De,instancing:xe,instancingColor:xe&&C.instanceColor!==null,instancingMorph:xe&&C.morphTexture!==null,supportsVertexTextures:u,outputColorSpace:ne===null?i.outputColorSpace:ne.isXRRenderTarget===!0?ne.texture.colorSpace:xn,alphaToCoverage:!!E.alphaToCoverage,map:Ce,matcap:k,envMap:Fe,envMapMode:Fe&&ee.mapping,envMapCubeUVHeight:B,aoMap:ve,lightMap:Ge,bumpMap:ye,normalMap:We,displacementMap:u&&A,emissiveMap:S,normalMapObjectSpace:We&&E.normalMapType===Mu,normalMapTangentSpace:We&&E.normalMapType===xu,metalnessMap:Y,roughnessMap:Z,anisotropy:te,anisotropyMap:Ae,clearcoat:ie,clearcoatMap:ae,clearcoatNormalMap:de,clearcoatRoughnessMap:Re,iridescence:Te,iridescenceMap:ge,iridescenceThicknessMap:_e,sheen:re,sheenColorMap:ke,sheenRoughnessMap:He,specularMap:Ye,specularColorMap:Xe,specularIntensityMap:je,transmission:Ee,transmissionMap:Me,thicknessMap:g,gradientMap:H,opaque:E.transparent===!1&&E.blending===li&&E.alphaToCoverage===!1,alphaMap:K,alphaTest:se,alphaHash:fe,combine:E.combine,mapUv:Ce&&v(E.map.channel),aoMapUv:ve&&v(E.aoMap.channel),lightMapUv:Ge&&v(E.lightMap.channel),bumpMapUv:ye&&v(E.bumpMap.channel),normalMapUv:We&&v(E.normalMap.channel),displacementMapUv:A&&v(E.displacementMap.channel),emissiveMapUv:S&&v(E.emissiveMap.channel),metalnessMapUv:Y&&v(E.metalnessMap.channel),roughnessMapUv:Z&&v(E.roughnessMap.channel),anisotropyMapUv:Ae&&v(E.anisotropyMap.channel),clearcoatMapUv:ae&&v(E.clearcoatMap.channel),clearcoatNormalMapUv:de&&v(E.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Re&&v(E.clearcoatRoughnessMap.channel),iridescenceMapUv:ge&&v(E.iridescenceMap.channel),iridescenceThicknessMapUv:_e&&v(E.iridescenceThicknessMap.channel),sheenColorMapUv:ke&&v(E.sheenColorMap.channel),sheenRoughnessMapUv:He&&v(E.sheenRoughnessMap.channel),specularMapUv:Ye&&v(E.specularMap.channel),specularColorMapUv:Xe&&v(E.specularColorMap.channel),specularIntensityMapUv:je&&v(E.specularIntensityMap.channel),transmissionMapUv:Me&&v(E.transmissionMap.channel),thicknessMapUv:g&&v(E.thicknessMap.channel),alphaMapUv:K&&v(E.alphaMap.channel),vertexTangents:!!V.attributes.tangent&&(We||te),vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&&!!V.attributes.color&&V.attributes.color.itemSize===4,pointsUvs:C.isPoints===!0&&!!V.attributes.uv&&(Ce||K),fog:!!z,useFog:E.fog===!0,fogExp2:!!z&&z.isFogExp2,flatShading:E.flatShading===!0,sizeAttenuation:E.sizeAttenuation===!0,logarithmicDepthBuffer:d,skinning:C.isSkinnedMesh===!0,morphTargets:V.morphAttributes.position!==void 0,morphNormals:V.morphAttributes.normal!==void 0,morphColors:V.morphAttributes.color!==void 0,morphTargetsCount:F,morphTextureStride:Q,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:E.dithering,shadowMapEnabled:i.shadowMap.enabled&&N.length>0,shadowMapType:i.shadowMap.type,toneMapping:ze,useLegacyLights:i._useLegacyLights,decodeVideoTexture:Ce&&E.map.isVideoTexture===!0&&$e.getTransfer(E.map.colorSpace)===Ke,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===Wt,flipSided:E.side===Mt,useDepthPacking:E.depthPacking>=0,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionClipCullDistance:Ve&&E.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:Ve&&E.extensions.multiDraw===!0&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:E.customProgramCacheKey()};return Ze.vertexUv1s=c.has(1),Ze.vertexUv2s=c.has(2),Ze.vertexUv3s=c.has(3),c.clear(),Ze}function f(E){const M=[];if(E.shaderID?M.push(E.shaderID):(M.push(E.customVertexShaderID),M.push(E.customFragmentShaderID)),E.defines!==void 0)for(const N in E.defines)M.push(N),M.push(E.defines[N]);return E.isRawShaderMaterial===!1&&(b(M,E),x(M,E),M.push(i.outputColorSpace)),M.push(E.customProgramCacheKey),M.join()}function b(E,M){E.push(M.precision),E.push(M.outputColorSpace),E.push(M.envMapMode),E.push(M.envMapCubeUVHeight),E.push(M.mapUv),E.push(M.alphaMapUv),E.push(M.lightMapUv),E.push(M.aoMapUv),E.push(M.bumpMapUv),E.push(M.normalMapUv),E.push(M.displacementMapUv),E.push(M.emissiveMapUv),E.push(M.metalnessMapUv),E.push(M.roughnessMapUv),E.push(M.anisotropyMapUv),E.push(M.clearcoatMapUv),E.push(M.clearcoatNormalMapUv),E.push(M.clearcoatRoughnessMapUv),E.push(M.iridescenceMapUv),E.push(M.iridescenceThicknessMapUv),E.push(M.sheenColorMapUv),E.push(M.sheenRoughnessMapUv),E.push(M.specularMapUv),E.push(M.specularColorMapUv),E.push(M.specularIntensityMapUv),E.push(M.transmissionMapUv),E.push(M.thicknessMapUv),E.push(M.combine),E.push(M.fogExp2),E.push(M.sizeAttenuation),E.push(M.morphTargetsCount),E.push(M.morphAttributeCount),E.push(M.numDirLights),E.push(M.numPointLights),E.push(M.numSpotLights),E.push(M.numSpotLightMaps),E.push(M.numHemiLights),E.push(M.numRectAreaLights),E.push(M.numDirLightShadows),E.push(M.numPointLightShadows),E.push(M.numSpotLightShadows),E.push(M.numSpotLightShadowsWithMaps),E.push(M.numLightProbes),E.push(M.shadowMapType),E.push(M.toneMapping),E.push(M.numClippingPlanes),E.push(M.numClipIntersection),E.push(M.depthPacking)}function x(E,M){o.disableAll(),M.supportsVertexTextures&&o.enable(0),M.instancing&&o.enable(1),M.instancingColor&&o.enable(2),M.instancingMorph&&o.enable(3),M.matcap&&o.enable(4),M.envMap&&o.enable(5),M.normalMapObjectSpace&&o.enable(6),M.normalMapTangentSpace&&o.enable(7),M.clearcoat&&o.enable(8),M.iridescence&&o.enable(9),M.alphaTest&&o.enable(10),M.vertexColors&&o.enable(11),M.vertexAlphas&&o.enable(12),M.vertexUv1s&&o.enable(13),M.vertexUv2s&&o.enable(14),M.vertexUv3s&&o.enable(15),M.vertexTangents&&o.enable(16),M.anisotropy&&o.enable(17),M.alphaHash&&o.enable(18),M.batching&&o.enable(19),E.push(o.mask),o.disableAll(),M.fog&&o.enable(0),M.useFog&&o.enable(1),M.flatShading&&o.enable(2),M.logarithmicDepthBuffer&&o.enable(3),M.skinning&&o.enable(4),M.morphTargets&&o.enable(5),M.morphNormals&&o.enable(6),M.morphColors&&o.enable(7),M.premultipliedAlpha&&o.enable(8),M.shadowMapEnabled&&o.enable(9),M.useLegacyLights&&o.enable(10),M.doubleSided&&o.enable(11),M.flipSided&&o.enable(12),M.useDepthPacking&&o.enable(13),M.dithering&&o.enable(14),M.transmission&&o.enable(15),M.sheen&&o.enable(16),M.opaque&&o.enable(17),M.pointsUvs&&o.enable(18),M.decodeVideoTexture&&o.enable(19),M.alphaToCoverage&&o.enable(20),E.push(o.mask)}function D(E){const M=_[E.type];let N;if(M){const I=Gt[M];N=Rr.clone(I.uniforms)}else N=E.uniforms;return N}function P(E,M){let N;for(let I=0,C=h.length;I<C;I++){const z=h[I];if(z.cacheKey===M){N=z,++N.usedTimes;break}}return N===void 0&&(N=new Em(i,M,E,s),h.push(N)),N}function T(E){if(--E.usedTimes===0){const M=h.indexOf(E);h[M]=h[h.length-1],h.pop(),E.destroy()}}function w(E){l.remove(E)}function L(){l.dispose()}return{getParameters:m,getProgramCacheKey:f,getUniforms:D,acquireProgram:P,releaseProgram:T,releaseShaderCache:w,programs:h,dispose:L}}function Am(){let i=new WeakMap;function e(s){let a=i.get(s);return a===void 0&&(a={},i.set(s,a)),a}function t(s){i.delete(s)}function n(s,a,o){i.get(s)[a]=o}function r(){i=new WeakMap}return{get:e,remove:t,update:n,dispose:r}}function wm(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.z!==e.z?i.z-e.z:i.id-e.id}function Fo(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function Uo(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function a(d,u,p,_,v,m){let f=i[e];return f===void 0?(f={id:d.id,object:d,geometry:u,material:p,groupOrder:_,renderOrder:d.renderOrder,z:v,group:m},i[e]=f):(f.id=d.id,f.object=d,f.geometry=u,f.material=p,f.groupOrder=_,f.renderOrder=d.renderOrder,f.z=v,f.group=m),e++,f}function o(d,u,p,_,v,m){const f=a(d,u,p,_,v,m);p.transmission>0?n.push(f):p.transparent===!0?r.push(f):t.push(f)}function l(d,u,p,_,v,m){const f=a(d,u,p,_,v,m);p.transmission>0?n.unshift(f):p.transparent===!0?r.unshift(f):t.unshift(f)}function c(d,u){t.length>1&&t.sort(d||wm),n.length>1&&n.sort(u||Fo),r.length>1&&r.sort(u||Fo)}function h(){for(let d=e,u=i.length;d<u;d++){const p=i[d];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:o,unshift:l,finish:h,sort:c}}function Cm(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new Uo,i.set(n,[a])):r>=s.length?(a=new Uo,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function Rm(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new R,color:new be};break;case"SpotLight":t={position:new R,direction:new R,color:new be,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new R,color:new be,distance:0,decay:0};break;case"HemisphereLight":t={direction:new R,skyColor:new be,groundColor:new be};break;case"RectAreaLight":t={color:new be,position:new R,halfWidth:new R,halfHeight:new R};break}return i[e.id]=t,t}}}function Pm(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let Lm=0;function Fm(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Um(i){const e=new Rm,t=Pm(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-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,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new R);const r=new R,s=new et,a=new et;function o(c,h){let d=0,u=0,p=0;for(let N=0;N<9;N++)n.probe[N].set(0,0,0);let _=0,v=0,m=0,f=0,b=0,x=0,D=0,P=0,T=0,w=0,L=0;c.sort(Fm);const E=h===!0?Math.PI:1;for(let N=0,I=c.length;N<I;N++){const C=c[N],z=C.color,V=C.intensity,q=C.distance,ee=C.shadow&&C.shadow.map?C.shadow.map.texture:null;if(C.isAmbientLight)d+=z.r*V*E,u+=z.g*V*E,p+=z.b*V*E;else if(C.isLightProbe){for(let B=0;B<9;B++)n.probe[B].addScaledVector(C.sh.coefficients[B],V);L++}else if(C.isDirectionalLight){const B=e.get(C);if(B.color.copy(C.color).multiplyScalar(C.intensity*E),C.castShadow){const $=C.shadow,j=t.get(C);j.shadowBias=$.bias,j.shadowNormalBias=$.normalBias,j.shadowRadius=$.radius,j.shadowMapSize=$.mapSize,n.directionalShadow[_]=j,n.directionalShadowMap[_]=ee,n.directionalShadowMatrix[_]=C.shadow.matrix,x++}n.directional[_]=B,_++}else if(C.isSpotLight){const B=e.get(C);B.position.setFromMatrixPosition(C.matrixWorld),B.color.copy(z).multiplyScalar(V*E),B.distance=q,B.coneCos=Math.cos(C.angle),B.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),B.decay=C.decay,n.spot[m]=B;const $=C.shadow;if(C.map&&(n.spotLightMap[T]=C.map,T++,$.updateMatrices(C),C.castShadow&&w++),n.spotLightMatrix[m]=$.matrix,C.castShadow){const j=t.get(C);j.shadowBias=$.bias,j.shadowNormalBias=$.normalBias,j.shadowRadius=$.radius,j.shadowMapSize=$.mapSize,n.spotShadow[m]=j,n.spotShadowMap[m]=ee,P++}m++}else if(C.isRectAreaLight){const B=e.get(C);B.color.copy(z).multiplyScalar(V),B.halfWidth.set(C.width*.5,0,0),B.halfHeight.set(0,C.height*.5,0),n.rectArea[f]=B,f++}else if(C.isPointLight){const B=e.get(C);if(B.color.copy(C.color).multiplyScalar(C.intensity*E),B.distance=C.distance,B.decay=C.decay,C.castShadow){const $=C.shadow,j=t.get(C);j.shadowBias=$.bias,j.shadowNormalBias=$.normalBias,j.shadowRadius=$.radius,j.shadowMapSize=$.mapSize,j.shadowCameraNear=$.camera.near,j.shadowCameraFar=$.camera.far,n.pointShadow[v]=j,n.pointShadowMap[v]=ee,n.pointShadowMatrix[v]=C.shadow.matrix,D++}n.point[v]=B,v++}else if(C.isHemisphereLight){const B=e.get(C);B.skyColor.copy(C.color).multiplyScalar(V*E),B.groundColor.copy(C.groundColor).multiplyScalar(V*E),n.hemi[b]=B,b++}}f>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=oe.LTC_FLOAT_1,n.rectAreaLTC2=oe.LTC_FLOAT_2):(n.rectAreaLTC1=oe.LTC_HALF_1,n.rectAreaLTC2=oe.LTC_HALF_2)),n.ambient[0]=d,n.ambient[1]=u,n.ambient[2]=p;const M=n.hash;(M.directionalLength!==_||M.pointLength!==v||M.spotLength!==m||M.rectAreaLength!==f||M.hemiLength!==b||M.numDirectionalShadows!==x||M.numPointShadows!==D||M.numSpotShadows!==P||M.numSpotMaps!==T||M.numLightProbes!==L)&&(n.directional.length=_,n.spot.length=m,n.rectArea.length=f,n.point.length=v,n.hemi.length=b,n.directionalShadow.length=x,n.directionalShadowMap.length=x,n.pointShadow.length=D,n.pointShadowMap.length=D,n.spotShadow.length=P,n.spotShadowMap.length=P,n.directionalShadowMatrix.length=x,n.pointShadowMatrix.length=D,n.spotLightMatrix.length=P+T-w,n.spotLightMap.length=T,n.numSpotLightShadowsWithMaps=w,n.numLightProbes=L,M.directionalLength=_,M.pointLength=v,M.spotLength=m,M.rectAreaLength=f,M.hemiLength=b,M.numDirectionalShadows=x,M.numPointShadows=D,M.numSpotShadows=P,M.numSpotMaps=T,M.numLightProbes=L,n.version=Lm++)}function l(c,h){let d=0,u=0,p=0,_=0,v=0;const m=h.matrixWorldInverse;for(let f=0,b=c.length;f<b;f++){const x=c[f];if(x.isDirectionalLight){const D=n.directional[d];D.direction.setFromMatrixPosition(x.matrixWorld),r.setFromMatrixPosition(x.target.matrixWorld),D.direction.sub(r),D.direction.transformDirection(m),d++}else if(x.isSpotLight){const D=n.spot[p];D.position.setFromMatrixPosition(x.matrixWorld),D.position.applyMatrix4(m),D.direction.setFromMatrixPosition(x.matrixWorld),r.setFromMatrixPosition(x.target.matrixWorld),D.direction.sub(r),D.direction.transformDirection(m),p++}else if(x.isRectAreaLight){const D=n.rectArea[_];D.position.setFromMatrixPosition(x.matrixWorld),D.position.applyMatrix4(m),a.identity(),s.copy(x.matrixWorld),s.premultiply(m),a.extractRotation(s),D.halfWidth.set(x.width*.5,0,0),D.halfHeight.set(0,x.height*.5,0),D.halfWidth.applyMatrix4(a),D.halfHeight.applyMatrix4(a),_++}else if(x.isPointLight){const D=n.point[u];D.position.setFromMatrixPosition(x.matrixWorld),D.position.applyMatrix4(m),u++}else if(x.isHemisphereLight){const D=n.hemi[v];D.direction.setFromMatrixPosition(x.matrixWorld),D.direction.transformDirection(m),v++}}}return{setup:o,setupView:l,state:n}}function No(i){const e=new Um(i),t=[],n=[];function r(){t.length=0,n.length=0}function s(h){t.push(h)}function a(h){n.push(h)}function o(h){e.setup(t,h)}function l(h){e.setupView(t,h)}return{init:r,state:{lightsArray:t,shadowsArray:n,lights:e,transmissionRenderTarget:null},setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function Nm(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new No(i),e.set(r,[o])):s>=a.length?(o=new No(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}class Im extends vi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=_u,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Om extends vi{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Bm=`void main() {
|
|
3746
|
+
Program Info Log: `+L+`
|
|
3747
|
+
`+J+`
|
|
3748
|
+
`+z)}else L!==""?console.warn("THREE.WebGLProgram: Program Info Log:",L):(C===""||U==="")&&(Y=!1);Y&&(F.diagnostics={runnable:H,programLog:L,vertexShader:{log:C,prefix:m},fragmentShader:{log:U,prefix:p}})}r.deleteShader(R),r.deleteShader(T),P=new Tr(r,_),y=Xm(r,_)}let P;this.getUniforms=function(){return P===void 0&&A(this),P};let y;this.getAttributes=function(){return y===void 0&&A(this),y};let M=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=r.getProgramParameter(_,Om)),M},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Bm++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=R,this.fragmentShader=T,this}let i0=0;class r0{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new s0(e),t.set(e,n)),n}}class s0{constructor(e){this.id=i0++,this.code=e,this.usedTimes=0}}function a0(i,e,t,n,r,s,a){const o=new $l,l=new r0,c=new Set,u=[],d=r.logarithmicDepthBuffer,h=r.vertexTextures;let f=r.precision;const g={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 _(y){return c.add(y),y===0?"uv":`uv${y}`}function m(y,M,F,L,C){const U=L.fog,H=C.geometry,Y=y.isMeshStandardMaterial?L.environment:null,J=(y.isMeshStandardMaterial?t:e).get(y.envMap||Y),z=J&&J.mapping===Nr?J.image.height:null,j=g[y.type];y.precision!==null&&(f=r.getMaxPrecision(y.precision),f!==y.precision&&console.warn("THREE.WebGLProgram.getParameters:",y.precision,"not supported, using",f,"instead."));const $=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,N=$!==void 0?$.length:0;let ee=0;H.morphAttributes.position!==void 0&&(ee=1),H.morphAttributes.normal!==void 0&&(ee=2),H.morphAttributes.color!==void 0&&(ee=3);let me,O,Q,ce;if(j){const lt=Gt[j];me=lt.vertexShader,O=lt.fragmentShader}else me=y.vertexShader,O=y.fragmentShader,l.update(y),Q=l.getVertexShaderID(y),ce=l.getFragmentShaderID(y);const ne=i.getRenderTarget(),ve=C.isInstancedMesh===!0,Te=C.isBatchedMesh===!0,Ce=!!y.map,k=!!y.matcap,Fe=!!J,xe=!!y.aoMap,Ge=!!y.lightMap,Ee=!!y.bumpMap,We=!!y.normalMap,w=!!y.displacementMap,S=!!y.emissiveMap,q=!!y.metalnessMap,Z=!!y.roughnessMap,te=y.anisotropy>0,ie=y.clearcoat>0,De=y.iridescence>0,re=y.sheen>0,ye=y.transmission>0,Ae=te&&!!y.anisotropyMap,ae=ie&&!!y.clearcoatMap,fe=ie&&!!y.clearcoatNormalMap,Re=ie&&!!y.clearcoatRoughnessMap,ge=De&&!!y.iridescenceMap,_e=De&&!!y.iridescenceThicknessMap,ke=re&&!!y.sheenColorMap,He=re&&!!y.sheenRoughnessMap,qe=!!y.specularMap,Xe=!!y.specularColorMap,Ye=!!y.specularIntensityMap,Me=ye&&!!y.transmissionMap,x=ye&&!!y.thicknessMap,V=!!y.gradientMap,K=!!y.alphaMap,se=y.alphaTest>0,pe=!!y.alphaHash,Ve=!!y.extensions;let ze=pn;y.toneMapped&&(ne===null||ne.isXRRenderTarget===!0)&&(ze=i.toneMapping);const Ze={shaderID:j,shaderType:y.type,shaderName:y.name,vertexShader:me,fragmentShader:O,defines:y.defines,customVertexShaderID:Q,customFragmentShaderID:ce,isRawShaderMaterial:y.isRawShaderMaterial===!0,glslVersion:y.glslVersion,precision:f,batching:Te,instancing:ve,instancingColor:ve&&C.instanceColor!==null,instancingMorph:ve&&C.morphTexture!==null,supportsVertexTextures:h,outputColorSpace:ne===null?i.outputColorSpace:ne.isXRRenderTarget===!0?ne.texture.colorSpace:xn,alphaToCoverage:!!y.alphaToCoverage,map:Ce,matcap:k,envMap:Fe,envMapMode:Fe&&J.mapping,envMapCubeUVHeight:z,aoMap:xe,lightMap:Ge,bumpMap:Ee,normalMap:We,displacementMap:h&&w,emissiveMap:S,normalMapObjectSpace:We&&y.normalMapType===eh,normalMapTangentSpace:We&&y.normalMapType===Qu,metalnessMap:q,roughnessMap:Z,anisotropy:te,anisotropyMap:Ae,clearcoat:ie,clearcoatMap:ae,clearcoatNormalMap:fe,clearcoatRoughnessMap:Re,iridescence:De,iridescenceMap:ge,iridescenceThicknessMap:_e,sheen:re,sheenColorMap:ke,sheenRoughnessMap:He,specularMap:qe,specularColorMap:Xe,specularIntensityMap:Ye,transmission:ye,transmissionMap:Me,thicknessMap:x,gradientMap:V,opaque:y.transparent===!1&&y.blending===ci&&y.alphaToCoverage===!1,alphaMap:K,alphaTest:se,alphaHash:pe,combine:y.combine,mapUv:Ce&&_(y.map.channel),aoMapUv:xe&&_(y.aoMap.channel),lightMapUv:Ge&&_(y.lightMap.channel),bumpMapUv:Ee&&_(y.bumpMap.channel),normalMapUv:We&&_(y.normalMap.channel),displacementMapUv:w&&_(y.displacementMap.channel),emissiveMapUv:S&&_(y.emissiveMap.channel),metalnessMapUv:q&&_(y.metalnessMap.channel),roughnessMapUv:Z&&_(y.roughnessMap.channel),anisotropyMapUv:Ae&&_(y.anisotropyMap.channel),clearcoatMapUv:ae&&_(y.clearcoatMap.channel),clearcoatNormalMapUv:fe&&_(y.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Re&&_(y.clearcoatRoughnessMap.channel),iridescenceMapUv:ge&&_(y.iridescenceMap.channel),iridescenceThicknessMapUv:_e&&_(y.iridescenceThicknessMap.channel),sheenColorMapUv:ke&&_(y.sheenColorMap.channel),sheenRoughnessMapUv:He&&_(y.sheenRoughnessMap.channel),specularMapUv:qe&&_(y.specularMap.channel),specularColorMapUv:Xe&&_(y.specularColorMap.channel),specularIntensityMapUv:Ye&&_(y.specularIntensityMap.channel),transmissionMapUv:Me&&_(y.transmissionMap.channel),thicknessMapUv:x&&_(y.thicknessMap.channel),alphaMapUv:K&&_(y.alphaMap.channel),vertexTangents:!!H.attributes.tangent&&(We||te),vertexColors:y.vertexColors,vertexAlphas:y.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,pointsUvs:C.isPoints===!0&&!!H.attributes.uv&&(Ce||K),fog:!!U,useFog:y.fog===!0,fogExp2:!!U&&U.isFogExp2,flatShading:y.flatShading===!0,sizeAttenuation:y.sizeAttenuation===!0,logarithmicDepthBuffer:d,skinning:C.isSkinnedMesh===!0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:N,morphTextureStride:ee,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:y.dithering,shadowMapEnabled:i.shadowMap.enabled&&F.length>0,shadowMapType:i.shadowMap.type,toneMapping:ze,useLegacyLights:i._useLegacyLights,decodeVideoTexture:Ce&&y.map.isVideoTexture===!0&&je.getTransfer(y.map.colorSpace)===Ke,premultipliedAlpha:y.premultipliedAlpha,doubleSided:y.side===Wt,flipSided:y.side===St,useDepthPacking:y.depthPacking>=0,depthPacking:y.depthPacking||0,index0AttributeName:y.index0AttributeName,extensionClipCullDistance:Ve&&y.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:Ve&&y.extensions.multiDraw===!0&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:y.customProgramCacheKey()};return Ze.vertexUv1s=c.has(1),Ze.vertexUv2s=c.has(2),Ze.vertexUv3s=c.has(3),c.clear(),Ze}function p(y){const M=[];if(y.shaderID?M.push(y.shaderID):(M.push(y.customVertexShaderID),M.push(y.customFragmentShaderID)),y.defines!==void 0)for(const F in y.defines)M.push(F),M.push(y.defines[F]);return y.isRawShaderMaterial===!1&&(E(M,y),v(M,y),M.push(i.outputColorSpace)),M.push(y.customProgramCacheKey),M.join()}function E(y,M){y.push(M.precision),y.push(M.outputColorSpace),y.push(M.envMapMode),y.push(M.envMapCubeUVHeight),y.push(M.mapUv),y.push(M.alphaMapUv),y.push(M.lightMapUv),y.push(M.aoMapUv),y.push(M.bumpMapUv),y.push(M.normalMapUv),y.push(M.displacementMapUv),y.push(M.emissiveMapUv),y.push(M.metalnessMapUv),y.push(M.roughnessMapUv),y.push(M.anisotropyMapUv),y.push(M.clearcoatMapUv),y.push(M.clearcoatNormalMapUv),y.push(M.clearcoatRoughnessMapUv),y.push(M.iridescenceMapUv),y.push(M.iridescenceThicknessMapUv),y.push(M.sheenColorMapUv),y.push(M.sheenRoughnessMapUv),y.push(M.specularMapUv),y.push(M.specularColorMapUv),y.push(M.specularIntensityMapUv),y.push(M.transmissionMapUv),y.push(M.thicknessMapUv),y.push(M.combine),y.push(M.fogExp2),y.push(M.sizeAttenuation),y.push(M.morphTargetsCount),y.push(M.morphAttributeCount),y.push(M.numDirLights),y.push(M.numPointLights),y.push(M.numSpotLights),y.push(M.numSpotLightMaps),y.push(M.numHemiLights),y.push(M.numRectAreaLights),y.push(M.numDirLightShadows),y.push(M.numPointLightShadows),y.push(M.numSpotLightShadows),y.push(M.numSpotLightShadowsWithMaps),y.push(M.numLightProbes),y.push(M.shadowMapType),y.push(M.toneMapping),y.push(M.numClippingPlanes),y.push(M.numClipIntersection),y.push(M.depthPacking)}function v(y,M){o.disableAll(),M.supportsVertexTextures&&o.enable(0),M.instancing&&o.enable(1),M.instancingColor&&o.enable(2),M.instancingMorph&&o.enable(3),M.matcap&&o.enable(4),M.envMap&&o.enable(5),M.normalMapObjectSpace&&o.enable(6),M.normalMapTangentSpace&&o.enable(7),M.clearcoat&&o.enable(8),M.iridescence&&o.enable(9),M.alphaTest&&o.enable(10),M.vertexColors&&o.enable(11),M.vertexAlphas&&o.enable(12),M.vertexUv1s&&o.enable(13),M.vertexUv2s&&o.enable(14),M.vertexUv3s&&o.enable(15),M.vertexTangents&&o.enable(16),M.anisotropy&&o.enable(17),M.alphaHash&&o.enable(18),M.batching&&o.enable(19),y.push(o.mask),o.disableAll(),M.fog&&o.enable(0),M.useFog&&o.enable(1),M.flatShading&&o.enable(2),M.logarithmicDepthBuffer&&o.enable(3),M.skinning&&o.enable(4),M.morphTargets&&o.enable(5),M.morphNormals&&o.enable(6),M.morphColors&&o.enable(7),M.premultipliedAlpha&&o.enable(8),M.shadowMapEnabled&&o.enable(9),M.useLegacyLights&&o.enable(10),M.doubleSided&&o.enable(11),M.flipSided&&o.enable(12),M.useDepthPacking&&o.enable(13),M.dithering&&o.enable(14),M.transmission&&o.enable(15),M.sheen&&o.enable(16),M.opaque&&o.enable(17),M.pointsUvs&&o.enable(18),M.decodeVideoTexture&&o.enable(19),M.alphaToCoverage&&o.enable(20),y.push(o.mask)}function b(y){const M=g[y.type];let F;if(M){const L=Gt[M];F=Fr.clone(L.uniforms)}else F=y.uniforms;return F}function R(y,M){let F;for(let L=0,C=u.length;L<C;L++){const U=u[L];if(U.cacheKey===M){F=U,++F.usedTimes;break}}return F===void 0&&(F=new n0(i,M,y,s),u.push(F)),F}function T(y){if(--y.usedTimes===0){const M=u.indexOf(y);u[M]=u[u.length-1],u.pop(),y.destroy()}}function A(y){l.remove(y)}function P(){l.dispose()}return{getParameters:m,getProgramCacheKey:p,getUniforms:b,acquireProgram:R,releaseProgram:T,releaseShaderCache:A,programs:u,dispose:P}}function o0(){let i=new WeakMap;function e(s){let a=i.get(s);return a===void 0&&(a={},i.set(s,a)),a}function t(s){i.delete(s)}function n(s,a,o){i.get(s)[a]=o}function r(){i=new WeakMap}return{get:e,remove:t,update:n,dispose:r}}function l0(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.z!==e.z?i.z-e.z:i.id-e.id}function Wo(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function Xo(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function a(d,h,f,g,_,m){let p=i[e];return p===void 0?(p={id:d.id,object:d,geometry:h,material:f,groupOrder:g,renderOrder:d.renderOrder,z:_,group:m},i[e]=p):(p.id=d.id,p.object=d,p.geometry=h,p.material=f,p.groupOrder=g,p.renderOrder=d.renderOrder,p.z=_,p.group=m),e++,p}function o(d,h,f,g,_,m){const p=a(d,h,f,g,_,m);f.transmission>0?n.push(p):f.transparent===!0?r.push(p):t.push(p)}function l(d,h,f,g,_,m){const p=a(d,h,f,g,_,m);f.transmission>0?n.unshift(p):f.transparent===!0?r.unshift(p):t.unshift(p)}function c(d,h){t.length>1&&t.sort(d||l0),n.length>1&&n.sort(h||Wo),r.length>1&&r.sort(h||Wo)}function u(){for(let d=e,h=i.length;d<h;d++){const f=i[d];if(f.id===null)break;f.id=null,f.object=null,f.geometry=null,f.material=null,f.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:o,unshift:l,finish:u,sort:c}}function c0(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new Xo,i.set(n,[a])):r>=s.length?(a=new Xo,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function u0(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new I,color:new be};break;case"SpotLight":t={position:new I,direction:new I,color:new be,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new I,color:new be,distance:0,decay:0};break;case"HemisphereLight":t={direction:new I,skyColor:new be,groundColor:new be};break;case"RectAreaLight":t={color:new be,position:new I,halfWidth:new I,halfHeight:new I};break}return i[e.id]=t,t}}}function h0(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let d0=0;function f0(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function p0(i){const e=new u0,t=h0(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-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,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new I);const r=new I,s=new et,a=new et;function o(c,u){let d=0,h=0,f=0;for(let F=0;F<9;F++)n.probe[F].set(0,0,0);let g=0,_=0,m=0,p=0,E=0,v=0,b=0,R=0,T=0,A=0,P=0;c.sort(f0);const y=u===!0?Math.PI:1;for(let F=0,L=c.length;F<L;F++){const C=c[F],U=C.color,H=C.intensity,Y=C.distance,J=C.shadow&&C.shadow.map?C.shadow.map.texture:null;if(C.isAmbientLight)d+=U.r*H*y,h+=U.g*H*y,f+=U.b*H*y;else if(C.isLightProbe){for(let z=0;z<9;z++)n.probe[z].addScaledVector(C.sh.coefficients[z],H);P++}else if(C.isDirectionalLight){const z=e.get(C);if(z.color.copy(C.color).multiplyScalar(C.intensity*y),C.castShadow){const j=C.shadow,$=t.get(C);$.shadowBias=j.bias,$.shadowNormalBias=j.normalBias,$.shadowRadius=j.radius,$.shadowMapSize=j.mapSize,n.directionalShadow[g]=$,n.directionalShadowMap[g]=J,n.directionalShadowMatrix[g]=C.shadow.matrix,v++}n.directional[g]=z,g++}else if(C.isSpotLight){const z=e.get(C);z.position.setFromMatrixPosition(C.matrixWorld),z.color.copy(U).multiplyScalar(H*y),z.distance=Y,z.coneCos=Math.cos(C.angle),z.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),z.decay=C.decay,n.spot[m]=z;const j=C.shadow;if(C.map&&(n.spotLightMap[T]=C.map,T++,j.updateMatrices(C),C.castShadow&&A++),n.spotLightMatrix[m]=j.matrix,C.castShadow){const $=t.get(C);$.shadowBias=j.bias,$.shadowNormalBias=j.normalBias,$.shadowRadius=j.radius,$.shadowMapSize=j.mapSize,n.spotShadow[m]=$,n.spotShadowMap[m]=J,R++}m++}else if(C.isRectAreaLight){const z=e.get(C);z.color.copy(U).multiplyScalar(H),z.halfWidth.set(C.width*.5,0,0),z.halfHeight.set(0,C.height*.5,0),n.rectArea[p]=z,p++}else if(C.isPointLight){const z=e.get(C);if(z.color.copy(C.color).multiplyScalar(C.intensity*y),z.distance=C.distance,z.decay=C.decay,C.castShadow){const j=C.shadow,$=t.get(C);$.shadowBias=j.bias,$.shadowNormalBias=j.normalBias,$.shadowRadius=j.radius,$.shadowMapSize=j.mapSize,$.shadowCameraNear=j.camera.near,$.shadowCameraFar=j.camera.far,n.pointShadow[_]=$,n.pointShadowMap[_]=J,n.pointShadowMatrix[_]=C.shadow.matrix,b++}n.point[_]=z,_++}else if(C.isHemisphereLight){const z=e.get(C);z.skyColor.copy(C.color).multiplyScalar(H*y),z.groundColor.copy(C.groundColor).multiplyScalar(H*y),n.hemi[E]=z,E++}}p>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=le.LTC_FLOAT_1,n.rectAreaLTC2=le.LTC_FLOAT_2):(n.rectAreaLTC1=le.LTC_HALF_1,n.rectAreaLTC2=le.LTC_HALF_2)),n.ambient[0]=d,n.ambient[1]=h,n.ambient[2]=f;const M=n.hash;(M.directionalLength!==g||M.pointLength!==_||M.spotLength!==m||M.rectAreaLength!==p||M.hemiLength!==E||M.numDirectionalShadows!==v||M.numPointShadows!==b||M.numSpotShadows!==R||M.numSpotMaps!==T||M.numLightProbes!==P)&&(n.directional.length=g,n.spot.length=m,n.rectArea.length=p,n.point.length=_,n.hemi.length=E,n.directionalShadow.length=v,n.directionalShadowMap.length=v,n.pointShadow.length=b,n.pointShadowMap.length=b,n.spotShadow.length=R,n.spotShadowMap.length=R,n.directionalShadowMatrix.length=v,n.pointShadowMatrix.length=b,n.spotLightMatrix.length=R+T-A,n.spotLightMap.length=T,n.numSpotLightShadowsWithMaps=A,n.numLightProbes=P,M.directionalLength=g,M.pointLength=_,M.spotLength=m,M.rectAreaLength=p,M.hemiLength=E,M.numDirectionalShadows=v,M.numPointShadows=b,M.numSpotShadows=R,M.numSpotMaps=T,M.numLightProbes=P,n.version=d0++)}function l(c,u){let d=0,h=0,f=0,g=0,_=0;const m=u.matrixWorldInverse;for(let p=0,E=c.length;p<E;p++){const v=c[p];if(v.isDirectionalLight){const b=n.directional[d];b.direction.setFromMatrixPosition(v.matrixWorld),r.setFromMatrixPosition(v.target.matrixWorld),b.direction.sub(r),b.direction.transformDirection(m),d++}else if(v.isSpotLight){const b=n.spot[f];b.position.setFromMatrixPosition(v.matrixWorld),b.position.applyMatrix4(m),b.direction.setFromMatrixPosition(v.matrixWorld),r.setFromMatrixPosition(v.target.matrixWorld),b.direction.sub(r),b.direction.transformDirection(m),f++}else if(v.isRectAreaLight){const b=n.rectArea[g];b.position.setFromMatrixPosition(v.matrixWorld),b.position.applyMatrix4(m),a.identity(),s.copy(v.matrixWorld),s.premultiply(m),a.extractRotation(s),b.halfWidth.set(v.width*.5,0,0),b.halfHeight.set(0,v.height*.5,0),b.halfWidth.applyMatrix4(a),b.halfHeight.applyMatrix4(a),g++}else if(v.isPointLight){const b=n.point[h];b.position.setFromMatrixPosition(v.matrixWorld),b.position.applyMatrix4(m),h++}else if(v.isHemisphereLight){const b=n.hemi[_];b.direction.setFromMatrixPosition(v.matrixWorld),b.direction.transformDirection(m),_++}}}return{setup:o,setupView:l,state:n}}function qo(i){const e=new p0(i),t=[],n=[];function r(){t.length=0,n.length=0}function s(u){t.push(u)}function a(u){n.push(u)}function o(u){e.setup(t,u)}function l(u){e.setupView(t,u)}return{init:r,state:{lightsArray:t,shadowsArray:n,lights:e,transmissionRenderTarget:null},setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function m0(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new qo(i),e.set(r,[o])):s>=a.length?(o=new qo(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}class g0 extends vi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Zu,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class _0 extends vi{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const x0=`void main() {
|
|
3749
3749
|
gl_Position = vec4( position, 1.0 );
|
|
3750
|
-
}`,
|
|
3750
|
+
}`,v0=`uniform sampler2D shadow_pass;
|
|
3751
3751
|
uniform vec2 resolution;
|
|
3752
3752
|
uniform float radius;
|
|
3753
3753
|
#include <packing>
|
|
@@ -3773,12 +3773,12 @@ void main() {
|
|
|
3773
3773
|
squared_mean = squared_mean / samples;
|
|
3774
3774
|
float std_dev = sqrt( squared_mean - mean * mean );
|
|
3775
3775
|
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|
3776
|
-
}`;function km(i,e,t){let n=new bl;const r=new ue,s=new ue,a=new dt,o=new Im({depthPacking:vu}),l=new Om,c={},h=t.maxTextureSize,d={[vn]:Mt,[Mt]:vn,[Wt]:Wt},u=new ft({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ue},radius:{value:4}},vertexShader:Bm,fragmentShader:zm}),p=u.clone();p.defines.HORIZONTAL_PASS=1;const _=new _t;_.setAttribute("position",new yt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new bt(_,u),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=tl;let f=this.type;this.render=function(T,w,L){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||T.length===0)return;const E=i.getRenderTarget(),M=i.getActiveCubeFace(),N=i.getActiveMipmapLevel(),I=i.state;I.setBlending(en),I.buffers.color.setClear(1,1,1,1),I.buffers.depth.setTest(!0),I.setScissorTest(!1);const C=f!==Jt&&this.type===Jt,z=f===Jt&&this.type!==Jt;for(let V=0,q=T.length;V<q;V++){const ee=T[V],B=ee.shadow;if(B===void 0){console.warn("THREE.WebGLShadowMap:",ee,"has no shadow.");continue}if(B.autoUpdate===!1&&B.needsUpdate===!1)continue;r.copy(B.mapSize);const $=B.getFrameExtents();if(r.multiply($),s.copy(B.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/$.x),r.x=s.x*$.x,B.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/$.y),r.y=s.y*$.y,B.mapSize.y=s.y)),B.map===null||C===!0||z===!0){const F=this.type!==Jt?{minFilter:Nt,magFilter:Nt}:{};B.map!==null&&B.map.dispose(),B.map=new Ht(r.x,r.y,F),B.map.texture.name=ee.name+".shadowMap",B.camera.updateProjectionMatrix()}i.setRenderTarget(B.map),i.clear();const j=B.getViewportCount();for(let F=0;F<j;F++){const Q=B.getViewport(F);a.set(s.x*Q.x,s.y*Q.y,s.x*Q.z,s.y*Q.w),I.viewport(a),B.updateMatrices(ee,F),n=B.getFrustum(),D(w,L,B.camera,ee,this.type)}B.isPointLightShadow!==!0&&this.type===Jt&&b(B,L),B.needsUpdate=!1}f=this.type,m.needsUpdate=!1,i.setRenderTarget(E,M,N)};function b(T,w){const L=e.update(v);u.defines.VSM_SAMPLES!==T.blurSamples&&(u.defines.VSM_SAMPLES=T.blurSamples,p.defines.VSM_SAMPLES=T.blurSamples,u.needsUpdate=!0,p.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new Ht(r.x,r.y)),u.uniforms.shadow_pass.value=T.map.texture,u.uniforms.resolution.value=T.mapSize,u.uniforms.radius.value=T.radius,i.setRenderTarget(T.mapPass),i.clear(),i.renderBufferDirect(w,null,L,u,v,null),p.uniforms.shadow_pass.value=T.mapPass.texture,p.uniforms.resolution.value=T.mapSize,p.uniforms.radius.value=T.radius,i.setRenderTarget(T.map),i.clear(),i.renderBufferDirect(w,null,L,p,v,null)}function x(T,w,L,E){let M=null;const N=L.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(N!==void 0)M=N;else if(M=L.isPointLight===!0?l:o,i.localClippingEnabled&&w.clipShadows===!0&&Array.isArray(w.clippingPlanes)&&w.clippingPlanes.length!==0||w.displacementMap&&w.displacementScale!==0||w.alphaMap&&w.alphaTest>0||w.map&&w.alphaTest>0){const I=M.uuid,C=w.uuid;let z=c[I];z===void 0&&(z={},c[I]=z);let V=z[C];V===void 0&&(V=M.clone(),z[C]=V,w.addEventListener("dispose",P)),M=V}if(M.visible=w.visible,M.wireframe=w.wireframe,E===Jt?M.side=w.shadowSide!==null?w.shadowSide:w.side:M.side=w.shadowSide!==null?w.shadowSide:d[w.side],M.alphaMap=w.alphaMap,M.alphaTest=w.alphaTest,M.map=w.map,M.clipShadows=w.clipShadows,M.clippingPlanes=w.clippingPlanes,M.clipIntersection=w.clipIntersection,M.displacementMap=w.displacementMap,M.displacementScale=w.displacementScale,M.displacementBias=w.displacementBias,M.wireframeLinewidth=w.wireframeLinewidth,M.linewidth=w.linewidth,L.isPointLight===!0&&M.isMeshDistanceMaterial===!0){const I=i.properties.get(M);I.light=L}return M}function D(T,w,L,E,M){if(T.visible===!1)return;if(T.layers.test(w.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&M===Jt)&&(!T.frustumCulled||n.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(L.matrixWorldInverse,T.matrixWorld);const C=e.update(T),z=T.material;if(Array.isArray(z)){const V=C.groups;for(let q=0,ee=V.length;q<ee;q++){const B=V[q],$=z[B.materialIndex];if($&&$.visible){const j=x(T,$,E,M);T.onBeforeShadow(i,T,w,L,C,j,B),i.renderBufferDirect(L,null,C,j,T,B),T.onAfterShadow(i,T,w,L,C,j,B)}}}else if(z.visible){const V=x(T,z,E,M);T.onBeforeShadow(i,T,w,L,C,V,null),i.renderBufferDirect(L,null,C,V,T,null),T.onAfterShadow(i,T,w,L,C,V,null)}}const I=T.children;for(let C=0,z=I.length;C<z;C++)D(I[C],w,L,E,M)}function P(T){T.target.removeEventListener("dispose",P);for(const L in c){const E=c[L],M=T.target.uuid;M in E&&(E[M].dispose(),delete E[M])}}}function Hm(i){function e(){let g=!1;const H=new dt;let K=null;const se=new dt(0,0,0,0);return{setMask:function(fe){K!==fe&&!g&&(i.colorMask(fe,fe,fe,fe),K=fe)},setLocked:function(fe){g=fe},setClear:function(fe,Ve,ze,Ze,lt){lt===!0&&(fe*=Ze,Ve*=Ze,ze*=Ze),H.set(fe,Ve,ze,Ze),se.equals(H)===!1&&(i.clearColor(fe,Ve,ze,Ze),se.copy(H))},reset:function(){g=!1,K=null,se.set(-1,0,0,0)}}}function t(){let g=!1,H=null,K=null,se=null;return{setTest:function(fe){fe?le(i.DEPTH_TEST):ne(i.DEPTH_TEST)},setMask:function(fe){H!==fe&&!g&&(i.depthMask(fe),H=fe)},setFunc:function(fe){if(K!==fe){switch(fe){case Xc:i.depthFunc(i.NEVER);break;case Yc:i.depthFunc(i.ALWAYS);break;case jc:i.depthFunc(i.LESS);break;case br:i.depthFunc(i.LEQUAL);break;case qc:i.depthFunc(i.EQUAL);break;case $c:i.depthFunc(i.GEQUAL);break;case Kc:i.depthFunc(i.GREATER);break;case Zc:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}K=fe}},setLocked:function(fe){g=fe},setClear:function(fe){se!==fe&&(i.clearDepth(fe),se=fe)},reset:function(){g=!1,H=null,K=null,se=null}}}function n(){let g=!1,H=null,K=null,se=null,fe=null,Ve=null,ze=null,Ze=null,lt=null;return{setTest:function(qe){g||(qe?le(i.STENCIL_TEST):ne(i.STENCIL_TEST))},setMask:function(qe){H!==qe&&!g&&(i.stencilMask(qe),H=qe)},setFunc:function(qe,it,rt){(K!==qe||se!==it||fe!==rt)&&(i.stencilFunc(qe,it,rt),K=qe,se=it,fe=rt)},setOp:function(qe,it,rt){(Ve!==qe||ze!==it||Ze!==rt)&&(i.stencilOp(qe,it,rt),Ve=qe,ze=it,Ze=rt)},setLocked:function(qe){g=qe},setClear:function(qe){lt!==qe&&(i.clearStencil(qe),lt=qe)},reset:function(){g=!1,H=null,K=null,se=null,fe=null,Ve=null,ze=null,Ze=null,lt=null}}}const r=new e,s=new t,a=new n,o=new WeakMap,l=new WeakMap;let c={},h={},d=new WeakMap,u=[],p=null,_=!1,v=null,m=null,f=null,b=null,x=null,D=null,P=null,T=new be(0,0,0),w=0,L=!1,E=null,M=null,N=null,I=null,C=null;const z=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let V=!1,q=0;const ee=i.getParameter(i.VERSION);ee.indexOf("WebGL")!==-1?(q=parseFloat(/^WebGL (\d)/.exec(ee)[1]),V=q>=1):ee.indexOf("OpenGL ES")!==-1&&(q=parseFloat(/^OpenGL ES (\d)/.exec(ee)[1]),V=q>=2);let B=null,$={};const j=i.getParameter(i.SCISSOR_BOX),F=i.getParameter(i.VIEWPORT),Q=new dt().fromArray(j),pe=new dt().fromArray(F);function U(g,H,K,se){const fe=new Uint8Array(4),Ve=i.createTexture();i.bindTexture(g,Ve),i.texParameteri(g,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(g,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let ze=0;ze<K;ze++)g===i.TEXTURE_3D||g===i.TEXTURE_2D_ARRAY?i.texImage3D(H,0,i.RGBA,1,1,se,0,i.RGBA,i.UNSIGNED_BYTE,fe):i.texImage2D(H+ze,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,fe);return Ve}const J={};J[i.TEXTURE_2D]=U(i.TEXTURE_2D,i.TEXTURE_2D,1),J[i.TEXTURE_CUBE_MAP]=U(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),J[i.TEXTURE_2D_ARRAY]=U(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),J[i.TEXTURE_3D]=U(i.TEXTURE_3D,i.TEXTURE_3D,1,1),r.setClear(0,0,0,1),s.setClear(1),a.setClear(0),le(i.DEPTH_TEST),s.setFunc(br),ye(!1),We(ga),le(i.CULL_FACE),ve(en);function le(g){c[g]!==!0&&(i.enable(g),c[g]=!0)}function ne(g){c[g]!==!1&&(i.disable(g),c[g]=!1)}function xe(g,H){return h[g]!==H?(i.bindFramebuffer(g,H),h[g]=H,g===i.DRAW_FRAMEBUFFER&&(h[i.FRAMEBUFFER]=H),g===i.FRAMEBUFFER&&(h[i.DRAW_FRAMEBUFFER]=H),!0):!1}function De(g,H){let K=u,se=!1;if(g){K=d.get(H),K===void 0&&(K=[],d.set(H,K));const fe=g.textures;if(K.length!==fe.length||K[0]!==i.COLOR_ATTACHMENT0){for(let Ve=0,ze=fe.length;Ve<ze;Ve++)K[Ve]=i.COLOR_ATTACHMENT0+Ve;K.length=fe.length,se=!0}}else K[0]!==i.BACK&&(K[0]=i.BACK,se=!0);se&&i.drawBuffers(K)}function Ce(g){return p!==g?(i.useProgram(g),p=g,!0):!1}const k={[Cn]:i.FUNC_ADD,[wc]:i.FUNC_SUBTRACT,[Cc]:i.FUNC_REVERSE_SUBTRACT};k[Rc]=i.MIN,k[Pc]=i.MAX;const Fe={[Lc]:i.ZERO,[Fc]:i.ONE,[Uc]:i.SRC_COLOR,[Ps]:i.SRC_ALPHA,[kc]:i.SRC_ALPHA_SATURATE,[Bc]:i.DST_COLOR,[Ic]:i.DST_ALPHA,[Nc]:i.ONE_MINUS_SRC_COLOR,[Ls]:i.ONE_MINUS_SRC_ALPHA,[zc]:i.ONE_MINUS_DST_COLOR,[Oc]:i.ONE_MINUS_DST_ALPHA,[Hc]:i.CONSTANT_COLOR,[Vc]:i.ONE_MINUS_CONSTANT_COLOR,[Gc]:i.CONSTANT_ALPHA,[Wc]:i.ONE_MINUS_CONSTANT_ALPHA};function ve(g,H,K,se,fe,Ve,ze,Ze,lt,qe){if(g===en){_===!0&&(ne(i.BLEND),_=!1);return}if(_===!1&&(le(i.BLEND),_=!0),g!==Ac){if(g!==v||qe!==L){if((m!==Cn||x!==Cn)&&(i.blendEquation(i.FUNC_ADD),m=Cn,x=Cn),qe)switch(g){case li:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ci:i.blendFunc(i.ONE,i.ONE);break;case _a:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case va:i.blendFuncSeparate(i.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",g);break}else switch(g){case li:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ci:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case _a:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case va:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",g);break}f=null,b=null,D=null,P=null,T.set(0,0,0),w=0,v=g,L=qe}return}fe=fe||H,Ve=Ve||K,ze=ze||se,(H!==m||fe!==x)&&(i.blendEquationSeparate(k[H],k[fe]),m=H,x=fe),(K!==f||se!==b||Ve!==D||ze!==P)&&(i.blendFuncSeparate(Fe[K],Fe[se],Fe[Ve],Fe[ze]),f=K,b=se,D=Ve,P=ze),(Ze.equals(T)===!1||lt!==w)&&(i.blendColor(Ze.r,Ze.g,Ze.b,lt),T.copy(Ze),w=lt),v=g,L=!1}function Ge(g,H){g.side===Wt?ne(i.CULL_FACE):le(i.CULL_FACE);let K=g.side===Mt;H&&(K=!K),ye(K),g.blending===li&&g.transparent===!1?ve(en):ve(g.blending,g.blendEquation,g.blendSrc,g.blendDst,g.blendEquationAlpha,g.blendSrcAlpha,g.blendDstAlpha,g.blendColor,g.blendAlpha,g.premultipliedAlpha),s.setFunc(g.depthFunc),s.setTest(g.depthTest),s.setMask(g.depthWrite),r.setMask(g.colorWrite);const se=g.stencilWrite;a.setTest(se),se&&(a.setMask(g.stencilWriteMask),a.setFunc(g.stencilFunc,g.stencilRef,g.stencilFuncMask),a.setOp(g.stencilFail,g.stencilZFail,g.stencilZPass)),S(g.polygonOffset,g.polygonOffsetFactor,g.polygonOffsetUnits),g.alphaToCoverage===!0?le(i.SAMPLE_ALPHA_TO_COVERAGE):ne(i.SAMPLE_ALPHA_TO_COVERAGE)}function ye(g){E!==g&&(g?i.frontFace(i.CW):i.frontFace(i.CCW),E=g)}function We(g){g!==bc?(le(i.CULL_FACE),g!==M&&(g===ga?i.cullFace(i.BACK):g===Dc?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):ne(i.CULL_FACE),M=g}function A(g){g!==N&&(V&&i.lineWidth(g),N=g)}function S(g,H,K){g?(le(i.POLYGON_OFFSET_FILL),(I!==H||C!==K)&&(i.polygonOffset(H,K),I=H,C=K)):ne(i.POLYGON_OFFSET_FILL)}function Y(g){g?le(i.SCISSOR_TEST):ne(i.SCISSOR_TEST)}function Z(g){g===void 0&&(g=i.TEXTURE0+z-1),B!==g&&(i.activeTexture(g),B=g)}function te(g,H,K){K===void 0&&(B===null?K=i.TEXTURE0+z-1:K=B);let se=$[K];se===void 0&&(se={type:void 0,texture:void 0},$[K]=se),(se.type!==g||se.texture!==H)&&(B!==K&&(i.activeTexture(K),B=K),i.bindTexture(g,H||J[g]),se.type=g,se.texture=H)}function ie(){const g=$[B];g!==void 0&&g.type!==void 0&&(i.bindTexture(g.type,null),g.type=void 0,g.texture=void 0)}function Te(){try{i.compressedTexImage2D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function re(){try{i.compressedTexImage3D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function Ee(){try{i.texSubImage2D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function Ae(){try{i.texSubImage3D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function ae(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function de(){try{i.compressedTexSubImage3D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function Re(){try{i.texStorage2D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function ge(){try{i.texStorage3D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function _e(){try{i.texImage2D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function ke(){try{i.texImage3D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function He(g){Q.equals(g)===!1&&(i.scissor(g.x,g.y,g.z,g.w),Q.copy(g))}function Ye(g){pe.equals(g)===!1&&(i.viewport(g.x,g.y,g.z,g.w),pe.copy(g))}function Xe(g,H){let K=l.get(H);K===void 0&&(K=new WeakMap,l.set(H,K));let se=K.get(g);se===void 0&&(se=i.getUniformBlockIndex(H,g.name),K.set(g,se))}function je(g,H){const se=l.get(H).get(g);o.get(H)!==se&&(i.uniformBlockBinding(H,se,g.__bindingPointIndex),o.set(H,se))}function Me(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),c={},B=null,$={},h={},d=new WeakMap,u=[],p=null,_=!1,v=null,m=null,f=null,b=null,x=null,D=null,P=null,T=new be(0,0,0),w=0,L=!1,E=null,M=null,N=null,I=null,C=null,Q.set(0,0,i.canvas.width,i.canvas.height),pe.set(0,0,i.canvas.width,i.canvas.height),r.reset(),s.reset(),a.reset()}return{buffers:{color:r,depth:s,stencil:a},enable:le,disable:ne,bindFramebuffer:xe,drawBuffers:De,useProgram:Ce,setBlending:ve,setMaterial:Ge,setFlipSided:ye,setCullFace:We,setLineWidth:A,setPolygonOffset:S,setScissorTest:Y,activeTexture:Z,bindTexture:te,unbindTexture:ie,compressedTexImage2D:Te,compressedTexImage3D:re,texImage2D:_e,texImage3D:ke,updateUBOMapping:Xe,uniformBlockBinding:je,texStorage2D:Re,texStorage3D:ge,texSubImage2D:Ee,texSubImage3D:Ae,compressedTexSubImage2D:ae,compressedTexSubImage3D:de,scissor:He,viewport:Ye,reset:Me}}function Vm(i,e,t,n,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new ue,h=new WeakMap;let d;const u=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(A,S){return p?new OffscreenCanvas(A,S):Cr("canvas")}function v(A,S,Y){let Z=1;const te=We(A);if((te.width>Y||te.height>Y)&&(Z=Y/Math.max(te.width,te.height)),Z<1)if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&A instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&A instanceof ImageBitmap||typeof VideoFrame<"u"&&A instanceof VideoFrame){const ie=Math.floor(Z*te.width),Te=Math.floor(Z*te.height);d===void 0&&(d=_(ie,Te));const re=S?_(ie,Te):d;return re.width=ie,re.height=Te,re.getContext("2d").drawImage(A,0,0,ie,Te),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+te.width+"x"+te.height+") to ("+ie+"x"+Te+")."),re}else return"data"in A&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+te.width+"x"+te.height+")."),A;return A}function m(A){return A.generateMipmaps&&A.minFilter!==Nt&&A.minFilter!==zt}function f(A){i.generateMipmap(A)}function b(A,S,Y,Z,te=!1){if(A!==null){if(i[A]!==void 0)return i[A];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+A+"'")}let ie=S;if(S===i.RED&&(Y===i.FLOAT&&(ie=i.R32F),Y===i.HALF_FLOAT&&(ie=i.R16F),Y===i.UNSIGNED_BYTE&&(ie=i.R8)),S===i.RED_INTEGER&&(Y===i.UNSIGNED_BYTE&&(ie=i.R8UI),Y===i.UNSIGNED_SHORT&&(ie=i.R16UI),Y===i.UNSIGNED_INT&&(ie=i.R32UI),Y===i.BYTE&&(ie=i.R8I),Y===i.SHORT&&(ie=i.R16I),Y===i.INT&&(ie=i.R32I)),S===i.RG&&(Y===i.FLOAT&&(ie=i.RG32F),Y===i.HALF_FLOAT&&(ie=i.RG16F),Y===i.UNSIGNED_BYTE&&(ie=i.RG8)),S===i.RG_INTEGER&&(Y===i.UNSIGNED_BYTE&&(ie=i.RG8UI),Y===i.UNSIGNED_SHORT&&(ie=i.RG16UI),Y===i.UNSIGNED_INT&&(ie=i.RG32UI),Y===i.BYTE&&(ie=i.RG8I),Y===i.SHORT&&(ie=i.RG16I),Y===i.INT&&(ie=i.RG32I)),S===i.RGB&&Y===i.UNSIGNED_INT_5_9_9_9_REV&&(ie=i.RGB9_E5),S===i.RGBA){const Te=te?Dr:$e.getTransfer(Z);Y===i.FLOAT&&(ie=i.RGBA32F),Y===i.HALF_FLOAT&&(ie=i.RGBA16F),Y===i.UNSIGNED_BYTE&&(ie=Te===Ke?i.SRGB8_ALPHA8:i.RGBA8),Y===i.UNSIGNED_SHORT_4_4_4_4&&(ie=i.RGBA4),Y===i.UNSIGNED_SHORT_5_5_5_1&&(ie=i.RGB5_A1)}return(ie===i.R16F||ie===i.R32F||ie===i.RG16F||ie===i.RG32F||ie===i.RGBA16F||ie===i.RGBA32F)&&e.get("EXT_color_buffer_float"),ie}function x(A,S){return m(A)===!0||A.isFramebufferTexture&&A.minFilter!==Nt&&A.minFilter!==zt?Math.log2(Math.max(S.width,S.height))+1:A.mipmaps!==void 0&&A.mipmaps.length>0?A.mipmaps.length:A.isCompressedTexture&&Array.isArray(A.image)?S.mipmaps.length:1}function D(A){const S=A.target;S.removeEventListener("dispose",D),T(S),S.isVideoTexture&&h.delete(S)}function P(A){const S=A.target;S.removeEventListener("dispose",P),L(S)}function T(A){const S=n.get(A);if(S.__webglInit===void 0)return;const Y=A.source,Z=u.get(Y);if(Z){const te=Z[S.__cacheKey];te.usedTimes--,te.usedTimes===0&&w(A),Object.keys(Z).length===0&&u.delete(Y)}n.remove(A)}function w(A){const S=n.get(A);i.deleteTexture(S.__webglTexture);const Y=A.source,Z=u.get(Y);delete Z[S.__cacheKey],a.memory.textures--}function L(A){const S=n.get(A);if(A.depthTexture&&A.depthTexture.dispose(),A.isWebGLCubeRenderTarget)for(let Z=0;Z<6;Z++){if(Array.isArray(S.__webglFramebuffer[Z]))for(let te=0;te<S.__webglFramebuffer[Z].length;te++)i.deleteFramebuffer(S.__webglFramebuffer[Z][te]);else i.deleteFramebuffer(S.__webglFramebuffer[Z]);S.__webglDepthbuffer&&i.deleteRenderbuffer(S.__webglDepthbuffer[Z])}else{if(Array.isArray(S.__webglFramebuffer))for(let Z=0;Z<S.__webglFramebuffer.length;Z++)i.deleteFramebuffer(S.__webglFramebuffer[Z]);else i.deleteFramebuffer(S.__webglFramebuffer);if(S.__webglDepthbuffer&&i.deleteRenderbuffer(S.__webglDepthbuffer),S.__webglMultisampledFramebuffer&&i.deleteFramebuffer(S.__webglMultisampledFramebuffer),S.__webglColorRenderbuffer)for(let Z=0;Z<S.__webglColorRenderbuffer.length;Z++)S.__webglColorRenderbuffer[Z]&&i.deleteRenderbuffer(S.__webglColorRenderbuffer[Z]);S.__webglDepthRenderbuffer&&i.deleteRenderbuffer(S.__webglDepthRenderbuffer)}const Y=A.textures;for(let Z=0,te=Y.length;Z<te;Z++){const ie=n.get(Y[Z]);ie.__webglTexture&&(i.deleteTexture(ie.__webglTexture),a.memory.textures--),n.remove(Y[Z])}n.remove(A)}let E=0;function M(){E=0}function N(){const A=E;return A>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+A+" texture units while this GPU supports only "+r.maxTextures),E+=1,A}function I(A){const S=[];return S.push(A.wrapS),S.push(A.wrapT),S.push(A.wrapR||0),S.push(A.magFilter),S.push(A.minFilter),S.push(A.anisotropy),S.push(A.internalFormat),S.push(A.format),S.push(A.type),S.push(A.generateMipmaps),S.push(A.premultiplyAlpha),S.push(A.flipY),S.push(A.unpackAlignment),S.push(A.colorSpace),S.join()}function C(A,S){const Y=n.get(A);if(A.isVideoTexture&&Ge(A),A.isRenderTargetTexture===!1&&A.version>0&&Y.__version!==A.version){const Z=A.image;if(Z===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Z.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Q(Y,A,S);return}}t.bindTexture(i.TEXTURE_2D,Y.__webglTexture,i.TEXTURE0+S)}function z(A,S){const Y=n.get(A);if(A.version>0&&Y.__version!==A.version){Q(Y,A,S);return}t.bindTexture(i.TEXTURE_2D_ARRAY,Y.__webglTexture,i.TEXTURE0+S)}function V(A,S){const Y=n.get(A);if(A.version>0&&Y.__version!==A.version){Q(Y,A,S);return}t.bindTexture(i.TEXTURE_3D,Y.__webglTexture,i.TEXTURE0+S)}function q(A,S){const Y=n.get(A);if(A.version>0&&Y.__version!==A.version){pe(Y,A,S);return}t.bindTexture(i.TEXTURE_CUBE_MAP,Y.__webglTexture,i.TEXTURE0+S)}const ee={[Ns]:i.REPEAT,[Ln]:i.CLAMP_TO_EDGE,[Is]:i.MIRRORED_REPEAT},B={[Nt]:i.NEAREST,[au]:i.NEAREST_MIPMAP_NEAREST,[Wi]:i.NEAREST_MIPMAP_LINEAR,[zt]:i.LINEAR,[Gr]:i.LINEAR_MIPMAP_NEAREST,[Fn]:i.LINEAR_MIPMAP_LINEAR},$={[Su]:i.NEVER,[Au]:i.ALWAYS,[Eu]:i.LESS,[dl]:i.LEQUAL,[yu]:i.EQUAL,[Tu]:i.GEQUAL,[bu]:i.GREATER,[Du]:i.NOTEQUAL};function j(A,S){if(S.type===pn&&e.has("OES_texture_float_linear")===!1&&(S.magFilter===zt||S.magFilter===Gr||S.magFilter===Wi||S.magFilter===Fn||S.minFilter===zt||S.minFilter===Gr||S.minFilter===Wi||S.minFilter===Fn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(A,i.TEXTURE_WRAP_S,ee[S.wrapS]),i.texParameteri(A,i.TEXTURE_WRAP_T,ee[S.wrapT]),(A===i.TEXTURE_3D||A===i.TEXTURE_2D_ARRAY)&&i.texParameteri(A,i.TEXTURE_WRAP_R,ee[S.wrapR]),i.texParameteri(A,i.TEXTURE_MAG_FILTER,B[S.magFilter]),i.texParameteri(A,i.TEXTURE_MIN_FILTER,B[S.minFilter]),S.compareFunction&&(i.texParameteri(A,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(A,i.TEXTURE_COMPARE_FUNC,$[S.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(S.magFilter===Nt||S.minFilter!==Wi&&S.minFilter!==Fn||S.type===pn&&e.has("OES_texture_float_linear")===!1)return;if(S.anisotropy>1||n.get(S).__currentAnisotropy){const Y=e.get("EXT_texture_filter_anisotropic");i.texParameterf(A,Y.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(S.anisotropy,r.getMaxAnisotropy())),n.get(S).__currentAnisotropy=S.anisotropy}}}function F(A,S){let Y=!1;A.__webglInit===void 0&&(A.__webglInit=!0,S.addEventListener("dispose",D));const Z=S.source;let te=u.get(Z);te===void 0&&(te={},u.set(Z,te));const ie=I(S);if(ie!==A.__cacheKey){te[ie]===void 0&&(te[ie]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,Y=!0),te[ie].usedTimes++;const Te=te[A.__cacheKey];Te!==void 0&&(te[A.__cacheKey].usedTimes--,Te.usedTimes===0&&w(S)),A.__cacheKey=ie,A.__webglTexture=te[ie].texture}return Y}function Q(A,S,Y){let Z=i.TEXTURE_2D;(S.isDataArrayTexture||S.isCompressedArrayTexture)&&(Z=i.TEXTURE_2D_ARRAY),S.isData3DTexture&&(Z=i.TEXTURE_3D);const te=F(A,S),ie=S.source;t.bindTexture(Z,A.__webglTexture,i.TEXTURE0+Y);const Te=n.get(ie);if(ie.version!==Te.__version||te===!0){t.activeTexture(i.TEXTURE0+Y);const re=$e.getPrimaries($e.workingColorSpace),Ee=S.colorSpace===fn?null:$e.getPrimaries(S.colorSpace),Ae=S.colorSpace===fn||re===Ee?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,S.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,S.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ae);let ae=v(S.image,!1,r.maxTextureSize);ae=ye(S,ae);const de=s.convert(S.format,S.colorSpace),Re=s.convert(S.type);let ge=b(S.internalFormat,de,Re,S.colorSpace,S.isVideoTexture);j(Z,S);let _e;const ke=S.mipmaps,He=S.isVideoTexture!==!0&&ge!==hl,Ye=Te.__version===void 0||te===!0,Xe=ie.dataReady,je=x(S,ae);if(S.isDepthTexture)ge=i.DEPTH_COMPONENT16,S.type===pn?ge=i.DEPTH_COMPONENT32F:S.type===mi?ge=i.DEPTH_COMPONENT24:S.type===Ii&&(ge=i.DEPTH24_STENCIL8),Ye&&(He?t.texStorage2D(i.TEXTURE_2D,1,ge,ae.width,ae.height):t.texImage2D(i.TEXTURE_2D,0,ge,ae.width,ae.height,0,de,Re,null));else if(S.isDataTexture)if(ke.length>0){He&&Ye&&t.texStorage2D(i.TEXTURE_2D,je,ge,ke[0].width,ke[0].height);for(let Me=0,g=ke.length;Me<g;Me++)_e=ke[Me],He?Xe&&t.texSubImage2D(i.TEXTURE_2D,Me,0,0,_e.width,_e.height,de,Re,_e.data):t.texImage2D(i.TEXTURE_2D,Me,ge,_e.width,_e.height,0,de,Re,_e.data);S.generateMipmaps=!1}else He?(Ye&&t.texStorage2D(i.TEXTURE_2D,je,ge,ae.width,ae.height),Xe&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,ae.width,ae.height,de,Re,ae.data)):t.texImage2D(i.TEXTURE_2D,0,ge,ae.width,ae.height,0,de,Re,ae.data);else if(S.isCompressedTexture)if(S.isCompressedArrayTexture){He&&Ye&&t.texStorage3D(i.TEXTURE_2D_ARRAY,je,ge,ke[0].width,ke[0].height,ae.depth);for(let Me=0,g=ke.length;Me<g;Me++)_e=ke[Me],S.format!==Xt?de!==null?He?Xe&&t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Me,0,0,0,_e.width,_e.height,ae.depth,de,_e.data,0,0):t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,Me,ge,_e.width,_e.height,ae.depth,0,_e.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):He?Xe&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,Me,0,0,0,_e.width,_e.height,ae.depth,de,Re,_e.data):t.texImage3D(i.TEXTURE_2D_ARRAY,Me,ge,_e.width,_e.height,ae.depth,0,de,Re,_e.data)}else{He&&Ye&&t.texStorage2D(i.TEXTURE_2D,je,ge,ke[0].width,ke[0].height);for(let Me=0,g=ke.length;Me<g;Me++)_e=ke[Me],S.format!==Xt?de!==null?He?Xe&&t.compressedTexSubImage2D(i.TEXTURE_2D,Me,0,0,_e.width,_e.height,de,_e.data):t.compressedTexImage2D(i.TEXTURE_2D,Me,ge,_e.width,_e.height,0,_e.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):He?Xe&&t.texSubImage2D(i.TEXTURE_2D,Me,0,0,_e.width,_e.height,de,Re,_e.data):t.texImage2D(i.TEXTURE_2D,Me,ge,_e.width,_e.height,0,de,Re,_e.data)}else if(S.isDataArrayTexture)He?(Ye&&t.texStorage3D(i.TEXTURE_2D_ARRAY,je,ge,ae.width,ae.height,ae.depth),Xe&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,ae.width,ae.height,ae.depth,de,Re,ae.data)):t.texImage3D(i.TEXTURE_2D_ARRAY,0,ge,ae.width,ae.height,ae.depth,0,de,Re,ae.data);else if(S.isData3DTexture)He?(Ye&&t.texStorage3D(i.TEXTURE_3D,je,ge,ae.width,ae.height,ae.depth),Xe&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,ae.width,ae.height,ae.depth,de,Re,ae.data)):t.texImage3D(i.TEXTURE_3D,0,ge,ae.width,ae.height,ae.depth,0,de,Re,ae.data);else if(S.isFramebufferTexture){if(Ye)if(He)t.texStorage2D(i.TEXTURE_2D,je,ge,ae.width,ae.height);else{let Me=ae.width,g=ae.height;for(let H=0;H<je;H++)t.texImage2D(i.TEXTURE_2D,H,ge,Me,g,0,de,Re,null),Me>>=1,g>>=1}}else if(ke.length>0){if(He&&Ye){const Me=We(ke[0]);t.texStorage2D(i.TEXTURE_2D,je,ge,Me.width,Me.height)}for(let Me=0,g=ke.length;Me<g;Me++)_e=ke[Me],He?Xe&&t.texSubImage2D(i.TEXTURE_2D,Me,0,0,de,Re,_e):t.texImage2D(i.TEXTURE_2D,Me,ge,de,Re,_e);S.generateMipmaps=!1}else if(He){if(Ye){const Me=We(ae);t.texStorage2D(i.TEXTURE_2D,je,ge,Me.width,Me.height)}Xe&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,de,Re,ae)}else t.texImage2D(i.TEXTURE_2D,0,ge,de,Re,ae);m(S)&&f(Z),Te.__version=ie.version,S.onUpdate&&S.onUpdate(S)}A.__version=S.version}function pe(A,S,Y){if(S.image.length!==6)return;const Z=F(A,S),te=S.source;t.bindTexture(i.TEXTURE_CUBE_MAP,A.__webglTexture,i.TEXTURE0+Y);const ie=n.get(te);if(te.version!==ie.__version||Z===!0){t.activeTexture(i.TEXTURE0+Y);const Te=$e.getPrimaries($e.workingColorSpace),re=S.colorSpace===fn?null:$e.getPrimaries(S.colorSpace),Ee=S.colorSpace===fn||Te===re?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,S.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,S.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ee);const Ae=S.isCompressedTexture||S.image[0].isCompressedTexture,ae=S.image[0]&&S.image[0].isDataTexture,de=[];for(let g=0;g<6;g++)!Ae&&!ae?de[g]=v(S.image[g],!0,r.maxCubemapSize):de[g]=ae?S.image[g].image:S.image[g],de[g]=ye(S,de[g]);const Re=de[0],ge=s.convert(S.format,S.colorSpace),_e=s.convert(S.type),ke=b(S.internalFormat,ge,_e,S.colorSpace),He=S.isVideoTexture!==!0,Ye=ie.__version===void 0||Z===!0,Xe=te.dataReady;let je=x(S,Re);j(i.TEXTURE_CUBE_MAP,S);let Me;if(Ae){He&&Ye&&t.texStorage2D(i.TEXTURE_CUBE_MAP,je,ke,Re.width,Re.height);for(let g=0;g<6;g++){Me=de[g].mipmaps;for(let H=0;H<Me.length;H++){const K=Me[H];S.format!==Xt?ge!==null?He?Xe&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,H,0,0,K.width,K.height,ge,K.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,H,ke,K.width,K.height,0,K.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,H,0,0,K.width,K.height,ge,_e,K.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,H,ke,K.width,K.height,0,ge,_e,K.data)}}}else{if(Me=S.mipmaps,He&&Ye){Me.length>0&&je++;const g=We(de[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,je,ke,g.width,g.height)}for(let g=0;g<6;g++)if(ae){He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,0,0,de[g].width,de[g].height,ge,_e,de[g].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,ke,de[g].width,de[g].height,0,ge,_e,de[g].data);for(let H=0;H<Me.length;H++){const se=Me[H].image[g].image;He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,H+1,0,0,se.width,se.height,ge,_e,se.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,H+1,ke,se.width,se.height,0,ge,_e,se.data)}}else{He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,0,0,ge,_e,de[g]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,ke,ge,_e,de[g]);for(let H=0;H<Me.length;H++){const K=Me[H];He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,H+1,0,0,ge,_e,K.image[g]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,H+1,ke,ge,_e,K.image[g])}}}m(S)&&f(i.TEXTURE_CUBE_MAP),ie.__version=te.version,S.onUpdate&&S.onUpdate(S)}A.__version=S.version}function U(A,S,Y,Z,te,ie){const Te=s.convert(Y.format,Y.colorSpace),re=s.convert(Y.type),Ee=b(Y.internalFormat,Te,re,Y.colorSpace);if(!n.get(S).__hasExternalTextures){const ae=Math.max(1,S.width>>ie),de=Math.max(1,S.height>>ie);te===i.TEXTURE_3D||te===i.TEXTURE_2D_ARRAY?t.texImage3D(te,ie,Ee,ae,de,S.depth,0,Te,re,null):t.texImage2D(te,ie,Ee,ae,de,0,Te,re,null)}t.bindFramebuffer(i.FRAMEBUFFER,A),ve(S)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Z,te,n.get(Y).__webglTexture,0,Fe(S)):(te===i.TEXTURE_2D||te>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&te<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Z,te,n.get(Y).__webglTexture,ie),t.bindFramebuffer(i.FRAMEBUFFER,null)}function J(A,S,Y){if(i.bindRenderbuffer(i.RENDERBUFFER,A),S.depthBuffer&&!S.stencilBuffer){let Z=i.DEPTH_COMPONENT24;if(Y||ve(S)){const te=S.depthTexture;te&&te.isDepthTexture&&(te.type===pn?Z=i.DEPTH_COMPONENT32F:te.type===mi&&(Z=i.DEPTH_COMPONENT24));const ie=Fe(S);ve(S)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,ie,Z,S.width,S.height):i.renderbufferStorageMultisample(i.RENDERBUFFER,ie,Z,S.width,S.height)}else i.renderbufferStorage(i.RENDERBUFFER,Z,S.width,S.height);i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,A)}else if(S.depthBuffer&&S.stencilBuffer){const Z=Fe(S);Y&&ve(S)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Z,i.DEPTH24_STENCIL8,S.width,S.height):ve(S)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Z,i.DEPTH24_STENCIL8,S.width,S.height):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,S.width,S.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,A)}else{const Z=S.textures;for(let te=0;te<Z.length;te++){const ie=Z[te],Te=s.convert(ie.format,ie.colorSpace),re=s.convert(ie.type),Ee=b(ie.internalFormat,Te,re,ie.colorSpace),Ae=Fe(S);Y&&ve(S)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Ae,Ee,S.width,S.height):ve(S)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Ae,Ee,S.width,S.height):i.renderbufferStorage(i.RENDERBUFFER,Ee,S.width,S.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function le(A,S){if(S&&S.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,A),!(S.depthTexture&&S.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(S.depthTexture).__webglTexture||S.depthTexture.image.width!==S.width||S.depthTexture.image.height!==S.height)&&(S.depthTexture.image.width=S.width,S.depthTexture.image.height=S.height,S.depthTexture.needsUpdate=!0),C(S.depthTexture,0);const Z=n.get(S.depthTexture).__webglTexture,te=Fe(S);if(S.depthTexture.format===ui)ve(S)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,Z,0,te):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,Z,0);else if(S.depthTexture.format===Fi)ve(S)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,Z,0,te):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,Z,0);else throw new Error("Unknown depthTexture format")}function ne(A){const S=n.get(A),Y=A.isWebGLCubeRenderTarget===!0;if(A.depthTexture&&!S.__autoAllocateDepthBuffer){if(Y)throw new Error("target.depthTexture not supported in Cube render targets");le(S.__webglFramebuffer,A)}else if(Y){S.__webglDepthbuffer=[];for(let Z=0;Z<6;Z++)t.bindFramebuffer(i.FRAMEBUFFER,S.__webglFramebuffer[Z]),S.__webglDepthbuffer[Z]=i.createRenderbuffer(),J(S.__webglDepthbuffer[Z],A,!1)}else t.bindFramebuffer(i.FRAMEBUFFER,S.__webglFramebuffer),S.__webglDepthbuffer=i.createRenderbuffer(),J(S.__webglDepthbuffer,A,!1);t.bindFramebuffer(i.FRAMEBUFFER,null)}function xe(A,S,Y){const Z=n.get(A);S!==void 0&&U(Z.__webglFramebuffer,A,A.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),Y!==void 0&&ne(A)}function De(A){const S=A.texture,Y=n.get(A),Z=n.get(S);A.addEventListener("dispose",P);const te=A.textures,ie=A.isWebGLCubeRenderTarget===!0,Te=te.length>1;if(Te||(Z.__webglTexture===void 0&&(Z.__webglTexture=i.createTexture()),Z.__version=S.version,a.memory.textures++),ie){Y.__webglFramebuffer=[];for(let re=0;re<6;re++)if(S.mipmaps&&S.mipmaps.length>0){Y.__webglFramebuffer[re]=[];for(let Ee=0;Ee<S.mipmaps.length;Ee++)Y.__webglFramebuffer[re][Ee]=i.createFramebuffer()}else Y.__webglFramebuffer[re]=i.createFramebuffer()}else{if(S.mipmaps&&S.mipmaps.length>0){Y.__webglFramebuffer=[];for(let re=0;re<S.mipmaps.length;re++)Y.__webglFramebuffer[re]=i.createFramebuffer()}else Y.__webglFramebuffer=i.createFramebuffer();if(Te)for(let re=0,Ee=te.length;re<Ee;re++){const Ae=n.get(te[re]);Ae.__webglTexture===void 0&&(Ae.__webglTexture=i.createTexture(),a.memory.textures++)}if(A.samples>0&&ve(A)===!1){Y.__webglMultisampledFramebuffer=i.createFramebuffer(),Y.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,Y.__webglMultisampledFramebuffer);for(let re=0;re<te.length;re++){const Ee=te[re];Y.__webglColorRenderbuffer[re]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,Y.__webglColorRenderbuffer[re]);const Ae=s.convert(Ee.format,Ee.colorSpace),ae=s.convert(Ee.type),de=b(Ee.internalFormat,Ae,ae,Ee.colorSpace,A.isXRRenderTarget===!0),Re=Fe(A);i.renderbufferStorageMultisample(i.RENDERBUFFER,Re,de,A.width,A.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+re,i.RENDERBUFFER,Y.__webglColorRenderbuffer[re])}i.bindRenderbuffer(i.RENDERBUFFER,null),A.depthBuffer&&(Y.__webglDepthRenderbuffer=i.createRenderbuffer(),J(Y.__webglDepthRenderbuffer,A,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(ie){t.bindTexture(i.TEXTURE_CUBE_MAP,Z.__webglTexture),j(i.TEXTURE_CUBE_MAP,S);for(let re=0;re<6;re++)if(S.mipmaps&&S.mipmaps.length>0)for(let Ee=0;Ee<S.mipmaps.length;Ee++)U(Y.__webglFramebuffer[re][Ee],A,S,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+re,Ee);else U(Y.__webglFramebuffer[re],A,S,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+re,0);m(S)&&f(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Te){for(let re=0,Ee=te.length;re<Ee;re++){const Ae=te[re],ae=n.get(Ae);t.bindTexture(i.TEXTURE_2D,ae.__webglTexture),j(i.TEXTURE_2D,Ae),U(Y.__webglFramebuffer,A,Ae,i.COLOR_ATTACHMENT0+re,i.TEXTURE_2D,0),m(Ae)&&f(i.TEXTURE_2D)}t.unbindTexture()}else{let re=i.TEXTURE_2D;if((A.isWebGL3DRenderTarget||A.isWebGLArrayRenderTarget)&&(re=A.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(re,Z.__webglTexture),j(re,S),S.mipmaps&&S.mipmaps.length>0)for(let Ee=0;Ee<S.mipmaps.length;Ee++)U(Y.__webglFramebuffer[Ee],A,S,i.COLOR_ATTACHMENT0,re,Ee);else U(Y.__webglFramebuffer,A,S,i.COLOR_ATTACHMENT0,re,0);m(S)&&f(re),t.unbindTexture()}A.depthBuffer&&ne(A)}function Ce(A){const S=A.textures;for(let Y=0,Z=S.length;Y<Z;Y++){const te=S[Y];if(m(te)){const ie=A.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:i.TEXTURE_2D,Te=n.get(te).__webglTexture;t.bindTexture(ie,Te),f(ie),t.unbindTexture()}}}function k(A){if(A.samples>0&&ve(A)===!1){const S=A.textures,Y=A.width,Z=A.height;let te=i.COLOR_BUFFER_BIT;const ie=[],Te=A.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,re=n.get(A),Ee=S.length>1;if(Ee)for(let Ae=0;Ae<S.length;Ae++)t.bindFramebuffer(i.FRAMEBUFFER,re.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ae,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,re.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ae,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,re.__webglMultisampledFramebuffer),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,re.__webglFramebuffer);for(let Ae=0;Ae<S.length;Ae++){ie.push(i.COLOR_ATTACHMENT0+Ae),A.depthBuffer&&ie.push(Te);const ae=re.__ignoreDepthValues!==void 0?re.__ignoreDepthValues:!1;if(ae===!1&&(A.depthBuffer&&(te|=i.DEPTH_BUFFER_BIT),A.stencilBuffer&&re.__isTransmissionRenderTarget!==!0&&(te|=i.STENCIL_BUFFER_BIT)),Ee&&i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,re.__webglColorRenderbuffer[Ae]),ae===!0&&(i.invalidateFramebuffer(i.READ_FRAMEBUFFER,[Te]),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[Te])),Ee){const de=n.get(S[Ae]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,de,0)}i.blitFramebuffer(0,0,Y,Z,0,0,Y,Z,te,i.NEAREST),l&&i.invalidateFramebuffer(i.READ_FRAMEBUFFER,ie)}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),Ee)for(let Ae=0;Ae<S.length;Ae++){t.bindFramebuffer(i.FRAMEBUFFER,re.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ae,i.RENDERBUFFER,re.__webglColorRenderbuffer[Ae]);const ae=n.get(S[Ae]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,re.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ae,i.TEXTURE_2D,ae,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,re.__webglMultisampledFramebuffer)}}function Fe(A){return Math.min(r.maxSamples,A.samples)}function ve(A){const S=n.get(A);return A.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&S.__useRenderToTexture!==!1}function Ge(A){const S=a.render.frame;h.get(A)!==S&&(h.set(A,S),A.update())}function ye(A,S){const Y=A.colorSpace,Z=A.format,te=A.type;return A.isCompressedTexture===!0||A.isVideoTexture===!0||Y!==xn&&Y!==fn&&($e.getTransfer(Y)===Ke?(Z!==Xt||te!==gn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Y)),S}function We(A){return typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement?(c.width=A.naturalWidth||A.width,c.height=A.naturalHeight||A.height):typeof VideoFrame<"u"&&A instanceof VideoFrame?(c.width=A.displayWidth,c.height=A.displayHeight):(c.width=A.width,c.height=A.height),c}this.allocateTextureUnit=N,this.resetTextureUnits=M,this.setTexture2D=C,this.setTexture2DArray=z,this.setTexture3D=V,this.setTextureCube=q,this.rebindTextures=xe,this.setupRenderTarget=De,this.updateRenderTargetMipmap=Ce,this.updateMultisampleRenderTarget=k,this.setupDepthRenderbuffer=ne,this.setupFrameBufferTexture=U,this.useMultisampledRTT=ve}function Gm(i,e){function t(n,r=fn){let s;const a=$e.getTransfer(r);if(n===gn)return i.UNSIGNED_BYTE;if(n===al)return i.UNSIGNED_SHORT_4_4_4_4;if(n===ol)return i.UNSIGNED_SHORT_5_5_5_1;if(n===cu)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===ou)return i.BYTE;if(n===lu)return i.SHORT;if(n===rl)return i.UNSIGNED_SHORT;if(n===sl)return i.INT;if(n===mi)return i.UNSIGNED_INT;if(n===pn)return i.FLOAT;if(n===_n)return i.HALF_FLOAT;if(n===uu)return i.ALPHA;if(n===hu)return i.RGB;if(n===Xt)return i.RGBA;if(n===du)return i.LUMINANCE;if(n===fu)return i.LUMINANCE_ALPHA;if(n===ui)return i.DEPTH_COMPONENT;if(n===Fi)return i.DEPTH_STENCIL;if(n===pu)return i.RED;if(n===ll)return i.RED_INTEGER;if(n===mu)return i.RG;if(n===cl)return i.RG_INTEGER;if(n===ul)return i.RGBA_INTEGER;if(n===Wr||n===Xr||n===Yr||n===jr)if(a===Ke)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Wr)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Xr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Yr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===jr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Wr)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Xr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Yr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===jr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===xa||n===Ma||n===Sa||n===Ea)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===xa)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Ma)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Sa)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Ea)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===hl)return s=e.get("WEBGL_compressed_texture_etc1"),s!==null?s.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===ya||n===ba)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===ya)return a===Ke?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===ba)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===Da||n===Ta||n===Aa||n===wa||n===Ca||n===Ra||n===Pa||n===La||n===Fa||n===Ua||n===Na||n===Ia||n===Oa||n===Ba)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Da)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Ta)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Aa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===wa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Ca)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Ra)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Pa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===La)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Fa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ua)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Na)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Ia)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Oa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Ba)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===qr||n===za||n===ka)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===qr)return a===Ke?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===za)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===ka)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===gu||n===Ha||n===Va||n===Ga)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===qr)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Ha)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Va)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Ga)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Ii?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}class Wm extends Rt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class dr extends St{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Xm={type:"move"};class xs{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new dr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new dr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new R,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new R),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new dr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new R,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new R),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const v of e.hand.values()){const m=t.getJointPose(v,n),f=this._getHandJoint(c,v);m!==null&&(f.matrix.fromArray(m.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=m.radius),f.visible=m!==null}const h=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],u=h.position.distanceTo(d.position),p=.02,_=.005;c.inputState.pinching&&u>p+_?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&u<=p-_&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,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,this.dispatchEvent(Xm)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new dr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const Ym=`
|
|
3776
|
+
}`;function M0(i,e,t){let n=new tc;const r=new ue,s=new ue,a=new dt,o=new g0({depthPacking:Ju}),l=new _0,c={},u=t.maxTextureSize,d={[_n]:St,[St]:_n,[Wt]:Wt},h=new ft({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ue},radius:{value:4}},vertexShader:x0,fragmentShader:v0}),f=h.clone();f.defines.HORIZONTAL_PASS=1;const g=new _t;g.setAttribute("position",new Et(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new bt(g,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Pl;let p=this.type;this.render=function(T,A,P){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||T.length===0)return;const y=i.getRenderTarget(),M=i.getActiveCubeFace(),F=i.getActiveMipmapLevel(),L=i.state;L.setBlending(en),L.buffers.color.setClear(1,1,1,1),L.buffers.depth.setTest(!0),L.setScissorTest(!1);const C=p!==Jt&&this.type===Jt,U=p===Jt&&this.type!==Jt;for(let H=0,Y=T.length;H<Y;H++){const J=T[H],z=J.shadow;if(z===void 0){console.warn("THREE.WebGLShadowMap:",J,"has no shadow.");continue}if(z.autoUpdate===!1&&z.needsUpdate===!1)continue;r.copy(z.mapSize);const j=z.getFrameExtents();if(r.multiply(j),s.copy(z.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/j.x),r.x=s.x*j.x,z.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/j.y),r.y=s.y*j.y,z.mapSize.y=s.y)),z.map===null||C===!0||U===!0){const N=this.type!==Jt?{minFilter:Ut,magFilter:Ut}:{};z.map!==null&&z.map.dispose(),z.map=new Ht(r.x,r.y,N),z.map.texture.name=J.name+".shadowMap",z.camera.updateProjectionMatrix()}i.setRenderTarget(z.map),i.clear();const $=z.getViewportCount();for(let N=0;N<$;N++){const ee=z.getViewport(N);a.set(s.x*ee.x,s.y*ee.y,s.x*ee.z,s.y*ee.w),L.viewport(a),z.updateMatrices(J,N),n=z.getFrustum(),b(A,P,z.camera,J,this.type)}z.isPointLightShadow!==!0&&this.type===Jt&&E(z,P),z.needsUpdate=!1}p=this.type,m.needsUpdate=!1,i.setRenderTarget(y,M,F)};function E(T,A){const P=e.update(_);h.defines.VSM_SAMPLES!==T.blurSamples&&(h.defines.VSM_SAMPLES=T.blurSamples,f.defines.VSM_SAMPLES=T.blurSamples,h.needsUpdate=!0,f.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new Ht(r.x,r.y)),h.uniforms.shadow_pass.value=T.map.texture,h.uniforms.resolution.value=T.mapSize,h.uniforms.radius.value=T.radius,i.setRenderTarget(T.mapPass),i.clear(),i.renderBufferDirect(A,null,P,h,_,null),f.uniforms.shadow_pass.value=T.mapPass.texture,f.uniforms.resolution.value=T.mapSize,f.uniforms.radius.value=T.radius,i.setRenderTarget(T.map),i.clear(),i.renderBufferDirect(A,null,P,f,_,null)}function v(T,A,P,y){let M=null;const F=P.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(F!==void 0)M=F;else if(M=P.isPointLight===!0?l:o,i.localClippingEnabled&&A.clipShadows===!0&&Array.isArray(A.clippingPlanes)&&A.clippingPlanes.length!==0||A.displacementMap&&A.displacementScale!==0||A.alphaMap&&A.alphaTest>0||A.map&&A.alphaTest>0){const L=M.uuid,C=A.uuid;let U=c[L];U===void 0&&(U={},c[L]=U);let H=U[C];H===void 0&&(H=M.clone(),U[C]=H,A.addEventListener("dispose",R)),M=H}if(M.visible=A.visible,M.wireframe=A.wireframe,y===Jt?M.side=A.shadowSide!==null?A.shadowSide:A.side:M.side=A.shadowSide!==null?A.shadowSide:d[A.side],M.alphaMap=A.alphaMap,M.alphaTest=A.alphaTest,M.map=A.map,M.clipShadows=A.clipShadows,M.clippingPlanes=A.clippingPlanes,M.clipIntersection=A.clipIntersection,M.displacementMap=A.displacementMap,M.displacementScale=A.displacementScale,M.displacementBias=A.displacementBias,M.wireframeLinewidth=A.wireframeLinewidth,M.linewidth=A.linewidth,P.isPointLight===!0&&M.isMeshDistanceMaterial===!0){const L=i.properties.get(M);L.light=P}return M}function b(T,A,P,y,M){if(T.visible===!1)return;if(T.layers.test(A.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&M===Jt)&&(!T.frustumCulled||n.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,T.matrixWorld);const C=e.update(T),U=T.material;if(Array.isArray(U)){const H=C.groups;for(let Y=0,J=H.length;Y<J;Y++){const z=H[Y],j=U[z.materialIndex];if(j&&j.visible){const $=v(T,j,y,M);T.onBeforeShadow(i,T,A,P,C,$,z),i.renderBufferDirect(P,null,C,$,T,z),T.onAfterShadow(i,T,A,P,C,$,z)}}}else if(U.visible){const H=v(T,U,y,M);T.onBeforeShadow(i,T,A,P,C,H,null),i.renderBufferDirect(P,null,C,H,T,null),T.onAfterShadow(i,T,A,P,C,H,null)}}const L=T.children;for(let C=0,U=L.length;C<U;C++)b(L[C],A,P,y,M)}function R(T){T.target.removeEventListener("dispose",R);for(const P in c){const y=c[P],M=T.target.uuid;M in y&&(y[M].dispose(),delete y[M])}}}function S0(i){function e(){let x=!1;const V=new dt;let K=null;const se=new dt(0,0,0,0);return{setMask:function(pe){K!==pe&&!x&&(i.colorMask(pe,pe,pe,pe),K=pe)},setLocked:function(pe){x=pe},setClear:function(pe,Ve,ze,Ze,lt){lt===!0&&(pe*=Ze,Ve*=Ze,ze*=Ze),V.set(pe,Ve,ze,Ze),se.equals(V)===!1&&(i.clearColor(pe,Ve,ze,Ze),se.copy(V))},reset:function(){x=!1,K=null,se.set(-1,0,0,0)}}}function t(){let x=!1,V=null,K=null,se=null;return{setTest:function(pe){pe?ce(i.DEPTH_TEST):ne(i.DEPTH_TEST)},setMask:function(pe){V!==pe&&!x&&(i.depthMask(pe),V=pe)},setFunc:function(pe){if(K!==pe){switch(pe){case Tu:i.depthFunc(i.NEVER);break;case Du:i.depthFunc(i.ALWAYS);break;case Au:i.depthFunc(i.LESS);break;case Ar:i.depthFunc(i.LEQUAL);break;case wu:i.depthFunc(i.EQUAL);break;case Cu:i.depthFunc(i.GEQUAL);break;case Ru:i.depthFunc(i.GREATER);break;case Pu:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}K=pe}},setLocked:function(pe){x=pe},setClear:function(pe){se!==pe&&(i.clearDepth(pe),se=pe)},reset:function(){x=!1,V=null,K=null,se=null}}}function n(){let x=!1,V=null,K=null,se=null,pe=null,Ve=null,ze=null,Ze=null,lt=null;return{setTest:function($e){x||($e?ce(i.STENCIL_TEST):ne(i.STENCIL_TEST))},setMask:function($e){V!==$e&&!x&&(i.stencilMask($e),V=$e)},setFunc:function($e,it,rt){(K!==$e||se!==it||pe!==rt)&&(i.stencilFunc($e,it,rt),K=$e,se=it,pe=rt)},setOp:function($e,it,rt){(Ve!==$e||ze!==it||Ze!==rt)&&(i.stencilOp($e,it,rt),Ve=$e,ze=it,Ze=rt)},setLocked:function($e){x=$e},setClear:function($e){lt!==$e&&(i.clearStencil($e),lt=$e)},reset:function(){x=!1,V=null,K=null,se=null,pe=null,Ve=null,ze=null,Ze=null,lt=null}}}const r=new e,s=new t,a=new n,o=new WeakMap,l=new WeakMap;let c={},u={},d=new WeakMap,h=[],f=null,g=!1,_=null,m=null,p=null,E=null,v=null,b=null,R=null,T=new be(0,0,0),A=0,P=!1,y=null,M=null,F=null,L=null,C=null;const U=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let H=!1,Y=0;const J=i.getParameter(i.VERSION);J.indexOf("WebGL")!==-1?(Y=parseFloat(/^WebGL (\d)/.exec(J)[1]),H=Y>=1):J.indexOf("OpenGL ES")!==-1&&(Y=parseFloat(/^OpenGL ES (\d)/.exec(J)[1]),H=Y>=2);let z=null,j={};const $=i.getParameter(i.SCISSOR_BOX),N=i.getParameter(i.VIEWPORT),ee=new dt().fromArray($),me=new dt().fromArray(N);function O(x,V,K,se){const pe=new Uint8Array(4),Ve=i.createTexture();i.bindTexture(x,Ve),i.texParameteri(x,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(x,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let ze=0;ze<K;ze++)x===i.TEXTURE_3D||x===i.TEXTURE_2D_ARRAY?i.texImage3D(V,0,i.RGBA,1,1,se,0,i.RGBA,i.UNSIGNED_BYTE,pe):i.texImage2D(V+ze,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,pe);return Ve}const Q={};Q[i.TEXTURE_2D]=O(i.TEXTURE_2D,i.TEXTURE_2D,1),Q[i.TEXTURE_CUBE_MAP]=O(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),Q[i.TEXTURE_2D_ARRAY]=O(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),Q[i.TEXTURE_3D]=O(i.TEXTURE_3D,i.TEXTURE_3D,1,1),r.setClear(0,0,0,1),s.setClear(1),a.setClear(0),ce(i.DEPTH_TEST),s.setFunc(Ar),Ee(!1),We(Aa),ce(i.CULL_FACE),xe(en);function ce(x){c[x]!==!0&&(i.enable(x),c[x]=!0)}function ne(x){c[x]!==!1&&(i.disable(x),c[x]=!1)}function ve(x,V){return u[x]!==V?(i.bindFramebuffer(x,V),u[x]=V,x===i.DRAW_FRAMEBUFFER&&(u[i.FRAMEBUFFER]=V),x===i.FRAMEBUFFER&&(u[i.DRAW_FRAMEBUFFER]=V),!0):!1}function Te(x,V){let K=h,se=!1;if(x){K=d.get(V),K===void 0&&(K=[],d.set(V,K));const pe=x.textures;if(K.length!==pe.length||K[0]!==i.COLOR_ATTACHMENT0){for(let Ve=0,ze=pe.length;Ve<ze;Ve++)K[Ve]=i.COLOR_ATTACHMENT0+Ve;K.length=pe.length,se=!0}}else K[0]!==i.BACK&&(K[0]=i.BACK,se=!0);se&&i.drawBuffers(K)}function Ce(x){return f!==x?(i.useProgram(x),f=x,!0):!1}const k={[wn]:i.FUNC_ADD,[lu]:i.FUNC_SUBTRACT,[cu]:i.FUNC_REVERSE_SUBTRACT};k[uu]=i.MIN,k[hu]=i.MAX;const Fe={[du]:i.ZERO,[fu]:i.ONE,[pu]:i.SRC_COLOR,[zs]:i.SRC_ALPHA,[Mu]:i.SRC_ALPHA_SATURATE,[xu]:i.DST_COLOR,[gu]:i.DST_ALPHA,[mu]:i.ONE_MINUS_SRC_COLOR,[ks]:i.ONE_MINUS_SRC_ALPHA,[vu]:i.ONE_MINUS_DST_COLOR,[_u]:i.ONE_MINUS_DST_ALPHA,[Su]:i.CONSTANT_COLOR,[yu]:i.ONE_MINUS_CONSTANT_COLOR,[Eu]:i.CONSTANT_ALPHA,[bu]:i.ONE_MINUS_CONSTANT_ALPHA};function xe(x,V,K,se,pe,Ve,ze,Ze,lt,$e){if(x===en){g===!0&&(ne(i.BLEND),g=!1);return}if(g===!1&&(ce(i.BLEND),g=!0),x!==ou){if(x!==_||$e!==P){if((m!==wn||v!==wn)&&(i.blendEquation(i.FUNC_ADD),m=wn,v=wn),$e)switch(x){case ci:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ui:i.blendFunc(i.ONE,i.ONE);break;case wa:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Ca:i.blendFuncSeparate(i.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",x);break}else switch(x){case ci:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ui:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case wa:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Ca:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",x);break}p=null,E=null,b=null,R=null,T.set(0,0,0),A=0,_=x,P=$e}return}pe=pe||V,Ve=Ve||K,ze=ze||se,(V!==m||pe!==v)&&(i.blendEquationSeparate(k[V],k[pe]),m=V,v=pe),(K!==p||se!==E||Ve!==b||ze!==R)&&(i.blendFuncSeparate(Fe[K],Fe[se],Fe[Ve],Fe[ze]),p=K,E=se,b=Ve,R=ze),(Ze.equals(T)===!1||lt!==A)&&(i.blendColor(Ze.r,Ze.g,Ze.b,lt),T.copy(Ze),A=lt),_=x,P=!1}function Ge(x,V){x.side===Wt?ne(i.CULL_FACE):ce(i.CULL_FACE);let K=x.side===St;V&&(K=!K),Ee(K),x.blending===ci&&x.transparent===!1?xe(en):xe(x.blending,x.blendEquation,x.blendSrc,x.blendDst,x.blendEquationAlpha,x.blendSrcAlpha,x.blendDstAlpha,x.blendColor,x.blendAlpha,x.premultipliedAlpha),s.setFunc(x.depthFunc),s.setTest(x.depthTest),s.setMask(x.depthWrite),r.setMask(x.colorWrite);const se=x.stencilWrite;a.setTest(se),se&&(a.setMask(x.stencilWriteMask),a.setFunc(x.stencilFunc,x.stencilRef,x.stencilFuncMask),a.setOp(x.stencilFail,x.stencilZFail,x.stencilZPass)),S(x.polygonOffset,x.polygonOffsetFactor,x.polygonOffsetUnits),x.alphaToCoverage===!0?ce(i.SAMPLE_ALPHA_TO_COVERAGE):ne(i.SAMPLE_ALPHA_TO_COVERAGE)}function Ee(x){y!==x&&(x?i.frontFace(i.CW):i.frontFace(i.CCW),y=x)}function We(x){x!==ru?(ce(i.CULL_FACE),x!==M&&(x===Aa?i.cullFace(i.BACK):x===su?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):ne(i.CULL_FACE),M=x}function w(x){x!==F&&(H&&i.lineWidth(x),F=x)}function S(x,V,K){x?(ce(i.POLYGON_OFFSET_FILL),(L!==V||C!==K)&&(i.polygonOffset(V,K),L=V,C=K)):ne(i.POLYGON_OFFSET_FILL)}function q(x){x?ce(i.SCISSOR_TEST):ne(i.SCISSOR_TEST)}function Z(x){x===void 0&&(x=i.TEXTURE0+U-1),z!==x&&(i.activeTexture(x),z=x)}function te(x,V,K){K===void 0&&(z===null?K=i.TEXTURE0+U-1:K=z);let se=j[K];se===void 0&&(se={type:void 0,texture:void 0},j[K]=se),(se.type!==x||se.texture!==V)&&(z!==K&&(i.activeTexture(K),z=K),i.bindTexture(x,V||Q[x]),se.type=x,se.texture=V)}function ie(){const x=j[z];x!==void 0&&x.type!==void 0&&(i.bindTexture(x.type,null),x.type=void 0,x.texture=void 0)}function De(){try{i.compressedTexImage2D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function re(){try{i.compressedTexImage3D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function ye(){try{i.texSubImage2D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function Ae(){try{i.texSubImage3D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function ae(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function fe(){try{i.compressedTexSubImage3D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function Re(){try{i.texStorage2D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function ge(){try{i.texStorage3D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function _e(){try{i.texImage2D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function ke(){try{i.texImage3D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function He(x){ee.equals(x)===!1&&(i.scissor(x.x,x.y,x.z,x.w),ee.copy(x))}function qe(x){me.equals(x)===!1&&(i.viewport(x.x,x.y,x.z,x.w),me.copy(x))}function Xe(x,V){let K=l.get(V);K===void 0&&(K=new WeakMap,l.set(V,K));let se=K.get(x);se===void 0&&(se=i.getUniformBlockIndex(V,x.name),K.set(x,se))}function Ye(x,V){const se=l.get(V).get(x);o.get(V)!==se&&(i.uniformBlockBinding(V,se,x.__bindingPointIndex),o.set(V,se))}function Me(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),c={},z=null,j={},u={},d=new WeakMap,h=[],f=null,g=!1,_=null,m=null,p=null,E=null,v=null,b=null,R=null,T=new be(0,0,0),A=0,P=!1,y=null,M=null,F=null,L=null,C=null,ee.set(0,0,i.canvas.width,i.canvas.height),me.set(0,0,i.canvas.width,i.canvas.height),r.reset(),s.reset(),a.reset()}return{buffers:{color:r,depth:s,stencil:a},enable:ce,disable:ne,bindFramebuffer:ve,drawBuffers:Te,useProgram:Ce,setBlending:xe,setMaterial:Ge,setFlipSided:Ee,setCullFace:We,setLineWidth:w,setPolygonOffset:S,setScissorTest:q,activeTexture:Z,bindTexture:te,unbindTexture:ie,compressedTexImage2D:De,compressedTexImage3D:re,texImage2D:_e,texImage3D:ke,updateUBOMapping:Xe,uniformBlockBinding:Ye,texStorage2D:Re,texStorage3D:ge,texSubImage2D:ye,texSubImage3D:Ae,compressedTexSubImage2D:ae,compressedTexSubImage3D:fe,scissor:He,viewport:qe,reset:Me}}function y0(i,e,t,n,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new ue,u=new WeakMap;let d;const h=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(w,S){return f?new OffscreenCanvas(w,S):Lr("canvas")}function _(w,S,q){let Z=1;const te=We(w);if((te.width>q||te.height>q)&&(Z=q/Math.max(te.width,te.height)),Z<1)if(typeof HTMLImageElement<"u"&&w instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&w instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&w instanceof ImageBitmap||typeof VideoFrame<"u"&&w instanceof VideoFrame){const ie=Math.floor(Z*te.width),De=Math.floor(Z*te.height);d===void 0&&(d=g(ie,De));const re=S?g(ie,De):d;return re.width=ie,re.height=De,re.getContext("2d").drawImage(w,0,0,ie,De),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+te.width+"x"+te.height+") to ("+ie+"x"+De+")."),re}else return"data"in w&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+te.width+"x"+te.height+")."),w;return w}function m(w){return w.generateMipmaps&&w.minFilter!==Ut&&w.minFilter!==zt}function p(w){i.generateMipmap(w)}function E(w,S,q,Z,te=!1){if(w!==null){if(i[w]!==void 0)return i[w];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+w+"'")}let ie=S;if(S===i.RED&&(q===i.FLOAT&&(ie=i.R32F),q===i.HALF_FLOAT&&(ie=i.R16F),q===i.UNSIGNED_BYTE&&(ie=i.R8)),S===i.RED_INTEGER&&(q===i.UNSIGNED_BYTE&&(ie=i.R8UI),q===i.UNSIGNED_SHORT&&(ie=i.R16UI),q===i.UNSIGNED_INT&&(ie=i.R32UI),q===i.BYTE&&(ie=i.R8I),q===i.SHORT&&(ie=i.R16I),q===i.INT&&(ie=i.R32I)),S===i.RG&&(q===i.FLOAT&&(ie=i.RG32F),q===i.HALF_FLOAT&&(ie=i.RG16F),q===i.UNSIGNED_BYTE&&(ie=i.RG8)),S===i.RG_INTEGER&&(q===i.UNSIGNED_BYTE&&(ie=i.RG8UI),q===i.UNSIGNED_SHORT&&(ie=i.RG16UI),q===i.UNSIGNED_INT&&(ie=i.RG32UI),q===i.BYTE&&(ie=i.RG8I),q===i.SHORT&&(ie=i.RG16I),q===i.INT&&(ie=i.RG32I)),S===i.RGB&&q===i.UNSIGNED_INT_5_9_9_9_REV&&(ie=i.RGB9_E5),S===i.RGBA){const De=te?wr:je.getTransfer(Z);q===i.FLOAT&&(ie=i.RGBA32F),q===i.HALF_FLOAT&&(ie=i.RGBA16F),q===i.UNSIGNED_BYTE&&(ie=De===Ke?i.SRGB8_ALPHA8:i.RGBA8),q===i.UNSIGNED_SHORT_4_4_4_4&&(ie=i.RGBA4),q===i.UNSIGNED_SHORT_5_5_5_1&&(ie=i.RGB5_A1)}return(ie===i.R16F||ie===i.R32F||ie===i.RG16F||ie===i.RG32F||ie===i.RGBA16F||ie===i.RGBA32F)&&e.get("EXT_color_buffer_float"),ie}function v(w,S){return m(w)===!0||w.isFramebufferTexture&&w.minFilter!==Ut&&w.minFilter!==zt?Math.log2(Math.max(S.width,S.height))+1:w.mipmaps!==void 0&&w.mipmaps.length>0?w.mipmaps.length:w.isCompressedTexture&&Array.isArray(w.image)?S.mipmaps.length:1}function b(w){const S=w.target;S.removeEventListener("dispose",b),T(S),S.isVideoTexture&&u.delete(S)}function R(w){const S=w.target;S.removeEventListener("dispose",R),P(S)}function T(w){const S=n.get(w);if(S.__webglInit===void 0)return;const q=w.source,Z=h.get(q);if(Z){const te=Z[S.__cacheKey];te.usedTimes--,te.usedTimes===0&&A(w),Object.keys(Z).length===0&&h.delete(q)}n.remove(w)}function A(w){const S=n.get(w);i.deleteTexture(S.__webglTexture);const q=w.source,Z=h.get(q);delete Z[S.__cacheKey],a.memory.textures--}function P(w){const S=n.get(w);if(w.depthTexture&&w.depthTexture.dispose(),w.isWebGLCubeRenderTarget)for(let Z=0;Z<6;Z++){if(Array.isArray(S.__webglFramebuffer[Z]))for(let te=0;te<S.__webglFramebuffer[Z].length;te++)i.deleteFramebuffer(S.__webglFramebuffer[Z][te]);else i.deleteFramebuffer(S.__webglFramebuffer[Z]);S.__webglDepthbuffer&&i.deleteRenderbuffer(S.__webglDepthbuffer[Z])}else{if(Array.isArray(S.__webglFramebuffer))for(let Z=0;Z<S.__webglFramebuffer.length;Z++)i.deleteFramebuffer(S.__webglFramebuffer[Z]);else i.deleteFramebuffer(S.__webglFramebuffer);if(S.__webglDepthbuffer&&i.deleteRenderbuffer(S.__webglDepthbuffer),S.__webglMultisampledFramebuffer&&i.deleteFramebuffer(S.__webglMultisampledFramebuffer),S.__webglColorRenderbuffer)for(let Z=0;Z<S.__webglColorRenderbuffer.length;Z++)S.__webglColorRenderbuffer[Z]&&i.deleteRenderbuffer(S.__webglColorRenderbuffer[Z]);S.__webglDepthRenderbuffer&&i.deleteRenderbuffer(S.__webglDepthRenderbuffer)}const q=w.textures;for(let Z=0,te=q.length;Z<te;Z++){const ie=n.get(q[Z]);ie.__webglTexture&&(i.deleteTexture(ie.__webglTexture),a.memory.textures--),n.remove(q[Z])}n.remove(w)}let y=0;function M(){y=0}function F(){const w=y;return w>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+w+" texture units while this GPU supports only "+r.maxTextures),y+=1,w}function L(w){const S=[];return S.push(w.wrapS),S.push(w.wrapT),S.push(w.wrapR||0),S.push(w.magFilter),S.push(w.minFilter),S.push(w.anisotropy),S.push(w.internalFormat),S.push(w.format),S.push(w.type),S.push(w.generateMipmaps),S.push(w.premultiplyAlpha),S.push(w.flipY),S.push(w.unpackAlignment),S.push(w.colorSpace),S.join()}function C(w,S){const q=n.get(w);if(w.isVideoTexture&&Ge(w),w.isRenderTargetTexture===!1&&w.version>0&&q.__version!==w.version){const Z=w.image;if(Z===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Z.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ee(q,w,S);return}}t.bindTexture(i.TEXTURE_2D,q.__webglTexture,i.TEXTURE0+S)}function U(w,S){const q=n.get(w);if(w.version>0&&q.__version!==w.version){ee(q,w,S);return}t.bindTexture(i.TEXTURE_2D_ARRAY,q.__webglTexture,i.TEXTURE0+S)}function H(w,S){const q=n.get(w);if(w.version>0&&q.__version!==w.version){ee(q,w,S);return}t.bindTexture(i.TEXTURE_3D,q.__webglTexture,i.TEXTURE0+S)}function Y(w,S){const q=n.get(w);if(w.version>0&&q.__version!==w.version){me(q,w,S);return}t.bindTexture(i.TEXTURE_CUBE_MAP,q.__webglTexture,i.TEXTURE0+S)}const J={[Gs]:i.REPEAT,[Pn]:i.CLAMP_TO_EDGE,[Ws]:i.MIRRORED_REPEAT},z={[Ut]:i.NEAREST,[ku]:i.NEAREST_MIPMAP_NEAREST,[Yi]:i.NEAREST_MIPMAP_LINEAR,[zt]:i.LINEAR,[Yr]:i.LINEAR_MIPMAP_NEAREST,[Ln]:i.LINEAR_MIPMAP_LINEAR},j={[th]:i.NEVER,[oh]:i.ALWAYS,[nh]:i.LESS,[Vl]:i.LEQUAL,[ih]:i.EQUAL,[ah]:i.GEQUAL,[rh]:i.GREATER,[sh]:i.NOTEQUAL};function $(w,S){if(S.type===fn&&e.has("OES_texture_float_linear")===!1&&(S.magFilter===zt||S.magFilter===Yr||S.magFilter===Yi||S.magFilter===Ln||S.minFilter===zt||S.minFilter===Yr||S.minFilter===Yi||S.minFilter===Ln)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(w,i.TEXTURE_WRAP_S,J[S.wrapS]),i.texParameteri(w,i.TEXTURE_WRAP_T,J[S.wrapT]),(w===i.TEXTURE_3D||w===i.TEXTURE_2D_ARRAY)&&i.texParameteri(w,i.TEXTURE_WRAP_R,J[S.wrapR]),i.texParameteri(w,i.TEXTURE_MAG_FILTER,z[S.magFilter]),i.texParameteri(w,i.TEXTURE_MIN_FILTER,z[S.minFilter]),S.compareFunction&&(i.texParameteri(w,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(w,i.TEXTURE_COMPARE_FUNC,j[S.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(S.magFilter===Ut||S.minFilter!==Yi&&S.minFilter!==Ln||S.type===fn&&e.has("OES_texture_float_linear")===!1)return;if(S.anisotropy>1||n.get(S).__currentAnisotropy){const q=e.get("EXT_texture_filter_anisotropic");i.texParameterf(w,q.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(S.anisotropy,r.getMaxAnisotropy())),n.get(S).__currentAnisotropy=S.anisotropy}}}function N(w,S){let q=!1;w.__webglInit===void 0&&(w.__webglInit=!0,S.addEventListener("dispose",b));const Z=S.source;let te=h.get(Z);te===void 0&&(te={},h.set(Z,te));const ie=L(S);if(ie!==w.__cacheKey){te[ie]===void 0&&(te[ie]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,q=!0),te[ie].usedTimes++;const De=te[w.__cacheKey];De!==void 0&&(te[w.__cacheKey].usedTimes--,De.usedTimes===0&&A(S)),w.__cacheKey=ie,w.__webglTexture=te[ie].texture}return q}function ee(w,S,q){let Z=i.TEXTURE_2D;(S.isDataArrayTexture||S.isCompressedArrayTexture)&&(Z=i.TEXTURE_2D_ARRAY),S.isData3DTexture&&(Z=i.TEXTURE_3D);const te=N(w,S),ie=S.source;t.bindTexture(Z,w.__webglTexture,i.TEXTURE0+q);const De=n.get(ie);if(ie.version!==De.__version||te===!0){t.activeTexture(i.TEXTURE0+q);const re=je.getPrimaries(je.workingColorSpace),ye=S.colorSpace===dn?null:je.getPrimaries(S.colorSpace),Ae=S.colorSpace===dn||re===ye?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,S.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,S.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ae);let ae=_(S.image,!1,r.maxTextureSize);ae=Ee(S,ae);const fe=s.convert(S.format,S.colorSpace),Re=s.convert(S.type);let ge=E(S.internalFormat,fe,Re,S.colorSpace,S.isVideoTexture);$(Z,S);let _e;const ke=S.mipmaps,He=S.isVideoTexture!==!0&&ge!==Hl,qe=De.__version===void 0||te===!0,Xe=ie.dataReady,Ye=v(S,ae);if(S.isDepthTexture)ge=i.DEPTH_COMPONENT16,S.type===fn?ge=i.DEPTH_COMPONENT32F:S.type===gi?ge=i.DEPTH_COMPONENT24:S.type===zi&&(ge=i.DEPTH24_STENCIL8),qe&&(He?t.texStorage2D(i.TEXTURE_2D,1,ge,ae.width,ae.height):t.texImage2D(i.TEXTURE_2D,0,ge,ae.width,ae.height,0,fe,Re,null));else if(S.isDataTexture)if(ke.length>0){He&&qe&&t.texStorage2D(i.TEXTURE_2D,Ye,ge,ke[0].width,ke[0].height);for(let Me=0,x=ke.length;Me<x;Me++)_e=ke[Me],He?Xe&&t.texSubImage2D(i.TEXTURE_2D,Me,0,0,_e.width,_e.height,fe,Re,_e.data):t.texImage2D(i.TEXTURE_2D,Me,ge,_e.width,_e.height,0,fe,Re,_e.data);S.generateMipmaps=!1}else He?(qe&&t.texStorage2D(i.TEXTURE_2D,Ye,ge,ae.width,ae.height),Xe&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,ae.width,ae.height,fe,Re,ae.data)):t.texImage2D(i.TEXTURE_2D,0,ge,ae.width,ae.height,0,fe,Re,ae.data);else if(S.isCompressedTexture)if(S.isCompressedArrayTexture){He&&qe&&t.texStorage3D(i.TEXTURE_2D_ARRAY,Ye,ge,ke[0].width,ke[0].height,ae.depth);for(let Me=0,x=ke.length;Me<x;Me++)_e=ke[Me],S.format!==Xt?fe!==null?He?Xe&&t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Me,0,0,0,_e.width,_e.height,ae.depth,fe,_e.data,0,0):t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,Me,ge,_e.width,_e.height,ae.depth,0,_e.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):He?Xe&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,Me,0,0,0,_e.width,_e.height,ae.depth,fe,Re,_e.data):t.texImage3D(i.TEXTURE_2D_ARRAY,Me,ge,_e.width,_e.height,ae.depth,0,fe,Re,_e.data)}else{He&&qe&&t.texStorage2D(i.TEXTURE_2D,Ye,ge,ke[0].width,ke[0].height);for(let Me=0,x=ke.length;Me<x;Me++)_e=ke[Me],S.format!==Xt?fe!==null?He?Xe&&t.compressedTexSubImage2D(i.TEXTURE_2D,Me,0,0,_e.width,_e.height,fe,_e.data):t.compressedTexImage2D(i.TEXTURE_2D,Me,ge,_e.width,_e.height,0,_e.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):He?Xe&&t.texSubImage2D(i.TEXTURE_2D,Me,0,0,_e.width,_e.height,fe,Re,_e.data):t.texImage2D(i.TEXTURE_2D,Me,ge,_e.width,_e.height,0,fe,Re,_e.data)}else if(S.isDataArrayTexture)He?(qe&&t.texStorage3D(i.TEXTURE_2D_ARRAY,Ye,ge,ae.width,ae.height,ae.depth),Xe&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,ae.width,ae.height,ae.depth,fe,Re,ae.data)):t.texImage3D(i.TEXTURE_2D_ARRAY,0,ge,ae.width,ae.height,ae.depth,0,fe,Re,ae.data);else if(S.isData3DTexture)He?(qe&&t.texStorage3D(i.TEXTURE_3D,Ye,ge,ae.width,ae.height,ae.depth),Xe&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,ae.width,ae.height,ae.depth,fe,Re,ae.data)):t.texImage3D(i.TEXTURE_3D,0,ge,ae.width,ae.height,ae.depth,0,fe,Re,ae.data);else if(S.isFramebufferTexture){if(qe)if(He)t.texStorage2D(i.TEXTURE_2D,Ye,ge,ae.width,ae.height);else{let Me=ae.width,x=ae.height;for(let V=0;V<Ye;V++)t.texImage2D(i.TEXTURE_2D,V,ge,Me,x,0,fe,Re,null),Me>>=1,x>>=1}}else if(ke.length>0){if(He&&qe){const Me=We(ke[0]);t.texStorage2D(i.TEXTURE_2D,Ye,ge,Me.width,Me.height)}for(let Me=0,x=ke.length;Me<x;Me++)_e=ke[Me],He?Xe&&t.texSubImage2D(i.TEXTURE_2D,Me,0,0,fe,Re,_e):t.texImage2D(i.TEXTURE_2D,Me,ge,fe,Re,_e);S.generateMipmaps=!1}else if(He){if(qe){const Me=We(ae);t.texStorage2D(i.TEXTURE_2D,Ye,ge,Me.width,Me.height)}Xe&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,fe,Re,ae)}else t.texImage2D(i.TEXTURE_2D,0,ge,fe,Re,ae);m(S)&&p(Z),De.__version=ie.version,S.onUpdate&&S.onUpdate(S)}w.__version=S.version}function me(w,S,q){if(S.image.length!==6)return;const Z=N(w,S),te=S.source;t.bindTexture(i.TEXTURE_CUBE_MAP,w.__webglTexture,i.TEXTURE0+q);const ie=n.get(te);if(te.version!==ie.__version||Z===!0){t.activeTexture(i.TEXTURE0+q);const De=je.getPrimaries(je.workingColorSpace),re=S.colorSpace===dn?null:je.getPrimaries(S.colorSpace),ye=S.colorSpace===dn||De===re?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,S.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,S.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,ye);const Ae=S.isCompressedTexture||S.image[0].isCompressedTexture,ae=S.image[0]&&S.image[0].isDataTexture,fe=[];for(let x=0;x<6;x++)!Ae&&!ae?fe[x]=_(S.image[x],!0,r.maxCubemapSize):fe[x]=ae?S.image[x].image:S.image[x],fe[x]=Ee(S,fe[x]);const Re=fe[0],ge=s.convert(S.format,S.colorSpace),_e=s.convert(S.type),ke=E(S.internalFormat,ge,_e,S.colorSpace),He=S.isVideoTexture!==!0,qe=ie.__version===void 0||Z===!0,Xe=te.dataReady;let Ye=v(S,Re);$(i.TEXTURE_CUBE_MAP,S);let Me;if(Ae){He&&qe&&t.texStorage2D(i.TEXTURE_CUBE_MAP,Ye,ke,Re.width,Re.height);for(let x=0;x<6;x++){Me=fe[x].mipmaps;for(let V=0;V<Me.length;V++){const K=Me[V];S.format!==Xt?ge!==null?He?Xe&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,V,0,0,K.width,K.height,ge,K.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,V,ke,K.width,K.height,0,K.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,V,0,0,K.width,K.height,ge,_e,K.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,V,ke,K.width,K.height,0,ge,_e,K.data)}}}else{if(Me=S.mipmaps,He&&qe){Me.length>0&&Ye++;const x=We(fe[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,Ye,ke,x.width,x.height)}for(let x=0;x<6;x++)if(ae){He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,0,0,fe[x].width,fe[x].height,ge,_e,fe[x].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,ke,fe[x].width,fe[x].height,0,ge,_e,fe[x].data);for(let V=0;V<Me.length;V++){const se=Me[V].image[x].image;He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,V+1,0,0,se.width,se.height,ge,_e,se.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,V+1,ke,se.width,se.height,0,ge,_e,se.data)}}else{He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,0,0,ge,_e,fe[x]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,ke,ge,_e,fe[x]);for(let V=0;V<Me.length;V++){const K=Me[V];He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,V+1,0,0,ge,_e,K.image[x]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,V+1,ke,ge,_e,K.image[x])}}}m(S)&&p(i.TEXTURE_CUBE_MAP),ie.__version=te.version,S.onUpdate&&S.onUpdate(S)}w.__version=S.version}function O(w,S,q,Z,te,ie){const De=s.convert(q.format,q.colorSpace),re=s.convert(q.type),ye=E(q.internalFormat,De,re,q.colorSpace);if(!n.get(S).__hasExternalTextures){const ae=Math.max(1,S.width>>ie),fe=Math.max(1,S.height>>ie);te===i.TEXTURE_3D||te===i.TEXTURE_2D_ARRAY?t.texImage3D(te,ie,ye,ae,fe,S.depth,0,De,re,null):t.texImage2D(te,ie,ye,ae,fe,0,De,re,null)}t.bindFramebuffer(i.FRAMEBUFFER,w),xe(S)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Z,te,n.get(q).__webglTexture,0,Fe(S)):(te===i.TEXTURE_2D||te>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&te<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Z,te,n.get(q).__webglTexture,ie),t.bindFramebuffer(i.FRAMEBUFFER,null)}function Q(w,S,q){if(i.bindRenderbuffer(i.RENDERBUFFER,w),S.depthBuffer&&!S.stencilBuffer){let Z=i.DEPTH_COMPONENT24;if(q||xe(S)){const te=S.depthTexture;te&&te.isDepthTexture&&(te.type===fn?Z=i.DEPTH_COMPONENT32F:te.type===gi&&(Z=i.DEPTH_COMPONENT24));const ie=Fe(S);xe(S)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,ie,Z,S.width,S.height):i.renderbufferStorageMultisample(i.RENDERBUFFER,ie,Z,S.width,S.height)}else i.renderbufferStorage(i.RENDERBUFFER,Z,S.width,S.height);i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,w)}else if(S.depthBuffer&&S.stencilBuffer){const Z=Fe(S);q&&xe(S)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Z,i.DEPTH24_STENCIL8,S.width,S.height):xe(S)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Z,i.DEPTH24_STENCIL8,S.width,S.height):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,S.width,S.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,w)}else{const Z=S.textures;for(let te=0;te<Z.length;te++){const ie=Z[te],De=s.convert(ie.format,ie.colorSpace),re=s.convert(ie.type),ye=E(ie.internalFormat,De,re,ie.colorSpace),Ae=Fe(S);q&&xe(S)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Ae,ye,S.width,S.height):xe(S)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Ae,ye,S.width,S.height):i.renderbufferStorage(i.RENDERBUFFER,ye,S.width,S.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function ce(w,S){if(S&&S.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,w),!(S.depthTexture&&S.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(S.depthTexture).__webglTexture||S.depthTexture.image.width!==S.width||S.depthTexture.image.height!==S.height)&&(S.depthTexture.image.width=S.width,S.depthTexture.image.height=S.height,S.depthTexture.needsUpdate=!0),C(S.depthTexture,0);const Z=n.get(S.depthTexture).__webglTexture,te=Fe(S);if(S.depthTexture.format===hi)xe(S)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,Z,0,te):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,Z,0);else if(S.depthTexture.format===Ni)xe(S)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,Z,0,te):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,Z,0);else throw new Error("Unknown depthTexture format")}function ne(w){const S=n.get(w),q=w.isWebGLCubeRenderTarget===!0;if(w.depthTexture&&!S.__autoAllocateDepthBuffer){if(q)throw new Error("target.depthTexture not supported in Cube render targets");ce(S.__webglFramebuffer,w)}else if(q){S.__webglDepthbuffer=[];for(let Z=0;Z<6;Z++)t.bindFramebuffer(i.FRAMEBUFFER,S.__webglFramebuffer[Z]),S.__webglDepthbuffer[Z]=i.createRenderbuffer(),Q(S.__webglDepthbuffer[Z],w,!1)}else t.bindFramebuffer(i.FRAMEBUFFER,S.__webglFramebuffer),S.__webglDepthbuffer=i.createRenderbuffer(),Q(S.__webglDepthbuffer,w,!1);t.bindFramebuffer(i.FRAMEBUFFER,null)}function ve(w,S,q){const Z=n.get(w);S!==void 0&&O(Z.__webglFramebuffer,w,w.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),q!==void 0&&ne(w)}function Te(w){const S=w.texture,q=n.get(w),Z=n.get(S);w.addEventListener("dispose",R);const te=w.textures,ie=w.isWebGLCubeRenderTarget===!0,De=te.length>1;if(De||(Z.__webglTexture===void 0&&(Z.__webglTexture=i.createTexture()),Z.__version=S.version,a.memory.textures++),ie){q.__webglFramebuffer=[];for(let re=0;re<6;re++)if(S.mipmaps&&S.mipmaps.length>0){q.__webglFramebuffer[re]=[];for(let ye=0;ye<S.mipmaps.length;ye++)q.__webglFramebuffer[re][ye]=i.createFramebuffer()}else q.__webglFramebuffer[re]=i.createFramebuffer()}else{if(S.mipmaps&&S.mipmaps.length>0){q.__webglFramebuffer=[];for(let re=0;re<S.mipmaps.length;re++)q.__webglFramebuffer[re]=i.createFramebuffer()}else q.__webglFramebuffer=i.createFramebuffer();if(De)for(let re=0,ye=te.length;re<ye;re++){const Ae=n.get(te[re]);Ae.__webglTexture===void 0&&(Ae.__webglTexture=i.createTexture(),a.memory.textures++)}if(w.samples>0&&xe(w)===!1){q.__webglMultisampledFramebuffer=i.createFramebuffer(),q.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,q.__webglMultisampledFramebuffer);for(let re=0;re<te.length;re++){const ye=te[re];q.__webglColorRenderbuffer[re]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,q.__webglColorRenderbuffer[re]);const Ae=s.convert(ye.format,ye.colorSpace),ae=s.convert(ye.type),fe=E(ye.internalFormat,Ae,ae,ye.colorSpace,w.isXRRenderTarget===!0),Re=Fe(w);i.renderbufferStorageMultisample(i.RENDERBUFFER,Re,fe,w.width,w.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+re,i.RENDERBUFFER,q.__webglColorRenderbuffer[re])}i.bindRenderbuffer(i.RENDERBUFFER,null),w.depthBuffer&&(q.__webglDepthRenderbuffer=i.createRenderbuffer(),Q(q.__webglDepthRenderbuffer,w,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(ie){t.bindTexture(i.TEXTURE_CUBE_MAP,Z.__webglTexture),$(i.TEXTURE_CUBE_MAP,S);for(let re=0;re<6;re++)if(S.mipmaps&&S.mipmaps.length>0)for(let ye=0;ye<S.mipmaps.length;ye++)O(q.__webglFramebuffer[re][ye],w,S,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+re,ye);else O(q.__webglFramebuffer[re],w,S,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+re,0);m(S)&&p(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(De){for(let re=0,ye=te.length;re<ye;re++){const Ae=te[re],ae=n.get(Ae);t.bindTexture(i.TEXTURE_2D,ae.__webglTexture),$(i.TEXTURE_2D,Ae),O(q.__webglFramebuffer,w,Ae,i.COLOR_ATTACHMENT0+re,i.TEXTURE_2D,0),m(Ae)&&p(i.TEXTURE_2D)}t.unbindTexture()}else{let re=i.TEXTURE_2D;if((w.isWebGL3DRenderTarget||w.isWebGLArrayRenderTarget)&&(re=w.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(re,Z.__webglTexture),$(re,S),S.mipmaps&&S.mipmaps.length>0)for(let ye=0;ye<S.mipmaps.length;ye++)O(q.__webglFramebuffer[ye],w,S,i.COLOR_ATTACHMENT0,re,ye);else O(q.__webglFramebuffer,w,S,i.COLOR_ATTACHMENT0,re,0);m(S)&&p(re),t.unbindTexture()}w.depthBuffer&&ne(w)}function Ce(w){const S=w.textures;for(let q=0,Z=S.length;q<Z;q++){const te=S[q];if(m(te)){const ie=w.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:i.TEXTURE_2D,De=n.get(te).__webglTexture;t.bindTexture(ie,De),p(ie),t.unbindTexture()}}}function k(w){if(w.samples>0&&xe(w)===!1){const S=w.textures,q=w.width,Z=w.height;let te=i.COLOR_BUFFER_BIT;const ie=[],De=w.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,re=n.get(w),ye=S.length>1;if(ye)for(let Ae=0;Ae<S.length;Ae++)t.bindFramebuffer(i.FRAMEBUFFER,re.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ae,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,re.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ae,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,re.__webglMultisampledFramebuffer),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,re.__webglFramebuffer);for(let Ae=0;Ae<S.length;Ae++){ie.push(i.COLOR_ATTACHMENT0+Ae),w.depthBuffer&&ie.push(De);const ae=re.__ignoreDepthValues!==void 0?re.__ignoreDepthValues:!1;if(ae===!1&&(w.depthBuffer&&(te|=i.DEPTH_BUFFER_BIT),w.stencilBuffer&&re.__isTransmissionRenderTarget!==!0&&(te|=i.STENCIL_BUFFER_BIT)),ye&&i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,re.__webglColorRenderbuffer[Ae]),ae===!0&&(i.invalidateFramebuffer(i.READ_FRAMEBUFFER,[De]),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[De])),ye){const fe=n.get(S[Ae]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,fe,0)}i.blitFramebuffer(0,0,q,Z,0,0,q,Z,te,i.NEAREST),l&&i.invalidateFramebuffer(i.READ_FRAMEBUFFER,ie)}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),ye)for(let Ae=0;Ae<S.length;Ae++){t.bindFramebuffer(i.FRAMEBUFFER,re.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ae,i.RENDERBUFFER,re.__webglColorRenderbuffer[Ae]);const ae=n.get(S[Ae]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,re.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ae,i.TEXTURE_2D,ae,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,re.__webglMultisampledFramebuffer)}}function Fe(w){return Math.min(r.maxSamples,w.samples)}function xe(w){const S=n.get(w);return w.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&S.__useRenderToTexture!==!1}function Ge(w){const S=a.render.frame;u.get(w)!==S&&(u.set(w,S),w.update())}function Ee(w,S){const q=w.colorSpace,Z=w.format,te=w.type;return w.isCompressedTexture===!0||w.isVideoTexture===!0||q!==xn&&q!==dn&&(je.getTransfer(q)===Ke?(Z!==Xt||te!==mn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",q)),S}function We(w){return typeof HTMLImageElement<"u"&&w instanceof HTMLImageElement?(c.width=w.naturalWidth||w.width,c.height=w.naturalHeight||w.height):typeof VideoFrame<"u"&&w instanceof VideoFrame?(c.width=w.displayWidth,c.height=w.displayHeight):(c.width=w.width,c.height=w.height),c}this.allocateTextureUnit=F,this.resetTextureUnits=M,this.setTexture2D=C,this.setTexture2DArray=U,this.setTexture3D=H,this.setTextureCube=Y,this.rebindTextures=ve,this.setupRenderTarget=Te,this.updateRenderTargetMipmap=Ce,this.updateMultisampleRenderTarget=k,this.setupDepthRenderbuffer=ne,this.setupFrameBufferTexture=O,this.useMultisampledRTT=xe}function E0(i,e){function t(n,r=dn){let s;const a=je.getTransfer(r);if(n===mn)return i.UNSIGNED_BYTE;if(n===Nl)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Ol)return i.UNSIGNED_SHORT_5_5_5_1;if(n===Gu)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Hu)return i.BYTE;if(n===Vu)return i.SHORT;if(n===Il)return i.UNSIGNED_SHORT;if(n===Ul)return i.INT;if(n===gi)return i.UNSIGNED_INT;if(n===fn)return i.FLOAT;if(n===gn)return i.HALF_FLOAT;if(n===Wu)return i.ALPHA;if(n===Xu)return i.RGB;if(n===Xt)return i.RGBA;if(n===qu)return i.LUMINANCE;if(n===Yu)return i.LUMINANCE_ALPHA;if(n===hi)return i.DEPTH_COMPONENT;if(n===Ni)return i.DEPTH_STENCIL;if(n===$u)return i.RED;if(n===Bl)return i.RED_INTEGER;if(n===ju)return i.RG;if(n===zl)return i.RG_INTEGER;if(n===kl)return i.RGBA_INTEGER;if(n===$r||n===jr||n===Kr||n===Zr)if(a===Ke)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===$r)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===jr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Kr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Zr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===$r)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===jr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Kr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Zr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Ra||n===Pa||n===La||n===Fa)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Ra)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Pa)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===La)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Fa)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Hl)return s=e.get("WEBGL_compressed_texture_etc1"),s!==null?s.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===Ia||n===Ua)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Ia)return a===Ke?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===Ua)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===Na||n===Oa||n===Ba||n===za||n===ka||n===Ha||n===Va||n===Ga||n===Wa||n===Xa||n===qa||n===Ya||n===$a||n===ja)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Na)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Oa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ba)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===za)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===ka)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Ha)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Va)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Ga)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Wa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Xa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===qa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Ya)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===$a)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===ja)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Jr||n===Ka||n===Za)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Jr)return a===Ke?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Ka)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Za)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Ku||n===Ja||n===Qa||n===eo)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Jr)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Ja)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Qa)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===eo)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===zi?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}class b0 extends Rt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class mr extends yt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const T0={type:"move"};class Es{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new mr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new mr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new I,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new I),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new mr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new I,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new I),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const _ of e.hand.values()){const m=t.getJointPose(_,n),p=this._getHandJoint(c,_);m!==null&&(p.matrix.fromArray(m.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=m.radius),p.visible=m!==null}const u=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],h=u.position.distanceTo(d.position),f=.02,g=.005;c.inputState.pinching&&h>f+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=f-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,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,this.dispatchEvent(T0)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new mr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const D0=`
|
|
3777
3777
|
void main() {
|
|
3778
3778
|
|
|
3779
3779
|
gl_Position = vec4( position, 1.0 );
|
|
3780
3780
|
|
|
3781
|
-
}`,
|
|
3781
|
+
}`,A0=`
|
|
3782
3782
|
uniform sampler2DArray depthColor;
|
|
3783
3783
|
uniform float depthWidth;
|
|
3784
3784
|
uniform float depthHeight;
|
|
@@ -3797,7 +3797,7 @@ void main() {
|
|
|
3797
3797
|
|
|
3798
3798
|
}
|
|
3799
3799
|
|
|
3800
|
-
}`;class qm{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const r=new Dt,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=n.depthNear||t.depthFar!=n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}render(e,t){if(this.texture!==null){if(this.mesh===null){const n=t.cameras[0].viewport,r=new ft({vertexShader:Ym,fragmentShader:jm,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new bt(new Nr(20,20),r)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}}class $m extends In{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,h=null,d=null,u=null,p=null,_=null;const v=new qm,m=t.getContextAttributes();let f=null,b=null;const x=[],D=[],P=new ue;let T=null;const w=new Rt;w.layers.enable(1),w.viewport=new dt;const L=new Rt;L.layers.enable(2),L.viewport=new dt;const E=[w,L],M=new Wm;M.layers.enable(1),M.layers.enable(2);let N=null,I=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(U){let J=x[U];return J===void 0&&(J=new xs,x[U]=J),J.getTargetRaySpace()},this.getControllerGrip=function(U){let J=x[U];return J===void 0&&(J=new xs,x[U]=J),J.getGripSpace()},this.getHand=function(U){let J=x[U];return J===void 0&&(J=new xs,x[U]=J),J.getHandSpace()};function C(U){const J=D.indexOf(U.inputSource);if(J===-1)return;const le=x[J];le!==void 0&&(le.update(U.inputSource,U.frame,c||a),le.dispatchEvent({type:U.type,data:U.inputSource}))}function z(){r.removeEventListener("select",C),r.removeEventListener("selectstart",C),r.removeEventListener("selectend",C),r.removeEventListener("squeeze",C),r.removeEventListener("squeezestart",C),r.removeEventListener("squeezeend",C),r.removeEventListener("end",z),r.removeEventListener("inputsourceschange",V);for(let U=0;U<x.length;U++){const J=D[U];J!==null&&(D[U]=null,x[U].disconnect(J))}N=null,I=null,v.reset(),e.setRenderTarget(f),p=null,u=null,d=null,r=null,b=null,pe.stop(),n.isPresenting=!1,e.setPixelRatio(T),e.setSize(P.width,P.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(U){s=U,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(U){o=U,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(U){c=U},this.getBaseLayer=function(){return u!==null?u:p},this.getBinding=function(){return d},this.getFrame=function(){return _},this.getSession=function(){return r},this.setSession=async function(U){if(r=U,r!==null){if(f=e.getRenderTarget(),r.addEventListener("select",C),r.addEventListener("selectstart",C),r.addEventListener("selectend",C),r.addEventListener("squeeze",C),r.addEventListener("squeezestart",C),r.addEventListener("squeezeend",C),r.addEventListener("end",z),r.addEventListener("inputsourceschange",V),m.xrCompatible!==!0&&await t.makeXRCompatible(),T=e.getPixelRatio(),e.getSize(P),r.renderState.layers===void 0){const J={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(r,t,J),r.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),b=new Ht(p.framebufferWidth,p.framebufferHeight,{format:Xt,type:gn,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil})}else{let J=null,le=null,ne=null;m.depth&&(ne=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,J=m.stencil?Fi:ui,le=m.stencil?Ii:mi);const xe={colorFormat:t.RGBA8,depthFormat:ne,scaleFactor:s};d=new XRWebGLBinding(r,t),u=d.createProjectionLayer(xe),r.updateRenderState({layers:[u]}),e.setPixelRatio(1),e.setSize(u.textureWidth,u.textureHeight,!1),b=new Ht(u.textureWidth,u.textureHeight,{format:Xt,type:gn,depthTexture:new Al(u.textureWidth,u.textureHeight,le,void 0,void 0,void 0,void 0,void 0,void 0,J),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0});const De=e.properties.get(b);De.__ignoreDepthValues=u.ignoreDepthValues}b.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),pe.setContext(r),pe.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode};function V(U){for(let J=0;J<U.removed.length;J++){const le=U.removed[J],ne=D.indexOf(le);ne>=0&&(D[ne]=null,x[ne].disconnect(le))}for(let J=0;J<U.added.length;J++){const le=U.added[J];let ne=D.indexOf(le);if(ne===-1){for(let De=0;De<x.length;De++)if(De>=D.length){D.push(le),ne=De;break}else if(D[De]===null){D[De]=le,ne=De;break}if(ne===-1)break}const xe=x[ne];xe&&xe.connect(le)}}const q=new R,ee=new R;function B(U,J,le){q.setFromMatrixPosition(J.matrixWorld),ee.setFromMatrixPosition(le.matrixWorld);const ne=q.distanceTo(ee),xe=J.projectionMatrix.elements,De=le.projectionMatrix.elements,Ce=xe[14]/(xe[10]-1),k=xe[14]/(xe[10]+1),Fe=(xe[9]+1)/xe[5],ve=(xe[9]-1)/xe[5],Ge=(xe[8]-1)/xe[0],ye=(De[8]+1)/De[0],We=Ce*Ge,A=Ce*ye,S=ne/(-Ge+ye),Y=S*-Ge;J.matrixWorld.decompose(U.position,U.quaternion,U.scale),U.translateX(Y),U.translateZ(S),U.matrixWorld.compose(U.position,U.quaternion,U.scale),U.matrixWorldInverse.copy(U.matrixWorld).invert();const Z=Ce+S,te=k+S,ie=We-Y,Te=A+(ne-Y),re=Fe*k/te*Z,Ee=ve*k/te*Z;U.projectionMatrix.makePerspective(ie,Te,re,Ee,Z,te),U.projectionMatrixInverse.copy(U.projectionMatrix).invert()}function $(U,J){J===null?U.matrixWorld.copy(U.matrix):U.matrixWorld.multiplyMatrices(J.matrixWorld,U.matrix),U.matrixWorldInverse.copy(U.matrixWorld).invert()}this.updateCamera=function(U){if(r===null)return;v.texture!==null&&(U.near=v.depthNear,U.far=v.depthFar),M.near=L.near=w.near=U.near,M.far=L.far=w.far=U.far,(N!==M.near||I!==M.far)&&(r.updateRenderState({depthNear:M.near,depthFar:M.far}),N=M.near,I=M.far,w.near=N,w.far=I,L.near=N,L.far=I,w.updateProjectionMatrix(),L.updateProjectionMatrix(),U.updateProjectionMatrix());const J=U.parent,le=M.cameras;$(M,J);for(let ne=0;ne<le.length;ne++)$(le[ne],J);le.length===2?B(M,w,L):M.projectionMatrix.copy(w.projectionMatrix),j(U,M,J)};function j(U,J,le){le===null?U.matrix.copy(J.matrixWorld):(U.matrix.copy(le.matrixWorld),U.matrix.invert(),U.matrix.multiply(J.matrixWorld)),U.matrix.decompose(U.position,U.quaternion,U.scale),U.updateMatrixWorld(!0),U.projectionMatrix.copy(J.projectionMatrix),U.projectionMatrixInverse.copy(J.projectionMatrixInverse),U.isPerspectiveCamera&&(U.fov=Ui*2*Math.atan(1/U.projectionMatrix.elements[5]),U.zoom=1)}this.getCamera=function(){return M},this.getFoveation=function(){if(!(u===null&&p===null))return l},this.setFoveation=function(U){l=U,u!==null&&(u.fixedFoveation=U),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=U)},this.hasDepthSensing=function(){return v.texture!==null};let F=null;function Q(U,J){if(h=J.getViewerPose(c||a),_=J,h!==null){const le=h.views;p!==null&&(e.setRenderTargetFramebuffer(b,p.framebuffer),e.setRenderTarget(b));let ne=!1;le.length!==M.cameras.length&&(M.cameras.length=0,ne=!0);for(let De=0;De<le.length;De++){const Ce=le[De];let k=null;if(p!==null)k=p.getViewport(Ce);else{const ve=d.getViewSubImage(u,Ce);k=ve.viewport,De===0&&(e.setRenderTargetTextures(b,ve.colorTexture,u.ignoreDepthValues?void 0:ve.depthStencilTexture),e.setRenderTarget(b))}let Fe=E[De];Fe===void 0&&(Fe=new Rt,Fe.layers.enable(De),Fe.viewport=new dt,E[De]=Fe),Fe.matrix.fromArray(Ce.transform.matrix),Fe.matrix.decompose(Fe.position,Fe.quaternion,Fe.scale),Fe.projectionMatrix.fromArray(Ce.projectionMatrix),Fe.projectionMatrixInverse.copy(Fe.projectionMatrix).invert(),Fe.viewport.set(k.x,k.y,k.width,k.height),De===0&&(M.matrix.copy(Fe.matrix),M.matrix.decompose(M.position,M.quaternion,M.scale)),ne===!0&&M.cameras.push(Fe)}const xe=r.enabledFeatures;if(xe&&xe.includes("depth-sensing")){const De=d.getDepthInformation(le[0]);De&&De.isValid&&De.texture&&v.init(e,De,r.renderState)}}for(let le=0;le<x.length;le++){const ne=D[le],xe=x[le];ne!==null&&xe!==void 0&&xe.update(ne,J,c||a)}v.render(e,M),F&&F(U,J),J.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:J}),_=null}const pe=new Dl;pe.setAnimationLoop(Q),this.setAnimationLoop=function(U){F=U},this.dispose=function(){}}}const An=new tn,Km=new et;function Zm(i,e){function t(m,f){m.matrixAutoUpdate===!0&&m.updateMatrix(),f.value.copy(m.matrix)}function n(m,f){f.color.getRGB(m.fogColor.value,Sl(i)),f.isFog?(m.fogNear.value=f.near,m.fogFar.value=f.far):f.isFogExp2&&(m.fogDensity.value=f.density)}function r(m,f,b,x,D){f.isMeshBasicMaterial||f.isMeshLambertMaterial?s(m,f):f.isMeshToonMaterial?(s(m,f),d(m,f)):f.isMeshPhongMaterial?(s(m,f),h(m,f)):f.isMeshStandardMaterial?(s(m,f),u(m,f),f.isMeshPhysicalMaterial&&p(m,f,D)):f.isMeshMatcapMaterial?(s(m,f),_(m,f)):f.isMeshDepthMaterial?s(m,f):f.isMeshDistanceMaterial?(s(m,f),v(m,f)):f.isMeshNormalMaterial?s(m,f):f.isLineBasicMaterial?(a(m,f),f.isLineDashedMaterial&&o(m,f)):f.isPointsMaterial?l(m,f,b,x):f.isSpriteMaterial?c(m,f):f.isShadowMaterial?(m.color.value.copy(f.color),m.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function s(m,f){m.opacity.value=f.opacity,f.color&&m.diffuse.value.copy(f.color),f.emissive&&m.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(m.map.value=f.map,t(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.bumpMap&&(m.bumpMap.value=f.bumpMap,t(f.bumpMap,m.bumpMapTransform),m.bumpScale.value=f.bumpScale,f.side===Mt&&(m.bumpScale.value*=-1)),f.normalMap&&(m.normalMap.value=f.normalMap,t(f.normalMap,m.normalMapTransform),m.normalScale.value.copy(f.normalScale),f.side===Mt&&m.normalScale.value.negate()),f.displacementMap&&(m.displacementMap.value=f.displacementMap,t(f.displacementMap,m.displacementMapTransform),m.displacementScale.value=f.displacementScale,m.displacementBias.value=f.displacementBias),f.emissiveMap&&(m.emissiveMap.value=f.emissiveMap,t(f.emissiveMap,m.emissiveMapTransform)),f.specularMap&&(m.specularMap.value=f.specularMap,t(f.specularMap,m.specularMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest);const b=e.get(f),x=b.envMap,D=b.envMapRotation;if(x&&(m.envMap.value=x,An.copy(D),An.x*=-1,An.y*=-1,An.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(An.y*=-1,An.z*=-1),m.envMapRotation.value.setFromMatrix4(Km.makeRotationFromEuler(An)),m.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=f.reflectivity,m.ior.value=f.ior,m.refractionRatio.value=f.refractionRatio),f.lightMap){m.lightMap.value=f.lightMap;const P=i._useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=f.lightMapIntensity*P,t(f.lightMap,m.lightMapTransform)}f.aoMap&&(m.aoMap.value=f.aoMap,m.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,m.aoMapTransform))}function a(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,f.map&&(m.map.value=f.map,t(f.map,m.mapTransform))}function o(m,f){m.dashSize.value=f.dashSize,m.totalSize.value=f.dashSize+f.gapSize,m.scale.value=f.scale}function l(m,f,b,x){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.size.value=f.size*b,m.scale.value=x*.5,f.map&&(m.map.value=f.map,t(f.map,m.uvTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function c(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.rotation.value=f.rotation,f.map&&(m.map.value=f.map,t(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function h(m,f){m.specular.value.copy(f.specular),m.shininess.value=Math.max(f.shininess,1e-4)}function d(m,f){f.gradientMap&&(m.gradientMap.value=f.gradientMap)}function u(m,f){m.metalness.value=f.metalness,f.metalnessMap&&(m.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,m.metalnessMapTransform)),m.roughness.value=f.roughness,f.roughnessMap&&(m.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,m.roughnessMapTransform)),f.envMap&&(m.envMapIntensity.value=f.envMapIntensity)}function p(m,f,b){m.ior.value=f.ior,f.sheen>0&&(m.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),m.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(m.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,m.sheenColorMapTransform)),f.sheenRoughnessMap&&(m.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,m.sheenRoughnessMapTransform))),f.clearcoat>0&&(m.clearcoat.value=f.clearcoat,m.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(m.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,m.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(m.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===Mt&&m.clearcoatNormalScale.value.negate())),f.iridescence>0&&(m.iridescence.value=f.iridescence,m.iridescenceIOR.value=f.iridescenceIOR,m.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(m.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,m.iridescenceMapTransform)),f.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),f.transmission>0&&(m.transmission.value=f.transmission,m.transmissionSamplerMap.value=b.texture,m.transmissionSamplerSize.value.set(b.width,b.height),f.transmissionMap&&(m.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,m.transmissionMapTransform)),m.thickness.value=f.thickness,f.thicknessMap&&(m.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=f.attenuationDistance,m.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(m.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(m.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=f.specularIntensity,m.specularColor.value.copy(f.specularColor),f.specularColorMap&&(m.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,m.specularColorMapTransform)),f.specularIntensityMap&&(m.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,m.specularIntensityMapTransform))}function _(m,f){f.matcap&&(m.matcap.value=f.matcap)}function v(m,f){const b=e.get(f).light;m.referencePosition.value.setFromMatrixPosition(b.matrixWorld),m.nearDistance.value=b.shadow.camera.near,m.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Jm(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(b,x){const D=x.program;n.uniformBlockBinding(b,D)}function c(b,x){let D=r[b.id];D===void 0&&(_(b),D=h(b),r[b.id]=D,b.addEventListener("dispose",m));const P=x.program;n.updateUBOMapping(b,P);const T=e.render.frame;s[b.id]!==T&&(u(b),s[b.id]=T)}function h(b){const x=d();b.__bindingPointIndex=x;const D=i.createBuffer(),P=b.__size,T=b.usage;return i.bindBuffer(i.UNIFORM_BUFFER,D),i.bufferData(i.UNIFORM_BUFFER,P,T),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,x,D),D}function d(){for(let b=0;b<o;b++)if(a.indexOf(b)===-1)return a.push(b),b;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function u(b){const x=r[b.id],D=b.uniforms,P=b.__cache;i.bindBuffer(i.UNIFORM_BUFFER,x);for(let T=0,w=D.length;T<w;T++){const L=Array.isArray(D[T])?D[T]:[D[T]];for(let E=0,M=L.length;E<M;E++){const N=L[E];if(p(N,T,E,P)===!0){const I=N.__offset,C=Array.isArray(N.value)?N.value:[N.value];let z=0;for(let V=0;V<C.length;V++){const q=C[V],ee=v(q);typeof q=="number"||typeof q=="boolean"?(N.__data[0]=q,i.bufferSubData(i.UNIFORM_BUFFER,I+z,N.__data)):q.isMatrix3?(N.__data[0]=q.elements[0],N.__data[1]=q.elements[1],N.__data[2]=q.elements[2],N.__data[3]=0,N.__data[4]=q.elements[3],N.__data[5]=q.elements[4],N.__data[6]=q.elements[5],N.__data[7]=0,N.__data[8]=q.elements[6],N.__data[9]=q.elements[7],N.__data[10]=q.elements[8],N.__data[11]=0):(q.toArray(N.__data,z),z+=ee.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,I,N.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function p(b,x,D,P){const T=b.value,w=x+"_"+D;if(P[w]===void 0)return typeof T=="number"||typeof T=="boolean"?P[w]=T:P[w]=T.clone(),!0;{const L=P[w];if(typeof T=="number"||typeof T=="boolean"){if(L!==T)return P[w]=T,!0}else if(L.equals(T)===!1)return L.copy(T),!0}return!1}function _(b){const x=b.uniforms;let D=0;const P=16;for(let w=0,L=x.length;w<L;w++){const E=Array.isArray(x[w])?x[w]:[x[w]];for(let M=0,N=E.length;M<N;M++){const I=E[M],C=Array.isArray(I.value)?I.value:[I.value];for(let z=0,V=C.length;z<V;z++){const q=C[z],ee=v(q),B=D%P;B!==0&&P-B<ee.boundary&&(D+=P-B),I.__data=new Float32Array(ee.storage/Float32Array.BYTES_PER_ELEMENT),I.__offset=D,D+=ee.storage}}}const T=D%P;return T>0&&(D+=P-T),b.__size=D,b.__cache={},this}function v(b){const x={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(x.boundary=4,x.storage=4):b.isVector2?(x.boundary=8,x.storage=8):b.isVector3||b.isColor?(x.boundary=16,x.storage=12):b.isVector4?(x.boundary=16,x.storage=16):b.isMatrix3?(x.boundary=48,x.storage=48):b.isMatrix4?(x.boundary=64,x.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),x}function m(b){const x=b.target;x.removeEventListener("dispose",m);const D=a.indexOf(x.__bindingPointIndex);a.splice(D,1),i.deleteBuffer(r[x.id]),delete r[x.id],delete s[x.id]}function f(){for(const b in r)i.deleteBuffer(r[b]);a=[],r={},s={}}return{bind:l,update:c,dispose:f}}class Fl{constructor(e={}){const{canvas:t=Wu(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1}=e;this.isWebGLRenderer=!0;let u;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");u=n.getContextAttributes().alpha}else u=a;const p=new Uint32Array(4),_=new Int32Array(4);let v=null,m=null;const f=[],b=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Ut,this._useLegacyLights=!1,this.toneMapping=mn,this.toneMappingExposure=1;const x=this;let D=!1,P=0,T=0,w=null,L=-1,E=null;const M=new dt,N=new dt;let I=null;const C=new be(0);let z=0,V=t.width,q=t.height,ee=1,B=null,$=null;const j=new dt(0,0,V,q),F=new dt(0,0,V,q);let Q=!1;const pe=new bl;let U=!1,J=!1;const le=new et,ne=new ue,xe=new R,De={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ce(){return w===null?ee:1}let k=n;function Fe(y,O){const W=t.getContext(y,O);return W!==null?W:null}try{const y={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Vs}`),t.addEventListener("webglcontextlost",H,!1),t.addEventListener("webglcontextrestored",K,!1),t.addEventListener("webglcontextcreationerror",se,!1),k===null){const O="webgl2";if(k=Fe(O,y),k===null)throw Fe(O)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(y){throw console.error("THREE.WebGLRenderer: "+y.message),y}let ve,Ge,ye,We,A,S,Y,Z,te,ie,Te,re,Ee,Ae,ae,de,Re,ge,_e,ke,He,Ye,Xe,je;function Me(){ve=new op(k),ve.init(),Ge=new tp(k,ve,e),Ye=new Gm(k,ve),ye=new Hm(k),We=new up(k),A=new Am,S=new Vm(k,ve,ye,A,Ge,Ye,We),Y=new ip(x),Z=new ap(x),te=new mh(k),Xe=new Qf(k,te),ie=new lp(k,te,We,Xe),Te=new dp(k,ie,te,We),_e=new hp(k,Ge,S),de=new np(A),re=new Tm(x,Y,Z,ve,Ge,Xe,de),Ee=new Zm(x,A),Ae=new Cm,ae=new Nm(ve),ge=new Jf(x,Y,Z,ye,Te,u,l),Re=new km(x,Te,Ge),je=new Jm(k,We,Ge,ye),ke=new ep(k,ve,We),He=new cp(k,ve,We),We.programs=re.programs,x.capabilities=Ge,x.extensions=ve,x.properties=A,x.renderLists=Ae,x.shadowMap=Re,x.state=ye,x.info=We}Me();const g=new $m(x,k);this.xr=g,this.getContext=function(){return k},this.getContextAttributes=function(){return k.getContextAttributes()},this.forceContextLoss=function(){const y=ve.get("WEBGL_lose_context");y&&y.loseContext()},this.forceContextRestore=function(){const y=ve.get("WEBGL_lose_context");y&&y.restoreContext()},this.getPixelRatio=function(){return ee},this.setPixelRatio=function(y){y!==void 0&&(ee=y,this.setSize(V,q,!1))},this.getSize=function(y){return y.set(V,q)},this.setSize=function(y,O,W=!0){if(g.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}V=y,q=O,t.width=Math.floor(y*ee),t.height=Math.floor(O*ee),W===!0&&(t.style.width=y+"px",t.style.height=O+"px"),this.setViewport(0,0,y,O)},this.getDrawingBufferSize=function(y){return y.set(V*ee,q*ee).floor()},this.setDrawingBufferSize=function(y,O,W){V=y,q=O,ee=W,t.width=Math.floor(y*W),t.height=Math.floor(O*W),this.setViewport(0,0,y,O)},this.getCurrentViewport=function(y){return y.copy(M)},this.getViewport=function(y){return y.copy(j)},this.setViewport=function(y,O,W,X){y.isVector4?j.set(y.x,y.y,y.z,y.w):j.set(y,O,W,X),ye.viewport(M.copy(j).multiplyScalar(ee).round())},this.getScissor=function(y){return y.copy(F)},this.setScissor=function(y,O,W,X){y.isVector4?F.set(y.x,y.y,y.z,y.w):F.set(y,O,W,X),ye.scissor(N.copy(F).multiplyScalar(ee).round())},this.getScissorTest=function(){return Q},this.setScissorTest=function(y){ye.setScissorTest(Q=y)},this.setOpaqueSort=function(y){B=y},this.setTransparentSort=function(y){$=y},this.getClearColor=function(y){return y.copy(ge.getClearColor())},this.setClearColor=function(){ge.setClearColor.apply(ge,arguments)},this.getClearAlpha=function(){return ge.getClearAlpha()},this.setClearAlpha=function(){ge.setClearAlpha.apply(ge,arguments)},this.clear=function(y=!0,O=!0,W=!0){let X=0;if(y){let G=!1;if(w!==null){const he=w.texture.format;G=he===ul||he===cl||he===ll}if(G){const he=w.texture.type,Se=he===gn||he===mi||he===rl||he===Ii||he===al||he===ol,we=ge.getClearColor(),Pe=ge.getClearAlpha(),Ue=we.r,Le=we.g,Ne=we.b;Se?(p[0]=Ue,p[1]=Le,p[2]=Ne,p[3]=Pe,k.clearBufferuiv(k.COLOR,0,p)):(_[0]=Ue,_[1]=Le,_[2]=Ne,_[3]=Pe,k.clearBufferiv(k.COLOR,0,_))}else X|=k.COLOR_BUFFER_BIT}O&&(X|=k.DEPTH_BUFFER_BIT),W&&(X|=k.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),k.clear(X)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",H,!1),t.removeEventListener("webglcontextrestored",K,!1),t.removeEventListener("webglcontextcreationerror",se,!1),Ae.dispose(),ae.dispose(),A.dispose(),Y.dispose(),Z.dispose(),Te.dispose(),Xe.dispose(),je.dispose(),re.dispose(),g.dispose(),g.removeEventListener("sessionstart",it),g.removeEventListener("sessionend",rt),Tt.stop()};function H(y){y.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),D=!0}function K(){console.log("THREE.WebGLRenderer: Context Restored."),D=!1;const y=We.autoReset,O=Re.enabled,W=Re.autoUpdate,X=Re.needsUpdate,G=Re.type;Me(),We.autoReset=y,Re.enabled=O,Re.autoUpdate=W,Re.needsUpdate=X,Re.type=G}function se(y){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",y.statusMessage)}function fe(y){const O=y.target;O.removeEventListener("dispose",fe),Ve(O)}function Ve(y){ze(y),A.remove(y)}function ze(y){const O=A.get(y).programs;O!==void 0&&(O.forEach(function(W){re.releaseProgram(W)}),y.isShaderMaterial&&re.releaseShaderCache(y))}this.renderBufferDirect=function(y,O,W,X,G,he){O===null&&(O=De);const Se=G.isMesh&&G.matrixWorld.determinant()<0,we=jl(y,O,W,X,G);ye.setMaterial(X,Se);let Pe=W.index,Ue=1;if(X.wireframe===!0){if(Pe=ie.getWireframeAttribute(W),Pe===void 0)return;Ue=2}const Le=W.drawRange,Ne=W.attributes.position;let tt=Le.start*Ue,At=(Le.start+Le.count)*Ue;he!==null&&(tt=Math.max(tt,he.start*Ue),At=Math.min(At,(he.start+he.count)*Ue)),Pe!==null?(tt=Math.max(tt,0),At=Math.min(At,Pe.count)):Ne!=null&&(tt=Math.max(tt,0),At=Math.min(At,Ne.count));const ct=At-tt;if(ct<0||ct===1/0)return;Xe.setup(G,X,we,W,Pe);let Yt,Qe=ke;if(Pe!==null&&(Yt=te.get(Pe),Qe=He,Qe.setIndex(Yt)),G.isMesh)X.wireframe===!0?(ye.setLineWidth(X.wireframeLinewidth*Ce()),Qe.setMode(k.LINES)):Qe.setMode(k.TRIANGLES);else if(G.isLine){let Ie=X.linewidth;Ie===void 0&&(Ie=1),ye.setLineWidth(Ie*Ce()),G.isLineSegments?Qe.setMode(k.LINES):G.isLineLoop?Qe.setMode(k.LINE_LOOP):Qe.setMode(k.LINE_STRIP)}else G.isPoints?Qe.setMode(k.POINTS):G.isSprite&&Qe.setMode(k.TRIANGLES);if(G.isBatchedMesh)Qe.renderMultiDraw(G._multiDrawStarts,G._multiDrawCounts,G._multiDrawCount);else if(G.isInstancedMesh)Qe.renderInstances(tt,ct,G.count);else if(W.isInstancedBufferGeometry){const Ie=W._maxInstanceCount!==void 0?W._maxInstanceCount:1/0,Br=Math.min(W.instanceCount,Ie);Qe.renderInstances(tt,ct,Br)}else Qe.render(tt,ct)};function Ze(y,O,W){y.transparent===!0&&y.side===Wt&&y.forceSinglePass===!1?(y.side=Mt,y.needsUpdate=!0,Vi(y,O,W),y.side=vn,y.needsUpdate=!0,Vi(y,O,W),y.side=Wt):Vi(y,O,W)}this.compile=function(y,O,W=null){W===null&&(W=y),m=ae.get(W),m.init(),b.push(m),W.traverseVisible(function(G){G.isLight&&G.layers.test(O.layers)&&(m.pushLight(G),G.castShadow&&m.pushShadow(G))}),y!==W&&y.traverseVisible(function(G){G.isLight&&G.layers.test(O.layers)&&(m.pushLight(G),G.castShadow&&m.pushShadow(G))}),m.setupLights(x._useLegacyLights);const X=new Set;return y.traverse(function(G){const he=G.material;if(he)if(Array.isArray(he))for(let Se=0;Se<he.length;Se++){const we=he[Se];Ze(we,W,G),X.add(we)}else Ze(he,W,G),X.add(he)}),b.pop(),m=null,X},this.compileAsync=function(y,O,W=null){const X=this.compile(y,O,W);return new Promise(G=>{function he(){if(X.forEach(function(Se){A.get(Se).currentProgram.isReady()&&X.delete(Se)}),X.size===0){G(y);return}setTimeout(he,10)}ve.get("KHR_parallel_shader_compile")!==null?he():setTimeout(he,10)})};let lt=null;function qe(y){lt&<(y)}function it(){Tt.stop()}function rt(){Tt.start()}const Tt=new Dl;Tt.setAnimationLoop(qe),typeof self<"u"&&Tt.setContext(self),this.setAnimationLoop=function(y){lt=y,g.setAnimationLoop(y),y===null?Tt.stop():Tt.start()},g.addEventListener("sessionstart",it),g.addEventListener("sessionend",rt),this.render=function(y,O){if(O!==void 0&&O.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(D===!0)return;y.matrixWorldAutoUpdate===!0&&y.updateMatrixWorld(),O.parent===null&&O.matrixWorldAutoUpdate===!0&&O.updateMatrixWorld(),g.enabled===!0&&g.isPresenting===!0&&(g.cameraAutoUpdate===!0&&g.updateCamera(O),O=g.getCamera()),y.isScene===!0&&y.onBeforeRender(x,y,O,w),m=ae.get(y,b.length),m.init(),b.push(m),le.multiplyMatrices(O.projectionMatrix,O.matrixWorldInverse),pe.setFromProjectionMatrix(le),J=this.localClippingEnabled,U=de.init(this.clippingPlanes,J),v=Ae.get(y,f.length),v.init(),f.push(v),Pt(y,O,0,x.sortObjects),v.finish(),x.sortObjects===!0&&v.sort(B,$),this.info.render.frame++,U===!0&&de.beginShadows();const W=m.state.shadowsArray;if(Re.render(W,y,O),U===!0&&de.endShadows(),this.info.autoReset===!0&&this.info.reset(),(g.enabled===!1||g.isPresenting===!1||g.hasDepthSensing()===!1)&&ge.render(v,y),m.setupLights(x._useLegacyLights),O.isArrayCamera){const X=O.cameras;for(let G=0,he=X.length;G<he;G++){const Se=X[G];rn(v,y,Se,Se.viewport)}}else rn(v,y,O);w!==null&&(S.updateMultisampleRenderTarget(w),S.updateRenderTargetMipmap(w)),y.isScene===!0&&y.onAfterRender(x,y,O),Xe.resetDefaultState(),L=-1,E=null,b.pop(),b.length>0?m=b[b.length-1]:m=null,f.pop(),f.length>0?v=f[f.length-1]:v=null};function Pt(y,O,W,X){if(y.visible===!1)return;if(y.layers.test(O.layers)){if(y.isGroup)W=y.renderOrder;else if(y.isLOD)y.autoUpdate===!0&&y.update(O);else if(y.isLight)m.pushLight(y),y.castShadow&&m.pushShadow(y);else if(y.isSprite){if(!y.frustumCulled||pe.intersectsSprite(y)){X&&xe.setFromMatrixPosition(y.matrixWorld).applyMatrix4(le);const Se=Te.update(y),we=y.material;we.visible&&v.push(y,Se,we,W,xe.z,null)}}else if((y.isMesh||y.isLine||y.isPoints)&&(!y.frustumCulled||pe.intersectsObject(y))){const Se=Te.update(y),we=y.material;if(X&&(y.boundingSphere!==void 0?(y.boundingSphere===null&&y.computeBoundingSphere(),xe.copy(y.boundingSphere.center)):(Se.boundingSphere===null&&Se.computeBoundingSphere(),xe.copy(Se.boundingSphere.center)),xe.applyMatrix4(y.matrixWorld).applyMatrix4(le)),Array.isArray(we)){const Pe=Se.groups;for(let Ue=0,Le=Pe.length;Ue<Le;Ue++){const Ne=Pe[Ue],tt=we[Ne.materialIndex];tt&&tt.visible&&v.push(y,Se,tt,W,xe.z,Ne)}}else we.visible&&v.push(y,Se,we,W,xe.z,null)}}const he=y.children;for(let Se=0,we=he.length;Se<we;Se++)Pt(he[Se],O,W,X)}function rn(y,O,W,X){const G=y.opaque,he=y.transmissive,Se=y.transparent;m.setupLightsView(W),U===!0&&de.setGlobalState(x.clippingPlanes,W),he.length>0&&On(G,he,O,W),X&&ye.viewport(M.copy(X)),G.length>0&&Mn(G,O,W),he.length>0&&Mn(he,O,W),Se.length>0&&Mn(Se,O,W),ye.buffers.depth.setTest(!0),ye.buffers.depth.setMask(!0),ye.buffers.color.setMask(!0),ye.setPolygonOffset(!1)}function On(y,O,W,X){if((W.isScene===!0?W.overrideMaterial:null)!==null)return;if(m.state.transmissionRenderTarget===null){m.state.transmissionRenderTarget=new Ht(1,1,{generateMipmaps:!0,type:ve.has("EXT_color_buffer_half_float")||ve.has("EXT_color_buffer_float")?_n:gn,minFilter:Fn,samples:4,stencilBuffer:s});const Ue=A.get(m.state.transmissionRenderTarget);Ue.__isTransmissionRenderTarget=!0}const he=m.state.transmissionRenderTarget;x.getDrawingBufferSize(ne),he.setSize(ne.x,ne.y);const Se=x.getRenderTarget();x.setRenderTarget(he),x.getClearColor(C),z=x.getClearAlpha(),z<1&&x.setClearColor(16777215,.5),x.clear();const we=x.toneMapping;x.toneMapping=mn,Mn(y,W,X),S.updateMultisampleRenderTarget(he),S.updateRenderTargetMipmap(he);let Pe=!1;for(let Ue=0,Le=O.length;Ue<Le;Ue++){const Ne=O[Ue],tt=Ne.object,At=Ne.geometry,ct=Ne.material,Yt=Ne.group;if(ct.side===Wt&&tt.layers.test(X.layers)){const Qe=ct.side;ct.side=Mt,ct.needsUpdate=!0,Ks(tt,W,X,At,ct,Yt),ct.side=Qe,ct.needsUpdate=!0,Pe=!0}}Pe===!0&&(S.updateMultisampleRenderTarget(he),S.updateRenderTargetMipmap(he)),x.setRenderTarget(Se),x.setClearColor(C,z),x.toneMapping=we}function Mn(y,O,W){const X=O.isScene===!0?O.overrideMaterial:null;for(let G=0,he=y.length;G<he;G++){const Se=y[G],we=Se.object,Pe=Se.geometry,Ue=X===null?Se.material:X,Le=Se.group;we.layers.test(W.layers)&&Ks(we,O,W,Pe,Ue,Le)}}function Ks(y,O,W,X,G,he){y.onBeforeRender(x,O,W,X,G,he),y.modelViewMatrix.multiplyMatrices(W.matrixWorldInverse,y.matrixWorld),y.normalMatrix.getNormalMatrix(y.modelViewMatrix),G.onBeforeRender(x,O,W,X,y,he),G.transparent===!0&&G.side===Wt&&G.forceSinglePass===!1?(G.side=Mt,G.needsUpdate=!0,x.renderBufferDirect(W,O,X,G,y,he),G.side=vn,G.needsUpdate=!0,x.renderBufferDirect(W,O,X,G,y,he),G.side=Wt):x.renderBufferDirect(W,O,X,G,y,he),y.onAfterRender(x,O,W,X,G,he)}function Vi(y,O,W){O.isScene!==!0&&(O=De);const X=A.get(y),G=m.state.lights,he=m.state.shadowsArray,Se=G.state.version,we=re.getParameters(y,G.state,he,O,W),Pe=re.getProgramCacheKey(we);let Ue=X.programs;X.environment=y.isMeshStandardMaterial?O.environment:null,X.fog=O.fog,X.envMap=(y.isMeshStandardMaterial?Z:Y).get(y.envMap||X.environment),X.envMapRotation=X.environment!==null&&y.envMap===null?O.environmentRotation:y.envMapRotation,Ue===void 0&&(y.addEventListener("dispose",fe),Ue=new Map,X.programs=Ue);let Le=Ue.get(Pe);if(Le!==void 0){if(X.currentProgram===Le&&X.lightsStateVersion===Se)return Js(y,we),Le}else we.uniforms=re.getUniforms(y),y.onBuild(W,we,x),y.onBeforeCompile(we,x),Le=re.acquireProgram(we,Pe),Ue.set(Pe,Le),X.uniforms=we.uniforms;const Ne=X.uniforms;return(!y.isShaderMaterial&&!y.isRawShaderMaterial||y.clipping===!0)&&(Ne.clippingPlanes=de.uniform),Js(y,we),X.needsLights=$l(y),X.lightsStateVersion=Se,X.needsLights&&(Ne.ambientLightColor.value=G.state.ambient,Ne.lightProbe.value=G.state.probe,Ne.directionalLights.value=G.state.directional,Ne.directionalLightShadows.value=G.state.directionalShadow,Ne.spotLights.value=G.state.spot,Ne.spotLightShadows.value=G.state.spotShadow,Ne.rectAreaLights.value=G.state.rectArea,Ne.ltc_1.value=G.state.rectAreaLTC1,Ne.ltc_2.value=G.state.rectAreaLTC2,Ne.pointLights.value=G.state.point,Ne.pointLightShadows.value=G.state.pointShadow,Ne.hemisphereLights.value=G.state.hemi,Ne.directionalShadowMap.value=G.state.directionalShadowMap,Ne.directionalShadowMatrix.value=G.state.directionalShadowMatrix,Ne.spotShadowMap.value=G.state.spotShadowMap,Ne.spotLightMatrix.value=G.state.spotLightMatrix,Ne.spotLightMap.value=G.state.spotLightMap,Ne.pointShadowMap.value=G.state.pointShadowMap,Ne.pointShadowMatrix.value=G.state.pointShadowMatrix),X.currentProgram=Le,X.uniformsList=null,Le}function Zs(y){if(y.uniformsList===null){const O=y.currentProgram.getUniforms();y.uniformsList=Er.seqWithValue(O.seq,y.uniforms)}return y.uniformsList}function Js(y,O){const W=A.get(y);W.outputColorSpace=O.outputColorSpace,W.batching=O.batching,W.instancing=O.instancing,W.instancingColor=O.instancingColor,W.instancingMorph=O.instancingMorph,W.skinning=O.skinning,W.morphTargets=O.morphTargets,W.morphNormals=O.morphNormals,W.morphColors=O.morphColors,W.morphTargetsCount=O.morphTargetsCount,W.numClippingPlanes=O.numClippingPlanes,W.numIntersection=O.numClipIntersection,W.vertexAlphas=O.vertexAlphas,W.vertexTangents=O.vertexTangents,W.toneMapping=O.toneMapping}function jl(y,O,W,X,G){O.isScene!==!0&&(O=De),S.resetTextureUnits();const he=O.fog,Se=X.isMeshStandardMaterial?O.environment:null,we=w===null?x.outputColorSpace:w.isXRRenderTarget===!0?w.texture.colorSpace:xn,Pe=(X.isMeshStandardMaterial?Z:Y).get(X.envMap||Se),Ue=X.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,Le=!!W.attributes.tangent&&(!!X.normalMap||X.anisotropy>0),Ne=!!W.morphAttributes.position,tt=!!W.morphAttributes.normal,At=!!W.morphAttributes.color;let ct=mn;X.toneMapped&&(w===null||w.isXRRenderTarget===!0)&&(ct=x.toneMapping);const Yt=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,Qe=Yt!==void 0?Yt.length:0,Ie=A.get(X),Br=m.state.lights;if(U===!0&&(J===!0||y!==E)){const Lt=y===E&&X.id===L;de.setState(X,y,Lt)}let Je=!1;X.version===Ie.__version?(Ie.needsLights&&Ie.lightsStateVersion!==Br.state.version||Ie.outputColorSpace!==we||G.isBatchedMesh&&Ie.batching===!1||!G.isBatchedMesh&&Ie.batching===!0||G.isInstancedMesh&&Ie.instancing===!1||!G.isInstancedMesh&&Ie.instancing===!0||G.isSkinnedMesh&&Ie.skinning===!1||!G.isSkinnedMesh&&Ie.skinning===!0||G.isInstancedMesh&&Ie.instancingColor===!0&&G.instanceColor===null||G.isInstancedMesh&&Ie.instancingColor===!1&&G.instanceColor!==null||G.isInstancedMesh&&Ie.instancingMorph===!0&&G.morphTexture===null||G.isInstancedMesh&&Ie.instancingMorph===!1&&G.morphTexture!==null||Ie.envMap!==Pe||X.fog===!0&&Ie.fog!==he||Ie.numClippingPlanes!==void 0&&(Ie.numClippingPlanes!==de.numPlanes||Ie.numIntersection!==de.numIntersection)||Ie.vertexAlphas!==Ue||Ie.vertexTangents!==Le||Ie.morphTargets!==Ne||Ie.morphNormals!==tt||Ie.morphColors!==At||Ie.toneMapping!==ct||Ie.morphTargetsCount!==Qe)&&(Je=!0):(Je=!0,Ie.__version=X.version);let Sn=Ie.currentProgram;Je===!0&&(Sn=Vi(X,O,G));let Qs=!1,Mi=!1,zr=!1;const pt=Sn.getUniforms(),sn=Ie.uniforms;if(ye.useProgram(Sn.program)&&(Qs=!0,Mi=!0,zr=!0),X.id!==L&&(L=X.id,Mi=!0),Qs||E!==y){pt.setValue(k,"projectionMatrix",y.projectionMatrix),pt.setValue(k,"viewMatrix",y.matrixWorldInverse);const Lt=pt.map.cameraPosition;Lt!==void 0&&Lt.setValue(k,xe.setFromMatrixPosition(y.matrixWorld)),Ge.logarithmicDepthBuffer&&pt.setValue(k,"logDepthBufFC",2/(Math.log(y.far+1)/Math.LN2)),(X.isMeshPhongMaterial||X.isMeshToonMaterial||X.isMeshLambertMaterial||X.isMeshBasicMaterial||X.isMeshStandardMaterial||X.isShaderMaterial)&&pt.setValue(k,"isOrthographic",y.isOrthographicCamera===!0),E!==y&&(E=y,Mi=!0,zr=!0)}if(G.isSkinnedMesh){pt.setOptional(k,G,"bindMatrix"),pt.setOptional(k,G,"bindMatrixInverse");const Lt=G.skeleton;Lt&&(Lt.boneTexture===null&&Lt.computeBoneTexture(),pt.setValue(k,"boneTexture",Lt.boneTexture,S))}G.isBatchedMesh&&(pt.setOptional(k,G,"batchingTexture"),pt.setValue(k,"batchingTexture",G._matricesTexture,S));const kr=W.morphAttributes;if((kr.position!==void 0||kr.normal!==void 0||kr.color!==void 0)&&_e.update(G,W,Sn),(Mi||Ie.receiveShadow!==G.receiveShadow)&&(Ie.receiveShadow=G.receiveShadow,pt.setValue(k,"receiveShadow",G.receiveShadow)),X.isMeshGouraudMaterial&&X.envMap!==null&&(sn.envMap.value=Pe,sn.flipEnvMap.value=Pe.isCubeTexture&&Pe.isRenderTargetTexture===!1?-1:1),X.isMeshStandardMaterial&&X.envMap===null&&O.environment!==null&&(sn.envMapIntensity.value=O.environmentIntensity),Mi&&(pt.setValue(k,"toneMappingExposure",x.toneMappingExposure),Ie.needsLights&&ql(sn,zr),he&&X.fog===!0&&Ee.refreshFogUniforms(sn,he),Ee.refreshMaterialUniforms(sn,X,ee,q,m.state.transmissionRenderTarget),Er.upload(k,Zs(Ie),sn,S)),X.isShaderMaterial&&X.uniformsNeedUpdate===!0&&(Er.upload(k,Zs(Ie),sn,S),X.uniformsNeedUpdate=!1),X.isSpriteMaterial&&pt.setValue(k,"center",G.center),pt.setValue(k,"modelViewMatrix",G.modelViewMatrix),pt.setValue(k,"normalMatrix",G.normalMatrix),pt.setValue(k,"modelMatrix",G.matrixWorld),X.isShaderMaterial||X.isRawShaderMaterial){const Lt=X.uniformsGroups;for(let Hr=0,Kl=Lt.length;Hr<Kl;Hr++){const ea=Lt[Hr];je.update(ea,Sn),je.bind(ea,Sn)}}return Sn}function ql(y,O){y.ambientLightColor.needsUpdate=O,y.lightProbe.needsUpdate=O,y.directionalLights.needsUpdate=O,y.directionalLightShadows.needsUpdate=O,y.pointLights.needsUpdate=O,y.pointLightShadows.needsUpdate=O,y.spotLights.needsUpdate=O,y.spotLightShadows.needsUpdate=O,y.rectAreaLights.needsUpdate=O,y.hemisphereLights.needsUpdate=O}function $l(y){return y.isMeshLambertMaterial||y.isMeshToonMaterial||y.isMeshPhongMaterial||y.isMeshStandardMaterial||y.isShadowMaterial||y.isShaderMaterial&&y.lights===!0}this.getActiveCubeFace=function(){return P},this.getActiveMipmapLevel=function(){return T},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(y,O,W){A.get(y.texture).__webglTexture=O,A.get(y.depthTexture).__webglTexture=W;const X=A.get(y);X.__hasExternalTextures=!0,X.__autoAllocateDepthBuffer=W===void 0,X.__autoAllocateDepthBuffer||ve.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),X.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(y,O){const W=A.get(y);W.__webglFramebuffer=O,W.__useDefaultFramebuffer=O===void 0},this.setRenderTarget=function(y,O=0,W=0){w=y,P=O,T=W;let X=!0,G=null,he=!1,Se=!1;if(y){const Pe=A.get(y);Pe.__useDefaultFramebuffer!==void 0?(ye.bindFramebuffer(k.FRAMEBUFFER,null),X=!1):Pe.__webglFramebuffer===void 0?S.setupRenderTarget(y):Pe.__hasExternalTextures&&S.rebindTextures(y,A.get(y.texture).__webglTexture,A.get(y.depthTexture).__webglTexture);const Ue=y.texture;(Ue.isData3DTexture||Ue.isDataArrayTexture||Ue.isCompressedArrayTexture)&&(Se=!0);const Le=A.get(y).__webglFramebuffer;y.isWebGLCubeRenderTarget?(Array.isArray(Le[O])?G=Le[O][W]:G=Le[O],he=!0):y.samples>0&&S.useMultisampledRTT(y)===!1?G=A.get(y).__webglMultisampledFramebuffer:Array.isArray(Le)?G=Le[W]:G=Le,M.copy(y.viewport),N.copy(y.scissor),I=y.scissorTest}else M.copy(j).multiplyScalar(ee).floor(),N.copy(F).multiplyScalar(ee).floor(),I=Q;if(ye.bindFramebuffer(k.FRAMEBUFFER,G)&&X&&ye.drawBuffers(y,G),ye.viewport(M),ye.scissor(N),ye.setScissorTest(I),he){const Pe=A.get(y.texture);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_CUBE_MAP_POSITIVE_X+O,Pe.__webglTexture,W)}else if(Se){const Pe=A.get(y.texture),Ue=O||0;k.framebufferTextureLayer(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,Pe.__webglTexture,W||0,Ue)}L=-1},this.readRenderTargetPixels=function(y,O,W,X,G,he,Se){if(!(y&&y.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let we=A.get(y).__webglFramebuffer;if(y.isWebGLCubeRenderTarget&&Se!==void 0&&(we=we[Se]),we){ye.bindFramebuffer(k.FRAMEBUFFER,we);try{const Pe=y.texture,Ue=Pe.format,Le=Pe.type;if(Ue!==Xt&&Ye.convert(Ue)!==k.getParameter(k.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ne=Le===_n&&(ve.has("EXT_color_buffer_half_float")||ve.has("EXT_color_buffer_float"));if(Le!==gn&&Ye.convert(Le)!==k.getParameter(k.IMPLEMENTATION_COLOR_READ_TYPE)&&Le!==pn&&!Ne){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}O>=0&&O<=y.width-X&&W>=0&&W<=y.height-G&&k.readPixels(O,W,X,G,Ye.convert(Ue),Ye.convert(Le),he)}finally{const Pe=w!==null?A.get(w).__webglFramebuffer:null;ye.bindFramebuffer(k.FRAMEBUFFER,Pe)}}},this.copyFramebufferToTexture=function(y,O,W=0){const X=Math.pow(2,-W),G=Math.floor(O.image.width*X),he=Math.floor(O.image.height*X);S.setTexture2D(O,0),k.copyTexSubImage2D(k.TEXTURE_2D,W,0,0,y.x,y.y,G,he),ye.unbindTexture()},this.copyTextureToTexture=function(y,O,W,X=0){const G=O.image.width,he=O.image.height,Se=Ye.convert(W.format),we=Ye.convert(W.type);S.setTexture2D(W,0),k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,W.flipY),k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,W.premultiplyAlpha),k.pixelStorei(k.UNPACK_ALIGNMENT,W.unpackAlignment),O.isDataTexture?k.texSubImage2D(k.TEXTURE_2D,X,y.x,y.y,G,he,Se,we,O.image.data):O.isCompressedTexture?k.compressedTexSubImage2D(k.TEXTURE_2D,X,y.x,y.y,O.mipmaps[0].width,O.mipmaps[0].height,Se,O.mipmaps[0].data):k.texSubImage2D(k.TEXTURE_2D,X,y.x,y.y,Se,we,O.image),X===0&&W.generateMipmaps&&k.generateMipmap(k.TEXTURE_2D),ye.unbindTexture()},this.copyTextureToTexture3D=function(y,O,W,X,G=0){const he=Math.round(y.max.x-y.min.x),Se=Math.round(y.max.y-y.min.y),we=y.max.z-y.min.z+1,Pe=Ye.convert(X.format),Ue=Ye.convert(X.type);let Le;if(X.isData3DTexture)S.setTexture3D(X,0),Le=k.TEXTURE_3D;else if(X.isDataArrayTexture||X.isCompressedArrayTexture)S.setTexture2DArray(X,0),Le=k.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,X.flipY),k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,X.premultiplyAlpha),k.pixelStorei(k.UNPACK_ALIGNMENT,X.unpackAlignment);const Ne=k.getParameter(k.UNPACK_ROW_LENGTH),tt=k.getParameter(k.UNPACK_IMAGE_HEIGHT),At=k.getParameter(k.UNPACK_SKIP_PIXELS),ct=k.getParameter(k.UNPACK_SKIP_ROWS),Yt=k.getParameter(k.UNPACK_SKIP_IMAGES),Qe=W.isCompressedTexture?W.mipmaps[G]:W.image;k.pixelStorei(k.UNPACK_ROW_LENGTH,Qe.width),k.pixelStorei(k.UNPACK_IMAGE_HEIGHT,Qe.height),k.pixelStorei(k.UNPACK_SKIP_PIXELS,y.min.x),k.pixelStorei(k.UNPACK_SKIP_ROWS,y.min.y),k.pixelStorei(k.UNPACK_SKIP_IMAGES,y.min.z),W.isDataTexture||W.isData3DTexture?k.texSubImage3D(Le,G,O.x,O.y,O.z,he,Se,we,Pe,Ue,Qe.data):X.isCompressedArrayTexture?k.compressedTexSubImage3D(Le,G,O.x,O.y,O.z,he,Se,we,Pe,Qe.data):k.texSubImage3D(Le,G,O.x,O.y,O.z,he,Se,we,Pe,Ue,Qe),k.pixelStorei(k.UNPACK_ROW_LENGTH,Ne),k.pixelStorei(k.UNPACK_IMAGE_HEIGHT,tt),k.pixelStorei(k.UNPACK_SKIP_PIXELS,At),k.pixelStorei(k.UNPACK_SKIP_ROWS,ct),k.pixelStorei(k.UNPACK_SKIP_IMAGES,Yt),G===0&&X.generateMipmaps&&k.generateMipmap(Le),ye.unbindTexture()},this.initTexture=function(y){y.isCubeTexture?S.setTextureCube(y,0):y.isData3DTexture?S.setTexture3D(y,0):y.isDataArrayTexture||y.isCompressedArrayTexture?S.setTexture2DArray(y,0):S.setTexture2D(y,0),ye.unbindTexture()},this.resetState=function(){P=0,T=0,w=null,ye.reset(),Xe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Qt}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Ws?"display-p3":"srgb",t.unpackColorSpace=$e.workingColorSpace===Fr?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class Or{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new be(e),this.density=t}clone(){return new Or(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Ul extends St{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new tn,this.environmentIntensity=1,this.environmentRotation=new tn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class Bs extends vi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new be(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Io=new R,Oo=new R,Bo=new et,Ms=new Ur,fr=new Bi;class Nl extends St{constructor(e=new _t,t=new Bs){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)Io.fromBufferAttribute(t,r-1),Oo.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=Io.distanceTo(Oo);e.setAttribute("lineDistance",new nt(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),fr.copy(n.boundingSphere),fr.applyMatrix4(r),fr.radius+=s,e.ray.intersectsSphere(fr)===!1)return;Bo.copy(r).invert(),Ms.copy(e.ray).applyMatrix4(Bo);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=new R,h=new R,d=new R,u=new R,p=this.isLineSegments?2:1,_=n.index,m=n.attributes.position;if(_!==null){const f=Math.max(0,a.start),b=Math.min(_.count,a.start+a.count);for(let x=f,D=b-1;x<D;x+=p){const P=_.getX(x),T=_.getX(x+1);if(c.fromBufferAttribute(m,P),h.fromBufferAttribute(m,T),Ms.distanceSqToSegment(c,h,u,d)>l)continue;u.applyMatrix4(this.matrixWorld);const L=e.ray.origin.distanceTo(u);L<e.near||L>e.far||t.push({distance:L,point:d.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else{const f=Math.max(0,a.start),b=Math.min(m.count,a.start+a.count);for(let x=f,D=b-1;x<D;x+=p){if(c.fromBufferAttribute(m,x),h.fromBufferAttribute(m,x+1),Ms.distanceSqToSegment(c,h,u,d)>l)continue;u.applyMatrix4(this.matrixWorld);const T=e.ray.origin.distanceTo(u);T<e.near||T>e.far||t.push({distance:T,point:d.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}const zo=new R,ko=new R;class Qm extends Nl{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let r=0,s=t.count;r<s;r+=2)zo.fromBufferAttribute(t,r),ko.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+zo.distanceTo(ko);e.setAttribute("lineDistance",new nt(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class eg extends vi{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new be(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Ho=new et,zs=new Ur,pr=new Bi,mr=new R;class tg extends St{constructor(e=new _t,t=new eg){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),pr.copy(n.boundingSphere),pr.applyMatrix4(r),pr.radius+=s,e.ray.intersectsSphere(pr)===!1)return;Ho.copy(r).invert(),zs.copy(e.ray).applyMatrix4(Ho);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,d=n.attributes.position;if(c!==null){const u=Math.max(0,a.start),p=Math.min(c.count,a.start+a.count);for(let _=u,v=p;_<v;_++){const m=c.getX(_);mr.fromBufferAttribute(d,m),Vo(mr,m,l,r,e,t,this)}}else{const u=Math.max(0,a.start),p=Math.min(d.count,a.start+a.count);for(let _=u,v=p;_<v;_++)mr.fromBufferAttribute(d,_),Vo(mr,_,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function Vo(i,e,t,n,r,s,a){const o=zs.distanceSqToPoint(i);if(o<t){const l=new R;zs.closestPointToPoint(i,l),l.applyMatrix4(n);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,object:a})}}class nn{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,r=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let r=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let o=0,l=s-1,c;for(;o<=l;)if(r=Math.floor(o+(l-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,n[r]===a)return r/(s-1);const h=n[r],u=n[r+1]-h,p=(a-h)/u;return(r+p)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const a=this.getPoint(r),o=this.getPoint(s),l=t||(a.isVector2?new ue:new R);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new R,r=[],s=[],a=[],o=new R,l=new et;for(let p=0;p<=e;p++){const _=p/e;r[p]=this.getTangentAt(_,new R)}s[0]=new R,a[0]=new R;let c=Number.MAX_VALUE;const h=Math.abs(r[0].x),d=Math.abs(r[0].y),u=Math.abs(r[0].z);h<=c&&(c=h,n.set(1,0,0)),d<=c&&(c=d,n.set(0,1,0)),u<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],o),a[0].crossVectors(r[0],s[0]);for(let p=1;p<=e;p++){if(s[p]=s[p-1].clone(),a[p]=a[p-1].clone(),o.crossVectors(r[p-1],r[p]),o.length()>Number.EPSILON){o.normalize();const _=Math.acos(ht(r[p-1].dot(r[p]),-1,1));s[p].applyMatrix4(l.makeRotationAxis(o,_))}a[p].crossVectors(r[p],s[p])}if(t===!0){let p=Math.acos(ht(s[0].dot(s[e]),-1,1));p/=e,r[0].dot(o.crossVectors(s[0],s[e]))>0&&(p=-p);for(let _=1;_<=e;_++)s[_].applyMatrix4(l.makeRotationAxis(r[_],p*_)),a[_].crossVectors(r[_],s[_])}return{tangents:r,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Il extends nn{constructor(e=0,t=0,n=1,r=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,t=new ue){const n=t,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(a?s=0:s=r),this.aClockwise===!0&&!a&&(s===r?s=-r:s=s-r);const o=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const h=Math.cos(this.aRotation),d=Math.sin(this.aRotation),u=l-this.aX,p=c-this.aY;l=u*h-p*d+this.aX,c=u*d+p*h+this.aY}return n.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class ng extends Il{constructor(e,t,n,r,s,a){super(e,t,n,n,r,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function js(){let i=0,e=0,t=0,n=0;function r(s,a,o,l){i=s,e=o,t=-3*s+3*a-2*o-l,n=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,c){r(a,o,c*(o-s),c*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,c,h,d){let u=(a-s)/c-(o-s)/(c+h)+(o-a)/h,p=(o-a)/h-(l-a)/(h+d)+(l-o)/d;u*=h,p*=h,r(a,o,u,p)},calc:function(s){const a=s*s,o=a*s;return i+e*s+t*a+n*o}}}const gr=new R,Ss=new js,Es=new js,ys=new js;class Ol extends nn{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new R){const n=t,r=this.points,s=r.length,a=(s-(this.closed?0:1))*e;let o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,h;this.closed||o>0?c=r[(o-1)%s]:(gr.subVectors(r[0],r[1]).add(r[0]),c=gr);const d=r[o%s],u=r[(o+1)%s];if(this.closed||o+2<s?h=r[(o+2)%s]:(gr.subVectors(r[s-1],r[s-2]).add(r[s-1]),h=gr),this.curveType==="centripetal"||this.curveType==="chordal"){const p=this.curveType==="chordal"?.5:.25;let _=Math.pow(c.distanceToSquared(d),p),v=Math.pow(d.distanceToSquared(u),p),m=Math.pow(u.distanceToSquared(h),p);v<1e-4&&(v=1),_<1e-4&&(_=v),m<1e-4&&(m=v),Ss.initNonuniformCatmullRom(c.x,d.x,u.x,h.x,_,v,m),Es.initNonuniformCatmullRom(c.y,d.y,u.y,h.y,_,v,m),ys.initNonuniformCatmullRom(c.z,d.z,u.z,h.z,_,v,m)}else this.curveType==="catmullrom"&&(Ss.initCatmullRom(c.x,d.x,u.x,h.x,this.tension),Es.initCatmullRom(c.y,d.y,u.y,h.y,this.tension),ys.initCatmullRom(c.z,d.z,u.z,h.z,this.tension));return n.set(Ss.calc(l),Es.calc(l),ys.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(new R().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function Go(i,e,t,n,r){const s=(n-e)*.5,a=(r-t)*.5,o=i*i,l=i*o;return(2*t-2*n+s+a)*l+(-3*t+3*n-2*s-a)*o+s*i+t}function ig(i,e){const t=1-i;return t*t*e}function rg(i,e){return 2*(1-i)*i*e}function sg(i,e){return i*i*e}function Ri(i,e,t,n){return ig(i,e)+rg(i,t)+sg(i,n)}function ag(i,e){const t=1-i;return t*t*t*e}function og(i,e){const t=1-i;return 3*t*t*i*e}function lg(i,e){return 3*(1-i)*i*i*e}function cg(i,e){return i*i*i*e}function Pi(i,e,t,n,r){return ag(i,e)+og(i,t)+lg(i,n)+cg(i,r)}class ug extends nn{constructor(e=new ue,t=new ue,n=new ue,r=new ue){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new ue){const n=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Pi(e,r.x,s.x,a.x,o.x),Pi(e,r.y,s.y,a.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class hg extends nn{constructor(e=new R,t=new R,n=new R,r=new R){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new R){const n=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Pi(e,r.x,s.x,a.x,o.x),Pi(e,r.y,s.y,a.y,o.y),Pi(e,r.z,s.z,a.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class dg extends nn{constructor(e=new ue,t=new ue){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ue){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new ue){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class fg extends nn{constructor(e=new R,t=new R){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new R){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new R){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class pg extends nn{constructor(e=new ue,t=new ue,n=new ue){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ue){const n=t,r=this.v0,s=this.v1,a=this.v2;return n.set(Ri(e,r.x,s.x,a.x),Ri(e,r.y,s.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Bl extends nn{constructor(e=new R,t=new R,n=new R){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new R){const n=t,r=this.v0,s=this.v1,a=this.v2;return n.set(Ri(e,r.x,s.x,a.x),Ri(e,r.y,s.y,a.y),Ri(e,r.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class mg extends nn{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new ue){const n=t,r=this.points,s=(r.length-1)*e,a=Math.floor(s),o=s-a,l=r[a===0?a:a-1],c=r[a],h=r[a>r.length-2?r.length-1:a+1],d=r[a>r.length-3?r.length-1:a+2];return n.set(Go(o,l.x,c.x,h.x,d.x),Go(o,l.y,c.y,h.y,d.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(new ue().fromArray(r))}return this}}var gg=Object.freeze({__proto__:null,ArcCurve:ng,CatmullRomCurve3:Ol,CubicBezierCurve:ug,CubicBezierCurve3:hg,EllipseCurve:Il,LineCurve:dg,LineCurve3:fg,QuadraticBezierCurve:pg,QuadraticBezierCurve3:Bl,SplineCurve:mg});const _r=new R,vr=new R,bs=new R,xr=new kt;class _g extends _t{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(hi*t),a=e.getIndex(),o=e.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],h=["a","b","c"],d=new Array(3),u={},p=[];for(let _=0;_<l;_+=3){a?(c[0]=a.getX(_),c[1]=a.getX(_+1),c[2]=a.getX(_+2)):(c[0]=_,c[1]=_+1,c[2]=_+2);const{a:v,b:m,c:f}=xr;if(v.fromBufferAttribute(o,c[0]),m.fromBufferAttribute(o,c[1]),f.fromBufferAttribute(o,c[2]),xr.getNormal(bs),d[0]=`${Math.round(v.x*r)},${Math.round(v.y*r)},${Math.round(v.z*r)}`,d[1]=`${Math.round(m.x*r)},${Math.round(m.y*r)},${Math.round(m.z*r)}`,d[2]=`${Math.round(f.x*r)},${Math.round(f.y*r)},${Math.round(f.z*r)}`,!(d[0]===d[1]||d[1]===d[2]||d[2]===d[0]))for(let b=0;b<3;b++){const x=(b+1)%3,D=d[b],P=d[x],T=xr[h[b]],w=xr[h[x]],L=`${D}_${P}`,E=`${P}_${D}`;E in u&&u[E]?(bs.dot(u[E].normal)<=s&&(p.push(T.x,T.y,T.z),p.push(w.x,w.y,w.z)),u[E]=null):L in u||(u[L]={index0:c[b],index1:c[x],normal:bs.clone()})}}for(const _ in u)if(u[_]){const{index0:v,index1:m}=u[_];_r.fromBufferAttribute(o,v),vr.fromBufferAttribute(o,m),p.push(_r.x,_r.y,_r.z),p.push(vr.x,vr.y,vr.z)}this.setAttribute("position",new nt(p,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class qs extends _t{constructor(e=.5,t=1,n=32,r=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:s,thetaLength:a},n=Math.max(3,n),r=Math.max(1,r);const o=[],l=[],c=[],h=[];let d=e;const u=(t-e)/r,p=new R,_=new ue;for(let v=0;v<=r;v++){for(let m=0;m<=n;m++){const f=s+m/n*a;p.x=d*Math.cos(f),p.y=d*Math.sin(f),l.push(p.x,p.y,p.z),c.push(0,0,1),_.x=(p.x/t+1)/2,_.y=(p.y/t+1)/2,h.push(_.x,_.y)}d+=u}for(let v=0;v<r;v++){const m=v*(n+1);for(let f=0;f<n;f++){const b=f+m,x=b,D=b+n+1,P=b+n+2,T=b+1;o.push(x,D,T),o.push(D,P,T)}}this.setIndex(o),this.setAttribute("position",new nt(l,3)),this.setAttribute("normal",new nt(c,3)),this.setAttribute("uv",new nt(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new qs(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Ni extends _t{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(a+o,Math.PI);let c=0;const h=[],d=new R,u=new R,p=[],_=[],v=[],m=[];for(let f=0;f<=n;f++){const b=[],x=f/n;let D=0;f===0&&a===0?D=.5/t:f===n&&l===Math.PI&&(D=-.5/t);for(let P=0;P<=t;P++){const T=P/t;d.x=-e*Math.cos(r+T*s)*Math.sin(a+x*o),d.y=e*Math.cos(a+x*o),d.z=e*Math.sin(r+T*s)*Math.sin(a+x*o),_.push(d.x,d.y,d.z),u.copy(d).normalize(),v.push(u.x,u.y,u.z),m.push(T+D,1-x),b.push(c++)}h.push(b)}for(let f=0;f<n;f++)for(let b=0;b<t;b++){const x=h[f][b+1],D=h[f][b],P=h[f+1][b],T=h[f+1][b+1];(f!==0||a>0)&&p.push(x,D,T),(f!==n-1||l<Math.PI)&&p.push(D,P,T)}this.setIndex(p),this.setAttribute("position",new nt(_,3)),this.setAttribute("normal",new nt(v,3)),this.setAttribute("uv",new nt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ni(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class $s extends _t{constructor(e=new Bl(new R(-1,-1,0),new R(-1,1,0),new R(1,1,0)),t=64,n=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:s};const a=e.computeFrenetFrames(t,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new R,l=new R,c=new ue;let h=new R;const d=[],u=[],p=[],_=[];v(),this.setIndex(_),this.setAttribute("position",new nt(d,3)),this.setAttribute("normal",new nt(u,3)),this.setAttribute("uv",new nt(p,2));function v(){for(let x=0;x<t;x++)m(x);m(s===!1?t:0),b(),f()}function m(x){h=e.getPointAt(x/t,h);const D=a.normals[x],P=a.binormals[x];for(let T=0;T<=r;T++){const w=T/r*Math.PI*2,L=Math.sin(w),E=-Math.cos(w);l.x=E*D.x+L*P.x,l.y=E*D.y+L*P.y,l.z=E*D.z+L*P.z,l.normalize(),u.push(l.x,l.y,l.z),o.x=h.x+n*l.x,o.y=h.y+n*l.y,o.z=h.z+n*l.z,d.push(o.x,o.y,o.z)}}function f(){for(let x=1;x<=t;x++)for(let D=1;D<=r;D++){const P=(r+1)*(x-1)+(D-1),T=(r+1)*x+(D-1),w=(r+1)*x+D,L=(r+1)*(x-1)+D;_.push(P,T,L),_.push(T,w,L)}}function b(){for(let x=0;x<=t;x++)for(let D=0;D<=r;D++)c.x=x/t,c.y=D/r,p.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new $s(new gg[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class zl{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Wo(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=Wo();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Wo(){return(typeof performance>"u"?Date:performance).now()}class Xo{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(ht(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Vs}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Vs);const Yo={type:"change"},Ds={type:"start"},jo={type:"end"},Mr=new Ur,qo=new dn,vg=Math.cos(70*fl.DEG2RAD);class kl extends In{constructor(e,t){super(),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new R,this.cursor=new R,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Hn.ROTATE,MIDDLE:Hn.DOLLY,RIGHT:Hn.PAN},this.touches={ONE:Vn.ROTATE,TWO:Vn.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return o.phi},this.getAzimuthalAngle=function(){return o.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(g){g.addEventListener("keydown",de),this._domElementKeyEvents=g},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",de),this._domElementKeyEvents=null},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(Yo),n.update(),s=r.NONE},this.update=(function(){const g=new R,H=new Un().setFromUnitVectors(e.up,new R(0,1,0)),K=H.clone().invert(),se=new R,fe=new Un,Ve=new R,ze=2*Math.PI;return function(lt=null){const qe=n.object.position;g.copy(qe).sub(n.target),g.applyQuaternion(H),o.setFromVector3(g),n.autoRotate&&s===r.NONE&&I(M(lt)),n.enableDamping?(o.theta+=l.theta*n.dampingFactor,o.phi+=l.phi*n.dampingFactor):(o.theta+=l.theta,o.phi+=l.phi);let it=n.minAzimuthAngle,rt=n.maxAzimuthAngle;isFinite(it)&&isFinite(rt)&&(it<-Math.PI?it+=ze:it>Math.PI&&(it-=ze),rt<-Math.PI?rt+=ze:rt>Math.PI&&(rt-=ze),it<=rt?o.theta=Math.max(it,Math.min(rt,o.theta)):o.theta=o.theta>(it+rt)/2?Math.max(it,o.theta):Math.min(rt,o.theta)),o.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,o.phi)),o.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(h,n.dampingFactor):n.target.add(h),n.target.sub(n.cursor),n.target.clampLength(n.minTargetRadius,n.maxTargetRadius),n.target.add(n.cursor);let Tt=!1;if(n.zoomToCursor&&T||n.object.isOrthographicCamera)o.radius=j(o.radius);else{const Pt=o.radius;o.radius=j(o.radius*c),Tt=Pt!=o.radius}if(g.setFromSpherical(o),g.applyQuaternion(K),qe.copy(n.target).add(g),n.object.lookAt(n.target),n.enableDamping===!0?(l.theta*=1-n.dampingFactor,l.phi*=1-n.dampingFactor,h.multiplyScalar(1-n.dampingFactor)):(l.set(0,0,0),h.set(0,0,0)),n.zoomToCursor&&T){let Pt=null;if(n.object.isPerspectiveCamera){const rn=g.length();Pt=j(rn*c);const On=rn-Pt;n.object.position.addScaledVector(D,On),n.object.updateMatrixWorld(),Tt=!!On}else if(n.object.isOrthographicCamera){const rn=new R(P.x,P.y,0);rn.unproject(n.object);const On=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/c)),n.object.updateProjectionMatrix(),Tt=On!==n.object.zoom;const Mn=new R(P.x,P.y,0);Mn.unproject(n.object),n.object.position.sub(Mn).add(rn),n.object.updateMatrixWorld(),Pt=g.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Pt!==null&&(this.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Pt).add(n.object.position):(Mr.origin.copy(n.object.position),Mr.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Mr.direction))<vg?e.lookAt(n.target):(qo.setFromNormalAndCoplanarPoint(n.object.up,n.target),Mr.intersectPlane(qo,n.target))))}else if(n.object.isOrthographicCamera){const Pt=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/c)),Pt!==n.object.zoom&&(n.object.updateProjectionMatrix(),Tt=!0)}return c=1,T=!1,Tt||se.distanceToSquared(n.object.position)>a||8*(1-fe.dot(n.object.quaternion))>a||Ve.distanceToSquared(n.target)>a?(n.dispatchEvent(Yo),se.copy(n.object.position),fe.copy(n.object.quaternion),Ve.copy(n.target),!0):!1}})(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",_e),n.domElement.removeEventListener("pointerdown",Y),n.domElement.removeEventListener("pointercancel",te),n.domElement.removeEventListener("wheel",re),n.domElement.removeEventListener("pointermove",Z),n.domElement.removeEventListener("pointerup",te),n.domElement.getRootNode().removeEventListener("keydown",Ae,{capture:!0}),n._domElementKeyEvents!==null&&(n._domElementKeyEvents.removeEventListener("keydown",de),n._domElementKeyEvents=null)};const n=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=r.NONE;const a=1e-6,o=new Xo,l=new Xo;let c=1;const h=new R,d=new ue,u=new ue,p=new ue,_=new ue,v=new ue,m=new ue,f=new ue,b=new ue,x=new ue,D=new R,P=new ue;let T=!1;const w=[],L={};let E=!1;function M(g){return g!==null?2*Math.PI/60*n.autoRotateSpeed*g:2*Math.PI/60/60*n.autoRotateSpeed}function N(g){const H=Math.abs(g*.01);return Math.pow(.95,n.zoomSpeed*H)}function I(g){l.theta-=g}function C(g){l.phi-=g}const z=(function(){const g=new R;return function(K,se){g.setFromMatrixColumn(se,0),g.multiplyScalar(-K),h.add(g)}})(),V=(function(){const g=new R;return function(K,se){n.screenSpacePanning===!0?g.setFromMatrixColumn(se,1):(g.setFromMatrixColumn(se,0),g.crossVectors(n.object.up,g)),g.multiplyScalar(K),h.add(g)}})(),q=(function(){const g=new R;return function(K,se){const fe=n.domElement;if(n.object.isPerspectiveCamera){const Ve=n.object.position;g.copy(Ve).sub(n.target);let ze=g.length();ze*=Math.tan(n.object.fov/2*Math.PI/180),z(2*K*ze/fe.clientHeight,n.object.matrix),V(2*se*ze/fe.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(z(K*(n.object.right-n.object.left)/n.object.zoom/fe.clientWidth,n.object.matrix),V(se*(n.object.top-n.object.bottom)/n.object.zoom/fe.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function ee(g){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?c/=g:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function B(g){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?c*=g:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function $(g,H){if(!n.zoomToCursor)return;T=!0;const K=n.domElement.getBoundingClientRect(),se=g-K.left,fe=H-K.top,Ve=K.width,ze=K.height;P.x=se/Ve*2-1,P.y=-(fe/ze)*2+1,D.set(P.x,P.y,1).unproject(n.object).sub(n.object.position).normalize()}function j(g){return Math.max(n.minDistance,Math.min(n.maxDistance,g))}function F(g){d.set(g.clientX,g.clientY)}function Q(g){$(g.clientX,g.clientX),f.set(g.clientX,g.clientY)}function pe(g){_.set(g.clientX,g.clientY)}function U(g){u.set(g.clientX,g.clientY),p.subVectors(u,d).multiplyScalar(n.rotateSpeed);const H=n.domElement;I(2*Math.PI*p.x/H.clientHeight),C(2*Math.PI*p.y/H.clientHeight),d.copy(u),n.update()}function J(g){b.set(g.clientX,g.clientY),x.subVectors(b,f),x.y>0?ee(N(x.y)):x.y<0&&B(N(x.y)),f.copy(b),n.update()}function le(g){v.set(g.clientX,g.clientY),m.subVectors(v,_).multiplyScalar(n.panSpeed),q(m.x,m.y),_.copy(v),n.update()}function ne(g){$(g.clientX,g.clientY),g.deltaY<0?B(N(g.deltaY)):g.deltaY>0&&ee(N(g.deltaY)),n.update()}function xe(g){let H=!1;switch(g.code){case n.keys.UP:g.ctrlKey||g.metaKey||g.shiftKey?C(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):q(0,n.keyPanSpeed),H=!0;break;case n.keys.BOTTOM:g.ctrlKey||g.metaKey||g.shiftKey?C(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):q(0,-n.keyPanSpeed),H=!0;break;case n.keys.LEFT:g.ctrlKey||g.metaKey||g.shiftKey?I(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):q(n.keyPanSpeed,0),H=!0;break;case n.keys.RIGHT:g.ctrlKey||g.metaKey||g.shiftKey?I(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):q(-n.keyPanSpeed,0),H=!0;break}H&&(g.preventDefault(),n.update())}function De(g){if(w.length===1)d.set(g.pageX,g.pageY);else{const H=je(g),K=.5*(g.pageX+H.x),se=.5*(g.pageY+H.y);d.set(K,se)}}function Ce(g){if(w.length===1)_.set(g.pageX,g.pageY);else{const H=je(g),K=.5*(g.pageX+H.x),se=.5*(g.pageY+H.y);_.set(K,se)}}function k(g){const H=je(g),K=g.pageX-H.x,se=g.pageY-H.y,fe=Math.sqrt(K*K+se*se);f.set(0,fe)}function Fe(g){n.enableZoom&&k(g),n.enablePan&&Ce(g)}function ve(g){n.enableZoom&&k(g),n.enableRotate&&De(g)}function Ge(g){if(w.length==1)u.set(g.pageX,g.pageY);else{const K=je(g),se=.5*(g.pageX+K.x),fe=.5*(g.pageY+K.y);u.set(se,fe)}p.subVectors(u,d).multiplyScalar(n.rotateSpeed);const H=n.domElement;I(2*Math.PI*p.x/H.clientHeight),C(2*Math.PI*p.y/H.clientHeight),d.copy(u)}function ye(g){if(w.length===1)v.set(g.pageX,g.pageY);else{const H=je(g),K=.5*(g.pageX+H.x),se=.5*(g.pageY+H.y);v.set(K,se)}m.subVectors(v,_).multiplyScalar(n.panSpeed),q(m.x,m.y),_.copy(v)}function We(g){const H=je(g),K=g.pageX-H.x,se=g.pageY-H.y,fe=Math.sqrt(K*K+se*se);b.set(0,fe),x.set(0,Math.pow(b.y/f.y,n.zoomSpeed)),ee(x.y),f.copy(b);const Ve=(g.pageX+H.x)*.5,ze=(g.pageY+H.y)*.5;$(Ve,ze)}function A(g){n.enableZoom&&We(g),n.enablePan&&ye(g)}function S(g){n.enableZoom&&We(g),n.enableRotate&&Ge(g)}function Y(g){n.enabled!==!1&&(w.length===0&&(n.domElement.setPointerCapture(g.pointerId),n.domElement.addEventListener("pointermove",Z),n.domElement.addEventListener("pointerup",te)),!Ye(g)&&(ke(g),g.pointerType==="touch"?Re(g):ie(g)))}function Z(g){n.enabled!==!1&&(g.pointerType==="touch"?ge(g):Te(g))}function te(g){switch(He(g),w.length){case 0:n.domElement.releasePointerCapture(g.pointerId),n.domElement.removeEventListener("pointermove",Z),n.domElement.removeEventListener("pointerup",te),n.dispatchEvent(jo),s=r.NONE;break;case 1:const H=w[0],K=L[H];Re({pointerId:H,pageX:K.x,pageY:K.y});break}}function ie(g){let H;switch(g.button){case 0:H=n.mouseButtons.LEFT;break;case 1:H=n.mouseButtons.MIDDLE;break;case 2:H=n.mouseButtons.RIGHT;break;default:H=-1}switch(H){case Hn.DOLLY:if(n.enableZoom===!1)return;Q(g),s=r.DOLLY;break;case Hn.ROTATE:if(g.ctrlKey||g.metaKey||g.shiftKey){if(n.enablePan===!1)return;pe(g),s=r.PAN}else{if(n.enableRotate===!1)return;F(g),s=r.ROTATE}break;case Hn.PAN:if(g.ctrlKey||g.metaKey||g.shiftKey){if(n.enableRotate===!1)return;F(g),s=r.ROTATE}else{if(n.enablePan===!1)return;pe(g),s=r.PAN}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(Ds)}function Te(g){switch(s){case r.ROTATE:if(n.enableRotate===!1)return;U(g);break;case r.DOLLY:if(n.enableZoom===!1)return;J(g);break;case r.PAN:if(n.enablePan===!1)return;le(g);break}}function re(g){n.enabled===!1||n.enableZoom===!1||s!==r.NONE||(g.preventDefault(),n.dispatchEvent(Ds),ne(Ee(g)),n.dispatchEvent(jo))}function Ee(g){const H=g.deltaMode,K={clientX:g.clientX,clientY:g.clientY,deltaY:g.deltaY};switch(H){case 1:K.deltaY*=16;break;case 2:K.deltaY*=100;break}return g.ctrlKey&&!E&&(K.deltaY*=10),K}function Ae(g){g.key==="Control"&&(E=!0,n.domElement.getRootNode().addEventListener("keyup",ae,{passive:!0,capture:!0}))}function ae(g){g.key==="Control"&&(E=!1,n.domElement.getRootNode().removeEventListener("keyup",ae,{passive:!0,capture:!0}))}function de(g){n.enabled===!1||n.enablePan===!1||xe(g)}function Re(g){switch(Xe(g),w.length){case 1:switch(n.touches.ONE){case Vn.ROTATE:if(n.enableRotate===!1)return;De(g),s=r.TOUCH_ROTATE;break;case Vn.PAN:if(n.enablePan===!1)return;Ce(g),s=r.TOUCH_PAN;break;default:s=r.NONE}break;case 2:switch(n.touches.TWO){case Vn.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Fe(g),s=r.TOUCH_DOLLY_PAN;break;case Vn.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;ve(g),s=r.TOUCH_DOLLY_ROTATE;break;default:s=r.NONE}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(Ds)}function ge(g){switch(Xe(g),s){case r.TOUCH_ROTATE:if(n.enableRotate===!1)return;Ge(g),n.update();break;case r.TOUCH_PAN:if(n.enablePan===!1)return;ye(g),n.update();break;case r.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;A(g),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;S(g),n.update();break;default:s=r.NONE}}function _e(g){n.enabled!==!1&&g.preventDefault()}function ke(g){w.push(g.pointerId)}function He(g){delete L[g.pointerId];for(let H=0;H<w.length;H++)if(w[H]==g.pointerId){w.splice(H,1);return}}function Ye(g){for(let H=0;H<w.length;H++)if(w[H]==g.pointerId)return!0;return!1}function Xe(g){let H=L[g.pointerId];H===void 0&&(H=new ue,L[g.pointerId]=H),H.set(g.pageX,g.pageY)}function je(g){const H=g.pointerId===w[0]?w[1]:w[0];return L[H]}n.domElement.addEventListener("contextmenu",_e),n.domElement.addEventListener("pointerdown",Y),n.domElement.addEventListener("pointercancel",te),n.domElement.addEventListener("wheel",re,{passive:!1}),n.domElement.getRootNode().addEventListener("keydown",Ae,{passive:!0,capture:!0}),this.update()}}const Hl={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
|
|
3800
|
+
}`;class w0{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const r=new Tt,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=n.depthNear||t.depthFar!=n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}render(e,t){if(this.texture!==null){if(this.mesh===null){const n=t.cameras[0].viewport,r=new ft({vertexShader:D0,fragmentShader:A0,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new bt(new zr(20,20),r)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}}class C0 extends Nn{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,u=null,d=null,h=null,f=null,g=null;const _=new w0,m=t.getContextAttributes();let p=null,E=null;const v=[],b=[],R=new ue;let T=null;const A=new Rt;A.layers.enable(1),A.viewport=new dt;const P=new Rt;P.layers.enable(2),P.viewport=new dt;const y=[A,P],M=new b0;M.layers.enable(1),M.layers.enable(2);let F=null,L=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(O){let Q=v[O];return Q===void 0&&(Q=new Es,v[O]=Q),Q.getTargetRaySpace()},this.getControllerGrip=function(O){let Q=v[O];return Q===void 0&&(Q=new Es,v[O]=Q),Q.getGripSpace()},this.getHand=function(O){let Q=v[O];return Q===void 0&&(Q=new Es,v[O]=Q),Q.getHandSpace()};function C(O){const Q=b.indexOf(O.inputSource);if(Q===-1)return;const ce=v[Q];ce!==void 0&&(ce.update(O.inputSource,O.frame,c||a),ce.dispatchEvent({type:O.type,data:O.inputSource}))}function U(){r.removeEventListener("select",C),r.removeEventListener("selectstart",C),r.removeEventListener("selectend",C),r.removeEventListener("squeeze",C),r.removeEventListener("squeezestart",C),r.removeEventListener("squeezeend",C),r.removeEventListener("end",U),r.removeEventListener("inputsourceschange",H);for(let O=0;O<v.length;O++){const Q=b[O];Q!==null&&(b[O]=null,v[O].disconnect(Q))}F=null,L=null,_.reset(),e.setRenderTarget(p),f=null,h=null,d=null,r=null,E=null,me.stop(),n.isPresenting=!1,e.setPixelRatio(T),e.setSize(R.width,R.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(O){s=O,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(O){o=O,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(O){c=O},this.getBaseLayer=function(){return h!==null?h:f},this.getBinding=function(){return d},this.getFrame=function(){return g},this.getSession=function(){return r},this.setSession=async function(O){if(r=O,r!==null){if(p=e.getRenderTarget(),r.addEventListener("select",C),r.addEventListener("selectstart",C),r.addEventListener("selectend",C),r.addEventListener("squeeze",C),r.addEventListener("squeezestart",C),r.addEventListener("squeezeend",C),r.addEventListener("end",U),r.addEventListener("inputsourceschange",H),m.xrCompatible!==!0&&await t.makeXRCompatible(),T=e.getPixelRatio(),e.getSize(R),r.renderState.layers===void 0){const Q={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(r,t,Q),r.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),E=new Ht(f.framebufferWidth,f.framebufferHeight,{format:Xt,type:mn,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil})}else{let Q=null,ce=null,ne=null;m.depth&&(ne=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Q=m.stencil?Ni:hi,ce=m.stencil?zi:gi);const ve={colorFormat:t.RGBA8,depthFormat:ne,scaleFactor:s};d=new XRWebGLBinding(r,t),h=d.createProjectionLayer(ve),r.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),E=new Ht(h.textureWidth,h.textureHeight,{format:Xt,type:mn,depthTexture:new rc(h.textureWidth,h.textureHeight,ce,void 0,void 0,void 0,void 0,void 0,void 0,Q),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0});const Te=e.properties.get(E);Te.__ignoreDepthValues=h.ignoreDepthValues}E.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),me.setContext(r),me.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode};function H(O){for(let Q=0;Q<O.removed.length;Q++){const ce=O.removed[Q],ne=b.indexOf(ce);ne>=0&&(b[ne]=null,v[ne].disconnect(ce))}for(let Q=0;Q<O.added.length;Q++){const ce=O.added[Q];let ne=b.indexOf(ce);if(ne===-1){for(let Te=0;Te<v.length;Te++)if(Te>=b.length){b.push(ce),ne=Te;break}else if(b[Te]===null){b[Te]=ce,ne=Te;break}if(ne===-1)break}const ve=v[ne];ve&&ve.connect(ce)}}const Y=new I,J=new I;function z(O,Q,ce){Y.setFromMatrixPosition(Q.matrixWorld),J.setFromMatrixPosition(ce.matrixWorld);const ne=Y.distanceTo(J),ve=Q.projectionMatrix.elements,Te=ce.projectionMatrix.elements,Ce=ve[14]/(ve[10]-1),k=ve[14]/(ve[10]+1),Fe=(ve[9]+1)/ve[5],xe=(ve[9]-1)/ve[5],Ge=(ve[8]-1)/ve[0],Ee=(Te[8]+1)/Te[0],We=Ce*Ge,w=Ce*Ee,S=ne/(-Ge+Ee),q=S*-Ge;Q.matrixWorld.decompose(O.position,O.quaternion,O.scale),O.translateX(q),O.translateZ(S),O.matrixWorld.compose(O.position,O.quaternion,O.scale),O.matrixWorldInverse.copy(O.matrixWorld).invert();const Z=Ce+S,te=k+S,ie=We-q,De=w+(ne-q),re=Fe*k/te*Z,ye=xe*k/te*Z;O.projectionMatrix.makePerspective(ie,De,re,ye,Z,te),O.projectionMatrixInverse.copy(O.projectionMatrix).invert()}function j(O,Q){Q===null?O.matrixWorld.copy(O.matrix):O.matrixWorld.multiplyMatrices(Q.matrixWorld,O.matrix),O.matrixWorldInverse.copy(O.matrixWorld).invert()}this.updateCamera=function(O){if(r===null)return;_.texture!==null&&(O.near=_.depthNear,O.far=_.depthFar),M.near=P.near=A.near=O.near,M.far=P.far=A.far=O.far,(F!==M.near||L!==M.far)&&(r.updateRenderState({depthNear:M.near,depthFar:M.far}),F=M.near,L=M.far,A.near=F,A.far=L,P.near=F,P.far=L,A.updateProjectionMatrix(),P.updateProjectionMatrix(),O.updateProjectionMatrix());const Q=O.parent,ce=M.cameras;j(M,Q);for(let ne=0;ne<ce.length;ne++)j(ce[ne],Q);ce.length===2?z(M,A,P):M.projectionMatrix.copy(A.projectionMatrix),$(O,M,Q)};function $(O,Q,ce){ce===null?O.matrix.copy(Q.matrixWorld):(O.matrix.copy(ce.matrixWorld),O.matrix.invert(),O.matrix.multiply(Q.matrixWorld)),O.matrix.decompose(O.position,O.quaternion,O.scale),O.updateMatrixWorld(!0),O.projectionMatrix.copy(Q.projectionMatrix),O.projectionMatrixInverse.copy(Q.projectionMatrixInverse),O.isPerspectiveCamera&&(O.fov=Oi*2*Math.atan(1/O.projectionMatrix.elements[5]),O.zoom=1)}this.getCamera=function(){return M},this.getFoveation=function(){if(!(h===null&&f===null))return l},this.setFoveation=function(O){l=O,h!==null&&(h.fixedFoveation=O),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=O)},this.hasDepthSensing=function(){return _.texture!==null};let N=null;function ee(O,Q){if(u=Q.getViewerPose(c||a),g=Q,u!==null){const ce=u.views;f!==null&&(e.setRenderTargetFramebuffer(E,f.framebuffer),e.setRenderTarget(E));let ne=!1;ce.length!==M.cameras.length&&(M.cameras.length=0,ne=!0);for(let Te=0;Te<ce.length;Te++){const Ce=ce[Te];let k=null;if(f!==null)k=f.getViewport(Ce);else{const xe=d.getViewSubImage(h,Ce);k=xe.viewport,Te===0&&(e.setRenderTargetTextures(E,xe.colorTexture,h.ignoreDepthValues?void 0:xe.depthStencilTexture),e.setRenderTarget(E))}let Fe=y[Te];Fe===void 0&&(Fe=new Rt,Fe.layers.enable(Te),Fe.viewport=new dt,y[Te]=Fe),Fe.matrix.fromArray(Ce.transform.matrix),Fe.matrix.decompose(Fe.position,Fe.quaternion,Fe.scale),Fe.projectionMatrix.fromArray(Ce.projectionMatrix),Fe.projectionMatrixInverse.copy(Fe.projectionMatrix).invert(),Fe.viewport.set(k.x,k.y,k.width,k.height),Te===0&&(M.matrix.copy(Fe.matrix),M.matrix.decompose(M.position,M.quaternion,M.scale)),ne===!0&&M.cameras.push(Fe)}const ve=r.enabledFeatures;if(ve&&ve.includes("depth-sensing")){const Te=d.getDepthInformation(ce[0]);Te&&Te.isValid&&Te.texture&&_.init(e,Te,r.renderState)}}for(let ce=0;ce<v.length;ce++){const ne=b[ce],ve=v[ce];ne!==null&&ve!==void 0&&ve.update(ne,Q,c||a)}_.render(e,M),N&&N(O,Q),Q.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Q}),g=null}const me=new nc;me.setAnimationLoop(ee),this.setAnimationLoop=function(O){N=O},this.dispose=function(){}}}const Dn=new In,R0=new et;function P0(i,e){function t(m,p){m.matrixAutoUpdate===!0&&m.updateMatrix(),p.value.copy(m.matrix)}function n(m,p){p.color.getRGB(m.fogColor.value,Jl(i)),p.isFog?(m.fogNear.value=p.near,m.fogFar.value=p.far):p.isFogExp2&&(m.fogDensity.value=p.density)}function r(m,p,E,v,b){p.isMeshBasicMaterial||p.isMeshLambertMaterial?s(m,p):p.isMeshToonMaterial?(s(m,p),d(m,p)):p.isMeshPhongMaterial?(s(m,p),u(m,p)):p.isMeshStandardMaterial?(s(m,p),h(m,p),p.isMeshPhysicalMaterial&&f(m,p,b)):p.isMeshMatcapMaterial?(s(m,p),g(m,p)):p.isMeshDepthMaterial?s(m,p):p.isMeshDistanceMaterial?(s(m,p),_(m,p)):p.isMeshNormalMaterial?s(m,p):p.isLineBasicMaterial?(a(m,p),p.isLineDashedMaterial&&o(m,p)):p.isPointsMaterial?l(m,p,E,v):p.isSpriteMaterial?c(m,p):p.isShadowMaterial?(m.color.value.copy(p.color),m.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function s(m,p){m.opacity.value=p.opacity,p.color&&m.diffuse.value.copy(p.color),p.emissive&&m.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.bumpMap&&(m.bumpMap.value=p.bumpMap,t(p.bumpMap,m.bumpMapTransform),m.bumpScale.value=p.bumpScale,p.side===St&&(m.bumpScale.value*=-1)),p.normalMap&&(m.normalMap.value=p.normalMap,t(p.normalMap,m.normalMapTransform),m.normalScale.value.copy(p.normalScale),p.side===St&&m.normalScale.value.negate()),p.displacementMap&&(m.displacementMap.value=p.displacementMap,t(p.displacementMap,m.displacementMapTransform),m.displacementScale.value=p.displacementScale,m.displacementBias.value=p.displacementBias),p.emissiveMap&&(m.emissiveMap.value=p.emissiveMap,t(p.emissiveMap,m.emissiveMapTransform)),p.specularMap&&(m.specularMap.value=p.specularMap,t(p.specularMap,m.specularMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest);const E=e.get(p),v=E.envMap,b=E.envMapRotation;if(v&&(m.envMap.value=v,Dn.copy(b),Dn.x*=-1,Dn.y*=-1,Dn.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(Dn.y*=-1,Dn.z*=-1),m.envMapRotation.value.setFromMatrix4(R0.makeRotationFromEuler(Dn)),m.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap){m.lightMap.value=p.lightMap;const R=i._useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=p.lightMapIntensity*R,t(p.lightMap,m.lightMapTransform)}p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,m.aoMapTransform))}function a(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform))}function o(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function l(m,p,E,v){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*E,m.scale.value=v*.5,p.map&&(m.map.value=p.map,t(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function c(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function u(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function d(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function h(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,m.roughnessMapTransform)),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function f(m,p,E){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===St&&m.clearcoatNormalScale.value.negate())),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=E.texture,m.transmissionSamplerSize.value.set(E.width,E.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(m.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(m.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,p){p.matcap&&(m.matcap.value=p.matcap)}function _(m,p){const E=e.get(p).light;m.referencePosition.value.setFromMatrixPosition(E.matrixWorld),m.nearDistance.value=E.shadow.camera.near,m.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function L0(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(E,v){const b=v.program;n.uniformBlockBinding(E,b)}function c(E,v){let b=r[E.id];b===void 0&&(g(E),b=u(E),r[E.id]=b,E.addEventListener("dispose",m));const R=v.program;n.updateUBOMapping(E,R);const T=e.render.frame;s[E.id]!==T&&(h(E),s[E.id]=T)}function u(E){const v=d();E.__bindingPointIndex=v;const b=i.createBuffer(),R=E.__size,T=E.usage;return i.bindBuffer(i.UNIFORM_BUFFER,b),i.bufferData(i.UNIFORM_BUFFER,R,T),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,v,b),b}function d(){for(let E=0;E<o;E++)if(a.indexOf(E)===-1)return a.push(E),E;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(E){const v=r[E.id],b=E.uniforms,R=E.__cache;i.bindBuffer(i.UNIFORM_BUFFER,v);for(let T=0,A=b.length;T<A;T++){const P=Array.isArray(b[T])?b[T]:[b[T]];for(let y=0,M=P.length;y<M;y++){const F=P[y];if(f(F,T,y,R)===!0){const L=F.__offset,C=Array.isArray(F.value)?F.value:[F.value];let U=0;for(let H=0;H<C.length;H++){const Y=C[H],J=_(Y);typeof Y=="number"||typeof Y=="boolean"?(F.__data[0]=Y,i.bufferSubData(i.UNIFORM_BUFFER,L+U,F.__data)):Y.isMatrix3?(F.__data[0]=Y.elements[0],F.__data[1]=Y.elements[1],F.__data[2]=Y.elements[2],F.__data[3]=0,F.__data[4]=Y.elements[3],F.__data[5]=Y.elements[4],F.__data[6]=Y.elements[5],F.__data[7]=0,F.__data[8]=Y.elements[6],F.__data[9]=Y.elements[7],F.__data[10]=Y.elements[8],F.__data[11]=0):(Y.toArray(F.__data,U),U+=J.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,L,F.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function f(E,v,b,R){const T=E.value,A=v+"_"+b;if(R[A]===void 0)return typeof T=="number"||typeof T=="boolean"?R[A]=T:R[A]=T.clone(),!0;{const P=R[A];if(typeof T=="number"||typeof T=="boolean"){if(P!==T)return R[A]=T,!0}else if(P.equals(T)===!1)return P.copy(T),!0}return!1}function g(E){const v=E.uniforms;let b=0;const R=16;for(let A=0,P=v.length;A<P;A++){const y=Array.isArray(v[A])?v[A]:[v[A]];for(let M=0,F=y.length;M<F;M++){const L=y[M],C=Array.isArray(L.value)?L.value:[L.value];for(let U=0,H=C.length;U<H;U++){const Y=C[U],J=_(Y),z=b%R;z!==0&&R-z<J.boundary&&(b+=R-z),L.__data=new Float32Array(J.storage/Float32Array.BYTES_PER_ELEMENT),L.__offset=b,b+=J.storage}}}const T=b%R;return T>0&&(b+=R-T),E.__size=b,E.__cache={},this}function _(E){const v={boundary:0,storage:0};return typeof E=="number"||typeof E=="boolean"?(v.boundary=4,v.storage=4):E.isVector2?(v.boundary=8,v.storage=8):E.isVector3||E.isColor?(v.boundary=16,v.storage=12):E.isVector4?(v.boundary=16,v.storage=16):E.isMatrix3?(v.boundary=48,v.storage=48):E.isMatrix4?(v.boundary=64,v.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),v}function m(E){const v=E.target;v.removeEventListener("dispose",m);const b=a.indexOf(v.__bindingPointIndex);a.splice(b,1),i.deleteBuffer(r[v.id]),delete r[v.id],delete s[v.id]}function p(){for(const E in r)i.deleteBuffer(r[E]);a=[],r={},s={}}return{bind:l,update:c,dispose:p}}class uc{constructor(e={}){const{canvas:t=bh(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:d=!1}=e;this.isWebGLRenderer=!0;let h;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");h=n.getContextAttributes().alpha}else h=a;const f=new Uint32Array(4),g=new Int32Array(4);let _=null,m=null;const p=[],E=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=It,this._useLegacyLights=!1,this.toneMapping=pn,this.toneMappingExposure=1;const v=this;let b=!1,R=0,T=0,A=null,P=-1,y=null;const M=new dt,F=new dt;let L=null;const C=new be(0);let U=0,H=t.width,Y=t.height,J=1,z=null,j=null;const $=new dt(0,0,H,Y),N=new dt(0,0,H,Y);let ee=!1;const me=new tc;let O=!1,Q=!1;const ce=new et,ne=new ue,ve=new I,Te={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ce(){return A===null?J:1}let k=n;function Fe(D,B){const W=t.getContext(D,B);return W!==null?W:null}try{const D={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Js}`),t.addEventListener("webglcontextlost",V,!1),t.addEventListener("webglcontextrestored",K,!1),t.addEventListener("webglcontextcreationerror",se,!1),k===null){const B="webgl2";if(k=Fe(B,D),k===null)throw Fe(B)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(D){throw console.error("THREE.WebGLRenderer: "+D.message),D}let xe,Ge,Ee,We,w,S,q,Z,te,ie,De,re,ye,Ae,ae,fe,Re,ge,_e,ke,He,qe,Xe,Ye;function Me(){xe=new Hp(k),xe.init(),Ge=new Up(k,xe,e),qe=new E0(k,xe),Ee=new S0(k),We=new Wp(k),w=new o0,S=new y0(k,xe,Ee,w,Ge,qe,We),q=new Op(v),Z=new kp(v),te=new jh(k),Xe=new Fp(k,te),ie=new Vp(k,te,We,Xe),De=new qp(k,ie,te,We),_e=new Xp(k,Ge,S),fe=new Np(w),re=new a0(v,q,Z,xe,Ge,Xe,fe),ye=new P0(v,w),Ae=new c0,ae=new m0(xe),ge=new Lp(v,q,Z,Ee,De,h,l),Re=new M0(v,De,Ge),Ye=new L0(k,We,Ge,Ee),ke=new Ip(k,xe,We),He=new Gp(k,xe,We),We.programs=re.programs,v.capabilities=Ge,v.extensions=xe,v.properties=w,v.renderLists=Ae,v.shadowMap=Re,v.state=Ee,v.info=We}Me();const x=new C0(v,k);this.xr=x,this.getContext=function(){return k},this.getContextAttributes=function(){return k.getContextAttributes()},this.forceContextLoss=function(){const D=xe.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){const D=xe.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return J},this.setPixelRatio=function(D){D!==void 0&&(J=D,this.setSize(H,Y,!1))},this.getSize=function(D){return D.set(H,Y)},this.setSize=function(D,B,W=!0){if(x.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}H=D,Y=B,t.width=Math.floor(D*J),t.height=Math.floor(B*J),W===!0&&(t.style.width=D+"px",t.style.height=B+"px"),this.setViewport(0,0,D,B)},this.getDrawingBufferSize=function(D){return D.set(H*J,Y*J).floor()},this.setDrawingBufferSize=function(D,B,W){H=D,Y=B,J=W,t.width=Math.floor(D*W),t.height=Math.floor(B*W),this.setViewport(0,0,D,B)},this.getCurrentViewport=function(D){return D.copy(M)},this.getViewport=function(D){return D.copy($)},this.setViewport=function(D,B,W,X){D.isVector4?$.set(D.x,D.y,D.z,D.w):$.set(D,B,W,X),Ee.viewport(M.copy($).multiplyScalar(J).round())},this.getScissor=function(D){return D.copy(N)},this.setScissor=function(D,B,W,X){D.isVector4?N.set(D.x,D.y,D.z,D.w):N.set(D,B,W,X),Ee.scissor(F.copy(N).multiplyScalar(J).round())},this.getScissorTest=function(){return ee},this.setScissorTest=function(D){Ee.setScissorTest(ee=D)},this.setOpaqueSort=function(D){z=D},this.setTransparentSort=function(D){j=D},this.getClearColor=function(D){return D.copy(ge.getClearColor())},this.setClearColor=function(){ge.setClearColor.apply(ge,arguments)},this.getClearAlpha=function(){return ge.getClearAlpha()},this.setClearAlpha=function(){ge.setClearAlpha.apply(ge,arguments)},this.clear=function(D=!0,B=!0,W=!0){let X=0;if(D){let G=!1;if(A!==null){const he=A.texture.format;G=he===kl||he===zl||he===Bl}if(G){const he=A.texture.type,Se=he===mn||he===gi||he===Il||he===zi||he===Nl||he===Ol,we=ge.getClearColor(),Pe=ge.getClearAlpha(),Ie=we.r,Le=we.g,Ue=we.b;Se?(f[0]=Ie,f[1]=Le,f[2]=Ue,f[3]=Pe,k.clearBufferuiv(k.COLOR,0,f)):(g[0]=Ie,g[1]=Le,g[2]=Ue,g[3]=Pe,k.clearBufferiv(k.COLOR,0,g))}else X|=k.COLOR_BUFFER_BIT}B&&(X|=k.DEPTH_BUFFER_BIT),W&&(X|=k.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),k.clear(X)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",V,!1),t.removeEventListener("webglcontextrestored",K,!1),t.removeEventListener("webglcontextcreationerror",se,!1),Ae.dispose(),ae.dispose(),w.dispose(),q.dispose(),Z.dispose(),De.dispose(),Xe.dispose(),Ye.dispose(),re.dispose(),x.dispose(),x.removeEventListener("sessionstart",it),x.removeEventListener("sessionend",rt),Dt.stop()};function V(D){D.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),b=!0}function K(){console.log("THREE.WebGLRenderer: Context Restored."),b=!1;const D=We.autoReset,B=Re.enabled,W=Re.autoUpdate,X=Re.needsUpdate,G=Re.type;Me(),We.autoReset=D,Re.enabled=B,Re.autoUpdate=W,Re.needsUpdate=X,Re.type=G}function se(D){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",D.statusMessage)}function pe(D){const B=D.target;B.removeEventListener("dispose",pe),Ve(B)}function Ve(D){ze(D),w.remove(D)}function ze(D){const B=w.get(D).programs;B!==void 0&&(B.forEach(function(W){re.releaseProgram(W)}),D.isShaderMaterial&&re.releaseShaderCache(D))}this.renderBufferDirect=function(D,B,W,X,G,he){B===null&&(B=Te);const Se=G.isMesh&&G.matrixWorld.determinant()<0,we=Ac(D,B,W,X,G);Ee.setMaterial(X,Se);let Pe=W.index,Ie=1;if(X.wireframe===!0){if(Pe=ie.getWireframeAttribute(W),Pe===void 0)return;Ie=2}const Le=W.drawRange,Ue=W.attributes.position;let tt=Le.start*Ie,At=(Le.start+Le.count)*Ie;he!==null&&(tt=Math.max(tt,he.start*Ie),At=Math.min(At,(he.start+he.count)*Ie)),Pe!==null?(tt=Math.max(tt,0),At=Math.min(At,Pe.count)):Ue!=null&&(tt=Math.max(tt,0),At=Math.min(At,Ue.count));const ct=At-tt;if(ct<0||ct===1/0)return;Xe.setup(G,X,we,W,Pe);let qt,Qe=ke;if(Pe!==null&&(qt=te.get(Pe),Qe=He,Qe.setIndex(qt)),G.isMesh)X.wireframe===!0?(Ee.setLineWidth(X.wireframeLinewidth*Ce()),Qe.setMode(k.LINES)):Qe.setMode(k.TRIANGLES);else if(G.isLine){let Ne=X.linewidth;Ne===void 0&&(Ne=1),Ee.setLineWidth(Ne*Ce()),G.isLineSegments?Qe.setMode(k.LINES):G.isLineLoop?Qe.setMode(k.LINE_LOOP):Qe.setMode(k.LINE_STRIP)}else G.isPoints?Qe.setMode(k.POINTS):G.isSprite&&Qe.setMode(k.TRIANGLES);if(G.isBatchedMesh)Qe.renderMultiDraw(G._multiDrawStarts,G._multiDrawCounts,G._multiDrawCount);else if(G.isInstancedMesh)Qe.renderInstances(tt,ct,G.count);else if(W.isInstancedBufferGeometry){const Ne=W._maxInstanceCount!==void 0?W._maxInstanceCount:1/0,Vr=Math.min(W.instanceCount,Ne);Qe.renderInstances(tt,ct,Vr)}else Qe.render(tt,ct)};function Ze(D,B,W){D.transparent===!0&&D.side===Wt&&D.forceSinglePass===!1?(D.side=St,D.needsUpdate=!0,Xi(D,B,W),D.side=_n,D.needsUpdate=!0,Xi(D,B,W),D.side=Wt):Xi(D,B,W)}this.compile=function(D,B,W=null){W===null&&(W=D),m=ae.get(W),m.init(),E.push(m),W.traverseVisible(function(G){G.isLight&&G.layers.test(B.layers)&&(m.pushLight(G),G.castShadow&&m.pushShadow(G))}),D!==W&&D.traverseVisible(function(G){G.isLight&&G.layers.test(B.layers)&&(m.pushLight(G),G.castShadow&&m.pushShadow(G))}),m.setupLights(v._useLegacyLights);const X=new Set;return D.traverse(function(G){const he=G.material;if(he)if(Array.isArray(he))for(let Se=0;Se<he.length;Se++){const we=he[Se];Ze(we,W,G),X.add(we)}else Ze(he,W,G),X.add(he)}),E.pop(),m=null,X},this.compileAsync=function(D,B,W=null){const X=this.compile(D,B,W);return new Promise(G=>{function he(){if(X.forEach(function(Se){w.get(Se).currentProgram.isReady()&&X.delete(Se)}),X.size===0){G(D);return}setTimeout(he,10)}xe.get("KHR_parallel_shader_compile")!==null?he():setTimeout(he,10)})};let lt=null;function $e(D){lt&<(D)}function it(){Dt.stop()}function rt(){Dt.start()}const Dt=new nc;Dt.setAnimationLoop($e),typeof self<"u"&&Dt.setContext(self),this.setAnimationLoop=function(D){lt=D,x.setAnimationLoop(D),D===null?Dt.stop():Dt.start()},x.addEventListener("sessionstart",it),x.addEventListener("sessionend",rt),this.render=function(D,B){if(B!==void 0&&B.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(b===!0)return;D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),B.parent===null&&B.matrixWorldAutoUpdate===!0&&B.updateMatrixWorld(),x.enabled===!0&&x.isPresenting===!0&&(x.cameraAutoUpdate===!0&&x.updateCamera(B),B=x.getCamera()),D.isScene===!0&&D.onBeforeRender(v,D,B,A),m=ae.get(D,E.length),m.init(),E.push(m),ce.multiplyMatrices(B.projectionMatrix,B.matrixWorldInverse),me.setFromProjectionMatrix(ce),Q=this.localClippingEnabled,O=fe.init(this.clippingPlanes,Q),_=Ae.get(D,p.length),_.init(),p.push(_),Pt(D,B,0,v.sortObjects),_.finish(),v.sortObjects===!0&&_.sort(z,j),this.info.render.frame++,O===!0&&fe.beginShadows();const W=m.state.shadowsArray;if(Re.render(W,D,B),O===!0&&fe.endShadows(),this.info.autoReset===!0&&this.info.reset(),(x.enabled===!1||x.isPresenting===!1||x.hasDepthSensing()===!1)&&ge.render(_,D),m.setupLights(v._useLegacyLights),B.isArrayCamera){const X=B.cameras;for(let G=0,he=X.length;G<he;G++){const Se=X[G];nn(_,D,Se,Se.viewport)}}else nn(_,D,B);A!==null&&(S.updateMultisampleRenderTarget(A),S.updateRenderTargetMipmap(A)),D.isScene===!0&&D.onAfterRender(v,D,B),Xe.resetDefaultState(),P=-1,y=null,E.pop(),E.length>0?m=E[E.length-1]:m=null,p.pop(),p.length>0?_=p[p.length-1]:_=null};function Pt(D,B,W,X){if(D.visible===!1)return;if(D.layers.test(B.layers)){if(D.isGroup)W=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(B);else if(D.isLight)m.pushLight(D),D.castShadow&&m.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||me.intersectsSprite(D)){X&&ve.setFromMatrixPosition(D.matrixWorld).applyMatrix4(ce);const Se=De.update(D),we=D.material;we.visible&&_.push(D,Se,we,W,ve.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(!D.frustumCulled||me.intersectsObject(D))){const Se=De.update(D),we=D.material;if(X&&(D.boundingSphere!==void 0?(D.boundingSphere===null&&D.computeBoundingSphere(),ve.copy(D.boundingSphere.center)):(Se.boundingSphere===null&&Se.computeBoundingSphere(),ve.copy(Se.boundingSphere.center)),ve.applyMatrix4(D.matrixWorld).applyMatrix4(ce)),Array.isArray(we)){const Pe=Se.groups;for(let Ie=0,Le=Pe.length;Ie<Le;Ie++){const Ue=Pe[Ie],tt=we[Ue.materialIndex];tt&&tt.visible&&_.push(D,Se,tt,W,ve.z,Ue)}}else we.visible&&_.push(D,Se,we,W,ve.z,null)}}const he=D.children;for(let Se=0,we=he.length;Se<we;Se++)Pt(he[Se],B,W,X)}function nn(D,B,W,X){const G=D.opaque,he=D.transmissive,Se=D.transparent;m.setupLightsView(W),O===!0&&fe.setGlobalState(v.clippingPlanes,W),he.length>0&&On(G,he,B,W),X&&Ee.viewport(M.copy(X)),G.length>0&&vn(G,B,W),he.length>0&&vn(he,B,W),Se.length>0&&vn(Se,B,W),Ee.buffers.depth.setTest(!0),Ee.buffers.depth.setMask(!0),Ee.buffers.color.setMask(!0),Ee.setPolygonOffset(!1)}function On(D,B,W,X){if((W.isScene===!0?W.overrideMaterial:null)!==null)return;if(m.state.transmissionRenderTarget===null){m.state.transmissionRenderTarget=new Ht(1,1,{generateMipmaps:!0,type:xe.has("EXT_color_buffer_half_float")||xe.has("EXT_color_buffer_float")?gn:mn,minFilter:Ln,samples:4,stencilBuffer:s});const Ie=w.get(m.state.transmissionRenderTarget);Ie.__isTransmissionRenderTarget=!0}const he=m.state.transmissionRenderTarget;v.getDrawingBufferSize(ne),he.setSize(ne.x,ne.y);const Se=v.getRenderTarget();v.setRenderTarget(he),v.getClearColor(C),U=v.getClearAlpha(),U<1&&v.setClearColor(16777215,.5),v.clear();const we=v.toneMapping;v.toneMapping=pn,vn(D,W,X),S.updateMultisampleRenderTarget(he),S.updateRenderTargetMipmap(he);let Pe=!1;for(let Ie=0,Le=B.length;Ie<Le;Ie++){const Ue=B[Ie],tt=Ue.object,At=Ue.geometry,ct=Ue.material,qt=Ue.group;if(ct.side===Wt&&tt.layers.test(X.layers)){const Qe=ct.side;ct.side=St,ct.needsUpdate=!0,oa(tt,W,X,At,ct,qt),ct.side=Qe,ct.needsUpdate=!0,Pe=!0}}Pe===!0&&(S.updateMultisampleRenderTarget(he),S.updateRenderTargetMipmap(he)),v.setRenderTarget(Se),v.setClearColor(C,U),v.toneMapping=we}function vn(D,B,W){const X=B.isScene===!0?B.overrideMaterial:null;for(let G=0,he=D.length;G<he;G++){const Se=D[G],we=Se.object,Pe=Se.geometry,Ie=X===null?Se.material:X,Le=Se.group;we.layers.test(W.layers)&&oa(we,B,W,Pe,Ie,Le)}}function oa(D,B,W,X,G,he){D.onBeforeRender(v,B,W,X,G,he),D.modelViewMatrix.multiplyMatrices(W.matrixWorldInverse,D.matrixWorld),D.normalMatrix.getNormalMatrix(D.modelViewMatrix),G.onBeforeRender(v,B,W,X,D,he),G.transparent===!0&&G.side===Wt&&G.forceSinglePass===!1?(G.side=St,G.needsUpdate=!0,v.renderBufferDirect(W,B,X,G,D,he),G.side=_n,G.needsUpdate=!0,v.renderBufferDirect(W,B,X,G,D,he),G.side=Wt):v.renderBufferDirect(W,B,X,G,D,he),D.onAfterRender(v,B,W,X,G,he)}function Xi(D,B,W){B.isScene!==!0&&(B=Te);const X=w.get(D),G=m.state.lights,he=m.state.shadowsArray,Se=G.state.version,we=re.getParameters(D,G.state,he,B,W),Pe=re.getProgramCacheKey(we);let Ie=X.programs;X.environment=D.isMeshStandardMaterial?B.environment:null,X.fog=B.fog,X.envMap=(D.isMeshStandardMaterial?Z:q).get(D.envMap||X.environment),X.envMapRotation=X.environment!==null&&D.envMap===null?B.environmentRotation:D.envMapRotation,Ie===void 0&&(D.addEventListener("dispose",pe),Ie=new Map,X.programs=Ie);let Le=Ie.get(Pe);if(Le!==void 0){if(X.currentProgram===Le&&X.lightsStateVersion===Se)return ca(D,we),Le}else we.uniforms=re.getUniforms(D),D.onBuild(W,we,v),D.onBeforeCompile(we,v),Le=re.acquireProgram(we,Pe),Ie.set(Pe,Le),X.uniforms=we.uniforms;const Ue=X.uniforms;return(!D.isShaderMaterial&&!D.isRawShaderMaterial||D.clipping===!0)&&(Ue.clippingPlanes=fe.uniform),ca(D,we),X.needsLights=Cc(D),X.lightsStateVersion=Se,X.needsLights&&(Ue.ambientLightColor.value=G.state.ambient,Ue.lightProbe.value=G.state.probe,Ue.directionalLights.value=G.state.directional,Ue.directionalLightShadows.value=G.state.directionalShadow,Ue.spotLights.value=G.state.spot,Ue.spotLightShadows.value=G.state.spotShadow,Ue.rectAreaLights.value=G.state.rectArea,Ue.ltc_1.value=G.state.rectAreaLTC1,Ue.ltc_2.value=G.state.rectAreaLTC2,Ue.pointLights.value=G.state.point,Ue.pointLightShadows.value=G.state.pointShadow,Ue.hemisphereLights.value=G.state.hemi,Ue.directionalShadowMap.value=G.state.directionalShadowMap,Ue.directionalShadowMatrix.value=G.state.directionalShadowMatrix,Ue.spotShadowMap.value=G.state.spotShadowMap,Ue.spotLightMatrix.value=G.state.spotLightMatrix,Ue.spotLightMap.value=G.state.spotLightMap,Ue.pointShadowMap.value=G.state.pointShadowMap,Ue.pointShadowMatrix.value=G.state.pointShadowMatrix),X.currentProgram=Le,X.uniformsList=null,Le}function la(D){if(D.uniformsList===null){const B=D.currentProgram.getUniforms();D.uniformsList=Tr.seqWithValue(B.seq,D.uniforms)}return D.uniformsList}function ca(D,B){const W=w.get(D);W.outputColorSpace=B.outputColorSpace,W.batching=B.batching,W.instancing=B.instancing,W.instancingColor=B.instancingColor,W.instancingMorph=B.instancingMorph,W.skinning=B.skinning,W.morphTargets=B.morphTargets,W.morphNormals=B.morphNormals,W.morphColors=B.morphColors,W.morphTargetsCount=B.morphTargetsCount,W.numClippingPlanes=B.numClippingPlanes,W.numIntersection=B.numClipIntersection,W.vertexAlphas=B.vertexAlphas,W.vertexTangents=B.vertexTangents,W.toneMapping=B.toneMapping}function Ac(D,B,W,X,G){B.isScene!==!0&&(B=Te),S.resetTextureUnits();const he=B.fog,Se=X.isMeshStandardMaterial?B.environment:null,we=A===null?v.outputColorSpace:A.isXRRenderTarget===!0?A.texture.colorSpace:xn,Pe=(X.isMeshStandardMaterial?Z:q).get(X.envMap||Se),Ie=X.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,Le=!!W.attributes.tangent&&(!!X.normalMap||X.anisotropy>0),Ue=!!W.morphAttributes.position,tt=!!W.morphAttributes.normal,At=!!W.morphAttributes.color;let ct=pn;X.toneMapped&&(A===null||A.isXRRenderTarget===!0)&&(ct=v.toneMapping);const qt=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,Qe=qt!==void 0?qt.length:0,Ne=w.get(X),Vr=m.state.lights;if(O===!0&&(Q===!0||D!==y)){const Lt=D===y&&X.id===P;fe.setState(X,D,Lt)}let Je=!1;X.version===Ne.__version?(Ne.needsLights&&Ne.lightsStateVersion!==Vr.state.version||Ne.outputColorSpace!==we||G.isBatchedMesh&&Ne.batching===!1||!G.isBatchedMesh&&Ne.batching===!0||G.isInstancedMesh&&Ne.instancing===!1||!G.isInstancedMesh&&Ne.instancing===!0||G.isSkinnedMesh&&Ne.skinning===!1||!G.isSkinnedMesh&&Ne.skinning===!0||G.isInstancedMesh&&Ne.instancingColor===!0&&G.instanceColor===null||G.isInstancedMesh&&Ne.instancingColor===!1&&G.instanceColor!==null||G.isInstancedMesh&&Ne.instancingMorph===!0&&G.morphTexture===null||G.isInstancedMesh&&Ne.instancingMorph===!1&&G.morphTexture!==null||Ne.envMap!==Pe||X.fog===!0&&Ne.fog!==he||Ne.numClippingPlanes!==void 0&&(Ne.numClippingPlanes!==fe.numPlanes||Ne.numIntersection!==fe.numIntersection)||Ne.vertexAlphas!==Ie||Ne.vertexTangents!==Le||Ne.morphTargets!==Ue||Ne.morphNormals!==tt||Ne.morphColors!==At||Ne.toneMapping!==ct||Ne.morphTargetsCount!==Qe)&&(Je=!0):(Je=!0,Ne.__version=X.version);let Mn=Ne.currentProgram;Je===!0&&(Mn=Xi(X,B,G));let ua=!1,Si=!1,Gr=!1;const pt=Mn.getUniforms(),rn=Ne.uniforms;if(Ee.useProgram(Mn.program)&&(ua=!0,Si=!0,Gr=!0),X.id!==P&&(P=X.id,Si=!0),ua||y!==D){pt.setValue(k,"projectionMatrix",D.projectionMatrix),pt.setValue(k,"viewMatrix",D.matrixWorldInverse);const Lt=pt.map.cameraPosition;Lt!==void 0&&Lt.setValue(k,ve.setFromMatrixPosition(D.matrixWorld)),Ge.logarithmicDepthBuffer&&pt.setValue(k,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),(X.isMeshPhongMaterial||X.isMeshToonMaterial||X.isMeshLambertMaterial||X.isMeshBasicMaterial||X.isMeshStandardMaterial||X.isShaderMaterial)&&pt.setValue(k,"isOrthographic",D.isOrthographicCamera===!0),y!==D&&(y=D,Si=!0,Gr=!0)}if(G.isSkinnedMesh){pt.setOptional(k,G,"bindMatrix"),pt.setOptional(k,G,"bindMatrixInverse");const Lt=G.skeleton;Lt&&(Lt.boneTexture===null&&Lt.computeBoneTexture(),pt.setValue(k,"boneTexture",Lt.boneTexture,S))}G.isBatchedMesh&&(pt.setOptional(k,G,"batchingTexture"),pt.setValue(k,"batchingTexture",G._matricesTexture,S));const Wr=W.morphAttributes;if((Wr.position!==void 0||Wr.normal!==void 0||Wr.color!==void 0)&&_e.update(G,W,Mn),(Si||Ne.receiveShadow!==G.receiveShadow)&&(Ne.receiveShadow=G.receiveShadow,pt.setValue(k,"receiveShadow",G.receiveShadow)),X.isMeshGouraudMaterial&&X.envMap!==null&&(rn.envMap.value=Pe,rn.flipEnvMap.value=Pe.isCubeTexture&&Pe.isRenderTargetTexture===!1?-1:1),X.isMeshStandardMaterial&&X.envMap===null&&B.environment!==null&&(rn.envMapIntensity.value=B.environmentIntensity),Si&&(pt.setValue(k,"toneMappingExposure",v.toneMappingExposure),Ne.needsLights&&wc(rn,Gr),he&&X.fog===!0&&ye.refreshFogUniforms(rn,he),ye.refreshMaterialUniforms(rn,X,J,Y,m.state.transmissionRenderTarget),Tr.upload(k,la(Ne),rn,S)),X.isShaderMaterial&&X.uniformsNeedUpdate===!0&&(Tr.upload(k,la(Ne),rn,S),X.uniformsNeedUpdate=!1),X.isSpriteMaterial&&pt.setValue(k,"center",G.center),pt.setValue(k,"modelViewMatrix",G.modelViewMatrix),pt.setValue(k,"normalMatrix",G.normalMatrix),pt.setValue(k,"modelMatrix",G.matrixWorld),X.isShaderMaterial||X.isRawShaderMaterial){const Lt=X.uniformsGroups;for(let Xr=0,Rc=Lt.length;Xr<Rc;Xr++){const ha=Lt[Xr];Ye.update(ha,Mn),Ye.bind(ha,Mn)}}return Mn}function wc(D,B){D.ambientLightColor.needsUpdate=B,D.lightProbe.needsUpdate=B,D.directionalLights.needsUpdate=B,D.directionalLightShadows.needsUpdate=B,D.pointLights.needsUpdate=B,D.pointLightShadows.needsUpdate=B,D.spotLights.needsUpdate=B,D.spotLightShadows.needsUpdate=B,D.rectAreaLights.needsUpdate=B,D.hemisphereLights.needsUpdate=B}function Cc(D){return D.isMeshLambertMaterial||D.isMeshToonMaterial||D.isMeshPhongMaterial||D.isMeshStandardMaterial||D.isShadowMaterial||D.isShaderMaterial&&D.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return T},this.getRenderTarget=function(){return A},this.setRenderTargetTextures=function(D,B,W){w.get(D.texture).__webglTexture=B,w.get(D.depthTexture).__webglTexture=W;const X=w.get(D);X.__hasExternalTextures=!0,X.__autoAllocateDepthBuffer=W===void 0,X.__autoAllocateDepthBuffer||xe.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),X.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(D,B){const W=w.get(D);W.__webglFramebuffer=B,W.__useDefaultFramebuffer=B===void 0},this.setRenderTarget=function(D,B=0,W=0){A=D,R=B,T=W;let X=!0,G=null,he=!1,Se=!1;if(D){const Pe=w.get(D);Pe.__useDefaultFramebuffer!==void 0?(Ee.bindFramebuffer(k.FRAMEBUFFER,null),X=!1):Pe.__webglFramebuffer===void 0?S.setupRenderTarget(D):Pe.__hasExternalTextures&&S.rebindTextures(D,w.get(D.texture).__webglTexture,w.get(D.depthTexture).__webglTexture);const Ie=D.texture;(Ie.isData3DTexture||Ie.isDataArrayTexture||Ie.isCompressedArrayTexture)&&(Se=!0);const Le=w.get(D).__webglFramebuffer;D.isWebGLCubeRenderTarget?(Array.isArray(Le[B])?G=Le[B][W]:G=Le[B],he=!0):D.samples>0&&S.useMultisampledRTT(D)===!1?G=w.get(D).__webglMultisampledFramebuffer:Array.isArray(Le)?G=Le[W]:G=Le,M.copy(D.viewport),F.copy(D.scissor),L=D.scissorTest}else M.copy($).multiplyScalar(J).floor(),F.copy(N).multiplyScalar(J).floor(),L=ee;if(Ee.bindFramebuffer(k.FRAMEBUFFER,G)&&X&&Ee.drawBuffers(D,G),Ee.viewport(M),Ee.scissor(F),Ee.setScissorTest(L),he){const Pe=w.get(D.texture);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_CUBE_MAP_POSITIVE_X+B,Pe.__webglTexture,W)}else if(Se){const Pe=w.get(D.texture),Ie=B||0;k.framebufferTextureLayer(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,Pe.__webglTexture,W||0,Ie)}P=-1},this.readRenderTargetPixels=function(D,B,W,X,G,he,Se){if(!(D&&D.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let we=w.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&Se!==void 0&&(we=we[Se]),we){Ee.bindFramebuffer(k.FRAMEBUFFER,we);try{const Pe=D.texture,Ie=Pe.format,Le=Pe.type;if(Ie!==Xt&&qe.convert(Ie)!==k.getParameter(k.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ue=Le===gn&&(xe.has("EXT_color_buffer_half_float")||xe.has("EXT_color_buffer_float"));if(Le!==mn&&qe.convert(Le)!==k.getParameter(k.IMPLEMENTATION_COLOR_READ_TYPE)&&Le!==fn&&!Ue){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}B>=0&&B<=D.width-X&&W>=0&&W<=D.height-G&&k.readPixels(B,W,X,G,qe.convert(Ie),qe.convert(Le),he)}finally{const Pe=A!==null?w.get(A).__webglFramebuffer:null;Ee.bindFramebuffer(k.FRAMEBUFFER,Pe)}}},this.copyFramebufferToTexture=function(D,B,W=0){const X=Math.pow(2,-W),G=Math.floor(B.image.width*X),he=Math.floor(B.image.height*X);S.setTexture2D(B,0),k.copyTexSubImage2D(k.TEXTURE_2D,W,0,0,D.x,D.y,G,he),Ee.unbindTexture()},this.copyTextureToTexture=function(D,B,W,X=0){const G=B.image.width,he=B.image.height,Se=qe.convert(W.format),we=qe.convert(W.type);S.setTexture2D(W,0),k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,W.flipY),k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,W.premultiplyAlpha),k.pixelStorei(k.UNPACK_ALIGNMENT,W.unpackAlignment),B.isDataTexture?k.texSubImage2D(k.TEXTURE_2D,X,D.x,D.y,G,he,Se,we,B.image.data):B.isCompressedTexture?k.compressedTexSubImage2D(k.TEXTURE_2D,X,D.x,D.y,B.mipmaps[0].width,B.mipmaps[0].height,Se,B.mipmaps[0].data):k.texSubImage2D(k.TEXTURE_2D,X,D.x,D.y,Se,we,B.image),X===0&&W.generateMipmaps&&k.generateMipmap(k.TEXTURE_2D),Ee.unbindTexture()},this.copyTextureToTexture3D=function(D,B,W,X,G=0){const he=Math.round(D.max.x-D.min.x),Se=Math.round(D.max.y-D.min.y),we=D.max.z-D.min.z+1,Pe=qe.convert(X.format),Ie=qe.convert(X.type);let Le;if(X.isData3DTexture)S.setTexture3D(X,0),Le=k.TEXTURE_3D;else if(X.isDataArrayTexture||X.isCompressedArrayTexture)S.setTexture2DArray(X,0),Le=k.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,X.flipY),k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,X.premultiplyAlpha),k.pixelStorei(k.UNPACK_ALIGNMENT,X.unpackAlignment);const Ue=k.getParameter(k.UNPACK_ROW_LENGTH),tt=k.getParameter(k.UNPACK_IMAGE_HEIGHT),At=k.getParameter(k.UNPACK_SKIP_PIXELS),ct=k.getParameter(k.UNPACK_SKIP_ROWS),qt=k.getParameter(k.UNPACK_SKIP_IMAGES),Qe=W.isCompressedTexture?W.mipmaps[G]:W.image;k.pixelStorei(k.UNPACK_ROW_LENGTH,Qe.width),k.pixelStorei(k.UNPACK_IMAGE_HEIGHT,Qe.height),k.pixelStorei(k.UNPACK_SKIP_PIXELS,D.min.x),k.pixelStorei(k.UNPACK_SKIP_ROWS,D.min.y),k.pixelStorei(k.UNPACK_SKIP_IMAGES,D.min.z),W.isDataTexture||W.isData3DTexture?k.texSubImage3D(Le,G,B.x,B.y,B.z,he,Se,we,Pe,Ie,Qe.data):X.isCompressedArrayTexture?k.compressedTexSubImage3D(Le,G,B.x,B.y,B.z,he,Se,we,Pe,Qe.data):k.texSubImage3D(Le,G,B.x,B.y,B.z,he,Se,we,Pe,Ie,Qe),k.pixelStorei(k.UNPACK_ROW_LENGTH,Ue),k.pixelStorei(k.UNPACK_IMAGE_HEIGHT,tt),k.pixelStorei(k.UNPACK_SKIP_PIXELS,At),k.pixelStorei(k.UNPACK_SKIP_ROWS,ct),k.pixelStorei(k.UNPACK_SKIP_IMAGES,qt),G===0&&X.generateMipmaps&&k.generateMipmap(Le),Ee.unbindTexture()},this.initTexture=function(D){D.isCubeTexture?S.setTextureCube(D,0):D.isData3DTexture?S.setTexture3D(D,0):D.isDataArrayTexture||D.isCompressedArrayTexture?S.setTexture2DArray(D,0):S.setTexture2D(D,0),Ee.unbindTexture()},this.resetState=function(){R=0,T=0,A=null,Ee.reset(),Xe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Qt}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===ea?"display-p3":"srgb",t.unpackColorSpace=je.workingColorSpace===Or?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class Hr{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new be(e),this.density=t}clone(){return new Hr(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class hc extends yt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new In,this.environmentIntensity=1,this.environmentRotation=new In,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class qs extends vi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new be(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Yo=new I,$o=new I,jo=new et,bs=new Br,gr=new Hi;class dc extends yt{constructor(e=new _t,t=new qs){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)Yo.fromBufferAttribute(t,r-1),$o.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=Yo.distanceTo($o);e.setAttribute("lineDistance",new nt(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),gr.copy(n.boundingSphere),gr.applyMatrix4(r),gr.radius+=s,e.ray.intersectsSphere(gr)===!1)return;jo.copy(r).invert(),bs.copy(e.ray).applyMatrix4(jo);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=new I,u=new I,d=new I,h=new I,f=this.isLineSegments?2:1,g=n.index,m=n.attributes.position;if(g!==null){const p=Math.max(0,a.start),E=Math.min(g.count,a.start+a.count);for(let v=p,b=E-1;v<b;v+=f){const R=g.getX(v),T=g.getX(v+1);if(c.fromBufferAttribute(m,R),u.fromBufferAttribute(m,T),bs.distanceSqToSegment(c,u,h,d)>l)continue;h.applyMatrix4(this.matrixWorld);const P=e.ray.origin.distanceTo(h);P<e.near||P>e.far||t.push({distance:P,point:d.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else{const p=Math.max(0,a.start),E=Math.min(m.count,a.start+a.count);for(let v=p,b=E-1;v<b;v+=f){if(c.fromBufferAttribute(m,v),u.fromBufferAttribute(m,v+1),bs.distanceSqToSegment(c,u,h,d)>l)continue;h.applyMatrix4(this.matrixWorld);const T=e.ray.origin.distanceTo(h);T<e.near||T>e.far||t.push({distance:T,point:d.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}const Ko=new I,Zo=new I;class F0 extends dc{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let r=0,s=t.count;r<s;r+=2)Ko.fromBufferAttribute(t,r),Zo.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+Ko.distanceTo(Zo);e.setAttribute("lineDistance",new nt(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class I0 extends vi{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new be(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Jo=new et,Ys=new Br,_r=new Hi,xr=new I;class U0 extends yt{constructor(e=new _t,t=new I0){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),_r.copy(n.boundingSphere),_r.applyMatrix4(r),_r.radius+=s,e.ray.intersectsSphere(_r)===!1)return;Jo.copy(r).invert(),Ys.copy(e.ray).applyMatrix4(Jo);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,d=n.attributes.position;if(c!==null){const h=Math.max(0,a.start),f=Math.min(c.count,a.start+a.count);for(let g=h,_=f;g<_;g++){const m=c.getX(g);xr.fromBufferAttribute(d,m),Qo(xr,m,l,r,e,t,this)}}else{const h=Math.max(0,a.start),f=Math.min(d.count,a.start+a.count);for(let g=h,_=f;g<_;g++)xr.fromBufferAttribute(d,g),Qo(xr,g,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function Qo(i,e,t,n,r,s,a){const o=Ys.distanceSqToPoint(i);if(o<t){const l=new I;Ys.closestPointToPoint(i,l),l.applyMatrix4(n);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,object:a})}}class tn{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,r=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let r=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let o=0,l=s-1,c;for(;o<=l;)if(r=Math.floor(o+(l-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,n[r]===a)return r/(s-1);const u=n[r],h=n[r+1]-u,f=(a-u)/h;return(r+f)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const a=this.getPoint(r),o=this.getPoint(s),l=t||(a.isVector2?new ue:new I);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new I,r=[],s=[],a=[],o=new I,l=new et;for(let f=0;f<=e;f++){const g=f/e;r[f]=this.getTangentAt(g,new I)}s[0]=new I,a[0]=new I;let c=Number.MAX_VALUE;const u=Math.abs(r[0].x),d=Math.abs(r[0].y),h=Math.abs(r[0].z);u<=c&&(c=u,n.set(1,0,0)),d<=c&&(c=d,n.set(0,1,0)),h<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],o),a[0].crossVectors(r[0],s[0]);for(let f=1;f<=e;f++){if(s[f]=s[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(r[f-1],r[f]),o.length()>Number.EPSILON){o.normalize();const g=Math.acos(ht(r[f-1].dot(r[f]),-1,1));s[f].applyMatrix4(l.makeRotationAxis(o,g))}a[f].crossVectors(r[f],s[f])}if(t===!0){let f=Math.acos(ht(s[0].dot(s[e]),-1,1));f/=e,r[0].dot(o.crossVectors(s[0],s[e]))>0&&(f=-f);for(let g=1;g<=e;g++)s[g].applyMatrix4(l.makeRotationAxis(r[g],f*g)),a[g].crossVectors(r[g],s[g])}return{tangents:r,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class fc extends tn{constructor(e=0,t=0,n=1,r=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,t=new ue){const n=t,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(a?s=0:s=r),this.aClockwise===!0&&!a&&(s===r?s=-r:s=s-r);const o=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const u=Math.cos(this.aRotation),d=Math.sin(this.aRotation),h=l-this.aX,f=c-this.aY;l=h*u-f*d+this.aX,c=h*d+f*u+this.aY}return n.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class N0 extends fc{constructor(e,t,n,r,s,a){super(e,t,n,n,r,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function ia(){let i=0,e=0,t=0,n=0;function r(s,a,o,l){i=s,e=o,t=-3*s+3*a-2*o-l,n=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,c){r(a,o,c*(o-s),c*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,c,u,d){let h=(a-s)/c-(o-s)/(c+u)+(o-a)/u,f=(o-a)/u-(l-a)/(u+d)+(l-o)/d;h*=u,f*=u,r(a,o,h,f)},calc:function(s){const a=s*s,o=a*s;return i+e*s+t*a+n*o}}}const vr=new I,Ts=new ia,Ds=new ia,As=new ia;class pc extends tn{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new I){const n=t,r=this.points,s=r.length,a=(s-(this.closed?0:1))*e;let o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,u;this.closed||o>0?c=r[(o-1)%s]:(vr.subVectors(r[0],r[1]).add(r[0]),c=vr);const d=r[o%s],h=r[(o+1)%s];if(this.closed||o+2<s?u=r[(o+2)%s]:(vr.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=vr),this.curveType==="centripetal"||this.curveType==="chordal"){const f=this.curveType==="chordal"?.5:.25;let g=Math.pow(c.distanceToSquared(d),f),_=Math.pow(d.distanceToSquared(h),f),m=Math.pow(h.distanceToSquared(u),f);_<1e-4&&(_=1),g<1e-4&&(g=_),m<1e-4&&(m=_),Ts.initNonuniformCatmullRom(c.x,d.x,h.x,u.x,g,_,m),Ds.initNonuniformCatmullRom(c.y,d.y,h.y,u.y,g,_,m),As.initNonuniformCatmullRom(c.z,d.z,h.z,u.z,g,_,m)}else this.curveType==="catmullrom"&&(Ts.initCatmullRom(c.x,d.x,h.x,u.x,this.tension),Ds.initCatmullRom(c.y,d.y,h.y,u.y,this.tension),As.initCatmullRom(c.z,d.z,h.z,u.z,this.tension));return n.set(Ts.calc(l),Ds.calc(l),As.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(new I().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function el(i,e,t,n,r){const s=(n-e)*.5,a=(r-t)*.5,o=i*i,l=i*o;return(2*t-2*n+s+a)*l+(-3*t+3*n-2*s-a)*o+s*i+t}function O0(i,e){const t=1-i;return t*t*e}function B0(i,e){return 2*(1-i)*i*e}function z0(i,e){return i*i*e}function Li(i,e,t,n){return O0(i,e)+B0(i,t)+z0(i,n)}function k0(i,e){const t=1-i;return t*t*t*e}function H0(i,e){const t=1-i;return 3*t*t*i*e}function V0(i,e){return 3*(1-i)*i*i*e}function G0(i,e){return i*i*i*e}function Fi(i,e,t,n,r){return k0(i,e)+H0(i,t)+V0(i,n)+G0(i,r)}class W0 extends tn{constructor(e=new ue,t=new ue,n=new ue,r=new ue){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new ue){const n=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Fi(e,r.x,s.x,a.x,o.x),Fi(e,r.y,s.y,a.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class X0 extends tn{constructor(e=new I,t=new I,n=new I,r=new I){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new I){const n=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Fi(e,r.x,s.x,a.x,o.x),Fi(e,r.y,s.y,a.y,o.y),Fi(e,r.z,s.z,a.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class q0 extends tn{constructor(e=new ue,t=new ue){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ue){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new ue){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Y0 extends tn{constructor(e=new I,t=new I){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new I){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new I){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class $0 extends tn{constructor(e=new ue,t=new ue,n=new ue){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ue){const n=t,r=this.v0,s=this.v1,a=this.v2;return n.set(Li(e,r.x,s.x,a.x),Li(e,r.y,s.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class mc extends tn{constructor(e=new I,t=new I,n=new I){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new I){const n=t,r=this.v0,s=this.v1,a=this.v2;return n.set(Li(e,r.x,s.x,a.x),Li(e,r.y,s.y,a.y),Li(e,r.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class j0 extends tn{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new ue){const n=t,r=this.points,s=(r.length-1)*e,a=Math.floor(s),o=s-a,l=r[a===0?a:a-1],c=r[a],u=r[a>r.length-2?r.length-1:a+1],d=r[a>r.length-3?r.length-1:a+2];return n.set(el(o,l.x,c.x,u.x,d.x),el(o,l.y,c.y,u.y,d.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(new ue().fromArray(r))}return this}}var K0=Object.freeze({__proto__:null,ArcCurve:N0,CatmullRomCurve3:pc,CubicBezierCurve:W0,CubicBezierCurve3:X0,EllipseCurve:fc,LineCurve:q0,LineCurve3:Y0,QuadraticBezierCurve:$0,QuadraticBezierCurve3:mc,SplineCurve:j0});const Mr=new I,Sr=new I,ws=new I,yr=new Ci;class Z0 extends _t{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(di*t),a=e.getIndex(),o=e.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],u=["a","b","c"],d=new Array(3),h={},f=[];for(let g=0;g<l;g+=3){a?(c[0]=a.getX(g),c[1]=a.getX(g+1),c[2]=a.getX(g+2)):(c[0]=g,c[1]=g+1,c[2]=g+2);const{a:_,b:m,c:p}=yr;if(_.fromBufferAttribute(o,c[0]),m.fromBufferAttribute(o,c[1]),p.fromBufferAttribute(o,c[2]),yr.getNormal(ws),d[0]=`${Math.round(_.x*r)},${Math.round(_.y*r)},${Math.round(_.z*r)}`,d[1]=`${Math.round(m.x*r)},${Math.round(m.y*r)},${Math.round(m.z*r)}`,d[2]=`${Math.round(p.x*r)},${Math.round(p.y*r)},${Math.round(p.z*r)}`,!(d[0]===d[1]||d[1]===d[2]||d[2]===d[0]))for(let E=0;E<3;E++){const v=(E+1)%3,b=d[E],R=d[v],T=yr[u[E]],A=yr[u[v]],P=`${b}_${R}`,y=`${R}_${b}`;y in h&&h[y]?(ws.dot(h[y].normal)<=s&&(f.push(T.x,T.y,T.z),f.push(A.x,A.y,A.z)),h[y]=null):P in h||(h[P]={index0:c[E],index1:c[v],normal:ws.clone()})}}for(const g in h)if(h[g]){const{index0:_,index1:m}=h[g];Mr.fromBufferAttribute(o,_),Sr.fromBufferAttribute(o,m),f.push(Mr.x,Mr.y,Mr.z),f.push(Sr.x,Sr.y,Sr.z)}this.setAttribute("position",new nt(f,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class ra extends _t{constructor(e=.5,t=1,n=32,r=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:s,thetaLength:a},n=Math.max(3,n),r=Math.max(1,r);const o=[],l=[],c=[],u=[];let d=e;const h=(t-e)/r,f=new I,g=new ue;for(let _=0;_<=r;_++){for(let m=0;m<=n;m++){const p=s+m/n*a;f.x=d*Math.cos(p),f.y=d*Math.sin(p),l.push(f.x,f.y,f.z),c.push(0,0,1),g.x=(f.x/t+1)/2,g.y=(f.y/t+1)/2,u.push(g.x,g.y)}d+=h}for(let _=0;_<r;_++){const m=_*(n+1);for(let p=0;p<n;p++){const E=p+m,v=E,b=E+n+1,R=E+n+2,T=E+1;o.push(v,b,T),o.push(b,R,T)}}this.setIndex(o),this.setAttribute("position",new nt(l,3)),this.setAttribute("normal",new nt(c,3)),this.setAttribute("uv",new nt(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ra(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Bi extends _t{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(a+o,Math.PI);let c=0;const u=[],d=new I,h=new I,f=[],g=[],_=[],m=[];for(let p=0;p<=n;p++){const E=[],v=p/n;let b=0;p===0&&a===0?b=.5/t:p===n&&l===Math.PI&&(b=-.5/t);for(let R=0;R<=t;R++){const T=R/t;d.x=-e*Math.cos(r+T*s)*Math.sin(a+v*o),d.y=e*Math.cos(a+v*o),d.z=e*Math.sin(r+T*s)*Math.sin(a+v*o),g.push(d.x,d.y,d.z),h.copy(d).normalize(),_.push(h.x,h.y,h.z),m.push(T+b,1-v),E.push(c++)}u.push(E)}for(let p=0;p<n;p++)for(let E=0;E<t;E++){const v=u[p][E+1],b=u[p][E],R=u[p+1][E],T=u[p+1][E+1];(p!==0||a>0)&&f.push(v,b,T),(p!==n-1||l<Math.PI)&&f.push(b,R,T)}this.setIndex(f),this.setAttribute("position",new nt(g,3)),this.setAttribute("normal",new nt(_,3)),this.setAttribute("uv",new nt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Bi(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class sa extends _t{constructor(e=new mc(new I(-1,-1,0),new I(-1,1,0),new I(1,1,0)),t=64,n=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:s};const a=e.computeFrenetFrames(t,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new I,l=new I,c=new ue;let u=new I;const d=[],h=[],f=[],g=[];_(),this.setIndex(g),this.setAttribute("position",new nt(d,3)),this.setAttribute("normal",new nt(h,3)),this.setAttribute("uv",new nt(f,2));function _(){for(let v=0;v<t;v++)m(v);m(s===!1?t:0),E(),p()}function m(v){u=e.getPointAt(v/t,u);const b=a.normals[v],R=a.binormals[v];for(let T=0;T<=r;T++){const A=T/r*Math.PI*2,P=Math.sin(A),y=-Math.cos(A);l.x=y*b.x+P*R.x,l.y=y*b.y+P*R.y,l.z=y*b.z+P*R.z,l.normalize(),h.push(l.x,l.y,l.z),o.x=u.x+n*l.x,o.y=u.y+n*l.y,o.z=u.z+n*l.z,d.push(o.x,o.y,o.z)}}function p(){for(let v=1;v<=t;v++)for(let b=1;b<=r;b++){const R=(r+1)*(v-1)+(b-1),T=(r+1)*v+(b-1),A=(r+1)*v+b,P=(r+1)*(v-1)+b;g.push(R,T,P),g.push(T,A,P)}}function E(){for(let v=0;v<=t;v++)for(let b=0;b<=r;b++)c.x=v/t,c.y=b/r,f.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new sa(new K0[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class gc{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=tl(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=tl();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function tl(){return(typeof performance>"u"?Date:performance).now()}class nl{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(ht(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Js}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Js);const il={type:"change"},Cs={type:"start"},rl={type:"end"},Er=new Br,sl=new hn,J0=Math.cos(70*Gl.DEG2RAD);class _c extends Nn{constructor(e,t){super(),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new I,this.cursor=new I,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Hn.ROTATE,MIDDLE:Hn.DOLLY,RIGHT:Hn.PAN},this.touches={ONE:Vn.ROTATE,TWO:Vn.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return o.phi},this.getAzimuthalAngle=function(){return o.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(x){x.addEventListener("keydown",fe),this._domElementKeyEvents=x},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",fe),this._domElementKeyEvents=null},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(il),n.update(),s=r.NONE},this.update=(function(){const x=new I,V=new Fn().setFromUnitVectors(e.up,new I(0,1,0)),K=V.clone().invert(),se=new I,pe=new Fn,Ve=new I,ze=2*Math.PI;return function(lt=null){const $e=n.object.position;x.copy($e).sub(n.target),x.applyQuaternion(V),o.setFromVector3(x),n.autoRotate&&s===r.NONE&&L(M(lt)),n.enableDamping?(o.theta+=l.theta*n.dampingFactor,o.phi+=l.phi*n.dampingFactor):(o.theta+=l.theta,o.phi+=l.phi);let it=n.minAzimuthAngle,rt=n.maxAzimuthAngle;isFinite(it)&&isFinite(rt)&&(it<-Math.PI?it+=ze:it>Math.PI&&(it-=ze),rt<-Math.PI?rt+=ze:rt>Math.PI&&(rt-=ze),it<=rt?o.theta=Math.max(it,Math.min(rt,o.theta)):o.theta=o.theta>(it+rt)/2?Math.max(it,o.theta):Math.min(rt,o.theta)),o.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,o.phi)),o.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(u,n.dampingFactor):n.target.add(u),n.target.sub(n.cursor),n.target.clampLength(n.minTargetRadius,n.maxTargetRadius),n.target.add(n.cursor);let Dt=!1;if(n.zoomToCursor&&T||n.object.isOrthographicCamera)o.radius=$(o.radius);else{const Pt=o.radius;o.radius=$(o.radius*c),Dt=Pt!=o.radius}if(x.setFromSpherical(o),x.applyQuaternion(K),$e.copy(n.target).add(x),n.object.lookAt(n.target),n.enableDamping===!0?(l.theta*=1-n.dampingFactor,l.phi*=1-n.dampingFactor,u.multiplyScalar(1-n.dampingFactor)):(l.set(0,0,0),u.set(0,0,0)),n.zoomToCursor&&T){let Pt=null;if(n.object.isPerspectiveCamera){const nn=x.length();Pt=$(nn*c);const On=nn-Pt;n.object.position.addScaledVector(b,On),n.object.updateMatrixWorld(),Dt=!!On}else if(n.object.isOrthographicCamera){const nn=new I(R.x,R.y,0);nn.unproject(n.object);const On=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/c)),n.object.updateProjectionMatrix(),Dt=On!==n.object.zoom;const vn=new I(R.x,R.y,0);vn.unproject(n.object),n.object.position.sub(vn).add(nn),n.object.updateMatrixWorld(),Pt=x.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Pt!==null&&(this.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Pt).add(n.object.position):(Er.origin.copy(n.object.position),Er.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Er.direction))<J0?e.lookAt(n.target):(sl.setFromNormalAndCoplanarPoint(n.object.up,n.target),Er.intersectPlane(sl,n.target))))}else if(n.object.isOrthographicCamera){const Pt=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/c)),Pt!==n.object.zoom&&(n.object.updateProjectionMatrix(),Dt=!0)}return c=1,T=!1,Dt||se.distanceToSquared(n.object.position)>a||8*(1-pe.dot(n.object.quaternion))>a||Ve.distanceToSquared(n.target)>a?(n.dispatchEvent(il),se.copy(n.object.position),pe.copy(n.object.quaternion),Ve.copy(n.target),!0):!1}})(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",_e),n.domElement.removeEventListener("pointerdown",q),n.domElement.removeEventListener("pointercancel",te),n.domElement.removeEventListener("wheel",re),n.domElement.removeEventListener("pointermove",Z),n.domElement.removeEventListener("pointerup",te),n.domElement.getRootNode().removeEventListener("keydown",Ae,{capture:!0}),n._domElementKeyEvents!==null&&(n._domElementKeyEvents.removeEventListener("keydown",fe),n._domElementKeyEvents=null)};const n=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=r.NONE;const a=1e-6,o=new nl,l=new nl;let c=1;const u=new I,d=new ue,h=new ue,f=new ue,g=new ue,_=new ue,m=new ue,p=new ue,E=new ue,v=new ue,b=new I,R=new ue;let T=!1;const A=[],P={};let y=!1;function M(x){return x!==null?2*Math.PI/60*n.autoRotateSpeed*x:2*Math.PI/60/60*n.autoRotateSpeed}function F(x){const V=Math.abs(x*.01);return Math.pow(.95,n.zoomSpeed*V)}function L(x){l.theta-=x}function C(x){l.phi-=x}const U=(function(){const x=new I;return function(K,se){x.setFromMatrixColumn(se,0),x.multiplyScalar(-K),u.add(x)}})(),H=(function(){const x=new I;return function(K,se){n.screenSpacePanning===!0?x.setFromMatrixColumn(se,1):(x.setFromMatrixColumn(se,0),x.crossVectors(n.object.up,x)),x.multiplyScalar(K),u.add(x)}})(),Y=(function(){const x=new I;return function(K,se){const pe=n.domElement;if(n.object.isPerspectiveCamera){const Ve=n.object.position;x.copy(Ve).sub(n.target);let ze=x.length();ze*=Math.tan(n.object.fov/2*Math.PI/180),U(2*K*ze/pe.clientHeight,n.object.matrix),H(2*se*ze/pe.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(U(K*(n.object.right-n.object.left)/n.object.zoom/pe.clientWidth,n.object.matrix),H(se*(n.object.top-n.object.bottom)/n.object.zoom/pe.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function J(x){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?c/=x:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function z(x){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?c*=x:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function j(x,V){if(!n.zoomToCursor)return;T=!0;const K=n.domElement.getBoundingClientRect(),se=x-K.left,pe=V-K.top,Ve=K.width,ze=K.height;R.x=se/Ve*2-1,R.y=-(pe/ze)*2+1,b.set(R.x,R.y,1).unproject(n.object).sub(n.object.position).normalize()}function $(x){return Math.max(n.minDistance,Math.min(n.maxDistance,x))}function N(x){d.set(x.clientX,x.clientY)}function ee(x){j(x.clientX,x.clientX),p.set(x.clientX,x.clientY)}function me(x){g.set(x.clientX,x.clientY)}function O(x){h.set(x.clientX,x.clientY),f.subVectors(h,d).multiplyScalar(n.rotateSpeed);const V=n.domElement;L(2*Math.PI*f.x/V.clientHeight),C(2*Math.PI*f.y/V.clientHeight),d.copy(h),n.update()}function Q(x){E.set(x.clientX,x.clientY),v.subVectors(E,p),v.y>0?J(F(v.y)):v.y<0&&z(F(v.y)),p.copy(E),n.update()}function ce(x){_.set(x.clientX,x.clientY),m.subVectors(_,g).multiplyScalar(n.panSpeed),Y(m.x,m.y),g.copy(_),n.update()}function ne(x){j(x.clientX,x.clientY),x.deltaY<0?z(F(x.deltaY)):x.deltaY>0&&J(F(x.deltaY)),n.update()}function ve(x){let V=!1;switch(x.code){case n.keys.UP:x.ctrlKey||x.metaKey||x.shiftKey?C(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Y(0,n.keyPanSpeed),V=!0;break;case n.keys.BOTTOM:x.ctrlKey||x.metaKey||x.shiftKey?C(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Y(0,-n.keyPanSpeed),V=!0;break;case n.keys.LEFT:x.ctrlKey||x.metaKey||x.shiftKey?L(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Y(n.keyPanSpeed,0),V=!0;break;case n.keys.RIGHT:x.ctrlKey||x.metaKey||x.shiftKey?L(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Y(-n.keyPanSpeed,0),V=!0;break}V&&(x.preventDefault(),n.update())}function Te(x){if(A.length===1)d.set(x.pageX,x.pageY);else{const V=Ye(x),K=.5*(x.pageX+V.x),se=.5*(x.pageY+V.y);d.set(K,se)}}function Ce(x){if(A.length===1)g.set(x.pageX,x.pageY);else{const V=Ye(x),K=.5*(x.pageX+V.x),se=.5*(x.pageY+V.y);g.set(K,se)}}function k(x){const V=Ye(x),K=x.pageX-V.x,se=x.pageY-V.y,pe=Math.sqrt(K*K+se*se);p.set(0,pe)}function Fe(x){n.enableZoom&&k(x),n.enablePan&&Ce(x)}function xe(x){n.enableZoom&&k(x),n.enableRotate&&Te(x)}function Ge(x){if(A.length==1)h.set(x.pageX,x.pageY);else{const K=Ye(x),se=.5*(x.pageX+K.x),pe=.5*(x.pageY+K.y);h.set(se,pe)}f.subVectors(h,d).multiplyScalar(n.rotateSpeed);const V=n.domElement;L(2*Math.PI*f.x/V.clientHeight),C(2*Math.PI*f.y/V.clientHeight),d.copy(h)}function Ee(x){if(A.length===1)_.set(x.pageX,x.pageY);else{const V=Ye(x),K=.5*(x.pageX+V.x),se=.5*(x.pageY+V.y);_.set(K,se)}m.subVectors(_,g).multiplyScalar(n.panSpeed),Y(m.x,m.y),g.copy(_)}function We(x){const V=Ye(x),K=x.pageX-V.x,se=x.pageY-V.y,pe=Math.sqrt(K*K+se*se);E.set(0,pe),v.set(0,Math.pow(E.y/p.y,n.zoomSpeed)),J(v.y),p.copy(E);const Ve=(x.pageX+V.x)*.5,ze=(x.pageY+V.y)*.5;j(Ve,ze)}function w(x){n.enableZoom&&We(x),n.enablePan&&Ee(x)}function S(x){n.enableZoom&&We(x),n.enableRotate&&Ge(x)}function q(x){n.enabled!==!1&&(A.length===0&&(n.domElement.setPointerCapture(x.pointerId),n.domElement.addEventListener("pointermove",Z),n.domElement.addEventListener("pointerup",te)),!qe(x)&&(ke(x),x.pointerType==="touch"?Re(x):ie(x)))}function Z(x){n.enabled!==!1&&(x.pointerType==="touch"?ge(x):De(x))}function te(x){switch(He(x),A.length){case 0:n.domElement.releasePointerCapture(x.pointerId),n.domElement.removeEventListener("pointermove",Z),n.domElement.removeEventListener("pointerup",te),n.dispatchEvent(rl),s=r.NONE;break;case 1:const V=A[0],K=P[V];Re({pointerId:V,pageX:K.x,pageY:K.y});break}}function ie(x){let V;switch(x.button){case 0:V=n.mouseButtons.LEFT;break;case 1:V=n.mouseButtons.MIDDLE;break;case 2:V=n.mouseButtons.RIGHT;break;default:V=-1}switch(V){case Hn.DOLLY:if(n.enableZoom===!1)return;ee(x),s=r.DOLLY;break;case Hn.ROTATE:if(x.ctrlKey||x.metaKey||x.shiftKey){if(n.enablePan===!1)return;me(x),s=r.PAN}else{if(n.enableRotate===!1)return;N(x),s=r.ROTATE}break;case Hn.PAN:if(x.ctrlKey||x.metaKey||x.shiftKey){if(n.enableRotate===!1)return;N(x),s=r.ROTATE}else{if(n.enablePan===!1)return;me(x),s=r.PAN}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(Cs)}function De(x){switch(s){case r.ROTATE:if(n.enableRotate===!1)return;O(x);break;case r.DOLLY:if(n.enableZoom===!1)return;Q(x);break;case r.PAN:if(n.enablePan===!1)return;ce(x);break}}function re(x){n.enabled===!1||n.enableZoom===!1||s!==r.NONE||(x.preventDefault(),n.dispatchEvent(Cs),ne(ye(x)),n.dispatchEvent(rl))}function ye(x){const V=x.deltaMode,K={clientX:x.clientX,clientY:x.clientY,deltaY:x.deltaY};switch(V){case 1:K.deltaY*=16;break;case 2:K.deltaY*=100;break}return x.ctrlKey&&!y&&(K.deltaY*=10),K}function Ae(x){x.key==="Control"&&(y=!0,n.domElement.getRootNode().addEventListener("keyup",ae,{passive:!0,capture:!0}))}function ae(x){x.key==="Control"&&(y=!1,n.domElement.getRootNode().removeEventListener("keyup",ae,{passive:!0,capture:!0}))}function fe(x){n.enabled===!1||n.enablePan===!1||ve(x)}function Re(x){switch(Xe(x),A.length){case 1:switch(n.touches.ONE){case Vn.ROTATE:if(n.enableRotate===!1)return;Te(x),s=r.TOUCH_ROTATE;break;case Vn.PAN:if(n.enablePan===!1)return;Ce(x),s=r.TOUCH_PAN;break;default:s=r.NONE}break;case 2:switch(n.touches.TWO){case Vn.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Fe(x),s=r.TOUCH_DOLLY_PAN;break;case Vn.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;xe(x),s=r.TOUCH_DOLLY_ROTATE;break;default:s=r.NONE}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(Cs)}function ge(x){switch(Xe(x),s){case r.TOUCH_ROTATE:if(n.enableRotate===!1)return;Ge(x),n.update();break;case r.TOUCH_PAN:if(n.enablePan===!1)return;Ee(x),n.update();break;case r.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;w(x),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;S(x),n.update();break;default:s=r.NONE}}function _e(x){n.enabled!==!1&&x.preventDefault()}function ke(x){A.push(x.pointerId)}function He(x){delete P[x.pointerId];for(let V=0;V<A.length;V++)if(A[V]==x.pointerId){A.splice(V,1);return}}function qe(x){for(let V=0;V<A.length;V++)if(A[V]==x.pointerId)return!0;return!1}function Xe(x){let V=P[x.pointerId];V===void 0&&(V=new ue,P[x.pointerId]=V),V.set(x.pageX,x.pageY)}function Ye(x){const V=x.pointerId===A[0]?A[1]:A[0];return P[V]}n.domElement.addEventListener("contextmenu",_e),n.domElement.addEventListener("pointerdown",q),n.domElement.addEventListener("pointercancel",te),n.domElement.addEventListener("wheel",re,{passive:!1}),n.domElement.getRootNode().addEventListener("keydown",Ae,{passive:!0,capture:!0}),this.update()}}const xc={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
|
|
3801
3801
|
|
|
3802
3802
|
varying vec2 vUv;
|
|
3803
3803
|
|
|
@@ -3820,7 +3820,7 @@ void main() {
|
|
|
3820
3820
|
gl_FragColor = opacity * texel;
|
|
3821
3821
|
|
|
3822
3822
|
|
|
3823
|
-
}`};class
|
|
3823
|
+
}`};class Wi{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const Q0=new ic(-1,1,1,-1,0,1);class eg extends _t{constructor(){super(),this.setAttribute("position",new nt([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new nt([0,2,0,0,2,0],2))}}const tg=new eg;class vc{constructor(e){this._mesh=new bt(tg,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,Q0)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class Mc extends Wi{constructor(e,t){super(),this.textureID=t!==void 0?t:"tDiffuse",e instanceof ft?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=Fr.clone(e.uniforms),this.material=new ft({name:e.name!==void 0?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new vc(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class al extends Wi{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const r=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0);let a,o;this.inverse?(a=0,o=1):(a=1,o=0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),s.buffers.stencil.setFunc(r.ALWAYS,a,4294967295),s.buffers.stencil.setClear(o),s.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.color.setMask(!0),s.buffers.depth.setMask(!0),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(r.EQUAL,1,4294967295),s.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),s.buffers.stencil.setLocked(!0)}}class ng extends Wi{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class Sc{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),t===void 0){const n=e.getSize(new ue);this._width=n.width,this._height=n.height,t=new Ht(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:gn}),t.texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new Mc(xc),this.copyPass.material.blending=en,this.clock=new gc}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){e===void 0&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let n=!1;for(let r=0,s=this.passes.length;r<s;r++){const a=this.passes[r];if(a.enabled!==!1){if(a.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(r),a.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),a.needsSwap){if(n){const o=this.renderer.getContext(),l=this.renderer.state.buffers.stencil;l.setFunc(o.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),l.setFunc(o.EQUAL,1,4294967295)}this.swapBuffers()}al!==void 0&&(a instanceof al?n=!0:a instanceof ng&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){const t=this.renderer.getSize(new ue);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(let s=0;s<this.passes.length;s++)this.passes[s].setSize(n,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}class yc extends Wi{constructor(e,t,n=null,r=null,s=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=s,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new be}render(e,t,n){const r=e.autoClear;e.autoClear=!1;let s,a;this.overrideMaterial!==null&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor!==null&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor)),this.clearAlpha!==null&&(s=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),this.clearDepth==!0&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear===!0&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor!==null&&e.setClearColor(this._oldClearColor),this.clearAlpha!==null&&e.setClearAlpha(s),this.overrideMaterial!==null&&(this.scene.overrideMaterial=a),e.autoClear=r}}const ig={uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new be(0)},defaultOpacity:{value:0}},vertexShader:`
|
|
3824
3824
|
|
|
3825
3825
|
varying vec2 vUv;
|
|
3826
3826
|
|
|
@@ -3854,7 +3854,7 @@ void main() {
|
|
|
3854
3854
|
|
|
3855
3855
|
gl_FragColor = mix( outputColor, texel, alpha );
|
|
3856
3856
|
|
|
3857
|
-
}`};class
|
|
3857
|
+
}`};class Un extends Wi{constructor(e,t,n,r){super(),this.strength=t!==void 0?t:1,this.radius=n,this.threshold=r,this.resolution=e!==void 0?new ue(e.x,e.y):new ue(256,256),this.clearColor=new be(0,0,0),this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let s=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);this.renderTargetBright=new Ht(s,a,{type:gn}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let d=0;d<this.nMips;d++){const h=new Ht(s,a,{type:gn});h.texture.name="UnrealBloomPass.h"+d,h.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(h);const f=new Ht(s,a,{type:gn});f.texture.name="UnrealBloomPass.v"+d,f.texture.generateMipmaps=!1,this.renderTargetsVertical.push(f),s=Math.round(s/2),a=Math.round(a/2)}const o=ig;this.highPassUniforms=Fr.clone(o.uniforms),this.highPassUniforms.luminosityThreshold.value=r,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new ft({uniforms:this.highPassUniforms,vertexShader:o.vertexShader,fragmentShader:o.fragmentShader}),this.separableBlurMaterials=[];const l=[3,5,7,9,11];s=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);for(let d=0;d<this.nMips;d++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(l[d])),this.separableBlurMaterials[d].uniforms.invSize.value=new ue(1/s,1/a),s=Math.round(s/2),a=Math.round(a/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=t,this.compositeMaterial.uniforms.bloomRadius.value=.1;const c=[1,.8,.6,.4,.2];this.compositeMaterial.uniforms.bloomFactors.value=c,this.bloomTintColors=[new I(1,1,1),new I(1,1,1),new I(1,1,1),new I(1,1,1),new I(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors;const u=xc;this.copyUniforms=Fr.clone(u.uniforms),this.blendMaterial=new ft({uniforms:this.copyUniforms,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,blending:ui,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new be,this.oldClearAlpha=1,this.basic=new Vi,this.fsQuad=new vc(null)}dispose(){for(let e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(let e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose();for(let e=0;e<this.separableBlurMaterials.length;e++)this.separableBlurMaterials[e].dispose();this.compositeMaterial.dispose(),this.blendMaterial.dispose(),this.basic.dispose(),this.fsQuad.dispose()}setSize(e,t){let n=Math.round(e/2),r=Math.round(t/2);this.renderTargetBright.setSize(n,r);for(let s=0;s<this.nMips;s++)this.renderTargetsHorizontal[s].setSize(n,r),this.renderTargetsVertical[s].setSize(n,r),this.separableBlurMaterials[s].uniforms.invSize.value=new ue(1/n,1/r),n=Math.round(n/2),r=Math.round(r/2)}render(e,t,n,r,s){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const a=e.autoClear;e.autoClear=!1,e.setClearColor(this.clearColor,0),s&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=n.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=n.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e);let o=this.renderTargetBright;for(let l=0;l<this.nMips;l++)this.fsQuad.material=this.separableBlurMaterials[l],this.separableBlurMaterials[l].uniforms.colorTexture.value=o.texture,this.separableBlurMaterials[l].uniforms.direction.value=Un.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[l]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[l].uniforms.colorTexture.value=this.renderTargetsHorizontal[l].texture,this.separableBlurMaterials[l].uniforms.direction.value=Un.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[l]),e.clear(),this.fsQuad.render(e),o=this.renderTargetsVertical[l];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.blendMaterial,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,s&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(n),this.fsQuad.render(e)),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=a}getSeperableBlurMaterial(e){const t=[];for(let n=0;n<e;n++)t.push(.39894*Math.exp(-.5*n*n/(e*e))/e);return new ft({defines:{KERNEL_RADIUS:e},uniforms:{colorTexture:{value:null},invSize:{value:new ue(.5,.5)},direction:{value:new ue(.5,.5)},gaussianCoefficients:{value:t}},vertexShader:`varying vec2 vUv;
|
|
3858
3858
|
void main() {
|
|
3859
3859
|
vUv = uv;
|
|
3860
3860
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
@@ -3904,7 +3904,7 @@ void main() {
|
|
|
3904
3904
|
lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +
|
|
3905
3905
|
lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +
|
|
3906
3906
|
lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );
|
|
3907
|
-
}`})}}
|
|
3907
|
+
}`})}}Un.BlurDirectionX=new ue(1,0);Un.BlurDirectionY=new ue(0,1);const rg=({onParamsChange:i,diskColor:e,glowColor:t,autoRotate:n})=>{const r=de.useRef(null),[s,a]=de.useState(n!==void 0?n:!1),[o,l]=de.useState(e||"#ff7733"),[c,u]=de.useState(t||"#ff6600"),d=de.useRef(null);return de.useEffect(()=>{e!==void 0&&l(e),t!==void 0&&u(t),n!==void 0&&a(n)},[e,t,n]),de.useEffect(()=>{if(!r.current)return;const h=r.current.querySelector("canvas");h&&r.current.removeChild(h);const f=1.3,g=f+.2,_=8,m=Math.PI/3,p=new hc;p.fog=new Hr(131332,.025),d.current=p;const E=new Rt(60,r.current.clientWidth/r.current.clientHeight,.1,4e3);E.position.set(-6.5,5,6.5);const v=new uc({antialias:!0,powerPreference:"high-performance"});v.setSize(r.current.clientWidth,r.current.clientHeight),v.setPixelRatio(Math.min(window.devicePixelRatio,1.5)),v.outputColorSpace=It,v.toneMapping=Qs,v.toneMappingExposure=1.2,r.current.appendChild(v.domElement);const b=new Sc(v);b.addPass(new yc(p,E));const R=new Un(new ue(r.current.clientWidth,r.current.clientHeight),.8,.7,.8);b.addPass(R);const T={uniforms:{tDiffuse:{value:null},blackHoleScreenPos:{value:new ue(.5,.5)},lensingStrength:{value:.12},lensingRadius:{value:.3},aspectRatio:{value:r.current.clientWidth/r.current.clientHeight},chromaticAberration:{value:.005}},vertexShader:`
|
|
3908
3908
|
varying vec2 vUv;
|
|
3909
3909
|
void main() {
|
|
3910
3910
|
vUv = uv;
|
|
@@ -3943,7 +3943,7 @@ void main() {
|
|
|
3943
3943
|
|
|
3944
3944
|
gl_FragColor = vec4(r, g, b, 1.0);
|
|
3945
3945
|
}
|
|
3946
|
-
`},
|
|
3946
|
+
`},A=new Mc(T);b.addPass(A);const P=new _c(E,v.domElement);P.enableDamping=!0,P.dampingFactor=.035,P.rotateSpeed=.4,P.autoRotate=s,P.autoRotateSpeed=.1,P.target.set(0,0,0),P.minDistance=2.5,P.maxDistance=100,P.enablePan=!1,P.update();const y=new _t,M=15e4,F=new Float32Array(M*3),L=new Float32Array(M*3),C=new Float32Array(M),U=new Float32Array(M),H=2e3,Y=[new be(8956671),new be(16755455),new be(11206655),new be(16768426),new be(16772812),new be(16777215),new be(16746632),new be(8978312),new be(16777096),new be(8978431)];for(let xe=0;xe<M;xe++){const Ge=xe*3,Ee=Math.acos(-1+2*xe/M),We=Math.sqrt(M*Math.PI)*Ee,w=Math.cbrt(Math.random())*H+100;F[Ge]=w*Math.sin(Ee)*Math.cos(We),F[Ge+1]=w*Math.sin(Ee)*Math.sin(We),F[Ge+2]=w*Math.cos(Ee);const S=Y[Math.floor(Math.random()*Y.length)].clone();S.multiplyScalar(Math.random()*.7+.3),L[Ge]=S.r,L[Ge+1]=S.g,L[Ge+2]=S.b,C[xe]=Gl.randFloat(.6,3),U[xe]=Math.random()*Math.PI*2}y.setAttribute("position",new Et(F,3)),y.setAttribute("color",new Et(L,3)),y.setAttribute("size",new Et(C,1)),y.setAttribute("twinkle",new Et(U,1));const J=new ft({uniforms:{uTime:{value:0},uPixelRatio:{value:v.getPixelRatio()}},vertexShader:`
|
|
3947
3947
|
uniform float uTime;
|
|
3948
3948
|
uniform float uPixelRatio;
|
|
3949
3949
|
attribute float size;
|
|
@@ -3972,7 +3972,7 @@ void main() {
|
|
|
3972
3972
|
|
|
3973
3973
|
gl_FragColor = vec4(vColor, alpha);
|
|
3974
3974
|
}
|
|
3975
|
-
`,transparent:!0,vertexColors:!0,blending:
|
|
3975
|
+
`,transparent:!0,vertexColors:!0,blending:ui,depthWrite:!1}),z=new U0(y,J);p.add(z);const j=new Bi(f*1.05,128,64),$=new ft({uniforms:{uTime:{value:0},uCameraPosition:{value:E.position},uGlowColor:{value:new be(c)}},vertexShader:`
|
|
3976
3976
|
varying vec3 vNormal;
|
|
3977
3977
|
varying vec3 vPosition;
|
|
3978
3978
|
void main() {
|
|
@@ -3996,7 +3996,7 @@ void main() {
|
|
|
3996
3996
|
|
|
3997
3997
|
gl_FragColor = vec4(uGlowColor * fresnel * pulse, fresnel * 0.4);
|
|
3998
3998
|
}
|
|
3999
|
-
`,transparent:!0,blending:
|
|
3999
|
+
`,transparent:!0,blending:ui,side:St}),N=new bt(j,$);p.add(N);const ee=new Bi(f,128,64),me=new Vi({color:0}),O=new bt(ee,me);O.renderOrder=0,p.add(O);const Q=new ra(g,_,256,128),ce=new be(o),ne=new ft({uniforms:{uTime:{value:0},uColorHot:{value:new be(16777215)},uColorMid1:{value:ce.clone()},uColorMid2:{value:ce.clone().multiplyScalar(.8)},uColorMid3:{value:ce.clone().multiplyScalar(.6)},uColorOuter:{value:ce.clone().multiplyScalar(.4)},uNoiseScale:{value:2.5},uFlowSpeed:{value:.22},uDensity:{value:1.3}},vertexShader:`
|
|
4000
4000
|
varying vec2 vUv;
|
|
4001
4001
|
varying float vRadius;
|
|
4002
4002
|
varying float vAngle;
|
|
@@ -4070,7 +4070,7 @@ void main() {
|
|
|
4070
4070
|
}
|
|
4071
4071
|
|
|
4072
4072
|
void main() {
|
|
4073
|
-
float normalizedRadius = smoothstep(${
|
|
4073
|
+
float normalizedRadius = smoothstep(${g.toFixed(2)}, ${_.toFixed(2)}, vRadius);
|
|
4074
4074
|
|
|
4075
4075
|
float spiral = vAngle * 3.0 - (1.0 / (normalizedRadius + 0.1)) * 2.0;
|
|
4076
4076
|
vec2 noiseUv = vec2(vUv.x + uTime * uFlowSpeed * (2.0 / (vRadius * 0.3 + 1.0)) + sin(spiral) * 0.1, vUv.y * 0.8 + cos(spiral) * 0.1);
|
|
@@ -4101,7 +4101,7 @@ void main() {
|
|
|
4101
4101
|
|
|
4102
4102
|
gl_FragColor = vec4(color * brightness, alpha);
|
|
4103
4103
|
}
|
|
4104
|
-
`,transparent:!0,side:Wt,depthWrite:!1,blending:
|
|
4104
|
+
`,transparent:!0,side:Wt,depthWrite:!1,blending:ui}),ve=new bt(Q,ne);ve.rotation.x=m,ve.renderOrder=1,p.add(ve);const Te=new gc,Ce=new I,k=()=>{requestAnimationFrame(k);const xe=Te.getElapsedTime(),Ge=Te.getDelta();ne.uniforms.uTime.value=xe,J.uniforms.uTime.value=xe,$.uniforms.uTime.value=xe,$.uniforms.uCameraPosition.value.copy(E.position),$.uniforms.uGlowColor.value.set(c),Ce.copy(O.position).project(E),A.uniforms.blackHoleScreenPos.value.set((Ce.x+1)/2,(Ce.y+1)/2),P.update(),z.rotation.y+=Ge*.003,z.rotation.x+=Ge*.001,ve.rotation.z+=Ge*.005,b.render(Ge)};k();const Fe=()=>{r.current&&(E.aspect=r.current.clientWidth/r.current.clientHeight,E.updateProjectionMatrix(),v.setSize(r.current.clientWidth,r.current.clientHeight),b.setSize(r.current.clientWidth,r.current.clientHeight),R.resolution.set(r.current.clientWidth,r.current.clientHeight),A.uniforms.aspectRatio.value=r.current.clientWidth/r.current.clientHeight)};return window.addEventListener("resize",Fe),()=>{window.removeEventListener("resize",Fe),v.dispose(),y.dispose(),J.dispose(),j.dispose(),$.dispose(),ee.dispose(),me.dispose(),Q.dispose(),ne.dispose(),r.current&&v.domElement&&r.current.removeChild(v.domElement)}},[s,o,c]),de.useEffect(()=>{i&&i({diskColor:o,glowColor:c,autoRotate:s})},[o,c,s,i]),oe.jsx("div",{className:"relative w-full h-full",children:oe.jsx("div",{ref:r,className:"w-full h-full"})})},sg=({onClick:i,size:e=40,className:t="",children:n,icon:r,iconPath:s})=>{const a=e*.08,o=e*.25,c=(e-o*2)*.6*2,u=()=>r?de.isValidElement(r)?oe.jsx("div",{style:{width:`${c}px`,height:`${c}px`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:de.cloneElement(r,{className:`text-zinc-50 ${r.props?.className||""}`,style:{color:"rgb(250 250 250 / 1.0)",width:"100%",height:"100%",display:"block",margin:0,padding:0,fontSize:`${c}px`,...r.props?.style}})}):r:s?oe.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:c,height:c,fill:"rgb(250 250 250 / 1.0)",viewBox:"0 0 24 24",children:oe.jsx("path",{d:s})}):n||oe.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:c,height:c,fill:"rgb(250 250 250 / 1.0)",viewBox:"0 0 32 32",children:oe.jsx("path",{d:"m26.71 10.29-10-10a1 1 0 0 0-1.41 0l-10 10 1.41 1.41L15 3.41V32h2V3.41l8.29 8.29z"})});return oe.jsxs(Mt.motion.button,{onClick:i,className:`relative cursor-pointer rounded-full ${t}`,style:{width:`${e}px`,height:`${e}px`,padding:`${o}px`,background:"linear-gradient(0deg, rgb(10 10 10 / 1.0) 10%, rgb(40 40 50 / 1.0)) padding-box",border:`${a}px solid transparent`,zIndex:0,boxSizing:"border-box"},whileHover:{scale:1.05},whileTap:{scale:.95},children:[oe.jsx(Mt.motion.div,{className:"absolute rounded-full",style:{top:`-${a}px`,left:`-${a}px`,width:`calc(100% + ${a*2}px)`,height:`calc(100% + ${a*2}px)`,zIndex:-1,border:"4px solid transparent",background:`
|
|
4105
4105
|
conic-gradient(from 0deg,
|
|
4106
4106
|
rgb(200 200 220 / 1.0),
|
|
4107
4107
|
rgb(160 160 180 / 1.0),
|
|
@@ -4120,7 +4120,7 @@ void main() {
|
|
|
4120
4120
|
rgb(10 10 10 / 1.0),
|
|
4121
4121
|
rgb(40 40 60 / 1.0),
|
|
4122
4122
|
rgb(200 200 220 / 1.0)) border-box
|
|
4123
|
-
`},animate:{rotate:[0,-360]},transition:{duration:8,repeat:1/0,ease:"linear"}}),
|
|
4123
|
+
`},animate:{rotate:[0,-360]},transition:{duration:8,repeat:1/0,ease:"linear"}}),oe.jsx(Mt.motion.div,{className:"absolute inset-0 rounded-full",style:{background:`conic-gradient(from 0deg,
|
|
4124
4124
|
rgb(200 200 220 / 0.5),
|
|
4125
4125
|
rgb(200 200 220 / 0.0),
|
|
4126
4126
|
rgb(10 10 10 / 0.0),
|
|
@@ -4128,7 +4128,7 @@ void main() {
|
|
|
4128
4128
|
rgb(80 80 100 / 0.5),
|
|
4129
4129
|
rgb(80 80 100 / 0.0),
|
|
4130
4130
|
rgb(80 80 100 / 1.0),
|
|
4131
|
-
rgb(200 200 220 / 0.5)) border-box`},animate:{rotate:[0,360]},transition:{duration:12,repeat:1/0,ease:"linear"}}),
|
|
4131
|
+
rgb(200 200 220 / 0.5)) border-box`},animate:{rotate:[0,360]},transition:{duration:12,repeat:1/0,ease:"linear"}}),oe.jsx("div",{className:"absolute inset-0 rounded-full flex items-center justify-center overflow-hidden",style:{background:"linear-gradient(0deg, rgb(10 10 10 / 1.0) 10%, rgb(40 40 50 / 1.0))"},children:u()})]})};class ag{constructor(e,t,n,r,s,a,o,l){this.width=e.width,this.height=e.height,this.ctx=t,this.x=n,this.y=r,this.color=s,this.speed=this.getRandomValue(.1,.9)*a,this.size=0,this.sizeStep=Math.random()*.4,this.minSize=.5,this.maxSizeInteger=l,this.maxSize=this.getRandomValue(this.minSize,this.maxSizeInteger),this.delay=o,this.counter=0,this.counterStep=Math.random()*4+(this.width+this.height)*.01,this.isIdle=!1,this.isReverse=!1,this.isShimmer=!1}getRandomValue(e,t){return Math.random()*(t-e)+e}draw(){const e=this.maxSizeInteger*.5-this.size*.5;this.ctx.fillStyle=this.color,this.ctx.fillRect(this.x+e,this.y+e,this.size,this.size)}appear(){if(this.isIdle=!1,this.counter<=this.delay){this.counter+=this.counterStep;return}this.size>=this.maxSize&&(this.isShimmer=!0),this.isShimmer?this.shimmer():this.size+=this.sizeStep,this.draw()}disappear(){if(this.isShimmer=!1,this.counter=0,this.size<=0){this.isIdle=!0;return}else this.size-=.1;this.draw()}shimmer(){this.size>=this.maxSize?this.isReverse=!0:this.size<=this.minSize&&(this.isReverse=!1),this.isReverse?this.size-=this.speed:this.size+=this.speed}}const og=({colors:i,gap:e,speed:t,pixelSize:n,isActive:r})=>{const s=de.useRef(null),a=de.useRef([]),o=de.useRef(null),l=de.useRef(0);return de.useEffect(()=>{l.current=performance.now()},[]),de.useEffect(()=>{const c=s.current;if(!c)return;const u=c.getContext("2d"),d=c.parentElement.getBoundingClientRect(),h=Math.floor(d.width),f=Math.floor(d.height);c.width=h,c.height=f,c.style.width=`${h}px`,c.style.height=`${f}px`,a.current=[];const g=(_,m)=>{const p=_-h/2,E=m-f/2;return Math.sqrt(p*p+E*E)};for(let _=0;_<h;_+=e)for(let m=0;m<f;m+=e){const p=i[Math.floor(Math.random()*i.length)],E=g(_,m);a.current.push(new ag(c,u,_,m,p,t,E,n))}},[i,e,t,n]),de.useEffect(()=>{const c=u=>{const d=s.current;if(!d)return;const h=d.getContext("2d"),f=1e3/60,g=()=>{o.current=requestAnimationFrame(g);const _=performance.now(),m=_-l.current;if(!(m<f)){l.current=_-m%f,h.clearRect(0,0,d.width,d.height);for(let p=0;p<a.current.length;p++)a.current[p][u]();a.current.every(p=>p.isIdle)&&cancelAnimationFrame(o.current)}};g()};if(o.current&&cancelAnimationFrame(o.current),a.current.length!==0)return c(r?"appear":"disappear"),()=>{o.current&&cancelAnimationFrame(o.current)}},[r]),oe.jsx("canvas",{ref:s,className:"absolute inset-0 w-full h-full"})},lg=({colors:i=["#e0f2fe","#7dd3fc","#0ea5e9"],gap:e=5,speed:t=.035,pixelSize:n=2,onParamsChange:r})=>{const[s,a]=de.useState(!1);return de.useEffect(()=>{r&&r({colors:i,gap:e,speed:t,pixelSize:n})},[i,e,t,n,r]),oe.jsxs("div",{className:"relative overflow-hidden aspect-[4/5] border border-gray-800 transition-all duration-200 hover:border-sky-400 focus-within:border-sky-400",onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),onFocus:()=>a(!0),onBlur:()=>a(!1),style:{isolation:"isolate"},children:[oe.jsx("div",{className:"absolute inset-0 pointer-events-none transition-opacity duration-700",style:{background:"radial-gradient(circle at bottom left, transparent 55%, #101012)",boxShadow:"#09090b -0.5cqi 0.5cqi 2.5cqi inset",opacity:s?0:1}}),oe.jsx("div",{className:"absolute inset-0 m-auto aspect-square transition-opacity duration-700",style:{background:"radial-gradient(circle, #09090b, transparent 65%)",opacity:s?1:0}}),oe.jsx(og,{colors:i,gap:e,speed:t,pixelSize:n,isActive:s}),oe.jsx("button",{className:"absolute inset-0 opacity-0 cursor-pointer","aria-label":"Code",children:"Code"})]})},cg=({images:i=[],title:e="GALLERY 3D",count:t=10,duration:n=16,className:r=""})=>{const s=de.useRef(null),a=de.useRef([]);de.useEffect(()=>{if(!s.current)return;a.current.forEach(c=>{if(c){const u=window.innerWidth*.5/16,d=-Math.random()*u+"rem",h=window.innerWidth*.5/16,f=-Math.random()*h+"rem";c.style.setProperty("--left",d),c.style.setProperty("--right",f)}})},[i,t]);const o=i.length>0?i.slice(0,t):Array.from({length:t},(l,c)=>({src:`https://images.pexels.com/photos/614117/pexels-photo-614117.jpeg?index=${c}`,alt:`Gallery image ${c+1}`}));return oe.jsxs(oe.Fragment,{children:[oe.jsx("style",{children:`
|
|
4132
4132
|
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');
|
|
4133
4133
|
|
|
4134
4134
|
@property --translate-z {
|
|
@@ -4227,10 +4227,10 @@ void main() {
|
|
|
4227
4227
|
--translate-z: 2000px;
|
|
4228
4228
|
}
|
|
4229
4229
|
}
|
|
4230
|
-
`}),
|
|
4230
|
+
`}),oe.jsxs("section",{ref:s,className:`gallery3d-container ${r}`,style:{"--count":t,"--duration":`${n}s`},children:[oe.jsx("h1",{className:"gallery3d-title",children:e}),oe.jsx("div",{children:o.map((l,c)=>oe.jsx("img",{ref:u=>a.current[c]=u,src:typeof l=="string"?l:l.src,alt:typeof l=="string"?`Gallery image ${c+1}`:l.alt||`Gallery image ${c+1}`,className:"gallery3d-image",style:{"--i":c+1}},c))})]})]})},ug=({speed:i=.1,lineColor:e="#4499ff",pointColors:t=["#00ff00","#ffff00","#4499ff"],fogDensity:n=.7,bloomStrength:r=7,className:s=""})=>{const a=de.useRef(null),o=de.useRef(null),l=de.useRef(null);return de.useEffect(()=>{if(!a.current)return;const c=a.current.querySelector("canvas");c&&a.current.removeChild(c);const u=a.current.clientWidth,d=a.current.clientHeight,h=new hc;h.fog=new Hr(0,n),o.current=h;const f=new Rt(75,u/d,.1,1e3);f.position.z=5;const g=new uc({antialias:!0});g.setSize(u,d),g.toneMapping=Qs,g.outputColorSpace=It,a.current.appendChild(g.domElement);const _=new _c(f,g.domElement);_.enableDamping=!0,_.dampingFactor=.03;const m=new yc(h,f),p=new Un(new ue(u,d),1.5,.4,100);p.threshold=.002,p.strength=r,p.radius=0;const E=new Sc(g);E.addPass(m),E.addPass(p);const v=[-.15439987182617188,-4.138374328613281,-3.073897361755371,-.869240403175354,-5.335973739624023,-2.7324037551879883,-1.633371353149414,-5.862466812133789,-1.7560205459594727,-1.9328842163085938,-5.843876838684082,-1.1907804012298584,-2.15252685546875,-5.668161869049072,-.644770622253418,-2.159583568572998,-5.050915241241455,-.1310250163078308,-2.1433849334716797,-4.40407657623291,.3640003204345703,-2.451664924621582,-3.9286396503448486,1.3159711360931396,-2.7058067321777344,-3.404994487762451,2.207650661468506,-2.0846996307373047,-1.873553991317749,2.309267044067383,-1.2601451873779297,-.2743096351623535,2.092146873474121,-1.0130963325500488,.8422636985778809,2.544243574142456,-.7751436233520508,1.9591703414916992,3.013312339782715,.2966790795326233,4.3367791175842285,2.9735190868377686,1.3506059646606445,4.95012092590332,1.5352253913879395,.9760977625846863,3.2327873706817627,.8298614025115967,.2991504669189453,1.1627817153930664,.39388465881347656,.5221062898635864,.7404534816741943,-.3582862913608551,1.137399673461914,1.2396659851074219,-1.0834779739379883,2.7765538692474365,4.385804653167725,-1.5419139862060547,4.430294990539551,7.450641632080078,-2.0930042266845703,5.475499153137207,7.852602481842041,-3.6867828369140625,5.584137916564941,6.385196685791016,-5.076840400695801,4.807437419891357,3.7945828437805176,-5.751949310302734,3.6053285598754883,1.381692886352539,-5.501461982727051,2.6468048095703125,.4823716878890991,-4.470411777496338,1.65478515625,-.0785517692565918,-3.1033201217651367,.6955953240394592,-1.3061118125915527,-2.337378740310669,.034491539001464844,-2.9893672466278076,-2.4886598587036133,-.0851704403758049,-3.677823543548584,-2.8274037837982178,-.2470083236694336,-4.365466117858887,-3.0880308151245117],b=[],R=v.length;for(let O=0;O<R;O+=3)b.push(new I(v[O],v[O+1],v[O+2]));const T=new pc(b),A=T.getPoints(100),P=new _t().setFromPoints(A),y=new qs({color:new be(e)}),M=new dc(P,y);h.add(M);const F=new sa(T,222,.65,16,!0),L=F.attributes.position,C=new Bi(.01,.01,.01),U=t.map(O=>new be(O)),H=[];for(let O=0;O<L.count;O++){const Q=L.getX(O),ce=L.getY(O),ne=L.getZ(O),ve=O%U.length,Te=new Vi({color:U[ve]}),Ce=new bt(C,Te);Ce.position.set(Q,ce,ne),h.add(Ce),H.push(Ce)}const Y=new Z0(F,.35),J=new qs({color:new be(e)}),z=new F0(Y,J);h.add(z);let j=0;const $=20*400;function N(O){j=O*i;const Q=j%$/$,ce=T.getPointAt(Q),ne=T.getPointAt((Q+.01)%1);f.position.copy(ce),f.lookAt(ne)}function ee(O=0){l.current=requestAnimationFrame(ee),N(O),E.render(h,f),_.update()}ee();const me=()=>{if(!a.current)return;const O=a.current.clientWidth,Q=a.current.clientHeight;f.aspect=O/Q,f.updateProjectionMatrix(),g.setSize(O,Q),E.setSize(O,Q),p.resolution.set(O,Q)};return window.addEventListener("resize",me),()=>{window.removeEventListener("resize",me),l.current&&cancelAnimationFrame(l.current),g.dispose(),P.dispose(),y.dispose(),C.dispose(),H.forEach(O=>{O.material.dispose(),h.remove(O)}),Y.dispose(),J.dispose(),F.dispose(),a.current&&g.domElement&&a.current.removeChild(g.domElement)}},[i,e,t,n,r]),oe.jsx("div",{className:`relative w-full h-full ${s}`,children:oe.jsx("div",{ref:a,className:"w-full h-full"})})};class hg{constructor(e,t={}){this.canvas=e,this.ctx=e.getContext("2d"),this.width=t.width||354,this.height=t.height||504,this.octaves=t.octaves||10,this.lacunarity=t.lacunarity||1.6,this.gain=t.gain||.6,this.amplitude=t.amplitude||.2,this.frequency=t.frequency||5,this.baseFlatness=t.baseFlatness||.2,this.displacement=t.displacement||60,this.speed=t.speed||1,this.borderOffset=t.borderOffset||60,this.borderRadius=t.borderRadius||40,this.lineWidth=t.lineWidth||1,this.color=t.color||"#71717a",this.animationId=null,this.time=0,this.lastFrameTime=0,this.canvas.width=this.width,this.canvas.height=this.height}random(e){return Math.sin(e*12.9898)*43758.5453%1}noise2D(e,t){const n=Math.floor(e),r=Math.floor(t),s=e-n,a=t-r,o=this.random(n+r*57),l=this.random(n+1+r*57),c=this.random(n+(r+1)*57),u=this.random(n+1+(r+1)*57),d=s*s*(3-2*s),h=a*a*(3-2*a);return o*(1-d)*(1-h)+l*d*(1-h)+c*(1-d)*h+u*d*h}octavedNoise(e,t,n,r,s,a,o=0,l=0,c=1){let u=0,d=s,h=a;for(let f=0;f<t;f++){let g=d;f===0&&(g*=c),u+=g*this.noise2D(h*e+l*100,o*h*.3),h*=n,d*=r}return u}getRoundedRectPoint(e,t,n,r,s,a){const o=r-2*a,l=s-2*a,c=Math.PI*a/2,u=2*o+2*l+4*c,d=e*u;let h=0;if(d<=h+o){const g=(d-h)/o;return{x:t+a+g*o,y:n}}if(h+=o,d<=h+c){const g=(d-h)/c;return this.getCornerPoint(t+r-a,n+a,a,-Math.PI/2,Math.PI/2,g)}if(h+=c,d<=h+l){const g=(d-h)/l;return{x:t+r,y:n+a+g*l}}if(h+=l,d<=h+c){const g=(d-h)/c;return this.getCornerPoint(t+r-a,n+s-a,a,0,Math.PI/2,g)}if(h+=c,d<=h+o){const g=(d-h)/o;return{x:t+r-a-g*o,y:n+s}}if(h+=o,d<=h+c){const g=(d-h)/c;return this.getCornerPoint(t+a,n+s-a,a,Math.PI/2,Math.PI/2,g)}if(h+=c,d<=h+l){const g=(d-h)/l;return{x:t,y:n+s-a-g*l}}h+=l;const f=(d-h)/c;return this.getCornerPoint(t+a,n+a,a,Math.PI,Math.PI/2,f)}getCornerPoint(e,t,n,r,s,a){const o=r+a*s;return{x:e+n*Math.cos(o),y:t+n*Math.sin(o)}}drawElectricBorder(e=0){if(!this.canvas||!this.ctx)return;const t=(e-this.lastFrameTime)/1e3;this.time+=t*this.speed,this.lastFrameTime=e,this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.strokeStyle=this.color,this.ctx.lineWidth=this.lineWidth,this.ctx.lineCap="round",this.ctx.lineJoin="round";const n=this.displacement,r=this.borderOffset,s=this.borderOffset,a=this.canvas.width-2*this.borderOffset,o=this.canvas.height-2*this.borderOffset,l=Math.min(a,o)/2,c=Math.min(this.borderRadius,l),u=2*(a+o)+2*Math.PI*c,d=Math.floor(u/2);this.ctx.beginPath();for(let h=0;h<=d;h++){const f=h/d,g=this.getRoundedRectPoint(f,r,s,a,o,c),_=this.octavedNoise(f*8,this.octaves,this.lacunarity,this.gain,this.amplitude,this.frequency,this.time,0,this.baseFlatness),m=this.octavedNoise(f*8,this.octaves,this.lacunarity,this.gain,this.amplitude,this.frequency,this.time,1,this.baseFlatness),p=g.x+_*n,E=g.y+m*n;h===0?this.ctx.moveTo(p,E):this.ctx.lineTo(p,E)}this.ctx.closePath(),this.ctx.stroke(),this.animationId=requestAnimationFrame(h=>this.drawElectricBorder(h))}start(){this.lastFrameTime=performance.now(),this.animationId=requestAnimationFrame(e=>this.drawElectricBorder(e))}stop(){this.animationId&&(cancelAnimationFrame(this.animationId),this.animationId=null)}updateOptions(e){Object.assign(this,e)}}const dg=({width:i=354,height:e=504,color:t="#71717a",speed:n=1.5,title:r="SparkDesign",description:s="Alibaba Cloud SparkDesign motion component library, bringing vitality and creativity to your products.",buttonText:a="SparkDesign",className:o=""})=>{const l=de.useRef(null),c=de.useRef(null);de.useEffect(()=>{if(!l.current)return;const h=new hg(l.current,{width:475,height:625,octaves:10,lacunarity:1.6,gain:.7,amplitude:.075,frequency:10,baseFlatness:0,displacement:60,speed:n,borderOffset:60,borderRadius:24,lineWidth:1,color:t});return c.current=h,h.start(),()=>{h.stop()}},[]),de.useEffect(()=>{c.current&&c.current.updateOptions({color:t,speed:n})},[t,n]);const u=t,d=t+"66";return oe.jsxs(oe.Fragment,{children:[oe.jsx("style",{children:`
|
|
4231
4231
|
.electric-border-card {
|
|
4232
4232
|
--electric-border-color: ${t};
|
|
4233
|
-
--electric-light-color: ${
|
|
4233
|
+
--electric-light-color: ${u};
|
|
4234
4234
|
--gradient-color: ${d};
|
|
4235
4235
|
--color-neutral-900: oklch(0.185 0 0);
|
|
4236
4236
|
}
|
|
@@ -4470,11 +4470,11 @@ void main() {
|
|
|
4470
4470
|
transparent
|
|
4471
4471
|
);
|
|
4472
4472
|
}
|
|
4473
|
-
`}),
|
|
4473
|
+
`}),oe.jsx("div",{className:`electric-border-card ${o}`,children:oe.jsxs("div",{className:"electric-border-card-container",children:[oe.jsxs("div",{className:"electric-border-inner-container",children:[oe.jsx("div",{className:"electric-border-canvas-container",children:oe.jsx("canvas",{ref:l,className:"electric-border-canvas",width:475,height:625})}),oe.jsx("div",{className:"electric-border-glow-layer-1"}),oe.jsx("div",{className:"electric-border-glow-layer-2"})]}),oe.jsx("div",{className:"electric-border-overlay-1"}),oe.jsx("div",{className:"electric-border-overlay-2"}),oe.jsx("div",{className:"electric-border-background-glow"}),oe.jsxs("div",{className:"electric-border-content-container",children:[oe.jsxs("div",{className:"electric-border-content-top",children:[oe.jsx("div",{className:"electric-border-button-glass",children:a}),oe.jsx("p",{className:"electric-border-title",children:r})]}),oe.jsx("hr",{className:"electric-border-divider"}),oe.jsx("div",{className:"electric-border-content-bottom",children:oe.jsx("p",{className:"electric-border-description",children:s})})]})]})})]})},fg=({cardCount:i=6,radius:e=500,curvature:t=10,images:n=[],cardWidth:r=200,cardHeight:s=300,className:a=""})=>{const o=de.useRef(null),l=de.useRef(null),c=de.useRef([]),u=["https://cdn.prod.website-files.com/679185b32f76eb227e8b2d64/690e228d4e47784421489090_e94dfb12e66c3ad5ce888a87139fb6e1.jpg","https://cdn.prod.website-files.com/679185b32f76eb227e8b2d64/68cc3546a30d418181506343_49154acfd6aa76f4bf21b4f4aac6d938.jpg","https://cdn.prod.website-files.com/679185b32f76eb227e8b2d64/690e21bca5a1e6afcad44a90_1661362d69d4f83dbb9635d50fe19695.jpg","https://cdn.prod.website-files.com/679185b32f76eb227e8b2d64/68cc3546430643d66ba5571a_c49ec3146d5ee88438a57615125aeb38.jpg","https://cdn.prod.website-files.com/679185b32f76eb227e8b2d64/68cc34c5e8f1a1601339ac88_78b4d0a1169a170c3d8efda43133bca0.jpg","https://cdn.prod.website-files.com/679185b32f76eb227e8b2d64/690e2269ff449135d95c027c_10cd22f7410c9c89996ef4459495caba.jpg"],d=n.length>0?n:u;return de.useEffect(()=>{if(!l.current||!c.current.length)return;const h=c.current,f=h.length;[...h].reverse().forEach((g,_)=>{if(!g)return;const m=_/f*Math.PI*2,p=Math.sin(m)*t;g.style.transform=`
|
|
4474
4474
|
rotateX(${m*180/Math.PI}deg)
|
|
4475
4475
|
translateZ(${e}px)
|
|
4476
|
-
rotateY(${
|
|
4477
|
-
`})},[i,e,t]),
|
|
4476
|
+
rotateY(${p}deg)
|
|
4477
|
+
`})},[i,e,t]),de.useEffect(()=>{c.current.forEach((h,f)=>{if(!h)return;const g=d[f%d.length];g&&(h.style.background=`url(${g}) center/cover no-repeat`)})},[d,i]),de.useEffect(()=>{if(!l.current)return;const h=()=>{const f=document.body.scrollHeight-window.innerHeight,_=(f>0?window.scrollY/f:0)*360;l.current&&(l.current.style.transform=`rotateX(${_}deg)`)};return window.addEventListener("scroll",h),h(),()=>{window.removeEventListener("scroll",h)}},[]),oe.jsxs(oe.Fragment,{children:[oe.jsx("style",{children:`
|
|
4478
4478
|
.scroll-cards-3d-scene {
|
|
4479
4479
|
position: sticky;
|
|
4480
4480
|
top: 0;
|
|
@@ -4511,5 +4511,197 @@ void main() {
|
|
|
4511
4511
|
backface-visibility: hidden;
|
|
4512
4512
|
transform-origin: center center;
|
|
4513
4513
|
}
|
|
4514
|
-
`}),ce.jsx("div",{className:`scroll-cards-3d-scene ${a}`,ref:o,children:ce.jsx("div",{className:"scroll-cards-3d-container",ref:l,children:Array.from({length:i},(u,p)=>ce.jsx("div",{className:"scroll-cards-3d-card",ref:_=>{_&&(c.current[p]=_)}},p))})})]})},Ug=({onClick:i,size:e=400,className:t="",icon:n,hoverGradient:r="linear-gradient(180deg, #3EF7A4 0%, rgba(62, 247, 164, 0) 100%)"})=>{const s=me.useRef(null),a=me.useRef(null),o=me.useRef(null),[l,c]=me.useState(!1),h=400,d=e/h;me.useEffect(()=>{let _=!0;return(async()=>{try{const{liquidMetalFragmentShader:m,ShaderMount:f}=await import("https://esm.sh/@paper-design/shaders");if(!_||!s.current)return;a.current&&(typeof a.current.destroy=="function"&&a.current.destroy(),a.current=null);const b=new f(s.current,m,{u_repetition:1.5,u_softness:.5,u_shiftRed:.3,u_shiftBlue:.3,u_distortion:0,u_contour:0,u_angle:100,u_scale:1.5,u_shape:1,u_offsetX:.1,u_offsetY:-.1},void 0,.6);a.current=b}catch(m){console.error("Failed to load shader:",m)}})(),()=>{_=!1,a.current&&(typeof a.current.destroy=="function"&&a.current.destroy(),a.current=null)}},[]);const u=h*.52,p=()=>n&&me.isValidElement(n)?ce.jsx("div",{style:{width:`${u}px`,height:`${u}px`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,position:"relative",zIndex:1},children:me.cloneElement(n,{className:`text-zinc-400 ${n.props?.className||""}`,style:{color:l?"#ffffff":"rgb(161 161 170 / 1.0)",width:"100%",height:"100%",display:"block",margin:0,padding:0,fontSize:`${u}px`,transition:"color 0.3s ease",...n.props?.style}})}):null;return ce.jsx("div",{className:`relative ${t}`,style:{width:`${e}px`,height:`${e}px`,display:"flex",alignItems:"center",justifyContent:"center"},children:ce.jsxs("div",{style:{width:`${h}px`,height:`${h}px`,transform:`scale(${d})`,transformOrigin:"center center",borderRadius:"50%",position:"relative"},children:[ce.jsx("div",{ref:s,id:"liquid-metal-container",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:`${h}px`,height:`${h}px`,borderRadius:"50%",overflow:"hidden"}}),ce.jsx("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:`${h*.91}px`,height:`${h*.91}px`,background:"linear-gradient(rgb(68 68 68 / 1.0), rgb(0 0 0 / 1.0))",borderRadius:"50%",boxShadow:"inset 0 0.2rem 0.2rem 0.2rem rgba(255, 255, 255, 0.3)",zIndex:0}}),ce.jsx("div",{className:"outline group",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",alignItems:"center",justifyContent:"center",width:`${h*1.01}px`,height:`${h*1.01}px`,borderRadius:"50%",zIndex:1,pointerEvents:"none"},children:ce.jsx("div",{ref:o,className:"outline-border",style:{position:"absolute",inset:0,padding:"0.5rem",borderRadius:"inherit",background:r,filter:l?"grayscale(0)":"grayscale(1)",WebkitMask:"linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0)",WebkitMaskComposite:"xor",mask:"linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0)",maskComposite:"exclude",transition:"all 0.3s ease"}})}),ce.jsx("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2,pointerEvents:"none"},children:p()}),ce.jsx("button",{onClick:i,className:"absolute inset-0 rounded-full cursor-pointer",style:{zIndex:3,background:"transparent",border:"none",padding:0,margin:0},"aria-label":"Liquid Metal Button",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1)})]})})};function Yl(...i){return i.filter(Boolean).join(" ")}exports.BlackHole=bg;exports.BlurText=lc;exports.CircularText=uc;exports.ElectricBorder=Lg;exports.FallingPattern=Ec;exports.FlowingDashedBox=Sc;exports.Gallery3D=Cg;exports.LiquidMetalButton=Ug;exports.MetalButton=Dg;exports.PixelCard=wg;exports.ScrambledText=Mc;exports.ScrollCards3D=Fg;exports.ShinyText=yc;exports.Tunnel3D=Rg;exports.cn=Yl;
|
|
4514
|
+
`}),oe.jsx("div",{className:`scroll-cards-3d-scene ${a}`,ref:o,children:oe.jsx("div",{className:"scroll-cards-3d-container",ref:l,children:Array.from({length:i},(h,f)=>oe.jsx("div",{className:"scroll-cards-3d-card",ref:g=>{g&&(c.current[f]=g)}},f))})})]})},pg=({onClick:i,size:e=400,className:t="",icon:n,hoverGradient:r="linear-gradient(180deg, #3EF7A4 0%, rgba(62, 247, 164, 0) 100%)"})=>{const s=de.useRef(null),a=de.useRef(null),o=de.useRef(null),[l,c]=de.useState(!1),u=400,d=e/u;de.useEffect(()=>{let g=!0;return(async()=>{try{const{liquidMetalFragmentShader:m,ShaderMount:p}=await import("https://esm.sh/@paper-design/shaders");if(!g||!s.current)return;a.current&&(typeof a.current.destroy=="function"&&a.current.destroy(),a.current=null);const E=new p(s.current,m,{u_repetition:1.5,u_softness:.5,u_shiftRed:.3,u_shiftBlue:.3,u_distortion:0,u_contour:0,u_angle:100,u_scale:1.5,u_shape:1,u_offsetX:.1,u_offsetY:-.1},void 0,.6);a.current=E}catch(m){console.error("Failed to load shader:",m)}})(),()=>{g=!1,a.current&&(typeof a.current.destroy=="function"&&a.current.destroy(),a.current=null)}},[]);const h=u*.52,f=()=>n&&de.isValidElement(n)?oe.jsx("div",{style:{width:`${h}px`,height:`${h}px`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,position:"relative",zIndex:1},children:de.cloneElement(n,{className:`text-zinc-400 ${n.props?.className||""}`,style:{color:l?"#ffffff":"rgb(161 161 170 / 1.0)",width:"100%",height:"100%",display:"block",margin:0,padding:0,fontSize:`${h}px`,transition:"color 0.3s ease",...n.props?.style}})}):null;return oe.jsx("div",{className:`relative ${t}`,style:{width:`${e}px`,height:`${e}px`,display:"flex",alignItems:"center",justifyContent:"center"},children:oe.jsxs("div",{style:{width:`${u}px`,height:`${u}px`,transform:`scale(${d})`,transformOrigin:"center center",borderRadius:"50%",position:"relative"},children:[oe.jsx("div",{ref:s,id:"liquid-metal-container",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:`${u}px`,height:`${u}px`,borderRadius:"50%",overflow:"hidden"}}),oe.jsx("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:`${u*.91}px`,height:`${u*.91}px`,background:"linear-gradient(rgb(68 68 68 / 1.0), rgb(0 0 0 / 1.0))",borderRadius:"50%",boxShadow:"inset 0 0.2rem 0.2rem 0.2rem rgba(255, 255, 255, 0.3)",zIndex:0}}),oe.jsx("div",{className:"outline group",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",alignItems:"center",justifyContent:"center",width:`${u*1.01}px`,height:`${u*1.01}px`,borderRadius:"50%",zIndex:1,pointerEvents:"none"},children:oe.jsx("div",{ref:o,className:"outline-border",style:{position:"absolute",inset:0,padding:"0.5rem",borderRadius:"inherit",background:r,filter:l?"grayscale(0)":"grayscale(1)",WebkitMask:"linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0)",WebkitMaskComposite:"xor",mask:"linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0)",maskComposite:"exclude",transition:"all 0.3s ease"}})}),oe.jsx("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2,pointerEvents:"none"},children:f()}),oe.jsx("button",{onClick:i,className:"absolute inset-0 rounded-full cursor-pointer",style:{zIndex:3,background:"transparent",border:"none",padding:0,margin:0},"aria-label":"Liquid Metal Button",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1)})]})})},mg=({color:i="#a5a5b0",size:e=40,count:t=9,className:n=""})=>{const r=t===9,s=r?[0,50,100,150,200,250,300,350,400]:[0,200,300,400,500,600],a=3,o=r?3:2;return oe.jsx("div",{className:aa(`grid grid-cols-${a} grid-rows-${o} gap-1.5`,n),style:{width:e,height:e,gridTemplateColumns:`repeat(${a}, 1fr)`,gridTemplateRows:`repeat(${o}, 1fr)`},children:s.map((l,c)=>{const u=r?2:1.2,d=r?[0,.05,.25,.5,.75,1]:[0,.2,.6,.8,1],h=r?[.5,1,1,1,.5,.5]:[.5,1,1,1,.5],f=r?[.3,1,1,1,.3,.3]:[.3,1,1,1,.3];return oe.jsx(Mt.motion.div,{style:{backgroundColor:i,aspectRatio:"1 / 1",width:"100%",height:"100%"},animate:{scale:h,opacity:f},transition:{duration:u,repeat:1/0,delay:l/1e3,ease:"easeInOut",times:d}},c)})})};function Ii(i){let e=i[0],t=i[1],n=i[2];return Math.sqrt(e*e+t*t+n*n)}function $s(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i}function gg(i,e,t,n){return i[0]=e,i[1]=t,i[2]=n,i}function ol(i,e,t){return i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i}function ll(i,e,t){return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i}function _g(i,e,t){return i[0]=e[0]*t[0],i[1]=e[1]*t[1],i[2]=e[2]*t[2],i}function xg(i,e,t){return i[0]=e[0]/t[0],i[1]=e[1]/t[1],i[2]=e[2]/t[2],i}function Rs(i,e,t){return i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i}function vg(i,e){let t=e[0]-i[0],n=e[1]-i[1],r=e[2]-i[2];return Math.sqrt(t*t+n*n+r*r)}function Mg(i,e){let t=e[0]-i[0],n=e[1]-i[1],r=e[2]-i[2];return t*t+n*n+r*r}function cl(i){let e=i[0],t=i[1],n=i[2];return e*e+t*t+n*n}function Sg(i,e){return i[0]=-e[0],i[1]=-e[1],i[2]=-e[2],i}function yg(i,e){return i[0]=1/e[0],i[1]=1/e[1],i[2]=1/e[2],i}function js(i,e){let t=e[0],n=e[1],r=e[2],s=t*t+n*n+r*r;return s>0&&(s=1/Math.sqrt(s)),i[0]=e[0]*s,i[1]=e[1]*s,i[2]=e[2]*s,i}function Ec(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function ul(i,e,t){let n=e[0],r=e[1],s=e[2],a=t[0],o=t[1],l=t[2];return i[0]=r*l-s*o,i[1]=s*a-n*l,i[2]=n*o-r*a,i}function Eg(i,e,t,n){let r=e[0],s=e[1],a=e[2];return i[0]=r+n*(t[0]-r),i[1]=s+n*(t[1]-s),i[2]=a+n*(t[2]-a),i}function bg(i,e,t,n,r){const s=Math.exp(-n*r);let a=e[0],o=e[1],l=e[2];return i[0]=t[0]+(a-t[0])*s,i[1]=t[1]+(o-t[1])*s,i[2]=t[2]+(l-t[2])*s,i}function Tg(i,e,t){let n=e[0],r=e[1],s=e[2],a=t[3]*n+t[7]*r+t[11]*s+t[15];return a=a||1,i[0]=(t[0]*n+t[4]*r+t[8]*s+t[12])/a,i[1]=(t[1]*n+t[5]*r+t[9]*s+t[13])/a,i[2]=(t[2]*n+t[6]*r+t[10]*s+t[14])/a,i}function Dg(i,e,t){let n=e[0],r=e[1],s=e[2],a=t[3]*n+t[7]*r+t[11]*s+t[15];return a=a||1,i[0]=(t[0]*n+t[4]*r+t[8]*s)/a,i[1]=(t[1]*n+t[5]*r+t[9]*s)/a,i[2]=(t[2]*n+t[6]*r+t[10]*s)/a,i}function Ag(i,e,t){let n=e[0],r=e[1],s=e[2];return i[0]=n*t[0]+r*t[3]+s*t[6],i[1]=n*t[1]+r*t[4]+s*t[7],i[2]=n*t[2]+r*t[5]+s*t[8],i}function wg(i,e,t){let n=e[0],r=e[1],s=e[2],a=t[0],o=t[1],l=t[2],c=t[3],u=o*s-l*r,d=l*n-a*s,h=a*r-o*n,f=o*h-l*d,g=l*u-a*h,_=a*d-o*u,m=c*2;return u*=m,d*=m,h*=m,f*=2,g*=2,_*=2,i[0]=n+u+f,i[1]=r+d+g,i[2]=s+h+_,i}const Cg=(function(){const i=[0,0,0],e=[0,0,0];return function(t,n){$s(i,t),$s(e,n),js(i,i),js(e,e);let r=Ec(i,e);return r>1?0:r<-1?Math.PI:Math.acos(r)}})();function Rg(i,e){return i[0]===e[0]&&i[1]===e[1]&&i[2]===e[2]}class kt extends Array{constructor(e=0,t=e,n=e){return super(e,t,n),this}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(e){this[0]=e}set y(e){this[1]=e}set z(e){this[2]=e}set(e,t=e,n=e){return e.length?this.copy(e):(gg(this,e,t,n),this)}copy(e){return $s(this,e),this}add(e,t){return t?ol(this,e,t):ol(this,this,e),this}sub(e,t){return t?ll(this,e,t):ll(this,this,e),this}multiply(e){return e.length?_g(this,this,e):Rs(this,this,e),this}divide(e){return e.length?xg(this,this,e):Rs(this,this,1/e),this}inverse(e=this){return yg(this,e),this}len(){return Ii(this)}distance(e){return e?vg(this,e):Ii(this)}squaredLen(){return cl(this)}squaredDistance(e){return e?Mg(this,e):cl(this)}negate(e=this){return Sg(this,e),this}cross(e,t){return t?ul(this,e,t):ul(this,this,e),this}scale(e){return Rs(this,this,e),this}normalize(){return js(this,this),this}dot(e){return Ec(this,e)}equals(e){return Rg(this,e)}applyMatrix3(e){return Ag(this,this,e),this}applyMatrix4(e){return Tg(this,this,e),this}scaleRotateMatrix4(e){return Dg(this,this,e),this}applyQuaternion(e){return wg(this,this,e),this}angle(e){return Cg(this,e)}lerp(e,t){return Eg(this,this,e,t),this}smoothLerp(e,t,n){return bg(this,this,e,t,n),this}clone(){return new kt(this[0],this[1],this[2])}fromArray(e,t=0){return this[0]=e[t],this[1]=e[t+1],this[2]=e[t+2],this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e}transformDirection(e){const t=this[0],n=this[1],r=this[2];return this[0]=e[0]*t+e[4]*n+e[8]*r,this[1]=e[1]*t+e[5]*n+e[9]*r,this[2]=e[2]*t+e[6]*n+e[10]*r,this.normalize()}}const hl=new kt;let Pg=1,Lg=1,dl=!1;class Fg{constructor(e,t={}){e.canvas||console.error("gl not passed as first argument to Geometry"),this.gl=e,this.attributes=t,this.id=Pg++,this.VAOs={},this.drawRange={start:0,count:0},this.instancedCount=0,this.gl.renderer.bindVertexArray(null),this.gl.renderer.currentGeometry=null,this.glState=this.gl.renderer.state;for(let n in t)this.addAttribute(n,t[n])}addAttribute(e,t){if(this.attributes[e]=t,t.id=Lg++,t.size=t.size||1,t.type=t.type||(t.data.constructor===Float32Array?this.gl.FLOAT:t.data.constructor===Uint16Array?this.gl.UNSIGNED_SHORT:this.gl.UNSIGNED_INT),t.target=e==="index"?this.gl.ELEMENT_ARRAY_BUFFER:this.gl.ARRAY_BUFFER,t.normalized=t.normalized||!1,t.stride=t.stride||0,t.offset=t.offset||0,t.count=t.count||(t.stride?t.data.byteLength/t.stride:t.data.length/t.size),t.divisor=t.instanced||0,t.needsUpdate=!1,t.usage=t.usage||this.gl.STATIC_DRAW,t.buffer||this.updateAttribute(t),t.divisor){if(this.isInstanced=!0,this.instancedCount&&this.instancedCount!==t.count*t.divisor)return console.warn("geometry has multiple instanced buffers of different length"),this.instancedCount=Math.min(this.instancedCount,t.count*t.divisor);this.instancedCount=t.count*t.divisor}else e==="index"?this.drawRange.count=t.count:this.attributes.index||(this.drawRange.count=Math.max(this.drawRange.count,t.count))}updateAttribute(e){const t=!e.buffer;t&&(e.buffer=this.gl.createBuffer()),this.glState.boundBuffer!==e.buffer&&(this.gl.bindBuffer(e.target,e.buffer),this.glState.boundBuffer=e.buffer),t?this.gl.bufferData(e.target,e.data,e.usage):this.gl.bufferSubData(e.target,0,e.data),e.needsUpdate=!1}setIndex(e){this.addAttribute("index",e)}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}setInstancedCount(e){this.instancedCount=e}createVAO(e){this.VAOs[e.attributeOrder]=this.gl.renderer.createVertexArray(),this.gl.renderer.bindVertexArray(this.VAOs[e.attributeOrder]),this.bindAttributes(e)}bindAttributes(e){e.attributeLocations.forEach((t,{name:n,type:r})=>{if(!this.attributes[n]){console.warn(`active attribute ${n} not being supplied`);return}const s=this.attributes[n];this.gl.bindBuffer(s.target,s.buffer),this.glState.boundBuffer=s.buffer;let a=1;r===35674&&(a=2),r===35675&&(a=3),r===35676&&(a=4);const o=s.size/a,l=a===1?0:a*a*4,c=a===1?0:a*4;for(let u=0;u<a;u++)this.gl.vertexAttribPointer(t+u,o,s.type,s.normalized,s.stride+l,s.offset+u*c),this.gl.enableVertexAttribArray(t+u),this.gl.renderer.vertexAttribDivisor(t+u,s.divisor)}),this.attributes.index&&this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.attributes.index.buffer)}draw({program:e,mode:t=this.gl.TRIANGLES}){this.gl.renderer.currentGeometry!==`${this.id}_${e.attributeOrder}`&&(this.VAOs[e.attributeOrder]||this.createVAO(e),this.gl.renderer.bindVertexArray(this.VAOs[e.attributeOrder]),this.gl.renderer.currentGeometry=`${this.id}_${e.attributeOrder}`),e.attributeLocations.forEach((r,{name:s})=>{const a=this.attributes[s];a.needsUpdate&&this.updateAttribute(a)});let n=2;this.attributes.index?.type===this.gl.UNSIGNED_INT&&(n=4),this.isInstanced?this.attributes.index?this.gl.renderer.drawElementsInstanced(t,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+this.drawRange.start*n,this.instancedCount):this.gl.renderer.drawArraysInstanced(t,this.drawRange.start,this.drawRange.count,this.instancedCount):this.attributes.index?this.gl.drawElements(t,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+this.drawRange.start*n):this.gl.drawArrays(t,this.drawRange.start,this.drawRange.count)}getPosition(){const e=this.attributes.position;if(e.data)return e;if(!dl)return console.warn("No position buffer data found to compute bounds"),dl=!0}computeBoundingBox(e){e||(e=this.getPosition());const t=e.data,n=e.size;this.bounds||(this.bounds={min:new kt,max:new kt,center:new kt,scale:new kt,radius:1/0});const r=this.bounds.min,s=this.bounds.max,a=this.bounds.center,o=this.bounds.scale;r.set(1/0),s.set(-1/0);for(let l=0,c=t.length;l<c;l+=n){const u=t[l],d=t[l+1],h=t[l+2];r.x=Math.min(u,r.x),r.y=Math.min(d,r.y),r.z=Math.min(h,r.z),s.x=Math.max(u,s.x),s.y=Math.max(d,s.y),s.z=Math.max(h,s.z)}o.sub(s,r),a.add(r,s).divide(2)}computeBoundingSphere(e){e||(e=this.getPosition());const t=e.data,n=e.size;this.bounds||this.computeBoundingBox(e);let r=0;for(let s=0,a=t.length;s<a;s+=n)hl.fromArray(t,s),r=Math.max(r,this.bounds.center.squaredDistance(hl));this.bounds.radius=Math.sqrt(r)}remove(){for(let e in this.VAOs)this.gl.renderer.deleteVertexArray(this.VAOs[e]),delete this.VAOs[e];for(let e in this.attributes)this.gl.deleteBuffer(this.attributes[e].buffer),delete this.attributes[e]}}let Ig=1;const fl={};class Ug{constructor(e,{vertex:t,fragment:n,uniforms:r={},transparent:s=!1,cullFace:a=e.BACK,frontFace:o=e.CCW,depthTest:l=!0,depthWrite:c=!0,depthFunc:u=e.LEQUAL}={}){e.canvas||console.error("gl not passed as first argument to Program"),this.gl=e,this.uniforms=r,this.id=Ig++,t||console.warn("vertex shader not supplied"),n||console.warn("fragment shader not supplied"),this.transparent=s,this.cullFace=a,this.frontFace=o,this.depthTest=l,this.depthWrite=c,this.depthFunc=u,this.blendFunc={},this.blendEquation={},this.stencilFunc={},this.stencilOp={},this.transparent&&!this.blendFunc.src&&(this.gl.renderer.premultipliedAlpha?this.setBlendFunc(this.gl.ONE,this.gl.ONE_MINUS_SRC_ALPHA):this.setBlendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA)),this.vertexShader=e.createShader(e.VERTEX_SHADER),this.fragmentShader=e.createShader(e.FRAGMENT_SHADER),this.program=e.createProgram(),e.attachShader(this.program,this.vertexShader),e.attachShader(this.program,this.fragmentShader),this.setShaders({vertex:t,fragment:n})}setShaders({vertex:e,fragment:t}){if(e&&(this.gl.shaderSource(this.vertexShader,e),this.gl.compileShader(this.vertexShader),this.gl.getShaderInfoLog(this.vertexShader)!==""&&console.warn(`${this.gl.getShaderInfoLog(this.vertexShader)}
|
|
4515
|
+
Vertex Shader
|
|
4516
|
+
${pl(e)}`)),t&&(this.gl.shaderSource(this.fragmentShader,t),this.gl.compileShader(this.fragmentShader),this.gl.getShaderInfoLog(this.fragmentShader)!==""&&console.warn(`${this.gl.getShaderInfoLog(this.fragmentShader)}
|
|
4517
|
+
Fragment Shader
|
|
4518
|
+
${pl(t)}`)),this.gl.linkProgram(this.program),!this.gl.getProgramParameter(this.program,this.gl.LINK_STATUS))return console.warn(this.gl.getProgramInfoLog(this.program));this.uniformLocations=new Map;let n=this.gl.getProgramParameter(this.program,this.gl.ACTIVE_UNIFORMS);for(let a=0;a<n;a++){let o=this.gl.getActiveUniform(this.program,a);this.uniformLocations.set(o,this.gl.getUniformLocation(this.program,o.name));const l=o.name.match(/(\w+)/g);o.uniformName=l[0],o.nameComponents=l.slice(1)}this.attributeLocations=new Map;const r=[],s=this.gl.getProgramParameter(this.program,this.gl.ACTIVE_ATTRIBUTES);for(let a=0;a<s;a++){const o=this.gl.getActiveAttrib(this.program,a),l=this.gl.getAttribLocation(this.program,o.name);l!==-1&&(r[l]=o.name,this.attributeLocations.set(o,l))}this.attributeOrder=r.join("")}setBlendFunc(e,t,n,r){this.blendFunc.src=e,this.blendFunc.dst=t,this.blendFunc.srcAlpha=n,this.blendFunc.dstAlpha=r,e&&(this.transparent=!0)}setBlendEquation(e,t){this.blendEquation.modeRGB=e,this.blendEquation.modeAlpha=t}setStencilFunc(e,t,n){this.stencilRef=t,this.stencilFunc.func=e,this.stencilFunc.ref=t,this.stencilFunc.mask=n}setStencilOp(e,t,n){this.stencilOp.stencilFail=e,this.stencilOp.depthFail=t,this.stencilOp.depthPass=n}applyState(){this.depthTest?this.gl.renderer.enable(this.gl.DEPTH_TEST):this.gl.renderer.disable(this.gl.DEPTH_TEST),this.cullFace?this.gl.renderer.enable(this.gl.CULL_FACE):this.gl.renderer.disable(this.gl.CULL_FACE),this.blendFunc.src?this.gl.renderer.enable(this.gl.BLEND):this.gl.renderer.disable(this.gl.BLEND),this.cullFace&&this.gl.renderer.setCullFace(this.cullFace),this.gl.renderer.setFrontFace(this.frontFace),this.gl.renderer.setDepthMask(this.depthWrite),this.gl.renderer.setDepthFunc(this.depthFunc),this.blendFunc.src&&this.gl.renderer.setBlendFunc(this.blendFunc.src,this.blendFunc.dst,this.blendFunc.srcAlpha,this.blendFunc.dstAlpha),this.gl.renderer.setBlendEquation(this.blendEquation.modeRGB,this.blendEquation.modeAlpha),this.stencilFunc.func||this.stencilOp.stencilFail?this.gl.renderer.enable(this.gl.STENCIL_TEST):this.gl.renderer.disable(this.gl.STENCIL_TEST),this.gl.renderer.setStencilFunc(this.stencilFunc.func,this.stencilFunc.ref,this.stencilFunc.mask),this.gl.renderer.setStencilOp(this.stencilOp.stencilFail,this.stencilOp.depthFail,this.stencilOp.depthPass)}use({flipFaces:e=!1}={}){let t=-1;this.gl.renderer.state.currentProgram===this.id||(this.gl.useProgram(this.program),this.gl.renderer.state.currentProgram=this.id),this.uniformLocations.forEach((r,s)=>{let a=this.uniforms[s.uniformName];for(const o of s.nameComponents){if(!a)break;if(o in a)a=a[o];else{if(Array.isArray(a.value))break;a=void 0;break}}if(!a)return ml(`Active uniform ${s.name} has not been supplied`);if(a&&a.value===void 0)return ml(`${s.name} uniform is missing a value parameter`);if(a.value.texture)return t=t+1,a.value.update(t),Ps(this.gl,s.type,r,t);if(a.value.length&&a.value[0].texture){const o=[];return a.value.forEach(l=>{t=t+1,l.update(t),o.push(t)}),Ps(this.gl,s.type,r,o)}Ps(this.gl,s.type,r,a.value)}),this.applyState(),e&&this.gl.renderer.setFrontFace(this.frontFace===this.gl.CCW?this.gl.CW:this.gl.CCW)}remove(){this.gl.deleteProgram(this.program)}}function Ps(i,e,t,n){n=n.length?Ng(n):n;const r=i.renderer.state.uniformLocations.get(t);if(n.length)if(r===void 0||r.length!==n.length)i.renderer.state.uniformLocations.set(t,n.slice(0));else{if(Og(r,n))return;r.set?r.set(n):Bg(r,n),i.renderer.state.uniformLocations.set(t,r)}else{if(r===n)return;i.renderer.state.uniformLocations.set(t,n)}switch(e){case 5126:return n.length?i.uniform1fv(t,n):i.uniform1f(t,n);case 35664:return i.uniform2fv(t,n);case 35665:return i.uniform3fv(t,n);case 35666:return i.uniform4fv(t,n);case 35670:case 5124:case 35678:case 36306:case 35680:case 36289:return n.length?i.uniform1iv(t,n):i.uniform1i(t,n);case 35671:case 35667:return i.uniform2iv(t,n);case 35672:case 35668:return i.uniform3iv(t,n);case 35673:case 35669:return i.uniform4iv(t,n);case 35674:return i.uniformMatrix2fv(t,!1,n);case 35675:return i.uniformMatrix3fv(t,!1,n);case 35676:return i.uniformMatrix4fv(t,!1,n)}}function pl(i){let e=i.split(`
|
|
4519
|
+
`);for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join(`
|
|
4520
|
+
`)}function Ng(i){const e=i.length,t=i[0].length;if(t===void 0)return i;const n=e*t;let r=fl[n];r||(fl[n]=r=new Float32Array(n));for(let s=0;s<e;s++)r.set(i[s],s*t);return r}function Og(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function Bg(i,e){for(let t=0,n=i.length;t<n;t++)i[t]=e[t]}let Ls=0;function ml(i){Ls>100||(console.warn(i),Ls++,Ls>100&&console.warn("More than 100 program warnings - stopping logs."))}const Fs=new kt;let zg=1;class kg{constructor({canvas:e=document.createElement("canvas"),width:t=300,height:n=150,dpr:r=1,alpha:s=!1,depth:a=!0,stencil:o=!1,antialias:l=!1,premultipliedAlpha:c=!1,preserveDrawingBuffer:u=!1,powerPreference:d="default",autoClear:h=!0,webgl:f=2}={}){const g={alpha:s,depth:a,stencil:o,antialias:l,premultipliedAlpha:c,preserveDrawingBuffer:u,powerPreference:d};this.dpr=r,this.alpha=s,this.color=!0,this.depth=a,this.stencil=o,this.premultipliedAlpha=c,this.autoClear=h,this.id=zg++,f===2&&(this.gl=e.getContext("webgl2",g)),this.isWebgl2=!!this.gl,this.gl||(this.gl=e.getContext("webgl",g)),this.gl||console.error("unable to create webgl context"),this.gl.renderer=this,this.setSize(t,n),this.state={},this.state.blendFunc={src:this.gl.ONE,dst:this.gl.ZERO},this.state.blendEquation={modeRGB:this.gl.FUNC_ADD},this.state.cullFace=!1,this.state.frontFace=this.gl.CCW,this.state.depthMask=!0,this.state.depthFunc=this.gl.LEQUAL,this.state.premultiplyAlpha=!1,this.state.flipY=!1,this.state.unpackAlignment=4,this.state.framebuffer=null,this.state.viewport={x:0,y:0,width:null,height:null},this.state.textureUnits=[],this.state.activeTextureUnit=0,this.state.boundBuffer=null,this.state.uniformLocations=new Map,this.state.currentProgram=null,this.extensions={},this.isWebgl2?(this.getExtension("EXT_color_buffer_float"),this.getExtension("OES_texture_float_linear")):(this.getExtension("OES_texture_float"),this.getExtension("OES_texture_float_linear"),this.getExtension("OES_texture_half_float"),this.getExtension("OES_texture_half_float_linear"),this.getExtension("OES_element_index_uint"),this.getExtension("OES_standard_derivatives"),this.getExtension("EXT_sRGB"),this.getExtension("WEBGL_depth_texture"),this.getExtension("WEBGL_draw_buffers")),this.getExtension("WEBGL_compressed_texture_astc"),this.getExtension("EXT_texture_compression_bptc"),this.getExtension("WEBGL_compressed_texture_s3tc"),this.getExtension("WEBGL_compressed_texture_etc1"),this.getExtension("WEBGL_compressed_texture_pvrtc"),this.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),this.vertexAttribDivisor=this.getExtension("ANGLE_instanced_arrays","vertexAttribDivisor","vertexAttribDivisorANGLE"),this.drawArraysInstanced=this.getExtension("ANGLE_instanced_arrays","drawArraysInstanced","drawArraysInstancedANGLE"),this.drawElementsInstanced=this.getExtension("ANGLE_instanced_arrays","drawElementsInstanced","drawElementsInstancedANGLE"),this.createVertexArray=this.getExtension("OES_vertex_array_object","createVertexArray","createVertexArrayOES"),this.bindVertexArray=this.getExtension("OES_vertex_array_object","bindVertexArray","bindVertexArrayOES"),this.deleteVertexArray=this.getExtension("OES_vertex_array_object","deleteVertexArray","deleteVertexArrayOES"),this.drawBuffers=this.getExtension("WEBGL_draw_buffers","drawBuffers","drawBuffersWEBGL"),this.parameters={},this.parameters.maxTextureUnits=this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),this.parameters.maxAnisotropy=this.getExtension("EXT_texture_filter_anisotropic")?this.gl.getParameter(this.getExtension("EXT_texture_filter_anisotropic").MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}setSize(e,t){this.width=e,this.height=t,this.gl.canvas.width=e*this.dpr,this.gl.canvas.height=t*this.dpr,this.gl.canvas.style&&Object.assign(this.gl.canvas.style,{width:e+"px",height:t+"px"})}setViewport(e,t,n=0,r=0){this.state.viewport.width===e&&this.state.viewport.height===t||(this.state.viewport.width=e,this.state.viewport.height=t,this.state.viewport.x=n,this.state.viewport.y=r,this.gl.viewport(n,r,e,t))}setScissor(e,t,n=0,r=0){this.gl.scissor(n,r,e,t)}enable(e){this.state[e]!==!0&&(this.gl.enable(e),this.state[e]=!0)}disable(e){this.state[e]!==!1&&(this.gl.disable(e),this.state[e]=!1)}setBlendFunc(e,t,n,r){this.state.blendFunc.src===e&&this.state.blendFunc.dst===t&&this.state.blendFunc.srcAlpha===n&&this.state.blendFunc.dstAlpha===r||(this.state.blendFunc.src=e,this.state.blendFunc.dst=t,this.state.blendFunc.srcAlpha=n,this.state.blendFunc.dstAlpha=r,n!==void 0?this.gl.blendFuncSeparate(e,t,n,r):this.gl.blendFunc(e,t))}setBlendEquation(e,t){e=e||this.gl.FUNC_ADD,!(this.state.blendEquation.modeRGB===e&&this.state.blendEquation.modeAlpha===t)&&(this.state.blendEquation.modeRGB=e,this.state.blendEquation.modeAlpha=t,t!==void 0?this.gl.blendEquationSeparate(e,t):this.gl.blendEquation(e))}setCullFace(e){this.state.cullFace!==e&&(this.state.cullFace=e,this.gl.cullFace(e))}setFrontFace(e){this.state.frontFace!==e&&(this.state.frontFace=e,this.gl.frontFace(e))}setDepthMask(e){this.state.depthMask!==e&&(this.state.depthMask=e,this.gl.depthMask(e))}setDepthFunc(e){this.state.depthFunc!==e&&(this.state.depthFunc=e,this.gl.depthFunc(e))}setStencilMask(e){this.state.stencilMask!==e&&(this.state.stencilMask=e,this.gl.stencilMask(e))}setStencilFunc(e,t,n){this.state.stencilFunc===e&&this.state.stencilRef===t&&this.state.stencilFuncMask===n||(this.state.stencilFunc=e||this.gl.ALWAYS,this.state.stencilRef=t||0,this.state.stencilFuncMask=n||0,this.gl.stencilFunc(e||this.gl.ALWAYS,t||0,n||0))}setStencilOp(e,t,n){this.state.stencilFail===e&&this.state.stencilDepthFail===t&&this.state.stencilDepthPass===n||(this.state.stencilFail=e,this.state.stencilDepthFail=t,this.state.stencilDepthPass=n,this.gl.stencilOp(e,t,n))}activeTexture(e){this.state.activeTextureUnit!==e&&(this.state.activeTextureUnit=e,this.gl.activeTexture(this.gl.TEXTURE0+e))}bindFramebuffer({target:e=this.gl.FRAMEBUFFER,buffer:t=null}={}){this.state.framebuffer!==t&&(this.state.framebuffer=t,this.gl.bindFramebuffer(e,t))}getExtension(e,t,n){return t&&this.gl[t]?this.gl[t].bind(this.gl):(this.extensions[e]||(this.extensions[e]=this.gl.getExtension(e)),t?this.extensions[e]?this.extensions[e][n].bind(this.extensions[e]):null:this.extensions[e])}sortOpaque(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program.id!==t.program.id?e.program.id-t.program.id:e.zDepth!==t.zDepth?e.zDepth-t.zDepth:t.id-e.id}sortTransparent(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.zDepth!==t.zDepth?t.zDepth-e.zDepth:t.id-e.id}sortUI(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program.id!==t.program.id?e.program.id-t.program.id:t.id-e.id}getRenderList({scene:e,camera:t,frustumCull:n,sort:r}){let s=[];if(t&&n&&t.updateFrustum(),e.traverse(a=>{if(!a.visible)return!0;a.draw&&(n&&a.frustumCulled&&t&&!t.frustumIntersectsMesh(a)||s.push(a))}),r){const a=[],o=[],l=[];s.forEach(c=>{c.program.transparent?c.program.depthTest?o.push(c):l.push(c):a.push(c),c.zDepth=0,!(c.renderOrder!==0||!c.program.depthTest||!t)&&(c.worldMatrix.getTranslation(Fs),Fs.applyMatrix4(t.projectionViewMatrix),c.zDepth=Fs.z)}),a.sort(this.sortOpaque),o.sort(this.sortTransparent),l.sort(this.sortUI),s=a.concat(o,l)}return s}render({scene:e,camera:t,target:n=null,update:r=!0,sort:s=!0,frustumCull:a=!0,clear:o}){n===null?(this.bindFramebuffer(),this.setViewport(this.width*this.dpr,this.height*this.dpr)):(this.bindFramebuffer(n),this.setViewport(n.width,n.height)),(o||this.autoClear&&o!==!1)&&(this.depth&&(!n||n.depth)&&(this.enable(this.gl.DEPTH_TEST),this.setDepthMask(!0)),(this.stencil||!n||n.stencil)&&(this.enable(this.gl.STENCIL_TEST),this.setStencilMask(255)),this.gl.clear((this.color?this.gl.COLOR_BUFFER_BIT:0)|(this.depth?this.gl.DEPTH_BUFFER_BIT:0)|(this.stencil?this.gl.STENCIL_BUFFER_BIT:0))),r&&e.updateMatrixWorld(),t&&t.updateMatrixWorld(),this.getRenderList({scene:e,camera:t,frustumCull:a,sort:s}).forEach(c=>{c.draw({camera:t})})}}function Hg(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i}function Vg(i,e,t,n,r){return i[0]=e,i[1]=t,i[2]=n,i[3]=r,i}function Gg(i,e){let t=e[0],n=e[1],r=e[2],s=e[3],a=t*t+n*n+r*r+s*s;return a>0&&(a=1/Math.sqrt(a)),i[0]=t*a,i[1]=n*a,i[2]=r*a,i[3]=s*a,i}function Wg(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]}function Xg(i){return i[0]=0,i[1]=0,i[2]=0,i[3]=1,i}function qg(i,e,t){t=t*.5;let n=Math.sin(t);return i[0]=n*e[0],i[1]=n*e[1],i[2]=n*e[2],i[3]=Math.cos(t),i}function gl(i,e,t){let n=e[0],r=e[1],s=e[2],a=e[3],o=t[0],l=t[1],c=t[2],u=t[3];return i[0]=n*u+a*o+r*c-s*l,i[1]=r*u+a*l+s*o-n*c,i[2]=s*u+a*c+n*l-r*o,i[3]=a*u-n*o-r*l-s*c,i}function Yg(i,e,t){t*=.5;let n=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(t),l=Math.cos(t);return i[0]=n*l+a*o,i[1]=r*l+s*o,i[2]=s*l-r*o,i[3]=a*l-n*o,i}function $g(i,e,t){t*=.5;let n=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(t),l=Math.cos(t);return i[0]=n*l-s*o,i[1]=r*l+a*o,i[2]=s*l+n*o,i[3]=a*l-r*o,i}function jg(i,e,t){t*=.5;let n=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(t),l=Math.cos(t);return i[0]=n*l+r*o,i[1]=r*l-n*o,i[2]=s*l+a*o,i[3]=a*l-s*o,i}function Kg(i,e,t,n){let r=e[0],s=e[1],a=e[2],o=e[3],l=t[0],c=t[1],u=t[2],d=t[3],h,f,g,_,m;return f=r*l+s*c+a*u+o*d,f<0&&(f=-f,l=-l,c=-c,u=-u,d=-d),1-f>1e-6?(h=Math.acos(f),g=Math.sin(h),_=Math.sin((1-n)*h)/g,m=Math.sin(n*h)/g):(_=1-n,m=n),i[0]=_*r+m*l,i[1]=_*s+m*c,i[2]=_*a+m*u,i[3]=_*o+m*d,i}function Zg(i,e){let t=e[0],n=e[1],r=e[2],s=e[3],a=t*t+n*n+r*r+s*s,o=a?1/a:0;return i[0]=-t*o,i[1]=-n*o,i[2]=-r*o,i[3]=s*o,i}function Jg(i,e){return i[0]=-e[0],i[1]=-e[1],i[2]=-e[2],i[3]=e[3],i}function Qg(i,e){let t=e[0]+e[4]+e[8],n;if(t>0)n=Math.sqrt(t+1),i[3]=.5*n,n=.5/n,i[0]=(e[5]-e[7])*n,i[1]=(e[6]-e[2])*n,i[2]=(e[1]-e[3])*n;else{let r=0;e[4]>e[0]&&(r=1),e[8]>e[r*3+r]&&(r=2);let s=(r+1)%3,a=(r+2)%3;n=Math.sqrt(e[r*3+r]-e[s*3+s]-e[a*3+a]+1),i[r]=.5*n,n=.5/n,i[3]=(e[s*3+a]-e[a*3+s])*n,i[s]=(e[s*3+r]+e[r*3+s])*n,i[a]=(e[a*3+r]+e[r*3+a])*n}return i}function e_(i,e,t="YXZ"){let n=Math.sin(e[0]*.5),r=Math.cos(e[0]*.5),s=Math.sin(e[1]*.5),a=Math.cos(e[1]*.5),o=Math.sin(e[2]*.5),l=Math.cos(e[2]*.5);return t==="XYZ"?(i[0]=n*a*l+r*s*o,i[1]=r*s*l-n*a*o,i[2]=r*a*o+n*s*l,i[3]=r*a*l-n*s*o):t==="YXZ"?(i[0]=n*a*l+r*s*o,i[1]=r*s*l-n*a*o,i[2]=r*a*o-n*s*l,i[3]=r*a*l+n*s*o):t==="ZXY"?(i[0]=n*a*l-r*s*o,i[1]=r*s*l+n*a*o,i[2]=r*a*o+n*s*l,i[3]=r*a*l-n*s*o):t==="ZYX"?(i[0]=n*a*l-r*s*o,i[1]=r*s*l+n*a*o,i[2]=r*a*o-n*s*l,i[3]=r*a*l+n*s*o):t==="YZX"?(i[0]=n*a*l+r*s*o,i[1]=r*s*l+n*a*o,i[2]=r*a*o-n*s*l,i[3]=r*a*l-n*s*o):t==="XZY"&&(i[0]=n*a*l-r*s*o,i[1]=r*s*l-n*a*o,i[2]=r*a*o+n*s*l,i[3]=r*a*l+n*s*o),i}const t_=Hg,n_=Vg,i_=Wg,r_=Gg;class s_ extends Array{constructor(e=0,t=0,n=0,r=1){super(e,t,n,r),this.onChange=()=>{},this._target=this;const s=["0","1","2","3"];return new Proxy(this,{set(a,o){const l=Reflect.set(...arguments);return l&&s.includes(o)&&a.onChange(),l}})}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}get w(){return this[3]}set x(e){this._target[0]=e,this.onChange()}set y(e){this._target[1]=e,this.onChange()}set z(e){this._target[2]=e,this.onChange()}set w(e){this._target[3]=e,this.onChange()}identity(){return Xg(this._target),this.onChange(),this}set(e,t,n,r){return e.length?this.copy(e):(n_(this._target,e,t,n,r),this.onChange(),this)}rotateX(e){return Yg(this._target,this._target,e),this.onChange(),this}rotateY(e){return $g(this._target,this._target,e),this.onChange(),this}rotateZ(e){return jg(this._target,this._target,e),this.onChange(),this}inverse(e=this._target){return Zg(this._target,e),this.onChange(),this}conjugate(e=this._target){return Jg(this._target,e),this.onChange(),this}copy(e){return t_(this._target,e),this.onChange(),this}normalize(e=this._target){return r_(this._target,e),this.onChange(),this}multiply(e,t){return t?gl(this._target,e,t):gl(this._target,this._target,e),this.onChange(),this}dot(e){return i_(this._target,e)}fromMatrix3(e){return Qg(this._target,e),this.onChange(),this}fromEuler(e,t){return e_(this._target,e,e.order),t||this.onChange(),this}fromAxisAngle(e,t){return qg(this._target,e,t),this.onChange(),this}slerp(e,t){return Kg(this._target,this._target,e,t),this.onChange(),this}fromArray(e,t=0){return this._target[0]=e[t],this._target[1]=e[t+1],this._target[2]=e[t+2],this._target[3]=e[t+3],this.onChange(),this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e[t+3]=this[3],e}}const a_=1e-6;function o_(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i}function l_(i,e,t,n,r,s,a,o,l,c,u,d,h,f,g,_,m){return i[0]=e,i[1]=t,i[2]=n,i[3]=r,i[4]=s,i[5]=a,i[6]=o,i[7]=l,i[8]=c,i[9]=u,i[10]=d,i[11]=h,i[12]=f,i[13]=g,i[14]=_,i[15]=m,i}function c_(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function u_(i,e){let t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],d=e[9],h=e[10],f=e[11],g=e[12],_=e[13],m=e[14],p=e[15],E=t*o-n*a,v=t*l-r*a,b=t*c-s*a,R=n*l-r*o,T=n*c-s*o,A=r*c-s*l,P=u*_-d*g,y=u*m-h*g,M=u*p-f*g,F=d*m-h*_,L=d*p-f*_,C=h*p-f*m,U=E*C-v*L+b*F+R*M-T*y+A*P;return U?(U=1/U,i[0]=(o*C-l*L+c*F)*U,i[1]=(r*L-n*C-s*F)*U,i[2]=(_*A-m*T+p*R)*U,i[3]=(h*T-d*A-f*R)*U,i[4]=(l*M-a*C-c*y)*U,i[5]=(t*C-r*M+s*y)*U,i[6]=(m*b-g*A-p*v)*U,i[7]=(u*A-h*b+f*v)*U,i[8]=(a*L-o*M+c*P)*U,i[9]=(n*M-t*L-s*P)*U,i[10]=(g*T-_*b+p*E)*U,i[11]=(d*b-u*T-f*E)*U,i[12]=(o*y-a*F-l*P)*U,i[13]=(t*F-n*y+r*P)*U,i[14]=(_*v-g*R-m*E)*U,i[15]=(u*R-d*v+h*E)*U,i):null}function bc(i){let e=i[0],t=i[1],n=i[2],r=i[3],s=i[4],a=i[5],o=i[6],l=i[7],c=i[8],u=i[9],d=i[10],h=i[11],f=i[12],g=i[13],_=i[14],m=i[15],p=e*a-t*s,E=e*o-n*s,v=e*l-r*s,b=t*o-n*a,R=t*l-r*a,T=n*l-r*o,A=c*g-u*f,P=c*_-d*f,y=c*m-h*f,M=u*_-d*g,F=u*m-h*g,L=d*m-h*_;return p*L-E*F+v*M+b*y-R*P+T*A}function _l(i,e,t){let n=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6],u=e[7],d=e[8],h=e[9],f=e[10],g=e[11],_=e[12],m=e[13],p=e[14],E=e[15],v=t[0],b=t[1],R=t[2],T=t[3];return i[0]=v*n+b*o+R*d+T*_,i[1]=v*r+b*l+R*h+T*m,i[2]=v*s+b*c+R*f+T*p,i[3]=v*a+b*u+R*g+T*E,v=t[4],b=t[5],R=t[6],T=t[7],i[4]=v*n+b*o+R*d+T*_,i[5]=v*r+b*l+R*h+T*m,i[6]=v*s+b*c+R*f+T*p,i[7]=v*a+b*u+R*g+T*E,v=t[8],b=t[9],R=t[10],T=t[11],i[8]=v*n+b*o+R*d+T*_,i[9]=v*r+b*l+R*h+T*m,i[10]=v*s+b*c+R*f+T*p,i[11]=v*a+b*u+R*g+T*E,v=t[12],b=t[13],R=t[14],T=t[15],i[12]=v*n+b*o+R*d+T*_,i[13]=v*r+b*l+R*h+T*m,i[14]=v*s+b*c+R*f+T*p,i[15]=v*a+b*u+R*g+T*E,i}function h_(i,e,t){let n=t[0],r=t[1],s=t[2],a,o,l,c,u,d,h,f,g,_,m,p;return e===i?(i[12]=e[0]*n+e[4]*r+e[8]*s+e[12],i[13]=e[1]*n+e[5]*r+e[9]*s+e[13],i[14]=e[2]*n+e[6]*r+e[10]*s+e[14],i[15]=e[3]*n+e[7]*r+e[11]*s+e[15]):(a=e[0],o=e[1],l=e[2],c=e[3],u=e[4],d=e[5],h=e[6],f=e[7],g=e[8],_=e[9],m=e[10],p=e[11],i[0]=a,i[1]=o,i[2]=l,i[3]=c,i[4]=u,i[5]=d,i[6]=h,i[7]=f,i[8]=g,i[9]=_,i[10]=m,i[11]=p,i[12]=a*n+u*r+g*s+e[12],i[13]=o*n+d*r+_*s+e[13],i[14]=l*n+h*r+m*s+e[14],i[15]=c*n+f*r+p*s+e[15]),i}function d_(i,e,t){let n=t[0],r=t[1],s=t[2];return i[0]=e[0]*n,i[1]=e[1]*n,i[2]=e[2]*n,i[3]=e[3]*n,i[4]=e[4]*r,i[5]=e[5]*r,i[6]=e[6]*r,i[7]=e[7]*r,i[8]=e[8]*s,i[9]=e[9]*s,i[10]=e[10]*s,i[11]=e[11]*s,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i}function f_(i,e,t,n){let r=n[0],s=n[1],a=n[2],o=Math.hypot(r,s,a),l,c,u,d,h,f,g,_,m,p,E,v,b,R,T,A,P,y,M,F,L,C,U,H;return Math.abs(o)<a_?null:(o=1/o,r*=o,s*=o,a*=o,l=Math.sin(t),c=Math.cos(t),u=1-c,d=e[0],h=e[1],f=e[2],g=e[3],_=e[4],m=e[5],p=e[6],E=e[7],v=e[8],b=e[9],R=e[10],T=e[11],A=r*r*u+c,P=s*r*u+a*l,y=a*r*u-s*l,M=r*s*u-a*l,F=s*s*u+c,L=a*s*u+r*l,C=r*a*u+s*l,U=s*a*u-r*l,H=a*a*u+c,i[0]=d*A+_*P+v*y,i[1]=h*A+m*P+b*y,i[2]=f*A+p*P+R*y,i[3]=g*A+E*P+T*y,i[4]=d*M+_*F+v*L,i[5]=h*M+m*F+b*L,i[6]=f*M+p*F+R*L,i[7]=g*M+E*F+T*L,i[8]=d*C+_*U+v*H,i[9]=h*C+m*U+b*H,i[10]=f*C+p*U+R*H,i[11]=g*C+E*U+T*H,e!==i&&(i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i)}function p_(i,e){return i[0]=e[12],i[1]=e[13],i[2]=e[14],i}function Tc(i,e){let t=e[0],n=e[1],r=e[2],s=e[4],a=e[5],o=e[6],l=e[8],c=e[9],u=e[10];return i[0]=Math.hypot(t,n,r),i[1]=Math.hypot(s,a,o),i[2]=Math.hypot(l,c,u),i}function m_(i){let e=i[0],t=i[1],n=i[2],r=i[4],s=i[5],a=i[6],o=i[8],l=i[9],c=i[10];const u=e*e+t*t+n*n,d=r*r+s*s+a*a,h=o*o+l*l+c*c;return Math.sqrt(Math.max(u,d,h))}const Dc=(function(){const i=[1,1,1];return function(e,t){let n=i;Tc(n,t);let r=1/n[0],s=1/n[1],a=1/n[2],o=t[0]*r,l=t[1]*s,c=t[2]*a,u=t[4]*r,d=t[5]*s,h=t[6]*a,f=t[8]*r,g=t[9]*s,_=t[10]*a,m=o+d+_,p=0;return m>0?(p=Math.sqrt(m+1)*2,e[3]=.25*p,e[0]=(h-g)/p,e[1]=(f-c)/p,e[2]=(l-u)/p):o>d&&o>_?(p=Math.sqrt(1+o-d-_)*2,e[3]=(h-g)/p,e[0]=.25*p,e[1]=(l+u)/p,e[2]=(f+c)/p):d>_?(p=Math.sqrt(1+d-o-_)*2,e[3]=(f-c)/p,e[0]=(l+u)/p,e[1]=.25*p,e[2]=(h+g)/p):(p=Math.sqrt(1+_-o-d)*2,e[3]=(l-u)/p,e[0]=(f+c)/p,e[1]=(h+g)/p,e[2]=.25*p),e}})();function g_(i,e,t,n){let r=Ii([i[0],i[1],i[2]]);const s=Ii([i[4],i[5],i[6]]),a=Ii([i[8],i[9],i[10]]);bc(i)<0&&(r=-r),t[0]=i[12],t[1]=i[13],t[2]=i[14];const l=i.slice(),c=1/r,u=1/s,d=1/a;l[0]*=c,l[1]*=c,l[2]*=c,l[4]*=u,l[5]*=u,l[6]*=u,l[8]*=d,l[9]*=d,l[10]*=d,Dc(e,l),n[0]=r,n[1]=s,n[2]=a}function __(i,e,t,n){const r=i,s=e[0],a=e[1],o=e[2],l=e[3],c=s+s,u=a+a,d=o+o,h=s*c,f=s*u,g=s*d,_=a*u,m=a*d,p=o*d,E=l*c,v=l*u,b=l*d,R=n[0],T=n[1],A=n[2];return r[0]=(1-(_+p))*R,r[1]=(f+b)*R,r[2]=(g-v)*R,r[3]=0,r[4]=(f-b)*T,r[5]=(1-(h+p))*T,r[6]=(m+E)*T,r[7]=0,r[8]=(g+v)*A,r[9]=(m-E)*A,r[10]=(1-(h+_))*A,r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}function x_(i,e){let t=e[0],n=e[1],r=e[2],s=e[3],a=t+t,o=n+n,l=r+r,c=t*a,u=n*a,d=n*o,h=r*a,f=r*o,g=r*l,_=s*a,m=s*o,p=s*l;return i[0]=1-d-g,i[1]=u+p,i[2]=h-m,i[3]=0,i[4]=u-p,i[5]=1-c-g,i[6]=f+_,i[7]=0,i[8]=h+m,i[9]=f-_,i[10]=1-c-d,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function v_(i,e,t,n,r){let s=1/Math.tan(e/2),a=1/(n-r);return i[0]=s/t,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=s,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=(r+n)*a,i[11]=-1,i[12]=0,i[13]=0,i[14]=2*r*n*a,i[15]=0,i}function M_(i,e,t,n,r,s,a){let o=1/(e-t),l=1/(n-r),c=1/(s-a);return i[0]=-2*o,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*l,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*c,i[11]=0,i[12]=(e+t)*o,i[13]=(r+n)*l,i[14]=(a+s)*c,i[15]=1,i}function S_(i,e,t,n){let r=e[0],s=e[1],a=e[2],o=n[0],l=n[1],c=n[2],u=r-t[0],d=s-t[1],h=a-t[2],f=u*u+d*d+h*h;f===0?h=1:(f=1/Math.sqrt(f),u*=f,d*=f,h*=f);let g=l*h-c*d,_=c*u-o*h,m=o*d-l*u;return f=g*g+_*_+m*m,f===0&&(c?o+=1e-6:l?c+=1e-6:l+=1e-6,g=l*h-c*d,_=c*u-o*h,m=o*d-l*u,f=g*g+_*_+m*m),f=1/Math.sqrt(f),g*=f,_*=f,m*=f,i[0]=g,i[1]=_,i[2]=m,i[3]=0,i[4]=d*m-h*_,i[5]=h*g-u*m,i[6]=u*_-d*g,i[7]=0,i[8]=u,i[9]=d,i[10]=h,i[11]=0,i[12]=r,i[13]=s,i[14]=a,i[15]=1,i}function xl(i,e,t){return i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i[3]=e[3]+t[3],i[4]=e[4]+t[4],i[5]=e[5]+t[5],i[6]=e[6]+t[6],i[7]=e[7]+t[7],i[8]=e[8]+t[8],i[9]=e[9]+t[9],i[10]=e[10]+t[10],i[11]=e[11]+t[11],i[12]=e[12]+t[12],i[13]=e[13]+t[13],i[14]=e[14]+t[14],i[15]=e[15]+t[15],i}function vl(i,e,t){return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i[3]=e[3]-t[3],i[4]=e[4]-t[4],i[5]=e[5]-t[5],i[6]=e[6]-t[6],i[7]=e[7]-t[7],i[8]=e[8]-t[8],i[9]=e[9]-t[9],i[10]=e[10]-t[10],i[11]=e[11]-t[11],i[12]=e[12]-t[12],i[13]=e[13]-t[13],i[14]=e[14]-t[14],i[15]=e[15]-t[15],i}function y_(i,e,t){return i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i[3]=e[3]*t,i[4]=e[4]*t,i[5]=e[5]*t,i[6]=e[6]*t,i[7]=e[7]*t,i[8]=e[8]*t,i[9]=e[9]*t,i[10]=e[10]*t,i[11]=e[11]*t,i[12]=e[12]*t,i[13]=e[13]*t,i[14]=e[14]*t,i[15]=e[15]*t,i}class Ir extends Array{constructor(e=1,t=0,n=0,r=0,s=0,a=1,o=0,l=0,c=0,u=0,d=1,h=0,f=0,g=0,_=0,m=1){return super(e,t,n,r,s,a,o,l,c,u,d,h,f,g,_,m),this}get x(){return this[12]}get y(){return this[13]}get z(){return this[14]}get w(){return this[15]}set x(e){this[12]=e}set y(e){this[13]=e}set z(e){this[14]=e}set w(e){this[15]=e}set(e,t,n,r,s,a,o,l,c,u,d,h,f,g,_,m){return e.length?this.copy(e):(l_(this,e,t,n,r,s,a,o,l,c,u,d,h,f,g,_,m),this)}translate(e,t=this){return h_(this,t,e),this}rotate(e,t,n=this){return f_(this,n,e,t),this}scale(e,t=this){return d_(this,t,typeof e=="number"?[e,e,e]:e),this}add(e,t){return t?xl(this,e,t):xl(this,this,e),this}sub(e,t){return t?vl(this,e,t):vl(this,this,e),this}multiply(e,t){return e.length?t?_l(this,e,t):_l(this,this,e):y_(this,this,e),this}identity(){return c_(this),this}copy(e){return o_(this,e),this}fromPerspective({fov:e,aspect:t,near:n,far:r}={}){return v_(this,e,t,n,r),this}fromOrthogonal({left:e,right:t,bottom:n,top:r,near:s,far:a}){return M_(this,e,t,n,r,s,a),this}fromQuaternion(e){return x_(this,e),this}setPosition(e){return this.x=e[0],this.y=e[1],this.z=e[2],this}inverse(e=this){return u_(this,e),this}compose(e,t,n){return __(this,e,t,n),this}decompose(e,t,n){return g_(this,e,t,n),this}getRotation(e){return Dc(e,this),this}getTranslation(e){return p_(e,this),this}getScaling(e){return Tc(e,this),this}getMaxScaleOnAxis(){return m_(this)}lookAt(e,t,n){return S_(this,e,t,n),this}determinant(){return bc(this)}fromArray(e,t=0){return this[0]=e[t],this[1]=e[t+1],this[2]=e[t+2],this[3]=e[t+3],this[4]=e[t+4],this[5]=e[t+5],this[6]=e[t+6],this[7]=e[t+7],this[8]=e[t+8],this[9]=e[t+9],this[10]=e[t+10],this[11]=e[t+11],this[12]=e[t+12],this[13]=e[t+13],this[14]=e[t+14],this[15]=e[t+15],this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e[t+3]=this[3],e[t+4]=this[4],e[t+5]=this[5],e[t+6]=this[6],e[t+7]=this[7],e[t+8]=this[8],e[t+9]=this[9],e[t+10]=this[10],e[t+11]=this[11],e[t+12]=this[12],e[t+13]=this[13],e[t+14]=this[14],e[t+15]=this[15],e}}function E_(i,e,t="YXZ"){return t==="XYZ"?(i[1]=Math.asin(Math.min(Math.max(e[8],-1),1)),Math.abs(e[8])<.99999?(i[0]=Math.atan2(-e[9],e[10]),i[2]=Math.atan2(-e[4],e[0])):(i[0]=Math.atan2(e[6],e[5]),i[2]=0)):t==="YXZ"?(i[0]=Math.asin(-Math.min(Math.max(e[9],-1),1)),Math.abs(e[9])<.99999?(i[1]=Math.atan2(e[8],e[10]),i[2]=Math.atan2(e[1],e[5])):(i[1]=Math.atan2(-e[2],e[0]),i[2]=0)):t==="ZXY"?(i[0]=Math.asin(Math.min(Math.max(e[6],-1),1)),Math.abs(e[6])<.99999?(i[1]=Math.atan2(-e[2],e[10]),i[2]=Math.atan2(-e[4],e[5])):(i[1]=0,i[2]=Math.atan2(e[1],e[0]))):t==="ZYX"?(i[1]=Math.asin(-Math.min(Math.max(e[2],-1),1)),Math.abs(e[2])<.99999?(i[0]=Math.atan2(e[6],e[10]),i[2]=Math.atan2(e[1],e[0])):(i[0]=0,i[2]=Math.atan2(-e[4],e[5]))):t==="YZX"?(i[2]=Math.asin(Math.min(Math.max(e[1],-1),1)),Math.abs(e[1])<.99999?(i[0]=Math.atan2(-e[9],e[5]),i[1]=Math.atan2(-e[2],e[0])):(i[0]=0,i[1]=Math.atan2(e[8],e[10]))):t==="XZY"&&(i[2]=Math.asin(-Math.min(Math.max(e[4],-1),1)),Math.abs(e[4])<.99999?(i[0]=Math.atan2(e[6],e[5]),i[1]=Math.atan2(e[8],e[0])):(i[0]=Math.atan2(-e[9],e[10]),i[1]=0)),i}const Ml=new Ir;class b_ extends Array{constructor(e=0,t=e,n=e,r="YXZ"){super(e,t,n),this.order=r,this.onChange=()=>{},this._target=this;const s=["0","1","2"];return new Proxy(this,{set(a,o){const l=Reflect.set(...arguments);return l&&s.includes(o)&&a.onChange(),l}})}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(e){this._target[0]=e,this.onChange()}set y(e){this._target[1]=e,this.onChange()}set z(e){this._target[2]=e,this.onChange()}set(e,t=e,n=e){return e.length?this.copy(e):(this._target[0]=e,this._target[1]=t,this._target[2]=n,this.onChange(),this)}copy(e){return this._target[0]=e[0],this._target[1]=e[1],this._target[2]=e[2],this.onChange(),this}reorder(e){return this._target.order=e,this.onChange(),this}fromRotationMatrix(e,t=this.order){return E_(this._target,e,t),this.onChange(),this}fromQuaternion(e,t=this.order,n){return Ml.fromQuaternion(e),this._target.fromRotationMatrix(Ml,t),n||this.onChange(),this}fromArray(e,t=0){return this._target[0]=e[t],this._target[1]=e[t+1],this._target[2]=e[t+2],this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e}}class T_{constructor(){this.parent=null,this.children=[],this.visible=!0,this.matrix=new Ir,this.worldMatrix=new Ir,this.matrixAutoUpdate=!0,this.worldMatrixNeedsUpdate=!1,this.position=new kt,this.quaternion=new s_,this.scale=new kt(1),this.rotation=new b_,this.up=new kt(0,1,0),this.rotation._target.onChange=()=>this.quaternion.fromEuler(this.rotation,!0),this.quaternion._target.onChange=()=>this.rotation.fromQuaternion(this.quaternion,void 0,!0)}setParent(e,t=!0){this.parent&&e!==this.parent&&this.parent.removeChild(this,!1),this.parent=e,t&&e&&e.addChild(this,!1)}addChild(e,t=!0){~this.children.indexOf(e)||this.children.push(e),t&&e.setParent(this,!1)}removeChild(e,t=!0){~this.children.indexOf(e)&&this.children.splice(this.children.indexOf(e),1),t&&e.setParent(null,!1)}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.worldMatrixNeedsUpdate||e)&&(this.parent===null?this.worldMatrix.copy(this.matrix):this.worldMatrix.multiply(this.parent.worldMatrix,this.matrix),this.worldMatrixNeedsUpdate=!1,e=!0);for(let t=0,n=this.children.length;t<n;t++)this.children[t].updateMatrixWorld(e)}updateMatrix(){this.matrix.compose(this.quaternion,this.position,this.scale),this.worldMatrixNeedsUpdate=!0}traverse(e){if(!e(this))for(let t=0,n=this.children.length;t<n;t++)this.children[t].traverse(e)}decompose(){this.matrix.decompose(this.quaternion._target,this.position,this.scale),this.rotation.fromQuaternion(this.quaternion)}lookAt(e,t=!1){t?this.matrix.lookAt(this.position,e,this.up):this.matrix.lookAt(e,this.position,this.up),this.matrix.getRotation(this.quaternion._target),this.rotation.fromQuaternion(this.quaternion)}}function D_(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[4],i[4]=e[5],i[5]=e[6],i[6]=e[8],i[7]=e[9],i[8]=e[10],i}function A_(i,e){let t=e[0],n=e[1],r=e[2],s=e[3],a=t+t,o=n+n,l=r+r,c=t*a,u=n*a,d=n*o,h=r*a,f=r*o,g=r*l,_=s*a,m=s*o,p=s*l;return i[0]=1-d-g,i[3]=u-p,i[6]=h+m,i[1]=u+p,i[4]=1-c-g,i[7]=f-_,i[2]=h-m,i[5]=f+_,i[8]=1-c-d,i}function w_(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i}function C_(i,e,t,n,r,s,a,o,l,c){return i[0]=e,i[1]=t,i[2]=n,i[3]=r,i[4]=s,i[5]=a,i[6]=o,i[7]=l,i[8]=c,i}function R_(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=1,i[5]=0,i[6]=0,i[7]=0,i[8]=1,i}function P_(i,e){let t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],d=u*a-o*c,h=-u*s+o*l,f=c*s-a*l,g=t*d+n*h+r*f;return g?(g=1/g,i[0]=d*g,i[1]=(-u*n+r*c)*g,i[2]=(o*n-r*a)*g,i[3]=h*g,i[4]=(u*t-r*l)*g,i[5]=(-o*t+r*s)*g,i[6]=f*g,i[7]=(-c*t+n*l)*g,i[8]=(a*t-n*s)*g,i):null}function Sl(i,e,t){let n=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6],u=e[7],d=e[8],h=t[0],f=t[1],g=t[2],_=t[3],m=t[4],p=t[5],E=t[6],v=t[7],b=t[8];return i[0]=h*n+f*a+g*c,i[1]=h*r+f*o+g*u,i[2]=h*s+f*l+g*d,i[3]=_*n+m*a+p*c,i[4]=_*r+m*o+p*u,i[5]=_*s+m*l+p*d,i[6]=E*n+v*a+b*c,i[7]=E*r+v*o+b*u,i[8]=E*s+v*l+b*d,i}function L_(i,e,t){let n=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6],u=e[7],d=e[8],h=t[0],f=t[1];return i[0]=n,i[1]=r,i[2]=s,i[3]=a,i[4]=o,i[5]=l,i[6]=h*n+f*a+c,i[7]=h*r+f*o+u,i[8]=h*s+f*l+d,i}function F_(i,e,t){let n=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6],u=e[7],d=e[8],h=Math.sin(t),f=Math.cos(t);return i[0]=f*n+h*a,i[1]=f*r+h*o,i[2]=f*s+h*l,i[3]=f*a-h*n,i[4]=f*o-h*r,i[5]=f*l-h*s,i[6]=c,i[7]=u,i[8]=d,i}function I_(i,e,t){let n=t[0],r=t[1];return i[0]=n*e[0],i[1]=n*e[1],i[2]=n*e[2],i[3]=r*e[3],i[4]=r*e[4],i[5]=r*e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i}function U_(i,e){let t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],d=e[9],h=e[10],f=e[11],g=e[12],_=e[13],m=e[14],p=e[15],E=t*o-n*a,v=t*l-r*a,b=t*c-s*a,R=n*l-r*o,T=n*c-s*o,A=r*c-s*l,P=u*_-d*g,y=u*m-h*g,M=u*p-f*g,F=d*m-h*_,L=d*p-f*_,C=h*p-f*m,U=E*C-v*L+b*F+R*M-T*y+A*P;return U?(U=1/U,i[0]=(o*C-l*L+c*F)*U,i[1]=(l*M-a*C-c*y)*U,i[2]=(a*L-o*M+c*P)*U,i[3]=(r*L-n*C-s*F)*U,i[4]=(t*C-r*M+s*y)*U,i[5]=(n*M-t*L-s*P)*U,i[6]=(_*A-m*T+p*R)*U,i[7]=(m*b-g*A-p*v)*U,i[8]=(g*T-_*b+p*E)*U,i):null}class N_ extends Array{constructor(e=1,t=0,n=0,r=0,s=1,a=0,o=0,l=0,c=1){return super(e,t,n,r,s,a,o,l,c),this}set(e,t,n,r,s,a,o,l,c){return e.length?this.copy(e):(C_(this,e,t,n,r,s,a,o,l,c),this)}translate(e,t=this){return L_(this,t,e),this}rotate(e,t=this){return F_(this,t,e),this}scale(e,t=this){return I_(this,t,e),this}multiply(e,t){return t?Sl(this,e,t):Sl(this,this,e),this}identity(){return R_(this),this}copy(e){return w_(this,e),this}fromMatrix4(e){return D_(this,e),this}fromQuaternion(e){return A_(this,e),this}fromBasis(e,t,n){return this.set(e[0],e[1],e[2],t[0],t[1],t[2],n[0],n[1],n[2]),this}inverse(e=this){return P_(this,e),this}getNormalMatrix(e){return U_(this,e),this}}let O_=0;class B_ extends T_{constructor(e,{geometry:t,program:n,mode:r=e.TRIANGLES,frustumCulled:s=!0,renderOrder:a=0}={}){super(),e.canvas||console.error("gl not passed as first argument to Mesh"),this.gl=e,this.id=O_++,this.geometry=t,this.program=n,this.mode=r,this.frustumCulled=s,this.renderOrder=a,this.modelViewMatrix=new Ir,this.normalMatrix=new N_,this.beforeRenderCallbacks=[],this.afterRenderCallbacks=[]}onBeforeRender(e){return this.beforeRenderCallbacks.push(e),this}onAfterRender(e){return this.afterRenderCallbacks.push(e),this}draw({camera:e}={}){e&&(this.program.uniforms.modelMatrix||Object.assign(this.program.uniforms,{modelMatrix:{value:null},viewMatrix:{value:null},modelViewMatrix:{value:null},normalMatrix:{value:null},projectionMatrix:{value:null},cameraPosition:{value:null}}),this.program.uniforms.projectionMatrix.value=e.projectionMatrix,this.program.uniforms.cameraPosition.value=e.worldPosition,this.program.uniforms.viewMatrix.value=e.viewMatrix,this.modelViewMatrix.multiply(e.viewMatrix,this.worldMatrix),this.normalMatrix.getNormalMatrix(this.modelViewMatrix),this.program.uniforms.modelMatrix.value=this.worldMatrix,this.program.uniforms.modelViewMatrix.value=this.modelViewMatrix,this.program.uniforms.normalMatrix.value=this.normalMatrix),this.beforeRenderCallbacks.forEach(n=>n&&n({mesh:this,camera:e}));let t=this.program.cullFace&&this.worldMatrix.determinant()<0;this.program.use({flipFaces:t}),this.geometry.draw({mode:this.mode,program:this.program}),this.afterRenderCallbacks.forEach(n=>n&&n({mesh:this,camera:e}))}}const yl={black:"#000000",white:"#ffffff",red:"#ff0000",green:"#00ff00",blue:"#0000ff",fuchsia:"#ff00ff",cyan:"#00ffff",yellow:"#ffff00",orange:"#ff8000"};function El(i){i.length===4&&(i=i[0]+i[1]+i[1]+i[2]+i[2]+i[3]+i[3]);const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);return e||console.warn(`Unable to convert hex string ${i} to rgb values`),[parseInt(e[1],16)/255,parseInt(e[2],16)/255,parseInt(e[3],16)/255]}function z_(i){return i=parseInt(i),[(i>>16&255)/255,(i>>8&255)/255,(i&255)/255]}function bl(i){return i===void 0?[0,0,0]:arguments.length===3?arguments:isNaN(i)?i[0]==="#"?El(i):yl[i.toLowerCase()]?El(yl[i.toLowerCase()]):(console.warn("Color format not recognised"),[0,0,0]):z_(i)}class Tl extends Array{constructor(e){return Array.isArray(e)?super(...e):super(...bl(...arguments))}get r(){return this[0]}get g(){return this[1]}get b(){return this[2]}set r(e){this[0]=e}set g(e){this[1]=e}set b(e){this[2]=e}set(e){return Array.isArray(e)?this.copy(e):this.copy(bl(...arguments))}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this}}class k_ extends Fg{constructor(e,{attributes:t={}}={}){Object.assign(t,{position:{size:2,data:new Float32Array([-1,-1,3,-1,-1,3])},uv:{size:2,data:new Float32Array([0,0,2,0,0,2])}}),super(e,t)}}const H_=`#version 300 es
|
|
4521
|
+
in vec2 position;
|
|
4522
|
+
void main() {
|
|
4523
|
+
gl_Position = vec4(position, 0.0, 1.0);
|
|
4524
|
+
}
|
|
4525
|
+
`,V_=`#version 300 es
|
|
4526
|
+
precision highp float;
|
|
4527
|
+
|
|
4528
|
+
uniform float uTime;
|
|
4529
|
+
uniform float uAmplitude;
|
|
4530
|
+
uniform vec3 uColorStops[3];
|
|
4531
|
+
uniform vec2 uResolution;
|
|
4532
|
+
uniform float uBlend;
|
|
4533
|
+
|
|
4534
|
+
out vec4 fragColor;
|
|
4535
|
+
|
|
4536
|
+
vec3 permute(vec3 x) {
|
|
4537
|
+
return mod(((x * 34.0) + 1.0) * x, 289.0);
|
|
4538
|
+
}
|
|
4539
|
+
|
|
4540
|
+
float snoise(vec2 v){
|
|
4541
|
+
const vec4 C = vec4(
|
|
4542
|
+
0.211324865405187, 0.366025403784439,
|
|
4543
|
+
-0.577350269189626, 0.024390243902439
|
|
4544
|
+
);
|
|
4545
|
+
vec2 i = floor(v + dot(v, C.yy));
|
|
4546
|
+
vec2 x0 = v - i + dot(i, C.xx);
|
|
4547
|
+
vec2 i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
|
|
4548
|
+
vec4 x12 = x0.xyxy + C.xxzz;
|
|
4549
|
+
x12.xy -= i1;
|
|
4550
|
+
i = mod(i, 289.0);
|
|
4551
|
+
|
|
4552
|
+
vec3 p = permute(
|
|
4553
|
+
permute(i.y + vec3(0.0, i1.y, 1.0))
|
|
4554
|
+
+ i.x + vec3(0.0, i1.x, 1.0)
|
|
4555
|
+
);
|
|
4556
|
+
|
|
4557
|
+
vec3 m = max(
|
|
4558
|
+
0.5 - vec3(
|
|
4559
|
+
dot(x0, x0),
|
|
4560
|
+
dot(x12.xy, x12.xy),
|
|
4561
|
+
dot(x12.zw, x12.zw)
|
|
4562
|
+
),
|
|
4563
|
+
0.0
|
|
4564
|
+
);
|
|
4565
|
+
m = m * m;
|
|
4566
|
+
m = m * m;
|
|
4567
|
+
|
|
4568
|
+
vec3 x = 2.0 * fract(p * C.www) - 1.0;
|
|
4569
|
+
vec3 h = abs(x) - 0.5;
|
|
4570
|
+
vec3 ox = floor(x + 0.5);
|
|
4571
|
+
vec3 a0 = x - ox;
|
|
4572
|
+
m *= 1.79284291400159 - 0.85373472095314 * (a0*a0 + h*h);
|
|
4573
|
+
|
|
4574
|
+
vec3 g;
|
|
4575
|
+
g.x = a0.x * x0.x + h.x * x0.y;
|
|
4576
|
+
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
|
4577
|
+
return 130.0 * dot(m, g);
|
|
4578
|
+
}
|
|
4579
|
+
|
|
4580
|
+
struct ColorStop {
|
|
4581
|
+
vec3 color;
|
|
4582
|
+
float position;
|
|
4583
|
+
};
|
|
4584
|
+
|
|
4585
|
+
#define COLOR_RAMP(colors, factor, finalColor) { int index = 0; for (int i = 0; i < 2; i++) { ColorStop currentColor = colors[i]; bool isInBetween = currentColor.position <= factor; index = int(mix(float(index), float(i), float(isInBetween))); } ColorStop currentColor = colors[index]; ColorStop nextColor = colors[index + 1]; float range = nextColor.position - currentColor.position; float lerpFactor = (factor - currentColor.position) / range; finalColor = mix(currentColor.color, nextColor.color, lerpFactor); }
|
|
4586
|
+
|
|
4587
|
+
void main() {
|
|
4588
|
+
vec2 uv = gl_FragCoord.xy / uResolution;
|
|
4589
|
+
|
|
4590
|
+
ColorStop colors[3];
|
|
4591
|
+
colors[0] = ColorStop(uColorStops[0], 0.0);
|
|
4592
|
+
colors[1] = ColorStop(uColorStops[1], 0.5);
|
|
4593
|
+
colors[2] = ColorStop(uColorStops[2], 1.0);
|
|
4594
|
+
|
|
4595
|
+
vec3 rampColor;
|
|
4596
|
+
COLOR_RAMP(colors, uv.x, rampColor);
|
|
4597
|
+
|
|
4598
|
+
float height = snoise(vec2(uv.x * 2.0 + uTime * 0.1, uTime * 0.25)) * 0.5 * uAmplitude;
|
|
4599
|
+
height = exp(height);
|
|
4600
|
+
height = (uv.y * 2.0 - height + 0.2);
|
|
4601
|
+
float intensity = 0.6 * height;
|
|
4602
|
+
|
|
4603
|
+
float midPoint = 0.20;
|
|
4604
|
+
float auroraAlpha = smoothstep(midPoint - uBlend * 0.5, midPoint + uBlend * 0.5, intensity);
|
|
4605
|
+
|
|
4606
|
+
vec3 auroraColor = intensity * rampColor;
|
|
4607
|
+
|
|
4608
|
+
fragColor = vec4(auroraColor * auroraAlpha, auroraAlpha);
|
|
4609
|
+
}
|
|
4610
|
+
`,G_=({colorStops:i=["#5227FF","#7cff67","#5227FF"],amplitude:e=1,blend:t=.5,speed:n=1,className:r=""})=>{const s=de.useRef({colorStops:i,amplitude:e,blend:t,speed:n});s.current={colorStops:i,amplitude:e,blend:t,speed:n};const a=de.useRef(null);return de.useEffect(()=>{const o=a.current;if(!o)return;const l=new kg({alpha:!0,premultipliedAlpha:!0,antialias:!0}),c=l.gl;c.clearColor(0,0,0,0),c.enable(c.BLEND),c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA),c.canvas.style.backgroundColor="transparent";let u;function d(){if(!o)return;const p=o.offsetWidth,E=o.offsetHeight;l.setSize(p,E),u&&(u.uniforms.uResolution.value=[p,E])}window.addEventListener("resize",d);const h=new k_(c);h.attributes.uv&&delete h.attributes.uv;const f=i.map(p=>{const E=new Tl(p);return[E.r,E.g,E.b]});u=new Ug(c,{vertex:H_,fragment:V_,uniforms:{uTime:{value:0},uAmplitude:{value:e},uColorStops:{value:f},uResolution:{value:[o.offsetWidth,o.offsetHeight]},uBlend:{value:t}}});const g=new B_(c,{geometry:h,program:u});o.appendChild(c.canvas);let _=0;const m=p=>{_=requestAnimationFrame(m);const{speed:E=1,amplitude:v,blend:b,colorStops:R}=s.current;u.uniforms.uTime.value=p*.001*E*.1,u.uniforms.uAmplitude.value=v??1,u.uniforms.uBlend.value=b??.5;const T=R??i;u.uniforms.uColorStops.value=T.map(A=>{const P=new Tl(A);return[P.r,P.g,P.b]}),l.render({scene:g})};return _=requestAnimationFrame(m),d(),()=>{cancelAnimationFrame(_),window.removeEventListener("resize",d),o&&c.canvas.parentNode===o&&o.removeChild(c.canvas),c.getExtension("WEBGL_lose_context")?.loseContext()}},[]),oe.jsx("div",{ref:a,className:`w-full h-full ${r}`})},W_=`
|
|
4611
|
+
attribute vec2 position;
|
|
4612
|
+
void main() {
|
|
4613
|
+
gl_Position = vec4(position, 0.0, 1.0);
|
|
4614
|
+
}
|
|
4615
|
+
`,X_=`
|
|
4616
|
+
precision highp float;
|
|
4617
|
+
|
|
4618
|
+
uniform float uTime;
|
|
4619
|
+
uniform vec2 uResolution;
|
|
4620
|
+
uniform vec3 uColors[5];
|
|
4621
|
+
uniform int uColorCount;
|
|
4622
|
+
uniform float uSpeed;
|
|
4623
|
+
uniform bool uWireframe;
|
|
4624
|
+
|
|
4625
|
+
// Hash function for pseudo-random
|
|
4626
|
+
float hash(vec2 p) {
|
|
4627
|
+
return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);
|
|
4628
|
+
}
|
|
4629
|
+
|
|
4630
|
+
// Smooth noise
|
|
4631
|
+
float noise(vec2 p) {
|
|
4632
|
+
vec2 i = floor(p);
|
|
4633
|
+
vec2 f = fract(p);
|
|
4634
|
+
f = f * f * (3.0 - 2.0 * f);
|
|
4635
|
+
|
|
4636
|
+
float a = hash(i);
|
|
4637
|
+
float b = hash(i + vec2(1.0, 0.0));
|
|
4638
|
+
float c = hash(i + vec2(0.0, 1.0));
|
|
4639
|
+
float d = hash(i + vec2(1.0, 1.0));
|
|
4640
|
+
|
|
4641
|
+
return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);
|
|
4642
|
+
}
|
|
4643
|
+
|
|
4644
|
+
// Fractal Brownian Motion
|
|
4645
|
+
float fbm(vec2 p) {
|
|
4646
|
+
float value = 0.0;
|
|
4647
|
+
float amplitude = 0.5;
|
|
4648
|
+
float frequency = 1.0;
|
|
4649
|
+
|
|
4650
|
+
for(int i = 0; i < 3; i++) {
|
|
4651
|
+
value += amplitude * noise(p * frequency);
|
|
4652
|
+
frequency *= 1.8;
|
|
4653
|
+
amplitude *= 0.5;
|
|
4654
|
+
}
|
|
4655
|
+
return value;
|
|
4656
|
+
}
|
|
4657
|
+
|
|
4658
|
+
void main() {
|
|
4659
|
+
vec2 uv = gl_FragCoord.xy / uResolution;
|
|
4660
|
+
|
|
4661
|
+
// Animate the noise - 降低缩放让渐变更大
|
|
4662
|
+
vec2 p = uv * 1.5;
|
|
4663
|
+
float t = uTime * uSpeed * 0.1;
|
|
4664
|
+
|
|
4665
|
+
p += vec2(fbm(p + t), fbm(p - t)) * 0.5;
|
|
4666
|
+
|
|
4667
|
+
// Multiple noise layers for complexity - 调整频率让过渡更平滑
|
|
4668
|
+
float n1 = fbm(p + t * 0.5);
|
|
4669
|
+
float n2 = fbm(p * 1.2 - t * 0.3);
|
|
4670
|
+
float n3 = fbm(p * 0.9 + t * 0.7);
|
|
4671
|
+
|
|
4672
|
+
// Combine noise layers
|
|
4673
|
+
float pattern = (n1 + n2 + n3) / 3.0;
|
|
4674
|
+
|
|
4675
|
+
// Map pattern to color gradient
|
|
4676
|
+
vec3 color = vec3(0.0);
|
|
4677
|
+
|
|
4678
|
+
if (uColorCount >= 2) {
|
|
4679
|
+
float step = 1.0 / float(uColorCount - 1);
|
|
4680
|
+
for(int i = 0; i < 4; i++) {
|
|
4681
|
+
if (i >= uColorCount - 1) break;
|
|
4682
|
+
|
|
4683
|
+
float pos1 = float(i) * step;
|
|
4684
|
+
float pos2 = float(i + 1) * step;
|
|
4685
|
+
|
|
4686
|
+
if (pattern >= pos1 && pattern <= pos2) {
|
|
4687
|
+
float t = (pattern - pos1) / (pos2 - pos1);
|
|
4688
|
+
color = mix(uColors[i], uColors[i + 1], t);
|
|
4689
|
+
break;
|
|
4690
|
+
}
|
|
4691
|
+
}
|
|
4692
|
+
} else if (uColorCount == 1) {
|
|
4693
|
+
color = uColors[0];
|
|
4694
|
+
}
|
|
4695
|
+
|
|
4696
|
+
// Wireframe effect - 降低网格密度
|
|
4697
|
+
if (uWireframe) {
|
|
4698
|
+
float grid = 0.5 + 0.5 * sin(uv.x * 30.0 + t) * sin(uv.y * 30.0 + t);
|
|
4699
|
+
vec2 gridPos = fract(uv * 12.0 + vec2(t * 0.1, t * 0.05));
|
|
4700
|
+
float gridLine = step(0.92, max(gridPos.x, gridPos.y)) * grid;
|
|
4701
|
+
color = mix(color * 0.3, color, gridLine);
|
|
4702
|
+
}
|
|
4703
|
+
|
|
4704
|
+
gl_FragColor = vec4(color, 1.0);
|
|
4705
|
+
}
|
|
4706
|
+
`,q_=({colors:i=["#e0d7ff","#bae6fd","#7dd3fc","#f5d0fe","#e879f9"],speed:e=.3,backgroundColor:t="#f8f9ff",wireframe:n=!1,className:r=""})=>{const s=de.useRef(null),a=de.useRef({colors:i,speed:e,wireframe:n});return a.current={colors:i,speed:e,wireframe:n},de.useEffect(()=>{const o=s.current;if(!o)return;const l=o.getContext("webgl",{alpha:!0,premultipliedAlpha:!1,antialias:!0});if(!l){console.error("WebGL not supported");return}function c(F,L){const C=l.createShader(F);return l.shaderSource(C,L),l.compileShader(C),l.getShaderParameter(C,l.COMPILE_STATUS)?C:(console.error("Shader compile error:",l.getShaderInfoLog(C)),l.deleteShader(C),null)}const u=c(l.VERTEX_SHADER,W_),d=c(l.FRAGMENT_SHADER,X_),h=l.createProgram();if(l.attachShader(h,u),l.attachShader(h,d),l.linkProgram(h),!l.getProgramParameter(h,l.LINK_STATUS)){console.error("Program link error:",l.getProgramInfoLog(h));return}l.useProgram(h);const f=new Float32Array([-1,-1,1,-1,-1,1,1,1]),g=l.createBuffer();l.bindBuffer(l.ARRAY_BUFFER,g),l.bufferData(l.ARRAY_BUFFER,f,l.STATIC_DRAW);const _=l.getAttribLocation(h,"position");l.enableVertexAttribArray(_),l.vertexAttribPointer(_,2,l.FLOAT,!1,0,0);const m=l.getUniformLocation(h,"uTime"),p=l.getUniformLocation(h,"uResolution"),E=l.getUniformLocation(h,"uColors"),v=l.getUniformLocation(h,"uColorCount"),b=l.getUniformLocation(h,"uSpeed"),R=l.getUniformLocation(h,"uWireframe");function T(F){const L=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(F);return L?[parseInt(L[1],16)/255,parseInt(L[2],16)/255,parseInt(L[3],16)/255]:[0,0,0]}function A(){const F=o.clientWidth,L=o.clientHeight;(o.width!==F||o.height!==L)&&(o.width=F,o.height=L,l.viewport(0,0,F,L))}let P;function y(F){P=requestAnimationFrame(y),A();const{colors:L,speed:C,wireframe:U}=a.current,H=[],Y=Math.min(L.length,5);for(let J=0;J<5;J++)if(J<L.length){const z=T(L[J]);H.push(...z)}else H.push(0,0,0);l.uniform1f(m,F*.001),l.uniform2f(p,o.width,o.height),l.uniform3fv(E,H),l.uniform1i(v,Y),l.uniform1f(b,C),l.uniform1i(R,U?1:0),l.drawArrays(l.TRIANGLE_STRIP,0,4)}A(),P=requestAnimationFrame(y);const M=new ResizeObserver(()=>{A()});return M.observe(o),()=>{cancelAnimationFrame(P),M.disconnect(),l.deleteProgram(h),l.deleteShader(u),l.deleteShader(d),l.deleteBuffer(g)}},[]),oe.jsx("canvas",{ref:s,className:`w-full h-full ${r}`,style:{backgroundColor:t}})};function aa(...i){return i.filter(Boolean).join(" ")}exports.Aurora=G_;exports.BlackHole=rg;exports.BlurText=Vc;exports.CircularText=Wc;exports.ElectricBorder=dg;exports.FallingPattern=nu;exports.FlowingDashedBox=tu;exports.Gallery3D=cg;exports.LiquidMetalButton=pg;exports.MeshGradient=q_;exports.MetalButton=sg;exports.PixelCard=lg;exports.ScrambledText=eu;exports.ScrollCards3D=fg;exports.ShinyText=iu;exports.SquareLoader=mg;exports.Tunnel3D=ug;exports.cn=aa;
|
|
4515
4707
|
//# sourceMappingURL=index.cjs.map
|